text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
29 January 2009 19:45 [Source: ICIS news] SAN FRANCISCO (ICIS news)--?xml:namespace> Banning individual chemicals and materials is unproductive, said Maureen Gorsen, director of the California Department of Toxic Substances. She spoke at the InformexUSA conference. Chemical bans represent the second wave of the environmental movement, which tried to control hazardous materials, Gorsen said. The first wave started a century ago with the conservation movement. The third wave would involve producing chemicals that are safe, Gorsen said. Demand for safe products is growing, as more attention is given to toxins in consumer products, Gorsen said. “The media has been doing a drum roll on this.” As it stands, the state needs to move beyond bans, she said. The bans do little to alter design of products made overseas. “People are beginning to realise that this is not going to work,” she said. The state needs regulations that create things instead of banning them.
http://www.icis.com/Articles/2009/01/29/9188569/california-should-encourage-safer-chems---agency-director.html
CC-MAIN-2013-48
refinedweb
155
58.58
getlogin, getlogin_r, cuserid − get username #include <unistd.h> char *getlogin(void); int getlogin_r(char *buf, size_t bufsize); #include <stdio.h> char *cuserid(char *string); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getlogin_r(): _REENTRANT || _POSIX_C_SOURCE >= 199506L cuserid(): _XOPEN_SOURCE. getlogin() returns a pointer to the username when successful, and NULL on failure, with errno set to indicate the cause of the error. getlogin_r() returns 0 when successful, and nonzero on failure. POSIX specifies Linux/glibc also has /etc/passwd password database file /var/run/utmp (traditionally /etc/utmp; some libc versions used /var/adm/utmp). getlogin() and getlogin_r() call those functions, so we use race:utent to remind users. getlogin() and getlogin_r() specified in POSIX.1-2001...(). geteuid(2), getuid(2), utmp(5) This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at−pages/.
http://man.linuxtool.net/centos7/u3/man/3_cuserid.html
CC-MAIN-2019-35
refinedweb
152
59.5
Hello: This is my first question and sadly it's more a complain. I'm new in Unity and looking some tutorials i found a particle system used for explosions called Legacy, i have the 4.0 version and i don't see it like in the tutorials (probably because they use 3.5 and/or previous version) but the options is there and i tried it using an empty object and add it as a component (ellipsoid, animator and rendered), animate it like the tutorials but doesn't show any particle, just some purple squares, plus, when i add a material to the ellipsoid particle system (to the empty or a prefab) like the default particle material, it show the particle but in a black square. I tried looking at the script as well, but i'm kinda new on that too. So, any help with that you can provide me? What just happened here? Deademon accepted my answer on behalf of Unidesky and now it's deleted? Answer by clunk47 · Sep 29, 2013 at 03:08 AM Just to make it easier, create a folder called "Editor" in your assets folder. This is something I came up with because I was tired of always needing to add all the components to an empty gameObject one at a time, then assigning a material in the inspector. This will create a "Resources" folder, and a material asset for later use. All you need to do is click on the new menu item "Custom > Add > Legacy Particle System", then add a texture to the material (only need to assign texture to material once, unless you delete the asset). Create a new C-Sharp script in this new editor folder and name it after the class here "LegacyParticleSystem", then simply paste my code in the script, then save. You may need to save your scene before the new menu item appears on the top bar. Note the shader of the custom material created in the Resources folder is "Particles/Alpha Blended Premultiply". using UnityEngine; using UnityEditor; using System.IO; using System.Collections; public class LegacyParticleSystem : MonoBehaviour { static Material mat; [MenuItem("Custom/Add/Legacy Particle System")] static void AddParticleSystem() { string matAsset = "Assets/Resources/Custom Assets/Legacy Particle Material.mat"; if(!Directory.Exists("Assets/Resources/Custom Assets")) Directory.CreateDirectory("Assets/Resources/Custom Assets"); GameObject ps = new GameObject("Particles"); string[] coms = new string[]{"EllipsoidParticleEmitter", "ParticleRenderer", "ParticleAnimator"}; if(Selection.activeTransform != null) ps.transform.position = Selection.activeTransform.position; foreach(string com in coms) ps.AddComponent(com); if(!File.Exists(matAsset)) { mat = new Material(Shader.Find ("Particles/Alpha Blended Premultiply")); AssetDatabase.CreateAsset(mat, matAsset); } ps.renderer.sharedMaterial = (Material)AssetDatabase.LoadAssetAtPath(matAsset, typeof(Material)); } } Answer by Eric5h5 · Dec 17, 2012 at 05:49 AM It works fine; you need a material with an appropriate texture and shader. Use one of the particle shaders. "It works fine; you need a material with an appropriate texture and shader. Use one of the particle shaders." Can you elaborate on this please? What would the steps be for a newbie to Unity 4.0 (or Unity in general) to create an object with the proper textures and shaders for the Legacy particle system? I've tried a few things and cannot get the Legacy stuff to work at all. Answer by Owen-Reynolds · Dec 17, 2012 at 04:11 PM There's a rule in making computer systems that if something is rare or experts only, you hide it a little so that beginners won't use it by mistake and get confused. The Legacy system works great, but new users had trouble with it, and Unity Answers wasn't helping (it seemed to be filling up with wrong info.) So, defacto, the Legacy system is "experts only" (but not really.) When Unity3D Corp made the new shuriken particleSsytem, I'm guessing they decided to hide the old one by removing the GameObject version of it, and forcing you to build it from parts. They wanted to make sure no new users mistakenly grabbed the old version and got even more confused than before. If you're an experienced user, you only have to build it once. Then you can make it a prefab for 1-step creation (or put in a package so you won't even have to build it for new Projects.) Ok so if it's hidden away, then where is it? The OP says how to get it: create an empty and add Effects->Legacy->ellipsiodEmitter, animator, renderer (all 3 in the same area.) Then you get purple squares. Then, as Eric5 writes, add a material to the renderer Ok I got that far, but I cant seem to be able to make each particle a mesh. Answer by DaveA · Dec 17, 2012 at 11:20 PM If your goal is to make nice explosions, forget about 'legacy' and grab the Detonator Pack. That's great stuff, you'll be blowing stuff up in minutes. Detonator pack is on the asset store? For what i understand, i'm a newbie on Unity, so i should learn to use Shuriken first and only, then i can go to Legacy, right? PLEASE use the 'comment' button to comment, NOT ANSWER Yes, it's free too. Legacy is, in my opinion, easier to use, but you have to build the system up a bit. Shuriken is more flexible and powerful, I think more difficult, but it generally works better for most things. If you've invested time in that tutorial, may as well keep at it, with the "Legacy" system. An example of how "hard" it is: if you want a random speed from 5 to 9, you have to set the base speed to 7 and the random +/- to 2. Answer by HappyMoo · Jan 16, 2014 at 07:04 AM (Reposting answer - mod must have deleted by accident) Unity 4 has a new particle system. The old still works though and also allows for more control with scripting. You can use the script discussed here to easily add them via menu: this is linking back to this very. 'enabled' is not a member of UnityEngine.Component 2 Answers Magnetic field Particle System 2 Answers How do I generate - IN CODE - a ParticleSystem for static particles? 1 Answer scale gameobject with particle system as child 0 Answers Blender hair to Unity 1 Answer
https://answers.unity.com/questions/365337/legacy-particle-system-doesnt-work-on-unity-40.html
CC-MAIN-2018-43
refinedweb
1,062
54.22
This is part of a series I started in March 2008 - you may want to go back and look at older parts if you're new to this series. Next up in my attempt to self-host parts of the parser, is Scanner#expect. This was no fun, and this part again recounts a long string of attempts at addressing relatively small annoying issues that will seem disjoint and probably confusing, but possibly useful in showing some of the debugging approaches. The immediate problem with Scanner#expect is this curious line: return Tokens::Keyword.expect(self, str) if str.is_a?(Symbol) It calls into Tokens::Keyword for no obvious reason. Because when we dig into Tokens::Keyword, we find that Tokens::Keyword.expect simply calls Atom.expect and compares the result with what it got passed in. So in our case, the only result of going that route, instead of falling through to the rest of Scanner#expect is basically to turn the expected string into a Symbol on returning it. Now, first of all, we don't need to call Tokens::Keyword.expect for that. I'm not quite sure why I did that. Secondly, the "proper" thing to do here is to just return a String anyway, or specifically a ScannerString, as that includes the position, allowing for better error reporting. The only place I find that depend on a specific value returned from expect is a line that uses ParserBase#expect with three symbols, which again call Scanner#expect with each in turn (I'm itching to optimize, but it's not for now), and uses that to determine what expression to return ( :if, :while, or :rescue nodes). But that piece of code actually calls #to_sym on the result... So, we're going to clean up Scanner#expect to simply call #to_s on objects that don't respond to #expect, and treat it as we do strings in f190425 : def expect(str,&block) return buf if str == "" return str.expect(self,&block) if str.respond_to?(:expect) - return Tokens::Keyword.expect(self, str) if str.is_a?(Symbol) + + str = str.to_s buf = ScannerString.new buf.position = self.position str.each_byte do |s| @@ -102,6 +103,7 @@ class Scanner end buf << get end + return buf end Firstly, our number of arguments check does not handle an explicit block argument as optional. Comment out that for now, and I get "Method missing: Symbol#==" when testing Scanner#expect by calling expect(:rescue). I've added one in 4292c34 - it's trivial, just comparing the string values This version is inefficient; part of the value of Symbol in Ruby is that it does not need to have the cost of String for comparisions, but it's functionally sufficient for now. A better way of handling it is to ensure Symbol objects are unique per symbol (so we can depend on just a pointer comparison), or at least obtain a unique id for any given string and compare that (which would be closer to how MRI is doing it); we'll revisit that again some day (not soon). Next up, I stub out String#is_a?, since Scanner#expect depends on it. I just make it return true, which will obviously cause problems later. We don't yet have exactly what we need to implement it properly. See 284d493 Then I ran into a segmentation fault. Some poking reveals several possible causes. One clear candidate is that String#initialize by default uses a null pointer, but that'd force us to check for null all over the place. And indeed, String#length doesn't. Rather than adding null checks all over, we fix String#initialize in 7b5805b. We also need to add something to String#reverse so what's returned is at a bare minimum a viable object. The obvious answer here would be to implement it, and we will, but first we should solve the reason this crashes: As it turns out, when we compile an empty array of expressions, we return junk: Whatever is in %eax. Thankfully this is trivial to fix the most obvious cases of. In Compiler#compile_do we do this (in c359ea7ca) : diff --git a/compiler.rb b/compiler.rb index 751c34b..dfcd253 100644 --- a/compiler.rb +++ b/compiler.rb @@ -649,6 +649,10 @@ class Compiler # Compiles a do-end block expression. def compile_do(scope, *exp) + if exp.length == 0 + exp = [:nil] + end + exp.each { |e| source=compile_eval_arg(scope, e); @e.save_result(source); } return Value.new([:subexpr]) end Great! Now we fail on NilClass#length due to the empty String#reverse. So lets add a basic version. Not the most inspired, nor most Ruby-ish implementation, but it has the benefit that it works with the current state of the compiler (in 9a363ee): diff --git a/lib/core/string.rb b/lib/core/string.rb index 0cbba12..d118d91 100644 --- a/lib/core/string.rb +++ b/lib/core/string.rb @@ -130,6 +130,16 @@ class String def reverse + buf = "" + l = length + if l == 0 + return + end + while (l > 0) + l = l - 1 + buf << self[l].chr + end + buf end The next error I ran into was this: WARNING: __send__ bypassing vtable (name not statically known at compile time) not yet implemented. WARNING: Method: '<6a5ffde) since we don't have support for method aliases (method aliases are actually quite straight forward to implement in this case: We 'just' need to update the vtable pointers; the only complication is that since this effectively means re-opening the class, it may have been sub-classed, in which case we need to update the sub-classes vtables as well; we'll deal with this properly once we "have to" deal with class re-opening). The scanner uses String.count(character) to count the number of instances of LF (ASCII 10) to determine how to adjust the line number. We don't care about this for now, so I just give it an argument that defaults to nil, and make it return 1 (in f41af6b) Now my test program runs all the way through, but it doesn't do much. The big deal is the missing String#each_byte which the Scanner class uses to check the stream against each byte in the expected string. We fill in a basic version like this (in b7879ee): diff --git a/lib/core/string.rb b/lib/core/string.rb index b89ae2c..51dba30 100644 --- a/lib/core/string.rb +++ b/lib/core/string.rb @@ -82,6 +82,13 @@ class String end def each_byte + i = 0 + len = length + while i < len + yield(self[i]) + i = i + 1 + end + self end Boom. Back to segmentation faults. The most obvious culprit is yield. Replacing the yield with __closure__.call(self[i]), using what should eventually be a "hidden" internal variable name for the block argument, we quickly run into a different error, but one that makes it clear that yield doesn't work. This is another unfortunate regression. As it turns out we can now reduce yield to this, though: # Yield to the supplied block def compile_yield(scope, args, block) @e.comment("yield") args ||= [] compile_callm(scope, :__closure__, :call, args, block) end But while this makes yield and __closure__.call() equivalent, it does not make it work with an argument. This is one of those little overcomplicated bits that badly needs to be re-thought. Basically, whenever we come across *rest in a method, we do a raw copy of it onto the stack for the call we expect to currently be preparing for. Except *rest can occur anywhere. And it can be used for things that does not refer to the argument list from the calling function. Except that will fail horribly. Basically this is a hack that is quickly overstaying its welcome. Particularly because the current solution is error prone. We'll give it this one last chance, before getting rid of it. There are two glaring problems with the current code: Firstly, it doesn't handle the case where there are no arguments properly. Secondly, I actually confused the parameters provided to the method/function being called, with the arguments provided to the method we're currently in. This has worked, sort of, as long as the methods have sufficiently similar signatures, which is why I haven't spotted it previously. I've fixed it like this (in 58c4373): diff --git a/splat.rb b/splat.rb index 65cf0f9..a7c1b46 100644 --- a/splat.rb +++ b/splat.rb @@ -20,7 +20,10 @@ class Compiler # (needs proper register allocation) @e.comment("*#{args.last.last.to_s}") reg = compile_eval_arg(scope,:numargs) - @e.subl(args.size-1,reg) + + # "reg" is set to numargs - (number of non-splat arguments to the *method we're in*) + m = scope.method + @e.subl(m.args.size-1,reg) @e.sall(2,reg) @e.subl(reg,@e.sp) The above is the critical bit that takes the correct argument length. And this changes the loop that copies, so that we jump to the end and do the check against the end condition first to handle the case of zero arguments to copy: @@ -32,16 +35,25 @@ class Compiler @e.with_register do |dest| @e.movl(@e.sp,dest) - l = @e.local + lc = @e.get_local + @e.jmp(lc) # So we can handle the zero argument case + + ls = @e.local @e.load_indirect(reg,@e.scratch) @e.save_indirect(@e.scratch,dest) @e.addl(4,@e.result) @e.addl(4,dest) + + @e.local(lc) # So we can jump straight to condition @e.cmpl(reg,argend) - @e.jne(l) + @e.jne(ls) + + # At this point, dest points to the position *after* the + # splat arguments. Subtracting the stack pointer, and shifting + # right twice gives us the number of splat arguments + @e.subl(@e.sp,dest) @e.sarl(2,dest) - @e.subl(1,dest) @e.movl(dest,@e.scratch) @e.comment("*#{args.last.last.to_s} end") The above also depends on some minor changes to the classes in scope.rb, which now have finally gotten a shared superclass. FuncScope have had a #method method that returns the Function object. The change introduced #method methods in all the scope classes, so that we can get at the method in question to figure out the argument length (in 58c4373 too) We also need to "fix" compile_call, as we're "abusing it" to implement yield, and it also needs to handle splats (we are long overdue a refactoring of compile_call and compile_callm, so we'll give that a gentle nudge by factoring out a tiny bit of code from it as well). Here is the change that includes invoking handle_splat (in 8b013ef15a): diff --git a/compiler.rb b/compiler.rb index d77bf08..f09da08 100644 --- a/compiler.rb +++ b/compiler.rb @@ -489,6 +489,15 @@ class Compiler end + # Push arguments onto the stack + def push_args(scope,args, offset = 0) + args.each_with_index do |a, i| + param = compile_eval_arg(scope, a) + @e.save_to_stack(param, i + offset) + end + end + + # Compiles a function call. # Takes the current scope, the function to call as well as the arguments # to call the function with. @@ -504,15 +513,17 @@ class Compiler args = [args] if !args.is_a?(Array) @e.caller_save do - @e.with_stack(args.length, true) do - args.each_with_index do |a, i| - param = compile_eval_arg(scope, a) - @e.save_to_stack(param, i) + handle_splat(scope, args) do |args,splat| + @e.comment("ARGS: #{args.inspect}; #{splat}") + @e.with_stack(args.length, !splat) do + @e.pushl(@e.scratch) + push_args(scope, args,1) + @e.popl(@e.scratch) + @e.call(compile_eval_arg(scope, func)) end - @e.movl(args.length, :ebx) - @e.call(compile_eval_arg(scope, func)) end end Yet more is needed to make this work properly, as we did not handle arguments to Proc#call previously. I will repeat the entirety of the "new" Proc here, as it's not very large. The main change is that instead of continuing to expand the __new_proc function, I've followed the approach taken in many of the other classes and added a #__set_raw method, with the intent of eventually preventing access to this method from regular Ruby. Other than that, the main difference, and the point of changing the class, is to make use of the fixed splat support to allow arguments, and at the same time attack another problem we'd run into shortly: self. The "old Proc executed the block with self bound to the instance of Proc itself, which does not work very well if the block tries to run methods on the object it was defind in. So now we pass in the value that should be bound to self as well. Also note the warning at the end of #call. This has a very good reason, which will be addressed in the next section. You can find this in 226e24f class Proc def initialize @addr = nil @env = nil @s = nil # self in block end # We do this here rather than allow it to be # set in initialize because we want to # eventually "seal" access to this method # away from regular Ruby code def __set_raw addr, env, s @addr = addr @env = env @s = s end def call *arg %s(call @addr (@s 0 @env (splat arg))) # WARNING: Do not do extra stuff here. If this is a 'proc'/bare block # code after the %s(call ...) above will not get executed. end end %s(defun __new_proc (addr env self) (let (p) (assign p (callm Proc new)) (callm p __set_raw (addr env self)) p )) There's also a minor change to transform.rb to ensure __new_proc is called with a self value to assign to the Proc object: diff --git a/transform.rb b/transform.rb index 22f3efb..406ca30 100644 --- a/transform.rb +++ b/transform.rb @@ -25,7 +25,7 @@ class Compiler E[:self,:__closure__,:__env__]+args, body] ] - e[2] = E[exp.position,:sexp, E[:call, :__new_proc, E[:__tmp_proc, :__env__]]] + e[2] = E[exp.position,:sexp, E[:call, :__new_proc, E[:__tmp_proc, :__env__, :self]]] end end end We have two minor little bits to add after this: Fixnum#! and String#ord which I've added in a93f95e. And then it's on to one more larger change before we're done: Ruby semantics is that a "return" from a block exits the method that calls the block. That doesn't currently work for us, because a block gets compiled into a C-style function that takes some extra arguments. A solution is to put the return address into the environment, and treat a return as a goto __env__.__return_address__ of sorts. Another complication is that when you use lambda to create Proc object, a return inside the block does seemingly not exit the defining method. But another way of seeing it, it that the return does exit Proc#call. This is a useful realisation, since for the time being at least, we've been creating Proc objects for simplicity. There are a few ways around this difference: Procobjects, so that the return address for "proper" Procobjects explicitly instantiated, or created via lambda, gets the following instruction in Proc#callset as its address for explicit returns. I'm sure there are other options too. One additional complication: If you return a block as a Proc, and it has a return inside, it will raise a LocalJumpError exception, so ideally we should be able to recognize this case, though we will defer that for later. We'll opt for storing what we need to return out of the defining scope on creation of the object. We'll also make a block act as the proc keyword (which we don't currently support). Note that there are additional complications: We're meant to nil out missing arguments, and ignore excess arguments rather than do strict argument checking as well. Those will have to wait. The approach chosen will absent additional work make things go badly haywire if we commit the sin of returning a Proc by returning a bare block / or Proc.new/ proc result (which we also doesn't support yet), since we can't yet detect it. First of all, we will add a new low level operation: :stackframe, which will return the contents of %ebp. By restoring %ebp to that of the defining method, we can do a normal leave then ret sequence, and the stack pointer will be correctly adjusted, and the return address of the next instruction in the containing method will be used. Conversely, for non- proc blocks, a normal return will still be done, resulting in a return to Proc#call, which will again just return out in the calling scope. Apart from adding it to @@keywords in Compiler, #compile_stackframe consists of just this (in e39ae721f48ed) : def compile_stackframe(scope) @e.comment("Stack frame") Value.new([:reg,:ebp]) end Above I've eluded to special handling of :return for :proc's. We do this in a new low level operation called :preturn that you can se below. In a little bit we'll then go through changes to transformations in transform.rb that rewrites :return nodes to :preturn as needed. But first #compile_preturn (still in e39ae721f48ed) : # "Special" return for `proc` and bare blocks # to exit past Proc#call. def compile_preturn(scope, arg = nil) @e.comment("preturn") @e.save_result(compile_eval_arg(scope, arg)) if arg @e.pushl(:eax) # We load the return address pre-saved in __stackframe__ on creation of the proc. # __stackframe__ is automatically added to __env__ in `rewrite_let_env` ret = compile_eval_arg(scope,[:index,:__env__,0]) @e.movl(ret,:ebp) @e.popl(:eax) @e.leave @e.ret @e.evict_all return Value.new([:subexpr]) end __stackframe__ here is hardcoded to offset 0 of __env__ which isn't particularly clean, but it works. So first we reload %ebp from what is effectively __env__[0], then we pop the return value off the stack, and do a normal return. Simple and fast. Here's our new #compile_proc... At the moment it's a pointless waste as it is pretty much identical to #compile_lambda. It will make more sense later, given the differences in how proc and lambda affect treatment of checking argument count etc. (e39ae721f48ed) # To compile `proc`, and anonymous blocks # See also #compile_lambda def compile_proc(scope, args=nil, body=nil) e = @e.get_local body ||= [] args ||= [] r = compile_defun(scope, e, [:self,:__closure__]+args,[:let,[]]+body) r end To make accessing captured variables (variables defined outside of the block, but used inside it) work with our recent typing, we need to define the contents of __env__ apart from the stack frame to be of type :object. To do this reasonably cleanly, we add a tiny #lookup_type method which for now is a bit of a hack, but that allow us to expand the type lookups later (e39ae721f48ed) : # For our limited typing we will in some cases need to do proper lookup. # For now, we just want to make %s(index __env__ xxx) mostly treated as # objects, in order to ensure that variables accesses that gets rewritten # to indirect via __env__ gets treated as object. The exception is # for now __env__[0] which contains a stackframe pointer used by # :preturn. def lookup_type(var, index = nil) (var == :__env__ && index != 0) ? :object : nil end For now this is only used in #compile_index: return Value.new([:indirect, r], lookup_type(arr,index)) The above is still not enough to use :preturn and :proc. For starters, in a number of places we now check for both :lambda an :proc nodes. Additionally, in the event we get a :proc, we call a new method to rewrite the body of the :proc to replace and :return nodes with :preturn: + if e[0] == :proc && body + body = rewrite_proc_return(body) + end #rewrite_proc_return looks like this: def rewrite_proc_return(exp) exp.depth_first do |e| next :skip if e[0] == :sexp if e[0] == :return e[0] = :preturn end end exp end And in #rewrite_let_env we add __stackframe__ to the __env__: # For "preturn". see Compiler#compile_preturn aenv = [:__stackframe__] + env.to_a env << :__stackframe__ In addition there are a few minor changes to correctly pick up variable references that were left out. Finally, in 927f173 I make a minor change to actually generate :proc nodes from bare blocks. I've not yet added support for the proc keyword itself, though that should be trivial. e535b77 contains a number of test case updates to cover some of the above changes, as well as a bug fix that caused a number of vasted lines special casing on single-argument function/method calls. It also contains some minor refactoring to start reducing the coupling of the shunting yard parser to the higher level Ruby parser (eventually I'd like to extract a useful generic component from it, but the separation is also intended to make the next step of self-hosting easier). You can find features/inputs/scanner6.rb in 36e3da5. This is the exact bastardized / cut down version of the scanner that compiles after the above changes. When run it tests #peek, #get, #unget and #expect (for some limited values of "tests" - many things will still not work). Compile and echo a suitable string in: $ ./compile features/inputs/scanner6.rb [...] $ echo "forescue" | /tmp/scanner6 Got: 102 (PEEK) Got: f (GET) Got: o (GET2) rescue f o o DONE The output from the scanner test code is hardly impressive for the amount of work put in so far, but more and more of the foundation is in place now, and as you can see from this part, apart from some hairy moments dealing with things like proc and yield, an increasing number of the fixes are a matter of small additions to our highly under-developed version of the Ruby standard library rather than gnarly low level compiler code. As a result I expect progress towards self-hosting to be faster for each coming part. There's certainly still plenty of gnarly low level compiler code left to do, such as re-opening of classes, proper handling of method-missing and send, as well as attr_accessor/reader/writer, define_method (again...), module, class methods and include. (I'm sure there are many more that I'm repressing too...), but even much of that should be simpler than what we've gone through over the last couple of parts. The next part too will be fairly messy, but then we'll have soother sailing for a few rounds as I'll be covering more focused features again.
https://hokstad.com/compiler/40-untangling-expect
CC-MAIN-2021-21
refinedweb
3,701
63.7
About Scopes Short description Explains the concept of scope in PowerShell and shows how to set and change the scope of elements. Long description PowerShell protects access to variables, aliases, functions, and PowerShell drives (PSDrives) by limiting where they can be read and changed. PowerShell uses scope rules to ensure that you do not inadvertently change an item that should not be changed. The following are the basic rules of scope: Scopes may nest. An outer scope is referred to as a parent scope. Any nested scopes are child scopes of that parent. An item is visible in the scope in which it was created and in any child scopes, unless you explicitly make it private. You can place variables, aliases, functions, or. PowerShell Scopes PowerShell supports the following scopes: Global: The scope that is in effect when PowerShell starts. Variables and functions that are present when PowerShell starts have been created in the global scope, such as automatic variables and preference variables. The variables, aliases, and functions in your PowerShell profiles are also created in the global scope.. Note Private is not a scope. It is an option that changes the visibility of an item outside of the scope where the item is defined. article. It includes all the variables that have the AllScope option, plus some automatic variables. A variable, alias, or function name can include any one of the following optional scope modifiers: nearest ancestor script file. using:- Used to access variables defined in another scope while running scripts via cmdlets like Start-Joband Invoke-Command. workflow:- Specifies that the name exists within a workflow. Note: Workflows are not supported in PowerShell Core. <variable-namespace>- A modifier created by a PowerShell PSDrive provider. For example: The default scope for scripts is the script scope. The default scope for functions and aliases is the local scope, even if they are defined in a script. Using scope modifiers To specify the scope of a new variable, alias, or function, use a scope modifier. The syntax for a scope modifier in a variable is: $[<scope-modifier>:]<name> = <value> The syntax for a scope modifier in a function is: function [<scope-modifier>:]<name> {<function-body>} The following command, which does not use a scope modifier, creates a variable in the current or local scope: $a = "one" To create the same variable in the global scope, use the scope global: modifier: $global:a = "one" To create the same variable in the script scope, use the script: scope modifier: $script:a = "one" You can also use a scope modifier. Without a modifier, PowerShell expects variables in remote commands to be defined in the remote session. The Using scope modifier is introduced in PowerShell 3.0.. For more information, see about_Remote_Variables. In thread sessions, they are passed by reference. This means it is possible to modify call scope variables in a different thread. To safely modify variables requires thread synchronization. For more information see: variables include global variables, variables in the parent scope, and variables. Note For the cmdlets that use the Scope parameter, you can also refer to scopes by number. The number describes the relative position of one scope to another. Scope 0 represents the current, or local, scope. Scope 1 indicates the immediate parent scope. Scope 2 indicates the parent of the parent scope, and so on. Numbered scopes are useful if you have created many recursive scopes. You can read more about the call operator in about_operators.. By default, modules are loaded into the top-level of the current session state not the current scope. The current session state could be a module session state or the global session state. Adding a module to a session does not change the scope. If you are in the global scope, then modules are loaded into the global session state. Any exports are placed into the global tables. If you load module2 from within module1, module2 is loaded into the session state of module1 not the global session state. Any exports from module2 are placed at the top of the module1 session state. If you use Import-Module -Scope local, then the exports are placed into the current scope object rather than at the top level. If you are in a module and use Import-Module -Scope global (or Import-Module -Global) to load another module, that module and it's exports are loaded into the global session state instead of the module's local session state. This feature was designed for writing module that manipulate modules. The WindowsCompatibility module does this to import proxy modules into the global session state. Within the session state, modules have their own scope. Consider the following module C:\temp\mod1.psm1: $a = "Hello" function foo { "`$a = $a" "`$global:a = $global:a" } Now we create a global variable $a, give it a value and call the function foo. $a = "Goodbye" foo The module declares the variable $a in the module scope then the function foo outputs the value of the variable in both scopes. $a = Hello $global:a = Goodbye Nested Prompts. Using the global scope modifier in this instance does not display the private variable. You can use the Option parameter of the New-Variable, Set-Variable, New-Alias, and Set-Alias cmdlets to set the value of the Option property to Private. Visibility The Visibility property of a variable or alias determines whether you can see the item outside the container, in which it was created. A container could be a module, script, or snap-in.. PS> $ConfirmPreference High This example shows that changes to the value of a variable in the script scope does not affect the variable`s value. PS> $test Local Example 4: Creating a Private Variable A private variable is a variable that has an Option property that has a value of Private. Private variables are inherited by the child scope, but they can only be viewed or changed in the scope in which they were created. The following command creates a private variable called $ptest in the local scope. New-Variable -Name ptest -Value 1 -Option private You can display and change the value of $ptest in the local scope. PS> $ptest 1 PS> $ptest = 2 PS> $ptest 2 Next, create a Sample.ps1 script that contains the following commands. The command tries to display and change the value of $ptest. In Sample.ps1: "The value of `$Ptest is $Ptest." "The value of `$Ptest is $global:Ptest." The $ptest variable is not visible in the script scope, the output is empty. "The value of $Ptest is ." "The value of $Ptest is ." Example 5: Using a Local Variable in a Remote Command For variables in a remote command created in the local session, use the Using scope modifier.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7&viewFallbackFrom=powershell-3.0
CC-MAIN-2020-34
refinedweb
1,126
64.3
I have some code and when it executes, it throws a NullReferenceException Object reference not set to an instance of an object.".. Some common scenarios where the exception can be thrown:. public class Person { public int Age { get; set; } } public class Book { public Person Author { get; set; } } public class Example { public void Foo() { Book b1 = new Book(); int authorAge = b1.Author.Age; // You never initialized the Author property. // there is no Person to get an Age from. } } The same applies to nested object initializers: Book b1 = new Book { Author = { Age = 45 } }; While the new keyword is used, it only creates a new instance of Book, but not a new instance of Person, so the Author the property is still null. int[] numbers = null; int n = numbers[0]; // numbers is null. There is no array to index. Person[] people = new Person[5]; people[0].Age = 20 // people[0] is null. The array was allocated but not // initialized. There is no Person to set the Age for. long[][] array = new long[1][]; array[0][0] = 3; // is null because only the first dimension is yet initialized. // Use array[0] = new long[2]; first. Dictionary<string, int> agesForNames = null; int age = agesForNames["Bob"]; // agesForNames is null. // There is no Dictionary to perform the lookup.. public class Demo { public event EventHandler StateChanged; protected virtual void OnStateChanged(EventArgs e) { StateChanged(this, e); // Exception is thrown here // if no event handlers have been attached // to StateChanged event } }!"; } } // if the "FirstName" session value has not yet been set, // then this line will throw a NullReferenceException string firstName = Session["FirstName"].ToString();es it: // Controller public class Restaurant:Controller { public ActionResult Search() { return View(); // Forgot the provide a Model here. } } // Razor view @foreach (var restaurantSearch in Model.RestaurantSearch) // Throws. { } <p>@Model.somePropertyName</p> <!-- Also throws --> (ie: listing label1 before comboBox1, ignoring issues of design philosophy, would at least resolve the NullReferenceException here. as var myThing = someObject as Thing; This doesn't throw an InvalidCastException, but returns a null when the cast fails (and when someObject is itself null). So be aware of that. The plain versions First() and Single() throw exceptions when there is nothing. The "OrDefault" versions return null in that case. So be aware of that. null, and ignore null values. If you expect the reference sometimes to be null, you can check for it being null before accessing instance members: void PrintName(Person p) { if (p != null) { Console.WriteLine(p.Name); } } null, and provide a default value. Methods calls you expect to return an instance can return null, for example when the object being sought cannot be found. You can choose to return a default value when this is the case: string GetCategory(Book b) { if (b == null) return "Unknown"; return b.Category; } nullfrom; } Debug.Assertif a value should never be null, to catch the problem earlier than the exception occurs. When you know during development that a method maybe can, but actually;
https://codedump.io/share/5zglknWeep2S/1/what-is-a-nullreferenceexception-and-how-do-i-fix-it
CC-MAIN-2017-13
refinedweb
487
57.87
{{wiki.template('Np-plugin-api')}} Summary Tells the plug-in that a stream is about to be closed or destroyed. Syntax #include <npapi.h> NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); Parameters The function has the following parameters: - instance - Pointer to current plug-in instance. - stream - Pointer to current stream. - reason - Reason the stream was destroyed. Values: - NPRES_DONE (Most common): Completed normally; all data was sent to the instance. - NPRES_USER_BREAK: User canceled stream directly by clicking the Stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. - NPRES_NETWORK_ERR: Stream failed due to problems with network, disk I/O, lack of memory, or other problems. Returns - If successful, the function returns NPERR_NO_ERROR. - If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes. Description The browser calls the NPP_DestroyStream function when a data stream sent to the plug-in is finished, either because it has completed successfully or terminated abnormally. After this, the browser deletes the NPStream object. You should delete any private data allocated in stream->pdata at this time, and should not make any further references to the stream object. See Also NPP_NewStream, NPP_DestroyStream, NPStream
https://developer.mozilla.org/en-US/docs/NPN_DestroyStream$revision/90515
CC-MAIN-2015-11
refinedweb
205
50.02
class Dragon < Creature life 1340 strength 451 charisma 1020 weapon 939 endWhat we're saying is that you could make new Dragons, and they'd have those stats. Our intrepid heroes could battle each dragon individually, and we could spawn many more as needed. But, what if we had something more exotic, like our heroes? Heroes tend to be weaker, but have lots of special moves. Our rabbit-hero has bombs. So we'd want to be able to mention this so our Game's OS will note it, and keep track of it for us: class Rabbit < Creature traits :bombs life 10 strength 2 charisma 44 weapon 4 bombs 3 ... endNote that these are simply Ruby classes. You can add methods below (or inbetween) if you see fit. What we've done is built a DomainSpecificLanguage just for gaming. And, we've built it in a totally OO fashion, and without us worrying about what bucket these traits go into. Note how we even used one method, "traits" to extend the class's meta language as we were defining it! It's this meta-object editing that makes Ruby such an awesome OO language. DomainSpecificLanguages were one of the major draws of Lisp, but it was something that Smalltalk only supported in the most limited of fashions with blocks. Ruby picks up where Smalltalk left off and carries the ball and brings in the touchdown. -- DaveFayram (Where it found Lisp waiting to greet it in the end zone. :) -- DanMuller (Indeed. -- DaveFayram)) I think a few smalltalkers might disagree with that assertion. Smalltalk does DSL's better than Ruby, Smalltalk does it so well that there's no need for special keywords in the language like "if/for/while", Ruby can't make that claim, if Ruby's object system and limited version of blocks are so good, why can't they model predicate logic as messages to objects rather than magic keywords? I'll tell you why, because Ruby can't cleanly pass more than one block to a method, and that seriously limits it's capabilities in comparison with Smalltalk blocks, which are much better. Why have the class keyword, why not do class declaration as a message send to an object. class Rabbit < Creature end would be a simple message send in Smalltalk Creature subclass: #Rabbit Ruby is elegant in comparison to Java, but it has a long way to go before it can touch Smalltalk, Ruby is still SmalltalkMinusMinus imho. RamonLeon --- Challenge to Smalltalk advocates: go ahead and reimplement DwemthysArray? then! The Array is a rather short program so it shouldn't take you too long. It's also rather well known, even celebrated, by now so a ST version will reach many people who wouldn't normally even notice ST advocacy. And an elegant implementation will frankly be a lot more convincing than "sure, we could do that" assertions. We've been promised Smalltalk DWEMTHY before: - who will deliver? -- May 2008 update - we now have a contender: If you're desparate to create classes with a message in Ruby, it turns out that the following will give you the ability: class Object def self.subclass name eval "class #{name} < #{self}; end" end endThe Smalltalk example above then translates to: Creature.subclass :RabbitBut I'm not sure exactly what this buys you. I guess in ST, the Creature class responds to the subclass message by opening an editor in the environment (don't have an ST env to hand to verify this), but there's no analogue in the Ruby world, so you'd probably be better off declaring classes idiomatically. A = Class.new(Object) A.class_eval do #class body as code, not string endThis is equivalent to class name < superclass. Playing with #const_set and #const_get you can mimic the ST-Style quite well. This is a rough implementation for illustration: class Object def self.subclass const_name = nil, &block c = Class.new(self); c.class_eval &block const_name ? self.const_set(const_name, c) : c end end c = Object.subclass(:Rabbit) def name "Roger" #the only true rabbit... end end c.nameIt is easy to extend this for almost all you needs. --FlorianGilcher? def with_blocks x, y, a, b a.call x b.call a, y end with_blocks :x, :y, proc { |x| puts "a: #{x}" }, proc { |a, y| puts "b: #{y}"; a.call y }Yeah, that really is quite ugly. I can tell that much even without being able to tell what it does. Could you provide a Smalltalk version here? "Define the method" SomeObject>>doSomethingUsingBlock: oneBlock andAnotherBlock: anotherBlock oneBlock value. anotherBlock value. "Call the method (on an instance of SomeObject)" aSomeObject doSomethingUsingBlock: [self foobar] andAnotherBlock: [self zeetix] True>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock ^trueAlternativeBlock value False>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock ^falseAlternativeBlock value "Calling ..." aBoolean ifTrue:[Transcript show: 'True'] ifFalse: [Transcript show: 'False']-- TomStambaugh class Bool def initialize cond @cond = cond end def if_true &block if @cond block.call end self end def if_false &block if !@cond block.call end self end end b = Bool.new(true) b.if_true { puts 'true'}.if_false { puts 'false' }Maybe we don't need to pass more than one block into a function after all... This doesn't match the Smalltalk example because you're throwing away the return values of the procs: myValue := aBool ifTrue: [1] ifFalse: [2]-- FrankShearar class SomeObject def with_blocks args args[:some_block].call args[:value] args[:another_block].call args[:value] end def foobar args result = "" args.each { |a| result += "#{a} " } puts "foobar: #{result}" end end obj = SomeObject.new obj.with_blocks({ :some_block => obj.method(:foobar), :another_block => proc { |args| puts "#{args.size} things." }, :value => [1, 2, 3, 4, 'Jon'] }) def make_class name eval "class #{name}; end" endHow would you go about doing the same thing in Smalltalk? (Please don't infer that that above code is in any way useful, I'm just intregued as to what the equivelent Smalltalk would look like...) I'm guessing that's a method that takes one argument, a string, and creates a class of that name. Broadly yes - it's a method that takes an argument which is either a String, or an object which responds to to_s with a String. But I am being pedantic, so please ignore me. subclass: aString ^self subclass: aString asSymbol instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''.subclass:instance... is the method the browser uses to create classes. Now, if you want it to produce a string including ST code which the compiler gets to process then, subclass: aString ^('^self subclass: ', aString asSymbol printString, ' instanceVariableNames: classVariableNames: poolDictionaries: .') evaluate<shudder> Actually, you'd probably use expandMacros somehow. The first example I'm guessing is closer to the SmalltalkWay?, and the first 2 lines make sense to me. But what's all this instanceVariablenames, classVariableNames, poolDictionaries gubbins? Are they strictly necessary? Would: subclass: aString ^super subclass: aString asSymbol.not work? And be closer to the ruby example? It would certainly seem more elegant than my ruby example (unless there is a more RubyWay to do it). There's no message "subclass:" because nobody in the Smalltalk world ever, but ever, makes subclasses in code. They make subclasses in the IDE and even the lamest browser will provide you with a template that you can just edit and accept. You never have to bother with classVariables and poolDictionaries unless you know what you're doing, and instance variables are easily specified. In the case of Dolphin, the browser provides you with a template that would recreate the class you've currently got selected if you aren't examining a method in that class. class Address def self.get path #return address object for path or nil end def self.add path #register an address object for path and return it end def add_child child @child.push child end def add_listener listener @listener.push listener end def each_listener @listener.each { |l| yield l } end def each yield self each_child { |c| yield c } end def each_child @child.each { |c0| c0.each { |c1| yield c1 } } end endNow, as the Address class is doing most of the work, the two modules are pretty simple: module Listener def listen addr a = Address.add addr if a a.add_listener self end nil end end module Dispatcher def broadcast addr, *args a0 = Address.get addr if a0 a0.each { |a1| a1.each_listener { |l| if l != self l.receive *args end } } end nil end endnow, if you want to create an object which can both listen for messages and dispatch them, you'd need something like the following (this is why I implemented Listener and Dispatcher as modules rather than classes): class Test include Listener include Dispatcher def receive *args #handle message (*args) here end endTwo includes, and one method implementation. That's it. My object can now listen and broadcast as it pleases. t = Test.new t.listen '/some/address' t.boadcast '/', :some_messageMaybe I'm easily impressed, but I think that's pretty elegant. Yes, mixins are Ruby's coolest feature, good enough that Smalltalk has already stolen the concept, improved upon it, and called em Traits. Traits are mixins, without the dependencies on the order of inclusion that Ruby's mixins have, so they are more well behaved. It's also a good example of why Smalltalk is superior, there's not much you could think up that you couldn't simply add to Smalltalk, implemented in Smalltalk. If Ruby didn't have traits, I don't think you could add traits by hacking a litte Ruby, especially since much of Ruby is implemented not in Ruby, but in C. Smalltalk is a language that can grow into anything you need it to be, to an extent far greater than Ruby. Ruby looks cool as hell, if you're coming from Java or CSharp or some such popular language, but if you look at Ruby from a Smalltalk or Lisp perspective, it's a step down. Traits/mixins could be implemented in pure Ruby easily enough. Ruby, like Smalltalk, provides sufficient runtime reflection and metaprogramming capabilities to perform namespace manipulation without resorting to C extensions. It's the reflection and metaprogramming stuff that makes Smalltalk so flexible. The implementation language of the VM is a relatively minor detail. That's not saying Ruby is bad or anything, but if you like Ruby, or find it impressive, then take another step up, and try Smalltalk, you'll like it better, especially when you realize how poor Ruby's tools are in comparison. If you think Ruby is impressive, then Smalltalk will blow your mind, hell, Ruby still uses files, how object oriented is that? Live in a Smalltalk image for a while, you'll realize how primitive files are, you'll realize how awesome it is to live in a world of pure living objects in a virtual environment, where you can prototype freely with no need of a database to store your objects. Where you can change a running program, change the implementation of a class while looking at a live instance of it. Ruby on rails is only impressive if you still think you need a database for rapid prototypes. Ruby is a great language, but it's not in Smalltalk's league, not yet. Smalltalk's had 30+ years of some of the most brilliant minds working on it, Ruby's a new kid on the block, it needs time to mature before it's ready to take on Smalltalk. def foo 'foo' endwhereas Smalltalk would require ^'foo'.
http://c2.com/cgi/wiki?RubyIsSmalltalkMinusMinus
CC-MAIN-2014-49
refinedweb
1,908
63.8
Agenda See also: IRC log <masinter> Date: 10 Dec 2009 <masinter> scribenick: masinter ht: this idea is not mine -- been floating around, never been written down, so I thought it was time to do so. I don't take credit for idea, but take blame for details. ... published in W3C blog. <ht> Default Prefix Declaration Henry S. Thompson 18 Nov 2009 ht: criticism we've heard about namespaces are: syntactic complexity and API complexity issue. This proposal basically addresses the syntactic complexity, belief is that API can be handled later. TAG participates in a W3C staff meeting about the Default Prefix Declaration idea <masinter_> #xmlnames minutes Note: minutes of the phone discussion held at this point were recorded by Carine Bournez and are available at: ht: slide 5 out of 7 already, just want to show example ... A "dpd" file gives default prefixes. One way to to give a link with rel="dpd" or for XML using a processing instruction. Or applications could ship in with a default DPD, or there could be media-type defaults. ... establish a priority order. ... In general, people are happy with using prefixing for avoiding collisions, but don't like namespace declarations, let's fix that. tbl: We should investigate this sort of thing, going down this path is a good idea. I'm keen on getting them linked on the MIME type, why not do things at the MIME-type level. ... One technical issue ... <scribe> scribenick: masinter <scribe> scribe: masinter Joint meeting ends; TAG meeting resumes. danc: neither of these proposals address interesting use cases ... I can see two use cases: Person wants to write SVG without gobbledygook in top of document. <svg> is simpler than <svg:svg>. ... This doesn't seem to be on the road to decentralized extensibility noah: you can change the link element or the linked DPD danc: then you're back to gobbledygook at the top of the document ... I'm looking for use cases & cost benefit timbl draws bar graph of document types. Most documents are HTML, but ther are SVG, MathML, FBML and lots of others. (draws zipf distribution, with HTML at the head, and "lots of others" as the long tail) (FBML is face book markup language) (discussion about cost and benefits for various use cases) <johnk> I would like to see it be possible to have XHTML + XML namespaces then served as text/html be processed correctly timbl: the issue is "in here" (pointing to HTML + popular other markups, SVG, etc.) but not minor ... languages that aren't used widely danc: which are the interesting use cases? allowing svg namespace without declaration doesn't help deploy SVG, they still have to learn how to draw circles noah: two communities invent <video> tag with conflicting meaning. To me the use case is "do you care about pollution" (discussion about use cases and transition path) danc: I'm trying to find some place where it's cost effective for someone timbl: so you're saying there's nothing in the middle? danc: svg and mathml are in the language. html5 does nothing interesting with rdfa. ... I'm still listening for the interesting use case. <Zakim> noahm, you wanted to noodle a bit on wild innovations evolving to the left of Tim's graph noah: example: notes that was originally an extension to html. Although very sympathetic to need to support decentralized extensibility, it's important mosaic:img to ask how an extension originally spelled would eventually become part of the core HTML spec and spelled . That's the challenge to mechansisms like namespaces that interests me most. henry's proposal just gets rid of the xmlns:mosaic="" <DanC_> no, it replaces it by <link ... ncsa> scribe: points out that "mosaic:img" would have been stuck with the prefix timbl: we would have added img as an alternative to mosaic:img ht: yes, there are some bumps in the road, if we go this way. But if that's the only thing in the way, i think we can live with this. <DanC_> (I'm trying to find the details of the <link> syntax ; I don't see it in , henry) danc: when i think of this, i think of <canvas> which is more recent. ... as much as I hate x-, the most successful example is the vendor prefix (e.g. moz-) in css. noah: that works for css, but the rules are different for css, won't work for paragraph names <DanC_> but yes, the cascade is critical to the transition from moz-smellovision to smellovision ht: two observations, different from dan. I don't agree, I think the current situation with SVG and MathML isnt' good enough. It has to define every possible transition. It specifies in detail where you can or can't put MathML and SVG elements. ... The fact that the SVG working group has been bullied into submission isn't good enough for me. ... They were pushed back to the current state of play. It isn't good enough for me. <DanC_> I think the SVG WG was convinced that this is simpler for authors <noahm> I would like to wrapup, get to next steps, and break ht: It is interesting to say that the RDFa group is happy, because I don't think there is any place in HTML5 wrt the HTML serialization for namespace declarations, because the DOM isn't going to be what they want. ... I've recorded my disagreement danc: the rdfa use case involves scripting noah: what are next steps <scribe> ACTION: noah to work to schedule followup meeting on xmlnames next week [recorded in] <trackbot> Created ACTION-356 - Work to schedule followup meeting on xmlnames next week [on Noah Mendelsohn - due 2009-12-17]. ht: reminds himself to work to figure out how this interacts with XML documents <DanC_> (do you remember the action #, larry? care to suggest a new due date?) <ht> ACTION: Henry to elaborate the DPD proposal to address comments from #xmlnames and tag f2f discussion of 2009-12-10, particularly wrt integration with XML specs and wrt motivation, due 2010-01-08 [recorded in] ]. action-337? <trackbot> ACTION-337 -- Larry Masinter to frame the F2F agenda and preparation on metadata formats/representations -- due 2009-12-08 -- OPEN <trackbot> <ht> trackbot, action-337 due 2010-01-08 <trackbot> ACTION-337 frame the F2F agenda and preparation on metadata formats/representations due date now 2010-01-08 (group on break) reconvene Philippe joins <plh> plh: not coverage between issues and change proposals noah: would help to add issue names to table ... failure mode is that people don't notice plh: issue 7 was closed. chairs are willing to reopen if there is no new information <DanC_> HTML WG issue 7 was video codecs <DanC_> (referring to issues by number only is an anti-pattern) action-327? <trackbot> ACTION-327 -- Henry S. Thompson to review Microsoft's namespaces in HTML 5 proposal -- due 2009-11-19 -- PENDINGREVIEW <trackbot> looking at Microsoft namespace proposal <noahm> We note that HTML issue 41 appears to be open <DanC_> HTML WG issue 41 is open, with no dead-man-switch yet issued <noahm> Microsoft's Namespaces Proposal (TAG ACTION-327) Henry S. Thompson 19 Nov 2009 HT: Microsoft's proposal imports a subset of XML namespace syntax into the HTML serialization. Core proposal is a duel of what we talked about earlier: allow xmlns:foo, and within that scope foo:xxx uses the namespace timbl: identical to xmlns, with regard to prefixed names ht: then it goes on to suggest a number of possible extensions <DanC_> (I wonder if everybody here is aware of the way HTML interacts with XPath in the case of unprefixed element names... maybe I'll q+) ht: the addition of default namespace declarations ... I'm just telling you what it says ... then there is an additional proposal, to treat unbound prefixes as if they were identity-declared ... namespace spec says you "shouldn't" use relative URIs (discussion of whether xmlns:udp="udp" is an error, a relative URL) timbl: local namespace declarations are useful in (context missed) ht: interesting idea, don't think it is going to fly timbl: maybe want #udp, not udp (speculation about what is deployed inside microsoft) ht: "3. to define short namespace names for commonly-used namespaces ..." (timbl bangs head on wall) plh: discussion on HTML was that this proposal would break (something), and Microsoft needs to revise ht: I think it is sound but doesn't address the two issues that other WG members had raised, (a) syntactic complexity and (b) API complexity noah: do we have a sense of where this is going? (speculation about what might happen in the HTML working group) <Zakim> ht, you wanted to reply to DanC <noahm> ac2 next danc: thanks for gathering all he facts. I think this is as good as it gets, though, disagree with conclusion. Henry's isn't simpler and Microsoft's is more like current namespaces. timbl: use this for svg? ht: orthogonal point -- stipulating that one of these proposals is adopted, opens the possibility but not necessity of revisiting the current embedding of SVG and MathML timbl: and the <a> tag, that's done by context? ht: yes timbl: should the TAG endorse the microsoft proposal? <DanC_> +1 TAG endorsedd jar: (put on the spot) noah: would like to see something happen, but insofar as doing this by saying TAG isn't happy with Henry or Liam's proposal, not ready to do that <Zakim> noahm, you wanted to discuss tim's proposal jar: here's how to convince me -- hard for me to keep this in my head... how about requirements? timbl: I need the Microsoft one anyway for the long tail ht: that's just not true. There's a place in HT for ideosyncratic use (danc at board making matrix of requirements vs proposals) noah: (floating idea for TAG position about endorsing MS vs. others) columns: DPD (ht), mangled xmlns (MS), Unobtrusive Namespaces (Liam's) rows: long tail, static scoping, ie, webkit, opera, mozilla static scoping means: changing some other document doesn't change what foo:bar would mean discussion of what the rows IE, Webkit, Opera, Mozilla mean jar: wondering if there's a null hypothesis? Maybe there's a 'status quo' column? adding 4th column, "Standing WG" adding rows for SVG, MathML, RDFa authoring communities adding examples of "Long Tail", FBML, SL = Second Life vs. SilverLight ht: PLH, what do you think about this? timbl: Were a browser manufacturer to change their attitude and implement application/xhtml+xml, would that make a difference? noah: expected question to be 'does then the TAG care about this', and I think they do, because e.g., service provider doesn't allow people to set MIME type ... even if 1st class support for application/xhtml+xml ht: as long as the columns are full of "maybe this or maybe that", it isn't helpful to push people to make their minds up (chart only partly filled out... longtail check, check, check, x scribe: x check x check IE has only ? under MS proposal danc: queue slot was to solicit people to write a blog entry jar: there's enough in the chart to take us from Tim's original proposal that we endorse the MS proposal, but I think this takes us a step further. We could say "we like the MS proposal insofar as it does X, Y and Z" noah: (will drain queue, and see where we are) <Zakim> timbl_, you wanted to point out that reusing exstig xmlns syntax has great advantages <DanC_> yeah, timbl, I meant to make a row for that; neglected to timbl: Reusing existing syntax, not inventing new stuff. Inventing new stuff is a hurdle. If it's a good thing to do. Just being able to say: for a given MIME type, have a default namespace. danc: that's the state of the art timbl: XML tools don't have an easy way of taking that into account ... This would be a relief in other cases <DanC_> (ah yes, tim; in particular, authors have to put the xmlns="...xhtml" for XML tool interop.) ht: i've just added 3 new rows to the table: reuses existing syntax. X for all but MS ... ... simplifies the syntax and simplifies the DOM timbl: I asked "Is the DOM the same?" and you said "Yes" ht: the HTML community *wants* the DOM to be simplified ... currently standing HTML tick on "Simplifies the DOM" is x for everything except for standing HTML5 ... 'simplify the syntax' is all check except for MS <DanC_> (still no takers on blogging this table? sigh. oh well.) <DanC_> action-357: try to include the requirements table <trackbot> ACTION-357 Elaborate the DPD proposal to address comments from #xmlnames and tag f2f discussion of 2009-12-10, particularly wrt integration with XML specs and wrt motivation, due 2010-01-08 notes added <plh> HTML 5: The Markup Language <ht> There are 3 docs: Hixie's, Mike Smith's and Lachlan Hunt's (looking for normative language reference spec) <ht> has a different date <DanC_> (editor of html-author is lachlan, I think; he's carrying 0 actions. ) plh: the group doesn't want to have a document that is normative, since this would create a high risk of conflicts between the documents ht: I think we lost the argument to split the spec into a language spec. and a behaviour spec. noah: point of clarification? Is this document going to progress plh: for the moment, it doesn't officially exist [i.e. hasn't been published as a WD] ... if the working group decided to do that, it would likely be normative <DanC> CfC: Close ISSUE-59 normative-language-reference (ends 2009-12-17) Maciej Stachowiak 08 Dec 2009 noah: would like he TAG to assess this. I skimmed this: far better than my worst fears, considerably worse than what I would hope for <Zakim> noahm, you wanted to talk about hixie's spec <ht> what is URI for "authoring view" of Hixie's draft? <noahm> email from Ian Hickson <noahm> I have now made the three versions available: <noahm> <noahm> <noahm> ht: this doesn't come close to what I want ... there is no grammar. I want a grammar. noah: I don't elevate the lack of a grammar to... (absolutely necessary) <Zakim> masinter, you wanted to talk about DOM API call being documented by normative algorithms <noahm> FWIW, my criterion for success is not "does it use formal grammars", though I think they ) LMM reminds us of the point he's made before, that there are things stated algorithmically (e.g. interpretation of image width/height) that should be done more declaratively. <masinter_> the point was: what are the invariants that a reasonable programmer or generator of programs can assume? Many of these are embedded deeply within algorithms presented for implementors, that cannot be inferred or extracted by any textual processing, because it's not written down anywhere. <Zakim> DanC_, you wanted to note two targets: (a) more traditional language spec (b) guide for authors. We seem to have missed HT's interest in (b). html-author is dated March 2009 and <jar> (danc, ACL2 is for proofs. Larry says he's missing the theorems.) <DanC_> (ACL2 does plenty of stuff with theorems; I don't understand your point) ht: I was interested in the document, because I thought it was actively being worked on. But to be clear, i'm not interested in an authoring spec, I'm interested in a language spec. <noahm> I am interested in the style=author one as a best approximation to a language spec, because it's the only one we're likely to get that's normative. <noahm> I do regret that it's advertised as an authoring spec, because I agree that a language spec is the higher priority. <noahm> Still, it may do the job, and my question is: does it, and if not, would some tuning get it there. <DanC_> (I think mutliple normative specs is _good_ for QA, but when I gave that opinion in the HTML WG, it was clear hardly anybody else in the WG agrees.) <DanC_> (e.g. having the OWL language spec and the test suite both normative; if they conflict, there's a bug, and I'm not prepared to say, in advance, where the bug is.) <Zakim> jar, you wanted to say the issue is how to evaluate the spec (speaks to openness of web). having 2nd spec that tracks is one way, modularizing the spec is a 2nd way, having a jar: this may be obvious: there's some objective to be able to approach the spec. This thing is just too big for that. There are multiple for making this tractable. ... you want to know what the spec does what it's supposed to do, and having it be so big is a problem. My message is to keep your eye on the ball. <Zakim> ht, you wanted to explain why I find unhelpful ht: i would like to use the last part to ask PLH his view. <Zakim> noahm, you wanted to say why I find helpful noahm: I do find it helpful, but the question is whether it is (or will be) good enough. I think it would be worthwhile for us to take what was offered and read it with some care... if the answers are in some ways promising, that would be good. <Zakim> masinter, you wanted to talk about getting away from the need for always-on updates to HTML <noahm> Some was lost in scribing what I said above, so let me clarify: <noahm> I think the style=author draft, which I've skimmed but not read in full detail, is valuable in several ways, but especially because it is being offered as normative, and well synced with the other variants of the spec. . LMM reiterates applicability statement idea raised earlier. 2 docs, one with undated references, another (the a.s.) with dated references "the way things are in 2010" LMM: the goal is to avoid the need to publish new specs too frequently danc: authoring spec engaged me to some degree, but didn't find it compelling to spend more time on it noah: is there something you could say? <jar> does it matter whether it engages anyone? the OWL WG basically said no, the non-normative docs can be engaging <noahm> DC: Well, hello world is in section 8. Oops, nope, I guess I fixed that. danc: the 'hello world' example *was* in section 8. Previously, it was hard to tell whether there was something that was a constraint on documents vs. a constraint on implementation ... that seems to have gotten better. <Zakim> DanC_, you wanted to respond re reading the author view <ht> Beware that if you follow TOC links from you _lose_ the parameter, and have to re-enter it by hand jk: who are we helping with respect to getting a grammar? Who cares? ... Hixie has done something toward satisfying a goal, we don't know if it is close to satisfying our goal ... maybe this is our chance of getting a spec that's normative I hope to give. <Zakim> johnk, you wanted to ask who are we trying to help here? <DanC_> I'm not prepared to give feedback on behalf of the design community, Noah; look at my web pages; they're design jokes, at best. I've encouraged the design community to comment for themselves, and had mixed success. jar: I think it is a threat, if you have standards that are hard to understand, that's a threat to openness <ht> HST absolutely agrees with PLH -- W3C writes specs for implementors <ht> .. but implementors need language specs, not algorithms plh: with the working group, who are we writing the spec for? For the implementors? The users can buy books. The implementors disagree. danc: there are lots of examples for users in the spec, though, not just for implementors. plh: given the resources, though, most of them spend their time <noahm> I strongly disagree. Books are very helpful, but not normative. There are architectural, and thus practical, benefits to having a rigorous, precise specification for a language, a spec that's not unnecessarily tangled with specs for other things. .) plh: there's a RELAXNG schema ht: it has no authority plh: The WG might adopt it as a WD hst: That would be great LMM: I want to support implementors of things other than browsers. Transformers, editors, etc. <ht> masinter +1 LMM: HTML for ATOM, HTML for email plh: the chairs would like to move HTML5 to last call soon. pick your battles. Look at the long list of issues the WG already has, are there any that don't have a change proposal, consider making a proposal for those. noahm: would like to get someone on TAG to review the table (and maybe things that have fallen off the table), would like to use that to help prioritize danc: I already did this before and did it again last night ... there is one I suggest we increase in priority: 'resource' vs 'representation' <DanC_> ACTION Noah schedule discussion of 'usage of 'resource' vs 'representation' in HTML 5, CSS, HTML 4, SVG, ...' [note follow-up discussion in www-archive] <trackbot> Created ACTION-358 - Schedule discussion of 'usage of 'resource' vs 'representation' in HTML 5, CSS, HTML 4, SVG, ...' [note follow-up discussion in www-archive] [on Noah Mendelsohn - due 2009-12-17]. (review of HTML open issues was only against 'things to be closed soon') <ht> DanC, I agree that user needs must be addressed by the _designs_ which WGs produce, but that that is _not_ the leading priority for the specs which communicate those designs noah: we did have this discussion of authoring. Would be helpful to... (?) ... proposal: (review of Maciej message of 08 Dec 2009 15:55:20) We do not have a uniform opinion of how much this meets needs, but we think this is ... positive. <DanC_> PROPOSED: to endorse the proposed disposition of HTML WG issue-59 in , i.e. the class=author view and the informative reference guide ht: message proposes closes this issue. We should say: don't do this, we're not happy. <DanC_> I gather ht doesn't find my proposal appealing ht: wants the TAG to ask for a language spec lm: I want the HTML working group to agree that they will review the resulting document and come to consensus about its adequacy, not just to do so as a political move to meet someone else's pro-forma requirement ht: Maciej's message proposes to adopt it as a non-normative WG product (discussion of whether the doc supports RelaxNG grammar) <DanC_> PROPOSED: to endorse the proposed disposition of HTML WG issue-59 in , i.e. the class=author view and the informative reference guide, provided the relaxng is appended to the informative reference guide <ht> PROPOSED: to endorse the proposed disposition of HTML WG issue-59 in , i.e. the class=author view and the informative reference guide, provided the relaxng is appended to the informative reference guide, which will be published as a Working Draft and taken forward noahm: and maintained as the HTML language evolves? (wordsmithing of response) <ht> PROPOSED: to endorse the proposed disposition of HTML WG issue-59 in , i.e. the class=author view and the informative reference guide, provided the relaxng is appended to the informative reference guide, which will be published as a Working Draft and maintained <plh> I suggest s/to Last Call/through Last Call/ so RESOLVED <ht> s/taken to last call/taken through Last Call/ RESOLUTION: endorse the proposed disposition of HTML WG issue-59 in , i.e. the class=author view and the informative reference guide, provided the relaxng is appended to the informative reference guide, which will be published as a Working Draft and taken to Last Call <scribe> ACTION: Noah to communicate TAG resolution to HTML WG [recorded in] <trackbot> Created ACTION-359 - Communicate TAG resolution to HTML WG [on Noah Mendelsohn - due 2009-12-17]. <DanC_> close ACTION-292 <trackbot> ACTION-292 Alert group to review HTML Authoring Drafts [trivial] [self-assigned] closed <noahm> ADJOURNED FOR LUNCH UNTIL 13:30 <DanC_> scribe: DC <DanC_> scribenick: DanC_ close action-330 <trackbot> ACTION-330 Prepare Dec f2f agenda in collaboration with Noah etc. closed <scribe> ACTION: John to clean up TAG ftf minutes 8 Dec [recorded in] <trackbot> Created ACTION-360 - Clean up TAG ftf minutes 8 Dec [on John Kemp - due 2009-12-17]. <scribe> ACTION: Henry to clean up TAG ftf minutes 9 Dec [recorded in] <trackbot> Created ACTION-361 - Clean up TAG ftf minutes 9 Dec [on Henry S. Thompson - due 2009-12-17]. <noah> Raman, we are starting, and we are dialed in <scribe> ACTION: Dan to clean up TAG ftf minutes 10 Dec, and either wrap up the 3 days or get Noah to do it [recorded in] <trackbot> Created ACTION-362 - Clean up TAG ftf minutes 10 Dec, and either wrap up the 3 days or get Noah to do it [on Dan Connolly - due 2009-12-17]. NM reviews agenda... <ht> John, <link id="xf" rel="prefix" is already allowed ! <raman> something is different in the room, audio is awful, lots of echo echo? bummer. HT: I do have something re references... though I'm OK if that goes to a telcon NM: accepts the agenda request; commits Revision: 1.31 raman? audio better? <noah> Raman, I have moved the mic, and will dial again if necessary. Was good this morning. Can't hear you at all. ACTION-281? <trackbot> ACTION-281 -- Ashok Malhotra to keep an eye on progress of link header draft, report to TAG, warn us of problems (ISSUE-62) -- due 2009-11-13 -- PENDINGREVIEW <trackbot> AM: we're tracking 4 drafts... linking, well-known, host-meta, XRDD... I think one got updated since I sent mail... <noah> Raman, please ping us in IRC when we have your attention again. Thank you. AM: I saw comments from Tim and Dan... the authors have seen those DC: I had a concern about the registration and Mark Nottingham fixed it. AM: these are 3 mechanisms for attaching metadata ... are these enough? do we need more? ... and JAR said something about an iTunes-like mechanism... JAR: well... maybe the issue name should be changed... it suggests there will be a limited number of ways to access metadata... ... these 3 mechanisms are about 1st-party metadata. in the [academic] metadata world, that's the least valuable, but in other cases, it's useful, especially if it's all you've got ... so something like "uniform access to 1st party metadata"; this isn't metadata in general NM: this is metadata that the 1st party helps you find JAR: that link itself is metadata LMM: if you include the pre-production and production workflow, [oops; I lost the train of thought]... photo metadata... ... the camera is the 1st party... ... the person who takes the photo and edits it is the 2nd party... and the next person in the workflow is 3rd, copyright guy is 4th party... or there's a lot of 3rd parties jar: I agree... I may need to adjust my terminology DanC: from the perspective of the link-header draft, all those are, in aggregate, the 1st party LMM: no, if you look in the photo, you can see the audit trail DanC: ah. LMM: and it goes on from there... flickr taggers, commenters, etc. JK: doesn't that means that the metadata inside the data? (I think the way I scribed JK makes the referent of "that" misleading.) LMM: it helps in the production workflow... ... but flickr tags and comments, probably not <Zakim> masinter, you wanted to talk about goals TBL: in the adobe tools, can you set the trail of custody? [something like that] LMM: in varying degrees, yes TBL: when adobe tools get content from the web, can they recover the trail? LMM: I don't know TBL: the metadat trust is [scribe falls behind] [discussion between TBL and LMM exceeds scribe bandwidth] LMM: in the Seybold community, I learned the industry uses a variety of mechanisms to send images around... often not compressed... <jar> I want to know what problem we're working on now. TBL: I'm interested in "this is/was http://...." . LMM: the workflow uses guiids rather than locations; these things move around too much <masinter> the locations weren't normative <masinter> I guess the point is that first-party metadata is often embedded, and that the Link header is better thought of as "third-party metadata" where the third-party is the publishing web site danc: Host-meta, powder, EARL - I would only want to write that software once (see mail Dan sent to www-tag) ... and I have a concern about not using .well-known unless it's merited in ways that Roy emphasized JAR: [who]'s concerns increases my desire to change the name of the issue... "server provided metadata"? <DanC> (I'm happy for the issue shepherd to change the issue name whenever they see fit; I trust them to consult the TAG as appropriate) <timbl_> Maybe we should be charging $10M for an entry in "well-known" to express the cost to the community of each one, clients having to check different places. . <masinter> issue-62? <trackbot> ISSUE-62 -- Uniform Access to Metadata -- OPEN <trackbot> <noah> Note that we just changed the name of the issue: issue-62? <trackbot> ISSUE-62 -- Uniform Access to Server-provided Metadata -- OPEN <trackbot> AM: do we need another issue for the rest? JAR: we have the broader issue; issue-63 <masinter> issue-63? <trackbot> ISSUE-63 -- Metadata Architecture for the Web -- OPEN <trackbot> <Zakim> jar, you wanted to suggest "server provided links" or "server provided metadata" <jar> These RFCs are going to be final soon. Very narrow window to have influence. AM: again, do we need more mechanism? or fewer? DanC: I'd like to see fewer JAR: these specs are nearing deployment <Zakim> noah, you wanted to ask questions from chair DanC: do you have any critical concerns? are you happy with the specs, JAR? JAR: yes, I'm happy <Zakim> masinter, you wanted to note that there are lots of other requirements and to diminish the importance of IETF proposed standards LMM: are the applicability of these draft narrow enough that other cases are ruled out? [?] ... I don't think publication of these as Proposed Standard will get in the way if something else is more appropriate JAR: well, it'll compete ... well, doesn't compete with mechanisms for other sources of metadata <jar> it will compete in the very narrow in which it applies. won't compete with ways of getting metadata *from other sources* LMM: my remaining concern is: when more than one of these mechanisms provides info, what about priority? JAR: thie "Web Linking" explicitly says "this is not authoritative; apps have to come up with their own trust model" LMM: it's not a matter of trust, it's a matter of intent. e.g. if I write copyright in both the Link header and in the content and they're different, which do I mean? both? TBL: that's a bug ... i.e. the web site is buggy [not the link header spec] <jar> there's no such thing as overriding a copyright statement (legally)... LMM: I don't like the "then it's a bug and we don't say which"; I prefer priorities TBL: priorities allow people to write incorrect things that get obscured due to priorieites; then they get surfaced when the document moves <Zakim> DanC_, you wanted to ask about use cases that are market drivers <timbl_> A language should ays "if you write this, then it means *this*". <jar> the resource and the server are distinct principals with different interests. metadata is statements of fact. thus disagreements are inherent and unresolvable outside of a trust model <timbl_> Not "it means this unless it is overridden...". <masinter> points to for dealing with conflicting embedded metadata DC: The specs may well come out, but it would be interesting to remind ourselves what the market drivers are for the specs we're discussing here. ... Anyone know what the drivers are, e.g., for host meta? AM: It says it's for where the host controls. DC: But who's going to make money? Falling behind scribing johnk.... JK: I think the market-driving use case is URI templates ... advertising. ... e.g. "if you want to look up a person whose profile is on my site, here's the URI template to plug the username into". and having lots of users leads to advertising revenue. ... e.g. google, yahoo, etc. <Zakim> timbl_, you wanted to say, well it would be better if they were all RDF of course. Are we goingto do nothing about that? <masinter> from TBL: this XRD format seems to overlap significantly with RDF... how much RDF is there out there? ... a lot. ... and we're pushing linked data... ... linking host meta into the linked data world seems helpful <noah> The XRD thing is already deployed, right? JAR: use GRDDL? TBL: but I can't use an RDF serializer to write XRD JAR: XRD is very simple TBL: I can't write arbitrary RDF into XRD JAR: aside from bnodes and literals, you can; i.e. arbitrary uri triples JK: ... web finger ... (If I were going to push on something, I'd push RDFa rather than RDF/XML) <Zakim> johnk, you wanted to note that Link header was originally specifically about representations that could not contain <link> elements JK: using <link> for formats that can't express links is like [something larry was talking about] <Zakim> masinter, you wanted to talk to the MWG document dealing with conflicting metadata <masinter> points to for dealing with conflicting embedded metadata NM: This reinforces Tim's point. If the use case in mind is where there's no possible duplication, then duplication with conflict should be an error, not resolved with priority. LMM: even when the metadata is embedded, you can have multiple kinds of metadata... this points to the practical issue of... ... what if you have EXIF, [something else], and conflicts, and how to manage... ... so I think the "conflicting metadata is a bug; we're not telling what to do" doesn't suffice... ... I suggest to say that it's not an error... providing an override mechanism is important <Zakim> jar, you wanted to answer larry regarding priority between sources (i will just say what i already entered in irc) JAR: metadata is typically a statement of fact. [LMM: no]. sometimes the server is right; sometimes the resource is right; each consumer has to decide who to believe <johnk> In response to the question "is XRD deployed" I mentioned WebFinger (see) which I believe may already be deployed <masinter> I don't want to say "who is right and who is wrong". I just am asking that the Link header be expanded to alow the server to be clear about whether the intent of the server is to override, supplant, or replace embedded metadata. <Zakim> masinter, you wanted to disagree: metadata is always an issue of opinion, not a theory of fact JAR: It's a putative fact AM: when I asked whether this is the right number of mechanism I got sort of a yes from LMM and JAR and a No from Dan... elaborate? <johnk> JK: regarding the Link header, I mentioned that the original use-case (IIRC!) was specifically for cases where an HTTP entity-body could not contain "links" (for example, text/plain) <noah> LM: I'm not looking to settle who's right, I'm looking for priority mechanisms. DanC: I think Host-Meta overlaps with existing mechanisms: POWDER. so we've got more mechanisms than I'd like to see. [don't mean to be emphatic about which of POWDER or Host-Meta shold survive] <noah> Interesting Dan, I thought some of what you wanted was an RDF answer (or maybe I'm channeling Tim through you) <Zakim> DanC_, you wanted to speak to expressiveness of override mechanism <jar> "The server believes this information to be more trustworthy than what the resource says." or "The server that what the resource says is more likely to be right than what it says." DC: The client can have all sorts of policies, but it's less expressive if you don't let the sender express a preference. TBL: architecturally, the HTTP header overrides the content... but in practical cases, people want their content to override the server config too. . JAR: I'd say mnot and Eran would say: it's the responsibility of what's pointed to by Link: to have this override mechanism. NM: we can always come back to this... JAR: no; there's a market window... DC: does anybody know timing of large deployments? JK: I think webfinger is deployed at scale, using [Host-Meta?] HT: uniform access has come back into this... harks back to XRI and [missed]... ... the energy currently is going into how to provide metadata that addresses the uniform access problem... ... the good news is that although there are what might look like 3 competing proposals, actually they play nice together ... and there's a story about how ... that's what I heard. DC: As team contact, I feel that doing nothing isn't good. ... I think we need to connect with the Sem Web coordination group. <noah> DC: What I have in mind is along the lines of going to coord group and say: Hey, this is about to happen without RDF, Linked Data. Problem? <scribe> ACTION: Jonathan inform SemWeb CG about market developments around webfinger and metadata access, and investigate relationship to RDFa and linked data [recorded in] <trackbot> Created ACTION-363 - Inform SemWeb CG about market developments around webfinger and metadata access, and investigate relationship to RDFa and linked data [on Jonathan Rees - due 2009-12-17]. <timbl_> <jar> Last call ended for .well-known and Link: <masinter> the TAG could ask the editor (Mark) to note open issues: use of RDF vs. other metadata representations, and whether Link: overrides, supplants, or defaults embedded metadata. <masinter> the discussion has been useful, even if we don't act further close action-281 <trackbot> ACTION-281 Keep an eye on progress of link header draft, report to TAG, warn us of problems (ISSUE-62) closed <noah> Supposedly now until 3:15, but we're struggling to close action-336 <trackbot> ACTION-336 Prep Metadata Architecture for Dec f2f closed <noah> WE ARE ON BREAK UNTIL 15:20 US EST <masinter> (back from break) DanC: HT notified us of a default processing model draft in the XProc WG <ht> DanC: any processing model that does Xinclude shouldn't be "_the_ default_" ... ... previously, HT seemed sympathetic <noah> (some metadiscussion on whether editors of this are obligated to listen to input before formal drafts available. Editor warns that lack of sleep will lead to forgetfulness anyway.) DanC: I think the way to make it clear that this is not _the_ default processing model is to include another one... ... the trivial one: just use the bytes you got DC: Earlier, I said "Default Processing Model" isn't the right title. Henry, you seemed sympathetic. Are you still. HT: Um, loses some value. ... Lots of people should point to this. DC: So you do want to be THE model. HT: Yes. ... With XInclude we can get rid of much of the need for DTDs. DC: The getting rid of DTDs part appeals to me. Tim, do you feel that justifies making XInclude the default? <masinter> shouldn't make normative reference to this? TBL: what does the xml:id bit do? HT: affects the DOM; e.g. GetElementById TBL: does xinclude happen after xml:id? HT: no; the details are in XProc ***** HT wants to remember that this could be clarified TBL: I'm surprised to not see something recursive HT: XInclude is recursive; unlike GRDDL, which doesn't say whether xinclude happens 1st, xinclude does say <Zakim> johnk, you wanted to ask what happens if the document looks like this: <xml version='1.0'?><EncryptedData>...</EncryptedData> JK: what if the data is encripted? HT: well... you lose... we tried to get encryption/signature into the design, but... they require a key... ... and we don't want to come anywhere close to encourage packaging a document with a key <Zakim> masinter, you wanted to ask whether this belongs with the application/xml media type & reregistration of it LMM: how about binding it to the XML media type? HT: not retrospectively LMM: but how about when people make new XML media types, they should be referred to this processing model <masinter> <noah> NM As I recall, schema looked at this a long time, asking "do you want to validate pre or post inclusion. The answer was a clear "both", that's as a good reason to use the infoset. <ht> TBL: what "the customer", me, asked for, is what "corresponds to" the input, in the HTTP sense <Zakim> noah, you wanted to ask whether this is clear on what to do if external resources don't resolve. Can you use this in a non-network environment? <timbl_> In the sense, if you send me an XML document, whot I can hold you to haveing said NM: meanwhile, HT has an action to lay out the design space-01-01 -- OPEN <trackbot> <masinter> e.g., the XML Media Types RFC could require, at a minimum, that registration of XML media types MUST clearly identify what processing model they use, and whether they use this one. <DanC> (w.r.t. wrapping up, I'm content to consider action-239 done and come back when we see progress on action-113, provided it comes before LC on this spec) <Zakim> ht, you wanted to answer Tim <timbl_> The meaning of an xinclude include emeplemnt is t its included contents. HT: yes, it's a reasonable exercise to answer "what is the author held to?" ... and the value increases if there's only one answer ... that's why there's no answer in the case you gave [oops; what case was that? I didn't scribe it] ... this only takes one step down a complicated [... more] <Zakim> timbl_, you wanted to explain as patiently as he can that the interesting thing i snot to tell people how they shoul dprocess it. in fact the idea of a processing model is (of <DanC> (I encourage jar, lmm, and noah to q- and wait for telcon time, unless there's nothing else on today's agenda that you care about) TBL: [...missed] which is the decrypted material... ... and in the case of XSLT is the output ... so in fact you have to go to the spec for each element to get what the author is held to <jar> TBL was talking about the recursive / compositional processing model. <jar> I think he's saying this spec isn't ambitious (inferential?) enough HT: LMM, yes, I take on board the concern about the connection between the XML media types spec and this spec ... though I'm concerned about the timelines close action-239 <trackbot> ACTION-239 alert chair when updates to description of xmlFunctions-34 are ready for review (or if none made) closed <masinter> LMM: you can see the suggested syntax at the bottom DC: hmm... DOCTYPE... despite my advice? LMM: I looked and couldn't find any downside DC: quirks mode? LMM: no, quirks mode is triggered only in the case of known DTD strings ... a goal is to make a change that needs no changes from browsers NM: what's the motivation/goal for the change? LMM: cf the change proposal, incl "The html version string is allowed primarily because it may be useful for content management systems and other development workflows as a kind of metadata to indicate which specification was being consulted when the HTML content was being prepared. " HT notes another procedural request from maciej HT: this looks good to me. ... yes, we should look into the XML requirement for a system identifier ... ah... yes... there are no XML syntaxes with only public id (train of thought started with something NM said, which I forgot) DC: that's why I advise a version attribute <johnk> Jonathan how about: <jar> johnk, that's amazing, thanks LMM: I wanted to follow the existing tradition of using <!DOCTYPE > DC: but it suggests there's a DTD, while there isn't one HT: well, a DTD with all "ANY" content models could be slotted in. LMM: in some ways I don't have a strong opinion on this issue, but ... ... I don't like to see the HTML WG close issues just because noone was willing to take flack for making a proposal <ht> Actually, forget ANY -- if it goes that way, I would expect/recommend that an effectively empty external subset should be provided at the given SYSID, i.e one consisting entirely of a comment LMM: and I think it's important for those who want to express a version id to be able to ... I encourage TAG members to review and contribute directly to public-html some discussion of public-html mailing list logistics and expectations action-334? <trackbot> ACTION-334 -- Henry S. Thompson to start an email thread regarding the treatment of pre-HTML5 versions in the media type registration text of HTML5 -- due 2009-11-26 -- PENDINGREVIEW <trackbot> <DanC> Backward-compatibility of text/html media type (ACTION-334) Henry S. Thompson 02 Dec 2009 HT: so that collects all relevant materials I know of <DanC> what's "suspended animation"? wild... they use tracker:closed <DanC> ISSUE-53 mediatypereg Need to update media type registrations "State: CLOSED Product: HTML5 Spec - PR Blockers" HT: so... should we try to get something to happen before Last Call? I thought there was an interaction with the language design, but on close examination, I didn't find one. <masinter> this is a useful as a Rationale for the change proposal <noah> ac2 n6ah <noah> DC: I don't agree with the obvious fix. I think the HTML 5 spec describes HTML 2 better than HTML 2 spec does. <Zakim> masinter, you wanted to ask for volunteer to write a change proposal LMM: I think a change proposal would be good... e.g. there are documents that prompt quirks mode that's implemented, but the current HTML 5 spec rules it out. [roughly] <masinter> suggest MIME registration point to history section inside HTML5 document and/or previous MIME registration <scribe> ACTION: DanC to ask HTML WG team contacts to make a change proposal re issue-53 mediatypereg informed by HT's analysis and today's discussion [recorded in] <trackbot> Created ACTION-364 - Ask HTML WG team contacts to make a change proposal re issue-53 mediatypereg informed by HT's analysis and today's discussion [on Dan Connolly - due 2009-12-17]. <ht> It occurs to me that a change which said "this registration augments [the existing registration] rather than replacing it LMM: a change proposal might fix some other parts of the media type registration... e.g. change controller close action-334 <trackbot> ACTION-334 Start an email thread regarding the treatment of pre-HTML5 versions in the media type registration text of HTML5 closed <masinter> LMM: there's a TAG issue about registering URI schemes [really?]; I think we should encourage registering permanent URI schemes rather than provisional ones... but leaving that aside... <johnk> rather <timbl_> LMM: consider "A producer may include an authority component in URIs. If present, the authority component is said to be opaque, meaning that the authority component has a syntax as defined by [RFC3987] but that the authority component is devoid of semantics. " ... this seems not well-defined ... earlier in the design discussion, this was used for cross-widget references , but due to security concerns, I think, they made it opaque JAR: how about using it to distinguish widgets? JK: but these are only used for reference within a widget ... widget URIs are used in a "manifest" contained within a widget package, and then used to point to other files within the widget package <masinter> <masinter> guidelines and registration procedures for new uri schemes TBL: this does seem undefined JAR: could be "reserved for future use" <masinter> For schemes that function as locators, it is important that the <masinter> mechanism of resource location be clearly defined. This might mean <masinter> different things depending on the nature of the URI scheme. <masinter> The URI registration process is described in the terminology of [3]. <masinter> The registration process is an optional mailing list review, followed <masinter> by "Expert Review". The registration request should note the desired <masinter> status. The Designated Expert will evaluate the request against the <masinter> criteria of the requested status. In the case of a permanent <masinter> registration request, the Designated Expert may: <masinter> I am not the expert. ]." RESOLUTION: to thank Amy for hosting arrangements. with applause AM: This was a very successful ftf. JK: yeah; good meeting; the action item stuff in the agenda worked; the Zakim tracking not so well. NM: yeah. TBL: yeah... good meeting... JAR's "speaks_for" stuff was a highlight ... the persistent domain stuff... not clearly within the TAG's scope, but if not us, who? JAR: yeah... Creative Commons will sure help... but who else is in a position to connect the IETF with the library community? <Zakim> johnk, you wanted to ask whether the crucial question is whether individual components of a widget will be "on the Web" <jar> who else other than the TAG, that is <jar> and CC <jar> (not a rhetorical question by the way) NM: yeah... good meeting... noteable technical highlights ... and as to how we work as a group, this feels like we're starting to hit stride. <masinter> done" state. <Zakim> DanC_, you wanted to speak to the persistent domain tactics . DC: yeah... not clear that persistent domains is a TAG thing, but it's a W3C thing, and if we can catalyze a workshop, that makes sense ... and several of the topics that came up in the meeting kept me thinking into the evening next meeting looks like 17 Dec JAR: [scribe too sleepy...] I'm starting to feel more in sync with the group ADJOURN Dan and Noah cleaned up some action states action-213? <trackbot> ACTION-213 -- Noah Mendelsohn to prepare 17 Dec weekly teleconference agenda -- due 2009-12-16 -- PENDINGREVIEW <trackbot> close action-277 <trackbot> ACTION-277 Ensure patent policy issue is resolved with Art closed close action-306 <trackbot> ACTION-306 Work with Raman, LM, JK to update Web APplication architecture outline based on discussions at TAG meetings closed action-327 close action-328 <trackbot> ACTION-328 Convey to the EXIWG the resolution "We thank the EXI WG for registering the conetnt encoding and encourage them in their endeavours.". closed
http://www.w3.org/2001/tag/2009/12/10-tagmem-minutes.html
CC-MAIN-2016-40
refinedweb
8,564
68.1
Basic Column GridViewColumn is the base column type on top of which the other columns are built. It provides the common functionality typical for RadGridView's columns. GridViewColumn inherits from FrameworkContentElement. You can add aggregate functions to display their result in the column footers, manage the headers and cells, apply different styling for the its header and cells, reorder it, etc. The most common usage of this type of column is when you want to define a column that doesn't bind to any data. Such a column is frequently referred as “unbound” column. A typical usage of such column involves setting the CellStyle/CellTemplate properties in order to place custom content within the cells such as buttons, checkboxes or even composite user controls rather than displaying data from the items source. You can check the Setting CellTemplate and CellEditTemplate article for more information on how to define your own CellTemplate or CellEditTemplate. Here is a list of the most important properties and how they can be used. AggregateFunctions - this property allows defining aggregate functions, which results will appear in the column footer. Read more here. CellEditTemplate, CellStyle, CellTemplate - by setting these properties you are able to modify the default look of the cells in the columns e.g. to place custom elements in the cell. Read more here. Footer, FooterCellStyle, GroupFooterStyle - by setting these properties you are able to modify the content and the appearance of the column footers. To learn how read the Column Footers topic. Header, HeaderCellStyle - by setting these properties you can modify the content and the appearance of the column headers. More about the headers can be found in the Column Headers topic. ToolTipTemplate - set to a DataTemplate to be shown when the mouse is over the column. Read more at Add ToolTip for columns and headers topic. ToolTipTemplateSelector - gets or sets the data template selector for the cell tooltip. IsFrozen - indicates whether the column is frozen or not. To learn more read the Frozen Columns topic. IsGroupable - indicates whether the data in the RadGridView can be grouped by this column. More about grouping is to be found here. IsReadOnly - indicates whether the cells in the column can be edited. More about editing the data in the RadGridView can be found here. IsReordable - indicates whether the column can change its place in relation to the other columns in the collection. To learn more read the Reordering Columns topic. IsResizable - indicates whether the user is allowed to resize the column. To learn more read the Resizing Columns topic. IsSortable - indicates whether the user is allowed to sort by this column. More about sorting the data in the RadGridView can be found here. IsFilterable - indicates whether the column can be filtered or not and whether the filtering UI (e.g. the funnel) is displayed in the respective header. More about filtering can be found here. ShowDistinctFilters - indicates whether the user will see the distinct values in the filtering dialog. To learn more read the Filtering topics. ShowFieldFilters - indicates whether the user will see the field filters (for manual entering the filter text) in the filtering dialog. To learn more read the Filtering topics. FilterMemberPath - Gets or sets the FilterMemberPath for this column. More about Filter Member Path can be found here. FilterMemberType Gets or sets the filter member type of the column. Set this property when the type cannot be automatically discovered from the FilterMemberPath. SortingState - provides information about how the data is sorted - ascending, descending or not sorted. More about sorting the data in the RadGridView can be found here. GroupMemberPath - defines the name of the property the data in the column will be grouped by. SortMemberPath- defines the name of the property the data in the column will be sorted by. GroupHeaderFormatString - defines the format of the group header. ShowColumnWhenGrouped - indicates whether the column should be visible when grid is grouped by this column. TabStopMode - Gets or sets the tab stop mode which denotes if cell could gain focus via TAB key. TextDecorations - Gets or sets the text decoration. Affects all the cells in the column. This is a dependency property. TextTrimming - Gets or sets TextTrimming that will be used to trim the text in this column cells. This is a dependency property. TextWrapping - Gets or sets TextWrapping that will be used to wrap the text in this column cells. This is a dependency property. Here is how to define a column of this type. Example 1: Define GridViewColumn in XAML: <telerik:RadGridView x: <telerik:RadGridView.Columns> <telerik:GridViewColumn /> </telerik:RadGridView.Columns> </telerik:RadGridView> Example 2: Define GridViewColumn in code: GridViewColumn column = new GridViewColumn(); this.radGridView.Columns.Add(column); Dim column As New GridViewColumn() Me.radGridView.Columns.Add(column) The columns are to be found in the same namespace as RadGridView control.
https://docs.telerik.com/devtools/wpf/controls/radgridview/columns/columntypes/column-types-basic-column
CC-MAIN-2019-13
refinedweb
797
59.19
With Python’s property(), you can create managed attributes in your classes. You can use managed attributes, also known as properties, when you need to modify their internal implementation without changing the public API of the class. Providing stable APIs can help you avoid breaking your users’ code when they rely on your classes and objects. Properties are arguably the most popular way to create managed attributes quickly and in the purest Pythonic style. In this tutorial, you’ll learn how to: - Create managed attributes or properties in your classes - Perform lazy attribute evaluation and provide computed attributes - Avoid setter and getter methods to make your classes more Pythonic - Create read-only, read-write, and write-only properties - Create consistent and backward-compatible APIs for your classes You’ll also write a few practical examples that use property() for validating input data, computing attribute values dynamically, logging your code, and more. To get the most out of this tutorial, you should know the basics of object-oriented programming and decorators in Python. Free Bonus: 5 Thoughts On Python Mastery, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level. When you define a class in an object-oriented programming language, you’ll probably end up with some instance and class attributes. In other words, you’ll end up with variables that are accessible through the instance, class, or even both, depending on the language. Attributes represent or hold the internal state of a given object, which you’ll often need to access and mutate. Typically, you have at least two ways to manage an attribute. Either you can access and mutate the attribute directly or you can use methods. Methods are functions attached to a given class. They provide the behaviors and actions that an object can perform with its internal data and attributes. If you expose your attributes to the user, then they become part of the public API of your classes. Your user will access and mutate them directly in their code. The problem comes when you need to change the internal implementation of a given attribute. Say you’re working on a Circle class. The initial implementation has a single attribute called .radius. You finish coding the class and make it available to your end users. They start using Circle in their code to create a lot of awesome projects and applications. Good job! Now suppose that you have an important user that comes to you with a new requirement. They don’t want Circle to store the radius any longer. They need a public .diameter attribute. At this point, removing .radius to start using .diameter could break the code of some of your end users. You need to manage this situation in a way other than removing .radius. Programming languages such as Java and C++ encourage you to never expose your attributes to avoid this kind of problem. Instead, you should provide getter and setter methods, also known as accessors and mutators, respectively. These methods offer a way to change the internal implementation of your attributes without changing your public API. Note: Getter and setter methods are often considered an anti-pattern and a signal of poor object-oriented design. The main argument behind this proposition is that these methods break encapsulation. They allow you to access and mutate the components of your objects. In the end, these languages need getter and setter methods because they don’t provide a suitable way to change the internal implementation of an attribute if a given requirement changes. Changing the internal implementation would require an API modification, which can break your end users’ code. Technically, there’s nothing that stops you from using getter and setter methods in Python. Here’s how this approach would look: # point.py class Point: def __init__(self, x, y): self._x = x self._y = y def get_x(self): return self._x def set_x(self, value): self._x = value def get_y(self): return self._y def set_y(self, value): self._y = value In this example, you create Point with two non-public attributes ._x and ._y to hold the Cartesian coordinates of the point at hand. Note: Python doesn’t have the notion of access modifiers, such as private, protected, and public, to restrict access to attributes and methods. In Python, the distinction is between public and non-public class members. If you want to signal that a given attribute or method is non-public, then you have to use the well-known Python convention of prefixing the name with an underscore ( _). That’s the reason behind the naming of the attributes ._x and ._y. Note that this is just a convention. It doesn’t stop you and other programmers from accessing the attributes using dot notation, as in obj._attr. However, it’s bad practice to violate this convention. To access and mutate the value of either ._x or ._y, you can use the corresponding getter and setter methods. Go ahead and save the above definition of Point in a Python module and import the class into your interactive shell. Here’s how you can work with Point in your code: >>> from point import Point >>> point = Point(12, 5) >>> point.get_x() 12 >>> point.get_y() 5 >>> point.set_x(42) >>> point.get_x() 42 >>> # Non-public attributes are still accessible >>> point._x 42 >>> point._y 5 With .get_x() and .get_y(), you can access the current values of ._x and ._y. You can use the setter method to store a new value in the corresponding managed attribute. From this code, you can confirm that Python doesn’t restrict access to non-public attributes. Whether or not you do so is up to you. Even though the example you just saw uses the Python coding style, it doesn’t look Pythonic. In the example, the getter and setter methods don’t perform any further processing with ._x and ._y. You can rewrite Point in a more concise and Pythonic way: >>> class Point: ... def __init__(self, x, y): ... self.x = x ... self.y = y ... >>> point = Point(12, 5) >>> point.x 12 >>> point.y 5 >>> point.x = 42 >>> point.x 42 This code uncovers a fundamental principle. Exposing attributes to the end user is normal and common in Python. You don’t need to clutter your classes with getter and setter methods all the time, which sounds pretty cool! However, how can you handle requirement changes that would seem to involve API changes? Unlike Java and C++, Python provides handy tools that allow you to change the underlying implementation of your attributes without changing your public API. The most popular approach is to turn your attributes into properties. Note: Another common approach to provide managed attributes is to use descriptors. In this tutorial, however, you’ll learn about properties. Properties represent an intermediate functionality between a plain attribute (or field) and a method. In other words, they allow you to create methods that behave like attributes. With properties, you can change how you compute the target attribute whenever you need to do so. For example, you can turn both .x and .y into properties. With this change, you can continue accessing them as attributes. You’ll also have an underlying method holding .x and .y that will allow you to modify their internal implementation and perform actions on them right before your users access and mutate them. Note: Properties aren’t exclusive to Python. Languages such as JavaScript, C#, Kotlin, and others also provide tools and techniques for creating properties as class members. The main advantage of Python properties is that they allow you to expose your attributes as part of your public API. If you ever need to change the underlying implementation, then you can turn the attribute into a property at any time without much pain. In the following sections, you’ll learn how to create properties in Python. Python’s property() is the Pythonic way to avoid formal getter and setter methods in your code. This function allows you to turn class attributes into properties or managed attributes. Since property() is a built-in function, you can use it without importing anything. Additionally, property() was implemented in C to ensure optimal performance. Note: It’s common to refer to property() as a built-in function. However, property is a class designed to work as a function rather than as a regular class. That’s why most Python developers call it a function. That’s also the reason why property() doesn’t follow the Python convention for naming classes. This tutorial follows the common practices of calling property() a function rather than a class. However, in some sections, you’ll see it called a class to facilitate the explanation. With property(), you can attach getter and setter methods to given class attributes. This way, you can handle the internal implementation for that attribute without exposing getter and setter methods in your API. You can also specify a way to handle attribute deletion and provide an appropriate docstring for your properties. Here’s the full signature of property(): property(fget=None, fset=None, fdel=None, doc=None) The first two arguments take function objects that will play the role of getter ( fget) and setter ( fset) methods. Here’s a summary of what each argument does: The return value of property() is the managed attribute itself. If you access the managed attribute, as in obj.attr, then Python automatically calls fget(). If you assign a new value to the attribute, as in obj.attr = value, then Python calls fset() using the input value as an argument. Finally, if you run a del obj.attr statement, then Python automatically calls fdel(). Note: The first three arguments to property() take function objects. You can think of a function object as the function name without the calling pair of parentheses. You can use doc to provide an appropriate docstring for your properties. You and your fellow programmers will be able to read that docstring using Python’s help(). The doc argument is also useful when you’re working with code editors and IDEs that support docstring access. You can use property() either as a function or a decorator to build your properties. In the following two sections, you’ll learn how to use both approaches. However, you should know up front that the decorator approach is more popular in the Python community. You can create a property by calling property() with an appropriate set of arguments and assigning its return value to a class attribute. All the arguments to property() are optional. However, you typically provide at least a setter function. The following example shows how to create a Circle class with a handy property to manage its radius: # circle.py class Circle: def __init__(self, radius): self._radius = radius def _get_radius(self): print("Get radius") return self._radius def _set_radius(self, value): print("Set radius") self._radius = value def _del_radius(self): print("Delete radius") del self._radius radius = property( fget=_get_radius, fset=_set_radius, fdel=_del_radius, doc="The radius property." ) In this code snippet, you create Circle. The class initializer, .__init__(), takes radius as an argument and stores it in a non-public attribute called ._radius. Then you define three non-public methods: ._get_radius()returns the current value of ._radius ._set_radius()takes valueas an argument and assigns it to ._radius ._del_radius()deletes the instance attribute ._radius Once you have these three methods in place, you create a class attribute called .radius to store the property object. To initialize the property, you pass the three methods as arguments to property(). You also pass a suitable docstring for your property. In this example, you use keyword arguments to improve the code readability and prevent confusion. That way, you know exactly which method goes into each argument. To give Circle a try, run the following code in your Python shell: >>>. The .radius property hides the non-public instance attribute ._radius, which is now your managed attribute in this example. You can access and assign .radius directly. Internally, Python automatically calls ._get_radius() and ._set_radius() when needed. When you execute del circle.radius, Python calls ._del_radius(), which deletes the underlying ._radius. Besides using regular named functions to provide getter methods in your properties, you can also use lambda functions. Here’s a version of Circle in which the .radius property uses a lambda function as its getter method: >>> class Circle: ... def __init__(self, radius): ... self._radius = radius ... radius = property(lambda self: self._radius) ... >>> circle = Circle(42.0) >>> circle.radius 42.0 If the functionality of your getter method is limited to just returning the current value of the managed attribute, then using a lambda function can be a handy approach. Properties are class attributes that manage instance attributes. You can think of a property as a collection of methods bundled together. If you inspect .radius carefully, then you can find the raw methods you provided as the fget, fset, and fdel arguments: >>> from circle import Circle >>> Circle.radius.fget <function Circle._get_radius at 0x7fba7e1d7d30> >>> Circle.radius.fset <function Circle._set_radius at 0x7fba7e1d78b0> >>> Circle.radius.fdel <function Circle._del_radius at 0x7fba7e1d7040> >>> dir(Circle.radius) [..., '__get__', ..., '__set__', ...] You can access the getter, setter, and deleter methods in a given property through the corresponding .fget, .fset, and .fdel. Properties are also overriding descriptors. If you use dir() to check the internal members of a given property, then you’ll find .__set__() and .__get__() in the list. These methods provide a default implementation of the descriptor protocol. Note: If you want to better understand the internal implementation of property as a class, then check out the pure Python Property class described in the documentation. The default implementation of .__set__(), for example, runs when you don’t provide a custom setter method. In this case, you get an AttributeError because there’s no way to set the underlying property. Decorators are everywhere in Python. They’re functions that take another function as an argument and return a new function with added functionality. With a decorator, you can attach pre- and post-processing operations to an existing function. When Python 2.2 introduced property(), the decorator syntax wasn’t available. The only way to define properties was to pass getter, setter, and deleter methods, as you learned before. The decorator syntax was added in Python 2.4, and nowadays, using property() as a decorator is the most popular practice in the Python community. The decorator syntax consists of placing the name of the decorator function with a leading @ symbol right before the definition of the function you want to decorate: @decorator def func(a): return a In this code fragment, @decorator can be a function or class intended to decorate func(). This syntax is equivalent to the following: def func(a): return a func = decorator(func) The final line of code reassigns the name func to hold the result of calling decorator(func). Note that this is the same syntax you used to create a property in the section above. Python’s property() can also work as a decorator, so you can use the @property syntax to create your properties quickly: 1# circle.py 2 3class Circle: 4 def __init__(self, radius): 5 self._radius = radius 6 7 @property 8 def radius(self): 9 """The radius property.""" 10 print("Get radius") 11 return self._radius 12 13 @radius.setter 14 def radius(self, value): 15 print("Set radius") 16 self._radius = value 17 18 @radius.deleter 19 def radius(self): 20 print("Delete radius") 21 del self._radius This code looks pretty different from the getter and setter methods approach. Circle now looks more Pythonic and clean. You don’t need to use method names such as ._get_radius(), ._set_radius(), and ._del_radius() anymore. Now you have three methods with the same clean and descriptive attribute-like name. How is that possible? The decorator approach for creating properties requires defining a first method using the public name for the underlying managed attribute, which is .radius in this case. This method should implement the getter logic. In the above example, lines 7 to 11 implement that method. Lines 13 to 16 define the setter method for .radius. In this case, the syntax is fairly different. Instead of using @property again, you use @radius.setter. Why do you need to do that? Take another look at the dir() output: >>> dir(Circle.radius) [..., 'deleter', ..., 'getter', 'setter'] Besides .fget, .fset, .fdel, and a bunch of other special attributes and methods, property also provides .deleter(), .getter(), and .setter(). These three methods each return a new property. When you decorate the second .radius() method with @radius.setter (line 13), you create a new property and reassign the class-level name .radius (line 8) to hold it. This new property contains the same set of methods of the initial property at line 8 with the addition of the new setter method provided on line 14. Finally, the decorator syntax reassigns the new property to the .radius class-level name. The mechanism to define the deleter method is similar. This time, you need to use the @radius.deleter decorator. At the end of the process, you get a full-fledged property with the getter, setter, and deleter methods. Finally, how can you provide suitable docstrings for your properties when you use the decorator approach? If you check Circle again, you’ll note that you already did so by adding a docstring to the getter method on line 9. The new Circle implementation works the same as the example in the section above: >>>. You don’t need to use a pair of parentheses for calling .radius() as a method. Instead, you can access .radius as you would access a regular attribute, which is the primary use of properties. They allow you to treat methods as attributes, and they take care of calling the underlying set of methods automatically. Here’s a recap of some important points to remember when you’re creating properties with the decorator approach: - The @propertydecorator must decorate the getter method. - The docstring must go in the getter method. - The setter and deleter methods must be decorated with the name of the getter method plus .setterand .getter, respectively. Up to this point, you’ve created managed attributes using property() as a function and as a decorator. If you check your Circle implementations so far, then you’ll note that their getter and setter methods don’t add any real extra processing on top of your attributes. In general, you should avoid turning attributes that don’t require extra processing into properties. Using properties in those situations can make your code: - Unnecessarily verbose - Confusing to other developers - Slower than code based on regular attributes Unless you need something more than bare attribute access, don’t write properties. They’re a waste of CPU time, and more importantly, they’re a waste of your time. Finally, you should avoid writing explicit getter and setter methods and then wrapping them in a property. Instead, use the @property decorator. That’s currently the most Pythonic way to go. Probably the most elementary use case of property() is to provide read-only attributes in your classes. Say you need an immutable Point class that doesn’t allow the user to mutate the original value of its coordinates, x and y. To achieve this goal, you can create Point like in the following example: # point.py class Point: def __init__(self, x, y): self._x = x self._y = y @property def x(self): return self._x @property def y(self): return self._y Here, you store the input arguments in the attributes ._x and ._y. As you already learned, using the leading underscore ( _) in names tells other developers that they’re non-public attributes and shouldn’t be accessed using dot notation, such as in point._x. Finally, you define two getter methods and decorate them with @property. Now you have two read-only properties, .x and .y, as your coordinates: >>> from point import Point >>> point = Point(12, 5) >>> # Read coordinates >>> point.x 12 >>> point.y 5 >>> # Write coordinates >>> point.x = 42 Traceback (most recent call last): ... AttributeError: can't set attribute Here, point.x and point.y are bare-bone examples of read-only properties. Their behavior relies on the underlying descriptor that property provides. As you already saw, the default .__set__() implementation raises an AttributeError when you don’t define a proper setter method. You can take this implementation of Point a little bit further and provide explicit setter methods that raise a custom exception with more elaborate and specific messages: # point.py class WriteCoordinateError(Exception): pass class Point: def __init__(self, x, y): self._x = x self._y = y @property def x(self): return self._x @x.setter def x(self, value): raise WriteCoordinateError("x coordinate is read-only") @property def y(self): return self._y @y.setter def y(self, value): raise WriteCoordinateError("y coordinate is read-only") In this example, you define a custom exception called WriteCoordinateError. This exception allows you to customize the way you implement your immutable Point class. Now, both setter methods raise your custom exception with a more explicit message. Go ahead and give your improved Point a try! You can also use property() to provide managed attributes with read-write capabilities. In practice, you just need to provide the appropriate getter method (“read”) and setter method (“write”) to your properties in order to create read-write managed attributes. Say you want your Circle class to have a .diameter attribute. However, taking the radius and the diameter in the class initializer seems unnecessary because you can compute the one using the other. Here’s a Circle that manages .radius and .diameter as read-write attributes: # circle.py import math class Circle: def __init__(self, radius): self.radius = radius @property def radius(self): return self._radius @radius.setter def radius(self, value): self._radius = float(value) @property def diameter(self): return self.radius * 2 @diameter.setter def diameter(self, value): self.radius = value / 2 Here, you create a Circle class with a read-write .radius. In this case, the getter method just returns the radius value. The setter method converts the input value for the radius and assigns it to the non-public ._radius, which is the variable you use to store the final data. There is a subtle detail to note in this new implementation of Circle and its .radius attribute. In this case, the class initializer assigns the input value to the .radius property directly instead of storing it in a dedicated non-public attribute, such as ._radius. Why? Because you need to make sure that every value provided as a radius, including the initialization value, goes through the setter method and gets converted to a floating-point number. Circle also implements a .diameter attribute as a property. The getter method computes the diameter using the radius. The setter method does something curious. Instead of storing the input diameter value in a dedicated attribute, it calculates the radius and writes the result into .radius. Here’s how your Circle works: >>> from circle import Circle >>> circle = Circle(42) >>> circle.radius 42.0 >>> circle.diameter 84.0 >>> circle.diameter = 100 >>> circle.diameter 100.0 >>> circle.radius 50.0 Both .radius and .diameter work as normal attributes in these examples, providing a clean and Pythonic public API for your Circle class. You can also create write-only attributes by tweaking how you implement the getter method of your properties. For example, you can make your getter method raise an exception every time a user accesses the underlying attribute value. Here’s an example of handling passwords with a write-only property: # users.py import hashlib import os class User: def __init__(self, name, password): self.name = name self.password = password @property def password(self): raise AttributeError("Password is write-only") @password.setter def password(self, plaintext): salt = os.urandom(32) self._hashed_password = hashlib.pbkdf2_hmac( "sha256", plaintext.encode("utf-8"), salt, 100_000 ) The initializer of User takes a username and a password as arguments and stores them in .name and .password, respectively. You use a property to manage how your class processes the input password. The getter method raises an AttributeError whenever a user tries to retrieve the current password. This turns .password into a write-only attribute: >>> from users import User >>> john = User("John", "secret") >>> john._hashed_password b'b\xc7^ai\x9f3\xd2g ... \x89^-\x92\xbe\xe6' >>> john.password Traceback (most recent call last): ... AttributeError: Password is write-only >>> john.>> john._hashed_password b'\xe9l$\x9f\xaf\x9d ... b\xe8\xc8\xfcaU\r_' In this example, you create john as a User instance with an initial password. The setter method hashes the password and stores it in ._hashed_password. Note that when you try to access .password directly, you get an AttributeError. Finally, assigning a new value to .password triggers the setter method and creates a new hashed password. In the setter method of .password, you use os.urandom() to generate a 32-byte random string as your hashing function’s salt. To generate the hashed password, you use hashlib.pbkdf2_hmac(). Then you store the resulting hashed password in the non-public attribute ._hashed_password. Doing so ensures that you never save the plaintext password in any retrievable attribute. So far, you’ve learned how to use Python’s property() built-in function to create managed attributes in your classes. You used property() as a function and as a decorator and learned about the differences between these two approaches. You also learned how to create read-only, read-write, and write-only attributes. In the following sections, you’ll code a few examples that will help you get a better practical understanding of common use cases of property(). One of the most common use cases of property() is building managed attributes that validate the input data before storing or even accepting it as a secure input. Data validation is a common requirement in code that takes input from users or other information sources that you consider untrusted. Python’s property() provides a quick and reliable tool for dealing with input data validation. For example, thinking back to the Point example, you may require the values of .x and .y to be valid numbers. Since your users are free to enter any type of data, you need to make sure that your point only accepts numbers. Here’s an implementation of Point that manages this requirement: # point.py class Point: def __init__(self, x, y): self.x = x self.y = y @property def x(self): return self._x @x.setter def x(self, value): try: self._x = float(value) print("Validated!") except ValueError: raise ValueError('"x" must be a number') from None @property def y(self): return self._y @y.setter def y(self, value): try: self._y = float(value) print("Validated!") except ValueError: raise ValueError('"y" must be a number') from None The setter methods of .x and .y use try … except blocks that validate input data using the Python EAFP style. If the call to float() succeeds, then the input data is valid, and you get Validated! on your screen. If float() raises a ValueError, then the user gets a ValueError with a more specific message. Note: In the example above, you use the syntax raise … from None to hide internal details related to the context in which you’re raising the exception. From the end user’s viewpoint, these details can be confusing and make your class look unpolished. raise statement in the documentation for more information about this topic. It’s important to note that assigning the .x and .y properties directly in .__init__() ensures that the validation also occurs during object initialization. Not doing so is a common mistake when using property() for data validation. Here’s how your Point class works now: >>> from point import Point >>> point = Point(12, 5) Validated! Validated! >>> point.x 12.0 >>> point.y 5.0 >>> point.x = 42 Validated! >>> point.x 42.0 >>> point.y = 100.0 Validated! >>> point.y 100.0 >>> point.x = "one" Traceback (most recent call last): ... ValueError: "x" must be a number >>> point.y = "1o" Traceback (most recent call last): ... ValueError: "y" must be a number If you assign .x and .y values that float() can turn into floating-point numbers, then the validation is successful, and the value is accepted. Otherwise, you get a ValueError. This implementation of Point uncovers a fundamental weakness of property(). Did you spot it? That’s it! You have repetitive code that follows specific patterns. This repetition breaks the DRY (Don’t Repeat Yourself) principle, so you would want to refactor this code to avoid it. To do so, you can abstract out the repetitive logic using a descriptor: # point.py class Coordinate: def __set_name__(self, owner, name): self._name = name def __get__(self, instance, owner): return instance.__dict__[self._name] def __set__(self, instance, value): try: instance.__dict__[self._name] = float(value) print("Validated!") except ValueError: raise ValueError(f'"{self._name}" must be a number') from None class Point: x = Coordinate() y = Coordinate() def __init__(self, x, y): self.x = x self.y = y Now your code is a bit shorter. You managed to remove repetitive code by defining Coordinate as a descriptor that manages your data validation in a single place. The code works just like your earlier implementation. Go ahead and give it a try! In general, if you find yourself copying and pasting property definitions all around your code or if you spot repetitive code like in the example above, then you should consider using a proper descriptor. If you need an attribute that builds its value dynamically whenever you access it, then property() is the way to go. These kinds of attributes are commonly known as computed attributes. They’re handy when you need them to look like eager attributes, but you want them to be lazy. The main reason for creating eager attributes is to optimize computation costs when you access the attribute often. On the other hand, if you rarely use a given attribute, then a lazy property can postpone its computation until needed, which can make your programs more efficient. Here’s an example of how to use property() to create a computed attribute .area in a Rectangle class: class Rectangle: def __init__(self, width, height): self.width = width self.height = height @property def area(self): return self.width * self.height In this example, the Rectangle initializer takes width and height as arguments and stores them in regular instance attributes. The read-only property .area computes and returns the area of the current rectangle every time you access it. Another common use case of properties is to provide an auto-formatted value for a given attribute: class Product: def __init__(self, name, price): self._name = name self._price = float(price) @property def price(self): return f"${self._price:,.2f}" In this example, .price is a property that formats and returns the price of a particular product. To provide a currency-like format, you use an f-string with appropriate formatting options. Note: This example uses floating-point numbers to represent currencies, which is bad practice. Instead, you should use decimal.Decimal from the standard library. As a final example of computed attributes, say you have a Point class that uses .x and .y as Cartesian coordinates. You want to provide polar coordinates for your point so that you can use them in a few computations. The polar coordinate system represents each point using the distance to the origin and the angle with the horizontal coordinate axis. Here’s a Cartesian coordinates Point class that also provides computed polar coordinates: # point.py import math class Point: def __init__(self, x, y): self.x = x self.y = y @property def distance(self): return round(math.dist((0, 0), (self.x, self.y))) @property def angle(self): return round(math.degrees(math.atan(self.y / self.x)), 1) def as_cartesian(self): return self.x, self.y def as_polar(self): return self.distance, self.angle This example shows how to compute the distance and angle of a given Point object using its .x and .y Cartesian coordinates. Here’s how this code works in practice: >>> from point import Point >>> point = Point(12, 5) >>> point.x 12 >>> point.y 5 >>> point.distance 13 >>> point.angle 22.6 >>> point.as_cartesian() (12, 5) >>> point.as_polar() (13, 22.6) When it comes to providing computed or lazy attributes, property() is a pretty handy tool. However, if you’re creating an attribute that you use frequently, then computing it every time can be costly and wasteful. A good strategy is to cache them once the computation is done. Sometimes you have a given computed attribute that you use frequently. Constantly repeating the same computation may be unnecessary and expensive. To work around this problem, you can cache the computed value and save it in a non-public dedicated attribute for further reuse. To prevent unexpected behaviors, you need to think of the mutability of the input data. If you have a property that computes its value from constant input values, then the result will never change. In that case, you can compute the value just once: # circle.py from time import sleep class Circle: def __init__(self, radius): self.radius = radius self._diameter = None @property def diameter(self): if self._diameter is None: sleep(0.5) # Simulate a costly computation self._diameter = self.radius * 2 return self._diameter Even though this implementation of Circle properly caches the computed diameter, it has the drawback that if you ever change the value of .radius, then .diameter won’t return a correct value: >>> from circle import Circle >>> circle = Circle(42.0) >>> circle.radius 42.0 >>> circle.diameter # With delay 84.0 >>> circle.diameter # Without delay 84.0 >>> circle.radius = 100.0 >>> circle.diameter # Wrong diameter 84.0 In these examples, you create a circle with a radius equal to 42.0. The .diameter property computes its value only the first time you access it. That’s why you see a delay in the first execution and no delay in the second. Note that even though you change the value of the radius, the diameter stays the same. If the input data for a computed attribute mutates, then you need to recalculate the attribute: # circle.py from time import sleep class Circle: def __init__(self, radius): self.radius = radius @property def radius(self): return self._radius @radius.setter def radius(self, value): self._diameter = None self._radius = value @property def diameter(self): if self._diameter is None: sleep(0.5) # Simulate a costly computation self._diameter = self._radius * 2 return self._diameter The setter method of the .radius property resets ._diameter to None every time you change the value of the radius. With this little update, .diameter recalculates its value the first time you access it after every mutation of .radius: >>> from circle import Circle >>> circle = Circle(42.0) >>> circle.radius 42.0 >>> circle.diameter # With delay 84.0 >>> circle.diameter # Without delay 84.0 >>> circle.radius = 100.0 >>> circle.diameter # With delay 200.0 >>> circle.diameter # Without delay 200.0 Cool! Circle works correctly now! It computes the diameter the first time you access it and also every time you change the radius. Another option to create cached properties is to use functools.cached_property() from the standard library. This function works as a decorator that allows you to transform a method into a cached property. The property computes its value only once and caches it as a normal attribute during the lifetime of the instance: # circle.py from functools import cached_property from time import sleep class Circle: def __init__(self, radius): self.radius = radius @cached_property def diameter(self): sleep(0.5) # Simulate a costly computation return self.radius * 2 Here, .diameter computes and caches its value the first time you access it. This kind of implementation is suitable for those computations in which the input values don’t mutate. Here’s how it works: >>> from circle import Circle >>> circle = Circle(42.0) >>> circle.diameter # With delay 84.0 >>> circle.diameter # Without delay 84.0 >>> circle.radius = 100 >>> circle.diameter # Wrong diameter 84.0 >>> # Allow direct assignment >>> circle.diameter = 200 >>> circle.diameter # Cached value 200 When you access .diameter, you get its computed value. That value remains the same from this point on. However, unlike property(), cached_property() doesn’t block attribute mutations unless you provide a proper setter method. That’s why you can update the diameter to 200 in the last couple of lines. If you want to create a cached property that doesn’t allow modification, then you can use property() and functools.cache() like in the following example: # circle.py from functools import cache from time import sleep class Circle: def __init__(self, radius): self.radius = radius @property @cache def diameter(self): sleep(0.5) # Simulate a costly computation return self.radius * 2 This code stacks @property on top of @cache. The combination of both decorators builds a cached property that prevents mutations: >>> from circle import Circle >>> circle = Circle(42.0) >>> circle.diameter # With delay 84.0 >>> circle.diameter # Without delay 84.0 >>> circle.radius = 100 >>> circle.diameter 84.0 >>> circle.diameter = 200 Traceback (most recent call last): ... AttributeError: can't set attribute In these examples, when you try to assign a new value to .diameter, you get an AttributeError because the setter functionality comes from the internal descriptor of property. Sometimes you need to keep track of what your code does and how your programs flow. A way to do that in Python is to use logging. This module provides all the functionality you would require for logging your code. It’ll allow you to constantly watch the code and generate useful information about how it works. If you ever need to keep track of how and when you access and mutate a given attribute, then you can take advantage of property() for that, too: # circle.py import logging logging.basicConfig( format="%(asctime)s: %(message)s", level=logging.INFO, datefmt="%H:%M:%S" ) class Circle: def __init__(self, radius): self._msg = '"radius" was %s. Current value: %s' self.radius = radius @property def radius(self): """The radius property.""" logging.info(self._msg % ("accessed", str(self._radius))) return self._radius @radius.setter def radius(self, value): try: self._radius = float(value) logging.info(self._msg % ("mutated", str(self._radius))) except ValueError: logging.info('validation error while mutating "radius"') Here, you first import logging and define a basic configuration. Then you implement Circle with a managed attribute .radius. The getter method generates log information every time you access .radius in your code. The setter method logs each mutation that you perform on .radius. It also logs those situations in which you get an error because of bad input data. Here’s how you can use Circle in your code: >>> from circle import Circle >>> circle = Circle(42.0) >>> circle.radius 14:48:59: "radius" was accessed. Current value: 42.0 42.0 >>> circle.radius = 100 14:49:15: "radius" was mutated. Current value: 100 >>> circle.radius 14:49:24: "radius" was accessed. Current value: 100 100 >>> circle.radius = "value" 15:04:51: validation error while mutating "radius" Logging useful data from attribute access and mutation can help you debug your code. Logging can also help you identify sources of problematic data input, analyze the performance of your code, spot usage patterns, and more. You can also create properties that implement deleting functionality. This might be a rare use case of property(), but having a way to delete an attribute can be handy in some situations. Say you’re implementing your own tree data type. A tree is an abstract data type that stores elements in a hierarchy. The tree components are commonly known as nodes. Each node in a tree has a parent node, except for the root node. Nodes can have zero or more children. Now suppose you need to provide a way to delete or clear the list of children of a given node. Here’s an example that implements a tree node that uses property() to provide most of its functionality, including the ability to clear the list of children of the node at hand: # tree.py class TreeNode: def __init__(self, data): self._data = data self._children = [] @property def children(self): return self._children @children.setter def children(self, value): if isinstance(value, list): self._children = value else: del self.children self._children.append(value) @children.deleter def children(self): self._children.clear() def __repr__(self): return f'{self.__class__.__name__}("{self._data}")' In this example, TreeNode represents a node in your custom tree data type. Each node stores its children in a Python list. Then you implement .children as a property to manage the underlying list of children. The deleter method calls .clear() on the list of children to remove them all: >>> from tree import TreeNode >>> root = TreeNode("root") >>> child1 = TreeNode("child 1") >>> child2 = TreeNode("child 2") >>> root.children = [child1, child2] >>> root.children [TreeNode("child 1"), TreeNode("child 2")] >>> del root.children >>> root.children [] Here, you first create a root node to start populating the tree. Then you create two new nodes and assign them to .children using a list. The del statement triggers the internal deleter method of .children and clears the list. As you already know, properties turn method calls into direct attribute lookups. This feature allows you to create clean and Pythonic APIs for your classes. You can expose your attributes publicly without the need for getter and setter methods. If you ever need to modify how you compute a given public attribute, then you can turn it into a property. Properties make it possible to perform extra processing, such as data validation, without having to modify your public APIs. Suppose you’re creating an accounting application and you need a base class to manage currencies. To this end, you create a Currency class that exposes two attributes, .units and .cents: class Currency: def __init__(self, units, cents): self.units = units self.cents = cents # Currency implementation... This class looks clean and Pythonic. Now say that your requirements change, and you decide to store the total number of cents instead of the units and cents. Removing .units and .cents from your public API to use something like .total_cents would break more than one client’s code. In this situation, property() can be an excellent option to keep your current API unchanged. Here’s how you can work around the problem and avoid breaking your clients’ code: # currency.py CENTS_PER_UNIT = 100 class Currency: def __init__(self, units, cents): self._total_cents = units * CENTS_PER_UNIT + cents @property def units(self): return self._total_cents // CENTS_PER_UNIT @units.setter def units(self, value): self._total_cents = self.cents + value * CENTS_PER_UNIT @property def cents(self): return self._total_cents % CENTS_PER_UNIT @cents.setter def cents(self, value): self._total_cents = self.units * CENTS_PER_UNIT + value # Currency implementation... Now your class stores the total number of cents instead of independent units and cents. However, your users can still access and mutate .units and .cents in their code and get the same result as before. Go ahead and give it a try! When you write something upon which many people are going to build, you need to guarantee that modifications to the internal implementation don’t affect how end users work with your classes. When you create Python classes that include properties and release them in a package or library, you should expect your users to do a lot of different things with them. One of those things could be subclassing them to customize their functionalities. In these cases, your users have to be careful and be aware of a subtle gotcha. If you partially override a property, then you lose the non-overridden functionality. For example, suppose you’re coding an Employee class to manage employee information in your company’s internal accounting system. You already have a class called Person, and you think about subclassing it to reuse its functionalities. Person has a .name attribute implemented as a property. The current implementation of .name doesn’t meet the requirement of returning the name in uppercase letters. Here’s how you end up solving this: # persons.py class Person: def __init__(self, name): self._name = name @property def name(self): return self._name @name.setter def name(self, value): self._name = value # Person implementation... class Employee(Person): @property def name(self): return super().name.upper() # Employee implementation... In Employee, you override .name to make sure that when you access the attribute, you get the employee name in uppercase: >>> from persons import Employee, Person >>> person = Person("John") >>> person.name 'John' >>> person.>> person.name 'John Doe' >>> employee = Employee("John") >>> employee.name 'JOHN' Great! Employee works as you need! It returns the name using uppercase letters. However, subsequent tests uncover an unexpected behavior: >>> employee.name = "John Doe" Traceback (most recent call last): ... AttributeError: can't set attribute What happened? Well, when you override an existing property from a parent class, you override the whole functionality of that property. In this example, you reimplemented the getter method only. Because of that, .name lost the rest of the functionality from the base class. You don’t have a setter method any longer. The idea is that if you ever need to override a property in a subclass, then you should provide all the functionality you need in the new version of the property at hand. A property is a special type of class member that provides functionality that’s somewhere in between regular attributes and methods. Properties allow you to modify the implementation of instance attributes without changing the public API of the class. Being able to keep your APIs unchanged helps you avoid breaking code your users wrote on top of older versions of your classes. Properties are the Pythonic way to create managed attributes in your classes. They have several use cases in real-world programming, making them a great addition to your skill set as a Python developer. In this tutorial, you learned how to: - Create managed attributes with Python’s property() - Perform lazy attribute evaluation and provide computed attributes - Avoid setter and getter methods with properties - Create read-only, read-write, and write-only attributes - Create consistent and backward-compatible APIs for your classes You also wrote several practical examples that walked you through the most common use cases of property(). Those examples include input data validation, computed attributes, logging your code, and more.
https://tefter.io/bookmarks/777292/readable
CC-MAIN-2021-49
refinedweb
7,755
60.21
Python has a variety of widget libraries, but TK is the one included in CPython. This post shows a very basic Python program that uses TK to create an application window with a label and a button. The application closes when the user clicks on the button. from tkinter import * root = Tk() Label(root, text='Click to quit => ').pack(side=LEFT, expand=YES, fill=BOTH) Button(root, text='Quit', command=sys.exit).pack(side=LEFT, expand=YES, fill=BOTH) root.mainloop() The following window appears when the application is executed. Explanation The program starts by importing the tkinter module on line 1. This module contains the widgets (or controls) that we need to create our application window. On line 3, we create a root variable and assign it to a main (or root) window by calling the Tk() function. We are now ready to start creating our controls. Line 5 creates a Label control. The first argument in the constructor is its parent window, so we pass in root. The text argument assigns text to the label. Next, we call the pack() method on the control. In our case, we use three optional arguments. Side is used to tell the layout manager which side the control should stick too. In our case, we want to left aling our controls so we use LEFT. The expand parameter tells the label to expand with the window, while the fill control tells the control which directions it should expand or shrink (horizontal, vertical, or both). Line 6 creates a Button that we can click on. The root is still the main window while the text is the button’s text. The command is the action the button should execute when clicked. In our case, we are telling the application to exit because we are passing the sys.exit function to the command argument. The pack() method does the same as the Label on line 5. Finally, we want to show the window and make the program wait for events. We do this by calling root.mainloop(). Once mainloop() executes, the script will only respond to code found in event handlers, which is command=sys.exit in our case.
https://stonesoupprogramming.com/2017/12/18/python-getting-started-with-tk/
CC-MAIN-2018-05
refinedweb
365
67.86
User talk:Dynamo From Uncyclopedia, the content-free encyclopedia edit Welcome to UnNews and Merry Kaizum Me! Reverend Zim_ulator says: "There are coffee cup stains on this copy, damnit! Now that's good UnJournalism." Welcome to UnNews, Dynam) edit UnNews I moved your latest article, so it has the UnNews: namespace prefix. --—Braydie 13:46, 27 December 2006 (UTC) edit Your Image If you want, I can steal your "camouflage" image, make it better, and give it back to you, no questions asked. No credit even taken by yours truly. I just want to help, you know? Get back to me on my talk page if you want my help. If not, welll... okay then. -- The Llama Llover!!! 23:04, 5 January 2007 (UTC) - Very well, then. I'll have it back to you soon enough!! (And this can be our little secret) --The Llama Llover!!! 23:12, 5 January 2007 (UTC) - Hello again. I finished the image, and uploaded it as a replacement to the other one. See what you think of it, and get back to me. -- The Llama Llover!!! 00:42, 6 January 2007 (UTC) Now that the camouflage image is better, you can nom it for VFH, if you'd like. It's worth a shot now. -- The Llama Llover!!! 18:56, 8 January 2007 (UTC) edit Ninjitsu
http://uncyclopedia.wikia.com/wiki/User_talk:Dynamo
CC-MAIN-2014-35
refinedweb
222
78.25
mquery— #include <sys/mman.h> void * mquery(void *addr, size_t len, int prot, int flags, int fd, off_t offset); mquery() system call checks the existing memory mappings of a process and returns hints to the caller about where to put a memory mapping. This hint can be later used when performing memory mappings with the mmap(2) system call with MAP_FIXED corresponding arguments to mmap(2). The behavior of the function depends on the flags argument. If set to MAP_FIXED the pointer addr is used as a fixed hint and mquery() will return. mquery() returns the available address. Otherwise, MAP_FAILEDis returned and errno is set to indicate the error. mquery() will fail if: EINVAL] MAP_FIXEDwas specified and the requested memory area is unavailable. ENOMEM] EBADF] mquery() function should not be used in portable applications. mquery() function first appeared in OpenBSD 3.4.
https://man.openbsd.org/mquery.2
CC-MAIN-2019-22
refinedweb
142
66.13
I recently had to build a GitOps driven CI/CD pipeline to Kubernetes for a client. Based on a few constraints — I went for an open source solution in the Flux library (). By default, Flux does not have the ability to spin up an entire new environment automatically based on a new branch in Git (which was a requirement) but this functionality was trivial to hack in by adding a new step to the CI pipeline. The end result is the ability to push to a new branch on the application repository and have an entire environment spin up automatically in Kubernetes based on that branch, with DNS automatically pointing to a subdomain named after that branch (“feature-1423.dev.myapp.com”), courtesy of ExternalDNS (). Flux: The Basics I am going to focus on Flux in the scenario of a single-app GitOps pipeline — but the ideas presented here are extensible to multi-app deploys. Note: when I say there is only a single GitOps driven deploy, that means that pushing to only one application repository — and therefore one docker registry — will trigger updates in Kubernetes. This is not to say that the deployment itself does not include multiple containers or even multiple Kubernetes deployments (in my case, both were true), just that only one application repository is triggering updates. In this simple setup, Flux depends on 2 Git repos. Firstly, the Application Repository, which ideally has some form of CI that pushes a new version to a Docker registry (which in my case was ECR). Secondly, the Infrastructure Repository — which contains the relevant YAML or helm charts that specify how the application is deployed to the cluster, as well as a Flux Workload definition: --- # Create a flux workload that will automatically update whenever # a new container with tag "dev-1" is pushedapiVersion: flux.weave.works/v1beta1 kind: HelmRelease metadata: name: dev-1 namespace: dev annotations: flux.weave.works/tag.chart-image: glob:dev-1 flux.weave.works/automated: "true" spec: releaseName: dev-1 chart: git: ssh://git@github.com/my-git-repo ref: master path: helm/charts values: image: 000000.dkr.ecr.us-east-1.amazonaws.com/my-repo-name tag: dev-1 Flux works by virtue of two mechanisms. Firstly, it syncs with your infrastructure repo and checks for Flux Workloads in a folder you specify when you start Flux on your cluster. Secondly, it polls any Docker Repositories that are specified in the Flux Workload to check for new versions. If a new version is found (and here you can set a filter in your Flux workload to only look for image tags that start with dev-*, for instance), it will update the relevant Flux workload with the new version. This is already pretty great, but the real magic happens when setting a Flux workload to deploy a Helm Chart — which is natively supported by Flux ( and). To start Flux with the helm operator, you use a command of the form: helm upgrade -i flux \ --set helmOperator.create=true \ --set helmOperator.createCRD=false \ --set git.url=git@github.com:YOURUSER/infrastructure-repo \ --namespace flux \ weaveworks/flux Now you can harness dynamic Helm templating to name and tag workloads based on container image tags — which is exactly what I needed to spin up entire environments automatically based on a new feature branch. How does this work? Flux will pass in values to Helm on an update, which you can use in your charts: # Simplified Deployment Helm Chart YAML# Helm Variables are used to name release from ECR image tagapiVersion: extensions/v1beta1 kind: Deployment metadata: name: {{ .Values.tag }} namespace: dev labels: app.kubernetes.io/name: "{{ .Values.tag }}" helm.sh/chart: {{ include "dev-release-chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: "{{ .Values.tag }}" app.kubernetes.io/instance: {{ .Release.Name }} strategy: rollingUpdate: maxSurge: 10 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app.kubernetes.io/name: "{{ .Values.tag }}" app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: app image: "{{ .Values.image }}:{{ .Values.tag}}" imagePullPolicy: Always This Helm template shows a deployment that would be named based on the exact feature branch tag on ECR, in addition to having the main app container be pulled based on that tag. In the full version, I made use of the Helm variables to automatically name external-dns entries — but you could use them for anything. The last piece of the puzzle With all of this in hand, we can automatically update our cluster on a Git (and therefore Container Repository) update to our application repo, AND we can change our Infrastructure Repo and see the new setup deployed in Kubernetes. However, each Flux Workload in the Infrastructure Repo is only good for updating one environment by default. For instance, if you set your Flux Workload to look for container tags of the form “dev-*”, and you push a new container tagged dev-2, that image will override the dev-1 currently running. This isn’t what I wanted — so I added one last piece to the setup: whenever a new branch gets created and pushed in our application repository, the CI system (in this case CircleCI) will make a Git commit and push a new Flux Workload yaml to the infrastructure repository. In this case, the Flux Workload would not specify a filter like “dev-*” but would actually specify the exact branch, “dev-1”. So new container images with that tag will automatically update the dev-1 deployment, but dev-2 will instead be associated with an entirely new deployment. This means that you can look at the infrastructure repository and see, at a glance, what workloads and branches are running in-cluster. How it works in practice For example, let’s say a developer makes a new branch of the application repo, called “dev-test-1”. They commit some changes and push the new branch. Now, our CI pipeline will perform it’s usual steps of building and pushing an image (labeled “dev-test-1” to ECR). Then, it will perform the additional step of making a commit to the Infrastructure Repo and pushing it, which will look like this: --- # Created by CI PipelineapiVersion: flux.weave.works/v1beta1 kind: HelmRelease metadata: name: dev-test-1 namespace: dev annotations: flux.weave.works/tag.chart-image: glob:dev-test-1 flux.weave.works/automated: "true" spec: releaseName: dev-test-1 chart: git: ssh://git@github.com/my-git-repo ref: master path: helm/charts values: image: 000000.dkr.ecr.us-east-1.amazonaws.com/my-repo-name tag: dev-test-1 On the next Flux sync, it will see this new workload and spin up the entire environment for our branch. In addition, whenever the branch is updated (a new image with tag dev-test-1 is pushed to ECR) it will update the workload running on Kubernetes. Next Steps If you’ve read this far, you’ve probably noticed a glaring omission: deleting environments. I haven’t implemented this yet, but it could be accomplished with a Git Webhook which would delete that specific branch from the Infrastructure Repo, which would trigger a deletion in the cluster on the next Flux poll. Keep an eye out for Part 2, where I’ll show the exact configuration and CI steps I used to get this working.
https://medium.com/rackner-engineering/fully-automated-gitops-on-kubernetes-with-weave-flux-part-1-4b0bf7d185a7
CC-MAIN-2019-35
refinedweb
1,226
50.77
Make a new image. More... #include <vil/vil_fwd.h> #include <vil/vil_image_resource.h> #include <vil/vil_blocked_image_resource.h> #include <vil/vil_pyramid_image_resource.h> #include <vil/vil_image_view.h> #include <vxl_config.h> Go to the source code of this file. Make a new image. If it's very big, it might make a disk image, with a temporary name in which case "prototype" will be consulted about issues such as file format etc. If you want more control over the exact disk format, use one of the routines with more than 4 arguments. Modifications 16 Feb 2000 AWF - Initial version. 25 Sep 2002 Ian Scott - convert to vil. 30 Mar 2007 Peter Vanroose- Removed deprecated vil_new_image_view_j_i_plane Definition in file vil_new.h. create a blocked interface around any image resource. For zero size blocks, appropriate default blocking is created Definition at line 198 of file vil_new.cxx. Make a new blocked resource file. Definition at line 156 of file vil_new.cxx. Make a new blocked resource file. Definition at line 182 of file vil_new.cxx. Make a new cached resource. Definition at line 206 of file vil_new.cxx. Make a new image of given format. If the format is not scalar, the number of planes must be 1. When you create a multi-component image in this way, the vil_image_resource API will treat it as a scalar pixel image with multiple planes. (This doesn't affect the underlying data storage.) Definition at line 32 of file vil_new.cxx. Make a new image, similar format to the prototype. Definition at line 69 of file vil_new.cxx. Make a new image. Definition at line 77 of file vil_new.cxx. Make a new image. Definition at line 123 of file vil_new.cxx. Make a new vil_image_resource, writing to file "filename", size ni x nj, copying pixel format etc from "prototype". Make a new vil_image_resource, writing to stream "os", size ni x nj, copying pixel format etc from "prototype". Make a new image of given format with interleaved planes. The format must be scalar. Definition at line 44 of file vil_new.cxx. Make a new image resource that is a wrapper on an existing view's data. Definition at line 62 of file vil_new.cxx. Create a shallow copy of an image and wrap it in a vil_image_view_base_sptr. Definition at line 278 of file vil_new.cxx. Construct a pyramid image resource from a base image. All levels are stored in the same resource file. Each level has the same scale ratio (0.5) to the preceeding level. Level 0 is the original base image. The resource is returned open for reading. The temporary directory is for storing intermediate image resources during the construction of the pyramid. Files are be removed from the directory after completion. If temp_dir is 0 then the intermediate resources are created in memory. Definition at line 234 of file vil_new.cxx. Construct a new pyramid image resource from a base image. The result is a directory containing separate images for each pyramid level. Each level has the same scale ratio (0.5) to the preceeding level and is created using level_file_format. Level 0 is the original base image. If copy_base is false, then Level 0 is already present in the directory and is used without modification. Each pyramid file in the directory is named filename + "level_index", e.g. R0, R1, ... Rn. Definition at line 262 of file vil_new.cxx. Make a new pyramid image resource for writing. Any number of pyramid layers can be inserted and with any scale. Image resources that duplicate existing scales are not inserted. Definition at line 213 of file vil_new.cxx.
http://public.kitware.com/vxl/doc/release/core/vil/html/vil__new_8h.html
crawl-003
refinedweb
601
70.8
Opened 9 years ago Closed 6 years ago #6603 closed (fixed) QuerySet in extra_context should be handled automatically Description f I pass an 'extra_context' parameter to a generic view I can't use a QuerySet because they'd only be evaluated once (at program start), so the only option is to pass a callable. Unfortunately, this solution increases code size and mental burden on the developer who can pass a QuerySet to 'queryset', but not within 'extra_context', so it's even inconsistent. I'd like to suggest that if a QuerySet is passed to 'extra_context' it should be handled exactly like the 'queryset' parameter: call value._clone(). I've attached a patch that you might use as a starting point. It even reduces the generic views code size by 34 lines, so I hope that alone is convincing enough. ;) (though, I'm not sure if the solution is OK) Attachments (2) Change History (11) Changed 9 years ago by comment:1 Changed 9 years ago by I'd like to throw my meager weight behind this ticket, despite it being documented for a good 2 years now (as of [2949]), it's a pretty irritating issue. Despite being a Django user since before aforementioned changeset, I still make this mistake (using QuerySets sans lambda within extra_context) quite often, and I'd like to think that's due more to the inconsistency aspect and less to my lack of mental conditioning. The patch looks OK to me, although the raw_extra_context argument name should probably change to extra_context else the code as-is is a little broken :) I was also going to say that it might work better as an extension to RequestContext but then realized there's a few spots where we're operating on a normal dictionary and not a RC instance, so never mind. comment:2 Changed 9 years ago by Oh, apart from renaing raw_extra_context to extra_context in common.py, line 9 should also say isinstance(value, QuerySet) instead of isinstance(extra, QuerySet). Yeah, I did indeed not test the patch at that time, but with those two changes it works. So, is there anyone interested in applying the patch? :) comment:3 Changed 9 years ago by Changed 9 years ago by updated the patch. changed docs to reflect that QuerySet are now cloned. current tests pas. comment:4 Changed 9 years ago by patch now works. The current generic view tests pass. Docs now mention that QuerySets are cloned so that the results are always fresh. comment:5 Changed 8 years ago by Maybe I'm overlooking something, but can't you just pass the all method of the manager? extra_context = {'news': News.objects.all} comment:6 Changed 8 years ago by SmileyChris -- that works if you want a top level manager result such as .all() (since you can grab the callable itself), but doesn't work if you want to do any sort of actual filtering, such as (totally arbitrary example): extra_context = {'top_news': News.objects.filter(rating__gte=5)} It's been a while since I looked at this issue but IIRC the deal is that the 'callable or not callable' test is too naive because QuerySets aren't callable (last I checked) and so the existing code does not re-evaluate them, despite QSs having the capacity to be re-evaluated via ._clone(). comment:7 Changed 8 years ago by I should say, that would be another approach -- defining def __call__(self): return self._clone() on QuerySet -- but it seems to me that changing/adding something pretty integral like this is not as good a solution as updating the behavior of the generic views to more intelligently handle QuerySets. comment:8 Changed 7 years ago by I'm -0 on this. To me, the problem is that once you special case this, there are so many other things that might need special casing. And the solution requires so little code: extra_context = {'top_news': lambda: News.objects.filter(rating__gte=5)} Perhaps special casing the queryset argument was also a mistake - we should just be educating people that objects stored at module level are persistent, and care needs to be taken with them. patch for trunk
https://code.djangoproject.com/ticket/6603
CC-MAIN-2017-13
refinedweb
697
57.91
Numpy asarray allows you to convert python data structures into NumPy array. You can convert list, list of list, tuple, or list of tuples into NumPy array. We convert python data structure to NumPy array for fast computation and to increase efficiency. In this entire tutorial, you will know the various examples of using numpy.asarray() in python. Examples on Numpy asarray() In this section, you will know how to use and convert list, tuples e.t.c and to convert it to NumPy array. Example 1: Converting a list to a Numpy array Suppose I have a python list and want to convert it into a NumPy array. Then I have to pass the list as an argument to the numpy.asarray() method. Execute the below lines of code. import numpy as np python_list = [1,2,3,4,5] list_to_numpy_arr = np.asarray(python_list) print(list_to_numpy_arr) print(type(list_to_numpy_arr)) Output You can see the output type of the list is the NumPy array. Example 2: Convert List of the lists to Numpy array Now, let’s convert a list of lists to a NumPy array. In the above example, you have got a single-dimensional NumPy array. But here you will get a two-dimensional NumPy array. Let’s execute the code and see the output. import numpy as np python_list_of_list = [[1,2],[3,4],[5,6]] list_of_list_to_numpy_arr = np.asarray(python_list_of_list) print(list_of_list_to_numpy_arr) print(type(list_of_list_to_numpy_arr)) Output You can see the output of the list of lists is the multi-dimensional NumPy array. Example 3: Numpy array from tuples using asarray In the above example I have converted list or list of list to NumPy array, lets apply the NumPy asarray() method on tuples. Just execute the given lines of code and see the output. import numpy as np python_tuple = (10,20,30,40,50) tuple_to_numpy_arr = np.asarray(python_tuple) print(tuple_to_numpy_arr) print(type(tuple_to_numpy_arr)) Output Example 4: Converting a list of tuples to a Numpy array In this last example, I will convert the list of tuples to the NumPy array. Here the output will the multi-dimensional array. Copy, paste, and execute the code. import numpy as np python_list_of_tuple = [(10,20),(30,40),(50,60)] list_of_tuple_to_numpy_arr = np.asarray(python_list_of_tuple) print(list_of_tuple_to_numpy_arr) print(type(list_of_tuple_to_numpy_arr)) You will get the following output. Output END NOTES Numpy asarray allows you to convert any simple data structures into NumPy array. After the conversion, you can easily manipulate the output array. These are the examples I have aggregated for you. I hope these examples have solved your queries. If you want to get more information on it then you can contact us for more help. Source: Numpy asarray Documentation Join our list Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
https://www.datasciencelearner.com/numpy-asarray-implementation-python-examples/
CC-MAIN-2021-39
refinedweb
463
66.74
Maths › Approximation › Regression › Logistic Evaluates the logistic regression curve built from a given set of points.Controller: CodeCogs Interface C++ Excel Class LogisticThe logit of a number Example 1 - The following example evaluates the logistic curve for a given set of points, which is also displayed in the previous graph. The abscissas are equally spaced in the interval [10, 50] with a step of 5. #include <codecogs/maths/regression/logistic.h> #include <iostream> #include <iomanip> using namespace std; int main() { double x[6] = { 28, 29, 30, 31, 32, 33}; double y[6] = {.3333, .4000, .7778, .7778, .8000, .9333}; Maths::Regression::Logistic A(6, x, y); cout << "Logistic regression values" << endl << endl; for (int i = 10; i <= 50; i += 5) { cout << "x = " << setw(3) << i << " y = " << A.getValue(i); cout << endl; } return 0; }Output: Logistic regression values x = 10 y = 0.143118 x = 15 y = 0.233325 x = 20 y = 0.356719 x = 25 y = 0.502592 x = 30 y = 0.648024 x = 35 y = 0.770364 x = 40 y = 0.859406 x = 45 y = 0.917614 x = 50 y = 0.95304 References:Wikipedia, Authors - Lucian Bentea (August 2005) Source Code Source code is available when you buy a Commercial licence. Not a member, then Register with CodeCogs. Already a Member, then Login. Members of Logistic LogisticInitializes the class by calculating the slope and intercept of the corresponding linear regression function. Logistic Once This function implements the Logistic class for one off calculations, thereby avoid the need to instantiate the Logistic class yourself. Example 2 - The following graphs fits a single regression curve to the following values: x = 23.2 y = 0.02 x = 33.3 y = 0.04 x = 33.5 y = 0.13 x = 34 y = 0.17 x = 34.2 y = 0.18 x = 34.2 y = 0.15 x = 34.4 y = 0.11There is an error with your graph parameters for Logistic_once with options n=7 x="23.2 33.3 33.5 34 34.2 34.2 34.4" y="0.02 0.04 0.13 0.17 0.18 0.15 0.11" a=0:150 .input Error Message:Function Logistic_once failed. Ensure that: Invalid C++ Parameters Returns - the interpolated y-coordinate that corresponds to a. Source Code Source code is available when you buy a Commercial licence. Not a member, then Register with CodeCogs. Already a Member, then Login.
https://www.codecogs.com/library/maths/approximation/regression/logistic.php
CC-MAIN-2018-51
refinedweb
396
71.1
XMonad.Prompt.DirExec Description. Usage - In your ~/.xmonad/xmonad.hs: import XMonad.Prompt.DirExec - In your keybindings add something like: , ("M-C-x", dirExecPrompt def spawn "/home/joe/.scipts") or , ("M-C-x", dirExecPromptNamed def spawn "/home/joe/.scripts" "My Scripts: ") or add this after your default bindings: ++ [ ("M-x " ++ key, dirExecPrompt def fn "/home/joe/.scripts") | (key, fn) <- [ ("x", spawn), ("M-x", runInTerm "-hold") ] ] ++ The first alternative uses the last element of the directory path for a name of prompt. The second alternative uses the provided string for the name of the prompt. The third alternative defines 2 key bindings, first one spawns the program by shell, second one runs the program in terminal For detailed instruction on editing the key binding see XMonad.Doc.Extending. dirExecPrompt :: XPConfig -> (String -> X ()) -> FilePath -> X () Source # Function dirExecPrompt starts the prompt with list of all executable files in directory specified by FilePath. The name of the prompt is taken from the last element of the path. If you specify root directory - / - as the path, name Root: will be used as the name of the prompt instead. The XPConfig parameter can be used to customize visuals of the prompt. The runner parameter specifies the function used to run the program - see usage for more information dirExecPromptNamed :: XPConfig -> (String -> X ()) -> FilePath -> String -> X () Source # Function dirExecPromptNamed does the same as dirExecPrompt except the name of the prompt is specified by String parameter.
https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.17.0.9/XMonad-Prompt-DirExec.html
CC-MAIN-2022-27
refinedweb
238
54.42
perlfaq8 - System Interaction ( $OSNAME if you use English) contains an indication of the name of the operating system (not its release number) that your perl binary was built for. (contributed by brian d foy) The exec function's job is to turn your process into another command and never to return. If that's not what you want to do, don't use exec. :) If you want to run an external command and still keep your Perl process going, look at a piped open, fork, or system. as examples in other answers in this section of the perlfaq. system (contributed by brian d foy) To clear the screen, you just have to print the special sequence that tells the terminal to clear the screen. Once you have that sequence, output it when you want to clear the screen. You can use the Term::ANSIScreen module to get the special sequence. Import the cls function (or the :screen tag): use Term::ANSIScreen qw(cls); my $clear_screen = cls(); print $clear_screen; The Term::Cap module can also get the special sequence if you want to deal with the low-level details of terminal control. The Tputs method returns the string for the given capability: use Term::Cap; $terminal = Term::Cap->Tgetent( { OSPEED => 9600 } ); $clear_string = $terminal->Tputs('cl'); print $clear_screen; On Windows, you can use the Win32::Console module. After creating an object for the output filehandle you want to affect, call the Cls method: Win32::Console; $OUT = Win32::Console->new(STD_OUTPUT_HANDLE); my $clear_string = $OUT->Cls; print $clear_screen; If you have a command-line program that does the job, you can call it in backticks to capture whatever it outputs so you can use it later: $clear_string = `clear`; print $clear_string;); This depends on which operating system your program is running on. In the case of Unix, the serial ports will be accessible through files in /dev; on other systems, device names will doubtless differ. Several problem areas common to all device interaction are the following: Your system may use lockfiles to control multiple access. Make sure you follow the correct protocol. Unpredictable behavior. You can use select() and the $| variable to control autoflushing (see "$|" in perlvar and "select" in perlfunc, or perlfaq5, "How do I flush/unbuffer an output filehandle? Why must I do this?"): $oldh = select(DEV); $| = 1; select($oldh); You'll also see code that does this without a temporary variable, as in do is check). (contributed by brian d foy) There's not a single way to run code in the background so you don't have to wait for it to finish before your program moves on to other tasks. Process management depends on your particular operating system, and many of the techniques are in perlipc. Several CPAN modules may be able to help, including IPC::Open2 or IPC::Open3, IPC::Run, Parallel::Jobs, Parallel::ForkManager, POE, Proc::Background, and Win32::Process. There are many other modules you might use, so check those namespaces for other options too. If you are on a Unix-like system, you might be able to get away with a system call where you put an & on the end of the command: system("cmd &") You can also try using fork, as described in perlfunc (although this is the same thing that many of the modules will do for you).); See "Signals" in perlipc for other examples of code to do this. Zombies are not an issue with system("prog &").{INT} = sub { syswrite(STDERR, "ouch\n", 5 ) }; # or a reference to a function $SIG{INT} = \&ouch; # or the name of the function as a string $SIG{INT} = zone, you can probably get away with setting an environment variable: $ENV{TZ} = "MST7MDT"; # Unixish $ENV{'SYS$TIMEZONE_DIFFERENTIAL'}="-5" # vms system "trn comp.lang.perl.misc";). (contributed by brian d foy) The Time::HiRes module (part of the standard distribution as of Perl 5.8) measures time with the gettimeofday() system call, which returns the time in microseconds since the epoch. If you can't install Time::HiRes for older Perls and you are on a Unixish system, you may be able to call gettimeofday(2) directly. See "syscall" in perlfunc.. On Windows, try Win32::API. On Macs, try Mac::Carbon. If no module has an interface to the C function, you can inline a bit of C in your Perl source with Inline:). See "Bidirectional Communication with Another Process" in perlipc and "Bidirectional Communication with Yourself" in perlipc You may also use the IPC::Open3 module (part of the standard perl distribution), but be warned that it has a different order of arguments from IPC::Open2 (see IPC::Open3).s them. Backticks and open() read only the STDOUT of your command. You can also use the open3() function_tmpfile; local *CATCHERR = IO::File->new_tmp_tmp the versus/csh.whynot article in the "Far More Than You Ever Wanted To Know" collection to redirect them separately to files, and then read from those files when the program is done: system("program args 1>program.stdout 2. Strictly speaking, nothing. Stylistically speaking, it's not a good way to write maintainable code. Perl has several operators for running external commands. Backticks are one; they collect the output from the command for use in your program. The system function is another; it doesn't do this. Writing backticks in your program sends a clear message to the readers of your code that you wanted to collect the output of the command. Why send a clear message that isn't true? Consider this line: `cat /etc/termcap`; You forgot to check $? to see whether the program even ran correctly. Even if you wrote print `cat /etc/termcap`; this code could and probably should be written as system("cat /etc/termcap") == 0 or die "cat program failed!"; which will echo the cat command's output as it is generated, instead of waiting until the program has completed to print it out. It also checks the return value. system also provides direct control over whether shell wildcard processing may take place, whereas backticks do not. This is a bit tricky. You can't simply write the command like this: @ok = `grep @opts '$search_string' @filenames`; As of Perl 5.8.0, you can use open() with multiple arguments. Just like the list forms of system() and exec(), no shell escapes happen. open( GREP, "-|", 'grep', @opts, $search_string, @filenames ); chomp(@ok = <GREP>); close GREP; You can also: my @ok = (); if (open(GREP, "-|")) { while (<GREP>) { chomp; push(@ok, $_); } close GREP; } else { exec 'grep', @opts, $search_string, @filenames; } Just as with system(), no shell escapes happen when you exec() a list. Further examples of this can be found in "Safe Pipe Opens" in perlipc. Note that if you're using Windows, no solution to this vexing issue is even possible. Even if Perl were to emulate fork(), you'd still be stuck, because Windows does not have an argc/argv-style API. This happens only if your perl is compiled to use stdio instead of perlio, which is the default. Some (maybe all?) stdios set error and eof flags that you may need to clear.. POSIX::setsid()function, so you don't have to worry about process groups. fork && exit; The Proc::Daemon module, available from CPAN, provides a function to perform these actions for you. (contributed by brian d foy) This is a difficult question to answer, and the best answer is only a guess. What do you really want to know? If you merely want to know if one of your filehandles is connected to a terminal, you can try the -t file test: if( -t STDOUT ) { print "I'm connected to a terminal!\n"; } However, you might be out of luck if you expect that means there is a real person on the other side. With the Expect module, another program can pretend to be a person. The program might even come close to passing the Turing test. The IO::Interactive module does the best it can to give you an answer. Its is_interactive function returns an output filehandle; that filehandle points to standard output if the module thinks the session is interactive. Otherwise, the filehandle is a null handle that simply discards the output: use IO::Interactive; print { is_interactive } "I might go to standard output!\n"; This still doesn't guarantee that a real person is answering your prompts or reading your output. If you want to know how to handle automated testing for your distribution, you can check the environment. The CPAN Testers, for instance, set the value of AUTOMATED_TESTING: unless( $ENV{AUTOMATED_TESTING} ) { print "Hello interactive tester!\n"; }. (contributed by Xho) Use the BSD::Resource module from CPAN. As an example: use BSD::Resource; setrlimit(RLIMIT_CPU,10,20) or die $!; This sets the soft and hard limits to 10 and 20 seconds, respectively. After 10 seconds of time spent running on the CPU (not "wall" time), the process will be sent a signal (XCPU on some systems) which, if not trapped, will cause the process to terminate. If that signal is trapped, then after 10 more seconds (20 seconds in total) the process will be killed with a non-trappable signal. See the BSD::Resource and your systems documentation for the gory details. Use the reaper code from "Signals" in perlipc to call wait() when a SIGCHLD is received, or else use the double-fork technique described in "How do I start a process in the background?" in perlfaq8.: . You can't. You need to imitate the system() call (see perlipc for sample code) and then have a signal handler for the INT signal that passes the signal on to the subprocess. Or you can check for it: $rc = system($cmd); if ($rc & 127) { die "signal death" }, "/foo/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644) or die "can't open /foo/somefile: $!": (answer contributed by brian d foy) message. (contributed by brian d foy) The easiest way is to have a module also named CPAN do it for you by using the cpan command the comes with Perl. You can give it a list of modules to install: $ cpan IO::Interactive Getopt::Whatever If you prefer CPANPLUS, it's just as easy: $ cpanp i IO::Interactive Getopt::Whatever If you want to install a distribution from the current directory, you can tell CPAN.pm to install . (the full stop): $ cpan . See the documentation for either of those commands to see what else you can do. If you want to try to install a distribution by yourself, resolving all dependencies on your own, you follow one of two possible build paths. For distributions that use Makefile.PL: $ perl Makefile.PL $ make test install For distributions that use Build.PL: $ perl Build.PL $ ./Build test $ ./Build install Some distributions may need to link to libraries or other third-party code and their build and installation sequences may be more complicated. Check any README or INSTALL files that you may find. (contributed by brian d foy)); } However, you can suppress the import by using an explicit, empty import list. Both of these still happen at compile-time: use MODULE (); BEGIN { require MODULE; } Since use will also call the import method, the actual value for MODULE must be a bareword. That is, use cannot load files by name, although require can: require "$ENV{HOME}/lib/Foo.pm"; # no @INC searching! See the entry for use in perlfunc for more details. When you build modules, tell Perl where to install the modules.. (contributed by brian d foy) If you know the directory already, you can add it to @INC as you would for any other directory. You might <use lib> if you know the directory at compile time: use lib $directory; The trick in this task is to find the directory. Before your script does anything else (such as a chdir), you can get the current working directory with the Cwd module, which comes with Perl: BEGIN { use Cwd; our $directory = cwd; } use lib $directory; You can do a similar thing with the value of $0, which holds the script name. That might hold a relative path, but rel2abs can turn it into an absolute path. Once you have the BEGIN { use File::Spec::Functions qw(rel2abs); use File::Basename qw(dirname); my $path = rel2abs( $0 ); our $directory = dirname( $path ); } use lib $directory; The FindBin module, which comes with Perl, might work. It finds the directory of the currently running script and puts it in $Bin, which you can then use to construct the right library path: use FindBin qw($Bin); Here are the suggested ways of modifying your include path, including environment variables, run-time switches, and in-code statements: $ export PERLLIB=/path/to/my/dir $ perl program.pl $ export PERL5LIB=/path/to/my/dir $ perl program.pl $ perl -I/path/to/my/dir program.pl use lib "$ENV{HOME}/myown_perllib"; The last is particularly useful because it knows about machine dependent architectures. The lib.pm pragmatic module was first included with the 5.002 release of Perl. It's a Perl 4 style file defining values for system networking constants. Sometimes it is built using h2ph when Perl is installed, but other times it is not. Modern programs use Socket;.
http://search.cpan.org/~rjbs/perl-5.13.1/pod/perlfaq8.pod
CC-MAIN-2014-23
refinedweb
2,199
62.07
This document describes a simple approach of implementing AJAX functionality in ASP.NET web applications. Pros and cons of using AJAX are also discussed. The document contains a working JavaScript and C#.NET code demonstrating the suggested solution. Most of you already know that AJAX stands for Asynchronous JavaScript and XML. This technology was introduced first by Microsoft (from my best knowledge) back in 1999, and had been known as �DHTML / JavaScript web application with remote calls�. The whole idea of the technology was to allow an internet browser to make an asynchronous HTTP call to remote pages/services, and update a current web page with the received results without refreshing the whole page. By creators� opinion, this should have improved customers� experience, making HTTP pages look and feel very similar to Windows applications. Because the core implementation of this technology was based on internet browser functionality, the usability was very limited at that time. But several years later, the technology has been reborn with new browsers support and massive implementation by such giants as Google, Amazon.com, eBay, etc. Today, it�s known as AJAX, and considered as a natural part of any dynamic web page with advanced user experience. The suggested approach provides a very simple, yet effective implementation of the AJAX functionality. It�s very easy to maintain and change, does not require any special skills from developers, and, from our best knowledge, is cross-browser compatible. Basically, a regular AJAX-like implementation includes two main components: a client HTML page with JavaScript code making an AJAX call and receiving a response, and a remote page that can accept a request and respond with the required information. The JavaScript code on the client page is responsible for instantiating an XmlHttp object, then providing this object with a callback method which will be responsible for processing the received information, and finally, sending a request to the remote page via the XmlHttp object. All this is done by the JavaScript code. Our approach is intended for use in ASP.NET applications, and considers the following possible scenarios: All these considerations are illustrated by the diagram below: I divided all the JavaScript methods into two parts: calling page specific JavaScript methods, and AJAX JavaScript methods common for all the calling pages. Specific methods include a callback method as well, as it is responsible for updating the page content. Common AJAX methods are responsible for instantiating an XmlHttp object and sending an asynchronous request to the remote page. Getting an XmlHttp object differs depending on the type of the browser. I distinguish two basic types: a Microsoft browser which is one of the IE family, and a Mozilla browser which is one of Mozilla Firefox, Netscape, or Safari. I tested the code with the Opera browser too, but I would not guarantee that it will always be working well.","Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP.2.6","Microsoft.XMLHTTP.1.0", "Microsoft.XMLHTTP.1","Microsoft.XMLHTTP"]; for(var i=0; i<clsids.length && xmlHttp == null; i++) { xmlHttp = CreateXmlHttp(clsids[i]); } return xmlHttp; } function CreateXmlHttp(clsid) { var xmlHttp = null; try { xmlHttp = new ActiveXObject(clsid); lastclsid = clsid; return xmlHttp; } catch(e) {} } According to Umut Alev, the code for the GetMSXmlHttp method can be simplified considering that we do not have to refer MSXML5 as it has been designed only for Office applications. Correspondingly, the simplified revision of the GetMSXmlHttp method may look as follows: function GetMSXmlHttp() { var xmlHttp = null; var clsids = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0"]; for(var i=0; i<clsids.length && xmlHttp == null; i++) { xmlHttp = CreateXmlHttp(clsids[i]); } return xmlHttp; } As you see, GetXmlHttpObject methods accept a handler parameter which is a name of the callback method that should be defined in the page-specific code. Now that we already have an XmlHttp object, we can send an asynchronous request. function SendXmlHttpRequest(xmlhttp, url) { xmlhttp.open('GET', url, true); xmlhttp.send(null); } I use a GET HTTP method to a given URL, but this can be easily changed by changing the JS code above. Now we have all the methods we need to perform a call to the remote page. In order to do this, we need to pass the callback method name to the GetXmlHttpObject method and then pass the URL string to the SendXmlHttpRequest method. var xmlHttp; function ExecuteCall(url) { try { xmlHttp = GetXmlHttpObject(CallbackMethod); SendXmlHttpRequest(xmlHttp, url); } catch(e){} } //CallbackMethod will fire when the state //has changed, i.e. data is received back function CallbackMethod() { try { //readyState of 4 or 'complete' represents //that data has been returned if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') { var response = xmlHttp.responseText; if (response.length > 0) { //update page document.getElementById("elementId").innerHTML = response; } } } catch(e){} } The CallbackMethod is responsible for updating the page content. In our example, it simply updates the inner HTML of the given HTTP element. But in real life, it can be much more complex. The last question regarding the calling page implementation is how we call the ExecuteCall JS method. Well, it depends on what the page is doing. In some cases, the ExecuteCall method can be called when the JS event is fired. But if that is not the case, we can register the method as a startup script for the page using the corresponding C# code in the page's code-behind. Page.RegisterStartupScript("ajaxMethod", String.Format("<script>ExecuteCall('{0}');</script>", url)); We can add this line of code either in the Page_Prerender or Page_Load method of the ASP.NET code-behind file. Let�s find out what a remote page could look like. If this is an ASP.NET page (what we assume), we are interested in the code-behind only. We can easily remove all the code from the .aspx file: it won�t affect the behavior of the page in any way. For example, we take a public web service that converts temperature values in Celsius to Fahrenheit and vice versa. The service is available here. If you add this URL as a web reference to your project, Visual Studio will generate a proxy class with the name com.developerdays.ITempConverterservice in your current namespace. Our remote ASP.NET page, let�s name it getTemp.aspx, will accept a query string parameter with the name � temp� which should contain an integer value of a temperature in Celsius to convert. So the target URL to the remote page will look like this:. And the code-behind for this page is shown below: private void Page_Load(object sender, EventArgs e) { Response.Clear(); string temp = Request.QueryString["temp"]; if (temp != null) { try { int tempC = int.Parse(temp); string tempF = getTempF(tempC); Response.Write(tempF); } catch { } } Response.End(); } private string getTempF(int tempC) { com.developerdays.ITempConverterservice svc = new ITempConverterservice(); int tempF = svc.CtoF(tempC); return tempF.ToString(); } According to our convention, we can now build a URL string for the remote page that we will pass to the RegisterStartupScript method in the example above, like this: int tempC = 25; string url = String.Format("" + "getTemp.aspx?temp={0}", tempC); Using the approach with an intermediate ASP.NET page, calling in its turn a remote service, allows simplifying response processing, especially if it requires parsing. In simple cases when the response contains just text, we can pass the remote service URL directly to the JS ExecuteCall method. This article is aimed to illustrate the simplicity of using the AJAX technology in any ASP.NET application. While AJAX has some drawbacks, it also provides some advantages from the user experience perspective. It�s completely up to the developer whether to use the AJAX technology or not, but I have just demonstrated that in simple cases, it does not take a long time or require any special skills. I would like to thank my colleagues Oleg Gorchkov and Chris Page who helped me out with testing and optimizing the approach described in the article. General News Question Answer Joke Rant Admin
http://www.codeproject.com/KB/ajax/SimpleAJAXforASPNETwebApp.aspx
crawl-002
refinedweb
1,334
56.45
EclipseLink/Examples/JPA/2.0/DerivedIdentifiers < EclipseLink | Examples | JPA Revision as of 10:05, 30 November 2009 by James.sutherland.oracle.com (Talk | contribs) Contents How to use derived identifiers to map composite Ids through OneToOne relationships Defining an Id for a OneToOne or ManyToOne in JPA 2.0 is much simpler. The @Id annotation or id XML attribute can be added to a OneToOne or ManyToOne mapping. The Id used for the object will be derived from the target object's Id. If the Id is a single value, then the source object's Id is the same as the target object's Id. If it is a composite Id, then the IdClass will contain the Basic Id attributes, and the target object's Id as the relationship value. If the target object also has a composite Id, then the source object's IdClass will contain the target object's IdClass. Example JPA 2.0 ManyToOne id annotation ... ... public class PhonePK { private String type; private long owner; public PhonePK() {} public PhonePK(String type, long owner) { this.type = type; this.owner = owner; } public boolean equals(Object object) { if (object instanceof PhonePK) { PhonePK pk = (PhonePK)object; return type.equals(pk.type) && owner == pk.owner; } else { return false; } } public int hashCode() { return type + owner; } }
http://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPA/2.0/DerivedIdentifiers&oldid=181206
CC-MAIN-2016-30
refinedweb
212
58.89
On Mon, Oct 03, 2011 at 01:30:15PM +0100, Daniel Drake wrote:> On Mon, Oct 3, 2011 at 1:16 PM, Mark Brown> >> and representative of the hardware.> This also matches the way that the hardware is described by VIA in the> specs, and it matches the way that Linux has its own device hierachy> laid out (i.e. the ISA bridge driven by the mfd driver, which then> spawns off a child device for the GPIO controller).> It would not be possible to fold all of the isa bridge child> components into the same device tree node without dealing with various> namespace collisions.So, I made two suggestions above and it sounds like you want the secondone but you've only responded to the first one without commenting on thesecond. My second suggestion was that if the block is sufficientlyisoltated from the core we should be able instantiate it from the devicetree without requiring explicit code in the core driver.
http://lkml.org/lkml/2011/10/3/186
CC-MAIN-2013-20
refinedweb
162
62.01
Fully Functional Jekyll Blog There’s comes a time when tutorials on getting started aren’t enough. This is not one of those tutorials. After this article, you will have the ability to make a fully functional Jekyll blog, complete with pagination and search capabilities. Get ready to see just how awesome Jekyll can be. Audience This is for: - People who have basic knowledge of Jekyll (Note: If you don’t read the docs. It’s easy to get to basic.) - Know how to use a text editor - Can do gem install - Are very good at HTML and JavaScript - Understand Liquid templating (Again…see the docs if not) Resources If at any point you are lost or confused, these links should help you out: Go! To make sure we’re all on the same page, I am going to be using Jekyll version 2.5.3. So, if you haven’t yet, you should gem install jekyll -v 2.5.3. We will not be using the jekyll new command to create this blog. It’s great for people who want to get the feel of a Jekyll blog, but I feel that it takes away from the learning experience. Instead, let’s start off by creating a fresh git repository and adding a config.yml file to it. This config.yml is where all of the site’s configuration goes. Variables in this file can be accessed with the global site variable (e.g. site.foo). $ mkdir jekyll-blog $ cd jekyll-blog $ git init $ git checkout -b gh-pages # for GitHub pages support $ echo "2.2.2"; > .ruby-version # sets Ruby version $ touch _config.yml The YAML file: # _config.yml title: A Sample Blog # your blog's name author: Jesse Herrick # your name baseurl: /blog/ # we'll get to this later exclude: # things to exclude from the build process - README.md - .ruby-version - Gemfile - Gemfile.lock Now, some git to make sure we start off right: $ git add . $ git commit -m "Initial blog configuration" $ git push -u origin gh-pages # you should create a GitHub repo if you haven't yet Cool stuff. Instead of our master branch being our deployment branch, gh-pages will serve that role. Before we just jump right in, let’s look at what we want in our blog: - An index page of posts - A page for individual posts - The ability to search posts We’ll need some actual posts to test with, so I generated a few using a Lorem Ipsum generator. For your convenience, you can get them here. Put these in a directory called, _posts. Every page in Jekyll needs a default template, so make one before creating the post index page. This saves us from having to write all the obligatory stuff: $ mkdir _layouts $ touch _layouts/default.html And the HTML: # _layouts/default.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>{% if page.title %}{{ page.title }} &· {% endif %}{{ site.title }}</title> {% include libs.html %} </head> <body> {{ content }} </body> </html> You’ll notice in the title tag that we used an if statement: {% if page.title %}{{ page.title }} &· {% endif %} This states: if the page variable, title is defined, then render it alongside a separator. If not, then nothing will be shown. We also used the include liquid tag to pull in an external HTML file called libs.html that lives in the _includes directory and contains our libraries. It’s possible to separate every template into smaller ones, but, at a certain point, it gets to be more time consuming than it’s worth. # _includes/libs.html <!-- Stylesheets --> <link href='//fonts.googleapis.com/css?family=Arvo:400,400italic,700' rel='stylesheet' type='text/css'> <link href="{{ '/css/style.css' | prepend: site.baseurl }}"> <!-- JS --> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script src="{{ '/js/app.js' | prepend: site.baseurl }}"></script> Awesome. Notice that we used the liquid filter, prepend, to prepend our site’s previously defined base URL. It’s defined as /blog/ so that the assets load properly if the site is hosted at URL like. This is helpful because our default layout is going to be applied to all pages. Now let’s make the index page. The index page needs to display whole posts and paginate every 3 posts (we have 4). Also, it should have links to individual post pages. Jekyll makes this super easy. # index.html --- title: Home layout: default --- <h1>{{ site.author }}'s Blog</h1> <section class="posts"> {% for post in site.posts %} <li><date>{{ post.date | date: "%B %-d, %Y"}}<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }} {% endfor %} </section> It’s just a plain and simple index page with a classic for..in loop over the posts. Search The AngularJS ng-repeat directive is perfect for a quick live search of posts. But first, we need some sort of API for Angular to consume. Jekyll can actually do this for us in pure liquid. Because the site is statically generated, the data in our “API” doesn’t need to be dynamically generated either. So, to generate the API, just use the following code: # posts.json --- layout: null --- { "posts": [ {% for post in site.posts %}{ "title": "{{ post.title }}", "url": "{{ post.url | prepend: site.baseurl }}", "date": "{{ post.date | date: "%B %-d, %Y" }}", "raw_date": "{{ post.date }}" }{% unless forloop.last %},{% endunless %} {% endfor %} ] } It’s pretty simple and generates a nice API for our blog that looks something like this: { "posts": [ { "title": "Sample 4", "url": "/2015/05/20/Sample-4.html", "date": "May 20, 2015", "raw_date": "2015-05-20 00:00:00 -0400" }, { "title": "Sample 3", "url": "/2015/05/18/Sample-3.html", "date": "May 18, 2015", "raw_date": "2015-05-18 00:00:00 -0400" }, { "title": "Sample 1", "url": "/2015/05/17/Sample-1.html", "date": "May 17, 2015", "raw_date": "2015-05-17 00:00:00 -0400" }, { "title": "Sample 2", "url": "/2015/05/15/Sample-2.html", "date": "May 15, 2015", "raw_date": "2015-05-15 00:00:00 -0400" } ] } So how do we use this in our blog to add search functionality? # js/app.js angular.module('JekyllBlog', []) .controller('SearchCtrl', ['$scope', '$http', function($scope, $http) { $http.get('/posts.json').success(function(data) { $scope.posts = data.posts; }); }]); Now, add this to the index page, but there’s a problem: Jekyll will parse AngularJS’ brackets. <p>{{wow.something}}</p> <!-- is parsed into... --> <p></p> This is because Jekyll runs all templates through Liquid, which assumes (as it should) that all brackets are part of the Liquid templates. So, we have to get around this. One option is this plugin that I wrote, but since we plan on deploying to GitHub pages, custom plugins aren’t an option. We’ll have to use Liquid’s {% raw %} tags (trust me, not as fun). # index.html <div class="posts" ng- <input type="search" class="search" ng- <ul> <li ng- <date ng-</date> <a href="{% raw %}{{ post.url }}{% endraw %}" ng-</a> </li> </ul> </div> The special sauce here is the combination of ng-repeat and a filter. We’re basically telling Angular to display each item in the posts array (aliased as post) that matches the query scope variable. You’ll notice that, at the top of the list we added a search input bound by ng-model to the query scope variable. Then we just reuse same output as used earlier in {% for post in posts %}, but using the Jekyll “API”. What About People Who Don’t Have JS? If you really need to cater to those people that don’t have JavaScript enabled, you can use a little ng-cloak magic. # css/styles.css (as recommended by:) [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } # index.html <div ng-cloak <input type="search" class="search" ng- <ul> <li ng- <date ng-</date> <a href="{% raw %}{{ post.url }}{% endraw %}" ng-</a> </li> </ul> </div> <div ng-show <ul> {% for post in posts %} <li><date>{{ post.date | date: "%B %-d, %Y"}}<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></li> {% endfor %} </ul> </div> This works through some interesting logic. First, AngularJS’ ng-cloak directive is detected by some CSS styles and is hidden until AngularJS is loaded. Thus, if JS is disabled, nothing is shown. Next, the ng-show directive is added to the Jekyll-generated list of posts. This works because AngularJS defaults ng-show to false, meaning that the Jekyll list will only be shown if AngularJS is not loaded. What About Posts? Each post has a link, but we haven’t really talked about what happens when you click that link. Right now, it displays the post’s markdown rendered to HTML, but we want more. First, let’s add a default layout to all of our posts because we shouldn’t have to worry about that when writing a new post: # _config.yml ... other config ... defaults: - scope: path: "" type: "posts" values: layout: "post" This means that layout: post will be added to all post type files. Now we need to create this post layout: $ touch _layouts/post.html This layout only really needs a heading and a place to render the post: # _layouts/post.html --> <article> <h2>{{ page.title }}</h2> <small>Written by <strong>{{ site.author }}</strong><date>{{ page.date | date: "%B %-d, %Y" }}</date>.</small> {{ content }} </article> If you’re familiar with Rails, {{ content }} is like in terms of layouts. In this case, it is yielding to content passed in each post. Notice that we also used page.title and page.date rather than post.title, etc. because we are calling a variable that is only passed to the page (layout) and not through an iteration. Now, if you visit a post link, a nice heading and some meta info about the post on that page are displayed. Conclusion There you have it! A fully functional Jekyll blog. A little more styling and you have something to write use to your heart’s desire. If you’d like to learn more about what Jekyll can do, check out the docs. Happy Blogging!
https://www.sitepoint.com/fully-functional-jekyll-blog/
CC-MAIN-2019-04
refinedweb
1,693
76.42
Blast Off with Blazor: Build a search-as-you-type box In this post, we build a quick search box that filters our images. So far in our series, we’ve walked through the intro, wrote our first component, dynamically updated the HTML head from a component, isolated our service dependencies, worked on hosting our images over Azure Blob Storage and Cosmos DB, built a responsive image gallery, and implemented prerendering. With a full result set from Cosmos DB, in this post we’ll build a quick search box. While I was originally thinking I should execute queries against our database, I then thought: You dummy, you already have the data, just filter it. My inner voice doesn’t always offer sage advice, but it did this time. Anyway, here’s how it’ll look. You’ve likely noticed the absence of a search button. This will be in the “search-as-you-type” style, as results will get filtered based on what the user types. It’s a lot less work than you might think. This post covers the following content. The “easy” part: our filtering logic In very simplistic terms, here’s what we’ll do: a user will type some text in the search box, and we’ll use a LINQ query to filter it. Then, we’ll display the filtered results. In Images.razor.cs, we’ll add SearchText. This field captures what the user enters. We’ll take that string, and see if we have any items that have a part of the string in the Title. We’ll want to make sure to initialize it to an empty string. That way, if nothing is entered, we’ll display the whole result set. public string SearchText = ""; Then, I’ll include a FilteredImages field. This will return a filtered List<Image> that uses the LINQ query in question to filter based on the SearchText. List<Image> FilteredImages => ImageList.Where( img => img.Title.ToLower().Contains(SearchText.ToLower())).ToList(); This part is relatively simple. We can do this in any type of app—Blazor, Web API, MVC, whatever. The power of Blazor is how we can leverage data binding to “connect” the data with our components to synchronize them and update our app accordingly. Let’s first understand data binding as a general concept. Understand data binding Data binding is not unique to Blazor. It’s essential to virtually all single-page application (SPA) libraries and frameworks. You can’t get away from displaying, updating, and receiving data. The simplest example is with one-way binding. As inferred from the name, this means data updates only flow in one direction. In these cases, the application is responsible for handling the data. The gist: you have some data, an event occurs, and the data changes. There’s no need for a user to control the data yet. In terms of events, by far the most common is a button click in Blazor: <p>@TimesClicked</p> <button @Update Click Count</button> @code { private int TimesClicked { get; set; } = 1; private void UpdateTimesClicked() { TimesClicked++; } } In this example the TimesClicked is bound to the component with the @ symbol. When a user clicks a button, the value changes—and, because an event handler was executed, Blazor triggers a re-render for us. Don’t let the simplicity of one-way binding fool you: in many cases, it’s all you need. Whenever we need input from a user, we need to track that data and also bind it to a field. In our case, we need to know what the user is typing, store it in SearchText, and execute filtering logic as it changes. Because it needs to flow in both directions, we need to use two-way binding. For ASP.NET Core in particular, data binding involves … binding … a @bind HTML element with a field, property, or Razor expression. Understand how @bind and @bind-value work In the ASP.NET Core documentation for Blazor data binding, this line should catch your eye: When one of the elements loses focus, its bound field or property is updated. In this case @bind works with an onchange handler after the input loses focus (like when a user tabs out). However, that’s not what we want. We want updates to occur as a user is typing and the ability to control which event triggers an update. After all, we don’t want to wait for a user to lose focus (and patience). Instead, we can use @bind-value. When we use @bind-value:event="event", we can specify a valid event like oninput, keydown, keypress, and so on. In our case, we’ll want to use oninput, or whenever the user types something. Don’t believe me? That’s fine, we’re only Internet friends, I understand. You can go check out the compiled components in your project’s obj/Debug/net5.0/Razor/Pages directory. Here’s how my BuildRenderTree method looks with @bind-value (pay attention to the last line): protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __builder.OpenElement(0, "div"); __builder.AddAttribute(1, "class", "text-center bg-blue-100"); __builder.AddAttribute(2, "b-bc0k7zrx0q"); __builder.OpenElement(3, "input"); __builder.AddAttribute(4, "class", "border-4 w-1/3 rounded m-6 p-6 h-8\r\n border-blue-300"); __builder.AddAttribute(5, "placeholder", "Search by title"); __builder.AddAttribute(6, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue(SearchText)); __builder.AddAttribute(7, "oninput", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => SearchText = __value, SearchText)); // and more ... } Put it together When we set @bind-value to SearchText and @bind-value:event to oninput, we’ll be in business. Here’s how we’ll wire up the search box: <div class="text-center bg-blue-100"> <input class="border-4 w-1/3 rounded m-6 p-6 h-8 border-blue-300" @ </div> Finally, as we’re iterating through our images, pass in FilteredImages instead: @foreach (var image in FilteredImages) { <ImageCard ImageDetails="image" /> } So now, here’s the entire code for our Images component: @page "/images" <div class="text-center bg-blue-100"> <input class="border-4 w-1/3 rounded m-6 p-6 h-8 border-blue-300" @ </div> @if (!ImageList.Any()) { <p>Loading some images...</p> } else { <div class="p-2 grid grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3"> @foreach (var image in FilteredImages) { <ImageCard ImageDetails="image" /> } </div> } And the Images partial class: using BlastOff.Shared; using Microsoft.AspNetCore.Components; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace BlastOff.Client.Pages { partial class Images : ComponentBase { public IEnumerable<Image> ImageList { get; set; } = new List<Image>(); public string SearchText = ""; [Inject] public IImageService ImageService { get; set; } protected override async Task OnInitializedAsync() { ImageList = await ImageService.GetImages(days: 70); } List<Image> FilteredImages => ImageList.Where( img => img.Title.ToLower().Contains(SearchText.ToLower())).ToList(); } } Here’s the search box in action. Look at us go. It's so fast! Trying to remember the pains I've had in my career implementing typeahead, and in #Blazor it's super simple with data binding on change. pic.twitter.com/zRjOmeUXCu— Dave Brock (@daveabrock) January 15, 2021 Wrap up In this post, I wrote how to implement a quick “type-as-you-go” search box in Blazor. We wrote filtering logic, understood how data binding works, compared @bind and @bind-value in Blazor, and finally put it all together. There’s certainly more we can do here—things like debouncing come in handy when we want to control (and sometimes delay) how often searches are executed. I’m less concerned because this is all executed on the client, but would definitely come into play when we want to limit excessive trips to the database.
https://www.daveabrock.com/2021/01/14/blast-off-blazor-search-box/
CC-MAIN-2021-25
refinedweb
1,299
58.08
Dec 06, 2007 10:23 PM|AceCorban|LINK I remember a friend of mine showing me a nifty shorthand in .NET where you could identify a class's members and getters/setters in a very concise way. Like "get:" and "set:" were in the same code block. Anyone know what I'm talking about? Could someone show me a sample class that has one member and a getter/setter using this shorthand? All-Star 67555 Points Moderator Dec 06, 2007 10:28 PM|anas|LINK public class Person { //default constructor public Person() { } private string _Name; public string Name { //set the person name set { this._Name = value; } //get the person name get { return this._Name; } } } Participant 1621 Points Dec 06, 2007 10:54 PM|AceCorban|LINK That was the one. Thanks to both of you! Turns out newer versions of C# supposedly support an even more concise declaration (though I haven't been able to verify because I am on an older server): public class Person { public string Firstname { get; set; } public string Middlename { get; set; } public string Lastname { get; set; } public int Age { get; set; } } Now that's concise! May 09, 2009 04:30 AM|Ry99|LINK I realize I'm way late on this one, but you are correct, C# v3.5 has those shorthand declarations... public string MyString { get;set; } private string _myString;...and unfortunately VB.NET (my client's requirement, argh) has no such shortcut, which is how I came upon this post... trying to find one (pain in the...) public string MyString { get { return _myString; } set { _myString = value; } } May 11, 2009 05:02 PM|AceCorban|LINK Yeah, that is probably the biggest reason I prefer C# over VB. VB code tends to be pretty wordy and it just feels like I'm writing a novel sometimes instead of code. :-P May 28, 2010 05:29 PM|M Athar|LINK this is a quick and easy way to do the getter and setter of the field but I am just wondering what is the difference between this approach and the traditional approach in a simple class not in the polymorphism private int _id; public void SetId (int id) { _id = id; } public int GetId() { return _id; } May 28, 2010 05:46 PM|sp00ks222|LINK private string _name public void Name(string _name) { _name + " smith" = Name; } 7 replies Last post May 28, 2010 05:46 PM by sp00ks222
http://forums.asp.net/t/1191140.aspx
CC-MAIN-2014-52
refinedweb
399
69.21
DataTypes: Concept of programming is incomplete without data types. Data types help the programming language deal with variable, methods & classes. Data types indicate which type of variable or any other method or object is going to be handled and how much memory this will occupy. Java is an object oriented programming language and java is incomplete without data types. Java has rich set of data types. There are some basic (primitives) data types which are defined in Java. A data type specifies the size & the type of value that we are going to store in an identifier. Using different kind of data types you can handle your application to store different values to supportrequirement. Data types in java categorized in two different ways: - Primitive data types:-(Ccharacter, integer, boolean, and floating point) - Non-primitive: (classes,arrays, and interfaces) Primitive Data Types: Java has the following primary data types. 1. Integer Integer can store any number whether number is negative or positive. It is used to hold only numeric values. We cannot store any character or symbol in integer type. Example: int variable1=18; Or int variable2=-11; Above both declarations of the variable are valid. Different data types have different storing capacity. The size of value depends on its type which is given below. Table 1: Description of Integer Data types and their Size. Above table shows various kinds of data types that are used for storing numeric values. All above listed data types have their own storage capacity. Smallest data type we seen in above table is byte which stores only 1 byte. 2. Floating Point Floating point data type is another form of primitive data types. This data type used to represent the fraction part of the number. We can store numeric values with fraction part that’s not possible in integer type. There are two subtypes of floating points. Table 2: Describe Floating Point Data Types with Their Values. 3. Character We can also store character values in java not only numeric. For storing character value java provide Character type. It’s a primitive data type. It stores the character constant in to the memory. It will occupy 2 bytes but it can allow only 1 character. 4. Boolean These data types are used to store values with two states: true or false which indicate 0 for false or 1 for true. You can use these data types to construct array and build own class type. This are the variety of data types to store different kinds of value in java. Variables : Variables in java mean Identifier. It is defined by the combination of data types, identifier & initialization. You can give them the scope. Scope means visibility through some block & its life time. We can give name for storing particular data. It can be local variable means it can be used unless the given block is over. You can declare global variable,which can be used in whole program at any scope. When variable scope is over then automatically it is destroyed by using garbage collector. In java you can declare variables as below. Syntax: Data Type identifiername; // only creation of variable. OR Data type identifiername = value; // variable creation and initialization. Here, Data Type is your datatype in which type of data you want to store. Identifier can be anything from A-Z,a-z or underscore,it’s your variable name it must need to be unique. Value is the variable initialization. It is not compulsory to use. You can give at declare time or not as required your application. There are some rules to create Variable. - Variable name must not start with a number. If you provide variable name with starting letter as number then it will show you error at compile time. - First letter must need to be either from A-Z or a-z or an underscore. - Any keyword that java has or we can say any java reserved word not allowed as a variable name. - Your variable name must need to be unique. One variable name with different type of data type is not allowed. So these are the common rules that we should have to keep in mind during declaring variable in java. Example of Data Types and Variable is given below. Listing 1: DataTypesAndvariableExample.java public class DataTypesAndvariableExample { public static void main (String[] args) { System.out.println("This Example Demostrate the Use Of Data types and Variable.."); intintegerTypeVariable; // here we define Integer variable without initializing it. floatfloatTypeVariable = 25.25f; // here we define float type variable with initializing value 25.25. double doubleTypeVariable= 1258.152f; // we create and initialize double type of variable.. charcharTypeVariable; // we only create character type variable not initialized it. integerTypeVariable= 10; // initializing integer type variable with value 10.. charTypeVariable= 'J'; // Initializing Character type variable with value Z.. System.out.println("\n\t Value Of Integer Type Variable is:- "+ integerTypeVariable); System.out.println("\n\t Value Of Character Type Variable is:- "+ charTypeVariable); System.out.println("\n\t Value Of Floating Type Variable is:- "+ floatTypeVariable); System.out.println("\n\t Value Of Double Type Variable is:- "+ doubleTypeVariable); System.out.println("\n\t Bit Size of Different Data Types ..."); System.out.println("\n\t Size of Integer is:- "+ Integer.SIZE); System.out.println("\n\t Size of Character is:- "+ Character.SIZE); System.out.println("\n\t Size of Floating is:- "+ Float.SIZE); System.out.println("\n\t Size of Double is:- "+ Double.SIZE); } } Output Listing 1: DataTypesAndvariableExample This Example Demostrate the Use Of Data types and Variable.. Value Of Integer Type Variable is:- 10 Value Of Character Type Variable is:- J Value Of Floating Type Variable is:- 25.25 Value Of Double Type Variable is:- 1258.1519775390625 Size of Different Data Types ... Size of Integer is:- 32 Size of Character is:- 16 Size of Floating is:- 32 Size of Double is:- 64 Type Conversion and Type Casting in Data type: In java we can assign one type of value to another type of variable. If both variables’ types are compatible or we can say both variable have similarity in data type then java automatically convert one type of variable into the another type.This concept is commonly known as type conversion. For an example it is possible in java to assign integer type of value to long type variable or floating type variable. But there are some situations where both variable types are not compatible and at that time java will not automatically convert one type of variable to the another one. But instead of automatic conversion we can convert one type of variable to the other compatible type manually. The manually conversion of one type to another type is known as Type Casting. It is also known as explicit conversion. Type Conversion: Type conversion is possible in java if following conditions are satisfied. - Both variables type need to be compatible. - Source type variable size is needed to be smaller than the destination variable type. If this condition satisfied then type conversion takes place. Type conversion is also known as widening conversion. Java cannot perform automatic conversion between numeric type and char and Boolean type. And Boolean type and character type are not compatible. If above listed condition is not satisfied then there is need to converting type manually. Type Casting: We can perform conversion of type manually if variable type is not compatible. We would not assign integer type value to byte automatically as it does not satisfy the condition. But we can do this by using manually converting type. This type of conversion is also known as narrowing conversion. Syntax: (target-type)yourValue; Here target type is the type of variable that you want to store. Example Of Type casting and Type Conversion is given below. Listing 1:TypeCastAndConversionExample.java public class TypeCastAndConversionExample { public static void main (String[] args) { intintegerVariable=10; // integer variable with initial value 10.. floatfloatVariable=25.5f; // float variable with initial value 25.5.. bytebyteVariable; // byte variable without initialization... System.out.println("\n\t Automatic Type Conversion.."); floatVariable=integerVariable; // here floatvariable size is larger than integer so java will make automatic type conversion.. System.out.println("\n\t Float Variable after Automatic type conversion..:- " + floatVariable); System.out.println("\n\t Manually Type casting Of integer to byte.."); byteVariable=(byte)integerVariable; // here we manualy casting. as both variable is not compitible... we use (byte) to cast it into byte. System.out.println("\n\t Byte Variable after Manually Type Casting..:- " + byteVariable); } } Output Listing 1: TypeCastAndConversionExample.java Automatic Type Conversion.. Float Variable after Automatic type conversion..:- 10.0 Manually Type casting Of integer to byte.. Byte Variable after Manually Type Casting..:- 10 In the above example we saw the automatic type conversion and manually type casting of two variables. This example simply demonstrates how to perform manually type casting if its required in our programming. Array: Array is one type of variable which store multiple value with same data type. It has many dimensions such as one dimension, two dimension, or multidimensional. Array is non-primitive data type. One Dimensional Array: It is simple form of an array, which list the value of same type. All rules of variable also assign to array because it is one type of variable. So you must have to declare array before use with its data type. The general form to declare Array is. Datatypearray_variable_name[ ]; Here data type can be any data type upon which we want to store values. You can use any of them as per your application’s requirement. Example: intarray_variable_name[ ]; Here we declare array of integer type. You can define it just like this. Here the size of array is null. It means the array has no value. To allocate any size to your array to store the value you have to use new keyword, which is the operator of Java. new operator allocates memory to the variable or any object or instance of class. Variable_array_name = new Datatype[size]; Here you can define size within the square brackets. Same data types you can use as you’re required. Size must be defined using int (integer) whatever data type you are using for the array elements. . Example of Declare Different Kind of Array in java: intintArry[]; // to create an integer type of array. Or int [] intArry; charcharArry[]; // to create character type array. or char [] charArry; longlngArry[]; // to create long type array. or long [] lngArry; String strArray[]; // To create String type of array. Or String [] strArray; You can dynamic allocate the memory or you can also allocate the memory at declaration time. Array_variable[0]=18; Array_variable[1]=11; Array_variable[2]=19; Array_variable[3]=28; Like this you can declare array by using its index in between square brackets. So that Compiler knows that which value is contained in which position. In bracket you specify index position. We understand two step of array declaration, first array declare with data type and then using new keyword, defining its type. Here we can also specify the size of an array during the declaration time . intarray_Variable = new int[10]; here we create array_variable of integer type with size of 10. As we know Array is a one type of variable, so you can initialize at declaration time. You can declare its value within the curly braces and by comma separated. Here there is no need to use new key word because it automatically takes the size of array. Example: intarray_variable_of_integer = {19,18,11,17,9,29,21,24}; Same as index starts with 0, 1st element starts with 0 index. So here position of value 19 in array is 0(zero). You must have to access the array and its value between the given size and its range. If you go out of the range of an array then Java will throw one run time exception that is ArrayIndexOutOfBounds and your program will terminate. Example of Simple array is given below. Listing 2: SimpleExampleOfArray.java public class SimpleExampleOfArray { public static void main(String[] args) { double [] dblArry=new double []{200,500,300,700,800,900,1000}; double [] dblArry1={200,500,300,700,800,900,1000}; for(int i=0;i<7;i++) { System.out.println("dblArry : " + i +" :"+dblArry[i]); System.out.println("dblArry : " + i +" :"+dblArry1[i]); } } } Output Listing 2: SimpleExampleOfArray.java dblArry : 0 :200.0 dblArry : 0 :200.0 dblArry : 1 :500.0 dblArry : 1 :500.0 dblArry : 2 :300.0 dblArry : 2 :300.0 dblArry : 3 :700.0 dblArry : 3 :700.0 dblArry : 4 :800.0 dblArry : 4 :800.0 dblArry : 5 :900.0 dblArry : 5 :900.0 dblArry : 6 :1000.0 dblArry : 6 :1000.0 Multidimensional Array Multidimensional array displays the value of array in the form of rows and columns. Just like table. In which you have to specified the size of both row as well as column at declaration time. It is also known as an array of array. Examples: int[][]multidimension_array_variable = new int[2][3] Here we declare variable multidimension_array_variable with specifying rows and columns. In the above example first index is 2 that shows row of an array and another one is column that is 3. So array created by this syntax has 2 rows and 3 columns. Below is the way that multidimention array has. 0 1 2 3 4 5 àin which positon of 0 is [0][0] Same as, multidimention_array_variable[0][1]=1; multidimention_array_variable[0][2]=2; multidimention_array_variable[1][0]=3; multidimention_array_variable[1][1]=4; multidimention_array_variable[1][2]=5; In this manner data value will be stored in multidimension array. Example of Multidimension array is given Below. Listing 3: SimpleExampleOfMultiDimensionArray.java public class SimpleExampleOfMultiDimensionArray { public static void main(String[] args) { String[][] names = { {"BajraRotla", "wheat Rotli", "Nan"}, {"with butter", "Withoht Butter"} }; System.out.println(names[0][0] + " " + names[1][0]); System.out.println(names[0][2] + " " + names[1][1]); } } Output Listing 3:SimpleExampleOfMultiDimensionArray.java BajraRotla with butter Nan Withoht Butter This example demonstrates the use of multi-dimensional array to store value in multiple forms. We can directly assign one array variable to the other one. Java provides built-in method to do this type of work. Example of copying one array variable to another without using arraycopy() method. Listing 4: SimpleExampleOfArray.java /* In this example we copy one array to another array. It is primitive type of array. * Directly assigning the one variable to the another variable. */ public class SimpleExampleOfArray { publicSimpleExampleOfArray() { } public static void main(String[] args) { intfirstArray[]=new int[]{20,30,40,50,60,70,80}; intsecondArray[]; // Simple assigning the variable to the another variable. secondArray=firstArray; System.out.println(" : Copy int Type of Value :"); System.out.println("---------------------------\n"); for(int i=0;i<firstArray.length;i++) { System.out.println("first Array Value is : "+i+":"+firstArray[i]); System.out.println("second Array Value is : "+i+":"+secondArray[i]); } char[] chrFirstArray = new char[]{ 'G', 'o', 'o', 'D', 'M', 'O', 'o', 'r', 'n', 'i', 'n', 'g', '.','!','!' }; char[] chrSecondArray; // Simple assigning the variable to the another variable. chrSecondArray=chrFirstArray; System.out.println("\n\n : Copy char Type of Value :"); System.out.println("---------------------------\n"); System.out.println("Value of Array First is :" + chrFirstArray) ; System.out.println("Value of Array First is :" + chrSecondArray); } } Output Listing 4: SimpleExampleOfArray.java : Copy int Type of Value : --------------------------- first Array Value is : 0:20 second Array Value is : 0:20 first Array Value is : 1:30 second Array Value is : 1:30 first Array Value is : 2:40 second Array Value is : 2:40 first Array Value is : 3:50 second Array Value is : 3:50 first Array Value is : 4:60 second Array Value is : 4:60 first Array Value is : 5:70 second Array Value is : 5:70 first Array Value is : 6:80 second Array Value is : 6:80 : Copy char Type of Value : --------------------------- Value of Array First is :GooDMOorning.!! Value of Array First is :GooDMOorning.!! This example demonstrates how to copy one array from another using simple assigning. Copy one array from another array using the method arraycopy() of System class. arraycopy() Method : arraycopy() is the method of final Class System. arraycopy() method is static method so we can directly call arraycopy() method by using class name System.return type of arraycopy() method is void. Syntax of this method is given below. Syntax: public staticvoidarraycopy(Object src,intsrcPos, Objectdest,intdestPos,intlength); Here src is a Source object from which array we want to copy. srcPos is the position where to start a copy from source. dest is the destination of array where it is copy. destPosition is the position of the destination array. Length is the total number of value we want to copy. Example of arraycopy() method is given below. Listing 5: SimpleExampleOfArray.java public class SimpleExampleOfArray { publicSimpleExampleOfArray() { } public static void main(String[] args) { intfirstArray[]=new int[]{20,30,40,50,60,70,80}; intsecondArray[]=new int[3]; // Simple assigning the variable to the another variable. System.arraycopy(firstArray,3,secondArray,0,3); System.out.println(" : Copy int Type of Value :"); System.out.println("---------------------------\n"); System.out.println("first Array Value is : "); for(int i=0;i<firstArray.length;i++) { System.out.print(" "+firstArray[i]); } System.out.println("\n\nSecond Array Value is : "); for(int i=0;i<secondArray.length;i++) { System.out.print(" "+firstArray[i]); } char[] chrFirstArray = new char[]{ 'G', 'o', 'o', 'D', 'M', 'O', 'o', 'r', 'n', 'i', 'n', 'g', '.','!','!' }; char[] chrSecondArray=new char[20]; // Simple assigning the variable to the another variable. System.arraycopy(chrFirstArray,4,chrSecondArray,0,5); System.out.println("\n : Copy char Type of Value :"); System.out.println("---------------------------\n"); System.out.println("Value of Array First is :" + new String(chrFirstArray)) ; System.out.println("Value of Array First is :" + new String(chrSecondArray)); } } Output Listing 5: SimpleExampleOfArray.java : Copy int Type of Value : --------------------------- first Array Value is : 20 30 40 50 60 70 80 Second Array Value is : 20 30 40 : Copy char Type of Value : --------------------------- Value of Array First is :GooDMOorning.!! Value of Array First is :MOorn Above example demonstrates the use of arraycopy() method of System class to copy one array to another one. Conclusion Here in this tutorial we learned about data types and array. We also got the idea how to use array in our programming. We learn type conversion and type casting of data type. We examine arraycopy() method of array to understand arrays.
http://mrbool.com/data-types-and-array-in-java/30246
CC-MAIN-2016-44
refinedweb
3,033
51.44
Getting Started with October CMS Static Pages This article was created in partnership with October CMS. Thank you for supporting the partners who make SitePoint possible. Looking to partner with SitePoint? Get more information here. These days it can be tough for website developers, especially now with WordPress going through the biggest and the most dramatic update in its history. Over the past few months, we’ve observed a growing interest in the October CMS community. October CMS is the natural choice for developers that look for a modern and reliable content management system based on the Laravel PHP framework. Launched in 2014, today October CMS is a mature platform with a large ecosystem. October CMS is known for its reliability and non-breaking updates, which is greatly appreciated by developers and their clients. The philosophy “Getting back to basics” really matters to freelancers and digital studios, whose businesses depend on the quality of the software they use. The quickly growing Marketplace and the supporting businesses built around October are great proof of the community’s trust. In 2018 October CMS was also voted the Best Flat File CMS in the CMS Critic Award contest. October CMS has a simple extensible core. The core provides basic CMS functions and a lot of functionality can be added with plugins from the Marketplace. The plugins Marketplace includes a lot of product categories, which include blogging, e-commerce, contact forms, and many others. In this tutorial, we will demonstrate how to create a website with pages editable in WYSIWYG (What You See Is What You Get) mode, and blogging features. We will use the Static Pages plugin that allows you to create a dynamic website structure with pages and menus manageable by non-technical end users. At the same time, the website will include dynamic blog pages, with content managed with the Blog plugin. All plugins used in this tutorial are free for anyone to install. The ideas from this tutorial can be extended to creating more complex websites. Themes implementing similar features can be found on the Themes Marketplace, but the goal of this tutorial is to show how easy it is to make an October website from scratch. This is what we will have at the end: The website theme is completely based on Twitter Bootstrap 4.3. The demo website also includes a simple CSS file that manages some light styling features, such as padding and colors, but since it is not relevant for the topic of this tutorial, it won’t be described in this guide. Installing October CMS To install October CMS you must have a web server meeting the minimum requirements. You can use MAMP as a solution to try October on your computer. There are several ways to install October CMS. We will use the Wizard Installer option, which is simple and user-friendly. The installation process is explained in the documentation. Create a new MySQL database, download the installer, unpack it to a directory you prepared for October and open the install.php script in a browser. The installation process is fairly straightforward, showing the standard prompts to enter the database details and set up the administrator credentials. On the last step, click Start from scratch. This will create an empty installation with a simple demo theme. After the installation finishes, click the Administration Area link and log into the October CMS back-end using the credentials you provided during the installation. Installing Static Pages and Blog Plugins In this step, we will install two plugins required for our little project. In the October CMS Administration Area, navigate to the Settings page and click the Updates & Plugins link in the sidebar. Enter “Static Pages” in the search bar and when the plugin list finishes loading, click the Static Pages plugin. This will install the Static Pages plugin. Repeat the process to install the Blog plugin. If you did everything right, you should see two plugins installed: Creating the new theme We want to start with a blank theme for our tutorial. To create a new theme, open the Settings page in the October CMS Administration Area and click the Front-end theme item in the sidebar. Click Create a new blank theme link. Enter the new theme name, for example, “My blog theme”. Click Create. Creating the Layout In October CMS, Layouts define pages scaffold – usually, they include the HTML, HEAD, TITLE and BODY tags. Almost every CMS page has a layout assigned to it. The simplest functional layout code looks like this: <html> <body> {% page %} </body> </html> Note the {% page %} tag — it gets replaced by the page contents when the page is requested and rendered by October CMS. For our tutorial, the Layout will define the markup required for a Twitter Bootstrap page. We will basically copy it from the Bootstrap Starter Template example and extend with October CMS features. To create a Layout, open the CMS editor by clicking CMS on the main menu. Note that using the built-in CMS editor is not a requirement since all theme objects — Layouts, Pages and Partials — are just HTML files in the theme directory (although there is an option to use a database instead). This means that you can edit them with your favorite code editor. However, using the CMS editor is preferable for new users. Click the Layouts item in the sidebar and then click the Add button. In the Layout editor enter default in the File Name field and click Save (alternatively you can click Ctrl+S on Windows or Cmd+S on Mac). Paste the following text in the Markup code editor and make sure you save the layout again. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <title>My blog theme</title> <!-- Bootstrap core </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark"> <div class="container"> <a class="navbar-brand" href="/">Static pages demo</a> <button class="navbar-toggler" type="button" data- <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse"> <!-- Menu contents will go here --> </div> </div> </nav> <main role="main" class="container"> <div class="row"> <div class="col-8"> {% page %} </div> <div class="col"> <div class="blog-categories-sidebar"> <h4>Blog categories</h4> <!-- Blog category list will go here --> </div> </div> </div> </main><!-- /.container --> mentioned above, the markup was copied from the Bootstrap Starter Template, with a few additions: - We added a reference to the theme.cssasset file. This stylesheet is not relevant for the tutorial. It defines a visual style for the blog categories menu and manages some text styles. - The main container has two columns. The left column contains the {% page %}tag and will be replaced with the actual page contents by October CMS when an actual page is requested. The right column contains the blog category menu. - The top menu elements were removed. We will replace them with the automatically generated content later in this tutorial. To make the layout available for Static Pages, we must add the Static Page component to the layout. Click the Components item in the sidebar and click the Static Page component. It is located in the Pages section. This will add the component to your layout. This component does not require any configuration, but you can click it to see the available properties in the Inspector. You can also check the Default layout checkbox to make this layout default for all new pages. Don’t forget to save the layout before leaving the page! Creating static pages Our imaginary website will have the following page structure: - Projects (/projects) - Websites (/projects/websites) - Applications (/projects/applications) - About (/about) - Blog (/blog) All pages except the Blog are going to be static pages. Static pages can be created by end-users without any web development knowledge, in WYSIWYG mode. Let’s now create the static pages. Click the Pages item in the main October CMS menu to open the Static Pages editor. Click the Add button to create a new static page. Enter Home in the title field and “/” (forward slash) in the URL field. Put any text to the Content field and save the page. Repeat the same process to create Projects, About and Contact Us page. The Blog page is not a static page, just skip it for now. You can use any URLs for the pages you create. The Static Pages plugin will try to generate URLs based on the page titles you provide. As you might have noticed, the Websites and Applications are subpages of the Projects page. To create a subpage, hover over the Projects page in the page list and click the Add subpage link: The automatically generated URL for subpages will reflect their location, for example, /projects/websites. You can now test your website by clicking the Preview icon in the top menu of the Administration Area. The icon is located in the right corner, to the left of the user avatar image. If you did everything right, the website now shows the home page and you can try opening other pages by entering their URLs in the browser address bar. The website top menu and blog category list are not visible yet and we are going to fix this in the following sections. Creating menus Now that we have the static pages created, we can create the main website menus. The Static Pages plugin can automatically create the menu structure based on the structure of your static pages, blog categories, and much more. You can add menu items manually, or you can configure the menu to generate its items automatically. Our website has two menus on the top – the left menu and the right menu. Let’s start with creating the left menu. On the Pages screen click the Menus item in the sidebar and then click Add button to create your first menu. Enter “Top menu – left” in the Name field. Click Add item in the Menu items area. Enter any value in the Title field – this menu item title will not be visible anyways. Select All Static Pages in the Type dropdown menu. Check the Replace this item with its generated contents checkbox. Save the menu item and the menu itself. Now we can add the menu to our Layout to make it visible on all website pages. Return to the CMS area, click Layouts and click default.htm layout in the layout list to open the layout in the editor. Now click Components item in the sidebar and click the Static Menu component. Click the new component on the Layout components area to open Inspector and make sure that the Menu property shows “Top menu – left”. Enter topMenuLeft in the Alias property. Save the layout. Now we are going to have a bit of coding. Bootstrap 4 expects a very specific markup for navbars: <ul class="navbar-nav"> <li class="nav-item active"><a class="nav-link" href="...">Active item</a></li> <li class="nav-item"><a class="nav-link" href="...">Inactive item</a></li> </ul> For dropdown menus, it is a little more complicated. The Static Pages plugin can generate markup for menus automatically, but the default markup is not specific to Bootstrap – this is just not possible to have a universal markup format that would fit all frameworks. We will create our own partial for rendering menu items, which will be fully compatible with Bootstrap 4. As you might know, October CMS uses the Twig templating engine. In the CMS area click Partials in the sidebar and then click Add to create a new partial. Enter menu-items in the File Name field and paste the following snippet to the Markup field. Make sure to save the partial when you finish. <ul class="navbar-nav {{ class }}"> {% for item in items %} <li class=" nav-item {{ item.isActive or item.isChildActive ? 'active' : '' }} {{ item.items ? 'dropdown' : '' }} "> <a class="nav-link {% if item.items %}dropdown-toggle{% endif %}" {% if item.items %}{{ item.title }}</a> {% if item.items %} <div class="dropdown-menu"> {% for subitem in item.items %} <a class="dropdown-item" href="{{ subitem.url }}">{{ subitem.title }}</a> {% endfor %} </div> {% endif %} </li> {% endfor %} </ul> The items and class variables are expected to be passed from outside the partial, which we will explain below. The items variable is a list (array) of menu items to render and the class variable specifies the CSS class we want to add to the navbar element. We will use the same partial to display 3 menus: the left side of the main menu, the right side of the main menu and the blog category list. The class variable is needed to add the mr-auto class name to the top left menu. This class is a part of the Bootstrap layout system. Basically, it will push the top left menu to the left side, and the top right menu – to the right. The items array contains a list of menu items. You can find full API documentation of the Static Pages menus on the plugin’s documentation page. Now we can finally display our menus on the page. Open the CMS editor, click Layouts in the sidebar and click our default layout. Replace the <!-- Menu contents will go here --> placeholder with the following line and save the template. {% partial 'menu-items' items=topMenuLeft.menuItems class='mr-auto' %} The partial tag is a standard feature of the October CMS template engine. It takes the partial name and optional variables to pass to the partial. The code above renders the partial we just created. The items variable loads menu items from the Static Menu component with the alias topMenuLeft, which we created before. The class variable is just a static string with a value required by Bootstrap. Open the website preview again to see the rendered menu: Currently, there are two problems with the menu – the Contact Us item is displayed on the left side, although according to our plan it must be on the right side. The other problem is that there is no Blog item on the menu. We will fix both problems in a minute. First, let’s fix the Contact Us menu item. Go to the Pages section, click Pages item in the sidebar and click the Contact Us page. Click the small triangle icon on the right side of the editor to access the Settings form: Enable the Hide in navigation option on the Settings form and save the static page. This will hide the Contact Us static page from the automatically generated menu. Let’s now create the right-side top menu. Click Menus on the sidebar and click Add to create a new menu. Enter Top menu – right in the Name field. Click Add item and enter Contact Us in the Title field. Select Static Page in the Type drop-down menu and select the Contact Us page in the Reference drop-down menu. Click Apply to save the menu item and also make sure to save the menu itself. Return to the CMS area and open our default layout in the editor. Add another Static Menu component to the layout. Click the new component to show Inspector, enter topMenuRight in the Alias field and select Top menu – right in the Menu drop-down. Close Inspector and paste the following line to the Markup section, below the line which you have added for rendering the top left menu: {% partial 'menu-items' items=topMenuRight.menuItems %} As you can see, we use the same partial as before, but this time we load menu items from the right top menu and do not pass any CSS class. Save the layout and preview the website again: Congratulations, we are almost there! The last missing menu item is the Blog. Explaining how to add blog features to a website is out of the scope of this tutorial. You can read about creating Blog pages on the Blog plugin documentation page. Assuming that you have already created the blog post page, we can add a menu item to the top left menu. Open the Pages section and go to the Menus area. Click the Top menu – left menu and click Add Item. Enter Blog in the Title field and select CMS Page in the Type drop-down menu. Select your blog page in the Reference drop-down menu. Do not close the menu item editor popup yet. We are going to show a trick that will help us to make the Blog menu item active programmatically on the Blog Category page. Click the Attributes tab in the menu item editor and click enter blog in the Code field. Save the menu item and then save the menu. You can now refresh the website preview and see our new Blog item on the menu: Creating the blog category menu The only missing part of our demo website is the blog category menu. We assume that you have created the blog category CMS page by following the Blog plugin documentation. An important thing for making the blog categories page compatible with the Static Pages plugin is that the Post List component on the categories page must have the Category Filter property to be configured to read its value from the URL parameter: After configuring the blog category CMS page, click the Pages item in the main October CMS menu again and create a new Menu. Enter Blog categories to the Name field and click Add Item. In the menu item editor enter Categories in the Title field. This value does not really matter as this menu item is going to be replaced with menu items based on the blog categories. Select All blog categories in the Type drop-down menu. Select your blog categories CMS page in the CMS Page drop-down menu. Click the Replace this item with its generated children checkbox, save the menu item and save the menu. We have already added two menus to the layout, the process of adding the third menu is the same. Click the CMS item in the main October menu, open the default layout and add the Static Menu component to the layout. Click the new component and enter blogCategories in the Alias field. Select the new menu Blog categories in the Menu drop-down list. Save the layout. Now replace the comment <!-- Blog category list will go here --> with the partial tag: {% partial 'menu-items' items=blogCategories.menuItems class='flex-column' %} Save the layout again and preview the website. If you don’t see any items in the blog categories menu make sure that you have actually created any blog categories! Now the website looks exactly as we wanted. However, if you click any blog category you will notice that the Blog main menu item is not active. To fix this we will use the Static Pages API to make the menu item active programmatically. Open the Blog Categories page in the CMS editor and paste this little snippet to the Code editor: function onInit() { $this['activeMenuItem'] = 'blog'; } The blog value is the menu item code, which you have specified for the Blog item. And the activeMenuItem is a variable which the Static Pages plugin uses to determine what menu item is currently active. You can read more about the plugin API on the documentation page. Save the page and refresh the website preview — the Blog item is now active. We hope you enjoyed this tutorial! It took a few hours to write this post, but the process of creating the demo website took as little as 15 minutes. Now you can create websites with mixed static and dynamic pages. You can find more useful plugins on the Marketplace and learn more tricks on the October CMS blog! See also:
https://www.sitepoint.com/getting-started-with-october-cms-static-pages/
CC-MAIN-2020-16
refinedweb
3,310
72.56
XAML - Debugging If you are familiar with debugging in any procedural language (such as C#, C/C++ etc.) and you know the usage of break and are expecting the same kind of debugging in XAML, then you will be surprised to know that it is not possible yet to debug an XAML code like the way you used to debug any other procedural language code. Debugging an XAML app means trying to find an error; In data binding, your data doesn't show up on screen and you don't know why Or an issue is related to complex layouts. Or an alignment issue or issues in margin color, overlays, etc. with some extensive templates like ListBox and combo box. Debugging in XAML is something you typically do to check if your bindings work, and if it is not working, then to check what's wrong. Unfortunately, setting breakpoints in XAML bindings isn't possible except in Silverlight, but we can use the Output window to check for data binding errors. Let's have a look at the following XAML code to find the error in data binding. <Window x: <Grid> <StackPanel Name = "Display"> <StackPanel Orientation = "Horizontal" Margin = "50, 50, 0, 0"> <TextBlock Text = "Name: " Margin = "10" Width = "100"/> <TextBlock Margin = "10" Width = "100" Text = "{Binding FirstName}"/> </StackPanel> <StackPanel Orientation = "Horizontal" Margin = "50,0,50,0"> <TextBlock Text = "Title: " Margin = "10" Width = "100"/> <TextBlock Margin = "10" Width="100" Text = "{Binding Title}" /> </StackPanel> </StackPanel> </Grid> </Window> Text properties of the two text blocks are set to “Name” and “Title” statically, while the other two text block’s Text properties are bound to “FirstName” and “Title”. But the class variables are intentionally taken as Name and Title in the Employee class which are incorrect variable names. Let us now try to understand where we can find this type of mistake when the desired output is not shown. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataBindingOneWay { public class Employee { public string Name { get; set; } public string Title { get; set; } public static Employee GetEmployee() { var emp = new Employee() { Name = "Ali Ahmed", Title = "Developer" }; return emp; } } } Here is the implementation of MainWindow class in C# code − using System; using System.Windows; using System.Windows.Controls; namespace DataBindingOneWay { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = Employee.GetEmployee(); } } } Let's run this application and you can see immediately in our MainWindow that we have successfully bound to the Title of that Employee object but the name is not bound. To check what happened with the name, let’s look at the output window where a lot of log is generated. The easiest way to find an error is to just search for error and you will find the below mentioned error which says “BindingExpression path error: 'FirstName' property not found on 'object' ''Employe” System.Windows.Data Error: 40 : BindingExpression path error: 'FirstName' property not found on 'object' ''Employee' (HashCode=11611730)'. BindingExpression:Path=FirstName; DataItem='Employee' (HashCode=11611730); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') Which clearly indicate that FirstName is not a member of Employee class, so it helps to fix this type of issues in your application. When you change the FirstName to Name again, you will see the desired output. UI Debugging Tools for XAML UI debugging tools for XAML are introduced with Visual Studio 2015 to inspect the XAML code at runtime. With the help of these tools, XAML code is presented in the form of visual tree of your running WPF application and also the different UI element properties in the tree. To enable this tool, follow the steps given below. Step 1 − Go to the Tools menu and select Options from the Tools menu. Step 2 − You will get to see the following dialog box. Step 3 − Go to the General Options under Debugging item on the left side. Step 4 − Check the highlighted option, i.e, “Enable UI Debugging Tools for XAML” Step 5 − Press the OK button. Now run any XAML application or use the following XAML code − <Window x: <StackPanel> <ComboBox Name = "comboBox" Margin = "50" Width = "100"> <ComboBoxItem Content = "Green"/> <ComboBoxItem Content = "Yellow" IsSelected = "True"/> <ComboBoxItem Content = "Orange" /> </ComboBox> <TextBox Name = "textBox" Margin = "50" Width = "100" Height="23" VerticalAlignment = "Top" Text = "{Binding ElementName = comboBox, Path = SelectedItem.Content, Mode = TwoWay, UpdateSourceTrigger = PropertyChanged}" Background = "{Binding ElementName = comboBox, Path = SelectedItem.Content}"> </TextBox> </StackPanel> </Window> When the application executes, it will show the Live Visual Tree where all the elements are shown in a tree. This Live Visual Tree shows the complete layout structure to understand where the UI elements are placed. But this option is only available in Visual Studio 2015. If you are using an older version of Visual studio, then you can’t use this tool; however there is another tool which can be integrated with Visual Studio such as XAML Spy for Visual Studio. You can download it from. We recommend you to download this tool if you are using an older version of Visual Studio.
https://www.tutorialspoint.com/xaml/xaml_debugging.htm
CC-MAIN-2018-39
refinedweb
850
51.28
Is undefining these items (like yytext_ptr) at the end of the rules just being fastidious or is it really necessary for the new functionality?Is undefining these items (like yytext_ptr) at the end of the rules just being fastidious or is it really necessary for the new functionality? Manoj Srivastava wrote: On Tue, 15 Apr 2003 12:44:49 -0400,Joey Hess <joeyh@debian.org> said:> Manoj Srivastava wrote: >> Flex sets up a number of things that are available in the rules >> section, and now cleans it all up before polluting the user >> namespace. Now, actions can be any C statement, but using >> functions that in turn use flex macros is going to be a problem >> since declaring the function is going to be problematic. >> >> Some of these changes were driven by the need to make flex >> scanners reentrant, others by hte requirements for having multiple >> scanners, perhaps with different options, in the same program. > It seems to promote bad coding style to require that reasonable > little functions like this: > eos() { > if (yytext[yyleng-1] == '.') > dintI(); > else > yyunput(yytext[yyleng-1], yytext); >> > Must be inlined into the rules block or defined as macros or > something, instead of just being defined as regular functions.Not quite. --------------------------------------------------------------------- *Note Lex and Posix::, for other such features). Any _indented_ text or text enclosed in `%{' and `%}' is copied verbatim to the output (with the %{ and %} symbols removed). The %{ and %} symbols must appear unindented on lines by themselves. ---------------------------------------------------------------------- I'll attach a file at the end that uses functions once again. Just the placement of these function definitions has changed. >> > Oh and why do I need an expliciy main() and yyweap() function >> > now? This code always worked before with flex generating stub >> > functions automatically. The real code is in the filters >> > package, in cockney.l, jive.l, and others. >> >> With multiple scanners now possible in the same program, flex >> would not know where to put main, obviously, it shoulkd not >> generate stubs in all the scanners generated. >> >> What is yyweap? > Typo for yywrap. You must supply a `yywrap()' function of your own, or link to `libfl.a' (which provides one), or use %option noyywrap in your source to say you don't want a `yywrap()' function. manoj %{ /* COMMENT: code block */ %} %option noyywrap /* COMMENT: Definitions Section */ BW [ \t\n] SP [ \t]+ EW [ \t.,;!\?$] %% /* COMMENT: Rules Section */ %{ /* COMMENT: Define function */ void foo () { unput(yytext[yyleng-1]); } %} foo /* COMMENT: after regex */ foo(); /* COMMENT: after code block */ /* COMMENT: Rules Section (indented) */ %% /* User COMMENT: Code Section */ int main(void) { yylex(); } --
https://lists.debian.org/debian-devel/2006/04/msg00550.html
CC-MAIN-2016-30
refinedweb
419
63.19
int InchesToFeet (int feet) {...} should read static int FeetToInches (int feet) {...} The figure does not match the code, either of code or figure should be change. The code reads p1.X =9 and p2.X=7 and remains unchanged, but in the figure we see that p1.X=7 and p2.X=9. Note from the Author or Editor:Figure 2-2 should be changed so that the numbers 7 and 9 are swapped around. The page now ends with "for example:" followed by no example. Here are the 6 lines that should follow: class BaseClass { protected virtual void Foo() {} } class Subclass1 : BaseClass { protected override void Foo() {} } // OK class Subclass2 : BaseClass { public override void Foo() {} } // Error The compiler prevents any inconsistent use of access modifiers. For example, a subclass itself can be less accessible than a base class, but not more accessible: internal class A {} public class B : A {} // Error Note from the Author or Editor:Note that the suggested correction isn't quite right: it should read: ...implements IUndoable.Undo explicitly. Also, on the last line of the page, it should read: IUndoable's Undo method. {95} 4th line, change Console.WriteLine (typeof(BorderSide), Enum.IsDefined (side)); //False to Console.WriteLine (Enum.IsDefined (typeof(BorderSide), side)); //False In the example: static void Swap<T> (ref T a, ref T b) { T temp = b; //SHOULD BE EITHER T temp = a; a = b; // OR b = a; b = temp; } Note from the Author or Editor:Method should be: static void Swap<T> (ref T a, ref T b) { T temp = a; a = b; b = temp; } I believe this code example should include at the end the line: enumerator.Dispose(); If this code is (as it states) intended to be functionally the same as a foreach statement shown above. Note from the Author or Editor:This has been fixed in the 4th edition. [3/08 printing] in the 2nd column of the IsWhiteSpace row and the IsControl row, control characters using incorrect syntax: "/n" should be "\n", etc Note from the Author or Editor:In the 2nd column of the IsWhiteSpace and IsControl rows, replace all forward slashes (/) with backslashes (\) if (Zoo != null) Zoo.NotifyNameChange(this, value); should bee: if (Zoo != null) Zoo.Animals.NotifyNameChange(this, value); There's an error in Figure 8-2 on page 283 - which is also reproduced on the back cover. There's an extra line betweeen the select and group-clause boxes which shouldn't be present. Here's how it should look: In code sample 1/4 down the page, cust.Purchases.Remove(p2) should read: cust.Purchases.Add(p2) Note from the Author or Editor:A correction was submitted for the third printing. Need to change "100" to "1". Sentence: "In this example, LINQ to SQL automatically writes 100 into the CustomerID column... " Should read: "In this example, LINQ to SQL automatically writes 1 into the CustomerID column... " The line: Customer cust = dataContext.Customers.Single(c => c.ID == 1); is superfluous. It does not need to be there and should be deleted. Note from the Author or Editor:Confirmed: delete first line in that code listing (top of page 315) as described. The descriptions for the methods 'TakeWhile' and 'SkipWhile' both state [Emits|Ignores] elements from the input sequence until the predicate is true This is incorrect, they operate while the predicate is true, and operate until the predicate is false. From MSDN on TakeWhile: "Returns elements from a sequence as long as a specified condition is true." The examples on page 327 also make the operation clear. The problem is that the operations continue WHILE the predicate is true, rather than UNTIL. To use until, you would have to state they continue until false, which is awkward. They should be reworded, as their function name suggests, to say they perform their action WHILE the predicate is true. Note from the Author or Editor:Table, half way down page 324: - In the middle column ("Description") of TakeWhile, change "until" to "while" so that it reads "Emits elements from the input sequence while the predicate is true" - In the middle column ("Description") of SkipWhile, change "until" to "while" so that it reads "Ignores elements from the input sequence while the predicate is true, and then emits the rest" Similarly, half way down page 327, change "until" to "while" in the first and second sentences under section "TakeWhile and "SkipWhile". writer.WriteStartElement ( Note from the Author or Editor:Page 406, first code listing, third line. Change "firstname" to "lastname", so that it reads: writer.WriteStartElement ("o", "customer", ""); writer.WriteElementString ("o", "firstname", "", "Jim"); writer.WriteElementString ("o", "lastname", "", "Bo"); writer.WriteEndElement(); In the last sentence of note at the top of the page, "setion" should be "section". In the sentence, "The client instantiates a NamedClientStream and then calls Connect (with an optional timeout)", "NamedClientStream" should say "NamedPipeClientStream". "in other words, reads until IsMessageComplete is false:" should be "in other words, reads until IsMessageComplete is true:". In the example given, the do-while loop exits when (!s.IsMessageComplete ) is false. VS' Object Browser tells me: public bool IsMessageComplete {get;} IsMessageComplete Returns: true if there are no more characters to read in the message; otherwise, false. Page 564, 9th line Change: Console.WriteLine(t); To: Console.WriteLine(t.FullName); the output of Console.WriteLine(t.FullName) should be: // System.Environment+SpecialFolder instead of: // System.Environment+StringBuilder In the sentence "...whereas RefectedType returns the subtype." RefectedType should read ReflectedType Page 587, Passing Arguments to a Dynamic Method section, 4th line Change: when calling DefineMethod. to: when calling DynamicMethod constructor. Note from the Author or Editor:Change: when calling DefineMethod. to: when calling DynamicMethod's constructor. Page 587, Passing Arguments to a Dynamic Method section, 4th line Change: when calling DefineMethod. to: when calling DynamicMethod constructor. Note from the Author or Editor:Change: ...when calling DefineMethod. to: ...when constructing the DynamicMethod. Page 600, Attaching Attributes section, 5th-to-last line Change: new object[] { "FirstName", 3 } // Property values To: new object[] { "", 3 } // Property values Page 600, Attaching Attributes section, 5th-to-last line Change: new object[] { "FirstName", 3 } // Property values To: new object[] { "", 3 } // Property values Note from the Author or Editor:Good spot. Page 601, second code snippet, 2nd-to-last line Change: gen.Emit(OpCodes.Ldarg_1); To: gen.Emit(OpCodes.Ldarg_0); Page 601, second code snippet, 2nd-to-last line Change: gen.Emit(OpCodes.Ldarg_1); To: gen.Emit(OpCodes.Ldarg_0); Note from the Author or Editor:The line to change is about 2/3 way down the page. It should read: gen.Emit (OpCodes.Ldarg_0); And to whoever reported this, well-spotted! Instead of "The final argument to BeginInvoke is a user state object that populates the AsyncResult property of IAsyncResult." it should be "The final argument to BeginInvoke is a user state object that populates the AsyncState property of IAsyncResult.". Please note "AsyncState" instead of "AsyncResult". A method is incorrectly referred to as "AppDomain.UnloadDomain". It should read "AppDomain.Unload". © 2014, O’Reilly Media, Inc. (707) 827-7019 (800) 889-8969 All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
http://www.oreilly.com/catalog/errata.csp?isbn=9780596527570
CC-MAIN-2014-52
refinedweb
1,186
58.08
Cyprus 🇨🇾 Get import and export customs regulation before travelling to Cyprus. Items allowed to import are Medicines for personal use. Prohibited items are Narcotic drugs and psychotropic substances. Some of restricted items are Air rifles of a diameter not exceeding 1. Cyprus is part of Europe with main city at Nicosia. Its Developed country with a population of 847K people. The main currency is Euro. The languages spoken are Greek, Turkish and Armenian. 👍 Developed 👨👩👦👦 847K people chevron_left import export chevron_right Useful Information Find other useful infromation when you are travelling to other country like visa details, embasssies, customs, health regulations and so on.
https://visalist.io/cyprus/customs
CC-MAIN-2020-50
refinedweb
103
51.44
ADO.NET EntityObject Generator Template This topic gives an overview of the ADO.NET EntityObject Generator template included with Visual Studio 2010, The topic also shows how to customize the text template. The ADO.NET EntityObject Generator template generates the typed ObjectContext and EntityObject derived entity classes (object-layer code). The ADO.NET EntityObject Generator template generates the same code as the default code generated by the Entity Designer. The ADO.NET EntityObject Generator template consists of one text template file: <model name>.tt. The <model name>.tt template outputs one source file, <model name>.cs (or .vb), which appears under <model name>.tt in Solution Explorer. <model name>.tt File Code Overview First, the code uses built-in directives to instruct the text template processing engine how to process the template. The text template includes the .ttinclude file that contains utility classes that help with the code generation process. For more information about .ttinclude file, see Entity Framework Utility .ttinclude File. Then, it creates an instance of the UserSettings type that lets the user specify how the code should be written out. For example, this type determines whether camel case is used for field names or if the AddTo methods are added to the typed object context class in the generated code. Then, the code instantiates and initializes the helper classes that are defined in the .ttinclude file. Some local variables are initialized as well. <# Dim loader As New MetadataLoader(Me) Dim ef As New MetadataTools(Me) Dim region As New CodeRegion(Me) Dim code As New CodeGenerationTools(Me) With {.FullyQualifySystemTypes = userSettings.FullyQualifySystemTypes, .CamelCaseFields = userSettings.CamelCaseFields} ItemCollection = loader.CreateEdmItemCollection(SourceCsdlPath, ReferenceCsdlPaths.ToArray()) ModelNamespace = loader.GetModelNamespace(SourceCsdlPath) Dim namespaceName As String = code.VsNamespaceSuggestion() UpdateObjectNamespaceMap(namespaceName) #> After the initialization, a mixture of text blocks and code blocks is used to generate the text for the output file. The foreach (For Each in Visual Basic) loops are used to write out the text that is based on the metadata information returned by the GetSourceSchemaTypes helper function. The GetSourceSchemaTypes helper function is defined in the <model name>.tt file and calls the GetItems method to get all the items of the specified type from this item collection. The following is the description of the code that is written out to the <model name>.cs or <model name>.vb file: EDM relationship metadata. Typed ObjectContext definition. The class definition includes: constructor overloads, ObjectSet properties, AddTo methods (if the UserSettings.CreateContextAddToMethods is set to true) and function import methods (if any are defined in the conceptual model). The following code from the <model name>.tt file writes out the typed ObjectContext class. If the container name is SchoolEntities, the following code is generated in the <model name>.cs or <model name>.vb file: Entity type classes. These classes derive from EntityObject and include attributes that define how entity types in the object layer are mapped to entity types in the conceptual model. The definition of entity classes includes factory methods and primitive, complex, and navigation properties. Complex type classes. These classes derive from ComplexObject and include attributes that define how complex types in the object layer are mapped to complex types in the conceptual model. Then, the helper functions are defined. In text templates, the helper functions are enclosed in class feature blocks. You denote class feature tags by using <#+ and #>. Customizing the Object-Layer Code If you want, you can modify the text blocks in your .tt file (the text block is outside of the <# and #> tags). To change the name of the typed object context, add the word (for example, My) before all occurrences of <#=code.Escape(container)#>. Then, if in the .edmx file the container's name is SchoolEntities, in the generated code the container's name will be MySchoolEntities. You can also customize the generated code by changing the values of the fields of the UserSettings type. For example, set FullyQualifySystemTypes to false if you do not want the generated code to have the fully qualified system types. For more information, see How to: Customize Object-Layer Code Generation (Entity Data Model Designer).
https://msdn.microsoft.com/en-us/library/ff477605(v=vs.100).aspx?cs-save-lang=1&cs-lang=vb
CC-MAIN-2015-40
refinedweb
682
50.43
You are right about the view handler. I forgot that JSF2 doesn't need afaces-config anymore. But I need it anyway for registering a phase listener. Anyway, if I remove the view handler from the faces-config, all I get from my webapp is a blank page and no errors. Do I have to define a view-handler if I use a faces-config file or does JSF just use the dafault view handler? -------- Original-Nachricht -------- > Datum: Wed, 07 Apr 2010 08:54:02 +0200 > Von: Werner Punz <werner.punz@gmail.com> > An: users@myfaces.apache.org > Betreff: Re: javascript error "jsf is not defined" > Am 07.04.10 08:14, schrieb Matthias Leis: > > Hi Jakob, > > > > I guess I use the built-in facelets. At least this is the code from > faces-config: > > <view-handler> > > com.sun.facelets.FaceletViewHandler > > </view-handler> > Wrong view handler... the jsf2 one is not under com.sun, but under > javax.faces.view.facelets and it is initialized automatically if you use > myfaces and the jsf2 facelets (no further configuration is needed) > Com sun is the old Facelet 1.x stuff and the new tags cannot work under > it due to the extensions in the jsf2 lifecycle and view handler api. > So it is either old facelets or the jsf2 one but not a mix of both, sort > of a hard break introduced by the namespace change from com.sun into > javax.facelets and due to the api changes, but better once a hard break > from old habits than having endless pain :-) > > Basically if you run in a pure jsf2 environment you can start to use > facelets without additional configuration on the faces-config side. > > Werner > -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter
http://mail-archives.apache.org/mod_mbox/myfaces-users/201004.mbox/%3C20100407115603.82650@gmx.net%3E
CC-MAIN-2018-51
refinedweb
293
75.2
Hello Community, I don't know if this some type of algorithm or just a method that I can use. Below is my code. import java.util.*; public class algorithmTest { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print( " Please input a String value: "); String inputString = scan.nextLine(); System.out.print( " Please input a int value 1-25: "); int inputInt = scan.nextInt(); char[] myChar; myChar = inputString.toCharArray(); char myCharJr = myChar[0]; int intCharValue = (int)myCharJr; if( intCharValue >= 65 || intCharValue <= 90) { int charNew = inputInt + intCharValue; System.out.println( " New char value: " + (char)charNew); } else if( intCharValue >= 97 || intCharValue <= 122) { int charNew = inputInt + intCharValue; System.out.println( " New char value: " + (char)charNew); } else { System.out.println( "You value is greater than or less than the paramater" ); } } } I'm doing an assignment and testing out a few things from this little test code. What I want to do is add the value of my char value and convert it into a integer. From converting it into a integer I want to shift the value depending on the users input i.e. an integer 1-26. Here is the problem I only want to display the alphabet A-Z and a-z. When I get to z or Z my program does what its supposed to do. Add the value. But I want it to start over i.e. User enters W..... user enters 6.... 6 is added to the ASCII value of 87((W) + 6). I want my ASCII value to start from A once it reaches to 90....and starts back to 65. Is there a way to do this. I hope this clarify my question.
http://www.javaprogrammingforums.com/whats-wrong-my-code/32700-i-need-help-developing-algorithm.html
CC-MAIN-2015-48
refinedweb
280
69.38
I am trying to create a sequence of length 6 which consists of numbers randomly picked from ranked groups. The first element of the sequence has to be drawn from the first group, and the last element has to be drawn from the last group. Let the new sequence be called "seq". Then, if a = [1,2,3] b = [9] c = [5,6] d = [11,12,4] seq[0] in a == 1 seq[-1] in d == 1 The intermediate elements have to come from lists a,b,c,d. But, if the second element is randomly drawn from 'a', then the third one, has to be drawn either from a later 'a' element, or from b/c/d. Similarly, if the third element is drawn from 'c', then the other ones have to come from later ranks like d.The groups are ranked this way. The number of groups given now, is arbitrary (maximum of 6 groups). The length for the sequence ( len(seq) == 6 ) is standard. One element from each group has to be in the final sequence. Repetition of elements is not allowed. All group elements are unique (and they are always numbers in the range of 1-12). you have four forced choices, then two free choices. set is a good help here. from random import choice a = [1,2,3] b = [9] c = [5,6] d = [11,12,4] l=a+b+c+d #ordered candidates def select(): e=set(l) for s in (a,b,c,d,e,e): # 4 forced choices and 2 frees. e.remove(choice(tuple(s))) # sets have no index. return [x for x in l if x not in e] 10 samples : >>> for _ in range(10) : print (select()) [1, 9, 5, 11, 12, 4] [1, 3, 9, 6, 11, 4] [1, 3, 9, 5, 6, 12] [1, 2, 9, 6, 11, 4] [1, 2, 9, 5, 6, 4] [2, 9, 5, 6, 11, 4] [1, 2, 9, 5, 11, 12] [1, 3, 9, 6, 11, 12] [3, 9, 6, 11, 12, 4] [1, 2, 9, 5, 12, 4] How about this: from random import choice, randint v = [[1, 2, 3], [9], [5, 6], [11, 12, 4]] def whatever(values, n=6): first = [choice(values[0])] last = [choice(values[-1])] seq = [] k = 0 while len(seq) < n -2: k = randint(k, len(values)-1) seq.append(choice(values[k])) return first + seq + last print whatever(v, 6) Try z=[a,b,c,d] Then for each element e in z, do seq.append(e[randint(0,Len(e))]), e.g. from random import randint a=[1,2,3] b=[4,5,6] z=[a,b] print(a[randint(0,len(a))]) f=[] for e in z: f.append(e[randint(0,len(e))]) print(f) Or you could use a for loop instead of a for each and use a manual counter so you could have seq[counter]=... This will not pick the groups randomly though.
http://m.dlxedu.com/m/askdetail/3/87f29a6cbac8f1a8e061249ea28a253c.html
CC-MAIN-2018-22
refinedweb
496
76.86
This action might not be possible to undo. Are you sure you want to continue? 02/04/2011 text original MANY TASKS Many activities at the same time As humans we can do probably 4 or 5 activities « How about computers? Early operating system . ± ± ± Once completed you do the next. 1st gen computers ² performed single tasks.DOS (disk OS). Windows 3.1.Round Robin Why wait for one application? ± ± Not very efficient« Important tasks will on hold 4 . early MAC version. BATCH processing Many Applications . After the first application has been executed the next application will be executed. One process at one time. And then the next. 5 . without the previous application your program will not run. So we create batch files Do you want spend time waiting for one task to be completed before your application runs? Remember.CONCURRENCY (OR MULTI-TASKING) From a command window you can run one Application at a time. . urgent tasks HIGH priority Timer expiration others have LOWER priority 7 . all activities are just set time Priorities introduced.CONCURRENCY (OR MULTI-TASKING) Operating System vendors introduced multi-tasking Let many applications run but in equal chunks of time ² Time Slices Not good. an application package will contain many associated executables An OS does not identify the various executables as belonging to one package So they run as different processes.PROCESSES Many times. 8 . ) Your main application is dependent on another process or application or task A layered architecture of application development Waiting for data or state or event You need Concurrent programming Flexibility to do things simultaneously No need to wait Processes create new process. Creating new process is heavy Need more resources ² memory How about a process that will not require new memory or resources allocated.PROCESSES (CONTD. Something that can run within the same process 9 Your Application is in waiting state«how long YOU ARE STUCK . . LET US CREATE THREADS ´ A thread is associated with an instance of a class Thread.asynchronous « Abstract thread management from rest of you application ² using extractor ´ Create instances of Thread « « Extend the thread class and override its run() method Implement a ¶Runnable· object 14 . Two basic strategies for concurrent application « To directly control thread creation and management ² Instantiate the thread when needed . println("Hello from a thread!"). } public void run(Strings arg[]) { } public static void main(String args[]) { // just started a thread (new Thread( new HelloRunnable() ) ). // We need to get a thread for the runnable created Thread THR1 = new Thread(HR1).start(). } } 15 .CREATING RUNNABLE OBJECTS public class HelloRunnable implements Runnable { @Override public void run() { System.out. // Create a Runnable instance HelloRunnable HR1 = new HelloRunnable(). HelloThread HT = new HelloThread().printStackTrace(). public void run() { System.out. HT.EXTENDING THE THREAD public class HelloThread extends Thread { static int j =0. try { HT.sleep(3999L). } public static void main(String args[]) { (new HelloThread() ). } } } Your Output: Hello from a thread #0! Hello from a thread #1! 16 .start().println("Hello from a thread #µ+j+++µ!"). } catch (InterruptedException e) { e.start(). thus.suspend is inherently deadlock-prone. Unlike other unchecked exceptions. The corruption can manifest itself at any time after the actual damage occurs. MIN_PRIORITY = 1 When threads operate on damaged objects. int nano ) Yield Suspend/resume IsAlive() Join() Because it is inherently unsafe). even hours or days in the future. or it may be pronounced.) If any of the objects previously protected by these Change priority of thread Java rangemonitors were in an inconsistent state. other threads may now view these objects in an inconsistent state. Check if thread is alive 17 . no thread can access this resource until the target thread is Willingly allow thread to give up processor resumed. If the target thread holds a lock on the monitor protecting a critical system resource when it is suspended. Get current thread reference ThreadDeath kills threads silently. Subclasses will override this method SUSPEND/RESUME are deprecated Your program specific code goes here Sleep in period of millis Thread. Sleep(long millis. arbitrary behavior can result. (The monitors are unlocked as the ThreadDeath exception propagates up Retrieve the name of Thread the stack. the user has no warning that his program may be corrupted. Such deadlocks typically manifest themselves as "frozen" processes. If the thread that would resume the target thread attempts to lock this monitor prior to calling Allow thread to pause and restart resume. deadlock results. This behavior may be subtle and difficult Read current priority to detect. Stopping a thread causes it to unlock all the monitors that it has locked. Such objects MAX_PRIORITY = 10 are said to be damaged. ´ We have to use try{«.}catch{«} blocks 18 . This Exception should be handled when the sleep method is used. // Create a Runnable instance HelloRunnable HR1 = new HelloRunnable().out. } catch(InterruptedException e) { System.SLEEPING THREADS public class HelloRunnable implements Runnable { @Override public void run() { System.start(). } } public void run(Strings arg[]) { } public static void main(String args[]) { // just started a thread (new Thread( new HelloRunnable() ) ).µ).sleep(1000L). try { Thread.out.println(´Terminated prematurely due to Exception. // We need to get a thread for the runnable created Thread THR1 = new Thread(HR1).println("Hello from a thread!"). } } 19 . isAlive()).println("Thread Three is alive: " + ob3. System.println(name + " exiting. Three: 2 public void run() { ob1.t.t. Three exiting.out.out. System. System. System."). Two: 4 } System. } } Thread One is alive: false Thread Two is alive: false Thread Three is alive: false Main thread exiting.out. One: 5 MyThread ob3 = new MyThread("Three"). i > 0.isAlive()).out. Thread. name).out. System.out.println("Thread Three is alive: " + ob3.isAlive()).out.join().println("Thread One is alive: " + ob1. MyThread ob2 = new MyThread("Two").out.t. t = new Thread(this.out.println(name + ": " + i).println("Thread Two is alive: " + ob2. } catch (InterruptedException e) { One exiting. i--) { ob3.join(). Three: 4 System.println("Thread Two is alive: " + ob2.").join().t. try { ob2.out. System. Two exiting.THREAD JOIN() Thread One is alive: true class MyThread implements Runnable { Thread Two is alive: true ´ public class MainClass { String name.out. Two: 3 System. One: 1 for (int i = 5. } } } catch (InterruptedException e) { Two: 5 System. Waiting for threads to finish.start().out.t. Three: 1 System. Two: 2 } Two: 1 } System.out.println("Main thread Interrupted"). // name of thread public static void main(String args[]) { Thread Three is alive: true MyThread ob1 = new MyThread("One").isAlive()).println("Waiting for threads to finish.println("Main thread exiting. Three: 3 } try { One: 2 System."). 3 One: t.isAlive()).println(name + " interrupted.sleep(1000).t.isAlive()).t.t.println("New thread: " + t). Thread t. 20 .println("Thread One is alive: " + ob1. Three: 5 MyThread(String threadname) { One: 4 name = threadname.t."). SYNCHRONIZATION ´ Many threads share a common object or data « « Usually many reads and few writes Lead to spurious situation ² One of the thread is updating and another is reading ´ Java way « « Give the thread an exclusive access to manipulate data .Semaphore Other threads wait Only one object will be able to lock at one time Every object has a monitor and a monitor lock ´ Monitor ² a Java built-in for synchronization « « ´ You need a Synchronization block 21 . SYNCHRONIZATION . displayState( "Producer writes " + buffer ). place thread in waiting state buffer = value. // tell waiting thread(s) to enter runnable state 23 . displayState( "Producer writes " + buffer ). if we are synchronizing in that objects. place thread in waiting state Synchronized(this) public synchronized void set( int value ) throws InteruptException { // place value into buffer // while there are no empty locations.SYNCHRONIZATION ´ format Synchronized Blocks or statements synchronized ( object ) { ´ Synchronized Methods synchronized <return type> SomeMethod(<arguments if any>) { // Method body } statements } // end synchronized statement Typically your object will be the this operator. notifyAll(). // tell waiting thread(s) to enter runnable state } } } // indicate producer cannot store another value // until consumer retrieves current buffer value occupied = true. // set new buffer value // indicate producer cannot store another value // until consumer retrieves current buffer value occupied = true. // set new buffer value { buffer = value. notifyAll(). public void set( int value ) throws InterruptException { // place value into buffer // while there are no empty locations. } catch (InterruptedException e) {} } drop.format("MESSAGE RECEIVED: %s%n". "Does eat oats". try { Thread.take(). public Producer(Drop drop) { this. Random random = new Random().nextInt(5000)). } public void run() { Random random = new Random(). try { Thread. public Consumer(Drop drop) { this. for (int i = 0.out.drop = drop.put("DONE").put(importantInfo[i]). } catch (InterruptedException e) {} } } } 24 . message = drop.INTER-THREAD COMMUNICATIONS public class Producer implements Runnable { private Drop drop. for (String message = drop. } } public class Consumer implements Runnable { private Drop drop. !message.length.drop = drop. "Little lambs eat ivy". message). i < importantInfo.equals("DONE").sleep(random. i++) \ { drop.nextInt(5000)). } public void run() { String importantInfo[] = { "Mares eat oats". "A kid will eat ivy too´ }.sleep(random.take() ) { System. //Notify consumer that status has changed. } catch (InterruptedException e) {} } //Toggle status. //Store message. } } 25 . } } public class ProducerConsumerExample { public static void main(String[] args) { Drop drop = new Drop(). while (empty) { try { wait(). //Notify producer that status has changed. } catch (InterruptedException e) {} } //Toggle status. empty = true. empty = false. while (!empty) { try { wait(). (new Thread(new Consumer(drop))).message = message.INTER-THREAD COMMUNICATIONS (CONTD) public class Drop { //Message sent from producer to consumer. //True if consumer should wait for producer to send message. false //if producer should wait for consumer to retrieve message.start().start(). return message. this. public synchronized String take() { //Wait until message is available. private boolean empty = true. (new Thread(new Producer(drop))). } public synchronized void put(String message) { //Wait until message has been retrieved. private String message. notifyAll(). notifyAll().. while simultaneously thread2 cannot proceed because it is waiting (either directly or indirectly) for thread1 to proceed. ´ The two threads are waiting for each other. ´ 26 . DEAD LOCK 27 . DEAD LOCK 28 . DEAD LOCK 29 . DEAD LOCK 30 . DEAD LOCK 31 . ´ 32 . ´ Best known way of resolving the deadlock is resource ordering or restructuring the programming logic.DEADLOCK ± HOW TO RESOLVE? There is no best solution. and thread states ² new.runnable and thread extends. a third kind extractors Threads can wait while the remaining program can continue to execute Threads can wait for another thread to complete using the ¶join· method Use of synchronization for blocks of code or a method to allow us to manipulate data and preventing blocking. terminated Creating Threads . We can perform inter-thread communication using a shared code and synchronization Deadlocks can still occur when two threads are waiting for an object to be released by the other thread ( could be directly or indirectly) ´ ´ 33 . timed wait. runnable.C0NCLUSION ´ ´ ´ ´ ´ ´ ´ ´ Multitasking and Processes Thread allow parallelization in our programming activity and logics. blocked. Thread do not require new memory and hence termed Lightweight Lifecycle of a Thread. wait. Q&A THANK YOU 34 . This action might not be possible to undo. Are you sure you want to continue?
https://www.scribd.com/doc/48172642/Threads-and-Java
CC-MAIN-2015-48
refinedweb
1,815
52.97
hi ... recently i have created a small plugin for intellij that supports another project of mine. the interesting thing is, that this plugin delivers its own jaxen, xpath, jdom classes and works without problems. recently i played around with the excellent jira-plugin and discovered problems when both plugins are installed at the same time. the jira plugin bundles its own xml-libs (again jaxen, xpath, ...). my assumption is that somehow the classloaders (if there are distinct classloaders for each plugin) get confused because of the different versions of the same class. actually it are the same classes (same version) but at another position. does anyone of you have noticed something similar??? what would be the right solution for this problem??? is there the possibility to provide central libraries as xpath or jaxen only once for the plugins (beside from copying them by hand into the intellij/lib directory)? thanks in advance cK hi ... Yes, the plugins are sharing one classloader :( Christian Köstlin wrote: Sven Krause wrote: oops??? is this a bug or a feature??? do some strategies exist to bundle important libraries as individual plugins for use for all other plugins (i guess the newest version of the libs should almost ever be ok (if the plugins that use a particular lib are still under development/improvement))??? thanks in advance cK Christian Köstlin wrote: Its the way as its implemented. It has the advantage that you can extend already existing plugins. The could be a way: Your required libraries become an own plugin. So the user can deselect it, if its conflict with other plugins. If all plugins follows this strategie the user can build its own configuration. All this works of course onle, if no concurrent libs are required from multiple plugins. Sven On 2004/02/05 08:46, Sven Krause wrote: That could be a bug. In Eugene Zhuravlev says: "Each IDEA plugin is loaded in a separate classloader (so called "plugin-loader") to prevent library conflicts. " Bas Bas Leijdekkers wrote: >> Yes, the plugins are sharing one classloader :( mhhh ... i searched a little more and made the following experiment: i used a small util-class for stringmanipulation that was delivered with one plugin without problems from within another plugin -> the classloader do get mixed up. im not sure how to resolve the problem .. in the tracker one solution is to remove "double" libraries, which is not possible if i do not want to change plugins from other people :)) as described before in this thread one solution would be to bundle all relevant libraries that could be used in some plugins into separate plugins ... but then it should be made for sure what classes are accessible from what plugin ... perhaps dependencies would be a solution (ala osgis import or eclipses requires statements) .. additional the pluginmanager would have to resolve dependencies ... everything is alot of work ... mhhh .. what would you sugest??? regards christian koestlin On 2004/02/06 00:11, Christian Köstlin wrote::-) Regards, Bas Bas Leijdekkers wrote: >> mhhh .. what would you sugest??? should the issue contain a small example "test" for the desired behavior??? cK On 2004/02/06 11:42, Christian Köstlin wrote: >> On 2004/02/06 00:11, Christian Köstlin wrote: >> >>> mhhh .. what would you sugest??? >> >> >>:-) I'm sure they would appreciate that, but it is not required.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206135369-xml-library-classloader-clashes?page=1
CC-MAIN-2020-24
refinedweb
552
64.91
Your math is way off here. There is also yet another I2C level optimization possible for string output. Currently the Cosa LCD driver implements only IOStream::putchar() and handles puts() and write() as a sequence of putchar(). The function writes the character to the LCD but also handles form-feed, carriage-return-line-feed and a few other control characters (something that LiquidCrystal does not). It is possible to write numbers directly as the string will not contain any control characters. The only issue is text clipping or wrapping. This implies that the whole string could be translated to a single larger I2C block and written as one transaction. This removes the I2C addressing per digit character. This is the same as the nibble optimization only on the next transaction level. QuoteYour math is way off here. Thanks for the correction, I updated my post and striked through the faulty math.Still I like to think of it in time/char as a frame/time is dependant on the size of the frame where time/char is not. #include "Cosa/TWI.hh"#include "Cosa/Watchdog.hh"#include "Cosa/LCD/Driver/HD44780.hh"HD44780::Port port;HD44780 lcd(&port);class LCDslave : public TWI::Slave {private: static const uint8_t BUF_MAX = 64; uint8_t m_buf[BUF_MAX];public: LCDslave() : TWI::Slave(0x5A) { set_write_buf(m_buf, sizeof(m_buf)); set_read_buf(m_buf, sizeof(m_buf)); } virtual void on_request(void* buf, size_t size);};voidLCDslave::on_request(void* buf, size_t size){ char c = (char) m_buf[0]; if (c != 0) { lcd.putchar(c); for (size_t i = 1; i < size; i++) lcd.putchar(m_buf[i]); return; } if (size == 2) { uint8_t cmd = m_buf[1]; switch (cmd) { case 0: lcd.backlight_off(); return; case 1: lcd.backlight_on(); return; case 2: lcd.display_off(); return; case 3: lcd.display_on(); return; } } else if (size == 3) { uint8_t x = m_buf[1]; uint8_t y = m_buf[2]; lcd.set_cursor(x, y); }}LCDslave slave;void setup(){ Watchdog::begin(); lcd.begin(); lcd.puts_P(PSTR("CosaLCDslave")); slave.begin();}void loop(){ Event event; Event::queue.await(&event); event.dispatch();} If you looking for a fast low pin count interface to an LCD (can't be lower than a single pin), you might be interested in this recent activity: the interface uses a single pin, it can transfer bytes in 92us for a frame rate close to 320 FPS,which is about 3.6 times faster than the standard LiquidCrystal library using 6 pins!This is a great example of how inefficient the Arduino core routines like digitalWrite() are.It is about 6 times faster than the optimized i2c i/o expander interface. The only benefit to I2C I can think of right now is that it is probably less susceptible to interference and long wires than the SPI. #include "Cosa/Watchdog.hh"#include "Cosa/LCD/Driver/HD44780.hh"#include "Cosa/VLCD.hh"// Use a 4-bit parallel port for the HD44780 LCD (16X2 default)HD44780::Port port;HD44780 lcd(&port);// And use the LCD for the implementation of the Virtual LCD slaveVLCD::Slave vlcd(&lcd);void setup(){ Watchdog::begin(); lcd.begin(); vlcd.begin();}void loop(){ Event event; Event::queue.await(&event); event.dispatch();} Cool stuff.I'm curious what core and i2c library you are using for the attiny. void HD44780::SR3W::write4b(uint8_t data){ m_port.data = data; m_sda.write(m_port.as_uint8, m_scl); m_en.toggle(); m_en.toggle();} // Select the LCD device for the benchmark#include "Cosa/LCD/Driver/HD44780.hh"// HD44780::Port port;HD44780::SR3W port;// HD44780::MJKDZ port;// HD44780::DFRobot port;HD44780 lcd(&port); // #include "Cosa/LCD/Driver/PCD8544.hh"// PCD8544 lcd;// #include "Cosa/LCD/Driver/ST7565.hh"// ST7565 lcd;// #include "Cosa/VLCD.hh"// VLCD lcd; Please enter a valid email to subscribe We need to confirm your email address. To complete the subscription, please click the link in the Thank you for subscribing! Arduino via Egeo 16 Torino, 10131 Italy
http://forum.arduino.cc/index.php?topic=175702.msg1318310
CC-MAIN-2015-48
refinedweb
633
58.69
urlspliter 0.1.0 A library for Dart developers. Created from templates made available by Stagehand under a BSD-style license. Usage # A simple usage example: import 'package:urlspliter/urlspliter.dart'; main() { var spliter = new UrlSpliter(); var seqs = sliter.process(); } Features and bugs # Please file feature requests and bugs at the issue tracker. Changelog # 0.1.0 # - Initial version, created by Stagehand example/urlspliter_example.dart import 'package:urlspliter/urlspliter.dart'; main() { var awesome = Awesome(); print('awesome: ${awesome.isAwesome}'); } Use this package as a library 1. Depend on it Add this to your package's pubspec.yaml file: dependencies: urlspliter: :urlspliter/urlspliter.dart'; We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using: - Dart: 2.7.0 - pana: 0.13.4 Health suggestions Fix lib/src/urlspliter_base.dart. (-2.96 points) Analysis of lib/src/urlspliter_base.dart reported 6 hints, including: line 19 col 29: Unnecessary new keyword. line 20 col 32: Unnecessary new keyword. line 21 col 28: Unnecessary new keyword. line 22 col 32: Unnecessary new keyword. line 26 col 35: Use isEmpty instead of length Maintenance suggestions The package description is too short. (-8 points) Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
https://pub.dev/packages/urlspliter
CC-MAIN-2020-05
refinedweb
227
54.39
Base class to transform boxes in an existing layout. More... #include <BoxLayout.H> Base class to transform boxes in an existing layout. If you want to do something esoteric to each box in a layout and preserve its ordering and proc assignment, here is what you do. Define your own transformation that inherits from this and here is what the code will look like. class MyTransform: public BaseTransform { virtual Box operator()(const Box& a_inputBox) { /do what you need to output the box you want given the input } }; BoxLayout bl1; //fill this one with starting layout BoxLayout bl2 = bl1; MyTransform mytrans; bl2.transform(mytrans); apparently I have to declare this to make some compilers happy. Implemented in GrowInBlock, BoxCollapser, and BoxFixedOff.
http://davis.lbl.gov/Manuals/CHOMBO-SVN/classBaseTransform.html
CC-MAIN-2019-22
refinedweb
120
54.63
(For more resources on Groovy, see here.) Template Method Pattern Overview The template method pattern often applies during the thought “Well I have a piece of code that I want to use again, but I can’t use it 100%. I want to change a few lines to make it useful.” In general, using this pattern involves creating an abstract class and varying its implementation through abstract hook methods. Subclasses implement these abstract hook methods to solve their specific problem. This approach is very effective and is used extensively in frameworks. However, closures provide an elegant solution. Sample HttpBuilder Request It is best to illustrate the closure approach with an example. Recently I was developing a consumer of REST webservices with HttpBuilder. With HttpBuilder, the client simply creates the class and issues an HTTP call. The framework waits for a response and provides hooks for processing. Many of the requests being made were very similar to one another, only the URI was different. In addition, each request needed to process the returned XML differently, as the XML received would vary. I wanted to use the same request code, but vary the XML processing. To summarize the problem: - HttpBuilder code should be reused - Different URIs should be sent out with the same HttpBuilder code - Different XML should be processed with the same HttpBuilder code Here is my first draft of HttpBuilder code. Note the call to convertXmlToCompanyDomainObject(xml). static String URI_PREFIX = '/someApp/restApi/' private List issueHttpBuilderRequest(RequestObject requestObj, String uriPath) { def http = new HTTPBuilder("") def parsedObjectsFromXml = [] http.request(Method.POST, ContentType.XML) { req -> // set uri path on the delegate uri.path = URI_PREFIX + uriPath uri.query = [ company: requestObj.company, date: requestObj.date type: requestObj.type ] headers.'User-Agent' = 'Mozilla/5.0' // when response is a success, parse the gpath xml response.success = { resp, xml -> assert resp.statusLine.statusCode == 200 // store the list parsedObjectsFromXml = convertXmlToCompanyDomainObject(xml) } // called only for a 404 (not found) status code: response.'404' = { resp -> log.info 'HTTP status code: 404 Not found' } } parsedObjectsFromXml } private List convertXmlToCompanyDomainObject(GPathResult xml) { def list = [] // .. implementation to parse the xml and turn into objects } As you can see, URI is passed as a parameter to issueHttpBuilderRequest. This solves the problem of sending different URIs, but what about parsing the different XML formats that are returned? Using Template Method Pattern The following diagram illustrates applying the template method pattern to this problem. In summary, we need to move the issueHttpBuilderRequest code to an abstract class, and provide an abstract method convertXmlToDomainObjects(). Subclasses would provide the appropriate XML conversion implementation.
https://hub.packtpub.com/using-groovy-closures-instead-template-method/
CC-MAIN-2018-17
refinedweb
424
50.33
One of the main tools that I've found useful in pen. testing is the Dradis Framework, it's a good way of keeping track of findings and notes during a test and I've also found it's template feature is good for keeping a list of things to remember during a test. One of the features available in Dradis is import plugins. This lets you create a link to an external information source, such as a OSVDB or a database of vulnerabilities. Having a database of vulnerabilities or findings can be pretty useful in cutting down the time required for reporting on a test as you can keep standard wordings in place (who really wants to write the same section about preventing XSS more than once!). So recently I knocked up a simple vulnerability database to link in to Dradis and I thought it might be of use, so here's the process. Creating the App We're going to use Ruby on Rails for this as it's nice and easy to develop for (as you'll see) and also that's what Dradis is based on, so makes sense to keep all the coding in the same underlying language. Also rails apps are very portable, they're basically contained within a single directory structure, so it's relatively easy to move them from place to place. Before starting the application, there's the usual pre-req's. I'm using Ruby 1.9.2 and Rails 3 so having those installed is a good thing. If you're using Linux then it's helpful to have RVM working as some distros don't have ruby 1.9.2 packaged up as yet. once you've got the pre-req's working, we can start by creating a rails app rails new vulnlist This creates a new application called vulnlist and adds all the standard rails files in. Creating the Scaffold Once we've got the app created, we can use rails scaffolding to quickly create the basic structure for our app. The web pages that scaffolding creates aren't the most pretty, but they'll do for now. With the scaffold we can specify what fields we want to create in the database and also what data types those fields are. rails generate scaffold Vulnerability title:string test_type:string description:text remediation:text technical_notes:text severity:string owasp_reference:string Once we've completed this we can look at the basic app by setting up the database with rake db:migrate Ensuring that all our gems are installed ok with bundle install and launching the app rails server At this point browsing to should show a blank page with our fields in it. From this page we can create new vulnerabilities and edit or delete existing ones. Now that we've got this basic structure setup it's worth using git to keep a handle on the source code. On Linux the procedure for this is pretty easy If you've not already got it installed sudo apt-get install git-core then in the root of the application git init git add . git commit -m "Initial Commit with Scaffold" Having git running on the app will make it pretty easy to revert any mistakes made along the way, as long as we've done regular commits. Setting up the Searches So far we've got a basic structure in place and can do the basic Create, Read, Update, Delete cycle on our data. However for the dradis integration, what'd be useful is if we could search for vulnerabilities using various criteria and have the results returned to Dradis. This turns out to be relatively straightforward. First what we need is a new action in our controller. Opening vulnlist/app/controllers/vulnerabilities_controller.rb we can see the existing actions that we've got for the application. What we need to do now is add a new action to allow for vulnerability searches. def vuln_search case params[:search_type] when "description" @vulnerabilities = Vulnerability.where("description like ?", "%"+params[:query]+"%") when "owasp" @vulnerabilities = Vulnerability.where("owasp_reference like ?",params[:query]+"%") when "severity" @vulnerabilities = Vulnerability.find_all_by_severity(params[:query]) when "test_type" @vulnerabilities = Vulnerability.find_all_by_test_type(params[:query]) end respond_to do |format| format.xml {render :xml => @vulnerabilities} format.json {render :json => @vulnerabilities} end end This defines a new method called "vuln_search" which takes two parameters, search_type and query. The search type parameter lets us pick from different finders. Rails provides access into the application database via ActiveRecord and this just uses a couple of the finder types for different parameters. Where the query is going to be one of a number of fixed values like "severity" which will be something like high, medium or low, we can just use a standard find_all_by_ approach, but where it's a more free text style search, we use Vulnerability.where and pass in the query parameter that way. The respond_to block is a really nice feature of rails. By adding in the two lines for :xml and :json rails wires up responses so that we can get the data out in those format, no additional code required. Now that we've got the basic code in place, we just need to modify the rails routes so that the application knows how to access our new method. This is done by modifying the vulnlist/config/routes.rb file, and adding the following code controller :vulnerabilities do get 'vuln_search' => :vuln_search end At this point, we've got the application basically working. If you put in a couple of test findings, then you should be able to go to for example and get some XML data back. Tidying up Now that we've got the basics working, there's a couple of additional steps that it's worth looking at to tidy some things up. Selectors First off, we'd like some of our fields (OWASP Reference, Severity and test type) to be one of a number of defined values. The "proper" way to do this would be to create additional models for these and link them in to the main vulnerabilities controller, but there's a quicker way which is probably going to work well enough for our purposes. Opening up vulnlist/app/models/vulnerability.rb we can specify some Constant values for these settings TEST_TYPES = ["Web Application","Windows Server","Unix Server","Wireless","Web Server","Oracle","MS SQL","MySQL","DB2"] SEVERITY_LEVELS = ["Critical","High","Medium","Low","No Impact"] OWASP_TOP_10 = ["A1 - Injection",s and Forwards"] Then we can modify the form that the scaffolding process created to use these arrays as a select list. The form is found in vulnlist/app/views/vulnerabilities/_form.html.erb. In that file we just need to replace the "text_field" lines for those three fields with the following select lines "Select the test type" %> "Select the severity level" %> "Select the appropriate OWASP top 10 reference" %> This picks up the Constants from our model and helps keep the data consistent. Localhost Only As you'll have noticed with this application, there's pretty much no security whatsoever. At the moment it's setup as a personal database only and isn't suitable to be on any kind of network. Adding that security isn't too difficult with rails, however it's not really a problem for the basic use case that we have here. Both the vulnerability list and the dradis installation only need to listen on the localhost. Configuring rails to only listen on the localhost (as opposed to specifying it on the command line) is a bit hacky, but here's a way to do it based on this post and this dradis change . We need to modify the vulnlist/script/rails file and add the following lines require 'rubygems' require 'rails/commands/server' require 'rack' require 'webrick' module Rails class Server 3003, :Host => "127.0.0.1", :environment => (ENV['RAILS_ENV'] || "development").dup, :daemonize => false, :debugger => false, :pid => File.expand_path("tmp/pids/server.pid"), :config => File.expand_path("config.ru") }) end end end This also moves the application off the default port of 3000, to a new one of 3003 which hopefully shouldn't clash with other services. Default Routes At the moment if we visit the root page of our application, now at we get the default rails welcome page. What'd be nicer is if we were re-directed to the vulnerability listing automatically. That's easily done with two steps. First edit the vulnlist/config/routes.rb file and add the line root :to => "vulnerabilities#index" then delete the file vulnlist/public/index.html file. Summary So at the end of this first part we've created a basic vulnerability database which we can search easily on a number of parameters. The next step is to create the dradis plugin to hook the two together, which as I'll cover next time is a reasonably easy thing to do.
https://raesene.github.io/blog/2010/10/20/creating_a_simp/
CC-MAIN-2021-25
refinedweb
1,486
51.58
I am new to programming in C++ and I am trying to convert an Integer to a string. would the function c_str work? Printable View I am new to programming in C++ and I am trying to convert an Integer to a string. would the function c_str work? No. Click Here There should be a couple links that will answer your question. but .c_str() is a string fxn that converts a std::string to a c string. Code: #pragma hdrstop #include <condefs.h> #include <stdlib.h> #include <stdio.h> int main(void) { int number = 12345; char string[25]; itoa(number, string, 10); printf("integer = %d string = %s\n", number, string); getchar(); return 0; } Hi I'm using CBuilder4 and found this code in the help! Hope it helps, Colin >>I'm using CBuilder4 and found this code in the help! That's all C code, and non-standard at that. Like alpha said, the answer is in the FAQ. He's New, I'm New..... I've asked for and received great help in the past. I read this site everyday and if there is something I can do to help someone I will. I am now getting a bit sick of the replys I get for the Super Dooper Moderators after I offer a suggestion. As I said I'm New to this and I'm only trying to help where I can. Thanks for the boost of confidence Hammer. Colin. Colin: Calm down! What Hammer said is correct. The questioner is asking for C++ help, giving him printf() is likely to confuse, as he may not have covered legacy code, as you yourself have pointed out, he is new. You did, also, give a compiler specific solution, which again might confuse and discourage a newcomer. >>> getting a bit sick of the replys I get I don't know which other threads you are referring too, but Hammers reply to this question is entirely correct, the answer is explained in the FAQ, and the code sample you have provided is not a general solution. In which case I guess typing this was a waste of time... Colin you are not new to this. You have been trying to program for 4 years now. Come on. Stop complaining. Thank you for the valuable information. I was trying to figure it out and I did not know about the FAQ section. Thanks for reminding me.:)
http://cboard.cprogramming.com/cplusplus-programming/37143-converting-interger-string-printable-thread.html
CC-MAIN-2016-18
refinedweb
404
83.86
Transparent window Hello guys is there a way to make a main Rectangle transparent I mean I want to see stuff behind the main window thank you Hi, Yes. Change opacity of the Rectangle and "setColor": of QQuickView to transparent. does it depend on version? I mean I have Qt 2.4 max and can't see anything like that or do I need to import something? I mean could you give me a code for a main Rectangle that will be transparent I mean I'll be able to see through it Sure, here you go: main.cpp @ QQuickView view; view.setColor(Qt::transparent); view.setSource(QUrl(QStringLiteral("qrc:///main.qml"))); view.show(); @ main.qml @ import QtQuick 2.4 Rectangle { width: 300 height: 300 color: "red" opacity: 0.1 } @ Hope this is what you meant.. no it didn't help I just want to see whatever is behind it for e.g. this site or my desktop... It seems you are using qmlscene to load the QML file, then you need to pass "--transparent" argument to it. am sorry but could you write me a code once more? with that last suggestion? Are you using QtCreator to execute that file ? yes I'm using QtCreator Then Keeping your current project selected, go to QtCreator > Projects (On Left side pane) > Build & Run > Run > Run > Arguments and add "--transparent" as argument there for qmlscene. Note: There are two hypens for transparent, it appears to be combined after posting. What should I write in executable? Which "executable" ? Here's a screenshot: !! Check the highlighted part. you mean this projects right? then build & run > run>run Yes exactly. Just remove the double quotes. oh no I meant to say that I want to see through it but like see that too for example I want to see that desktop but also I want to see whatever is written in this window So what doesn't work for you ? If you have a Text element in this QML it will displayed as it is. It wont be affected by transparency. this is what I see :S It seems the Window itself has completely disappeared. Since I can't see it running in the task bar. Here is what it looks like on my machine: !! Kept the default Project template like yours and just added color and opacity for rectangle. In my case it is seen running in taskbar. I am more confused then everything else on this planet, and even more embaressed Quite strange. It is running but it is not shown in the taskbar. And if you remove the "--transparent" argument it shows as expected ? It could be bug. It seems you are running it on Windows XP. It tried it on Linux, Ubuntu flavor. Try creating it the other way. Create a new project as, File > New File Or Project > Application > Qt Quick Application and then in main.qml, you will find Window as root element. Try setting opacity to it. @ import QtQuick 2.4 import QtQuick.Window 2.2 Window { visible: true opacity: 0.4 MainForm { anchors.fill: parent mouseArea.onClicked: { Qt.quit(); } } } @ strange but same stuff :S It seems to b a bug then since it works on Linux. You can report it on "Qt bugs tracker":. Mention the scenario, OS, Qt Version and possibly a small reproducible example.
https://forum.qt.io/topic/50463/transparent-window
CC-MAIN-2018-30
refinedweb
559
77.74
Content from this entry was originally created in this entry from blog A .Net Architecture, Development and Design Journal. You're not imagining things, System.Web.Mail does not support related attachments, so stop beating your head against a wall trying to "figure it out." But I do have a solution, and if System.Web.Mail works on the target system, this will too without any additional software! A little background first; System.Web.Mail uses CDOSYS.DLL found in %SYSTEM32%. This means that we can interact with CDOSYS.DLL directly to achieve our goals of sending and receiving multi-part attachments. The first step is to create COM Interop assemblies for CDOSYS.DLL. Assemblies? Yes, assemblies. CDOSYS.DLL is dependent upon ADO and uses it heavily in its public API. Let's start with creating the interop. From a machine with the .Net Framework SDK installed, open a command prompt and navigate to your project directory. If you have not already done so, add a sub-folder called "lib". This is where we'll keep our new interop assemblies for referencing. C:\{path to project}\lib>tlbimp %systemroot%\system32\cdosys.dll /namespace:CDO This will create two assemblies, CDO.dll and ADODB.dll. If you need to sign these assemblies you would add the /keyfile:{keyfilename} switch to the above command. Now, from your project, add a reference to both CDO.dll and ADODB.dll. It's important that you use this new version of ADODB.dll as it's not the same as the one Microsoft ships with the .Net framework. If you already have a reference to ADODB in your project then you might have some rework ahead of you to utilize the new interop assembly. Now, we've added CDO to our project, it's time to use it. One thing about ADO and CDO is that both of them heavily utilize optional parameters. You would be wise to consider using VB.Net in lieu of C# or J# to interact with CDO. If your project is written in C#, I recommend creating a new VB.Net Library projct in your solution and referencing it from your C# project. You'll also have to add references to CDO and ADO from the interop assemblies in your VB.Net project. In your VB.Net project, create a new Module file called CDOHelper. Public Module CDOHelper ' Field to set with the SMTP server Public Const SERVER_FIELD As String = _ "" ' Field to set with that tells CDO how to deliver the message Public Const SEND_USING_FIELD As String = _ "" ' The field name for the content-type of the HTML Body. Public Const CONTENT_TYPE As String = _ "urn:schemas:mailheader:content-type" Public Sub SetField( _ ByVal config As CDO.Configuration, _ ByVal name As String, _ ByVal value As String) If config.Fields(name) Is Nothing Then ' Create the field ' Optional parameters make ' VB.Net Useful here. config.Fields.Append( _ name, _ ADODB.DataTypeEnum.adVarWChar, _ , , _ value) Else ' Change the field config.Fields(name).Value = value End If End Sub Public Sub AddRelatedPart( _ ByVal message As CDO.Message, _ ByVal filename As String) ' This has several optional parmeters ' This is why VB.Net helps Dim part As CDO.IBodyPart = _ message.AddRelatedBodyPart( _ filename, _ System.IO.Path.GetFileName(filename), _ CDO.CdoReferenceType.cdoRefTypeLocation) Public Function CreateMessage( _ ByVal server As String) As CDO.Message ' Create the objects Dim objMessage As CDO.Message = _ New CDO.MessageClass Dim objConfig As CDO.Configuration = _ New CDO.Configuration ' Set the configuration objMessage.Configuration = objConfig ' Set the default fields objConfig.Fields(SERVER_FIELD).Value = server ' 1 = Use SMTP ' 2 = Use Folders objConfig.Fields(SEND_USING_FIELD).Value = 1 ' This is ADO, don't forget ' to update the recordset! objConfig.Fields.Update() ' Return the new message Return objMessage End Function Public Sub SetHtmlBody( _ ByVal message As CDO.Message, _ ByVal html As String) ' Set the HTMLBody message.HTMLBody = html ' Above created the HTMLBodyPart ' Now we need to ensure correct ' settings for ContentTransferEncoding ' and Content-Type message.HTMLBodyPart.ContentTransferEncoding = _ "quoted-printable" message.HTMLBodyPart.Fields( _ CONTENT_TYPE).Value = "text/html" End Module Above is a valid technique that will get you where you want to go on Microsoft Windows systems. This will fail gloriously on Mono, however. But if you're using Mono you probably have more flexibility to be using System.Net.Mail.
http://it.toolbox.com/wiki/index.php/Create_HTML_Multipart_-_Related_Email_in_.Net_Framework_1.0_or_1.1
crawl-002
refinedweb
730
53.17
While getting data from one of web service quote(") is coming as (?) when i use Rest Template. I tested the web service in the postman on chrome and it giving correct characters. I tried encoding UTF-8, but no success. I checked following are encodin I want to write something to the end of the file every time the file is modified and I'm using this code : public class Main { public static final String DIRECTORY_TO_WATCH = "D:\\test"; public static void main(String[] args) { Path toWatch = Pa As per the Java ternary operator expression ? statement1 : statement2, if expression is true then statement1 will be executed, if expression is false then statement2 will be executed. But when I run: // some unnecessary codes not displaying char y = Here is an use case of general java multithreading implementation: I have one cpu with four virtual cores. I have four cpus with four physical cores. Which hardware should I choose to efficiently implement a multithreaded application. As far as I kno I'm trying to use annotations with a custom message in spring/hibernate validation. What I want to do is support internationalization while being able to pass in a parameter. For instance, here is the field in the java class: @NotEmpty (message = "{e My goal is add data to listView, after push on notification shows dialog, if user press Yes, app will show activity with fragment, and again will display new dialog to add new item. But if I press add, I get: java.lang.NullPointerException: Attempt t I'm trying to call my paintComponent method by using repaint but it is never being called. This is my first class: public class start { public static void main(String[] args){ Frame f = new Frame(); f.createFrame(); } } And this is the class that I w I am getting an error and I can only assume there is something wrong with my query. I am trying to initialize a class with the "new" key word in JPQL like so: @Query("SELECT NEW com.htd.domain.ShopOrder(po.id, po.po_number, " + "p I have problem with can't set text in UITextView .see below code , TwxtView value not change after setText() . when i press Button "hello word" not change. i want to change "hello world" to "How are you" when i press Button. Let's say I have a class (the equal method also exists): public class SomeClassA { private int a; private int b; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + a; result = prime * result + b; return I have this code: button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.add(label, BorderLayout.LINE_START); panel.add(label2, BorderLayout.LINE_START); panel.add(textfield, BorderLayout.LINE_EN I used Java for building Image upload tag: Map options = ObjectUtils.asMap("resource_type", "auto"); options.put("callback", ""); Map htmlOptions = null; String html = cloud My application flow is as follow. JAVA APP ----> MS SQL (Tables)---> MS SQL (Stored procedure) ---> Another DB Here from Java application i am pushing certain Sensitive information that i even want to hide from DBA. So i want to encrypt those col public class TestException extends except2 { public static void main(String[] args)throws Exception { try { try { throw new TestException(); } catch (final TestException e){ } throw new except2(); } catch (TestException a){ } catch (Exception e){ thr I am trying the coding bat problem repeatFront: Given a string and an int n, return a string made of the first n characters of the string, followed by the first n-1 characters of the string, and so on. You may assume that n is between 0 and the lengt I need to extend an existing Liferay webservice (created with Service Builder) to handle an additional optional parameter. With Service Builder, you have to specify every parameters inside the method signature: public String getList(String param1){ . I make a procedure that get a nvarchar and it return a table by using like and it works well. but when I want to use this procedure in java it doesn't work. here is the java code. String query = "exec Predict ?"; pst = conn.prepareStatement(quer I have one Activity and six different Fragments attached to it. Each fragment has OnFragmentInteractionListener interface and activity implements all these listeners in order to receive callbacks. It looks a little messy, so I'm interested are there I am developping an application for my android phone, and I am trying to enable the Wifi hotspot. I am using Qt 5.4.1 so I developp in C++. As there is not any function to do this in the NDK, I am using JNI to call Java Methods. My java code is (than Usually I'd love all my POJOs to be immutable (well, to contain only final fields as Java understands immutability). But with my current project, a constant pattern is that I need to change a single field from a POJO. Working with immutable POJO's in
http://www.dskims.com/category/java/6/
CC-MAIN-2019-13
refinedweb
826
53.1
- Author: - eternicode - Posted: - August 31, 2010 - Language: - Python - Version: - 1.1 - Score: - 2 (after 2 ratings) A quick-and-dirty, and extremely simple, decorator to turn a simple function into a management command. This still requires you to have the management directory structure, but allows you to name your primary method whatever you want, and encapsulates the basic functionality of an argument-accepting management commmand. The function's docstring will be used for the command's help text if the help arg is not passed to the decorator. Simple usage: from myapp.utils import command @command() def my_command(): print "Hello, world" I'm not too familiar with the intricacies of decorators and management commands, so this could probably (most likely) be improved upon, but it's a start. Update: I've taken this a bit farther and put my work up on bitbuck, some how (and I think it can be done) the decorator can introspect the function's positional arguments and keyword arguments, and then use those for the command's arguments and options, respectively. Then the only parameter needed for the decorator usage would be the help text. # gmandx, interesting idea. I've done some light reading around, and it looks like the functools module has some stuff that could do this. # Please login first before commenting.
https://www.djangosnippets.org/snippets/2181/
CC-MAIN-2022-33
refinedweb
219
52.49
There is no need for developers to walking the same path, performing the same tasks at the beginning of any project, over and over again. That is what this series of articles has been about, streamlining our workflow. I have writing about create templates for Rails before, but quite frankly, I have learned so much about Rails over the last six months, as I sharpen my skills while searching for a position, it bears touching this topic again. This is a default/basic template: - RSpec - Code Quality with Rubocop - Code Coverage - Configure Rails generators - Static routes - No styling (this varies per project) - No user accounts TLTR: The Rails template is hosted in this Repository The template design uses a modular design, so it is easy to maintain and turn off features if I desire. I am going to step through a few of the methods to explain my set up: Setup Additional Gems The first method adds new gem requirements to the 'Gemfile'. This does not install them, it only prepares for the installation. Most of these gems are to set up my testing, code quality, and code coverage norms I prefer. def add_gems # Rexml is required for Ruby 3 gem "rexml" gem_group :development, :test do gem "capybara", ">= 2.15" gem "database_cleaner" gem "factory_bot_rails", git: "" gem "rspec-rails" end gem_group :development do gem "fuubar" gem "guard" gem "guard-rspec" gem "rubocop" gem "rubocop-rails", require: false gem "rubocop-rspec" end gem_group :test do gem "simplecov", require: false end end I have written on this topic before, and you can read more in my previous article: Rails testing Setup Static Routes This method sets up a static route controller with a view for a home route. This is a mounting point for any static routes the project may have: def add_static generate "controller static home" route "root to: 'static#home'" end Copy Additional Files We can stop here with one configuration file. However, we can also setup some files to copy for a more complete configuration: def copy_templates remove_dir "spec" copy_file "Guardfile" copy_file ".rspec", force: true copy_file ".rubocop.yml" copy_file ".simplecov" directory "config", force: true directory "lib", force: true directory "spec", force: true end We are copying four files which are specifically for testing, code quality, and code coverage. Whenever I use rails generators, I prefer to not create a lot of extra files I am not going to use, like stylesheets, helpers, and spec files. If I choose to use any of these resources, I would rather manually create them. So, I configure the generators in config/application.rb, and copy the config directory: config.generators do |g| g.stylesheets false g.helper nil g.test_framework nil end Lastly, I remove the generated spec directory and copy a new one that includes the configuration I need, and one feature spec to test the static route. Config File To use the new template, you need to set up a .railsrc dotfile, in the users' path, in your $HOME directory. When you use the rails new command will inject commands to the command line silently. So my simple .railsrc file: --database=postgresql --database=postgresql -T -m /path/to/template.rb I can start a new project: rails new cool_app and silently the postgresql flag is added, no default testing framework is installed, and the custom setup installation process begins. Remember to check out the complete Rail's template hosted in the Repository)
https://dev.to/eclecticcoding/rails-basic-template-3opg
CC-MAIN-2021-10
refinedweb
570
60.04
So, if you've been going through the System.Data.Services.Internal namespace, you might have noticed that the types are rather visible. What's up with that? Well, the types are used to ask LINQ provider to do $expand projections as necessary. Projecting is rather interesting, because the providers will need to look at these types and instantiate them at some point or another. We wanted LINQ provider writer to be able to write code that didn't require requesting any privilege elevations to get at these types and instantiate them, call methods on them and so on and so forth. Typically the projection can be done using LINQ to Objects and by making the types visible, 'it just works' from any privilege level - a LINQ implementation could generate IL referencing these types, use reflection over visible types, or whatever strategy they choose to implement. And now you know. Then why not put them in a better namespace than 'internal'? I'm surprised we let this through the namespace approval.. Well, these types are not meant to be referenced externally in most cases - thus the moniker. Typically processing code such as LINQ providers will reference them at run-time, analyze them using reflection and possibly get & set properties using reflection and/or IL, so being visible eases requirements on the them, but direct usage won't happen while developing data services per se. Also, while the data service will produce queries that reference these types, they are accessed by the rest of the system through the System.Data.Services.IExpandedResult, so even custom LINQ providers that are Data Services-aware are unlikely to have a direct reference. All said, I wish we had a better organization solution for this, but a .Internal suffix had precedents and solved our concerns without interfering with API usage. Trademarks | Privacy Statement
http://blogs.msdn.com/marcelolr/archive/2008/08/19/system-data-services-internal-is-rather-visible.aspx
crawl-002
refinedweb
308
53.92
Input & Output Authors: Darren Yao, Benjamin Qi, Allen Li Demonstrates how to read input and print output for USACO contests, including an example problem. Prerequisites C++ Java Python The code snippets below will read in three integers as part of a single line and output their sum. For example, given the input 1 2 3 the output will be as follows: The sum of these three numbers is 6 Feel free to test them out at ide.usaco.guide. Out of the methods below, which one should I use? It doesn't matter. Whichever you're most comfortable with! Standard I/OStandard I/O In most websites (such as CodeForces and CSES), and in USACO problems after December 2020, input and output are standard. C++ Method 1 - <iostream> More straightforward to use. Calling the extraction operator operator>> on cin reads whitespace-separated data from standard input. Similarly, calling the insertion operator operator<< on cout writes to standard output. The escape sequence \n represents a new line. #include <iostream>using namespace std;int main() {int a;int b;int c;cin >> a >> b >> c;// "\n" can be replaced with endl as wellcout << "The sum of these three numbers is " << a + b + c << "\n";} Method 2 - <cstdio> This library includes the scanf and printf functions, which are slightly more complicated to use. #include <cstdio>using namespace std;int main() {int a;int b;int c;/** %d specifies that a value of type int is being input.* To input a 64-bit (long long) number, Java Method 1 - Scanner and System.out.print In your CS classes, you've probably implemented input and output using standard input and standard output, or using Scanner to read input and System.out.print to print output. import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt();int b = sc.nextInt();int c = sc.nextInt();System.out.print("The sum of these three numbers is ");System.out.println(a + b + c);}} This works, but Scanner and System.out.print are slow when we have to handle inputting and outputting tens of thousands of lines. Input Speed See the Fast I/O module for a comparison of input speeds as well as faster methods of input than those described in this module. Method 2 - BufferedReader and PrintWriter USACO This is the recommended I/O method for USACO contests. Feel free to refer to this section in-contest as it provides information about basic Java functionality. These are faster because they buffer the input and output and handle it all at once as opposed to parsing each line individually. However, BufferedReader is harder to use than Scanner. It has quite a few more methods and the io library must be imported for its use as well. A StringTokenizer is used to split the input line by whitespace into tokens, which are then accessed individually by the nextToken() method. import java.io.*;import java.util.StringTokenizer;public class Main {public static void main(String[] args) throws IOException {BufferedReader r = new BufferedReader(new InputStreamReader(System.in));PrintWriter pw = new PrintWriter(System.out);StringTokenizer st = new StringTokenizer(r.readLine());int a = Integer.parseInt(st.nextToken()); Method 3 - I/O TemplateMethod 3 - I/O Template Warning! Since the code in this section could potentially be considered more than just basic Java functionality, you should not refer to this during a USACO contest. The following template (a shortened version of Kattis's Kattio.java) wraps BufferedReader and PrintWriter and takes care of the string processing for you. You may or may not find this more convenient than method 2. import java.io.*;import java.util.*;/*** Simple yet moderately fast I/O routines.* Some notes:** - When done, you should always do io.close() or io.flush() on the* Kattio-instance, otherwise, you may lose output.* The input methods in our Kattio class mimic those of Scanner. Given an instance io: PrintWriter Buffering The original Kattio code had super(new BufferedOutputStream(o)); on line 23. But since PrintWriter will automatically wrap an OutputStream with a BufferedWriter (source), including BufferedOutputStream is unnecessary. Similarly, you may see PrintWriters for file output initialized like the following (ex. here): PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("problemname.out"))); This is equivalent to what we use in this module: PrintWriter pw = new PrintWriter("problemname.out"); Python Method 1 - input() and print() The most intuitive way to do input/output is using the built in input() and print() methods. The input() method will return the next line, and can be processed using various Python methods. The print() method takes in a string and an optional string end (defaults to '\n'). Below is an annotated demonstration on different input/output scenarios. # Read in a stringmy_str = input()# Prints the string on its own lineprint(my_str)# Take in an integer n on a single linen = int(input())# Prints n with " test" (no newline) after itprint(n, end=" test") Method 2 - stdin and stdout The first method of reading input can be far slower (sometimes hundreds of times slower!) than using stdin. Coupled with Python's relatively slow execution speed, reading input quickly becomes incredibly important. # Import the sys module to use stdin/stdoutimport sys# sys.stdin/stdout is similar to a file in that we read lines for input/outputmy_str = sys.stdin.readline()sys.stdout.write(str(myStr) + '\n')# Renaming the read/write methods for convenienceinput = sys.stdin.readlineprint = sys.stdout.write We can also use split, map or a list comprehension to read in multiple whitespace-separated integers on the same line. import sys# Read in a series of numbers on one line into a listnums = [int(x) for x in input().split()]# This does the same thingnums = list(map(int, input().split()))# stdin/stdout, just replace input() with sys.stdin.readline()nums = list(map(int, sys.stdin.readline().split())) We can use something similar to the above if we are unpacking a fixed number of integers. import sys# Read in integers n and m on the same line with a list comprehensionn, m = [int(x) for x in input().split()]# Do the same thing but with map insteadn, m = map(int, input().split())# stdin and stdoutn, m = map(int, sys.stdin.readline().split()) So taking three integers as input and printing their sum is quite simple. On a larger scale (thousands of integers), using stdin and stdout becomes far more important for speed: import sysa, b, c = map(int, input().split())print("The sum of these three numbers is", a + b + c)# stdin and stdouta, b, c = map(int, sys.stdin.readline().split())print("The sum of these three numbers is", a + b + c) Example Problem - Weird AlgorithmExample Problem - Weird Algorithm Focus Problem – try your best to solve this problem before continuing! Try to implement this yourself! C++ As noted in the resource above, this problem requires 64-bit integers. Solution Java As noted in the resource above, this problem requires 64-bit integers. Method 1 - Scanner and System.out.print Method 1 Method 2 - BufferedReader and PrintWriter Method 2 With Kattio Kattio Python Solution File I/OFile I/O Update USACO problems from December 2020 onwards use standard I/O rather than file I/O. You'll still need to use file I/O to submit to earlier problems. In older USACO problems, the input and output file names are given and follow the convention problemname.in. After the program is run, output must be printed to a file called problemname.out. Focus Problem – try your best to solve this problem before continuing! You must use the correct file names when opening the .in and .out files, depending on the problem. The file names are given on USACO problems which require file opening. For example, you would open paint.in and paint.out in the above problem. C++ Method 1 - freopen You will need the <cstdio> library. The freopen statements reuse standard I/O for file I/O. Afterwards, you can simply use cin and cout (or scanf and printf) to read and write data. #include <iostream>#include <cstdio>using namespace std;int main() {freopen("problemname.in", "r", stdin);// the following line creates/overwrites the output filefreopen("problemname.out", "w", stdout);// cin now reads from the input file instead of standard input To test your solution locally without file I/O, just comment out the lines with freopen. For convenience, we can define a function that will redirect stdin and stdout based on the problem name: #include <iostream>#include <cstdio>using namespace std;// the argument is the input filename without the extensionvoid setIO(string s) {freopen((s + ".in").c_str(), "r", stdin);freopen((s + ".out").c_str(), "w", stdout);} Method 2 - <fstream> You cannot use C-style I/O ( scanf, printf) with this method. #include <fstream>using namespace std;int main() {ifstream fin("problemname.in");ofstream fout("problemname.out");int a;int b;int c;fin >> a >> b >> c;fout << "The sum of these three numbers is " << a + b + c << "\n";} Java JavaJava Again, BufferedReader and PrintWriter should be used. Note how static initialization of r and pw is slightly different. import java.io.*;import java.util.StringTokenizer;public class Main {public static void main(String[] args) throws IOException {BufferedReader r = new BufferedReader(new FileReader("problemname.in"));PrintWriter pw = new PrintWriter("problemname.out");StringTokenizer st = new StringTokenizer(r.readLine());int a = Integer.parseInt(st.nextToken()); With Kattio import java.io.*;import java.util.*;public class Main {public static void main(String[] args) throws IOException {Kattio io = new Kattio("problemname");int a = io.nextInt();int b = io.nextInt();int c = io.nextInt();io.print("The sum of these three numbers is "); Python PythonPython See here for documentation about file I/O. The most intuitive way to do file I/O in Python is by redirecting the system input and output to files. After doing this, you can then use the above input() and print() methods as usual. import syssys.stdin = open("problemname.in", "r")sys.stdout = open("problemname.out", "w") A different approach to file I/O in Python is to still use the open() method, but use the built-in functions .readline() or .readlines(): """Note: The second argument can be omitted in the open()command for read-only files"""fin = open("problemname.in", "r")fout = open("problemname.out", "w")# One way to read the file using .readline()line1 = fin.readline()# readline() will pick up where you left off fin.readline()will return the next line as a string. This method is useful for problems where you only have to read a short amount of lines but you still need to map each value to a variable. fin.readlines()returns all of the file's content as a list, separated by newlines ( "\n"). Combined with a for loop, this method provides a concise way to separate variables in the same line in a problem. Keep in mind that each line entry in the list will still have a "\n"at the end. fout.write(data)will write the variable datato the file. datamust be a string, and you can convert non-string variables with str(my_var). The write()method will NOT write a new line at the end. You must also run fout.write("\n")if you wish to write a new line. f-strings were added in Python 3.6, and generally look nicer than concatenating (adding) strings. To define an f-string, simply add the letter fright before the start of the string, and any variables or expressions enclosed in curly braces ( {}) will be put into the string. As an example, fout.write(f"{var1} {var2} {var3+var4}")looks much cleaner than fout.write(str(var1)+" "+str(var2)+" "+str(var3+var4)) After you read a line, you may wish to process it further. Python has many built-in string methods and functions: str.strip()removes any trailing or leading whitespace. You should always run this method after reading a line, to ensure that there is no extra whitespace: line = fin.readline().strip() map(func, iterable)will run a function (the funcargument) against each element of an iterable (list) you pass it. This is useful for changing a list of strings into a list of ints: nums = list(map(int, ["1", "2", "3"])). Please note that map()returns a Map object, and you need to convert it into a list with list(). str.split(delim)will split the string. If no argument is passed, it will split by space. This is useful if you want to separate a string of space-separated integers into ints: nums = list(map(int, line.split())) Example Solution - Fence PaintingExample Solution - Fence Painting For an explanation of the solutions below, check the Rectangle Geometry module. C++ Method 1 - freopen Method 1 Method 2 - <fstream> Method 2 Java Method 1 - Scanner and PrintWriter Method 1 Method 2 - BufferedReader and PrintWriter Method 2 With Kattio Kattio Python Method 1Method 1 Method 1 Method 2Method 2 Redirecting file input using sys, as mentioned above. Method 2 USACO Note - Extra WhitespaceUSACO Note - Extra Whitespace Importantly, USACO will automatically add a newline to the end of your file if it does not end with one. Warning! Occasionally, there is a period of time near the beginning of the contest window where the model outputs do not end in newlines. This renders the problem unsolvable. Make sure not to output trailing spaces, or you will get an error such as the following: Here are some examples of what is allowed and what isn't when the intended output consists of a single integer ans: C++ C++C++ cout << ans; // OK, no newlinecout << ans << endl; // OK, newlinecout << ans << "\n"; // OK, newlinecout << ans << " "; // NOT OK, extra spacecout << ans << "\n\n"; // NOT OK, extra newline Java JavaJava pw.print(ans); // OK, no newlinepw.println(ans); // OK, newlinepw.print(ans + "\n"); // OK, newlinepw.print(ans + " "); // NOT OK, extra spacepw.print(ans + "\n\n"); // NOT OK, extra newline Python PythonPython print(ans, end='') # OK, no newlineprint(ans) # OK, newlineprint(str(ans) + '\n', end='') # OK, newlineprint(str(ans) + " ", end='') # NOT OK, extra spaceprint(str(ans) + '\n') # NOT OK, extra newline Module Progress: Join the USACO Forum! Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!
https://usaco.guide/general/input-output
CC-MAIN-2022-40
refinedweb
2,380
57.77
15117/facing-rendering-issue-in-aws-ec2-instance If you are not able to remotely log on to a Windows Server EC2 instance from a user account that is not an administrator account, ensure that you have granted the user the right to log on locally. See Grant a user or group the right to log on locally to the domain controllers in the domain. You could always use the Amazon RDS ...READ MORE Please follow the steps mentioned here:- This ...READ MORE No, you don't need an Elastic IP address for ...READ MORE Yes, the general limit for creating on-demand ...READ MORE Hey @nmentityvibes, you seem to be using ...READ MORE It can work if you try to put ...READ MORE Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE When you use docker-compose down, all the ...READ MORE import boto3 ec2 = boto3.resource('ec2') instance = ec2.create_instances( ...READ MORE I believe that you are using the ...READ MORE OR
https://www.edureka.co/community/15117/facing-rendering-issue-in-aws-ec2-instance
CC-MAIN-2019-22
refinedweb
166
77.53
CEIL(3P) POSIX Programmer's Manual CEIL(3P) This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. ceil, ceilf, ceill — ceiling value function #include <math.h> double ceil(double x); float ceilf(float x); long double ceill the smallest integral value not less than x. The result shall have the same sign as x..(3p), floor(3p), isnan CEIL(3P) Pages that refer to this page: math.h(0p), floor(3p), rint(3p)
http://man7.org/linux/man-pages/man3/ceil.3p.html
CC-MAIN-2019-22
refinedweb
103
58.58
How to convert string to double std::string to double i tried stof but it didn't work i kept getting errors it didn't recognize it - SergioDanielG Hi karim24. Did you try using "QString::toDouble()": Regards What does this have to do with Qt? One of quite a few options: @ #include <string> #include <cstdlib> std::string test("0.6"); double value = ::atof(test.c_str()); @ - leon.anavi It is recommended to use QString for Qt projects but if you insists on using std::string you can easily find solution in similar topics: - "C++ string to double conversion": - "How can I convert string to double in C++?": - "std::string to float or double": @ChrisW67 What does this have to do with Qt? because i used "stof" in most of my code when i was using visual c++ it worked fine but when i used it in qtcreator there were errors and now "atof" working just fine for me thanks This is a Qt forum, neither std::string nor stof() is part of Qt, and no other part of your question implicates Qt in any way. Hence my question. You are probably getting errors, that you don't specify, because std::stof() is part of C++11 and your compiler, which you also did not specify, is defaulting to an earlier C++ standard. That's only a guess though. The difference has to do with the compiler and libraries you use (VC vs MinGw), not with the fact that you use Qt or Qt Creator.
https://forum.qt.io/topic/28396/how-to-convert-string-to-double
CC-MAIN-2017-51
refinedweb
253
75.03
“A picture says more than 1000 words.” I don’t know the source of that quote, but for sure it is true for every developer and engineer too. Engineers need to work a lot with numbers. But numbers can be transformed into pictures and graphs which can make complex things and relationships easier to understand. Verifying proper functionality of a PID closed loop controller or watching sensor values with a nice plot is definitely something very useful. Would it not be great to watch sensor data changing over time in a chart like the one below? One way is to export data and then show it e.g. in Excel (which has been great chart functions). But even better, if this could be done directly with data provided from the target board? If you think this is hard to do, then I can show you how this can be done in a few steps with the help of a very nice tool: FreeMASTER 🙂 FreeMASTER FreeMASTER is a graphical tool to read or write memory on the target, either using a COM (serial) port on the host PC or using a dedicated communication protocol (BDM, JTAG, or CAN). FreeMASTER is provided for free-of-charge on the Freescale web site (requires registration). There seems no uniform spelling of FreeMASTER. Even Freescale uses different spelling (FreeMaster, FreeMASTER, PCMaster, so do I in this post too 😉 FreeMASTER is using the application binary file and debug information for the location of the global variables in the target memory, and is able to display them in ‘real time’ on the host. ‘Real time’ means that it does not impact the target code execution ‘much’. This makes it a great tool to visualize or change variables ‘on the fly’. Additionally it allows to send ‘callbacks’ to the target for advanced control. More about this at the end of this article. The downside is: it is not very easy to use. Jim Trudeau wrote a great article about the capabilities of FreeMASTER which is a starting point. Similar to the comments on his blog, I have not found I have not found good documentation or tutorials how to use it. This is very I hope I can close a gap. I want to pass a big ‘Thank you!” to Yayra Kwaku for reminding me that I had the ‘FreeMASTER’ topic in my bucket list for a long time. As a reader of my blog and as intern at Freescale, he explored FreeMASTER and he provided me important tips and ways how to use FreeMASTER. Without this, I would not have been able to use FreeMASTER or to explore the features easily. THANK YOU! So with this, I hope you find this tutorial helpful and that it gives an easier way to learn this tool. I promise: it is indeed a great tool, it just needs some learning. And a tutorial 🙂 ❗ FreeMASTER is only available for Windows. So if you are using Linux, you are (yet again) not covered 😦 Tutorial Outline In this tutorial I’ll show how to use FreeMASTER to visualize the accelerometer values on the FRDM-KL25Z board and to change the LEDs on the board. I’m using Processor Expert with CodeWarrior for MCU10.4. The steps are very generic so it can be used for any other board or toolchain configuration, e.g. IAR, Keil or standard Eclipse. To communicate between the microprocessor and FreeMASTER, I’m using the OpenSDA USB CDC (serial over USB) connection. As starting point, I’m using the project I had created in a tutorial about how to use the accelerometer. Installation FreeMASTER comes in two parts: - FreeMASTER Application: this is the visualization tool itself, running on the host. It comes with built-in drivers to communicate with the target through debugging/JTAG/BDM devices like P&E Multilink. - FreeMASTER Communication Drivers: this includes serial communication software drivers to communicate with the target, and source code for other connections like BDM (Background Debug Mode) or CAN and USB. So if you are not going to use the Processor Expert component (I’m going to use below), then you can use the files in this package to be incorporated into your application. Instructions to download and install are very simple: - Go here and download FreeMASTER from the ‘Downloads’ tab. You need both the ‘FreeMASTER Application Installation’ and ‘FreeMASTER Communication Driver’. - Run both setups (order does not matter) to install the application and the communication drivers. Project Setup In the next steps I will add a FreeMaster Processor Expert component to my project which will communicate with the FreeMaster application on the host machine. 💡 I’m using Processor Expert as it comes with a FreeMaster component, and only requires to add two function calls. The limitation is that the Processor Expert component only works with RS-232/SCI, and not with other communication ways like CAN or USB CDC. I need to insert two calls to FreeMaster library functions in my code. In order to view my variables, they need to be global variables. 💡 Global variables can be ‘static global’ or ‘external global’. They just need to be present in the Dwarf (Debug Information) of the application binary file. The next steps outline what needs to be done to transform a Processor Expert project into a ‘FreeMASTER ready’ one. Adding FreeMaster Processor Expert Component From the Components view, add the FreeMaster component to the project. It can be found in the Components Library view in Processor Expert: To add it to the project, either double-click on it, use the ‘+’ icon or drag&drop the component to the project. In the Component Inspector, enable Oscilloscope, Recorder and Application command: 💡 ‘Recorder’ is a feature I’m now not covering in this tutorial, but I’ll have it enabled. UART Configuration Next step is to configure the UART: I select the device (e.g. UART0) and enable the Clock gate in the Init_UART sub-component. Then I configure a suitable baud (9600 baud in this example) with divisor and oversampling ratio values as below: ❓ It is too bad that the FreeMaster component is using the Init_UART component (why?). It is very complicated in and not intuitive to set up the Baud rate with Init_UART. Why is it not possible to set up the desired baud as in the AsynchroSerial component? And with this way of component, it is not possible to say use USB or CAN? Next to configure the UART RX and TX pins: Finally, I enable the error interrupts (so the Init_UART component is happy about the settings): Generating Code With this, there should be no errors, so time to generate code, either with the context menu on the ProcessorExpert.pe file or with the button below: There are the following three warnings in the Problems view: They remind me that I need to call the FMSTR1_Poll() function to keep the communication alive with FreeMaster, and that I need to use the FMSTR1_Recorder() function to sample variables in the recorder. ❓ I have the requirement to have my projects error and warning free. Unfortunately I have not found a way to get rid of these warnings? Even if I’m using the functions, the warnings do not go away? The FMSTR1_RegisterAppCmdCall() function can register added callbacks and is not used in this tutorial (I will use a direct way. More about this later). Poll() and Recorder() I add both FMSTR1_Poll() and FMSTR1_Recorder() calls to my application main loop. For this I can use drag&drop to place the function calls into my source file: If needed, add the proper include to my source file: #include "FMSTR1.h" Global Variables FreeMASTER is accessing the target memory. For this, a variable needs to be at a fixed address. Accessing local variables on the stack does not make sense, as the memory address will change all the time. Therefore, any variable I want to watch, needs to be a global one. 💡 FreeMASTER can use as well directly the address of a memory location. But it is more user friendly to find the address of the memory location, based on the variable name. So if I want to see my x, y and z accelerometer values (which are local variables in my example), I need to copy them into global variables. For this I add extra code to make accelerometer values global: ❗ Of course if the variables to watch are already global, no copy is needed. But if you want to monitor local ones, then you need to make them global. Please refer to the project sources on GitHub. With this, my application is complete, and I can build and download it to the board as usually. FreeMASTER Application Run FreeMASTER from the shortcut installed: The application probably will complain about a communication port error: Click OK to get rid of it. 💡 Consider changing the FreeMASTER shortcut to add the project *.pmp file (more about this later), so it loads automatically your project at startup. Select the menu Project > Options: Here we need to setup the communication and which binary file (map file) to use. COM Port Select the COM port where you connect to the board and the Baud (see above) you have configured on your board: 💡 If you are unsure which COM port is used, check the communication ports in the Windows Device Manager: Map (or ELF) File FreeMASTER is using the information inside the debug information of the ELF/Dwarf file. Under the ‘MAP Files’ tab, browse to the .elf application file and specify the File format: ❗ FreeMASTER is using old/outdated Windows libraries for the browse dialogs. As a result browsing Libraries in Windows 7 or 8 will not work, so you need browse to the absolute drive path. This completes the communication setup. Press OK. Creating Variables With the .elf file specified, we can add variables to watch in FreeMASTER. Use the menu Project > Variables: Initially, the list of variables is empty, so we are going to create new ones with ‘Generate’: 💡 I could use ‘New’ as well, and then setup things from scratch. Generate is a better way in my view as it automatically populates the settings with the settings from the debug information. Then I select the variable and use ‘Generate single variables‘: I do this for all my variables: Then use ‘Close’ button. And I have my variables listed in the variables list: Using the ‘Edit…’ button on a variable shows the details about it. For example the sampling period can be changed: 💡 FreeMASTER is using the data types for the variables as defined in the .elf file. In the above case, AccelX is defined as uint8_t in the sources. It can be changed in this dialog to a signed fixed point type (or any other type) as needed. Then close the dialogs with OK. Saving Project Settings Now it would be a good time to save the project settings so it can be loaded later again: Otherwise if you close FreeMASTER, you will lose all your settings. So do not forget to save your settings on a regular base. 💡 I recommend to save the project file inside the CodeWarrior project folder. That way the path to the .elf file will be relative to the project root, and allows easier sharing of the file e.g. in a version control system. Additionally if you specify that project file as argument to the PCMaster.exe (that’s the name for FreeMASTER executable), then it will load that project file at startup. Creating Subblock To show the variables, we need to create a ‘Subblock’. To do this, right-click on the project icon and use ‘Create Subblock…’: Provide a (hopefully 🙂 ) meaningful name: In the ‘Watch’ tab move the variables you want to watch to the right side using the ‘Add ->’ button: Then close the dialog with OK. Watching Variables Values How to see the variable value? Select the subblock and I can watch the variable in the lower part of the window: 💡 To watch variables changing over time like in above view, I can use the ‘live view’ of the CodeWarrior debugger too. Watching Variables in Graphical View Having the variable value updated periodically is one thing. But I want to see the values plotted over time. To view the variables in graphical mode, right-click on the subblock and then create a scope: 💡 ‘Scope’ is meant here like a oszillo’scope’, and not in the sense of ‘scope’ in the sense of programming languages. So not like the ‘scope’ of a variable 😉 Then use the Setup tab to assign variables to colors, using the drop down to select variables: Close the dialog and we are ready to show the graph. Showing the Variable Plot To show the plotted graph, select the scope created and enjoy the graph in the ‘oscilloscope’ tab: 💡 There is a ‘algorithm block description’ tab which I do not cover here. See the documentation about how to use it. You can hide this tab too if needed. 💡 I’m using the TWR-LCD module as display to a similar graphical view of data at runtime. Data is sent to the TWR-LCD with I2C. It is fast and does not require a dedicated PC like with FreeMASTER. But it requires a hardware LCD. If data transfer is paused, I can zoom in/out the graph to inspect details: Changing Variables through FreeMASTER It is not only possible to read and monitor variables: I can write them too. For example I want to control if the LED’s are used or not. So I use a variable ‘enableLED’ for this: static bool enableLED = TRUE; /* if LED's are used or not */ void APP_Run(void) { ... if (enableLED) { LED1_Put(xyz[0]>50); LED2_Put(xyz[1]>50); LED3_Put(xyz[2]>50); } ... } As before, I add that variable: And this time I mark it as writable in the ‘Modifying’ tab: That way I can now control and change my application from FreeMASTER by changing this application variable: App Commands: Passing Information to the Application With FreeMASTER it is possible to send commands to the application. That way commands with parameters can be passed to the application without using additional global variables. It is like if I would call the application on the board from the PC host. I can have multiple of such commands (each with a unique ID) on the host to control my embedded application. This can be used for testing purposes or for demonstrating functionality or to stimulate the system. To show this, I’m going to send a custom command to the application to toggle the RGB LED on the board. I want to implement the following interface: /*! * \brief Toggles a LED on the board. * \param[in] ledNO Which LED to toggle, 0 for red, 1 for green and 2 for blue LED. * \return Error code, 0 for OK and 1 for failure. */ uint8_t toggleLED_cmd(uint8_t ledNo); FreeMASTER Application Command Definition First, I define the command in FreeMASTER. Right click on the subblock and select Properties: Then create a new Application command with ‘New..’: In the ‘Definition’ tab I give the command a name and a code number: 💡 The ‘Code’ is a numerical value I can use later in my application to differentiate between commands. It is more like a ‘command ID’. In the ‘Arguments’ tab I specify the argument(s) to be used: I can have multiple arguments. In this example I just need one: the ledNo as a one byte of integral type. Similar to this, I define the return codes: With specifying a message icon, I the given return code text will be shown in a dialog box (more about this later). Handling FreeMASTER Application Commands in Application I define three variables in my application (they can be local variables too): static FMSTR_APPCMD_CODE cmd; /* application command */ static FMSTR_APPCMD_PDATA cmdDataP; /* pointer to application command data */ static FMSTR_SIZE cmdSize; /* size of application command arguments */ With the following call /* check application commands */ cmd = FMSTR1_GetAppCmd(); I check if an application command has been received. 💡 It is possible to register callbacks for application commands using RegisterAppCmdCall(). That way the FreeMASTER library will directly call the callback. In my example I’m using the polling method. FMSTR1_GetAppCmd() returns the command ID (‘code’) I have defined earlier in FreeMASTER. If no command is present, it returns FMSTR_APPCMDRESULT_NOCMD. If there is a valid command, I query for the size of arguments and the arguments itself: /* check application commands */ cmdDataP = FMSTR1_GetAppCmdData(&cmdSize); This returns in cmdSize the number of bytes of the arguments, and a pointer to the arguments as return value. Then I need to acknowledge the reception of the command and return the return value. Otherwise FreeMASTER on the host will show a timeout. Acknowledgement is performed with /* check application commands */ FMSTR1_AppCmdAck(0); /* acknowledge the command */ Here I return the return codes I have defined before in FreeMASTER (e.g. 0 for OK, 1 for failure, etc). In summary, my application command handling source then looks like this to toggle the LEDs: cmd = FMSTR1_GetAppCmd(); if (cmd!=FMSTR_APPCMDRESULT_NOCMD) { /* received command */ cmdDataP = FMSTR1_GetAppCmdData(&cmdSize); if (cmd==0 && cmdSize==1) { /* ToggleLED_cmd (id: 0) has just one byte argument */ switch(*cmdDataP) { case 0: LED1_Neg(); FMSTR1_AppCmdAck(0); /* acknowledge the command */ break; case 1: LED2_Neg(); FMSTR1_AppCmdAck(0); /* acknowledge the command */ break; case 2: LED3_Neg(); FMSTR1_AppCmdAck(0); /* acknowledge the command */ break; default: FMSTR1_AppCmdAck(1); /* failed */ break; } } else { FMSTR1_AppCmdAck(1); /* acknowledge the command with failure code */ } } Sending Application Commands To send the application commands, make sure that the ‘Fast Access Pane’ is enabled: With ‘Send’ a command is sent: Double clicking in the command or using the ‘Send Dialog…’ opens a dialog: Make sure to check the ‘Wait for result’ box if you are interested in the return value. The argument values can be changed too: With ‘Send’ the command gets sent to the application. Based on the return value and the return value settings, a dialog box is shown (only if ‘wait for result’ is checked): Stimulating Variables Similar to changing variables, it is possible to stimulate variables. Stimulation means that FreeMASTER will change the variable over time. For this I have added a variable ‘stimulatedVar’ to my application. To create a stimulator, I use ‘New…’ in the ‘stimulators’ tab: Then I select the variable to stimulate, plus the time-table with the values: There are a few important details which might not be clear from this dialog (and I might be wrong as I have found no documentation about this feature in the delivered documentation, but I will prove my points below 🙂 ): - The Time in the table are absolute time points, relative from the start of the stimulation. - Between two time points the value between it gets *interpolated*, with the frequency given the ‘approximate time step‘ setting. So if this is 100 ms, then a new value will be written every 100 ms. So every 100 ms a new value gets written. - The stimulation either runs once, or in a loop if the ‘Run in the loop‘ is enabled. As visible with the graph, the stimulation is ‘approximate’. It seems not be at the very millisecond. Still, this is a very useful feature for changing variables on the target over time. To run the stimulation, either double-click on it or use the context menu: The running script is showing with a ‘green walking person’ 😉 : To show what happens with the time-table I have set up, I show the plot of the changing value: In summary, I can now watch variables, change them, display them in graphs, send my custom commands to the application, and I can send stimulation values :-). Creation of Advanced Control Pages There is more in FreeMASTER, and one big thing I have not touched is using advanced visualization pages in FreeMASTER. I have not found much information about this, except an application note AN2263 from 2004. It explains how FreeMASTER can be extended with HTML pages and to use ActiveX. ❓ The dependency on ActiveX might be the reason FreeMASTER is not available on Linux? How this could look like is shown in the article by Jim Trudeau on FreeMASTER: Using Debug Connection Another part which I have not touched yet is using a Debug Connection to the target, instead of using the serial communication protocol. This requires a JTAG/BDM run control unit like a P&E Multilink. The advantage is that this does not need changes in the application running on the target and does not need a serial port. The downside is that at least with the P&E Multilink debugging while running FreeMASTER is not possible, at least not for ARM/Kinetis. Troubleshooting Tips As with any software and tools, FreeMASTER is not perfect. Below are some tips & tricks in case of problems. Be free to post a comment if you have more hints and tips! No Updates One problem is that the variables in FreeMASTER do not get updated any more: they are frozen. I saw the application on the board running properly, and the serial connection was transmitting data. But FreeMASTER somehow was stuck. Closing FreeMASTER did not help. Logging out the user was not enough, it required a full machine reboot :-(. I had that case several times, and it seems to be related to the fact if switching back and forward between FreeMASTER and normal serial connection (having a terminal program open and connected to the board if not using FreeMASTER ). It seems that FreeMASTER then blocks the serial port, and only a reboot of the machine helps. So be careful with using terminal programs (especially on the same COM port) in parallel with FreeMASTER. Host Suspend/Resume The other thing I noticed: Suspend/resume on a notebook while FreeMASTER is running can be problematic. I need to exit FreeMASTER first, then suspend the notebook, and start FreeMASTER again after resume. Otherwise a ‘Can not detect board information’ error can show up: Sometimes it helps to unplug/re-plug the USB cable of the connected board (using USB CDC). In some cases I had to reboot the machine. 💡 The above issues might not be directly related to FreeMASTER itself, but to the USB CDC drivers (I used the FRDM boards with OpenSDA USB CDC drivers). It could be that using a ‘real’ COM port would work fine, but I have not tried this yet. But avoiding the notebook to enter suspend definitely helped in combination with FreeMASTER. Suspending the notebook with other application (terminal programs) seems not to be a problem. Return Code Number in Message A ‘#’ in the return code dialog box is supposed th show the return code number in the message: However, this did not work for me: I do not have a workaround for this (yet). Return Code Dialog Box The return code dialog box did not work initially (not really sure why?), as it should (it did not show up at all). Sending commands worked, but not the dialog box. It worked after closing FreeMASTER and loading the project again. The other catch is: the dialog box shows up if the command is executed only if you do it with the ‘Send’ context menu. But it does *not* show up if using the ‘Send dialog’ way with the ‘wait for result’ unchecked. To show the return dialog box using the ‘Send dialog’ way, the ‘Wait for result’ needs to be checked. 💡 It would be more intuitive if each command would have a check box ‘show return code dialog box’. Debugging Debugging the application while connected to FreeMASTER is possible. But it is not possible to debug the board if FreeMASTER is using the debug port (instead of serial port). I was able to use FreeMASTER on the same USB connection to the FRDM-KL25Z board, both having the debugger and FreeMASTER running the same time. The CodeWarrior debugger is using the USB cable to debug, while the same the USB cable is used with USB CDC. But the target should not be halted during FreeMASTER application command processing, otherwise a timeout will occur: If that error happens otherwise, try extending the command response timeout: Summary FreeMASTER is a free-of-charge tool to monitor, visualize and change variables or memory on my embedded system. It is suitable for a ‘few’ variables, as ultimately it will not allow to transfer a lot of data in a very fast way. But it works very well for a few bytes every few 100 ms. An ideal tool to inspect a system to see what is going on, either with a serial connectivity or using a debug port. Although FreeMASTER is intrusive to some extend, it adds a lot of value during the development of a system, as it allows to monitor and change the system in nearly real time. For using serial connectivity, It requires that the target system adds a FreeMASTER library/source support. It offers using a debug port too, but then you cannot debug and visualize the same time (at least with ARM targets). It is using a viewer on the host PC (Windows only) which communicates to the target. Altough the FreeMASTER user interface and runtine library is not very easy to use, it is very easy to use with the help of Processor Expert. But it would be great if Processor Expert could support other protocols beyond Serial. For example the FreeMASTER communication drivers have the FSL USB Stack CDC sources added, but there is no way use it with Processor Expert. Unless Freescale would release a better component which would allow more flexible connections, I probaly need to implement my version if it to use something like my USB CDC component. Unfortunately FreeMASTER is only available for Windows and no other host operating system. It seems that the FreeMASTER architecture and libraries used (e.g. ActiveX) does not make it easily portable to other systems. It is understood that such a tool is useful as a standalone version, but I wish it would exist as plugin in Eclipse. That would make it even more useful, and would certainly solve the cross-platform issue. Neverless, FreeMASTER is a very useful tool. And I hope that tutorial is useful if you were searching for a tutorial about FreeMASTER as I did ;-). Happy FreeMASTERing 🙂 PS: The accelerometer project used in this post is published on GitHub. Erich as always you did an excellent job. If memory servers me PCmaster was the original name and when Freescale came about form Motorola it was changed to FreeMaster. None of that really matters. The early usage was for motor control visual feedback, so the few App Notes and documentation make the package seem to be for DSCs only. We beat our way through usage for motor tuning and drive information in our robots with not enough time to write an App Note. Besides our company is to small by Freescale standards to publish our App Notes. You are correct in there is no Note out there on how to use and/or configure FreeMaster which in itself is a shame. Keep up the great work. Hi Bill, thanks for feedback and reading :-). Yes, most of the things I have found is DSC oriented, at it looks like only for DSCs (with USBTap/EtherTap) it is possible to use FreeMaster while debugging (if using the debug connection). But I think the value of that tool is well beyond motor control, but unfortunately it got labeled as such. Erich, I think the original intent was for motor control readback but you have shown what we have not had time to do. I am looking at using it as the data source for joint motion on a screen (robotic arm). We have some other ideas but are not ready to release the thought just yet. My old friend 🙂 FreeMASTER is perhaps the single most useful and valuable unsung tool in the FSL tool chest. Glad to hear you met an old friend :-). It is like you wrote in your blog a gem, but an unpolished one. And if it would have at least some of the capabilites of National Instrument LabView, that would make that tool really outstanding. Hi Erich, great job!! Use Freemaster a while ago and today I learned many new things 🙂 When you made the post on USBDM and Freedom board I use it with Freemaster and I did not use the Freemaster component in my code, and is much faster than for UART. Would be interesting to see you try 🙂 Hi Carlos, which target/board did you use with USBDM and FreeMaster? KL25Z128 Hi Carlos, how have you selected USBDM? I don’t see OpenSDA or USBDM in the FreeMaster connection settings? Hi Erich, There is the FreeMASTER communication plug-in that allows to access the target hardware over an alternative communication interface. This plug-in supports several BDM interfaces based on open source firmware including USBDM. To select the USBDM, in the menu Project > Options click on the Plug-in Module and select the “FreeMASTER BDM Communication Plugin” in the drop-down list. Then press the Configure button and select USBDM. The FreeMASTER communication driver is available at the bottom of this website: Hi Tomas, thanks, I need to try this out! Hi all, Being an old and very attached user of FreeMaster ( or PcMaster at the beginning of its story ), i’ve just to add a small note to the Erich’s article : FreeMaster view all the global or STATIC variables . In other words , you can view a variable internal to a function like this : void func( void ) { int a; ….. } simply by adding the static qualifier : static int a; The static qualifier, infacts, says to he compiler to allocate space in RAM for that var and to not use the stack. Hi Luca, thanks for that additional point: yes, indeed, ‘static locals’ can be used too. I just add the note that some compilers might use very special names in the symbol table, so it might be hard to identify them. Hi Erich, great job as usual. Despite I’m a very old Freemaster user, your tutorial taught me a lot: thank you very much. I just would like to point out that Freemaster for KL is not able to read MCU registers (sometimes useful to check configuration on target when you can’t put breakpoints) because target side firmware reads 32 and 16 bit variables (so registers too) byte by byte. The program jumps to hard fault handler in this case. Anyway this is OK for S08 MCU where most of registers are 8 bits wide. Will it be possible to make a modification in the processor expert generated code? Of course workaround is to stop code generation and modify the generated code but it does not look so smart 😉 Hi Roberto, this sounds like a bug in FreeMaster to me. Have you reported it already to Freescale? And now I need to learn something from you: how can I read the registers? thanks, Erich Erich, More like a limited human design, goes back to earlier comment about DSCs which are 16-bit. Now it would be great if FSL would take this wonderful tool and expand it. Bill Hi Erich, thanks for your reply. Yes I think it’s a bug too and I have already reported it to FSL… Anyway to read a register: Menu Project\Variables\New. The “usual” form will appear: enter for istance register name as variable name and its address in the edit box below, specifying type and size. Then you can set sampling period…That’s it. On KL04 to read RTC_TSR variable name = RTC_TSR address = 0x4003D000 type = unsigned fixed point size = 4 Roberto Hi Roberto, ok, I see. I was thinkig that you mean the core (CPU) registers, and not the memory mapped peripheral registers. Maybe my poor english vocabulary lead to this misunderstanding. Anyway that’s OK now. Thanks again for this tutorial and all other ones. Roberto No, no, it is not your vocabulary! ‘Register’ can mean CPU register or ‘peripheral’. Always good to clarify. Hi Erich, I am also using FreeMASTER in my ‘Programming Microcontroller’ Course at my University. The tool is perfect to teach the student in online calibration and even for a HIL enviroment by using the interface between FreeMASTER and Matlab. All this is possible with a free licence. so first of all thank you to Freescale for providing this. However it is not everything nice-and-easy. The amount, the level of details and its widespreaded distribution makes it hard to get used to the tool. Although you are doubtless one of the worldwide experts in everything around the Freescale ecosystem you discovered a lot of obstacles during your work with it and there are still some questions open. Imagine how hard, better say frustrating it could be for a 2nd year student. So what I would love to see is a central place on the Freescale Website that collect everything about FreeMASTER and also has sufficient examples how to use the tools for the different purposes. I know there is already a lot available – but it would help a lot to centralize it. Another thing are the available communication plug-in’s. I am planning to use the TCP Interface (via Ethernet). The belonging plug-in is marked as ‘experimental’. So I balk a little bit to start the project because I know I will have to solve a lot of things on my microcontroller – but it would be hard if I always have to question the host side as well. So my conclusion: Great tool for many important things during the developement of an embedded system. However a little bit more attention and development from Freescale side is necessary to get its whole potential. Best Regards Markus Hi Markus, many thanks for your write-up, and this exactly matches what I have encountered while using FreeMaster on my own. I’ll pass this to my Freescale contacts, so hopefully this will be considered. Great to see the profile of FreeMaster being raised, I have used it since it was PC Master and find it very helpful. One thing that can be done is to use the FreeMaster driver on your micro and then implement your communications from your own PC software. You can then design your own UI without limitations. I used Visual C# Express to do this, any tool that can write to a serial port can be used. The protocol is fully documented. Just watch out for endian swaps. Note that I found an issue with the Coldfire V1 Processor Expert component for FreeMaster, which I explain here: Hi Ian, yes, I have seen that in the forum too, thanks for posting it! Erich Freemaster can’t parse elf – “Dwarf section corrupted”… Hi Max, just to check: is it a valid ELF/Dwarf file? And the Dwarf (debug) information has not been stripped off? I hope this helps. Hi, Erich Project created by the wizard are creating a .elf file per default. In my property window of the project (debugging page): debug level maximum(g3), debug format dwarf-2, Other debugging flags -gstrict-dwarf. Do you have any suggestions? Thanks. I would try to set the compiler to no optimization. Which compiler/toolchain are you using? I get the same error “Dwarf section corrupted”. My ELF file is compiled with -g3 and -O0. I’m using GCC version 4.8.0 which outputs the Dwarf 4 superset of Dwarf 2. Is it possible Freemaster is unable to parse certain Drawf 4 sections and this results in the error “Dwarf section corrupted”. I have very well possible that Freemaster is not able to read Dwarf 4, as to my knowledge FreeMaster is using its own parser. There should be a new FreeMaster version out (V1.4), although I have not tried it yet, but you might give it a try. I’m using v1.3. Hi Erich, I’m using FreeMaster V1.4 in fact. Thanks Stephen Pingback: Sumo Robot Battle Tips | MCU on Eclipse Hi Erich, Thanks for the post, I have learned a lot :D.(Really xD) I have a Question: Can I use P&E multilink USB with FreeMaster? I want to see the behavior of some data, but I dont see the opcion, I´m using the DEMOEM. Thanks for Advanced. Hi Braulio, yes, this should be possible. I’m away from my boards and goodies, but from what I can tell is that it should support the P&E connection. Could you help me to implement this using Keil toolchain without PE? OR even better how to get my project started in driverless mode? Thanks! Hi Andrea, I recommend that you use the driver suite (), because with this you can get this done in a very short time, and then it works. Of course you are free to do it without PE, but then it is much more complicated. Hi Erich, I am unable to see Accelx,Accely,Accelz. on FreeMaster, Its throwing me an error saying that the AccelX,AccelY and AccelZ symbols are not found I am having the same problem even if i try to download your project and use it. It works for me (I just tried that project again). Are you using the same FreeMaster version? I’m using V1.3.15.0 (from Jul 27 2012). Hi Erich, I am using FreeMaster 1.3.16.0(from Oct 16 2012) I even tried for another variable declared globally but even unable to see that variable also. Looks like FreeMaster does not have the debug information. Make sure that in the Options/MAP Files tab you ahve your .elf selected, with ‘Binary ELF with DWARF1 or DWARF2 dbd format”, and that it lists the .elf in the list of valid symbol file formats (see). Maybe browse for that file again. Hi Erich, I have done the same I have also declared a few other Variable Globally, But none of them are visible I don’t know what i am doing wrong. Please help!!!!!!! I really don’t know what could be wrong? Maybe post your problem in the Freescale Forum? Hi Erich, veryvery useful site and post! Thank you for taking the time to make such detailed Information avalable! However, I am having a Problem with the “Cannot detect the board Information” error you mentioned above. It is appearing always and not only when I had the PC in sleep mode. I also noticed, that I need to run FreeMaster as an Administrator explicitely, else it wouldn’t even start. I tried the USBDM plugin mode, too, mentioned by a reader. Nothing helps. Any ideas on how to get this running? Best regards, Adrian Hi Adrian, which version are you using? I’m using V 1.3.15.0 from Jul 27 2012. I have explicitly not updated to a later version (“never change a running system” ;-). HI Erich, wow, fast response! 😛 I am using 1.4.2.3 (comm protocol v3+). I see there is a 1.3.16 available at freescale.com. I’ll try this right away… hmm, download says 1.3.16, installed says 1.3.15… whatever… but it still doesn’t work. What role does the communication driver play? I installed just the most recent one. Your tutorial says that this is only necessary if Processor Expert Component is not used. Do I need to use it at all if I only use the USB OpenSDA Connection? I had not installed these communication drivers. From the Processor Expert component and application I’m using the normal UART of the microprocessor, which then gets translated by the K20/OpenSDA chip to USB CDC. On the host PC this is a normal virtual COM port which then is used by FreeMASTER. So all what you need for this is a working USB CDC/Virtual COM with the FRDM board. You should have that by default already. Check your Windows device manager if it shows up under the COM ports. Hi, I have tried to use PE with FRDM-K64F and to use the Freemaster PE cmponent, but it doesn’t exist, in the alphabetical order I have FreeCntr8 and then FreeRTOS, but NO FreeMaster, where can I find this? Kind regards, Anders Yes, for strange reasons Freescale did not include the FreeMaster component into the KDS and Driver Suite distributions. I guess it was an ovesight, as it is present in CodeWarrior. I have been told that it should be included in the next release. Hi agian, I forgot to tell what version I use: Kinetis Design Studio Version: 1.1.1 And I have also downloaded and installed your Part1_Beans_19.09.2014.PEupd + Part2_Beans_19.09.2014.PEupd /Anders Hi Anders, yes, it is not included in KDS (or Driver Suite 10.4). It is part of CodeWarrior for MCU10.6, but I think there is not a way how to extract it from CodeWarrior and install it in KDS. I have been told that it should be included in the next version. Hi Erich, I have now been able to port the code in the Freemaster serial driver + using the PE “init_Uart” component to set correct baudrate and pins etc to work with the virtual com port on the FRDM-K64F. And when starting the C:\Freescale\FreeMASTER_Serial_Communication_Driver_V1.8.1\examples\Kxx\TWR-K60N512\demo.pmp and just changing the elf-file + setting the COM9 which is my virtuall port,and it connects!! BUT the var16 in the control window is the only variable that is updated and NONE of the variables in the watch view in the bottom are updated not even var16 here??? When opening the oscilloscope view doesn’t work either NOT even the var16 is showing any trace at all, have you seen this strange behaviour? /Anders Hi Anders, is your variable a global (extern) variable? FreeMaster only can show ‘true’ global variables. I hope this helps, Erich Hi Erich, Its a pitty I can’t upload a screendump of Freemaster, sorry for not being clear about what I was testing: it is a Demo project that comes with the Freemaster serial driver v1.81 that has global variables var16 and var32. See C:\Freescale\FreeMASTER_Serial_Communication_Driver_V1.8.1\examples\Kxx\TWR-K60N512\demo.pmp And the realy strange thing is that I can see var16 but just in the “control view” I think it is some html code that uses “inline” the var16 value and this value is changing OK, BUT in the bottom “Watch view” NONE of the variables are updated, they just show a “?” also the var16 is showing a “?” /Anders Hi Anders, really not sure what is causing this. I’ll ask around if someone knows more about this. Erich Hello Anders, this seems as a known bug which affects the FreeMASTER 1.4.x running on 64bit Windows systems. It will be fixed in FreeMASTER version 1.4.3 which is going to be released by middle of October at. A workaround is to keep the serial port closed when the FreeMASTER starts and to open the port manually (Ctrl+K) when the FreeMASTER main window opens. You can change the start-up port settings in Project/Options… dialog. We have used PCMaster for a long time with the Motorolla DSP56F80x line of controllers, recently we have swapped up to Freemaster and are experiencing issues when using the scope functionality. It will work as expected for a short period of time, it will then switch to greyscale and is no longer able to be navigated using the mouse. At some point latter it sometimes the whole scope window turns black. This happens on multiple computers so I do not think it is graphics driver based. Any Ideas? I think it is a bug in the newer version. I explicitly did not upgrade and I’m still using the V1.3.15.0 version. Thanks, so the bug is only in 1.4. Any idea if it is possible to convert files back without the this file was made by a newer version errors I have not upgraded to the new version, as I have seen reports with issues, and I did not need the new version anyway (“never change a running system”). Not sure if the files are backward compatible, but I hope so. Erich, the project file of the 1.4. Freemaster are not backward compatible with 1.3.x . The Freemaster 1.4.x is able to read the previous version but when you save the project file with the new version that file will not be more “readable” by 1.3 software. Anyway, I’d like to suggest to download the latest version ( 1.4.3 ) from the Freescale website . In my experience ( i’m using FreeMaster mainly in conjunction with DSC ), no problem so far .. Thanks for putting up this great post. I followed the post and was able to create a basic main loop and plot data from my K20 device I then tried the same thing on an application that is based on mqxlite RTOS with multiple tasks. Below is a task I created and I set it to the highest priority void free_master_task(uint32_t task_init_data) { int counter = 0; while(1) { counter++; FMSTR1_Poll(); FMSTR1_Recorder(); _time_delay_ticks(10); /* Write your code here … */ } } I setup the UART0 port correctly and verified that I could communicate to the port and I also see the port in the freemaster utility. But when I try to read a global variable it gives the following error: App:ReadValue(counter) ReadVar(addr:0x1fff83dc, size:0x4) Detect done [ERROR code=0x80000101] done [ERROR code=0x80000103] done [ERROR code=0x80000103] Is there something special that needs to be done to get freeMaster working with an MQX lite application? (other than the steps you mention in this post) I’m not aware of anything special, but I have not used MQX (lite) with FreeMaster, so I don’t have a definitive answer. Will it be better if you change the delay from 10 ticks to 1? Thanks for getting back to me so quickly. I tried a 1 ms delay instead of 10ms and it didn’t change anything. Have you ever used freemaster with an RTOS? Are there any gotcha’s? I’m using FreeMASTER with FreeRTOS and that works great. I have FreeMaster connected to the Freescale KIT9Z1J638EVM through the USB and the variables are being read through the scope and in Variable Watch. When I try to add a Recorder I get the following error “Recorder Could Not Be Initialised. Error 0x80000081(Invalid Command).” What does this mean, as I cannot find any information on the web? In the Recorder properties I also see that Board Time Base is “Not Defined” and Current On-Board Recorder Memory is at 0 bytes. I have tried everything I can think of, but I cannot get the recorder to initialize. Any ideas? I had a Freescale technician look at the code and he changed a few things and said that he did not get the recorder error on his system, but I get it on mine. I suggest you have a look at freemaster_cfg.h. Have you enabled FMSTR_USE_RECORDER? I think probably not, so you are not able to use the recorder because of that? Hi Erich, Yeah its enabled: #define FMSTR_USE_RECORDER 1 /* enable/disable recorder support */ #define FMSTR_MAX_REC_VARS 8 /* max. number of recorder variables (2..8) */ #define FMSTR_REC_OWNBUFF 0 /* use user-allocated rec. buffer (1=yes) */ I had a Freescale tech look the code over and the only thing he changed was the FMSTR_SCI_BASE for mm9z1_638, but that correction did not help the recorder to initialize. Changing the SCI base only affects the UART address/port, and I’m wondering why this should have solved your problem. So there must be something else wrong. Have you tried stepping through the FreeMaster code on the target to see where the problem could happen? HI Erich, The Freescale tech was just correcting anything wrong in the code for my application. I think I found the problem, I am using the BDM communication plugin, because it Freemaster will not connect to KIT9Z1J638EVM via the serial port. The BDM connection has some limitations, see Startmenu | FreeMASTER 2.0 | Protocol & Library Documentation which reads “FreeMASTER Recorder, Application Commands, Target-side Addressing, Masked (bit-wise) write access and other higher protocol features are NOT available with BDM. In order to use such features over the BDM, use Packet Driven BDM Plug-in with FreeMASTER Serial Driver running on the target side.” Hi Chris, Ok, good you have found it. I admit that I have not used BDM or direct debug connection in my use cases, so thanks for pointing that out for everyone else who could run into the same problem. Pingback: Automatic Variable, Expression and Memory Display with GDB and Eclipse | MCU on Eclipse Will Freemaster be supported KDS 3.0? Why are you asking? It should be already supported. You’re the f***** Meister, I really like this tutorial as I saw it in my mcu’s class, thank you a lot, this content is a good one, as many as you have in this beautiful page. Hello everyone! I have 3-Phase BLDC/PMSM Low-Voltage Motor Control Drive from Freescale and I uploaded it with sample program from producent. I used to it CodeWarrior 10.6.4. I used to it MC9S08MP16 daughter board. BLDC works well but I have problem with Freemaster application. I didn’t change anything in the code and in it it was part for Freemaster too. When I want to show charts in Freemaster there is error: The hardware recorder could not be initialised. Error 0x80000101 (Response timeout.). I checked freemaster_cfg.h library and I think everything is correct: #define FMSTR_USE_RECORDER 1 // enable/disable recorder support #define FMSTR_MAX_REC_VARS 8 // max. number of recorder variables (2..8) #define FMSTR_REC_OWNBUFF 0 // use user-allocated rec. buffer (1=yes) Could you help me with this problem? Greetings, Pawel Hi Pawel, not sure what could be wrong. Does textual variable display work? Yes, they show properly values. When I want to check recorder some of them are highlighted red. Here’s the link. Hi Pawel, so this means that the basic communication is working. I think it might be a problem with FreeMaster, have you tried it with v1.4 or an earlier version (v1.3) too? I’m using Freemaster 1.3. That is version which was on the CD with added to kit. I try to use scope and it’s working good. I don’t know what means triangles and circle appeared in my scope. Do you know? Hi Pawel, strange, I have never seen something like this :-(. I’m sorry, no idea. Erich I have just one more question. Did you ever have ‘Command checksum error’ while changing the value of variable? I don’t have idea why it appears… No, I have never seen that message. It seems like the communication between your host and the FreeMASTER agent on the target is corrupted (corrupted checksum). Can you verify that there are no issues with it? Hi Erich I’m trying to run the freemaster on kl25z128, but I’ve stuck on generating processor expert code. For some reason I get : Generator: FAILURE: at line 3: Property not found: “Wait” (file:Drivers\Common\GenericI2CSettings.Inc) Line 3: %;**%>12 Wait %>60: %get(Wait,Text) Generator: FAILURE: at line 4: Property not found: “SupportStopNoStart” (file: Drivers\Common\GenericI2CSettings.Inc) Line 4: %;**%>12 Support STOP_NOSTART %>60: %get(SupportStopNoStart,Text) I’ve tried to load Your project “FREEDOM_Accel” but I’m getting an error in “.project” file due to the project couldn’t be loaded. Mabey some hint? Have you loaded the latest versions of components from SourceForge (see) already? It could be that you have old or missing components installed? Yes i’ve loaded the latest components from 2016-02-07 package. OK After removing and adding one again the generic I2C component, generating the processor expert code successfully finished. Ah, good, thanks for checking and confirming 🙂 OK after debug i’ve got 2 new errors : I2C2.h: No such file or directory Events.h /acc/Sources line 34 C/C++ Problem I2C2.h: No such file or directory I2C2.h: No such file or directory Events.h /acc/Sources line 34 C/C++ Problem They’re both in “Events.h”. I’m extreamly fresh in CodeWarrior and C but I need to grab few scopes (FreeMaster) from ACC on kl25z. This is one-time need but if it end successfuly I’ll take some time to know CW better… So please, don’t be mad when my questions will “look stupid” 🙂 But these messages did not affect debugging in any way, correct? Just in case, this might help: do a Project > Clean and rebuild your project. Or delete the ‘Debug’ folder in your project and do a rebuild. I hope this helps. It helped 🙂 Thank You VERY much 🙂 Erich, Probably last one question/problem 😉 While runing the debug process I’m getting connection fault. I have my kl25z on port com3, but in connection settings (OpenSDA Embedded Debug – USB choosed) there is no device detected. This way I can’t perform full debug process. I’ve reinstall usb drivers from P&E. When I connect the board to SDA port mbed drive shows up. if there is no device shown, this means that P&E has not found the drivers. Maybe a dumb question: have you loaded the P&E firmware on the board already (bootloader of the K20/OpenSDA)? My bad, I’ve forgot about draging the updated app after updateing the bootloader… so far so good, but still it’ not perfect – i’ve set the communication options in freemaster, but i get a communication error : could not open the communication port… OK, silly misteake – wrong com port. the fault is : could not detect the board information. the comunication will be paused So it is working now? No 😦 When I check communication options in freemaster it detects board on com4 (baudrate is set correct) but when I try to connect it pop up’s an error : could not open the communication port… have no idea how to move it… OK! it works now. problem was (I think so), that after debuging and opening the freemaster I should first connect and then hit run in debuger. Erich I know I look stupid but I really need Your help. Everything seems to work fine. I get the x y z values from my acc, I read those values in freemaster but I always get the XYZ values in DEC (i.e. XX,000 where only “XX” changes). I tried to change every settings in freemaster but nothing helps. But thats not all. Can You please tell me how to transform those readings from ACC to any readable form? I mean how to change them to “g” units or even better to “m/s2” or “mm/s2”? Right now I’m just checking values for each axis in still position and multiplying them by 9,81 (m/s2) but I doubt it’s a good idea… Mabey there is another way to get valuest form ACC in a readeable form? I suggest that you make the conversion e.g. to m/s2 on the target and store it a global variable, then read that variable(s) with FreeMaster. As for decimal->hex conversion: I did not need that, so I don’t know 😦 OK I’ll try 🙂 As I see, there is an option to change the readings to mg and from this I can transform it to m/s2. Or mabey You know an easyer way to convert the RawXYZ to m/s2? I don’t know an easier way 😦 Hi Erich, I tried to install FreeMASTER 2.0 using CodeWarrior 10.6 and KL25Z with OpenSDA, but unable to do so. Could you please help and advise the procedures/links where I re-install the FreeMASTER 2.0 for use with OpenSDA. Thank you very much for your help. Best Regards Hoe Min Hi Hoe Min, I have used FreeMaster V1.3 and V1.4 sucessfully, and have not seen a reason to upgrade to v2.0. So I don’t know what problems you are facing? I think the previous versions are still available and you could check if the v1.4 or v1.3 works for you? I hope this helps, Erich Erich, Thanks for your quick response. This is the first time I use FreeMASTER, I just picked the latest version. I will delete v2.0 and install v1.4. I presume there are instructions on v1.4 to do the setting to use OpenSDA, otherwise please advise. Thanks. Hoe Min Hi Hoe Min, this article used V1.3 with OpenSDA and I had not seen any issues. Erich Erich, Thanks for your message. Sorry to troubling you again. I have uninstalled FreeMASTER 2.0 and installed FreeMASTER 1.4. I am connecting a NXP KY82/100 Temperature Sensor Pin 1, 2 and 3 directly to KL25Z Pin 12 (Ground), Pin 8 (3.3V) and Pin 2 (PTB0 (Signal) respectively using CodeWarrior 10.6 without Processor Expert. The idea is to capture the temperature profile and display on FreeMASTER 1.4 graphically. The codes written on C were fine, but just cannot get the FreeMASTER 1.4 to display the temperature profile yet because I have trouble in understand what setting need to be done on FreeMASTER 1.4 to get it working. I was not able to follow the procedures stated in your article because it was written with Process Expert. Could you please provide me with the instructions how to configure the settings of the FreeMASTER 1.4 to capture and display the data. Thank you very much for your help. Best Regards Hoe Min Hi Hoe Min, I have used FreeMaster only with Processor Expert, as this works fine and was very easy and simple to set up. Erich How to make FREEMASTER communication via CAN microcontroller and MC9S12XEP100 The Freemaster documentation includes information how to use a generic transport protocol, including CAN. Pingback: Plataforma Freemaster de NXP | Leonardo Moreno Urbieta Enjoyed the article. Was hoping you might help me with a problem I am having. I receive the following warning: Description Resource Path Location Type Warning: Please call Inhr1_Poll() function regularly and process the FreeMASTER communication (typically in main loop of your application). Pix_4000_Test Inhr1 Processor Expert Problem I am hoping that you can tell me how to fix this problem. Hi John, this is more of an information message. It informs you that you have to call the Poll() function in a frequent way, otherwise the FreeMaster communication will not work. Erich I thought that was the case and I put a call in the main loop but I still receive the error. it should not be an error, but a warning only (you can ignore). Pingback: What is “Realtime Debugging”? | MCU on Eclipse hi,Erich! thanks for your sharing,it is a great job!I’m a newer in FreeMaster, I have a question: how can I connect the FreeMaster with the MC9S12XEP100 by TBDML? My TBDML——HW Ver:2.0,SW Ver:4.6,DLL Ver:4.6,GDI DLL Ver:v1.7 As long as you get some kind of communication (UART, …), this should be possible to use the UART FreeMaster layers. But I have not used TBDML, so I cannot comment on that specifically. Erich, as usual, your tutorials are amazing! I was able to make this run in the FRDM-KL02 using CodeWarrior and ProcessorExpert. However, I am trying to do the same thing in Kinetis Studio for the FRDM-KL03, but when configuring the Pins/Signals, the following message appears just by Transmitter modulation: “Problem in the component: property model is not supported by the selected processor – LPUART0_TransmitterModulation (Transmitter Modulation)”. I try to enable and disable this option (according to my experience with KL02 it should be disabled), but the problem continues to appear. This creates 2 errors in the debugger. – Error in the inherited component settings (Init_UART) Processor Expert Problem – Problem in the component: property model is not supported by the selected processor: LPUART0_TransmitterModulation (Transmitter modulation) Processor Expert Problem Have you ever faced this problem? Do you have an idea on how to solve it? I tried to create a new project in Kinetis Studio based on the project for Freemaster that I generated for the KL02 in CodeWarrior, replacing several code lines between the UART code of the KL02 and the LPUART on the KL03, but I still haven’t been able to make the code run succesfully with Freemaster. Do you have any suggestion? It is very annoying that CodeWarrior doesn’t support the KL03 Processor Expert. Thanks, Andy Hi Andy, I don’t remember I saw something like this. I have not used FreeMaster for a while because the Segger RTT and Segger Scope is providing me similar functionality with less overhead on the device. Again, I have to create a project myself with KDS and the KL03Z, just give me some time. Erich Hi Andy, I think I see now your problem. The issue is that Processor Expert does support the KL03Z only with the SDK components. But the FreeMaster component is not compatible with the SDK components (I think the FreeMaster development has been stopped at that time. So support as for the FRDM-KL25Z or KL02Z is not possible the same way, and NXP stopped further development of Processor Expert :-(. The only way I see would be to move the source files over from the KL02Z project to the KL03Z and port them to the UART. For sure not something which can be done in a few hours 😦 Erich, thanks for your fast and insight reply. I will try to finish moving the source files, but I guess it can be more time lost that what it will really benefit me in my application. Thanks anyway! 🙂 Have you tried another scope with KL03Z? Hi Andy, yes, I’m using the Segger J-Scope (): it is free of charge and simply works. Yes, less features than the FreeMASTER, but has all what I need. Super! I’ll check it out. Thanks, and keep the excellent work in this site 🙂 Hi eric, I wanted to run Freemaster as a FreeRTOS task, because in my application i have delay’s and is causing freemaster not to work. My questions is: Do i just create a task which has contains: FMSTR1_Recorder(); FMSTR1_Poll(); functions in the task ? Do i need to anaything else for the Freemaster to work under FreeRTOS? Thank You Your approach sounds correct to me, I would do the same. Thanks Eric. I just tried It and it worked !!!!! Hi Erich, I´m trying to make a new baremetal project using Freemaster (I´m new with this) for FRDM-KL25Z board and I found this one from Tomas Vaverk. The example worked fine for me, but I coudn´t watch it running on Freemaster. I saw the source code but there is no libraries at all on it to communicate with Freemaster, so how the variables are displayed there? I also tryed to run a demo from FreeMASTER_Serial_Communication_Driver_V2.0 I have download at NXP, but some libraries (for example freemaster_example.h) are missing when I build the project thus getting a lot of errors. Can you please help me to solve this problem? thanks in advance. FreeMaster is able to connect to the target over the debug probe too (see the communication drivers section in FreeMaster). But instead of using FreeMaster, you might use other ways to show your data which might be a better approach: if using MCUXpresso IDE, there is a way to directly watch the data in the debugger, see section “Global Variables Graph with LinkServer Connection” if using a LinkServer debug connection. Or if you are using a Segger J-Link connection, see Hi Erich, thanks for your response. Well, in fact FRDM-KL25Z board was only for testing purposes and the target is a custom board of mine with uses the SKEAZ128MLK4 (KEA128 family). This board has a working RS232 (thru PTC6 and PTC7 pins), I´m debugging with S32 IDE and I have installed the Freemaster SDKs for this project. The major problem here is that there is no way to connect to the board and show the variables on Freemaster. I already checked the baud rate, called FMSTR_Init(); and FMSTR_Poll(); in my source code but with no results. Even in community I didn´t find any reasonable doc explaining how to make Freemaster work when it doesn´t communicate with a board. Can you help me on that? Hi Marcio, so I assume your setup works with the FRDM-KL25Z, right? What I would try is the following: a) check with a logic analyzer/scope if there is any communication on the PTC6 and PTC7 b) halt the target in the debugger inside the FreeMaster code to see what might be blocking? The later could be difficult as some portion of it are only delivered as a library. Using an osciloscope I can see that it is receiving some pulses thru RS232 (Rx line), but it is not transmitting (Tx line) at the boards side. On debug everything seems to be working fine and the code doesn´t halt anywhere, this is weird : S I have written the following code to test out FreeMaster. Was it suppose to work this way? uint8_t test_variable; int main(void) { __disable_irq(); /* global disable IRQs */ /// Clock initialization ICS_C1 |= ICS_C1_IRCLKEN_MASK; /* Enable the internal reference clock*/ ICS_C3 = 0x90; /* Reference clock frequency = 31.25 kHz*/ while ( !(ICS_S & ICS_S_LOCK_MASK) ); /* Wait for PLL lock, now running at 40 MHz (1024*39.0625 kHz) */ ICS_C2 |= ICS_C2_BDIV( 1 ); /*BDIV=2, Bus clock = 20 MHz*/ //ICS_S |= ICS_S_LOCK_MASK; /* Clear Loss of lock sticky bit */ SIM_SCGC |= SIM_SCGC_UART1_MASK; // Enable bus clock in UART1 UART1_C2 = 0; UART1_BDH = 0; // One stop bit UART1_BDL = 33; // Baud rate at 38400 UART1_C1 = 0; // No parity enable,8 bit format UART1_C2 = UART_C2_TE_MASK | UART_C2_RE_MASK| UART_C2_RIE_MASK; // Enable Transmitter, Receiver and Receiver interrupts NVIC_EnableIRQ(UART1_IRQn); /* Enable UART1 interrupt */ FMSTR_Init(); __enable_irq(); /* global enable IRQs */ while(1) { test_variable++; FMSTR_Poll(); } } I don’t see a call to the recorder functionality? And is UART1 really what your Freemaster is using for communication? Yes, I just called FMSTR_Recorder(); right before FMSTR_Poll(); but it didn´t change anything (still not communicating). And yes it is UART1 I´m using for communication, I have changed the FMSTR_SCI_BASE at freemaster_cfg.h file, 0x4006B000UL should be the UART1 address as I check at its reference manual: /***************************************************************************** * Select communication interface (SCI/FlexCAN base address) ******************************************************************************/ #define FMSTR_SCI_BASE 0x4006B000UL /* UART1 registers base address on KEA */ #define FMSTR_CAN_BASE 0x40024000UL /* FlexCAN0 base on MPC5604B/P */ Not sure what else it could be. I cannot try things out as I don’t have your hardware. I think something is missing. Did you reach out in the NXP forums already? Otherwise you have to single step through the Freemaster code to get an idea what is not working. I understand. The thing is with the FRDM-KL25Z I couldn´t communicate with Freemaster either, so it could be something simple I´m not seeing right now. To make things easier, how about to start a example project for FRDM-KL25Z using PEx and Freemaster component in KDS? I´d be very happy if I´ll be able to watch a simple variable reading at Freemaster. Can you send me this demo project? I have pushed a project here: Yes, your demo worked here so the problem still remains at my project. The UART1 or SCI1 is working fine as I have tested using hyperterminal to transmitt and receive data and changing the baud rate doesn´t make any difference. I started an empty project on KDS with PEx and Freemaster component only. The variable “contador” is the one I want to watch and below it folows my code: byte contador = 0; int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON’T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ // FMSTR_Init(); for(;;) { contador++; FMSTR1_Recorder(); FMSTR1_Poll(); } /***!!! ***/ Here I´m facing a new problem: when I try to connect to Freemaster using the Stop icon I got a PE_DEBUGHALT(); (!?) /* ** =================================================================== ** Method : UnhandledInterrupt (component SKEAZ128LK4) ** ** Description : ** This ISR services the unhandled common interrupt. ** This method is internal. It is used by Processor Expert only. ** =================================================================== */ PE_ISR(UnhandledInterrupt); PE_ISR(UnhandledInterrupt) { PE_DEBUGHALT(); } I suggest that you use my application code (application.c) for the polling and handling? Solved! I have inicialized the UART1 (on my S9KEAZ128AVLH board) with no interrupts and did the same at freemaster_cfg.h: /****************************************************************************** * Select interrupt or poll-driven serial communication ******************************************************************************/ #define FMSTR_LONG_INTR 0 /* Complete message processing in interrupt */ #define FMSTR_SHORT_INTR 0 /* SCI FIFO-queuing done in interrupt */ #define FMSTR_POLL_DRIVEN 1 /* No interrupt needed, polling only */ So, I think the problem is when we use interrupts with Freemaster. Erich, in fact AN4752 tell us to assign FMSTR_Isr() to the UART1 (my case) interrupt vector on kinetis_sysinit.c file, but it was not generated here. Do you know what is the file and where I can do this? (tIsrFunc) FMSTR_Isr, /* 67 (0x0000010C) (prior: -) UART 3 status sources */ (tIsrFunc) FMSTR_Isr, /* 68 (0x00000110) (prior: -) UART 3 error sources */
https://mcuoneclipse.com/2013/08/24/tutorial-freemaster-visualization-and-run-time-debugging/?like_comment=18013&_wpnonce=9334ba59ff
CC-MAIN-2019-47
refinedweb
11,613
71.85
There?. … ality.html The obvious drive is find content that is comprehensive and insightful. In-depth articles on professionally edited sites with big brand names are going to be favored. Doesn't work. Google propaganda. I create some of the most authoritative articles around, and some of them got "panda-ized," despite being the most authoritative piece on the Internet. What you fail to understand is that Google is a business and as such, their primary concern is making money for their shareholders and mostly this money comes from selling google adwords advertising. Why would a company use adwords? Because they have trouble getting organic traffic, because wikipedia rules the search results, because google wants adwords buyers, because that is what makes them the money, and SEO companies are competitors of Google. You need to understand that the Internet is going through a consolidation phase that involves the big boys eating the little boys. The best way of combating this is to emulate the big boys - which is hard to do for some and particular given the fact that Google is deliberately targeting certain niches and markets for their own profits. Or - to find the gaps in the wall where there can be no "authority." There is still room in many niches, but don't expect that to include Computer reviews. Remember there have been a couple of other Google changes recently as well. 1. Removal of specific search results from logged-in google users in analytics (all analytics). In some cases, this has resulted in a drop of over 50% of search terms being available. 2. Refusal to be specific with adwords buyers as to search terms used by incoming traffic. Combine this with the recent algo changes and you are looking at massive data loss for many SEO firms. Unless you want to invest $250,000 pa on a premium analytics account? But thanks for the regurgitated advice. You are great at regurgitating stuff. Yes, this. Given the facts that you've stated above, it totally amazes me that people still carry on taking those Google propaganda articles as gospel. Google is really cool! they turned the Internet up side down. It's survival of the fittest Yes, there's a lot of corporate politics going on in the background. Google has become so big that only major legal action from corporate competitiors, or action by the US gov/EU can have any effect on its future direction (and makeup). Google is happy to work with corporations like Amazon, because they don't really encroach on Google's business territory, but there is a ruthlessness towards companies that Google sees as rivals. Sometimes you feel like a pawn in someone else's war. Hey Mark: re your conversation with Will Ar se: "Never try to teach a pig to sing. It is a waste of your time, and it only annoys the pig." Thank you Will for giving us this information. I have never seen it written out in that form. I will take any information that I get and that anyone on the site takes the time to provide. I understand the frustration of those who have lost a great deal of money. Hopefully, things will get better. I do believe that the money from asking questions has helped to some extent. Isn't this what Hub Pages has always emphasized? A lot of people who complain about traffic loss have failed to heed these guidelines. So posting them at regular intervals is no bad thing. So you're saying I, Sally's Trove, AndyOz, Paul Goodman etc etc all write cr@p. Gee thanks. Yes, we're all "HubPages haters" for even daring to suggest that factors outside our control might be at least partially responsible for a loss in traffic, as opposed to just the "wooden" quality of our writing This is why so many people here will never get past the obstacle of Panda. Emotionalism is always so much easier than honest self appraisal. If you want to do well, play the odds. The odds are that Google will get its way. So you fall in line with the quality demands and hope Google really does get its algo right. Or you throw your lot in with the floundering SEO Google gamers. Which do you think is more rational? Will, that is a disgraceful statement. Many of the Hubbers hit by the recent Panda/Penguin updates produce terrific quality work. Look at Marye Audet - are you seriously saying she can't write? She could blow you out of the water. Google likes to claim Panda is all about quality, but at the end of the day,a dumb algorithm cannot judge the quality of anyone's writing accurately. Google can penalize things like spelling, keyword stuffing, excessive advertising, questionable linking etc - not quality. I think the Google list is "aspirational" (or maybe "PR"?) rather than practically achievable for them. They test pages/sites out with humans, then try to identify patterns in the pages/websites that people liked/disliked, but they are still limited by technology - the algo is a complex and a beautiful piece of work, but still a blunt instrument compared with a human brain. Some of my "crap" articles do better than my better quality ones to be honest. I've given up worrying about it and just go with the flow. (I'm a great believer in empiricism). Thanks Will - it does no harm to re-read that occasionally. For my stuff I could be slammed or not slammed by an algo or person. Luck of the draw, for me, I think. I try to give the searcher what they were expecting from their visit, but it's a challenge when spoofing things. I reckon people don't realize how specific some of these guidelines are. Someone recently took a big tumble traffic-wise after including the keyword phrase 'houseplant care' in something like a dozen article titles. Taking note of this could have saved him some pain: 'Does the site have duplicate, overlapping, or redundant articles on the same or similar topics with slightly different keyword variations?' This is one I am trying to fix in my own account: 'Was the article edited well, or does it appear sloppy or hastily produced?' When I am careless I am very careless. Someone is doing a very good job of proof reading all my articles right now. Some of the mistakes are truly horrible, lol. I reckon the most common reason for traffic loss is this one: Does the page provide substantial value when compared to other pages in search results? Too many people are writing in saturated topics. You can't produce a page titled 'removing red wine stains' and expect a good result anymore. Getting someone from oDesk or other similar sites to write content for you, and get it published, is not going to bring any good when it comes to search engine traffic. Reason is this, those guys at odesk are mass producing those content to different clients, all they'll do is just adjusting the same content to make it looks original. And which google will quickly penalized. Hey you forgot one! How does the copy sound when you read it out loud? How could the dumb googlebot possibly assess all that stuff. Sorry I don't believe it. None of its assessed. Its just general advice. I don't think it isn't just about quality writing that should be the focus. Step into the shoes of the advertiser, that 'G' has attracted. Now, what does 'G' have to offer for delivering advertisements ? If our writing lands in a good category, and there's amazing traffic, then a deal is successful. It's that area where we fall in and HP itself provides the platform, therefore a good partner. We, the writers, just got to deliver. Least, that's how I'm imagining how it works but I could be wrong I would have to agree with you Dame Scribe. I admit whole-heartedly that I am not an accomplished writer by far compared to you and others who have written amazing work. But I do think of how I would feel as the consumer who would look at an article and ask the important question, does this article deliver what I am looking for? Can I trust it? How does it apply to me? "G" has to offer the advertiser and consumer a quality AND a needed subject. HP has offered us a great way to perfect our writing skills, use our imaginations, and make money as well. We need to exercise our talents and keep writing! Afterall, we are doing what we love, right? Has anyone tried the free $100 worth of advertising that Google offers? I tried it for my website and got so little traffic for that amount that if it was cash out of my pocket, it would have made me feel a sick. Facebook has become a huge competitor to Google for both ads and traffic. Google is grabbing at straws to get back to where they were. They'll try many things before it is all finished. Hopefully that means a return to Hubpage traffic. And here was I thinking I was the only lucky one! Actually for me, it was $75. I think there's a real learning curve to using Adwords effectively, so I'm not sure if the lack of result was really lack of effectiveness or my inexperience. I'm just on my last $7 so will be turning it all off tomorrow. A listing of changes to the Google Algorithm in April from Matt Cutts. (Google Engineer) Search Quality Highlights 53 Changes There's some good stuff there No freshness boost for low-quality content. [launch codename “NoRot”, project codename “Freshness”] We have modified a classifier we use to promote fresh content to exclude fresh content identified as particularly low-quality. ===> sounds like they are targeting generic brands. Just another little point from Amit Sighal: "Writing an algorithm to assess page or site quality... (rather than writing the wish list, quoted)... is a much harder task, but we hope the questions above give some insight into how we try to write algorithms that distinguish higher-quality sites from lower-quality sites." For those who want to keep their accounts safe, this list is worth taking on-board. TRY is the operative word here - notice they admit assessing page quality is a "much harder task". Yes, Marisa. Try. Harder. These are all important words. The fact is though, the criteria in Singhals wish list is the criteria that they are writing the algorithms to. If you want to game the algo, take note of the list. Or just write good stuff. And before we go back to what is good and bad... My view is you let the reader decide and many other people now believe that Google makes some use of user metrics. So keep an eye on view duration. If readers spend plenty of time on a page it is probably good enough and Google will decide the same thing. Who said anything about gaming the algo? You seem to think I'm some kind of black hatter. Do you really think I'd be writing about dance if I was out to make money at all costs? Of course we should all be trying to write quality, that's a given. I'm objecting to your clear implication - that if you've been hit by Panda, you must be writing poor quality rubbish. And if people like Marye Audet and Sally's Trove are not deeply insulted by that, then they should be, because they do NOT write rubbish. I don't think I write rubbish either. My guess would be that they can make a stab at guessing 'bad' content more easily than 'good'. Keyword stuffing, dodgy linking - that kind of thing. I'm not saying anyone does that, etc., blah blah. They also may be taking notice of the neighborhood. So those links that HP put on our pages to others people's content... I don't really like that. No control. I notice with amusement but not much surprise that many people on this thread have ignored Mark's post about Google propaganda, and are taking said propaganda literally, as if it actually means something real. (This is strikingly similar to what goes on in the political forums.) I have a nice drink that you all might be interested in... would you like to join my cult? There is a grain of truth in what Mark says. We are only going to pick up the crumbs here. This site will never have the authority of the big specialized blogs. But if you can spot the gaps left by the big boys, you can still make money. As long as you don't blow it by coming across as a spammer. Or being a spammer. That list gives you most of the clues you need to avoid that fate. Regurgitating what Mark said now huh? That list you posted is a list of reasons not to write here. That is the problem with simply regurgitating things you don't understand and have not tested. Bit like writing product reviews of products you have never touched. I am concerned with Hubpages and how to do well here. You are not, apparently. According to your own reports, you are a heavy hitter who is here to chat to your friends. Nothing wrong with that, of course. Frankly, what I see is someone who spins all his thoughts through a self pitying 'its the big guy beating on the little guy' distortion machine. So Google becomes evil for preferring a well established blog or site with editorial staff, solid writers who can be fired for messing up and codes of practice that ensure their stuff is reliable. And we go-it-aloners are the sad victims of Google's discrimination. Not really. As I have said dozens of times, if you can learn to use Hubpages for what is it good at, you can still make money. Just avoid the grandiose delusions and focus on the realities. Sorry you didn't understand. Give out some more regurgitated advice. Please. What makes you think I don't still make money here? Producing webspam such as you produce is not likely to make you any real money, and I would prefer it of you stopped lying about me. I never said anything about being a heavy hitter. I am here to chat though. Sorry it bothers you that I understand more than you do because regurgitating wot google sed and producing nothing but webspam is not convincing me you have the best interests of this site our your fellow hubbers in mind. You just seem to want to be another guruwanker. Clearly your articles go against the list you just posted, and - honestly - I think spammers such as yourself are part of the problem this site is currently facing. Now - don't go getting all emotional. It is not your fault you cannot afford to buy the products you lie about testing. Neither is your poor command of English. But - I am sure now you are paying $3 an article to have your "work," edited, your fortunes will turn around. But - hub hating and giving a list of reasons not to write here and then claiming to be concerned with hubpages don't gel together. Self pitying? Yes - that about sums you up. Write a few more "5 best amazon wotsits" and then tell us how little traffic you are getting. And then regurgitate some more advice you have not understood. Frankly all I see is a little man incapable of understanding the new reality and having trouble adapting. But thanks for regurgitating what I said. At least that is useful advice. Honestly - I know what I am talking about, and attacking what I say because you don't understand it is not doing yourself or your fellow hubbers any good at all. Will, Apart from blogger.com, wordpress.com and blogspot.com there is no 'big specialized blogs' ranked higher than HubPages at the moment. Even if one loosely looks at Quantcast. And forums unless it is is a forum on a site I have a lot of faith and trust in regards to SEO. I will never look at forums on HubPages for SEO information. Too many so called 'experts'. On a final note, search engines help , but they are not the ONLY source of traffic. If you think you can outrank CNET, Mashable, Gizmodo or ZDNet in tech with a Hubpage, please go ahead and try. The same story with the big fashion blogs etc. Hubpages is a Web 2.0 content farm and ranks as well as any other Web 2.0 content farm but that is all. Weird. I outrank Mashable and ZDNet and am 3rd after CNET and Gizmodo for a tech hubpage. And you are saying this is impossible? Odd. You obviouslyknow some stuff I don't know. What is your secret? Other than the self pity thing? Probably getting persecuted as well huh? And you say you are not religious.... Will, I don't understand your continued undervaluing of this site. You seem convinced that HubPages is a content farm and thats it, no other function outside of that. You also seem to believe that people are operating instead a specified box of operation (writing content, particular SEO) and are unable to expand, deviate or thrive outside of that box. You also seem to persist with a difference of opinion and argument when its been made clear you are often incorrect yet choose not to indulge otherwise. Even if I am wrong about this Will, I still do not understand your basis for these understandings. Jase, Will is talking about large blogs, not large blogging platforms. So is Mark. And Will is right in this case - it's becoming increasingly difficult to outrank the big, established websites and blogs on most subjects. Google has been favouring "authority sites" for some time (an authority site is a substantial website or blog which offers expertise in a particular field). Although HubPages is a substantial website, it can never be an authority site because it doesn't specialize in any one topic. That's why some people were saying the sub-domains should've been topic-based, not author-based, after Panda - so each sub-domain stood a chance of being seen as an authority site. However, up till now HubPages seems to have bucked the trend, and some Hubbers are still getting good traffic in spite of writing on a variety of subjects. I think that may be changing now,though, as Google continues to "refine" Panda. I notice, for instance, that when I Google a health topic, the top results are always from the big medical sites, even though they may be less relevant than some of the results from smaller sites which appear further down the SERPS. Playing Devil's Advocate. From Google's point of view, a big medical or health organization has more to lose by providing incorrect information than an anonymous writer on a free writing platform. Let's give the independent writer the nickname of "Flopsy Bunny". "Flopsy Bunny" might actually be providing more relevant and accurate info in his/her article than the big medical organization, but the safer bet for Google is always to put the big medical organization top of the search results. The thing is, Mark Knowles is an internet expert. He is on a different level to people like me. All I can do is take notice of what Google says, and try to produce content that people search for, and use when they get there. I have no other game plan or skill set. So for me, the list of what Google claims it is interested in - while it may not be the truth - is at least some sort of guide. Hi Mark, thank you for at least replying and giving a credible answer. I am in the same position as you, really. It just annoys me when people seem to really buy into this "Google wants quality" stuff, and spend *hours* examining their own and other people's navel fluff. Hours that could have been spent doing something productive. Which reminds me, I need to put my tomatoes outside so they can harden off. Lol @ tomatoes - that makes a fair point. I am still learning, and I have a lot to learn. For me, revising what I have done, who is visiting, how long they stay, what the competition is, keywords (why didn't I do any research FIRST - doh!) - and, and, and. I do take the Google pronouncements with a pinch of salt, as I do ANY pronouncements on the web on how to play the game. It just all slowly forms a big picture... which may still not work. Oh, and as a relative newbie, I don't really have much history or axes to grind. Plus I don't care too much who agrees with who - it's all part of that larger picture. I think your approach is a good one, Mark. I find the forums debates on here interesting (well, maybe not always, but certainly sometimes). The ego battles can get a little wearisome, however, and I am always impressed by your ability to stay aloof from them - I can feel myself getting sucked into them sometimes... must resist! Thanks Paul. Before I came here I was a forum junkie, always keen to have some fun and banter. I'm here for a reason, and that is to learn to write and make some money - if possible. Selfishly, there is no benefit to me of getting involved, so I try not to. As you say though, it is hard to just stay quiet sometimes. I have been here for 4 months and have had dismal numbers. I also have had great responses from readers, some so good that they have blown me away. I don't understand much of the tech stuff, but I have tried to write original, well structured and informative articles. I have revised plenty, and yet my numbers 3 days ago dropped basically to zero. While I know not all of my articles are great, I've produced 92 of them...can they ALL be THAT bad? So bad that the money has totally stopped, the reading has totally stopped and I'm frozen in time? This is getting tiresome and is very discouraging. It seems to me that making quality content is exactly how we should be spending our time. No argument with that at all - I suppose I should have been a bit clearer. What gets to me is (a) the way that people trustingly believe that what Google's spokespropagandists *say* Google wants is exactly equivalent to what Google *does* want, and (b) the hours they spend talking about it. Google wants profits. That's their main aim. You might be able to help them make a profit by writing quality content, but quality content is not Google's prime raison d'etre, otherwise you wouldn't have complete crap getting to the top of the SERPs as it does at present. You know, I am tired of the same voices coming out with the same old rubbish here - that when we lose traffic it must be because either out writing is poor or because we use suspect SEO techniques. I am so glad I have different subdomains of my own, to make some comparisons. Up until now, we may have thought our poorer hubs were the 'fluff' ones that we may have written, the ones we sat down and wrote in under half an hour, and that our 'good' hubs are the ones we labored over, put the effort into, and ended up with a highly readable article that we can be more or less proud of. But, I am seeing a pattern emerge where fluff hubs are holding up, even on slapped subdomains, where the 'good' hubs are falling. I am seeing 500 word articles take off (on unslapped s.domains) while 2,000 word ones, complete with videos, photos, polls etc, flounder. Maybe too early to tell, but all of this is weird. I think Google's *new improved* algorithm is far worse than the previous version, the one they had before Panda. I don't think it has anything to do with 'quality'. They have been feeding us propaganda. We cannot dance to their tune, unless we want to be constantly editing hubs. I cannot see the 'pattern' in what they want, and I strongly suspect no-one else can, either. I think we should carry on as we are, and eventually everything will settle down as Google shuffle and re-shuffle its own results. And I think we, as in ALL OF US, should be less derogatory towards other hubbers, and show a little less of the "I'm all right, Jack" mentality. As Marisa says, when people like Marye Audet, herself and Sally's Trove get hit, we KNOW writing standards are not being judged. It's something else entirely, and probably to do with the commercial aspect of Google. My mini-subs always do worse that my mother-sub and so its very hard to tell - follow ABBA's advice: On and On and On, Keep in Write'n Baby till the Night is Gone! All that re-writing stuff has no basis in fact, it just wastes time (no body knows) - just write more and more and more - some will succeed, some won't, but enjoy it! Cheers, Y-A-W-N. Where have I heard all this advice before? Oh! It's been already written and published! Excuse me while I return to my writing . . . My personal fave: "Does the article describe both sides of a story?" And here I've been bemoaning the demise of objective journalism. Thank you, almighty Google, for bringing it back. (Ha ha ha ha ha)! "Would you trust the information presented in this article?" Gimme a break. Sigh... Maybe a few people looked at that list and realized how useful it is if you want to avoid Panda. But maybe the whole thing is just a lost cause. A lot of people just want to believe there is nothing more than randomness at work. Should I care? Frankly, I wish I didn't. But there you are. Really? I doubt anyone thinks the effects of Panda or Penguin are down to randomness. Some people think the effects are down to a far-from-perfect algorithm. Others subscribe to theories about Google favouring its corporate mates. Neither theory has anything to do with randomness. *Even bigger sigh* Have you tested it? No - you have not. I have tested it and the list you gave does not work. I have spent the last year testing. You on the other hand - as you do with your "work" here - are simply regurgitating other people's words. Should I care that you are handing out advice that you have not tested and do not understand? Frankly - I wish I didn't, but - there you are. Simple fact is - you don't know how to avoid a Panda mauling - you just seem to want to have your ego stroked. Hubpages don't know how to avoid a Panda mauling. Just look at the quantcast figures. Your constant need to hand out regurgitated information is rather annoying, because if some one did follow your advice - how many hours would they have wasted to discover it does not work? Still - you don't care about that do you? If you had actually tested this list and had some results to share, I could respect you. But - by your own admission - you are only now starting to have your own pages edited. So - you have no results. You are guessing. That list you posted is over a year old. Have you spent the last year testing? No - you have spent the last year pontificating. There is nothing random about the recent changes. I have explained why but you choose to ignore it. *really big sigh* Perhaps you should tell us how someone who has been hit by Panda should react. Should they just give up? Is there a way forward? If so what is it? Also, are there any factors that predispose a site or sub-domain to a Panda mauling? I already posted a list of suggestions that were ignored and buried under your deluge of regurgitated Google propaganda. No, but they may well have to write off a bunch of previously published work - as I have done. Yes. Find gaps the the wall that are not being crushed by the Google machine. Follow the advice I gave on the last thread you started, but editing and bringing "up to quality," stuff that has dropped for no apparent reason is not going to help. Certain niches are now what I consider to be impossible to rank in. As far as HP goes - I would monitor closely the competitions run and take a look at niches they are encouraging people to write about. Look at the pages you have that have not been adversely affected and do more like that. If all your pages have been adversely affected and you consider the quality to be good - try a different approach. I am not certain I have enough data to answer that accurately, but a broad range of niches does not seem to be a good thing unless you bury a money making page within a large amount of non-money makers. Neither does a large amount of product review pages with affiliate links in do very well. If we are staying on topic and talking about Panda... I have been through this whole thread and the only specific points that I can pull out are that you think affiliate links and shallow micro-niche sites are problematic. Hard to disagree there. I don't recall starting a thread in months, apart from this one, so I can't refer back any further. What I was hoping was that you would have some more specific advice for people on Hubpages. Many people get hit here. Do you ever look at their accounts to see if you can see the problem? Last time I gave specific advice, the site immediately filled up with "5 best amazon wotsits" hubs from people such as your self. Not sure I can be more specific, but I will try. Sorry you did not understand the specific instructions I just gave you, so I will repeat some of them and add a few more without spelling it out for you. 1. Don't write product reviews about products you have clearly never touched. 2. Follow HP's advice as to what niches to write in - i.e. - competitions etc. 3. Get into video. I see you already took my advice on that one, so you must remember the thread I told you to do that. It may not have been your own thread, you were just telling us wot google sed on it. 4. Look at what is still working for you and repeat that format/niche/approach. 5. Write off the hubs that have been hard hit that you cannot see a problem with, and do not try and fix them. 6. Avoid certain over-saturated niches which require authority such as medicine, finance, loans etc. 7. Spread yourself out and write in many different places. 8. If you are setting up your own sites, keep the quality high, the niche tight and emulate the bigger sites or appear to be a seller not an affiliate. 9. Look for niches that have no authority that you can still thrive in. I have looked at a lot of accounts. The problem is mostly external - as I already explained and - you then accused me of self pity, so I won't bother trying to explain it to you again. It surprises me Mark that you have just outlined some excellent points worth their weight in gold. I'm surprised as most people should be invoiced for this advice. Mainly posting to bump this post to the end where people will see it - but also, could you expand on why you say (no. 5) there's no point "fixing" Hubs that have been hard hit? My (former) biggest earners are now at the bottom of the pile, so I'm guessing they would fall into that category - it seems like a big step to kiss them bye-bye after they've earned me hundreds of dollars over the past few years! What I actually said was "5. Write off the hubs that have been hard hit that you cannot see a problem with, and do not try and fix them. So - if you cannot see a problem, chances are the issue is external. In that case - go find some high quality incoming links, get a few social bookmarks going, and see if that helps. If you don't know what the problem is - how can you fix it? That is why the list Mr Apse posted is a waste of time. It is too vague, and doesn't go to the core of the problem. The people who are most frustrated are people who produce high quality work and don't see why they have been penalized. In which case - it must be external. You also have to remember that the Internet is not a vacuum. You may have written a piece that hits all the "quality" markers, but - there could be 30 other pieces out there that are "better," than yours. (According to the algo). The list seems like a useful reminder of what hubbers need to focus on. I was maybe hoping for more new ideas that you or others have not covered previously, but that is quite possibly an unrealistic expectation on my behalf. Maybe it's more of a question of diligently employing what we already know, rather looking for a magic wand. That makes absolute sense, thanks Mark. As Paul says, we're all looking for magic solutions but what you've said is more realistic. I think I'm seeing that in my own work. The Hubs (and other stuff elsewhere) which have been hit are on popular subjects like fashion, beauty, fitness etc. They were ranking highly and getting lots of natural backlinks and now they're in the toilet. But let's face it, those fields are heavily targeted by online writers, and there's so much new stuff constantly being churned out, they probably had to fall off their perch sooner or later. Whereas my stuff on dance - which ranks pretty well but makes very little money (because there's no point being #1 if only 3 people are searching for it) hasn't been affected, because it doesn't offer high value keywords or much in the way of affiliate companies, so there's not as much competition. Market saturation is a topic that rarely gets discussed here for some reason, but I have to agree with you Marissa. When I first started writing here some of the topics I wrote on ranked highly and brought in good traffic. But they are and were popular things to write about, and now there are lots more articles on the same subject on HP itself, and thousands of more writing sites and articles out there, making it so much harder to rank them. I definitely think market saturation is an issue on HP, and will continue to be as long as writers continue going for high traffic topics, basically spamming the internet with nothing new or unique. Hubs may be written well, but with all of the competition and saturation, why not focus on something less saturated that may be easier to rank well for. "Is the content mass-produced by or outsourced to a large number of creators, or spread across a large network of sites, so that individual pages or sites don’t get as much attention or care?" This, I believe, is the crux of the problem. "Mass-Produced", "Large number of Creators". I think this is an indictment of Hubpages as a whole, and not of individual hubbers. The majority of hubbers who are commenting on these forums, produce unique, high-quality, informative articles, and don't fall into the categories of abuse shown on that laundry list. However, a large number of poor quality hubs are published every day by people who are not as serious about offering up good content. I think that this is what's bringing down the overall site ratings. What's the solution? I don't know...Maybe there should be a probation period for new hubbers, where everything they produce is reviewed before being published. Not all hubbers or hubs should make the cut. Maybe Hubpages should have separate sites for informative articles and creative writing. Just my 2 cents. I think I am going to try writing on my other account. It's been along time since I used my other account for writing hubs(in fact I barely use it). These Google Algorithms are extremely frustrating to me. Last year in the later months, I was quite happy how I was doing here. However, since that dreadful panda that occurred in feb. 2011, I knew another one would inevitably hit me once again. We can all blame the stupid spammers who end up affecting legit writers!! Too many people sign up to HubPages just to post 1,000,000 articles that are either copied content, spam, or are extremely "self-promoting." Or they are hubs that just focus on keywords and do not have any real information. It's good to have keywords when writing hubs, however, if the article is solely based on getting traffic from the search engines, then it's probably useless to the readers. You need a balance between keywords and information etc.. To anyone still quite new to this site who doesn't know who they should ever listen to for advice here, I highly recommend three hubbers whose information is in a league of its own. These people make their full time living online and are too modest to say it, but they are the 'creme de la creme' and would normally charge for their services elsewhere. Those three members are Mark Knowles, Sunforged (Josh) and Eric Graudins. If they hand out any gems of advice on forums here it is wise to listen and follow it I agree, and would add relache. +1 Assuming my content is good, should I simply give up and republish my articles elsewhere? How long should we wait? Mark has certainly caught the mood on Hubpages. Which is sad for Hubpages. He has moved from a person who was happy to game Google and pretty pleased with Google and himself. To someone who realizes it is now so risky to game Google you might as well not try. Unfortunately, that has added Google to the long list of things that Mark hates (Mark is moved to this emotion easily). The consequence is a not especially rational commentator given to conspiracy theories and lashing out at anybody who offers even mild disagreement. He was wrong last year, repeatedly, saying Google will never punish spammy backlinks etc or get on top of the gamers. And he will continue to be wrong because he cannot think outside his own narrow interests. Google isn't rewarding him anymore, so Google is broken. Anyway. I can honestly say I have only seen 2 accounts hit by Panda here that obviously had not violated the guidelines in that list. Those accounts bounced back, fortunately. Bear in mind, it is not the number of good pages you have it is the number of bad pages. Plenty of people hit by Panda have a lot of great pages but persist in keeping pages that press all the spam buttons. So they get hit. As a further note, Mark's style is so unpleasant I will not be getting involved in any further attempt to have a civil discourse. This sort of emotional outburst is typical of the mood Mr Apse brings to hubpages. People with no real knowledge or understanding pushing advice they do not understand and have not tested. I don't hate Google so I wish he would stop lying about me. I know he doesn't understand what I said, and do not understand the reasons I said them, but - I suspect he will go away and follow my suggestions and has already started to incorporate them into his "advice." He was happy to game google with faux product reviews, now that has stopped working he fails to understand how to adapt. Rather than see the wisdom in my advice, he prefers to rant and rave about other people's quality and does not understand that these condescending, passive-aggressive attacks on others are the reason I adopt a certain tone with him. I will not bother responding any further to these types of threads unless I see Mr Apse giving out more poor advice which he has not tested. I never said Google will never punish spammy backlinks, but Mr Aspe prefers to lie in order to look like he knows what he is talking about when he doesn't. Sadly, these sort of backhanded personal attacks are typical. Peopel tend to be far, far braver when there is no likelihood of meeting the other person. See religion and politics forums. As usual - all these sort of diatribes from Mr Aspe do, is detract from the actual good advice given out, and suggest trolling rather than a genuine interest. In that case, please do post a couple of examples of which of my Hubs violate the guidelines, I'm always interested to learn. He is making it up. Go take a look at the success stories page and click the "keep reading" buttons. Then you will see the traffic graphs of some writers I consider to not be breaking his mythical guidelines. Seriously - on top of those, I have access to about a dozen other accounts analytics, plus I can extrapolate all my referrals and the referrals of those dozen accounts. He is full of it. I think he got religion. Have you been hit by Panda? Or are you seeing a steady slide in views which is probably something else? I was hit by Panda. Overnight loss of 75% of traffic. Well, I am sorry to hear that. You know all the usual advice. Try deleting all the poorly performing pages of any age. Make sure you have no amazon ads that are not absolutely relevant to the content. Check that all links are relevant to visitors(including within your own sub domain). I would especially check that one Most of the points in the list that I pointed out will be represented in your data: Is the page detailed, insightful offering something more than other pages? etc etc is something you don't need to make any judgement on yourself. The views you get and the time spent on the page are the judgements that have already been made. By readers and search engines alike. So you know where the weak pages are. Best of luck. Assuming it is Panda, a lot of people bounce back. Actually, from what I read, an awful lot of people never bounce back from Panda. In fact it's so hard to do, the standard advice (if you have your own blog) is just to transfer all your content to a new domain and start again. My experience has been weird, but almost exactly parallel with Paul Goodman. I lost nearly all my traffic late last year in a Panda slap. I made a few changes - not what you suggest, though. I changed the layout on all my Hubs to prevent an ad appearing in the top right-hand corner (because Google doesn't like too many ads 'above the fold' now) and unpublished a few Hubs. Then I celebrated, as the recent Panda update brought all my traffic roaring back overnight. Then in early May, it disappeared overnight again. That date in May has never been announced as any kind of update, and I can only assume Google made some kind of minor tweak which undid the benefit I got from the Panda update. My only consolation is that my blogs were not affected. Their traffic is down slightly, but that's because they're not getting referral traffic from HubPages now - plus links from places like HubPages, Wizzley etc have probably been devalued. That's why I don't take your concerns about Amazon ads seriously - every single post on my belly dance site has two Amazon links and three eBay ads in it, and its traffic has actually gone up. I wouldn't give up too quickly. People like Hope Alexander and Max Dalton came back. And you do have a lot of pages that you could try getting rid of that you probably wouldn't miss. Paul Edmonton is advising that experienced hubbers with older hubs that have been hit should hold on and wait, as HubPages may well have identified the problem now. The problem is more likely to relate to a Google glitch, rather than anything to do with the quality of individual hubs or subdomains. Waiting for HubPages and Google to resolve a technical issue would appear to be Melisa's (and my) best course of action IMHO - but I am sure that she is capable of making her own mind up. That might bring some traffic back (we are all praying) but it won't cure the underlying problems so many people have in their content. A lot of the pages I see in Panda hit accounts are the next best thing to suicidal. Then people fall into some kind of fatalistic trance and don't even think about dealing with the issues. Izzy, for example, still has 2 pages trying to sell UGG boots! And things like 'buy a cuckoo clock online'. 'Buy a greenhouse online' etc etc This is just crazy. Single product review pages were one of the most notable casualties of Panda. The 'buy online' tag is considered deceptive for affiliate pages. And of course, the products Izzy has tried to sell are in some of the most saturated and spammy areas that you could imagine. It is especially sad to see Izzy do this to herself because she is a nice person and has produced a lot of interesting pages. How many other people are determined to take the same route? It may surprise you to know that I agree with you on this. One of the items in the list you quoted was: "Are the topics driven by genuine interests of readers of the site, or does the site generate content by attempting to guess what might rank well in search engines?" It would be interesting to know how Google are judging that - but we know they've identified certain subjects as being associated with spam, so one easy measure would be the number of such subjects in a sub-domain. That could mean even people who've written serious Hubs on those subjects would be in trouble. I also agree with you about the "Buy...Online" wording. Every affiliate marketer was being told that was THE headline to use - along with using their keyword in the URL, title, every heading and sub-heading and photo caption (not really something you'd do naturally). If Google wasn't aware of those practices - which they could've discovered by sending staff to frequent any affiliate forum - they're dumber than I thought! You're doing something weird when you post, Trois Chenes, because your posts always end up inside quotes, as if you're quoting yourself! You've doubled up on the "quote" formatting - are you manually adding extra ones yourself? You don't have to. I'm not sure what Will has against Ugg boots, or even against selling one particular product. I think he's just using that Hub as an example of how not to do it (in his opinion) under the new Google guidelines. Although he and I often disagree (as you may have noticed), we're probably in agreement on this one. First, it has the "Buy .... Online" title (which some people say is being penalized now). Second, it has a high keyword density (7% to 8% for Ugg and boots) but not a lot of meaningful information. That type of Hub (or lens) was hugely successful pre-Panda, but seems to be on the nose with Google now. And the trouble is, Panda will penalize your whole sub-domain if you have even a few Hubs Google doesn't like. That is interesting. When you say Squidoo, who exactly do you mean? Is it someone on the staff? It's like HubPages, but with a giant squid: yes Deleted That advice is sort of custom made for your account, Les Trois Chenes. 'If your lens is about garden gnomes don’t include sprinklers' Everything on a page should be relevant to a searchers interests. Painting courses stand out on plumbing page and so on. This is not about single product reviews, it is about relevance. You might be right. I don't especially like writing "Buy..Online" as I think such titles are crass, but they did work! 'Did' being the operative word, of course. About a fifth of my hubs have the same title. I tried changing a few, but it made no difference at all. It's not as if Google hates them completely, as they do still work on some topics, but maybe I have too many and have pushed my own subdomain over the edge. The other hubbers who have lost traffic for as long as me did not have such titles so it's not that alone. I think I may have figured out what is wrong, but I need to make many changes and then wait until the next Panda run to test out my theories. That's the whole point, really. The advice did work, far too well - once everyone started using that title, using keywords in a particular pattern etc, Google realized what was happening and reacted against it. You're unlucky you didn't catch the wave earlier! Well, as you know, Panda will give a lower score to your whole domain if you have even a few "bad apples", so you'd have to change the lot before you'd know whether it made any difference. Good luck - let us know if you come to any conclusions! 'The other hubbers who have lost traffic for as long as me did not have such titles so it's not that alone.' Panda will pick up on anything spammy. There are a lot of things that can look spammy or be spammy. It doesn't have to be 'buy online' single topic review pages. Other people will have sunk for other reasons. Over-saturated topics, short pages with little content, etc etc That will be why Yahoo Answers have risen to the top of many searches? It is important to remember that Google can't read, and look at other factors. You have so many reasons for not trying to get out from under Panda. How about finding a reason for trying? Don't you think that your genuinely wonderful pages deserve some readers? Perhaps it might be helpful to look at overall trends. The trend seems to be for the very top search results to consist more and more of "big" sites like Yahoo Answers and Wikipedia. Plus, in the case of items for sale, retail sites - most notably Amazon but also any site that specialises in whatever item is being searched for. That cuckoo clock example that Sunforged gave was a case in point - most of the top twenty hits were online cuckoo clock shops from various countries. It was only at position no. 19 that you got a content farm result (a HubPages "Buy a cuckoo clock online" hub). So you have two things going on here: 1. For all types of search query, the bigger sites are becoming more dominant. 2. For retail-based searches, sites that actually sell the item are becoming more prominent, at the expense of content farm articles. This surely must be why so many of us are experiencing a gradual decline in views. Even if we haven't been completely sandboxed or "Pandalised", our hubs are gradually slipping down the SERPs because more and more, the top spots are being taken over by "big name" sites. Again, this is an overall trend rather than a hard and fast rule, but it surely must account for the general reduction in traffic here. I think this trend is going to get stronger, and more and more people with blogs and small niche sites are going to find that they have to buy Adwords in order to get traffic. Result? More income for Google, of course! Perfect post, Empress. I think a lot of hubbers are spending too much time trying to figure out what they did wrong, when it could just be a case of other sites doing the right things better or simply having different credentials. Google is determined to cut out the middleman, so to speak -- particularly in the retail arena. If you're going to write about broad diabetes topics, for example, expect to be outranked by Joslin, Mayo, NYU, NIH, etc. There's probably very little you can do about it right now. If you're going to write about fleece jackets, expect to be outranked by NorthFace and Amazon. A lot of my hubs have lost their #1 spot in Google, and rightfully so, TBH. I'm simply resetting my sights on certain topics/keywords to get to the first page rather than the first position in the SERPs -- at least until there's been a lot more testing done post-Penguin/Panda by knowledgeable people. Once that dust has settled, then we can all move forward with a bit more clarity. Thank you It just seems like common sense, really. That's why all this obsessing about the minute tweaking of hubs is bollocks. The problem lies deeper. We might have to face up to the fact that long-term, the "write content, stick loads of Adsense and affiliate links on it and rake in the cash" model might ultimately be doomed. Or at least a lot harder to achieve. ..... 'I think a lot of hubbers are spending too much time trying to figure out what they did wrong, when it could just be a case of other sites doing the right things better or simply having different credentials.'.... Content farms have certainly lost out to pro sites but there is plenty of room for people with a good eye for the gaps left by the big boys. First things first, though. You have to know how to avoid Panda before you have any kind of chance. And, as far as I am concerned, we have more than enough data to know what Panda is about. It is about any content on a site that rates as spam in the eyes of the algorithm. Frankly, if you get hit, take that as a sign you need to take some action and change your ways. Penguin, I will worry about as the info comes out. If I had a site with, say, 100 organic backlinks that boosted me in the SERPs and 50 of those linking sites got hit by Panda, chances are that my site will lose its ranking despite the fact that I've done nothing wrong. So if by "taking some action" and "changing your ways" you mean building some quality backlinks using varied anchor text to regain my rankings, then I agree with you. There is a huge difference between getting hit by Panda and losing views for the kinds of reasons you are talking about. A Panda hit is a site wide ranking factor demerit that will cost you up to 90 per cent of your views overnight. It is handed down by the Panda algorithm that is run periodically to detect thin or spammy content. It follows a surge in views and is unmistakable. If you are collateral damage,(affected by other sites being punished)it is impossible to imagine such dramatic declines in a single day. No amount of links, will save you from Panda incidentally. It is looking at content and nothing else. If I'm not mistaken, it was Panda 3.1? or 3.2? or 3.3? (Feb/Mar timeframe) that added something new to the mix in terms of evaluating backlinks. Did you miss that one? And whether it happens in a single day or over the course of a week, and whether it is your site that has been hit or the sites linking to you, the outcome is the same. Let's not get hung up on semantics. It is essential to distinguish between your site being hit and other sites giving you link juice being hit. If you don't, whatever measures you take will be way off target. I have never heard Google say that links are a factor in Panda but I would be interested in any refs. Sorry, not your beck-and-call girl, Will. I do believe that you are capable of looking the info up all on your own. I'm sort of surprised that you didn't hear about the algorithm update that killed sites like BMR and SEO Nitro? And...when did Wisegeek and Suite 101 start rising from the dead? Must've been fairly recent. Links were a factor in Penguin. However links can also be a factor in Panda. For instance, I have links to my websites from HubPages. When my HP account was doing well, real people were clicking on those links which gave my sites good traffic, and of course the links also counted with Google. Now that my HP account has dropped out of the SERPS, I've lost all that referral traffic to my sites, and the loss of link juice will affect Google's assessment of my sites. So Panda can have an indirect effect as well as a direct effect. However, I'm wondering if Panda is my problem. I posted about a curious discovery here: Exactly, and Google has actually told us that. They are now giving strong preference to "authority sites" - sites that offer a large amount of information on a single subject. Not dilettantes who write all over the place. That's a fact. I've always wondered how some HubPages sub-domains were doing well in spite of that. Greekgeek had a theory that it had to do with HubPages' interlinked structure, whereby even if I wrote only one Hub on hair (for instance), it would be interlinked with hundreds of other Hubbers' articles on hair, which gives an appearance of "authority". Who knows, but (up till recently) it seemed to work. So for me, this thread isn't about finding reasons for a general loss of traffic, which is to be expected - it's trying to work out why some of us have been absolutely crucified while others are going up. Hi Izzy, I changed all my 'buy' and 'online' titles and have tried to weed out words like 'buy' from the text, but it hasn't changed anything, and unfortunately you can't change the url. I have also deleted a lot of these hubs, and posted them elsewhere where they still get traffic? Trouble is, while there is probably some truth in all of the suggestions made, all of us are still speculating really. One hub that I think that the big G should hate is still bringing in some traffic in and has a high hub score, while some other 'worthier' hubs are doing squat diddly Oh crap. Sorry to hear about that, Marisa! This latest panda attack seems to be gradually working its way through hubbers like a flu virus! If I came along and said "Will Apse is an amateur psychologist and wind-up merchant, who likes pushing people's buttons just to get a reaction", you'd probably object, wouldn't you? Here's a suggestion: why not stick to the subject of the thread instead of making these ad hominem attacks. The first post from Mark in this thread (about Panda) bemoans the fact that Google is limiting the search data that SEO companies need to game Google. Is that relevant? I try really hard to actually get him on-topic and address Panda and what triggers a hit. I get a list of tips for getting traffic. Plus the usual jibe about product comparison pages which Mark seems to think do badly now (they don't). I have to wonder if he even understands what Panda is. On top of sneers about regurgitated lists and being an idiot for putting more faith in Amit Singhal (head designer of Google's most important algorithms) and Mark Masters (self described heavy hitter who 'tests things')I have to look at all those idiotic smilies. lol. Enough is enough. I have better things to do. Instead of lying about me to others - please quote me self describing myself as a heavy hitter. Is the only answer to your passive aggressive attacks. I have given some genuine advice here - which you choose to ignore in favor of appearing as though you know what you are talking about. Whether you and I like it or not - hubpages had the lowest number of visitors since last August on the 12th of this month. And that has nothing to do with anything you have posted - or the regurgitated advice that you have not followed. The site as a whole is being hit, for sure. The statistical evidence is overwhelming. Hubbers who write well, who succeed on other sites, and who couldn't be described as being excessively commerical are being hit, as well as the crasser and more commerically-minded ones. The stats aren't the "falling off the edge of a cliff" variety like with the Feb 2011 hit, they generally show a more of a subtle picture of the blood being drained from HP slowly over a period of months. There is a limit to what individual hubbers can do in this scenario, methinks. OK, so what is wrong with this article? (I hope it's ok to post link, have read rules and doesn't say not to - for info and not spamming etc) … horpe-York Was on page 2 of a Google search "Bishopthorpe York", now only appears if you add "HubPages". Not a subject flooded out on internet, not a selling or affiliate lens. Only one little Amazon, only one link (re my painting courses) not about York or Bishopthorpe, think spelling etc ok, reasonable amount of text, own pictures. Too many links? How many pages do you have that mention Les Trois Chenes, link to Les Trois Chenes pages (without any apparent relevance), or to your Les Trois Chenes website? Could Google consider these gateway pages? I don't know without looking at your entire account but the first batch of pages roused a few suspicions. I think it might be a problem. You should try to keep your links relevant or Google's semantic analysis might decide that you are only writing the pages for the sake of the links and that you are a spammer. In fact with 170 pages, it seems inevitable. I looked at just a few of your hubs, and the content is great and the links I saw were perfectly relevant. You blended them in very, very well. Whether there are too many of them from one domain, well, that would be the question, and I don't know the answer. Perhaps you should reach out to someone who knows what he's talking about, like Mark Knowles. He has a page on plumbing. Then an invitation to his Painting Class at Les Trois Chenes. He has a page on fruit. Then an invitation to his Painting Class at Les Trois Chenes. He has a page on the historic city of York. Then an invitation to his Painting Class at Les Trois Chenes. He has a page on stone. Then an invitation to his Painting Class at Les Trois Chenes. I could write this 170 times, apparently. And you don't think this might be a problem? I mean, yes, they are nice pages but that is not the thing the Googlebot will notice. Did you read my response? The part where I started out with: "I looked at just a few of your hubs...." You may have the time to look at 170 of his hubs. I don't. There are two issues here. The first is whether that many links to his site will actually help, and the answer is probably no. Google tends to discard repetitious incoming links from the same domain after a certain number. That could be one or it could be 10 -- I don't know. The second question is whether these links are hurting his HP subdomain. I don't know whether it will from a Google standpoint and neither do you. But HP could call it overly promotional, I suppose, and unpublish the whole lot. No, they won't, because they changed the overly promotional rule to remove that bit. The only limit now is two links per Hub. You can have a link to the same domain on every single Hub if you want, now (provided it's relevant to the Hub of course). I think the this thread has reached its conclusion now? No? This indeed is a very insightful thread from which i must say i am learning a lot, believe it or not. Wow, that's a fall indeed, Marisa sorry to hear that. I don't really have any offers of good advice though maybe try a new social site, one that's related but not competing? just a thought. Marisa, thank you for the compliment to my writing abilities. I think I have a long way to go. I have unpublished the hubs that didn't get traffic or I felt would do better on a blog.. I seem to have stabilized at around 2200 per day on weekdays and 1900 per day on the weekends. Quite a drop from 14000 per day last fall and 9000 per day this past winter. The hubs I have left up have low bounce rates and page view times of 5 minutes or more. Nothing seems to have made a difference so, while it is always a good idea to analyze your work and try to do better of course(!) I wouldn't kick yourself too much about it. Seems to be out of our hands. Good news is that eventually we will have created other sources of income, the hub traffic will come back and we will all have more money that before. Or I like to think so. Have a great day everyone. Also, you know, if you have a lot of hubs on one subject you might want to create short e-books for Lulu or kindle and sell them for 99cents to 2.99 each. Just a thought. "Good news is that eventually we will have created other sources of income, the hub traffic will come back and we will all have more money that before." I certainly hope so, Marye! Something like this is far more likely to be the culprit for many of the traffic losses, rather than what Will is suggesting. … ch-Results (Janderson found it and posted it in another thread) The site as a whole is NOT being hit. My traffic is improving. Each time Panda or Penguin knocks another load backwards, my traffic gets better. So I think you can discount a site wide penalty. To be honest, I hope Google doesn't 'fix it' because then I'm back to being outranked by spam copies of crap again. As for the Mark and Will show. Underneath their opposing angles the same message. GAME OVER. The game, which it took me a while to realise, is that SEO rehashed Wiki and Amazon thing, repeated over and over and over again. The same, or very similar content, on a million pages. So I think they are both right. And Panda and Penguin get my vote. Sorry about that. Look out! The clock is ticking............... Yep, I tempted fate. So be it. Worrying about the algorithm has occupied far too much of my time. Worrying about my content offering would be a better idea. Here Here! Keeping on Writing Baby, till the night is Gone! Its all a dance really. By the way have you seen this Put Your Rage Into a Cartoon and Exit Laughing (we could all do with some of this) … wanted=all "The best way to understand rage comics is to read a couple of dozen of them. The best place to do that is a section of Reddit, known as “f7u12.” (just Google it). Lol. I'm wincing slightly... Mark. Both Marisa and I had a period of raised traffic levels, before we suffered a sudden and inexplicable crash. Just sayin'. The only thing is, Mark, you cannot predict how long the high ride will last... Yesterday, as soon as my HubPages account showed me the money, I have been growing red Christmas trees since. My page views have more than doubled, but my page views are nothing to write home about--compared to the authors who have the years in. But, I did make payout. All this time, I was not slapped by the black and white bear or the bird. I'll be a year on HubPages next month. My only theory is that ignorance is bliss. I don't feel the need to analyze Google or the decisions of HubPages administration because most of it I don't understand in the first place. After my earlier pissing and moaning at the beginning of all this, I decided that I'm not wasting time on what I can't control. Business as usual. I took a break, but now I continue to plan and write my Hubs. Thank you, Mark Knowles, for sharing your excellent tips. I found them very valuable, and have posted them as a daily reminder. Oddly enough, I've been following them all along without knowing it, but I really need to concentrate on #7. Many, many thanks! SOmeone has to rank for "Buy a ______ online" … annel=fflb Looking at the results (my personalized) can show you how things are changing - there is a Hub in the top 20 for my results, sadly not Izzy's though. Ad ad ad ad AD ad ad ad AD YAHOO SHOPPING AMAZON Shopping Results pic pic pic pic pic ____FOLD________ exact match domain exact match domain partial EMD EMD Crap Article Directory with Massive ABove The Fold Ads Fodors Forum EMD Kind of makes a good argument for the "crap listings equal more adwords purchase" argument 200 words or so it looks like! I don't see a single affiliate site there. Am I wrong? I see places where you can actually buy a clock. That is the point. If you say 'buy online' you need to be selling the item. Or at the very least you need to process the order on site. People don't like being shunted around. We must see differently. I see brands, saturation of paid ad and EMD's Two poor results "quality" wise but on aged, popular locations and this gem. It really is a gem: … 10950.html (really! A must read ..) Total keyword madlibbing. I am not saying that the issues you raise are not important but I don't think they are entirely relevant to Panda and Hubpages. The cuckoo palace site looks like a classic example of spun content that has somehow slipped through the full array of Google's spam filters but it is a high risk strategy these days. This was one of the criterions addressed in the Google rater's document that was posted online last fall. Oh....I was trying to find out how to avoid a Panda mauling? no matter, they are nearly extinct anyways! Panda (the collective numbers), Penguin, etc only effect you if your using Google. Nearly 150 base algorithm changes in 5.5 months. By the time "ordinary" folks figure out how-to follow their "guidelines" it will be too late. The Panda-monium is not over, not by a long shot. They have plans for even more changes in the next three months. So, how to avoid a Panda Mauling? Try this: Yahoo, Bing, Blekko, Ask, Amazon/Alexa, Lycos (still one of my favorites)... and many more. In truth, there are over 100 search engines out there to utilize for traffic. For those interested, check the search engine "powers" for google & bing, you would be surprised the options available. James Watched Paul E's vid on the impact of Panda. An interesting overview. … April-2012 I hope he does more. (It looks like opening a new account might be in order if the problems with older hubs being hit can't be resolved soon.) The sites like Wisegeek and Suite 101 coming back from the dead might go some way to explaining the gradual decline in views I have seen recently. One of those graphs (looking at the fate of older content)looks remarkably like mine. The time scale means that it isn't mine but the profile is almost identical. Google's freshness updates look like the prime suspect and regular content updates look like the only possible cure. I'm experimenting with external RSS for a fresh touch! After that video, Paul E wrote a hub in which he says that he now believes that the problem lies with a Google bug, at least with some older accounts. If that's the case, then whatever you do, it won't achieve much. It's not always easy accepting that you might be powerless, but I personally am not going to do anything much for the timebeing on here until they've had an opportunity to get an answer from Google regarding the reported bug. I do not agree about the sub.domain theory. For one thing, nearly 75% of registered Hubbers have 2 - up to 10 - or more accounts. This means of 50,000 authors, only 15,000 are "organic". Of those accounts, a small few then are responsible for trafficking. Second, what is the difference between cdn.hubpages.com and mcsilflicks.hubpages.com? Both are still effected by the parent directory itself. Blogger™ and Wordpress™ do the same thing, essentially using pseudo-classes based on data driven content, hackneyed keywords and synthetic descriptions -like a Yoast™ plugin, versus unique pages. So, either way, the overall crawl and indexing done as hubpages.com is the root. The collective data being retrieved, coupled with "search engines" objective is reason for such fluctuation. James I've never seen that figure - can you clarify where it comes from? So you think that a Blogger blog isn't completely standalone, and Google judges each individual blog by the quality of the entire site? First time I've heard that theory. My understanding is that if you author both the domain and the sub-domains, they are treated as one big sites and links between them are internal. If the domain and the sub-domains are authored by different people, they are treated as separate sites and links between them are external. Would love to have that clarified. From the many, many people I know here and their many, many sock-puppets. If fact, two individuals I have been acquainted with, for almost two years on HP {from my old deleted account and this one} have nearly 30 accounts between them. And further, for the CEO to suggest a Hubber open an additional account, leans my logic further toward that assessment. Blogger™, WordPress™ and HP operate on pseudo-class calls from data driven systems -either by php or ajax. There are no real "pages". Instead includes are used at runtime to pull the data; while permalinks (slugs) and the like are used via sitemap, rss, etc to index. Take special note of the Title Tuner and other tools here and how they resemble Yoast™ plugin, etc. Not necessarily Black Hat, but definitely not White Hat. And again the LARGEST issue is the exclusivity of just one Major Search Engine, when there are considerably equal -if not better- engines out there. but that means the "relationship" between Big G and HP would be strained greatly. and HP being the original test modal for AdSense would make things even more strenuous. As for judging individual sites: No sub.domain on HP, Blogger or WP has a Unique IP {is independent} so long as it is the same server. That would cost them 6 figures -or more- if even permitted. Any dedicated Server is allowed 3 IP per container. Anymore than that, and you have to give very good reason to DNS recording as to why. What you have is a shared IP being used which can be split up @ will by adding folders/sub directories. Like Parked Domains, which point to a specific namespace, yet is still under the same protocol. This makes it "appear" to be unique, but is not, which is why most of these sub.domains are/were effected by the many Panda, Penguin -and will continue to be effected. No one can convince me HP privatized 100,000 user names as sub.domain names or that Big G is indexing each user based on their .hubpages address, unless that user is submitting rss or verification themselves. The domain is indexed together. For WP, the difference is the CMS wrapping/configuration, which often causes issues with indexing, even on a private domain. James Thank you James. Unfortunately I don't have the knowledge to understand much of what you said. I think what you're saying is that sub-domains on Blogger, HP etc are all on the same server (no surprise there), but I'm not seeing the point of that. Google can tell the difference between domains/sub-domains authored by the same person, and domains/sub-domains authored by different people, because they distinguish between them in the way links are handled in Webmaster Tools. So why wouldn't their search engine algorithm make the same differentiation, regardless of the physical connection? After all, it's not in Google interests to say, "We're not going to judge each Blogger blog on its own merits, we're going to allow all the spam bloggers to ruin it for the good bloggers". @James - You've made excellent points and clearly have expert-level knowledge of the nuances of search engines, CMS, and TCP-IP. We also need to consider that this sudden tempest may be the result of a Google bug. Other CMS sites are constrained by the same issues as Hubpages, yet in many cases those other sites are showing up ahead of Hubs that are more relevant to the searched topic. I know that Hubpages is looking into this, so I am content to wait it out. I don't suggest making any drastic changes to hubs in the meantime. +1 I agree, sometimes it's best to do nothing major and let others work on a solution. Individual tinkering can sometimes do more harm than good in this sort of situation methinks. I am glad that we've got so many great "techies" on here! My My, how the advice in this forum has gone full circle. Full circle? I think the opposite is true. Everyone's just stuck to their original positions! :-) The only things that have changed is that Marisa's traffic crashed and Mark K got bored of arguing with Will. @Bill @Paul, Oh gosh, hope I did not come off as an Elitist or anything. Sometimes by technical tongue overlaps my normal self. lol. But given the nature of my business -Web Development- understanding system infrastructure/architecture, engineering, brick-on-brick, is essential to making sites stable, appealing, realistic and beneficial to the many. SEO/M are -for the moment- critical elements that keep these cyber spaces "leased" or "time shared". It has long been projected that SEO/M will fade out -as the masses shift from "Ad" Words {keynote} to "Fore" Words. Interim, everyone waits for the market to bounce back. But if it doesn't, it is not a bad idea to have an exit strategy {alternative measures in place}. James. One thing I like about HubPages is that they handle most of the technical stuff and I can just focus pretty much on writing here (even playing around with basic html can frustrate the hell out of me!). Having said that, HP do seem to be cursed by much more by erratic traffic patterns than most places when Google makes a change to the algo (which is frequently nowadays). @James - I was sincere in my comment that you show expert level knowledge in this area, which is kind of a black-box to most. I am quite impressed by how many hubbers have a firm grasp on the intricacies SEO, and appreciate the sharing of that information. I am happy to report that my hubs are back to normal! Google searches now show my hubs in results again. The test I did that illustrated the problem and later proved the fix is this: View one of your popular hubs. Click on the "Stats" page, then the "Keywords" page. This will show a list of recent searches that led people to your hub. Click on one of the search strings, preferably one with the most hits. This will execute a search. Your hub should be found in the results and hopefully it will be high up on the page. Before the fix, this test failed to find my hubs, now they succeed. I don't know the scope of the problem or the scope of the fix, but I do know that it's working for me. @Bill It could be related to the fix applied see nice little bounce in my traffic No bounces for me, as yet. I hope HP and Google can resolve all their technical and political differences. Well, there will be other algo's coming and I sit in dread unless traffic shows otherwise before happy sets in but awesome discussion Hubbers I'm learning things too. by KiaKitori6 years ago I jus finished rading this article and thought to share it with you : … algorithm/It say that this Panda technology is the foundation of the new internet search, and it is... by Ethan Green4 weeks ago Since I joined HP there has been a constant battle against the rise and fall of traffic. We are often encouraged to tune our titles, edit our content and generally try to improve our Hubs. Now with the threat of having... by Mike Craggs6 years ago From a new post on Google's Webmaster blog: Would you trust the information presented in this article?Is this article written by an expert or enthusiast who knows the topic well, or is it more shallow ShailaSheshadri7 weeks.
http://hubpages.com/community/forum/97584/how-to-avoid-a-panda-mauling
CC-MAIN-2017-26
refinedweb
14,060
72.56
mbsrtowcs - convert a character string to a wide-character string (restartable) #include <wchar.h> size_t mbsrtowcs(wchar_t *restrict dst, const char **restrict src, size_t len,() behaves as if no function defined in this volume of IEEE Std 1003.1-2001 calls mbsrtowcs(). The behavior of this function shall shall return (size_t)-1; the conversion state is undefined. Otherwise, it shall return the number of characters successfully converted, not including the terminating null (if any). The mbsrtowcs() function may fail if: - [EINVAL] - [CX] ps points to an object that contains an invalid conversion statebsrtowcs() prototype is updated for alignment with the ISO/IEC 9899:1999 standard. The [EINVAL] error condition is marked CX.
http://pubs.opengroup.org/onlinepubs/009604599/functions/mbsrtowcs.html
CC-MAIN-2016-22
refinedweb
112
56.35
Agenda See also: IRC log Previous minutes approved <scribe> ACTION: [DONE] Philippe to send an issue to WS-A about a stronger reference to WS-Policy. [recorded in] Paul:Not much to report, we have a f2f next week in Sophia Antipolis. XML.com article and xmlschema-dev discussions Chris: Nothing to report, very close to PER, still have to review the primer Plh: you will have other WGs from this CG to review your docs. Chris: down to 16 issues Jonathan: Talks about features at risk. 3 items to talk about: HTTP binding. less interest from member than for the SOAP binding, but still some interest. it won't be removed. some MEPs are at risk as well. we have some MEP that are not used. the out-only is not referred to in the document, the group may extract those MEPs and publish them in a WG Note Jacek: even if they are removed, will they in the same form of URI as the current ones? Jonathan: yes Jacek: that sounds like a good move to publish them in a WG note with the same kind or URIs. Jonathan: last feature at risk is F&Ps. the group thinks that it is possible to remove them without impacting the implementation and the doc, one of our member is wanting to have a way to describe MTOM, currently it is defined only as a feature, so we are looking for a way to define MTOM without. using the whole F&P framework skipped, see the addressing agenda item not much since last time, working on the theoretical background note, and chasing impls we are in sync with our timeline - Guide to Versioning XML Languages using XML Schema 1.1 - Short namespace URIs for W3C TRs available Jacek: SAWSDL will meet in Georgia mid-november Jacek: people were not notified as I was away. not sure about the process Plh: it might have been better to negociate the review time with other group prior to publication jacek: groups targeted; WSDL, schema, databinding (although unofficially), the SemWeb and SWS IG, and the Semantic Execution Environment TC in OASIS MSM: it will be a bit difficult considering the time frame Philippe: CDL sent in the past a message saying that F&P were a good thing to keep Yves: it would have been a nice hook to plug things needed for alignment, but there might be other ways to do it. also for MEP, there is need to support them at the CDL level, as messages are mostly one way at the CDL level Jacek: in the case of MTOM, we can ask people unwilling to implement full fledge Policy processor, they can implement only the part relative to describing MTOM Bob: since early july, got 2 issues, starting with one, rec-33 related to WSDL description and anonymous. Anish & Paco are tasked to provide a new resolution. We may go back on how we are relying on WSDL. Jonathan: there is kind of loop around that issue between addressins and RX TC Bob: there is still an option for a get-together on this topic. The WG sentiment is not to change the MUST in a SHOULD as it leaves room for badly done stuff Philippe: looks like the only way to have addressing and RX agreeing will be by doing a joint call. also if there is a better alignment with Policy on anonymous, the doc will probably have to go back to WD Felix: the i18n activity will start work in this area, the goal is do things like describing things like the locale using policy presentation was made to the WSDL WG during the last plenary as well early next week a pointer to the charter will circulate Oct 10, Jonathan, Bob, Paul (MDA workshop), Philippe (FSTC) and Jacek won't be there next call Oct 24th ADJOURNED
http://www.w3.org/2006/09/26-ws-cg-minutes.html
CC-MAIN-2015-32
refinedweb
650
67.52
Talk:Banana Pi the Gentoo. Article title Why not call the article "Banana Pi" instead? I'd wonder if it ain't Gentoo Way, when it's written down on wiki.gentoo.org --Mrueg (talk) 12:08, 30 July 2015 (UTC) - I'd would rename it "ze Gentoo Way" as far as I'm concerned. --Monsieurp (talk) 17:24, 30 July 2015 (UTC) - Currently we have no way of organizing guides that are related to but different than our "official" guides. How to name or store alternative instructions might be something we should put a little thought towards. Should users put them in their user space instead on the main namespace? Should they have a certain naming scheme? --Maffblaster (talk) 17:36, 30 July 2015 (UTC) - Even better, the Banana Pi article can be an introduction, this article can be the "Guide." --Maffblaster (talk) 19:08, 30 July 2015 (UTC) SinOjos (talk) - The reason I named it The Gentoo Way, is that at the time, the competing groups involved in litigation over the Banana Pi, were all posting releases, and spamming forums to get traffic. Some were outright attempts to discredit Banana Pi, while some intentionally contained malicious code taking advantage of the situation. Even the more legitimate (litigation is not completed) releases, by the various groups involved, were not done correctly, some were better than others. Some were terrible, and were modified raspberry pi releases, which were all wrong configuration wise, kernel, and arm 6 not even arm 7, simply terrible performance, incorrect network interface modules and configurations, etc. Not one of the so called developers, had a clue as to how Linux really worked, ideology of the software, or possessed any business acumen. The majority were students in china, that spoke little or no English, who were not competent at translating English documents, hence not fully understanding what they were doing, a big security risk. The great majority had no prior experience with Linux or business. Every thing from copyrights, to patent infringement, and false advertisement through claims of open source, were used to market the Banana Pi. Some of the components of the Banana Pi are closed source, and patented, yet advertised as open source. It was a case of some with money, and access to component designs and manufacturing facilities getting students involved and taking advantage of the Raspberry Pi momentum. Hence the name Banana Pi, typical Chinese knock off. Don't get me wrong, it is nice hardware, but Not Open Source. Good luck taking full advantage of the GPU! Since there were many unsuspecting new people to Linux, who were getting roped into using possibly malicious releases of Gentoo. I wanted to clearly differentiate the difference between all the other Gentoo releases for Banana Pi. While also providing the instructions on how to roll your own using a Gentoo Arm stage3 release. I felt it was better that people learn how to do it the right way, rather than use pre-made releases, that may contain malicious code, and or incorrectly configured. Not to mention, that users will learn a lot more about how Linux works by building their own Gentoo system rather than something pre-made. Since there was an existing Banana Pi page already pointing to one of the aforementioned pre-made releases. I simply wanted to stay out of the war zone. So I did Banana Pi The Gentoo Way. - SinOjos (talk)
https://wiki.gentoo.org/wiki/Talk:Banana_Pi_the_Gentoo_Way
CC-MAIN-2022-33
refinedweb
571
61.16
The Hashset class extends the AbstractSet class. The HashSet class implements the Set interface. This class deals with a collection, whose elements are stored in a hash table. The hashing mechanism is used to store the elements in a hash table. This mechanism uses the informational content of a key to determine a unique value. Such a unique value is known as a hash code. The hash code is then used as the index. The data associated with the key is stored at this index. The important forms of the constructor of the hashSet class are as follows: HashSet ( ) HashSet (Collection c) When we use the first form of the constructor, a default hash set will be created. The second form of the constructor initializes the elements of the newly created hash set by using the elements of the collection c. Progarm Program Source import java.util.HashSet; public class Javaapp { public static void main(String[] args) { HashSet hs = new HashSet(); hs.add(20); hs.add(20); hs.add(40); hs.add(40); hs.add(60); hs.add(60); hs.add(80); hs.add(80); System.out.println(hs); } }
http://hajsoftutorial.com/hashset/
CC-MAIN-2017-47
refinedweb
189
57.37
It will be better if you have a rough understanding of object oriented programming and its concepts like encapsulation, polymorphism and inheritance. If you don't have those then this article may appear a little confusing. If it does then comment back in, I will try my best to explain. All of the example code that I provide here will follow Java syntax. From wikipedia - A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise. What do you understand from the above two lines ? If you ask me, I will say - not a darn thing. This is the problem that occurs to all the beginners in design patterns. People and websites who teach these stuff seem to talk in a way that is very hard for the beginners to understand. Rather than pursuing these heavy definitions, let us learn what design patterns are by looking at their applications. To simply put, an object is something that has - Enough talk. Let's see some code. Before you create an object, you need to let the compiler know what data and operations will that object contain. You do this by declaring a class as follows - public class Person { protected string name; // Data public person(){} // Constructors, a special type of operation public string getName() { // Operation return this.name; } public void setName(string name) { string escapedName = EscapeString.escape(name); // Here EscapeString is another object whose // service is being requested by this Person // class. So Person is a client of EscapeString this.name = name; } } You can think of the class as a blue print for compilers which describes what data and operations will an object contain in it. And now, to create an object, you use the following syntax - Person aPerson = new Person(); Again I would like to point out that this article is not for those who are absolute beginner in object oriented programming . This article provides a different perspective of those concepts. You should acquire basic concepts from this fine article that Java's official site provides. Requests are the only way to get an object to execute an operation. Operations are the only way to change an object’s internal data. Because of these restrictions, the object’s internal state is said to be encapsulated. Encapsulation means that the data that an object contains cannot be accessed directly from outside that object, and its representation is invisible from outside the object. It is a great way to develop a loosely coupled software components. What the heck do the above two lines mean ? It means that you cannot access the name property of the Person object directly. If you need to get that value then you will have to request it through the getName method. Doing it this way gives the designer of the object a lot of flexibility, i.e., he can change the name of the variable to myname and it still won't cause any code to change outside this object. The designer can even choose to store the name value in a Java Map or in an array without much trouble. Yes, it does! There are a lots of design patterns that are targeted specifically for this purpose. One of them is Strategy Pattern. It helps us to encapsulate complex data structures, algorithms, changing behaviors into their own separate class and protect the rest of the system from any change that may occur in them. So, we can say - Design patterns help us to maintain Encapsulation when we write an application in a true object oriented way. This is one of the most important use of design patterns. Do you understand anything from the above three points ? If you don't, then don't worry. These are part of a broader topic known as system analysis and design, which I will cover later in the future. What you would like to know whether or not design patterns help you to determine what should be an object in your system, and you will be glad to know that they do. There is a pattern called Facade which describes how to represent subsystems as objects. There is also another pattern known as Flyweight that describes how to support huge number of objects at the finest granularities. So we can say - Design patterns help us to decide what should be an object in our system. This is another important use of design patterns. Every operation declared by an object specifies the operation’s name, the objects it takes as parameters, and the operation’s return value. This is know as the operation’s signature. Don't confuse it with method signature which doesn't include the return type of a method. Let us consider the Person object discussed earlier. The method signature of its getname operation is - string getName() The set of all signatures defined by an object’s operations is called the interface to the object (beware people, it’s not the same as our programming language’s interface construct). There is one thing that you should be aware of. Some OOP languages allow us to declare methods that cannot be accessed from outside that object (i.e., in java using private, protected keywords). Those methods won't be included in the object interface since you cannot request those operations to an object from outside that object. If we consider the Person object, then its interface is - {void setName(string name), string getName()} X if it accepts all requests for the operations defined in the interface X. An object may have many types, and widely different objects can share a type. As an example, we can say that the interface that our Person object defines is of type Person. Interfaces can contain other interfaces as subsets. We say that a type is a subtype of another if its interface contains the interface of its supertype. Let us consider an example. Suppose that I have a class called Man whose interface is as follows - {void setName(string name), string getName(), void playCricket(), void playKabadi()} This object's interface contains all the method signatures that are defined in the Person object's interface. So in this case we can say that Man is a subtype of Person, and Person is a supertype of Man. We can also say that this Man object's interface inherits the Person's object's interface. Why am I talking about these stuff? Because interfaces are fundamental in object-oriented systems. Objects are known only through their interfaces. There is no way to know anything about an object or to ask it to do anything without going through its interface. An object’s interface says nothing about its implementation though. Different objects are free to implement requests differently. That means two objects having completely different implementations can have identical interfaces. Let me clarify the last point with an example. Consider the following definition of the Man object - public class Man extends Person { public Man(){} public string getName() { return EscapeString.escape(this.name); } public void setName(string name) { this.name = name; } public void playCricket() { System.out.Print("I am playing cricket"); } public void playKabadi() { System.out.Print("I am playing kabadi"); } } This example uses inheritance to make sure that the Man object has the Person object's interface as its subtype. You can learn more about inheritance by reading the Sun Java's article. All I will say is this - since we are inheriting Man class from Person class, then all of the methods that constitute its object interface will also be included in the Man class. The Man class is providing a different implementation to those methods by overriding definition/implementation of those methods. That's all we care about for this article. Those who find this example confusing, I would like to say to them that Object Interface and Java/C# language's interface aren't the same thing, though they have so much in common. Object interface is the collection of all signatures of all the methods that can be called from outside that object; where as an interface in C#/Java defines a collection of method signatures that some object can implement, thus including those signatures in its Object Interface. In this sense you can say that an interface construct in C#/Java defines an object interface, but it isn't the only way. In those languages we can ensure that an object has a specific Object Interface by one of two ways - Probably now you will want to say that aren't these two are the same thing? I will say, no, because an object that doesn't implement any Programming Language's interface still has an Object Interface, which is the collection of all the signatures of all those methods that can be called outside from this object. Please think about this distinction thoroughly before moving on. From our definition of interface, type and subtype, we can say that Man class also has Person as its type, because it accepts all the operations defined in the Person interface type. It's supertype is Person, and it's a subtype of Person. Now, look at the implementation of the getName and setName. They are completely different from the Person's implementation, although they have common interface. Since these objects have common interface, you can use one in place of another when you're dealing with only that common interface. Let me clarify it with another example. Consider the following method of a certain class - public string returnProcessedName(Person p) { this.nameProcessor = p; // nameProcessor is a member variable of CertainClass whose type // is Person. You can use a setter method for setting up appropriate name // processor, but hey, this is just an example ;-) . return this.nameProcessor.getName(); } Now I can call this method like this - Person newPerson = new Person(); CertainClass c = new CertainClass(); newPerson.setName("Stupid"); string processedName = c.returnProcessedName(newPerson); Or like this - Man newMan = new Man(); CertainClass c = new CertainClass(); newMan.setName("Stupid"); string processedName = c.returnProcessedName(newMan); This code snippet is also valid. Why? Because both the Person and the Man object has a common interface, which we have named Person before. So you can use one object in place of another whenever you are dealing with that interface. If you pass a Person object's reference to the returnProcessedName method, then it will call the getName implementation that this class or object provides. Similarly, if you pass a Man object's reference then its implementation will be called. Hence we can say that which implementation of getName will be called will be determined at runtime, which means when the application runs, rather than at compile time, which means when the application is compiled. This runtime association of a request to one of its implementation is known as Dynamic Binding. returnProcessedName getName Dynamic binding means that issuing a request doesn’t commit you to a particular implementation until run-time. Consequently, you can write programs that expect an object with a particular interface, knowing that any object that has the correct interface will accept the request. This property is very, very important because Polymorphism depends on it. Dynamic binding lets you substitute objects that have an identical interfaces for each other at run-time. This substitutability is known as polymorphism. It lets a client object make few assumptions about other objects beyond supporting a particular interface. As a result, it simplifies the definition of clients, decouples objects from each other and lets them vary their relationships to each other at run-time. These inter-changeable classes are said to display polymorphic behaviors. Let us discuss this with respect to the last example. In our last example, the CertainClass is a client of the Person interface. Since both the Person object and Man object have this interface, we have been able to use both of these objects in the CertainClass. The client class doesn't even have to know which implementation it is being provided as long as the implementation or object has this Person interface. This is the true meaning of polymorphism, and this client object CertainClass is said to display polymorphic behavior because at run-time it can achieve one of two different behaviors by simply switching between the instances of the Person and Man class like this - CertainClass Person newPerson = new Person(); CertainClass c = new CertainClass(); newPerson.setName("Stupid"); string processedName = c.returnProcessedName(newPerson); System.out.println("Current name: " + processedName); Man newMan = new Man(); newMan.setName("Stupid"); processedName = c.returnProcessedName(newMan); // Now you will get name processed in a different // way, because implementation is different! System.out.println("Current name: " + processedName); This greatly reduces the complexity of accommodating changes in our application because if you design an application using polymorphism then you can plug in any implementation of this interface in your application without having to test and re-test your application and without breaking any of the existing code. Yes, it does! So we have found another use of design pattern - Design pattern lets us design a flexible application by helping us maintaining true polymorphism in our application This is so far I am going to go in this article. I will soon write the second part of this article. Until then,.
http://www.codeproject.com/Articles/198373/An-Introduction-to-Design-Pattern-Part
CC-MAIN-2015-27
refinedweb
2,219
54.63
A development "roadmap" for version three of AIMLBot can now be found on my homepage at (actually, its a list of aims and objectives but is a start). This version fixes a rather serious bug that crept in the last version where the regular expression handling replacements would cause the bot to either time out or produce wrong paths for a search of the graphmaster. In addition, generics are now used throughout the library so .NET 1.1. is no longer supported. Finally, various new unit tests have been added to the Test project to cover the corner cases that identified the regex bug mentioned above and also check the bots handling of international alphabets. This point release fixes a trivial (but commonly occurring) bug in the code that handles the random tag. Unfortunately it missed the 2.4 final release. A bug-fix release. Changes (in no particular order): 1. Fixed a bug that meant random and condition tags were not working correctly - they were recursively processing all the child nodes before processing themselves instead of processing themselves and then the result. This could cause the bot to get into an infinite loop (and thus time-out) or process predicates in the wrong way. This bug fix is also matched by new unit tests. Thanks to ebiztiger and ghostdogpr for reporting this problem. 2. The order of wildcard matches has been reversed in line with a more intuitive interpretation of the AIML standard and to match common practice. Thanks to Vauntie for pointing this problem out. 3. Replacements have been made more robust. You should be able to just specify "CU" and have it work as if it were " CU", "CU " and "CU" as a single word but not work in a word in which it is a constituent (like your "calCUlator"). Unfortunately, ALICE's own substitution files (the ones I supply with the code) include patterns that include spaces. The bot will now trim off outer white-space and I leave it up to the bot-master to make sure they write appropriate replacements. Thanks again to Vauntie for bringing this to my attention. 4. The bot handles settings and dictionary XML files in a more robust manner. Comments in the XML no longer trip it up! Thanks to ebiztiger for pointing this out to me. 5. Custom tags are no longer single instances. You get as many instances as there are tags encountered in the template. Kudos to Vauntie for giving me a kick to make this more robust. 6. Custom tags now take precedence over the built in tag-handling code so developers can implement their own versions of the standard AIML tags. Vauntie also kicked me into action on this feature. 7. The AIMLGui example application now has a quick load of AIML from settings in the configuration file and the ability to save and load session information (a user's predicate dictionary). These examples should answer bartvda and safifi's questions concerning the persistence of user information. 8. New tests have been added to the Test project suite to reflect the changes made. 9. A small amount of re-factoring has taken place to make the code more efficient.... read more Fixed a bug where XML namespace and schema information caused the loading of AIML into the bot's memory to barf. The topic handling part of AIML loading has also been made more efficient. Kudos to Jimmy Wang for spotting this problem! A minor release that solves the "shadowing" problem that might affect all AIML interpreters that generate normalized paths in a non-standard way (AIMLbot now reverts to strictly following the standard). The AIMLGUI example Windows project has also been updated to include voice synthesis so the bot literally talks to you (XP and Vista only). This is mainly a minor feature enhancement and bug fix release. Summary of changes: 1. The bot used to get the wild-card matches mixed up if processing more than one sentence. This is now fixed with the appropriate unit tests written and the other applications updated. A new class "SubRequest" now encapsulates a query to the Graphmaster and holds the wild-card matches. 2. The normalization process for applying changes is now fixed so it doesn't always return uppercase. The case of the normalized result should match that of the user's raw input plus any replacements. This means <star/> tags return exactly what the user inputted, rather than a capitalized version of it. 3. There is the potential that the bot could get into an infinite loop when processing the template tag, especially if it encountered a srai tag that ultimately led back to itself. This hole has now been plugged in two ways: a) Each time an AIML tag is processed the request is checked to make sure it hasn't timed out. b) When the srai class calls a sub-request with the new path the new request object has the same StartedOn value as the original request. 4. Made changes to the way the path for queries to the Graphmaster are dealt with. It is now "backwards": (topic <topic> that <that> User input). This should provide a slight increase in efficiency. 5. Added some new tests and code for stopping a bot from accepting user input (something that should happen should it be changing the graphmaster for example). Updated other projects to reflect these changes too. 6. Changed the behaviour of the default constructor in the "Bot" class. Removed the loading of config files from the constructor so you now have to call the loadSettings() method to load the configuration files. 7. Included a very simple Web-services based example application. I am pleased to announce the release of version 2.0 of AIMLBot and the project's move to Sourceforge. AIMLBot (Program#) is a small, fast, standards-compliant yet easily customizable .NET dll implementation of an AIML (Artificial Intelligence Markup Language) based chatter bot. AIMLBot has been tested on both Microsoft's runtime environment and Mono. This version 52.
http://sourceforge.net/p/aimlbot/news/
CC-MAIN-2015-22
refinedweb
1,010
64
Welcome to the Java Methods and Encapsulation tutorial offered by Simplilearn. The tutorial is a part of the Java Certification Training Course. Let us begin by looking into the objectives of this methods and encapsulation tutorial. In this methods and encapsulation tutorial, we will be able to - Explain what a Java method is Apply static keyword to the method Create and overload constructors Apply access modifiers to restrict the scope of a class, data member, method, or constructor Apply encapsulation principles to a class Pass objects reference and primitive values to methods Let us begin with the Java methods in the next section. A method is a collection of statements that are grouped together to perform an operation. <modifier>* <return_type> <name> ( <argument>* ) { <statement>* } The reason we would create a method is so that you could reuse it as and when required. The method is also more for the black box where you pass a value to it, it performs an operation and returns a value. To declare a method you need a modifier which would be an access modifier. Then, we provide the return type in terms of the what data type it would return, followed by the name of the method and a list of arguments as required. The <modifier> segment is optional and carries a number of different access modifiers, including: public: A method that can be called from other code private: A method that can be called only by other methods in a class protected: A method that can be called within a method in a class default: A variable or method declared without any access control modifier that is available to any other class in the same package The <return_type> indicates the type of value to be returned by a method. The name can be any legal identifier, with some restrictions based on the names that are already used in the program. The <argument> list allows argument values to be passed into a method. In the next section, let us look at the Java Methods example. Let us look at an example. public class Dog { private int weight; public int getWeight() { return weight; } public void setWeight (int newWeight) { if (newWeight > 0) { weight = newWeight; } } } Here, we do a simple validation to check if the new weight is greater than zero, only then we assign it to the weight data member of the class. From this example, we can say that generally, the data members of the class would be private, and the methods in your class would be public. In the next section, let us look at the static keyword in Java. The static keyword is a non-access modifier. Static methods can be called without creating an object of the class. It can be applied with variables, methods, blocks, and nested class. Also, they belong to the class, and not the instance of the class and hence such methods can typically be called only prefixed with the name of the class. In the next section, we will look at the static method in Java. The static method enables you to apply the static keyword with any method. It belongs to a class rather than the object of the class. It can access a static data member and can change the value of it. In the next section, let us look at an example of the static method. Let us now look at an example of the static method. Here, we have a student class, with roll number, name, college as parameters. The college is common for all the students and hence if we create three different objects of the student class or two different objects of the student class say S1 and S2 we would have different values for roll number and name. class Students3 { int rollno; String name; static String college = “MGT"; static void change(){ college = “MGIT"; } Students3(int r, String n){ rollno = r; name = n; } void display (){System.out.println(rollno+" "+name+" "+college);} public static void main(String args[]){ Students3.change(); Students3 s1 = new Students3 (111,“Paul"); Students3 s2 = new Students3 (222,“Martha"); Students3 s3 = new Students3 (333,“Bob"); s1.display(); s2.display(); s3.display(); } } Output: 111 Paul MGIT 222 Martha MGIT 333 Bob MGIT Even though we did not pass specific college names, all the three objects picked up the same college name since it was a static variable and that got assigned in a static method. In the next section, we will look at some important points of the Java static methods. Want to join the high-earners club? Enroll in our Java Certification Course today Some of the important points to be noted in the static method are - You cannot override a static method, but you can hide it. For a method to be overridden, it must be non-static. Overriding is a feature of polymorphism or perhaps an OOPS feature. It is a pillar of OOPS, which is an implementation of the polymorphism OOPS concept. The main() method is a static method because the JVM does not create an instance of a class when executing the main method. You can use a static method as a class method. You should access methods that are static using the class name rather than an object reference. Let us go to the final keyword in the next section. The final keyword is a reserved keyword in Java that stops the value change, method overriding, and Inheritance. It can be applied to: Methods Classes Member variables Local variables If the final keyword is applied to the Methods, then, that method cannot be overridden; If it is applied to the Classes, we cannot inherit further from that class and we cannot implement the OOPS feature of inheritance; If the final keyword is applied on Member variables, then, we cannot change the value of that variable as it becomes a constant value that the variable will hold irrespective of the Member variable of the class or the Local variable that is defined inside the method. Some of the final keywords include - final Class: You can apply the final keyword to a class to form a final class. Once you do this, that class cannot be subclassed or inherited. For example, java.lang.String. This is a final class for security reasons. final Method: You can mark a method as final. Once a method is made final, it cannot be overridden in the child classes. final Variable: You can apply the final keyword to a variable to make it constant. When the value of the final variable is tried to change, it will result in a compiler error. Here we find a private static final double and the variable name is assigned a value. Since this is final, we cannot change the value of the variable, it becomes a static constant inside the class. We can only define, as the value is a fixed value. public class Bank { private static final double DEFAULT_INTEREST_RATE=3.2; // more declarations } If we have the interest rates or the value of pi in a mathematical calculation, we can define that as final so that these values do not undergo any changes further in the code. Let us talk about constructors next in Java in the next section. A constructor is a set of instructions designed to initialize an object. So in case, we have some default values that our object should hold; the moment we create a new object of the class, we should ensure that the developer does not forget to initialize those default values. For this, the constructors have been provided, so that the initialization of these values can happen within these constructors. This is also a good feature to avoid the null reference error that we generally encounter in cases where there are some values or data members in the class that are uninitialized and when we allow the user to create an object of the class, some other developer may get a null reference error saying that this particular array or object was not initialized and yet you were able to create an object of the class and access some of the data members. Parameters can also be passed to the constructor in the same way as for a method; this means that the parameters can also be passed to the constructor in the same way as we do to a method, so that, when the object is initialized you can pass some default values that can be assigned to the object. For example, if we are creating the student object, there itself during the initialization line, we can pass the student id and the student name. Therefore, the moment the student object is created it will be initialized with an id and a name. Basic declaration of a constructor: [<modifier>] <class_name> (<argument>* ) { <statement>* } This code gives the basic declaration of a constructor, the access modifier, the name of the class, and the argument list. Thus, the constructor always has the same name as that of the class. Valid modifiers are public, protected, and private. Valid modifiers can be made private so that nobody would be able to create an object of the class because your constructor would be a private constructor. When the constructor is made public, we allow users to initialize the class because a constructor will automatically fire, when the object of the class is created. You can also mark it as protected. The <argument> list is the same as that used for method declarations. You can provide any number of argument declarations as per your requirements as you do for a regular class method. Constructors can also be declared with parameters. In the next section, let us learn about the default constructors in Java. A constructor with no arguments having the name of the class without a return type is a default constructor. This enables us to create object instances with the new keyword. Once again it fires the very moment a new instance of the class is created. On doing this, the default constructor fires and we can use the default constructor to set some default start values for data members in our class. A user added constructor declaration to a class always overrides the default constructor. Thus, in case we have not provided a constructor in our class, the system will automatically generate a default constructor. Implicitly, we will not see it in the code and initialize the object. Depending on the data type used in the class, the number of variables, if it is in the string, or int it will accordingly assign it to zero or null. In the next section, let us look at an example of the default constructors in Java. Given below is an example of a default constructor. class Test { public void disp() { System.out.println(“Display All”); } public static void main(String args[]){ Test t1=new Test(); t1.disp(); } } } In the next section, let us learn about the Java Access Modifiers. Access modifiers in Java set access level for classes, variables, methods, and constructors. They have four levels. The first level is the package level. Here, we can control whether the class can be accessed out of our package and inside another package. We can set the package level access if we are not adding any specifier, default access or no modifiers at all or private. For example, if the variable is marked public, it is accessible everywhere. If the variable is marked protected, it is accessible in the same class. It is accessible in child classes of that class and it is accessible in all the classes within that package only. It is inaccessible to classes outside the current package. If we do not give any modifier by default, a default modifier gets applied to that data member and they are accessible only within the class and within the current package. The last one is the private modifier. If we give anything as private, it is accessible only within the class and not accessible within other classes in the same package or within the subclass. This is the broad perspective of the access levels for the access modifiers present in java. The public access modifier is accessible everywhere. It has the widest scope among all modifiers. public class employee { <statement> } The protected access modifier is accessible within and outside the package but through inheritance only. protected access modifier: public class A{ protected void mesg(){ System.out.println("Hello"); } } The private access modifier is accessible only within the class. class D { private int data=20; private void mesg(){ System.out.println("Hello Java"); } } In the next section, we will learn about Java Encapsulation. Java Encapsulation is a methodology of hiding certain elements of the implementation of a class but providing a public interface for the client software. To achieve encapsulation in java, you need to- Declare the variables of a class as private, and Provide public getter and setter methods to modify and view the variable values Let us look at an example of this encapsulation principle. Given below is an example of hiding data that will help you understand encapsulation better: MyDate -date : long +getDay() : int +getMonth(): int +getYear(): int +setDay(int) : boolean +setMonth(int) : boolean +setYear(int) : boolean -isDayValid(int) : boolean To understand encapsulation, think of it as a black box. The reason we have encapsulation is because if there are any changes that need to be implemented in the code of your class, like, if the customer comes to you with a change request and the entire code is visible externally to other classes or modules or subsystems, the moment there are changes made to your class, all the other classes will get impacted at the cost of testing the entire code base and there is a risk of some other code breaking if you make a change to your class. Encapsulation prevents this. Since our code is encapsulated within a class, any change that we make to the method or the code inside the method will never impact any subsystems using that code. This is because, if suppose we have a function called calculate tax, all we can do from the outside when we are using a class is to create an object of the class and call it to calculate the tax. There is no way that we would know what is the process of tax calculation taking place in the third party class. The moment we are exposed to that, any change made by the user makes the client or the application using that API or that class method will simply break. To prevent this, we always keep the class method same. Therefore, the method continues to remain to calculate tax and the other classes of the other subsystems just adhere to that method name. The moment the method name remains the same, the internal implementation of the method can always change because that will have zero impact on the subsystems of the client code. In order to achieve encapsulation, we either declare the variables private, so that they cannot be accessed outside or we make use of methods, because, when we declare a method, the code inside is encapsulated within the class and this is hidden from those who are calling it. Thus, only the developers who are calling your code know what the code does. They cannot see how the process is happening. The client subsystem would need to be modified if the code in the class is modified and also the cost and time required to do that will be higher. So, the end user would have to wait much longer for the software to get delivered. In the next section, we will look at Passing Objects Reference and Primitive Values to Methods in Java. Let us learn about Passing Object by Reference in Java. All parameters are passed by values, but objects are always manipulated through reference variables in Java. We can say that objects are passed by reference. Let us understand this with an example. Here, we have a class test1 wit an integer value of 10. Next, we have the class test parameter where we are creating the object of this class and executing a method called amethod. Class Test1 { public int i = 10; } public class TestPar{ public static void main(String argv[ ]) { TestPar p = new TestPar(); p.amethod(); } public void amethod() { Test1 t = new Test1(); t.i=10; System.out.println("Before another = "+ t.i); another(t); System.out.println("After another = "+ t.i); } //End of a method public void another(Test1 t){ t.i = 20; System.out.println("In another = "+ t.i); } //End of another } Output: Before another = 10 In another = 20 After another = 20 This is an example of passing object references which means we are passing pointers to objects which are pointing both to the same memory location. In the next section, we will learn Primitives as Method Parameters in Java. When you pass primitives to a method, they are considered passed by value. A method works with its own copy and no modifications reflect outside the method. Let us understand with an example. Here, we are creating an object of the class, initializing the value ‘i’ and we print the value of ‘i’. public class Par1 { public static void main(String argv[]) { Par1 p = new Par } Output: Before another i= 10 In another i= 20 After another i= 10 Thus primitive types are not pointers, they are typically stored on the stack. They are not the pointers on the stack that point to the value on the heaps and hence they are always passed by value. Thus, passing by value means, a copy of that variable is created in memory, it is replicated and then passed. Let us summarize what we have learned in this methods and encapsulation tutorial - The Java method is a collection of statements that are grouped together to perform an operation. The static keyword in Java is used for memory management. We can apply Java static keyword with variables, methods, blocks, and nested class. A constructor is a set of instructions designed to initialize an instance. Parameters can be passed to the constructor in the same way as for a method. Access modifiers set access levels for classes, variables, methods, and constructors. The four access levels are the package, the default, no modifiers, and private. Encapsulation is the methodology of hiding certain elements of the implementation of a class but providing a public interface for the client software. With this, we come to an end to the methods and encapsulation tutorial. A Simplilearn representative will get back to you in one business day.
https://www.simplilearn.com/java-methods-encapsulation-tutorial
CC-MAIN-2019-22
refinedweb
3,110
60.55
Httpcfg Overview Updated: March 28, 2003 Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2 Httpcfg.exe: HTTP Configuration Utility The HTTP Configuration Utility can be used to manage the HTTP application programming interface (API). It may be used to perform many of the tasks associated with web server administration. Concepts The HTTP API enables applications to communicate over HTTP without using Microsoft Internet Information Services (IIS). Applications can register to receive HTTP requests for particular URLs, receive HTTP requests, and send HTTP responses. The HTTP API includes SSL support so applications can also exchange data over secure HTTP connections without depending on IIS. It is also designed to work with I/O completion ports. Use this tool to configure a web server in any of the following ways: - Add, query and delete SSL certificate meta-information. Such meta-information is maintained by the HTTP API in a metastore, and is used to locate certificates for certificate exchange in HTTPS sessions. - Add, query and delete namespace reservations. The HTTP API allows administrators to reserve URI namespaces and protect them with Access Control Lists (ACLs), so that only specified HTTP API clients can use them. - Add, query, and delete Internet Protocol (IP) addresses in the IP Listen List. If this list of addresses is specified, the HTTP API listens only to addresses on the list. Otherwise it listens on all IPs on the machine. System Requirements The following are the system requirements for this tool: - Windows Server 2003 Files Required - Httpcfg.exe
https://technet.microsoft.com/en-us/library/cc787508.aspx
CC-MAIN-2017-26
refinedweb
261
54.12
Time Zones¶. It will always be displayed in UTC there. Also, templates used in Operators are not converted. Time zone information is exposed and it is up to the writer of DAG to decide the recommended or even required setup). The main reason is that many countries use Daylight Saving Time (DST), where clocks are moved forward in spring and backward in autumn. If you’re working in local time, you’re likely to encounter errors twice a year, when the transitions happen. (The pendulum and pytz documentation discuss. Web UI¶ By default the Web UI will show times in UTC. It is possible to change the timezone shown by using the menu in the top right (click on the clock to activate it): “Local” is detected from the browser’s timezone. The “Server” value comes from the default_timezone setting in the [core] section. The users’ selected timezone is stored in LocalStorage so is a per-browser setting. Note If you have configured your Airflow install to use a different default timezone and want the UI to use this same timezone, set default_ui_timezone in the [webserver] section to either an empty string, or the same value. (It currently defaults to UTC to keep behaviour of the UI consistent by default between point-releases.) timezone.is_localized(). dag = DAG( "my_dag", start_date=pendulum.datetime(2017, 1, 1, tz="UTC"), default_args={"retries": 3}, ) op = BashOperator(task_id="dummy", bash_command="Hello World!", dag=dag) print(op.retries) # 3 Unfortunately, during DST transitions, some datetimes don’t exist or are ambiguous. In such situations, pendulum raises an exception. That’s why you should always create aware datetime objects when time zone support is enabled. In practice, this is rarely an issue. Airflow gives you time zone Note For more information on setting the configuration, see Setting Configuration Options Time zone aware DAGs¶ Creating a time zone aware DAG is quite simple. Just make sure to supply a time zone aware start_date using pendulum. Don’t try to use standard library timezone as they are known to have limitations and we deliberately disallow using them in DAGs. import pendulum dag = DAG("my_tz_dag", start_date=pendulum.datetime(2016, 1, 1, tz="Europe/Amsterdam")) op = EmptyOperator(task_id="empty", dag=dag) print(dag.timezone) # <Timezone [Europe/Amsterdam]> Please note that while it is possible to set a start_date and end_date for Tasks, the DAG timezone or global timezone (in that order) will always be used to calculate data intervals.(logical_date).datetime(2020, 1, 1, tz="UTC") and a schedule interval of timedelta(days=1) will run daily at 05:00 UTC regardless of daylight savings time.
https://airflow.apache.org/docs/apache-airflow/2.3.1/timezone.html
CC-MAIN-2022-33
refinedweb
434
55.44
[ ] Alex Harui commented on FLEX-35075: ----------------------------------- I haven't really taken the time to understand the allowed syntax for e4x filters. It is rather strange that there is an implied node when evaluating the expression (that just "year" is allowed instead of "node.year"). This makes the compiler have to make some assumptions when resolving identifiers (could 'year' be a global or scope variable?). I'm putting in a fix to get this simple "year == '2016'" to generate node.child('year') == '2016' for now. I want to see what other filters people have actually used. It may not be practical to map all operators to function calls. There might be other complex expressions that don't easily map. If toString() is implied and we can just try to insert attribute() and child() calls and let JS run the rest of the expression, I think that would be easier for the compiler. > E4X filters need to be smarter > ------------------------------ > > Key: FLEX-35075 > URL: > Project: Apache Flex > Issue Type: Bug > Components: FalconJX > Affects Versions: Apache FalconJX 0.6.0 > Reporter: Harbs > > The following expression: > {code:actionscript} > xmlSource.Set1.child.(year == "2015"); > {code} > compiles into: > {code:javascript} > xmlSource.child('Set1').child('child').filter(function(node){return (node.year == "2015")}); > {code} > This is all fine except for the filter expression. > node.year means nothing in Javascript. > I'm not sure the best way to compile this. The following will work, but it will probably get tricky covering all cases: > {code:javascript} > xmlSource.child('Set1').child('child').filter(function(node){return (node.child("year").toString() == "2015")}); > {code} > What might make more sense might be to add some helper functions like: > XML.isEqual(randomObject); (mapped to ==) > XML.isNotEqual(randomObject); (mapped to !=) > XML.greaterThan(randomObject); (mapped to >) > XML.lessThan(randomObject); (mapped to <) > XML.greaterThanOrEqualTo(randomObject);(mapped to >=) > XML.lessThanOrEqualTo(randomObject);(mapped to <=) > And the code will figure out the best way to handle these comparisons based on the type at runtime. > In that case, this would compile like this: > xmlSource.child('Set1').child('child').filter(function(node){return (node.child("year").isEqualTo("2015"))}); > Thoughts? -- This message was sent by Atlassian JIRA (v6.3.4#6332)
http://mail-archives.us.apache.org/mod_mbox/flex-issues/201604.mbox/%3CJIRA.12957898.1460414734000.209251.1460485825933@Atlassian.JIRA%3E
CC-MAIN-2021-49
refinedweb
357
59.7
Autostart Qt applications at boot on Symbian devices Latest revision as of 03++.. Code Example Compatibility Article [edit] Startup List Management API Steps for auto-starting an EXE on boot time in Qt. 1. Create an .RSS file in your project's directories. For example: 06000001.rss Here a number is used for the name, which is the same as the Package UID (pUID) of the project. This might help later in identifying the resource and is a good reminder when adding the entry in the PKG file. The name is however irrelevant at this point. Add the following code to the new .rss file: #include <startupitem.rh> RESOURCE STARTUP_ITEM_INFO startexe { executable_name = "!:\\sys\\bin\\QtAutoStartApp.exe"; recovery = EStartupItemExPolicyNone; } In the code above: - QtAutoStartApp.exe is the name of the application to be started and this will of course depend on your choice of name for your project. Must be the same as specified for the TARGET statement in the MMP file. 2. Open your .PRO file. Add the following lines to include the new resource in the build and attach .RSC file to package. symbian { # Define rss file for autoboot autoStartBlock = \ "SOURCEPATH ." \ "START RESOURCE 06000001.rss" \ "END" MMP_RULES += autoStartBlock # Deploy rsc file to package. deployRscFile = "\"$${EPOCROOT}epoc32/data/06000001.rsc\" - \ \"C:/private/101f875a/import/[06000001].rsc\"" deployFiles.pkg_postrules += deployRscFile DEPLOYMENT += deployFiles } 3. That's it. Now just build the project and deploy sis file on device. On the next phone reboot your application will be started automatically. [edit] Notes - If the EXE exits within a few (about 5?) seconds of starting up, a message is displayed, reading: Unable to start <name of EXE>. Application may need to be removed. - Startup List Management API does not work with Self-Signed application. It should be signed with a trusted certificate (Open Signed Online or Open Signed Offline during R&D stage and Symbian Signed when released) even if otherwise the capabilities required for the project do not justify it. - The exe to be started must be installed directly from the root of the package that contains the resource file (not accepted from embedded file) - Symbian Signed's Test Criteria mandates that the user must have the option to turn the autostart feature on/off. For info on how applications may implement such feature please see CS001564 - Implementing user-selectable autostart feature in Qt for Symbian [edit] Download Example Code Startup List Management Example in Qt
http://developer.nokia.com/Community/Wiki/index.php?title=Autostart_Qt_applications_at_boot_on_Symbian_devices&diff=174880&oldid=133044
CC-MAIN-2013-48
refinedweb
403
57.77
CommandLink ActionListeners in DataTable Jack J. Jackson Greenhorn Joined: Apr 20, 2002 Posts: 27 posted Mar 15, 2006 15:14:00 0 I'm using Sun RI 1.1_01 and MyFaces Tomahawk 1.1.1. Inside a DataTable, I have a CommandLink that appears on each row of data. The CommandLink has an ActionListener bound to a method on a session-scoped bean. Each row has the same client Id. I just discovered that the ActionListener is fired for every row in the data table; i.e. if there are 100 rows, the actionListener method is invoked 100 times. I'm not sure why this would ever be useful behavior; it certainly isn't for my application. Why does the actionListener event get fired for each row in the table? Is it because each row has the same id? I suspect I've configured something incorrectly and would appreciate being steered back on course. Thanks. Jack Jack J. Jackson Greenhorn Joined: Apr 20, 2002 Posts: 27 posted Mar 15, 2006 16:43:00 0 I'm adding more info to my original post. The following are the artifacts needed to illustrate what I'm talking about: - faces-config.xml entry <managed-bean> <managed-bean-name>simpleItemContainer</managed-bean-name> <managed-bean-class>mypackage.SimpleItemContainer</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> - SimpleItemContainer public class SimpleItemContainer { public List<OrderableItem> itemList; private int invocationCount; public SimpleItemContainer() { super(); init(); } /** * @return Returns the itemList. */ public List<OrderableItem> getItemList() { return itemList; } /** * @param itemList The itemList to set. */ public void setItemList(List<OrderableItem> itemList) { this.itemList = itemList; } private void init() { itemList = new ArrayList<OrderableItem>(); for(int i = 1; i <= 10; i++) { itemList.add(new OrderableItem("Item " + i, i)); } } public void listener(ActionEvent evt) { FacesContext ctx = FacesContext.getCurrentInstance(); String modelRowStr = (String) ctx.getExternalContext().getRequestParameterMap().get("modelRow"); int modelRow = Integer.parseInt(modelRowStr); System.out.println("Event received for modelRow #" + modelRow); invocationCount ++; } /** * @return Returns the invocationCount. */ public int getInvocationCount() { return invocationCount; } /** * @param invocationCount The invocationCount to set. */ public void setInvocationCount(int invocationCount) { this.invocationCount = invocationCount; } } - OrderableItem public class OrderableItem { private String label; private int itemNo; public OrderableItem() { super(); } public OrderableItem(String label, int orderno) { super(); this.label = label; } /** * @return Returns the label. */ public String getLabel() { return label; } /** * @return Returns the itemNo. */ public int getItemNo() { return itemNo; } /** * @param itemLabel The label to set. */ public void setLabel(String label) { this.label = label; } /** * @param itemNo The itemNo to set. */ public void setItemNo(int orderNo) { this.itemNo = orderNo; } } - simpleList.jsp form element <h:form <t :D ataTable <h:column <f:facet<h :o utputText</f:facet> <h :o utputText </h:column> <h:column <f:facet<h :o utputText</f:facet> <h :o utputText </h:column> <h:column <f:facet<h :o utputText</f:facet> <h:commandLink <f :p aram </h:commandLink> </h:column> </t :D ataTable> </h:form> <h :o utputText When a link in a row is clicked, the actionListener method (simpleItemContainer.listener) is fired 10 times. Here's the output after clicking a link: Item NoLabelLink Col 1Item 1Click Me! 2Item 2Click Me! 3Item 3Click Me! 4Item 4Click Me! 5Item 5Click Me! 6Item 6Click Me! 7Item 7Click Me! 8Item 8Click Me! 9Item 9Click Me! 10Item 10Click Me! Invocation Count = 10 What I'd like to have happen is have the actionListener method "consume" the event so it's not broadcast 9 times more than is needed. Since this issue hasn't been raised, I'm sure I've just misconfigured something. (or am doing this all wrong!) Thanks for any help. [ March 15, 2006: Message edited by: Jack J. Jackson ] [ March 15, 2006: Message edited by: Jack J. Jackson ] Jack J. Jackson Greenhorn Joined: Apr 20, 2002 Posts: 27 posted Mar 15, 2006 18:09:00 0 Okay. I found the cause of the problem. I was using a MyFaces HtmlDataTable , but a Sun RI HtmlCommandLink was enclosed in a row. Apparently unique ids were not being generated for each row, causing every CommandLink's actionListener to be fired when any CommandLink was clicked. When I switched the DataTable back to RI from MyFaces, a unique id is generated for each row's CommandLink. I wanted to use the MyFaces "rowindex" attribute. Maybe if I used the MyFaces JSF impl, things would work, but I'm mandated to use the Sun JSF RI implementation. Oh well. I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: subject: CommandLink ActionListeners in DataTable Similar Threads Control the execution order in jsf Submit dataTable fields getting object instance inside nested h:dataTable onclick row action in dataTable TreeTable and row selection All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/211410/JSF/java/CommandLink-ActionListeners-DataTable
CC-MAIN-2015-32
refinedweb
793
51.75
Pyinstaller and QML Can someone help me? Is there a way that I can use Pyinstaller with PyQt5 and QML? Because I run pyinstaller but when I run the .exe file it says "QtQuick is not installed" I have visited the stackoverflow page like a thousand times but none of the answers worked for me I think I solved it I hope this could help After hours, I did something simple, but for me it worked In my main.py I mean the file in which you load the QML file I added import PyQt5.QtQuick And then run pyinstaller : pyinstaller -F - -onefile main.py And it worked
https://forum.qt.io/topic/90182/pyinstaller-and-qml
CC-MAIN-2022-40
refinedweb
108
90.09
Agenda See also: IRC log <trackbot-ng> Date: 16 October 2007 <FrederickHirsch> Meeting: XML Security Specifications Maintenance WG Conference Call <FrederickHirsch> Scribe: Juan Carlos Cruellas <tlr> <FrederickHirsch> Agenda: hal will scribe at next week fh: the group will meet on Thursday and Friday in Boston during the plenary tr: registration implies lunch. This has to be taken into account when registered fh: who will be able to attend Monday and Tuesday for meeting XML Core? ... we could at least attend some XML Core session. fh: proposal to meet preferably with XML Core on Tuesday for progressing on the issues related with that group ... asks Konrad if he will be able to call in konrad: as long as the time framework is reasonable fh: will investigate time frameworks <tlr> fh: registration of the technical plennary is about to be closed. Need to fill in the form if... ... you want to attend other groups' meetings as observers. tr: did some work on the XMLSig draft, all of them editorial. ... hopes they are not controversial fh: any comment on this draft, not in this call but in the next one. <FrederickHirsch> RESOLUTION: the group approves the minutes of last conf call RESOLUTION: the group approves the minutes of the workshop <FrederickHirsch> action 26 - how to deal with changes to changes in xml namespace (and associating canonicalization approaches) etc <FrederickHirsch> tlr: moot if we have a xml security group that is able to do this work th: proposed to drop action 26. Looked at minutes and emails, I think that the things there could be ... better fit in other places. <FrederickHirsch> see tr: strong dependencies on how we organize the future work on canonicalization ... suggest close this action. kl: what direction we should take? tr: should be a wg addressing these issues... ... the question on how to technically deal best with canonicalization, this could ... fit within one new place that would appear in the future after the discussions ... we had in the workshop ... move ahead in the charter discussion of potential future groups (?) fh: any problem with this? ... proposes closing the action and proceed as tr suggested. ACTION-26: CLOSED; see ACTION-71: OPEN ACTION-74: OPEN ACTION-81: OPEN ACTION-93: OPEN <klanz2> ACTION-97: closed. see URL above kl: this action deals with the frequent usage of square brackets in xpointers syntax <FrederickHirsch> A Potential Conclusion: There should be no issue with changing to RFC 3986, with the caveat that we may want to allow to verify references with a "fragment only uri reference" that actually has unescaped square brackets. fh: do we need any change? <klanz2> section 4.3.3.1 kl: section 4.3.3.1 will be affected ... could add a note on this issue. ... read the text and try to reach a conclusion at the next meeting: may, should? ... implementations should be able to verify signatures with unescaped square brackets in the ... uri fragments xpointers....maybe something like this ... rfc2732 moves square brackets to the set of characters allowed in the uri's fragments. ... it also says that square brackets are mainly used for being scaped.. fh: relationship with further interop? required new interop? kl: actually most implementations would accept unescaped square brackets fh: look at this during this week and add an item in the agenda of next conf call <brich> +1 fh: disscussion on the mail also ACTION-98: kl: email produced but not sent to the list OPEN ACTION-99: OPEN fh: need to coordinate with XML Core group. Maybe needed to extend our group's life other <klanz2> +1 fh: 3 months...is it acceptable? hal: no problem <rdmiller> +1 bruce: ok tr: one reason: takes more time achieve our goals.... another reason: need to go into next year for overlaping with progresion of canonicalization work <tlr> +1 actually hal: very undesirable having two groups: if this goes on, no other one should be started while this one is alive <klanz2> +1 to hal tr: agrees on that. <FrederickHirsch> +1 to hal - not have two overlapping xmlsec groups <FrederickHirsch> this one and the next tr: it might be a single reason for this to happen: if there are patent policy issues that ... cause problems in dealing with them at the same group <FrederickHirsch> tr: e.g IPR fh: want to have an initial list of topics in the agenda. <FrederickHirsch> - Finalization of Interop Report- Charter drafting- Best Practices draft- XML Signature Proposed Edited Rec- Joint meetings - EXI, Core- Other bruce: does not plan to attend at this point of time fh: next call we need to figure out how to go forward for the interop tr: asked for a telephone bridge, so remote participation is OK ... two open ends at this point: ... question on the dname encoding test cases. We found that this did not raise any problem. Maybe ... extend this a little bit. ... question on the square brackets. Open: maybe new test cases... kl: this could only be optional as xpointers are optional fh: appendix a What is the point on this, Konrad kl: this action does not deal with writing new annex a but giving some pointers on certain aspects of the wording fh: wording seemed a bit confusing. kl: one reason: little differences with original text. ... maybe a good idea could be that XML core asked our group to make a new proposal fh: this is what I understood from an email from Paul ... we need the equivalent to what Bruce had. tr: do not conclude that the message by Paul is a request to our group... ... in consequence maybe better to remain silent, observing and prepared ... current annex a wording is problematic.... ... so my reading is leaving annex a as it is is not acceptable for us and ... xml core should notice it. fh: this is related with our timeline. tr: next xml core call is tomorrow. kl: maybe tr could join the call. tr: conflict with other wg. kl: if people give me proposals, I can, as member of xml core bring them to xml core. fh: we have given our input already. <tlr> another two weeks, actually fh: useful to indicate to xml core that we are waiting they indicate what they plan on this topic ... indicate that annex a must be changed. ... xml core should indicate what change they plan, and when ... anyone is welcome to post on the list any suggestion on annex a. fh: other things in the plenary? ... maybe decryption transform.... ... time constraints on issues to be dealt with depending on availability of members fh: proposes to publish the workshop report RESOLUTION: the wg agrees in publishing the workshop report <tlr> ACTION: thomas to work toward publishing workshop report [recorded in] <trackbot-ng> Created ACTION-101 - Work toward publishing workshop report [on Thomas Roessler - due 2007-10-23]. tr: what about publishing the minutes? <hal> I must leave to attend ws-fed fh: currently no list of attendees. bruce: some missing pieces in the interop test cases. <tlr> public list should be ok fh: should raise this issue in the email list ... public list. ... will try to work a little bit more on the participants list of workshop during this week <brich> aa is brich tr: send the report at the public list fh: first give the attendees the chance to take a look to them <tlr> +1 to giving attendees notice before things go to old list fh: and then send it to old list xmlsig-ietf For a full record of this discussion, please refer to the member-confidential full minutes. In summary, the Working Group has information that the implementors affected by the second issue recorded in the interop meeting report (section 2.4 of C14N 1.1, xml:base fix-up) expect to have conforming implementations within the next few weeks.
http://www.w3.org/2007/10/16-xmlsec-minutes-public
CC-MAIN-2016-26
refinedweb
1,301
72.66
$ cnpm install @angularclass/dope-docs :lipstick: :green_book: Storybook inspired Angular docs generator Dope Docs is a CLI and Library that will create beautiful documentation, styleguides, and demos for your Angular UI bits (components, directives, pipes). Perfect your component libs, and styleguides for your team. Dope docs supports Angular 2 and beyond only. Now, lets get your docs going so you can stop procrastinating :100:. yarn add @angularclass/dope-docs For every UI element you want to add, you'll create a doc for it. We follow the convention of [name].doc.ts. And then for each doc, you'll add examples. Below we have a button, and it has multiple states, so we create an example for each state. // button.doc.ts /* you have to import DopeDoc for now or TS will complain, even though you won't use it. */ import { docsFor, DopeDoc } from '@angularclass/dope-docs' export default docsFor( // the title for the doc you're creating for the UI element. Unique to the dope docs app 'Dope Button', // The description for this doc 'This button is so fire, yo have to use it. If you want the monies, use this button', // any @Inputs and or @Outputs for the UI element {inputs: [], outputs: []} ) .example('primary', { // the name of this example, unique to this doc // the description of this example description: 'Default and primary button state', // show the source code in the docs? showSource: true, // props to pass the the template to use for data binding context: { type: 'primary' }, // the template to render in the docs. Make sure it compliments the example name and description. Don't mislead people! template: ` <dope-button [buttonStyle]="type"> click me </dope-button> ` }) .example('warning', { template: ` <dope-button click me </dope-button> `, description: 'Warning button type' }) .example(/* you can chain more examples */) Because DopeDocs is an Angular app, it must be bootstrapped with all your examples. So create a new entry file for it, like you would with an entry NgModule. import 'core-js' import 'zone.js' import { FormsModule } from '@angular/forms' import { createDopeDocs } from '@angularclass/dope-docs' import { UIModule } from './app/ui' // this takes in all the options needed to bootstrap your dope docs createDopeDocs({ // The module from your app that has all the components exported. ngModule: UIModule, /* * This is the markdown for your Docs entry route. Will be the landing page */ entryMarkdown: `# My Teams' Components`, /* * Any NgModules your NgModule will need. Great if your project is a library * and depends on the host app for these modules */ ngModuleImports: [ FormsModule ], /* * This function must return all the modules in your app that have docs. * Above is an example of how to do so pragmatically using webpack`s `require.context`. * If you're not using Webpack, or want to be explicit, you can just require * every file individually or just import them all up top :sunglasses: and return them in an array here */ loadUIGuides() { const context = (require as any).context('./', true, /\.doc\.ts/) // this works because all my examples have .doc.ts paths return context.keys().map(context).map((mod: any) => mod.default) } }) Last step is to setup configuration. Create a dope.js on your root file. Your Angular app probably has a specific build setup, so DopeDocs will use that setup to build itself and your App. module.exports = { // your webpack config. Will be used to build the app. webpackConfig: require('./webpack.config') // the path to the Dope docs entry file you created above entry: './src/dope-docs.ts' } PR's and issues welcome! There aren't any tests associated with this, so your code will be look at carefully
https://developer.aliyun.com/mirror/npm/package/@angularclass/dope-docs
CC-MAIN-2020-24
refinedweb
595
57.57
I have discovered an issue relating to func_globals for functions and the deallocation of the module it is contained within. Let's say you store a reference to the function encodings.search_function from the 'encodings' module (this came up in C code, but I don't see why it couldn't happen in Python code). Then you delete the one reference to the module that is stored in sys.modules, leading to its deallocation. That triggers the setting of None to every value in encodings.__dict__. Oops, now the global namespace for that module has everything valued at None. The dict doesn't get deallocated since a reference is held by encodings.search_function.func_globals and there is still a reference to that (technically held in the interpreter's codec_search_path field). So the function can still execute, but throws exceptions like AttributeError because a module variable that once held a dict now has None and thus doesn't have the 'get' method. My question is whether this is at all worth trying to rectify. Since Google didn't turn anything up I am going to guess this is not exactly a common thing. =) That would lead me to believe some (probably most) of you will say, "just leave it alone and work around it". The other option I can think of is to store a reference to the module instead of just to its __dict__ in the function. The problem with that is we end up with a circular dependency of the functions in modules having a reference to the module but then the module having a reference to the functions. I tried not having the values in the module's __dict__ set to None if the reference count was above 1 and that solved this issue, but that leads to dangling references on anything in that dict that does not have a reference stored away somewhere else like encodings.search_function. Anybody have any ideas on how to deal with this short of rewriting some codecs stuff so that they don't depend on global state in the module or just telling me to just live with it? -Brett
https://mail.python.org/pipermail/python-dev/2007-January/070690.html
CC-MAIN-2018-05
refinedweb
358
67.89
Visual Studio .NET provides a text editor that provides the basic source code editing facilities that are common to all languages. Each language service can extend the text editor to provide language-specific features. (See Chapter 10 for information about how language services extend VS.NET.) As well as supplying the basic text editing services, the editor also has hooks that allow language services to provide advanced features, such as IntelliSense and automatic formatting. Even though the exact way in which these services work is language-specific, the IDE provides the basic framework so that the behavior is as consistent as possible across languages. You can configure the way the text editor behaves for each language. When a particular language takes advantage of a standard editor feature such as IntelliSense, you will be able to configure that feature's behavior either globally or, if you prefer, on a per-language basis. Most languages also have their own unique configuration options. You can edit all of these options by selecting Tools Options and then selecting the Text Editor folder in the lefthand pane of the Options dialog box. As Figure 2-1 shows, you will see a list of supported languages. Appendix D describes all of the available options. Visual Studio .NET provides many coding aids to make editing your source code easier. The following sections describe each of these features. Visual Studio .NET provides a number of context-sensitive autocompletion features, collectively referred to as IntelliSense. VS.NET relies on the language service for the file you are editing to work out which symbols are in scope and uses this to show pop-up lists of suggestions, to show information in ToolTips or to autocomplete your text. Four varieties of assistance are offered by IntelliSense. All of them can be invoked manually from the Edit IntelliSense menu, but IntelliSense usually works automatically (unless you've disabled it). However, it can sometimes be useful to give it a kick, because in some situations, it doesn't operate automatically when you need it. (The most common example being when you want to bring up a list of members in scope at function scope. Many people use the trick of typing in this. to bring up a list of members, but it is easier to use the shortcuts once you know about them.) The four IntelliSense commands are: List Members displays a list of available members. The exact contents of the list are determined by the cursor position. If the cursor is placed after a variable name followed by a member access operator (. in VB.NET and C#, and either . or -> in C++), it will list the members of that variable's type. If the cursor is just on some whitespace inside a function, it will list all available variables, types, and members currently in scope. You can find the member you want in the list by typing in the first few letters of the member until the member is highlighted or by selecting the member with the mouse or arrow keys. When available, VS.NET will display brief documentation for the currently selected item in a ToolTip next to the list. Once you have highlighted the member you would like to use, VS.NET can enter the member name into your code for you. Either double-click on the item or just type any character that would not be allowed in an identifier (e.g., any of (, ., ;, Space, or Enter). Alternatively, you can execute the Complete Word command (see later). The List Members command executes automatically if you type in a variable name followed by the character for member access or object dereferencing (usually ., ->, or ::). However, the list will disappear if you start doing something else (e.g., you click to move the cursor elsewhere) so this shortcut is useful for bringing it back. Also, if you select the wrong item by accident, pressing Ctrl-J will reopen the list with your current selection highlighted, allowing you to move to the item you meant to select. This command displays the names and types of the parameters needed to call a method, along with the method's return type. This command works only if the cursor is inside the parentheses of a method call. (The command is invoked automatically when you type the open parenthesis for a method call.) The Quick Info command displays the complete declaration for any identifier in your code and, where available, a documentation summary. (This is the same information that will be shown if you move the mouse over an identifier and hover.) The declaration is displayed in a ToolTip-style box. If Quick Info is not autoenabled, hovering the mouse will not work, and you will need to execute this command manually to make the pop up display. (Even if Quick Info is autoenabled, it is still often useful to be able to invoke it without reaching for the mouse. You will also need to invoke the command manually if you need it while debuggingin debug mode, the default behavior when you hover over an item is to display its value instead of its quick info.) Complete Word will complete whatever symbol is currently selected in the IntelliSense member list. If the list is not currently open, IntelliSense will work out whether the letters typed so far unambiguously refer to a particular member. If they do, it will complete the member. If, however, the text already present is ambiguous (and the member list is not already open), it will display the member list. For example, if the text editor had the text Console.W, the W might be expanded to either Write or WriteLine. Since this is ambiguous, it will open the member list to let you choose the one you mean. If you have VS.NET 2003 and are using C# or J#, you can enable the "Preselect most frequently used members" option. (This setting can be found in the options dialog, which can be opened using Tools Options. On the left of the dialog, expand the Text Editor category, and then under either C# or Visual J# select the Formatting item.) This will cause VS.NET to highlight the item you use most often. Otherwise, it will just choose the first matching itemWrite in this case. Some other autocompletion features are provided by the C# language service. Automatic skeleton insertion for interfaces and virtual methods is described later in this chapter (in the Section 2.1.5 section). Help is also provided with event handlers. (This feature is not available in VS.NET 2002.) If you write the += operator after an event member name (e.g., myButton.Click +=), a tooltip will appear offering to add code to create an appropriate delegate if you press Tab. If you go ahead and press the Tab key, it adds the appropriate code (e.g., new EventHandler(myButton_Click);). At this point a second tooltip will appear, offering to create a skeleton function whose signature matches the delegate and with a name matching its suggestion in the first completion. (So in this case, pressing Tab a second time would add a function called myButton_Click, with the correct signature for a Click event handler.) The C# programming language lets you put special comments in the source code that can be used to generate documentation. These comments must begin with three slashes instead of the normal two and must be in an XML-based format. The XML is typically converted into HTML-based documentation for your solution. However, the XML can also be used by IntelliSense to provide pop-up documentation for types and their members. It uses the summary element for this, so you should always keep that part fairly succinct. The following code snippet shows a typical example of this documentation: /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main( ) If you type three slashes into the source editor in a C# file (or /**, which is the other way of indicating that a comment contains XML documentation), you will find that Visual Studio .NET automatically provides an XML skeleton for your documentation. This will always include a summary element, but if you put the comment before a method, VS.NET will also add elements for each parameter and for the return type. VS.NET also provides IntelliSense pop ups for the XML, telling you which elements are supported for the item you are documenting. (A complete description of the supported elements can be found in C# in a Nutshell (O'Reilly and Associates) and also in the C# Language Specification in the MSDN Library.) IntelliSense will automatically use this documentation if it is present, but you must explicitly ask for HTML documentation to be built if you want it. You do this using Tools Build Comment Web Pages. VS.NET can reformat the currently selected portion of a file. The exact behavior of this feature is controlled by the language service. This feature is not available for certain file types (such as text files). To invoke this feature, first select the region of text you would like to reformat (if you want to reformat the entire file, use Ctrl-A or Edit Select All). Then select Edit Advanced Format Selection (Ctrl-K, Ctrl-F). This will reformat the selected area. Most languages that support this feature allow the way in which reformatting occurs to be controlledsee Appendix F for details of the relevant settings. A navigation bar is available for five different languages: C#, J#, C++, VB.NET, and HTML/XML. In C#, J#, and C++, the navigation bar is just a navigation aidyou can use it to navigate to specific type and member declarations. However, with VB.NET and HTML, the navigation bars have slightly more functionality. The navigation bar allows you add event handlers in VB.NET and HTML files. If you are editing a class, form, or page that contains event sources, these will appear in the lefthand list. If you select one, the righthand list will show all of the events it provides. Selecting one of these adds a skeleton event handler. With VB.NET, the navigation bar also allows you to add new code as well as navigating to existing code. In VB.NET, if you select your class in the lefthand drop-down list, the righthand list will not only contain your class's members, it will also show some methods you have not yet implemented. The list will contain overridable methods from your base class, along with any members of interfaces your class implements. When you pick a method that you have not yet implemented, the editor adds a skeleton implementation (just the Sub or Function declaration and the corresponding End Sub or End Function). The class view provides a way of navigating within a solution. You can display the class view with View Class View (Ctrl-Shift-C). The class view shows a tree view of the types declared in your source files. In a multiproject solution, the types will be grouped by project. When you expand a project in the class view, you will see all of the namespaces that the project defines, along with any classes that are in the default namespace. As you expand the tree view, you will see types and their members. If you double-click on any item in the tree, the cursor will go to its definition. You can also navigate in reverseyou can right-click in the text editor and select Synchronize Class View. This will show the Class View pane and will select the node corresponding to whichever item the cursor was over. In both C# and C++, you can also use the Class View pane to generate skeleton implementations for overridable members from base types, as well as for interface members. If you expand any type that you have defined, its first node will be labeled Bases and Interfaces. If you expand that node, you will see your class's base type, along with any interfaces that it implements. If you find an overridable member of the base type (or any member of an interface) that you would like to implement, you can right-click on that member and select Add Override (Ctrl-Alt-Insert). This will add a skeleton for that member to your source file. You can also add skeletons for all members of an interface in one step: expand the Bases and Interfaces node, select the interface you require, right-click, and select Add Implement Interface.... Another useful feature of the class view is that it can be customized. In a large project, there are likely to be a substantial number of classes. However, you may well be working with only a small subset of these at any given time. Rather than having to scroll through the tree to find the few classes you are interested in, you can create a new folder in the class view that contains just the items you wish to see. You create new folders with Project New Folder. You can add as many folders as you like. Folders can contain types, namespaces, or even individual membersjust drag them in there from their current place in the tree view. You can delete a type by highlighting it and pressing the Delete key. You can see an example of a custom folder containing a namespace, a type, and an individual member at the top of Figure 2-2. Custom class view folders have no impact on the output of the solutionthey merely change the way in which it is presented in VS.NET. Because of this, custom folder settings are not stored in the .sln file. Information that affects only the way in which VS.NET shows the project are typically held in per-user files, so custom folders settings are stored in the .suo file. This means that custom folders will not be saved into source control. (.suo files are not checked in by default, and it is not a good idea to check in user-specific IDE configuration files in any case.) You should therefore avoid relying on them to convey important information in team projects. (For example, do not rely on custom class view folders as part of your code documentation strategy.) VS.NET provides a number of additional ways to navigate through your source code files. The View Navigate Backward (CTRL+-) and View Navigate Forward commands are like Undo and Redo commands for navigationas you are moving from file to file, and within a file itself, the editor remembers your location when you execute certain commands. (Not all commands are remembered, as otherwise the editor would have to remember every single editing keystroke or command.) These commands include searches, Go To Line (Ctrl-G), Beginning of Document (Ctrl-Home), End of Document (Ctrl-End), Pasting Text, and Go To Definition commands. Bookmarks provide another useful navigation aid. You can add a bookmark to any line of source code by placing the cursor on that line and selecting Edit Bookmarks Toggle Bookmark (Ctrl-K, Ctrl-K). It is easy to see when a line has been bookmarked, as there will be a visual marker in the indicator margin (unless you have turned the indicator margin off). You can then use the commands under Edit Bookmarks to navigate back and forth between the different bookmarks you have placed in your source files, the most useful being Next Bookmark (Ctrl-K, Ctrl-N) and Previous Bookmark (Ctrl-K, Ctrl-P). The main language services (VB.NET, C#, J#, and C++) provide the text editor with outlining information for your source code. When outlining is enabled, VS.NET uses this to show markers in the lefthand margin of the text editor that delineate sections of your source code. The editor marks the start of a section by a minus (-) symbol inside a small square. It shows the extent of the section with a vertical gray line ending with a small horizontal tick. These sections of code can be expanded and contracted, allowing you to hide sections of source code that you are not currently working on, thus making more effective use of your screen real estate. In Figure 2-3, you can see some sections of the source code that are hidden (like the using section) and some sections that are open (the code inside of the namespace declaration). When a section is hidden, it is represented by a plus (+) symbol in a square. The section can be unhidden by clicking on the +. Some text will be shown inside a box in the main part of the editor window next to the + to represent what is contained in the hidden section. The text shown will depend on the type of sectionfor example, in Figure 2-3, the using section appears as three periods, and the comment section appears as /**/. Hidden functions just show the function declaration. For #region sections (described later in this section), arbitrary text may be shown. If you want to see the code contained in a hidden section without expanding it, you can hover the mouse over it. A ToolTip containing the hidden source code (or as much of the source code as will fit on the screen) will appear. One of the hidden sections in Figure 2-3 appears as the text "Component Designer generated code". This is an example of a section created with the #region keyword. (This particular section was added, unsurprisingly, by the component designer.) The language service decides where the outline sections should be placed, and they are usually based upon language constructs. But in VB.NET, C#, and J#, you can add extra sections using the #region and #endregion keywords (#Region and #End Region in VB.NET). You can place a string next to the opening directive, and this will be displayed in the box when the outlined section is hidden. Figure 2-4 shows how the region at the bottom of Figure 2-3 looks when it is expandedit is now clear how VS.NET knew what text to display when the section was hidden. When a Visual Studio .NET designer generates code, it usually places it inside a #region directive. The main reason for this is that it discourages people from editing it by accidentregions are hidden by default. (You can change this default, though, as discussed in Appendix F.) The commands for outlining are found under Edit Outlining. The most useful command is Toggle Outlining Expansion (Ctrl-M, Ctrl-M)if the cursor is inside a section that is not currently hidden, VS.NET will hide it. If the cursor is over a hidden section, VS.NET will expand it. Also, Collapse to Definitions (Ctrl-M, Ctrl-O) will hide all members, and Toggle All Outlining (Ctrl-M, Ctrl-L) will expand any collapsed sections in the file. If there are no collapsed sections in the file, it collapses everything. The Toolbox (View Toolbox) is used most often for visual editing (see the later section on designers, Section 2.4). But it can also be used as a place to keep useful chunks of text. You can select any section of source code, then drag the selection onto the Toolbox. (You can do this on any of the different tabs of the Toolboxeither the standard tabs or tabs you have added yourself.) Each time you do this, a new item will appear on the Toolbox. You can then move to another part of the same file or a different file and drag the item off the Toolbox and back into the editor where you would like it to be placed. This will create a copy of the original text. If you regularly need to insert pieces of boilerplate such as a standard comment header, this can be a great time-saver. To remove a text block from the Toolbox, right-click the text block and select Delete. Another section of the Toolbox that can be used for text editing is the Clipboard Ring tab. The clipboard ring holds the value of the last 12 copy or cut operations, and these are all displayed on the Clipboard Ring Toolbox tab. In fact, you don't need to use the Toolbox to take advantage of the clipboard ringyou can cycle through the items in the ring by pressing Ctrl-Shift-V until the text that you want appears in the text editor. Once you have found the item you want from the ring, it moves to the top of the ring. This means that if you want to paste it in again somewhere else, you only need to press Ctrl-V next time. When you are editing a document, you may wish to leave comments in your code to remind yourself or others of work that still needs to be done. VS.NET can show a list of these kinds of comments along with their locations in the Task windowjust select View Show Tasks Comment. By default, it will look for comments that start with either TODO, HACK, or UNDONE, but you can also add your own custom tokens to the list using the Options dialog (Tools Options)underneath the Environment folder, select the TaskList property page. Each token has one of three priorities assigned to it (Low, Normal, or High). The priority controls a visual cue that is displayed in the TaskList window and determines the order in which items will be displayed. The built-in tokens are all Normal by default, but with the exception of the TODO token, you can change the priority for these and your own tokens with the TaskList property page. The following source code shows some comments that use this feature. (In addition to using the three standard comments, this example uses two custom comments.) //TODO:This code need optimizing public void Slow( ) { } //HACK:This method is a kludge public void BadCode( ) { } //UNDONE:Someone needs to finish this and it isn't me! public void NotDone( ) { } //MANAGERSEZ:We need this method public void Meaningless( ) { } //NOTTESTED:This code needs to be tested public void Crash( ) { } This would produce a TaskList window like the one shown in Figure 2-5. Note that, by default, the TaskList shows only build errors. To enable the display of comments such as these, you must use the View Show Tasks menu. These comments will be shown only if you select All or Comment. If you double-click on a task in the TaskList window, it will bring you to the line of code containing the comment. You can also cycle forward and backward through your undone tasks by selecting View Show Tasks Next Task (Ctrl-Shift-F12) or View Show Tasks Previous Task, respectively.
http://etutorials.org/Programming/Mastering+visual+studio+.net/Chapter+2.+Files/2.1+Text+Editor/
crawl-001
refinedweb
3,794
62.17
I have documents with cutting edge (little horizontal and vertical lines in the corners)I must delete these line and the content of the page can not be resized. Is it possible with iText ? and how ? Thanks for your help Post your Comment what is the default buffer size for bufferedreader what is the default buffer size for bufferedreader Hi, I am writing... is the default buffer size for bufferedreader? Is there any example of reading the big text file efficiently? Thanks Hi, The default buffer size pdf default size pdf default size  ... the default size of pdf. Its options are from A0 to A10. These text explains the ISO 216 paper size system and the ideas behind its design. It will adjust the size Size of commarea Size of commarea hii, What is the size of commarea? hello, Default size of commarea is 65k Servletoutputstream size limit. Servletoutputstream size limit. What is the maximum size of ServletOutputStream? By default size is set to 10MB.You can increase your message size maximum 2000000000 bytes. That is size limit is 2000000000 SQL Alter Column Size SQL Alter Column Size Alter Column Size modify the Column Size. The SQL Alter Column Size is used when you want to change the data type size. Understand Mysql Alter Column Size Mysql Alter Column Size Mysql Alter Column Size is used to change the data size... from 'Mysql Alter Column Size'. To understand example we create table Getting ResultSet size - JSP-Servlet , The "fetch size" is a hint to the driver to control internal buffering within... is also free to ignore the hint. A "fetch size" of 0 means "transfer all...". It is the default for some drivers, and not for others. Thanks Get Image Size Example Get Image Size Example This Example shows you get the image size... the default toolkit. Toolkit.getImage() : getImage method return a Image C Array default values C Array default values In this section, you will learn how to set the default values in Array. The example below contains an array arr of integer type. The maximum size Image Size Image Size This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size...; This program helps you in setting an image and getting the size of its Set the size of visual component in Flex4 Set the size of visual component in Flex4: Flex 4 provide mechanism to set Size of the visual components. There are two different ways to set Size for visual components. 1. Default Sizing:- In this mechanism you do not specify How to Increase Upload File Size Limit in php . But the default file upload size settings restrict you to upload large files. PHP default setting allowed only 2MB file upload size. So if you want to upload...How to Increase Upload File Size Limit in php Increase Upload File how to set fetch size for jdbc odbc driver how to set fetch size for jdbc odbc driver What is the default fetch size for the JDBC ODBC driver and how can i fetch a set of results for JDBC... size of JDBC drivers is 10. In general default fetch size of JDBC drivers is 10 Controlling Java Heap Size Memory Allocation Controlling Java Heap Size Memory Allocation Hi, Tell me about Controlling Java Heap Size Memory Allocation? I have to run java program from console and allocate 2GB of RAM to Java Heap Size. Thanks Hi, You can Default Package Default Package Can we import default packages??? Yes, you can import the default packages. But there will be no error or exception, if you will not import default packages. Otherwise, importing packages is must Size in FLex Size in FLex Hi..... What is the difference between width, explicitWidth, measuredMinWidth, measuredWidth, and percentWidth? please tell me about that difference Thanks Size in FLex Size in FLex Hi... I just want to know about... What happens in measure()? measuredHeight, measuredWidth, measuredMinHeight, measuredMinWidth are set. please give me an example with description... Thanks java serializable default constructor java serializable default constructor java serializable default constructor is set interface synchronize by default??????? is set interface synchronize by default??????? is set interface synchronize by default??????? an whether list is syncrhronized by default Default_Page ipad default image names ipad default image names i have a problem while launching application in iPad. The Default image that i have set is not displaying in landscape mode correctly. please suggest. Thanks. ipad Default image names MySQL Default Port number MySQL Default Port number HI, What is MySQL Default Port number? Thanks Hello, MySQL Server Default Port number is 3306. Thanks Which package is imported by default? Which package is imported by default? hi, Which package is imported by default? thanks hi, It is very important to know Which package is imported by default? The java.lang package is imported by default even Default Values Default Values The elements which do not have any children can have default values. Default values are assigned automatically if no value is supplied... to specify a default value. If the element appears in the document with content Reset checkbox style to default Reset checkbox style to default Reset checkbox style to default input[type="checkbox"] { /* styles To make toggle by default hidden To make toggle by default hidden i have done this coding...;aComments</a> <p id=1></p> by default toggle is "shown"..but i want it by default "hidden".. Wat should i add Actions Threadsafe by Default - Struts Actions Threadsafe by Default Hi Frieds, I am beginner in struts, Are Action classes Threadsafe by default. I heard actions are singleton , is it correct java default constructor java default constructor suppose i hava a class: public class... be the default constructor: 1) public Student(){ private int rollNo = 0; private... the space in memory and initializes the fields. So, in the default constructor you can Is Singleton Default in Struts - Struts Is Singleton Default in Struts Hi Friend, Is Singleton default in Struts ,or should we force any technique Thanks Prakash Hi friend, Use of singletons is normally program for default constructor in java program for default constructor in java class Box { double l; double b; double h; Box resize and crop pageFlock Marc June 14, 2011 at 4:32 PM I have documents with cutting edge (little horizontal and vertical lines in the corners)I must delete these line and the content of the page can not be resized. Is it possible with iText ? and how ? Thanks for your help Post your Comment
http://www.roseindia.net/discussion/18376-pdf-default-size.html
CC-MAIN-2015-18
refinedweb
1,087
64.81
'0' coerced to True sqlite boolean value since 1.1 Use case: insert using rows (i.e. string tuples) from CSV import sqlalchemy as sa import sqlalchemy.ext.declarative class Spam(sa.ext.declarative.declarative_base()): __tablename__ = 'spam' id = sa.Column(sa.Integer, primary_key=True) spam = sa.Column(sa.Boolean) engine = sa.create_engine('sqlite://', echo=True) Spam.metadata.create_all(engine) sa.insert(Spam, bind=engine).execute(spam='0') # worked until 1.0.19, fails with 1.1 assert not engine.scalar(sa.select([Spam.spam])) Maybe this is intended though, see 7c74d702a963 (does this mean one cannot round-trip via CSV any more?): return int(value) -> int(bool(value)) so the string '0' coercion is noted in the migration notes: the value '0' in Python is True: You can round trip CSVs you just need to ensure the correct string->data marshalling is present, not just booleans but things like dates, numbers too. One would think a lot of tools are out there to help with this, though googling it seems folks either roll their own (since it is simple) or they use the richer features of Pandas. In an earlier era, people would use form processing tools such as deform. csvschema seems pretty good too but looks a little stale (then again, csv hasn't changed much since 2014)... Thanks. I understand that all strings except ''are falsy. However, the cited migration note does not mention strings, right (only integers)? IMHO it is surprising that directly inserting '0' into an Integercolumn does the expected coersion for the target data type but doing the same with a Booleancolumn stopped working analogically in 1.1. How about changing the conversion to return int(bool(int(value)))? then I'll update the document. The design (which actually has a critical issue I just found) is that the integer type does: int(value) and the boolean type does bool(value). It would be less consistent that the boolean coercion adds an additional int() to work around Python's calling style. That would treat a string '0' as False which is not what Python does, and I dont see a reason this boolean type should not act as closely to Python's notion of booleans as possible. However, some backends are still doing this, because the coercion isn't taking place in all cases. #4104is created in that this boolean coercion needs to be turned on for all backends to be consistent - most DBAPIs pass the string '0' straight through where it gets interpreted as false, so the change here did not take effect for every backend and that's kind of a critical issue. Since I screwed up the transition by not checking that native boolean backends consider string 0 to be false, one side or the other has to be changed now. So I've put it out for a vote on twitter. twitter consensus is clear that any string non-None/True/False/1/0 should raise. It's very possible this will have to be just a warning to ease transitions but let's see what we get with a straight ValueError first, in. For transparent coercion of strings to boolean in any way you'd like, use TypeDecorator. +1 for warning/error instead of implicit coersion. Thanks for the reminder to use TypeDecoratorfor special input handling like this. #4102 Change-Id: If9edba3af476bc4303246e55d0ecb53009084342 → <<cset 9ffee8c94a2e>> #4102 Change-Id: If9edba3af476bc4303246e55d0ecb53009084342 (cherry picked from commit 9ffee8c94a2ed586b2d1abe404276a044078b8ca) → <<cset 98c18ae8645d>> Disallow all ambiguous boolean values for Boolean In release 1.1, the :class: .Booleantype was broken in that boolean coercion via bool()would occur for backends that did not feature "native boolean", but would not occur for native boolean backends, meaning the string "0"now behaved inconsistently. After a poll, a consensus was reached that non-boolean values should be raising an error, especially in the ambiguous case of string "0"; so the :class: .Booleandatatype will now raise ValueErrorif an incoming value is not within the range None, True, False, 1, 0. Change-Id: If70c4f79c266f0dd1a0306c0ffe7acb9c66c4cc3 Fixes: #4102 → <<cset c63658973c95>>
https://bitbucket.org/zzzeek/sqlalchemy/issues/4102/0-coerced-to-true-sqlite-boolean-value
CC-MAIN-2018-13
refinedweb
674
64.2
As Dmitry K. wrote: > Opinion of the simple user: it is time to collect personal library > which will be inaccessible to fans of "deprecation". Please elaborate. If you have any reason to still use one of the constructs that has been marked deprecated (or is currently discussed to be), please speak up. So far, deprecation affected the following items, included the reasoning: . timer_enable_int() and enable_external_int() Both perform really simple operations on their respective interrupt masking register which aren't worth a private macro or inline function in any way. The API was flawed in several ways. The entire byte for the bit masks needed to be passed each time, so the application had to track in a separate variable which bits are currently set and which aren't. For the ATmega128 at least, there are now two registers for the timer interrupt bit masks, so timer_enable_int() is pretty pointless. Finally, the code as it is causes an #error to trigger for the AT86RF401 chip since that one doesn't have any external interrupt mask register. The only advantage of this was to provide a chip-independent method to activate external interrupts, regardless of the actual name of the external interrupt mask register (EIMSK, GIMSK, GICR). However, this could be solved by providing a generic register name definition in another header file instead, say <compat/io.h> or maybe <avr/genericio.h>, something that is needed for many other commonly found AVR features as well (different names of the UART registers between different AVRs come to mind). There was consensus that such a compatibility header would be worth the while, but nobody drafted one so far. . inb(), inp(), outb(), outp(), sbi(), cbi() These macros/inline functions have all been private hacks from avr-gcc that were invented by a time when avr-gcc itself was not smart enough to handle the direct assignment form for IO registers (and to optimize it properly). Now avr-gcc can do this, so there's no longer a justification for these hacks. They make code written for avr-gcc artificially incompatible with other C compilers for the AVR platform (all the Atmel examples use the direct assignment form as well), and i personally found that apart from ``I've always been doing it that way'' the most frequent reason why people in particular tend to use sbi() and cbi() is that they believe them to be more efficient than writing the generic C expression REG |= _BV(BIT); or REG &= ~_BV(BIT);. They simply don't realize that both are exact equivalents. In particular, if you don't optimize (-O0), /both/ forms cause the same inefficient code to be generated. In addition, outp() had an illogical order of arguments. . eeprom_rb(), eeprom_wb(), eeprom_rw() They have been deprecated in favour of a consistent namespace for EEPROM handling functions, using the longer but more descriptive names (like eeprom_read_byte()) instead. Previously, there has been a mix of short and long names. . BV() Has been deprecated in favour of _BV() since the name without the underscore is more risky to clash with a name in the application namespace (i. e. one that can legitimately be defined by the user). -- J"org Wunsch Unix support engineer address@hidden
http://lists.gnu.org/archive/html/avr-libc-dev/2003-06/msg00039.html
CC-MAIN-2013-20
refinedweb
536
50.57
Python Windows FAQ - 1 How do I run a Python program under Windows? - 2 How do I make python scripts executable? - 3 Why does Python sometimes take so long to start? - 4 Where is Freeze for Windows? - 5 Is a *.pyd file the same as a DLL? - 6 How can I embed Python into a Windows application? - 7 How do I use Python for CGI? - 8 How do I keep editors from inserting tabs into my Python source? - 9 How do I check for a keypress without blocking? - 10 How do I emulate os.kill() in Windows? - 11 Why does os.path.isdir() fail on NT shared directories? - 12 cgi.py (or other CGI programming) doesn't work sometimes on NT or win95! - 13 Why doesn't os.popen() work in PythonWin on NT? - 14 Why doesn't os.popen()/win32pipe.popen() work on Win9x? - 15 PyRun_SimpleFile() crashes on Windows but not on Unix; why? - 16 Importing _tkinter fails on Windows 95/98: why? - 17 How do I extract the downloaded documentation on Windows? - 18 Missing cw3215mt.dll (or missing cw3215.dll) - 19 Warning about CTL3D32 version from installer 1 How do I run a Python program under) [MSC. 2 How do I make python scripts executable? 3 Why. 4 Where is Freeze for Windows? . 5 Is a *.pyd file the same as a DLL?. 6 How can I embed Python into a Windows application?. 7 How. 8 How do I keep editors from inserting tabs into my Python source? The FAQ does not recommend using tabs, and the Python style guide. 9 How do I check for a keypress without blocking? Use the msvcrt module. This is a standard Windows-specific extension module. It defines a function kbhit() which checks whether a keyboard hit is present, and getch() which gets one character without echoing it. 10 How do I emulate os.kill() in Windows? Use win32api: def kill(pid): """kill function for Win32""" import win32api handle = win32api.OpenProcess(1, 0, pid) return (0 != win32api.TerminateProcess(handle, 0)) 11 Why does os.path.isdir() fail on NT shared directories?: 12 cgi.py (or other CGI programming) doesn't work sometimes on NT or win95!). 13 Why doesn't os.popen() work in PythonWin on NT?() 14 Why doesn't os.pop:. 15 PyRun_SimpleFile() crashes on Windows but not on Unix; why?. 16 Importing _tkinter fails on Windows 95/98: 'bin'.) 17 How.) 18 Missing). 19 Warning about CTL3D32 version from installer). David A Burton has written a little program to fix this. Go to and click on "ctl3dfix.zip"
http://python.org/doc/faq/windows
crawl-001
refinedweb
429
80.48
Getting started with MVC3 Architecture Hi today i am planning to write an article on Model-View-Controller architecture in the .net framework. In MVC architecture we have 3 different components. Model: A model is nothing but an object that represents some data. It can be something like a Person class that holds data like firstname,lastname,age and other information. It can also be a dataset obtained from sql. View: A view is nothing but an UI component that contains html content. A view takes model data and based on the data it generates the UI Controller: A controller is a component that interacts with both view and model. A controller interacts with model and gets data from it and then it returns a view which renders the UI part. We can understand about these components in depth going on… Creating our first MVC project: Note MVC3 was not provided as a template in VS2010. We are supposed to download that and install it Here we are creating an empty mvc3 application. In the above image we can see View Engine drop down. A view engine is used to render the html content. there are multiple types of view engines like razor, webform engine, NAHTML, Spark etc. With the empty MVC application we can see different folders. Among them Model,View and controller folders plays an important role. Adding Our First Controller: Now we will get a pop to enter the name(I am using FirstController) of the controller. Click on add it will add a file called FirstController.cs inside Controller folder. FirstController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplication2.Controllers { public class FirstController : Controller { // // GET: /First/ public ActionResult Index() { return View(); } } } The controller we added is derived from the Controller class. The controller is having an ActionResult called Index that retruns a view. Adding Our First Model: I am not doing much with the model. i am just adding a class called MyModel Class with few things like firtname,lastname. Right click on the model folder and click on add—> Add a class file and name it as MyModel.cs MyModel.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MvcApplication2.Models { public class MyModel { public string firstname; public string lastname; } } For now this is my model class. Modifying My Controller to interact with model and then returning a view that renders html: firstController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplication2.Controllers { public class FirstController : Controller { // // GET: /First/ public ActionResult Index() { Models.MyModel mod = new Models.MyModel(); mod.firstname = "pavan"; mod.lastname = "arya"; return View("MyFirstView",mod); } } } So here the index controller is interacting with the class present in the model and then it is returning the model to the view. Creating our View: Click on the view folder and click on add.Then enter the name and click on add.i am naming it as MyFirstView. Now we can see MyFirstView.cshtml file inside the subfolder(shared) of views folders. MyFirstView.cshtml @{ Layout = null; } @model MvcApplication2.Models.MyModel <!DOCTYPE html> <html> <head> <title>myFirstView</title> </head> <body> <div> @{ @Model.firstname; } </div> </body> </html> @model MvcApplication2.Models.MyModel this specifies the model that can be used and we can use properties of that model as follows. <div> @{ @Model.firstname; } </div> Why Do we Use MVC architecture when we have WebForms: As of now i am not sure about the performance between MVC and web forms. But i have my own advantages that made me to use MVC 1.WebForms architecture is tightly coupled. That is we have tight coupling between aspx and aspx.cs. 2. Whenever we request for some data initially the request is routed to aspx page and from there it will interact with aspx.cs which in turn interacts with the bussinees layers and data layers. So everything is tightly coupled. 3. MVC overcomes these problems and provides loose coupling between different layers. 4 In MVC when we request for a resource it will initially hit the controller(This is taken care by routing tables in Global.ascx.cs) from there it will perform operations on the business logic and then finally it will pass return a view and can pass model object(that contains data) to the view. 5. Here we have an advantage. Suppose i am calling a controller and from there i’ll perform some business logic and based on some output from business logic i decided to render one view. let us assume i am calling a method met() in class A. This returns a boolean value and based on the boolean value i can call different views and each view renders different UI. So in this way it breaks the coupling between UI(like aspx) and code behind(like aspx.cs) files […] in my previous post we saw the basics of MVC3 architecture. Now let us discuss about the controller and rendering Views in […] Rendering a View from a Controller in MVC3 « pavanarya June 5, 2012 at 1:14 pm can you tell me difference between MVC3 and MVVM ? and those are blogs to which tier architecture (3tier and n-tier why) satyam October 9, 2012 at 8:07 pm Hi Satyam, You can go through this for diff between MVC and MVVM pavanarya October 10, 2012 at 1:56 pm
https://pavanarya.wordpress.com/2012/05/28/getting-started-with-mvc3-architecture/
CC-MAIN-2018-30
refinedweb
911
67.65
Polymorphism and abstract classes This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here! // -------------------------------- // -----. what is happening in the java code QUESTION 1 public abstract class Account{ public abstract boolean open(double); } public class Checking extends Account{ public boolean open (double bal){ } } In the above code, what happens if open() is not declared in each subclass of Account? Question 2 public class A{ private int i; public void setI(int j){ i = j; } public class B{ private A a; public A getA(){ return a; } } How do you access the value of i from the B class? Question 3 Given the following code: public class Exam { private int [] list; private int num; Exam () { list = new int[100];} public void addItem (int i) { list[num++] = i; } // insert method here } Which of the following may be a violation of information hiding if inserted for the comment above? Answer A public int[] getList(){ return list; } B None of the above C public int[] getList(){int[] copy=new int[list.length]; for(int i = 0;i<num; i++) copy[i]=list[i]; return copy;} D public int getAListValue (int index){ return list[index]; } Question 4 Which of the following is true regarding subclasses? Answer A A subclass that inherits methods from its superclass may not override the methods. B A subclass that inherits instance variables from its superclass may not declare additional instance variables. C A subclass may inherit methods or instance variables from its superclass but not both. D A subclass inherits methods and instance variables from its superclass, and may also implement its own methods and declare its own instance variables. Question 5 Which of the following statements about an interface is true? Answer A An interface has instance variables but no methods. B An interface has methods but no instance variables. C An interface has neither methods nor instance variables. D An interface has methods and instance variables. Question 6 Which statement is true about a class that is marked with the keyword final: Answer A A class marked final will not compile unless at least one method is marked final B You can instantiate only a subclass of a final class, not the final class itself C You can extend a final class D You can instantiate a final class Question 7 What must a subclass do to modify a private superclass instance variable? Answer A The subclass must simply use the name of the superclass instance variable. B The subclass must declare its own instance variable with the same name as the superclass instance variable. C The subclass must use a public method of the superclass (if it exists) to update the superclass's private instance variable. D The subclass must have its own public method to update the superclass's private instance variable. Question 8 Consider the following class hierarchy: public class Vehicle{ private String type; public Vehicle(String type) { this.type = type; } public String getType() { return type; } } public class LandVehicle extends Vehicle { public LandVehicle(String type) { . . . } } public class Auto extends LandVehicle { public Auto(String type) { . . . } } Which of the following code fragments is NOT valid in Java? Answer A LandVehicle myAuto = new Auto("sedan"); B LandVehicle myAuto = new Vehicle("sedan"); C Auto myAuto = new Auto("sedan"); D Vehicle myAuto = new Auto("sedan"); Question 9 Consider the following code snippet: Employee anEmployee = new Programmer(); anEmployee.increaseSalary(2500); Assume that the Programmer class inherits from the Employee class, and both classes have an implementation of the increaseSalary method with the same set of parameters and the same return type. Which class's increaseSalary method is to be executed is determined by ____. Answer A the variable's type. B it is not possible to determine which method is executed. C the hierarchy of the classes. D the actual object type. Question 10 Consider the following code snippet: if (anObject instanceof Auto) { Auto anAuto = (Auto) anObject; . . . } What does this code do? Answer A This code tests whether anObject was created from a superclass of Auto. B This code creates a subclass type object from a superclass type object. C This code safely converts an object of type Auto or a subclass of Auto to an object of type Auto. D This class safely converts an object of any type to an object of type Auto. Question 11 Consider the following code snippet: public void deposit(double amount) { transactionCount ++; super.deposit(amount); } Which of the following statements is true? Answer A This method will call itself. B This method calls a public method in its superclass. C This method calls a public method in its subclass. D This method calls a private method in its superclass Question 12 If a super class named Pet and a sub class named Cat both have an instance method named methodOne() with the same method declarations, the Cat class would call methodOne() in the Pet class as follows: Answer A this.methodOne(); B Pet.methodOne(); C Cat.methodOne(); D super.methodOne(); E methodOne(); Question 13 Consider the following code snippet: public class Motorcycle extends Vehicle { private String model; . . . public Motorcycle(int numberAxles, String modelName) { model = modelName; super(numberAxles); } } What does this code do? Answer A It invokes a private method of the Vehicle class from within a method of the Motorcycle class. B It invokes the constructor of the Motorcycle class from within the constructor of the Vehicle class. C This code will not compile. D It invokes the constructor of the Vehicle class from within the constructor of the Motorcycle class. Question 14 Select any statement in below that will generate an error if it replaces the comment public class Person { public String toString() { return "Person"; } } public class Student extends Person { public String toString() { return "Student"; } } public class GraduateStudent extends Student { } public class Test { public static void m(Student x) { System.out.println(x.toString()); } public static void main(String[ ] args) { // Replace this comment with given statement } } Answer A m(new GraduateStudent()); B m(new Object()); C m(new Person()); D m(new Student()); Question 15 Fill in the blank to indicate either the type of error (be specific!) or the output produced by the code : var.m(); public class A { public void m() {System.out.println ("m in class A");} } public class B extends A { public void m() {System.out.println ("m in class B");} } public class Main { public static void main (String [] args) { Object var = new B(); var.m(); // ____________________________ } } Answer Question 16 Fill in the blank to indicate either the type of error (be specific!) or the output produced by the code: ((A)var).m(); public class A { public void m() {System.out.println ("m in class A");} } public class B extends A { public void m() {System.out.println ("m in class B");} } public class Main { public static void main (String [] args) { Object var = new B(); ((A)var).m(); // ____________________________ } } Question 17 If a method in a subclass has the same signature as a method in the superclass, does the subclass method overload or override the superclass method? Question 18 Given the following 3 data definition classes that will provide structure for a application to manage inventory at a store that sells Produce and Grocery items: public abstract class Item { String name; double cost; public static final double TAX = .05; public String getName() {return name;} public double getCost() {return cost;} public void setName(String n) { name = n;} public boolean setCost (double c){ cost = c; return (c > 0 && c < 100) ? true : false; } abstract public double amount() ; public double total() {return amount() * (1+TAX); } abstract public boolean sellItem (double amt) ; } public class Grocery extends Item { private int quantity; private static int numItems = 0; public static int getNumItems() { return numItems; } public boolean setQty (int q) { quantity = q; return (q > 0 && q < 100) ? true : false; } public double amount () {return quantity * getCost();} public boolean sellItem (double amt) { if (amt > quantity) return false; quantity -= (int) (amt+ .001); return true; } Grocery () {numItems++;} } public class Produce extends Item { private double weight; private static int numItems = 0; public static int getNumItems() { return numItems; } public boolean setWeight(double w) { weight = w; return (w > 0 && w < 10) ? true : false; } public double amount () {return weight * getCost(); } public boolean sellItem (double amt) { if (amt > weight) return false; weight -= amt; return true; } Produce () {numItems++;} } Give an example (by a short code segment and explanation) of how polymorphism would be implemented. Question 19 A Java method doing Input/Output or other tasks may encounter errors that generate exceptions. In these cases, the Java method may wish to handle the exception itself. If a Java method wants to handle an exception, how does it do this? Augment your answer with some Java code segments, to illustrate your explanation.View Full Posting Details
https://brainmass.com/computer-science/graphics/176990
CC-MAIN-2018-47
refinedweb
1,450
53
A short while ago, I was working for a client, integrating video reviews in their website. Like any motivated developer solving a novel problem, the first thing I did was Google it, and I found a plethora of unhelpful or misguided answers on how to achieve something entirely different, or outdated and unmaintained Python packages. Eventually, I bit the bullet and the team and I built everything from scratch: we created the views, learned about Google’s API, created the API client, and eventually succeeded in programmatically uploading videos from Django. In this post, I’ll try to guide you step by step in how to post YouTube videos from your Django app. This will require a bit of playing around with Google API credentials—first with the web interface, then with the code. The YouTube part itself is very straightforward. We need to understand how Google stuff works because sometimes it’s tricky and the information is spread through many places. Prerequisites I recommend familiarizing yourself with the following before we begin working: - YouTube Data API: Python Quickstart - YouTube Data API: API Reference - YouTube Data API: Code Samples - Google Python API Client Library - Google Python API Client Library: Reference Doc - Google Python API Client Library: Code Samples - YouTube API: Python Code Samples An interesting bit of code to note is the following Python Snippet from the Google YouTube API Docs: # Sample python code for videos.insert def videos_insert(client, properties, media_file, **kwargs): resource = build_resource(properties) # See full sample for function kwargs = remove_empty_kwargs(**kwargs) # See full sample for function request = client.videos().insert( body=resource, media_body=MediaFileUpload(media_file, chunksize=-1, resumable=True), **kwargs ) # See full sample for function return resumable_upload(request, 'video', 'insert') media_file = 'sample_video.flv' if not os.path.exists(media_file): exit('Please specify a valid file location.') videos_insert(client, {'snippet.categoryId': '22', 'snippet.defaultLanguage': '', 'snippet.description': 'Description of uploaded video.', 'snippet.tags[]': '', 'snippet.title': 'Test video upload', 'status.embeddable': '', 'status.license': '', 'status.privacyStatus': 'private', 'status.publicStatsViewable': ''}, media_file, part='snippet,status') Getting Started After you’ve read the prerequisites, it’s time to get started. Let’s see what we need. Toolbelt Basically, let’s create a virtual environment. I personally prefer pyenv. Setting up both is out of the scope of this post, so I’m going to post some pyenv commands below and, if your preference is virtualenv, feel free to replace the commands accordingly. I’m going to use Python 3.7 and Django 2.1 in this post. ➜ ~/projects $ mkdir django-youtube ➜ ~/projects $ cd django-youtube ➜ ~/projects/django-youtube $ pyenv virtualenv 3.7.0 djangoyt ➜ ~/projects/django-youtube $ vim .python-version djangoyt Installing dependencies: ➜ ~/projects/django-youtube $ pip install google-api-python-client google-auth\ google-auth-oauthlib google-auth-httplib2 oauth2client Django unipath jsonpickle Now time to start our django project: ➜ ~/projects/django-youtube $ django-admin startproject django_youtube . Pause for some Google Config. Let’s config our project credentials now so we are able to use the Google APIs. Step 1. Go to the following URL: Step 2. Create a New Project. Step3. Click "Enable APIs and Services." Step4. Look for Youtube Data API v3, click "Enable." Step 5. You should get a message about credentials. Step 6. Click on the "Create credentials" blue button on the right side, and you should get the following screen: Step 7. Choose Web server, User Data Step 8. Add authorized JS origins and redirect URIs. Continue to the end. OK we are done with our credentials set up. You can either download the credentials in a JSON format or copy the Client ID and Client Secret. Back to Django Let’s start our very first Django app. I usually name it “core”: (djangoyt) ➜ ~/projects/django-youtube $ python manage.py startapp core Now, let’s add the following to our root urls.py file to route the homepage requests to our core app: # urls.py from django.urls import path, include path('', include(('core.urls', 'core'), namespace='core')), In the core app, let’s have another urls.py file, with some config also: # core/urls.py from django.conf import settings from django.conf.urls.static import static from django.urls import path from .views import HomePageView urlpatterns = [ path('', HomePageView.as_view(), name='home') ] if settings.DEBUG: urlpatterns += static( settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) See there is an empty path pointing to HomePageView. Time to add some code. Let’s do now a simple TemplateView just to see it running. # core/views.py from django.shortcuts import render from django.views.generic import TemplateView class HomePageView(TemplateView): template_name = 'core/home.html' And of course we need a basic template: # core/templates/core/home.html <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> We need to do some settings tweaks: # settings.py from unipath import Path # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = Path(__file__).parent INSTALLED_APPS = [ # [...] 'core', ] STATIC_ROOT = BASE_DIR.parent.child('staticfiles') STATIC_URL = '/static/' MEDIA_ROOT = BASE_DIR.parent.child('uploads') MEDIA_URL = '/media/' Let's create now a YoutubeForm and add as form_class to the view: from django import forms from django.views.generic.edit import FormView class YouTubeForm(forms.Form): pass class HomePageView(FormView): template_name = 'core/home.html' form_class = YouTubeForm Try to run your application now, and the page will look like this: Pause to do Authorization First of all, you have to create a model to store your credentials. You could to through a file, cache system, or any other storage solution, but a database seems reasonable and scalable, and also you can store credentials per users if you want. Before proceeding, an adjustment needs to be made—there is fork of oauth2client that supports Django 2.1 that we have to use. Soon, we’ll have official support, but in the meantime, you can inspect the fork changes. They are very simple. pip install -e git://github.com/Schweigi/oauth2client.git@v4.1.3#egg=oauth2client # Because of compatibility with Django 2.0 Go to your settings.py and place the Client ID and Client Secret you got from Google in previous steps. # settings.py GOOGLE_OAUTH2_CLIENT_ID = '<your client id>' GOOGLE_OAUTH2_CLIENT_SECRET = '<your client secret>' Caution: storing secrets in your code is not recommended. I’m doing this simply as a demonstration. I recommend using environment variables in your production app, and not hardcoding secrets in application files. Alternatively, if you downloaded the JSON from Google, you can also specify its path instead of the settings above: GOOGLE_OAUTH2_CLIENT_SECRETS_JSON = '/path/to/client_id.json' The oauth2client package already provides plenty of functionality, with a CredentialsField already done that we can use. It’s possible to add more fields, like a foreign key and created/modified dates so we get more robust, but let’s stay simple. Simple model to store credentials: # core/models.py from django.db import models from oauth2client.contrib.django_util.models import CredentialsField class CredentialsModel(models.Model): credential = CredentialsField() Time to create migrations and migrate: (djangoyt) ➜ ~/projects/django-youtube $ ./manage.py makemigrations core (djangoyt) ➜ ~/projects/django-youtube $ ./manage.py migrate Now let’s change our API views to be able to authorize our application: In our core/urls.py file, let’s add another entry for the first authorization view: # core/urls.py from .views import AuthorizeView, HomePageView urlpatterns = [ # [...] path('authorize/', AuthorizeView.as_view(), name='authorize'), ] So first part of the AuthorizeView will be: # core/views.py from django.conf import settings from django.shortcuts import render, redirect from django.views.generic.base import View from oauth2client.client import flow_from_clientsecrets, OAuth2WebServerFlow from oauth2client.contrib import xsrfutil from oauth2client.contrib.django_util.storage import DjangoORMStorage from .models import CredentialsModel # [...] class AuthorizeView(View): def get(self, request, *args, **kwargs): storage = DjangoORMStorage( CredentialsModel, 'id', request.user.id, 'credential') credential = storage.get()='')''' And then second part: if credential is None or credential.invalid == True: flow.params['state'] = xsrfutil.generate_token( settings.SECRET_KEY, request.user) authorize_url = flow.step1_get_authorize_url() return redirect(authorize_url) return redirect('/') So if there is no credential or the credential is invalid, generate one and then redirect it to the authorize URL. Otherwise, just go to the homepage so we can upload a video! Let’s access the view now and see what happens: Let’s create a user then, before going to that page. (djangoyt) ➜ ~/projects/django-youtube $ python manage.py createsuperuser Username (leave blank to use 'ivan'): ivan Email address: ivan***@mail.com Password: Password (again): This password is too short. It must contain at least 8 characters. Bypass password validation and create user anyway? [y/N]: y Superuser created successfully. Let’s also log in with it via /admin. After, let’s access our /authorize/ view again. Then, OK, it tried to redirect to the callback URL we configured long ago with Google. Now we need to implement the callback view. Let’s add one more entry to our core/urls.py: # core/urls.py from .views import AuthorizeView, HomePageView, Oauth2CallbackView urlpatterns = [ # [...] path('oauth2callback/', Oauth2CallbackView.as_view(), name='oauth2callback') ] And another view: # core/views.py # the following variable stays as global for now='')''' # [...] class Oauth2CallbackView(View): def get(self, request, *args, **kwargs): if not xsrfutil.validate_token( settings.SECRET_KEY, request.GET.get('state').encode(), request.user): return HttpResponseBadRequest() credential = flow.step2_exchange(request.GET) storage = DjangoORMStorage( CredentialsModel, 'id', request.user.id, 'credential') storage.put(credential) return redirect('/') Note: The flow was moved to outside of the AuthorizeView, becoming global. Ideally, you should create it under the AuthorizeView and save in a cache, then retrieve it in the callback. But that is out of the scope of this post. The get method of AuthorizeView is now: def get(self, request, *args, **kwargs): storage = DjangoORMStorage( CredentialsModel, 'id', request.user.id, 'credential') credential = storage.get() if credential is None or credential.invalid == True: flow.params['state'] = xsrfutil.generate_token( settings.SECRET_KEY, request.user) authorize_url = flow.step1_get_authorize_url() return redirect(authorize_url) return redirect('/') You can take a look at similar implementations here. The oauth2clien package itself provides views but I particularly prefer to implement my custom Oauth view. - - Now if you try the /authorize/ URL again, the OAuth flow should work. Time to see if this work is worth it and upload our video! The HomePageView will first check for credentials and if it’s all good, we are ready for uploading our video. Let’s check how our new code for the HomePageView will look: import tempfile from django.http import HttpResponse, HttpResponseBadRequest from googleapiclient.discovery import build from googleapiclient.http import MediaFileUpload class HomePageView(FormView): template_name = 'core/home.html' form_class = YouTubeForm def form_valid(self, form): fname = form.cleaned_data['video'].temporary_file_path() storage = DjangoORMStorage( CredentialsModel, 'id', self.request.user.id, 'credential') credentials = storage.get() client = build('youtube', 'v3', credentials=credentials) body = { 'snippet': { 'title': 'My Django Youtube Video', 'description': 'My Django Youtube Video Description', 'tags': 'django,howto,video,api', 'categoryId': '27' }, 'status': { 'privacyStatus': 'unlisted' } } with tempfile.NamedTemporaryFile('wb', suffix='yt-django') as tmpfile: with open(fname, 'rb') as fileobj: tmpfile.write(fileobj.read()) insert_request = client.videos().insert( part=','.join(body.keys()), body=body, media_body=MediaFileUpload( tmpfile.name, chunksize=-1, resumable=True) ) insert_request.execute() return HttpResponse('It worked!') And the template: # core/templates/core/home.html <!DOCTYPE html> <html> <body> <h1>Upload your video</h1> <p>Here is the form:</p> <form action="." method="post" enctype="multipart/form-data"> { csrf_token } \{\{ form.as_p \}\} <input type="submit" value="Submit"> </form> </body> </html> Don't forget to add the video field to YouTubeForm: class YouTubeForm(forms.Form): video = forms.FileField() Here we go! Voila! Closing Notes The code needs some improvement, but it’s a good starting point. I hope it helped with most of the Google’s YouTube API Integration problems. Here are a few more important things to note: - For authorization, it’s important to require login and extra permissions for the user that will authorize your application to be uploading videos. - The flow variable needs to be moved out from being global. It isn’t safe in a production environment. It’s better to cache based on the user ID or session who accessed the first view, for instance. - Google only provides a refresh token when you do the first authorization. So after some time, mostly one hour, your token will expire and if you didn’t interact with their API you will start receiving invalid_grant responses. Reauthorizing the same user who already authorized a client will not guarantee your refresh token. * You have to revoke the application in your Google Accounts page and then do the authorization process again. In some cases, you might need to run a task to keep refreshing the token. - We need to require login in our view since we are using a user credential directly related to the request. - There is a work in progress based on this experience and this post. Of course there is a lot to be added, but it’s a good starting point: Uploading takes a lot of time, and doing it in your main application process can cause the entire application to block while the upload happens. The right way would be to move it into its own process and handle uploads asynchronously. The code needs some improvement, but it's a good starting point. I hope it helped with most of the Google's API handling and of course uploading your video to YouTube! Cheers! Discussion (1) I like it, great explanation. Do you know if anything exists to replace: from oauth2client.contrib.django_util.models import CredentialsField I get 'ImportError: cannot import name 'urlresolvers' from 'django.core'' when i try to import it, my understanding is that urlresolver is deprecated in Django v2 (which I don't understand since you are using 2.1?) at least according to this: stackoverflow.com/questions/431390... Maybe it would be easiest to just skip the oauth2client library completely and just build CredentialsField from the ground up?
https://practicaldev-herokuapp-com.global.ssl.fastly.net/ivancrneto/youtube-api-integration-uploading-videos-with-django-53c5
CC-MAIN-2022-33
refinedweb
2,303
52.26
Code. Collaborate. Organize. No Limits. Try it Today. This article is for anyone who is interested in game programming. I will take you through the basics of game programming. Here we are specifically focusing on the classic DOS games.. In general, a computer game has five elements: Graphics consists of any images that are displayed and any effects that are performed on them. This includes 3D objects, textures, 2D tiles, 2D full screen shots, Full Motion Video (FMV) and anything else that the player will see. Sound consists of any music or sound effects that are played during the game. This includes starting music, CD music, MIDI or MOD tracks, Foley effects (environment sounds), and sound effects. It encompasses how fun the game is, how immense it is, and the length of playability. The game's story includes any background before the game starts, all information the player gains during the game or when they win and any information they learn about character in the game. A story is an element of a game. The difference between a story and a game is that a story represents the facts in an immutable (i.e., fixed) sequence, while a game represents a branching tree of sequences and allows the player to create his own story by making choice at each branch point. Though graphics plays an important role in game programming, in this article we're not going to emphasize upon graphics and sound element of a game. We shall be concentrating at elementary game programming through text based interfaces. Since game design requires one to explore one's artistic abilities, it cannot be formulated in a step by step process. However, there are certain technical steps that one needs to follow in one way or another.These are: We will look at each of these in detail. While writing a game program, after selecting the goal-of-game, one needs to determine its initial requirements. For instance, to write a game program for guessing a number, you need to decide about a way to generate the number, number of players involved, number of chances allowed to the player, a scoring methodology etc. Here we are not aiming at making you a professional game programmer, rather we are concentrating more at giving you an idea of writing simple or elementary game programs. General Description of Game: The general description of a game involves the general overview of the game, how it works, what happens on each level, etc. It describes all parts of the game from the player's perspective: Interface is another very important aspect of game programming. The interface is the mode of communication between the computer and the player. Like any human language, it is the funnel through which the programmer must squeeze the avalanche of thoughts, ideas and feelings that he/she seeks to share with the fellow player. Interface will dictate what can or cannot be done. Interface is composed of input and output. While developing interface, the programmer should develop the static display screens and dynamic display screen. Static display is the screen which remains unaffected by the player's actions i.e., the input by the player. The dynamic display, on the other hand, is the screen which is governed by the player's actions i.e., the input by the player. Examples of some static display screens are: What options are available to the player on the game startup? This describes what options are on the menu, how and where it appears on what screen, how the player gets there, and how he gets out. What does the screen looks like at the beginning of the game, what are the startup parameters, where are the characters, etc? What messages, if any are on screen, and where? Intro music? Etc. Since the dynamic screen vary as per the input given by the player, their descriptions are too many to be listed here. Some examples: While developing interfaces, you also need to work on screens in response to legal actions of the player, by intimating that he/she is on the right track. Also, you need to work on the screens required to warn the player in case he/she commits an illegal move or action. These screens include messages and responses to questions like: What happens when the player loses? What happens when the player wins? What happens when the player get the high score? Where does the player go when the game is over? How does he start a new game? This step involves developing a proper logic for gameplay. This requires the game-programmer to answer many questions in the form of program-code. These questions include: How is game played? What are the controls? What is the Game Goal? How is the player going to achieve the game goal? etc. In other words, we must say that since game represents an event-driven situation, the game-programmer i.e., you must specify or program everything that includes: Developing logic for the scoring purposes is a subset of developing logic for the game play. For this, you must first decide the scoring policy that you're going to follow in your game. You're going to decide the maximum number of chances allowed, the scoring mechanism, whether it is tied to time or not, etc. During this phase, the milestone events are worked out and accordingly scoring (positively or negatively) is carried out. Every once in a while, the player needs to be rewarded (or penalized) somehow for reaching that point in the game. Each of these places where something special happens is called a Milestone Event. There are a gauge to let the player know he's on the right (or wrong) track, and will encourage (or discourage) him to keep going. Now that we have discussed these different phases in game-development, let us not develop a simple tic-tac-toe game. Now let us analyze different elements of the game design in the program that we're going to make. It's a two player game, so we need two variables to store their names and run a loop to ask for the player to enter their move turn by turn. So we need another variable to store the turn to see which player is to enter the move. Here are the variables: char name[2][30]; //double dimensional array to store names of the player int chance; //to store the chance, to track which player is to enter the move We need a function to handle the navigation to the boxes when the player presses arrow keys and hit the Enter button to enter his move in the box. We need another variable to track the current box the player is on at the movement. An array to store the values entered by the player. So here are the variables: int box; //to track the current box the player is on at the moment char a[3][3]; //array to hold the actual values that player enter while playing int navigate(char a[3][3], int box, int player, int key); // to handle key presses and update the current box the player is on // and to enter the move in to the box when player presses Enter. Here in this function, char a[3][3] is the array that holds the moves. box is the box the player was on, and key is the key pressed. a[3][3] box key Another variable is required to count the number of turns. There are nine boxes in total however the number of turns maybe more than nine because if the player tries to enter his move into a box that's already taken, then the chance passes over to the other player. int turns; // to count the number of chances We need a function to put the move into the box chosen by the player and we need to make sure that we don't overwrite the value in a box: void putintobox(char a[3][3], char ch, int box); Here a[3][3] is used to represent the boxes, ch is the character ‘O' or ‘X', and box is the box into which the value is to be entered. Now how would we know what character to put into the box? Well, this function is called by the navigate function mentioned above. So if the navigate function is called like this: box = navigate(a[3][3],3,0,ENTER);, then it means that player1(here player1-0, player2 is represented by 2) needs to enter into box 3. The putintobox function checks if the box is taken and enter the value in to the array that represents the boxes (a[3][3]), and calls another function showbox(char ch, int box) to show the character on screen in the specified box. ch navigate box = navigate(a[3][3],3,0,ENTER); putintobox showbox(char ch, int box) checkforwin checks if the player has won the game or not and boxesleft will check if all boxes are filled. We would need another variable to check if the player wants to quit the game so – int quit;. checkforwin boxesleft int quit; In order to interact with the user, many messages are displayed. Also the player is told if he won the game or if it's a draw. The program will also ask if the player wants to play again. So in our program, the messages would be: The logic of this program is to run a while loop that runs till a player wins, or all the boxes are filled up but no one won the game or if the user wants to quit. Now while the loop is running, the variable chance that tracks whose chance is it to enter the move is updated. A function will check what was the key what pressed by the user (user can enter only up, down, left, right or enter key) and moves the cursor to the specified box and enter the character assigned to the player into the array and displays that on the screen. It also makes sure that no box is overwritten. It the user tries to overwrite the box, chance is passed on to the other player as a penalty to the player who entered the wrong move. At the end of the program, the user is asked if he/she wants to play the game again. Here is the list of functions we would need: void showframe(int posx, int posy) void showbox(int ch, int box) void putintobox(char a[3][3], char ch, int box) showbox(ch,box) void gotobox(int box) int navigate(char a[3][3], int box, int player, int key) int checkforwin(char a[3][3]) int boxesleft(char a[3][3]) Details of the function: void showframe(int posx, int posy) //Function to show the Tic Tac Toe Frame void showframe(int posx, int posy) { int hr=196, vr=179; // These are ascii character which display the lines int crossbr=197; // Another ascii character int x=posx, y=posy; int i,j; gotoxy(35,4); cprintf("TIC TAC TOE"); gotoxy(35,5); for(i=0;i<11;i++) cprintf("%c",223); for(i=0;i<2;i++) { for(j=1;j<=11;j++) { gotoxy(x,y); printf("%c",hr); x++;p; x++; } x=posx; y+=2; } x=posx+3; y=posy-1; for(i=0;i<2;i++) { for(j=1;j<=5;j++) { gotoxy(x,y); printf("%c",vr); y++; } x+=4;y=posy-1; } x=posx+3; y=posy; gotoxy(x,y); printf("%c",crossbr); x=posx+7; y=posy; gotoxy(x,y); printf("%c",crossbr); x=posx+3; y=posy+2; gotoxy(x,y); printf("%c",crossbr); x=posx+7; y=posy+2; gotoxy(x,y); printf("%c",crossbr); } void showbox(char ch, int box) //Function to show the character in the specified box void showbox(char ch, int box) { switch(box) { case 1 : gotoxy(_x+1,_y-1); printf("%c",ch); break; //1st box case 2 : gotoxy(_x+5,_y-1); printf("%c",ch); break; //2nd box case 3 : gotoxy(_x+9,_y-1); printf("%c",ch); break; //3rd box case 4 : gotoxy(_x+1,_y+1); printf("%c",ch); break; //4th box case 5 : gotoxy(_x+5,_y+1); printf("%c",ch); break; //5th box case 6 : gotoxy(_x+9,_y+1); printf("%c",ch); break; //6th box case 7 : gotoxy(_x+1,_y+3); printf("%c",ch); break; //7th box case 8 : gotoxy(_x+5,_y+3); printf("%c",ch); break; //8th box case 9 : gotoxy(_x+9,_y+3); printf("%c",ch); break; //9th box } } //Function to insert the specified character into the array void putintobox(char arr[3][3], char ch, int box) { switch(box) { case 1 : if(arr[0][0] != 'X' && arr[0][0]!= 'O') { arr[0][0] = ch; showbox(ch,1); } break; case 2 : if(arr[0][1] != 'X' && arr[0][1]!= 'O') { arr[0][1] = ch; showbox(ch,2); } break; case 3 : if(arr[0][2] != 'X' && arr[0][2]!= 'O') { arr[0][2] = ch; showbox(ch,3); } break; case 4 : if(arr[1][0] != 'X' && arr[1][0]!= 'O') { arr[1][0] = ch; showbox(ch,4); } break; case 5 : if(arr[1][1] != 'X' && arr[1][1]!= 'O') { arr[1][1] = ch; showbox(ch,5); } break; case 6 : if(arr[1][2] != 'X' && arr[1][2]!= 'O') { arr[1][2] = ch; showbox(ch,6); } break; case 7 : if(arr[2][0] != 'X' && arr[2][0]!= 'O') { arr[2][0] = ch; showbox(ch,7); } break; case 8 : if(arr[2][1] != 'X' && arr[2][1]!= 'O') { arr[2][1] = ch; showbox(ch,8); } break; case 9 : if(arr[2][2] != 'X' && arr[2][2]!= 'O') { arr[2][2] = ch; showbox(ch,9); } break; }//end of switch } //Function to show the curson on the box specified //uses the position to check the coordinates void gotobox(int box) { switch(box) { case 1 : gotoxy(_x+1,_y-1); break; case 2 : gotoxy(_x+5,_y-1); break; case 3 : gotoxy(_x+9,_y-1); break; case 4 : gotoxy(_x+1,_y+1); break; case 5 : gotoxy(_x+5,_y+1); break; //5th box case 6 : gotoxy(_x+9,_y+1); break; //6th box case 7 : gotoxy(_x+1,_y+3); break; //7th box case 8 : gotoxy(_x+5,_y+3); break; //8th box case 9 : gotoxy(_x+9,_y+3); break; } } //Function to handle the navigation int navigate(char arr[3][3], int box, int player, int key) { switch(key) { case UPARROW : if( (box!=1) || (box!=2) || (box!=3) ) { box-=3; if(box<1) box = 1; gotobox(box); } break; case DOWNARROW : if( (box!=7) || (box!=8) || (box!=9) ) { box+=3; if(box>9) box = 9; gotobox(box); } break; case LEFTARROW : if( (box!=1) || (box!=4) || (box!=7) ) { box--; if(box<1) box = 1; gotobox(box); } break; case RIGHTARROW : if( (box!=3) || (box!=6) || (box!=9) ) { box++; if(box>9) box = 9; gotobox(box); } break; case ENTER : if(player == 0) putintobox(arr,'O',box); else if(player == 1) putintobox(arr,'X',box); break; }//end of switch(key) return box; } int checkforwin(char arr[3][3]) { int w=0; /* 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 2,2 */ //rows if((arr[0][0] == arr[0][1]) && (arr[0][1] == arr[0][2])) w = 1; else if((arr[1][0] == arr[1][1]) && (arr[1][1] == arr[1][2])) w = 1; else if((arr[2][0] == arr[2][1]) && (arr[2][1] == arr[2][2])) w = 1; //coloums else if((arr[0][0] == arr[1][0]) && (arr[1][0] == arr[2][0])) w = 1; else if((arr[0][1] == arr[1][1]) && (arr[1][1] == arr[2][1])) w = 1; else if((arr[0][2] == arr[1][2]) && (arr[1][2] == arr[2][2])) w = 1; //diagonal else if((arr[0][0] == arr[1][1]) && (arr[1][1] == arr[2][2])) w = 1; else if((arr[0][2] == arr[1][1]) && (arr[1][1] == arr[2][0])) w = 1; return w; } int boxesleft(char a[3][3]) { int i,j,boxesleft=9; for(i=0;i<3;i++) { for(j=0;j<3;j++) { if((a[i][j] == 'X') ||(a[i][j] == 'O')) boxesleft--; } } return boxesleft; } Now we have all the functions in place, we move on to the third step that talks about Presentation. We have actually taken care of presentation in some of the above written functions, haven't we? The ASCII character used in this program to display the vertical line is 179 and for horizontal line is 196. For a cross - 197. Check this website for more information about extended ASCII characters. You can even printout your ASCII table with a C program. Here is an example: #include <stdio.h> int main() { FILE *fh; int ch; fh = fopen("ascii.txt","r"); for(i=0;i<256;i++) fprint(fh,"\n%d - %c",i,i); fclose(fh); return 0; } Now we will talk about Exception Handling. Here in this program, we have kept it simple so nothing much to worry about here, however, we do take the name from the user. The array we use to store the name is of size 30. What if the user enters a string that is more than 30 in length? This would result in a buffer overflow. This may crash your program right away or produce unexpected results. To avoid this either we can write a function that would get a string from the stdin one by one and stops if Enter is pressed or if string is more than 30 OR we can use the inbuilt function known as fgets. stdin fgets Finally, putting it all together: #include <stdio.h> #include <conio.h> int main() { /* Declaration of variables used */ showframe(12,25); printf("\nPlayer 1, enter your name:"); fgets(name[0], 30, stdin); printf("\nPlayer 2, enter your name:"); fgets(name[1], 30, stdin); printf("\n%s, you take 0",name[0]); printf("\n%s, you take X",name[1]); getch(); clrscr(); do { while(!enter) { if(khbit()) ch = getch(); switch(ch) { case UPARROW : box = navigate(a[3][3], box, player, UPARROW); . . . } } if(quit) break; //check if the player wins win = checkforwin(a); }while(!win) if(win) { . . } else if(quit) { . . } return 0; } View the complete source code and executable to take a look at how the program works. Here are some screenshots of the working executable for Tic Tac Toe: This article was not a complete fully fledged article for game programming but I hope that you gain something out of it. If you have any questions, please feel free to email me at shine_hack@yahoo.com Source code for this program can be obtained at:. Happy programming! Shine Jacob (Enot): shine_hack@yahoo.
http://www.codeproject.com/Articles/447332/Game-Programming-in-C-For-Beginners?msg=4352389
CC-MAIN-2014-23
refinedweb
3,149
67.08
An Introduction to NestJS for Ionic Developers By Josh Morony Creating a backend for your application has typically required a totally different skill set to what you might use for the front end. Over time, those lines have blurred as the likes of NodeJS and server-side JavaScript have risen in popularity. Now, with NestJS, you might not even feel like you are working on a backend at all. NestJS is a NodeJS framework for building server-side applications. The major thing that drew me towards NestJS was its similarities to standard Angular architecture. You will find a lot of the same concepts used in NestJS as you will in an Angular, including: - TypeScript - Imports/Exports - Services/Providers - Modules (e.g. app.module.ts) - Pipes - Guards Although NestJS introduces its own unique concepts as well – including additional decorators like @Controller, @Get, and @Post – the general methodology is very much Angular inspired. It seems to be that anywhere that the framework can be like Angular, it is (and that is fantastic). If you are familiar with Angular, or building Ionic/Angular applications, you are already going to feel comfortable with many of the key concepts for NestJS. As much as I enjoy building servers with vanilla NodeJS and Express (NestJS uses Express behind the scenes), I feel much more at home with NestJS. NestJS brings that Angular experience to the backend – it’s super easy to get started with built-in generators in the Nest CLI and TypeScript support is included by default. In this tutorial, we are going to focus on getting a simple project set up that uses Ionic for the frontend and NestJS for the backend. For now, we will just be focusing on a bare-bones “Hello world!” style example. We will not be focusing on exploring the theory of NestJS in-depth, and we will only be covering the key concepts required to get a simple server running. In future tutorials, we will cover other aspects of NestJS. Before We Get Started Last updated for Ionic 4.0.0-beta.7 and NestJS 5.0.0 This tutorial will assume a basic understanding of Ionic and Angular. It will also help to have a general sense of how integrating a backend with an Ionic applications works – if you are not already familiar, you might be interested in reading this article. & Angular. 1. Create a Client/Server Project Structure When we are creating an Ionic application with a backend, we are going to require two separate projects: the Ionic project, and the NestJS project. A structure I like to use is to use a single folder for the entire project, which contains a client folder for the Ionic project, and a server folder for the NestJS project. You don’t need to use this structure if you don’t want to, just make sure that you are not creating your NestJS project inside of your Ionic project (or vice versa). In order to start a new NestJS project, you can install the NestJS CLI: npm i -g @nestjs/cli and then you will just need to run: nest new server I used server as the project name here because, as I mentioned, I want the NestJS project to be contained inside of a folder called server – you can supply a different name for the project if you wish. Once you have generated the NestJS project, you should have a quick browse around the files and folders that were created. As I mentioned, we are going to cover more of the theory stuff in future tutorials, but just from looking around you will likely notice a few similarities between the NestJS project and an Angular (or Ionic/Angular) project. 2. Create a Simple NestJS API Unlike a frontend client-side application built with Ionic/Angular, a backend/server application primarily performs the function of listening for requests and responding to those requests. The way in which we would integrate out front-end Ionic application with our backend NestJS server is by making HTTP requests from our Ionic application to the URL of the server where our NestJS backend is hosted. If our NestJS server was running on then perhaps we would make an HTTP request from our Ionic application to. Our NestJS application would then receive that request and then it can send a response back to the Ionic application (what that response is will depend on what it is you code the server to do). In order to set up a simple API that responds appropriately to that request, we are going to need to set up a @Controller in NestJS. A @Controller is a NestJS concept that allows us to set up routes for the application, and those routes can handle responding to requests. Run the following command to generate a messagescontroller: nest g controller messages This will create a basic controller template at src/messages/messages.controller.ts that looks like this: import { Controller } from '@nestjs/common'; @Controller('messages') export class MessagesController { } As is typical in Angular applications, we just have an exported class topped with a particular decorator – in this case, we are just using the NestJS @Controller decorator to identify this class as a controller. Also note that this controller is automatically added to app.module.ts if you use the generator: import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; import { MessagesController } from './messages/messages.controller'; @Module({ imports: [], controllers: [AppController, MessagesController], providers: [AppService], }) export class AppModule {} Again, this is all rather Angular-esque – instead of using @NgModule NestJS is just using @Module but the general concept remains the same. Modules bundle chunks of functionality together, and in our root module, we are including the various dependencies that will be used throughout the application. Our controller is going to allow us to listen to and respond to requests on the messages route. In order to allow for GET requests, we will also need to import the @Get decorator and use it to decorate a method that will return a response. Modify src/messages/messages.controller.ts to reflect the following: import { Controller, Get } from '@nestjs/common'; @Controller('messages') export class MessagesController { @Get() getMessages(){ return { message: 'In a real example, I would return all of the messages' } } } By adding the @Get decorator above getMessages, this method will now be triggered when we activate the messages route by making a request to. Whatever this method returns is what will be supplied in response to that request. We are just supplying a simple message in return, but in a real application, you might fetch some actual messages from a database before returning a response to the requester. If we wanted to set up an additional route that would allow us to grab a specific message from the backend, we might do something like this: import { Controller, Get, Param } from '@nestjs/common'; @Controller('messages') export class MessagesController { @Get() getMessages(){ return { message: 'In a real example, I would return all of the messages' } } @Get(':id') getMessage(@Param('id') id){ return { message: `In a real example, I would return the message with an id of ${id}` } } } Now we are importing and using the @Param decorator, which will allow us to grab parameters from our routes. Once again, the way in which you supply parameters through routes is very similar to Angular routes – we just prefix the desired parameter with a :. With this additional route defined, we would now be able to make a request to and the response we receive will be able to make use of the id that was supplied. 3. Run the NestJS Server If we now start our NestJS server by running: npm run start inside of our NestJS project, and then navigate to: We will first see the Hello world! message that the default project generates by default (this code is contained in the app.controller.ts file). However, if we then navigate to: We will see the message we are returning from our getMessages method: In a real example, I would return all of the messages If we then navigate to: we would see the following result: In a real example, I would return the message with an id of 14 We can see that the server has been able to grab the id we supplied and use it in its response. In a real-world scenario, we would probably use that id to look up a specific record in a database. Interacting with our server through by navigating to URLs through our browser is all well and good, but this isn’t how we would interact with the server generally. We would be making HTTP requests from our client-side application, which in this case is our Ionic application. Let’s investigate how to do that. 4. Enable CORS (Cross-Origin Resource Sharing) Before we can make requests to our server (in development at least), we will need to enable CORS (Cross-Origin Resource Sharing). By default, requests from one domain to another are blocked unless the server specifically allows it. Since our Ionic application will be running on localhost:8100 and the server will be running on localhost:3000 our requests from Ionic to NestJS will be blocked. If you want to know more about what CORS is exactly, I would recommend reading Dealing with CORS (Cross-Origin Resource Sharing) in Ionic Applications. Enabling CORS in a NestJS server is simple enough, we just need to add app.enableCors() to the main.ts file in our NestJS project: import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors(); await app.listen(3000); } bootstrap(); Make sure to stop and re-run your server after making these changes: Ctrl + C npm run start 5. Integrating a NestJS API with an Ionic Application All we have left to do now is to make the request from our Ionic application to the NestJS server we have running (you do need to make sure that you keep it running, otherwise the request won’t work). Create the following service to interact with the NestJS API: ionic g service services/Messages We will also be making use of the HttpClient library, so make sure that you have the HttpClientModule set up the root module file for your Ionic project. Modify src/app/services/messages.service.ts to reflect the following: import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs' @Injectable({ providedIn: 'root' }) export class MessagesService { constructor(private http: HttpClient) { } getMessages(): Observable<Object> { return this.http.get(''); } getMessage(id: string): Observable<Object> { return this.http.get(`{id}`); } } We’ve just created two simple methods that will make our HTTP requests to the server for us. Now, all we need to do is make use of these somewhere – as an example, we are just going to add it to the ngOnInit hook(){ this.messages.getMessages().subscribe((res) => { console.log(res); }); this.messages.getMessage('12').subscribe((res) => { console.log(res); }); } } If we were to serve our Ionic application now (whilst the NestJS server remains running) we would see the following values output to the console: As you can see, both requests have received a successful response from our NestJS server. Summary We have just scratched the surface of NestJS, so there will be plenty more tutorials to come in the future that will cover all sorts of concepts and examples. The good news is that if you already know Angular, then you already know a lot about NestJS. In the meantime, it is always a good idea to have a read through the official documentation.
https://www.joshmorony.com/an-introduction-to-nestjs-for-ionic-developers/
CC-MAIN-2019-51
refinedweb
1,948
54.66
At the moment, when someone wants to stop paying for a rolling Plan/Membership, they need to contact admin so that we can delete their membership, and avoid the next payment. Is there any chance we would be able to give our members/clients the freedom to cancel their subscription whenever they want? (This could be restricted to "X" days of notice, or done straight when clicking "cancel my subcription") As admin, we are able to cancel client's subscriptions online, through out dashboard, but not on wix app. It would also be handy if we would be able to cancel other's subscription through the app. Thank you! Hi, Thanks for the feedback. First you already have the option to cancel subscription through the Wix App. Go to app Dashboard>> Paid Plans>> Purchased tab>> tap a specific purchase there>> 3 dots at the top>> there you have the option to cancel. Regarding giving this option to members- we'll add it to our queue. Thanks. Hi Noa, thank you very much! I didn't realize that I could cancel through the app, and that's great to know! Yes please! Where will this feature request be so I can vote for it? @Daniela Azzip You can find it here. Please Vote and you will be notified when the feature will go out. @Antanas Dapkus Thank you for sending the link back! Hello Noa, It feels like there is an update due regarding the paid plans app. Are there any timeline estimates regarding a new version of this app? Doesn't have to be exact but are we taking next couple of months or sometime later this year, or next year perhaps? Just the cancellation piece alone is a huge piece when dealing with customer interactions and user management, but there are also various other pieces of this app which require a serious overhaul. Many thanks, talk to you soon. Kind regards, Chris Yes I agree with this. There are many things i feel are pushed out to quick and then abandoned. Understand that it is important for you guys to make money however, when you look at our site building, think of it like if on how you guys would want your site to be for us users. Image a world where we had to contact you with 50,000+ accounts asking for account changes. We need this option soon!!! Hi, Thanks for the feedback. We're constantly trying to improve our products, same with Paid Plans. We'll keep you updated. I hate to be rude, but I mean, is this a joke? Why on Earth can't customers/members manage their own accounts? It shouldn't be up to us as the page designers to do this sort of thing, for one. Two, I can't even easily find where I can cancel a member's account. Three, I've had a couple of issues regarding payments and how they function, and I always get a response back from Wix in the affect of "You can do it manually". Why should I be doing all this stuff manually? What are we paying Wix all this money for? I have enough to do with my site, let alone my life outside of this. Four, what if something happens to me? What if I become paralyzed? What if I die? My customers are just going to keep paying and paying even though I am not updating my page at all, with no way to cancel? I've never heard of such a thing. I don't even understand why this is something that should be voted on. This should have been implemented prior to Wix even allowing us to create pages and granting members access. I'm truly baffled. @Martin Martyr I am sorry to hear that you had a bad experience with Paid Plans. I would love to talk to you about your problems. Please contact me at antanasd at wix.com so that we could schedule a call. Kind regards, I am so sorry, but this is so true. Members should be able to cancel their paid plans, it just makes sense. Image if you have to deal with every one you have on WIX, wanting to cancel their plans, but they can't do it on their end, so you have to do it manually for them. You wouldn't be able to focus on the hard work you have to do to make this platform better, because you would be consuming so much time dealing with admin! That's why we need this feature really soon! Can't believe this is still not possible to allow customers to update/ cancel their plans. I will have no other option than to stop using Wix then... I am still shocked Wix doesn't allow this I agree 100%. This is absolutely asinine that Wix chooses not to implement this standard and fundamental necessity into their list of features. Not only does this make Wix looks bad, but it makes us as website creators look bad. Our customers do not realize that this is something that Wix refuses to add, but they think that it is on us. Everything that we do or don't do on our websites come back to us, and the fact that Wix is dragging their feet on a function that could take a matter of hours to implement, shows their true lack of professionalism and their unwillingness to provide us with an adequate business model. I will be discontinuing my Wix account as well if this is not implemented in the next few weeks. Done playing games with my business and my customer's hard earned money. Completely unacceptable! We are working on My Plans feature that would allow to view and manage (cancel) orders for members in Members area. In the meantime, we have released Corvid API that allows to create a custom page that would show plans and cancel them. You can read the documentation here. Way to allow site members to cancel their own orders: 1. For the members to be able to cancel their orders first you'll need to be able to show them the orders so they could choose what to cancel. Way to have orders' data is to save it in your own DB dataset in corvid () every time the member purchases a plan. E.g. of the data that can be collected and saved on every purchase of the plan: "planName": plan.name, "planId": plan._id, "orderId": purchaseResponse.orderId, "memberId": user.id , "dateCreated": Date().toString() "plan" is the plan to be purchased, "purchaseResponse" is the response we get after calling .purchasePlan () method because it's return value is PurchaseResult () , "user" - currently logged in user . Example of the code used on dynamic page of custom package picker where member can purchase a plan (notice a field called "canceled" - it is needed so you would be able to track if member canceled the order or not, it is obvious that on the purchase we need to set it to false): import paidPlans from 'wix-paid-plans'; import wixData from 'wix-data'; import wixUsers from 'wix-users'; $w.onReady(function () { $w('#dynamicDataset').onReady( () => { const plan = $w("#dynamicDataset").getCurrentItem(); // purchase a plan $w("#button2").onClick( (event) => { const purchase = paidPlans.purchasePlan(plan._id).then(purchaseResponse => { // get current member (who is purchasing the plan) let user = wixUsers.currentUser; // collect all the data you want to save to your collection let toInsert = { "planName": plan.name, "planId": plan._id, "orderId": purchaseResponse.orderId, "memberId": user.id, "canceled": false, "dateCreated": Date().toString() }; // insert the data into "subscriptions" collection that you've created (how to) wixData.insert("subscription", toInsert) }) }); }); }); 2. Once you start saving members' orders data you'll have the necessary information to be able to allow them to cancel their orders. Cancellation can be done calling .cancelOrder method () which takes orderId (which you are saving to your DB dataset (field " "orderId": purchaseResponse.orderId " in the previous example)). You can create members area page Subscriptions on your site where you'd show logged-in member's orders: code example: import wixPaidPlans from 'wix-paid-plans'; import wixData from 'wix-data'; import wixUsers from 'wix-users'; import wixWindow from 'wix-window'; $w.onReady(function () { // const user = wixUsers.currentUser; // filter dataset so only currently logged-in user's orders would be visible () $w("#dataset1").setFilter( wixData.filter() .eq("memberId", user.id) ) .then( () => { $w('#dataset1').onReady( () => { $w("#button1").onClick( (event) => { const $item = $w.at(event.context); const subscription = $item("#dataset1").getCurrentItem(); const orderId = subscription.orderId; // Cancel the specific order of the logged-in user - wixPaidPlans.cancelOrder(orderId) .then( () => { // Get details for updating status of existing subscription ("subscription" dataset you've created before) const toUpdate = { "_id": subscription._id, "planName": subscription.planName, "planId": subscription.planId, "orderId": subscription.orderId, "memberId": user.id, "dateCreated": subscription.dateCreated, "canceled": true, // Set cancellation to true "dateUpdated": Date().toString() }; // Update existing subscription in collection to show that the subscription is canceled wixData.update("subscription", toUpdate); // OPTIONAL - Let user know that cancellation succeeded by opening some lightbox wixWindow.openLightbox("planCanceled") }) // Do something in the case of error - e.g. open lightbox that says that cancellation failed .catch((err) => { wixWindow.openLightbox("cancelFailed"); }); }) }) } ) .catch( (err) => { // in the case $w("#dataset1").setFilter(...) fails console.log(err); } ); }) Let me know if you will have questions at antanasd (eta) wix.com. I am terrible at coding and this is too complicated for me, so I will be waiting for this feature to be released :) If/when you do open the option for members to cancel their subscriptions, PLEASE make it an option that admin can select from the back-end. I am using paid plans as more so a payment plan than a monthly membership, so I do NOT want my "members" to be able to cancel on their own and at any time. THANK YOU. Hi, thanks for your feedback. We will include it into product development.
https://www.wix.com/corvid/forum/community-feature-request/allow-a-client-to-cancel-a-plan-membership-on-their-own
CC-MAIN-2019-47
refinedweb
1,657
74.69
A couple weeks ago we finally released Devise 1.1 which is fully-compatible with Rails 3! Not only that, we’ve been working with Rails 3 since the first betas and several features were added along the way! Let’s take a look at those, some architectural changes and see how Devise 1.1 and Rails 3 will change how you handle authentication. Pretty URLs with Metal A common complaint in Devise 1.0 (for Rails 2.3) was, in order to know which message to show to the user when sign in failed, we had to pass a parameter in the URL as in /users/sign_in?unauthenticated=true while one would expect us to simply use flash messages. This happened because the redirection was done not from inside a controller, but a Rack application set up in Warden (a Rack authentication framework Devise relies on) and we could not access flash messages from it. However, since Rails 3 moved several responsibilities to the Rack layer, including flash messages, we can easily access flash messages from any Rack application, allowing us to remove the parameter from the URL! Even more, Rails 3 provides small, fast, bare bone controllers through ActionController::Metal, which we used in Devise to clean and speed up the code considerably. Locking goodness The lockable module in Devise also went through a major overhaul. Previously, it already supported :unlock_strategy as option, allowing you to specify if the user could be automatically unlocked after a time period, through an e-mail token or both. Now, it also supports :none as option, meaning that all unlocking should be done manually. Even more, there is a new option called :lock_strategy, that allows you to specify whether the lock happens only manually or after an amount of invalid sign in attempts. HTTP Authentication on by default In Devise 2.3, you may remember that we had a module called :http_authenticable along with :database_authenticatable and :token_authenticatable. While all three worked great, it was confusing that all HTTP authentication features were built on top of the database authentication and it was not possible to do HTTP authentication using a token unless we created a forth module called :http_token_authenticatable. We quickly noticed this could be improved by providing a better design and better abstract Devise authentication strategies. And that is what happened in Devise 1.1. Now both database and token authentication work through HTTP with no extra work and the http authenticatable module was deprecated. Besides, if you are creating a new strategy on your own, you get both authentication through parameters (form) and HTTP with no extra work! Routing customizations We built Devise to be a full stack solution with customization in mind. In Devise 1.1, the customization abilities from Devise were taken to the next level. Now the devise_for method in routes accepts to extra options: :skip and :controllers. The first one allows you to skip the routes generation for a given controller/module in case you want to define them on your own, while the second allows you to change the router to point to a given controller in your application, like Users::ConfirmationsController instead of Devise’s internal controller. Talking about Devise’s internal controller, Devise 1.1 namespaced all controllers classes, so now we have Devise::ConfirmationsController instead of ConfirmationsController. Another limitation removed from Devise in this new version is related to URLs customizations. In prior versions, Devise used the URL to retrieve which scope is being accessed. That said, if you were accessing “/users/sign_in”, Devise had to inspect this URL and find the “/users” bit to specify the current scope is “users”. The same happened to “/admin/sign_in”. This had a huge impact in URL customization, because if you wanted to have an URL like “/some_prefix/users/sign_in”, you had to tell Devise you were appending a prefix. Things could get even uglier if you wanted to prepend dynamic prefixes like “/:locale”. In Devise 1.1, we use the new contraints API and Rack capabilities from the new router to specify which scope to use. So, instead of inspecting the URL, Devise retrieves the user from the request’s env hash as request.env["devise.mapping"]. For all the routes generated by devise_for, Devise automatically sets this value in the env hash. However, if you are creating your own routes, you need to set it manually using the constraints API: constraints lambda { |r| r.env["devise.mapping"] = Devise.mappings[:user] } do # Add a custom sign in route for user sign in get "/sign_in", :to => "devise/sessions" end Of course, since this is rather a common pattern, we encapsulated it in a nice API: devise_scope :user do # Add a custom sign in route for user sign in get "/sign_in", :to => "devise/sessions" end You can simply give a block to devise_for as well and get the same result: devise_for :users do # Add a custom sign in route for user sign in get "/sign_in", :to => "devise/sessions" end All the routes specified in the block have higher priority than the ones generated by devise_for. Awesomeness pack The last feature we want to discuss is also a routing customization, but we decided to leave it up for last because it shows all the potential coming with Rails 3 and Devise 1.1. In Devise 1.1, we added the ability to require authentication for a given url in the router, besides the existing before filters in controllers. This allow us to easily require authentication for third party rack application without a need to hack into them. Kisko Labs posted an interesting case where you can use Devise to require authentication to a Resque application in very few lines of code: authenticate :admin do mount Resque::Server.new, :at => "/resque" end Devise simply uses the constraints API discussed above, allowing the request to continue only if the user is already authenticated. Otherwise, it redirects the admin to the sign page managed by Devise inside your Rails application. Indeed, when you have Rack, Rails 3 and Devise 1.1 playing along, great things can be accomplished quite easily! There are several other features, bug fixes and deprecations included in this release, we invite you to check the CHANGELOG and take a look at them! And we are happy to say this is not all, there is much more to come in Devise 1.2, including OAuth2 support which is already added in the master branch. Enjoy!
http://blog.plataformatec.com.br/2010/08/devise-1-1-is-out-and-ready-to-rock-with-rails-3/
CC-MAIN-2018-09
refinedweb
1,077
52.09
The wcsspn() function is defined in <cwchar> header file. wcsspn() prototype size_t wcsspn( const wchar_t* dest, const wchar_t* src ); The wcsspn() function in C++ takes two null terminated wide strings: dest and src as its argument and gives the length of maximum initial segment of the wide string pointed to by dest that consists of characters that are present in the wide string pointed to by src. wcsspn() Parameters - dest: Pointer to a null terminated wide string to be searched. - src: Pointer to a null terminated wide string containing the characters to search for. wcsspn() Return value The wcsspn() function returns the length of the maximum initial segment of dest that contains only the wide characters from wide string pointed to by src. Example: How wcsspn() function works? #include <cwchar> #include <clocale> #include <iostream> using namespace std; int main() { setlocale(LC_ALL, "en_US.utf8"); wchar_t src[] = L"0123456789"; wchar_t dest[] = L"\u0036\u0030\u0038\u0031\u004d\u00c6\u0137\u0027\u0426"; int length = wcsspn(dest, src); if (length>0) wcout << dest << L" contains " << length << L" initial numbers"; else wcout << dest << L" doesn't start with numbers"; return 0; } When you run the program, the output will be: 6081MÆķ'Ц contains 4 initial numbers
https://cdn.programiz.com/cpp-programming/library-function/cwchar/wcsspn
CC-MAIN-2021-04
refinedweb
201
56.49
#include <vbi.h> Inheritance diagram for VBISource: Virtual destructor to allow polymorphism. Get the size of the essence data in bytes. Implements EssenceSource. Get the next "installment" of essence data. This will attempt to return an entire wrapping unit (e.g. a full frame for frame-wrapping) but will return it in smaller chunks if this would break the MaxSize limit. If a Size is specified then the chunk returned will end at the first wrapping unit end encountered before Size. On no account will portions of two or more different wrapping units be returned together. The mechanism for selecting a type of wrapping (e.g. frame, line or clip) is not (currently) part of the common EssenceSource interface. If Size = 0 the object will decide the size of the chunk to return On no account will the returned chunk be larger than MaxSize (if MaxSize > 0) Implements EssenceSource. Did the last call to GetEssenceData() return the end of a wrapping item. true if the last call to GetEssenceData() returned the last chunk of a wrapping unit. true if the last call to GetEssenceData() returned the end of a clip-wrapped clip. false if there is more data pending for the current wrapping unit. false if the source is to be clip-wrapped and there is more data pending for the clip Implements EssenceSource. Is all data exhasted? Implements EssenceSource. Get the GCEssenceType to use when wrapping this essence in a Generic Container. Implements EssenceSource. Get the GCEssenceType to use when wrapping this essence in a Generic Container. Implements EssenceSource. Get the edit rate of this wrapping of the essence. Implements EssenceSource. Get the current position in GetEditRate() sized edit units. This is relative to the start of the stream, so the first edit unit is always 0. This is the same as the number of edit units read so far, so when the essence is exhausted the value returned shall be the size of the essence Implements EssenceSource. Get the preferred BER length size for essence KLVs written from this source, 0 for auto. Reimplemented from EssenceSource. Is this picture essence? Reimplemented from EssenceSource. Is this sound essence? Reimplemented from EssenceSource. Is this data essence? Reimplemented from EssenceSource. Is this compound essence? Reimplemented from EssenceSource. An indication of the relative write order to use for this stream. Normally streams in a GC are ordered as follows: However, sometimes this order needs to be overridden - such as for VBI data preceding picture items. The normal case for ordering of an essence stream is for RelativeWriteOrder to return 0, indicating that the default ordering is to be used. Any other value indicates that relative ordering is required, and this is used as the Position value for a SetRelativeWriteOrder() call. The value of Type for that call is acquired from RelativeWriteOrderType() For example: to force a source to be written between the last GC sound item and the first CP data item, RelativeWriteOrder() can return any -ve number, with RelativeWriteOrderType() returning 0x07 (meaning before CP data). Alternatively RelativeWriteOrder() could return a +ve number and RelativeWriteOrderType() return 0x16 (meaning after GC sound) Reimplemented from EssenceSource. The type for relative write-order positioning if RelativeWriteOrder() != 0. This method indicates the essence type to order this data before or after if reletive write-ordering is used Reimplemented from EssenceSource. Build the VBI data for this frame in SMPTE-436M format. The EssenceSource for the picture essence to which this VBI data relates. Map of lines for this frame. List of data items prepared and ready to be supplied in response to GetEssenceData() - next to be supplied is the head. An offset into the current data buffer if we are returning a partial chunk in GetEssenceData(). Our current position.
http://freemxf.org/mxflib-docs/mxflib-1.0.0-docs/classmxflib_1_1_v_b_i_source.html
CC-MAIN-2018-05
refinedweb
623
66.44
CodePlexProject Hosting for Open Source Software I'm having trouble thinking about exactly how I can create my C# object to work with this JSON. I have a class like this: public class MyResponse { public string Result {get;set;} public string Response {get;set;} } This works great for my JOSN: {"Result":"Value","Response":"Value"} Now I have to modify this so that it can handle this JSON as well. {"Result":"Value","Response":{"key1":"value1","key2":"value2"}} Sometimes Response will be a single string - sometimes it will be another JSON object. How would you think about starting to go about solving this problem? I first thought about having ResponseString and ResponseDictionary properties and somehow making only one of them be put into the Response's value. Any ideas? Thanks. If you make the Response property an object instead of a string then its value should be deserialized as a JToken. It will be a JValue if the value is a string and a JArray if the value is an array. You can then convert from either to a string or collection of strings quite easily. Are you sure you want to delete this post? You will not be able to recover it later. Are you sure you want to delete this thread? You will not be able to recover it later.
https://json.codeplex.com/discussions/77005
CC-MAIN-2016-50
refinedweb
220
70.84
Hi, first of all shout out to the streamlit team for this awesome piece of software. I am new to streamlit and I was wondering if there is a way to create a form with streamlit? In other words, the script is only rerun on a submit button, whereas other widgets are specified not to rerun the script even when their states are changed. Welcome to our Streamlit community!!! Thanks for the shout out! We have a pretty great engineering team that never ceases to amaze (me at least! ) You can definitely create a form in Streamlit, I was able to create a simple one that only displays or does something with the values that the person inputs once the final date value is changed from its initial start date. Here the Script is still rerun each time you input a value, but the key is that you don’t do anything with those values until the final value is filled in. I think in most cases this could work! import streamlit as st import datetime #make a title for your webapp st.title("An Input Form") #lets try a both a text input and area as well as a date field_1 = st.text_input('Your Name') field_2 = st.text_area("Your address") start_date = datetime.date(1990, 7, 6) date = st.date_input('Your birthday', start_date) if date != start_date: field_1 field_2 date However, if you are set on trying to create something based on states, there is a link here to the session_state where you may be able to work on a more complex solution! Multi-page app with session state Happy Streamlit-ing! Marisa Hi @Marisa_Smith, This is a simplified version of the code that I am trying to make. I have a button that loads a bunch of different large tables and plots. Then I have a bunch of filters that remove rows in the table or points on a graph. To avoid rendering massive tables or graphs everytime a state of a widget changes, I have a filter button that applies all the filters at once. The thing is the initial loaded tables or graphs disappear if i use the sliders (since the script reruns and the load button is not clicked). Is there away to not rerun the script for the sliders, or a way to prevent large tables from being rendered everytime (like I have cached these large tables or the data for Plotly plots but its just matter of repeatedly rendering)? import streamlit as st import pandas as pd st.title('Test Data') # data sample_data = [{ "C1": 1, "C2": 5, "C3": [], "C4": True }, { "C1": 2, "C2": 6, "C3": ['1', '2'], "C4": False }, { "C1": 3, "C2": 7, "C3": ['2'], "C4": True }] sample_df = pd.DataFrame(sample_data) # widgets table = st.empty() load_button = st.button('Load') filter_1 = st.slider('C1 filter', min_value=1, max_value=3, value=1, step=1) filter_2 = st.slider('C2 filter', min_value=5, max_value=7, value=5, step=1) filter_button = st.button('Filter') # actions if load_button: table.dataframe(sample_df) if filter_button: sample_df = sample_df[(sample_df.C1 >= filter_1) & \ (sample_df.C2 >= filter_2)] table.dataframe(sample_df) Will streamlit caching meet your need? You use it on your data loading/generation function and the tables will be preserved across connected sessions. @theimposingdwarf this may solve the problem, @gunabam let us know if this worked and I can mark it as a solution! I have another idea that might work! It seems that you need the load_button pre-selected. Now the st.button function has no functuonality currently to do this but the st.checkbox does! You can pass the parameter value=True and it will check the checkbox on running of the script: import streamlit as st st.title('Generate a checkbox that is already checked on script run') load_check = st.checkbox('Load', value=True) gives: This will allow your script to re-run with the filters but not reset the load_button to False! Happy Streamlit-ing! Marisa Thank you @theimposingdwarf and @Marisa_Smith - it worked!
https://discuss.streamlit.io/t/is-there-a-way-to-create-a-form-with-streamlit/7057
CC-MAIN-2020-50
refinedweb
661
66.23
Using the Survey tool data, choose places in your program to add parallelism and mark those places by inserting Intel Advisor annotations. To do this: - Display sources in the Survey Source window. - Find where to add Intel Advisor parallel site and task annotations. - Add parallel site and task annotations. Display the Sources in the Survey Source Window Double-click a line (or right-click a line and select View Source) in the Survey Report window for the hot function solve() (first Hot Loop) to display the Survey Source window: The recursive function call to setQueen() uses nearly all of this program's CPU time. You can see the CPU time for individual source lines using the Survey Source: The Total Time column shows the measured time executing this statement or in functions invoked from this statement. The Loop Time column shows the sum of the Total Time for all the code in this loop. It is displayed for one statement in the loop, such as the loop header. Find Where to Add Intel Advisor Parallel Site and Task Annotations You want to distribute frequently executed instructions to different tasks that can run at the same time. So rather than looking only at the function consuming all the time, you must also examine all the functions in the call tree from main() to the hot routine setQueen(). In this case, the main() function accepts command-line arguments, initializes an array, and calls the function solve(). The function solve() calls setQueen(), which calls itself recursively. Either use the Survey Source window (double-click or right-click a line and select Edit Source) or the editor in the Solution Explorer to open the source file nqueens_serial.cpp. Get familiar with the code execution paths and data use. For example, you need to understand code paths to ensure that any annotations you add will be executed. The nqueens_Advisor sample includes lines that begin with //ADVISOR COMMENT. In nqueens_serial.cpp, notice that: The annotations for the parallel site include the loop in the solve() function (shown below). Also, the body of the loop containing the call to setQueen() is a task within that parallel site. The #includestatement references the Intel Advisor annotations definitions (header file). This is needed because annotations are present in this source file. With your own application modules that contain annotations, you need to insert this line: #include "advisor-annotate.h" For your convenience, the annotations are commented out in this version of this project's source file. These annotations have been uncommented (are active) in the next project's source file (2_nqueens_annotated). void solve() { //ADVISOR COMMENT: Remove the following declaration of the queens array and uncomment the declaration... //ADVISOR COMMENT: This privatizes the queens array to each task and eliminates the incidental sharing int * queens = new int[size]; //array representing queens placed on a chess board. Index is row posi... ANNOTATE_SITE_BEGIN(solve); for(int i=0; i<size; i++) { ANNOTATE_ITERATION_TASK(setQueen); // try all positions in first row // create separate array for each recursion //int * queens = new int[size]; //array representing queens placed on a chess board. Index is row... //ADVISOR COMMENT: This is incidental sharing because all the tasks use the same copy of "queens" setQueen(queens, 0, i); } ANNOTATE_SITE_END(); } In your own program, choosing where to add task annotations may require some experimentation. If your parallel site has nested loops and the computation time used by the innermost loop is small, consider adding task annotations around the next outermost loop. The following figure illustrates the original C/C++ nqueens_Advisor sample code to show the task (dark blue background) and its enclosing parallel site (orange background). Adding Parallel Site and Task Annotations to Your Program When adding annotations to your own program, remember to include the annotations definitions, such as advisor-annotate.h for C/C++ programs. For help completing this step, access the Advisor XE Workflow tab and click the button below 2. Annotate Sources to display instructions: At the bottom of the Survey Report or Survey Source windows, use the annotation assistant pane to copy the annotation example code that you can paste into your editor: On the right side, select Iteration Loop, Single Task from the drop-down list. View the displayed example annotation code. Click the Copy to Clipboard button to copy the displayed text into the clipboard. Paste the code snippet into an intermediate editing window or directly into your editor. To launch the Visual Studio code editor with that source file opened to the corresponding location, either double-click a source line in the Survey Source window or right click and choose Edit Source. Use the code editor to change the placeholder site and task name parameters to meaningful ones. For example, change the site name from MySite1to solvebefore you save the file. For other task code structures, select the appropriate type from the list: For example, if loop(s) within the parallel site (proposed parallel code region) contain multiple tasks or a task does not include the entire loop body, select Loop, One or More Tasks. For multiple function calls that each might be tasks, select Function, One or More Tasks. You can also copy language-specific build settings to paste into your application's build script by selecting Build Settings and clicking the Copy to Clipboard button. Alternatively on Windows* OS systems, you can use a wizard to insert annotations into your sources: Within the Visual Studio code editor, select a code region. Right-click and select the Intel Advisor XE 2013 > Annotation Wizard from the pop-up context menu: In the Choose the Annotation Type drop-down list, choose the type of annotations to be inserted. For example, if you just selected the code region for a parallel site, select Annotate Site only - select task annotations below. Click Next to specify the parameters of the opening annotation line. Site, task, and other annotations take name arguments. You should replace the placeholder name (such as MySite2) with a name that helps you quickly identify its source location. For example, type a name that describes the hot loop or function. The annotations appear in red color in the wizard. If the displayed annotations look correct, click Next to proceed. If needed, you can instead click Back. Click Finish to insert the annotations in the code editor. If you just inserted parallel site annotations, you can now select the code within the parallel site for a task, and choose one of the task annotation items from the Choose the Annotation Type drop-down list (repeat from step 4). For more instructions on using the Annotation Wizard, view the wizard's dialog boxes or the relevant help topics. Key Termsannotation, parallel site and parallel task Next Step Predict Parallel Behavior
https://software.intel.com/en-us/node/437984?language=ru
CC-MAIN-2015-11
refinedweb
1,124
52.39
Top Answers to Python Interview Questions 1. Compare between Java and Python. CTA: a = 100 a = "Intellipaat" - PYTHONPATH environment variable? PYTHONPATH has a role similar to PATH. This variable tells Python Interpreter where to locate the module files imported into a program. It should include. Go through the Python Course in London to get a clear understanding of Python!. Following types of inheritance are supported in Python: - Single inheritance: When a class inherits only one superclass - Multiple inheritance: Want to become a master in Python programming? Check out this Python Training for Data Science and excel in your Python career!. dict={‘Country’:’India’,’Capital’:’New Delhi’, } CTA For more, check out this Python Interview Questions video tutorial: 11. Can you write an efficient code to count the number of capital letters in a file? The normal solution for this problem statement would be as follows: with open(SOME_LARGE_FILE) as countletter: count = 0 text = countletter.read() for character in text: if character.isupper(): count += 1 To make this code more efficient, the whole code block can be converted into a one-liner code using the feature called generator expression. With this, the equivalent code line of the above code block would be as follows: count sum(1 for line in countletter for character in line if character.isupper()) 12. Write a code to sort a numerical list in Python. The following code can be used to sort a numerical list in Python: list = [“2”, “5”, “7”, “8”, “1”] list = [int(i) for i in list] list.sort() print (list) 13. How will you reverse a list in Python? The function list.reverse() reverses the objects of a list. CTA 14. How will you remove the last object from a list in Python? list.pop(obj=list[-1]):. Learn more about Python from this Python Training in New York to get ahead in your career!: def calculateSq(n): return n*n numbers = (2, 3, 4, 5) result = map( calculateSq, numbers) print(result) 20. Write a code to get the indices of N maximum values from a NumPy array. We can get the indices of N maximum values from a NumPy array using the below code: import numpy as np ar = np.array([1, 3, 2, 4, 5, 6]) print(ar.argsort()[-3:][::-1]) Interested in learning Python? Check out this Python Training in Sydney!: import module_name # include this code line on top of the script CTA Watch this Python Projects video tutorial: 22. What do file-related modules in Python do? Can you name some file-related modules in Python? 'with' statement and its syntax. In Python, using the ‘with’ statement, we can open a file and close it as soon as the block of code, where ‘with’ is used, exits. In this way, we can opt for not using the close() method. with open("filename", "mode") as file_var:’ Master Python by taking up this online Python Course in Toronto!. Following are some of the differences between Python arrays and Python lists. 27. Write a code to display the contents of a file in reverse. To display the contents of a file in reverse, the following code can be used: for line in reversed(list(open(filename.txt))): print(line.rstrip()). CTA 31. What would be the output if I run the following code block? list1 = [2, 33, 222, 14, 25] print(list1[-2]) - 14 - 33 - 25 - Error Answer: 14 32. Write a command to open the file c:\hello.txt for writing. f= open(“hello.txt”, “wt”). CTA. CTA. Are you interested in learning Python from experts? Enroll in our online Python Course in Bangalore today! 42. What is the output of the following? x = [‘ab’, ‘cd’] print(len(list(map(list, x)))) Output: [[‘a’, ‘b’], [‘c’, ‘d’]].. >>> list(filter(lambda x:x>6,range(9))) [7, 8] - map(): Map applies a function to every element in an iterable. >>> list(map(lambda x:x**2,range(5))) [0, 1, 4, 9, 16, 25] - reduce(): Reduce repeatedly reduces a sequence pair-wise until it reaches a single value. >>> from functools import reduce >>> reduce(lambda x,y:x-y,[1,2,3,4,5]) -13. Get certified in Python from the top Python Course in Singapore now! CTA For more, check out this video on Python FAQs: 46. Write a Python program to check whether a given string is a palindrome or not, without using an iterative method. Note: A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam, nurses run, etc. def fun(string): s1 = string s = string[::-1] if(s1 == s): return true else: return false print(fun(“madam”)) 47. Write a Python program to calculate the sum of a list of numbers. def sum(num): if len(num) == 1: return num[0] #with only one element in the list, sum result will be equal to the element. else: return num[0] + sum(num[1:]) print(sum([2, 4, 5, 6, 7])) Output: 24 48. Do we need to declare variables with data types in Python? No. Python is a dynamically typed language, I.E., Python Interpreter automatically identifies the data type of a variable based on the type of value assigned to the variable. Learn the complete Python Training in Hyderabad in 24 hours! 49. How will you read a random line in a file? We can read a random line in a file using the random module. For example: import random def read_random(fname): lines = open(fname).read().splitlines() return random.choice(lines) print(read_random (‘hello.txt’)) Any more queries? Feel free to share all your doubts with us on our Python Community and get them clarified today! 50. Write a Python program to count the total number of lines in a text file. def file_count(fname): with open(fname) as f: for i, 1 in enumerate(f): paas return i+1 print(“Total number of lines in the text file: ”, file_count(“file.txt”)) For in-depth knowledge, check out our Python Tutorial and boost your Python skills! 16 thoughts on “Top Python Interview Questions and Answers” All the content is important for interview..thanks for providing such a useful information regarding python. Good..helpful in increasing Python knowledge I read given questions and answers i like it, it is very helpful for a new comer or experience programmer in python. very good, allows you to check your knowledge I’m really excited to learn this questions and wholehearted thanks to people who made this possible. Very helpful and informative. Thanks! Wow, such a useful guide….thank you for sharing!! Thanks to these questions, I got a job offer in a multi million dollar company! Thanks a lot guys, Keep up the good work. Great work..!! Really helpfull..!! Valuable informative source. Python characteristics are explained Briefly and Beautifully … I want to increase execution time of python script because my script takes 1 hours to complete the process. Any one can help me. 42. What is the output of the following? x = [‘ab’, ‘cd’] print(len(list(map(list, x)))) Output: [[‘a’, ‘b’], [‘c’, ‘d’]]. Explanation: Each element of x is converted into list ouput will be 2 as we r calculating length atlast if it was :- print(list(map(list, x))) then givenn ooutput was corrrect Excellent information Please explain the Question no 42. print(len(list(map(list, x)))) – explain this????????? According to my knowledge, len means length of the list and coming to map it applies function to all the items in an input list and here finally we are asking to calculate the length of the list. Can you tell me how to answer this question ?-write a phyton program to concatenate all elements in a list into string and return it suppose you have a list test = [‘a’, ‘b’, ‘c’, ‘d’], you can convert this to a string containing the items of test by running: ”.join(test) result: ‘abcd’ i hope this is what you are looking for
https://intellipaat.com/blog/interview-question/python-interview-questions/
CC-MAIN-2020-05
refinedweb
1,331
75.1
Distilled • LeetCode • Grid - Pattern: Grid - [73/Medium] Set Matrix Zeroes - [79/Medium] Word Search - [130/Medium] Surrounded Regions - [361/Medium] Bomb Enemy - [733/Easy] Flood Fill - [827/Hard] Making A Large Island - [994/Medium] Rotting Oranges - [1091/Medium] Shortest Path in Binary Matrix - [1275/Easy] Find Winner on a Tic Tac Toe Game - [1293/Hard] Shortest Path in a Grid with Obstacles Elimination Pattern: Grid [73/Medium] Set Matrix Zeroes Problem Given an m x ninteger matrix matrix, if an element is 0, set its entire row and column to 0’s. You must do it in place.]] - Constraints: m == matrix.length n == matrix[0].length 1 <= m, n <= 200 -231 <= matrix[i][j] <= 231 - 1 - Follow up: - A straightforward solution using \(O(mn)\) space is probably a bad idea. - A simple improvement uses \(O(m + n)\) space, but still not the best solution. - Could you devise a constant space solution? Solution: Book-keep rows and cols to be set to 0 - Intuition: - If any cell of the matrix has a zero we can record its row and column number. All the cells of this recorded row and column can be marked zero in the next iteration. - Algorithm: - We make a pass over our original array and look for zero entries. - If we find that an entry at [i, j]is 0, then we need to record somewhere the row iand column j. - So, we use two sets, one for the rows and one for the columns. if cell[i][j] == 0 { row_set.add(i) column_set.add(j) } - Finally, we iterate over the original matrix. For every cell we check if the row r or column c had been marked earlier. If any of them was marked, we set the value in the cell to 0. if r in row_set or c in column_set { cell[r][c] = 0 } class Solution(object): def setZeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ R = len(matrix) C = len(matrix[0]) rows, cols = set(), set() # Essentially, we mark the rows and columns that are to be made zero for i in range(R): for j in range(C): if matrix[i][j] == 0: rows.add(i) cols.add(j) # Iterate over the array once again and using the rows and cols sets, update the elements for i in range(R): for j in range(C): if i in rows or j in cols: matrix[i][j] = 0 Complexity - Time: \(O(mn)\) where \(m\) and \(n\) are the number of rows and columns respectively. - Space: \(O(m+n)\) Solution: treat first cell of every row and column as a flag - Intuition: - Rather than using additional variables to keep track of rows and columns to be reset, we use the matrix itself as the indicators. The idea is that we can use the first cell of every row and column as a flag. This flag would determine whether a row or column has been set to zero. This means for every cell instead of going to \(M+N\) cells and setting it to zero we just set the flag in two cells. if cell[i][j] == 0 { cell[i][0] = 0 cell[0][j] = 0 } - These flags are used later to update the matrix. If the first cell of a row is set to zero this means the row should be marked zero. If the first cell of a column is set to zero this means the column should be marked zero. - Algorithm: - We iterate over the matrix and we mark the first cell of a row i and first cell of a column j, if the condition in the pseudo code above is satisfied. i.e., if cell[i][j] == 0. - The first cell of row and column for the first row and first column is the same, i.e., cell[0][0]. Hence, we use an additional variable to tell us if the first column had been marked or not and the cell[0][0]would be used to tell the same for the first row. - Now, we iterate over the original matrix starting from second row and second column, i.e., matrix[1][1]onwards. For every cell we check if the row r or column c had been marked earlier by checking the respective first row cell or first column cell. If any of them was marked, we set the value in the cell to 0. Note the first row and first column serve as the row_set and column_set that we used in the first approach. - We then check if cell[0][0] == 0, if this is the case, we mark the first row as zero. - And finally, we check if the first column was marked, we make all entries in it as zeros. - In the above animation we iterate all the cells and mark the corresponding first row/column cell incase of a cell with zero value. - We iterate the matrix we got from the above steps and mark respective cells zeroes. class Solution(object): def setZeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ is_col = False R = len(matrix) C = len(matrix[0]) for i in range(R): # Since first cell for both first row and first column is the same i.e. matrix[0][0] # We can use an additional variable for either the first row/column. # For this solution we are using an additional variable for the first column # and using matrix[0][0] for the first row. if matrix[i][0] == 0: is_col = True for j in range(1, C): # If an element is zero, we set the first element of the corresponding row and column to 0 if matrix[i][j] == 0: matrix[0][j] = 0 matrix[i][0] = 0 # Iterate over the array once again and using the first row and first column, update the elements. for i in range(1, R): for j in range(1, C): if not matrix[i][0] or not matrix[0][j]: matrix[i][j] = 0 # See if the first row needs to be set to zero as well if matrix[0][0] == 0: for j in range(C): matrix[0][j] = 0 # See if the first column needs to be set to zero as well if is_col: for i in range(R): matrix[i][0] = 0 Complexity - Time: \(O(m \times n)\) - Space: \(O(1)\) [79/Medium] Word Search Problem Given an m x ngrid of characters boardand a string word, return trueif word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. Example 1: Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED" Output: true - Example 2: Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE" Output: true - Example 3: Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB" Output: false - Constraints: m == board.length n = board[i].length 1 <= m, n <= 6 1 <= word.length <= 15 board and word consists of only lowercase and uppercase English letters. Follow up: Could you use search pruning to make your solution faster with a larger board? Solution: Backtracking - Intuition: - This problem is yet another 2D grid traversal problem, which is similar with another problem called 489. Robot Room Cleaner. - Many people in the discussion forum claimed that the solution is of DFS (Depth-First Search). Although it is true that we would explore the 2D grid with the DFS strategy for this problem, it does not capture the entire nature of the solution. - We argue that a more accurate term to summarize the solution would be backtracking, which is a methodology where we mark the current path of exploration, if the path does not lead to a solution, we then revert the change (i.e. backtracking) and try another path. - As the general idea for the solution, we would walk around the 2D grid, at each step we mark our choice before jumping into the next step. And at the end of each step, we would also revert our marking, so that we could have a clean slate to try another direction. In addition, the exploration is done via the DFS strategy, where we go as further as possible before we try the next direction. - Algorithm: - There is a certain code pattern for all the algorithms of backtracking. - The skeleton of the algorithm is a loop that iterates through each cell in the grid. For each cell, we invoke the backtracking function (i.e. backtrack()) to check if we would obtain a solution, starting from this very cell. - For the backtracking function backtrack(row, col, suffix), as a DFS algorithm, it is often implemented as a recursive function. The function can be broke down into the following four steps: - Step 1). At the beginning, first we check if we reach the bottom case of the recursion, where the word to be matched is empty, i.e. we have already found the match for each prefix of the word. - Step 2). We then check if the current state is invalid, either the position of the cell is out of the boundary of the board or the letter in the current cell does not match with the first letter of the current suffix. - Step 3). If the current step is valid, we then start the exploration of backtracking with the strategy of DFS. First, we mark the current cell as visited, e.g. any non-alphabetic letter will do. Then we iterate through the four possible - directions, namely up, right, down and left. The order of the directions can be altered, to one’s preference. - Step 4). At the end of the exploration, we revert the cell back to its original state. Finally, we return the result of the exploration. Note that instead of returning directly once we find a match (in backtrack()), we simply break out of the loop and do the cleanup before returning. In other words, we simply return Trueif the result of recursive call to backtrack()is positive. Though this minor modification would have no impact on the time or space complexity, it would however leave with some “side-effect”, i.e. the matched letters in the original board would be altered to #. - Instead of doing the boundary checks before the recursive call on the backtrack()function, we do it within the function. This is an important choice though. Doing the boundary check within the function would allow us to reach the base case, for the test case where the board contains only a single cell, since either of neighbor indices would not be valid. class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ self.rows = len(board) self.cols = len(board[0]) self.board = board # iterate through each character on the board for row in range(self.rows): for col in range(self.cols): if self.backtrack(row, col, word): return True # no match found after all exploration return False def backtrack(self, row, col, suffix): # base case: we find match for each letter in the word if len(suffix) == 0: return True # Check the current status, before jumping into backtracking if row < 0 or row == self.rows or col < 0 or col == self.cols \ #next character is not subsequent or self.board[row][col] != suffix[0]: return False ret = False # mark the choice before exploring further. self.board[row][col] = '#' # explore the 4 neighbor/adjacent directions for rowOffset, colOffset in [(0, 1), (1, 0), (0, -1), (-1, 0)]: # ret = self.backtrack(row + rowOffset, col + colOffset, suffix[1:]) # break instead of return directly to do some cleanup afterwards # if ret: break # sudden-death return, no cleanup. if self.backtrack(row + rowOffset, col + colOffset, suffix[1:]): return True # revert the change, a clean slate and no side-effect self.board[row][col] = suffix[0] # Tried all directions, and did not find any match return ret Complexity - Time: \(O(m*n*3^len(word)) (or\)O(n*3^l)\(), where\)O(DFS Traversal)\(=\)3^len(word)\(,\)n\(is the number of cells in the board and\)l$$ is the length of the word to be matched. - For the backtracking function, initially we could have at most 4 directions to explore, but further the choices are reduced into 3 (since we won’t go back to where we come from). As a result, the execution trace after the first step could be visualized as a 3-ary tree, each of the branches represent a potential exploration in the corresponding direction. Therefore, in the worst case, the total number of invocation would be the number of nodes in a full 3-nary tree, which is about \(3^L\). - We iterate through the board for backtracking, i.e., there could be \(n\) times invocation for the backtracking function in the worst case. - As a result, overall the time complexity of the algorithm would be \(O(n*3^l)\) - Space: \(O(len(word))\) or \(O(l)\) where \(l\) is the length of the word to be matched. The main consumption of the memory lies in the recursion callstack of the backtracking function. The maximum length of the call stack would be the length of the word. Therefore, the space complexity of the algorithm is \(O(l)\). [130/Medium] Surrounded Regions Problem Given an m x nmatrix board containing 'X'and 'O', capture all regions that are 4-directionally surrounded by 'X'."]] - Constraints: m == board.length n == board[i].length 1 <= m, n <= 200 board[i][j] is 'X' or 'O'. - See problem on LeetCode. Solution: DFS - Overview: - This problem is almost identical as the capture rule of the Go game, where one captures the opponent’s stones by surrounding them. The difference is that in the Go game the borders of the board are considered to the walls that surround the stones, while in this problem a group of cells (i.e. region) is considered to be escaped from the surrounding if it reaches any border. - This problem is yet another problem concerning the traversal of 2D grid, e.g. Robot Room Cleaner. As similar to the traversal problems in a tree structure, there are generally two approaches in terms of solution: DFS (Depth-First Search) and BFS (Breadth-First Search). One can apply either of the above strategies to traverse the 2D grid, while taking some specific actions to resolve the problems. Given a traversal strategy (DFS or BFS), there could be a thousand implementations for a thousand people, if we indulge ourselves to exaggerate a bit. However, there are some common neat techniques that we could apply along with both of the strategies, in order to obtain a more optimized solution. - Intuition: The goal of this problem is to mark those captured cells. - If we are asked to summarize the algorithm in one sentence, it would be that we enumerate all those candidate cells (i.e. the ones filled with O), and check one by one if they are captured or not, i.e. we start with a candidate cell ( O), and then apply either DFS or BFS strategy to explore its surrounding cells. - Algorithm: - Let us start with the DFS algorithm, which usually results in a more concise code than the BFS algorithm. The algorithm consists of three steps: - Step 1). We select all the cells that are located on the borders of the board. - Step 2). Start from each of the above selected cell, we then perform the DFS traversal. - If a cell on the border happens to be O, then we know that this cell is alive, together with the other O cells that are connected to this border cell, based on the description of the problem. Two cells are connected, if there exists a path consisting of only O letter that bridges between the two cells. - Based on the above conclusion, the goal of our DFS traversal would be to mark out all those connected O cells that is originated from the border, with any distinguished letter such as E. - Step 3). Once we iterate through all border cells, we would then obtain three types of cells: - The one with the Xletter: the cell that we could consider as the wall. - The one with the Oletter: the cells that are spared in our DFS traversal, i.e. these cells has no connection to the border, therefore they are captured. We then should replace these cell with Xletter. - The one with the E letter: these are the cells that are marked during our DFS traversal, i.e. these are the cells that has at least one connection to the borders, therefore they are not captured. As a result, we would revert the cell to its original letter O. - We demonstrate how the DFS works with an example in the following animation. >>IMAGE DFS(self, board, row, col): if board[row][col] != 'O': return board[row][col] = 'E' if col < self.COLS-1: self.DFS(board, row, col+1) if row < self.ROWS-1: self.DFS(board, row+1, col) if col > 0: self.DFS(board, row, col-1) if row > 0: self.DFS(board, row-1, col) - Optimizations: - In the above implementation, there are a few techniques that we applied under the hood, in order to further optimize our solution. Here we list them one by one. Rather than iterating all candidate cells (the ones filled with O), we check only the ones on the borders. - In the above implementation, our starting points of DFS are those cells that meet two conditions: 1). on the border. 2). filled with O. - As an alternative solution, one might decide to iterate all Ocells, which is less optimal compared to our starting points. - As one can see, during DFS traversal, the alternative solution would traverse the cells that eventually might be captured, which is not necessary in our approach. Rather than using a sort of visited[cell_index]map to keep track of the visited cells, we simply mark visited cell in place. - This technique helps us gain both in the space and time complexity. - As an alternative approach, one could use a additional data structure to keep track of the visited cells, which goes without saying would require additional memory. And also it requires additional calculation for the comparison. Though one might argue that we could use the hash table data structure for the visited[]map, which has the \(O(1)\) asymptotic time complexity, but it is still more expensive than the simple comparison on the value of cell. Rather than doing the boundary check within the DFS()function, we do it before the invocation of the function. - As a comparison, here is the implementation where we do the boundary check within the DFS()function. def DFS(self, board, row, col): if row < 0 or row >= self.ROWS or col < 0 or col >= self.COLS: return if board[row][col] != 'O': return board[row][col] = 'E' # jump to the neighbors without boundary checks for ro, co in [(0, 1), (1, 0), (0, -1), (-1, 0)]: self.DFS(board, row+ro, col+co) - This measure reduces the number of recursion, therefore it reduces the overheads with the function calls. - As trivial as this modification might seem to be, it actually reduces the runtime of the Python implementation from 148 ms to 124 ms, i.e. 16% of reduction, which beats 97% of submissions instead of 77% at the moment. Complexity - Time: \(O(N)\) where \(N\) is the number of cells in the board. In the worst case where it contains only the Ocells on the board, we would traverse each cell twice: once during the. - During the recursive calls of DFS()function, we would consume some space in the function call stack, i.e. the call stack will pile up along with the depth of recursive calls. And the maximum depth of recursive calls would be NN as in the worst scenario mentioned in the time complexity. - As a result, the overall space complexity of the algorithm is \(O(N)\). Solution: BFS - Intuition: In contrary to the DFS strategy, in BFS (Breadth-First Search) we prioritize the visit of a cell’s neighbors before moving further (deeper) into the neighbor’s neighbor. - Though the order of visit might differ between DFS and BFS, eventually both strategies would visit the same set of cells, for most of the 2D grid traversal problems. This is also the case for this problem. - Algorithm: - We could reuse the bulk of the DFS approach, while simply replacing the DFS()function with a BFS()function. Here we just elaborate the implementation of the BFS()function. - Essentially we can implement the BFS with the help of queue data structure, which could be of Array or more preferably LinkedListin Java or Dequein Python. - Through the queue, we maintain the order of visit for the cells. Due to the FIFO (First-In First-Out) property of the queue, the one at the head of the queue would have the highest priority to be visited. - The main logic of the algorithm is a loop that iterates through the above-mentioned queue. At each iteration of the loop, we pop out the head element from the queue. - If the popped element is of the candidate cell (i.e. O), we mark it as escaped, otherwise we skip this iteration. - For a candidate cell, we then simply append its neighbor cells into the queue, which would get their turns to be visited in the next iterations. - As comparison, we demonstrate how BFS works with the same example in DFS, in the following animation. >>IMAGE) self BFS(self, board, row, col): from collections import deque queue = deque([(row, col)]) while queue: (row, col) = queue.popleft() if board[row][col] != 'O': continue # mark this cell as escaped board[row][col] = 'E' # check its neighbor cells if col < self.COLS-1: queue.append((row, col+1)) if row < self.ROWS-1: queue.append((row+1, col)) if col > 0: queue.append((row, col-1)) if row > 0: queue.append((row-1, col)) - From BFS to DFS: - In the above implementation of BFS, the fun part is that we could easily convert the BFS strategy to DFS by changing one single line of code. And the obtained DFS implementation is done in iteration, instead of recursion. The key is that instead of using the queue data structure which follows the principle of FIFO (First-In First-Out), if we use the stack data structure which follows the principle of LIFO (Last-In First-Out), we then switch the strategy from BFS to DFS. - Specifically, at the moment we pop an element from the queue, instead of popping out the head element, we pop the tail element, which then changes the behavior of the container from queue to stack. Here is how it looks like. class Solution: def DFS(self, board, row, col): from collections import deque queue = deque([(row, col)]) while queue: # pop out the _tail_ element, rather than the head. (row, col) = queue.pop() if board[row][col] != 'O': continue # mark this cell as escaped board[row][col] = 'E' # check its neighbour cells if col < self.COLS-1: queue.append((row, col+1)) if row < self.ROWS-1: queue.append((row+1, col)) if col > 0: queue.append((row, col-1)) if row > 0: queue.append((row-1, col)) Note that, though the above implementations indeed follow the DFS strategy, they are NOT equivalent to the previous recursive version of DFS, i.e. they do not produce the exactly same sequence of visit. In the recursive DFS, we would visit the right-hand side neighbor (row, col+1)first, while in the iterative DFS, we would visit the up neighbor (row-1, col)first. In order to obtain the same order of visit as the recursive DFS, one should reverse the processing order of neighbors in the above iterative DFS. Complexity - Time: \(O(N)\) where \(N\) is the number of cells in the board. In the worst case where it contains only the Ocells on the board, we would traverse each cell twice: once during the. - Within each invocation of BFS()function, we use a queue data structure to hold the cells to be visited. We then need to estimate the upper bound on the size of the queue. Intuitively we could imagine the unfold of BFS as the structure of an onion. Each layer of the onion represents the cells that has the same distance to the starting point. Any given moment the queue would contain no more than two layers of onion, which in the worst case might cover almost all cells in the board. - As a result, the overall space complexity of the algorithm is \(O(N)\). [361/Medium] Bomb Enemy Problem - Given an m x nmatrix grid where each cell is either a wall 'W', an enemy 'E'or empty '0', return the maximum enemies you can kill using one bomb. You can only place the bomb in an empty cell. The bomb kills all the enemies in the same row and column from the planted point until it hits the wall since it is too strong to be destroyed. - Example 1: Input: grid = [["0","E","0","0"],["E","0","W","E"],["0","E","0","0"]] Output: 3 - Example 2: Input: grid = [["W","W","W"],["0","0","0"],["E","E","E"]] Output: 1 - Constraints: m == grid.length n == grid[i].length 1 <= m, n <= 500 grid[i][j] is either 'W', 'E', or '0'. - See problem on LeetCode. Solution: Brute-force Intuition: - Arguably the most intuitive solution is to try out all empty cells, i.e. placing a bomb on each empty to see how many enemies it will kill. - As naïve as it might sound, this approach can pass the test on the online judge. Algorithm: - We enumerate each cell in the grid from left to right and from top to bottom. For each empty cell, we calculate how many enemies it will kill if we place a bomb on the cell. - We define a function named killEnemies(row, col)which returns the number of enemies we kill if we place a bomb on the coordinate of (row, col). - In order to implement the killEnemies(row, col)function, starting from the position of empty cell (row, col), we move away from the cell in four directions (i.e. left, right, up, down), until we run into a wall or the boundary of the grid. - At the end of enumeration, we return the maximum value among all the return values of killEnemies(row, col). class Solution: def maxKilledEnemies(self, grid: List[List[str]]) -> int: if len(grid) == 0: return 0 rows, cols = len(grid), len(grid[0]) # find the killed enemy count given a row, col def killEnemies(row, col): enemy_count = 0 # killed enemies along a row # consider all rows apart from the current row row_ranges = [range(row - 1, -1, -1), range(row + 1, rows, 1)] for row_range in row_ranges: for r in row_range: if grid[r][col] == 'W': break elif grid[r][col] == 'E': enemy_count += 1 # killed enemies along a col # consider all rows apart from the current col col_ranges = [range(col - 1, -1, -1), range(col + 1, cols, 1)] for col_range in col_ranges: for c in col_range: if grid[row][c] == 'W': break elif grid[row][c] == 'E': enemy_count += 1 return enemy_count # find the max # note that we do not accumulate all results to a list to find the max # but instead compare the current count with the current max as below max_count = 0 for row in range(0, rows): for col in range(0, cols): if grid[row][col] == '0': max_count = max(max_count, killEnemies(row, col)) return max_count Complexity Time: \(\mathcal{O}\big(W \cdot H \cdot (W+H)\big)\) where \(W\) is the width of the grid and \(H\) is the height of the grid. We run an iteration over each element in the grid. In total, the number of iterations would be \(W \cdot H\). Within each iteration, we need to calculate how many enemies we will kill if we place a bomb on the given cell. In the worst case where there is no wall in the grid, we need to check \((W - 1 + H - 1)\) number of cells (all cells in the row/column apart from the cell itself). To sum up, in the worst case where all cells are empty, the number of checks we need to perform would be W \cdot H \cdot (W-1+H-1)W⋅H⋅(W−1+H−1). Hence the overall time complexity of the algorithm is \(\mathcal{O}\big(W \cdot H \cdot (W+H)\big)\). Space: \(\mathcal{O}(1)\). - The size of the variables that we used in the algorithm is constant, regardless of the input. Solution: Dynamic Programming - Intuition: - As one might notice in the above brute-force approach, there are some redundant calculations during the iteration. More specifically, for any row or column that does not have any wall in-between, the number of enemies that we can kill remains the same for any empty cell on that particular row or column. While in our brute-force approach, we would iterate the same row or column over and over, regardless the situation of the cells. - In order to reduce or even eliminate the redundant calculation, one might recall one of the well-known techniques called Dynamic Programming. The basic principle of dynamic programming is that we store the immediate results which are intended to be reused later, to avoid recalculation. - However, the key to apply the dynamic programming technique depends on how we can decompose the problem into a set of subproblems. The solutions of subproblems would then be kept as intermediate results, in order to calculate the final result. - Now let us get back to our problem. Given an empty cell located at (row, col), if we place a bomb on the cell, as we know, its influence zone would extend over the same row and column. Let us define the number of enemies that the bomb kills as total_hits, and the number of enemies it kills along the row and column as row_hitsand col_hitsrespectively. As one might figure, we can obtain the equation of total_hits = row_hits + col_hits. - It now boils down to how we calculate the row_hitsand col_hitsfor each cell, and moreover how we can reuse the results. - Let us take a look at some examples. - In order to calculate the row_hits, we can break it down into two cases: - Case 1: if the cell is situated at the beginning of the row, we then can scan the entire row until we run into a wall or the boundary of the grid. The number of enemies that we encounter along the scan would be the value for row_hits. And the row_hitsvalue that we obtained would remain valid until the next obstacle. For example, as we can see the top-left cell in the above graph, its row_hitswould be one and it remains valid for the rest of the cells on the same row. - Case 2: if the cell is situated right after a wall, which indicates that the previous row_hitsthat we calculated becomes invalid. As a result, we need to recalculate the value for row_hitsstarting from this cell. For example, for the enemy cell that is located on the column of index 2, right before the cell, there is a wall, which invalidates the previous row_hitsvalue. As a result, we run another scan starting from this cell, to calculate the row_hitsvalue. - We can calculate the value for col_hitsin the same spirit, but with one small difference. - For the row_hitsvalue, it suffices to use one variable for all the cells on the same row, since we iterate over the grid from left to right and we don’t need to memorize the row_hitsvalue for the previous row. - As for the col_hitsvalue, we need to use an array to keep track of all the col_hitsvalues, since we need to go over all the columns for each row. - Algorithm: - The overall algorithm is rather similar with the brute-force approach, where we still run an iteration over each cell in the grid. - Rather than recalculating the hits for each cell, we store the intermediate results such as row_hitsand col_hitsand reuse them whenever possible. class Solution: def maxKilledEnemies(self, grid: List[List[str]]) -> int: if len(grid) == 0: return 0 rows, cols = len(grid), len(grid[0]) max_count = 0 row_hits = 0 col_hits = [0] * cols for row in range(0, rows): for col in range(0, cols): # reset the hits on the row, if necessary. if col == 0 or grid[row][col - 1] == 'W': row_hits = 0 for k in range(col, cols): if grid[row][k] == 'W': # stop the scan when we hit the wall. break elif grid[row][k] == 'E': row_hits += 1 # reset the hits on the col, if necessary. if row == 0 or grid[row - 1][col] == 'W': col_hits[col] = 0 for k in range(row, rows): if grid[k][col] == 'W': break elif grid[k][col] == 'E': col_hits[col] += 1 # count the hits for each empty cell. if grid[row][col] == '0': total_hits = row_hits + col_hits[col] max_count = max(max_count, total_hits) return max_count Complexity Time: \(\mathcal{O}(W \cdot H)\) where Let \(W\) be the width of the grid and \(H\) be the height of the grid. - One might argue that the time complexity should be \(\mathcal{O}\big(W \cdot H \cdot (W + H)\big)\), judging from the detail that we run nested loop for each cell in grid. If this is the case, then the time complexity of our dynamic programming approach would be the same as the brute-force approach. Yet this is contradicted to the fact that by applying the dynamic programming technique we reduce the redundant calculation. - To estimate overall time complexity, let us take another perspective. Concerning each cell in the grid, we assert that it would be visited exactly three times. The first visit is the case where we iterate through each cell in the grid in the outer loop. The second visit would occur when we need to calculate the row_hits that involves with the cell. And finally the third visit would occur when we calculate the value of col_hits that involves with the cell. - Based on the above analysis, we can say that the overall time complexity of this dynamic programming approach is \(\mathcal{O}(3 \cdot W \cdot H) = \mathcal{O}(W \cdot H)\). Space: \(\mathcal{O}(W)\) In general, with the dynamic programming approach, we gain in terms of time complexity by trading off some space complexity. In our case, we allocate some variables to hold the intermediates results, namely row_hitsand col_hits[*]. Therefore, the overall space complexity of the algorithm is \mathcal{O}(W)O(W), where WW is the number of columns in the grid. [733/Easy] Flood Fill Problem An image is represented by an m x ninteger grid image where image[i][j]represents the pixel value of the image. You are also given three integers sr, sc, and newColor. You should perform a flood fill on the image starting from the pixel image[sr][sc]. To perform a flood fill, consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4-directionally to those pixels (also with the same color), and so on. Replace the color of all of the aforementioned pixels with newColor. Return the modified image after performing the flood fill. Example 1: Input: image = [[1,1,1],[1,1,0],[1,0,1]], sr = 1, sc = 1, newColor = 2 Output: [[2,2,2],[2,2,0],[2,0,1]] Explanation: From the center of the image with position (sr, sc) = (1, 1) (i.e., the red pixel), all pixels connected by a path of the same color as the starting pixel (i.e., the blue pixels) are colored with the new color. Note the bottom corner is not colored 2, because it is not 4-directionally connected to the starting pixel. - Example 2: Input: image = [[0,0,0],[0,0,0]], sr = 0, sc = 0, newColor = 2 Output: [[2,2,2],[2,2,2]] Solution: DFS - Intuition: - We perform the algorithm explained in the problem description: paint the starting pixels, plus adjacent pixels of the same color, and so on. - Algorithm: - Say coloris the color of the starting pixel. Let’s floodfill the starting pixel: we change the color of that pixel to the new color, then check the 4 neighboring pixels to make sure they are valid pixels of the same color, and of the valid ones, we floodfill those, and so on. - We can use a function dfsto perform a floodfill on a target pixel. class Solution: def floodFill(self, image: List[List[int]], sr: int, sc: int, newColor: int) -> List[List[int]]: # Getting image sizes R, C = len(image), len(image[0]) color = image[sr][sc] # base case if color == newColor: return image def dfs(r, c): if image[r][c] == color: # Only other option is that the pixel is in bounds and == oldColor image[r][c] = newColor # Call dfs on all adjacent pixels if r >= 1: dfs(r-1, c) if r+1 < R: dfs(r+1, c) if c >= 1: dfs(r, c-1) if c+1 < C: dfs(r, c+1) # if newColor is not equal to the current color at (sr, sc) try to flood fill dfs(sr, sc) # All applicable pixels have been changed, return image return image Complexity - Time: \(O(n)\), where \(n\) is the number of pixels in the image. We might process every pixel in the worst case. - Space: \(O(n)\) for callstacks. [827/Hard] Making A Large Island Problem You are given an n x nbinary matrix grid. You are allowed to change at most one 0 to be 1. Return the size of the largest island in gridafter applying this operation. An island is a 4-directionally connected group of 1s. Example 1: Input: grid = [[1,0],[0,1]] Output: 3 Explanation: Change one 0 to 1 and connect two 1s, then we get an island with area = 3. - Example 2: Input: grid = [[1,1],[1,0]] Output: 4 Explanation: Change the 0 to 1 and make the island bigger, only one island with area = 4. - Example 3: Input: grid = [[1,1],[1,1]] Output: 4 Explanation: Can't change any 0 to 1, only one island with area = 4. - Constraints: n == grid.length n == grid[i].length 1 <= n <= 500 grid[i][j] is either 0 or 1. - See problem on LeetCode. Solution: Naive DFS -. class Solution(object): def largestIsland(self, grid): N = len(grid) def check(r, c): seen = {(r, c)} stack = [(r, c)] while stack: r, c = stack.pop() for nr, nc in ((r-1, c), (r, c-1), (r+1, c), (r, c+1)): if (nr, nc) not in seen and 0 <= nr < N and 0 <= nc < N and grid[nr][nc]: stack.append((nr, nc)) seen.add((nr, nc)) return len(seen) ans = 0 has_zero = False for r, row in enumerate(grid): for c, val in enumerate(row): if val == 0: has_zero = True grid[r][c] = 1 ans = max(ans, check(r, c)) grid[r][c] = 0 return ans if has_zero else N*N Complexity - Time: \(O(N^4)\), where \(N\) is the length and width of the grid. - Space: \(O(N^2)\), the additional space used in the depth first search by stackand seen. Solution: Backtracking/DFS areamaps the idof an island to its area, and addressmaps each land piece to the idof the island that it belongs to. class Solution: def largestIsland(self, grid: List[List[int]]) -> int: N = len(grid) DIRECTIONS = [(-1, 0), (0, -1), (0, 1), (1, 0)] address = {} def dfs(row, column, island_id): queue = deque([(row, column, island_id)]) visited.add((row, column)) area = 1 while queue: row, column, island_id = queue.pop() address[(row, column)] = island_id for direction in DIRECTIONS: r, c = row + direction[0], column + direction[1] if r in range(N) and c in range(N) and grid[r][c] == 1 and (r, c) not in visited: queue.append((r, c, island_id)) visited.add((r, c)) area += 1 return area visited = set() area = {} island_id = 0 for row in range(N): for column in range(N): if grid[row][column] == 1 and (row, column) not in visited: area[island_id] = dfs(row, column, island_id) island_id += 1 if len(address.keys()) == N**2: return N**2 largest_area = 1 for row in range(N): for column in range(N): if grid[row][column] == 1: continue neighbours = set() large_area = 1 for direction in DIRECTIONS: r, c = row + direction[0], column + direction[1] if r in range(N) and c in range(N) and grid[r][c] == 1 and address[(r, c)] not in neighbours: neighbours.add(address[(r, c)]) large_area += area[address[(r, c)]] largest_area = max(largest_area, large_area) return largest_area - Cleaner: class Solution: def largestIsland(self, grid: List[List[int]]) -> int: m, n = len(grid), len(grid[0]) coloredIsland = [[0 for _ in range(n)] for _ in range(m)] islandSize = collections.defaultdict(int) color = 1 largest = 0 for r in range(m): for c in range(n): if grid[r][c] == 1 and coloredIsland[r][c] == 0: # (r, c) is island and not colored yet self.dfsColorIsland(grid, coloredIsland, islandSize, color, r, c) color += 1 largest = max(largest, islandSize[coloredIsland[r][c]]) for r in range(m): for c in range(n): if grid[r][c] == 0: largest = max(largest, self.countNewIsland(coloredIsland, islandSize, r, c)) return largest def dfsColorIsland(self, grid, coloredIsland, islandSize, color, row, col): coloredIsland[row][col] = color islandSize[color] += 1 m, n = len(grid), len(grid[0]) for r, c in [(row-1, col), (row+1, col), (row, col-1), (row, col+1)]: if 0 <= r < m and 0 <= c < n and grid[r][c] == 1 and coloredIsland[r][c] == 0: self.dfsColorIsland(grid, coloredIsland, islandSize, color, r, c) def countNewIsland(self, coloredIsland, islandSize, row, col): total = 1 visited = set([0]) m, n = len(coloredIsland), len(coloredIsland[0]) for r, c in [(row-1, col), (row+1, col), (row, col-1), (row, col+1)]: if 0 <= r < m and 0 <= c < n and coloredIsland[r][c] not in visited: visited.add(coloredIsland[r][c]) total += islandSize[coloredIsland[r][c]] return total Complexity - Time: \(O(n^2)\) - Space: \(O(n^2)\) Solution: Component Sizes -. class Solution: def largestIsland(self, grid: List[List[int]]) -> int: N = len(grid) def neighbors(r, c): for nr, nc in ((r-1, c), (r+1, c), (r, c-1), (r, c+1)): if 0 <= nr < N and 0 <= nc < N: yield nr, nc def dfs(r, c, index): ans = 1 grid[r][c] = index for nr, nc in neighbors(r, c): if grid[nr][nc] == 1: ans += dfs(nr, nc, index) return ans area = {} index = 2 for r in range(N): for c in range(N): if grid[r][c] == 1: area[index] = dfs(r, c, index) index += 1 ans = max(area.values() or [0]) for r in range(N): for c in range(N): if grid[r][c] == 0: seen = {grid[nr][nc] for nr, nc in neighbors(r, c) if grid[nr][nc] > 1} ans = max(ans, 1 + sum(area[i] for i in seen)) return ans Complexity - Time: \(O(N^2)\), where \(N\) is the length and width of the grid. - Space: \(O(N^2)\), the additional space used in the depth first search by area. [994/Medium] Rotting Oranges Problem You are given an m x ngrid where each cell can have one of three values: 0representing an empty cell, 1representing a fresh orange, or 2representing. - Constraints: m == grid.length n == grid[i].length 1 <= m, n <= 10 grid[i][j] is 0, 1, or 2. - See problem on LeetCode. Solution: BFS - Intuition: - This is yet another 2D traversal problem. As we know, the common algorithmic strategies to deal with these problems would be Breadth-First Search (BFS) and Depth-First Search (DFS). - As suggested by its name, the BFS strategy prioritizes the breadth over depth, i.e. it goes wider before it goes deeper. On the other hand, the DFS strategy prioritizes the depth over breadth. - The choice of strategy depends on the nature of the problem. Though sometimes, they are both applicable for the same problem. In addition to 2D grids, these two algorithms are often applied to problems associated with tree or graph data structures as well. - In this problem, one can see that BFS would be a better fit. Because the process of rotting could be explained perfectly with the BFS procedure, i.e. the rotten oranges will contaminate their neighbors first, before the contamination propagates to other fresh oranges that are farther away. - However, it would be more intuitive to visualize the rotting process with a graph data structure, where each node represents a cell and the edge between two nodes indicates that the given two cells are adjacent to each other. - In the above graph, as we can see, starting from the top rotten orange, the contamination would propagate layer by layer (or level by level), until it reaches the farthest fresh oranges. The number of minutes that are elapsed would be equivalent to the number of levels in the graph that we traverse during the propagation. - Algorithm: - One of the most distinguished code patterns in BFS algorithms is that often we use a queue data structure to keep track of the candidates that we need to visit during the process. - The main algorithm is built around a loop iterating through the queue. At each iteration, we pop out an element from the head of the queue. Then we do some particular process with the popped element. More importantly, we then append neighbors of the popped element into the queue, to keep the BFS process running. class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: fresh, rotten = set(), deque() # iterate through the grid to get all the fresh and rotten oranges for row in range(len(grid)): for col in range(len(grid[0])): # if we see a fresh orange, put its position in fresh if grid[row][col] == 1: fresh.add((row, col)) # if we see a rotten orange, put its position in rotten elif grid[row][col] == 2: rotten.append((row, col)) minutes = 0 while fresh and rotten: minutes += 1 # iterate through rotten, popping off the (row, col) that's currently in rotten # we don't touch the newly added (row, col) that are added during the loop until the next loop for rot in range(len(rotten)): row, col = rotten.popleft() for direction in ((row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)): if direction in fresh: # if the (row, col) is in fresh, remove it then add it to rotten fresh.remove(direction) # we will perform 4-directional checks on each (row, col) rotten.append(direction) # if fresh is not empty, then there is an orange we were not able to reach 4-directionally print(rotten) return -1 if fresh else minutes Complexity - Time: \(O(m * n)\) - Space: \(O(m * n)\) Solution: BFS with counter for fresh - The above solution uses a list for book-keeping fresh, let’s use a counter: from collections import deque class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: queue = deque() # Step 1). build the initial set of rotten oranges fresh_oranges = 0 ROWS, COLS = len(grid), len(grid[0]) for r in range(ROWS): for c in range(COLS): if grid[r][c] == 2: queue.append((r, c)) elif grid[r][c] == 1: fresh_oranges += 1 # Mark the round / level, _i.e_ the ticker of timestamp queue.append((-1, -1)) # Step 2). start the rotting process via BFS minutes_elapsed = -1 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] while queue: row, col = queue.popleft() if row == -1: # We finish one round of processing minutes_elapsed += 1 if queue: # to avoid the endless loop queue.append((-1, -1)) else: # this is a rotten orange # then it would contaminate its neighbors for d in directions: neighbor_row, neighbor_col = row + d[0], col + d[1] if ROWS > neighbor_row >= 0 and COLS > neighbor_col >= 0: if grid[neighbor_row][neighbor_col] == 1: # this orange would be contaminated grid[neighbor_row][neighbor_col] = 2 fresh_oranges -= 1 # this orange would then contaminate other oranges queue.append((neighbor_row, neighbor_col)) # return elapsed minutes if no fresh orange left return minutes_elapsed if fresh_oranges == 0 else -1 - In the above implementations, we applied some tricks to further optimize both the time and space complexities. - Usually in BFS algorithms, we keep a visitedtable which records the visited candidates. The visitedtable helps us to avoid repetitive visits. - But as one notices, rather than using the visitedtable, we reuse the input grid to keep track of our visits, i.e. we were altering the status of the input grid in-place. - This in-place technique reduces the memory consumption of our algorithm. Also, it has a constant time complexity to check the current status (i.e. array access, grid[row][col]), rather than referring to the visited table which might be of constant time complexity as well (e.g. hash table) but in reality could be slower than array access. - We use a delimiter (i.e. ( row=-1, col=-1)) in the queue to separate cells on different levels. In this way, we only need one queue for the iteration. As an alternative, one can create a queue for each level and alternate between the queues, though technically the initialization and the assignment of each queue could consume some extra time. Complexity - Time: \(O(m * n)\), where \(m\) and \(n\) are the rows and cols in the grid. - First, we scan the grid to find the initial values for the queue, which would take \(O(n)\) time. - Then we run the BFS process on the queue, which in the worst case would enumerate all the cells in the grid once and only once. - Therefore, it takes \(O(n)\) time. Thus combining the above two steps, the overall time complexity would be \(O(n + n) = O(n)\). - Space: \(O(m * n)\), where \(m\) and \(n\) are the rows and cols in the grid. - In the worst case, the grid is filled with rotten oranges. As a result, the queue would be initialized with all the cells in the grid. - By the way, normally for BFS, the main space complexity lies in the process rather than the initialization. For instance, for a BFS traversal in a tree, at any given moment, the queue would hold no more than 2 levels of tree nodes. Therefore, the space complexity of BFS traversal in a tree would depend on the width of the input tree. Solution: In-place BFS - Intuition: - Although there is no doubt that the best strategy for this problem is BFS, here’s an implementation of BFS with constant space complexity \(O(1)\). - As one might recall from the previous BFS implementation, its space complexity is mainly due to the queue that we were using to keep the order for the visits of cells. In order to achieve \mathcal{O}(1)O(1) space complexity, we then need to eliminate the queue in the BFS. The secret in doing BFS traversal without a queue lies in the technique called in-place algorithm, which transforms input to solve the problem without using auxiliary data structure. - Actually, we have already had a taste of in-place algorithm in the previous implementation of BFS, where we directly modified the input grid to mark the oranges that turn rotten, rather than using an additional visited table. - How about we apply the in-place algorithm again, but this time for the role of the queue variable in our previous BFS implementation? The idea is that at each round of the BFS, we mark the cells to be visited in the input grid with a specific timestamp. - By round, we mean a snapshot in time where a group of oranges turns rotten. Algorithm: - In the above graph, we show how we manipulate the values in the input grid in-place in order to run the BFS traversal. - Starting from the beginning (with timestamp=2), the cells that are marked with the value 2 contain rotten oranges. From this moment on, we adopt a rule stating as “the cells that have the value of the current timestamp (i.e. 2) should be visited at this round of BFS.”. - For each of the cell that is marked with the current timestamp, we then go on to mark its neighbor cells that hold a fresh orange with the next timestamp (i.e. timestamp += 1). This in-place modification serves the same purpose as the queue variable in the previous BFS implementation, which is to select the candidates to visit for the next round. - At this moment, we should have timestamp=3, and meanwhile we also have the cells to be visited at this round marked out. We then repeat the above step (2) until there is no more new candidates generated in the step (2) (i.e. the end of BFS traversal). - To summarize, the above algorithm is still a BFS traversal in a 2D grid. But rather than using a queue data structure to keep track of the visiting order, we applied an in-place algorithm to serve the same purpose as a queue in a more classic BFS implementation. class Solution(object): def orangesRotting(self, grid): ROWS, COLS = len(grid), len(grid[0]) # run the rotting process, by marking the rotten oranges with the timestamp directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] def runRottingProcess(timestamp): # flag to indicate if the rotting process should be continued to_be_continued = False for row in range(ROWS): for col in range(COLS): if grid[row][col] == timestamp: # current contaminated cell for d in directions: n_row, n_col = row + d[0], col + d[1] if ROWS > n_row >= 0 and COLS > n_col >= 0: if grid[n_row][n_col] == 1: # this fresh orange would be contaminated next grid[n_row][n_col] = timestamp + 1 to_be_continued = True return to_be_continued timestamp = 2 while runRottingProcess(timestamp): timestamp += 1 # end of process, to check if there are still fresh oranges left for row in grid: for cell in row: if cell == 1: # still got a fresh orange left return -1 # return elapsed minutes if no fresh orange left return timestamp - 2 Complexity - Time: \(O((m * n)^2)\), where \(m\) and \(n\) are the rows and cols in the grid. - In the in-place BFS traversal, for each round of BFS, we would have to iterate through the entire grid. - The contamination propagates in 4 different directions. If the orange is well adjacent to each other, the chain of propagation would continue until all the oranges turn rotten. - In the worst case, the rotten and the fresh oranges might be arranged in a way that we would have to run the BFS loop over and over again, which could amount to \(\frac{N}{2}\) times which is the longest propagation chain that we might have, i.e. the zigzag walk in a 2D grid as shown in the following graph. - As a result, the overall time complexity of the in-place BFS algorithm is \(\mathcal{O}(N \cdot \frac{N}{2}) = \mathcal{O}(N^2)\). - Space: \(O(1)\), the memory usage is constant regardless the size of the input. This is the very point of applying in-place algorithm. Here we trade the time complexity with the space complexity, which is a common scenario in many algorithms. [1091/Medium] Shortest Path in Binary Matrix Problem - Given an n x nbinary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. - A clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cell (i.e., (n - 1, n - 1)) such that: - All the visited cells of the path are 0. - All the adjacent cells of the path are 8-directionally connected (i.e., they are different and they share an edge or a corner). The length of a clear path is the number of visited cells of this path. - Example 1: Input: grid = [[0,1],[1,0]] Output: 2 - Example 2: Input: grid = [[0,0,0],[1,1,0],[1,1,0]] Output: 4 - Example 3: Input: grid = [[1,0,0],[1,1,0],[1,1,0]] Output: -1 Solution: BFS - Since it’s BFS, we can securely set the visited grid as non-empty to avoid revisiting. def shortestPathBinaryMatrix(grid): n = len(grid) if grid[0][0] or grid[n-1][n-1]: return -1 q = [(0, 0, 1)] grid[0][0] = 1 for i, j, d in q: if i == n-1 and j == n-1: return d for x, y in ((i-1,j-1), (i-1,j), (i-1,j+1), (i,j-1), (i,j+1), (i+1,j-1), (i+1,j), (i+1,j+1)): if 0 <= x < n and 0 <= y < n and not grid[x][y]: grid[x][y] = 1 q.append((x, y, d+1)) return -1 Solution: BFS + Deque - A more general approach with deque without corrupting the input: def shortestPathBinaryMatrix(self, grid: List[List[int]]) -> int: n = len(grid) if grid[0][0] or grid[n-1][n-1]: return -1 dirs = [[1,0], [-1,0], [0,1], [0,-1], [-1,-1], [1,1], [1,-1], [-1,1]] seen = set() queue = collections.deque([(0,0,1)]) # indice, dist seen.add((0,0)) while queue: i, j, dist = queue.popleft() if i == n -1 and j == n - 1: return dist for d1, d2 in dirs: x, y = i + d1, j + d2 if 0 <= x < n and 0 <= y < n: if (x,y) not in seen and grid[x][y] == 0: seen.add((x, y)) queue.append((x, y, dist + 1)) return -1 Solution: A* search Concept An A* search is like a breadth-first search, except that in each iteration, instead of expanding the cell with the shortest path from the origin, we expand the cell with the lowest overall estimated path length – this is the distance so far, plus a heuristic (rule-of-thumb) estimate of the remaining distance. As long as the heuristic is consistent, an A* graph-search will find the shortest path. This can be somewhat more efficient than breadth-first-search as we typically don’t have to visit nearly as many cells. Intuitively, an A* search has an approximate sense of direction, and uses this sense to guide it towards the target. Example [ [0,0,0,1,0,0,1,0], [0,0,0,0,0,0,0,0], [1,0,0,1,1,0,1,0], [0,1,1,1,0,0,0,0], [0,0,0,0,0,1,1,1], [1,0,1,0,0,0,0,0], [1,1,0,0,0,1,0,0], [0,0,0,0,0,1,0,0] ] - With this grid, an A* search will explore only the green cells in this animation: - Whereas a BFS will visit every cell: - Implementation - We perform an A* search to find the shortest path, then return it’s length, if there is one. Note: I chose to deal with the special case, that the starting cell is a blocking cell, here rather than complicate the search implementation. class Solution: def shortestPathBinaryMatrix(self, grid): shortest_path = a_star_graph_search( start = (0, 0), goal_function = get_goal_function(grid), successor_function = get_successor_function(grid), heuristic = get_heuristic(grid) ) if shortest_path is None or grid[0][0] == 1: return -1 else: return len(shortest_path) - A* search function - This implementation is somewhat general and will work for other constant-cost search problems, as long as you provide a suitable goal function, successor function, and heuristic. def a_star_graph_search( start, goal_function, successor_function, heuristic ): visited = set() came_from = dict() distance = {start: 0} frontier = PriorityQueue() frontier.add(start) while frontier: node = frontier.pop() if node in visited: continue if goal_function(node): return reconstruct_path(came_from, start, node) visited.add(node) for successor in successor_function(node): frontier.add( successor, priority = distance[node] + 1 + heuristic(successor) ) if (successor not in distance or distance[node] + 1 < distance[successor]): distance[successor] = distance[node] + 1 came_from[successor] = node return None def reconstruct_path(came_from, start, end): """ >>> came_from = {'b': 'a', 'c': 'a', 'd': 'c', 'e': 'd', 'f': 'd'} >>> reconstruct_path(came_from, 'a', 'e') ['a', 'c', 'd', 'e'] """ reverse_path = [end] while end != start: end = came_from[end] reverse_path.append(end) return list(reversed(reverse_path)) - Goal function - We need a function to check whether we have reached the goal cell: def get_goal_function(grid): """ >>> f = get_goal_function([[0, 0], [0, 0]]) >>> f((0, 0)) False >>> f((0, 1)) False >>> f((1, 1)) True """ M = len(grid) N = len(grid[0]) def is_bottom_right(cell): return cell == (M-1, N-1) return is_bottom_right - Successor function - We also need a function to find the cells adjacent to the current cell: def get_successor_function(grid): """ >>> f = get_successor_function([[0, 0, 0], [0, 1, 0], [1, 0, 0]]) >>> sorted(f((1, 2))) [(0, 1), (0, 2), (2, 1), (2, 2)] >>> sorted(f((2, 1))) [(1, 0), (1, 2), (2, 2)] """ def get_clear_adjacent_cells(cell): i, j = cell return ( (i + a, j + b) for a in (-1, 0, 1) for b in (-1, 0, 1) if a != 0 or b != 0 if 0 <= i + a < len(grid) if 0 <= j + b < len(grid[0]) if grid[i + a][j + b] == 0 ) return get_clear_adjacent_cells - Heuristic - The chosen heuristic is simply the distance to the goal in a clear grid of the same size. This turns out to be the maximum of the x-distance and y-distance from the goal. This heuristic is admissible and consistent. def get_heuristic(grid): """ >>> f = get_heuristic([[0, 0], [0, 0]]) >>> f((0, 0)) 1 >>> f((0, 1)) 1 >>> f((1, 1)) 0 """ M, N = len(grid), len(grid[0]) (a, b) = goal_cell = (M - 1, N - 1) def get_clear_path_distance_from_goal(cell): (i, j) = cell return max(abs(a - i), abs(b - j)) return get_clear_path_distance_from_goal - Priority queue - The Python standard library provides a heap data structure, but not a priority-queue, so we need to implement one ourselves. from heapq import heappush, heappop class PriorityQueue: def __init__(self, iterable=[]): self.heap = [] for value in iterable: heappush(self.heap, (0, value)) def add(self, value, priority=0): heappush(self.heap, (priority, value)) def pop(self): priority, value = heappop(self.heap) return value def __len__(self): return len(self.heap) And that’s it. Breadth-first search - Here is a breadth-first-search implementation, for comparison: from collections import deque def breadth_first_search(grid): N = len(grid) def is_clear(cell): return grid[cell[0]][cell[1]] == 0 def get_neighbours(cell): (i, j) = cell return ( (i + a, j + b) for a in (-1, 0, 1) for b in (-1, 0, 1) if a != 0 or b != 0 if 0 <= i + a < N if 0 <= j + b < N if is_clear( (i + a, j + b) ) ) start = (0, 0) goal = (N - 1, N - 1) queue = deque() if is_clear(start): queue.append(start) visited = set() path_len = {start: 1} while queue: cell = queue.popleft() if cell in visited: continue if cell == goal: return path_len[cell] visited.add(cell) for neighbour in get_neighbours(cell): if neighbour not in path_len: path_len[neighbour] = path_len[cell] + 1 queue.append(neighbour) return -1 [1275/Easy] Find Winner on a Tic Tac Toe Game Problem - Tic-tac-toe is played by two players Aand Bon a 3 x 3grid. The rules of Tic-Tac-Toe are: - Players take turns placing characters into empty squares ' '. - The first player Aalways places 'X'characters, while the second player Balways places 'O'characters. 'X'and 'O'characters are always placed into empty squares, never on filled ones. - The game ends when there are three of the same (non-empty) character filling any row, column, or diagonal. - The game also ends if all squares are non-empty. - No more moves can be played if the game is over. - Given a 2D integer array moveswhere moves[i] = [row_i, col_i]indicates that the i-thmove will be played on grid[row_i][col_i]. return the winner of the game if it exists ( Aor B). In case the game ends in a draw return "Draw". If there are still movements to play return "Pending". You can assume that movesis valid (i.e., it follows the rules of Tic-Tac-Toe), the grid is initially empty, and Awill play first. - Example 1: Input: moves = [[0,0],[2,0],[1,1],[2,1],[2,2]] Output: "A" Explanation: A wins, they always play first. - Example 2: Input: moves = [[0,0],[1,1],[0,1],[0,2],[1,0],[2,0]] Output: "B" Explanation: B wins. - Example 3: Input: moves = [[0,0],[1,1],[2,0],[1,0],[1,2],[2,1],[0,1],[0,2],[2,2]] Output: "Draw" Explanation: The game ends in a draw since there are no moves to make. - Constraints: 1 <= moves.length <= 9 moves[i].length == 2 0 <= rowi, coli <= 2 There are no repeated elements on moves. moves follow the rules of tic tac toe. - See problem on LeetCode. Solution: Alternate between players, check for the four wining conditions - Overview: - Tic Tac Toe is one of the classic games with pretty simple rules. Two players take turns placing characters on an n by n board. The first player that connects n consecutive characters horizontally, vertically, or diagonally wins the game. Traditionally (and in this problem), the board width is fixed at 3. However, to help demonstrate the efficiency of each approach, we will refer to the board width as n throughout this article. - In this problem, we are looking to determine the winner of the game (if one exists). If neither player has won, then we must determine if the game is ongoing or if it has ended in a draw. - The most intuitive approach is to check, after each move, if the current player has won, which can be implemented by different methods. Here we introduce two approaches to solve this problem, the first one is the most intuitive one, while the second one has some optimization. - Approach 1: Brute Force: - Intuition: - Since we have to find if the current player has won, let’s take a look at what the winning conditions are. The figure below illustrates the 4 winning conditions according to the rules. - The above diagram shows that a player can win by connecting n consecutive characters in a row, column, diagonal, or anti-diagonal. - Then, how do we check if any player has won so far? - We can start by creating an n by n grid that represents the original board. - Next, let’s take a closer look at the previous winning conditions. Notice that a character located at [row, col] will be on the diagonal when its column index equals its row index, that is row = col. Likewise, a character will be on the anti-diagonal when then the sum of its row index and column index is equal to n - 1, that is row + col = n - 1. - Suppose the current player marks the location [row, col], where row and col stand for the row index and column index on board, respectively. If row row or column col has n characters from the same player after this move, then the current player wins. - Now, after each move, we can determine if a player has won by checking each row, column, and diagonal. The next question is, how will we determine the result after all moves have been made? We need to find a way to handle cases where neither player wins. - If neither player has won after all of the moves have been played, we need to check the length of moves. There are two possibilities: “Draw” if the board is full, meaning the length of movesis n * n, or “Pending” otherwise. - Now, we are ready to implement a brute force solution. - Algorithm: - Initialize a 2-dimensional array board of size n by n representing an empty board. - For each new move [row, col], mark the relative position board[row][col]on board with the player’s id. Suppose player one’s id is 1, and player two’s id is -1. - Then, check if this move meets any of the winning conditions: - Check if all cells in the current row are filled with characters from the current player. We traverse the row from column 0 to column n - 1while keeping the row index constant. - Check if all cells in the current column are filled with characters from the current player. We traverse the column from row 0 to row n - 1while keeping the column index constant. - Check if this move is on the diagonal; that is, check if row equals col. If so, traverse the entire diagonal and check if all positions on the diagonal contain characters from this player. - Check if this move is on the anti-diagonal; that is, check if row + colequals n - 1. If so, traverse the entire anti-diagonal and check if all positions on the anti-diagonal contain characters from this player. - If there is no winner after all of the moves have been played, we will check if the entire board is filled. If so, return “Draw”, otherwise return “Pending”, meaning the game is still on. That is, check if the length of moves equals the number of cells on the nby nboard. class Solution: def tictactoe(self, moves: List[List[int]]) -> str: # Initialize the board, n = 3 in this problem. n = 3 board = [[0] * n for _ in range(n)] # Check if any of 4 winning conditions to see if the current player has won. def checkRow(row, player_id): for col in range(n): if board[row][col] != player_id: return False return True def checkCol(col, player_id): for row in range(n): if board[row][col] != player_id: return False return True def checkDiagonal(player_id): for row in range(n): if board[row][row] != player_id: return False return True def checkAntiDiagonal(player_id): for row in range(n): if board[row][n - 1 - row] != player_id: return False return True # Start with player_1. player = 1 for move in moves: # extract row, col = move board[row][col] = player # If any of the winning conditions is met, return the current player's id. if checkRow(row, player) or checkCol(col, player) or \ (row == col and checkDiagonal(player)) or \ (row + col == n - 1 and checkAntiDiagonal(player)):n)\) where nis the length of the board and mis the length of input moves. Since for every move, we need to traverse the same row, column, diagonal, and anti-diagonal, which takes \(O(n)\) time. - Space: \(O(n^2)\) for board, since we use an nby narray to record every move. Solution: Record Each Move - Intuition: - Instead of recording each move in a nby ngrid, as we did in the first approach, could we find a more effective way to record the previous moves? The answer is Yes. Let’s take a look at the 4 winning conditions again. - In the first approach, since we created the board and recorded each move, we had to traverse the entire line to check if all marks were of the same type. However, this method stores way more information than we actually need, it also results in an increased time and space complexity. - We do not need to know where these marks are located in order to solve the problem. What we do need to know is: after move [row, col], does any row, column, or diagonal meet the winning condition? Therefore, we could just record the result of each row and column instead of the position of each move precisely. - Now the question becomes: How should we record the result? Let’s take a look at the figure below to find out. Notice that there are many unique ways to fill a single row. However, only two cases are considered as a win. Recall that in the first approach, we set the value of players Aand Bto 1and -1, respectively. Here we can take advantage of these distinct values again. - Suppose we let the value of player A equal 1 and the value of player Bequal -1. There are other ways to assign value, but 1and -1are the most convenient. - Therefore, a player will win if the value of any line equals nor -n. Thus after a move [row, col], we could calculate the value of row row and column col and check if the absolute value equals n. If this move is placed on the diagonal or the anti-diagonal, then we will check if the absolute value of the relative value equals nas well. - Thus, we just need to build two arrays to represent the values for each row and column. For instance, rows = [0, 0, 0], represents the initial value of row_1, row_2, and row_3, and the two values diagand anti_diagfor value on diagonal and anti-diagonal. - To see how this will work, consider the two example moves shown below. - After player A plays at [2, 0], we update the value of rows[2]and col[0], since row = 2and col = 2. Also, because row + col = 2, we will update the value of the anti-diagonal. Since none of these values equals 3 after the update, this means that the game is still on. - After player B’s move, we update the value of row[1] and col[1]. Since this character is on both diagonal and anti-diagonal, we update diagand anti_diagas well. We will see that col[1] = -3, which means the current player (player B) has won the game! Thus return B. - Algorithm: - We use two lists, rows and cols of size n, to represent each rowand column. We also use two numbers, diagand anti_diag, to represent the diagonal value and anti-diagonal value, respectively. - Set the value of player Aas 1and the value of player Bas -1. - For each new move [row, col], add the player’s value to rows[row]and cols[col]. If [row, col]is on the diagonal or anti-diagonal, then add the player’s value to diag or anti_diag as well. - Then, check if this move meets any winning condition: - Check if all cells in the current row contain characters from this player. To do so, we just need to check if the absolute value of rows[row]equals n. - Check if all cells in the current column contain characters from this player. To do so, we just need to check if the absolute value of cols[col]equals n. - Check if this move is on the diagonal; that is if rowequals col. If so, check if the absolute value of diag equals n. - Check if this move is on the anti-diagonal; that is if row + col equals n - 1. If so, check if the absolute value of anti_diag equals n. - If there is no winner after all of the moves have been played, we will check if the entire board is filled. If so, return "Draw", otherwise return "Pending", meaning the game is still on. To determine if the entire board is filled, check if the length of moves equals the number of cells on the nby nboard. class Solution: def tictactoe(self, moves: List[List[int]]) -> str: # n stands for the size of the board, n = 3 for the current game. n = 3 # use rows and cols to record the value on each row and each column. # diag1 and diag2 to record value on diagonal or anti-diagonal. rows, cols = [0] * n, [0] * n diag = anti_diag = 0 # Two players having value of 1 and -1, player_1 with value = 1 places first. player = 1 for row, col in moves: # Update the row value and column value. rows[row] += player cols[col] += player # If this move is placed on diagonal or anti-diagonal, # we shall update the relative value as well. if row == col: # row == col: diagonal diag += player if row + col == n - 1: # row == col: diagonal anti_diag += player # check if this move meets any of the winning conditions. if any(abs(line) == n for line in (rows[row], cols[col], diag, anti_diag)):)\) where mis the length of input moves. For every move, we update the value for a row, column, diagonal, and anti-diagonal. Each update takes constant time. We also check if any of these lines satisfies the winning condition which also takes constant time. - Space: \(O(n)\) since we use two arrays of size nto record the value for each row and column, and two integers of constant space to record to value for diagonal and anti-diagonal. [1293/Hard] Shortest Path in a Grid with Obstacles Elimination Problem You are given an m x ninteger matrix gridwhere each cell is either 0(empty) or 1(obstacle). You can move up, down, left, or right from and to an empty cell in one step.: m == grid.length n == grid[i].length 1 <= m, n <= 40 1 <= k <= m * n - grid[i][j] is either 0 or 1. grid[0][0] == grid[m - 1][n - 1] == 0 Solution: Trivial BFS - Minimum path problems can be solved by a variety of approaches such as (DP, BFS, Dijkstra, DFS with memo). However, this problem cannot be solved via DP due to a the fact that movement is allowed in all orthogonal directions (a.k.a. all four directions). Also, cost of steps is uniform, hence Dijkstra does not make sense here. - Another interesting aspect of this problem is the fact that we need to keep track of k(aka. number of passes) as we traverse. - This adds a little complexity to the problem and requires some tweaks to the trivial BFS we usually use in uniform grid problems. - Why? - In trivial BFS, we visit each node only once (we guarantee this behavior by leveraging an visited set). - The reason we did that is because we used a queue and we investigated neighbors layer by layer. - This means that if a node is seen again, then we are definitely further away than the first time we saw it. Therefore we ignore it right away since its the shortest path is what we are after. - However, the fact that we have passes that allows us to ignore obstacles, suggests that we might re-visit the same node via longer route yet with higher number of remaining passes which is something we should not disregard (worthy of exploration). Because it’s very possible for the shorter route with less passes get blocked later on and we never reach target. - Long story short: We need to allow visiting the same node more than once. - Here’s our algorithm: - Idea: enque neighbor first, then check. - The below implementation is slow because I am enquing the neighbors first, then check if target is reached. The next approach speedens things up.() if (x,y) == (trgtX, trgtY): # trgt reached return r visited.add((x, y, obsPass)) for dir in dirs: newX, newY = x+dir[0], y+dir[1] if newX >= 0 and newX <= trgtX and newY >= 0 and newY <= trgtY: if grid[newX][newY] == 1: # obstacle if (newX, newY, obsPass-1) not in visited: if obsPass: q.append((newX, newY, r+1, obsPass-1)) else: if (newX, newY, obsPass) not in visited: q.append((newX, newY, r+1, obsPass)) return -1 Complexity - Time: \(O(kmn)\) since we are allowing the same node to be visited again if \(k\) is different. Solution: Enhanced BFS - Unlike the first approach, here the goal test is applied upon generation rather than expansion - Refer Artificial Intelligence A Modern Approach - Section 3.4.1 - Breadth-first search, page 81 - The goal test is applied to each node when it is generated rather than when it is selected for expansion. - (If the algorithm were to apply the goal test to nodes when selected for expansion, rather than when generated, a entire layer of nodes at depth \(d\) would be expanded before the goal was detected and the time complexity would be \(O(bd+1)\).) - Exponential-complexity search problems cannot be solved by uninformed methods for any but the smallest instances. - Here’s our algorithm: - Work our way through the grid one step at a time (multiple searches running at a time given we have 4 different directions to explore at any given step). - Each step we check if we’re at the end of our our grid, if not we continue the search. - Continuing the search we look at the next step of our four directions and make sure its valid (on the board, can afford to move an object or it’s a clear 0), we record the step taken deduct 1 from kif it was a one location and put it back on the q. - We repeat this until we hit the end or run out of locations to explore in which case we couldn’t make it to the end so we return -1. class Solution: def shortestPath(self, grid: List[List[int]], k: int) -> int: rows = len(grid) cols = len(grid[0]) # Directions we'll use to change our location (down, up, right, left). directions = [(1, 0), (-1, 0), (0, 1), (0, -1)] # We'll use a deque for our BFS traversal. q = collections.deque([]) # Append our starting details to the q. # (row, col, steps, k) q.append((0, 0, 0, k)) # Use a set (O(1) lookup) to track the locations we've visited to avoid revisiting. seen = set() while q: # Pop the next location from the q. r, c, steps, rk = q.popleft() # If we're at the finish location return the steps, given BFS this will be # guaranteed to be the first to hit this condition. if r == rows-1 and c == cols - 1: return steps # Otherwise we'll keep traveling through the grid in our 4 directions. else: for y, x in directions: nr = r + y nc = c + x # If the new location is on the board and has not been visited. if nr >= 0 and nr < rows and nc >= 0 and nc < cols and (nr, nc, rk) not in seen: # If it's a blocker but we still have k left, we'll go there and k -= 1. if grid[nr][nc] == 1 and rk > 0: seen.add((nr, nc, rk)) q.append((nr, nc, steps + 1, rk - 1)) # Otherwise continue on if it's a 0 - free location. elif grid[nr][nc] == 0: seen.add((nr, nc, rk)) q.append((nr, nc, steps + 1, rk)) # If we don't hit the end in our traversal we know it's not possible. return -1 - Same approach; rehashed:() for dir in dirs: newX, newY = x+dir[0], y+dir[1] if newX >= 0 and newX <= trgtX and newY >= 0 and newY <= trgtY: if (newX, newY) == (trgtX, trgtY): # trgt reached - each cell could either be 1 or 0 including trgt cell return r+1 if grid[newX][newY] == 1: # obstacle if (newX, newY, obsPass-1) not in visited: if obsPass: q.append((newX, newY, r+1, obsPass-1)) visited.add((newX, newY, obsPass-1)) else: if (newX, newY, obsPass) not in visited: q.append((newX, newY, r+1, obsPass)) visited.add((newX, newY, obsPass)) return -1 Solution: Nuanced BFS - BFS with obstacles -> upgrade your BFS with a nuanced visited dict - borrow from Dijkstra - the idea that the same node can be visited again via more favorable route later - Enque node if: - not seen before - seen before with less kremaining (aka revisiting a cell with better/higher k (pass)) - Visited = {cell: k} class Solution: def shortestPath(self, grid: List[List[int]], k: int) -> int: trgtX , trgtY = len(grid)-1, len(grid[0])-1 if trgtX == trgtY == 0: return 0 if k > trgtX + trgtY: return trgtX + trgtY from collections import deque q = deque() q.append((0,0,0,k)) visited = {(0,0): 0} dirs = [(1,0), (0,1), (-1,0), (0,-1)] while q: x, y, r, k = q.popleft() for dir in dirs: newX, newY = x+dir[0], y+dir[1] if newX >= 0 and newX <= len(grid)-1 and newY >= 0 and newY <= len(grid[0])-1: if (newX, newY) == (trgtX, trgtY): return r+1 # traverse one layer further if grid[newX][newY] == 1: if k: if (newX, newY) not in visited or ( (newX, newY) in visited and visited[(newX,newY)] < k-1 ): # --- NOTE [1] q.append((newX, newY, r+1, k-1)) visited[(newX, newY)] = k-1 else: if (newX, newY) not in visited or ( (newX, newY) in visited and visited[(newX,newY)] < k ): q.append((newX, newY, r+1, k)) visited[(newX, newY)] = k return -1 # NOTE [1] # -------- # if prev cell had less remaining passes, then we should give this path a chance since it has more passes # even though the radius is bigger
https://aman.ai/code/grid/
CC-MAIN-2022-40
refinedweb
14,174
68.7
Causes of exceptions: Handling Exceptions: Consider the following code: List: 1 Test1.cs using System;class Test{public static void Main(string[] args){int i = 10/Int32.Parse(args[0]);Console.WriteLine(i);}} Now when we run the above program like test 5 It will print 2 on console. But suppose if we run it like test or test hello Then in that case program will crash. We need to handle these situations by modifying our code. Exceptions are handled by try-catch statement. List: 2 Test2.cs using using using.StackOverflowException Thrown when the execution stack is exhausted by having too many pending method calls; typically indicative of very deep or unbounded recursion. Using an Array as a Parameter in C# BinarySearch, Sort And Reverse Method of ArrayList in C# hi m using .net 2005 in that i have a webgrid which shows data...when i click on the header of a particular column it shoud sort the column however i am getting this error ...m not able to trace the source file of error...i have migrated the code from .net 2003 to .net 2005......] Infragistics.WebUI.UltraWebGrid.UltraWebGrid.RaisePostDataChangedEvent() +30593 System.Web.UI.Page.RaiseChangedEvents() +165 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3538 can u help me
http://www.c-sharpcorner.com/UploadFile/amehta/ExceptionHandling11092005015431AM/ExceptionHandling.aspx
CC-MAIN-2013-20
refinedweb
213
52.66
Set certain actions inside ui.animate to happen instantly - Webmaster4o I think there should be a way to mark certain lines in a function that should not be animated when ui.animateis called. For example, in my cover flow, I have all the frames sliding, but what if I want one frame to have its alpha set to 0 before it slides? The only way to do this is to break the animation into two parts with a function between, like ui.animate(anim_1, duration=1.0) self.subviews[0].alpha = 0.0 ui.animate(anim_2, duration=1.0) self.subviews[0].alpha = 1.0 This seems awkward, because I'm really performing one animation, but I'm having to split it. Maybe that's not the best example, but there are certainly cases where it would be desirable to have instant actions within an animation that had to happen in the middle. I think a possibility would be to add comments above lines that should not be animated, like def anim(): view['button'].frame = (0,0,30,60) #ui.no_animate view['button2'].frame = (90, 140, 20, 10) view['slider'].alpha = 0.3 Where the animated lines are view['button'].frame = (0,0,30,60) and view['slider'].alpha = 0.3 and only the second action is not animated. This is just one way to implement my idea. IIRC, animate is not parsing your python code, it is basically looking at what changed in your object, then interpolating those attribs over time. so trying to use comments wont work like that. note that the way you "broke up" the animation is not doing what you think. Animations happen asynchronously, so your second animation is happening at the same time as the first ( if you animate different properties) ir overwriting it (if you are animating the same attribute). Try changing the frame, then changing it back in badk to back calls, and you will see what i mean. You should use completionto chain together animations. If you want to do something instantly at the start, that is no different than just setting that param before you start the animation. Note that doing so will effectively cancel animation of that attribute if you are already animating that attribute. If you want to change an attribute in the middle of an animation, kick off two animations at the same time, making us of the delayargument..l in this way you could have alpha switch at the halfway point, or even have alpha animating at a different rate. , If you dont like a few lines on animate calls, you should write your own wrapper that takes in a few a functions and chains together an animation. for instance, one could envision creating pseudo acceleration by chaining two or three animations, that have different velocities.
https://forum.omz-software.com/topic/2199/set-certain-actions-inside-ui-animate-to-happen-instantly/2
CC-MAIN-2021-04
refinedweb
470
62.48
This is a good tutorial about interfacing with the parallel port; more inportantly reading from the port. Other articles I've seen only shown how to write to the port. Before I get ahead of myself, the parallel port I used is an ECP (<!--?xml:namespace prefix = st1 /-->Extended Capability Port). Find out if your port is the same as mine, yours could be an EPP or SPP... As mention before, I used a DMM to test out the ports (nothing connected to the ports yet) and I used the read function from the inpout32.dll, .ie In(Port Address), my particular port address was: [Data Port] Addres: 0x378H or in VB Express &H378S [Status Port] Addres: 0x379H or in VB Express &H379S [Control Port] Addres: 0x37AH or in VB Express &H37AS *note these port address are in HEX Note that this was done in VB 2005 Express Edition. The 1st Tutorial: Writing to the 'data' port and reading what we wrote on it. The 2nd Tutorial: Reading from the 'status' port externally. Step 1: Basically; once you download the inpout32.dll file. Copy it to your system directory. .ie C:\WINDOWS\system32 Step 2: Then in VB; Open a New File Step 3: In the text box, write a name for this project. I called my 'Port_Testing' Step 4: "Drag" a button to your form window and then "Double Click" on the button. Step 5: Once your in the code editor declare this at follows at the beginning of your code: Step 5: Scroll down to the 'event handler,' of Button1. Button1 Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub End Class Step 6: Now within the event handler code, write the next following three lines of code: 7: Run It!!! Using 'F5 Key' or going to 'Debug/Start Debugging.' Here is the result of our hard earn. Out(&H378S, [HEX CODE: Only from &H0S to &HFFS ]) Step 1: If you haven't gone through Tutorial #1 and your a novice. I suggest that you should scroll up. Step 2: Go to the 'Design Tab' and drag another button to the form window. Step 3: Next, double click on it and then add the following code in the 'eventhandler' for Button2. Button2 Dim Value2 As String 'String named Value2 Value2 = Inp(&H379S) 'Now Value2 has the values in 'signal port' MessageBox.Show(Value2) 'A popup will indicate the current value written Step 4: Run It!!! Press F5 or go to Debug/Start Debugging. Step 5: Click on Button2 and watch for the popup window. It should read 120 Decimal.’ll be happy to share. It’s in VB Express although. Regards This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) Quote:[...] value of 120. [...] The answer is that Bit 7 (S7) of the signal port is inverted! (Ahhhhh) and S7 - S3 are always high enable [...] int inputState = Inp(0x378 + 1) ^ 0x78; Hi, Your tutorial is very helpful and it seems to be working except that I cannot change the output value (tutuorial 1). I think this is because I don't have the correct port address. No matter which Hex value I enter the messagebox always displays 255. I'm using a USB to Parallel port on Windows 7 (32 -bit) and I'm running the code in VB 2010. Can you tell me how to determine the address when using a USB Parallel port? Thanks General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
https://www.codeproject.com/Articles/15020/Reading-from-Parallel-Port-using-Inpout-dll?msg=3272692
CC-MAIN-2017-43
refinedweb
620
73.78
Phoenix Wright: Ace Attorney Justice for All: FAQ/Walkthrough by Deathborn 668 Version: Final | Updated: 2007-07-04 | Original File ******* * * ***** ***** * * ***** * * * * * * * * * ** * * * * ******* * * * * * * * * * * * * ***** * * ***** * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * ***** ***** * * ***** * * * * ***** ***** ***** * * ***** ***** ***** ***** * * * * * * * * * * * * * * * ***** * * * * * * * * * * * * * * * ** ***** * --- ***** * ***** * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * ** ** * * ***** ***** * * * * * ***** ***** ***** ***** ***** ***** ***** * * ***** * * * * * * * * * * ** * * * * * * * * * * ***** * * * * * ***** * * * * * * * * * ***** * ~JUSTICE FOR ALL~ * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * ***** * * * * ***** *; Justice For All Lost Turnabout | |6.Episode 2-Reunion, and Turnabout | |7.Episode 3-Turnabout Big Top | |8.Episode 4-Farewell, My Turnabout | |9.The Good and Bad Endings | ; Justice For All". 2017. Hence the possibility of these laws actually being true. As a side note, I STILL have no idea why the hell every picture is in black and white. I guess everyone's color blind in the future or something. =========================================================================== , sometime. HEALTH BAR-New to Justice For All is the replacement of the simple five "!" marks with a regular health bar.~ =========================================================================== Justice For All has a wide variety of wierd and wacky characters, along with a few (insane) killers. Several of these characters you should already know from playing the first Phoenix Wright, and the rest you will meet along the way in your cases. Most of them have an important background that will usually get called to attention in court, to keep them in mind! Phoenix Wright-The main character and Ace Attorney himself, Phoenix has earned his status by clearing his clients from seemingly impossible cases, and defeating Edgeworth in court, who was known to have a perfect win streak up until he met Wright. Phoenix also brought down legendary prosecutor Manfred von Karma, a complete perfectionist in every sense of the word. Phoenix has a decent amount of friends, most of whom refer to him by "Nick". Phoenix generally believes in his client all the way through the trial and will go to the farthest reachs in order to prove his clients innocent. Maya Fey-Maya is Mia's little sister. She started to accompany Phoenix on his cases soon after Mia died in the first game. She continues to help out Phoenix as well in Justice for All, but for the most part she's unable to do so either because she's being put on trial herself or has been kidnapped. She's a really sweet girl, though, and attempts to put some humor into these cases. Maya is also a spirit medium, capable to channeling dead spirits into her body temporarily. She does this occasionally to have Mia converse with Phoenix. Mia Fey-Mia was Phoenix's mentor until she was brutally killed in the first game. Since then she has made appearences in Maya's body when the case is near impossible for Phoenix. She will appear again quite often in Justice For All to help you, but this time she's going to be more vague. Yeah, that helps a lot in court. At leats she's a nice woman for the most part. Detective Dick Gumshoe-Making a grand return from the first game, Detective Gumshoe is back again. His main purpose on the police first is, obviously, breif overview of the case. You'll grow to love Gumshoe if you haven't already played the first game. Maggey Byrde-Maggey is your client in the first case of the game. She has been known most of her life to have insanely bad luck, and he current situation adds to her reputation. This police officer was dating another police officer, Dustin Prince, for several months. When Dustin was mysteriously killed, the blame for his death was pinned on Maggey. Richard Wellington-Richard is the first witness in the first case, and he will testify on how he's positive that Maggey was the one who killed Dustin Prince. Richard is the typical egoistic rich man if you couldn't tell by the way he dresses, and his blonde hair. He's also got a scarf which he chokes himself with when under pressure. He has a knack for convienently leaving out really important details, making his testimonies slightly easier to break. Dustin Prince-Dustin was dating Maggey Byrde for several months before being killed one mysterious night. Like Maggey, he was a police officer and was apparently a big baseball fanatic. His murderer was suspected to be Maggey herself. Winston Payne-Payne is once again the opening case's prosecutor. He's an old man and easily isn't a good prosecutor. Just listen to his girly objection voice! Payne will always have little to add to any discussion, paving the way for an easy first case. The Judge-The Judge is still the head of the court, and ultimately decides if the defendant will be innocent or guilty. The Judge isn't too bright, much like Gumshoe, and his opinion is easily swayed by threatening people or woman who try flirting with him in court. Despite that, and usually being several steps behind the current reasoning and explainations in court, the Judge will just keep the trial flowing smoothly until the end. Doctor Grey-He is the owner of his own doctoring clinic. During one medical procedure, fourteen of his patients were killed during a slight error. Grey quickly blamed a nurse working with him to save his own name. Shortly after the incident, that nurse was killed in a car accident. Still trying to repair his reputation, he wishes to channel the spirit of his nurse to clear his name. However, Grey ends up getting killed while having Maya channel the spirit. Ini Miney-Ini is the sister of Mimi Miney, the nurse who was working with Doctor Grey on the day of the accident. She is totally spaced out constantly, and if you do get her attention she will, like, totally, like, start like talking something like this. There's something odd about her personality though, and that's something you will have to figure out for yourself in the case. Mimi Miney-Mimi was the nurse working with Doctor Grey during the incident that killed fourteen people. All the blame was put on her and she escaped the clinic with her car, but soon was killed when she crashed. Her spirit was attempted to be channeled by Maya by request of Doctor Grey. Grey was killed during this channeling. Pearl Fey-Pearl is Maya's younger cousin. She's a real sweetheart, but is shy due to her mother preventing her from pretty much any contact with the outside world. When Maya is unable to aid Phoenix, Pearl will take her place. Her spirit channeling powers aren't as strong as Maya's, but she will still be able to occasionally channel Mia from time to time. Pearl is still a sweet partner to have following you around. Morgan Fey-Morgan is Pearl's mother and Maya's aunt. She's an incredibly strict person, and hates how Maya is soon going to be the new leader of the Kurain Village. Morgan has no spiritual abilities at all, though, but she does know as much about spirit channeling as Maya does. Franziska von Karma-Phoenix battled Manfred von Karma in case 4 in the first game, and smoked him into the ground. Now his daughter Franziska is out for revenge. She has been a prosecutor since the young age of 13 and has been living in Germany most of her life. Like her father, she is also a total perfectionist and has a perfect win record in court, at least until she faces off against Phoenix. Russell Berry-Russell is the ringmaster of the Berry Big Circus. He has a young daughter, Regina, who has lived in the circus her entire life. Russell also took in Acro and Bat when they were young, abondoned by their parents. His goal was to make the circus seem like a big family. After a conversation with Max Galactica, Russel was killed and his body was stuffed awkwardly into a box. Max was the alleged killer. Max Galactica-Max is a famous magician in the Berry Big Circus. He is totally into his persona, constantly showing off his magic tricks to everyone in the circus. He's actually a really emotional guy. He also won an award at the Magician's Grand Prix. He's been a magician for several years. After a conversation with Russel Berry one night, Russel was killed. His murder was pinned on Max. Max's real name, Billy Bob Johns, refers to his origin in the countryside. He is also crazy in love with Regina. Regina Berry-This 16 year old is the lion tamer in the Berry Big Circus, and is the daughter of Russel Berry. Because of her age, several men are in love with her. Due to a bet she made with Bat, her lion Leon accidentally chomped on Bat, sending him into a coma. Regina, who has been raised with the circus her entire life, doesn't really understand why he won't wake up. She has a similar cluelessness to most things outside of the circus just like Pearl. Although most people like and respect her, Acro has a serious hatred for Regina. Moe the Clown-Moe is the clown for the Berry Big Circus. He fitfully laughs at his own jokes (something NO comedian should ever do, little protip there), and tries packing humor into almost every other statement he makes. His full name is Moe Lawrence Curls, a blatant refrence to the three stooges. Moe has lived with the circus for most of his life, and was also a witness to the incident that put Bat into a coma several months ago. Ben and Trilo-Ben is a ventriloquist, and Trilo is his puppet. An odd character, Ben does very little talking, letting all of his words come out of Trilo's mouth. Trilo is mean to most people in the circus with the exception of Regina who he's in love with (or is it Ben that's in love with her...?). Either way, you rarely see Ben without Trilo, and Ben rarely speaks his own mind. Acro-Acro is a former acrobat at the Berry Big Circus. At the time you meet him he will be in a wheelchair, paralyzed for the most part. He has a deep hatred of Regina, due to the bet she made with Bat a while back. Acro didn't know Regina thought it was nothing serious, so when he saw her shove off the fact his brother was in a coma, Acro grew to hate Regina. This soon led to the events of the third case. Acro was taken in by Russel Berry when he was a kid, and looks to him as a father. Bat-Bat is Acro's younger brother. He used to be part of the acrobat act in the Berry Big Circus, but has been in a coma for several months due to an accident with Regina's lion. He becomes a critical character within the third case, despite being hospitalized. Matt Engarde-Your client in the final case. He's charged with murdering Juan Corrida. Matt is a mostly independant guy, contacting his managers constantly for answers to pretty much anything. He doesn't really care what happens to himself. However, the real Matt Engarde is a cunning tactician that places his faith in no one. You'll understand his dual personality as you play the case. Matt plays the Nickel Samurai, which was made soon after the Steel Samurai was cancelled. Juan Corrida-Juan plays as the Jammin' Ninja, a show aimed for kids much like the Nickel Samurai. Apparently, Juan and Matt were rivals at almost everything they did involving each other. They did their best to outdo the other. Juan was supposedly killed by Matt Engarde, perhaps out of jelousy. Will Powers-Will played as the former Steel Samurai, but is still an actor at heart. He helps Phoenix with general information through the fourth case and testifies against Matt Engarde, backing up the claim he killed Juan Corrida. Adrian Andrews-Adrian is Matt Engarde's manager. She entered the entertainment business at a similar time Celeste Inpax did, and she soon became Adrain's mentor. Celeste was dumped by Juan Corrida, and unable to ease herself she committed suicide. Adrain was so distraught at her mentor killing herself that she almost committed suicide as well. She isn't big with idle talk, only speaking important things and commenting on critical subjects. Shelly de Killer-Shelly is a professional assassin. There isn't much known about this man because his face is rarely seen. His primary mode of communication is relying on a radio transciever. He also leaves cards with a seashell on it near his victims. Miles Edgeworth-After a yearlong hiatus from being a prosecutor, Miles Edgeworth makes a well welcomed return (for the fans at least) in the final case. He isn't as ruthless as he was before, and actually helps out Phoenix during the investigation scenes. He's still formidable in court, so watch out for him there. =========================================================================== ~5.Episode One-The Lost Turnabout~ =========================================================================== =~=~=~=~=~=~=~ Trial-Part 1-1 =~=~=~=~=~=~=~ The introduction to this case start with Phoenix seemingly running from something, and his adversary yelling that he can't escape. Phoenix appears on a cliff, with a huge shadow of the Judge coming closer and closer. The Judge lifts his gavel and slams it on Phoenix... ---------------------------------------------- Date-September 8, 9:08 AM Location-District Court; Defendant Lobby No. 1 ---------------------------------------------- The same eerie organ music that was playing during Phoenix's dream is playing again-this time on Phoenix's phone. He thinks his phone caused his nightmare. He answers the phone, but the other person already hung up. Then some crazy guy around the corner mutters that he "found it", then whacks Phoenix on the head with a fire extinguisher. That's one creepy guy. And a stupid looking one. Several minutes later, Phoenix recovers (and those guards three feet away saw nothing?) and is staring at a young girl. Phoenix is clueless who this girl is, and why she is so cheerful. You'll find out her name is Maggey Byrde from the Court Record. She retells her story on how you decided to take on her case not long ago. Phoenix then tries to remember who he is and fails. Horribly. He then concludes he has amnesia (no...really?), he must be a defense attorney, and that he has to prove whoever that girl was not guilty. ---------------------------------------- Date-September 8, 10:00 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Now court is in session for the trial of Maggey Byrde. Prosecutor Payne is back in action for the first case. Not that it matters since he isn't a very interesting prosecutor. From here on I will put the answers you should respond the questions in quotations, making them easier to see. The Judge will ask if you are ready. Answer "Yes" since you should be. The Judge will retell that the defendant is a member of the police force, so this trial will be quick and swift. Payne will begin now begin by saying that the defendant is accused of killing her lover. To make matters worse, he was also a police officer. Maggey is irritated she's being called a killer even though she says she didn't kill her lover, Dustin. Payne will call Detective Dick Gumshoe to the stand now. Gumshoe is the detective in charge of homicides and other various crimes. He isn't feeling so well since Maggey looked up to him as a trainee, so Gumshoe just feels awkward to be trying to prove someone so loyal guilty of murder. Payne will ask Gumshoe to describe the details of the murder. The murder happened near the police headquarters in Expose Park. The victim was one of the police officers, Dustin Prince. Dustin was shoved off a ledge on the top of a balcony. Despite being a short fall, the landing snapped his neck and injured most of his body. The injury was so severe that he died soon after. Phoenix mutters he didn't get a copy of the autopsy report. Actually, you have one. It's in the Court Record. Dustin died a 6:28 PM from his broken neck. Gumshoe comments that when Dustin hit the ground the impact destroyed his watch, stopping it. The time or death was easy to document from this. The autopsy results also backed up the evidence. Payne also submits the picture where Dustin is lying on the ground dead. CRIME PHOTO 1 will be added to the Court Record. In the Court Record you can look at this picture again at any time, so feel free to do so if you need to. The Judge also mentions that a critical piece of evidence was found under the victim's body. Of course, he doesn't remember what it was. Maggey will help you through this if you haven't played the original Phoenix Wright. To open up the Court Record either press the R button of tap the Court Record button on the top-right corner of the touch screen. The Judge wants to make sure you know what item you have in the Court Record that was recieved earlier today. Choose "Glasses", the only other critical item in the Court Record at the moment. Gumshoe explains that the victim grabbed the criminal's glasses as he was being shoved off of the balcony. He held onto them as he fell onto the ground, where they promptly shattered. Maggey explains to Phoenix that the glasses found at the crime scene weren't her's. If you look at the glasses Maggey is wearing right now, despite it being a spare pair, they look totally different. Payne continues to say that he has decisive evidence. The Judge orders Gumshoe to testify on the evidence. --------------------------------------- ~Gumshoe's Testimony-Decisive Evidence~ --------------------------------------- -There", sir. -With this piece of evidence and the glasses, it's hard to say she's not the culprit. Well, this looks troubling. Before you can cross examine, Payne submits the picture where Dustin is writing Maggey's name into the sand. CRIME PHOTO 2 will be added to the Court Record. Maggey quickly explains how you are supposed to cross examine witness's. You need to press the statements of the witness testifying for more clues on their testimony. Eventually you will hit a contradiction, where a piece of evidence or another statement in the testimony disagrees with the statement you are looking at. At such a time you want to present evidence proving the contradiction. You must expose their lies for all their worth! If you reach the end of the testimony, Maggey will ask you if you're going to pull off that special move. Choose "Enlighten me" to learn more. There's a new addition to contradicting in Justice For All. You can now present profiles if needed. Now, when cross examining you can choose to press a statement to get the witness to reveal more details about it. This may lead to them revealing a severe contradiction, changing or adding a line of testimony too. This time around the contradiction is right in the open. At Gumshoe's fourth statement he talks about how the defendant's name "Maggie" was written into the sand. Yeah, if you've been paying any attention you should know that her name is spelled "Maggey", not "Maggie". This actually catches so many people off since not many realise you can present profiles. Present Maggey Byrde's profile here. Phoenix explains that the name in the sand isn't the same name as the defendant due to a spelling error. Ohhh, blatant contradiction. The Judge will ask Gumshoe to revise his testimony in light of this error. --------------------------------------- ~Gumshoe's Testimony-Dustin and Maggey~ --------------------------------------- -Officer Prince and Officer Byrde had been going out for about half a year. -It sounded like they were even talking about marriage. -The day of the incident just happened to be the victim's birthday, sir. -Maggey...I mean, Officer Byrde, had gotten Officer Prince a present. -It was something she had gotten over 2 months ago. -I should know, 'cause she came to me to ask what she should get for him. There's no flat out contradiction right now, so you must start pressing statement. Press by hitting the "press" button or tapping L. Start by pressing the fifth statement, about how Gumshoe knows she got something for Prince two months ago. Gumshoe will reveal that Maggey got him a baseball glove. Officer Prince was a huge baseball fan. Choose to "Press further" when asked. It turns out this glove was custom made. Maggey ordered the glove over two months ago. The Judge will agree with Payne that this line of questioning seems rather pointless. Choose "Of course it's relevant". Phoenix thinks that glove is the key to the whole case. Gumshoe states that he happens to have the glove with him right here, right now. The BASEBALL GLOVE will be added to the Court Record. The glove is yellow since Dustin loved that color. Maggey also says there was another reason she had to custom order the glove. The Judge now questions if the victim really wrote the name into the sand or not. Gumshoe will be asked to testify more into this matter. ------------------------------------------- ~Gumshoe's Testimony-Writing on the Ground~ ------------------------------------------- -We first looked into the handwriting. -Unfortunately, we couldn't confirm that it was the victim's handwriting. -Next, we checked the victim's pointer finger. -We found that there was sand trapped under the victim's fingernail. -There were also scratches on the skin that were caused by him writing on the ground. -From this, we could confirm that the victim wrote this name with his right hand. You won't get much information from pressing. If you press the sixth and final statement, Phoenix thinks some evidence can contradict that statement. Maggey then says that something about the present might help. That's all the help you need, since the two go together well. Present the Baseball Glove at the last statement. There's two things special about the glove. Firstly, it's real yellow. Yeah. Second, the glove was made for a left-handed person. Phoenix will ask again which hand the victim used to write Maggey's name into the sand. The right hand. But there's a problem there. Dustin was left handed. Phoenix claims that the victim would not have been able to write that neatly with his right hand, especially since it's not his dominant hand and he was so close to death. Thusly, someone else must have written the name. The Judge also agrees with your reasoning. It seems Maggey is off the hook, but Payne objects before the decision is made. It turns out the prosecution has another witness. Payne states that the witness saw the moment the victim was pushed to his death, and caught the face of the culprit. The Judge will call a recess in spite of recent events. Save the game when prompted. =~=~=~=~=~=~=~ Trial-Part 1-2 =~=~=~=~=~=~=~ ---------------------------------------------- Date-September 8, 11:43 AM Location-District Court; Defendant Lobby No. 1 ---------------------------------------------- Phoenix explains to Maggey that he apparently has amnesia. She suggests having her kick Phoenix in the head to boost his memory, but that seems a little too violent. She also explains she tries to stick her business into everyone else's problems. Anyways, Phoenix asks Maggey to explain several details to him. First, Phoenix confirms his name. Heh. Maggey will gladly give back Phoenix's business card. The number on the back is Phoenix's cell phone number. PHOENIX'S BUSINESS CARD will be added to the Court Record. Phoenix then asks for any other important information. She mentions an incident with a cell phone. She goes back over the details. On the day of the crime, just before 6 PM, she picked up a lost cell phone whilst on a walk with Dustin. You will here the cell phone. Sounds a bit familar, doesn't it? Like, say, Phoenix's cell phone? The phone rang and Maggey answered it. The person on the other end lost the phone. Maggey says that they should meet up. She gives her name over the phone. They agreed to meet at 6 PM, but the mysterious person never showed up. The phone was given to you yesterday. Phoenix isn't sure if this is important or not to the case. Just then, someone bursts into the lobby screaming at the top of their lungs. Haha, it's just Maya, your trusty companion from the previous game. She's the sister of Mia Fey, your old mentor in case you forgot. Phoenix doesn't reconize her, but luckily Maggey greets her by her name for you. Maya says that she has ultra-super important evidence. Phoenix wanted her to bring a list of people. There's about 20 names on the list with their phone numbers written down. She goes on to say that a there is a group of con artists that the police are currently investigating. She thinks these people are members of that group. NAMES LIST will be added to the Court Record. These numbers were found in the phone that Maggey found. Before much else can occur, court is back in session. ---------------------------------------- Date-September 8, 11:54 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Before Payne brings in the next witness, he warns the Judge that he has an egoistic nature that may rub off onto people the wrong way. He says the witness was just a random passerby in the park on the day of the murder. Hmm. This guy looks just like the wierd guy shown in the opening cutscene. Maybe, maybe not. This guy then starts ranting about how many universities he's attended and how Payne's offending him by not bringing the court's attention to him properly. He says he is Richard Wellington, just a "drifter", insulting Payne clearly. He orders Wellington to testify what he was doing in the park on the day of the murder. -------------------------------------------- infront of my eyes. -Without a thought, I looked up, and there I met the eyes of a charming, young lady. -Of course I remember her sweet face. It was that of the pretty defendant there. -The only thing I saw was the banana that fell with the police officer. Hmm. The only statement that seems odd would be the last one, about the falling banana. It could be the baseball glove we recieved earlier, since it DOES resemble a group of bananas. Press him at this statement. He is certain he saw something resemble bananas fall down the balcony. Now it should be obvious to present the Baseball Glove at this statement. Wellington will confirm that those are the bananas, but Phoenix will put out that it was a baseball glove, not bananas. Wellington freaks out for a moment, then Phoenix will need to state something. Choose "has bad eyesight". Wellington states that his eyesight isn't completely perfect, and that he isn't wearing any glasses today. He says the he lost his glasses recently. He was planning on getting new ones soon, though. Phoenix pokes Wellington even more and clearly shows that the witness wasn't wearing any glasses when he saw the murder. Thusly, the woman he saw at the crime scene easily may not have been the defendant. The Judge will ask for a new testimony to describe what happened soon after the incident. ------------------------------------------- ~Wellington's Testimony-What Happened Next~ ------------------------------------------- -The girl on the upper path ran away as soon as she realized I was there. -After that, I immediately called the police station to report the crime. -It must have been 6:45 PM when I made the call. -They must have a lot of free time on their hands since they showed up within 10 minutes. Well, the only way to get any contradictory information from this is to start pressing. Press his second statement about how he called the police after seeing the incident. He says that there may have been about a minute between when he saw the incident and called the police, but that's it. Now press the third statement. He says he knows the time because Gumshoe told him. Hmm. Something just isn't right. The autopsy report says Dustin was killed at 6:28 PM, and Wellington didn't call for a full 17 minutes. That isn't "immediately" by any standards. Present Dustin's Autopsy Report at the second statement. The questioning of this gap makes Wellington panic. Payne tries interfering but to no avail. Something is really wrong with the 17 minute gap. He says that he was searching for a telephone booth during the 17 minute gap. He then goes on to say that he lost his cell phone. Phoenix gets an idea, and Maya agrees that perhaps the phone Maggey found belongs to Wellington. Choose to "Question further". When asked, Wellington will whip out his phone, claiming he has found it. The Judge will then ask if you have any other questions. Choose "There is something..." since there must be more to this explaination. He says that there would be no reason at all to search for a phone booth. Payne will demand proof that there was no need to search for a phone booth. Present Crime Photo 1. If you inspect it, there was a phone booth just severeal feet from Dustin's body! It's true. All Wellington needed to do was take a few steps and he would have been in a phone booth. Not exactly 17 minutes worth of searching to me. Since the 17 minute gap is still in play, there's enough reason to claim this testimony fraudulous. Maya thinks that the phone you have really is his. But did he kill Dustin just to get his phone back? If Wellington wasn't looking for his cell phone during the time gap, what was he looking for? Choose "Yes, I have an idea" when asked if you can explain this time gap. So, what piece of evidence shows that the witness didn't call the police right away? It doesn't seem very obvious, and you'd probably figure it out eventually with a little guessing (and a lot of lost health), but present the Glasses. Phoenix demands to know if those were Wellington's glasses or not. He spills it, stammering where you found them. These glasses are in fact his. They were found crushed under the victim's body. So, how did they get to be there, exactly? As Dustin fell, he grabbed onto Wellington's glasses. He knew that Wellington would have to search for them, and what he didn't realize was that they were under Dustin's body the entire time. That's why it took so long for him to make the phone call. The Judge will ask if you are implying that Wellington is the real murderer. Um, duh? Who else could it be at this point? Turns out the cell phone was the key to this case the whole time. Payne still thinks your accusations are wild. Wellington will get a chance to explain why he can't be the murderer. He will ask about the name written, the one spelled out "Maggie". All Wellington does is imply that the real murderer personally wrote out the victim's name. Then, wouldn't the real criminal have to know the defendant? Could there be a way he knew her name before the trial? Answer "There was a way". You will need to present evidence showing Wellington knew Maggey's name before the trial. Present the Cell Phone. Phoenix will restate that Wellington lost his phone. In order to find it, Phoenix guesses he called the cell phone to find out who had it. He breaks down, wondering how you knew this. There must be a connection between the lost cell phone and this murder. The cell phone conversation will replay, showing that whoever called asked for Maggey's name, and she gave it away. Through this phone conversation Wellington must have heard Maggey's name. The big mistake he made was that it was spelled Maggey, not Maggie. This error could only be made if the name was heard! However, we still don't know what Wellington's motive is. He wouldn't kill someone without a motive. To prove he had a motive, present the Names List of the people in the con artist's group. This list of numbers was stored in the cell phone's memory. The very phone Maggey picked up. Why were these numbers on Wellington's phone? Now you will be asked why he has the numbers of all these con artists on his phone. Answer that he is "a member of that group." All of his friends are stored on his phone. That's why he had to kill, to hide these numbers. Payne will come in and ask why, if all Wellington had to do was meet Maggey and pick up the phone, did he need to kill Dustin? Something must not have agreed with him. You'll be asked to present what didn't agree with him. Present Dustin Prince's profile. Around the time of the murder, Dustin and Maggey were walking through the park on their date. With no time to change, Dustin was still in uniform. Wellington didn't know they were going out so he paniced. Wellington then spazes out of control with laughter. Whose to say the cell phone was really his to begin with? He states again that he found his phone, so why would the one you hold be his? Perhaps there's something you overlooked. Choose "Fingerprints on the phone?" Maya will remind you that you wiped the prints off when you got the phone from Maggey. Wellington regains composure thinking he may be off the hook. He then says the numbers on his phone somehow disappeared. Sure they did. Phoenix demands to know where he found the cell phone. He then completely remembers everything before the trial. You'll see the opening cutscene again breifly, and Phoenix will remember who hit him with the fire extinguisher. Unless you can prove who the phone belongs to, and fast, then it's all over. You better "Raise an objection". Phoenix is confident that he will be able to prove everything. Your health bar will take a big hit if you get this wrong so don't screw up! Present the Wellington killer-Phoenix's Business Card. You will trade cards with the Judge for whatever reason. JUDGE'S BUSINESS CARD will be added to the Court Record. There is something odd about your card. State "the back of the card." Phoenix will ask Maya to call the number on the back of Phoenix's business card. Maya makes the call and... the Steel Samurai theme plays. In Wellington's pocket. How did Wellington end up with Phoenix's phone, then? As it turns out, when Wellington went to retrieve his phone from an unconcious Phoenix, he took the wrong one. Wellington chokes himself unconcious on the spot. Good job on the Not Guilty verdict! ---------------------------------------------- Date-September 8, 2:16 PM Location-District Court; Defendant Lobby No. 1 ---------------------------------------------- Looks like Maggey is happy that you proved her innocent. Maggey can't help but feel Dustin's death was her fault. She says that she's been shunned with a torrent of bad luck her entire life, and now look at what's happened here. She also thinks that he bad luck latched onto anyone around her. She says she's gonna quit being a police officer to start a new life somewhere. She's sure she will have better luck the next time you see her. After a heartfelt reunion with Maya, the case comes to a close. Save the game and Episode 2 will be unlocked. =========================================================================== ~6.Episode Two-Reunion, and Turnabout~ =========================================================================== The intro cutscene shows a car speeding on the highway, and someone talking about being drugged by someone they hate. Soon the car veers off the road and crashes, erupting into flames. The woman says she is out for revenge. The scene now cuts to Phoenix and Maya talking, one behind a wall. It appears to be the detention center. How the hell did Maya end up there again? Maya is saying that she killed someone, and Phoenix is trying to get her to relax. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 2-1 =~=~=~=~=~=~=~=~=~=~=~ --------------------------------- Date-June 16, 3:34 PM Location-Wright & Co. Law Offices --------------------------------- Now we cut back into the Law Offices. A man is there waiting for you, fumbling around with his glasses. He talks about how the rain is depresing. He introduces himself as Dr. Turner Grey, a surgeon. He talks about an incident recently where fourteen people at the Grey Clinic were killed in a malpractice. Grey doesn't want to take responsibility, so he blames the nurse in charge right away. He says it was her that screwed up the medications, which is what killed all of the people. What's worse, the nurse was killed before she had the chance to admit to her wrongdoing. She died in a car accident, the same one form the intro. This crash occured about a year ago. Rumors have been put out stating that Grey was the cause of the crash, perhaps to his the real person responsible for the malpractice. Grey comes back and asks why he'd want to kill the nurse. What's odd is that this case is a year old, so why bring it up now? Grey says that his clinic isn't seeing as many patients nowadays due to this incident, so he wants to clear his name. He wants you to prove him innocent. He brings up Maya and knows that she is a spirit medium. Grey has already set up an appointment with Maya to channel the spirit of the dead nurse. Also of note is that this will be Maya's first real channeling, and the only condition she has to do this is that Phoenix is there with her. Phoenix heads with Grey to Maya's hometown. ----------------------- Date-June 19, 1:25 PM Location-Kurain Village ----------------------- Hmm. Seems like an old fashioned kind of place, nice and peaceful. A young girl spots you as you enter, then runs off. Maya then tries chasing after her but ends up running into Phoenix. Maya's training has been going well recently, and now you are able to talk with her. Talk to Maya about "Today's channeling" first. Maya confirms that she knows all of the details behind this case right now. She's pretty sure that Grey is innocent, but we'll have to find out. Talk about "Kurain Village" now. Maya asays most of the people who work here are spirit mediums, as well as most of her ancestors. Only the woman here are mediums. The men work in another place outside of the village. Now ask about "The girl earlier". Maya says she is Pearl Fey, her cousin. Like Maya, Pearl is also a spirit medium. She ran away since her mother (Maya's aunt) drilled into her head to run away from suspicious people. Pearl isn't allowed to leave town, so she doesn't know much outside of the village. Maya will state that the channeling will start soon, so you better hurry. Move to the Meditation Room. ----------------------------------- Date-June 19 Location-Fey Manor; Meditation Room ----------------------------------- You will meet up with Dr. Grey right away. He's still ranting on about the weather when you first talk to him. He was given a map to this place, and passes a copy to you. GUIDEMAP (FEY MANOR) will be added to the Court Record. You can talk to Grey now. Ask him about "Today's channeling". Phoenix will ask what he's going to do when the spirit has been called. He intends on having her sign a confession that the car incident and the malpractice were all her fault. Yeah, last time a spirit medium was called to answer a case bad things happened. Also ask about "Maya". He heard about her from a girl studying in college. That girl showed him the village. Maya is also a daughter of the master of the village. Maya's aunt is just behind the door, so we should go meet her. Move to the Channeling Chamber. -------------------------------------- Date-June 19 Location-Fey Manor; Channeling Chamber -------------------------------------- Fancy room. A crazy old woman with a huge afro will demand to know who you are. She's heard a lot about Phoenix from "Mystic" Maya. She introduces herself as her aunt, Morgan Fey. She thinks that you ask to much of her in your duties as a lawyer. She seems to disapprove of it. Talk about "Maya" now. She's earned the Mystic title because she is the only one with the blood of the master running through her. She's the last of the rightful heirs to the Kurain Channeling. Morgan is merely a member of the branch family. Members there can't become the master. She hints at the fact she has no spiritual ability. Now ask about "Today's channeling". She thinks the death of someone in a car accident will be easier to channel. The channeling will occur right here in this room. Talk about the "Channeling Chamber" next. She won't allow you to observe the channeling, as that's only allowed for the medium and the client. She also mentions that the door is securely locked to prevent anything from going wrong. She also brings up the subject of Pearl. She requests that you don't speak to her at all. There's nothing left here. Head to the Meditation Room, then move to the Winding Way. ------------------------------- Date-June 19 Location-Fey Manor; Winding Way ------------------------------- There's nothing much in this room for now. There's a nice garden, an incinerator, and a glass urn containing something. You'll figure out why most of these are important later. Move to the Side Room now. ----------------------------- Date-June 19 Location-Fey Manor; Side Room ----------------------------- Someone is sleeping in one of the beds on the ground. There's nothing you can do here, so again head back to the Winding Way. ------------------------------- Date-June 19 Location-Fey Manor; Winding Way ------------------------------- As soon as you step out someone will demand that you answer some questions. It turns out to be Lotta Hart, the eccentric photographer from the fourth case in the previous game. Answer "Lotta Hart" when you stammer for her name. She's still a paranormal photographer, oddly enough. Thought she gave up that dream a while back. She says that the channeling is about to be started. She says you better hurry to the Mediation Room. Head there now. ----------------------------------- Date-June 19 Location-Fey Manor; Meditation Room ----------------------------------- Morgan tells Maya and Dr. Grey to enter the Channeling Chamber. Maya says that she has the key to the chamer. Morgan says that the key is the only one of it's kind. Well, while we wait for the channeling to be over, Morgan invites Phoenix to relax over some food. Lotta becomes angry that she can't get any photos of the channeling, but Morgan just shoves her complaints off. A few minutes will pass and you will hear a loud bang. As soon as you realise what it is, another bang goes off. You will question what to do in this situation. Choose "Break into the Chamber". Obviously there isn't much of a choice, since the only key is with Maya. After several slams you end up in the Channeling Chamber. -------------------------------------- Date-June 19 Location-Fey Manor; Channeling Chamber -------------------------------------- That's not good. Dr. Grey is lying in a bloody pool in the corner of the room. Lotta takes several photos of this scene, then the camera pans over to Maya who doesn't look like herself right now. She mutters that she was murdered, and that Dr. Grey killed her so she killed him back. Morgan interferes and orders you to leave and alert the police. Maya's screwed now. ----------------------- Date-June 19 Location-Kurain Village ----------------------- Phoenix's cell phone doesn't get any reception down in the village, but he is lucky enough to have a phone booth built convienently nearby. He phones the police and they are on their way. What an odd case this is turning out to be. Talk to Lotta about "What you witnessed". She thinks that it wasn't Maya that pulled the trigger, instead it was the person that was channeled in her body. Ask about "Dr. Grey" now. She doesn't know much about him, but he has a bad reputation. Although skilled at surgery, he's got a bad attitude. He was a tough person to work with. Now move back to the Meditation Room. ------------------------------------ Date-June 19 Location-Fey Manor; Meditation Room ------------------------------------ You'll meet up with Morgan again. She seems to be quite calm. She tells you that although the channeling is complete, Maya is still unconcious. Out of the blue pops in Detective Gumshoe, here to cheer us all up. How convienent for him to be in this area at the time of the police call. He leaves to investigate the crime scene. The only thing you can do now is talk to other people hoping for some clues. Head back to Kurain Village. ----------------------- Date-June 19 Location-Kurain Village ----------------------- Lotta is panicing, hoping she isn't next to be killed. Talk to her about "Any ideas" now. She brings back up the fact that she took two pictures when you were in the Channeling Chamber. She leaves to go back to the Chamber to get more photos. Head back to the Side Room now. ----------------------------- Date-June 19 Location-Fey Manor; Side Room ----------------------------- As soon as you enter the room you'll notice the person in the bed wakes up and makes her way over to you. She mentions about the time of the channeling and if it's going to happen soon. Phoenix tells her a murder just happened and she...totally doesn't know what that is. Oookay. Seems like a total druggie or someone with really bad memory. She introduces herself as Ini Miney. She's studying parapsychology, the study of these mystical spiritual things. Talk to her about "Ini Miney". She says that she was the one who told Dr. Grey about this place. He asked her if she knew a good spirit medium, and she told him about Maya. She was taking a nap here since she wasn't feeling well. She's allergic to sesame seeds, so after feeling ill after lunch she took a nap. Now ask her about "What happened". Since she's been sleeping here since lunch she has no idea about the murder that just took place. Now talk about "The victim". Ini stammers when asked if she knew Dr. Grey and hurredly replies she doesn't. It seems that she's trying to hide something. Head back to Winding Way. ------------------------------- Date-June 19 Location-Fey Manor; Winding Way ------------------------------- When you set foot into Winding Way this time you will meet up with Pearl. She's not responsive, but Phoenix will notice she is holding a key. Talk to her about "Pearl". She will get a surprised look and then run off, having Phoenix confused that it was about his hair rather than something else. Nonetheless we need to find her elsewhere. Head back into the Channeling Chamber. -------------------------------------- Date-June 19 Location-Fey Manor; Channeling Chamber -------------------------------------- Gumshoe will appear and yell at Phoenix to not tamper with anything in the room. He will let you ask him a few questions, however. Talk to him about "Maya". He grimly says that with the way the case looks right now she is the only person who could have committed the crime. He says you can't see Maya right now, either. Now ask about the "Cause of death". Dr. Grey was shot in the forehead, as well as stabbed in the chest with a knife. After being stabbed, the final blow was from the gun again. Well, Gumshoe won't disperse any more information. Don't know why you need to shoot someone twice and stab them, but I guess the killer wanted to ensure Grey was brutally killed. Head back into the Meditatio Room. ----------------------------------- Date-June 19 Location-Fey Manor; Meditation Room ----------------------------------- You will meet up with Morgan again here. She is talking to Ini at the moment, and then Gumshoe will step into the conversation. He says that the investigation won't be done for a while. There's nothing else you can do for now so everyone will just spend the night at the manor. What a bizzare day. Maya was arrested by the police for the second time, and Phoenix is in deep water. You'll awake back in this room June 20, 8:02 AM. You will head down to the detention center right away. ----------------------------------------- Date-June 20, 10:34 AM Location-Detention Center; Visitor's Room ----------------------------------------- Well, Maya is back in the detention center. There's not much she can really do to help you through this case. Phoenix and her will talk a bit, the same conversation from the intro to the case. Talk to Maya about "Channeling". She says that her mother is the master of the Kurain school for now. Since the title is passed form mother to daughter, she imagines that she will soon be the new master. Now ask about "What happened". Maya doesn't remember too much. She sat down and began the channeling. That was the last thing she remembers. Once the spirit is in her body, she loses consciousness. When she woke up there was blood all over her clothes. She does remember having a dream, though. Talk to her about the "Dream" now. She remembers being dead and buried into the ground. She couldn't move and was suffocating. Phoenix orders her to prepare the documents to let him be her attorney. Maya says that if your going to be helping her you should have her magical charm. The MAGATAMA will be put into the Court Record. You need to give it to Pearl to fill it with energy. Head to Wright & Co. Law Offices first, though. --------------------------------- Date-June 20 Location-Wright & Co. Law Offices --------------------------------- Phoenix will search for a newspaper that Dr. Grey brought the other day. NEWSPAPER CLIPPING 1 will be added to the Court Record. Now get back to Kurain Village, specifically the Side Room. ----------------------------- Date-June 20 Location-Fey Manor; Side Room ----------------------------- You will meet up with Ini right away. She is very...uncoperative. Or just really, really stupid. Talk to her about "Ini Miney" as if you are actually going to get something out of it. She is still here at the manor because there is so much for her to be studying. Ask about "What happened" now. She doesn't respond at all, probably since she doesn't have a grip on what is happening. Now ask about "The victim". She will stammer and say she doesn't know about Dr. Grey. You can examine the room now. At the back end of the room is a nice alter built for some purpose. Left of the alter is a wooden bear figurine. It's just a souvenir. Now examine the box infront of her bed. Phoenix will imply that the box wasn't here yesterday, remember? At the bottom of the chest are some spiritual clothes, but nothing major. Head into the Channeling Chamber now. -------------------------------------- Date-June 20 Location-Fey Manor; Channeling Chamber -------------------------------------- Gumshoe isn't here, so he must be swamped with other work involving this case at the moment. Morgan is here, though. She says that Pearl and her were deeply sorry and shocked at the events that have transpired here and hope for Maya's safety. Ask Morgan about "What happened". As soon as you left the Channeling Chamber yesterday, Morgan struck Maya on the head to make her fall unconscious. She then performed a special technique to send the spirit back to the other world. That's totally believable in court. Now ask about the "Channeling Chamber". She says that this chamber is built to prevent such a tragedy. Despite Maya still being a novice spirit channeler, it was unlikely that the spirit she called would turn so violent so quickly. She is glad that none of the heirlooms were damaged. She is talking about the folding screen with old Kurain writings on it. Along with the Sacred Urn (in the Winding Way, remember that?), these are irreplacable items. Now ask about "Pearl". She says that Pearl is her most prizes possession at the moment. Pearl has the spiritual power to become the next master. She then goes all psycho saying Pearl is a prodigy of the family, stronger than most in the main branch. She half-tells you to die or something (damn she's creepy). Examine the folding screen she mentioned. Phoenix will notice that there is a bullet hole in the screen. Didn't Morgan say it wasn't damaged? FOLDING SCREEN info will be put into the Court Record. Morgan will leave now to visit Maya. Head back to the Winding Way now. ------------------------------- Date-June 20 Location-Fey Manor; Winding Way ------------------------------- You will find Pearl standing here once again, and she still is as shy as before. She's also carrying the key again. Wonder why. She won't answer any of your questions, so present the Magatama to her. She then starts to cry, muttering that it belongs to Maya. She then recongnizes you as Nick, wonder how she got that name. She then calls you Maya's "special someone". Oooh. Busted. She totally thinks you and Maya are in love. Pearl says that she is going to help you however she can. Talk to her about "Pearl". She really looks up to Maya, and wants to be like her when she's older. Morgan wasn't kidding when she said Pearl knows nothing of the outside world. She doesn't know what a lawyer is. Now ask about "The item in your hand". She says that she found the key yesterday. She says she can give it to you, so choose to "Accept it". BLACK KEY added to the Court Record. Pearl takes the Magatama and charges it with spiritual energy, making it glow brightly. She says that it will allow you to see people's secrets. Pearl asks to join you for a little while, to test out the Magatama. Let's head back into the Side Room to visit Ini. ----------------------------- Date-June 20 Location-Fey Manor; Side Room ----------------------------- Ask Ini once more about "The victim" since she totally refuses to answer this question. When she says she doesn't know, the screen fades black and chains and a lock appear over Ini. Pearl asks if you are able to see the lock. This is the Magatama's secret power. You're the only one who can see these Psyche-Locks. The more locks you see over a person, the harder it will be to get that person wants to hide the secret. She says you should be able to unlock it easily with only one lock. You can try out the Magatama Secret mode. To do so, just present the Magatama to Ini. The way the mode works is that she will ask you questions that you will need to answer with evidence. Get enough correct and the lock will break. However, incorrectly guess and you will lose health. Pearl warns you that if you don't have enough evidence you must stop the mode and return later when you have the proper evidence. You actually don't have the right evidence to get through the lock, so don't waster your time trying. Head back to the Meditation Room. ----------------------------------- Date-June 20 Location-Fey Manor; Meditation Room ----------------------------------- You will meet up with Gumshoe right away. One of Gumshoe's best lines comes here when he wants to show Pearl a real, genuine pistol. Talk to him about "Maya's guilt". Gumshoe is sure that you won't be able to win. Although there are a few pieces of evidence, such as Lotta Hart who will be testifying, probably about the pictures she took. He also says that no one else but Maya could have killed Dr. Grey. Now ask about "The victim". He says that his face was all over the tabloids last year. He says he lost the copy of the article he had with him, though. Now ask about "Tomorrow's trial". Gumshoe has some bad news. You're up against Prosecutor von Karma tomorrow. How? We put that scumbag in jail as far as we know form the previous game! He get out early or something? Gumshoe steps in an says that it's actually his successor who will be taking place. Now ask about the "Successor". It actually is Von Karma's daughter, who became a prosecutor at age 13. She hasn't lost a trial since. She was raised in Germany, though, explaining why you haven't heard about her at all. Present the Newspaper Clipping 1. Gumshoe will add that the situation got worse after the incident. He has another article which he'll give to you describing what happened next. NEWSPAPER ARTICLE 2 will be added to the Court Record. You have the evidence you need. Head back to the Side Room. ----------------------------- Date-June 20 Location-Fey Manor; Side Room ----------------------------- There's nothing left to do with Ini than present the Magatama and unlock her hidden secret. ---------------------------------------- ~Ini Miney's Magatama Secret-The Victim~ ---------------------------------------- Phoenix will boldly exclaim that Ini does infact know Dr. Grey. While it is possible they never met in person, Ini possibly may have had a way of indirectly knowing him. You need to present something that shows a possible connection between Ini and Dr. Grey. Look at Newspaper Clipping 2. It says that Mimi Miney, the nurse at the Grey Clinic, died after falling asleep at the wheel. Were Mimi and Ini sisters? It's possible since they have the same last name. Present this article. She was infact her older sister. This is how she knew the name-her sister worked at Grey's Clinic. The lock will break. You can now ask about "The victim" without worry of her stammering. She says that her sister Mimi was a nurse at the Grey Clinic. She heard from her sister that Grey was a total slave driver, totally pushing his workers. Mimi usually came home from work totally wiped out. Since she was driven so hard it's possible that is why she fell asleep at the wheel. Ini also thinks that the person responsible for the malpractice was also Grey. Her sister was pushed so hard is led to her death. Pearl comes in when Ini finishes and says Psyche-Locks are likely to be harder to break in the future. Head back to the detention center now. ----------------------------------------- Date-June 20 Location-Detention Center; Visitor's Room ----------------------------------------- You will meet up with someone who hasn't seen you in a long time. You'll find out that Maya is channeling Mia again. Phoenix will explain the whole case to Mia. You can talk to her now. Ask her about "Not guilty". She says she knows Maya is guilty because spirit mediums can't have dreams. From what Maya said earlier it seems like she was having a dream. That's quite impossible, though, since she shouldn't be able to dream. This means that Maya was probably set-up. You need to figure out how she was set-up, though. Now ask about "Evidence?" She vaguely hints at the fact that the black key you are holding is the key to the entire case. She asks you to show it to her, so present the Black Key. She says the key shouldn't be in your hands right now as it contradicts the facts. She then says you need everything you need to know. Just then, three Psyche-Locks appear on Mia. This means Mia must know something about the real murderer. Too late to think about it because trial is about to start. Save the game now. =~=~=~=~=~=~=~ Trial-Part 2-1 =~=~=~=~=~=~=~ ---------------------------------------------- Date-June 21, 9:48 AM Location-District Court; Defendant Lobby No. 1 ---------------------------------------------- You and Maya start discussing what the successor to Von Karma is going to be like in court. Probably just like the real man himself-sinister and willing to do anything to get a guilty verdict. Just then, Pearl pops into the courthouse. Pearl snuck away from Kurain Village all by herself with little more than a map to reach her. For someone that young and no real world experience she seems to have gotten here nice and safe. Ignoring the fact she ran here (...) Maya will bring up that Edgeworth would be better as the prosecutor here since he isn't as ruthless. At the point where she calls him Phoenix's rival and friend, you'll see a flashback to when Edgeworth was battling Phoenix in court. Phoenix doesn't like to talk about Edgeworth anymore since he's disappeared. No more chitchat, court is starting. ---------------------------------------- Date-June 21, 10:00 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Damn. Von Karma's daughter sure doesn't look pleased at anything. She introduces herself as Franziska von Karma, the young prosecuting prodigy. She gave up her career in Germany to come to America and smoke Phoenix's ass in court for revenge. Obviously she isn't pleased that her perfect father was demolished by Phoenix in court. She has a whip, and whips the Judge right away when he starts talking. Also of note is that Franziska loves to go on spiels where the only word she uses in a sentence is "fool", all plural and made up forms of it as possible. She tries to get Phoenix to go for a justified self-defense plea, but that is the same as confessing to murder. However, Phoenix continues to go for his plea of not guilty. She calls in the first witness, Detective Gumshoe. He will then bring out a map of the Channeling Chamber. He puts two dots on the diagram, one for where the killer was and one for where the victim was. He goes on to say that soon after the channeling started, gunshots were heard from the room. Several witnesses, including Phoenix, burst into the room. The FLOOR PLANS will be added to the Court Record. Gumshoe will now testify. ------------------------------------ ~Gumshoe's Testimony-Cause of Death~ ------------------------------------ -The direct cause of death was a pistol shot to the forehead, sir. -The shot was fired from point-blank range. -But before the victim was shot, sir, he was stabbed in the chest. -The wound was very severe, but not enough to cause instantaneous death. -The murderer used the pistol to finish the victim off after the stabbing. You will recieve DR. GREY'S AUTOPSY REPORT just before the cross examination. Press the first statement to find out that the pistol belonged to Dr. Grey. However, Maya's fingerprints were found on the gun. Now press the second statement to find out that there were gunpowder burns on Dr. Grey's forehead, revealing he was shot at close proximity. Now press the third statement. He was stabbed by a fruit knife, and it belonged to the Fey's. Maya's fingerprints are all over this as well. Press the fourth statement next. The stab wound just barely missed Dr. Grey's heart so it didn't kill him, but he became too weak to stand after it. Press the final statement now. You'll just confirm that the victim was shot, stabbed, then shot again. The Judge will end the cross examination since it's getting nowhere. Gumshoe reveals that he brought the weapons with him. PISTOL and KNIFE will be added to the Court Record. Franziska states the time of death was 3:15 PM. Witnesses heard two gunshots as well. You will now be asked again if you want to switch your plea over to justified self-defense. Be sure to "Plead not guilty". Franziska is confident you have screwed yourself over by continuing to plea not guilty and orders Gumshoe to testify on the final strike and other incriminating evidence. -------------------------------------------- ~Gumshoe's Testimony-Incriminating Evidence~ -------------------------------------------- -Sorry, pal but there's an even more incriminating piece of evidence. -This is the costume the defendant was wearing at the time of the crime. -As you can see, it's covered in blood. -The defendant attacked and killed a person who, without a doubt, was not fighting back. Gumshoe will present MAYA'S COSTUME which will be added to the Court Record. There is a decent amount of blood spilled onto it, directing linking Maya to this crime. Start off by pressing the third statement when he talking about how the costume is covered in blood. Gumshoe will say that lab results confirmed that the blood belongs to the victim. Franziska will tell you that you are just wasting time trying to get Gumshoe to tell about other pieces of evidence. You need to "Press further". You will be shown the costume again and Phoenix says there must be a clue somewhere. Do you see it yet? Actually, choose "There is one little thing..." when asked if anything is wrong with the costume. You will need to point to what the problem in the evidence is. There is a hole, probably from a gun bullet, in the bottom right corner of the costume so point there and present it. The Judge confirms that the hole smells like gunpowder, so there's only one way it could have been made. MAYA'S COSTUME will be updated in the Court Record. Franziska doesn't seem phazed at all, and seems glad you found the contradiction. However, since this piece of evidence has little to do with the testimony, it still stands and Gumshoe will continue. However, this costume does provide a vital clue. Present Maya's Costume on his last statement. If there's a gunshot hole in it, obviously the victim was at least attempting to fight back. Now it is quite possible that Dr. Grey did infact fire off a shot at Maya. Sadly, these grounds are only enough to support a justified self-defense plea. Since you chose to go for a not guilty plea, Gumshoe will give another testimony. ------------------------------------- ~Gumshoe's Testimony-What Transpired~ ------------------------------------- -During the channeling, the defendant saw her chance to stab the victim in the chest. -Of course, the victim used the last of his strength to fight back, sir. -While the two were fighting, the victim took out his gun. -The victim took a shot, but because they were too close, he missed. -The defendant then picked up on the opening and took the victim's gun and ended it... There's not much information to work off of here. This took me forever to figure out, but pressing will get you nowhere. You actually need to present Maya's Costume at the fourth statement where he mentions that Grey missed because they were too close. Phoenix exclaims that this hole creates a gap in the testimony. If the victim and Maya were standing at point blank range when the gun was fired, then there would be clear gunpowder burns on the costume. However, there clearly isn't. This means that Dr. Grey and Maya were standing a decent distance apart from each other when the shot was fired. Franziska says that Dr. Grey probably just shoved Maya away and then shot, but Phoenix says that the stab wound was very severe and wouldn't have had the strength to do such a thing. Then she comes back and says that it was Maya instead who pushed Dr. Grey aside to get distance between them before the doctor took his shot. Choose "Something does not make sense". You will need to present some evidence to prove that Maya was not attacking at the time she was shot at. Present the Folding Screen, the only other piece of evidence with a bullet hole in it. The shot fired went through Maya's costume, then through the folding screen. Since the bullet through the folding screen was very low, this means that Maya was squatting low on the ground, nowhere near getting ready to attack. Phoenix will pull out the Channeling Chamber diagram and show where the victim and folding screen are located. You need to show where Maya was at. Present the spot right next to the bullet hole. Franziska will stammer, saying it's illogical and Maya should have been squatting near the victim. She couldn't have been that close since gunpowder burns would have been present if she was. Since there aren't any on the costume, this situation changes slightly. Choose "It changes everything". It was claimed that Maya was aiming to kill by stabbing. If that was true, finishing the kob with a knife would be ideal. However, at the time they were squatting by the folding screen. If Maya was the real murderer, why would she be by the folding screen and not preparing to strike? Franziska gets ready to call in the next witness, likely to be Lotta. Save the game. =~=~=~=~=~=~=~ Trial-Part 2-2 =~=~=~=~=~=~=~ ---------------------------------------------- Date-June 21, 11:37 AM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Maya was scared to near death during trial. Pearl seems as cheerful as ever though. She obviously doesn't know what it's like to be a defense attorney. Phoenix is pretty sure as well that the next witness will be Lotta Hart. It also seems that Pearl didn't know that Mia was a defense attorney before she was killed. ---------------------------------------- Date-June 21, 11:43 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Franziska is utterly infuriated at the fact Phoenix just won't lose, so much so that she tells the Judge to shut it while she calls the next witness. Damn. You guessed it, Lotta Hart will be testifying next. She's be testifying on the events that occured before and after the shootings. ------------------------------------------ ~Lotta Hart's Testimony-Witness's Account~ ------------------------------------------ -Only the Doc and the defendant went into the Channelin' Chamber. -We were watin' outside the door and then, "bang!", we hear this gunshot! -Mr. Lawyer there broke the door down, and we rushed into the room. -Inside was the dead victim, and the defendant, wavin' a pistol around. -I swear, other than those two, there was no one else in the room. Lotta will present one of the pictures she took. It shows the backside of Maya with a pistol in her right hand. LOTTA'S PHOTO will be added to the Court Record. Now down to business. Press the fourth statement since it wasn't truly the defendant Maya, it was the spirit in her body. "Press harder" when asked to. You will recall that Lotta wasn't sure at the time whether the murderer was Maya or not. Franziska says that since Maya was the only other person to have gone into the chamber, only the person in the photo could be Maya. Now press the final statement. Phoenix thinks that since the place was very dark, there could have been someone else in the room. Choose "Behind the folding screen". Lotta says that she checked there and nobody was hiding behind it. This doesn't bode well with you. The Judge becomes fed up and ends the cross examination early. Franziska goes back over who was in the room, and then goes back to the picture from earlier. You will be asked if you want to present evidence to prove that this isn't Maya in the picture. Sadly, you must choose "Can't present anything yet" as nothing can really show anything about her face. Just before Phoenix gives up, Mia appears in Pearl's body. She says to think carefully about what happened in the Channeling Chamber. She says you should question Lotta one more time. Franziska oddly enough will allow Phoenix another testimony. She's gonna talk about what happened when she burst into the chamber. ------------------------------------------------ ~Lotta Hart's Testimony-Witness's Account, Pt.2~ ------------------------------------------------ -When we broke into that room, all I could focus on was Maya. -I was...uh, kinda scared of the dead body, so I didn't take a good look at it. -I'm really bad when it comes to blood and ghosts and stuff. -But I still managed to point my camera at Maya and take a shot. There's something strange about the testimony from the start, if you remember. Lotta took two photos at the crime scene and not one. Press the fifth statement to learn more about the second photo. She says she hasn't submitted the other photo as evidence because Franziska told her not to do so. You can choose what to do against Franziska now. Choose to "Leave it to the Judge" although it really doesn't matter. Franziska says she didn't think the photo would be important at all so she didn't submit it. LOTTA'S PHOTO 2 will be added to the Court Record. This photo shows the actual face of the murderer, and it is most certainly NOT Maya. Choose to "Insist it's not Maya". Phoenix says that the real murderer snuck in and traded places with the defendant. Mia says that you aren't hitting very hard, though. She says Franziska is smiling at your helpless efforts. She then presents a photo of you an Mia talking in the detention center (holy crap it's in COLOR!). But you were really talking to Maya, right? Franziska says she looks different because she is channeling a spirit, obviously. Mia says that taking pictures during a provate conversation is illegal, so it can't be presented as evidence. You need to figure out a way to prove the person in the second photo isn't Maya. Choose "I can prove it". There is a clear contradiction in this photo compared to the evidence. You must point out what is wierd in the photo. You should notice that the costume is missing the all-important bullet hole we discovered earlier. Point to the sleeve and present it. Obviously, Franziska was hiding this evidence from the court intentionally. She's smiling happy again, though. She blames not knowing about the bullet hole on the investigators since they didn't notify her about the hole in the first place. So, we have a photo that is missing a bullet hole in the sleeve, and the actual costume itself which has the sleeve with a bullet hole. You'll need to choose the logical explaination for this. Choose "The shooter is someone else." Franziska foes crazy after you present this statement. She is saying the defense is in a mess right now, and then asks Lotta if anyone else was in the room. So, if a third person entered the room, who was it and where did the come from? Time to look at this from a different angle. What if the third person was already in the room, and before breaking in Maya somehow left the room, and if either of these could be proven true, Maya may be off the hook. Before busting into the Channeling Chamber, choose "Maya had left the room." You need to prove that from the murder until the time of arrest Maya had left the room. You need to present the Black Key Pearl gave you yesterday. Yes, they key to the Channeling Chamber itself. Maya locked herself in the room with that key. Now Franziska asks how the hell the key landed in your possession. If Maya had indeed locked the door, the key should have been with her. She didn't have the key at the time of arrest, though. You got the key from Pearl who was nowhere near the crime scene. This means that Maya must have left the room at some point. If she didn't, Phoenix wouldn't have the key right now. Oh yeah, totally screwed over Franziska today. It's a bit tricky to declare a verdict when you're not sure if the defendant really was the murderer or not, or even in the room at the time. ---------------------------------------------- Date-June 21, 1:32 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Pearl explains she had little choice to call Mia to help out in court. Maya then says she doesn't remember ever leaving the Channeling Chamber. Pearl doesn't think that a third person could have even gone into the room. Save the game now. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 2-2 =~=~=~=~=~=~=~=~=~=~=~ ----------------------- Date-June 21, 3:24 PM Location-Kurain Village ----------------------- Pearl has been thinking that if Maya isn't the one that killed Dr. Grey, then someone else must have done that. She seems a bit sad, so talk to her to try cheering her up. Ask about "Today's trial". She was a bit surprised at it, not expecting so many people. Her insult at Franziska is pretty funny too. She wants to give Franziska a piece of her mind. Heh. Now you can talk to her about "Prosecutors". Phoenix will try to explain to Pearl why Franziska wanted Maya guilty so bad. Phoenix also says that all prosecutors are the same-they just want to win. He hints at someone else that may not have that same attitude, and Pearl guesses you are talking about Edgeworth. Phoenix also reveals that Edgeworth apparently committed suicide. Er, wow. Anyways, talk about "The murderer". When you ask Pearl if she knows anything, she will stammer and claim she knows nothing. Now you wonder what she was doing during the murder and where she got the key. Now ask about "Pearl's alibi". When Phoenix asks what she was doing during the murder, she will stammer and two Psyche Locks will appear over her. There's nothing you can do to break them for now, so head over to the Channeling Chamber. -------------------------------------- Date-June 21 Location-Fey Manor; Channeling Chamber -------------------------------------- Morgan will be in this room, and she's kneeling down with a creepy grin on her face, staring at a picture. She mentions the name Misty, possibly referring to Misty Fey? Morgan will then realize you've entered the room. Now you can talk to her. Ask Morgan about "What happened". She says she has nothing more to add about her whereabouts during the murder. While Lotta and Phoenix went calling the police, she was by Maya's side. Nothing else happened. Now ask about "Training". She says that all trainees go through training almost every day. She'll snap when Phoenix doesn't use Maya's and Pearl's title, so you won't learn more about this subject. Now ask about "The Master". Misty Fey is the current master at the Kurain school. Nobody is sure where she is right now, if you recall that is the same situation that was brought up in the previous game. Morgan says that she won't return to this village most likely, and in four years her name will be forever erased from it. Anyone who is gone for 20 years is considered dead, so she won't be the master any longer. A new master will be appointed at that time, and Maya was supposed to become the next master. However, due to the murder, this isn't gonna happen. Head back to Kurain Village. ----------------------- Date-June 21 Location-Kurain Village ----------------------- Present the Black Key to Pearl. She will say she found the key lying in the incinerator in the Winding Way. She says she found the key after the channeling when everyone was in a panic. Phoenix thinks he should check out the area once again, so follow that advice and head back to Winding Way. ------------------------------- Date-June 21 Location-Fey Manor; Winding Way ------------------------------- You will meet up with Ini right away here. She runs up to you from the incinerator. She will mention the urn nearby, and you'll comment that it is just a cracked piece of pottery. Talk to her about the "Sacred Urn". She says it is this village's treasure. Ami Fey's spirit is trapped inside the urn. She's the woman who founded the Kurain Channeling Technique. As long as her spirit is in the jar, the Fey family can continue to use their psychic prowess. Or some myth like that. Now ask about "What happened". She says she has nothing to do with the murder since she was sleeping in the Side Room the entire time. Now ask about the "Traffic accident". Before you get a chance to get a response, Ini will claim it has nothing to do with the murder and two Psyche Locks will appear. You also don't have the necessary evidence to break the locks. Well, that makes three. Mia's, Pearl's, and now Ini's you can open. Now, examine the sacred urn. All Phoenix will notice is a bunch or cracks on the surface of the urn. The words "I AM" are written on the urn as well. SACRED URN will be added to the Court Record. Now examine the piece of purple cloth hanging from the incinerator. The piece is from Maya's costume and the blood is still on it. CLOTH STRAP will be added to the Court Record. Head all the way back to the detention center now. ----------------------------------------- Date-June 21 Location-Detention Center; Visitor's Room ----------------------------------------- Maya seems really depressed right now. Talk to her about "Today's trial". She comments that you ran a great trial today, pulling all sorts of turnabouts each time you were about to lose. She questions if it was really her who shot Dr. Grey. She confirms nobody was behind the folding screen. Now ask her about "Not guilty". Phoenix says he believes in Maya since she isn't able to have dreams while channeling. Phoenix thinks that before the channeling occured, Maya was drugged. There was a set-up plan to frame the murder on Maya. Now ask about "Pearl's alibi". Perhaps Maya will be able to answer what she was doing during the time of the murder. She says that she was with Pearl most of the day, playing with her ball. Now ask about the "Ball". Maya says it's just a normal ball she likes to play with and that she was probably playing with it during the channeling. She also says the ball is stored in the clothing box, remember that? The big yellow box in the Side Room? Head to the Side Room right now. ----------------------------- Date-June 21 Location-Fey Manor; Side Room ----------------------------- Before you get here you will see Lotta at the entrance to the village, but she'll run off. Once in the Side Room, examine the ball lying right next to the yellow box. This is Pearl's ball (note the Steel Samurai picture on the ball). PEARL'S BALL will be added to the Court Record. Now examine the yellow box again. What the hell was Lotta doing hiding in the box? She'll run off again, and after than Phoenix will notice that there is a small hole in the clothing box, about 8 inches off the ground. That's the same height as the hole in the folding screen! CLOTHING BOX will be added to the Court Record. Now head back to the Meditation Room. ----------------------------------- Date-June 21 Location-Fey Manor; Meditation Room ----------------------------------- Pearl will meet you here and tell you that Lotta went off, saying she was gonna find her true self. You have enough evidence now, so present the Magatama to Pearl. --------------------------------------- ~Pearl's Magatama Secret-Pearl's Alibi~ --------------------------------------- Pearl isn't too thrilled about talking about the murder much or what she was doing during it, so Phoenix is going to play a small guessing game. You will be shown a map of the Fey Manor, and need to point out where Pearl was during the murder. Point to the Winding Way and present it. Now you need to present something that shows what she was doing in Winding Way at the time. Present Pearl's Ball. She was playing with her ball during the time of the murder. Judging by the look on her face, something bad happened while she was bouncing her ball. Now you need to present what happened. Present the Sacred Urn. Yeah, Pearl ended up breaking the urn while she was playing with her ball. She says that it isn't too wierd to have that urn with cracks in it, considering how old it is. You need to present evidence to show how the urn was broken. To prove it, present Ami Fey's profile. The name is spelled "Ami", but the letters on the urn have been rearranged to spell "I AM" instead. Pearl's last lock will break and you can talk to her about "Pearl's alibi" now. You've alreayd figured most of it out. During the murder, Pearl was playing with her ball in the Winding Way. Her ball smacked into the urn and broke it. She was afraid that she would be forced to leave the village for destroying a keepsake, so she thought she could easily fit the pieces back together. Now ask about the "Sacred Urn". She got some glue and fixed the urn back together in the Winding Way, assuming that since the channeling was going on nobody would walk by. She finished fixing it around the time Phoenix and Lotta finished reporting the murder. SACRED URN info will be updated in the Court Record. Now head back to Kurain Village. ----------------------- Date-June 21 Location-Kurain Village ----------------------- Phoenix will ignore Lotta for a few seconds while pondering over the case. She will mutter something about why you're following her, then you can talk to her. Ask about "Today's trial". She'll admit that she made some mistakes in trial today. Choose to "Forgive her". She will gladly share with you all of the info she has dug up so far. Now ask about "The murderer". She thinks that since Maya isn't the murderer, it must be Ini instead. It couldn't really have been anyone else. Present to Lotta Ini's profile. Now talk about "Ini Miney". Lotta says that Ini was hospitalized six months ago. She doesn't know for sure why, but she has the clinic's address of where she went to. Head over to the Hotti Clinic. -------------------------------- Date-June 21 Location-Hotti Clinic; Reception -------------------------------- A creepy doctor with many missing teeth and pink hair (WTF) will greet you when you enter. He is Director Hotti, apparently the owner of this clinic. A nurse will come by and tell Hotti to return back to his room, and to hang up the director's coat. Is he even the real director? Not much of a choice you can do now. Talk about the "Hotti Clinic". He says they do doctory-type things here. He also says they do plastic surgery here. Now ask about "Ini Miney". She was transferred from the general hospital. She needed surgery, but Hotti isn't exactly willing to tell you. There's nothing else he can really freely talk to you about. Present your Attorney's Badge. He says that he isn't the real director to this place. He is willing to give you some information, though. He knows information about many of the patients, past and present here. Talk about "Ini Miney" again. She was transferred from the general hospital about a year ago in an emergency case. She was seriously injured. Most of her body was wrapped in a cast. He then mutters that it was a car accident that cause the injury. Now you can ask him about "The Operation". Most of Ini's face was burned clean off in the accident. Using a picture of her, they were able to put her face back together. Her license was also burned in the wreckage of the car. LICENSE PHOTO will be added to the Court Record. Now ask about "The Accident". He brings out an article that says Ini was in the passengers seat of the car. She was sleeping when a jolt woke her up, and a sea of fire was all around her. She managed to get the door open and escaped the fire. NEWSPAPER CLIPPING 2 will be added to the Court Record. It has been about half a year since Ini was discharged from the clinic. Had back to Kurain Village now. ----------------------- Date-June 21 Location-Kurain Village ----------------------- Lotta will say that Morgan called the cops a little while ago, saying that she had something important to tell them. Talk to Lotta about "Morgan". As it turns out, although the master right now is Misty Fey, the real master was supposed to be Morgan. Now ask about "Ini Miney". She confirms Ini is still hanging out near Winding Way. Now ask Lotta about "The Master". The master is apparently always the oldest daughter. Morgan is Misty's older sister. The older sister usually has the stronger powers, but not so in this case. Most of the villae turned against Morgan for having no power at all. If it wasn't for this, Maya's family would have been the branch family. Now head to Winding Way. ------------------------------- Date-June 21 Location-Fey Manor; Winding Way ------------------------------- As Phoenix hints at, you have enough evidence now to unlock Ini's secrets. Present the Magatama. ---------------------------------------------- ~Ini Miney's Magatama Secret-Traffic Accident~ ---------------------------------------------- Ini starts off by questioning what accident you are talking about. She says that Dr. Grey made her sister fall asleep at the wheel and that's all she has to say. Since she said "whose accident" it implies she knows more than one accident. Phoenix will try changing the topic to someone else's accident. Present the License Photo. Let's ask about her accident instead. Now you need to prove that she was ever in an accident. Present Newspaper Clipping 2. The clipping states that Ini Miney had an interview after the crash. Now she states that that "Ini Miney" in the article wasn't actually her, although they just happen to have the same name. Now you need to prove that she was ever hospitalized. Present the License Photo again here. Yeah, the photo looks just like Ini. The first lock will break. Now she says that the accident in question isn't related to this murder. Now you need to present who the woman that died in the accident was. Present Mimi Miney's profile of course. Both of them were in the car, together, when the accident occured, making them the same. Now talk about the "Traffic accident". She was riding in the car with her sister, on their way home. She was riding in the passenger seat when she fell asleep when it happened, the accident. She was incapable of doing anything to help her sister. Now ask about "Dr. Grey". Ini is positive that Dr. Grey drugged her in order to get revenge for killing his patients. She then says it will be impossible to catch her. Head back to Kurain Village. ----------------------- Date-June 21 Location-Kurain Village ----------------------- Gumshoe and Pearl will be fighting when you arrive here. Morgan comes in and says to Pearl that she will be fine for now, and to protect the manor while she is gone. Gumshoe tries to show his real, genuine pistol, but that just upsets Morgan. Talk to Pearl about "Morgan" now. She has a feeling that something bad is going to happen and she's not sure what. Now ask about "Maya". Pearl says she will be perfectly fine here, so you should go visit Maya in the detention center. ----------------------------------------- Date-June 21 Location-Detention Center; Visitor's Room ----------------------------------------- You will find Mia again when you enter. Mia invites you to try your luck at getting the last piece of information. What a jerk, her sister's fate could rest on this information and she's forcing us to play a game to find it out. Honestly...for now, talk about "The murderer". The Psyche Locks will apper over Mia now. Present the Magatama so we can get this over with. ------------------------------------ ~Mia's Magatama Secret-The Murderer~ ------------------------------------ You know that she is hiding information from you intentionally. You need to present who she is trying to protect. Present Morgan's profile. The first lock will break off easily. However, Morgan was outside with you when the murder was taking place, so she has an alibi. Now you need to present evidence that may place suspicion on Morgan. Present the Cloth Strap. This strap was from Maya's costume. However, when Maya was arrested she was wearing the outfit. This means someone must have changed her clothes. Who was the only person with Maya when nobody else was around? Morgan. Now you need to present proof that this blood belongs to Maya's costume, not someone else's. Present the Black Key now. Maya had this key when she was channeling. Somehow it ended up in the incinerator much like the piece of cloth. Maya also said earlier that the key was placed in her sleeve. Both were found in the incinerator. This means this must be part of Maya's costume. The only person who could have changed her clothes and burned these items was Morgan. The second lock will break now. Now you need to who or what Morgan needed to place the murder. Present to her Ini Miney's profile, the only other person without an alibi who was at the manor. This means that Ini and Morgan were working together. Now ask about "The Murderer". This crime was something no normal person could do. Someone had to know a lot of the Fey Manor to do this. We can assume that Ini Miney had something to do with this. However, we are still missing a motive. Why would Morgan go through all of this trouble? Mia mutters it involves her mother. You have gathered every clue you can. Time for the final showdown. Save the game. =~=~=~=~=~=~=~ Trial-Part 2-3 =~=~=~=~=~=~=~ ---------------------------------------------- Date-June 22, 9:51 AM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Maya mentions tha Franziska is the same age as herself, and the amount of strength between the two is uncomparable. Pearl comes in to greet everyone cheerfully, and says that Morgan is coming to testify on her behalf. Or so you may think. Phoenix asks Pearl to channel Mia again, and says thankfully that this way she won't be able to see the trial, whatever that could mean. ---------------------------------------- Date-June 22, 10:00 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Franziska is quite confident that she will utterly defeat you. Mia will appear next to you, saying this already makes you seem famous. I think it's time we brought down this egoistic blue haired maniac before she gets any further. The Judge will then recap what was found out at the end of the trial yesterday. Namely, the possibility that Maya could have left the Channeling Chamber. The key was proof enough of this. Franziska points out that from the time of murder to the time of arrest, Maya did indeed leave the chamber. She then goes on to say that Maya dropped the key after she left the room. She then calls Morgan ot the stand to testify on this behalf. Morgan talks about the technique she used to remove the spirit from Maya's body briefly, then goes on to say Maya escaped the room afterwards. She'll testify based on what happened. -------------------------------------- ~Morgan Fey's Testimony-Maya's Escape~ -------------------------------------- -After we heard the gunshots, those two broke the door open and entered the Chamber. -I requested that Mr. Wright and the other lady please contact the police. -A pistol was hanging from Mystic Maya's hand and she was in a daze... -Then, quite suddenly, she thrusted me away from herself and escaped from the room. -With great strength, she hit the base of my neck and I fainted for a short while... -I'm afraid I have no knowledge of where she went after that. Mia says before you start that there's no clear contradiction, so get pressing. Press the first statement, though you won't hear anything new to the case. Press the second statement where Morgan says she told Phoenix and Lotta to contact the police. If the job was just to call the police, then why should two people need to have done it? Morgan says she was confused and that there was another...something. She shuts up after that. Choose to "Question further". She says she didn't want either of you in there because she didn't want any more victims. Press the thid statement. She now says that the statement where she hit Maya on the head to make her fall unconcious was a lie. Franziska says that she way lying to protect the defendant. Choose to "Question further". She was correctly informed later what happened. Press the fourth statement. Franziska says it was easy for Maya to shove away Morgan since she wasn't physically Maya at the time. Now press the fifth statement. She says she was unconcious for about ten minutes. Press the final statement next. Choose to "Question further". Phoenix says if she is so sure she didn't know what Maya did when Morgan was knocked unconcious, how can she be sure Maya left the room at all? Now that you have pressed every statement, the Judge ends the examination. Franziska says the important thing is where Maya went after leaving the chamber. She then goes on to say Maya went to speak with a certain person. She calls in Ini Miney, the only other person near the murder scene at the time. She will testify on what happened with Maya. ---------------------------------------- ~Ini Miney's Testimony-After the Murder~ ---------------------------------------- -Like, when the channeling started, I was, like, sleeping in the Side Room. -Like, a little later, someone came into the room, like, really suddenly. -It was, like, oh my gawd, totally my sister! -I, like, hadn't seen her in, like, so long...I was so happy in, like, a sad way... -My sister...She, like, told me something, like, totally terrible. Ini mentions a terrible thing at the end of her testimony. She said that her sister told her that she was drugged by Doctor Grey, and it was no accident. Then her sister told her she took her revenge on Dr. Grey. Mia then says that this tesitmony was probably just one huge made up lie. Press the fourth statement, about when she saw her sister. Phoenix asks why she wasn't shocked or anything to see her dead sister standing right near her. Choose to "Question further". The Judge will ask if the question of if she really saw her sister or not was important. Choose "It is very important". Ini will change her line of testimony to this: -I wasn't, like, scared at all. And, like, her costume looked, like, normal. Press this new statement. Mia will say that it is impossible for her costume to not having something wrong with it. At this statement, present Maya's Costume. It had spilled blood on it, remember? That should have been very noticeable. Phoenix will show the crime photo and the blood spray on the dress. Ini totally, like, stammers when told she should have noticed the blood right away. Ini snaps for a second, then regains composure. She's gonna testify again. Woo. ---------------------------------------------- ~Ini Miney's Testimony-After the Murder, Pt.2~ ---------------------------------------------- -Like, the Side Room was, like, kinda dark, you know? -So like, the costume is, like, purple, right? The blood totally blended right in. -And I, like, persuaded my sister it wasn't, like, right to do something like that. -And then...like, I took my sister to the Channeling Chamber. Something is odd about the third statement, so press it. What is she taking about when she says the persuaded her sister to do something? Ini says her sister was aware of this and wanted to go apologize to Morgan or something. Now press the final statement. Phoenix will go on to say if there was something that wasn't right with the scene. Choose when she "was going to the crime scene". She answers quickly, so "Press harder". Ini refuses to answer the question, and the Judge asks if this was important at all. Choose "It's very important". Now she'll add this statement: -I, like, didn't see anyone on the way to, like, the Channeling Chamber. Press this new statement. Ini is completely positive she saw nobody in the Winding Way when she was heading to it. However, this is quite false. Present Pearl's profile at this new statement. Pearl was busy fixing the broken urn, and when we talked to her she clearly said nobody passed by. Ini spazzes out for a second at this fact. Now you need to present evidence showing there would be no way to miss Pearl busy in the Winding Way. Present the Sacred Urn. The urn was broken around the time the channeling started. Pearl managed to put it back together in the middle of the Winding Way. Thusly, it would be impossible to miss her passing through it. Well this shows that Ini must have been lying the entire time. She still says she was sleeping in the Side Room, so choose "There is no way!" when Phoenix thinks if this is still true. Phoenix says there is a clear contradiction. To show where, choose "It's in her testimony just now". Ini said that Morgan was the only one in the Channeling Chamber. However, if she was sleeping, how did she know this? So, she did go to the Channeling Chamber but she never went through the Winding Way. So Ini couldn't have been in the Winding Way or the Side Room at the time of the murder. You must now point to where Ini was when the murder took place. Present the in the Channeling Chamber. Ini must have been at the crime scene the entire time. Ini was hiding the entire time in the Channeling Chamber. Now you must present where she was hiding. Point to the right of the folding screen. It's the far right side of the screen, so it's technically "behind" the folding screen. Now you must present evidence to help show how she was hiding. There was a hole in the folding screen. Remember another object with a similar hole? Present the Clothing Box. Anybody could hide in it since Lotta did the same thing yesterday. The Judge will ask if you can prove the clothing box was at the scene of the crime at the time. Choose "Yes, I can with some evidence". Now you need to present how you know the box was there. It should be simple-present the Folding Screen. Yeah, the hole in the box and the hole in the folding screen are at the same height. It can't be a mere coincidence. Ini must have been hiding in the box, waiting for her chance to kill Dr. Grey. So, was the person in the crime photo Ini Miney? She wore a costume to masquerade as Maya the entire time. Franziska will say this is impossible for one person to do by themself. Choose "Correct. It's not possible." Ini starts getting irratated when Phoenix suggests more than one person could have been in cahoots with this plan. Ini had an accomplice. Present Morgan Fey's profile, the only other person at or anywhere near the crime scene. If the person wasn't from the village she couldn't have gotten the costume. If it wasn't someone who lived there, she couldn't have gotten the box. Ini goes crazy now. Phoenix will try to support his own theory. Ini had put herself at the crime scene long before it occured. Dressed in the medium's costume and wearing a wig, she imitated the defendant. Then the channeling started. Ini got out of the box and drugged Maya, then stabbed Dr. Grey with the knife. Then she hid Maya inside the box. She did this to take Maya's place and frame her for the crime. Something unexpected happened. Dr. Grey was not dead, so he took a shot at his attacker. That is why the hole in the folding screen is so low. The murderer took the gun and finished off Dr. Grey. After the gunshot, Phoenix and Lotta forced their way into the room. Several photos were taken. Ini covered her costume in blood, pretending to be Maya. This probably would have been easy to figure out at the crime scene, so that's why Morgan chased you out of the room. Franziska isn't ready to lose the trial just yet, and says that Ini would need a motive to go through this trouble. This should also be simple from what she said in her previous testimony. Present Mimi Miney's profile. She must have gone through this trouble to take revenge on her sister's death. Ini says she was discharged from the hospital six months ago. If she wanted to kill Dr. Grey, why would she have waited this long? The Judge is about to end the trial since you have nothing more to say, but Mia steps in and asks for another minute. Ini had a reason to kill Dr. Grey. Choose "Yes, I can" when asked if you have proof for a motive. There will be a short recess before the final showdown. Save the game. =~=~=~=~=~=~=~ Trial-Part 2-4 =~=~=~=~=~=~=~ ---------------------------------------------- Date-June 22, 12:04 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Maya is a bit surprised at the fact her aunt must have had some part to do with this set-up murder. Franziska will appear and say that everything is going to her plans. She is damn determined to let the world know of Phoenix's downfall. She's a bit creepy. Ooookay. ---------------------------------------- Date-June 22, 12:10 PM Location-District Court; Courtroom No. 2 ---------------------------------------- Ini will be asked to testify about the car accident from last year, the main connection in this crime. -------------------------------------------- ~Ini Miney's Testimony-Last Year's Accident~ -------------------------------------------- -That was...like, last year, in May. -Like, something really bad has happened at, like, my sister's clinic around then... -And like, the night of the accident, my sis was. Press the third statement where she talks about how Mimi was tired when driving. She had to talk to police and was being investigated like every day. Choose to "Press harder". Phoenix will ask why they didn't just switch places, making Ini the driver. Ini then says she doesn't have a driver's license. Her line of testimony will change to this: -I, like, didn't have my license, so, like, I couldn't take over driving for her. Bull. We have her her license in the Court Record. Present the License Photo at this statement. Ini then stammers saying she did have a driver's license, but didn't get it until after the accident. Ini then says she recieved her license last November. Ini thinks that even if she had a license her sister wouldn't have allowed her to drive. She will now testify on this matter. --------------------------------------------- ~Ini Miney's Tesitmony-I Wouldn't Be Allowed~ --------------------------------------------- -Like, around that time, I was, like, really close to getting my license. -My sis was, like, this totally big fan of cars and, like, really valued them. -She, like, had just goteen this really shiny, bright red sports car. -She, like, would say things like, "No way am I letting a newb drive my car!" -So, like, that's why I ended up in the passenger's seat that night too. Press the third statement, about how Mimi had just gotten a new sports car. She says it was from the UK. Mimi said it was a really special model. Choose to "Press harder". Ini will change her line of testimony to this: -My sis' new car was, like, a totally special model from England. Press this new statement and "Ask for the heck of it". Remember Phoenix's critical statement that the driver's seat is opposite to the cars in the United States. She then goes crazy about how great the car was. Found the contradiction? Check out Newspaper Clipping 2 in detail. Ini says that she climbed out of the right side door. This wouldn't be a problem if she wasn't the passenger in a car made from England. Since everything is screwed up there, if she was really the passenger she would have climbed out of the LEFT side door. Present the Newspaper Clipping 2 at this statement. So, this means that if Ini was on the right side of the car, she's be in the driver's seat instead. It turns out this is all a big misunderstanding. Who was really driving that night? Choose "Mimi Miney". She was the only person with a driver's license. Now comes the million dollar question-who the hell is the person at the witness's stand? Now you must tell her real name. Present Mimi Miney's profile. She was admitted into the hosptial with facial burns. To put her face back together they needed a picture as refrence, and it was Ini's picture she gave. It was thought Mimi had died in the car accident, when infact the opposite was true. The dead body at the crash site was the real Ini Miney. Mimi survived the crash and rebuilt her face to mimic Ini's so nobody would recongize the difference. Now this is why Mimi had to kill Dr. Grey. He wanted to call the spirit to a dead person, specifically Mimi Miney. That would have been impossible since Mimi wasn't actually dead. If the channeling had actually occured, this would have been discovered. Ini...or Mimi says that she's finally been unmasked. Mimi now says that the doctor finally got what was coming to him in the end. You need to present why Mimi was so willing to let go of herself. Present Newspaper Clipping 1. Dr. Grey was actually right the whole time. The mistake was caused by Mimi. A few weeks after this mishap she got into a car accident where her younger sister was killed. This was her last chance to throw away her old life and start over as her sister. Well, looks like you've won. Just before you get the Not Guilty verdict, Franziska goes psycho and whips Phoenix into submission. ---------------------------------------------- Date-June 22, 3:13 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Mia and Maya have a short and sweet reunion with each other. Mia also says that she stored her clothes in that box long ago as well. Phoenix now wonders what would have happened if Mimi didn't shoot Dr. Grey. She probably would have opened the doors anyways, and the scene would have been that much more shocking. Maya then demands to know why Morgan went through all of this trouble to get her convicted of murder. Present Pearl's profile. The new master will be delcared in several years, and next in line is Maya. If Maya wasn't there to take the place of master, then Pearl would have been the next in line to become master. Well that's some crazy stuff. All this just to make Pearl the next master. Hmm. ------------------------------------------------------- Date-Date and Time unknown Location-Detention Center; Solitary Confinement Cell 13 ------------------------------------------------------- Clearly Morgan is the one speaking here. She says only Pearl is the one suitable to become the next master of Kurain Village. She admits to sacrificing herself just to have her become the next master. All to unseat Maya. She says Pearl's time will come soon... This is the end of the case. Episode 3 will now be unlocked. =========================================================================== ~7.Episode Three-Turnabout Big Top~ =========================================================================== The intro to this case starts in what appears to be a large circus show. Deemed someone who's master flight, the scene pans upwards towards the famous Maximillion Galactica. He flies around for a bit, then vanishes. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 3-1 =~=~=~=~=~=~=~=~=~=~=~ ------------------------------------------ Date-December 26, 8:12 PM Location-Berry Big Circus; Circus Entrance ------------------------------------------ Turns out Phoenix, Pearl, and Maya were here to watch the show as well. Seems like Phoenix has a tough time finding cases, it's been about five months since the last one. Maya mentions Max Galactica, the world's greatest magician. Maya and Pearl head back to Kurain Village, Maya promising to be back by the New Year. --------------------------------- Date-December 28, 9:12 AM Location-Wright & Co. Law Offices --------------------------------- Phoenix intends on cleaning up his office when Maya calls his phone. She orders Phoenix to turn on the TV for an important announcement. Back at the Berry Big Circus, a murder has taken place. That's the circus they all went to two days ago. Turns out Max Galactica was the one who was suspected and arrested. Maya says she'll meet Phoenix in the detention center. Looks like you've taken on this case whether you wanted to or not. ----------------------------------------- Date-December 28, 11:19 AM Location-Detention Center; Visitor's Room ----------------------------------------- Maya has arrived and exclaims that there's no way Max Galactica would ever kill somebody. You'll see Max through the glass now, and yes, he calls almost everything fabulous. He then plays a magic trick with Maya for a second, then tries it on Phoenix. Although he picks a card, Max still just talks to Maya. Seems he really likes people who admire him. Might as well talk to the fabulous Max Galactica. Talk to him about "Max Galactica". Max seems really over-egoistic here, and then Phoenix says that he recently won an award. He won the Magician's Grand Prix, held by an association of magicians. The award pretty makes him the most fabulous of fabulous magicians. There was a trophy and a bust. Now ask him about the "Berry Big Circus". He talks about how he is the lead magician of the Berry Big Circus. He also says that it's a thing of the past. Nowadays nobody cares what goes on there. That's why he signed a contract to the place, so he could make it more fabulous. He goes on to say he makes all the other performers obsolete. Jerk. Now ask about "What happened". Last night, the ringmaster Russell Berry was murdered. Somebody smashed his head and he was found lying on the ground. Even though it occured in the middle of the night, there was a ton of police activity. Max was also the last person to see the ringmaster before he was murdered. He makes it sound like he hasn't been arrested-that the police are merely questioning him. Now ask about "Meeting with Russell". Max doesn't feel like talking about what he talked about with Russell. Just then, three Psyche Locks appear on him. Unless your Attorney's Badge can answer all the questions, just keep this at the back of your mind for now. Present your Attorney's Badge, though. It's hard but Maya will eventually manage to break the truth to Max that he's really been arrested for murder. Max then starts bawling, saying there's no way he'd ever kill someone. He then starts using country talk, just as annoying as Lotta's from the previous case. He also says his real name is Billy Bog Johns, and that he is really a country bumpkin. You've taken on the case now. Move to the circus entrance. ------------------------------------------ Date-December 28 Location-Berry Big Circus; Circus Entrance ------------------------------------------ There's a bunch of police investigators running amok, obviously trying to find important evidence. Maya says you should find somebody to help with the case. Move to the Lodging House. ----------------------------- Date-December 28 Location-Lodging House; Plaza ----------------------------- This appears to be a dormatory where all of the circus performers live. You will meet up with Detective Gumshoe here. Talk to Gumshoe about "Tomorrow's trial". Franziska von Karma is going to be the prosecutor for this case as well. Seems she hasn't had enough on Phoenix just yet. Maya also asks Gumshoe about the whereabouts of Edgeworth. Gumshoe isn't exactly willing to tell you the details of what happened to him. He says he just isn't here anymore. Phoenix also tells Maya to not say his name again. Now ask about "What happened". The ringmaster died around 10 PM, outside in the cold. The body was found right around this lodge, actually. The ringmaster was killed by a blunt force to the head. He mentions that something just didn't fit right. Now ask about "Something unusual". Turns out there were footprints. He then shows you a picture of the crime scene. Russell is lying in the snow ontop of a box. The footprints belong to Russell, so the problem is that the killer's footprints are nowhere around. So who was the killer and where did they come from? CRIME PHOTO will be added to the Court Record. Now present Max's profile. Gumshoe says most people don't like Max, probably because of his attitude. Gumshoe also has proof of his crime. He left one of his hat's at the crime scene. SILK HAT will be added to the Court Record. He says that eyewitnesses saw the event and know about it. Talk about "Eyewitnesses" now. He won't tell you who they are, but he says you're not permitted to enter the lodging house. Now head to the Big Top. ---------------------------------- Date-December 28 Location-Berry Big Circus; Big Top ---------------------------------- It really should seem like an unsafe, or really stupid idea to be messing in the area where the performers...perform. Unfortunately, a tiger charges right at Phoenix and Maya. A young girl appears, appearently she is the lion tamer. The girl is also amused at how Maya has her own costume. Heh. She introduces herself as Regina Berry, the animal tamer for the Berry Big Circus. Talk to Regina about "What happened". She seems to announce confidently that her father was murdered. Everyone was here practicing last night. They all finished at around 10 PM. Regina stayed at the Big Top, though, to play with her tiger Regent. Now ask about "Regina". She playfully admits that Regent nor any of the other animals are scary at all. She also says that since Leon died she's been hanging with Regent. Regina's dad killed Leon. She isn't too sure why he was killed, though. Present Russell Berry's profile. Regina will say he went back to his room once practice was over, and she'll point the way to his room. Head to his room now. ----------------------------------- Date-December 28 Location-Big Top; Ringmaster's Room ----------------------------------- This must have been the room where Max and Russell were talking last night. Maya also notices a large picture of Max on the wall. Examine the paper envelope on the table. Max's salary is written on the paper, and the ringmaster signed it. Max's salary was clearly raised, but the document was dated a week ago. RINGMASTER'S PAPERS will be added to the Court Record now. Examine the black tuxedo in the corner of the room next. A piece of paper is hanging out of the coat. You aren't allowed to read it, though. Now examine the posters on the back wall. Turns out Maya already swiped one of the posters when you were busy. MAX G. PROMO POSTER will be added to the Court Record. There's nothing left to do here, head back out. ---------------------------------- Date-December 28 Location-Berry Big Circus; Big Top ---------------------------------- Present Max's profile. You'll break the news to her that Max has been arrested. She says she's worried about many things right now. Talk to her about "What's on your mind?" She tells just Maya, and she gets real excited and happy for Regina. She says that someone professed their love for Regina. Now only that, but it was Max Galactica who did just so. On the same day another person also professed their love. It was some guy named Trilo. Head back to the entrance. ------------------------------------------ Date-December 28 Location-Berry Big Circus; Circus Entrance ------------------------------------------ You'll find a man in a white tuxedo with a huge red bow tie standing around the tent entrance. He says that he doesn't work at the circus, and seems a bit quiet about it. Then he goes on to say he's a ventriloquist after slightly being insulted. He says he's Benjamin Woodman. Talk to him about "What happened". He tries to say he doesn't know anything about the murder, but keeps stuttering. Now ask about "Max Galactica". He says he's not too friendly. Now ask about "Ventriloquism". He seems to say something about his puppet...but doesn't get further than that. Head back to the Lodging Area and enter Moe's room. ------------------------------------------ Date-December 28 Location-Lodgin Hall 1st Floor; Moe's Room ------------------------------------------ You'll meet up with Moe, naturally since this is his room. He's a pretty over-the-top clown for the circus. He keeps trying to make really horrible jokes with pretty much every statement. Yeah, he'll laugh at everything he says. Quite annoying. When he finally shuts up long enough for you to talk to him, ask about the "Berry Big Circus". He says the circus has been in business for over 20 years. All this time they've performed under Russell Berry. He says this kind of entertainment has become more and more difficult to work with over the years. Moe has been here since the very beginning. He also admits that Russell was a really kind guy, always thinking of his employees. He's ticked that someone would outright kill him. Now ask about "What happened". He says it happened around 10 PM last night. He came back to his room at around that time, then caught a peek of the action when he went to bed. Moe is the eyeiwtness to the crime as Gumshoe hinted at. Now ask about "Russell Berry". Russell was constantly adding new acts to the show. He says that Max takes things too far, though. He seems to be hiding something about Max on the day of the murder. Now ask about "What you witnessed". Moe isn't allowed to tell you anything he witnessed, but he might let it go for a joke. A really horrible joke told by Wright. Anyways, Moe heard a loud noise that night. It sounded like a loud thump. Thagt's when he saw someone in a cap and top hat, near Russell's dead body. Next, present Max's profile. Moe says that the morning of the murder he clonked Ben on the head very hard. He suggests that you go to the cafeteria and investigate. CIRCUS MAP will be added to the Court Record after he hands it to you. Move to the Big Top, and from there to the Cafeteria. --------------------------- Date-December 28 Location-Big Top; Cafeteria --------------------------- Moe said, in a really bad pun, there's "Gotti" be something here. This place is a terrible mess due to nobody being able to pick up the place once the murder happened. The only thing you need to do is examine the broken bottle on the ground. BROKEN BOTTLE will be added to the Court Record. You have enough evidence to break Mac's Psyche Locks now, so head back to him. ----------------------------------------- Date-December 28 Location-Detention Center; Visitor's Room ----------------------------------------- Talk to Max about "Max Galactica". He thinks that the other performers are just jealous. He also says that he plans to get married to Regina, and that most of it is in the works right now. Now ask about "What happened". Max goes on to say that when he was in Russell's room at 10 PM, Russell needed to leave for a few minutes. Max stayed in the room. He never came back, and he was unaware where he went. Time to present the Magatama. ------------------------------------------------------ ~Max Galactica's Magatama Secret-Meeting with Russell~ ------------------------------------------------------ Phoenix asks if the only thing Max did in Russell's room was discuss his salary. You need to present something that proves he discussed more than just that. Present the Ringmaster's Papers. The main problem with this is that it was dated a week ago. He says that on that night the ringmaster actually called him to his room. Now you need to present something that shows what he was called into the room to discuss. Present the Broken Bottle. The second lock will break. He says the bottle just fell onto the floor, but you need to present what really happened. Present Ben's profile. Max hit Ben over the head with the bottle. That's why he was called to the room. Now ask about "Meeting with Russell". On that morning at breakfast, Ben and Max had a run in. They had a fight over Regina. Max got upset that somebody else was competing for Regina's love so he hit him over the head with a bottle. He was called to the ringmaster's room about this, and that was his chance to ask him to marry Regina. Since Ben was causing trouble he had to shut him up. Now ask about "Shut him up". Unless Trilo is with Ben (Trilo is his puppet), Ben hardly says a word. Max decided to hide Trilo in the ringmaster's room. Head over to the room right now. ----------------------------------- Date-December 28 Location-Big Top; Ringmaster's Room ----------------------------------- You need to find Trilo in this room. Examine the trophy case on the left side of the room to discover Trilo lying inside. TRILO QUIST will be added to the Court Record. Head to the cafeteria to meet up with Ben. --------------------------- Date-December 28 Location-Big Top; Cafeteria --------------------------- Talk to Ben about "What happened". Ben still says he doesn't know anything. Now ask about "Berry Big Circus". He says that he doesn't really like Regina too much. Seems odd since I thought Regina said he wanted to marry her. Anyways, present Trilo to Ben. It will be removed from the Court Record now. Now for something odd, all of Ben's thoughts will be projected through the puppet. You can freely talk to him now. Ask about "What happened". Trilo says the he probably deserved it since he payed him very little for his work. Now ask about "Berry Big Circus". Yeah. Trilo flat out says most things in this circus suck. He says that even in this pool of misfit circus performers he found someone to love- Regina. Trilo says he wants to marry Regina. Now ask about "Flying Fraud". Trilo says that he has the facts because he was there when the murder took place. Now ask about "Marriage". He says that he gave her a gift of song. He says that he wants to get to court to finally get rid of Max Galactica. ---------------------------------- Date-December 28 Location-Berry Big Circus; Big Top ---------------------------------- Head back to the entrance. On your way, a monkey will attack you and steal your Attorney's Badge. Regina says that his name is Money and she is willing to help you out. Talk about "Money the Monkey". She says that Moe probably knows where he is hiding. Now ask about "Ben and Trilo". Trilo told Regina he was in love with her, not Ben. Now ask about the "Proposal". This won't really get you anywhere. She just acts like a naive girl, not aware Trilo is a friggin puppet. Head to Moe now. ------------------------------------------- Date-December 28 Location-Lodging Hall 1st Floor; Moe's Room ------------------------------------------- Talk to Moe about "Regina". He says that Regina was born and raised in the Big Top, and knows little about the outside world. Now ask about "Money the Monkey". Moe is willing to take you to the owner of Money right now. Choose to "Go with Moe". -------------------------------------------- Date-December 28 Location-Lodging Hall 3rd Floor; Acro's Room -------------------------------------------- This is Acro's room. He's an acrobat for the circus. Moe says that Acro is out for the day. Before he leaves, MONEY THE MONKEY data will be added to the Court Record. Examine the pile of junk in the corner of the room. PHOENIX'S ATTORNEY'S BADGE will be added to the Court Record again. Phoenix then finds a ring reading "From T to R" on it. RING will be added to the Court Record. That wraps up this day. Save the game. =~=~=~=~=~=~=~ Trial-Part 3-2 =~=~=~=~=~=~=~ ---------------------------------------------- Date-December 29, 9:43 AM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max is here, and he seems a bit troubled. He desires a glass of milk, but is denied his request. The he says he wants to make a flying entrance into the courtroom. Hehe, but Phoenix wishes it could be him that'd make the entrance... ---------------------------------------- Date-December 29, 10:00 AM Location-District Court; Courtroom No. 2 ---------------------------------------- The Judge starts off by calling Max Galactica by his stage name due to his granddaughter being a big fan. Franziska is still ticked off at the whole spirit channeling sham and says that it totally doesn't count for anything. Good to know she's doing well. Gumshoe is the first witness called up. ------------------------------------------ ~Gumshoe's Testimony-Detail of the Events~ ------------------------------------------ -The night of the crime, snow was falling until 9:40 PM, making it extremely cold out. -All of the circus performers gathered in the Big Top to practice their routines. -The pracitce session broke up around 10 PM. -The murder itself took place in the plaza in front of the lodging house at 10:15 PM. -The victim was found bent over a wooden box dead as a doornail. -The cause of death was blunt force trauma that snapped a vertebrae in his neck. You will recieve RUSSELL'S AUTOPSY REPORT into the Court Record before the cross examination. Start by pressing the first statement. You'll learn nothing of interest. Now press the second statement. Gumshoe says all the main performers, excluding the dancers and leaders, were there at the practice. Press the third statement next. He mentions where everyone went after the practice was over. You already know Max and Russell went back to the ringmaster's room to discuss the salary, and Moe went back to his room. Now press the fourth statement. You'll get nothing out of it. Pressing the fifth statement will make Gumshoe talk about the wooden box. He says the box was locked and heavier than it looked. WOODEN BOX will be added to the Court Record. You can ask a question about the box itself. Choose "About the contents". The only thing inside of the box was a small bottle, filled with pepper. SMALL SEASONING BOTTLE will be added to the Court Record. Does this hold any significance...? Press the final statement. Nobody knows what the murder weapon is, it's still being searched for. Now that you've pressed all the statements, the examination will end. Franziska then calls Ben and Trilo to the stand. After Trilo badmouths almost everyone in the courtroom several times, he'll finally testify about what he saw. ---------------------------------------------- ~Ben and Trilo's Testimony-What You Witnessed~ ---------------------------------------------- -Once practice was over, I left the tent with the stooge...I mean clown. -Once we got to the lodging house, I ditched him and went over to the plaza. -That's when I saw Max heading towards the scene of the crime. -He was the only one heading that way...How could that punk not be the killer? -Then police showed up, and took magic boy away. Before you can to examine him, the Judge asks if it was possible at all for Moe to have committed the crime since nobody was with him. Franziska says that was impossible since the silk hat, a signature feature of Max, was found at the scene. Yeah, as if that couldn't have been just planted there easily. Press Trilo's third statement when he mentions seeing Max head over to the scene of the crime. He says that his 3-piece getup is impossible to not notice. He's referring to his silk hat, cloak, and white roses around his neck. Now press the fourth statement about him being the only one heading that way. Trilo will say he was certain he only saw Max. You can ask a question here, so choose "Ben only saw Max?" You will need to show who else he should have seen. Present Russell Berry's profile. If Max was heading off in that direction to the ringmaster's room, he would have to have seen Russell as well. Press the fifth statement next. Ben says that the police didn't arrive until 10:30 PM, and that he was standing in the cold the entire time. Phoenix guesses they were waiting for someone. Now you need to present who he was waiting for. Present Regina's profile. Yes, Trilo just exploded. If Trilo was waiting for Regina, whom he says he was, then he easily wouldn't have cared who else walked past him. He was waiting to propose to her. Now we're gonna hear a testimony about the proposal. What the hell. ---------------------------------------------- ~Ben and Trilo's Testimony-About the Proposal~ ---------------------------------------------- -Don't be so surprised that I was going to propose to Regina! -I even had something to give to her... -I kept it in my pocket, waiting for the chance to propose and give it to her. -Of course, I also had it in my pocket that night. It was a present for her. -In the end, I wasn't able to give it to her, so I've still got it in my pocket! Press the second statement to learn about what the present he intended to give Regina is. It was an engagement ring. Franziska looks ticked off, and even though pain=bad, choose to "Push on anyway". Trilo's testimony will change to this: -I planned on giving an engagement ring to Regina... There's something odd with the testimony here. Remember the ring you have in the Court Record that says "From T to R"? T may stand for Trilo and R for Regina...and if that were true, then YOU have the ring, now Trilo. Present the Ring at the last statement now. This only works if the above line of testimony gets added. Phoenix says that Money the Monkey likes to go after shiny objects. Ben says that the ring was stolen from him on the night of the crime. It was stolen right after Max showed up in the plaza. The ring was taken around that time. Trilo says that once the ring was stolen he gave chase after the monkey. Ben was unable to catch up the Money and couldn't retrieve the ring. This proves one important point. Choose "Ben's testimony has a flaw." Trilo said that he was in the plaza up until the point which the police arrived. However, he just stated that he went chasing after the monkey. There was nobody watching the plaza at this point, then. Now this means that someone other than the defendant could have been in the plaza. Phoenix and Franziska argue for a bit, then he'll testify yet again. ------------------------------------------ ~Ben and Trilo's Testimony-Witnessing Max~ ------------------------------------------ -I'll give you that I was waiting that night for Regina. -But that doesn't change the fact that I saw Max in the plaza that night! -He showed up after I had been waiting there for about five minutes. -I said "good evening" to him, but he didn't even acknowledge my presence! -I'm absolutely sure it was him! I saw Maximillion Galactica at the scene!! -There's no way I could mistake someone wearing those three rediculous symbols. The contradiction is lying flat out in the open, but it probably isn't too obvious. Note that Trilo said "good evening" to what we think is Max. However, we know that Ben and Trilo severely dislike Max for one major reason, especially on that day. Present the Broken Bottle at the fourth statement. A fight with Max ensued in the cafeteria, and Ben ended up getting conked on the head with a bottle. There's no way Trilo would be so friendly at that time of night. Now you need to explain your theory further. Choose "He saw a different person". If Trilo had really seen Max, there would have been no greeting. Thusly, the person he saw was not Max. That's why he bothered to greet this person. Now you need to show who it was that Trilo saw then. Present Russell Berry's profile. That is why Trilo greeted him, it was Russell he saw, not Max. Now Trilo says he thought it was Russell at first, but then realized it was Max. Trilo then says he clearly saw the three symbols that make Max's outfit. Finally Phoenix says that somebody else could have been dressing up as him. Franziska says that the next witness will be able to determine who the one person that Trilo saw really was. A short recess will be taken. Save the game. ---------------------------------------------- Date-December 29, 11:54 AM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max says that he didn't go anywhere near the crime scene. He still says that he was in the ringmaster's room the entire time. Now he admits that he went to the ringmaster's room still dressed in his usual outfit. When he got to the room, though, he took them off. This means that the ringmaster could have taken his costume, therefore looking like Max. Then he says that only silk hat was found at the scene. What about his cloak and his roses? There's nothing else to describe now. Back to court. =~=~=~=~=~=~=~ Trial-Part 3-3 =~=~=~=~=~=~=~ ---------------------------------------- Date-December 29, 12:06 PM Location-District Court; Courtroom No. 2 ---------------------------------------- Moe is going to testify on what he saw last night. Recall that he did see the murder take place. Ignore his first testimony-it's a fake. The real one comes after it. Don't miss the Fresh Prince quote he says before tesifying, though. ---------------------------------------------- ~Moe the Clown's Testimony-What You Witnessed~ ---------------------------------------------- that pressing Moe too hard will result in useless chatter, and tells you to refrain from doing it. Bascially, you will lose 2/10ths of your health bar for each bad press. Don't screw around with Moe. Start off by pressing the third statement where he says he glanced out of the window. Be sure to "Keep pressing" even though Moe keeps dodging the question at hand. Phoenix then says that Moe said yesterday he heard a loud noise, and looks out of the window at that time. Moe then rebutts saying he forgot about that. Moe looked out of the window because of the loud sound, not because he felt like it. This line of testimony will change to this: -I heard a huge noise outside the window, and that's what made me take a look outside... You'll need this for later. Now press the next statement where he says he saw two figures outside. Moe says the figures were about 30 feet away from his bedroom window. It was snowing that night, so visibility was low. Press the final statement now about Max hitting Russell on the head with a weapon. Moe is also unaware of what the murder weapon is. You will start to demand knowing if he saw the murder or not, and Franziska will pop in saying you better have a good reason for harassing him. Tell her that "Of course I do!" when asked if you have proof he didn't see the crime. The reason is Moe's own testimony. There's a great flaw, though. Moe said he heard a great thumping noise, and also said that he saw Max hit the ringmaster with the murder weapon. There's no way he could have heard the sound, then looked out of the window to see the murder. Now he says that when he looked out of the window, the ringmaster was already lying face down in the snow. Franziska helped fill in the gaps in his statements. Moe goes on to say that although he didn't see the actual crime, he did see the murderer. He saw someone silhouette next to the ringmaster's dead body. He's gonna testify again on this matter. ------------------------------------------ ~Moe the Clown's Testimony-The Silhouette~ ------------------------------------------ -I was a bit far away, but that shadow could only have belonged to Max. -There's no doubting it. Especially since I saw his uppity symbols. -His silk hat. That black cloak. They were all there! -His face was still silhouetted, but there was no doubt that it was him. -His cloak was fluttering in the wind, so I couldn't really see what he was carrying. Phoenix says it's not enough to just prove Moe was wrong, but suspicion that someone else could have committed the murder must be made. The contradiction in his testimony is lying quite visible, but it's not likely you'd think of it right away. At Moe's third statement he mentions two of Max's symbols. However, he has three. He's missing the white roses. Present the Max G. Promo Poster here. Franziska tries saying that it's not really important-it's just one symbol he forgot to mention. Moe then says that there weren't any roses on the person he saw. Despite it being dark out, the white roses would have stuck out well. There's no way he could have missed them. Franziska then says they must have falled off at the crime scene. However, they would have been found if that had happened. Remember that Trilo said that he saw all three symbols, but Moe just now says he saw two. This is a clear contradiction to what Moe has just said. The Judge is nearly ready to call a verdict, but he still has some doubt left. Moe will testify one last time. -------------------------------------------------- ~Moe the Clown's Testimony-The Silhouette, Part 2~ -------------------------------------------------- ! If you press any statement, like the Judge warned you not to, you will get severely penalized. The contradiction is lying out in the open once again. On the final statement, he says Max was wearing his silk hat the entire time. However, it ended up on the ground. Thusly, he must have dropped it at some point. Present the Silk Hat here. There's no way he could have been wearing it the entire time if it was found at the crime scene. Moe then goes on in frantic outbursts, insulting the Judge several times that his own eyesight is perfectly fine and that he did see Max. Then he says that he left the scene wearing his silk hat still. Phoenix asks just how exactly the murderer left the scene. Moe says that all he did was turn and walk away. Now you need to present proof that Moe is wrong on how the criminal left the scene. Present the Crime Photo. The only footprint here are of Russell Berry. There's no traces of anyone else's footprints. Phoenix demands that all of Moe's testmonies be erased due to complete unreliability. Moe then says he's finally ready to tell the truth. Then he says Franziska was really the one that formed his testimonies, but he's ready to come clean now. ------------------------------------- ~Moe the Clown! -Now, this is the best bit. That's when I saw him...fly through the air! -He flew right off and disappeared into the darkness! -That's why there were no footprints. Flying criminals don't leave footprints. Before you cros examine the Judge will ask your opinion on his wierd testimony. Choose "His eyes are playing tricks". It doesn't really matter since the Judge is tired of this useless story telling by Moe. The main thing you must find tonight is why there were no footprints on the scene. ---------------------------------------------- Date-December 29, 2:33 PM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max demands to know what is happening. Then he says that he's never actually flying when on stage, rather invisible wires are attached to him to give him that appearence. The only chance you have now is to find and catch the real criminal. Save the game. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 3-4 =~=~=~=~=~=~=~=~=~=~=~ --------------------------------- Date-December 29, 3:03 PM Location-Wright & Co. Law Offices --------------------------------- Maya admits that she's horrible at figuring out magic tricks. She goes on to say that Pearl showed her a magic trick once and she was totally dumbfounded. She pulled the classic "pull the thumb off" gag. Phoenix then does the trick as well and Maya seems stupified. Again. Talk about "What to do" now. Maya isn't so sure that the criminal really flew off through the air. Now ask about "Any ideas". Although Max is a total ass, Maya doesn't think that's enough to frame a murder on him. Eh, we're totally lost here. Head back to the circus. ------------------------------------------ Date-December 29 Location-Berry Big Circus; Circus Entrance ------------------------------------------ When you arrive you overhear two people arguing. Ben and Trilo are busy practicing their singing. They're trying to sing as a new round for their ventrilquist act. Eh. Maya hands back the ring to Trilo. Talk about "Today's trial" now. They say that they thought they saw the ringmaster at first, but realized it was Max. If he wasn't wearing his symbols that would have assumed it was the ringmaster. Ask about "Marriage" next. Trilo says he's just waiting for Regina to come by to propose to her. Now ask about "Ventriloquism". Trilo seems pumped to take the ventriloquist act around the world. He says he wants to win the Grand Prix next, and Maya says the he's the doll now, man. Head over to Lodging House. ----------------------------- Date-December 29 Location-Lodging House; Plaza ----------------------------- You'll meet Gumshoe here. Phoenix was right in assuming Franziska would force him to listen to Moe's jokes for a long time. He says he doesn't want to backwhip Franziska since she's always got her eyes on them. He says the she is directly above you right now. She is in Acro's room at the moment, since the criminal would have to have flown into or past it as Moe put it. Gumshoe says not to get any ideas of going up there. Shouldn't get involved near Franziska, that's for sure. You can't enter his room right now, and you should flat out stay away from it anyways. For now, head back to the cafeteria. --------------------------- Date-December 29 Location-Big Top; Cafeteria --------------------------- You will meet up with Moe when you enter the cafeteria. He seems to be in a good mood despite what happened in court earlier today. Ask Moe about "Today's trial". He says that it was tough for him because he wasn't able to make anyone laugh. He seems really ticked off nobody is laughing at his jokes. Now ask about "What you witnessed". He is positive that he saw someone float through the air. Since no Psyche Locks appeared he must be telling the truth about this. Now that we know this, head back to Max. ----------------------------------------- Date-December 29 Location-Detention Center; Visitor's Room ----------------------------------------- Max says that a TV crew appeared a little while ago, saying that he should be getting his own TV special. They are calling it a prison escape, actually. He mornfully says he can't do it before he gets an aquittal, though, as that'd just hurt his chances of getting a not guilty verdict. He asks you to hurry up and get him out of here. Ask about "Night of the murder". He goes back over the events once more. At the time of the murder, he was sitting in the ringmaster's room. Flying off into the sky is something he can't do at will. Now ask about "Today's trial". Maya asks why he can't be friends with the other performers. He says that the other performers aren't full of ambition and that is why he doesn't like them as much. Now ask about the "Grand Prix". He holds up a picture of him winning the International Grand Prix, and this picture is also in color. Whoa. He asks you to show the picture to the other performers. GRAND PRIX PHOTO will be added to the Court Record. Head to the Cafeteria for another talk with Moe. --------------------------- Date-December 29 Location-Big Top; Cafeteria --------------------------- Present the Grand Prix Photo to Moe. Moe says that he's seen this picture before. He also says that Max showed him his bust, and that it was really big too. Max pretty much made them all worship his enormous bust. Now talk about "Max's Bust" since we should figure out what the hell a bust is to begin with. Moe says that the bust should be on the table nearby. It isn't, and Moe says that about five days ago the bust disappeared. MAX G. BUST will be added to the Court Record. He also mentions that one thing here is slightly different. Ask about "What's changed". On the morning of the crime, a piece of paper was posted on the bullitin board. It was torn, so only the title is visible. It reads "To the Murderer". NOTE will be added to the Court Record. Now you need to find the other half of this piece of paper. Head to the Detention Center again. ----------------------------------------- Date-December 29 Location-Detention Center; Visitor's Room ----------------------------------------- Present the Note you just recieved to Max. He knows all about this note. When head read it for the first time, his heart jumped a bit. While enjoying his morning tea, the ringmaster and company entered the room. When he read the note, his face turned real red. He tore the note off the wall and stuck it into the pocket of his tailcoat. He isn't going to spoil what is on the note for you. Head back to the Ringmaster's Room. ----------------------------------- Date-December 29 Location-Big Top; Ringmaster's Room ----------------------------------- Examine the black coat at the back of the room once again. Remember the piece of paper stuck in it? You will finally get to read what is on this note. The piece of paper here indeed is the other half of the ripped note. The note reads "I have conclusive evidence of what took place. Meet at 10 PM tonight at the lodging house plaza." That's the time the murder took place. NOTE will be updated in the Court Record. Now we just need to find out who wrote that note and we should be able to pinpoint the murderer from there. Head back to the Lodging Plaza now. ----------------------------- Date-December 29 Location-Lodging House, Plaza ----------------------------- Gumshoe says that he is done with his investigation for now. He then hear's a strange sound. Anytime that irritating sound is heard, Franziska isn't too far behind. Gumshoe thinks it's a best idea to run away, and he does just that. Franziska appears soon after whipping Maya from a distance. She says that tomorrow will finally be the day that she defeats the almighty Phoenix Wright. Talk about "Tomorrow's trial". She says she has conclusive evidence and a conclusive witness. There's not much else to the story. She is, of course, referring to the acrobat. Now ask about "Revenge". She says that her revenge on you isn't actually just to destroy you. It's actually to get somebody else back. Phoenix is just a small roadblock. She's talking about Miles Edgeworth. Now ask about "Miles Edgeworth". It was Karma who trained him to be a prosecutor in the first place. Miles was like a little brother to Franziska. After the fourth case from the previous game, Edgeworth vanished. Franziska accuses Phoenix that it's his fault he is gone. Now ask about "Edgeworth's death". After the case, Edgeworth seemed traumatized and got worse each day. He never came back to court. One day, he just vanished. All he left was a note that said "Prosecutor Miles Edgeworth chooses death." Franziska doesn't buy it, though. She's still sure he's alive somewhere. Phoenix must have killed his inner prosecutional skills. There's nothing left here. Head up to Acro's Room. -------------------------------------------- Date-December 29 Location-Lodging Hall 3rd Floor; Acro's Room -------------------------------------------- The odd looking man you meet says he is Ken Dingling, or Acro as most people here call him. Acro says that he performs mainly on the tightrope and whatnot, but for a while all he's been performing in is his wheelchair. Talk to him about "Berry Big Circus". When Acro was a kid, his parents failed at business. They just ran away from it all, leaving Acro and his brother. The ringmaster was willing to take in the kids. He was a lifesaver to Acro. He says he wanted to find a way to repay him, but now that's impossible since he's been killed. Maya says that Regina is truly a princess, but Acro thinks otherwise. Now ask about the "Wheelchair". The nerves in his legs were badly damaged, and is stuck to his wheelchair now. He lives on the third floor of the building, so he can't even leave by himself. He won't go any further when three Psyche Locks appear on him. His injury clearly wasn't related to an acrobatic accident. He injured himself six months ago. Now ask about "What happened". He says he wasn't in his room yesterday because he was in the hospital. He wasn't sure if the murder was real or not before going to the hospital. Now ask further with "What you witnessed". He looked out of his window the night before when he heard a loud noise, and saw Max flying straight up into the air. That isn't going to help us at all. Head back to the Big Top. ---------------------------------- Date-December 29 Location-Berry Big Circus; Big Top ---------------------------------- Regina will appear again to stop the bear from eating Phoenix. She was hoping to teach someone a lesson, but ended up with Phoenix instead of who she was looking for. Talk to her about "Russell Berry". She says that she feel's lonely that she won't be able to see him for a while. She seems like one really messed up girl. Ask about "Money the Monkey" next. She says she wanted to teach him a lesson because he is so mean. Turns out that Money stole one of her stage costumes. She asks if you see the costume to retrieve it for her. Answer any of the choices, it doesn't matter at all. Now, present the Note. Regina says she knows what that is since it was in her pocket for a while. She noticed it was there around breakfast. She goes to Acro's room each morning to give him his breakfast, take out the trash, then heads to the cafeteria herself to eat breakfast. Since she figured she's not a murderer, she thought it belonged to someone else. She thought someone should know about it and stuck it up onto the bulletin board. NOTE will be updated in the Court Record now. Head back to Moe's Room now. ------------------------------------------- Date-December 29 Location-Lodging Hall 1st Floor; Moe's Room ------------------------------------------- Moe isn't here right now, but someone else is. Money is in the room, and he's holding Regina's dress that she told you to get for her. Now you need to figure out how to get the monkey's attention. Choose "Give it back, Monkey-brain!" Money will run away while Phoenix tries to have a man-to-man talk with the monkey, but Phoenix will swipe the dress away from him when he's distracted. STAGE COSTUME will be added to the Court Record. Head back over to the Big Top to give this to Regina. ---------------------------------- Date-December 29 Location-Berry Big Circus; Big Top ---------------------------------- Present the Stage Costume you just found. She says that the costume wasn't actually hers, it was Leon's. Now ask about "Leon". She says Leon was killed because he did something bad during practice. She mentions that when Leon was opening his mouth, she would stick her head into his mouth. During one practice session, Leon bit someone. LEON will be added to the Court Record. We need to have another discussion with Moe. He still knows something quite important to this case. Head back to the Cafeteria. --------------------------- Date-December 29 Location-Big Top; Cafeteria --------------------------- What's that smell? It's...burgers! Moe turns out to be cooking up some burgers right now. What is it with Maya and other various people with crazy burger fetishes? Talk about the "Berry Big Circus" now. Turns out when Acro found out about the murder he was quite livid. He was so upset he hardly felt like living anymore. Moe has been thinking that he should just quit his job while he has the chance. He's thinking he should try replacing the ringmaster. Max would still be an issue to work with, though, but it is hard to argue with his importance. He admits that many things he says are true, that he is the reason the circus is so lively. He's hoping that everyone could just get over the tradjety. Ask about "Get over it?" and Moe says yes to when Maya guesses he's talking about Russell's death. Two Psyche Locks appear over him now. He says a small accident occured six months ago. He thinks everyone should just get over the accident, but he makes it seem that the topic of it is brought up every now and then. Present the Magatama. ---------------------------------------------- ~Moe the Clown's Magatama Secret-Get Over It?~ ---------------------------------------------- Phoenix asks what happened six months ago that is so important. Phoenix thinks he knows something about the accident. You need to present the cause of the accident. Present Leon (he's in the Court Record). Leon did something during his performance, and that is what this accident must be a cause of. One of the locks will shatter. Moe told Regina many times that she should have Leon do so many dangerous things during performances. Putting heads into Leon's mouth was all part of the act. Regina believed in Leon, and Russell believed in Regina, so he kept going along with it. Moe promised not to tell who was bitten during the accident. He mentions someone else was involved in this accident, too. You need to present who it is made Moe promise not to tell anything. Present Acro's profile. Moe is ready to tell the truth, as he thinks now this accident may help figure out who the murderer is. The second lock will break off. Now ask about "Get over it?" He says it would have been better off if someone had died during the accident. When the person was bitten, he suffered major brain damage. The man will never recover from the coma he is in. All he does is lie in a hospital bed, nothing more. This man is related to Acro because it is his brother. Bat was Acro's brother, and he was bitten and sent into a coma. Now ask about "Acro's brother". Sean Dingling is Acro's brother, but everyone calls him Bat. He also fell in love with Regina, and that was his downfall. During a practice session six months ago, Bat said he wanted to perform with Leon. This is what caused the accident. When Leon bit down, he seemed to have been similing. The police were never informed of this incident, as the circus was afraid of being shut down if they were notified. The next day, Russell shot Leon dead with his rifle. Maya sneezes on the pepper shaker you have, and Moe comments that Regina has a similar sneeze. Turns out Bat would always tease Regina with pepper. Head back to Acro's Room for the last bit of information you need. -------------------------------------------- Date-December 29 Location-Lodging Hall 3rd Floor; Acro's Room -------------------------------------------- Acro seems to know why Phoenix is back so soon. He's still thinking about what he's hiding when you asked about his wheelchair. Present the Magatama so we can find out. --------------------------------------------- ~Acro's Magatama Secret-About the Wheelchair~ --------------------------------------------- Acro says once again that the cause of his accident was while training for an acrobatic routine. However, if this was the case he would have no reason to keep it a secret. You need to present the real cause of his injury. Present the picture of Leon. Six months ago he was attacked by the lion, and that's how he ended up in the wheelchair. The first lock will break. Phoenix thinks that he didn't actually get attacked, but had to fight it to save someone's life. Present Bat's profile. The second lock will shatter when confronted with the facts. Moe did say that the team of Acro and Bat were cut down at the same time. They were injured in the same accident. Acro says it wasn't anyone's fault, though. You need to present someone whom he doesn't like very much. Present Regina's profile. Acro always seems calm until the subject comes to Regina. Regina and Bat were good friends back at the time. You need to present proof of why Acro has hated Regina for so long. Present the Note. Acro must have written the note and put it in her pocket. The final lock will break. Now, finally ask about the "Wheelchair". His legs were injured by Leon. Six months ago, Bat had a dare with Regina. Bat said if he could put his head inside Leon's mouth like Regina does, she'd have to go out with him on a date. They figured that since Leon was old he wouldn't attack somebody else who put their head into his mouth. However, that wasn't the case here. When Leon chomped on his head, Acro ran towards him. Leon attacked Acro and that's how he ended up this way. Bat is still in a coma. He went to the hospital yesterday to visit him, hoping one day he'll open his eyes again. Now ask about "Regina and Bat". Both were great friends. Acro also hands you a scarf that Bat was wearing when he was attacked. It's covered in blood. The scarf was a present from Regina on the day of the attack. Leon looked to be smiling when he chomped on Bat. Franziska appears and demands that you hand over the scarf. Acro then leaves with Franziska as he'll be the final witness to appear tomorrow. Hopefully this case will all make sense soon. Save the game. =~=~=~=~=~=~=~ Trial-Part 3-5 =~=~=~=~=~=~=~ ---------------------------------------------- Date-December 30, 9:41 AM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max says he's pretty nervous before coming into court today. Regina appears to bring him a carton of milk. Moe told Regina that she should come to the trial to watch it. Regina clearly doesn't understand how a trial works since she still thinks that Max will be putting on a performance. After a small morale boost, Regina heads off to the audience. Moe then appears with another carton of milk. Moe is pretty sure that Acro is the real criminal as well. He's used to putting his life on the line, Moe warns you. Moe also says that Regina is here to hopefully understand the reality of what happened to her father. Time for trial. ---------------------------------------- Date-December 30, 10:00 AM Location-District Court; Courtroom No. 2 ---------------------------------------- Franziska opens up by saying she wants to revise her recent theories on the events of the murder. They have discovered a new witness, one that says he saw Max fly off from the scene of the crime. An explaination for how Max was able to fly that night will be proven. Gumshoe was even forced to provide a mockup of how such an even could occur. Acro will be called to the stand. ------------------------------------- ~Acro's Testimony-What You Witnessed~ ------------------------------------- -It was just after 10:00 PM, and I was resting in my bed. -Around that time, I heard a large "THUMP" noise from outside the window. -Then a few moments later, I saw someone...Flying...Right by my window. -It was Max Galactica...I only saw him from behind, but that's who it looked like. -To be honest, when I saw that, I thought I was dreaming... This testimony matches up quite similar to what Moe said yesterday. You will need to press for the hard facts. Press the fourth statement when he mentions he saw Max Galactica from behind. Phoenix will confirm that the lights in his room were shut off. Despite them being off, he was still able to see Max. Acro says that the safety lights were on, and that was enough to enable him to see the silhouette of Max. Although he couldn't see the white roses this way, he says he did see the silk hat and the cloak around his body. Phoenix will think something was wrong with that statement. Choose "There is a contradiction". This happened yesterday so you probably already have realized it. Max's hat was on the ground. Therefore, he couldn't have been wearing it when he was flying past Acro's window. Acro thinks that is actually the ringmaster's hat, not Max's. Clearly Acro has been lying about this the entire time. Now Franziska will demand that you back up this statement explaining why Acro would lie in court right now. Answer "Acro is the real culprit". Phoenix will accuse Acro of murdering Russell now, and Franziska actually finds this amusing. She then points to Acro who is still very calm and collected. If he was the real murderer, he'd probably be panicing right now. Acro then says that he can't even move out of his wheelchair, so he easily couldn't have done the murder. Or so he says. Franziska says she had proof that Acro is disabled, so now she thinks you will call out that he had an accomplice. Choose "Of course he didn't". Phoenix exclaims that Acro planned and executed the murder all on his own. Now the Judge will say that if this is true, Acro being the murderer, then his testimony is all lies. He'll ask you to point out where Acro was then during the murder. Point to his own room. Acro wasn't able to leave the room by himself, so the only explaination is that he committed the murder from his room. Acro then says that it's an interesting, but impossible, theory. The Judge also backs up his claim by reminding you he's in a wheelchair. Acro then asks how you think he killed Russell. If he couldn't leave his room he couldn't have worn Max's costume. The Judge will ask if you have an explaination as to how Acro could have killed Russell. Choose to "Present evidence". Now you need to show what we think is the murder weapon. Present the Max G. Bust. The bust itself is actually quite heavy. Heavy enough to ensure death, especially if dropped from a third story window. Franziska then says that there's no way that Acro could have wheeled his chair around with such a heavy bust in it. Phoenix says that he has a strong enough body to carry the bust. Acro isn't able to refute your statements, so clearly we're getting somewhere. Acro will be forced to testify about his current handicapped condition, a testimony Phoenix thinks is just a stall for time. ---------------------------------------- ~Acro's Testimony-Acro's Physical State~ ---------------------------------------- -I supposed I could have lifted something the size of the bust. -I have a strong upper body from working as an acrobat, and only my legs were injured. -However, lifting the bust and looking out of the window would've been impossible. -There's no way I could have exerted that kind of force on my lower body. -That makes it impossible for me to have known the location of the Ringmaster's head. -Thus it would be unrealistic for me to drop the bust on him. Don't you think? The Judge agrees that trying to exert such a force would lead to more injuries on his body. Phoenix will still examine nonetheless. Pressing won't get you anywhere in this testimony as the contradiction can already be spotted. At the fifth statement, where he says it would have been impossible to see the ringmaster's head, it actually wasn't with some help. Present the Wooden Box here. Acro didn't need to lean out of the window because he already knew where the ringmaster was going to be ahead of time. Quite precisely, actually. Phoenix will bring out the picture of Russell leaning over the box. The question is-who placed the box there? When Ben and Trilo saw the ringmaster, they didn't see any box. This means that the wooden box was already placed at the scene of the crime. The moment the bust came falling down was the moment that the ringmaster picked up the box. This all makes it clear. If the bust were to fall at the point marked by the wooden box, there would be no possible chance of it missing the victim. The Judge will then ask who placed the wooden box at the scene. Phoenix says it was Acro himself. He had a rope to help himself lower the box to that point. Franziska then says that the ringmaster's head could have been anywhere at that point. That's why the box was specially made. You need to choose its special feature. Choose "The weight of the box". According to the Court Record it is over 20 pounds. The only way most people could have picked up the box is if they squatted down to pick it up. The box is large and has carrying handles, making the head placement of the person who was picking up the box easy to determine. Acro still won't admit to what we think is his crime yet. He still says that even if he wanted to do those events, he couldn't. He will ask if you remember the original location of the bust. Choose "I remember". It was in the cafeteria, on a table. The big question now is how would Acro have gotten the bust from the cafeteria to his room? He can't leave his room by himself. Now you must show how the bust made its way from the cafeteria to Acro. Present Money the Monkey. Acro never ordered the monkey to steal the bust, he took it with his own free will. Franziska says that the bust isn't shiny at all, since it's mostly bronze. The cards, however, were the shiny part of the bust. Acro admits that Money is capable of holding the heavy bust. Franziska says that the current location of the bust is still unknown. If the monkey didn't steal the bust, though, then what? Or, perhaps the bust was used as the murder weapon by accident. One fact has been proven, though, and that is Acro has the ability to kill the ringmaster. Franziska says again that Max was still scene at the crime location. She then asks the clown saw the murderer. You must present who it was. Present the Max G. Bust. Franziska says she demanded a picture of the person, not some useless piece of evidence. However, Moe said he saw Max's silhouette. However, what he didn't see was a person at all. What Moe actually saw that night was Max's bust. There's no reason why Max's cloak couldn't have been attached to the bust, and this would give it the appearence that it looks just like Max. It also shows why the white roses weren't visible. Now you must show who put the cloak on the bust. Present Russell Berry's profile. Russell didn't actually "put" the cloak on the bust. Phoenix describes the scene again. Acro lowered a rope with the wooden box attached. Then he attached the bust to the rope and dangled the bust outside of his window, directly over the box. At the same time, Max was told to wait in the ringmaster's room by Russell. At the time, the ringmaster was wearing Max's cloak. Perhaps it was to stay hidden that night. However, he was spotted by Ben and Trilo, much to his demise. When the ringmaster got over to the scene, he bent over to pick up the wooden box, and that's when Acro let go of the rope and let the bust his Russell. At the instant the bust hit the victim, the cloak flew off of Russell and landed on the bust. Franziska stops you, saying this is absurd. Phoenix continues on anyways. That's the sound Moe heard and he looked out of the window. The crime being committed, Acro lifted up the bust back to his room. He had no idea Moe saw this, though. That is how the cloak managed to fly into the sky. Franziska now demands proof that your absurd story is true. There is still something unusual about Moe's eyewitness account. A contradiction, rather, about the facts we know and what he said. The Judge wants hard proof that this is what happened. Present the Silk Hat once again. The problem lies within Max's three symbols. The hat, cloak, and roses. A Silk Hat was found at the crime scene, but Moe said he saw the murderer flee with the silk hat still on him. The "silk hat" Moe saw must have been the bust instead. However, that was just one of two contradictions found. When the cloak snagged onto the bust, what happened to the white roses? This means the the roses would have to have landed on the back of the bust to not be visible. This is why Moe didn't see them. Acro then says that Phoenix is a bit off track here. Acro is missing a motive for his actions. There's no way he would want to kill the ringmaster. A short break will occur now. Save the game. ---------------------------------------------- Date-December 30, 2:17 PM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max is pretty sure now that it is Acro who is trying to pin the murder on himself. Max then gets angry at Acro for trying to do this to him. Gumshoe then appears, angry that you're ignoring him. Turns out Gumshoe was able to bring the scarf which Franziska confiscated yesterday. Gumshoe isn't willing to tell you how or why he brought it here, and says to keep it a secret. He then says something from a prosecutor saying "Judgment comes at the very last moment". Huh. Back to court now. ---------------------------------------- Date-December 30, 2:27 PM Location-District Court; Courtroom No. 2 ---------------------------------------- Franziska wants Acro to continue to testify about his relationship with the ringmaster, and orders you to provide proof he had a motive. --------------------------------------- ~Acro's Testimony-About the Ringmaster~ --------------------------------------- -When we were little, we were abondoned by our parents. -That's when the Ringmaster of the Berry Big Circus, Russell Berry, took us in. -I became an acrobat at around nine years old. -I wanted to find a way to repay to Ringmaster. That was my sole purpose in life... Make sure you choose "Of course I'll cross-examine" when thinking if Acro ever had a motive. Press the first statement to find out that the second person Acro is talking about is, of course, Bat. Now press the second statement to find out that Acro thought of the ringmaster as a father. Press the third statement to find out that since he was in such great shape when he was little, he became an acrobat. Now press the final statement. Nothing good will happen since Franziska's whipping will stop you short of asking questions. The Judge says that no matter what he says, it seems Acro has no reason to have killed Russell Berry. Now the Judge will ask what the motive to kill the ringmaster was. He'll ask if you can explain it. Choose "I can't provide one" on the basis that he never intended to kill the ringmaster in the first place. Phoenix says that the ringmaster wasn't the target of Acro that night. He never intended to kill Russell Berry. Franziska will demand to know who the hell Acro did intend to kill instead that night. Present Regina's profile. Phoenix says Acro was really aiming for her that night. Franziska starts going ballistic at this, and now demands proof why Acro would want to kill Regina. Present the Note you found earlier. Acro goes silent when you present the Note. He wrote the note, which is ironically titled "To the murderer". It was a calling of someone to the plaza at 10:00 PM. The note wasn't intended to bring Russell Berry to the plaza. The note was placed inside Regina's pocket, and was intended for her. Regina didn't think the note was for her, so she put it on the cafeteria bulletin board. That's when her father read the note. Russell Berry unknowningly went in place of Regina. He was killed because of this mistake. Acro even said earlier that he couldn't have looked out of the window if he really did lower the bust. This theory would make that situation even more realistic because Acro couldn't see the person he was killing. Acro thought it was Regina who was in the plaza, and that's when he dropped the bust. Franziska objects, asking about the line in the note saying "I have conclusive evidence of what took place." She says that if that is in the note, Regina would be a murderer. Phoenix thinks that the ringmaster knew what this note meant and that's why he went to the plaza, in place of his daughter. The Judge will ask what the incident six months ago was. Choose "I know all about it". This incident directly involves this case now. You will now be forced to present just what the conclusive evidence the note is referring to. Present the Small Seasoning Bottle you haven't used yet. No joke, this is the evidence Acro was planning to use. The victim would take away the wooden box and discover the conclusive evidence inside. Now, Franziska will demand you say who Regina's intended victim was. Present Bat's profile. Bat has been in a coma for six months. Acro probably feels that his brother is as good as dead, though. Bat was bit by Regina's lion six months earlier. Franziska says there's no way Regina would ever willingly kill somebody. She says he was the victim of an accident rather than a planned murder. Maya will ask if this was all an accident or not. Choose "It was more than that." The lion biting Bat wasn't an accident whatsoever. While Regina wouldn't willingly hurt somebody, she is responsible for making the lion injure Bat. You need to present evidence to back up this claim. Present the Scarf that Gumshoe managed to give to you several minutes ago. That scarf was something that Bat used to wear. Regina was the one who gave it to him. There is more than just some blood stains on the scarf, however. Pepper was found on the scarf. Regina gave the scarf to Bat just before the accident. She covered the scarf with a ton of pepper beforehand. Franziska then asks again if the lion was seen to be smiling before biting down on Bat. Leon wasn't smiling, he was actually sneezing. He never really did bite down on Bat, but instead sneezed due to all of the pepper Regina stuffed onto the scarf. at lost conciousness soon afterwards. Acro nearly lost Bat to this accident. Franziska still thinks this is a mere joke. Acro tried to get his revenge on the one person who did this to him-Regina. Acro says he's impressed by Phoenix's imagination. Acro hints at the fact everything Phoenix just admitted is true. However, it isn't enough to frame Acro of murder. Not yet, at least. He brings up the topic of the bust again. There is no evidence that proves this claim. The location of the bust is still a mystery. The Judge thinks that if Acro's room was searched and a bloody bust was found, that would be all the conclusive evidence he would need to make a verdict. You have two choices now. Choose to "See how things work out first". Searching Acro's room would get you nowhere since he probably assumed that would be done. He must have hidden the bust elsewhere. Franziska says that Acro's room was thoroughly searched yesterday, and no bust was found. The location of the murder weapon is still a mystery. Also, to ensure he didn't hide it, the search was a complete surprise and Acro was taken to the prosecutor's office soon afterwards. Maya thinks the location of the bust right now should be known. Just before the Judge ends this all, Maya steps in to declare you need a second to prepare the last bit of evidence. Now you must declare where the bust is right now. Choose "Somewhere in this courtroom". That's not enough info, though. The Judge will ask where the bust is in the courtroom. Choose "The witness chair". Acro is asked to remove the blanket on his chair. The possibility that the bust is being hidden under that blanket seems quite likely, as he doesn't even need that blanket. It was incovienent for Acro to be unable to hide the bust elsewhere since he can't leave his room. The only place he could have hid it was under his wheelchair. He says he's been bagged by the real pro here, Phoenix. He finally comes clean. He asks why the timing for the surprise search was last night. He says he burned the cloak and threw the ashes out in the trash. He obviously couldn't throw away the bust. The best he could do when the search was warranted was to hide the bust. Hiding it under his wheelchair was his only choice. There is nothing he could do when called to court with the weapon in hand. He also thinks Franziska had this all figured out to begin with when she searched the room. She says that if she didn't order the search of the room, she would have easily gotten her verdict. Acro admits to killing Russell. He explains the story of how how Regina put pepper on his scarf, which made Leon bite him. Acro couldn't forgive what she did to him, and Regina joked about how bat became a star when word got out he was bitten. So much so that Acro was so drastic to attempt killing her. He wanted to kill himself, then decided it would be best to try living and pin the murder on Max. And thus, the case has finally been resolved. There's nothing left to do but bask in the glory that Franziska von Karma has been defeated by Phoenix. Twice. Owned her there. ---------------------------------------------- Date-December 30, 4:27 PM Location-District Court; Defendant Lobby No. 5 ---------------------------------------------- Max is happy that he was found innocent. Moe comes over to congratulate Max on getting found not guilty. Moe says not to worry too much about Acro as there isn't anything that can be done now. Regina comes in crying, though. She's a bit distressed at how this whole incident was her fault to begin with. She's worried that everyone is going to split up now that half of the circus gang is gone. Regina asks if Acro has plans to get revenge on her. Choose "I don't think so." When she asks for evidence, present Bat's profile. Acro didn't want to get caught because he wanted to see Bat when he awoke from his coma. She says she'll take the place of Acro in the hospital now and will go see Bat until he finally wakes up. Moe decides he'll be the new ringmaster, and Max decides to finally stay. And so ends this chapter. Before the case ends, the screen turns black and someone is talking. The mysterious man asks how the case went, where Gumshoe states that the previous day's search really paid off. He asks if the man really had it all figured out, to which he responds it was only a theory that only "him", referring to the defense attorney for the case, would ever figure out. The scene will cut to an airport, and Edgeworth wil be seen as the one on the other end of the phone. He says he'll be making a stop at the prosecutor's office... =========================================================================== ~8.Episode Four-Farewell, My Turnabout~ =========================================================================== The intro cutscene starts off by questioning who will be this year's Grand Prix Champion. The camera pans downwards to where all of the contestants are, all in costumes. The hinted at winner is the Jammin' Ninja, sporting a purple costume. Then some guy drops down onto the stage, calling himself the Nickel Samurai. He's awarded the prize. Just who are these people and what do they have to do with this case? =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 4-1 =~=~=~=~=~=~=~=~=~=~=~ ------------------------------------ Date-March 20, 7:42 PM Location-Gatewater Hotel; Viola Hall ------------------------------------ Back in the Gatewater Hotel again, Maya greets you and asks if you saw the Nickel Samurai win the contest. Will Powers, the former Steel Samurai, is also here with you guys. Pearl is also here, however due to Morgan never allowing her to watch TV back at home she has no idea who the Steel or Nickel Samurai's in question are. Maya fills in for Phoenix by saying that he hates these kids shows, which is obviously true from his constant moaning over all this. Pearl says that Phoenix needs to act more mature when he says he prefers Pearls' kids shows than the Nickel Samurai. Hah. Will says that he's glad he invited everyone here for a feast, and that he feels sorry for the Jammin' Ninja who lost to the Pink Princess (who fans will remember Will also played as). Maya then comments if the Jammin' Ninja was any different today, commenting that he wasn't carrying around his red guitar. Will then says it is odd he wasn't carrying around his signature guitar. Maya mentions you should head over to the lobby. There's going to be a press conference about the Nickel Samurai confessing something. Now we got some options. Talk to Will about "Will Powers". Maya will ask Will what he's been doing lately. Ever since The Pink Princess finished last month, he has been busy on a kid's exercise show. Phoenix will comment that he's an action star who's popularity exploded when he was the Steel Samurai and when accused of a murder case Phoenix worked on. Will is also an incredibly kind guy. Now ask about "The Nickel Samurai". Will comments that a movie based on the Nickel Samurai will be coming soon. The new series of the Nickel Samurai is very similar to the Steel Samurai show-it's still aimed at kids. Will didn't get any part on the show, though, much to his dismay. Maya mentions that the actor Matt Engarde plays the Nickel Samurai, and that he'll be fighting it out with the Jammin' Ninja for popularity. Now ask about the "Jammin' Ninja". The Jammin' Ninja always carries around his red guitar. The show premise just seems really odd. Global Studios who has the Nickel Samurai, and Worldwide Studios who has the Jammin' Ninja, have been fierce rivals. There isn't anything else to do here. Enter the Hallway. --------------------------------- Date-March 20 Location-Gatewater Hotel; Hallway --------------------------------- You will enter a long and spacious hallway. Time to examine this place to kill off some time. First, examine the purple disc things near the door to the right. These gifts were given to Matt Engarde by the Global Studio staff. Now examine the door left of Matt's. The door has a slip of paper reading it's "Juan Corrida's Room". Phoenix doesn't know much about this actor. Now that you have some info, head back to the Viola Hall. ------------------------------------ Date-March 20 Location-Gatewater Hotel; Viola Hall ------------------------------------ Will says that the post-awards ceremony is about to start. Will is most interested in the press conference where the Nickel Samurai is going to confess something, possibly very important. Will doesn't know what the conference is going to be about, so he invited Phoenix and company to join him in going there. He hands you the PRESS CONFERENCE TICKET which you will need to get in there. Move to the Hotel Lobby now. ------------------------------------- Date-March 20 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- Why didn't we get to see this place in the first game? Anyways, you will see the large stage where the awards ceremony is going to be held in the lobby. Someone on the PA will say that the Post-Awards Ceremony Press Conference will not be continuing due to unforeseen circumstances. It also says that nobody should move, and that's a special request from the police. Phoenix is ready to investigate, but someone in a...space suit...or something like that, comes by and barks at you to stay put. Sound familar? The person then goes on a huge rant about how some punk kid tried going over a bridge despite a sign saying the bridge was out nearby, and the person here shoved that kid off the bridge. Will recongnizes the non-stop chatter can only come from one person-Wendy Oldbag. Oh gawd, not her again. And she's got a gun! Damnit what the hell is wrong with this woman? She recongnizes Will right away, and go on a long spiel on how she admires Will's character in the show he is in right now. Oldbag says that she is a security member still. Love how she apparently gets a toy gun with realistic sound effects as a defensive weapon. Talk to her about "Wendy Oldbag". She says that ever since the murder incident that happened last year, Global Studios has been letting people go. They also lowered their security team and that's when she was fired from her job. She then blames her job scenario on Phoenix for forcing her to testify like that back in case 3 of the previous game. She also tried being a bodyguard for Edgeworth (who she apprently really likes, as it's hinted). Now ask about "What happened?" Oldbag says she doesn't have all the details, but it appears that someone was murdered here. Maya then says they should all act like they're going to the bathroom to get a cover to check out the action. Head back over to the Viola Hall. ------------------------------------ Date-March 20 Location-Gatewater Hotel; Viola Hall ------------------------------------ Phoenix comments that nothing unusual is happening in this room. Just before you get to go somewhere else, a bellboy stops you and asks if he is looking at Maya. He says she has a phone call waiting by the front desk and asks if she could come with him. Well that is totally not suspicious at all. Since it isn't, let's just let her go. Pearl says she's excited to help you investigate. Head back to the Hallway. --------------------------------- Date-March 20 Location-Gatewater Hotel; Hallway --------------------------------- Once you enter the hallway, you will hear somebody yelling that they have a right to get the information they need to know. Someone else, probably a police officer, says that they aren't allowed to give out details at a time like this. The person yelling seems to use some sort of accent before running off. Yeah, Lotta Hart is back once again. So much for wanting to find her true self. Gumshoe appears (always the cop everyone yells at, apprently!) and asks if you'll make Lotta shut her trap. Gumshoe says that this is the scene of a murder. Turns out Lotta was right in assuming that murder has happened here. Over Gumshoe's complaining that he's in trouble, Lotta shouts out this was the murder of a huge star. Huh. Talk to Gumshoe about "What happened". Pearl asks if it was the Nickel Samurai who was killed, but Gumshoe says that isn't the case. Turns out it is the Nickel Samurai who people are thinking is the murderer. The guy who was killed is none other than the actor of the Jammin' Ninja. Ask about "Lotta Hart" now. Gumshoe says that Lotta was hanging around the hallway just before the murder happened. She was hiding infront of the Jammin's Ninja's door, no doubt wanting to get pictures of the actor. Lotta only said she was trying to get a "scoop" and said nothing more than that. Now question Gumshoe on "The victim". Gumshoe confirms the victim was the Jammin' Ninja, rival to the Nickel Samurai. The action star who was killed is Juan Corrida. Judging by his picture it seems he is from the countryside. He's been attracting a lot of attention lately. However, the Nickel Samurai's actor Matt Engarde has been stealing his spotlight. Phoenix asks that now since Juan Corrida is gone, if Matt Engarde will have the stage to himself. Gumshoe says that he can't quite let that happen. Present Matt Engarde's profile. Gumshoe will say that Matt was just arrested on suspicion that he killed Juan Corrida. Now talk about "Arrested?" Gumshoe said that he isn't allowed to tell you as he's afraid or any information leaks. Pearl asks if you'll take on the case since that is what Maya would make you do if she was here right now. Head back to the Hotel Lobby. ------------------------------------- Date-March 20 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- Will will be waiting in the lobby and asks what is going on. Will can hardly believe the circumstances of this murder, as it all seems familar to him. One famous actor killing another famous actor. Will still doesn't think that Matt would kill someone. Phoenix notices something in his hand, though. He says that the bellboy from earlier wanted to give this to Phoenix. RADIO TRANSCEIVER will be added to the Court Record. All the bellboy said is that it was for the attorney Phoenix Wright. Now talk to Will about "Matt and Juan". He says that Matt is one of the most energetic actor's out there right now. The Nickel Samurai made him a real idol, but he kept adding to his rivalry with Juan anyways. He keeps saying the Juan and Matt would compete to be the best in just about anything, however it was usually Matt who came out to be the best. Since Juan wanted to compete with Matt, he joined a rival television show, and that was where the Jammin' Ninja came from. Now look at where their rivalry is gone to. Matt has killed Juan. Now ask about the "Press conference". The conference wasn't really for Matt as much as it was for the Nickel Samurai. He was supposed to wear the costume and give the press conference in it. He isn't sure on why this is, though. Pearl then asks what is taking Maya so long with her phone call. Pearl leaves to take a look for her, and an irritating beeping noise occurs. Turns out to be the transciever you just recieved. After turning it on, a mysterious voice come online, and Maya's voice can be heard shouting for help as well. He says that the fate of Maya is very important right now. The man says he has a proposal, and if Phoenix accepts then Maya will be returned unharmed. He alerts you this is a kidnapping. The man isn't seeking any money, however. He wants a verdict on a certain acquittal. He isn't the person he wants Phoenix to represent. What he wants is very simple. He wants you to get a total not guilty verdict on Matt Engarde. He didn't kill anyone, the voice says. Someone is framing him for the murder, though. Phoenix is able to believe him or not, however, Maya is still with him whether he accepts or not. You have one chance. Don't screw up. He calls himself "De Killer" before hanging up. Clever name. Pearl runs off to inform Gumshoe of the situation. Don't see how that isn't part of "don't call the cops" but Gumshoe's incompetence will see us through. Somehow. Gumshoe suspects that this means Engarde is the killer. But De Killer said Matt is being framed, right? If Matt was really innocent then there'd be no point to the kidnapping. Gumshoe also comments that "too much evidence" is being found. --------------------------------- Date-??? Time-??? Location-??? --------------------------------- This scene involves Maya, complaining that her body aches. The room she is locked in resembles a wine cellar. A mysterious man looking just like a butler walks in, and introduces himself as "De Killer". He says Maya isn't his target for now. He says that this is a mere business transaction. De Killer then calls Phoenix. This is what you just witnessed earlier. --------------------------------- Date-March 21, 8:11 AM Location-Wright & Co. Law Offices --------------------------------- Pearl greets you early in the morning and says that you should hurry over to greet Matt in the detention center. However, since visiting hours aren't open for a little while, you have some time to kill. Talk to her about "What to do". Pearl asks what if Matt is the real murderer. It's best not to think about that option for the moment. Now ask about "Maya's situation". Pearl says that Maya is the last one of her family she still has. Her father is gone, Morgan is locked in solitary confinement, and that just leaves Maya at a high risk of getting killed. Move to the Detention Center now. ----------------------------------------- Date-March 21, 8:57 AM Location-Detention Center; Visitor's Room ----------------------------------------- You will find Matt Engarde sitting in the Detention Center. He seems like a much bigger guy in person. He thinks Phoenix is selling him life insurance for some reason before he gets corrected. He then calls his manager on what to do in this situation. You have to make him have Phoenix take the case. Talk about "Matt Engarde" first. He says he can't talk about much since he has an autobiography coming out soon. He then calls his publisher and says he isn't allowed to talk about anything. Now ask about "What happened". Now he calls the president of the studios (he needs a mind of his own...) on what to do here. He says that the president strongly thinks Matt isn't the murderer. Present the Press Conference Ticket. Phoenix asks if he was going to give a conference after winning the Grand Prix. Matt says he never heard anything about this, he just leaves all this stuff to his manager. Matt then says it's about time he got going. Phoenix mentions the name De Killer before he takes off, and this stops Matt. Engarde lets you take on his case now. He says he'll answer anything he can. Now ask about "Matt Engarde". He says that it's really great to be the Nickel Samurai. He mentions his motto about refrshing like a spring breeze. This describes his personality (or so he says). He says that this scandal is going to destroy his reputation even if he manages to get out of here easily. Now ask about "What happened". After Matt got the award he went back to his room. He had that post-award ceremony to get ready for. He was in his Nickel Samurai costume, and he was along the entire time. When he was leaving his room he noticed it was very noisy. He was told by his manager that Juan was killed. Gumshoe appeared moments later to arrest him. Now ask about "The victim". Matt says that him and Juan are the same age. He asks why he would have any reason to kill Juan in the first place. It logically would be the other way around. Juan should be jealous and would want to kill Matt. Now ask about "The charge of the murder". He says that the full body search went badly, and that's why he was charged with the crime. They found a button from the Jammin' Ninja's costume. It was caught in his pants at the time. He thinks that it was planted there by someone. Pearl says that you should ask if he is really innocent or not, and if he's lying then the Magatama would figure it out. Phoenix asks Matt directly if he killed Juan Corrida. He says that he didn't kill him, and since no Psyche Locks appeared it's safe to assume he isn't the murderer. Save the game now. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 4-2 =~=~=~=~=~=~=~=~=~=~=~ --------------------------------- Date-March 21 11:34 AM Location-Wright & Co. Law Offices --------------------------------- You'll discuss with Pearl that you only have one day to get Matt a not guilty verdict, and since he's innocent it shouldn't be all that hard. But that means you have to find the real killer. Talk to Pearl about "What to do". You'll just repeat that Matt is innocent. Ask about "Any ideas". Phoenix asks why Pearl thinks him and Maya are so interested in each other even though they aren't doing anything special. Then Phoenix gets slapped since she thinks you're just hiding your feelings. You can now move back to the Gatewater Hotel, so do that. ------------------------------------- Date-March 21 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- You'll meet up with Oldbag once again as you arrive. It seems funny how yet another action star was killed, and Oldbag is the security officer still, and she happened to be a huge fan of Juan's. It's like case 3 all over again. She thinks that everyone she's near gets killed. Duh, she's so irritating and ugly. No surprise. Talk to her about "The victim". She questions why every star she cares about gets killed off one by one. She also mentions that she doesn't believe anything Lotta says to her. We can assume that Lotta told Oldbag what she knows so far. Now ask about "What happened". She says that she doesn't know anything about the murder since she was in the lobby getting ready for the press conference. However, she mentions that she did see the most important moment of the crime. Now ask about "What you witnessed". She laughs at Phoenix for all of a sudden wanting info, then four Psyche Locks appear over her. She demands you bring her a present to get her to talk. You don't have any real evidence of which you can use now, so ignore her for a while and head over to the Hallway. --------------------------------- Date-March 21 Location-Gatewater Hotel; Hallway --------------------------------- The hotel staff and police investigators sure seem busy today. You will meet up with Lotta when you enter the hallway. Lotta exclaims that Phoenix is a thief and demands that he hands over her camera. She says that since the criminal returns to the scene of the crime, Phoenix must have her camera. Talk to Lotta about the "Camera". She says that she lost her camera sometime after the murder from last night. She probably lost it trying to run around all of the police investigators there at the time. She did catch many pictures of anything that caught her eye, though. LOTTA'S CAMERA will be added to the Court Record. Now ask about "What happened". Before the awards ceremony the night before, Lotta was hanging out in the hallway area. She was even here when Matt was arrested. She said there was a big scoop to be had. Now you can ask her about the "Big Scoop". Before she'll tell you what she was really after that night, two Psyche Locks appear over her. You have a couple more options now than from yesterday. Head over to Engarde's Hotel Room first. ---------------------------------------------- Date-March 21 Location-Gatewater Hotel; Engarde's Hotel Room ---------------------------------------------- When you enter the room, someone will ask who you are. The woman figures that you are Engarde's lawyer. She seems to be a really smart woman. She thinks that you came here to find clues that will build up your case. She says she is Adrian Andrews, and she prefers to get right down to the facts. Talk to Adrian about "Night of the murder". Before the awards ceremony, she was having dinner with Engarde in his hotel room. She says to check the table if you care about what she ate. When the show was starting, she went to the Viola Hall. She didn't come back to the room afterwards because she had some errands to run. She helped with the preperations in the lobby. She went to get Engarde and Corrida for the show, and that's when she discovered the body. Ask about her "Relation to Engarde". She'll say that she's surprised you don't already know who she is, and adds she is Engarde's manager. Adrian also says Corrida doesn't have a manager due to hs studios having a different policies than Global Studios. Present to Adrian the Press Conference Ticket. You will say that Engarde didn't know anything about the conference, and Adrian points out that she didn't know most of the details herself either. It was part of the publicy department's order not to know much about the conference itself. Now present Juan Corrida's profile. Adrian says that she did know Juan Corrida. She says that Matt and Juan were like children when they were competing over the silliest of things. Perhaps she knows why Matt was driven to kill Juan, or whoever the real murderer is. Ask about "Motive for murder" now. Surprise, surprise, she too has four Psyche Locks on her. Sheesh, must everyone be hiding simple details from us? Next I'm sure Gumshoe will have Psyche Locks. There's nothing more you can do here. Head next door to Corrida's Hotel Room. ---------------------------------------------- Date-March 21 Location-Gatewater Hotel; Corrida's Hotel Room ---------------------------------------------- There a crapload of stuffed bears in this room. That's slightly awkward for a man to like these things. Gumshoe will appear to greet you and asks if anything else about the kidnapper has come up. Phoenix assumes he won't call again until Matt gets his not guilty verdict. Gumshoe says that due to these extreme circumstances he's willing to let you look around the crime scene and will tell you everything he knows. He also has a map of the hotel and hands it to you. HOTEL GUIDEMAP will be added to the Court Record. Talk to Gumshoe about "Cause of death". There isn't an autopsy report yet, but the picture of the crime scene should be sufficent enough. There is a knife stuck in Corrida's chest. This knife is obviously the murder weapon, and it's being analyzed for fingerprints right now. Tests are pretty sure these are Matt Engarde's fingerprints, too. CRIME PHOTO will be added to the Court Record. Now ask about the "Reason for arrest". He was arrested because evidence was piled up on him. Juan ended up putting up a fight, and by looking at the other side of the room you can easily tell that a struggle occured here. During the fight, one of his button's flew off. It's possible this is the same button that landed in Engarde's pocket. Even worse, there was a witness to this crime. He says that Oldbag is one of the witnesses. Gumshoe also says that something was a little off in the room. However, he won't tell you. Let's start examining the room. Press L to shift screens. Look at the vanity. Despite everything being a mess here, a single wine glass remains upright on the table. WINE GLASS will be added to the Court Record. Now on the floor near the vanity is a guitar case, no doubt the one that holds the Jammin' Ninja's red guitar. Oddly enough, the guitar is missing in action, and the top of the lid to the case is wet. GUITAR CASE will be added to the Court Record. Head back to Gumshoe and present the Wine Glass. He admits that was the oddest thing about the room. It was the only part that remained untouched. However, he mentions that Franziska found this out first. Gumshoe says you are going to be in a lot of trouble when she gets here. Ah, too late, that annoying beeping noise appears again. Franziska appears and starts whipping the hell out of Phoenix and Gumshoe. She says that you have soiled her perfect prosecuting record twice over, and this time she will destroy you in court. Franziska swears she will defeat you and leaves, but not before throwing something at you. Gumshoe also says he has to leave, and tells you to visit him at the Criminal Affairs Department if you need something. Examine the table infront of you now to find a note on it, autographed by Corrida, and made out to someone named Wendy. Wonder who that could be. MR. CORRIDA'S AUTOGRAPH will be added to the Court Record. Now head back into the Viola Hall. ------------------------------------ Date-March 21 Location-Gatewater Hotel; Viola Hall ------------------------------------ You will meet up with Will again here. He says that anyone connected to the murder isn't allowed to leave. Ask him about "The Nickel Samurai". He will tell you the show is aimed for kids, and is the sequel to his Steel Samurai show. There is nothing major you need to remember about the show, but Pearl seems really into the show now. Ask about the "Jammin' Ninja" to learn the show which is also aimed towards kids. Pearl also gets ideas to watch this show as well. Choose to present Adrian Andrews' profile. Will says he was interested in her for a little while. He says he doesn't know too much about her. Now ask about "The gossip on Adrian". He shows you an article where someone dedicates something to the beautiful managed A.A., Adrian Andrews' initials. This hints that Juan Corrida wanted Adrian Andrews to be his manager. MAGAZINE CLIPPING will be added to the Court Record. You will need this very clipping to unlock Lotta's Psyche Locks, so go visit her. --------------------------------- Date-March 21 Location-Gatewater Hotel; Hallway --------------------------------- Present the Magatama and get down to business. ----------------------------------- ~Lotta's Magatama Secret-Big Scoop~ ----------------------------------- Lotta isn't willing to give you any clues, so Phoenix guesses that Lotta was looking into a scandal. She may have been looking for a break in a huge story. You need to present the person that goes with Juan Corrida who may have been involved in the scandal. Present Adrian Andrews' profile here. She has been caught meeting with Juan Corrida secretly and would have been a great story for Lotta if she could get it. The first lock will break. However, she claims you need backup information and asks you to present info that ties Corrida with Adrian. Present the Magazine Clipping. Lotta saw this article and was loitering in the hallway, waiting for her chance to get some proof of this story. The second lock will break. Now ask about "Big scoop". She admits that she was going to get pictures of their love affair. She was hoping that she could get real proof and not just the initals of the name of the person Juan was seeing. The note to herself that she wrote on is gone, however. It was inside of her camera which she lost. LOTTA'S CAMERA will be updated in the Court Record. Head back to the Hotel Lobby to unravel the secrets of a certain old duff. ------------------------------------- Date-March 21 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- Present the Magatama to start unlocking Oldbag's secrets. --------------------------------------------- ~Oldbag's Magatama Secret-What You Witnessed~ --------------------------------------------- Oldbag says that she finally has a chance to toy with you, and Phoenix says he will give her what she wants. Present Juan Corrida's Autograph. The autograph was addressed to Wendy (prey tell if this is the real Wendy or not), so perhaps it is right in giving it to her. She wants to autograph so badly that the first three locks will break right off. She wants an exchange since Phoenix isn't too sure in getting rid of the autograph. The last Psyche Lock will break off. The autograph will be handed over to Oldbag. Now ask about "What you witnessed". Oldbag says that she saw Matt leave Juan's room that night. It was about 10 minutes before Juan's body was discovered. It was just a coincidence, though. Oldbag has alreayd testified that to the police. She says that she has been called in as a witness tomorrow, and that sounds just super. All we need is another Oldbag testimony. She says she really wants to get Matt guilty. Now you can ask about "Engarde's past". Oldbag says that Engarde framed Juan. He created the scandal that plagued Juan. Oldbag says that Juan was tempted by Adrian Andrews none less. She thinks that Matt shoved her into Juan's business intentionally to force a scandal that would lower Juan's reputation. Oldbag knows so much about it because she is a huge fan of him. She says she learned about it from a magazine that won't be out until next week. How does she know that now? Head over to the Criminal Affairs Department now. ----------------------------------------------- Date-March 21 Location-Police Station; Criminal Affairs Dept. ----------------------------------------------- Gumshoe will greet you just like he said he would. He says that there isn't anything to be happy about in this case, and that all of the testimonies point that Matt is the murderer. Talk to Gumshoe about "Airtight evidence". He says he can't reveal the details, but there are two big pieces. Both of them are in the crime photo. There is a button missing from Juan's chest that was found in the Nickel Samurai's pants, and the fingerprints that were on the kinfe stuck in Juan's chest. The prints belong to Matt. Ask about "Airtight testimony" now. He says that Oldbag will be testifying, but we already knew that. Gumshoe even told Oldbag not to say anything to anyone. She saw everything. She saw Matt come out of Juan's room near the time of death. Present to Gumshoe the Magazine Clipping. The police are involved with the scandal between Adrian Andrews and Juan as well. Two years ago, a woman committed suicide. Her name was Celeste Inpax. She used to be Juan Corrida's manager. As if this wasn't enough, Celeste was Adrian's mentor. She taught Adrian almost everything she knows about business. Now ask about "Celeste Inpax". It's been two years since her suicide, and now another case has formed and possibly her death could be involved. Franziska apears before he gets any further. Franziska is sick of Gumshoe acting traitor to her and says he is fired. However, just before Gumshoe leaves, someone says that Franziska would have won in court if it wasn't Gumshoe. The voice belongs to the one and only Edgeworth. Franziska says that Edgeworth should be ashamed for failing as a prosecutor, but then he backlashes at her by asking just how well her court record has been coming along. He says he came back to replace Franziska who was clearly losing it. Let's talk to Edgeworth about "Tomorrow's trial". Phoenix says that he thought Edgeworth went up and died a year ago. He asks if Edgeworth is prosecuting tomorrow, but as long as Franziska wants the case there's nothing he can do. He does say that Phoenix can't win by himself tomorrow. Something seems odd with Edgeworth. He totally doesn't seem the same. He goes as far as saying he's understood the importance of teamwork, and is willing to let loose any information he knows since he isn't part of the case. Ask about "Proof of Von Karma blood" now. A perfect win record is a proof of a Von Karma. Phoenix guesses that since Edgeworth's win record had been shattered, Edgeworth couldn't show his face in court again and said he chose death while in reality ran away. Now he asks you why Phoenix is in court. Ask "Why stand in court?" now. Phoenix says he is in court just to defend his client while Edgeworth merely laughs and says he has a lot to learn. Present Celeste Inpax's profile to Edgeworth. He says the she is an important part of this case. She was Adrians' mentor, but suddenly was called in to be Juan Corrida's manager. Several months later, Inpax died. Despite her death being a suicide, something remains unanswered. She had a suicide note, but nobody could find it. Talk about the "Missing suicide note". The police began to suspect that the suicide note was hidden. There was no solid evidence that she had written a note, however, there were cases of ink found on her finger, so the likelihood of a suicide note is very high. The police think it was Juan Corrida himself who hid the note. He was the one who found her body, so he was the only person who had a chance to hide the note. Edgeworth hands you part one of the SUICIDE REPORT which will be added to the Court Record. Present this report to Edgeworth. He says that this report has two parts to it. The second part mentions of an attempted suicide of Adrian Andrews. Edgeworth says that she just looks like a strong business woman. She has always had a secret she was trying to hide. He mentions the word co-dependency. Ask about "Co-dependency" now. Adrian Andrews tried to commit suicide several days after Celeste Inpax killed herself. Adrian tried to kill herself because she had lost her will to live. Her mentor had just killed herself, and her mentor taught her so much. Adrian then started going to counseling sessions to try and find someone she could trust unconditionally. Without someone to follow, Adrian becomes uneasy and can't find her way through life. ATTEMPTED SUICIDE REPORT will be added to the Court Record now. Wow. That's a lot of new info to the case. We may be able to break Adrian's Psyche Locks now, so head to Engarde's Hotel Room. ---------------------------------------------- Date-March 21 Location-Gatewater Hotel; Engarde's Hotel Room ---------------------------------------------- Adrian is still in the room, but she's talking with Franziska at the moment. Franziska quickly accuses Phoenix of following her around everywhere she goes. Pearl steps in and says that it is her who is doing the following, not Phoenix, and says that she is always following Gumshoe around. She then present an electromagnetic receiver that tracks the location of Gumshoe at any given time. That's like, illegal, doesn't she know that? Franziska takes her leave after telling Adrian to remember what they discussed. Present the Magatama and let's get this over with. -------------------------------------------- ~Adrian's Magatama Secret-Motive for Murder~ -------------------------------------------- Adrian says she was never really close to Juan Corrida. She's never been good at being with other people. You need to present evidence that shows doubt in this statement. Present the Magazine Clipping. She says that it is just a tabloid and you shouldn't go believing it. She says again she hates relationships like that. Now you need to show her why she needed to get close to Juan. Present Celeste Inpax's profile. The first lock will break. Celeste committed suicide and nobody knows why. Phoenix believes that Celeste got close to Juan so she could find out more about the missing suicide note. She says that there was no mystery surrounding her death. Now you must present something that shows she wasn't happy with the way the case was resolved. Present the Suicide Report. The police were under suspicion that there was a note and that Juan Corrida was the one who hid it. Adrian thought the same thing and strived to be with Juan to find the note. The second lock will break. Adrian says she never knew that suicide note was never found and that she doesn't go and gets in the way of other people. You need to present proof that Celeste was an important person to her. Present the Attempted Suicide Report. Although Adrian looks like someone who heavily supports herself, that's all a lie. She's heavily dependant on other people. The third lock will break now. When Celeste died, Adrian died a little on the inside. N matter what, however, she couldn't rest her mind of the note. Now the perspective changes a bit. It seems now that Adrian wanted Juan dead for hiding the note more than Matt wanted him dead. The final lock will break. Ask about "Motive for murder" now. Adrian admits she has little self confidence. She wanted to somehow find out what the note said, and this secret tore at her. Without Celeste, Adrian got scared. She got close to Juan so she could pick up the suicide note. She admits, though, she wouldn't kill anybody for the note. She then asks if you'd keep her attempted suicide a secret. Pearl then mentions that Adrian often plays with a card in her hand. She isn't sure what it is, it just suddenly found its way into her handbag. There's a picture of a seashell on the front of it. She then leaves. Head back to Wright & Co. Law Offices to end the day. --------------------------------- Date-March 21 Location-Wright & Co. Law Offices --------------------------------- One thing was discovered today. Adrian does have a clear motive for murder. Just then, the tranceiver begins to beep. De Killer must be calling again. As promised, De Killer hasn't touched her. He says that she is probably starving, so it's in your best interest to win the trial as soon as possible. Maya faintly says to ask Mia something. Mia appears in Pearl's body seconds later. She says she has a message from Maya so ask her anything you need. Ask about "Maya's situation". Maya is safe, just like De Killer said, for now. Mia knows about this because Maya channeled her, and left a note for her to read. Now ask about "The kidnapper". Mia says that Maya went to answer a phone call at the hotel and was drugged by De Killer on the spot. Maya is locked in a dark room. She'll explain what she heard. --------------------------------- Date-??? Time-??? Location-??? --------------------------------- You'll appear in the wine cellar again, but this time you are playing as Maya. Cool. Examine the small card at the bottom of the stairwell. She says it looks like a business card, but there's no name on it. It's the same card that Adrian was holding. Now examine the door. Maya thinks she may be able to open the door using the card. Maya is then heard escaping... Save the game. =~=~=~=~=~=~=~ Trial-Part 4-3 =~=~=~=~=~=~=~ ---------------------------------------------- Date-March 22, 9:47 AM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Engarde says that there is no way Adrian would have killed Juan. There's going to be a ton of evidence against Matt in trial, and you have to somehow prove it doesn't connect Matt to the murder. Matt also says that the scandal in question would severely hurt his image if it were true. Mia comes in and says you must get a complete acquittal by the end of the trial. Just before it starts, the tranceiver radio beeps. De Killer wants to help you win the trial, so he sent you a small present. He says you will figure it out. ---------------------------------------- Date-March 22, 10:00 AM Location-District Court; Courtroom No. 3 ---------------------------------------- Franziska isn't in the courtroom for some reason. The bailiff comes in and alerts that Franziska was shot by an unknown gunman this morning. It isn't all that unknown to you as Mia thinks that is clearly the present that De Killer wanted to give you. If Franziska, one of the best prosecutor's around, was unable to make the trial, this would be all the more to your advantage. Someone comes in and says Franziska is still okay, and reveals himself to be Edgeworth. He says he will be taking her place. It's about time he did so, too. He also says Franziska was shot in the right shoulder (how ironic) and is in surgery. Edgeworth knows all the details to the case and is ready to get a verdict. He then brings Gumshoe to the stand. He'll testify to the facts of the case. -------------------------------------------- ~Gumshoe's Testimony-Bare Facts of the Case~ -------------------------------------------- -This murder happened after the Hero of Heroes award ceremony, sir. -The victim, Juan Corrida, was found dead in his hotel room. -After looking into the cause of death, we believe he was definitely murdered, sir. -At first, we though there was something suspicious about the empty guitar case. -However, we later found out that the guitar case had nothing to do with the murder. Gumshoe also points out at the end that Matt and Juan went to their respective hotel room, alone, after the ceremony. Start by pressing his third statement, about how Juan was murdered. Gumshoe says that the cause of death wasn't actually the knife stuck in Juan's chest, and tells you to look at the photo again. He points you to the bandana around his neck. The knife was probably just stuck into his body after death to make it look like the actual murder weapon. AUTOPSY REPORT will be added to the Court Record. Press the fourth statement. The guitar case was empty when Juan was murdered. The only fingerprints that could be found on the case were of Juan's. GUITAR CASE information will be updated in the Court Record. Now press the final statement. The police are convinced it has nothing to do with the case because it wasn't present at the Gatewater Hotel that night. The red guitar was eventually found at the studio's TV set. Juan has apparently taken just the case with him. Even when he was onstage for the awards he didn't have his guitar. Because there was nothing in it, is has no relevence to the case. Edgeworth ends the examination and recaps that Juan was choked to death by his bandana. He was then stabbed by a knife intentionally after that. Why did the police arrest Matt then? ----------------------------------------- ~Gumshoe's Testimony-Why Arrest Engarde?~ ----------------------------------------- -Matt Engarde and Juan Corrida were huge rivals with each other. -They each thought the other guy was "in his way". That's motive enough in my book. -As for evidence...There's the Jammin' Ninja button. -It was ripped off of the ninja costume and was found in Mr. Engarde's "hakama". -The defendant's fingerprints were also all over the knife. -The defendant bought the knife for the crime...Which makes this a premediated murder! Gumshoe says that the knife was easy to get fingerprints from, and that it was bought just for the occasion of this murder. KNIFE will be added to the Court Record. There is also the button from Juan's outfit with traces of his blood on it. JAMMIN' NINJA'S BUTTON will be added to the Court Record as well. The contradiction is lying flat out here, so no need to go press happy. Present the Knife at the final statement, where Gumshoe says the knife was bought just for the crime. There is no way Matt bought this knife. The handle of the knife has the word Gatewater engraved onto it, so the knife clearly belonged to the hotel and therefore wasn't bought at a store or elsewhere. Because of this, the murder could not have been premediated. Edgeworth then states this is worthless information as everyone already knows the murder wasn't premediated. He then asks where the knife came from then. He then shows the picture of the room, and that there is a knife resting on the table. Then he shows the room of Engarde. There isn't any knife on his table. It is assumed that since Matt's knife was missing, he took it and stabbed Juan with it after dinner. Edgeworth then asks if you'd like to present any evidence not yet known. Choose "Actually, I do." when asked if you need to present anything. The Judge will give you the chance to present just one piece of evidence. Screw up and you'll lose the entire health bar. Present the Wine Glass that we noticed in Juan's room. Taking a look back at the crime scene, there was a struggle. Many things are knocked over, but the wine glass remains untouched. Edgeworth says there isn't anything special about the glass, though. He thinks it is safe to say the glass was set up there after the crime took place. Perhaps by Adrian Andrews. Answer "There's no way" when asked if Adrian could have set down a glass. Edgeworth says he has proof that Adrian set the glass on the table. He has alreayd inspected the glass for fingerprints, and as it would turn out, only one set of fingerprints were found on the glass. All of them belong to Adrian Andrews. WINE GLASS will be updated in the Court Record. Adrian probably was holding the glass when she went into Juan's room, and put it down when she was shocked to him dead. Edgeworth has yet another witness that will give their account. Oh no, not Oldbag. Oldbag seems a little more than excited to see Edgeworth again. Edgeworth doesn't look to thrilled, though, to have this irritating witness on the stand. She says again that she was a fan of Juan, and probably is part of his security team. --------------------------------------- ~Oldbag's Tesitmony-What You Witnessed~ --------------------------------------- -Anyway, after the ceremony, I went to pace around in the hallway in the front room. -There was something I was interested in finding out, you know... -Well, since I was on the job, I made sure to keep a good eye out the whole time. -That's when someone showed up! It was a man coming out of poor Juan's room. -It was Engarde. Matt Engarde. He was trying to sneak his way out of Juan's room! Press the final statement, about how she saw Engarde come out of Juan's room. Oldbag is sure that she saw him come out of his room. You can now ask Oldbag a side question. Choose to learn more about "The person's clothes". She says the man was wearing a sporty racing jacket. The Judge will ask if this question was important in any way. Choose "It was very important". Oldbag will add the following line to her testimony. -He was wearing his flashy racing jacket. Honestly, it's all just for show. Present the Jammin' Ninja's Button at this new statement. Oldbag knows the button from the Jammin' Ninja's costume. Oldbag really wants the button as a small gift, but too bad it's evidence. The button was found in Matt's pants of the Nickel Samurai costume. However, Oldbag just said that Matt was wearing his usual racing jacket. Oldbag will testify again, going into further detail on who she saw. ------------------------------ ~Oldbag's Testimony-Who I Saw~ ------------------------------ -Engarde...Engarde...Yes, now I remember! -The Nickel Samurai, that's right, it was the Nickel Samurai that I saw! -Yes, it would have been convienent for him to wear his costume to the murder. -He had to go to that post-ceremony stage show right after the crime, you know. -So he must've worn that Nickel Samurai costume when he was stabbing poor Juan. Mia says that the contradiction is lying in plain sight. Present the Knife at the final statement, where she says that Matt must have been in the Nickel Samurai costume. The knife is important because it has Matt's fingerprints on it. If Matt was really in the Nickel Samurai costume at the time of the murder, there's no way his fingerprints would have been on the knife. He would have just wiped them clean off. The Nickel Samurai wears gloves on his costume. Edgeworth says that he may have taken off the gloves, but that's impossible. Why would have have done that? Edgeworth says there is one possibility. He says he went to Juan's room in his costume, expecting just to converse with him with no intention of killing. That's when he took off the gloves. You need to check if there are any contradictions with this theory. Choose "There is a contradiction". If Matt was the killer, you need to present what intent he had for going to his room. Present the knife once again. If Matt was the killer, he would have brought the knife to his visit with Juan. However, if Matt originally went in with no intent to murder, there'd be no point in bringing the knife. Also, if Matt was wearing his costume to the murder, then there would be glove marks on the knife. Thusly, Phoenix thinks the knife was planted by the real killer to make it look like Matt is the murderer. You must answer why the knife was planted in Juan. Choose "To frame Matt Engarde". Oldbag did just say she saw Matt in his costume, and thusly there would be glove prints on the knife it that were true. Oldbag hints that it may not have been the Nickel Samurai she really saw. She says she wasn't waiting around in the hallway for the Nickel Samurai. She isn't allowed to say just who she was really waiting for, though. However, she wasn't actually waiting for Juan Corrida. Now you must present the person she was really waiting for. Present Adrian Andrews' profile. It is explained why Adrian would be in Juan's room. Oldbag then says that since you all figured it out, she might as well spill the beans on this secret information. --------------------------------------- ~Oldbag's Testimony-Secret Information~ --------------------------------------- -That Engarde is one evil, evil man! -He thought he could ruin poor Juan by causing a huge scandal! -So to do that, he sent his own manager to get in close with Juan! -I cannot condone such dirty tricks! So I took action! -...Oh, and this is top secret, you got that!? Bobody else but you and me know yet, OK? As it turns out, if you don't prove this rumor to be false then it proves ill-will towards the victim, and will probably prove Matt guilty. Start off by pressing the final statement of her testimony, where she says this info is top secret. Oldbag isn't willing to say where she found the information from. Choose to "Present evidence" as you have something that shows where she may have gotten this information from. Present Lott'a Camera. She lost her camera, and she put a note inside the camera as well. She wrote down several things she thought about the relationship between Adrian and Juan. Oldbag then presents the note she found. Oldbag must have been the one who stole Lotta's camera to begin with, and found the note later. Phoenix will then think it's best to forgive her. Choose to "Pile on more pressure". Oldbag says that the piece of paper is the only thing she stole. You need to present what else she stole that night. Present Lotta's Camera here. Oldbag then admits that she did steal the camera. Oldbag was curious what kind of pictures Lotta had taken so she "borrowed" the camera to find out. The photos on the camera will be developed at once. Only one photo is actually relevent to the case, however. The picture shows the Nickel Samurai, and LOTTA'S PHOTO will be added to the Court Record. This picture, added to Matt's statement that he was in the Nickel Samurai costume at the time of the murder, proves that he is the murderer. You will be asked if there is anything wrong with the picture. Choose there is "something strange with it". Once again this is your last shot, worth your entire health bar. Point to the bottom of the left leg (or his right leg if you were in the costume). If it were possible to see the ankles, that would be enough to prove it is Matt in the costume, however, they aren't visible. Thusly, the person in the costume isn't Matt Engarde. The Nickel Samurai in the picture is holding up the hakama just to walk. The person inside the costume must be shorter than Matt. Edgeworth asks just who could be inside the Nickel Samurai costume. Present Adrian Andrews' profile. First, she is shorter than Matt. Also, she can move freely between Matt and Juan's room without trouble. She also had dinner with Matt that night. It means that it was easy for her to get the knife that night. Phoenix now calls that Adrian Andrews is the one who murdered Juan, not Matt. She tried to frame Engarde instead. However, this means that the trial will last for another day. Sadly, you can't let that happen. Choose to "Raise an objection". As it turns out, Edgeworth predicted such an event would occur, os he brought Adrian as a witness in the event it was necessary for her to come. A short recess will occur now. Save the game. =~=~=~=~=~=~=~ Trial-Part 4-4 =~=~=~=~=~=~=~ ---------------------------------------------- Date-March 22, 2:14 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Matt still doesn't think that Adrian would have pulled off this murder. He also says that during the break between the ceremony and press conference he was sleeping, so the only person it could have been is Adrian. She also could have planted the blood covered button into his pocket at that time, as well. Mia also thinks that Adrian's only motive was to retrieve the missing suicide note that Celeste left. The only problem with this theory is that Edgeworth told it to you. It's obvious he knows you'll pull this stunt in court. ---------------------------------------- Date-March 22, 2:25 PM Location-District Court; Courtroom No. 3 ---------------------------------------- Adrian Andrews is called to the witness stand. She says that she has one request regarding everyone already knowing that she had some relationship with Juan. She was seeing Juan Corrida, and was already aware of the rivalry between Juan and Matt. However, she claims seeing him was a private matter. She then claims she didn't kill him, and testifies what she knows. ------------------------------------------------- ~Adrian Andrews' Testimony-When I Found the Body~ ------------------------------------------------- . Adrian also states at the end that she was so paniced that she forgot to not touch anything, and that's how her fingerprints ended up on the wine glass. Press the third statement when she says she was in shock. You won't get any info out of this, though, save Edgeworth saying it's natural to be in shock after seeing a murder. Now press the final statement when she says she made herself some juice. Adrian says that she wasn't feeling too good, so she put the glass down without drinking from it. Phoenix confirms that she was in great shock when she saw Juan's dead body, and that's when she poured herself juice. She then says that she made one mistake, but stops herself from going any further. Choose to "Press further". Edgeworth isn't aware of what her mistake at the crime scene is either. When she put the wine glass on the counter, she accidentally knocked over the flower vase. When the vase fell, it broke when it hit the guitar case. She'll add the next line to her testimony. -I was the one who knocked the flower vase over, where it fell onto the guitar case. Present the Guitar Case at this statement. The main problem here is that the top of the guitar case was soaked with water. If the flower vase really did fall into the guitar case, the inside of it would be wet and not the outside. Also, since the guitar was open during the crime, the glass shards would have to be inside the case and not outside of it. Adrian did say she didn't touch anything else but the vase. The Judge will ask if you want Adrian to testify about the guitar case. Choose to "Make her testify" since there's likely to be even more holes in her story. ------------------------------------------- ~Adrian Andrews' Testimony-The Guitar Case~ ------------------------------------------- . Present the Guitar Case at her second statement, when she says she must have opened the case. There isn't any way that Adrian could have opened the case herself because fingerprints belonging only to Juan were found on the case. Pretty simple explaination. Adrian asks what if she were wearing gloves when she walked into the room. You'll then be asked if this is a strange statement. Say "That's strange..." when prompted. You need to prove that she wasn't wearing any gloves. Present the Wine Glass. Adrian left her fingerprints on the Wine Glass, so she obviously wasn't wearing any gloves like she said she was. In the event she did take her gloves off to put the glass of juice on, why would she put them back on just to open the guitar case? Mia says that the guitar case does play an important role and questions if it was really empty upon first discovering it. Edgeworth says this has nothing to do with the case, but Phoenix objects and refutes that Adrian keeps contradicting herself. The guitar case must have something to do with the murder. Now you need to present what was in the case at the time of the murder. Present the Nickel Samurai picture. Phoenix proposes that the Nickel Samurai's costume was inside the guitar case the entire time. The point of this would be to wear the costume, allowing Adrian to put it on and make her escape easily. Phoenix says that Lotta has the picture to support this statement. The Nickel Samurai in the photo wasn't Matt, it was Adrian instead. You need to explain what Matt's costume was doing inside the guitar case. Choose "It was a spare costume". Since Matt didn't take off his costume during the break, this costume must be a spare. This would mean that the victim brought the spare costume all along to the ceremony. Now you need to present the reason Juan had to bring a spare Nickel Samurai costume. Present the Press Conference Ticket. The Nickel Samurai was going to confess something at the press conference. However, Matt himself had no idea that this conference was going to occur. This can only mean one thing. The conference was set up by none other than Juan Corrida himself. The spare costume was brought just for this occassion. The main concern now is what Juan intended on revealing during the press conference. Thusly, it can be assumed Juan intended on speaking badly of Matt Engarde. Adrian then says that the press conference was setup by Juan. She was the one Juan asked for help setting up. She also prepared the second costume. Juan said that if he lost the Grand Prix, he intended on taking Matt down with him as well. Juan had a secret so powerful that it would have destroyed Matt's career. She also says she has been trying to protect Matt, explaining why she's been acting weird. ------------------------------------------- ~Adrian Andrews' Testimony-Protecting Matt~ ------------------------------------------- -From the moment I saw the crime scene, I had a feeling that I had to protect him... Press the fourth statement where she says her thoughts were confirmed by the murder evidence. Phoenix says that the knife could easily just be a cover. Adrian says this doesn't really matter, but will change her line of testimony to the following. -That button was torn off of Juan during his fight with Matt. Now present Juan's Autopsy Report. Juan wasn't killed from the knife as Adrian claims, but was killed from being strangled by his bandana. The button could only have been ripped off after the knife was stabbed into the victim. It's impossible the button would have been ripped off during the struggle because he was choked to death in actuality. The button was ripped off of Juan's already dead body. Edgeworth will demand to know where you are going. The button was taken off purposefully, but what was it? You must choose what the murderer had in mind when pulling off the button. Choose "To pin the crime on Engarde". There's no other way the button would be in Engarde's pants. Matt was being setup the entire time by the real killer. Now you need to present who the real murderer must be. Present Adrian Andrews' profile. There's no real need to present evidence because all of it to this point now shows that she is the real killer. The knife was used to throw suspicion onto Engarde to begin with. It could only have been taken from his room. Adrian was the only person to have had dinner with Matt. Then she asks about the button. The only people who could have removed the button were either the killer or the person who found the body. If Matt was the real killer, he wouldn't be stupid enough to put important evidence in his own pocket. The only person who could have put it in his pocket was the one who woke him up, again that is Adrian. The guitar case held a spare Nickel Samurai outfit. Adrian was the only person who would have even thought to look in the guitar case for one. She wiped the prints from the guitar case so as not to make it look incriminating. However, she left her prints on the glass of juice. She left the prints intentionally just to setup the fact she discovered the body. Then there's the photo which establishes Adrian coming out of the room. Adrian starts to break down now. She then states she refuses to testify. She isn't forced to testify since it would incriminate her. Phoenix then thinks back to yesterday when Franziska told Adrian to remember what she had told her. Franziska put this idea of not tesifying into her head if the case started to look bad for her. Edgeworth then says you still lack definitive proof that any of your accusations are true. We haven't figured out if Adrian really did murder Juan. The Judge is ready to call off the trial, but Edgeworth manages to object to his decision. Although Adrian can refuse to testify, she can't if the testimony regards an unrelated subject. He says that when people find dead bodies they are usually scared, not thirsty for juice. ------------------------------------------------- ~Adrian Andrews' Testimony-When I Found the Body~ ------------------------------------------------- -That glass of juice...I didn't really pour it for myself. -I was surprised when I walked into. Present the Crime Photo at her fourth statement, when she says she didn't think Juan was dead. There's something totally odd about that. There was a knife stuck in Juan's body. How she couldn't have thought he was dead or seriously injured whens he walked into the room is absurd. There's nobody else who would just get a glass of juice while ignoring someone who is dead in the same room. Her lie has proven, according to Phoenix, she is the real killer. Adrian still keeps stammering, and still says it wasn't her. Now she's flat out accusing Matt of making the murder. Just before the verdict gets put down, Edgeworth objects. He says Adrian has yet to speak the real truth. Adrian says that if she spoke then Matt would never be declared guilty. All she is doing right now is following the advice of Franziska. Edgeworth tells you to think about what Adrian has and hasn't done. Choose to "Force Andrews to testify". Adrian still refuses to testify, though, so Edgeworth reveals that Adrian has a mental condition and is about to reveal Adrian's true nature. Adrian finally agrees to talk. -------------------------------------- ~Adrian Andrews' Testimony-My "Crime"~ -------------------------------------- -When I first saw him...I really thought he has. Adrian says she did all of this just to pin the blame on that scumbag Engarde. She says he deserves this for escaping a previous crime. Press her first statement. Since the bandana is part of the Jammin' Ninja's costume, she though nothing was unusual. Press the second statement. She admits to forging the knife and the button. Now press the third statement. Nothing important will come out of it. Press the fourth statement to find out Adrian really did plant the button inside Matt's costume. Press the fifth statement to find out it was Oldbag and Lotta who got in her way. Now press the final statement. Adrian reveals it really was her who put the Nickel Samurai costume into Juan's guitar case. After pressing every statement, the Judge will call off the cross examination. Adrian says that Franziska talked to her yesterday to just keep quiet about her crime, and that would make Matt guilty. Sadly, this testimony means she isn't the real killer. Court is over for the day. This brings disaster for Phoenix. Before Edgeworth leaves, he asks to see the card Adrian keeps fumbling around with in her hand. She says she found it in Juan's room the day of the murder. Edgeworth demands the card, however. Edgeworth goes into a fury of hatred, calling Adrian an idiot for hiding this card. It still doesn't seem that important. Save the game. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 4-5 =~=~=~=~=~=~=~=~=~=~=~ --------------------------------- Date-March 22, 5:24 PM Location-Wright & Co. Law Offices --------------------------------- Pearl starts off crying about Maya since you weren't able to get your verdict today. Phoenix says that there still may be a chance for Maya's freedom. The condition was to get a not guilty verdict, and since Matt hasn't been proved guilty yet, you should still be fine. Gumshoe drops by to share some information. Talk about "The future". Gumshoe says he's not exactly capable of finding another job and wants to work with you. Well that's...great. Ask about "Edgeworth" now. Gumshoe says this is the first time Edgeworth has ever acted like that in court. However, thanks to his bold statement the truth finally came out. However, Phoenix still wants to know why there was a need to frame Matt Engarde. Now ask about "Franziska". She was shot on the way to the trial by a pistol. She's resting at the hospital right now, and says it's none other than the Hotti Clinic. Err, okay. Can't be all bad. Head over there right now. -------------------------------- Date-March 22 Location-Hotti Clinic; Reception -------------------------------- As soon as you enter you will be greeted by the awkward doctor impersonator. As if this wasn't enough, Edgeworth appears as well to talk with him. He asks how Franziska is doing, and the fake director says that she is doing fine. He also says he's personally taking care of her and he knows the surgery went fine. The fake director will fall when Franziska appears and whips him. Looks like she's in a fine condition. Ask about "The shooting" now. Franziska says she was shot infront of the courthouse in her right shoulder. She even goes as far to say that such things happen all the time. She even had the mind to continue running the trial in her condition. She was dragged here by Edgeworth, though. Even so, Edgeworth still had to clean up her mess. Now talk about "The deal". Franziska plays dumb and says that she never made such a deal with Adrian. This is slightly ironic in Adrian's situation because now that she told her secret, she is in danger of being found guilty herself. She then runs off. Now talk about "Today's trial" to Edgeworth. He says he had to go to such extremes to get her to testify that one little detail on what she did at the crime scene. Now ask about "Adrian's card". Edgeworth says the history of the card is top secret and can't be leaked to anyone. A special team of investigations has been working for years to find the owner of these cards. A man named Shelly de Killer. He also mentions that De Killer is one of the best assassins out there. PICTURE CARD will be added to the Court Record. Now ask about "Assassin". De Killer is in a long standing line of assassins out there. Shelly is the professional name to one of the heirs of the De Killer name. He has a habit of leaving his business card, cleverly a card with a shell on it, near each of his victims. Police think it is a part of his duty to his clients. If he leaves a card, then the client can be assured that it was De Killer who killed the person. De Killer values the trust between himself and his clients. This pretty much confirms that De Killer is the assassin who killed Juan. Now ask about "Maya's situation". Edgeworth is willing to help by putting out a rescue team, but it's worthless since there's no clues to her location. The only eay to save her is to get an acquittal. Edgeworth says that De Killer did kill Juan Corrida. However, the client is none other than Matt Engarde. He hands you a LETTER OF INTRODUCTION that will allow you into the Gatewater Hotel, added to the Court Record. He then takes his leave. -------------------------------- Date-??? Time-??? Location-??? -------------------------------- Maya says that even kidnappers are a bit careless in their actions. She thinks that the assassin is just making that title up just like Phoenix does for most things in court. She unlocks the door easily. Move to ????. You appear in a living room of sorts. Start investigating the area for any clues. Examine the right wall with all the shelves. There appears to be a ton of video tapes lined up on the wall. Now examine the picture on the table. The picture reads "With love... Celeste" and has a picture of Celeste on it. Now examine the teddy bear sitting on the couch. There seems to be several cuts on it, however. Now examine the antennae in the left corner of the room. It's hooked up to a VCR. Examine the door next. It's locked, however, and the card won't be able to help you here. The mysterious man appears again and tells Maya to cooperate. -------------------------------- Date-March 22, 7:04 PM Location-Hotti Clinic; Reception -------------------------------- Phoenix isn't too sure whether or not Engarde is really guilty. There's nothing left here so head to the Detention Center. ----------------------------------------- Date-March 22 Location-Detention Center; Visitor's Room ----------------------------------------- Sadly, visiting hours are over so you can't investigate into whether or not Matt hired De Killer or not. However, he did leave a message for you. Matt has a cat named Shoe and is asking you to feed him. His house isn't too far from the hotel. MATT'S NOTE will be stuffed into the Court Record. Head to the Hotel Lobby first. You need to anyways to access the option to go to Matt's house. ------------------------------------- Date-March 22 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- Oldbag appears and says you can't pass anywhere into the hotel. Don't bother wasting time here. A cat's life could hang in the balance if we don't feed it! Head to Matt's Living Room. ------------------------------------- Date-March 22 Location-Engarde Mansion; Living Room ------------------------------------- Damn, Engarde sure lives in a fancy house. Shoe appears and seems to be attached to Pearl. A certain someone comes up. Wonder why this guy looks just like De Killer. He says you must be Mr. Wright, and introduces himself as John Doe. He's the family butler. Talk to him about "Matt Engarde". The guy says he doesn't think Engarde is capable of murder. Now ask about "John Doe". He says he's served at the mansion for about a year. Now ask about "Shoe". You'll throw away Matt's Note after this. Doe then takes his leave. Oddly, Phoenix doesn't think it strange that Matt made you come here to feed Shoe even though the butler already did it. Man, he overlooks simple details. Head back to the Hotel Lobby now. ------------------------------------- Date-March 22 Location-Gatewater Hotel; Hotel Lobby ------------------------------------- Present the Letter of Introduction. She's delighted to see something from Edgeworth and Oldbag will allow you to tour the hotel again. She comes back a second later to tell you that Engarde's Hotel Room is off limits. The police are investigating that room all day so you can't enter. Move to the Hallway. --------------------------------- Date-March 22 Location-Gatewater Hotel; Hallway --------------------------------- You'll meet up with Lotta as you enter the Hallway. Talk to her about "Night of the murder". There isn't much info to be had here as neither Oldbag nor Lotta were here the entire time. Now ask about "Scandal". Lotta says it's best not to believe that info from her camera. She actually just wrote it on a hunch. Now ask about the "Camera". Turns out Edgeworth came by a little while earlier and said the camera needs to be kept on account of it's still evidence. Lotta then takes her leave. Head to Corrida's Hotel Room. ---------------------------------------------- Date-March 22 Location-Gatewater Hotel; Corrida's Hotel Room ---------------------------------------------- Yeah, Oldbag somehow managed to get into the room. She says she came down here to pay her respects to Juan and you're interrupting. Ask about "Night of the murder". She says she was tricked by that fraud of a photographer. She says she had more to do than just stand around the hallway. Ask about "Memories of Corrida" now. She thinks that he was going to become a huge star one day and beat Engarde. Pearl points out that all of the presents that Juan has recieved are bears. Ask about "Presents" now. Some time ago Juan had a fight with a bear, and in the end they somehow became friends. Uh...so, since that incident, people have sent him bears in appreciation of what he had done. Just before you can talk much more, De Killer calls again. De Killer is ticked that even with his present you still weren't able to pull of a not guilty verdict. He will give you one last chance to pull through. Before you get to hear news of Maya, the transceiver happens to start malfunctioning. Head back to Wright & Co. now. --------------------------------- Date-March 22 Location-Wright & Co. Law Offices --------------------------------- Gumshoe is still here and wanting to help, so he allows you to ask him anything. The only new things you can do would be to present the Radio Tranceiver. Phoenix turns the transceiver back on, but it appears to be working just fine right now. Gumshoe suspects electromagnetic interference. Talk about "Electromagnetic interference" now. He says that is what occurs when radio signals get mixed with other signals. Gumshoe says that something in the room you were just in must have been emitting strong radio waves that could interfere with the transceiver. Something like a listening device. Gumshoe says he's going to get a bug sweeper to check for anything suspicious at the crime scene. Head back to Corrida's Hotel Room. ---------------------------------------------- Date-March 22 Location-Gatewater Hotel; Corrida's Hotel Room ---------------------------------------------- Gumshoe says he was kicked out of the precinct and couldn't get his hands on a bug sweeper. He did manage to get one, and it happens to be the one he made in elementary school. Whatever works, I guess. However, the device will go off at any source of waves. You will then have to move the scanner around the room, checking for any major source of radio waves. There are several objects here that will make the scanner beep very fast. However, the item you want is the bear in the left corner of the left side of the room. It's the tall bear that towers over the rest of them. Gumshoe comes in an deduces that tha listenting device is set up inside this bear. He will rip the eye out of the bear. Turns out there was a camera inside all along, and there's a transmitter and timer as well. Talk to Gumshoe about the "Camera". He says this kind of camera is only used in security systems. The footage the camera recieves is sent to a receiver somewhere else, and that's where it is recorded. SPY CAMERA will be added to the Court Record. Now ask about the "Transmitter". This device sends the footage from the camera elsewhere. The timer attatchment can turn the camera on and off on its own. The camera was set to turn on at 8 PM and to continue on for an hour. That was the time the award ceremont ended. Just perhaps this camera caught the footage of the murder. Judging by the angle of the bear, it may have caught the entire crime easily. TRANSMITTER infomation will be added to the Court Record. Ask about the "Stuffed bear" now. It is unknown who gave the bear as a present. This does mean that somebody caught the footage of the murder. SUFFED BEAR infomation will be added to the Court Record. Gumshoe has an idea. He's going to take the camera and see if he can find who bought it. The Spy Camera and Transmitter will be handed back to Gumshoe. Edgeworth will appear now. He says he heard the entire story, as well as mentioning a rescue team is out searching for Maya. Edgeworth says that the maker of the bear is overseas. Very few of them are exported here. By tracking where the bear came from, we can find the owner. The Stuffed Bear will be handed to Edgeworth. Everything just seems odd now. Juan Corrida's death, Adrian's past, De Killer who is demanding an acquittal for his client Matt Engarde, and the shell card. Save the game. =~=~=~=~=~=~=~=~=~=~=~ Investigation-Part 4-6 =~=~=~=~=~=~=~=~=~=~=~ ---------------------------------------------- Date-March 22 Location-Gatewater Hotel; Corrida's Hotel Room ---------------------------------------------- Pearl questions if Maya has already been found. She seems a bit concerned despite things looking your way, if only slightly. Talk to her about "The real killer". Both of you are sure now that Shelly de Killer is the one who killed Juan. The card seems to be enough proof of that. But then the question of who his client is comes to mind. Whoever the client is is still technically a killer. Ask about "The assassin's client" now. Phoenix thinks it may be Adrian, but if that were true there would be no reason for her to stab Juan afterwards. Now ask about "Was it Matt?". If Engarde did hire De Killer, he would have to be guilty then despite him not killing anybody in his own blood. There were no Psyche Locks on Matt when asked if he killed Juan. Now Phoenix brings up that Adrian mentioned something interesting in court. Ask about "Something interesting". Juan had bet everything on the Jammin' Ninja winning. If he lost, he intended to take down Matt with him. Somehow, Juan got a powerful secret that would destroy Matt's career. Since Juan planned to reveal this secret, Matt would have plenty of motive to kill him, or at least hire an assassin to. You need to visit Engarde now. Head to the Viola Hall. ------------------------------------ Date-March 22 Location-Gatewater Hotel; Viola Hall ------------------------------------ Oldbag meets you here. She says that someone gave her a tracking device and was told to search out the hotel for anything suspicious. The request came from Edgeworth so she doesn't have any real complaints. Talk to her about the "Bug sweeper". She has heard that the camera was found in one of the bears, but she thinks it was to capture Adrian's and Juan's scadalous meeting. She also thinks that Lotta planted the camera inside the bear. Now ask about "Juan and Adrian". Juan really seemed to like his old manager, Celeste. Oldbag says she was supposed to get married to Juan. She killed herself just three days after the marriage announcement. Now ask about "Celeste's suicide" further. Oldbag says she was thrown away by Juan. Juan cancelled the marriage three days after it was announced. She isn't aware of why he cancelled it, however. Head over to the Criminal Affairs Department. ----------------------------------------------- Date-March 22 Location-Police Station; Criminal Affairs Dept. ----------------------------------------------- The chief in here will alert you that the police have found what they have been looking for-a real decisive witness. The chief also says you should know this person well. Edgeworth also has allowed you special permission to visit the Detention Center past visitor's hours. Head over there right now. ----------------------------------------- Date-March 22 Location-Detention Center; Visitor's Room ----------------------------------------- Choose to talk to "Matt Engarde" right now. You won't get any information from Adrian until later. Ask about "Juan and Adrian" right now. He doesn't know or care about Juan's life. Perhaps he is connected to Celeste's suicide. Now ask about "Matt's secret". Five Psyche Locks will appear over Matt. There isn't anything you can do about the Locks right now. Some strong evidence will be required later. Head back to the Criminal Affairs Department. ----------------------------------------------- Date-March 22 Location-Police Station; Criminal Affairs Dept. ----------------------------------------------- You will meet up with Will again. As it turns out, he somehow got himself involved in this mess. Now he's going to testify at tomorrow's trial. Turns out he is the decisive witness the chief mentioned earlier. Ask about "Tomorrow's testimony". Will isn't sure what he is going to testify about, but it must be important from what the police told him. Unfortunately, he isn't allowed to tell you the details. Now ask about "Matt Engarde". Will says that this trial is going to seriously hurt Matt's reputation. He has a sort of player attitude towards women, and usually just calls it a game to reassure others it's nothing. He's also said that one person won't swoon over him; Adrian Andrews. Now ask about "Gossip". Will hears gossip about stars all of the time. Will also says he knows something about Celeste's sudden suicide. Ask about "Celeste's suicide" now. Will thinks that something bad was written on the note, something that would hurt Juan. Before she died, she said to some of her friends that she was caught by an insidious man. This is probably referring to Juan Corrida. That would be reason enough for him to hide the suicide note. Head back to the Detention Center. ----------------------------------------- Date-March 22 Location-Detention Center; Visitor's Room ----------------------------------------- Let's get Adrian's side of the story now. Ask about "Matt Engarde". She mentions you don't know the real him. Now ask about "Celeste Inpax". She says she's finally put her death behind her, and now you have to bring it up. She wanted to get the suicide note and burn it. Now ask about "Why frame him?". She says she did it out of revenge. A single Psyche Lock will appear over her, but you can't unlock it for a while. Head back to the Wright & Co. Law Offices. --------------------------------- Date-March 22 Location-Wright & Co. Law Offices --------------------------------- Phoenix's phone will ring as you enter. Gumshoe says there's a big problem and he's coming to your office. He pops in seconds later. He says that he knows who bought the spy camera. He figured out quickly that he should have been looking into the bear and not the camera. Anyway, he says Matt Engarde bought the bear and the camera. That's totally not good. Ask about the "Stuffed bear" now. He even has the receipt for the purchase of the bear. The clerk even said himself that Engarde bought the bear. CREDIT CARD RECEIPT added to the Court Record. Ask about the "Spy camera" now. SPY CAMERA, TRANSMITTER, and STUFFED BEAR will be re-added to the Court Record. This doesn't bode well. We need to discover why Matt planted this camera. Head back to the Detention Center. ----------------------------------------- Date-March 22 Location-Detention Center; Visitor's Room ----------------------------------------- Phoenix says that it's about time he told you the truth. Present the Magatama and get to the bottom of this mess. ---------------------------------------------- ~Matt Engarde's Magatama Secret-Matt's Secret~ ---------------------------------------------- Matt still protests he doesn't know anything about Juan. You need to present something that shows Matt was paying attention to Juan that night. Present the Spy Camera. Matt now asks where the camera was hidden. Present the Stuffed Bear. The first lock will break. Now Matt starts playing dumb and asks who would have sent the bear. Present Matt Engarde's profile. Matt still doesn't want to have any of his locks break. You need to present proof that he put the camera into the bear. Present the Credit Card Receipt. Matt protests that the money on the receipt could be for an expensive toothbrush he bought a while ago. The second lock will break off now. Now you need to present the reason why he would hide the camera in Juan's room to begin with. Present the Picture Card. Matt quickly says that he doesn't know anyone by the name Shelly de Killer. You need to say how he knows De Killer. Choose "you're his client". Since he set up the camera, he knew everything that was going to happen. The person behind this whole murder is Matt Engarde himself. He then tries to consult "himself" Uh...erm. He thinks it's time for him to reveal his true self. The remaining three locks break and he pulls back his hair, revealing a huge scar there. He also picks up a glass of wine. Now talk about "Matt's secret". He comments that there's no way he would murder Juan himself, so he hired Shelly to do it for him. He also gives props to Adrian for having the balls to pin the crime on him. Matt says he doesn't believe assassins. He knows assassins are above blackmail. Matt now reveals that he plans to use the tape of Shelly killing Juan to blackmail De Killer. The video is his own "insurance". Now ask about the "Motive for murder". Matt did all of this, once again, because Juan was going to screw him over. Then he says that all he had to do was put on an innocent face and he could get anyone to do what he wanted. It worked on Adrian, Shelly, and obviously Phoenix. Engarde says at the end that you still have to win the case, otherwise Maya gets killed. Somehow you need to pin the murder on Matt while at the same time letting De Killer release Maya. Edgeworth appears and brings you to the police station. ----------------------------------------------- Date-March 22 Location-Police Station; Criminal Affairs Dept. ----------------------------------------------- Edgeworth will say this is the moment you will need to decide what your definition of a lawyer is. Ask about "Matt Engarde". Phoenix sort of questions his own motives for getting his clients free up to this point. He disagree's with Edgeworth when saying Engarde deserves a proper trial. We know he is guilty, and that scumball doesn't deserve one. Now ask about "Maya's situation". Edgeworth says the only thing you can do is fight. Now question "Why fight?". Edgeworth restates that the only thing Franziska fights for is her perfect win streak. He then says that when Phoenix destroyed his perfect win record, that's when he started seeing what it really meant to be a prosecutor. De Killer then calls. He asks if you are still capable of getting an acquittal tomorrow. He says that the whole kidnapping situation is his "aftercare". He's completing his client relations to ensure that no harm comes to his clients. He was unlucky this time to have his client arrested. In order to ensure the end would turn out well, he hired Phoenix. Just before the end of the broadcast you will hear a cat meow. This can only mean that Shelly is holding Maya hostage at Matt Engarde's house. Move there immediately! ------------------------------------- Date-March 22 Location-Engarde Mansion; Living Room ------------------------------------- Edgeworth arrives and says the entire mansion has been surrounded. If De Killer is still here, he has no way of escaping. Examine the room now, and focus on the bear sitting on the floor on the right side of the room. There are a lot of cuts in the bear for some reason. FIGURINE will be added to the Court Record. Edgeworth and Phoenix break down the door next to the figurine. This room has all the equipment Maya discovered earlier. Phoenix demands that the tapes be searched for anything important. Convenient that there be a VCR and recieving antennae, eh? There's nothing in the tapes, however. Move to the Wine Cellar. ------------------------------------- Date-March 22 Location-Engarde Mansion; Wine Cellar ------------------------------------- Sadly, De Killer and Maya have already up and left. Examine the object hanging by the bottom of the stairs. It's a picture of Celeste Inpax with the words "With love...Celeste" written on it. The same picture Maya found earlier. CELESTE'S PHOTO will be added to the Court Record. Pearl says there's something written on the back. It reads "Maya". She says that she demands you get Engarde a guilty sentence and not to worry about her, she's just fine. Before you leave, Edgeworth will contact the Detention Center and alert them that you'll need to talk to Adrian one last time. ----------------------------------------- Date-March 22 Location-Detention Center; Visitor's Room ----------------------------------------- Adrian seems to be toying with you and dares you to break her lock. Present the Magatama so we can get the last bit of information we need for this case. ------------------------------------------------ ~Adrian Andrews' Magatama Secret-Why Frame Him?~ ------------------------------------------------ Phoenix says he heard Adrian mention something about revenge earlier. You need to show something or someone that would make her want revenge. Present the Suicide Report. There's only one event in her life that would make her want revenge, and that was Celeste's death. Now you need to present something that links the relation between Celeste and Matt. Present Celeste's Photo. She knows that you found this picture at Engarde's Mansion. The Psyche Lock breaks. Ask about "Why frame him?" now. Celeste didn't want to get married to Juan because of Matt. Celeste was Matt's manager a long time ago. Adrian was working part time back then. That's how the picture turned up. Adrian says that Celeste was just being used, until one day she was thrown away. Celeste was aware a scandal would demolish Matt's good image, so she moved to Worldwide Studios. She met Juan there. Everything seemed fine with him until the wedding was called off. On the night it was called off, Celeste killed herself. That's why she framed Matt. To get revenge for Celeste and herself. Now ask about "Revenge". Juan called off the wedding because Matt confessed his love with Celeste. Matt was waiting for the moment that telling Juan about his previous relationship would hurt him most. Juan discovered her body and suicide note. He hide her note because the note contained a secret about Matt. It would have been damaging to his image. Juan wanted revenge, so he was going to announce what the suicide note contained. Adrian admits she thought Matt was the murderer when she found Juan. She took the chance to search for the suicide note. When she couldn't find the note, she then resorted the revenge. Save the game. The big trial is coming up. =~=~=~=~=~=~=~ Trial-Part 4-7 =~=~=~=~=~=~=~ Just before the trial, Phoenix has the same dream that he had in the opening of the first case. He dreams the Judge deems him no longer worthy of being a defense attorney, and kills him with his gavel. He's going into trial trying to prove a killer innocent... ---------------------------------------------- Date-March 23, 9:43 AM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Phoenix's phone will ring, and Engarde will be on the other end. He taunts you, saying to do your best while Maya's life is on the line. Mia will appear now. Phoenix's phone rings again, this time it's Gumshoe on the other end. He says he was let back onto the investigation team and they are trying to capture De Killer. They have no leads, but they are trying their hardest. If they can get Maya out, then you can safely get a guilty verdict. Gumshoe also says if you work with Edgeworth to stall the trial there still may be hope. ---------------------------------------- Date-March 23, 10:00 AM Location-District Court; Courtroom No. 3 ---------------------------------------- The Judge will recap the events of yesterday's trial. The main question right now is Adrian's role in the murder. It may be possible that she isn't even connected to this crime. Adrian forged evidence to throw suspicion on Matt, then escaped in the Nickel Samurai costume if you remember. Edgeworth then present Shelly's card. He says that Juan was killed by this assassin. Edgeworth then calls Will Powers to testify. He was in the area on the night of the murder and went inside Matt's room. He'll testify about that. --------------------------------------------- ~Will Powers' Testimony-Visit to Matt's Room~ --------------------------------------------- -After the award ceremony, I went by myself to Matt's room. -Matt was standing there in front of his room. still in his Nickel Samurai costume. -He was talking with someone. At first, I thought it was the bellboy. -I watched the two of them for a while, but then I gave up and went back. -I had guests with me that night, and I couldn't make them wait for me. Press the first statement. Will was Matt's mentor, so he wanted to talk to him for a bit. Will will stop talking thinking Phoenix is going to pin the murder on him. Now press the fourth statement where he said he watched Matt for a while. Will says he saw something strange. He saw Matt give the bellboy a tip. Now press the third statement, about how he thought he saw a bellboy. He will say that he didn't seem like a normal bellboy. His line of testimony will change to the following: -Matt gave the bellboy a tip. Press this new statement. Will says that Matt paid the bellboy a large sum. As if that wasn't enough, he even saw the bellboy's face after that. Ask about "Engarde's tip" in more detail. Will can't even guess at how much money was given because it was wrapped up in a huge roll. The Judge starts to make you look suspicious. Choose to "Raise an objection". Edgeworth says that the wad of cash was payment for the murder of Juan Corrida. The bellboy Will say then was the assassin himself. He then present Shelly' business card. Will now says that he saw the bellboy a second time that night. ---------------------------------------- ~Will Powers' Testimony-The Second Time~ ---------------------------------------- -This time, I was in that hallway because I had to go to the bathroom! -And that's when that bellboy I saw earlier came out of the room! -Of course, when I say "room", I mean Juan Corrida's room! -Now that I think about it, that bellboy did seem kinda out of place! -Yeah! So he had to be the assassin! I'm sure of it! Press the fourth statement where Will says the bellboy seemed out of place. The odd thing was that the bellboy was empty handed. Choose to "Try to pull a fast one" here. Edgeworth says that there isn't any reason for them to ever be empty handed. This line of testimony will change to the following: -I thought it was kinda strange for a bellboy to come out of a guest's room empty-handed! Press this new statement. Will thinks it's suspicous because the bellboy was holding a tray when he first saw him. He was carrying a bottle of juice and a wine glass. He says it was tomato juice. Present the Crime Photo here. In the photo you can see the glass of tomato juice as well as the wine glass. All the bellboy did was bring the tray to Juan Corrida's room and drop it off. It was perfectly logical for him to leave with nothing afterwards. Edgeworth says there's one other important detail Will saw. He noticed the bellboy wearing gloves. He says he was wearing suspicous black, leather gloves, which is different from the other bellboy's. --------------------------------------------- ~Will Powers' Testimony-Their Second Meeting~ --------------------------------------------- -After leaving Juan's room, the bellboy went and knocked on Matt's door, just like that. -He gave something to the person inside the room. -Then the old guy just left, without even going into the room. -After that, I went to the bathroom and then back to my seat. Press the second statement, about how the bellboy gave something to the man in the room. You can ask him two options now. "Ask about this 'something'" first. He says it was a small item, but he isn't too sure on the details. Press this statement again and "Ask about the person inside". Will didn't see the face of the person, just the arm. Edgeworth now stops you and recaps the testimony. The bellboy left Juan's room to go to Matt's room, handed him a small item, then left. This moment is important because it reveals what was removed from the crime scene and was handed to Matt. He'll add this line to his testimony: -If I saw it again, I could say for sure, but I think it was some sort of wooden statue. Present the Figurine that you found at Engarde's Mansion. Turns out this small bear is the item that he saw. Edgeworth now proposes that Shelly killed Juan in his room, then stole the wooden bear from the crime scene. It goes without saying that Matt is De Killer's client. The Judge is about to end the trial, but Phoenix says there are points that still haven't been covered. Choose to question further "The bear itself". The bear was found at Engarde's Mansion, but Matt was arrested at the hotel. He hasn't had a chance to go home and place the bear there. It isn't possible for Matt to have taken the bear to the mansion. Edgeworth comes in and says that Engarde's butler was none other than De Killer, which is understandable since they were working together. He assumes Matt had De Killer bring it to his house since it would have been bad if the bear was found at the crime scene. You will be given the three options again on what you think was shaky in Will's testimony. Now question "The person who received the bear". Will hasn't made clear who gave the bear to whom. He remembers now the arm belonged to the Nickel Samurai. The Judge is ready to end the trial because this makes Matt look completely guilty. Choose to "Raise an objection". It is entirely plausible that Matt is De Killer's client, however, there is another suspect. Present Adrian Andrews' profile. She put on the spare Nickel Samurai costume after all, and this easily could have been the hand that Will saw. Edgeworth isn't too sure whether this is true or not. Well of course were lying! We just need to stall for time. Edgeworth then says that the figurine bear hides a big secret that will reveal who the true killer is. He is sure that by making Adrian testify this whole murder will be cleared up. A short recess will be called. ---------------------------------------------- Date-March 23, 11:54 AM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Matt greets you and says he's surprised in your desperate efforts to save Maya that you would resort to pinning the murder on Adrian. Pearl returns and says that Mia was called away. Phoenix's phone rings again. It's Gumshoe once again. Mia comes back and says that she was able to see a circus tent when she was in Maya's body. Gumshoe says the Berry Big Circus is still in town. This must be where De Killer is keeping Maya. Gumshoe will set off right away to rescue Maya. There's nothing left to do but stall court long enough until Maya gets rescued. ---------------------------------------- Date-March 23, 12:05 PM Location-District Court; Courtroom No. 3 ---------------------------------------- Adrian has appeared now, and states that she has seen the bear before. She will tell you the secrets this bear holds. --------------------------------------------- ~Adrian Andrews' Testimony-The Bear Figurine~ --------------------------------------------- -Actually, this is an elaborate puzzle. -If you know the correct order, it can. Press the first statement. You'll find nothing here. Now press the second statement. Adrian will mention how the bear can be taken apart. Now press the third statement. She knows this because she was the one who bought it. She thought it would be a nice present for Juan. Press her fourth statement next. Only her and Juan knew how to solve the puzzle. Press the final statement. FIGURINE will be updated in the Court Record. After pressing all the statement, Phoenix will give up finding a contradiction. Now Edgeworth asks what is inside of the bear. Adrian opens up the bear and finds a note inside. Not just any note, but Celeste Inpax's suicide note. It was, as suspected, hidden by Juan himself. Celeste even signed this note. Adrian actually knew about this note already. That's why when she found Juan she wanted to quickly find the bear and note and destroy it. She couldn't find it because De Killer already took it. The Judge will read the note aloud. You already know the gist of the story, though. Now Edgeworth present Matt's motive for murder. Since Juan was going to reveal the contents of this note, Matt had to stop him at all costs. CELESTE'S SUICIDE NOTE will be added to the Court Record. De Killer was hired to get this note and kill the person who had. Engarde hired him, clearly. You are capable of going more indepth to one of the major pieces of evidence. Choose "Celeste's Suicide Note". There's a slight contradiction here. How did Matt learn what was written on the note? Egdeworth presents the spy camera that Matt setup. Juan was being spied upon, and this is how Matt learned of what was contained on the note. Edgeworth then says the camera he has isn't the one from the stuffed bear's eye. He went to Engarde's Mansion to search for more clues and found the Matt's fingerprints on the camera. Mia says, however, these is still one piece of evidence that requires more investigation. Choose to "Present evidence". Present Celeste's Suicide Note. The handwriting on the note has yet to be analyzed. It may not even be Celeste's at all! Gumshoe finally calls. Sadly, De Killer managed to escape. His hideout was discovered, but him and Maya have already up and left. Gumshoe then demands to talk to Edgeworth. Yeah, that doesn't go over so well. The Judge calls off the court proceedings for the day, but then Edgeworth objects. He will call a final recess for the handwriting analysis. ---------------------------------------------- Date-March 23, 2:04 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- You'll meet up with Edgeworth right away. Phoenix's phone rings again. Gumshoe reports that De Killer left behind several things in his desperate attempt to escape. He says that he has the items and is bringing them over as evidence as we speak. He should be here in about 20 minutes, just barely enough time before court reconvenes. A loud bang can be heard from the phone and the line goes dead. Looks like Gumshoe just crashed into something. Is there any way you can find his location? Choose "There is a way." Present Franziska's profile. She has a tracking device installed on Gumshoe, remember? Edgeworth leaves to find the results of the handwriting analysis. Save the game now. =~=~=~=~=~=~=~ Trial-Part 4-8 =~=~=~=~=~=~=~ ---------------------------------------- Date-March 23, 2:35 PM Location-District Court; Courtroom No. 3 ---------------------------------------- Edgeworth doesn't seem so happy when you enter court. The note has ended up to be a forgery. It wasn't written by Celeste Inpax. He then says the handwriting matches that of Juan Corrida. Looks liek Celeste never did leave a suicide note. However, Matt could not have known this note was a fake and the main facts remain unchanged. Phoenix thinks something is wrong with this. Choose to "Present evidence". Present the Spy Camera. If Matt had spied on Juan, he would have known as well that the note was a fake and wouldn't go to the trouble of killing him over it. Matt's main motive for murder has now completely changed to something unknown at the moment. Edgeworth states that it could have been written at an unknown place, and Phoenix demands he present evidence to back that up. He then says he has onle final witness, and this one isn't normal. It's the one person that can answer who hired Shelly de Killer. He is actually going to make Shelly de Killer testify. Well, via a radio transceiver, at least. He makes Maya speak into the radio to prove that he is De Killer. He then says he did kill Juan Corrida at the request of a client. ---------------------------------------------- ~Shelly de Killer's Testimony-About My Client~ ---------------------------------------------- -There is something I must first state. -To an assassin, nothing is more important than the trust between a client and himself. -And that is the reason I am here today on this witness stand. -It is my wish that you grasp this concept before I give the name of my client. Press De Killer on his second statement, about his trust. Phoenix asks if anyone has ever stabbed him in the back, and De Killer says that if one of his clients did so, they wouldn't be his client for very long. Now press the third statement. He says that he's fine with saying the name because his client broke the rules by trying to pin the crime on someone else. Now press the second statement again. De Killer thinks you understand his logic since one of his clients broke his trust, so he's going to go back on his word. This next line of testimony gets added: -Now then, I do believe it's about time I revealed the name of my client, don't you agree? Press this new statement, of course. He says that Adrian Andrews is his client. Wait...what? Isn't it Engarde? What the hell? Looks like De Killer just stabbed Edgeworth in the back. Adrian comes in and says that everything De Killer said was a lie. The Judge will ask if you want the trial to continue a little longer. Choose "Request the trial continue". De Killer will be contacted again. He'll go indepth about his client. ----------------------------------------------------- ~Shelly de Killer's Testimony-About My Client, Pt. 2~ ----------------------------------------------------- -As I have already stated quite a few times, Adrian Andrews is my client. However. -One thing I simply cannot overlook is tampering with the scene of the crime. -My client did it to frame another for the crime. -While pretending to be the first person to discover the body and enter the scene, -Adrian Andrews already knew from the very beginning that Juan Corrida was dead! -But even more appalling is the creation and planting of the "knife" and "button". -That act is what I was referring to when I said my client has "broken the rules". Present the Wine Glass at the fifth statement, when De Killer says Adrian knew Juan was dead. When Adrian entered the room, there's no way she knew that Juan was dead. Had the glass been planned, then there wouldn't be fingerprints at all. If Adrian was really his client, she would have known about his death. This only means that Adrian couldn't be his client. Looks like we just need to have De Killer play along a little longer... --------------------------------------------- ~Shelly de Killer's Testimony-Request Taking~ --------------------------------------------- -This request came to me...oh, about a week ago. -It was a request for my services on the night of the awards ceremony. -We met at a certain bar to discuss and finalize a few matters. -That is what occurred. I trust my memory, and I believe I have made no mistakes. Press his third statement, about meeting the client in a bar. De Killer stops talking for a second. "Press further" when asked. The Judge will ask if any of this is important. Choose "It is not important" for now. De Killer says that by talking face to face with him that he builds trust. The Judge will ask again if this was important. Choose "It was very important". The following line of testimony will be added: -From the moment I saw him, I thought, "I can trust this person as a client." Present Adrian Andrews' profile here. I'm pretty sure Adrian is a woman, not a man. There's no way he could have met Adrian Andrews if he thinks she was a guy. The problem here is that Adrian can be either a man's or woman's name, so De Killer made the mistake of assuming it was a guy. Now he says he confused Adrian with another client, and will speak for real. ---------------------------------------------------- ~Shelly de Killer's Testimony-Request Taking, Pt. 2~ ---------------------------------------------------- -Yes, now I remember. I took that request by mail. -There have been times when I took a job without having met my client. -The request was for the murder of Juan Corrida and 2 or 3 other small things. -When I saw the name at the end of the letter, I thought my client to be a man. Press the third statement, about the request to kill Corrida amoung other things. He says these things have nothing to do with the current case. "Press further". De Killer now asks why you have continued this cross examination when everything he has said has been beneficial to Engarde. Now he starts thinking that you are about to betray Matt. Choose to "Press further" even though it seems suicidal. He mentions the bear figurine. After the assassination he was told to find the figurine. The figurine was inside Juan's suitcase. Then he gave the bear to the client. His line of testimony will change to this: -One of these was to find the bear figurine and to give it to Adrian Andrews. Press this new statement. De Killer says he was waiting for Adrian at Engarde's Mansion. Choose "There is a contradiction" when the Judge asks if there's a problem with this. Mia says you will need to present strong evidence to keep this going. Choose to "Present evidence". Present the Figurine now. If he had really given the bear to him, the fake suicide note wouldn't be inside of it. Adrian says if she got her hands on the note, she would have burned it. By the fact that the note was still in the bear, the client didn't know how to disassemble the bear. It is now impossible for Adrian to be his client. De Killer then states that unless you do something, and fast, he will kill Maya. Edgeworth then rests his actions. Engarde is brought to the stand and reveals his true self. Phoenix then must decide if he wants to keep going for this verdict. Choose "Guilty". Stupid ass. Before you get the chance to announce it... Franziska makes a huge entrance into the courtroom. Wow, she actually managed to help us with something. Dayum. The final pieces of evidence you need are within Gumshoe's coat. The first item Franziska presents is a pistol. Phoenix will wonder if this is important. "Question for more details". She thinks this is the pistol used to shoot her. PISTOL will be added to the Court Record. The second piece of evidence is a video tape. "Question for more details". There was no time for her to check the tape. De Killer must have wanted it because he came back to his hideout to retrieve it, but failed. VIDEO TAPE will be added to the Court Record. The last piece of evidence is the bellboy's uniform. "Question for more details". She's almost certain that this was used during the crime. There's even a pair of black gloves in it. She also says a button is missing from the uniform. BELLBOY'S UNIFORM will be added to the Court Record. Sadly, the question here is who was the client and not who did the killing. These items can't be used. Mia says there is a way to make a miracle happen. There are two ways out of this situation. First, you can make Matt Engarde WANT a guilty verdict. The second way is to make De Killer end his contract with Engarde. If he didn't want Engarde as his client, he wouldn't follow him anymore. The Judge says he doesn't need the evidence. So, who does? It's time to save the game. Your final action will determine which ending you get. =========================================================================== ~9.The Good and Bad Endings~ =========================================================================== From the previous point I have mentioned to save, you have the option of either getting the Good Ending, or the Bad Ending, depending on your next action. I recommend you see both of them at least once. Once you get an ending you can restart from the save point and get the other ending. We'll start with the bad ending so you have something to look forward to when you see the depressing ending screen. =~=~=~=~=~ Bad Ending =~=~=~=~=~ If you want this ending, don't present De Killer's profile and you will ensure you get this ending. Choose to present any item after that. The Judge will then announce his verdict of Not Guilty on Matt Engarde. Adrian Andrew's goes to jail then. Just like that, the trial is over. Phoenix runs away from the courtroom afterwards, never to see Maya again. He knows that she would be released, though, since De Killer is a man of his word. Now you get the best sentence ever in an ending screen. "The miracle never happen". Way to screw up a bad ending, huh? The case ends after that. No credits, just one sad screen to leave you thinking about your awful choice. Go restart from the save and get the exciting, good ending now! =~=~=~=~=~= Good Ending =~=~=~=~=~= The Judge will give you one last chance to turn the entire trial around. You need to free Maya and get Engarde a guilty verdict at the same time. Present Shelly de Killer's profile as the person you want to show evidence to, then present the Video Tape as the thing you want to show him. Edgeworth will say that this may be of some interest. De Killer will be brought in again. De Killer was told to protect the video tape at all costs from his client. De Killer was told not to watch the contents of the tape, so he doesn't know what they are. Surprisingly, De Killer is the one on the tape. The video was set at the crime scene, and all of his actions were being recorded. The only person who could have planted the camera was his client, Matt Engarde. He purposefully specified the time of murder so he could catch De Killer on the tape. De Killer asks why Engarde would do this. Choose that Matt "wanted blackmail on you." He never trusted De Killer at all, so he was going to use the tape as blackmail. That's what Matt is good at; lying and deceiving others. De Killer says since his own client is a traitor, he would end the contract right away. The client would then become his next target. To keep his name he would ensure the traitor would get what's coming to him. De Killer hangs up, saying his contract is over. He says he'll gladly return Maya. Well, this wraps up the trial. Matt got the acquittal he wanted, but an assassin is going to be out to get him the rest of his life. "Plead guilty" here. Engarde then goes insane and claws the hell out of his face. What a great ending animation. Adrian appears at the end and says that she felt saved when Phoenix and Edgeworth teamed up to defend her. ---------------------------------------------- Date-March 23, 5:14 PM Location-District Court; Defendant Lobby No. 3 ---------------------------------------------- Mia says there's more to just a not guilty verdict. She says the difficult choice he had to make defines what he think it meant to be a lawyer. Edgeworth appears and says that Maya is safe and sound. Pearl appears and is delighted to know that. Franziska appears and says you should have nothing to be happy about since you lost. Edgeworth says that perhaps one day she will be able to understand. He retells his story from the previous game, and says even the prosecutors would need to have faith in the defense attorneys. Phoenix says he felt betrayed when Edgeworth suddenly left. He told himself that Edgeworth had died, instead of really thinking of the matter. Franziska says that neither Edgeworth nor herself are worthy of the Von Karma name. Franziska runs away, dropping her electromagnetic receiver. She also dropped her whip. Maya appears next. Oh what a happy reunion. Edgeworth then says he's glad Maya turned out fine. Then Maya demands that you all go out for food. ------------------------------------- Date-March 23, 7:38 PM Location-Gatewater Hotel; Hotel Lobby ------------------------------------- You'll meet Gumshoe as you arrive. Turns out the fool hit a telephone pole. Good job. Lotta and Will are here to congratulate you as well. Lotta seems to have bought herself a new camera, and everyone heads to the Viola Hall. Will mentions that the three items saved the day, and Gumshoe stops. He says he found four items, not three. Maya said to keep her mind off of being kidnapped she drew a picture. She doesn't know where it went, however. Franziska's electromagnetic receiver goes off again. Even though Gumshoe is standing right here, the device is pointing elsewhere. You can present evidence to show Edgeworth how you feel. Present Franziska's Whip. She helped bring this case to an end as well. Everyone then says they bought something in Phoenix's name, leaving him totally confused. Maya says you should just let it all out. Yell "OBJECTION!" into the mic and enjoy the credits! ------------------------------------------ Date-March 23, 9:42 PM Location-International Departures; Gate 12 ------------------------------------------ Edgeworth meets up with Franziska at the airport. Franziska doesn't care much about the last item since the case is over. She also points out she has quit being a prosecutor. She then says her revenge was to beat Phoenix and become better than Edgeworth. Franziska finally takes her leave, and she presents the last piece of evidence-the picture Maya made. That's the end of the game! =========================================================================== ~10.Frequently Asked Questions~ =========================================================================== These are just a group of questions that I see asked on the message boards quite often. If it can't easily be answered elsewhere, you can probably find the answer to your simple question here. Q:Why do most people hate this game compared to the original? A:There's only four cases to this game compared to the original's five. Also, the first three cases in this game are complete and utter crap in many people's eyes, making just the fourth case the only great case in this game. The original Phoenix Wright had three good cases. Q:I can't find this game anywhere! A:EBay, Amazon, Play-Aisa, those are just three of the websites you can easily buy this game from if you really can't find it anywhere. Also, due to the lack of replay value it's highly likely you can find this game used at some retailers. Just do a little hunting and resort to buying off of the internet as a last resort. Q:Is there any difference between the good and bad endings? A:The bad ending has a really horrible grammar mistake that totally ruins the mood, but other than that it's just a nice effect to have two different outcomes. For those curious, the third Phoenix Wright game takes place after the good ending, so I recommend you at least get that ending once. Q:Why must all of these cases be murder cases? A:What else COULD they be? It's not like you can accuse someone of giving someone else a heart attack or something. Case 2 changed it up a bit by making it a car accident, but other than that it isn't like the entire case revolves around the death. Any player should know that these cases go much further than that. Q:What makes Edgeworth so great? A:He just is. It's difficult explaining the opinions of others but...if you have played the first game you should know he's badass. Edgeworth is also far less annoying than Franziska and Manfred von Karma (Although Manfred has his own level of badassery reserved for him). Q:How do I reset the game? A:Hold down the B and R buttons as you load up the game. You'll be asked to confirm if you really want to erase all saved data. Like any other game, erased data cannot be recovered. You will have to unlock the cases manually again if you erase the game. =========================================================================== ~11.Credits~ =========================================================================== Myself-For putting the time to make this You, the reader-For making this walkthrough seem worthwhile. Good to know I helped you. CJayC-For hosting the greatest website to hold such walkthroughs like this. This walkthrough is Copyright Deathborn 668.
http://www.gamefaqs.com/ds/933086-phoenix-wright-ace-attorney-justice-for-all/faqs/49150
CC-MAIN-2015-06
refinedweb
52,053
85.08
Question: No module named Gnuplot 1 Hi, I'm trying to generate a chart using "Bar chart for multiple columns" but it gives me error: Traceback (most recent call last): File "/galaxy-central/tools/plotting/bar_chart.py", line 26, in <module> import Gnuplot, Gnuplot.funcutils ImportError: No module named Gnuplot ADD COMMENT • link •modified 2.7 years ago by Jennifer Hillman Jackson ♦ 25k • written 2.7 years ago by vebaev • 130 Hello, This is on a local Galaxy, correct? Make sure you are running the latest version of Galaxy: Thanks, Jen, Galaxy team Yes, a local one, it is version 16.01 via Docker -
https://biostar.usegalaxy.org/p/16717/index.html
CC-MAIN-2021-43
refinedweb
104
66.33
#include <fs.h> #include <tinyformat.h> #include <threadsafety.h> #include <util/string.h> #include <atomic> #include <cstdint> #include <list> #include <mutex> #include <string> #include <vector> Go to the source code of this file. Definition at line 191 of file logging.h. Return true if str parses as a log category and set the flag. Definition at line 169 of file logging.cpp. NOTE: the logger instances is leaked on exit. This is ugly, but will be cleaned up by the OS/libc. Defining a logger as a global object doesn't work since the order of destruction of static/global objects is undefined. Consider if the logger gets destroyed, and then some later destructor calls LogPrintf, maybe indirectly, and you get a core dump at shutdown trying to access the logger. When the shutdown sequence is fully audited and tested, explicit destruction of these objects can be implemented by changing this from a raw pointer to a std::unique_ptr. Since the ~Logger() destructor is never called, the Logger class and all its subclasses must have implicitly-defined destructors. This method of initialization was originally introduced in ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c. Definition at line 17 of file logging.cpp. Definition at line 15 of file logging.cpp. Definition at line 38 of file logging.cpp.
https://doxygen.bitcoincore.org/logging_8h.html
CC-MAIN-2021-43
refinedweb
211
59.8
View variables in imported module I'm importing a module containing control variables for a program and I wonder whether there is a way of interrogating them at a breakpoint (as with 'Stack Data') from pgvars import Pgvars as pgv . . if pgv.value_1 == 'A': pgv.Value_2 = '123' else: pgv.value_2 = 'abc' . if pgv.value_2 == 'abc' # breakpoint at the breakpoint I can display the individual variables in 'debug probe'. Is there a way of viewing all variables in 'pgv' ? I feel that this is an elementary question but can't find an answer. I'm running Python 3.5 on Xubuntu 18.04 using Wing Pro 6.1.2.1
https://ask.wingware.com/question/130/view-variables-in-imported-module/?answer=285
CC-MAIN-2022-33
refinedweb
109
68.97
So I have decided to put down the ms c++ and go linux for my first program this semester. It went well, got the hang of emacs,g++, and gtb. I was thinking "Hey , I can deal with this stuff. No need to usw MS product for my stumble through the C++ programming". There is just one problem here. How do set my main arguments when I run my program. Here is my code. when I run a.open 40. It prints 2.when I run a.open 40. It prints 2.Code: #include <iostream> #include <string.h> using namespace std; void convert(int input,int base, int counter); void add(int); void report(); int main(int argv, char*argv[] ) { cout<< argv<<endl; // print to test argument ... .... ..... Any ideas would be great. Thanks
http://cboard.cprogramming.com/linux-programming/60758-arguments-main-printable-thread.html
CC-MAIN-2015-35
refinedweb
133
96.59