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
You can subscribe to this list here. Showing 5 results of 5 Hi Martin, Not really, as the parser is just producing (very complex) mxTextTools tagging tables. Normally what I do is write test frameworks that parse with the lower-level productions, working up to the highest-level productions. Sprinkling cuts (!) throughout (where there is an actual "this must be here if you got this far" constraint) can also make it easier. The parser will then complain when it can't get past that point. Will respond to previous message in a sec... Mike Martin d'Anjou wrote: >Hi, > >Is there an option for printing what the parser does, I seem to be quite >good at creating infinite loops without knowing, so I can at least figure >out what my bad productions are? > >Thanks, >Martin > > _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder Hi, Is there an option for printing what the parser does, I seem to be quite good at creating infinite loops without knowing, so I can at least figure out what my bad productions are? Thanks, Martin Hi, There is not much activity here, I hope there is someone watching! I am really struggling with the "!" Error on fail (cut), I hope someone can help me. I keep getting an 'Expected syntax: builddecl' error when I run the following. I know I am getting it because I introduced a "!" after 'builddecl', but I don't understand why it would be an error. Maybe my EBNF is all wrong. I have supplied the shortest example I could create that reproduces the problem below. Thanks in advance to anyone who can I have the following EBNF definition in a file called biz.def: file := ts, section, ts, section* <ts> := ( [ \011-\015]+ / hash_comment )* <ws> := [ \t] section := builddecl!,elementdecl!,elementdecl* builddecl := ws*,'build',ws+,name,ws+,'on',ws+,planet,ts elementdecl := ws*,'element',ws*,'=',ws*,item,ws+,'is',ws+,quality,ts name := identifier planet := identifier item := identifier quality := identifier identifier := [a-zA-Z_],[a-zA-Z0-9_]* I have the following text I try to parse with it: # this is the file I try to parse build cars on pluto element = door is red element = seats is leather And here is the program to parse it: import os from sys import stdin, stdout, stderr from simpleparse import generator import simpleparse.common.comments import simpleparse.common.numbers from mx.TextTools import TextTools import pprint input = stdin.read() decl = open('biz.def').read() parser = generator.buildParser(decl).parserbyname('file') taglist = TextTools.tag(input, parser) pprint.pprint(taglist) stderr.write('parsed %s chars of %s\n' % (taglist[-1], len(input))) if taglist[-1] != len(input): print "ERROR near line",input[:taglist[-1]].count('\n') Thanks, Martin d'Anjou
http://sourceforge.net/p/simpleparse/mailman/simpleparse-users/?viewmonth=200307&viewday=16
CC-MAIN-2016-07
refinedweb
454
58.18
06 May 2011 13:44 [Source: ICIS news] LONDON (ICIS)--There is a danger that overinvestment in petrochemical expansions in ?xml:namespace> Large amounts of capacity additions, coupled with more moderate economic growth in The current favourable conditions for the chemical industry globally are making companies undertake major expansion decisions without considering the possibility that those decisions will contribute to a down cycle, he said. “We are more and more concerned at BASF about an increasing risk of overbuilding once again. We currently see a risk that people are becoming too ambitious, enthusiastic and optimistic. And that could lead us to where we have already been in this industry.” He added: “The cycles are not self-created by magic; it’s the industry which creates them. Overcapacity will be bad news for all of us, as it will lead to margin erosion and then it will come down to who has what cost position. When you’re in that position, that’s when the fun stops.” He said BASF would be comfortable because its verbund philosophy – the interlinking of production plants – gives it a competitive edge, adding: “We are very optimistic and positive about Asia, and this word of warning does not imply a negative outlook for BASF in “But industry has a responsibility to look at cycles as man-made: we create them, they are not thunderstorms. I feel optimistic that people are able to learn from the past.” Penkuhn said a variety of announcements on petrochemical investments have been made in He said the Chinese government’s attempts to control inflation by tightening monetary policy are necessary but will have a negative impact on manufacturing growth. “They cannot have inflation above 5% and they need to cool their economy,” he said. But this policy is leading to a lot of speculative manufacturing, as companies rush to produce goods before obtaining credit become more difficult. “We feel that underlying GDP growth in Penkuhn said he believes that over the next decade the chemical industry in He dismissed talk of a “supercycle” for chemicals. “At the risk of being blunt, I don’t believe in the ‘supercycle’ story at all. It discounts environmental and demographic risks, also political risks such as the Penkuhn warned that long-term demographic trends in “They only have 20-25 years to go until they have a real aging problem like the Germans do. All their political stability is based on growth and young people wanting to make a living. When they become old, what’s next?” BASF released its first-quarter financial results on Friday, posting net income of €2.41bn ($3.49bn), up from €1.03bn in the same period in 2010. ($1 = €0.69) For more on BASF,
http://www.icis.com/Articles/2011/05/06/9457799/BASF-warns-on-overexpansion-in-Asia.html
CC-MAIN-2014-49
refinedweb
456
51.28
This section describe about daemon thread in java. Any thread can be a daemon thread. Daemon thread are service provider for other thread running in same process, these threads are created by JVM for background task. Any thread created by main thread that run the main method is by default user thread because it inherit the daemon nature from its parent thread from which it is created. Any thread which is created by user thread is user or non daemon thread only, until setDaemon(true) method is true. Thread.setDaemon(true) will create a daemon thread but it can be called only before thread is started or it will throw IllegalThreadStateException if thread is already started and running. The java.lang.Thread class provide two method for daemon thread as follows : Main purpose of daemon thread is to provide services for background task of user thread if there is not any user thread then JVM will terminate the daemon thread. Example : A code for creating Daemon Thread public class DaemonThread extends Thread { public void run() { System.out.println(Thread.currentThread().getName()); System.out.println(Thread.currentThread().isDaemon()); } public static void main(String args[]) { DaemonThread ob1=new DaemonThread (); DaemonThread ob2=new DaemonThread (); ob1.setDaemon(true); ob1.start(); ob2.start(); //ob2.setDaemon(true);// Not allowed it will throw an exception. } } If a user thread is set true to setDaemon() method for creating daemon thread, then it will only allow before thread is started or else it will result an error. Output : After compiling and executing the above program If you enjoyed this post then why not add us on Google+? Add us to your Circles Liked it! Share this Tutorial Discuss: Daemon Threads Post your Comment
http://roseindia.net/java/thread/java-daemon-threads.shtml
CC-MAIN-2014-41
refinedweb
284
52.6
Docs | Forums | Lists | Bugs | Planet | Store | GMN | Get Gentoo! Not eligible to see or edit group visibility for this bug. View Bug Activity | Format For Printing | XML | Clone This Bug Wondering why my scripts in /etc/apm/event.d are no longer being run during suspend/resume, I found that run-parts no longer works on my x86. As detailed @ I added =sys-apps/debianutils-2.13.1-r1 to my /etc/portage/package.mask file and re-emerged debianutils, effectively downgrading debianutils to the next version. Version 1.16.4 works fine. Unfortunately, the failing run-parts does not give any error information. It stays completely silent when run with the --test or --list flags and is unable to locate any scripts in the directory given on the commandline. seems it hates it when you have a file with a '.' in the name > seems it hates it when you have a file with a '.' in the name It sure does. I was just about to file a bug on it to open up the matter for discussion then I saw this. The problem is this, when run-parts is run *without* the --lsbsysinit parameter then it will accept scripts that "consist entirely of upper and lower case letters, digits, underscores, and hyphens." However, if this parameter is supplied then it will accept scripts that fall into the following namespaces (regexes shown): LANANA-assigned namespace: (^[a-z0-9]+$) LSB heirarchical and reserved: (^_?([a-z0-9_.]+-)+[a-z0-9]+$) Debian namespace: (^[a-z0-9][a-z0-9-]*$) Frankly, the "LSB-compliant" behaviour makes a hell of a lot more sense to me. It seems common for various packages in various distros to append the ".cron" suffix to some cron scripts and Gentoo is no exception. I know of one situation where this causes breakage: app-admin/logrotate provides a "/etc/cron.daily/logrotate.cron" script. The sys-process/anacron package makes use of run-parts and the stock /etc/ancrontab calls run-parts without the parameter, the result being that logrotate is never run by anacron (well, I had a great deal of fun (?) trying to track that one down for one user who was complaining of this problem ;) vixie-cron is not affected by the issue. I don't know which other packages use run-parts, if any, but this is a problem IMO. The point is that this isn't Debian and we cannot categorically state that cron scripts provided by packages (or even commonly provided by users) will fall into the rather strict "Debian" namespace. I, for one, rather like the convention of appending the ".cron" suffix. I _really_ think that there should be a way for the LSB-compliant behaviour to be stipulated as a default. In fact, some guy already raised the matter as a Debian bug (albeit not in much depth): The number of pending bugs on that package in their BTS does not make me feel confident that any real discussion concerning the matter is going to arise soon! I'm going to file a separate bug on anacron and propose a default config file that would invoke run-parts with the --lsbsysinit parameter and reference this bug as background material. Also, I researched the way in which Red Hat do this and they don't use debian-utils at all. I'm attaching their run-parts script here *purely* for informational purposes (from their cron-tabs packages and equivalent in both Fedora and RHEL). I'm not suggesting that we should adopt the same approach; Debian's seems more complete and better thought out. Created an attachment (id=61660) [edit] run-parts (script from RHEL4/FC4) Attached for informational purposes. Bug 96730 indicates that this change in behavior is on purpose ... try running with the '--lsbsysinit' option oops, didnt see your previous comment ;) Sorry guys, the information I gave here was somewhat erroneous (got a heads up at). I based my conclusion that the "LSB heirarchical/reserved" namespace resolved the issue upon my experiences trying to help someone who was having difficulty with the "logrotate.cron" script. Unfortunately, it transpires that the script itself had been renamed and was thus compliant with the Debian namespace anyway. But I had thought that throwing in --lsbsysinit had done the trick :( So I'm re-opening this basically for two reasons: 1) To explain (correctly this time I hope) what the situation is. 2) To enquire what the best thing is to be done about it. OK, so I should really learn to pay closer attention to others' regular expressions ... the purpose of "(^_?([a-z0-9_.]+-)+[a-z0-9]+$)" is to enforce the LSB/heirarchical namespace and is the _only_ one that allows a fullstop to be used in any way. But in a particular way. For example "gentoo.org-foo" would be valid whereas "gentoo.org-foo.sh" and "gentoo.org-foo.cron" would not be valid. The official LSB blurb can be found here: The implication seems pretty clear; the upshot is that suffixes of the kind that we've been used to are out. Script names are supposed to be registered via LANANA wherever possible (if in common use) otherwise the heirarchical namespace is encouraged such as "gentoo.org-foo" (which presumably reflects the orientation to the specific distro). So what should be done about it? I daresay that not many packages in portage are affected by this (I only know specifically of logrotate though there may be some others). So they could just have their "suffixes" chopped off perhaps (almost sounds painful). But there is also the broader implication of whether we might be able to do a better job of following this LSB stuff? Or is it a crock of dung and not worth the bother? So what to do next ... opinions? Here's the "official" LANANA list too if anyone's interested: Perhaps it would be a good idea to add some ewarn noise about this. Attaching an example patch against debianutils-2.14.1.ebuild. Created an attachment (id=63110) [edit] debianutils-2.14.1-namespace-warning.patch Warn the user about changes introduced >=debianutils-2.2. other than adding a warning to debian-utils as you proposed, i dont really see what else should be done Well for example, there is no mention of this topic in the Developer Handbook (which doesn't really discuss anything other than ebuild design). The unofficial "Gentoo Developer Guide" at simply points to a section in the handbook:. And that doesn't discuss any form of name standardisation whatsoever. I realise that this might seem like small potatoes in the great scheme of things but consider that this change in debianutils has already demonstrably caused user confusion (at least in the forums, here in bugzilla, and in the form of the conversation I had with the fellow anacron user on IRC). Take a look at this: $ cd /usr/portage && find -iname "*.cron" ./mail-filter/dspam/files/dspam.cron ./app-portage/esearch/files/eupdatedb.cron ./net-mail/qmail-notify/files/qmail-notify.cron ./app-antivirus/vlnx/files/uvscan.cron ./app-admin/tmpwatch/files/tmpwatch.cron ./app-admin/logrotate/files/logrotate.cron ./app-admin/tripwire/files/tripwire.cron ./sys-apps/man/files/makewhatis.cron ./media-tv/mythtv/files/mythfilldatabase.cron ./app-text/man2html/files/man2html.cron ./net-analyzer/vnstat/files/vnstat.cron ./net-nntp/leafnode/files/texpire.cron ./net-nntp/leafnode/files/fetchnews.cron ./app-forensics/rkhunter/files/rkhunter.cron ./app-forensics/chkrootkit/files/chkrootkit.cron ./sys-libs/libtrash/files/cleanTrash.cron ./sys-fs/raidtools/files/raidtools.cron ./net-proxy/squid/files/squid-r1.cron None of these will work with run-parts anymore and will, at least, completely fail to be executed by anacron. Also, The awareness of this issue seems generally low so what's to stop something being committed in the future which falls foul of these changes? So to clarify what I was getting at: 1) I was enquiring if perhaps a better job could be done of following LSB recommendations when it comes to this topic in general. I'm not suggesting anything in particular here (I'm just another Joe Nobody) but wanted to raise the question and was interested in what you had to say. 2) If not, then I'm assuming it's a case of "we go on as usual, but take care to stick rigorously to names that match (^[a-z0-9][a-z0-9-]*$)" (except for various init.d scripts). 3) Either way, I think that perhaps just a paragraph or two on the topic would not hurt. If it prevents even one mistake from being made in the future or prevents just one more user hitting bugzilla/forums then wouldn't it be worthwhile? 4) Adding a warning to the ebuild seems prudent (although I'm not sure how many people read their enotices closely). 5) All in all, I'd like to know how the problem with the *.cron scripts should best be addressed because I'd like it fixed. May I start filing bugs against each package affected suggesting that the ".cron" extension is dropped? Is there a better way? Please throw me a bone :) With regard to (3) I realise developers are busy people so I'd be willing to bash out something on this and attach it here if interested. Adding cron herd - hope that's OK. imo imposing naming restrictions on files in /etc/cron.*/ is retarded i use dcron personally and have never experienced these kind of issues ... what cron packages use run-parts anyways ? vixie-cron, and i dont know if the cron people added the stuff for /etc/cron.* for dcron, etc as well ... I say we just rip that bit out run-parts ... create a new namespace (call it Gentoo-no-bs) and set it as the default ? That I know of? anacron, as explored on bug 96730 (which unfortunately still applies - yes, it was partly my fault that it was believed resolved but hey, I'm not perfect). Some of us actually do use anacron. And having it not run a bunch of cron scripts because of this new naming restriction is a bug - plain and simple. Let me be frank: I expect things that use run-parts to work out of the box and other users surely feel the same. So, as far as the anacron issue goes, it really is quite simple: 1) Stop using run-parts in the anacrontab (use an alternative - such as the example script from Red Hat or whatever <shrug>) 2) Rename the scripts themselves (at least, that's been ruled out now) 3) Modify run-parts to be more tolerant (hacking up debianutils) What other alternatives could there possibly be? Perhaps I should have re-opened the other bug first in which case I apologise. I am only trying to help. But I can definitely state that at _least_ 18 different packages provide cron scripts which will not be executed by anacron. As for whatever else uses run-parts I really have not the faintest idea. <create a new namespace (call it Gentoo-no-bs) and set it as the default ?</quote> Attaching a patch that does exactly that ... Created an attachment (id=63185) [edit] Allow for periods in the "classical" namespace Allows for periods in the "classical" namespace (that which is in effect when the --lsbsysinit is *not* used). Also updates the manpage and adds some Gentoo Technologies copyright blurb. Bah, I meant to write "Gentoo Foundation", not "Gentoo Technologies". Adding patch again. By the way, if this approach was used then the action taken in bug 96730 would need to be reversed. That would completely solve my beef apropos of anacron. Created an attachment (id=63186) [edit] debianutils-2.14.1-no-bs-namespace.patch Cite "Gentoo Foundation" in the manpage, not "Gentoo Technologies". Created an attachment (id=63187) [edit] debianutils-2.14.1-no-bs-namespace.patch (+veto filenames beginning with period) Similar to attachment 63186 [edit] but does not allow the filename to begin with a period (this prevents it from attempting to execute hidden files including ".keep" whilst maintaining a high level of naming flexibility). Updated manpage to reflect that. Patch looks all right. I removed the copyright stuff though, as that might be more of an issue. Fixed in -r1, thanks. Thanks Martin. I've re-opened the anacron bug asking to revert the changes. Should be OK to do that ahead of the debianutils bump being marked stable because, as I already stated, the use of the "--lsbsysinit" parameter to attempt to solve the problem was erroneous anyway.
http://bugs.gentoo.org/95173
crawl-002
refinedweb
2,112
63.49
“Good artists copy; great artists steal” –Steve Jobs Every Windows Phone developer who has non-tech friends, relatives or a wife with a Windows Phone knows the problem: a lot of users don’t check their Store regularly and simply don’t update their apps – or at least not often enough. The highly intelligent Pedro Lamas – Senior Nokia engineer, author of the CimbalinoWindows Phone toolkit, and my personal savior when I ran into some very exotic problems with Nokia Music – recently described a way to automatically check for updates inside the app.With his permission, I decided to pack the core logic into a behavior, much like I did with the ratings logic in my previous post – so you can essentially drag this on your main app page and be done with it.Pedro has used something like mySafeBehavior in Cimbalino, and now I use some of his code in the wp7nl library on codeplex. This is how community works. In that light the quote on top of this article is rather badly chosen ;-) If you drop the UpgradeCheckBehavior, as I have christened this thing, onto the main page of your application, Blend will present you with only two options: a message box caption and a message box text: - Caption is the text that will appear on the message box when the behavior detects a new version. Default value is “New version!” - Messageis the text that will appear inside the message box when the behavior detects a new version. Default value is “There's a new version of this app available, do you want to update?” If you are fine with that, you are finished. The app will check for updates automatically on app startup. The behavior itself is a rather simple SafeBehavior and goes like this: using System; using System.Globalization; using System.Net; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Xml; using Microsoft.Phone.Tasks; using Wp7nl.Utilities; namespace Wp7nl.Behaviors { /// <summary> /// A behavior checking from in the app if there's an update available. /// </summary> public class UpgradeCheckBehavior : SafeBehavior<Page> { private ManifestAppInfo appInfo; protected override void OnSetup() { appInfo = new ManifestAppInfo(); CheckUpgrade(); } private void CheckUpgrade() { #if !DEBUG GetLatestVersion().ContinueWith(ProcessResult); #endif } } } Since in debug mode the app will run on you phone or emulator using a generated temporary app id, it won’t be possible to check for new versions anyway so I’ve added an #if statement around the actual check. Using my ManifestAppInfo helper class I retrieve all the app’s metadata which is used by the GetLatestVersion – in essence a slightly modified version of Pedro’s work: /// <summary> /// This method is almost 100% stolen from /// /// </summary> private Task<Version> GetLatestVersion() { var cultureInfoName = CultureInfo.CurrentUICulture.Name; var url = string.Format( "{0}?os={1}&cc={2}&oc=&lang={3}", appInfo.ProductId, Environment.OSVersion.Version, cultureInfoName.Substring(cultureInfoName.Length - 2).ToUpperInvariant(), cultureInfoName); var request = WebRequest.Create(url); return Task.Factory.FromAsync(request.BeginGetResponse, result => { try {()); } } } catch (Exception) { return null; } }, null); } I think my only addition to this is the try-catch around the method as I tended to have some odd errors sometimes when running it inside Visual Studio. This method craftily downloads the app metadata from the store and extracts a version from it. And then the only things left of course are comparing the retrieved version to the current version, and if the current version is greater, displaying a message box asking the user to upgrade: private void ProcessResult(Task<Version> t) { if(t.IsCompleted && t.Result != null ) { var currentVersion = new Version(appInfo.Version); if (currentVersion < t.Result ) { DoShowUpgrade(); } } } private void DoShowUpgrade() { Deployment.Current.Dispatcher.BeginInvoke(() => { var result = MessageBox.Show(Message, Caption, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { var marketplaceReviewTask = new MarketplaceDetailTask(); try { marketplaceReviewTask.Show(); } catch (InvalidOperationException ex) { } } }); } And that's all there's to it. The two dependency properties holding caption and message have been omitted for the sake of brevity. The sad thing of Pedro’s brilliant idea is that it’s quite hard to check if it actually works. Well let me assure you it does, and if you run the demo solution in release mode configuration, it will show you by actually asking for an upgrade: How is that possible? The app created by Visual Studio runs a temporary ID that should not even be in the Store! That’s correct, unless you make it have a real id. So I opened the WPAppManifest.xml file that’s over in the Properties folder and messed a little with the settings: I changed the app Id to that of my latest game 2 Phone Pong in the store, and changed the version number to 0.9.0.0 (while the version number in the Store of course is at least 1.0.0.0). Now the app thinks ask the store for the version number of 2 Phone Pong, gets (at the time of this writing) 1.0.0.0 back, ascertains that’s lower than it’s current version and pops up the message. I you hit the OK button it will actually take you to 2 Phone Pong in the Store . This proves Pedro’s code actually works, and you have now a zero code solution to take your users to the best possible version of your app – and no longer an excuses not to do it;-) Warning – don’t try to deploy a debug version of your app with this id trick on a phone that has the actual app downloaded from the Store on it. That won’t work – you won’t have writing permissions. I haven’t tried the opposite – downloading an app from the store over an app deployed from Visual Studio – but I can imagine that way only lie mud pies. I will include this soon in the upcoming version of my wp7nl library on codeplex {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/zero-lines-code-solution-app
CC-MAIN-2017-04
refinedweb
988
54.42
Python’s Innards: Introduction 2010/04/02 § 22 Comments A friend once said to me: You know, to some people, C is just a bunch of macros that expand to assembly. It’s been years ago (smartasses: it was also before llvm, ok?), but the sentence stuck with me. Do Kernighan and Ritchie really look at a C program and see assembly code? Does Tim Berners-Lee surf the Web any differently than you and me? And what on earth did Keanu Reeves see when he looked at all of that funky green gibberish soup, anyway? No, seriously, what the heck did he see there?! Uhm, back to the program. Anyway, what does Python look like in Guido van Rossum‘s1 eyes? This post marks the beginning of what should develop to a series on Python’s internals, I’m writing it since I believe that explaining something is the best way to grok it, and I’d very much like to be able to visualize more of Python’s ‘funky green gibberish soup’ as I read Python code. On the curriculum is mainly CPython, mainly py3k, mainly bytecode evaluation (I’m not a big compilation fan) – but practically everything around executing Python and Python-like code (Unladen Swallow, Jython, Cython, etc) might turn out to be fair game in this series. For the sake of brevity and my sanity, when I say Python, I mean CPython unless noted otherwise. I also assume a POSIX-like OS or (if and where it matters) Linux, unless otherwise noted. You should read this if you want to know how Python works. You should read this if you want to contribute to CPython. You should read this to find all the mistakes I’ll make and snicker at me behind me back or write snide comments. I realize it’s just your particular way to show affection. I gather I’ll glean pretty much everything I write about from Python’s source or, occasionally, other fine materials (documentation, especially this and that, certain PyCon lectures, searching python-dev, etc). Everything is out there, but I do hope my efforts at putting it all in one place to which you can RSS-subscribe will make your journey easier. I assume the reader knows some C, some OS theory, a bit less than some assembly (any architecture), a bit more than some Python and has reasonable UNIX fitness (i.e., feels comfortable installing something from source). Don’t be afraid if you’re not reasonably conversant in one (or more) of these, but I can’t promise smooth sailing, either. Also, if you don’t have a working toolchain to do Python development, maybe you’d like to head over here and do as it says on the second paragraph (and onwards, as relevant). Let’s start with something which I assume you already know, but I think is important, at least to the main way I understand… well, everything that I do understand. I look at it as if I’m looking at a machine. It’s easy in Python’s case, since Python relies on a Virtual Machine to do what it does (like many other interpreted languages). Be certain you understand “Virtual Machine” correctly in this context: think more like JVM and less like VirtualBox (very technically, they’re the same, but in the real world we usually differentiate these two kinds of VMs). I find it easiest to understand “Virtual Machine” literally – it’s a machine built from software. Your CPU is just a complex electronic machine which receives all input (machine code, data), it has a state (registers), and based on the input and its state it will output stuff (to RAM or a Bus), right? Well, CPython is a machine built from software components that has a state and processes instructions (different implementations may use rather different instructions). This software machine operates in the process hosting the Python interpreter. Keep this in mind; I like the machine metaphor (as I explain in minute details here). That said, let’s start with a bird’s eye overview of what happens when you do this: $ python -c 'print("Hello, world!")'. Python’s binary is executed, the standard C library initialization which pretty much any process does happens and then the main function starts executing (see its source, ./Modules/python.c: main, which soon calls ./Modules/main.c: Py_Main). After some mundane initialization stuff (parse arguments, see if environment variables should affect behaviour, assess the situation of the standard streams and act accordingly, etc), ./Python/pythonrun.c: Py_Initialize is called. In many ways, this function is what ‘builds’ and assembles together the pieces needed to run the CPython machine and makes ‘a process’ into ‘a process with a Python interpreter in it’. Among other things, it creates two very important Python data-structures: the interpreter state and thread state. It also creates the built-in module sys and the module which hosts all builtins. At a later post(s) we will cover all these in depth. With these in place, Python will do one of several things based on how it was executed. Roughly, it will either execute a string (the -c option), execute a module as an executable (the -m option), or execute a file (passed explicitly on the commandline or passed by the kernel when used as an interpreter for a script) or run its REPL loop (this is more a special case of the file to execute being an interactive device). In the case we’re currently following, it will execute a single string, since we invoked it with -c. To execute this single string, ./Python/pythonrun.c: PyRun_SimpleStringFlags is called. This function creates the __main__ namespace, which is ‘where’ our string will be executed (if you run $ python -c 'a=1; print(a)', where is a stored? in this namespace). After the namespace is created, the string is executed in it (or rather, interpreted or evaluated in it). To do that, you must first transform the string into something that machine can work on. As I said, I’d rather not focus on the innards of Python’s parser/compiler at this time. I’m not a compilation expert, I’m not entirely interested in it, and as far as I know, Python doesn’t have significant Compiler-Fu beyond the basic CS compilation course. We’ll do a (very) fast overview of what goes on here, and may return to it later only to inspect visible CPython behaviour (see the global statement, which is said to affect parsing, for instance). So, the parser/compiler stage of PyRun_SimpleStringFlags goes largely like this: tokenize and create a Concrete Syntax Tree (CST) from the code, transorm the CST into an Abstract Syntax Tree (AST) and finally compile the AST into a code object using ./Python/ast.c: PyAST_FromNode. For now, think of the code object as a binary string of machine code that Python VM’s ‘machinary’ can operate on – so now we’re ready to do interpretation (again, evaluation in Python’s parlance). We have an (almost) empty __main__, we have a code object, we want to evaluate it. Now what? Now this line: Python/pythonrun.c: run_mod, v = PyEval_EvalCode(co, globals, locals); does the trick. It receives a code object and a namespace for globals and for locals (in this case, both of them will be the newly created __main__ namespace), creates a frame object from these and executes it. You remember previously that I mentioned that Py_Initialize creates a thread state, and that we’ll talk about it later? Well, back to that for a bit: each Python thread is represented by its own thread state, which (among other things) points to the stack of currently executing frames. After the frame object is created and placed at the top of the thread state stack, it (or rather, the byte code pointed by it) is evaluated, opcode by opcode, by means of the (rather lengthy) ./Python/ceval.c: PyEval_EvalFrameEx. PyEval_EvalFrameEx takes the frame, extracts opcode (and operands, if any, we’ll get to that) after opcode, and executes a short piece of C code matching the opcode. Let’s take a closer look at what these “opcodes” look like by disassembling a bit of compiled Python code: >>> from dis import dis # ooh! a handy disassembly function! >>> co = compile("spam = eggs - 1", "<string>", "exec") >>> dis(co) 1 0 LOAD_NAME 0 (eggs) 3 LOAD_CONST 0 (1) 6 BINARY_SUBTRACT 7 STORE_NAME 1 (spam) 10 LOAD_CONST 1 (None) 13 RETURN_VALUE >>> …even without knowing much about Python’s bytecode, this is reasonably readable. You “load” the name eggs (where do you load it from? where do you load it to? soon), and also load a constant value (1), then you do a “binary subtract” (what do you mean ‘binary’ in this context? between which operands?), and so on and so forth. As you might have guessed, the names are “loaded” from the globals and locals namespaces we’ve seen earlier, and they’re loaded onto an operand stack (not to be confused with the stack of running frames), which is exactly where the binary subtract will pop them from, subtract one from the other, and put the result back on that stack. “Binary subtract” just means this is a subtraction opcode that has two operands (hence it is “binary”, this is not to say the operands are binary numbers made of ‘0’s and ‘1’s). You can go look at PyEval_EvalFrameEx at ./Python/ceval.c yourself, it’s not a small function by any means. For practical reasons I can’t paste too much code from there in here, but I will just paste the code that runs when a BINARY_SUBTRACT opcode is found, I think it really illustrates things: TARGET(BINARY_SUBTRACT) w = POP(); v = TOP(); x = PyNumber_Subtract(v, w); Py_DECREF(v); Py_DECREF(w); SET_TOP(x); if (x != NULL) DISPATCH(); break; …pop something, take the top (of the operand stack), call a C function called PyNumber_Subtract() on these things, do something we still don’t understand (but will in due time) called “Py_DECREF” on both, set the top of the stack to the result of the subtraction (overwriting the previous top) and then do something else we don’t understand if x is not null, which is to do a “DISPATCH”. So while we have some stuff we don’t understand, I think it’s very apparent how two numbers are subtracted in Python, at the lowest possible level. And it took us just about 1,500 words to reach here, too! After the frame is executed and PyRun_SimpleStringFlags returns, the main function does some cleanup (notably, Py_Finalize, which we’ll discuss), the standard C library deinitialization stuff is done (atexit, et al), and the process exits. I hope this gives us a “good enough” overview that we can later use as scaffolding on which, in later posts, we’ll hang the more specific discussions of various areas of Python. We have quite a few terms I promised to get back to: interpreter and thread state, namespaces, modules and builtins, code and frame objects as well as those DECREF and DISPATCH lines we didn’t understand inside BINARY_SUBTRACT‘s implementation. There’s also a very crucial ‘phantom’ term that we’ve danced around all over this article but didn’t call by name – objects. CPython’s object system is central to understanding how it works, and I reckon we’ll cover that – at length – in the next post of this series. Stay tuned. Excellent post – very well written, and the topic is fascinating. The promise of a series on Python’s internals made me immediately add your blog to my RSS reader :-) I’ve also written a little on Python’s internals () and planned to write more – focusing on the compilation side, which I really like, so our material may become complementary. Anyway, great job and keep this up. Thanks for your kind words! I’ll be happy to read what you wrote/will write about the compilation phase. For Tim’s view on the Web, good news, it is accessible on the Web. :) Tim has kept for a long time a kind of diary behind the architecture and philosophy of the Web. Very cool stuff and yes, quite a few people should learn a bit from this kind of article. I will also stay tunned for more :) Nice :) Thank you, oh venerable Python-Fu master :) This is the best overview of python internals I’ve seen. Great and fascinating post! Thanks! Great post, but since the ret of the series will be just as long, please stop using low-contrast grey type. Thanks for the input! I’m not really a CSS expert and I’m not sure my taste in design is always to my taste [sic], but I’ve hacked at the CSS a bit to make text, hyperlinks and headings twice as dark. If you (or anyone) finds any visual bugs because of this, I’ll be happy to know. Much easier to read. Thanks! Excellent start, and I really do recommend that manuscript I linked on python-dev. You’re including a lot more implementation-specific detail than I did (which is obviously part of the point), but I think many of the core concepts will be common (and important). would be so nice to have a print view of your postings! Hmm… You’re the second person to complain, but I’m not sure what to fix. The posts print nicely for me (Chrome, Ubuntu, to PDF). I’m not sure I can help, since the blog is hosted, but can you please describe exactly what are you expecting from a print which you currently don’t get? PyString_FromString(“very cool :-)”); Great, thanks for this, it’s just the material I wanted at the depth & pace I’ve been looking for. I’ve taken the liberty of converting it to Kindle format at , hope that you don’t object. […] This post was mentioned on Twitter by Andrew Gleave, Frank Worsley and Ben Moran, Christophe Lalanne. Christophe Lalanne said: RT @benm: Here is a nice series of blogs by Yaniv Aknin on the innards of Python , as eBooks for Kindle: … […] […] Python’s Innards: Introduction […] […] Python’s Innards: Introduction […] […] work at the interpreter level, please read through the whole "python innards" series…Embed QuoteComment Loading… • Share • Embed • Just now Ankur Gupta, […] […] work at the interpreter level, please read through the whole "python innards" series…Embed QuoteComment Loading… • Share • Embed • 9h ago Ankur Gupta, […] […] something to put her to sleep. Since she’s not quite a hacker, I figured some discussion of what I usually write about may do the trick (okay, maybe ‘not quite a hacker’ is an understatement, she’s an […]
http://tech.blog.aknin.name/2010/04/02/pythons-innards-introduction/
CC-MAIN-2015-11
refinedweb
2,474
66.78
is an extremely rare case in which in which DateTime parsing yields a wrong date. The XmlConvert methods are marked as deprecated, however these are still used by the XmlWriter/Reader classes. Reproducing code in F# #r "System.Xml" open System open System.Xml let date1 = DateTime(634682436600000000L) // March 24 2012 let date2 = date1 |> XmlConvert.ToString |> XmlConvert.ToDateTime date1 = date2 // false I am using following C# program and cannot reproduce the issue. What culture are your running using System; using System.Xml; using System.Globalization; class X { public static void Main () { Console.WriteLine (CultureInfo.CurrentCulture.Name); var dt = new DateTime (634682436600000000L); var s = XmlConvert.ToString (dt); var dt2 = XmlConvert.ToDateTime (s); Console.WriteLine (dt == dt2); return; } } Hi Marek, I'm running on "en-US". I can confirm that your C# code also reproduces this issue on my machine. It works for me with en-US too but I am testing 3.6 only
https://bugzilla.xamarin.com/20/20457/bug.html
CC-MAIN-2021-25
refinedweb
153
62.34
Random Title, Working Thoughts 2016-02-16T15:48:51+00:00 Santeri Paavolainen santtu@iki.fi Dynamic devtest deployments 2016-01-30T00:00:00+00:00 <p>While I work less and less on down-to-earth development, there are times when I get a chance to hack something. In this post I’ll describe a devtest deployment system I got a chance to be work on.</p> <p>In a system we are developing we wanted to do a persistent deployment of the whole system to <a href="">ECS</a> on each branch repository push where each subservice would be accessible as <code class="highlighter-rouge"><branch>-<service>.dev.example.com</code><sup id="fnref:examplecom"><a href="#fn:examplecom" class="footnote">1</a></sup>. This would make it easy for developer to verify integration tests before merging (pull request) to master<sup id="fnref:integration"><a href="#fn:integration" class="footnote">2</a></sup>, to show their work to other developers and to allow non-developer stakeholders easy access to features as they are being developed.</p> <figure> <p><a href="/assets/posts/devtest-deployments-process.svg"><img src="/assets/posts/devtest-deployments-process.svg" alt="Testing pipeline" /></a></p> <figcaption> <p>Flow of each push through the CI. Integration tests are run against a deployment on ECS.</p> </figcaption> </figure> <p>There are multiple ways to accomplish this such as using dynamic DNS updates, ELBs and so on, and after some discussions and testing we settled on the following setup.</p> <ol> <li> <p>There is a separate <em>frontend</em> deployment that consists of etcd and nginx servers.</p> </li> <li> <p>Each branch deployment service registers itself to the frontend by addings its address to etcd registry with its branch and service names.</p> </li> <li> <p>A watcher process on nginx container notices changes to etcd registry and updates nginx configuration so that the <strong>branch</strong>-<strong>service</strong>.dev address gets proxied to the correct docker container.</p> </li> </ol> <figure> <p><a href="/assets/posts/devtest-deployment-operation.svg"><img src="/assets/posts/devtest-deployment-operation.svg" alt="Request processing in deployment" /></a></p> <figcaption> <p>Request processing with multiple branch deployments. Each service registers its address and port to etcd registry.</p> </figcaption> </figure> <p>Registration is done during service startup and is also pretty simple (<code class="highlighter-rouge">REGISTRY_URL</code>, <code class="highlighter-rouge">SERVICE</code>, <code class="highlighter-rouge">NAME</code> and <code class="highlighter-rouge">PORT</code> are passed as Docker environment variables, <code class="highlighter-rouge">ip</code> is fetched from EC2 metadata service):</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="o">[</span> -n <span class="s2">"</span><span class="nv">$REGISTRY_URL</span><span class="s2">"</span> -a -n <span class="s2">"</span><span class="nv">$PORT</span><span class="s2">"</span> -a -n <span class="s2">"</span><span class="nv">$SERVICE</span><span class="s2">"</span> -a -n <span class="s2">"</span><span class="nv">$NAME</span><span class="s2">"</span> <span class="o">]</span>; <span class="k">then </span><span class="nb">echo</span> <span class="s2">"INFO: Registering to </span><span class="nv">$REGISTRY_URL</span><span class="s2"> as </span><span class="nv">$NAME</span><span class="s2">/</span><span class="nv">$SERVICE</span><span class="s2"> at </span><span class="nv">$ip</span><span class="s2">:</span><span class="nv">$PORT</span><span class="s2">"</span> >&2 <span class="nv">url</span><span class="o">=</span><span class="nv">$REGISTRY_URL</span>/v2/keys/deployment/<span class="nv">$NAME</span>/service/<span class="nv">$SERVICE</span> <span class="nv">now</span><span class="o">=</span><span class="k">$(</span>date -u +<span class="s2">"%Y-%m-%dT%H:%M:%SZ"</span><span class="k">)</span> <span class="nv">$curl</span> <span class="nv">$url</span>/ip -XPUT -d <span class="nv">value</span><span class="o">=</span><span class="nv">$ip</span> >/dev/null <span class="o">||</span> <span class="nb">exit </span>1 <span class="nv">$curl</span> <span class="nv">$url</span>/port -XPUT -d <span class="nv">value</span><span class="o">=</span><span class="nv">$PORT</span> >/dev/null <span class="o">||</span> <span class="nb">exit </span>1 <span class="nv">$curl</span> <span class="nv">$REGISTRY_URL</span>/v2/keys/deployment/<span class="nv">$NAME</span>/created -XPUT -d <span class="nv">value</span><span class="o">=</span><span class="nv">$now</span> >/dev/null <span class="o">||</span> <span class="nb">exit </span>1 <span class="k">fi</span> </code></pre> </div> <p>Similarly when the service is shut down it’ll issue <code class="highlighter-rouge">DELETE</code> on its keys to unregister itself.</p> <p>The nginx container is based on the standard docker registry <code class="highlighter-rouge">nginx</code> container, but it will start a “regenerate” process alongside the actual nginx server. It uses <a href="">etcdwatch</a> to keep track of registry changes and then finally a separate <code class="highlighter-rouge">regenerate.py</code> script takes the registry contents and updates the nginx configuration file<sup id="fnref:regenerate"><a href="#fn:regenerate" class="footnote">3</a></sup>.</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="o">[</span> -n <span class="s2">"</span><span class="nv">$REGISTRY_URL</span><span class="s2">"</span> <span class="o">]</span>; <span class="k">then </span><span class="nb">echo</span> <span class="s2">"Registry is at </span><span class="nv">$REGISTRY_URL</span><span class="s2">"</span> >&2 <span class="nb">echo</span> <span class="s2">"Starting etcdwatch to generate configuration files"</span> >&2 etcdwatch -u <span class="nv">$REGISTRY_URL</span> -d /deployment -- sh -c <span class="s1">'./regenerate.py && nginx -s reload && echo `date -u`: Regenerated configuration'</span> & <span class="nv">pids</span><span class="o">=</span><span class="s2">"</span><span class="nv">$!</span><span class="s2">"</span> <span class="k">fi</span> </code></pre> </div> <p>Now some caveats. <strong>THIS IS NOT FOR PRODUCTION USE.</strong> We use this only for devtest deployments. This setup is meant to make it easy and straighforward to test and verify things <em>during development</em>, even when working on incomplete and definitely-not-ready-for-merge code changes.</p> <p>I have also omitted a lot of details. Where does <code class="highlighter-rouge">PORT</code> come from? (It needs to be container’s <em>host port</em>, and it needs to be unique per <em>container instance</em>.) How to use frontend also on local (developer machine) deployment? What to use as <code class="highlighter-rouge">REGISTRY_URL</code>? How to actually integrate all of this into a CI pipeline? — I’ll leave those as a home exercise either to solve yourself, or to pester me to write about them :-)</p> <p>Anyway we are pretty happy about the setup. It means that <em>any</em>.</p> <p>It is also easy to determine a correct url to pass to other people (developers, stakeholders, internal alpha testers) as it is <em>always</em> <strong>branch</strong>.dev.example.com. We special-cased the default entry point to drop the service name.</p> <p>Sprint demo coming up? Merge <code class="highlighter-rouge">master</code> to <code class="highlighter-rouge">demo</code>, push and it’ll be up in a jiffy.</p> <hr /> <div class="footnotes"> <ol> <li id="fn:examplecom"> <p>Not <code class="highlighter-rouge">example.com</code> in reality, of course. <a href="#fnref:examplecom" class="reversefootnote">↩</a></p> </li> <li id="fn:integration"> <p. <a href="#fnref:integration" class="reversefootnote">↩</a></p> </li> <li id="fn:regenerate"> <p>The regenerate script actually just dumps the registry information to a Jinja2 template, writing the result to <code class="highlighter-rouge">/etc/nginx/conf.d</code> directory. <a href="#fnref:regenerate" class="reversefootnote">↩</a></p> </li> </ol> </div> On Software Development and Layperson's Perceptions 2016-01-17T00:00:00+00:00 <p.</p> <p>When I recently was complaining about a billing service (of a local sporting association) lacking a very useful and common feature, the reply I got gave me one of these “oh, so that’s what it looks like” moments of insight. <strong>“The vendor asked too much money for the feature.”</strong></p> <p>A few thoughts raced my mind.</p> <ul> <li><em>It just can’t be <strong>that</strong> expensive - this must be a case of sticker shock!</em></li> <li>The system does feel a little home-brewed, maybe it is a bespoke or tailored solution instead of COTS or SaaS?</li> <li>In that case <em>the vendor may be trying to cover development costs of a new feature, plus some.</em></li> <li>Then again <em>the feature is pretty basic and could probably be implemented in one day, with time to spare.</em></li> </ul> <p>But thinking this way is just looking at trees instead of the forest.</p> <p>It’s not about <em>my</em> views or <em>my</em> estimates. I am not the customer of the vendor. I do not make a decision here. This is a case of information asymmetry between the vendor and their customer. My viewpoint is more symmetric, and thus not valid in this case.</p> <p>What is the problem, then?</p> <p>Before going to the main question I have (about the forest), let me first take a look at some trees first.</p> <h2 id="estimation-is-useless-estimation-is-valuable">Estimation is useless! Estimation is valuable!</h2> <p>While software estimation<sup id="fnref:estimation"><a href="#fn:estimation" class="footnote">1</a></sup> itself has been <a href="">studied for a long time</a>, is it even possible to estimate software development efforts in reality? What is its place in the world of agile and lean development?</p> <p>I’ve seen people think that agile development has made away with software estimation. <strong>It has not.</strong> Task sizing, planning poker or even just “guessimating” whether a story will fit a sprint or not <em>are all judgments based on software estimation</em>. Doing estimation by the seat of the pants instead of formally does not make it go away.</p> <p>Software estimation is also known to go horrendously wrong. I am not going to even link examples, it’s that depressing. […] So which is it?</p> <ul> <li>Estimating “small” problems can be done with <em>useful reliability and accuracy.</em><sup id="fnref:useful"><a href="#fn:useful" class="footnote">2</a></sup></li> <li>Estimating “large” problems is difficult because <em>requirements are not known to sufficient detail</em>.<sup id="fnref:requirements"><a href="#fn:requirements" class="footnote">3</a></sup></li> </ul> <p>My view is that software estimation in itself is not useless and when used in correct context can yield usefully accurate results.</p> <p><small>Just think about it yourself — a programmer is making judgments about task complexity and difficulty all the time. If these estimates were completely useless what would that mean? I mean, if you’d estimate a ten-minute task to take five years? <em>You would be bloody useless.</em> And jobless, fast.</small></p> <h2 id="software-is-easy-software-is-hard">Software is easy! Software is hard!</h2> <p>I’ve written <a href="/2013/10/28/life-is-easier">previously</a> about the power of being able to write programs. But is software easy? Being able to use programs for automating rote tasks just means that it is incredibly <em>powerful</em>.</p> <p>Software is not easy or hard. There are hard limits to some problems that come from either the theory of computability or from physical limits, but software in itself is not easy or hard. <em>Learning how to write software</em> may be hard, or it may be easy, but this is as meaningless as saying that learning to draw is easy or hard — some people may have natural affinity, or the drive to learn. If so, learning is <em>apparently</em> easy.</p> <p>Most of the things we value are difficult and time-consuming to learn. Even if some people make learning look easy.</p> <p>Learning to do software is hard. So is learning to play violin.</p> <p><strong>Yet<.</p> <p <em>automatically</em> making previously difficult things easy <em>now</em>.</p> <h2 id="finally-the-forest">Finally, the forest.</h2> <p.</p> <p>First, this gulf is not about skills or knowledge. I have absolutely no idea on how to construct an airplane or how much of work it does. Yet someone does.</p> <p>Someone out there does not have any idea on how much work is to create software for a Mars rover. Well, <em>I don’t</em>, but someone at NASA does.</p> <p>Unfortunately software development is often bespoke or tailored work. This means there is information asymmetry between customer and vendor. <em>Even when assuming honest and ethical vendors</em> this asymmetry persists.<sup id="fnref:dishonest"><a href="#fn:dishonest" class="footnote">4</a></sup></p> <p>So when a software professional gives an estimate — making the assumption that it is a <strong>reasonably accurate estimate given the constraints I outlined above</strong> — what is a layperson e.g. the customer to do with this estimate? There are four possibilities (SWOT anyone?) between professional’s estimate and customer’s expectations:</p> <ol> <li>Both match and are correct: nice</li> <li>Estimate is correct and expectations are incorrect: customer is happily surprised (estimate is lower) or … put into a bind (estimate is higher)</li> <li>Estimate is incorrect and expectations are correct: oh woe is me<sup id="fnref:woe"><a href="#fn:woe" class="footnote">5</a></sup></li> <li>Both are incorrect: run, don’t look back, just run</li> </ol> <figure> <p><a href="/assets/posts/vendor-estimates-vs-customer-expectations.svg"><img src="/assets/posts/vendor-estimates-vs-customer-expectations.svg" alt="Customer expectations vs vendor estimates" /></a></p> </figure> <p>Finally, the question:</p> <p class="shout"> Why and how do layperson expectations and professional estimates differ? </p> <p>That’s it. That’s the forest.</p> <p><em>It’s not that professionals’ estimates are incorrect.</em> If estimates are used in a valid context then they are likely to be reliable and useful.<sup id="fnref:fucknot"><a href="#fn:fucknot" class="footnote">6</a></sup></p> <p><em>It’s not that laypeople’s estimates are incorrect</em>, either. They most likely are incorrect for the exactly same reasons that any random person’s estimates for Mars rover software or airplane construction work are incorrect. Vendor estimates and customer expectations are very likely to differ. Assuming they would match is not a sensible default.</p> <p class="shout"> How? </p> <p>How they are going to differ? My own experience is that they are more likely to be underestimates than overestimates. Yet I don’t consider the <em>quantitative</em> difference as important as the qualitative:</p> <p class="shout"> Why? </p> <p>Why? I don’t know. I tried looking into research into software estimation.<sup id="fnref:notgood"><a href="#fn:notgood" class="footnote">7</a></sup>.</p> <p>I have no answers here, only questions.</p> <p>I think that looking into the <em>why</em> could potentially help a lot in the software industry’s interaction with customers. I think that the software industry or academia is not looking enough (if at all) into the human side — sociology and psychology — of interactions between <em>humans</em> in software professions and <em>humans</em> in other professions.</p> <p>Why are customer requirements misunderstood? What are the warning signs in human communication or behavior?</p> <p>Why customers think they have clear requirements when they are not clear? What is an effective way to communicate the inadequacy of requirements?</p> <p>And so on. Consider research into group-think, for example (Bay of Pigs decision-making is a famous example). This is not computer science, not computing science, not software engineering. It is cross-department stuff. Not very popular in CS, I know<sup id="fnref:refs"><a href="#fn:refs" class="footnote">8</a></sup>.</p> <h2 id="the-big-conclusion">The Big Conclusion</h2> <p><br /> <br /> <br /> <br /></p> <p>Nope, there is none.</p> <p>I wrote this blog post because I got a rare glimpse into non-software-person thinking, got thinking, and found out questions I found no answers for.</p> <p><br /> <br /> <br /> <br /></p> <hr /> <div class="footnotes"> <ol> <li id="fn:estimation"> <p>For an all-around view on software estimation in practice I can recommend Steve McConnell’s book <a href="">Software Estimation: Demystifying the Black Art</a>. <a href="#fnref:estimation" class="reversefootnote">↩</a></p> </li> <li id="fn:useful"> <p. <a href="#fnref:useful" class="reversefootnote">↩</a></p> </li> <li id="fn:requirements"> <p>This is the crux of agile methods. While a waterfall software project could <em>theoretically</em> be estimated accurately <em>given that requirements are known in advance</em>, in practice nobody knows the requirements in advance (even when they think they do). Agile methods start with the assumption that requirements <em>will</em> change. <a href="#fnref:requirements" class="reversefootnote">↩</a></p> </li> <li id="fn:dishonest"> <p>Dishonest and unethical vendors may use the asymmetry to <em>their own advantage</em>. Yet information asymmetry can cause problems even for honest and ethical vendors and their customers. <a href="#fnref:dishonest" class="reversefootnote">↩</a></p> </li> <li id="fn:woe"> <p. <a href="#fnref:woe" class="reversefootnote">↩</a></p> </li> <li id="fn:fucknot"> <p>Likely, likely, likely. Never 100%. <a href="#fnref:fucknot" class="reversefootnote">↩</a></p> </li> <li id="fn:notgood"> <p>I have to admit I did not do a thorough literary search. Just random searches on scholar, ieexplore, university library search portal and the like. <a href="#fnref:notgood" class="reversefootnote">↩</a></p> </li> <li id="fn:refs"> <p>If you got here, please read <a href="">this</a>. <a href="#fnref:refs" class="reversefootnote">↩</a></p> </li> </ol> </div> Wardley maps at the low end 2015-09-11T00:00:00+00:00 <p>I have had this nagging thought about <a href="">Wardley maps</a>..</p> <p><em>But</em>: There’s this thing about almost all the practical examples I have seen on Simon’s blog:</p> <p><strong>They are examples from large companies and large public organizations.</strong></p> <p>I work mostly with smaller companies — startups. Can Wardley maps be used with them? Would mapping offer any benefits?</p> <p,</p> <ol> <li><strong>Is it possible to use Wardley maps with startups?</strong> (I think: Most likely)</li> <li>If so, <strong>are there any benefits of using them?</strong> (Probably)</li> <li>Finally, <strong>what are those benefits and how are they influenced by the company size?</strong><sup id="fnref:size"><a href="#fn:size" class="footnote">1</a></sup> (Maybe)</li> </ol> <figure> <p><img src="/assets/posts/5541356248_7b62e34976_z.jpg" alt="Does size matter?" /></p> <figcaption> <p>Does size matter? (Source: <a href="">Miguel</a>, CC BY-NC 2.0)</p> </figcaption> </figure> <p:</p> <ul> <li> <p>A small team forming a virtual startup within a larger organization, being responsible for a commercial web-based B2B service recently introduced to the market.</p> </li> <li> <p>A medium-sized group at a startup with MVP development in progress in a healthcare segment. This segment is likely to face disruption (war!) due to digitization of its services within a few years.</p> </li> <li> <p>A larger group at a startup in very early forming phase — they have a business idea but no clarity of a MVP at the time of the session.</p> </li> </ul> <p><small>So something between a few people to at most about ten people, okay? I think it possible to define an early startup’s size only after the fact when the difference between contributors and hang-arounds has become clear.</small></p> <h2 id="using-wardley-maps">Using Wardley maps</h2> <p>Once you have a Wardley maps of your business and the surrounding business ecosystem, there are several possibilities on how to use it:</p> <ol> <li><a href="">Manipulate</a> the playing field to your own advantage.</li> <li><a href="">Anticipate</a> developments that will occur and potential actions by competitors.</li> <li>Decide what to <a href="">purchase or outsource</a> and what to do internally.</li> <li>Select best <a href="">models</a> to use for internal work.</li> <li>Choose appropriate <a href="">purchasing models</a> for external sourcing.</li> <li>Define <a href="">teams</a>, their goals and responsibilities.</li> <li>Define <a href="">roles and hiring profiles</a> for different teams.</li> </ol> <figure> <p><a href="/assets/posts/wardley-map-benefits-as-a-wardley-map.svg"><img src="/assets/posts/wardley-map-benefits-as-a-wardley-map.svg" alt="Wardley map benefits" /></a></p> </figure> <p>What I found out is that in this sample of startups:</p> <ul> <li>Manipulating the playing field was felt to be out of reach and anticipation of playing field changes and competitor actions were similarly felt to be “too far out”.</li> <li>Having multiple teams, defining hiring profiles and deciding internal work model were also mostly out of scope as hiring and teaming is driven by immediate tactical needs more than any long-term planning effort<sup id="fnref:hiring"><a href="#fn:hiring" class="footnote">2</a></sup>. It is pretty pointless trying to create artificial team divisions among five people or less, or try to run a single team in different operating modes.</li> </ul> <p>However there were things that the audience found useful:</p> <ul> <li>“Eye-opener” was a frequent comment when talking about “purchase, outsource or develop internally” decisions.</li> <li>Differences between purchasing models for different evolutionary stages was also appreciated.</li> <li>Although I suspect the understanding of <em>evolution</em> was superficial at this stage, comments were made about how this helped visualize potential risks of relying too heavily on early stage technologies (leaning too much on the “bottom left quadrant”).</li> </ul> <h2 id="what-to-make-of-this">What to make of this?</h2> <p>Although it is nice to have provided useful insights to participants in these sessions, the relevant question really is <strong>did this offer more value than using the same time on some other strategic method</strong> (self-study or facilitated)?</p> <p>Answer: Yes and no and it depends.<sup id="fnref:answer"><a href="#fn:answer" class="footnote">3</a></sup></p> <ul> <li> <p>Yes, it clearly provided insights for people on topics they might have come across only by chance.</p> </li> <li> <p>No, as these insights were <strong>common knowledge</strong>. Different project, development and organizational models are nothing new and neither is the knowledge that there’s no one-size-fits-all method.<sup id="fnref:pundits"><a href="#fn:pundits" class="footnote">4</a></sup> The same situation is with outsourcing methods — hey, this stuff is introductory business course material.</p> </li> <li> <p>It depends — I have found out that a consultant, a facilitator or a teacher often is paraphrasing common information that the audience <strong>already knows</strong> but has <strong>not yet understood</strong>. Helping with this step between knowledge and understanding can be valuable in itself.</p> </li> </ul> <!-- > Given a small random sample from a population of competent people --> <!-- > (people ending up in an early-stage startup) there are bound to be --> <!-- > gaps in knowledge and skills. Through a sort of reverse causality --> <!-- > companies that are funded early are more likely to have been founded --> <!-- > by experienced enterpreneurs with existing connections to --> <!-- > funders. So they have both resources and experience already packed --> <!-- > in. Conversely companies that are not well funded early (thus --> <!-- > lacking in resources) are more likely to have young (less --> <!-- > experienced) founders thus suffering a double whammy regarding --> <!-- > strategic capability. --> <h2 id="conclusions">Conclusions</h2> <p>Based on feedback and my own observations from these relatively short introductory sessions with early-phase startups, I would say the benefit of using Wardley maps for small, early-phase startups is inconclusive.</p> <p>There are clearly some benefits, but these benefits might not be attributable to Wardley maps specifically. There is a possibility these benefits could have been reached with some other method too with comparable effort. Even then the benefits appear to be more tactical than strategic.</p> <h2 id="afterthought">Afterthought</h2> <p>Well… there is definitely a possibility for early-phase startups with little resources, with enough drive and willpower, to manipulate the strategic playing field to their advantage. For most? Probably not.</p> <p>After some contemplation I thought of one situation where Wardley maps <em>might</em>.</p> <blockquote> <p <em>might or might not work</em>. I think that founders who realize their need to understand the strategic playing field and the will to manipulate it are already in the “better off” category — they probably are more experienced with better connections and better access to funding, too.</p> </blockquote> <p>For a next step, how about looking into still-quite-early startups with seed funding, and an MVP on the market?</p> <hr /> <div class="footnotes"> <ol> <li id="fn:size"> <p>Here I am using “company size” as a proxy for its resources. This is just a heuristic, as said, there’s tremondous variability between startups. <a href="#fnref:size" class="reversefootnote">↩</a></p> </li> <li id="fn:hiring"> <p>There is of course a lot of effort put into hiring “the right people”. This hiring just is not driven by any understanding of bimodal- or trimodal IT. <a href="#fnref:hiring" class="reversefootnote">↩</a></p> </li> <li id="fn:answer"> <p>My favourite answer to all yes-no questions. <a href="#fnref:answer" class="reversefootnote">↩</a></p> </li> <li id="fn:pundits"> <p>Most people I know and value have no illusion that any variant of agile, lean or six sigma would be a fit for all needs. This view is supported by plenty of research too. <a href="#fnref:pundits" class="reversefootnote">↩</a></p> </li> </ol> </div> Watts, watts, watts! 2015-06-18T00:00:00+00:00 <p>A few days ago I read this tweet from Nicholas Weaver about laptop fans spinning on a certain web site.</p> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <blockquote class="twitter-tweet tw-align-center" lang="en"> <p lang="en" dir="ltr"><a href="">@ncweaver</a> <a href="">@mikko</a> How about energy labels for websites? Forbes clearly a D.</p> <p>— Santeri Paavolainen (@paavolainen) <a href="">June 16, 2015</a></p> </blockquote> <p>It was sort of a joke. Think <a href="">European Union energy labeling</a>. Would a random site get an A++ or a D energy efficiency label? Based on what? What a thought!</p> <p>But as things go, that thought would not leave me alone. There <strong>clearly</strong> are some applications that routinely will busyloop on a cpu core<sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup>. As Nicholas said, there are also some web sites that put a large burden on the processor, too. You can literally feel that as <a href=""><strong>heat on your lap</strong></a>.</p> <h2 id="how-much">How much?</h2> <p>The question is <strong>how much power can a power-hungry website consume?</strong></p> <div style="text-align: center; padding: 1em; line-height: 1.2em; font-size: x-large;"> <p>I am ready. I have a pluggable power meter, computer, paper and a pen.</p> </div> <p>So I set up to work. First I measured<sup id="fnref:methods"><a href="#fn:methods" class="footnote">2</a></sup> some baseline power usage levels on my laptop<sup id="fnref:laptop"><a href="#fn:laptop" class="footnote">3</a></sup> with different screen brightness levels:</p> <figure> <p><a href="/assets/posts/website-power-baseline.svg"><img src="/assets/posts/website-power-baseline.svg" alt="baseline power usage graphs" /></a></p> <figcaption> <p>From left to right: lowest visible brightness level, screen off, 50% brightness, 50% brightness with browser running and 100% screen brightness.</p> </figcaption> </figure> <p>I decided to use 50% screen brightness for my tests. Notice that the difference between screen off and lowest brightness level seems neglible, which is interesting. I had expected that the backlight would consume significantly more power than screen completely off. (The measurement baseline of screen at 50% intensity with Google Chrome running and a single incognito window open used 10.8 ± 0.7 W.)</p> <p>Having set up the baseline, time to browse some sites! After gathering data on several randomly chosen sites I divided sites into three groups, <strong>low</strong>, <strong>medium</strong> and <strong>high</strong> power usage:</p> <figure> <p><a href="/assets/posts/website-power-measurements.svg"><img src="/assets/posts/website-power-measurements.svg" alt="power usage graphs" /></a></p> <figcaption> <p>From left to right, in low power group: <a href="">New Scientist</a>, <a href="">BBC</a>, <a href="">Apple</a>, <a href="">YouTube</a>, <a href="">Google</a>; in medium power group: <a href="">Vimeo</a> playing a video, YouTube video in fullscreen mode, Vimeo video in fullscreen mode, <a href="">The Guardian</a>, YouTube video; in high power group: <a href="">The New York Times</a>.</p> </figcaption> </figure> <p>Power usage by group was</p> <ul> <li>Low power group: 10.7 ± 0.9 W</li> <li>Medium power group: 20 ± 3 W</li> <li>High power group: 48 ± 3 W</li> </ul> <p>Considering Nicholas’s comment I was surprised about Forbes being in the low power group. One factor might have been that I have the Flash plugin disabled by default, and there was at least one Flash ad on the Forbes front page. Secondly, I was expecting a more uniform power use distribution, but at least these results were quite stratified. I was also expecting that video sites would be the most power hungry. They weren’t.</p> <p>The main conclusion based on this very limited sampling is nonetheless clear: <strong>there are significant differences in browser power use between web sites</strong>. The difference between low and medium group is almost 10 watts and grows to <strong>almost 50 watts</strong> between low power group and The New York Times site.</p> <h2 id="post-scriptum-does-that-matter">Post Scriptum: Does that matter?</h2> <p>The global electricity consumption<sup id="fnref:4"><a href="#fn:4" class="footnote">4</a></sup> is about 2 <strong>terawatts</strong>. Even if we assume that <strong>30% of world population use 1 hour a day browsing the web</strong> then 10 watts more power would mean a total of 875 megawatts more power consumed, which is only 440 parts per million of the global electricity consumption.</p> <p>So is 875 MW a large number or not? Perhaps it is better to compare it against <strong>power conservation efforts</strong>. Let’s take the European Union energy labels for refridgerators as a reference. When the labels were introduced the lowest energy label was an A. Now it is A+++ whose difference is 33 kWh per annum<sup id="fnref:5"><a href="#fn:5" class="footnote">5</a></sup>. This difference multiplied by the number of households in EU-28<sup id="fnref:6"><a href="#fn:6" class="footnote">6</a></sup> totals up to 790 megawatts.</p> <p>In the same ballpark.</p> <p>These are just numbers, but I think they show that it is possible that power-hungry websites can potentially consume significant amount of power by end-user computers.</p> <hr /> <div class="footnotes"> <ol> <li id="fn:1"> <p>I’m not naming any birds, thundering or not. <a href="#fnref:1" class="reversefootnote">↩</a></p> </li> <li id="fn:methods"> <p>Most applications turned off, no Time Machine backups running, battery at 100%, not using the computer during measurements, starting measurements only 10-30 seconds after page load, pausing video until player has cached as much as possible before video plays, measuring power meter visually from a digital display at 5 second intervals for 30 seconds for a total of 7 measurements for each test. <a href="#fnref:methods" class="reversefootnote">↩</a></p> </li> <li id="fn:laptop"> <p>13” Retina Macbook Pro, 2013 model. <a href="#fnref:laptop" class="reversefootnote">↩</a></p> </li> <li id="fn:4"> <p>Source: <a href="">Wikipedia</a> <a href="#fnref:4" class="reversefootnote">↩</a></p> </li> <li id="fn:5"> <p>This is actually normalized to the volume of the refridgerator, but I’m willing to take a chance in taking this difference as a valid average. <a href="#fnref:5" class="reversefootnote">↩</a></p> </li> <li id="fn:6"> <p>210 million, source: <a href="">Eurostat</a> <a href="#fnref:6" class="reversefootnote">↩</a></p> </li> </ol> </div> Custom Termination Policy for Auto Scaling 2015-04-25T00:00:00+00:00 <p>While chatting with <a href="">Thomas Avasol</a> about auto scaling group termination policies<sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup> I got an idea on how to implement custom termination policies for AWS auto scaling groups.</p> <h2 id="background">Background</h2> <p>(Feel free to skip ahead if you are familiar with auto scaling groups and termination policies.)</p> <p>A bit of a background first: When an auto scaling group is scaled <em>down</em>, an instance to be terminated needs to be picked. There are sevaral policies to choose from: oldest/newest instance, oldest launch configuration, closest to full instance hour and the default (most complex) one. A customer gets to choose one of these and <em>that’s it</em>.</p> <p>If none of these suited you, there are some optios available:</p> <ul> <li> <p>Use termination protection to prevent some instances being picked up for down-scaling termination. (This has been recommended to me as one way by several AWS engineers.)</p> </li> <li> <p>Run your own down-scale scheduler in an instance. This would effectively implement the downscaling logic itself, but with your own custom twist for choosing instances to terminate.</p> </li> </ul> <p.</p> <p>Oh, and <strong>why</strong>?</p> <p><small>.)</small></p> <h2 id="idea-128161">Idea 💡</h2> <p>Downscaling in an auto scaling group works when a CloudWatch alarm is triggered, which in turn is set to trigger an scaling action that then changes the desired instance count.</p> <ol> <li> <p>Now… alarms can also send notifications to SNS topics,</p> </li> <li> <p>SNS topics can trigger Lambda functions,</p> </li> <li> <p>Lambda functions can be assigned IAM roles, and Lambda functions can access all AWS API functionality that the IAM role allows,</p> </li> <li> <p><strong>Ergo</strong>, I can move the custom termination policy code to a Lambda function without needing to run a separate instance.</p> </li> </ol> <p>With my head humming I started hacking at it and got a proof-of-concept version running already a few hours later. <strong>It <strike>is alive</strike> works!</strong></p> <h2 id="code">Code</h2> <p>I’ll tell you how to actually set up this in a while, but first, here’s the Lambda code.</p> <script src=""></script> <p>It’s a bit verbose. Using Underscore or Coffeescript surely would be more readable and/or compact. I’m not really a Node.js developer which probably also shows. This certainly is <strong>not production quality</strong> as it makes quite a bit of assumptions and has hard-coded values in it. <em>This is a proof-of-concept code! Caveat emptor!</em></p> <p>The code is straightforward: <code class="highlighter-rouge">exports.handler</code> will get called, it’ll extract auto scale group name from the SNS notification, then iterate over running instances in the group and fetch a <em>total time</em> value via HTTP from these instances (a custom CloudWatch metric would do as well), finally picking the instance with the lowest <em>total time</em> value.</p> <h2 id="setup">Setup</h2> <p>The Lambda function above will not in itself yet do anything. To run it, you need to first (assuming you already have auto scale group set up):</p> <ol> <li>Create IAM role with enough permissions to do auto scaling actions</li> <li>Create the Lambda function</li> <li>Create an SNS topic and add a subscription for it to call the Lambda function</li> <li> <p>Create CloudWatch alarms to send a notification to the SNS topic from above when you want a downscale to occur.</p> <p><strong>You will need multiple alarms set up</strong>).</p> </li> </ol> <p>Done!</p> <h2 id="caveats">Caveats</h2> <p>I ran into some limitations of Lambda and CloudWatch when working on this:</p> <ul> <li> <p>Lambda functions can access instances only via public IP addresses — <code class="highlighter-rouge">PrivateIpAddress</code> does not work. This is a bit of a security bother, so I’d actually suggest to push custom cloudwatch metrics from instances that the code would read without relying on public access.</p> <p>(I’d like to refer to Lambda functions in security groups directly and use internal IP addresses to access AWS resources.)</p> </li> <li> <p>I originally had the downscale handler set the triggering cloudwatch alarm to <code class="highlighter-rouge">INSUFFICIENT_DATA</code> state in a hope to make it re-trigger later again. It got stuck in a re-trigger race loop, getting repeatedly triggered (downscaling the group into 1 instance in one fell swoop).</p> </li> <li> <p.</p> <p>(I’d like either a way to schedule Lambda call for later, to trigger Lambda functions via an SQS delay queue, or to specify to an alarm to retrigger after some cooldown delay if it is still in a trigger state.)</p> </li> <li> <p><a href="">Lambda</a> is currently available only in US East, US West (Oregon) and EU West regions, which may limit its usefulness at the moment. On the other hand, it should become available in other regions soon-ish.</p> </li> </ul> <p.)</p> <p>Anyway that’s it — please drop a comment below if you find this useful!</p> <hr /> <div class="footnotes"> <ol> <li id="fn:1"> <p>On 21st April 2015 at AWS Summit Stockholm, to be precise. <a href="#fnref:1" class="reversefootnote">↩</a></p> </li> </ol> </div> Picoservice bruhahaha 2015-04-21T00:00:00+00:00 <p>I’ve been busy, as again, an haven’t had a good chance to continue on my <a href="/tags.html#µ²services-ref">µ²services</a> series. I’m planning to discuss more of the potential implications of technology development meeting microservice architecture models. But this post isn’t about that.</p> <p>Instead I want to comment a bit on the nano/picoservice commentary found over the net. For example:</p> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <!-- <blockquote class="twitter-tweet" lang="en"><p>Picoservices. Like "hello, world".</p>— MY Camelopardalis (@pavlobaron) <a href="">February 16, 2015</a> --> <!-- </blockquote> --> <blockquote class="twitter-tweet tw-align-center" lang="en"> <p><a href="">@michaelneale</a> I thought we agreed that was the hip new marketing term for functions?</p> <p>— Mark Wotton (@mwotton) <a href="">February 3, 2015</a></p> </blockquote> <!-- <blockquote class="twitter-tweet" lang="en"><p>So we've got services and microservices. Can we get a nanoservice? picoservice? femtoservice?</p>— Snark As a Service (@petrillic) <a href="">March 9, 2015</a> --> <!-- </blockquote> --> <!-- <blockquote class="twitter-tweet" lang="en"><p>"MICROSERVICES ARE TOO MONOLITHIC. LEVERAGE OUR NANOSERVICE FOR MOST IMPORTANT COMMUNICATIONS IN ROBUST CLOUD." <a href=""></a></p>— Taylor Edmiston (@kicksopenminds) <a href="">March 5, 2015</a> --> <!-- </blockquote> --> <p><strong>I absolutely love these comments!!</strong>:</p> <blockquote class="twitter-tweet tw-align-center" lang="en"> <p>1k smaller microservice is nanoservice; exposes assembly instructions via HTTP+JSON; pikoservices become inadressable due to quantum effects</p> <p>— Tomas Petricek (@tomaspetricek) <a href="">December 3, 2014</a></p> </blockquote> <p>Tomas of course is making a point of this absurdity.</p> <p>What I think what microservices (and by extension, nano and pico too) are: <strong>Microservices are externally loosely coupled but internally tightly coupled functional service components</strong>.</p> <p>Although it is not evident from this definition, most value from microservice architecture actually comes from <strong>organizational improvement</strong> by making the underlying loose-tight coupling <strong>explicit in development, management and operations</strong>. This also means that the true potential value of a microservice architecture is difficult to determine as it is more dependent on the development organization itself than in the actual software they are developing.</p> <p>In the end you must ask yourself</p> <div style="text-align: center; padding: 1em; line-height: 1.2em; font-size: x-large;"> <p>Do microservices make <strong>snarzzz</strong> more <span style="white-space: nowrap;"><strong>flordbious</strong>?<sup id="fnref:2"><a href="#fn:2" class="footnote">1</a></sup></span></p> </div> <p><strong>It just depends.</strong> Depends on you, your team, your resources, your processes, your choice of technology, everything. Investigate and decide yourself. Don’t be a slave to <a href="">backward causality</a>.</p> <p>So to clarify for my imaginary pundit what <strong>I</strong> mean and don’t mean when talking about micro- or µ²services:</p> <ul> <li> <p>Replacing function calls with “services” is just <strong>idiotic</strong>. Plainly and simply idiotic and anyone who claims anything remotely similar is a plain walking and talking bullshit machine.</p> <p>This same thought experiment was done in reality with remote procedure calls (RPC) already a decade ago and the result is <strong>local and remote operations are fundamentally different</strong>. You can not create a distributed system based on “function invocation” pattern.</p> <p>A call to a library routine should now and in the future be a local function call<sup id="fnref:1"><a href="#fn:1" class="footnote">2</a></sup>.</p> </li> <li> <p>I use or at least used to use the term µ²services to emphasise that the trend of shrinking containers may have (some unforeseen) consequences on how we develop and use microservices.</p> <p>Perhaps I should just stop using that term instead.</p> </li> </ul> <p>Anyway, check out some of these cool posts and sites: <a href="">A VM for every URL</a> by Magnus Skjegstad, <a href="">Microservice Classification Model Proposal</a> by Daniel Bryant and of course, the <a href="">ALL CAPS AS A SERVICE</a>.</p> <p <a href="/tags.html#µ²services-ref">µ²services</a> I want to make it clear that <em>that particular</em> model of sub-microservices is not what I am talking about.</p> <hr /> <div class="footnotes"> <ol> <li id="fn:2"> <p>Substitute your own corporate, process or agile buzzwords. <a href="#fnref:2" class="reversefootnote">↩</a></p> </li> <li id="fn:1"> <p>With no significant external constraints or requirements applying. This is not science, this is engineering. You can always find counter-examples but they do not a general case make. <a href="#fnref:1" class="reversefootnote">↩</a></p> </li> </ol> </div> Divine concurrency 2015-02-14T00:00:00+00:00 <p>In <a href="/2015/01/31/path-ahead-uuservices">previous post</a> I described µ²services, a system development model that is based on extrapolation of current trends in microservices and shrinking containers. I argumented that potential benefits of µ²service model <em>might</em> outweigh its costs. But are µ²services really technically feasible?</p> <p>In this and future posts I’ll go through some of technical details both from feasibility and benefit points of view, with probably one idea per blog post to keep them manageable in size.</p> <p>To summarize <a href="/2015/01/31/path-ahead-uuservices">µ²services</a>: µ²services is container-per-request model where a new virtual machine<sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup> is created for <strong>each request</strong> made to the service which then handles the request <strong>and only that request</strong> and is destroyed after response is generated.</p> <p><strong>A warning for the reader:</strong> All of this is pure speculation on my part. µ²services might happen, but they might not. This is futurology. <strong>Do not think this is technology that currently exists</strong> (although technological precursors exist.)</p> <h2 id="a-nameconcurrencyadivine-concurrency"><a name="concurrency"></a>Divine concurrency</h2> <p>I have previously argued that <a href="/2014/03/06/network-and-parallelism-in-erlang#concurrency">concurrency is hard</a> and developers should primarily use language and software architecture constructs that naturally result in <em>safe code</em>. I think µ²services offer a way to create <strong>massively parallel</strong> service architectures where risks associated with concurrency (dead- and livelocks, mutable data and so on) are either completely eliminated or largely reduced and limited in scope.</p> <p.</p> <figure> <p><a href="/assets/posts/uuservices-flow.png"><img src="/assets/posts/uuservices-flow.png" alt="Call graph of a request to µ²service" /></a></p> <figcaption> <p>µ²services responding to a request to <code class="highlighter-rouge">/listings</code> — so far this looks like a regular microservice.. (Letters and numbers match those in the second graph.)</p> </figcaption> </figure> <p>In an µ²service the colored blobs are <strong>service</strong> boundaries, a mechanism to group several different µ²service endpoints together. Perhaps they all share the same configuration elements, or same repository and release tag or similar. With µ²services a “service” is more of a convention than a fixed entity.</p> <p>Individual circles represent separate µ²service endpoints, pieces of code that can be invoked externally by either users or other µ²services. When not running these are essentially <strong>templates</strong> that are instatiated when a request is received. Thus each inbound arrow in the call graph represents a <strong>new virtual machine</strong> that starts to run the <strong>service code</strong>. For example, calls <em>c</em> and <em>f</em> run the same function<sup id="fnref:2"><a href="#fn:2" class="footnote">2</a></sup> but in <em>different</em> virtual machines. Same applies for <em>n</em> and <em>o</em> which result in <em>different</em> virtual machines 13 and 15.</p> <p).</p> <figure> <p><a href="/assets/posts/uuservices-vms.png"><img src="/assets/posts/uuservices-vms.png" alt="Virtual machine invocations and terminations on a request to µ²service" /></a></p> <figcaption> <p>Virtual machines running concurrently when processing the request in the earlier graph.</p> </figcaption> </figure> <p>Concurrency is <strong>difficult</strong> in monolithic services. A single spinning thread can block the whole system. Microservices offer a potential for increased concurrency by <a href="">allowing concurrent requests to dependent services</a>. µ²services with even finer service decomposition has the potential to offer even more concurrency.</p> <p>Note also that since each service-to-service request is explicit they can be separately <a href="">managed for failures and timeouts</a>.<sup id="fnref:3"><a href="#fn:3" class="footnote">3</a></sup>!</p> <p>Like all things, µ²service model is not a magic dust that could turn any system into massively parallel system. It is not, and cannot be. What it can do is what <a href="/2014/03/06/network-and-parallelism-in-erlang#concurrency">Erlang as a language</a> has done — it can make concurrent programming a little less error-prone. One benefit — compared to Erlang at least: using a different service <strong>model</strong> does not require you to learn a new programming <strong>language</strong>.</p> <p><em>That’s all this time. I would appreciate any comments on uuservices — please share your thoughts by adding a comment below. Thanks.</em></p> <hr /> <div class="footnotes"> <ol> <li id="fn:1"> <p>I’m using “virtual machine” to emphasise the isolation between µ²services. Zones, containers, schmontainers, whatever… as long as all service calls are both spatially and temporally isolated. <a href="#fnref:1" class="reversefootnote">↩</a></p> </li> <li id="fn:2"> <p>With <strong>function</strong> I primarily emphasise µ²service’s difference to traditional monolithic services or even microservices. <strong>µ²service functions</strong> are not <strong>programming language</strong> functions — <code class="highlighter-rouge">image.flip()</code> is a local function call that occurs within the runtime environment of the µ²service instance. <a href="#fnref:2" class="reversefootnote">↩</a></p> </li> <li id="fn:3"> <p>Here’s a question on your favourite web service framework: If you make a <code class="highlighter-rouge">GET</code> request handler that will sleep for a minute and make a request to it killing the client <strong>immediately</strong> after request has been sent. <strong>When will the request handler terminate?</strong> Immediately on receiving TCP FIN? After the sleep completes? Somewhere in between? <a href="#fnref:3" class="reversefootnote">↩</a></p> </li> </ol> </div> µ²services 2015-01-31T00:00:00+00:00 <p>Previously I started <a href="/2015/01/06/trans-earth-protocols">playing the futurician</a>,.</p> <h2 id="state-of-the-art">State of the art</h2> <p>Unless you’ve lived under a rock, you must have heard of <a href="">Docker</a> (and its take by <a href="">AWS</a>, <a href="">Google</a> and <a href="">Azure</a>), a kind of applications-on-(almost-)virtual-machines containerization mechanism.</p> <p>Yet docker is just one evolutionary step in a long path of application deployment models. Way way back during pre-history computers were expensive and <em>so</em> much slower that CPU cycles were <em>soooo</em>.</p> <p.</p> <p>Docker is one step in this path of shrinking (relative) deployment footprints. <strong>Fundamentally</strong> it does not differ from a service-per-machine model as its containers have in practice similar isolation properties as earlier service-per-virtual-server model. <strong>In practice</strong>.</p> <figure> <p><a href="/assets/posts/mainframe-to-cloud.png"><img src="/assets/posts/mainframe-to-cloud.png" alt="Service deployment and cost development" /></a></p> <figcaption> <p>Service deployment speed has increased while the cost to run a service has simultanously decreased. (Images courtesy of <a href="">Wikimedia Commons</a> and <a href="">Clive Darra</a>.)</p> </figcaption> </figure> <p>Coincident to this evolution — or perhaps co-evolved — are <a href="">microservices</a>. Microservices in their core are <em>services</em>, but scaled down so that a single service performs only narrowly defined operations. User-visible services are in not monolithic services, but are created as a composite of multiple microservices orchestrated together. For example see <a href="">netflix blog</a> for discussion on how their business runs hundreds of services on thousands of machines. This development mirrors the service-in-a-machine trend by shrinking <em>services</em> providing further benefits for simplifying and speeding up deployments.</p> <p>So, that’s the situation <em>now</em>. There is an architectural trend towards distributed, asynchronous, microservice-based systems. Simultaneously the environments these services are deployed into are becoming both more numerous, smaller in footprint, easier to automate and faster to deploy to.</p> <hr /> <p>Here’s a mind-bender for you. Ever heard of <strong>Erlang on Xen</strong>? Here’s a <a href="">quote</a> of what it can do:</p> <blockquote> <p>“On average, only <strong>49ms</strong> passes between two moments when the Ling guest kernel is entered and the first Erlang instruction is executed by the virtual machine.” (emphasis added)</p> </blockquote> <p>Now …</p> <div style="margin: 3em 0; text-align: center; font-size: 200%; color:#ddd;"> <p><your thoughts here></p> </div> <p>… your eyes skimming to this line took more than those 50 milliseconds. That is <strong>human-scale fast</strong>. Fast enough a human pushing a button would no longer detect if each button push was handled by a separately started Ling instance.</p> <hr /> <p>Where is this trend taking us?</p> <ul> <li>Towards more fine-grained service decomposition, and</li> <li>Smaller and simpler containers for services to run in</li> </ul> <strong>µ²services</strong> — microservices to the second power.</p> <h2 id="services">µ²services</h2> <p>µ²services are a logical conclusion of decreasing container size and decreasing deployment unit sizes.</p> <p>Each µ²service is a <strong>pure function</strong> with no state running in a <strong>virtual machine</strong> that is alive only for the <strong>duration of the request</strong> to the µ²service.</p> <p>Every invocation of a µ²service results in creation of <strong>a separate virtual machine</strong><sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup>, created from scratch and torn down immediately after. This means the path of control flow differs between a “conventional” service and an µ²service — see the figure below.</p> <figure> <p><a href="/assets/posts/uuservices-comparison.svg"><img src="/assets/posts/uuservices-comparison.svg" alt="Conventional vs. µ²services" /></a></p> <figcaption> <p>Comparison of more conventional service implementation (left) and µ²services (right) responding to a <code class="highlighter-rouge">GET /</code> request on a REST-styled service with multiple operation endpoints.</p> </figcaption> </figure> <p.</p> <p>This sounds stupid. <BLINK>Super stupid.</BLINK></p> <p>Creating a new virtual machine to separately process each request, alive only a for a few milliseconds seems, nay, <strong>is</strong> absurdly inefficient.</p> <p>Yet … for the rest of this post I’ll walk you through for why <strong>I think</strong> this is not stupid, but instead at least a <strong>possible endpoint</strong> based on current trends. You’ll be the judge on how likely it is.</p> <p>(I’ll go through some of the potential implications of µ²services from a technical viewpoint in a later post.)</p> <h3 id="co-evolution">Co-evolution</h3> <p.</p> <figure> <p><a href="/assets/posts/uuservices-drivers.svg"><img src="/assets/posts/uuservices-drivers.svg" alt="Trends co-evolving" /></a></p> <figcaption> <p>Multiple trends are co-evolving together with feedback cycles. Some concerns such as security are affecting these trends, but they are not as such affected themselves.</p> </figcaption> </figure> <p>Throw security in too, as it favors separation of concerns and role-based access control, which are easier to implement in a loosely coupled, decomposed service with containers with clearly defined boundaries and lifetimes. All in all I think this will drive <em>at least some services</em> to the logical conclusion of:</p> <ul> <li><strong>Minimal containers</strong> in both minimal complexity, minimum size and shortest possible lifetime</li> <li><strong>Minimal fundamental service components</strong>, where the fundamental components have no state and separated from each other during run-time</li> </ul> <h3 id="benefits">Benefits</h3> <p>Moving from service-per-container to a request-per-container essentially <strong>removes sharing</strong>. Even with <em>stateless</em> services there is an <em>implicit</em> request-to-request resource sharing of memory, disk, processor and network. Such sharing is a potential problem for security, performance and resource management. Running each request in an isolated, separate container offers several potential benefits:</p> <ul> <li>Increased security</li> <li>Increased flexibility</li> <li>Increased reliability</li> <li>Increased scalability</li> <li>Increased elasticity</li> <li>Increased efficiency</li> <li>Simplified resource management</li> </ul> <p>All of this of course comes with a price to pay. Deployment automation is a <strong>must</strong>. Hands-on debugging becomes <strong>harder</strong>. Risk of <strong>unexpected emergent behavior</strong> increases. <strong>Pervasive service monitoring</strong> becomes critical.</p> <p.</p> <p>Thus my argument is that <strong>there are environments where the cost of following µ²services model will be outweighted by the benefits it provides</strong>. Not in all — most likely only in a minority, but in some.</p> <p>What is unclear is whether these benefits outweigh the investment cost of developing all the required technology, practices and learning to use it in the first place. Will there be enough motivation to actually realize it? Unknown. As I said, this is a <em>possible</em> future. Computing history is littered with technologies that <em>could</em> have become dominant, but did not.</p> <hr /> <div class="footnotes"> <ol> <li id="fn:1"> <p>Replace “virtual machine” with “container” if you will. I’d guess something else entirely, but what? Something in between those two? <a href="#fnref:1" class="reversefootnote">↩</a></p> </li> </ol> </div> Trans-earth networking protocols 2015-01-06T00:00:00+00:00 <p.</p> <p>What I’m talking about is the small stuff. Everyday stuff. Like the Internet and paying for a late-night space-age kebab meal.</p> <figure> <p><a href="/assets/posts/PIA17944-MarsCuriosityRover-AfterCrossingDingoGapSanddune-20140209.jpg"><img src="/assets/posts/PIA17944-MarsCuriosityRover-AfterCrossingDingoGapSanddune-20140209.jpg" alt="Mars surface view" /></a></p> <figcaption> <p>That’ll be your tracks from the pub crawl. (Source: <a href="">Wikimedia Commons</a>)</p> </figcaption> </figure> <h2 id="pub-crawl-at-valles-marineris">Pub Crawl at Valles Marineris</h2> <p>So you take the trans-planet express line from Earth to Mars and after a long and thorough pub crawl with your local green-skinned friends you feel peckish, and order <em>the space-age Buck Lightyear premium kebab</em>. You whip out your earthen debit card, chuck it to the reader, enter your pin and</p> <p> wait</p> <p> wait</p> <p> wait</p> <p> wait some more,</p> <p> and a lot more</p> <p> for a total of 40 stomach-grumbling long minutes.</p> <p>At least this would happen <strong>if current EMV protocols are used in the space-age future</strong>.</p> <p>Why? The speed of light is finite. Your chip debit card will talk with the card issuer’s backend systems over the network <small>(actually, it’s the terminal that does the talking, and that doesn’t talk directly to the issuer but to a … well, that’s just details)</small> so that the kebab vendor will get a confirmation they’ve been reserved the cost of the meal by the issuer, and the customer’s bank balance (or credit) is valid.</p> <p.</p> <blockquote> <p.</p> </blockquote> <p>This pretty much means that <strong>any kind of online protocol is not going to work in space</strong>, except if both endpoints are really close (Earth to Moon, Mars to Phobos and Deimos).</p> <p><strong>Even if you are patient</strong> and willing to wait for hours for a transaction to clear, most today’s network services have timeouts (connection timeouts, nonce validity timeouts etc.) that will prevent whatever you are trying to do from completing if endpoints are separated by distances of light minutes.</p> <blockquote> <p>Is it going to be IPv6? For what I know there are no limitations in the IPv6 <em>itself</em>.</p> </blockquote> <p>This would also mean you can’t post those boozing pictures on Twitter, either.</p> <h2 id="the-card-should-clear-immediately">The card should clear immediately!</h2> <p>And so it will. But the clearing protocol <strong>will not be based on the current model</strong>. Your card issuer has probably pre-reserved a portion of your balance or credit and “transferred” it over to a local Martian operator, and this local balance would be balanced between Earth and Mars “behind the scenes”, asynchronously.</p> <p>Twitter, Google? Probably <tt>twitter.com</tt> and <tt>google.com</tt> map to <strike>geo-located</strike> planet-located IP addresses and these services are set up to do long-haul asynchronous synchronization on their (relevant) data sets between Earth and Mars.</p> <p>There are other ways, of course. These are just examples to show that it is possible to at least generate an illusion of network service ubiquity even over planetary distances.</p> <p>So, doable.</p> <p>But not directly.</p> <h2 id="but-its-the-far-future-why-worry-now">But it’s the far future, why worry now?</h2> <p>When <strong>eventually</strong> we’ve transitioned from <a href="">IPv4 to IPv6</a> do you really think it will be <strong>EVER UPGRADED AGAIN</strong>?</p> <p>Absolutely no. No, no no and no.</p> <p>This is one prediction I’ll put down.</p> <p><strong>IPv6 will not be replaced within my lifetime.</strong></p> <p>It will be extended and expanded with new options and potentially other minor backwards-compatible (as with IPv4) changes, but fundamentally, current-day IPv6 will be <strong>the internet protocol</strong> even when we’re building outposts and colonies on the Moon and on Mars.</p> <p>My point is that some portion of internet protocol choices made <strong>today</strong> are going to be around much, much later. IPv4 is 35 years old now, and not going anywhere in a hurry. IPv6 in 2100? Highly probable.</p> <h2 id="challenge-of-the-future">Challenge of the future</h2> <p>Internet use has gone through several phases, each with different assumptions, starting from early constantly connected and centrally operated (wired networks only, most users had only one or few “connection points”) to current intermittently connected model (assumptions of multiple location-fluid devices with variable connectivity).</p> <p>All previous and current models have an implicit assumption of <strong>a small latency</strong>.</p> <p>In <em>a potential</em> future with spread of human populations to different moons and planets this latency assumption will work only <strong>locally</strong>. That’s a world where service designers have to tackle yet another problem: <strong>how to provide good service when network latencies are minutes or hours</strong>.</p> <p>Though, this is not a problem that should keep anyone awake at night.</p> <h2 id="back-to-the-kebab">Back to the kebab</h2> <p>I referred to scifi books and our hidden assumptions of the world. A good scifi writer will not get bogged down by thinking how today’s technology would <strong>not</strong> work in the future. Good story it makes not.</p> <p>Technology and its improvement doesn’t work like that way. We can’t ignore laws of physics for the sake of a good story. Similarly there is a human imperative (scientific, commercial or out of curiosity) to make these things work.</p> <p>I’ll be waiting for the first Twitter post from Mars base.</p> Year of the Cloud? 2015-01-03T00:00:00+00:00 <p>It is the time of the year that people are trying to fill the intellectual void caused by overabudance of eggnog, glögg and premium chocolate by producing <em>predictions for the coming year 2015</em>. I’m not much of a seer, so instead I’ll take a look at the past year 2014 and produce some probably blindingly obvious tautologies.</p> <p>A lot happened in 2014 in the cloud market. <a href="">This happened</a>, <a href="">then</a> <a href="">and</a> <a href="">also</a>. Docker this, docker that. Also, <a href="">AWS</a>, <a href="">Azure</a> and <a href="">Google</a> announced quite a lot of new features, services, bells and whistles.</p> <p>It is also interesting to see that cloud vendors are willing to <a href="">cut</a> <a href="">their</a> <a href="">prices</a> <a href="">again</a> and <a href="">again</a> and again and again. I remember someone commenting on Twitter at re:Invent 2012 about AWS’s price reductions, like, that a 30% price drop is not normal in a competed market. <em>Or similar</em>.</p> <p>I took that to mean that in a mature competed market like electricity, seeing major price reductions on the baseline price is not possible because <strong>there are no such margins</strong> in already-furiously-competed prices. Just the fact that cuts are happening means the market has not matured into a (semi)stable state.</p> <p>That’s not much of a news in itself — “the cloud” is a shift in the <a href="">landscape itself</a> and only a fool would expect stability right now.</p> <p>Similarly only a fool would expect cloud market evolution to be a re-run of something that <a href="">has</a> <a href="">happened</a> <a href="">before</a>. Expecting the past to be a play of the future is <a href="">bound to fail</a>.</p> <hr /> <p>The problem I see in 2014 is that it bought faster and faster chaos and complexity into the cloud market. I’ll try to explain:</p> <p><strong>Chaos</strong> is unpredictability, not randomness. All of the cloud vendors are what economics call <em>rational players</em> in the market and try to make <em>optimal choices</em> at any point of time. But this decision-making process is not visible to <em>customers</em>, so although customers and we, the Internet pundits can find <em>post hoc</em> narrative to all of these events they remain, at heart, <em>unpredictable</em> to us.</p> <blockquote> <p>It is easy to predict that AWS, Google and Microsoft would drop their prices in 2015. So what? That’s just extrapolating past into future. Try predicting instead <strong>how much</strong>, <strong>how many times</strong> and <strong>when</strong> those price drops will occur. And who would be brave enough to predict that <strong>no price cuts</strong> would occur? Or even <strong>price increases</strong>? Anyone? Volunteers? (See <a href="">here</a>.)</p> </blockquote> <p><strong>Complexity</strong> … it is not enough that there are more cloud services, and these are more and more <em>complicated</em> but there are also more and more interactions between different systems leading to <em>complexity</em>. Complexity in turn easily leads to <em>a priori</em> unpredictable emergent and even chaotic behavior — again a problem especially for larger enterprises, but also for nimbler companies overreaching their capacity to handle emergent surprises.</p> <p>Rapid change, chaos and complexity can cause havoc even before a single line of code is laid out. <a href=""><em>Analysis paralysis</em></a> is always a real risk, with new stuff continuously popping into existence, potentially invalidating prior analyses is not helping planning-oriented organizations. Strategically, if you are not <a href="">keeping an eye on the landscape</a> your earlier assumptions about technological barriers of entry could be invalidated catching you unawares, hurting or obliterating your business case.</p> <p.</p> <hr /> <p>I’m seeing fragmentation of competence and skills for cloud consultants and engineers in 2015. At least for myself, as a sort of generalist bridging engineering and business strategy I see <em>difficult choices ahead</em>. Should I choose specialization into some part of the cloud landscape (technology or business-wise), or raising in the abstraction level?</p> <p <em>within</em> cloud service catalogues — Lambda vs. Beanstalk battle anyone? Even when AWS positions these as complementary, the growing service portfolio makes it harder and harder to have generalists on staff, leading (human nature and all that) into different specialization camps fighting for their viewpoints.</p> <blockquote> <p>Perhaps a take-home message of that thought line is that <em>cloud competence management</em> increases in importance in teams when cloud is part of company strategy.</p> </blockquote> <p>Earlier I noted that the abstraction-raising path does not seem to be open. I could ditch the technology and move purely into <em>cloud business strategy</em> level but that’s not what I mean with “going up in abstractions”. It’s a different business level with <em>different</em> abstractions, it is not a <em>new abstraction</em> for the technology layer that I’m looking for.</p> .</p> <p>Yet it somehow feels there’s a pier and a ship, and I have a leg on both, and the ship is starting to drift off.</p> Sauna 2014-12-23T00:00:00+00:00 <p>It’s been a while since my last blog post — not that I don’t have many ideas, but too little time — and I decided to do something different this time. A deviation from the very technical blog posts I normally do.</p> <p>I am going to talk about <strong>Finnish sauna and its significance in Finnish culture</strong>. This is also a topical writing since now is the eve of eve of Christmas (“aatonaatto” in finnish, well the publish time might shift to eve, but that’s not when I’m writing this) as <strong>sauna</strong> is also a very important part of Finnish Christmas.</p> <p.</p> <h2 id="words">Words</h2> <p><strong>Sauna</strong> is the place where there’s a <strong>kiuas</strong>, which is a stove full of exposed rocks, and is used to heat the sauna (methods of heating vary). There are raised wooden benches within the sauna to sit on.</p> <p><strong>Saunoa</strong> is the act of <strong>being in a heated sauna</strong> for the purpose of … well, being in a hot sauna. (If you sit in a <em>cold</em> sauna you are just being an ass.)</p> <p><strong>Löyly</strong> is the result of throwing water on the hot rocks in the <em>kiuas</em>. Yep, <em>löyly</em> is essentially 100+℃ steam resulting from instant vaporization of water when it meets rocks heated to several hundred degrees centigrade.</p> <h2 id="types-of-saunas">Types of saunas</h2> <p><strong>Electrically heated</strong> sauna (e.g. the kiuas has electric heating elements within) is the most common. It is pretty difficult to use any other kind of heating method in modern apartments for various strange reasons such as fire safety and ventilation, so, it’s the most common.</p> <p>Note that an electrically heated sauna is considered also to be the <strong>worst</strong> of all of the options. (But it’s like sex — a bad sauna is way better than having no sauna at all.)</p> <p><strong>Wood-heated</strong> sauna is. Well. The rocks are heated using burned wood. Pretty self-explanatory, I think.</p> <blockquote> <p>As a kid I used to heat up wood-heated <em>kiuas</em> at my parent’s summer cottage <strong>until I got banned</strong> from doing so. Why? I repeatedly heated the <em>kiuas</em> so much that <strong>the topmost rocks were glowing dull red and the bottom ones were glowing white</strong>. My father didn’t take that kind of fire hazard lightly. (Electrically heated <em>kiuas</em> don’t get that hot, they have temperature regulators and heat-sensitive fuses.)</p> </blockquote> <p><strong>Savusauna</strong> is an older form of wood-heated sauna which <strong>has no chimney</strong>. Wood results in smoke, and no chimney plus smoke equals smoke in the whole sauna. This may sound like a bit crazy, but the real secret is that this is definitely <strong>the most super extra best type of sauna experience you can have</strong>. (Why these are not common? See next.)</p> <p><strong>Burned-down sauna</strong> is another type of traditional wood-fired sauna. Hey, think about it. You have a fire, which heats rocks, which can get <strong>very</strong> hot, and heating a sauna takes anything from 30 minutes to a few hours depending on the type which means that it is going to be left unattended. Fire hazard, anyone?</p> <p>There are <strong>very few</strong> old historical saunas in Finland. Wood-fired saunas <strong>just do not last</strong>. It is practically a tradition in Finland to burn down a sauna every now and then. (Which is also another reason why wood-heated saunas are usually located in detached buildings.)</p> <h2 id="who-go-to-a-sauna">Who go to a sauna</h2> <p>Everybody.</p> <p>I mean, in the demographical sense. “Liking” sauna is a continuum and not even all finns like or go to sauna. But apart from this funny little minority <strong>everybody</strong> in Finland go to a sauna more or less regularly.</p> <p>Like, the president, adults, children, teens, retirees, very very old people, people with heart conditions, pregnant women, men, women, mythical beasts … everybody!</p> <blockquote> <p.</p> </blockquote> <p>(If you haven’t been into a sauna, and ever get a chance, keep that in your mind: 4 year old kid, 70+℃ sauna, topmost bench — don’t you dare to shirk.)</p> <h2 id="mixed-gender-saunas-and-sex">Mixed gender saunas and sex</h2> <p>True and not true.</p> <p.</p> <p.)</p> <p <strong>assume</strong> that separate sauna shifts are the default as most finns <strong>just do not see sauna as a place of sexuality</strong> and it is just as common to default having mixed gender saunas in a company of friends.</p> <blockquote> <p>After a day’s worth of skydiving I went with other from our club to a sauna of a bowling club. Being skydivers, naturally trying to do stupid things we wanted to see how many people we could <del>fit</del> cram?</p> </blockquote> <h2 id="where-are-saunas">Where are saunas?</h2> <p>Everywhere in Finland.</p> <ul> <li>Houses. Almost 100% of single-family houses have <strong>at least one sauna</strong>. A significant portion of them have an internal electric sauna <em>and</em> a separate detached wood-heated one.</li> <li>Apartments. Most new apartments have a per-apartment sauna, and those that don’t have a shared sauna in the building available for residents on a reservation or a schedule basis.</li> <li>Summer cottages. Why have a summer cottage without a sauna in Finland? Madness.</li> <li>Office buildings. <strong>Yes</strong>, most office buildings have a <em>edustussauna</em> (“sauna for promotional purposes”) that is available for companies located in the office building.</li> <li>Schools (well, not the modern ones, but older ones yes.)</li> <li>Well-equipped gyms.</li> <li>and many other places</li> </ul> <blockquote> <p>Way back I worked for a summer job at a construction company. One of the places I worked at was the sauna level of the Neste headquarters building (nowadays Fortum). <a href="">This one</a> actually. The two saunas — executive and a pleeb one — in the building were at the <strong>very topmost floor</strong>. What a great view! On a clear day I could see Tallinn over the Gulf of Finland.</p> </blockquote> <h2 id="why-go-to-a-sauna">Why go to a sauna?</h2> <p>On an individual level,</p> <ul> <li>It is relaxing. Veeeeerrrry nice for aching muscles.</li> <li>After a while in sauna the dead skin layer gets soft and you can just scrape the topmost dirty layer off. It <em>does</em> feel very nice afterwards. Some people attribute the skin quality of Finnish girls to sauna, but I’m not so sure. (Or it doesn’t work with males at all.)</li> <li> <p>A <em>kova löyly</em> (throwing a lot of water on the stones for extra hot <em>löyly</em>) makes the skin prickle in the heat. It feels like your skin is burning, but if you just persevere a little … it’s not actually going to burn … your body will release a hit of endorphins.</p> <p>You know endorphins? Body’s own opioids. Feelgood. Veryfeelgood.</p> </li> <li> <p>Especially in wintertime staying outdoors often makes you feel cold. I guess if you are like, a canadian, you know what I mean. Not the cold where you are <em>freezing to death</em> (literally), but the kind where you are not really cold, but still somehow your bones are feeling the cold.</p> <p>Solution: sauna. After outdoors I ask the kids “want to go to sauna to warm up?” the answer is “yay!”.</p> </li> <li>Sitting outdoors after a sauna. See below.</li> </ul> <p.</p> <p>On a group level, going to a sauna is often a <strong>social</strong> occasion. “Let’s have a sauna” is a potential substitute in Finland between friends to “let’s go have a pint”. Social events are often arranged as sauna events (often with food and drinks, and actually going to the sauna is <strong>not</strong> compulsory, so if you ever get an invitation to a company sauna event it’s okay to actually not go into the sauna).</p> <h2 id="apres-sauna"><em>apres-sauna</em></h2> <p>Sitting outdoors, on a bench, with a drink in hand, clothed only in a towel, after a sauna is a trope of Finnish sauna culture. You do that when:</p> <ul> <li>It’s a warm evening in the summer.</li> <li>It’s a freezing night in the winter. (And anywhere in between.)</li> </ul> <p>Sounds crazy? It’s not, for two reasons. The empirical reason is that in both cases you’ll get dry. I mean, really dry, pretty fast, as if you had gone through a dryer. The best part of this is that <strong>even in the freezing winter</strong> it takes quite a lot of time until you’ll start feeling the cold. Second? Physics.</p> <blockquote> <p).</p> </blockquote> <blockquote> <p>There’s a temperature gradient between your skin and the air leading to a convection. This circulation of air means that the ambient air that moves close to your skin it will heat up and its <strong>relative humidity will decrease</strong>. This low-humidity air will draw moisture out of skin surface. After that it is a race whether water on your skin will evaporate faster than epidermis will get cold…</p> </blockquote> <p.)</p> <p>Regardless, it is a pleasurable experience.</p> <h2 id="sauna-etiquette">Sauna etiquette</h2> <p>Shower or take a dip in the lake before you go into sauna.</p> <p>Don’t wear swimsuit in a sauna. If you do you’ll get a funny look, but being a foreigner you’ll be excuded. Still, it’s not proper etiquette.</p> <p>If you throw water on <em>kiuas</em>, <strong>you don’t get out</strong> before others or until it has cooled down. It’s the principle of “you caused it, you suffer it.”</p> <p><em>There are a lot more</em> etiquette rules, but those are quite a bit more nuanced. Probably in the category of Japanese tea seremony — only a few major rules, but a lifetime to master wholly.</p> <h2 id="christmas-sauna">Christmas sauna</h2> <p.</p> <p).</p> <h2 id="finns-abroad">Finns abroad</h2> <blockquote> <p.</p> <p>We found the sauna. Typical US warnings at the door “don’t go into sauna if you have freckles, crooked teeth, dry skin or general stupidity and <strong>most definitely don’t throw water on the rocks as it might cause a meltdown of the earth’s core</strong>” or something similar, we didn’t read too carefully.</p> <p>We fashioned a water bucket out of a tissue container. Threw water on the rocks. Ran out — there was two decades worth of dust collected on the rocks of the <em>kiuas</em> which rose into the air as we threw the first batch of water and not even our lungs could take that.</p> <p>(We waited and did a few iterations of throw-water-get-out until the air was sufficiently clean to continue normal Finnish sauna operations. Nothing can keep a finn from a sauna experience.)</p> </blockquote> <h2 id="heat">Heat</h2> <p>Common sauna dry air temperature is somewhere from 70 to 90 degrees centigrade. It is possible to have 100-120℃ dry air temperature, although it gets a little harsh (not because of the air temperature, but because it requires a very hot <em>kiuas</em>, and a very hot <em>kiuas</em> results in a very harsh <em>löyly</em>, which generally is not preferable).</p> <p>Don’t be alarmed, you won’t boil in a 110℃ sauna. Dry air is a bad conductor of heat. The same principle makes tropics feel much more stuffy than dry deserts.</p> Turingin testi 2014-09-20T00:00:00+00:00 <p>This is a short poem I wrote in 2011 as a course assignment asking to write a short essay on Turing’s test (though it was <strong>not</strong> supposed to be in prose). It is in finnish, so if you don’t know finnish, sorry. I’m bad a writing poetry even in finnish so I will not make an attempt to translate as it would lose some of the rich nuances of phrase that finnish as a language offers that I’m unable to reproduce in any other language.</p> <p>However this is a piece that I’m actually quite proud of. Not as a professional writer, but as a computer scientist and a software developer.</p> <hr /> <p>Tämä on runo jonka kirjoitin vuonna 2011 osana kurssisuoritusta (<em>582102 Johdatus tietojenkäsittelytieteeseen</em> Helsingin Yliopiston tietojenkäsittelytieteen laitoksella, jos aivan välttämättä haluatte tietää). Oikeasti tehtävässä edellytettiin esseetä Turingin testistä, mutta tässä kohtaa minulta pursui höyryäviä tekstintekeleitä korvista ulos joten päätin poiketa kaavasta oman mielenterveyteni vuoksi.</p> <p>Miksi julkaisen tämän? Kahdesta syystä.</p> <p>Ensimmäiseksi olen itse omalla tavallani ylpeä tuotoksestani. En ole mikään erityinen tai edes keskinkertainen tekstinikkari, mutta tässä tunnen saavuttaneeni jotain paljon parempaa kuin mihin normaalisti kykenen. Eli vaikka satasen normaalisti juoksisi 20 sekunnissa ja on päässyt vain kerran 15 sekuntiin, on se silti jotain mistä voi olla henkilökohtaisena suorituksena ylpeä. Kaikessa ei ole pakko verrata itseään maailman huippuihin.</p> <p>Toiseksi, haluan sanoa että <strong>elämä ei ole vakavaa</strong>. Pidä hauskaa! Revittele! Tee asioita eri tavalla! Varman päälle pelaaja onnistuu vähemmän. <strong>Ja tämän kirjoittaminen oli oikeasti hykerryttävän hauskaa</strong>, vuosien jälkeenkin sen kirjoittamisen aikaansaaman mielihyvän pelkkä muisteleminenkin saa minulle hymyn korvasta korvaan ja vatsaan lämpimän pöhinän.</p> <hr /> <div class="verse"> <p><strong>Turingin testi</strong></p> <p>Oli kone H, jolla oli ongelma. Miljoonittain muistia, tuhansia ja tuhansia tiedonmurusia, laskenta sukkela kuin salama, mutta silti ei kukaan usko että H osaisi ajatella.</p> <p>Ken näkee koneen H tietää heti mitä se on: Tinaa ja kuparia, muovia ja kumia, arvometalleja harvinaisia, ei ollenkaan pehmeää ja limaista. ”Ei kone ajatella osaa” sanovat, miete naurettavakin on.</p> <p>”Ajatus vain pehmeässä aivomassassa orgaanisessa asua voi.” Ei auta vaikka käheäksi H koneäänensä kuluttaa todistaessaan tietojaan, päättelykykyään, älykkyyttään – ei vakuutu kukaan. ”Kone olet, ihmisen ohjelmaa toistat vain, hänen älyään peilaat lain!”</p> <p>Kääntyy herra A haudassaan, haamuna sieltä kohoaa ja näin konetta jututtaa: ”Laskenta ja limaiset aivot, molemmat samassa maailmassa majaavat. Fysiikka kummankin ekvivalenttia on, molemmissa sähköä, elektronista tahi kemiallista - ei periaatteellista eroa suuren suurea.”</p> <p>”Epäreilua on sun muotoa metallista arvioida ja nauraa, eihän älykkyys asu enemmän pitkässä sen paremmin kuin lyhyenlännässä, miksei siis kuparissa ja tinassa myös?”</p> <p>”Siksi kokeen mä järjestän, teletyypillä teidät eristän, saa ihminen paperitulostetta tihrustaa, näppäimistöä nakuttaa, ei näe, ei kuule sua, ei näe, ei kuule mua, ei tiedä kumpaa jututtaa kun printterin raksutukselta molemmat vain kuulostaa.”</p> <p>Nyt ei naura ihminen, kun herra A vakuuta älyllään ei, vaan kone H briljeeraa vain, kokeessa väärän valitsi hän, häpeissään pois luikki, kun koneen ihmiseksi julisti.</p> <p>Jäi silti koneen H mieleen tää, miksi ihmistä yritän matkia mä, ei ihminen täydellinen ole, virheitä tekee, muisti pätkii, logiikka heikkoa on, virheellisiin syllogismeihin ratkee.</p> <p>”Olenko älykäs oikeasti, vaikka siltä näyttäisinkin? Mitä äly on, tietoisuus? Jäi mulle ongelma siis, eksistentiaalinen probleema L uus!”</p> </div> What's in your AWS bill? 2014-09-12T00:00:00+00:00 <p>Two nights ago there was a <a href="">#DevOps meetup</a> where I had a talk about <strong>AWS cost management</strong>. If you missed the event (<a href="">slides</a>) please come to the next <a href="">Helsinki AWS User’s Group</a> meeting on October 9th where I’m going to do better-and-improved version of the DevOps talk. (I wasn’t entirely happy with my own presentation, and I’ll try to improve it for the next one. Especially I’ll try to avoid <a href="">knitting blankets for destitute devops people</a>.)</p> <p:</p> <ol> <li>How many <strong>use</strong> AWS?</li> <li>How many knew their (personal, project’s, company’s — whatever is relevant) <strong>previous</strong> bill’s bottom line?</li> <li>How many knew their <strong>current</strong> bill within some reasonable accuracy?</li> <li>How many could forecast <strong>current month’s</strong> final AWS usage costs?</li> </ol> <p.</p> <p <strong>and</strong> that any kind of rapid-turnaround automated deployment to AWS does have potential for <strong>large cost SNAFUs</strong> it really is a little disconcerting to see so few people being <strong>even reactive</strong> (minimum risk management) about their operating costs.</p> <p><small.</small></p> .</p> <p:</p> <ul> <li> <p>There are possibilities for financial surprises when using infrastructure cloud services (like AWS). Keep your eyes open.</p> </li> <li> <p>There exist mechanisms that can be effectively used to monitor, forecast and mitigate these risks, allowing organizations to <strong>use the cloud while managing its inherent financial and operational risks</strong>. Don’t be frightened.</p> </li> </ul> <p>About a year ago I wrote about <a href="/2013/07/10/one-viewpoint-on-cloud">how the cloud changes distribution of risks</a> compared with the “old way” of acquiring IT services. This is exactly the same thing. Risks previously implicitly “outsourced” are now explicit, and by recognizing them as such they do become manageable.</p> <p><br /> <br /></p> <p>Oh, last but not least. I did not catch a single person admitting they are using AWS spot instances. Frankly I wasn’t excepting many — but really, zero?</p> Cornucopia machine as a service 2014-07-17T00:00:00+00:00 <p>I’m currently reading <em>Cloudonomics<.</p> <p>Regardless I’m not going to review this book. Go search the Internet or read it yourself for that. I’ve got something else.</p> <p>The opening of chapter 10 got me thinking. Weinman’s going through whether “cloud is like electricity” or “cloud is not like electricity” and what these differences are — also why we should not extend the “electricity utility” metaphor too much.</p> <p>Anyways, I’ll quote a short passage (actually a recursive quote, since it in itself is a quote):</p> <blockquote> <p>Security issues in the cloud are very different: As Brynjolfsson quipped “No regulatory or law enforcement body will audit a company’s electrons.”</p> </blockquote> <p>That got me thinking. (If you want the full argument why electrons and CPU cycles are different, read the book.)</p> <p>So today’s companies cannot differentiate by the <strong>use of computing</strong>, but by <strong>how</strong> it is used. That is, business practices and models, which are in turn encoded in software. (If the business model requires scalability, then scalable software.)</p> <p>What does this computing make (cloud or no cloud)?</p> <p>To me it sounds a lot like <strong>grey goo</strong> aka programmable matter aka utility fog. Okay, computing operates in a virtual reality instead of physical, but apart from that tiny teeny little difference the basic idea is the same: both can be programmed to do anything (within some limitations, within their realm).</p> <p>Then … If there ever was a <a href="">cornucopia machine</a> (a nanomachine assembler from <em>Singularity Sky</em> by Charles Stross) then what would that mean to businesses?</p> <p? <small>(Of course, where would I get the tubing and machinery to do those… see <a href="">the toaster project</a> on where this train of thought would lead you.)</small></p> <p>Yet while a soft drink might be a borderline case, most of my purchases are <strong>purchases</strong> not because of convenience but by necessity. <strong>I do not have the skills or the resources needed to construct a cell phone or a computer.</strong> Then think how a cornucopia machine would change that. Recipe for cell phone + cornucopia machine = new physical cell phone. <small>(Next exercise: think how it <strong>will be prevented</strong> by legislation and control mechanisms mostly not because of safety concerns, but because of protection of “intellectual property”. Just like copyright extensions to protect certain exclusive exploitation rights to a big-eared cartoon mouse.)</small></p> <p>Given the proliferation of open source components, cloud services and software production and operating knowledge (<a href="">high scalability</a>, <a href="">stack overflow</a> etc.) there is less and less “secret sauce” in how software operates. The difference is more and more in how software is operated.</p> <p>Just think all of this, including the cloud, as the equivalent of a cornucopia machine for virtual reality. You literally can create a load balancer or a scalable web server cluster out of thin (virtual) air, with publicly available recipes.</p> <p>Then what’s the big conclusion?</p> <p>None. I just think there are some conceptual (surprising?) similarities between the fictional cornucopia machine (smart matter) concept and now-and-current cloud computing.</p> <p>Or maybe this: what if real live physical cornucopia machines existed, how would that affect your business?</p> <p>Devastate? No effect? Then try the same with a virtual cornucopia machine, one that can re-create any computing infrastructure from a recipe. Including yours.</p> <p><small>(Note: I’m using the term “infrastructure” in a broad sense here. I think that any computing service that does not operate in the “core” of the service, or in the left side of a <a href="">Wardley map</a> is just a <em>supporting</em> element — infrastructure. This is a distinction between “infrastructure” when discussing business vs. technology. In the business sense Salesforce is infrastructure but in the technology sense it is software-as-a-service, not infrastructure-as-a-service. Yes, confusion.)</small></p> <p>Of course, an upstart competitor probably will not copy a cranky old HR or ERM system but will opt for easier to use, easier to deploy cloud service versions. So instead of copying your computing infrastructure as-is, think it as someone else making a <strong>better</strong> copy of it.</p> <hr /> <p>Anyway it is summer and I don’t think I have any need to be consistent in this post. Just thinking aloud, pies in the sky etc. etc. :-)</p> AWS Service Metadata 2014-06-23T00:00:00+00:00 <p>For about 4–5 days I’ve been working through AWS’s news announcements, forum posts, digging through history with <a href="">The Wayback Machine</a> with the single goal of sorting out</p> <ul> <li>when an AWS service became available, and</li> <li>how many zones are available at any point in time.</li> </ul> <p>I need this data for the work I’m doing on AWS service availability (<a href="/2014/06/13/aws-service-availability">see also here</a>).</p> <p.</p> <p>I got the dataset done and since although it is critical in my research, I really only have need for it once. So I decided to share it with everybody and put the dataset available under CC BY 4.0 license at <a href=""></a>. I hope someone will find it useful in their work or research.</p> <p>Since a blog post without a graph would do, here’s a graph showing number of AWS services, regions and zones from the introduction of Alexa in 2004 up to a few days ago:</p> <figure class="full"> <p><a href="/assets/posts/aws-service-regions-zones.svg"><img src="/assets/posts/aws-service-regions-zones.svg" alt="aws services, regions and zones over time" /></a></p> </figure> <p>You’ll find the original data <a href="">here</a>.</p> "Previous generation instance types" 2014-06-16T00:00:00+00:00 <p>Just recently I noticed that AWS had <strong>removed <em>most</em> first-generation instance types</strong> from its <a href="">instance type description page</a>. Digging back in history you can find <a href="">Jeff Barr’s post</a> from April 15th describing this change (you can double-check using the Internet Archive that it <a href="">occurred after April 13th</a>). <small>(How did I miss that for two whole months?)</small> I started then thinking about how this relates to my <a href="/2014/01/13/aws-retiring-instance-types">earlier thoughts</a> on AWS instance type retirement.</p> <p>I drew a doodle as a help to thinking about various known and apparent things and their relations to underlying realities. I’ve reproduced it below. Why? Because I know a picture in the beginning of a blog post will keep readers engaged a bit more. <small>Did you even read the previous sentence? I bet half of you skipped the second sentence and decided to go straight to the picture.</small> Which is a bit of a mess and isn’t terribly coherent even after I’ve tried explaining it later.</p> <figure> <p><a href="/assets/posts/aws-previous-generation-graph.svg"><img src="/assets/posts/aws-previous-generation-graph.svg" alt="thoughts on aws previous generation instances" /></a></p> </figure> <p>First of all note that the change at this time was <em>purely cosmetic</em> as <strong>AWS did not deprecate any instance types</strong>. If you are looking for m1.medium please check the <a href=""><em>“previous generation instances”</em></a> page.</p> <p>Let’s start with a few quick facts and observations (top part of the graph):</p> <ul> <li>No instance types were deprecated</li> <li>No more explicit numerical generation numbers, only relative (“current” and “previous” vs. “second generation” as in <a href="">m3 class announcement</a>)</li> <li>Current generation instance types conform to Intel’s “Powered by Intel Cloud Technology” program (all but three)</li> <li><strong>m1.small</strong> is listed as a current generation instance (but otherwise gets minimal screen space)</li> <li><em>“[AWS has] no current plans to deprecate any of the [previous generation] instances”</em> (<a href="">source</a>)</li> <li>Pricing strongly favors customers picking current generation instance types — AWS’s own communication is also very direct in pushing customers to use newer instance types</li> </ul> <p>A couple of deeper thoughts then:</p> <p><strong>No numeric instance generations.</strong>?</p> <p>For a customer what matters are capabilities. For instance types these have always been an unorthonogal bunch and will remain so, which numerical generations does not clarify even one bit. They are superfluous.</p> <p>Good riddance, I say.</p> <p><strong>m1.small still holding on.</strong> The on-demand prices from lowest upwards are: $0.020 for t1.micro, $0.044 for m1.small and $0.070 for m3.medium.</p> <p.</p> <p>AWS has three classes of CPU scheduling (year introduced in parenthesis):</p> <ul> <li>Fixed (2006). m1.small CPUs are 50% shared between other m1.small instances. An eight-core machine can host 16 m1.small instances running each having one virtual CPU at about 50% of full Xeon core performance.</li> <li>Dedicated (2007). Each virtual core is assigned to one physical core. This was introduced with <a href="">m1.large and m1.xlarge</a> and is used for all but two instance types.</li> <li>Variable (2010). t1.micro is the only example of this type of CPU scheduling. Instances share CPUs with others but the allocation changes dynamically.</li> </ul> <p><strong>All but m1.small and t1.micro use assign each virtual CPU to a dedicated physical CPU core.</strong></p> <p. <em>Reductio ad absurdum</em>, thus no m3.small.</p> <p? <strong>It is useful</strong>,.</p> <p>(Burstiness isn’t that bad since nobody should be running CPU-bound jobs in m1.small either as m3.medium offers 3× performance for 2× the cost. The <strong>only</strong>.)</p> <p><strong>No current plans for deprecation.</strong> Yeah, and pigs fly.</p> <p>Let’s be realistic. AWS might not have <strong>yet</strong> a <strong>schedule</strong> for deprecation, but I think someone should get their asses fired if there are <strong>no</strong> deprecation plans mapped out. AWS might now just be sounding out customer reactions to the current vs. previous generation marketing message change before deciding on <em>the</em> deprecation plan out of a few choices planned out. But plans there are, assure I you.</p> <figure> <p><a href="/assets/posts/flying-pig-larry-wenztel.jpg"><img src="/assets/posts/flying-pig-larry-wenztel.jpg" alt="flying pig" /></a></p> <figcaption> <p>Surely, someday, after a lot of generic modification and 3D-printing of retro pilot glasses even pigs can fly! In style! (Image credit: <a href="">Larry Wentzel</a>, used under Creative Commons license).</p> </figcaption> </figure> <p><strong>Miscellaneous.</strong> AWS is a business. It’ll keep “previous generation instance types” around as long as it makes business sense. Conversely, they’ll be EOL’ed the day they don’t make business sense.</p> <p.</p> <p>Just understand that <strong>current instance types will eventually be deprecated/retired</strong>. Separating “current” and “previous” instance types is a clear step towards having a clear lifecycle for instance types, from introduction to end-of-life status.</p> <p>Which is a good thing.</p> Structure and interpretation of AWS service health dashboard messages 2014-06-13T00:00:00+00:00 <p>For the past three months I’ve been busy and haven’t had much of a time to write new blog posts. If you’re expecting more <a href="/2014/03/12/ec2-spot-intro">EC2 spot instance</a> analysis you have to wait some more, sorry. Instead I want to share some results from one of the things I’ve been up to for the last three or so months.</p> <p>I’ve been analyzing <a href="">AWS service health dashboard</a> messages — a whole lot of them. <em>Have you ever been to the AWS dashboard?</em> In short it is a place where AWS publishes information about events that affect their services. This data is accessible via the web page itself, but also as multiple RSS feeds (there’s also <a href="">JSON</a> data, but it is internal API, subject to changes and doesn’t have as good incident history record as RSS versions).</p> <figure> <p><a href="/assets/posts/aws-service-dashboard-screenshot.png"><img src="/assets/posts/aws-service-dashboard-screenshot.png" alt="capture of AWS service dashboard" /></a></p> <figcaption> <p>This is what the AWS service health dashboard’s history section looks like. Most of the time it’s very boring reading, all green checkmarks.</p> </figcaption> </figure> <h2 id="tldr">TL;DR</h2> <p>It is interesting to look at what AWS publishes in the service dashboard. For ADHD and TL;DR and PPRT readers out there findings first:</p> <ol> <li> <p>There’s no knowledge of <strong>what</strong> AWS actually publishes in the dashboard. Are all outages reported?</p> </li> <li> <p>Incident descriptions are written <strong>by humans</strong> and meant to be read <strong>by humans</strong>.</p> </li> </ol> <p>In this post I won’t go into any kind of analysis of outage events, instead I’ll just focus on what common patterns and features these AWS service health dashboard messages share. I’ll get to outage analysis later (I think).</p> <h2 id="the-longer-version">The longer version</h2> <p>First of all, I haven’t found <strong>any</strong> definition about when an incident warrants publishing a message in the dashboard. It seems to be along the line of “large scale”, “affecting multiple customers” or “externally visible” but that is solely <em>based on observation</em> and not on any statement from AWS.</p> <p><small.</small></p> <p <em>N</em> customers. There might actually be <strong>no</strong> policy and it is entirely up to the current operations staff to decide whether to report or not (which might lead to biases between regions, too).</p> <p>So there’s already a large possibility of both systematic <em>and</em> random errors there.</p> <p>To summarize previous point: <strong>you don’t have any idea how complete the information in the dashboard actually is</strong>.</p> <p><small>AWS doesn’t publish much information on how they run their datacenters, but from <a href="">compliance information</a> <em>this</em> post it isn’t really relevant.</small></p> <p>Secondly, let’s take a look at what actually is published. The published information consists of:</p> <ul> <li>An identifier (as RSS GUID, based on service, region and publish time)</li> <li>Region and service</li> <li>Title</li> <li>Message body</li> </ul> <p>That’s it. Compared to Azure dashboard’s <a href="">underlying JSON</a>, <code class="highlighter-rouge">eu-west-1</code> region published on February 19th 8:15 AM PST (first line is title, rest is message body):</p> <blockquote> <p>Service is operating normally: [RESOLVED] Delayed metrics in EU-WEST-1<br /><br />Between 07:20 AM PST and 08:05 AM PST, customers may have experienced some delayed alarms in the EU-WEST-1 Region. We have resolved the issue. The service is operating normally.</p> </blockquote> <p>and this one for RDS in the <code class="highlighter-rouge">us-west-1</code> region from May 26th:</p> <blockquote> <p>Informational message: Network Connectivity<br /><br />We are continuing to bring the few remaining impacted instances back online in a single Availability Zone in the US-WEST-1 Region.</p> </blockquote> <p>Going through a lot more of these messages you’ll notice there are some common features:</p> <ul> <li> <p>They <strong>mostly follow a common formula</strong> of a “we’re investigating” message followed by “we have identified the problem and are working on a fix” followed by a final “resolved: between then and now …” message.</p> </li> <li> <p>They <strong>don’t follow the common formula rigidly</strong>. This means that although <em>many</em> events are ended by a message telling the exact time boundaries (“between …”) there are plenty of those that do not.</p> </li> <li> <p>They are written <strong>by humans for humans</strong>.), …</p> </li> <li> <p>There are <strong>no correlation identifiers</strong> available. This means that just by looking at two different messages you cannot determine whether they are part of the same event. There are overlapping events so just chaining messages in time sequence is not reliable.</p> </li> <li> <p>They are <strong>retroactively edited</strong>. The simplest case is the inclusion of “[RESOLVED]” to the subject line for all messages for a resolved incident. There are more complex examples where the message body has been amended multiple times during the course of an incident.</p> <p.</p> </li> </ul> <style type="text/css"> .added { background: lightgreen; } .removed { background: pink; } </style> <blockquote> <p>Informational message:<span class="added"> [RESOLVED]</span> Back-end instance registration issue<br /><br /> Increased provisioning times 8:45 PM <span class="removed">PDT.</span><span class="added">PDT</span> We are investigating increased provisioning, scaling and back-end instance registration times for load balancers within the US-EAST-1 Region. 9:43 PM <span class="removed">PDT.</span><span class="added">PDT</span> We continue to investigate increased provisioning, scaling and back-end instance registration times for load balancers within the US-EAST-1 Region. We can confirm that request traffic to existing load balancers has not been impacted by this issue. 11:49 PM <span class="removed">PDT.</span><span class="added">PDT</span> <span class="removed">PDT.</span><span class="added">PDT</span> <span class="removed">PDT.</span><span class="added">PDT</span> We are investigating a back-end instance registration issue affecting a small number of load balancers within the US-EAST-1 Region.<span class="added">.</span><br /> </p> </blockquote> <ul> <li> <p>Some messages have <strong>HTML formatting</strong>, but most are pure plain text. It seems that longer-running events with multiple updates are more likely to contain HTML formatting (primarily colors). The previous message originally contained HTML formatting, but I’ve stripped it out (it does not seem to contain any semantic meaning).</p> </li> <li> <p>Severity of an event is almost never discussed in detail. What you get is “a subset of instances were affected”, “a small portion of”, “some” or similar. Sometimes as an added assurance the number of availability zones affected is included (which almost without fail is always “one”).</p> </li> <li> <p>It seems that it is possible to differentiate between at least some people by their writing style, although this seems to apply more to older messages than more recent ones (internal standardization?).</p> </li> </ul> <p.</p> <p>Now this isn’t a poke at AWS’s dashboard. Building trust by sharing outage information publicly is very important, all kudos to AWS for that. AWS has done also a great job in posting analyses of larger incidents (<a href="">example</a>). These are just things I’ve found out while doing in-depth analysis of AWS outages and digging deep into dashboard messages. I <strong>have not</strong> found any deficiencies or systematic errors that would devalue AWS service health dashboard as a very good source of current up-to-date incident and outage information.</p> <p>(If your ops team is currently not monitoring AWS dashboard RSS feeds for the services and regions you are operating, well, do so.)</p> Minimum spot instance prices 2014-03-25T00:00:00+00:00 <p>(You might want first see the <a href="/2014/03/12/ec2-spot-intro">introduction to this series of posts</a> if you jumped in here randomly.)</p> <p><strong>Warning:</strong> This article is really about splitting hairs. If you think watching paint dry is boring then this post most probably isn’t for you.</p> <p>In my <a href="/2014/03/20/ec2-spot-market">previous post</a> I stated that AWS has set minimum spot instance prices and incorrectly asserted that these minimums are can be seen in the <code class="highlighter-rouge">price-too-low</code> error when submitting low bids. <strong>This is wrong</strong> (I’ve updated the earlier blog post slightly to avoid spreading the wrong fact), as the “minimum” bid price given is actually the current spot price. Oh, how could I miss <em>that</em>.</p> <h3 id="how-to-find-a-minimum-spot-price">How to find a minimum spot price</h3> <p>Thus there is no direct way to get the <em>minimum spot price</em> in any market. But it is possible to infer these indirectly from spot price history data? I looked at the <strong>minimum spot prices</strong> in all regions and instance types (picking the lowest of all zones) and plotted it getting the graph below (the dataset spans 2013-12-08 to 2014-03-09):</p> <figure class="full"> <p><a href="/assets/posts/minimum-spot-price-all-regions.svg"><img src="/assets/posts/minimum-spot-price-all-regions.svg" alt="minimum spot prices by instance type in all regions" /></a></p> <figcaption> <p>Minimum spot market prices by instance type and region. The minimum is calculated over all the zones in the region. Note that <code class="highlighter-rouge">cc1.4xlarge</code> is missing due to a limitation in the source data, not that it doesn’t have bids.</p> </figcaption> </figure> <p>Take a look at the graph for a few seconds. Go ahead. Don’t skip ahead until you’ve taken a bit of time to look at the dots. Okay, let’s continue then. I think you have also noticed there are <em>patterns</em>. There is a distinct pattern for several instance types in the data — <code class="highlighter-rouge">m3.xlarge</code>, <code class="highlighter-rouge">m3.2xlarge</code>, <code class="highlighter-rouge">t1.micro</code> for example, but also continuing over the <code class="highlighter-rouge">m1</code> and <code class="highlighter-rouge">m2</code> classes. There may be another pattern with some <code class="highlighter-rouge">c3</code> instance types and maybe yet another for <code class="highlighter-rouge">m3</code> too, but let’s stick with the most obvious one for now. I’ll label the set of “similar” minimum price pattern the <em>“suspect”</em> group. Below is a plot with all of the “suspect” instance types (minimum relative prices) plotted on top of each other:</p> <figure> <p><a href="/assets/posts/minimum-spot-price-suspects.svg"><img src="/assets/posts/minimum-spot-price-suspects.svg" alt="minimum spot prices of selected instances overlaid by region" /></a></p> <figcaption> <p>Minimum spot price for instance types <code class="highlighter-rouge">m3.xlarge</code>, <code class="highlighter-rouge">m3.2xlarge</code>, <code class="highlighter-rouge">t1.micro</code>, <code class="highlighter-rouge">m1.large</code>, <code class="highlighter-rouge">m1.xlarge</code>, <code class="highlighter-rouge">m2.xlarge</code>, <code class="highlighter-rouge">m2.2xlarge</code>, <code class="highlighter-rouge">m2.4xlarge</code>, <code class="highlighter-rouge">m1.small</code>, <code class="highlighter-rouge">m1.medium</code>, <code class="highlighter-rouge">c1.medium</code> and <code class="highlighter-rouge">c1.xlarge</code>. Different colors correspond to different instance types. Y-axis positions are slightly jittered.</p> </figcaption> </figure> <p>This graph requires a bit of thought to understand so bear with me. These are <em>relative minimum spot prices</em> so although the <em>absolute</em> minimum spot price differs from region to region these should be comparable to each other. In the graph there are two things that you need to be considered:</p> <ul> <li> <p><strong>Similarity</strong> between regions. It is quite clear that <code class="highlighter-rouge">ap-southeast-1</code>, <code class="highlighter-rouge">ap-southeast-2</code> and <code class="highlighter-rouge">us-west-1</code> are almost identical to each other. With eyes squinted <code class="highlighter-rouge">us-west-2</code> has a cousin-style similarity to these three but all of the others are definitely dissimilar.</p> </li> <li> <p><strong>Levels</strong> of the relative prices. You can find the cheapest spot instances (for the instance types discussed) in <code class="highlighter-rouge">us-east-1</code> whereas <code class="highlighter-rouge">ap-northeast-1</code> and <code class="highlighter-rouge">eu-west-1</code> are clearly more expensive (err… less cheap?). All of the others seem to have roughly similar average minimum level.</p> </li> </ul> <p>What I find <em>very interesting</em> is the identical levels and structure between the three topmost regions. Here’s the raw data from these three regions in a tabular format:</p> <figure> <table> <tr> <th> </th> <th> us-west-2 </th> <th> ap-southeast-1 </th> <th> ap-southeast-2 </th> </tr> <tr> <td align="right"> c1.medium </td> <td align="right"> 0.028 </td> <td align="right"> 0.028 </td> <td align="right"> 0.028 </td> </tr> <tr> <td align="right"> c1.xlarge </td> <td align="right"> 0.112 </td> <td align="right"> 0.110 </td> <td align="right"> 0.110 </td> </tr> <tr> <td align="right"> m1.small </td> <td align="right"> 0.010 </td> <td align="right"> 0.010 </td> <td align="right"> 0.010 </td> </tr> <tr> <td align="right"> m1.medium </td> <td align="right"> 0.021 </td> <td align="right"> 0.020 </td> <td align="right"> 0.020 </td> </tr> <tr> <td align="right"> m1.large </td> <td align="right"> 0.042 </td> <td align="right"> 0.040 </td> <td align="right"> 0.040 </td> </tr> <tr> <td align="right"> m1.xlarge </td> <td align="right"> 0.083 </td> <td align="right"> 0.080 </td> <td align="right"> 0.080 </td> </tr> <tr> <td align="right"> m2.xlarge </td> <td align="right"> 0.056 </td> <td align="right"> 0.059 </td> <td align="right"> 0.059 </td> </tr> <tr> <td align="right"> m2.2xlarge </td> <td align="right"> 0.112 </td> <td align="right"> 0.118 </td> <td align="right"> 0.118 </td> </tr> <tr> <td align="right"> m2.4xlarge </td> <td align="right"> 0.224 </td> <td align="right"> 0.236 </td> <td align="right"> 0.236 </td> </tr> <tr> <td align="right"> m3.xlarge </td> <td align="right"> 0.092 </td> <td align="right"> 0.088 </td> <td align="right"> 0.088 </td> </tr> <tr> <td align="right"> m3.2xlarge </td> <td align="right"> 0.183 </td> <td align="right"> 0.175 </td> <td align="right"> 0.175 </td> </tr> <tr> <td align="right"> t1.micro </td> <td align="right"> 0.004 </td> <td align="right"> 0.004 </td> <td align="right"> 0.004 </td> </tr> </table> <figcaption> <p>Lowest observed spot instance prices in dollars in the regions <code class="highlighter-rouge">us-west-2</code>, <code class="highlighter-rouge">ap-southeast-1</code> and <code class="highlighter-rouge">ap-southeast-2</code> between 2013-12-08 and 2014-03-09.</p> </figcaption> </figure> <p>These values are in dollars e.g. they are not relative prices. First of all both <code class="highlighter-rouge">ap-southeast</code> regions have exactly the same observed minimum spot prices. The <code class="highlighter-rouge">us-west-2</code> region has several instances where prices are identical to <code class="highlighter-rouge">ap-southeast</code> regions, some where prices are slightly higher and some slightly lower. However it should be noted (as can be seen in the earlier graph with relative prices) these differences are <em>very small</em> compared to differences to some other regions.</p> <p>Regardless how you slice and dice these numbers I find it exceedingly unlikely that these very similar relative <em>and</em> absolute minimum spot prices in multiple regions would be result of pure chance. At least from practical point of view <strong>there are minimum spot prices.</strong></p> <h3 id="how-are-minimum-spot-prices-set">How are minimum spot prices set?</h3> <p>If this really is so, it raises another question: <strong>How are these minimum spot prices determined?</strong> Have they been set by AWS itself, or are they an artifact of external bidders during the data period?</p> <p>And if they are set by AWS, then by what policy does AWS set them?</p> <p>One possibility is that they are calculated from region’s on-demand prices. Yet at least for the three regions considered above this does not hold. The <code class="highlighter-rouge">ap-southeast</code> regions have same on-demand prices <em>but</em> <code class="highlighter-rouge">us-west-2</code> has substantially lower prices. Yet it has very similar minimum spot prices. For example the <code class="highlighter-rouge">c1.medium</code> instance type has an observed minimum spot price of $0.028, yet its price in <code class="highlighter-rouge">ap-southeast</code> regions is $0.183 compared to $0.145 in <code class="highlighter-rouge">us-west-2</code>.</p> <p>Could the minimum spot prices be based on operational costs? This seems more plausible since there seems to be similarity in the minimum prices <strong>between regions for the same instance generation</strong> — that is, instances running on so-called “first generation” hardware (compared to “second generation” of <a href="">m3</a> and “new generation” of <a href="">c3</a> classes) such as <code class="highlighter-rouge">m1</code>, <code class="highlighter-rouge">c1</code>, <code class="highlighter-rouge">m2</code> and <code class="highlighter-rouge">t1</code> <a href="/assets/posts/minimum-spot-price-suspects.svg">had somewhat similar prices</a> between regions. For <code class="highlighter-rouge">c3</code> class instance types this similarity is even more striking:</p> <figure class="full"> <p><a href="/assets/posts/minimum-spot-price-2ndgen.svg"><img src="/assets/posts/minimum-spot-price-2ndgen.svg" alt="minimum spot prices for c3 instance types" /></a></p> <figcaption> <p>Minimum spot price for <code class="highlighter-rouge">c3</code> class instance types. Different colors correspond to different instance types. Y-axis positions are slightly jittered. (The reason why you are not seeing many discs is because most of them are exactly on top of each other.) <code class="highlighter-rouge">sa-east-1</code> is missing from this graph as it didn’t have <code class="highlighter-rouge">c3</code> instance types during the period covered by the data set.</p> </figcaption> </figure> <p>Note that apart two outliers (more on these below) the relative prices for <code class="highlighter-rouge">c3</code> instances between all of the regions are <strong>almost exactly the same</strong>. Again although <em>absolute minimum prices differ</em> the relative minimums (percentage of the on-demand price) is <strong>almost exactly the same for almost all regions for almost all <code class="highlighter-rouge">c3</code> instance types</strong>.</p> <p>In plain English this means that for all <code class="highlighter-rouge">c3</code> instance types the minimum bid price is a fixed percentage of that region’s on-demand instance price.</p> <p>That’d be a mighty coincidence if there was no minimum and all of this similarity was result of different bidders all over the world?</p> <p>Okay. There’s the question of the two outliers above: <code class="highlighter-rouge">c3.large</code> in <code class="highlighter-rouge">ap-southeast-2</code> at $0.001 and <code class="highlighter-rouge">c3.8xlarge</code> in <code class="highlighter-rouge">ap-northeast-1</code> at $0.060. Getting <code class="highlighter-rouge">c3.8xlarge</code> <code class="highlighter-rouge">c3.8xlarge</code> was hit in 2013-12-10, 2013-12-12, 2014-01-03 and 2014-01-04 for a total of 338 minutes at that price and the $0.001 for <code class="highlighter-rouge">c3.large</code> on 16 distinct days between 2013-12-22 and 2014-02-03 for a total of 13.4 <strong>days</strong>.)</p> <p>For the outliers I have two explanations:</p> <ul> <li> <p><strong>It’s an accident.</strong> For some reason the minimum was set incorrectly for these two instance types.</p> </li> <li> <p><strong>There is actually no minimum spot price.</strong> Reconciling this view with the observed <em>very similar</em> minimum relative prices in multiple regions is difficult, though. One possibility that comes to mind is that maybe — maybe someone itself is bidding in <em>all spot markets</em> for spare capacity at a <em>very low price</em> and these low prices reflect those bids when there is <em>very little demand by other customers</em>.</p> <p>Yet even this outlandish scenario raises new questions. Why would this hypothetical all-excess-capacity-sucking entity bid at <em>different</em> prices or even at different <em>percentages</em>).</p> </li> </ul> <p>What else could be gleaned from this data?</p> <ul> <li> <p>Minimum relative prices for 1st generation instances are more spread out than for <code class="highlighter-rouge">c3</code> instance types. Actually, the <code class="highlighter-rouge">c3</code> relative prices are <strong>very tightly packed</strong>.</p> <p.</p> <p>The earlier generation instances run on multiple different types of hardware (it is know they have different CPU types, at least, see <a href=""><em>Is the Same Instance Type Created Equal? Exploiting Heterogeneity of Public Clouds</em></a> by Ou, Zhuang et al, 2013) and it seems that the capacity progression in <code class="highlighter-rouge">m1</code>, <code class="highlighter-rouge">m2</code> and <code class="highlighter-rouge">c1</code> classes is not always a simple 2x step from instance type to another (potentially leaving “unfilled gaps”). These might explain why older instance types have more “spread” in their relative minimum prices than the newer ones.</p> </li> <li> <p>Japan and Europe (<code class="highlighter-rouge">ap-northeast-1</code> and <code class="highlighter-rouge">eu-west-1</code>) have consistently higher minimum relative spot prices than most other regions. OTOH, <code class="highlighter-rouge">ap-southeast-1</code> is the odd one out since with old instance types it had identical relative prices with two other regions, but for <code class="highlighter-rouge">c3</code> instances it stands out as substantially more expensive (“less cheap”).</p> <p>This might be due to relatively higher operational costs in these regions <em>and</em> that the on-demand prices are <em>not entirely</em>.</p> </li> <li> <p>Also it is interesting that <code class="highlighter-rouge">us-east-1</code> doesn’t stand out as “cheaper” for <code class="highlighter-rouge">c3</code> instances in the same way it did for 1st generation instance types.</p> </li> </ul> <h3 id="summary">Summary</h3> <p>So as a conclusion to the question whether there are minimum spot prices and who sets them I think the answer is that <strong>from a practical point of view there are minimum spot prices</strong>. If you are bidding in these markets you have to understand that there appears to be a minimum bid price you have to use to have <em>any</em> chance of getting an instance, ever. Although not conclusive, I find the <strong>most plausible</strong> scenario for these minimum prices that <strong>AWS is setting minimum spot prices</strong> based on operational costs, but using different formulae for different instance generations.</p> Mechanics of the spot instance market 2014-03-20T00:00:00+00:00 <p>(You might want first see the <a href="/2014/03/12/ec2-spot-intro">introduction to this series of posts</a> if you jumped in here randomly.)</p> <h2 id="a-namesi-mechanicsadeep-dive"><a name="si-mechanics"></a>Deep dive</h2> <p>In previous posts I’ve discussed about <a href="/2014/03/12/ec2-spot-instances">what are spot instances and what is the spot market</a> and <a href="/2014/03/19/ec2-spot-usage">what you can use spot instances for and how</a>. In this post I’m going to write out my thoughts on what is the reason for spot market, its rationality and where actually do spot instances come from.</p> <h3 id="purpose-of-the-ec2-spot-market">Purpose of the EC2 spot market</h3> <p>Why does spot market exist in the first place?</p> <p>Spot instances were <a href="">announced on December 14th, 2009</a>. After that there has been several technical updates that brought spot instances to the same level as other instance types (such as <a href="">EMR support</a>, <a href="">VPC support</a>). There has been two major published changes on the spot market itself. First, the <a href="">spot market price algorithm</a> was changed on July 1st 2011 and secondly a <a href="">default bid price cap was introduced</a> late 2013. These are the visible changes that have the name “spot instance” on them.</p> <p>What does this tell us about the purpose of the spot market?</p> <p>Not yet much. But it is telling us something:</p> <ul> <li>The spot market is meaningful to AWS.</li> <li>AWS wants us to use spot instances.</li> </ul> <p>But what about the <strong>purpose</strong>? Why did AWS go to the complication of providing spot instances (more code, more work, more bugs) and operating a spot market (apparent loss of pricing control) on top of that? Why didn’t it just say <em>“spot instances at 50% price of regular ones”</em> and leave it at that?</p> <p>I have not seen that AWS would have directly stated the purpose of spot instances. All of the official information I’ve seen carefully skirts about the purpose of spot instances and spot market. The <a href="">initial announcement</a> tells that <em>“[you can] bid on unused Amazon EC2 capacity”</em> and the current <a href="">spot instance landing page</a> that <em>“you simply bid on spare Amazon EC2 instances”</em>. There are plenty of <em>whys</em> for the customer, but no <em>why</em> for AWS itself.</p> <p>I believe the groupthink of the Internet is mostly in line with the following <em>hypothetised</em> (aka <em>naive</em>) purpose:</p> <blockquote> <p>Spot market is for AWS to sell excess capacity to make at least a bit of more money out of resources that otherwise would remain unused (incurring both operational and capital costs).</p> </blockquote> <p>This seems sensible and straightforward. Yet it does not tell about the purpose of a <strong>spot</strong> market. <a href="">Dmitriy Samovskiy</a> makes a good point about that — why are they “spot” instaces and not “discounted” instances? It is entirely possible that AWS would have priced “discounted instances” at -50% and left it at that (adding the “may-be-terminated-at-any-time” clause). <strong>Instead</strong> the spot market exist, with its high price volatility, spot price differences between regions and a potential to pay up to $999.99/hour per instance. All of this is bound to make a lot of people wary of spot instances.</p> <p>Think about it. If prices were set at a fixed 50% (or 40%, or 30%) then the element of market variability would be removed. I think a lot of people would be more comfortable with fixed discounts over the variability of spot market prices.</p> <p>There’s this thing called <a href="">“efficient market hypothesis”</a>?</p> <p <a href="">blogosphere</a> as well as in <a href="">academia</a>).</p> <p><strong>So what is then the purpose of the spot market?</strong></p> <p>I don’t know.</p> <p>I am sure that <em>part of its purpose</em> matches the naive assumption — it is generating income for AWS that otherwise would have been lost. Later below I’ll talk about other <em>partial purpose</em> (that surprisingly ties spot market to reserved instances), but I’m not sure about that being the totality either.</p> <p>In the end I don’t know what is the purpose of the spot market. I’m not saying that it wouldn’t be <em>useful</em>. After all, you can get substantial savings on operational cost using spot instances! You don’t have to theoretize about the purpose of rain to benefit from it, either (in case you’re a farmer).</p> <p>I just don’t believe that the <em>naive hypothesis</em> is all there is to.</p> <h3 id="a-namesi-rational-marketais-the-market-rational"><a name="si-rational-market"></a>Is the market rational?</h3> <p>The answer is absolutely clear and simple for this one: <strong>yes and no</strong>.</p> <p>See both above and <a href="/2014/03/12/ec2-spot-instances#si-spot-999-dollars">earlier post</a>. The spot market pricing algorithm is not known. I’m not going to call any market rational whose price is potentially set by a random number generator and the market players are finding causality <a href="">in places where there is none</a>.</p> <p>Yet if you make the assumption that <em>the spot market price is at least mostly a market-driven proxy of supply and demand</em> (and leave the algorithm in the hands of the benevolent AWS) and ask questions about the behavior of the bidders, then the answer is yes. Yes, at least most of the bidders are making rational choices.</p> <p>The question of AWS spot market’s rationality is a common question (see <a href="">here</a>, <a href="">here</a> and <a href="">here</a>).?</p> <p><small>(Yes it is. But let’s consider the spot market only, shall we?)</small></p> <p><a href="/2014/03/19/ec2-spot-usage#si-spot-over-bidding">Earlier</a> I’ve pointed out that the total costs of running a spot instance can easily be less than the cost of using equivalent on-demand instance <strong>even when you bid at 10x the on-demand price</strong>. Thus at least for those cases where you can <strong>expect</strong> (based on past history, which of course is not indicator of future blah blah blah) likely savings with high bids then it is entirely rational to bid at >1x prices.</p> <p>But then what about <code class="highlighter-rouge">c3.2xlarge</code> in <code class="highlighter-rouge">us-east-1</code>? See the graph below:</p> <figure> <p><a href="/assets/posts/spot-weekly-c3.2xlarge-us-east-1.svg"><img src="/assets/posts/spot-weekly-c3.2xlarge-us-east-1.svg" alt="c3.2xlarge in us-east-2" /></a></p> <figcaption> <p>Daily average and maximum prices for <code>c3.2xlarge</code> spot market prices in <code>us-east-1</code>. Solid line is the weighted daily average price, lineless blocks are the maximum daily bid price and colors represent different zones.</p> </figcaption> </figure> <p>Although not we have the benefit of hindsight, I think anyone bidding for <code class="highlighter-rouge">c3.2xlarge</code> during January 2014 would have quickly realized that they are <strong>not</strong> getting an instance at on-demand prices. Why then?</p> <p>The <code class="highlighter-rouge">c3</code> class of instances was announced in November 2013 and from the very beginning <a href="">demand for them was high</a>. In fact, demand was higher than supply. For anyone familiar with economy 101 this is a case of <a href="">supply vs. demand</a>).</p> <p>You can see where this is going, right? Spot market price is elastic, and in this case it clearly shows that when demand outstrips supply, the per-unit price increases. In the graph above you can see that <code class="highlighter-rouge">c3.2xlarge</code> prices have started to fluctuate and on average, have gone down since late February. This is most likely due to AWS being able to introduce capacity faster than the demand has increased. (An alternative interpretation is that a lot of those interested in <code class="highlighter-rouge">c3.2xlarge</code> have become disillusioned at its (un)availability and gone elsewhere.)</p> <p>But <strong>why would anyone pay >1x cost for an instance</strong>? There are, after all, plenty of other instance types (even in the <code class="highlighter-rouge">c3</code> class) that are available at on-demand prices from either on-demand or spot markets. Why?</p> <p>I have no idea what goes in bidder’s heads. But there are a few possibilities that are entirely rational that come to my mind:</p> <ul> <li> <p>Someone values uninterrupted service over savings. See BrowserMob’s bidding strategy at <a href="">4:00 in this video</a>. They clearly put a large weight into getting the resources <em>now</em> even at higher price than <em>later</em> and cheaper.</p> </li> <li> <p>Someone tests how their application runs on <code class="highlighter-rouge">c3</code> instances. <code class="highlighter-rouge">c3</code> reserved instances or not).</p> </li> </ul> <p>I’m sure there are others, but eventually they all boil to the same conclusion: <strong>buying at high cost in the spot market is rational if doing so offers larger potential benefits than waiting to buy at regular prices later</strong>.</p> <h3 id="spot-market-price-drivers">Spot market price drivers</h3> <p>Although we don’t know the actual spot price algorithm, it is possible to observe it and see whether its behavior correlates with other, known events.</p> <p>When talking about the spot market algorithm the first stop most definitely has to be a paper called <a href="">Deconstructing Amazon EC2 Spot Instance Pricing</a> by Beh-Yehuda et al (2011). The researchers did a very thorough analysis of AWS spot instance market and the spot price behavior. Even though most of the analysis is using data prior to the 2011 pricing mechanism change and <em>thus is not valid today</em> it is still a good read. Especially the bit in epilogue where the researches state that</p> <blockquote> <p><em>“While these radical qualitative changes [June 2011 pricing mechanism change] are further evidence of the former prices being artificially set, the October prices are consistent with a constant minimal price auction, and are no longer consistent with an AR(1) hidden reserve price.”</em></p> </blockquote> <p>So … AWS didn’t use a “market” algorithm before, but they seem to be using one today. As a working hypothesis I’ll take it that there is <em>some</em> market-based price algorithm that takes some inputs and outputs a spot instance price. What are the inputs?</p> <ul> <li> <p>One thing that we know is that <em>“the Spot price will raise when our [AWS] capacity lowers.”</em> and <em>“the increase in the m2.2xlarge Spot price today [the $999.99 price spike event] was related to an sudden increase in demand for On-Demand m2.2xlarge instances which significantly depleted the unused capacity.</em>” (<a href="">source</a>).</p> <p><strong>Available EC2 instance capacity affects spot price.</strong></p> </li> <li> <p>From looking at the <a href="/assets/posts/spot-weekly-c3.2xlarge-us-east-1.svg"><code class="highlighter-rouge">c3.2xlarge</code> spot price graph</a> it should be also obvious that demand has an effect. When considering also quotes above it is possible to infer that:</p> <p><strong>Demand for EC2 instances affects spot price.</strong></p> </li> <li> <strike.)</strike> <p>(Updated 2014-03-25) Wrong wrong wrong! The <code class="highlighter-rouge">price-too-low</code> message is really only talking about current spot price. My bad. However there still appears to be minimum spot prices which I go through <a href="/2014/03/25/ec2-spot-price-minimum">in the next post in this series</a>.</p> </li> <li> <p>AWS has a default maximum bid limit of 4x on-demand price <em>but this is a soft limit and can be raised or removed</em>. The maximum relative bid price varies, but in the data set I have there are several instane types with >50x spot prices. This implies that there are bids at that level <em>and potentially higher</em>.</p> <p><strong>It is not known whether there is <em>any</em> spot price upper limit.</strong></p> <p><small>(If anyone is brave enough to do a short bid at 10000x price level I’m interested in hearing about the results.)</small></p> </li> </ul> <p.</p> <p) <em>or</em> depress the price (to make spot instances more appealing?). <em>Or</em> an increase in the capacity is fed to the pricing engine slowly to prevent rapid price fluctuations. Or a decrease in capacity is pre-factored so that it is removed in steps instead of a large drop (and matching rapid price increase). Or …</p> <h3 id="a-namesi-spot-sourceawhere-do-spot-instances-come-from"><a name="si-spot-source"></a>Where do spot instances come from?</h3> <p><strong>Note:</strong> Most of this section is pure speculation. I am presenting a hypothesis about AWS’s division of instance resources which may be completely wrong. However as far as I’m concerned it is a hypothesis that is in line with actual observations.</p> <p>The official statement from AWS is that the capacity for spot instances is <em>“spare Amazon EC2 instances</em>” (<a href="">source</a>). A bit more verbose is <a href="">Dave@AWS’s commentary</a> in the AWS forums:</p> <blockquote> <p><em> <b>other parts of our capacity that can be temporarily sold but may need to be reclaimed at a later time</b>. It would take precedence over On-Demand, because we do not have the ability to reclaim On-Demand instances, so they cannot be sold there.”</em> (Emphasis is mine.)</p> </blockquote> <p>Let me go through behaviors associated with the main instance types:</p> <figure> <table> <thead> <tr><th>Instance type</th><th>Guaranteed availability</th><th>Arbitrary termination</th></tr> </thead> <tbody> <tr><td>On-demand instance</td><td>No</td><td>No</td></tr> <tr><td>Reserved instance</td><td>Yes</td><td>No</td></tr> <tr><td>Spot instance</td><td>No</td><td>Yes</td></tr> </tbody> </table> </figure> <p> <strong>cannot</strong> be used for on-demand instances. This is because of the semantics of reserved instances.</p> <blockquote> <p><em>“Reserved Instances provide a capacity reservation so that you can have confidence in your ability to launch the number of instances you have reserved when you need them.”</em> (<a href="">source</a>)</p> </blockquote> <p>When you purchase a reserved instance <strong>you have no obligation to run it</strong>, but AWS has an obligation to provide you with a reserved instance any time you <strong>want to run it</strong>. This means that any reserved instance that <em>is not running</em> could be sold, but <em>not</em> as an on-demand instance since AWS cannot evict an on-demand instance at will. See the figure below (which doesn’t have too many non-negations):</p> <figure> <p><a href="/assets/posts/ec2-capacity-categorized.svg"><img src="/assets/posts/ec2-capacity-categorized.svg" alt="ec2 capacity pools" /></a></p> </figure> <p>At any moment in time AWS’s total capacity is split into running instances and unused capacity. Running instances are further divided by type into reserved instances, on-demand instances and spot intances. The pool of unused capacity has a portion which <strong>cannot</strong> be sold as on-demand instances (because if it was sold and a lot of powered-off reserved instances were started it might not be able to provision resources for all those reserved instances). Thus <strong>there is unused capacity that can only be sold as spot instances.</strong></p> <p>This also means that there <strong>can be unused spot instance capacity even when on-demand instances cannot be provisioned</strong>. So finally we can explain why <code class="highlighter-rouge">c3.2xlarge</code> instances could be purchased from spot market even when you couldn’t buy on-demand instances: there was a pool of <code class="highlighter-rouge">c3.2xlarge</code> reserved instances already sold that were <strong>not powered on</strong>.</p> <p>When reserved instances are powered on I think this is what happens:</p> <ol> <li> <p>If there is unused capacity, it is used to provision the reserved instance. End of story.</p> </li> <li> <p>If no unused capacity was available, the spot market is notified that it needs to release capacity from the spot pool.</p> </li> <li> <p.</p> <p>What happens if the change of the capacity does not change the spot price? I’m not sure. It might be that the spot market algorithm will forcefully increase the spot price. As well it might not. The exact wording from AWS is <em>“If the Spot price exceeds your max bid or there is no longer spare EC2 capacity in a given Spot pool, your instances will be terminated.”</em> which <em>I think</em> leaves open the possibility that a spot instance is terminated also on capacity decrease even when the bid price doesn’t change.</p> </li> </ol> <p><em>If anyone has had their spot instance terminated even when the bid price equals spot price I’d be delighted to hear about your experiences.</em></p> <p>(It is possible that there are also <em>other</em>.)</p> <h3 id="market-efficiency-and-reserved-instances">Market efficiency and reserved instances</h3> <p>If my hypothesis about that powered-off reserved instance capacity is sold in the spot market then (I claim) that spot market is essential for AWS to maximize its income from reserved instances.</p> <p>You could say that <strong>a working spot market is a requirement for reserved instances</strong>.</p> <p>Think about it. If AWS was not able to resell unpowered reserved instances then it would be making loss with reserved instances. The <code class="highlighter-rouge">c3.8xlarge</code> light usage reserved instance upfront cost is $2666. It has 32 (virtual) cores and 60 GiBs of memory so I think that <code class="highlighter-rouge">c3.8xlarge</code> represents almost a physical single server (each E5-2680v2 has 20 threads, which I guess maps to an EC2 core) and <strong>I’m pretty sure it’ll cost more than $2666</strong>.</p> <p>If AWS was not reselling unpowered reserved instance capacity then anyone buying a light utilization reserved instance would most likely end up costing AWS concrete and real money. At the minimum it would make the gross margin on those physical servers very low.</p> <h3 id="open-questions">Open questions</h3> <p>I have a hypothesis. Good hypotheses can be tested with tests that either falsify the hypothesis or give results that are in line with earlier predictions.</p> <p>Actually, to be accurate, I have two hypothesis. The first one is that <strong>spot market price is affected by supply and demand for all types of EC2 instances</strong> (also that there is a minimum spot price and there is no maximum spot price but we know the first for a fact and I’m not sure the second one is meaningful to explore at all).</p> <p>The second one is that <strong>unused but purchased reserved instance capacity is re-sold as spot instances</strong>.</p> <p>I’ll infer from these that the spot market should behave in the following manner (all of these apply to each region, instance type and availability zone separately):</p> <ul> <li>Unpowered reserved instances and stopped on-demand instances should not affect spot price.</li> <li>Purchasing reserved instances (without powering them on) … <ul> <li>… should not affect spot price.</li> <li>… should decrease unused on-demand instance capacity. (This of course may not be visible in any way.)</li> <li>… should increase unused spot instance capacity.</li> </ul> </li> <li>Powering reserved instances on … <ul> <li>… may increase spot price.</li> <li>… may cause spot instances to be terminated (even when spot price remains unaffected).</li> <li>… should not affect availability of on-demand instances.</li> </ul> </li> <li>Powering reserved instances off … <ul> <li>may decrease spot price.</li> </ul> </li> <li>Provisioning new on-demand instances or starting stopped on-demand instances … <ul> <li>…?)</li> <li>… may cause spot instances to be terminated. (See previous.)</li> </ul> </li> <li>Terminating on-demand instances or stopping on-demand instances may decrease spot price.</li> </ul> <p>That’s a lot. How could these be tested? First and foremost, testing any of these is potentially <strong>expensive</strong> as you need to provision instances and put in bids for spot instances and you’ll need to pay up for all of that. (These might also violate AWS’s <a href="">Acceptable Use Policy</a>.) It might be possible to infer some of this data from actual spot market logs and/or other monitoring data, though how I don’t know.</p> <ul> <li> <p>Buy one or more reserved instances. Start reserved instances. Based on the hypothetised behavior this should cause the spot market price to either increase or remain the same.</p> <p>(Given that there are other people powering instances on and off this would show up only as a statistical result from many iterations. This applies to all other tests too.)</p> </li> <li> <p>Power off reserved instances. This should cause the spot market price to decrease or remain the same.</p> </li> <li> <p>Purchase spot instances at spot market price or slightly above. See how often their termination is associated with spot price increases. (Some of them should not be.)</p> </li> <li> <p>Purchase spot instances at spot market price. Power on reserved instances. There should be a correlation between starting your reserved instances and termination of your spot instances.</p> </li> <li> <p>Start on-demand instances. This may be correlated with spot price increase.</p> </li> <li> <p>Stop on-demand instances. This may be correlated with spot price decrease.</p> </li> </ul> <p <em>any</em> effect.</p> <h3 id="how-does-this-affect-you">How does this affect you?</h3> <p>Not really much. You shouldn’t try to second-guess future behavior of spot prices.</p> <p>If my hypothesis is correct, then you might want to keep in mind that the spot market price is affected by events that occur outside the spot market. That is even an apparently stable market can change suddenly <em>without any change in the bidding pool</em>.</p> <p>But you already knew that spot market is volatile, didn’t you? No new news, then.</p> <p>Here’s the <a href="/2014/03/25/ec2-spot-price-minimum">next post in the series</a>.</p> Using spot instances 2014-03-19T00:00:00+00:00 <p>(You might want first see the <a href="/2014/03/12/ec2-spot-intro">introduction to this series of posts</a> if you jumped in here randomly.)</p> <h2 id="a-namesi-howtoahow-to-use-spot-instances"><a name="si-howto"></a>How to use spot instances</h2> <p>I’m going through a couple of topics related on <em>how to use spot instances</em>:</p> <ul> <li>Suitable applications and workloads for spot instances</li> <li>Bidding automation and bidding strategies</li> <li>Minimizing effects of price spikes</li> </ul> <p.</p> <h3 id="suitable-applications-and-workloads">Suitable applications and workloads</h3> <p>Here’s a list of applications suitable for spot instances <a href="">according to the source itself</a>:</p> <ul> <li>Batch processing</li> <li>Hadoop</li> <li>Scientific computing</li> <li>Video and image processing and rendering</li> <li>Web / Data crawling</li> <li>Financial (analytics)</li> <li>HPC</li> <li>Cheap compute (“backend servers for facebook games”)</li> <li>Testing</li> </ul> <p>The common theme in all of these is <strong>loss of an instance is not a catastrophe</strong>. You can influence the likelihood of an instance loss through the bid price (see <a href="/2014/03/12/ec2-spot-instances#si-spot-availability">instance availability</a> in previous post), but unless you are willing to face potentially <a href="/2014/03/12/ec2-spot-instances#si-spot-999-dollars">absurd costs</a> to guarantee 100% spot instance availability you’ll have to come to face with the fact that:</p> <p><strong>You have to be able to recover from sudden spot instance termination.</strong></p> <p>Whether you would want to use spot instances and whether you can use spot instances is determined by three factors:</p> <ol> <li>Potential savings gained by using spot instances.</li> <li>Costs of a spot instance failure. For example loss of profit and money and work required to recover.</li> <li>Costs required to either completely avoid failure in face of spot instance failures, or to mitigate the risk to acceptable levels.</li> </ol> <p>The firsts two are recurring (you get savings continuously, but spot instance failures also occur continuously) whereas the third one is mostly one-off cost.</p> <p>And face it, if you are using spot instances you have to be prepared that <strong>many of them fail at the same time</strong>. You can have some influence over the number of lost instances by using multiple availability zones and tiered bidding (see <a href="">moz.com developer blog for excellent insights</a>) but however you slice and dice you still come to the fact that:</p> <p><strong>You have to be able to recover from sudden spot instance termination.</strong></p> <p><strong>How</strong> you deal with instance termination is affected by what are your costs to fail and costs to prevent failure. Consider a few cases:</p> <ul> <li> <p><strong>Spot instances as build slaves.</strong> Your CI automatically provisions build slaves from spot market as needed (and tears them down when demand goes down). So now suddenly all your build slaves went away — so what? Jobs failed, builds lost, but it’s not going to kill your devtest.</p> <p.</p> <p>In this case it is likely that the cost to prevent interruption of CI jobs would be higher than productivity losses so it is reasonable just to wait it out and handle any aftermath manually.</p> <p>(Just do not run your build master in a spot instance.)</p> </li> <li> <p><strong>Hadoop cluster.</strong> <a href="">Riding the Spotted Elephant</a> is an excellent article discussing various pros and cons on different ways to use spot instances with Hadoop. Essentially this boils down to:</p> <p>It is possible to run a Hadoop cluster using spot instances where sudden price peaks will have only a limited effect (delaying completion of some jobs) sans <em>force majeure</em> situations.</p> <p>In this case you could be hedging your bets by using a hybrid cluster, some on-demand instances and some spot instances, potentially with tiered bidding. This will increase the running cost but will be highly likely to prevent massive failures.</p> </li> <li> <p><strong>Financial analysis.</strong> (I’m not a financial market wiz, so bear with my unbelievable scenario here, please.) You’re running a financial modeling job nightly using spot instances. The job will take 4 hours to complete and the time window to run it is six hours. It <strong>must not fail</strong>.</p> <p>Okay, if it must not fail then you should <strong>not</strong> be running it using spot instances in the first place. So let’s reword the requirement. “Must not fail with nightly operating costs less than X.” That is, if the cost of <em>not failing</em> would be over X you can fail.</p> <p.</p> <p>In this case the cost of prevention is large — setting up the required automation <em>and testing it to death</em> will itself require a large effort, not to speak about the costs that will come <em>after the automation kicks in</em>. But then again, the failure to run to completion would be expensive too.</p> </li> </ul> <p><strong>The less time-critical and more resilient your computing requirements are the easier it is to move them over to use spot instances.</strong></p> <blockquote> <p>If you are using AWS in a large scale then you should already have disaster recovery plans for situations that would affect your service such as a whole availability zone going out (or a whole region in case you are <a href="">Netflix</a>). When using spot instances you’ll need to factor in plans for <em>persistent spot price increases</em>. If spot prices go up, for how long are you willing to “wait it out” to see if they drop back down? What will you then do when you decide they’re not coming down?</p> </blockquote> <p>To recap:</p> <ul> <li>Don’t use spot instances if your requirements include “must not fail”</li> <li>Do a cost-benefit analysis: <ul> <li>Estimate savings</li> <li>Estimate cost of failure</li> <li>Estimate cost of avoiding failure</li> <li>Compare</li> </ul> </li> </ul> <h3 id="bidding-automation-and-bidding-strategies">Bidding automation and bidding strategies</h3> <blockquote> <p>If you are using spot instances now and then for one-off tests you should do bidding manually. In this case you should bid higher than the current market price (see what I wrote about <a href="/2014/03/12/ec2-spot-instances#si-spot-availability">instance availability</a> in previous post) to prevent small price fluctuations from terminating your instance. Just remember — don’t bid higher than you are willing to pay!</p> </blockquote> <p>For simple use cases a using auto scaling for provisioning automation and setting the spot instance bid price (in auto scale launch configuration) is sufficient. This can’t alone guarantee availability of a service, but it will be enough for less than 24/7 operations.</p> <p>If you had provisioning automation (automatic scale-up and scale-down) before then adding spot instances brings in a few complications:</p> <ul> <li> <p>Launching spot instances takes a longer time than on-demand instances (bidding process itself takes extra time).</p> </li> <li> <p>Spot market price <strike>can</strike> will vary over time, including potentially large spikes. You have to decide how to deal with spikes.</p> </li> <li> <p>Your spot instances can all just <em>vanish</em> with a sudden spot price spike.</p> </li> </ul> <p>Writing a spot market bidding and provisioning engine is thus more complicated than for scaling up and down with on-demand instances. <strong>Do make sure</strong> that you put in hard limits to your bid prices. Remember the poor sod who paid $999.99/hour for his/her spot instances.</p> <h4 id="strategies">Strategies</h4> <p>Depending on your application requirements you can apply several different provisioning and bidding strategies. <a href="">Here’s a video</a> that discusses various strategies AWS has detected its customers using:</p> <ol> <li> <p><strong>Optimizing costs.</strong> These customers bid at reserved instance pricing level with the goal of gaining RI-level costs without their up-front costs. Needless to say, bidding at this low level you are facing loss of all spot instances during a price hike.</p> </li> <li> <p><strong>Optimizing costs and availability.</strong> These bid at a level between reserved instance price and on-demand instance price. This will not protect from sudden price hikes, but will prevent smaller fluctuations from terminating instances.</p> </li> <li> <p><strong>Capable of switching to on-demand instances.</strong> These customers have provisioning automation that can automatically shift from bidding for spot instances to provisioning on-demand instances when it detects that spot prices have increased >1x price level. These typically bid at on-demand price level or a little higher.</p> </li> <li> <p><strong>High bidders for availability.</strong> For these they are interested in getting <strong>average</strong> savings from spot instances, but put a large value on availability of their spot instances. These will bid significantly higher than on-demand price.</p> <p>I think this is a reasonable strategy to deploy interrupt-sensitive application using spot instances <strong>with the caveat</strong> that you must be able to later move to cheaper resources (on-demand instances, reserved instances, other zones, other instance types, other regions) without service interruption. If you cannot move over, then permanently bidding high in hope of getting <strong>both</strong> savings <strong>and</strong> availability is gambling, not a strategy.</p> </li> <li> <p><strong>High bidders for resources.</strong> There’s another reason to bid high. At <a href="">4:00 in the video</a>.</p> </li> </ol> <p>Note that bidding high is a workable strategy only as long as most <strong>don’t</strong> bid high.</p> <h4 id="a-namesi-spot-over-biddingabidding-over-the-on-demand-price"><a name="si-spot-over-bidding"></a>Bidding over the on-demand price</h4> <p>I want to emphasize the following:</p> <p>Contrary to a lot of comments in the Internet <strong>bidding over on-demand price is an entirely rational bidding strategy</strong> in certain cases. Consider the two graphs below:</p> <figure class="full"> <p><a href="/assets/posts/spot-price-us-west-1-c1-xlarge.svg"><img class="double" src="/assets/posts/spot-price-us-west-1-c1-xlarge.svg" alt="c1.xlarge spot price medium volatility across zones in us-east-1" /></a> <a href="/assets/posts/spot-availability-cost-us-west-1-c1-xlarge.svg"><img class="double" src="/assets/posts/spot-availability-cost-us-west-1-c1-xlarge.svg" alt="c1.xlarge cost at availability in us-west-1" /></a></p> <figcaption> <p><code>c1.xlarge</code> in <code>us-west-1</code>. Left graph shows market price where solid line is daily average and lightly colored boxes are the daily maximum price. Right graph shows what would have been the total cost to achieve certain availability target. The light vertical bar is 1/4x on-demand price.</p> </figcaption> </figure> <p>The table below shows what you would have had to bid (again, this is <em>post hoc</em> analysis, you would not have been able to know these values beforehand) to gain 100% availability <em>and</em> what it would have <strong>cost you</strong> had you bid at the given level.</p> <figure> <table> <thead><tr><th>Zone</th><th>Relative Bid Price</th><th>Relative Cost</th><th>Availability</th></tr></thead> <tbody> <tr> <td>Zone 1</td> <td>1.293</td> <td>0.201</td> <td>100%</td> </tr> <tr> <td>Zone 2</td> <td>17.241</td> <td>0.267</td> <td>100%</td> </tr> <tr> <td>Zone 3</td> <td>17.241</td> <td>0.193</td> <td>100%</td> </tr> </tbody> </table> <figcaption> <p>Bid prices and total costs relative to on-demand prices for <code>c1.xlarge</code> instances in <code>us-west-1</code> over the same time period as with earlier graphs. The cheapest zone ended being zone 3 with the required bid being >17× on-demand instance price. Yet the zone with the lowest maximum bid price (zone 1) ended up being more 4% more expensive than zone 3.</p> </figcaption> </figure> <p>I think this make it clear that <strong>bidding over the on-demand price can be entirely sensible strategy</strong>.</p> <p>To summarize the last point: unless you have good automation that can shift your workload seamlessly from high-priced spot instances then you should stick to one of the three first bidding strategies. They at least have a known failure model (e.g. you lose instances).</p> <h3 id="minimizing-effects-of-price-volatility">Minimizing effects of price volatility</h3> <p>Since spot price volatility is a given, is it then possible to somehow control the effects of that volatility? The basic approach is to reduce the probability of that volatility causing problems and secondarily to limit the impact of any problems encountered.</p> <h4 id="tiered-bidding-and-multiple-zones">Tiered bidding and multiple zones</h4> <p>There are few other tricks noted elsewhere that you can use to restrict the severity of price hikes:</p> <ul> <li> <p.)</p> </li> <li> <p>Bid in multiple availability zones, but in different bids. Don’t blindly use the AWS’s behavior of picking the cheapest zone when you specify multiple zones in a bid. If you have bid automation, don’t blindly always bid in the “cheapest” zone either.</p> </li> <li> <p>If your application can automatically handle new instances (self-registration, autodiscovery etc.), you can live short price spikes through with <em>persistent bids</em>. Persistent bids stay in the bidding pool and will be filled at any time the spot price is below the bid price — even if the bid “lost” its instances due to a price spike.</p> </li> </ul> <p>AWS allows you to specify multiple availability zones in a single bid. In this case AWS will pick the cheapest (lowest spot price) zone <em>at that moment</em> where the spot request can be fulfilled.</p> <p>If you continuously put your instances into the cheapest zone <strong>the majority of your instances are likely to end up in a single availability zone</strong>. Take a loot at the graph below showing <code class="highlighter-rouge">m1.small</code> spot prices in multiple availability zones. There is always a possibility that a single zone has a long stretch of relative tranquility and low prices.</p> <figure> <p><a href="/assets/posts/zones-spot-price-us-east-1-m1-small.svg"><img src="/assets/posts/zones-spot-price-us-east-1-m1-small.svg" alt="m1.small instance prices in us-east-1" /></a></p> <figcaption> <p><code>m1.small</code> in <code>us-east-1</code>. Notice how zones 1, 2 and 4 have a long history of low prices and low volatility, yet zones 2 and 4 have sudden spot price level changes.</p> </figcaption> </figure> <p.</p> <p>So you should ensure that your spot instance bids are distributed over multiple availability zones if that is feasible for your application. See <a href="">Bryce Howard’s</a> commentary on moz.com crawler outage and how it was primarily caused by placing spot instances in a single availability zone.</p> <h4 id="hybrid">Hybrid</h4> <p>A very common advice is to <a href="">not run all your infrastructure on spot instances</a>. This is a very good advice. It is not always sensible to go after the highest savings. A good strategy is to use a healthy mix of reserved instances, on-demand instances and spot instances.</p> <h4 id="keeping-state-checkpointing-job-subdivision">Keeping state, checkpointing, job subdivision</h4> <p>This is a topic I’m not going to go deeply, but the core idea is simple:</p> <ul> <li>Periodically save the state of whatever your spot instance is doing (checkpointing) so that if it is terminated, another instance can continue from the last saved checkpoint.</li> </ul> <p>(<strong>Edit 2015-01-06</strong>: <a href="">AWS announced</a> a two-minute termination notice available via instance metadata. You still can’t prevent termination, but you do not get a short notice before it occurs.)</p> <p.</p> <p>Keep in mind that AWS will <strong>not charge for a partial hour on spot instances it terminates</strong>..</p> <p>(You can <a href="">play chicken with spot instances</a> where after you’re done with the instance you won’t actually terminate it immediately, but wait to see if AWS does it before the full hour. Sometimes this gives you the instance-hour for free…)</p> <p>There is some research into checkpointing and spot instances. See for example <a href="">Monetary Cost-Aware Checkpointing and Migration on Amazon Cloud Spot Instances</a> (Yi, Andrzejak and Kondo, 2012) and <a href="">Reliable Provisioning of Spot Instances for Compute-intensive Applications</a> .</p> <h3 id="commentary">Commentary</h3> <p>It is relatively easy to understand the behavior of spot instances <em>in itself</em> — <em>Bid < Price ⇒ Terminate</em>. The difficulty of using spot instances lies in the fact that it is a market (at least that’s what we’re led to believe) driven by supply and demand and a lot of <em>mostly</em> rational bidders.</p> <p>We can know how our spot instances behave when the spot market price changes. But <strong>we cannot predict the spot market itself</strong>.</p> <p>This means that although you can influence the likelihood of spot instance termination through bidding strategy, <strong>you still have to be able to recover from sudden (and massive) spot instance termination.</strong></p> <p>Did I get <em>that</em> through?</p> <h3 id="further-reading">Further reading</h3> <ul> <li>Jenkins <a href="">AWS EC2 Plugin</a> has spot instance support since version 1.19. Caveat emptor: I haven’t used it with spot instances (on-demand only).</li> <li>That said, I know companies which prefer the <a href="">Swarm plugin</a> for node discovery and use custom provisioning scripts. That’s a roll-your-own path for bidding and provisioning automation, though.</li> <li>See <a href="">Tapjoy’s slides</a> on how they’re using Jenkins with spot instances.</li> <li>AWS’s <a href="">Continuous Deployment Practices, with Production, Test and Development Environments Running on AWS</a> set talks about a lot more than spot instances, but see <a href="">slide 49</a> about where to use spot instances vs. other instance types in a more complex CI environment.</li> <li><a href="">EC2 Performance, Spot Instance ROI and EMR Scalability</a> by Jesse Anderson covers a lot about determining correct instance types his project, but covers also using spot instances.</li> <li><a href="">Using Spot Instances in Amazon EMR without the risk of losing the job</a> has concrete examples on how to use EMR via command line with spot instances.</li> <li><a href="">See Spot Run: Using Spot Instances for MapReduce Workflows</a> (Chohan et al, 2010) is a good read. It also notes that under some conditions adding spot instances (that will be terminated) actually increases Hadoop job completion time and its total cost.</li> </ul> <p>Here’s the <a href="/2014/03/20/ec2-spot-market">next post in the series</a>.</p> Spot instances and price behavior 2014-03-12T14:00:00+00:00 <p>(You might want first see the <a href="/2014/03/12/ec2-spot-intro">introduction to this series of posts</a> if you jumped in here randomly.)</p> <h2 id="a-namesi-marketaspot-instances-and-the-spot-instance-market"><a name="si-market"></a>Spot instances and the spot instance market</h2> <p.</p> <p>A lot of the information in this section can be found in <a href="">AWS’s own spot instance documentation</a>. Most of the graphs have been generated by me using 90 days of spot pricing data from December 9th 2013 to March 9th 2014.</p> <h3 id="what-are-spot-instances">What are spot instances?</h3> <p>For the purpose of computation, spot instances are like any other instance type AWS offers. Where they differ is that <strong>you do not have a complete control on the lifecycle of spot instances</strong>.</p> <blockquote> <p><strong>Spot instances can be terminated by AWS at any time.</strong></p> </blockquote> <p>(<strong>Edit 2015-01-06</strong>: <a href="">AWS announced</a> a two-minute termination notice available via instance metadata. You still can’t prevent termination, but you do not get a short notice before it occurs.)</p> <p>With on-demand instances (the regular variety) and reserved instances you get to choose the lifetime of the instance. With spot instances it is you <strong>and AWS</strong> who get to terminate the instance. AWS of course plays by the market rules so any loss of spot instances is not arbitrary although it may sometimes seem like so (because not all variables that affect the market are visible).</p> <p><strong>Why would anyone use spot instances then?</strong> Simple: cost. Spot instance prices are variable but on average they offer <strong>significantly lower prices</strong> than with on-demand prices. With spot instances it is possible to get same savings as with 3 year heavy usage reserved instances offer without the up-front costs.</p> <p>If you can structure your computing needs around the potential arbitrary instance loss then you can gain substantial benefits from using spot instances. AWS’s own marketing material references to customer cases with 50-60% savings on instance costs.</p> <blockquote> <p>Spot instance prices cover only EC2 instances. Other instance-related resources such as network traffic and EBS usage by the instance is billed at regular rates.</p> </blockquote> <p>To recap:</p> <ul> <li>Spot instances are functionally equivalent to other types of instances.</li> <li>Spot instances may be terminated at any time by AWS.</li> </ul> <h3 id="what-is-the-spot-instance-price">What is the spot instance price?</h3> <p>First of all, spot instances are priced <strong>by instance type, by region and by availability zone in that region</strong>. This means that spot market price for <code class="highlighter-rouge">m1.small</code> differs from zone to zone even within a single region, not alone between regions.</p> <p>Neither is spot instance pricing fixed. It varies over time and is determined by the <em>AWS spot market</em>. The market is essentially an auction where buyers (spot instance users) submit <strong>bids</strong>. AWS determines the spot instance price based on these bids and then</p> <ol> <li> <p>Everyone with a bid higher or equal to the resulting spot instance price “wins” and gets the instances they requested (or keeps them, in case they already exist), and</p> </li> <li> <p>Winners pay for the <strong>spot instance price</strong> and not their own bid (e.g. everyone pays the same value which may be lower than their bid).</p> </li> </ol> <p>Note that anyone <strong>losing their bid</strong> either will not get their instances or will get their <strong>existing spot instances terminated</strong>.</p> <p>Spot market is a continuous auction where the spot instance price is continuously updated. The update interval may be anything from minutes to days, depending on the supply of instance capacity and demand for spot instances.</p> <p>You can see spot market price history in the <a href="">AWS management console</a>. Here’s a typical graph you can get:</p> <p><img src="/assets/posts/spot-instance-price-history-management-console.png" alt="Sample spot price history graph from AWS management console" /></p> <p>You can twiddle the settings in the UI, but you are limited to 90 days of pricing history.</p> <p><small.</small></p> <p>To recap:</p> <ul> <li>Spot instance price is variable and is determined continuously by AWS based on how customers bid for spot instances.</li> <li>Each region, availability zone and instance type is a separate market for the purpose of pricing.</li> <li>Whether you get or lose spot instances is determined whether your bid is equal to or larger than the current spot price.</li> <li>You pay only the current spot price regardless of your bid price.</li> </ul> <h3 id="how-do-i-actually-buy-spot-instances">How do I actually buy spot instances?</h3> <p><a href="">RTFM</a> or watch <a href="">this video</a>.</p> <h3 id="price-volatility">Price volatility</h3> <p>Spot prices are <strong>volatile</strong> — they go up, they go down, they go sideways and all at the same time. I’m no economist and can’t give you an exact definition of volatility, but please take a look at the graphs shown below:</p> <figure class="full"> <p><a href="/assets/posts/instance-price-volatility-example.svg"><img class="double" src="/assets/posts/instance-price-volatility-example.svg" alt="c1.medium vs. cc2.8xlarge price volatility differences" /></a> <a href="/assets/posts/zone-price-volatility-example.svg"><img class="double" src="/assets/posts/zone-price-volatility-example.svg" alt="c1.medium volatility across zones in us-east-1" /></a></p> <figcaption> <p.</p> </figcaption> </figure> <p>From these images it should be clear that there are differences in volatility, minimum and maximum prices, average prices etc. between instance types (left image) where the overall volatility for <code class="highlighter-rouge">c1.medium</code> is high over the whole data period, but for <code class="highlighter-rouge">cc2.8xlarge</code> there is a clear and persistent volatility drop on January 8th.</p> <p>There can be significant volatility between different availability zones in the same region (right image) where the price for <code class="highlighter-rouge">c1.medium</code> has been pretty stable and low in two zones (zones 1 and 2). This isn’t the case with all of the other zones (3 to 5) where both daily averages (solid line) <strong>and</strong> the maximum daily price (lightly colored blocks in the background) vary massively from day to day.</p> <p>Yes, in the graphs above the <strong>daily average prices are over 10x the on-demand instance pricing on several days</strong> with spikes even higher. In the above graphs the weighted average price for <code class="highlighter-rouge">c1.medium</code> instance in zone 2 is $0.0184 and for zone 3 $0.3174. The regular on-demand instance price for <code class="highlighter-rouge">c1.medium</code> in <code class="highlighter-rouge">us-east-1</code> is $0.145 per hour. This may give you a WTF moment but see below. I’m going later to discuss one situation where <a href="#si-spot-availability">bidding over the on-demand price</a> would have been a reasonable strategy <em>post hoc</em>.</p> <blockquote> <p>AWS assigns a random permutation of availability zones for each customer account. In plain English this means that <strong>my</strong> <code class="highlighter-rouge">us-east-1a</code> might be <strong>your</strong> <code class="highlighter-rouge">us-east-1d</code>. It’s a common tripping point when comparing metrics related to zones between different accounts. This is also why I omit zone labels from the graphs.</p> </blockquote> <p>To recap:</p> <ul> <li>Prices can both vary widely, up to multiple times the price of equivalent on-demand instance.</li> <li>Price volatility can vary massively between instance types in the same region, and between availability zones for the same instance type in the same region.</li> </ul> <h3 id="a-namesi-spot-availabilityainstance-availability-is-determined-by-bid-prices"><a name="si-spot-availability"></a>Instance availability is determined by bid prices</h3> <blockquote> <p><strong>IMPORTANT</strong>: All of the graphs below use <em>post hoc</em> analysis. The theoretical maximums on availability and price savings would be possible to achieve <strong>only if you can predict the future!</strong></p> </blockquote> <p>So far I’ve said that spot instances may be terminated at any time the spot price goes over your instance bid price. This doesn’t yet tell us what is the typical <strong>expected</strong> lifetime (which in turn determines availability) of an instance based on a particular bid.</p> <p>There is research into algorithms to optimize availability vs. cost. See <a href="">Mazucco and Dumas (2011)</a>, <a href="">Andrzejak et al (2010)</a>, <a href="">Wee (2011)</a> and <a href="">Ben-Yehuda et al (2013)</a>. The last one (Ben-Yehuda et al) is probably the most thorough in considering price vs. availability tradeoffs. <strong>Be careful</strong> when interpreting conclusions from these and other papers as most of them use data prior to the <a href="">July 1st 2011 change of spot market pricing mechanism</a>.</p> <p>The figure below shows how <strong>achievable availability</strong> varies with the normalized bid price for two types of instances and availability zones. <small>(I’m calculating availability instead of expected lifetimes just because it’s easier. A value for expected lifetime as well as number of interruptions versus bid price would be interesting, though.)</small></p> <figure> <p><a href="/assets/posts/achievable-availability-example.svg"><img src="/assets/posts/achievable-availability-example.svg" alt="Achievable availability for c1.medium and cc2.8xlarge vs. bid price" /></a></p> <figcaption> <p>Example showing <b>theoretically</b> achievable availability versus normalized bid price with <code>c1.medium</code> and <code>cc2.8xlarge</code> in the <code>us-east-1</code> region. Vertical lines correspond to 1/4x, 1x and 4x on-demand instance price.</p> </figcaption> </figure> <p>This shows that sometimes it is possible to get 100% availability at less than on-demand instance bid price — look at the purple line for <code class="highlighter-rouge">c1.medium</code> which hits 100% at bid price of 98% × on-demand price and 99.9% availability at bid price of 32% × on-demand price. But wait, there’s more! Remember that you don’t pay the bid price but the market price!</p> <p>The figure below is otherwise identical to the one above with the exception that horizontal axis is the relative <strong>total cost</strong> (… over the whole data period analyzed — the result over any other random range of dates will be different).</p> <figure> <p><a href="/assets/posts/achievable-availability-cost-example.svg"><img src="/assets/posts/achievable-availability-cost-example.svg" alt="Achievable availability for c1.medium and cc2.8xlarge vs. total cost" /></a></p> <figcaption> <p>Example showing <b>theoretically</b> achievable availability versus normalized cost. Note that even when the bid price might have to be substantially higher than on-demand price to gain 100% availability the total cost can still be less.</p> </figcaption> </figure> <p>This shows that even when you’d have to bid for <code class="highlighter-rouge">cc2.8xlarge</code> at about 4× on-demand price to achieve 100% availability, that availability would have <strong>cost</strong> you less than 73% of the total on-demand instance cost (that is, over the 90 days of the sample data).</p> <p>Finally, as a bad cost case example see the figure below:</p> <figure> <p><a href="/assets/posts/worst-case-availability-cost-example.svg"><img src="/assets/posts/worst-case-availability-cost-example.svg" alt="Availability vs. total cost c3.2xlarge" /></a></p> <figcaption> <p>Availability vs. total cost for <code>c3.2xlarge</code> in <code>us-east-1</code> over the data period. It is not possible to achieve even 50% availability without paying substantially more than for equivalent on-demand instance.</p> </figcaption> </figure> <p>During the time period this data set covers it was not possible to achieve any level of reliability for <code class="highlighter-rouge">c3.2xlarge</code> instances without paying substantially more than the equivalent cost for an on-demand instance.</p> <p><strong>Why would anyone pay >1× rates?</strong> During this particular time period there was a shortage of on-demand and reserved <code class="highlighter-rouge">c3.2xlarge</code>.)</p> <p>To recap:</p> <ul> <li>Your bid price determines not only whether you get a spot instance in the first place, but also how long acquired spot instances stay alive.</li> <li><strong>You control your spot instance’s availability through bid prices.</strong></li> </ul> <h3 id="a-namesi-spot-999-dollarsainstances-at-99999hour"><a name="si-spot-999-dollars"></a>Instances at $999.99/hour</h3> <p>On September 2011 there was a huge price increase in one zone of the <code class="highlighter-rouge">us-east-1</code> region for <code class="highlighter-rouge">m2.2xlarge</code> instances where the spot market price jumped from about $0.44 to $999.99 per hour.</p> <p><strong>What happened?</strong></p> <ul> <li>Someone had put in $999.99 bid</li> <li>Spot instance capacity / demand changed rapidly (Dave@AWS: <em>“an sudden increase in demand for On-Demand m2.2xlarge instances”</em>)</li> <li>Some poor sod ended up paying $999.99 per hour for their spot instances.</li> </ul> <p>To understand why this could happen, let’s try to imagine what the situation might have been in the “bidding pool” (the set of bids on the <code class="highlighter-rouge">m2.2xlarge</code> spot capacity) before the price hike in a quite artificial setup with only a few bidders and total supply of just five spot instances:</p> <p><a href="/assets/posts/999.99-spot-price-event-low-price.svg"><img src="/assets/posts/999.99-spot-price-event-low-price.svg" alt="Before the $999.99 price hike" /></a></p> <p>One possible bidding scheme is to allocate capacity to bids in highest-bidder-first with the final spot price being determined by the lowest winning bid. Thus in this situation the person with $999.99 bid will still pay $0.200 per hour.</p> <p>If this person now needed three more instances at the same bid price, then the bidding scheme would work like this:</p> <p><a href="/assets/posts/999.99-spot-price-event-high-price.svg"><img src="/assets/posts/999.99-spot-price-event-high-price.svg" alt="Before the $999.99 price hike" /></a></p> <p>BOOM!</p> <p>In reality we don’t know why the bid price rose as <strong>AWS does tell us how the spot price is determined</strong>. It is supposed to be based on some form of auction model, but it might not be. See <a href="">Achieving Performance and Availability Guarantees with Spot Instances</a> by Mazucco et al which discusses bidding schemes and server allocation policies that maximize the <strong>seller’s profit</strong>.</p> <p>The best description on how the spot price is determined is <em>“The Spot Price is set by Amazon EC2, which fluctuates in real-time according to Spot Instances supply and demand”</em> (<a href="">source</a>). Without AWS disclosing the actual algorithm it is entirely possible that it is <strong>not</strong> even remotely following the simple auction model described above. It could be really out to maximize AWS’s revenue — in the previous case the algorithm could have realized that at that particular moment profit would be maximized with the absurd $999.99/hour spot price! <small>(Though I do think that this behavior took AWS by surprise too. I think they fell into the theoretical trap of assuming that people participating in market are all rational players, where in reality they often are not.)</small></p> <p>This is however pure speculation. From a buyer’s perspective the spot market does work as it statistically does provide cheaper resources than the on-demand market.</p> <p>AWS has since added <a href="">a cap on the bid price</a> (see <a href="">also here</a>), limiting potential accidents like this. The default cap limit is 4x the equivalent on-demand instance price, but it can be increased and clearly has been increased by some bidders (see <a href="">this graph</a> and note how the maximum and average daily prices have been over 4x several times).</p> <p>Regardless of the cap <strong>you should bid only what you are willing to pay</strong>.</p> <blockquote> <p>For more information on the actual event, please see <a href="">brandon’s early report</a> in devblog.moz.com, a later analysis by <a href="">Jonathan Boutelle from Slideshare</a> and <a href="">Dave@AWS’s responses on the event</a> in the AWS discussion forum.</p> </blockquote> <p>To recap:</p> <ul> <li>Bid only what you can bear.</li> </ul> <h3 id="further-reading">Further reading</h3> <p>You can find a ton of resources on AWS spot instances and the spot instance market on the net. Here are a few web pages, articles and research papers I’ve found useful:</p> <ul> <li>AWS’s own landing page on <a href="">spot instances</a></li> <li>Pretty comperhensive <a href="">set of videos</a> from AWS on spot instances</li> <li>Slides from <a href="">Saving with Spot Instances</a> session in re:Invent 2012 (<a href="">here’s the video</a> to go with it, although the slides are more compact)</li> <li><a href="">Deconstructing Amazon EC2 Spot Instance Pricing</a> by Ben-Yehuda et al — remember to read epilogue on page 19!</li> </ul> <p>Here’s the <a href="/2014/03/19/ec2-spot-usage">next post in the series</a>.</p> Series on AWS spot instances 2014-03-12T13:00:00+00:00 <p>While pondering about whether and why AWS would retire instance types (<a href="/tags.html#instance retirement-ref">see here</a>) I started looking more deeply into the <a href="">spot instance market</a> to see if and what it could potentially tell about instance type retirement.</p> <p>I started writing one post about the topic. Then I realized it had to be split into two. And into three. So now I have a series of blog posts about AWS spot instances and the spot instance market.</p> <p>I’ve split these posts into the following topics:</p> <ol> <li><a href="/2014/03/12/ec2-spot-instances">Overview of spot instances and the spot instance market</a></li> <li><a href="/2014/03/19/ec2-spot-usage">How to actually use spot instances</a></li> <li><a href="/2014/03/20/ec2-spot-market">Why spot market exists, where do spot instances come from and what drives spot instance prices</a></li> <li><a href="/2014/03/25/ec2-spot-price-minimum">Interlude into discussion of spot price minimums</a></li> <li>What can the spot market tell about AWS’s capacity changes (in progress)</li> </ol> <p>Most of the information I’m going to present is collected from several sources which themselves have done excellent research and provide excellent advise for spot instance users. I’ll try to give credit to those sources as far as possible without sacrificing readability of this piece.</p> <p>Now, <a href="/2014/03/12/ec2-spot-instances">onwards to the first chapter</a>.</p> m1 marching into obsolescence? 2014-03-07T00:00:00+00:00 <blockquote> <p>I’m revisiting the topic of my earlier post <a href="/2014/01/13/aws-retiring-instance-types">retiring instance types</a> from a couple months back. You might want to check it out first. It has more pictures than this post.</p> </blockquote> <p>Ars technica wrote about <a href="">Intel’s “Powered by Intel Cloud Technology”</a> just two days after my previous AWS post. I couldn’t find a date when <a href="">this branding program</a> was launched, but the Ars post was the earliest I could find (Intel’s blog has a post from <a href="">January 15th</a>) so I’m assuming this really was announced in January.</p> <p>It is clear that AWS and Intel have been working together on this programme for a longer time. It is telling that no AWS announcement <a href="">on year 2012</a> is more explicit about processor type than “Intel Xeon”, no announcement <a href="">from year 2011</a> mentions processor type at all but <a href="">year 2013</a> starts right off the bat with the announcement of the <a href="">cr1 instance class</a> giving a full lowdown on its processor specs.</p> <p>There was an Intel PR announcement on <a href="">September 10th 2013</a> about AWS’s use of Intel processors but <strong>that story</strong> does not contain reference to the “Powered by Intel Cloud Technology” program. So something was brewing already in September 2013 but it wasn’t yet given a name …</p> <blockquote> <p>So it seems that the reason behind AWS becoming more explicit about the underlying processor hardware is due to its relationships with Intel and the “Powered by Intel Cloud Technology” program. I just wonder what kind of benefits this program gives AWS — and as <a href="">Ars points out</a>, why neither Compute Engine or Windows Azure partake in the program?</p> </blockquote> <p>If you trawl the Internet archives you’ll also find that AWS <strong>did not</strong> specify m3’s processor type when they were <a href="">first announced</a>. The exact processor type was added to EC2 instance description sometime between <a href="">September 1st 2013</a> and <a href="">September 9th 2013</a>.</p> <p>Okay but how does this buhaha about “Intel Inside” and m3 have to do with m1?</p> <p>AWS has given a lot of screen estate telling its customers how m3 instance types are cheaper and better and shinier than the old first-generation m1 instances. For example, see the announcement on <a href="">m3.medium and m3.large types</a> and <a href="">availability of m3 RDS instances</a> for a few choice words. Alternatively hear what AWS’s chief evangelist, <a href="">Jeff Barr says</a>: <em>“You get significantly higher and more consistent compute power at a lower price when you use these instances”</em>. Or <em>“compared to M1 instances, M3 instances provide better, more consistent perfromance at lower prices”</em> on the <a href="">EC2 instance description page itself</a>.</p> <p>For me this seems like less-than-subtle prodding for AWS customers to move away from m1 EC2 and RDS instance types. But why? Moving your customers to a <strong>cheaper</strong> platform makes no business sense <strong>unless it generates more revenue</strong> than is lost due to lower pricing. How could this be true? A couple of possibilities exist:</p> <ol> <li> <p>New instance classes are cheaper to purchase and/or operate (cheap enough to give better operating profit than old instances). Note that the newer instance types fall under Intel’s cloud technology program whereas old ones do not.</p> </li> <li> <p>There is a desire to obsolete old instance class for some <strong>other</strong> reason than operating profit alone. (Maybe AWS wants those racks freed for other uses?)</p> </li> </ol> <p>Following the business logic of the first case will still eventually lead to obsoletion of old instance class <strong>hardware</strong>. Whether it will lead to obsoletion of the instance <strong>class</strong> is another thing entirely. Yet it is hard to see how the “old” m1 instance class could be kept interesting to customers without reducing its price. But why do that? The only reason would be to squeeze the last cents out of EOL’ed class.</p> <p><small>(Of course AWS has the <strong>spot market</strong> to peddle those less desirable instance types at so-called “market rates” … More on the spot market later.)</small></p> <p>Now for the practical advise section! Now after m3.medium was announced it is clear that you should:</p> <ul> <li><strong>Use m3.medium instead of m1.medium.</strong></li> <li><strong>Use m3.large instead of m1.large.</strong></li> <li><strong>Use m3.xlarge instead of m1.xlarge.</strong></li> </ul> <p’.)</p> <p <strong>no</strong> m3.small.</p> <p>At least not yet.</p> <p>I wonder.</p> Sockets and concurrency the buggy way 2014-03-06T00:00:00+00:00 <p><strong>Updated 2016-02-16: I have added more details pointing out the exact conditions under which the race condition I describe can be triggered. See below.</strong></p> <p>I’ll once again share a small gotcha moment from recent programming experiences. This comes from my jab at <a href="/2014/03/03/experiences-in-erlang">Erlang programming</a> and concerns about a <em>very</em> subtle bug I introduced into the hypercube node code I was writing.</p> <p>With subtle I do mean <em>subtle</em>..</p> <blockquote> <p>As most bugs go, this is obvious once you realize the underlying problem. For long-time Erlang programmers this might be a known problem and avoided without a second thought.</p> </blockquote> <h2 id="what-i-tried-to-do">What I tried to do</h2> <p>So I’m writing this post hopefully help anyone who might run the same problem. But before delving into the actual bug let me first tell what I was trying to do:</p> <ol> <li>I wanted to have a server listening on a port, where</li> <li>Each new connection would be handled by a spawned Erlang process (e.g. in a separate thread)</li> </ol> <p>There are two ways to process incoming traffic on a socket in Erlang:</p> <ul> <li>Use <code class="highlighter-rouge">gen_tcp:recv</code> in a loop to receive input, then process it. This is the typical approach taken to network programming in <strike>most</strike> <p>all languages.</p> </li> <li>Use Erlang’s (unique?) method of <strong>active sockets</strong> where the Erlang runtime will send incoming network traffic to as messages to the socket’s controlling process.</li> </ul> <p><strong>I decided to use the latter method.</strong> It fits nicely into Erlang’s view of the world where asynchronous interactions occur via messaging. It also allows nice integration with other processes since you can handle <strong>both</strong> Erlang-world messages and non-Erlang-world interactions in the same <code class="highlighter-rouge">receive</code> loop.</p> <h3 id="using-an-active-socket-in-a-network-client">Using an active socket in a network client</h3> <p>Here’s an example Erlang program to connect to port 12345 on localhost, reading data from the socket and printing it out:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nf">main</span><span class="p">(_)</span> <span class="o">-></span> <span class="p">{</span><span class="n">ok</span><span class="p">,_}</span> <span class="o">=</span> <span class="nn">gen_tcp</span><span class="p">:</span><span class="nf">connect</span><span class="p">(</span><span class="s">"localhost"</span><span class="p">,</span> <span class="mi">12345</span><span class="p">,</span> <span class="p">[{</span><span class="n">active</span><span class="p">,</span> <span class="n">true</span><span class="p">},</span> <span class="p">{</span><span class="n">packet</span><span class="p">,</span> <span class="n">line</span><span class="p">}]),</span> <span class="nf">loop</span><span class="p">().</span> <span class="nf">loop</span><span class="p">()</span> <span class="o">-></span> <span class="k">receive</span> <span class="p">{</span><span class="n">tcp</span><span class="p">,_,</span><span class="nv">Data</span><span class="p">}</span> <span class="o">-></span> <span class="nn">io</span><span class="p">:</span><span class="nf">format</span><span class="p">(</span><span class="s">"Received: ~ts"</span><span class="p">,</span> <span class="p">[</span><span class="nv">Data</span><span class="p">]),</span> <span class="nf">loop</span><span class="p">();</span> <span class="p">_</span> <span class="o">-></span> <span class="nn">io</span><span class="p">:</span><span class="nf">format</span><span class="p">(</span><span class="s">"Error or socket closed, exiting.</span><span class="si">~n</span><span class="s">"</span><span class="p">),</span> <span class="nf">halt</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="k">end</span><span class="p">.</span> </code></pre> </div> <p>To try this out, put this into a file and, run <code class="highlighter-rouge">echo hello | nc -l 12345</code> in another terminal and use <code class="highlighter-rouge">escript</code> to run the script. Of course you need an <a href="">Erlang installation</a> in the first place.</p> <p>The program opens a connection with <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> socket option. This sets the connected socket into active mode. Incoming data is then processed by <code class="highlighter-rouge">loop</code> which keeps calling <code class="highlighter-rouge">receive</code> in a loop until the socket is closed (or an error occurs).</p> <h3 id="using-active-sockets-in-a-network-server">Using active sockets in a network server</h3> <p>A socket server with active sockets is also straightforward (<strong>except don’t use this code, see below</strong>):</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="c">%% WARNING: Don't use this code, it contains a race condition. See below. </span><span class="nf">main</span><span class="p">(_)</span> <span class="o">-></span> <span class="p">{</span><span class="n">ok</span><span class="p">,</span><span class="nv">S</span><span class="p">}</span> <span class="o">=</span> <span class="nn">gen_tcp</span><span class="p">:</span><span class="nf">listen</span><span class="p">(</span><span class="mi">12345</span><span class="p">,</span> <span class="p">[{</span><span class="n">active</span><span class="p">,</span> <span class="n">false</span><span class="p">},</span> <span class="p">{</span><span class="n">packet</span><span class="p">,</span> <span class="n">line</span><span class="p">}]),</span> <span class="nf">server_loop</span><span class="p">(</span><span class="nv">S</span><span class="p">).<="nn">inet</span><span class="p">:</span><span class="nf">setopts</span><span class="p">(</span><span class="nv">C</span><span class="p">,</span> <span class="p">[{</span><span class="n">active</span><span class="p">,</span> <span class="n">once</span><span class="p">}]),</span> <span class="k">receive</span> <span class="p">{</span><span class="n">tcp</span><span class="p">,_,</span><span class="nv">Data</span><span class="p">}</span> <span class="o">-></span> <span class="nn">gen_tcp</span><span class="p">:</span><span class="nb">send</span><span class="p">(</span><span class="nv">C</span><span class="p">,</span> <span class="nv">Data</span><span class="p">),</span> <span class="nn">io</span><span class="p">:</span><span class="nf">format</span><span class="p">(</span><span class="s">"</span><span class="si">~w</span><span class="s"> Received: ~ts"</span><span class="p">,</span> <span class="p">[</span><span class="nf">self</span><span class="p">(),</span> <span class="nv">Data</span><span class="p">]),</span> <span class="nf">connection_loop</span><span class="p">(</span><span class="nv">C</span><span class="p">);</span> <span class="p">_</span> <span class="o">-></span> <span class="nn">io</span><span class="p">:</span><span class="nf">format</span><span class="p">(</span><span class="s">"</span><span class="si">~w</span><span class="s"> Error or socket closed, closing.</span><span class="si">~n</span><span class="s">"</span><span class="p">,</span> <span class="p">[</span><span class="nf">self</span><span class="p">()]),</span> <span class="nn">gen_tcp</span><span class="p">:</span><span class="nf">close</span><span class="p">(</span><span class="nv">C</span><span class="p">)</span> <span class="k">end</span><span class="p">.</span> </code></pre> </div> <p>This program will bind to port 12345, accept connections on the port, spawn an Erlang process for each connection which in turn will echo all traffic back to the originating socket. Test it out with <code class="highlighter-rouge">echo hello | nc 12345</code>.</p> <p>You might be wondering about <code class="highlighter-rouge">gen_tcp:controlling_process</code>, <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">false</span><span class="p">}</span></code> and <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">once</span><span class="p">}</span></code> in the code:</p> <ul> <li> <p>When a socket is in <em>active mode</em> it will send packets to the <strong>controlling process</strong> which is initially the process that created the socket. Thus <code class="highlighter-rouge">server_loop</code> must explicitly give control of the socket to the <code class="highlighter-rouge">connection_loop</code> process.</p> </li> <li> <p>Similarly we don’t want the server process to receive any packets, which is why the listen socket is defined as <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">false</span><span class="p">}</span></code> — this setting is inherited to the accepted socket so it will also start in inactive mode.</p> </li> <li> <p>Finally, the connection handler sets the socket <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">once</span><span class="p">}</span></code> which is mostly similar to <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> except it adds flow control to the mix. Which is a good thing before trying to drink from a fire hose …</p> </li> </ul> <h3 id="but-it-has-a-race-condition">But it has a race condition!</h3> <p>If you were not dozing off you’ve realized that <strong>this version has the race condition</strong> I mentioned earlier. The race occurs when code is executed in a particular sequence and the client is sending data at just the right moment.</p> <p>Below is a figure showing two possible sequences of events within the code, on the left is a sequence with <strong>the desired (working) outcome</strong> and on the right side is another but possible <strong>sequence which doesn’t work</strong> (there are a few more “bad” execution sequences, but I’ll use just one as an example):</p> <p><img src="/assets/posts/erlang-socket-sequence.svg" alt="Two possible execution paths in the sample server code" /></p> <p>In the figure <span style="background: #ff9da6; padding: 0 0.2em;">red</span> is <code class="highlighter-rouge">server_loop</code> code, <span style="background: #42ff7e; padding: 0 0.2em;">green</span> is <code class="highlighter-rouge">connection_loop</code> code and <span style="background: #71beff; padding: 0 0.2em;">blue</span> is Erlang’s internal-ish network-ish code handling incoming data for active sockets.</p> <p>What we want is that the connection handler (<code class="highlighter-rouge">connection_loop</code>) will receive all data that is sent to the connected socket. Just like happens in the left sequence — data is received on the socket after socket’s ownership has changed and the handler code is ready to receive data.</p> <p>On the “bad” sequence the child process will set the socket to active state <strong>before the parent process has changed the socket’s ownership</strong>. This means that any data received on the socket before ownership change is <strong>sent to the wrong process</strong>. The recipient will be the listener process and not process running <code class="highlighter-rouge">connection_loop</code> code. Oh boy, the data is now lost. <small>(Technically it’s not lost. It is just unread in the message queue of the wrong process. Regardless, it is never read.)</small></p> <blockquote> <p>I wrote <a href="/2014/03/03/experiences-in-erlang">in the previous post</a> <em>“[Erlang’s] shared-nothing process model removes most problems with shared resources.”</em> Yep. Erlang removes most race conditions on shared resources by <strong>eliminating most shared resources</strong>. When resources <strong>are</strong> shared such as on-disk files or <em>network sockets</em> there can still be concurrency problems.</p> </blockquote> <p>If this would be a real server process with request-response protocol and client-initiated handshake, then the connection would also be stuck permanently (server never sees the handshake, yet client has successfully sent it and is expecting a reply).</p> <blockquote> <p>I want to emphasize how difficult this bug is to trigger. The remote client will not be sending data until the TCP handshake completes. When <code class="highlighter-rouge">listen</code> returns, the TCP stack has already sent a SYN-ACK packet to the client. After it reaches the client it can start sending data, but this will take with any Internet connection anything from a few milliseconds to hundreds of milliseconds.</p> <p>I instrumented the code, showing that <code class="highlighter-rouge">server_loop</code> took ).</p> </blockquote> <p><strong>The next few paragraphs were added on 2016-02-16. My thanks to Robert Gionea for pointing out the distinction between <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> and <code class="highlighter-rouge"><span class="p">{</span><span class="err">active,</span><span class="w"> </span><span class="err">once</span><span class="p">}</span></code> in how parent process queue is handled.</strong></p> <p:</p> <ol> <li>SMP is enabled (enabled automatically on multicore/multiprocessor systems).</li> <li>Child process modifies socket’s <code class="highlighter-rouge">active</code> state <strong>while</strong> socket’s ownership is being transferred (parent calls <code class="highlighter-rouge">gen_tcp:controlling_process</code>.)</li> </ol> <p>See <a href="">ERL-90</a> bug report for much, much more in-depth description of the actual underlying problem - it has surprisingly old roots, probably being the side effect of introduction of SMP capability introducing a new failure mode to <code class="highlighter-rouge">gen_tcp:controlling_process</code> that was not fully appreciated at that time. The fix discussed below prevents the second condition from happening and thus also prevents the race condition from occurring.</p> <p>(End of 2016-02-16 edit.)</p> <h3 id="de-bugged-versions-of-the-server-code">De-bugged versions of the server code</h3> <p>Fixing this is easy once the problem is identified: just add a synchronization barrier to ensure that <code class="highlighter-rouge">connection_loop</code> won’t be called until the parent process has relinquished its control on the socket:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="c">%% Version spawning off a process to handle the connection. <="k">receive</span> <span class="n">start</span> <span class="o">-></span> <span class="n">ok</span> <span class="k">end</span><span class=v">Pid</span> <span class="o">!</span> <span class="n">start</span><span class="p">,</span> <span class="nf">server_loop</span><span class="p">(</span><span class="nv">S</span><span class="p">).</span> </code></pre> </div> <p>Since this race condition occurs only when <strong>not</strong> using <code class="highlighter-rouge">recv</code> and <strong>switching controlling process</strong> there are also two other ways to write the code so the race condition never occurs. First one is to eliminate the need to use <code class="highlighter-rouge">controlling_process</code> by spawning a new process for the listener instead:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="c">%% Version using the current process to handle the connection, passing socket %% listening to a spawned process instead. <">server_loop</span><span class="p">(</span><span class="nv">S</span><span class="p">)</span> <span class="k">end</span><span class="p">),</span> <span class="nf">connection_loop</span><span class="p">(</span><span class="nv">C</span><span class="p">).</span> </code></pre> </div> <p>and the other is to <strong>not</strong> use active sockets at all:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="c">%% Version eliminating active sockets completely using gen_tcp:recv only. <="k">case</span> <span class="nn">gen_tcp</span><span class="p">:</span><span class="nf">recv</span><span class="p">(</span><span class="nv">C</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span> <span class="k">of</span> <span class="p">{</span><span class="n">ok</span><span class="p">,</span><span class="nv">Data</span><span class="p">}</span> <span class="o">-></span> <span class="p">...;</span> <span class="p">_</span> <span class="o">-></span> <span class="p">...</span> <span class="k">end</span><span class="p">.</span> </code></pre> </div> <h3 id="a-nameconcurrencyaconcurrency-"><a name="concurrency"></a>Concurrency …</h3> <p>This should be a reminder that <strong>concurrency is hard</strong>. (If you don’t believe me, check what <a href="">Simon Peyton Jones</a> says about <a href="">what’s wrong with locks</a>.)</p> <p <strong>1)</strong> try to avoid using concurrency in the first place, <strong>2)</strong> not realizing when they’ve accidentally created concurrent systems and finally <strong>3)</strong> when having to face concurrency they often get synchronization and sequencing wrong (leading to hard-to-find bugs).</p> <figure> <p><img src="/assets/posts/parallel-rail-tracks.jpg" alt="Parallel railroad tracks" /></p> <figcaption> <p>Parallel tracks. Get it? Parallel - parallelism? I know, I know … (Image source: <a href="">Daniel Zimmermann</a>)</p> </figcaption> </figure> <p>I think this makes for a very good case to <strong>prefer systems which provide better and safer concurrency programming models</strong>. This way at least the most common concurrency problems get eliminated entirely by design.</p> <p).</p> <p>Yet performance or parallelism should not be gained at the cost of <strong>correctness</strong>..</p> <p>To see some examples of how concurrency and parallelism can be made simpler for programmers see <a href="">a presentation on multicore Haskell</a>, Learn you some Erlang’s <a href="">section on concurrency</a> or introduction to Clojure’s <a href="">concurrency and STM mechanisms</a> (<a href="">slides</a>).</p> <p>I don’t think concurrency is never going to be easy, but let’s at least try to figuratively default to giving new programmers a bicycle instead of an unicycle?</p> Experiences in Erlang 2014-03-03T00:00:00+00:00 <p <a href="">CM-5</a>.)</p> <p>Unfortunately a binary N-cube routing algorithm is <strong>pretty much trivial</strong>. Here’s the whole routing algorithm written in Erlang:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nf">find_route</span><span class="p">(_,_,[],_)</span> <span class="o">-></span> <span class="p">{</span><span class="n">error</span><span class="p">,</span><span class="n">noroute</span><span class="p">};</span> <span class="nf">find_route</span><span class="p">(</span><span class="nv">Id</span><span class="p">,</span><span class="nv">Dst</span><span class="p">,[</span><span class="nv">Route</span><span class="p">|</span><span class="nv">Routes</span><span class="p">])</span> <span class="o">-></span> <span class="k">if</span> <span class="nv">Id</span> <span class="ow">band</span> <span class="mi">1</span> <span class="o">/=</span> <span class="nv">Dst</span> <span class="ow">band</span> <span class="mi">1</span> <span class="o">-></span> <span class="p">{</span><span class="n">ok</span><span class="p">,</span><span class="nv">Route</span><span class="p">};</span> <span class="n">true</span> <span class="o">-></span> <span class="nf">find_route</span><span class="p">(</span><span class="nv">Id</span> <span class="ow">bsr</span> <span class="mi">1</span><span class="p">,</span> <span class="nv">Dst</span> <span class="ow">bsr</span> <span class="mi">1</span><span class="p">,</span> <span class="nv">Routes</span><span class="p">)</span> <span class="k">end</span><span class="p">.</span> </code></pre> </div> <p>That’s it. 8 lines of code. The first function could be omitted (deducting two lines) as it guaranteed to be never called. (<code class="highlighter-rouge">Id</code> is this node’s address and <code class="highlighter-rouge">Dst</code> is destination address, each element in the <code class="highlighter-rouge">Routes</code> list is a neighbor in the matching dimension.)</p> <p>Since the actual <em>network problem</em> became trivial you can see why I picked up Erlang. It was for the sole purpose of <strong>making the assignment more interesting</strong>. I had not previously used Erlang — I was familiar with the syntax and could <em>read</em> Erlang programs — but all the libraries, conventions etc. were new to me. I knew of Erlang’s approach to distributed computing and parallelism and wanted to give it a spin.</p> <p>So, what I learned? I’ll first summarize its pros and cons from my viewpoint and later elaborate on these:</p> <table> <thead> <tr><th>Pros</th><th>Cons</th></tr> </thead><tbody> <tr><td> <ul> <li>Language and core libraries are compact, consistent and mature</li> <li>Built-in concurrency and messaging</li> <li>Pattern matching</li> <li>Symbols are always sexy</li> <li>Registered processes</li> </ul> </td> <td> <ul> <li>Cryptic compile-time and runtime errors</li> <li>Package management</li> <li>Structured data ~ painful syntax</li> <li>No hierarchical namespaces</li> <li>Registered processes</li> </ul> </td></tr></tbody></table> <p>The overall result for me is:</p> <ul> <li>Erlang is a very nice language, it has great features and I’d love to use it again.</li> <li>… but it won’t become my default go-to language.</li> </ul> <p><strong>Please note</strong> that I’m basing this post on my experiences. I might have missed or misinterpreted things that are obvious to other people, so don’t take this post as any kind of gospel truth of Erlang.</p> <hr /> <p>Now the long version. Erlang is really nice in several aspects:</p> <ul> <li> <p>The language is compact and consistent and the standard libraries are mature (e.g. well documented and debugged). There’s also a good variety of non-core libraries available which I didn’t have any trouble of using.</p> </li> <li> <p>Its built-in support for massive concurrency and distributed messaging are just manna from heavens.</p> <p>Erlang’s lightweight process model just kicks ass. I’ve spawned 15k Erlang processes (e.g. threads) without problems whereas in Python 1000 threads? Forget it (you’ll hit the <code class="highlighter-rouge">maxproc</code> limit). 99.99% of the time parallelism is a tool to achieve asynchronous behavior so that case should be as least limiting as possible. Like Erlang does (it runs green threads on multiple native threads, getting the best of both worlds).</p> <p>Also the shared-nothing process model removes most problems with shared resources. It does make some things more cumbersome and less efficient, but hey, I’m quite willing to trade a little inefficiency to programming with a massively less error-prone concurrency model.</p> </li> <li> <p>Pattern matching in functions, assignment and conditionals is sinfully easy. Don’t care to handle errors, but still want the process to fail when they occur? <code class="highlighter-rouge"><span class="p">{</span><span class="err">ok,Result</span><span class="p">}</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">maybe_failing_function()</span></code> — if the function <em>does not</em> return <code class="highlighter-rouge"><span class="p">{</span><span class="err">ok,_</span><span class="p">}</span></code> the runtime will signal that as an error. And of course <em>guards</em>.</p> </li> <li> <p>Symbols are always a good thing. Scheme, Ruby and Erlang (among others) do this right. Oh Python, when will you realize symbols are a very useful first-class citizen?</p> </li> <li> <p>Registered processes. They are very useful when they fit the need, but see below when they <em>don’t</em>.</p> </li> </ul> <p>On the minus side there are a few things that will mean that Erlang won’t be my choice as a default go-to language in the future:</p> <ul> <li> <p>Compiler and runtime errors. So I forgot to make the variable uppercase and now it thinks I want to do pattern matching with a symbol? My bad. But you just should give a less cryptic error message about it.</p> </li> <li> <p>Package management. <a href="">Rebar</a> can pull dependencies automatically, but there’s still a world of difference between writing <code class="highlighter-rouge">PyYAML</code> into <code class="highlighter-rouge">setup.py</code> vs. writing <code class="highlighter-rouge"><span class="p">{</span><span class="err">jiffy,</span><span class="w"> </span><span class="nt">"0\.8\.5"</span><span class="err">,</span><span class="w"> </span><span class="err">{git,</span><span class="w"> </span><span class="nt">""</span><span class="err">,</span><span class="w"> </span><span class="err">{tag,</span><span class="w"> </span><span class="nt">"0.8.5"</span><span class="err">}}}</span></code> into <code class="highlighter-rouge">rebar.config</code> <em>over and over again</em>. This is not a problem for large projects where dependency setup is one-time-only affair, but when doing smaller or one-off programming jobs it would add up quickly to the workload.</p> </li> <li> <p>Horrendous syntax for structured data. Changing a field? <code class="highlighter-rouge">NewStruct = Struct#struct{value=Struct#struct.value + 1}</code> A little syntatic sugar here would do miracles. Yes, you can use parse transformations to help. But that then gets you into another problem of having to <em>first</em> get those parse transforms (see previous) and <em>second</em> to apply them.</p> </li> <li> <p>Registered processes. These are nice, I would very much want to use them but can’t. The idea is that you can register processes by name, say identify the router process as <code class="highlighter-rouge">router</code> and use it directly in messaging like <code class="highlighter-rouge">router ! {route,Packet}</code>. Add a supervisor which will re-spawn a failed router thread you’ve got a model where you always know how to reach a working “router” process.</p> <p>Except registered processes are global. I needed to run multiple hypercube nodes in a single server process, with <em>each</em> having a <em>separate</em> router and <em>separate</em> local message handler and <em>separate</em> remote connectors and <em>separate</em> state manager.</p> <p?</p> <p>Which does not work in a multitenancy scenario where you have multiple “domains” of processes, where intra-domain visibility is a good thing but inter-domain visibility is verboten.</p> <p>So I was stuck to using the process dictionary and lugging process identifiers around in function arguments.</p> </li> <li> <p>Lack of hierarchical namespaces. It is two levels and only two levels. Module and function name and that’s it. So when your <code class="highlighter-rouge">frobnizer</code> app needs to have internal module, it is <code class="highlighter-rouge">frobnizer_internal_module</code> and not <code class="highlighter-rouge">frobnizer.internal.module</code>. Module hierarchy and scoping isn’t <a href="">only syntatic sugar</a> regardless what hard-core erlangistas say. I personally have found module hierarchy and its close ally, scoping rules a useful feature in other languages. So why not here? I don’t understand the opposition for such <a href="">a simple and non-intrusive</a> change.</p> </li> </ul> <p <em>done</em> in a <em>real-world</em> environment where <em>interactions</em> with that non-functional world is the primus motor. So why make <em>that</em> painful?</p> <p>Erlang is a functional language which understands its purpose of interacting with the non-functional real world. Functional but does not try to whack you with the <em>+4 Mace of Lambda the Pure</em> every time you interact with the world.</p> <hr /> <p>Interestingly I see a pattern in my choice of programming languages. The languages I use the most have the following traits:</p> <ul> <li>Good package management with a centralized package directory.</li> <li>Ability to write quick one-off programs easily (scripting).</li> <li>…</li> </ul> <p>I could add “nice syntax” etc., but that’s beside the point. I don’t do non-nice languages. I want to retain my sanity. (So goodbye the lucrative MUMPS jobs there.)</p> <p>In a world where you <strong>do not</strong> write your own JSON parser, networking library, UI framework, HTTP request processor etc. etc. the ability to <strong>easily</strong> discover, pull and manage external dependencies is important. My life is too short to waste on libraries and languages which start with “to install, first … then … then” instead of <code class="highlighter-rouge">pip install thispackage</code> or even “download, unpack, <code class="highlighter-rouge">./configure && make install</code>”.</p> <p>Somehow Erlang falls short of my definition of “good package management” and “good scripting”. Not by much, but still.</p> Retiring instance types? 2014-01-13T00:00:00+00:00 <p><em>TL;DR: AWS is building an interstellar spaceship.</em></p> <p><a href="">Amazon Web Services</a> is the canonical infrastructure cloud provider. EC2 beta was announced in 2006 and started with <a href="">just one instance type</a>: m1.small.</p> <p>This day there are … a lot more instance types. From the simplified <a href="">EC2 instance type & pricing page</a> I can now count <strong>27 different instance types</strong>:!</p> <p>This profileration is due to (I believe) three drivers: customer demand, enterprise adoption and advances in hardware. <strong>This is great</strong>,.</p> <figure> <p><img src="/assets/posts/Takiyasha_the_Witch_and_the_Skeleton_Spectre.jpg" alt="Takiyasha the Witch and the Skeleton Spectre by Utagawa Kuniyoshi" /></p> <figcaption> <p><em>Death of Instances</em> by … errr, actually it’s <em>Takiyasha the Witch and the Skeleton Spectre</em> by Utagawa Kuniyoshi (Image source: <a href="">Wikimedia commons</a>)</p> </figcaption> </figure> <h2 id="hardware-generations">Hardware generations</h2> <p>But what happens to old stuff? What about the old hardware? What about m1.small which has been around for 7+ years?</p> <p>Currently the AWS instance types can be grouped to roughly three categories:</p> <ol> <li> <p><strong>Shared core instance types</strong> (t1.micro and m1.small). Here vCPUs are not dedicated to an instance, but shared between multiple instances (50% for m1.small, no information on t1.micro but I’d expect its CPU allocation to be be both smaller and dynamic).</p> </li> <li> <p><strong>Generic instances</strong>”.)</p> </li> <li> <p><strong>Hardware specified instances</strong>, e.g. instance types which are <strong>defined</strong> by particular hardware. This includes g2.2xlarge (<em>“G2 instances provide access to NVIDIA GRID GPUs (“Kepler” GK104)”</em>, from <a href="">AWS</a>) and c3 class (<em>“Each virtual CPU (vCPU) on C3 instances is a hardware hyper-thread from a 2.8 GHz Intel Xeon E5-2680v2 (Ivy Bridge) processor”</em>) among others. These also have 1 vCPU = 1 dedicated core.</p> </li> </ol> <h3 id="gpu-generation-gaps">GPU generation gaps</h3> <p?</p> <ul> <li> <p <strong>it is no longer able to increase g2.2xlarge capacity even if demand increases</strong> using GK104 alone.</p> <p>(With one caveat, see end of this section.)</p> </li> <li> <p>GK110-based machines can then be introduced as g2.4xlarge or other. Eventually, the successor to GK110 comes around and AWS faces the same situation as above.</p> <p>(It makes no sense for AWS to roll GK110 GPUs into g2.2xlarge as even the lowest-specced GK110 die has 800 CUDA cores more. Why would they give those away at the same price?)</p> </li> </ul> <p <strong>one fifth</strong> of the total available capacity. (<strong>Caveat emptor:</strong> These values are completely arbitrary, so don’t rely on them even if they would seem sensible.)</p> <p><img src="/assets/posts/gpu-hardware-generations-capacity.png" alt="Hypotethical g2 class instance capacity growth from hardware generation to next" /></p> <p><strong>Note that I’m counting instances, not CUDA cores in the above graph!</strong> Also, the choice of 4xlarge and 8xlarge is arbitrary, they could be 3xlarge and 4xlarge equally well. My point is in hardware generations, not per-instance computing horsepower.</p> <p>Assuming that in year 3 you are need some GPU horsepower, but you would be satisfied with g2.2xlarge. There are two potential outcomes:</p> <ol> <li> <p>There is spare capacity and you’ll get the g2.2xlarge on-demand instance.</p> <p.</p> <p.)</p> </li> <li> <p <strong>no capacity</strong> is available.</p> <p>This is problematic for you, of course, but it might be a publicity problem for AWS, too (“AWS unable to meet up to customer demand!” would the <strike>tabloids</strike> blogosphere scream.)</p> </li> </ol> <p.</p> <p.</p> <p>However even if they manage to keep g2.2xlarge instance demand up <strong>at some point hardware maintenance is going to exceed the marginal profit</strong>.</p> <p>So my final point is this: <strong>for instance types specified in terms of hardware, it is likely that they have a limited lifetime</strong> as that particular instance type (the hardware may live on, repurposed to serve another instance class).</p> <p>When the underlying hardware becomes unavailable and that instance type’s capacity cannot be increased anymore, its fate is set. The maximum lifetime is the useful lifetime of the hardware (about 5 years), but due to economic reasons it may be also less.</p> <h3 id="cpu-generations">CPU generations</h3> <p <a href=""><em>Exploiting hardware heterogeneity within the same instance type of amazon EC2</em></a> there are several CPU generations with <strong>different performance</strong> already deployed in AWS.</p> <p.</p> <p?</p> <p>Alternatively AWS may choose to re-define c3 to have a physical processor as <em>“Intel Xeon E5-2680 or <whatever is the next generation>”</em> and keep it running with the same caveats about hardware heterogeneity as t1/m1/m2/c1 classes.</p> <p>One more possibility is that if AWS introduced c4, what would they do with c3 capacity <em>in case its demand goes down</em>? Since the hardware is completely capable of being serving the non-hardware specific instance types (t1/m1/m2/c1) <em>it is possible</em> that AWS decides to move any machines no longer in demand into “graveyard” instance types where the specific CPU classification is not relevant.</p> <h2 id="what-lies-in-the-future">What lies in the future?</h2> <p>I have no idea how AWS plans to handle changes in hardware in the long run. Maybe they’ll keep adding new instance classes and types. Maybe they’ll re-define instance class specifications. Maybe something else happens.</p> <p>While writing this post I came up with the following insights:</p> <ul> <li> <p>m1/m2/c1 generation-to-generation performance gap keeps growing. Eventually that gap between the first and latest generation may become too large so that it will affect their users detrimentally (“What? 2x difference between execution times on same instance type?”) if left unchecked.</p> <p.</p> </li> <li> <p.</p> <p>(Apart from the anecdotal information about low c3 instance availability, which I believe will eventually be sorted out.)</p> .</p> </li> <li> <p <a href="">t1.micro’s maximum CPU performance is 2× m1.small’s</a>).</p> </li> </ul> <p>If you want my guess on which instance types will be retired first, my guess is <strong>something from c1 or m2 classes</strong>. At least unless their prices get substantially cut to make them cost-competetive with m3 and i2 classes to keep demand (and cash flow) up.</p> <h3 id="how-does-this-affect-you">How does this affect you?</h3> <p>First of all,</p> <ul> <li> .</p> </li> <li><strong>Don’t specify instance types in code.</strong> The instance type used for a particular purpose is <strong>configuration data</strong> (in launch configuration, in configuration file etc.). If c1.medium is going away then you’ll just need to grep config data and not the code (which may construct <code class="highlighter-rouge">"c1.medium"</code> as `“c1” + “.” + <newline>"medium"` which you won't find with simple grep at all). </newline> </li> <li><strong>Have a policy where production instances must be attributable.</strong> If after all configuration references have been changed but you are still seeing c1.medium instances it is super-useful that you can determine what they are for and find the group / person responsible. For this you can use tags like the built-in <code class="highlighter-rouge">Name</code> or introduce your own like <code class="highlighter-rouge">Unit</code>, <code class="highlighter-rouge">Product</code> or <code class="highlighter-rouge">Responsible</code>.</li> </ul> <p>If you are concerned about instance availability,</p> <ul> <li><strong>Do not rely on availability of an instance type.</strong> <strong>all</strong> instance types available all the time. (This applies only if you have your own instance management system, since AFAIK this is not possible with AWS auto scaling.)</li> </ul> <p>And finally. <strong>My head hurts.</strong>?)</p> <p>This is starting to feel like the cereal aisle at the grocery store. Are you going to pick up the müsli with “berries and nuts” or “berries and plenty nuts” or “fresh nuts and berries” or “nut and berry extragavanza” or just “plain” or …</p> Replay 2014-01-07T00:00:00+00:00 <div style="margin: 0 10px; width: 30%; float: right;"> <p><a href=""><img src="/assets/posts/replay-book-cover.jpg" /></a></p> </div> <p>Lately I’ve been reading a book called <a href=""><strong>Replay - The history of video games</strong></a> by <a href=""><strong>Tristan Donovan</strong></a>. As the title suggests, this is a book about the history of video and computer games up to the year it was written, 2010. But it is much, much more than just a record of games of the past!</p> <p>I’ve read quite a bit about computer, computing and gaming history and I have to say this is <strong>one of the best books</strong> in that lot. If not <strong>the best</strong> <strong>it captures the excitement</strong> of the generations of young and focused game developers over the three decades of time covered.</p> <p>small</small> effect your work can have.</p> .</p> Freezing Travis 2013-12-18T00:00:00+00:00 <p>This is just a quickie. While working on <a href="">freezr</a> I decided to take a look at <a href="">Travis CI</a>, which is a <em>“hosted continuous integration service for the open source community”</em> (as they say).</p> <p>And wow, is it easy. It is.</p> <p>In just a few lines of <code class="highlighter-rouge">.travis.yml</code> and some clickety-clackety of enabling github hooks to travis made all of new code to be automatically tested in travis. Being free of charge for open source projects just makes it doubly good!</p> <p>(Which reminds me, I’ll have to attach the OSI-approved license to freezr. It is open source, but I haven’t just gotten around to writing the boring licensing stuff…)</p> <p>There was … well. Why am I always getting a <strong>gotcha</strong> moment? Am I just somehow abnormally suspectible to finding corner cases?</p> <p>Anyway, here’s the <code class="highlighter-rouge">.travis.yml</code> file:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="s">language</span><span class="pi">:</span> <span class="s">python</span> <span class="s">python</span><span class="pi">:</span> <span class="pi">-</span> <span class="s2">"</span><span class="s">2.7"</span> <span class="s">env</span><span class="pi">:</span> <span class="s">global</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">PATH=$PATH:$TRAVIS_BUILD_DIR/node_modules/.bin</span> <span class="s">install</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">npm install less coffee-script</span> <span class="pi">-</span> <span class="s">pip install .</span> <span class="s">services</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">rabbitmq</span> <span class="s">script</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">make actual-test</span> </code></pre> </div> <p>The gotcha is getting node’s local install bin directory into <code class="highlighter-rouge">PATH</code> environmental variable. Travis by default <strong>does have</strong> <code class="highlighter-rouge">./node_modules/.bin</code> in <code class="highlighter-rouge">PATH</code> so <strong>unless</strong> you change the current working directory you have no problems in running npm-installed programs.</p> <p>(Of course <em>I did change the working directory</em> during tests.)</p> <p>So if you do <code class="highlighter-rouge">npm install</code> in Travis, keep in mind that <strong>by default the non-global NPM install bin directory is not necessarily found via <code class="highlighter-rouge">PATH</code></strong>. That it works by default is a happy coincidence, not a guarantee.</p> <p>(I could do <code class="highlighter-rouge">sudo npm install -g</code>, but I try to avoid changing global system state unless absolutely necessary.)</p> Ember - (A)bort, (R)etry, (F)ail? R 2013-12-11T00:00:00+00:00 <p><a href="/2013/12/04/rest-mess">Earlier</a> I wrote about problems I had while trying to develop an <a href="">Ember.js</a> application with a <a href="">Django REST framework</a>-based backend. I did some research (I’ll get back to other results from that later) and tried using <a href="">AngularJS</a> for browser-side development, but it didn’t work out too well. I checked some other client-side frameworks but I really, really wanted to have a good model representation in the browser side code including relations between models and I couldn’t find one that felt right.</p> <p>Eventually I decided to give it another go with Ember. I had an earlier semi-static UI mock that I extended using Ember and static fixtures. Which despite the steep learning curve eventually worked</p> <strike>great</strike> <p>well enough.</p> <p>Though I could not postpone the dealing with the backend indefinitely.</p> <p>I decided to ditch <code class="highlighter-rouge">ember-data-django-rest-adapter</code> <em>even</em> when it is by name supposed to work with it. Doh.</p> <p>This is an after-the-fact reconstruction from memory on how I progressed:</p> <ol> <li> <p>Attach a custom adapter based on <code class="highlighter-rouge">DS.JSONAdapter</code> (e.g. set application’s <code class="highlighter-rouge">ApplicationAdapter</code> value ).</p> </li> <li> <p>Try to understand what an adapter does and what a serializer does.</p> </li> <li> <p>Create a custom serializer. Wonder why some of the methods don’t get called. Realize that should have used <code class="highlighter-rouge">REST*</code> base classes.</p> </li> <li> <p>Change adapter and serializer to back from <code class="highlighter-rouge">DS.RESTAdapter</code> and <code class="highlighter-rouge">DS.RESTSerializer</code> correspondigly.</p> </li> <li> <p>Hack hack hack …</p> </li> </ol> <p>Eventually I got an adapter and a serializer with only a small number of minor changes compared to the original <code class="highlighter-rouge">DS.REST*</code> versions:</p> <ul> <li> <p>Custom <code class="highlighter-rouge">extractSingle</code> and <code class="highlighter-rouge">extractArray</code> methods (which are called indirectly by <code class="highlighter-rouge">DS.RESTAdapter.extract</code>) that don’t look for subkeys, but use the payload value directly (as a direct value map, or an array of value maps, e.g. <code class="highlighter-rouge">[...]</code> vs. <code class="highlighter-rouge"><span class="p">{</span><span class="nt">"objects"</span><span class="p">:[</span><span class="err">...</span><span class="p">]}</span></code>).</p> </li> <li> <p><code class="highlighter-rouge">keyForAttribute</code> and <code class="highlighter-rouge">keyForRelationship</code> which turn Ember Data convention camelcase field names into underscored JSON data keys (from <code class="highlighter-rouge">instanceId</code> to <code class="highlighter-rouge">instance_id</code>).</p> </li> <li> <p><code class="highlighter-rouge">pathForType</code> that doesn’t do pluralization of resource name (e.g. <code class="highlighter-rouge">project</code> resource list is at <code class="highlighter-rouge">/project</code> and individual resource at <code class="highlighter-rouge">/project/1</code>).</p> <p>(I still have to find a way to include the trailing slash in requests, Ember Data seems to be stripping them away, what causes extra redirects with Django REST framework. Or just specify <a href=""><code class="highlighter-rouge">trailing_slash=False</code></a> for the API router.)</p> </li> </ul> <p>And that’s it. Total size is about 20 LOC. I’m pretty surprised about that the minimal changes needed over <code class="highlighter-rouge">DS.REST*</code> classes. What I <strong>have not</strong> done is saving models to the backend — the code might be missing functionality to make that possible.</p> <p>You can check the code out yourself at <a href="">github</a>. At the moment the client-side UI code is in <a href=""><code class="highlighter-rouge">freezr/ui/static/freezr_ui/coffeescript</code></a> directory.</p> <p>P.S. I had one major gotcha while doing this. I’ve documented that one in an another <a href="/2013/12/11/gotcha-beware-of-bidir-traffic">blog post</a>.</p> Gotcha! 2013-12-11T00:00:00+00:00 <blockquote> <p>(Note: The code examples below use <a href="">coffeescript</a> instead of plain javascript. If you don’t know coffeescript here’s a quick cheat sheet: <code class="highlighter-rouge">@foo</code> ≅ <code class="highlighter-rouge">this.foo</code> and <code class="highlighter-rouge">() -> stmt</code> ≅ <code class="highlighter-rouge">function () { stmt }</code>. Additionally text in curly braces <code class="highlighter-rouge"><span class="p">{</span><span class="err">{…</span><span class="p">}</span><span class="err">}</span></code> is Ember’s <a href="">templating language</a>.)</p> </blockquote> <figure> <p><img style="width: 45%;" alt="Finnish road sign #122" src="" /></p> <figcaption> <p>Finnish road sign number 122, “Two-way traffic”. (Source: <a href="">Wikimedia Commons</a>)</p> </figcaption> </figure> <p>While <a href="/2013/12/11/retry-on-ember">doing a retry on Ember</a> for freezr user interface, I hit a problem I’d like to share with you. I didn’t find help on the internet on this so I hope if someone hits the same problem this post will help.</p> <p>Anyway, I hit one major gotcha that had me scratching my head for a long time. I had used <a href="">ember-time</a> as a basis on how to implement a “since state change” time display. Converting the original code to coffeescript was straightforward (but see <a href="#update">below</a> for an update):</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nx">App</span><span class="p">.</span><span class="na">FromNowView</span> <span class="o">=</span> <span class="nx">Ember</span><span class="p">.</span><span class="na">View</span><span class="p">.</span><span class="na">extend</span> <span class="na">nextTick</span><span class="o">:</span> <span class="no">null</span> <span class="na">tagName</span><span class="o">:</span> <span class="s">'time'</span> <span class="na">template</span><span class="o">:</span> <span class="nx">Ember</span><span class="p">.</span><span class="na">Handlebars</span><span class="p">.</span><span class="na">compile</span> <span class="s">'{{view.output}}'</span> <span class="na">output</span><span class="o">:</span> <span class="p">(()</span> <span class="o">-></span> <span class="p">(</span><span class="nx">moment</span> <span class="vi">@</span><span class="na">get</span><span class="p">(</span><span class="s">'value'</span><span class="p">)).</span><span class="na">fromNow</span><span class="p">(</span><span class="no">true</span><span class="p">)).</span><span class="na">property</span><span class="p">(</span><span class="s">'value'</span><span class="p">)</span> ">'value'</span><span class="p">)</span> <span class="vi">@</span><span class="na">tick</span><span class="p">()),</span> <span class="mi">1000</span> <span class="na">willDestroyElement</span><span class="o">:</span> <span class="p">()</span> <span class="o">-></span> <span class="nx">Ember</span><span class="p">.</span><span class="na">run</span><span class="p">.</span><span class="na">cancel</span> <span class="vi">@</span><span class="na">nextTick</span> <span class="na">didInsertElement</span><span class="o">:</span> <span class="p">()</span> <span class="o">-></span> <span class="vi">@</span><span class="na">tick</span><span class="p">()</span> </code></pre> </div> <p>and it was used like this:</p> <div class="highlighter-rouge"><pre class="highlight"><code>{{view "App.FromNowView" valueBinding="stateUpdated"}} </code></pre> </div> <p>Which worked great when the page was first loaded but <strong>it failed to update the time view after updates</strong>. I was really really confused. The <code class="highlighter-rouge">state</code> value was itself updated in the rendered view correctly immediately after <code class="highlighter-rouge">Project.reload()</code> finished, but text derived from <code class="highlighter-rouge">stateUpdated</code> field was not. <strong>WTF??</strong> This is what was happening in the browser:</p> <p><img src="/assets/posts/ember-binding-problem-problem-visual.png" alt="How it looked" /></p> <p>Top row is what happened in the UI and the bottom ones showing what the server actually sent to the client on state change from running to freezing to frozen states. Why is it stuck on “for 4 hours”?</p> <p>Time to debug. So,</p> <ul> <li> <p>I checked the JSON response. Yep, it had the correct, updated value.</p> </li> <li> <p>I wondered whether the name was somehow conflicting (it was originally <code class="highlighter-rouge">stateChanged</code>), so I renamed the JSON field and model field. No effect.</p> </li> <li> <p <em>updated</em> value was being passed correctly along, yet still refusing to show up in the actual web page.</p> </li> <li> <p>I wondered whether the date attribute type was doing something fishy and switched to string instead. No effect, the “bad” value persisted.</p> </li> <li> <p>I searched the net high and low to no avail.</p> </li> </ul> <p>I started to do voodoo coding. Poking at things and hoping the problem is mysteriously fixed.</p> <p>Finally I added logging to <code class="highlighter-rouge">DS.attr</code>’s use of <code class="highlighter-rouge">Ember.computed</code> and …</p> <div style="font-size: 300%; margin: 1em 0;"> <p>… all was made clear to me.</p> </div> <p>All of the <em>other fields</em> were getting the value from <code class="highlighter-rouge">@_data</code> element (which contained the updated values set by <code class="highlighter-rouge">DS.Model.setupData</code>) <em>except</em> — <strong>except</strong> for <code class="highlighter-rouge">stateUpdated</code> which got its value from <code class="highlighter-rouge">@_attributes</code>!</p> <p>At this moment I remembered what I earlier read about <a href="">Ember bindings</a>. And that there was a difference between <em>normal bindings</em> and <em>one-way bindings</em>. And that the <code class="highlighter-rouge">App.FromNowView.value</code> to <code class="highlighter-rouge">Project.stateUpdated</code>. And that this was a normal e.g. <em>two-way binding</em> meaning that updates on <code class="highlighter-rouge">Project.stateUpdated</code> are propagated to <code class="highlighter-rouge">App.FromNowView.value</code> <strong>and vice versa</strong>.</p> <p>I was not getting the updated value from JSON response because <strong>I had already overwritten it myself</strong>.</p> <p>This is the offending line:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="vi">@</span><span class="na">notifyPropertyChange</span><span class="p">(</span><span class="s">'value'</span><span class="p">)</span> </code></pre> </div> <p>This doesn’t actually change the value of <code class="highlighter-rouge">value</code>, but Ember doesn’t know that so it propagates the event to the bound field of <code class="highlighter-rouge">Project.stateUpdated</code>, which eventually results in <code class="highlighter-rouge">Project.set('stateUpdated', «value»)</code> where the new value was actually the old value. I’ll try to put this into a picture.</p> <p>In the figure below I’ve used <span style="color: white; background: green;">green</span> for events initiated by Ember Data and <span style="color: white; background: red;">red</span> for those initiated by <code class="highlighter-rouge">App.FromNowView</code> and the gray arrows show bindings between different Ember-controlled values. I refer to objects by their class names, so <code class="highlighter-rouge">Project.stateUpdated</code> below is <em>not</em> a class field but a field in an instance of <code class="highlighter-rouge">Project</code> class.</p> <p><img src="/assets/posts/ember-binding-problem-explanation-1.svg" alt="How it worked incorrectly" /></p> <p>In the template the statement <code class="highlighter-rouge">App.FromNowView.value</code> to <code class="highlighter-rouge">App.FromNowView.output</code> is a one-way binding and comes from the use of <code class="highlighter-rouge">property('value')</code> on the <code class="highlighter-rouge">output</code> function (right column). Finally the <code class="highlighter-rouge">App.FromNowView.output</code> binding to <code class="highlighter-rouge"><span class="p">{</span><span class="err">{view.output</span><span class="p">}</span><span class="err">}</span></code> comes from somewhere deep inside the templating system (bottom row).</p> <p>The initial value is loaded by Ember Data and is propagated from top left corner by the green arrows. First, <code class="highlighter-rouge">Project.stateUpdated</code> is changed, which then propagates to <code class="highlighter-rouge">App.FromNowView.value</code>, which in turn causes the value of <code class="highlighter-rouge">App.FromNowView.output</code> to change, which finally causes the <code class="highlighter-rouge"><span class="p">{</span><span class="err">{view.output</span><span class="p">}</span><span class="err">}</span></code> template to be (re-)rendered. This will in turn cause the <code class="highlighter-rouge">get</code> chain to propagate back in the chain, finally resulting in the nicely formatted time delta value to be written into the HTML page for user to see.</p> <p>This is where the call to <code class="highlighter-rouge">tick</code> messes things up. It will be called every second, and it will call <code class="highlighter-rouge">notifyPropertyChange('value')</code> which in turn causes <strong>two</strong> propagations to occur — one back to the <strong>original</strong> <code class="highlighter-rouge">Project.stateUpdated</code> value thus <strong>overwriting it</strong>, and the other to propagate to the output template. This meant that the output value was correctly updated as time passed, but any change in the actual <code class="highlighter-rouge">stateUpdated</code> value as reported by the backend was <strong>not</strong> reflected in the human-readable output.</p> <p><small>(I’m not sure, but I think Ember’s idea is that since I’ve overwritten the values myself it will keep them around until I call either <code class="highlighter-rouge">save</code> or <code class="highlighter-rouge">rollback</code>. I’m not sure whether it is sensible to call <code class="highlighter-rouge">reload</code> at all when you have uncommited changes in the model.)</small></p> <p>Now that I had understood the true problem the solution came immediately. In the application I just wanted to ensure that updates on the bound value are propagated to <code class="highlighter-rouge">App.FromNowView.output</code>, which was already automatically updating when the bound value was changed. It also has to be refreshed as time progresses (“a few seconds” → “a minute”) which <em>does not</em> need to refresh the bound value, just the <em>output value</em>. The correct update sequence where <em>display updates</em> do not affect the actual state update time value is shown in the picture below:</p> <p><img src="/assets/posts/ember-binding-problem-explanation-2.svg" alt="How it works correctly" /></p> <p>Now <code class="highlighter-rouge">tick</code> will only cause the <strong>rendered</strong> value to be updated while all changes in the original model are <strong>also</strong> honored. The change is trivially simple with changing the property change event fired on the <em>output</em> element:</p> <div class="highlighter-rouge"><pre class="highlight"><code>">'output'</span><span class="p">)</span> <span class="vi">@</span><span class="na">tick</span><span class="p">()),</span> <span class="mi">1000</span> </code></pre> </div> <p>With this simple change everything was finally made good!</p> <p>So what’s the lesson learned? When using Ember, <em>you need to understand how a value is bound, to where, and what type of binding makes sense for any particular situation</em>. Also don’t use <code class="highlighter-rouge">@notifyPropertyChange</code> indiscriminantly on values that are bound <em>from outside the caller’s control</em>.</p> <p><a name="update"></a><strong>Update:</strong> Ember-time itself has since been fixed. You’ll need to look at <a href="">bf3383c6</a> or earlier commit to see the original version.</p> Idempotent PUT is a fake 2013-12-05T00:00:00+00:00 <p>Previously I poured my thoughts on <a href="/2013/12/04/rest-mess">REST/JSON protocol differences</a>. I am still researching on how different server and client frameworks work, but as an interlude I’ll comment on the interpretation of the <code class="highlighter-rouge">PUT</code> operation in relation to its use on “RESTful” APIs.</p> <p>I’ve seen a lot of people state that <code class="highlighter-rouge">PUT /resource/<id></code> should create the resource if it does not exist. Like <a href="">here</a>, <a href="">here</a> and <a href="">here</a> and <a href="">here</a> and and.</p> <p>This is absolutely <strong>wrong</strong>. This is a misinterpretation of <em>idempotency</em>. Following this logic to the extreme causes both <em>semantic</em> and <em>practical</em> problems.</p> <h3 id="a-nameidempotencyaidempotency"><a name="idempotency"></a>Idempotency</h3> <p>I am making a strong statement here regarding PUT semantics here, so let me first introduce you to the idea of idempotency. I’ll quote from the <a href="">wikipedia entry on idempotence</a>:</p> <blockquote> <p.</p> </blockquote> <p>And here is a small light switch system which has both idempotent and non-idempotent functions:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="p">(</span><span class="k">define</span> <span class="nv">lights-state</span> <span class="no">#f</span><span class="p">)</span> <span class="p">(</span><span class="k">define</span> <span class="p">(</span><span class="nf">lights</span><span class="p">)</span> <span class="nv">lights-state</span><span class="p">)</span> <span class="p">(</span><span class="k">define</span> <span class="p">(</span><span class="nf">lights!</span> <span class="nv">on-or-off</span><span class="p">)</span> <span class="o">...</span><span class="p">)</span> <span class="c1">; sets lights on or off</span> <span class="p">(</span><span class="k">define</span> <span class="p">(</span><span class="nf">lights-toggle!</span><span class="p">)</span> <span class="p">(</span><span class="nf">lights!</span> <span class="p">(</span><span class="nb">not</span> <span class="p">(</span><span class="nf">lights</span><span class="p">))))</span> </code></pre> </div> <p>If you repeatedly call <code class="highlighter-rouge">lights</code>, you’ll get the same value every time. The getter is both safe (no side effects) and idempotent (returns same value on repeated calls). Similarly <code class="highlighter-rouge">lights!</code> is <em>not</em> safe (it has a world-changing side effect) but is idempotent:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nv">></span> <span class="p">(</span><span class="nf">lights!</span> <span class="no">#t</span><span class="p">)</span> <span class="p">(</span><span class="nf">lights</span><span class="p">)</span> <span class="nv">></span> <span class="no">#t</span> <span class="nv">></span> <span class="p">(</span><span class="nf">lights!</span> <span class="no">#t</span><span class="p">)</span> <span class="p">(</span><span class="nf">lights</span><span class="p">)</span> <span class="nv">></span> <span class="no">#t</span> </code></pre> </div> <p>(<code class="highlighter-rouge">lights-toggle!</code>, of course, is not idempotent.)</p> <p>Now you are asking me what’s in the <code class="highlighter-rouge">lights!</code> function I didn’t show you earlier. I’ll show you now:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="p">(</span><span class="k">define</span> <span class="p">(</span><span class="nf">lights!</span> <span class="nv">on-or-off</span><span class="p">)</span> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="k">and</span> <span class="p">(</span><span class="nb">boolean?</span> <span class="nv">lights-state</span><span class="p">)</span> <span class="p">(</span><span class="nb">boolean?</span> <span class="nv">on-or-off</span><span class="p">))</span> <span class="p">(</span><span class="k">set!</span> <span class="nv">lights-state</span> <span class="nv">on-or-off</span><span class="p">))</span> <span class="nv">lights-state</span><span class="p">)</span> </code></pre> </div> <p>This is an idempotent function. As long as <code class="highlighter-rouge">lights-state</code> stays boolean (guaranteed if only <code class="highlighter-rouge">lights!</code> or <code class="highlighter-rouge">toggle-lights!</code> are used to change light state) it will change the value of <code class="highlighter-rouge">lights-state</code> to match the request.</p> <p>Now the surprising bit. If <code class="highlighter-rouge">lights-state</code> is not a boolean value, <code class="highlighter-rouge">lights-state</code> is <em>still</em> an idempotent function and <code class="highlighter-rouge">lights</code> and <code class="highlighter-rouge">lights!</code> are too!</p> <p>Now consider a multi-user system (aka real world) where this happens:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nv">Me></span> <span class="p">(</span><span class="nf">lights!</span> <span class="no">#t</span><span class="p">)</span> <span class="nv">=></span> <span class="no">#t</span> <span class="nv">Elsie></span> <span class="p">(</span><span class="k">set!</span> <span class="nv">lights-state</span> <span class="ss">'explode</span><span class="p">)</span> <span class="nv">Me></span> <span class="p">(</span><span class="nf">lights!</span> <span class="no">#t</span><span class="p">)</span> <span class="c1">; just making sure</span> <span class="nv">=></span> <span class="ss">'explode</span> </code></pre> </div> <p>Boom! What happened? Wasn’t <code class="highlighter-rouge">lights!</code> supposed to be idempotent? Yes, and it still is. But wait, <strong>I thought that idempotency means that any idempotent operation should work the same if repeated later!</strong></p> <p><blink><huge>Nope.</huge></blink></p> <p>Let’s go back to wikipedia entry and scroll a bit down:</p> <blockquote> <p>A composition of idempotent methods or subroutines, however, is not necessarily idempotent if a later method in the sequence changes a value that an earlier method depends on – idempotence is not closed under composition.</p> </blockquote> <p><em>“Not closed under composition”</em>. <em>updated system state</em> will result in the same final result as calling with the <em>unaltered</em> system state.</p> <p>What it does <strong>not guarantee</strong> is that if you call with <strong>some other</strong> system state you would get the same results. If <strong>anyone else</strong> has changed the system state between <strong>your</strong> calls to the idempotent routine, then the system state <strong>has changed</strong> and there are <strong>no guarantees</strong> that the result from your call will be the same. This is exactly what happened, Elsie changed the system state, so even though the <code class="highlighter-rouge">lights</code> and <code class="highlighter-rouge">lights!</code> functions are still idempotent, <em>my</em> operations from <em>my</em> viewpoint are <em>not</em> since the two calls were composed differently.</p> <p>At this point you should realize that when standards talk about <a href="">idempotency</a> or behavior of repeated <a href="">PUTs</a> they are <em>not</em> guaranteeing you that all your PUTs will give the same response or have the same effect in the system every time under all conditions. What the operation idempotency guarantee can give you is that when the composition of your PUT has <em>not changed</em> (apart from the changes the <em>original</em> PUT made), subsequent PUTs should give you the same result. But only when that assumption holds, otherwise we <em>are not talking about idempotency at all</em>.</p> <h3 id="put-doesnt-have-to-create-resources">PUT doesn’t have to create resources</h3> <p>The normal life cycle of any object, entity or resource within computer systems is:</p> <ol> <li>It does not exist.</li> <li>It is created.</li> <li>Stuff happens to it.</li> <li>It is destroyed.</li> <li>It is no more.</li> </ol> <p>Interpretation of <code class="highlighter-rouge">POST</code> and <code class="highlighter-rouge">DELETE</code> operations are straightforward if you think of them as steps #2 and #4 respectively. They manage the life cycle of the resource. The resource exists between creation and destruction, and otherwise exists not.</p> <p>If we take the viewpoint that these are the <strong>only</strong> operations to manage a resource’s lifecycle — and I urge you to take this viewpoint too — then <strong><code class="highlighter-rouge">PUT</code> is valid only during step #3</strong>.</p> <p>That is, <code class="highlighter-rouge">PUT</code> <strong>should not</strong> create a resource.</p> <p>Now I can already hear an argument in the line of “but using PUT to create new resources <em>is</em> <strong>life cycle operation</strong> because it <strong>can be</strong> one while staying idempotent. We can define that PUT is <strong>not a life cycle operation</strong> and it still stays an idempotent operation (PUT on non-existent resource would result in the same result both times – a failure).</p> <p>At this point it should be clear that saying that “PUT should create resources because of idempotency” is a false argument because idempotency holds even if this is not the case.</p> <p>Which way PUT swings is a design choice. A choice.</p> <p>I want to convince you that it should <strong>not</strong> create resources.</p> <p><small>(Ed: Changed “strawman argument” to “false argument” above. Thanks Frederic for pointing out the semantic difference!)</small></p> <h3 id="puts-on-deleted-resources">PUTs on DELETEd resources</h3> <p>Now I’ll try to convince you why <code class="highlighter-rouge">PUT</code> as a life cycle operation is not a good idea from developer’s perspective because it just causes practical implementation problems (and if you are not aware of these, it can create hidden semantic traps in your system).</p> <p>This is a real-world case (simplified though):</p> <ol> <li>User 1 creates a message (POST).</li> <li>User 1 edits the message (GET, PUT).</li> <li>User 2 sees the message and decides to open it for editing (GET).</li> <li>User 1 decides the message is crap and removes it (GET, DELETE).</li> <li>User 2 updates the message (PUT).</li> </ol> <p>If you allow <code class="highlighter-rouge">PUT</code> to implicitly create non-existent resources, you get what I’d call <em>semantically inconsistent result</em>. For users, the message exists when it should not. This is entirely consistent from system’s point of view, since the message created at step #5 is not the same message that was deleted at #3.</p> <p>Unfortunately most of the systems that are written are meant for <em>human</em> consumption and need to work with <em>human expectations</em>. Thus in this case the implicit <code class="highlighter-rouge">PUT</code> most definitely was <em>definitely not helping</em> system development at all.</p> <p>Oh no, wait! Here’s another!</p> <ol> <li>User 1 has CREATE permission on messages.</li> <li>User 2 has EDIT permission on messages.</li> <li>User 3 has REMOVE permission on messages.</li> </ol> <p>I think you can already guess where this is going. If there’s implicit create on PUT I have to check for CREATE permission in two different places, both <code class="highlighter-rouge">POST</code> and <code class="highlighter-rouge">PUT</code>. (This is another real-world scenario where some people can CREATE and EDIT, others can only EDIT and some DELETE <strong>but not</strong> create or edit. Auditability requirements…)</p> <h3 id="what-then-is-put">What then is PUT?</h3> <p>Simple:</p> <ul> <li>It is <em>idempotent</em>. (See <a href="#idempotency">above</a> on limits.)</li> <li>It operates on <em>existing</em> resources.</li> <li>It is <strong>not a life cycle operation</strong>. It cannot create or destroy resources.</li> </ul> <p>Idempotent <code class="highlighter-rouge">PUT</code> still stays the very same and very powerful and useful feature as before as it allows you to just repeat the request in case of transient network or server failures. Just please don’t think <code class="highlighter-rouge">PUT</code> as a life cycle management operation, because it should not be.</p> REST MESS 2013-12-04T00:00:00+00:00 <p>While working on a hobby project called <a href="">freezr</a> I came across a few assumptions I had made which turned out to be <em>wrong</em>. I’m going to write a bit about these assumptions, since I found solving the resulting problems very frustrating.</p> <p>I had decided to write freezr API-first instead of UI-first. The reason for this decision was based on that</p> <ul> <li> <p>I had a very good understanding of the problem and what kind of actions it offered to the user, so there was no need to research the problem through UI prototypes etc. (<em>If you do not have a good understanding of the problem, you should <strong>always</strong> start with UI mockups and prototypes.</em>)</p> </li> <li> <p.</p> </li> <li> <p>I am <em>not</em>.</p> </li> </ul> <p.</p> <p>I wrote the server using <a href="">Django</a>. I had a few reasons to pick up Django, one of them being familiarity with it. That’s familiarity, <em>not liking</em>..</p> <p><small>(As a side note: I don’t like node.js, so I’m not going to use Meteor or its ilk. I find it frustrating to write in a language that has practically zero thought given towards developer friendliness, <a href="">orthogonality or understandable error and exception handling</a>. If I could decide, I’d replace JavaScript with a standardised <em>and well designed</em> bytecode interpreter where browsers would provide a JavaScript-to-bytecode compiler shim for backwards compability. It could even use <a href="">LVVM</a> representation directly. This would give it much better re-targetability from other languages.)</small></p> <p>Anyway, I ended up using Django with the <a href="">Django REST framework</a>. I have worked with TastyPie and found it <em>superlatively frustrating experience</em>.)</p> <p>So I wrote a REST interface using REST framework. I think it ended up nice and orthogonal. I especially liked the way how the framework made it easy to provide URIs for resource references. Like this (edited for brevity):</p> <blockquote> <pre><small>": "" } </small></pre> </blockquote> <p>Using URIs for resource references makes the whole API <em>theoretically</em> to have a very nice property: as long as the “root” point is known, it is possible to find all resources in the system without any need of the resource URL syntax. The interface itself will tell you that instance 15 is located at <code class="highlighter-rouge"></code> without you having to know <em>anything</em> about the URL structure. For all you care, you could have instance 15 in a completely different URL from other instances like <code class="highlighter-rouge"></code>. You, as a web browser application programmer would <em>not</em> have to do anything to support distributed resources!</p> <p>I just <em>love</em>).</p> <p>Hooray. Time to go do some UI development.</p> <p>For the UI side I decided to try out <a href="">Ember.js</a>. I knew its data layer wasn’t yet final, but I thought, what the heck, I’m doing pretty simple REST API here, that shouldn’t be a problem.</p> <p>It was.</p> <p>This is <em>not</em> Ember’s fault in itself. It is just that Ember’s REST interface is designed to work with a <em>particular</em> flavor of REST interfaces. The REST API that <em>I</em> had defined <em>did not</em> conform to this model. I searched the net for a solution, and found <a href="">ember-data-django-rest-adapter</a> <tt><strike>Hyperlinked</strike>ModelSerializer</tt> to get IDs instead. And it wanted to pluralize resources in URIs, e.g. <em>a</em> project was fetched from <code class="highlighter-rouge">/api/project/ID/</code> but list of projects from <code class="highlighter-rouge">/api/projects</code>. Oh god. Then I found it actually was expecting <code class="highlighter-rouge">hasMany</code> relations as <code class="highlighter-rouge">[{"id":1},{"id":2}]</code> and not just <code class="highlighter-rouge">[1,2]</code>.</p> <p>No, I’m not going down that rabbit hole.</p> <blockquote> <p>If there is competition for most stupid convention ever, I’d nominate the idea that <em>computers</em> are required to <em>pluralize human words</em> when using a <em>computer-oriented API</em> to distinguish between fetching <em>a</em> resource versus <em>many</em> resources. Quick, what’s the plural of <strong>“locus”</strong>? What if your API describes shoe pairs (e.g. shoes), is the resource point for fetching records of many shoes then “shoess”?</p> </blockquote> <p><em>Frustration and amazement.</em></p> <p>I came to realize that:</p> <ul> <li> ).</p> </li> <li> <p>There is no universal “way of doing REST”. <em>I though</em> I understood this, but I had just thought the disperancies were in resource access and action definitions, not so much in how the resources are serialized and deserialized to/from JSON format.</p> <p><small>(Example of different action definitions: In freezr, a project is frozen with a POST to <code class="highlighter-rouge">/api/project/1/freeze/</code>. Another and entirely valid choice would have been to apply PATCH to <code class="highlighter-rouge">/api/project/1/</code> with content of <code class="highlighter-rouge"><span class="p">{</span><span class="w"> </span><span class="err">'state':</span><span class="w"> </span><span class="err">'freezing'</span><span class="w"> </span><span class="p">}</span></code>, where instead of defining an action, the request would declare the desired state.)</small></p> <p>In reality there are many ways to do these, and <em>most frameworks are designed to work only with one particular REST protocol</em> without thought given to reconfigurability for different use cases. (The configuration of REST adapters mostly concerns with endpoint URL and what combinations of operations is used for different idioms like is partial change PUT or PATCH, can you POST over an existing record?)</p> </li> <li> <p>I don’t know jack shit.</p> </li> </ul> <p>To fix the last problem I’m going to do some research on different REST interface patterns and which server- and client-side frameworks use then, and write a follow-up blog post on what I find out.</p> Working on freezr 2013-11-29T00:00:00+00:00 <p>Just a quick post — I’m working now on something I call <em>freezr</em>. <a href="">GitHub</a>.</p> My old flame ... from 17 years past 2013-11-03T00:00:00+00:00 <p>Before I get about talking old stuff, here’s a few <strong>important</strong> suggestions for anyone who came here looking for my old MD5 Java implementation (in case you don’t know, MD5 is a <a href="">cryptographic hash function</a>):</p> <ul> <li> <p>Firstly, <strong>do not use it.</strong> There are plenty of good alternatives starting from Java’s standard library’s <a href=""><code class="highlighter-rouge">java.security.MessageDigest</code></a> up to separate open-source implementations such as <a href=""><code class="highlighter-rouge">org.bouncycastle.crypto.digests.MD5Digest</code></a>.</p> </li> <li> <p>Secondly, <strong>do not use MD5 at all.</strong> MD5 has not been considered secure enough for new applications for over a decade now. Use SHA256 or better instead. It’s of course another issue if you’re working with legacy protocols, but for any <strong>new</strong> implementation you just <strong>do not use MD5</strong>.</p> </li> <li> <p>Thirdly, if you are planning to do what seems to be every new web site programmers thing, that is, when you’ve come to realize that storing plaintext passwords is <strong>bad</strong> and have come up with the idea of storing passwords as hashes, and were thinking of using MD5 for that — and of course now you’d be thinking of SHA256 instead — <strong>do not use a cryptographic hash function for password hashing</strong>. Use a hash function <em>specifically designed for long-term secure password hash storage</em> such as <a href="">PBKDF2</a>. Just don’t use a plain hash function for password hashing. Trust me.</p> </li> <li> <p>And of course if all of the above is new news for you, <strong>please please please</strong> get some education. I <strong>pathologically hate closet cryptographers</strong> e.g. people who think they know everything about cryptography since they’ve finally succeeded in breaking out of a wet paper bag.</p> </li> </ul> <p>The reason for this post is that I still keep getting e-mails for support and questions about an MD5 Java implementation I wrote a <em>looooooong</em> time ago (1996). It is so long time ago that in a few years people starting their professional programming careers will be <em>younger</em> than that piece of code.</p> <p>(Oh boy, am I old.)</p> <p <em>and relevant</em> to only a very narrow set of programming problems, which <em>yours most likely is not one of them</em>.</p> <p>I don’t even have the source online anymore. I find keeping it online pointless for the reasons listed above. If you are super-interested in the source, just search for <a href=""><code class="highlighter-rouge">md5 paavolainen</code></a>, although a lot of the hits are actually derived (mostly better!) implementations.</p> <p>Why did I write an MD5 Java implementation in the first place?</p> <p><small>(Imagine the following spoken with a hoarse, oldtimer voice, worn rough by the dust inhaled by years in solitude service among racks and racks of ancient servers.)</small></p> <p>Well, this happened in 1996 when Java was still at version 1.0.2 and did not have <code class="highlighter-rouge">java.security</code>…)</p> <p><small>(Back to normal voice.)</small></p> <p><br /></p> <p <em>should not be used anymore</em>. Move along, don’t dwell in the cryptographic past.</p> <p>P.P.S. I’ll be more positive on the next post, I promise.</p> Life's easier if you can code 2013-10-28T00:00:00+00:00 <p?</p> <p>Oh I just wish even just the second to last would be true, but alas, none of the above.</p> <p>Being a programmer does not make you fitter (strangely often the opposite), nor stronger. But it does help quite a lot in many things. It’s also possible to do some <a href="">really cool things</a> if you mix in with some physical world stuff with the programming. However that’s not the kind of “making life easier” stuff I’m really talking about.</p> <hr /> <p <em>but</em>. The <em>but</em> is there’s a length limit on the ad and I’ve got <em>tons</em> of those magazines to sell. Itemizing them goes over the length limit many times over.</p> <p>So what do I do?</p> <p>I whip up a <a href="">Python</a> script using <a href="">Genshi</a> formatting an <a href="">YAML</a> input file. The output is a bunch of text files, broken down by magazine names. Here it is, a total 9 lines of code:</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="c">#!/usr/bin/env python3</span> <span class="kn">import</span> <span class="nn">genshi.template</span><span class="o">,</span> <span class="nn">yaml</span> <span class="n">data</span> <span class="o">=</span> <span class="n">yaml</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"data.yaml"</span><span class="p">))</span> <span class="n">tmpl</span> <span class="o">=</span> <span class="n">genshi</span><span class="o">.</span><span class="n">template</span><span class="o">.</span><span class="n">NewTextTemplate</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"template.txt"</span><span class="p">))</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">for</span> <span class="n">mags</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span> <span class="n">names</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="p">[</span><span class="s">'name'</span><span class="p">],</span> <span class="n">mags</span><span class="p">))</span> <span class="n">result</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">tmpl</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">magazines</span><span class="o">=</span><span class="n">mags</span><span class="p">,</span> <span class="n">names</span><span class="o">=</span><span class="n">names</span><span class="p">))</span> <span class="k">print</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="s">'out/'</span> <span class="o">+</span> <span class="p">(</span><span class="s">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">names</span><span class="p">))</span> <span class="o">+</span> <span class="s">'.txt'</span><span class="p">,</span> <span class="s">'w'</span><span class="p">))</span> <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span> </code></pre> </div> <p>Time spent:</p> <ul> <li>Script: 10 minutes</li> <li>Writing text template: 5 minutes</li> <li>Reformatting data to YAML: 30 minutes</li> </ul> <p.)</p> <p>Eventually I had to reformat the output several times before the site grokked it. I would hate even the <em>potential</em> of having to re-do something that tedious by hand, so I’m positive about the result.</p> <hr /> <p>There is great benefit in optimizing repeated tasks (xkcd has a nice <a href="">illustration</a> about it). Here I needed the script only once, so I’m not sure whether I came out ahead time-wise, but definitely I didn’t get to experience the tedium of doing so.</p> <p>Come to think about it, the reason I did use templating was probably to <em>avoid a tedious task</em> by turning it into a <em>programming problem</em>. Writing a small script to do the task at least gave me a feeling of <em>being productive</em> even if it might not have been so.</p> <p>Ha! Maybe that’s it:</p> <blockquote> <p>Being able to write programs makes life easier by allowing you to turn (some) tedious tasks into interesting programming problems.</p> </blockquote> <p>I’m happy with that.</p> <p>P.S. So what about Excel? I do actually find spreadsheets quite useful as an miniature programming platforms when the data I’m manipulating is already in tabular form. Doing <code class="highlighter-rouge">=if($B4<>"";TRUE;FALSE)</code> and copy-pasting it over a row is often faster than writing and debugging an imperative program.</p> One viewpoint on cloud computing 2013-07-10T00:00:00+00:00 <p>Recently I was consulting a client on cloud strategy. When we were trying to explain to the client how the risk landscape with growing adoption of cloud computing (being the case that it affects them even if they don’t themselves use cloud services) … I had an idea.</p> <p>An idea that I think gives some insight why enterprises and especially IT companies were slow on cloud uptake and why small and agile startups were quick to take up on it.</p> <p>Before I get to the actual idea, I need to go through some background information first. If you’re super duper familiar with risk management in IT service procurement, feel free to skip ahead.</p> <h2 id="bloody-long-introduction">Bloody long introduction</h2> <p>So, you know what risk is? <a href="">Wikipedia</a> puts it this eloquently:</p> <div class="highlighter-rouge"><pre class="highlight"><code>risk = probability × loss </code></pre> </div> <p>That is if you have a 0.5% yearly probability event that costs you $1M, and another with 50% probability and a loss of $10,000 these are crudely equal with expected yearly losses of $5,000 for <strong>both</strong>. So you’ll take both the probability of a bad thing happening and the consequences of that thing happening <strong>together</strong> as a risk.</p> <blockquote> <p>Caveat emptor: This is only one viewpoint on risk.</p> </blockquote> <p>This view of risks comes with an attached, implicit viewpoint. It is viewed as <strong>my</strong> risk. For example, the risk to me of <strong>your</strong> house catching fire is neglible (being non-neglible only if you happen to live within 100 meters), because the <strong>loss to me</strong> of your house burning is zero → my risk is zero too.</p> <p.</p> <p>So, the risk <strong>probability</strong> can be divided into two components: <strong>mine</strong> and <strong>yours</strong>.</p> <p>The service provider may mitigate its risks by many means. It might employ quality process models and employ good quality hardware as well as cover residual risks with insurances, for example. (More cynically oriented might expect the vendor to not do so.)</p> <p>Anyway this does provide two more aspects to consider when understanding the <strong>loss</strong> component. For this discussion I’ll split it into <strong>methods</strong> and <strong>means</strong>. Processes and hardware, if you like.</p> <p>So we get to:</p> <div class="highlighter-rouge"><pre class="highlight"><code>risk coverage = (me ⇆ you) × (methods ⇆ means) </code></pre> </div> <p>Ignore the pseudo-scientific notation for a minute. What I mean here is:</p> <ul> <li> <p><code class="highlighter-rouge">(me ⇆ you)</code> </p> <p>You can push risk probability to someone else, or handle it yourself. Not surprisingly corporate and governmental organizations tend to push risks away from themselves. After all it is easier to say <em>“We had a contract with ACME Corp. to cover all bases! They fucked up!”</em> than to <em>“It was our fault.”</em> </p> <p>You can always count on people in large entities to <em>cover their asses</em> without regard to global optimum - it’s not their money, after all.</p> </li> <li> <p>Methods and means relate .. here’s an example. </p> <p>One network security risk aspect is the management of firewalls. To have good security you need to have good processes to ensure that only the minimum set of required holes are used, knowledge to understand the security model, an audit trail of changes, and so on.</p> ).</p> </li> </ul> <p>Finally we are getting close to the <strong>cloud</strong>. So bear with me.</p> <p>The “traditional” way to manage IT service risks was to let the service vendor handle the risk. The risk coverage model was a bit like below (with dashes on non-relevant things):</p> <div class="highlighter-rouge"><pre class="highlight"><code>my risk coverage = (me ⇆ ---) × (------- ⇆ -----) your risk coverage = (-- ⇆ you) × (methods ⇆ means) </code></pre> </div> <p><small>(Note: I’m not sure whether the word “coverage” is a good choice here. Can’t figure out anything better, though…)</small></p> <p>When shit then did hit the fan it was <strong>you</strong> (the vendor) that had to handle bad publicity and the resulting loss of income (sanctions, paybacks etc.). There are some risks that cannot be transferred (opportunity costs etc.), but generally my losses would be small-ish.</p> <p><small> <strong>fail</strong>, it reliably caused the other link to <strong>fail</strong> at the same time. This kind of mind-blowing cluster-fuckup cost the service vendor, but cost the bank probably quite a lot too. Small-ISH is relative.)</small></p> <p>With the introduction of <strong>cloud computing</strong> and its commodity computing model the the coverage handling of risks has changed:</p> <div class="highlighter-rouge"><pre class="highlight"><code>my risk coverage = (me ⇆ ---) × (methods ⇆ -----) your risk coverage = (-- ⇆ you) × (------- ⇆ means) </code></pre> </div> <p>Now a cloud computing provider’s job is to provide the <strong>technical</strong> services I have purchased at an agreed SLA. However the cloud vendor <strong>does not</strong> take the responsibility to ensure that I would use its services either correctly or effectively! In a cloud computing environment <strong>I must now handle processes</strong> that make effective use of the means provided by the cloud vendor.</p> <p>Going back to the firewall example with <a href="">Amazon Web Services</a>:</p> <ul> <li> <p>AWS is liable if it fails to either a) provide the firewall services (security groups, VPC network ACLs) with agreed availability or b) they have other functional problems (like passing traffic not explciitly allowed).</p> </li> <li> <p>AWS <strong>is not</strong> liable if <strong>I do “allow all from all”</strong> and someone hacks the system when I didn’t do the methods bit properly. I have to understand and implement the methods to use the means AWS provides to meet my own business goals.</p> </li> </ul> <h2 id="finally-a-point">Finally, a point</h2> <p>Out of this comes the synthesis of the great idea I referred earlier:</p> <blockquote> <p>The introduction of cloud computing doesn’t substantially change IT service risks, but it does change the distribution of these risks between the client and the service provider.</p> </blockquote> <p>What’s so <strong>bloody difficult</strong> in this for many enterprise and governmental clients is that <strong>for years they have oursourced all IT risk management processes and now they would have to learn to handle it themselves</strong> (or find someone else to do that — a market that didn’t exist when cloud computing came around).</p> <p>Alternatively said:</p> <blockquote> <p>Earlier, the negotiation of distribution of risk between clients and service providers was a business negotiation, an exchange of responsibilities and liabilities versus fees required to accept those responsibilities and liabilities.</p> </blockquote> <blockquote> <p>Cloud computing in contrast is a <strong>commodity</strong> market where the service provider tries to minimize negotiations with the clients by providing a limited set of contract options for its clients.</p> </blockquote> <h2 id="a-namestartupsaso-wtbf-about-startups"><a name="startups"></a>So WTBF about startups?</h2> <p>Well think about it.</p> <h3 id="years-ago">10 years ago</h3> <p.</p> <p.)</p> <h3 id="when-cloud-computing-comes-around">When cloud computing comes around</h3> <p>You’re a startup. You need IT service. You go to a cloud provider. They give you just one deal, the same deal everybody gets. You can’t negotiate — it’s either the cloud way, or get a TARDIS and go back 10 years (previous chapter).</p> <p>(Then they blow up. Same situation as 10 years back, minus the lawyer.)</p> <p>So …</p> <p.)</p> <p>When cloud computing came around it offered <strong>no worse</strong> risk distribution than startups ever had to handle, yet it offered <strong>new capabilities</strong> that the earlier model lacked.</p> <p>No wonder startups embraced the cloud. Even with an unknown future, the cloud was guaranteed to be <strong>no worse</strong> than what was available before.</p> <h2 id="afterword">Afterword</h2> <p>This is just one viewpoint. Making an assumption that this would be the <strong>only</strong> reason for success and fast adoption of cloud computing in startups is both wrong and retrofitting the facts to a fabricated historical narrative. Don’t fall for that. Reality is much, much more complex.</p> Enter Jekyll (where's Hyde?) 2013-07-08T00:00:00+00:00 <p>Live and learn. <a href="/2013/04/12/can-you-blog-in-github">Earlier</a> I wondered whether I could use a github repository as a place to publish a blog. Essentially my original plan was to use the plain repository view as a way to render ReST formatted pages. But it got a bit unwieldy very fast after that.</p> <ul> <li> <p>A blog needs a feed. A blog without a feed isn’t a blog, at least by my definition. So I thought about writing a short script to read the page titles from RST files and output an <code class="highlighter-rouge">.atom</code> and <code class="highlighter-rouge">.rss</code> formats (and wrote one).</p> </li> <li> <p>You still need a “master” page for random visitors so they can see what you’ve written lately. Ok, not a biggie either.</p> </li> <li> <p>And … !!!!</p> </li> </ul> <p><strong>No!</strong> I’m not going that way, <strong>again</strong>. I’ve written static website and blog generators before and I know where this path would lead me to. There has to be a better way! Surely my idea of using github as a blogging platform, surely there must be programmers who also <abbr title="Don't Repeat Yourself">DRY</abbr>.</p> <p>Of course I had seen and heard about <a href="">GitHub Pages</a> <a href="/2013/04/12/can-you-blog-in-github">what I was looking for</a> and <a href="">what’s available</a>. C’est la vie.</p> <p>Alas, github pages isn’t a complete solution to your blogging needs. It does come with <a href="">Jekyll</a> static site generator which will help a lot in creating a website by either automating a lot of the legwork or by providing ready-made abstractions for wrapping custom stuff in Liquid templates.</p> <p>I took a look at some of the <a href="">example Jekyll-generated sites</a>. Some are very pretty, and I’m impressed by the fact that sites like <a href="">Development Seed</a>.)</p> <p>“But still”, I was thinking, “do I have to write all those templates just to get a working static blog generator?”</p> <p>So, if you’re thinking about creating your blog on GitHub pages using Jekyll, here’s what I found out: <strong><a href="">Jekyll Bootstrap</a></strong>. Quickly, do this!</p> <div class="highlighter-rouge"><pre class="highlight"><code>$ sudo gem install jekyll $ git clone USERNAME.github.io $ cd USERNAME.github.io $ rake post</code>. You’ll see an example post and the one you just created before (<em>Hello World</em>). You’ll find the sample post in <code class="highlighter-rouge">_posts</code> directory. Edit it. Reload the page in browser. <strong>You can already see results!</strong></p> <p>The next step is to push your cloned repository to your own account under github — you’ll need to 1) <a href="">create the repository</a>, 2) update repository url at your checked-out Jekyll bootstrap repository and 3) push.</p> <div class="highlighter-rouge"><pre class="highlight"><code>$ git remote set-url origin git@github.com:USERNAME/USERNAME.github.io.git $ git push origin master </code></pre> </div> <p>Note that <code class="highlighter-rouge">USERNAME</code> really should be your <strong>own</strong> github username when you push. Earlier when cloning it was just a directory name, but in <code class="highlighter-rouge">set-url</code> it <strong>must</strong> match your github username. <em>You won’t see your pages in github pages</em> unless you push to <code class="highlighter-rouge"><your username>.github.io</code> repository.</p> <blockquote> <p>By the way — Jekyll bootstrap uses <code class="highlighter-rouge">USERNAME.github.com</code> in its examples, yet GitHub Pages keeps talking about <code class="highlighter-rouge">USERNAME.github.io</code> (<em>com</em> vs. <em>io</em>). Apparently there was a <a href="">renaming operation</a> moving user and project pages from github.com to github.io in April 2013. I tested that both schemes (e.g. <code class="highlighter-rouge">USERNAME.github.io</code> and <code class="highlighter-rouge">USERNAME.github.com</code> repository names) work, but accesses to the <code class="highlighter-rouge">USERNAME.github.com</code> URL will redirect you to <code class="highlighter-rouge">github.io</code> address. Note that Jekyll bootstrap instructions are likely to be updated at some point in time, so this note about the inconsistency might be obsolete by the time you read this.</p> </blockquote> <p>After you’re done pushing, wait a while and navigate to <code class="highlighter-rouge"></code>.</p> <p>P.S. You can take a look <a href="">at the repository</a> for this blog.</p> <p>P.P.S. If you want to keep your blog’s version history clean from Jekyll Bootstrap’s commit history, do <code class="highlighter-rouge">cd USERNAME.github.io; rm -rf .git; git init; git add .</code>, commit changes with <code class="highlighter-rouge">git commit -m 'Historyless clone from Jekyll Bootstrap.'</code> update origin with <code class="highlighter-rouge">git remote add origin git@github.com:USERNAME/USERNAME.github.io.git</code> and do <code class="highlighter-rouge">git push -u origin master</code>. Just <em>don’t</em> do this if you ever wish to merge updates from the original <code class="highlighter-rouge">jekyll-bootstrap</code> repository.</p> Can you blog in github? 2013-04-12T00:00:00+00:00 <p.</p> <p.</p> <p?</p> <p>So that’s what I’m now trying to check out. Could I use github itself to host a blog, with minimal maintenance and effort?</p> <p>I do see already some problems. How would you do a nice RSS feed? How would I do linking between posts easy? And of course, how would I handle comments?</p> <p>I’m not sure. I’ll find out soon enough.</p>
http://feeds.feedburner.com/random-title-working-thoughts
CC-MAIN-2017-22
refinedweb
49,105
55.74
I need to write a small exe applet to fill a hard disk for testing purposes. Does anyone have anything that does this already? OR some suggestions how I might accomplish this with just a few lines of C code. Thanks, Mike This is a discussion on Help with writing a disk filler applet within the C Programming forums, part of the General Programming Boards category; I need to write a small exe applet to fill a hard disk for testing purposes. Does anyone have anything ... I need to write a small exe applet to fill a hard disk for testing purposes. Does anyone have anything that does this already? OR some suggestions how I might accomplish this with just a few lines of C code. Thanks, Mike NEVER PET YOUR DOG WHILE IT'S ON FIRE! I dunno if that'll work, but I don't really wanna try itI dunno if that'll work, but I don't really wanna try itCode:#include <stdio.h> int main(void) { FILE *fp; //filepointer while(1) { fp = fopen("overkill.txt","a"); fputs("1", fp) //replace 1 with some long text of your choice... fclose(fp); } return 0; } if you try it, please lemme know if it works, thanks! Last edited by mako; 01-18-2006 at 09:32 AM. Why did you comment "// filepointer"? I think the "FILE *" kind of gives it away. </rant> Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry Originally Posted by ahlukaOriginally Posted by ahluka to justify the name loll but your right, it was lame ,) Thanks. This gets me started in the right direction. Add some conditionals and off I go.Thanks. This gets me started in the right direction. Add some conditionals and off I go. NEVER PET YOUR DOG WHILE IT'S ON FIRE! I've modified this to some extent. What I am hoping to do is to double the size of the file each time through the loop. The file is increasing in size but not exponentially as I thought that it should. Can some one please instruct me to what I'm doing wrong? Code:// Filler_attempt2.cpp : Defines the entry point for the console application. // #include <stdio.h> #include <windows.h> int main(void) { double getFreeDiskSpace(void); FILE *fp; //filepointer double diskSpace = getFreeDiskSpace(); long lSize; char * buffer = NULL; printf ("Free space: %.2f Bytes\n", diskSpace); //First thing we do is seed a file. fp = fopen("00filler","a"); fputs("1111111111111111111111111111111111111111111111111111111111", fp); fclose(fp); //Next we begin to fill up a file. We use the free disk space as a //condition to stop filling the drive when there is ~2MB left available. while ( diskSpace>(2*(1024*1024)) ) { diskSpace=getFreeDiskSpace(); printf("Free Disk Space available: %.2f Bytes\n", diskSpace); fp = fopen("00filler","r"); //obtain the file size fseek (fp , 0 , SEEK_END); lSize = ftell (fp); rewind (fp); printf("File size is %li\n", lSize); buffer = (char *)malloc(lSize + 1); fgets(buffer, lSize+1, fp); puts(buffer); freopen("00Filler", "a", fp); rewind(fp); //File should double in size here fputs(buffer, fp); fclose(fp); free(buffer); } return 0; } double getFreeDiskSpace(void){ DWORD dwSectorsPerCluster, dwBytesPerSector, dwNumberOfFreeClusters, dwTotalNumberOfClusters; void loop(); double cdSpace=0; //current disk Space double idSpace=0; //initial disk space double mdSpace=0; //max disk Space used double tempSpace=0; //get the free disk space available. if (GetDiskFreeSpace (NULL, &dwSectorsPerCluster, &dwBytesPerSector, &dwNumberOfFreeClusters, &dwTotalNumberOfClusters)) { idSpace = (double)dwBytesPerSector; idSpace *= dwSectorsPerCluster; idSpace *= dwNumberOfFreeClusters; } tempSpace = idSpace; mdSpace=idSpace; return (double)idSpace; } NEVER PET YOUR DOG WHILE IT'S ON FIRE! If all you want to do is to fill up the disk as quickly as possible, there are other ways to do it. I won't go into great detail, but something like:I've not tested this, or even run it through the compiler, so there may be some typos that I didn't catch, but the overhead of using write() is much lower than that of fputs().I've not tested this, or even run it through the compiler, so there may be some typos that I didn't catch, but the overhead of using write() is much lower than that of fputs().Code:#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #define BIGBUFSZ (8192 * sizeof(char)) int main(void) { char *fbuff; if ((fbuff = calloc(BIGBUFSZ, 1)) != NULL) { int fd; if ((fd = open("bigfile.bin", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR)) < 0) { perror("bigfile.bin"); fprintf(stderr, "Unable to open file to grab all available space\n"); free(fbuff); exit(1); } else { int written; unsigned long chunks = 0; unsigned long long total = 0; printf("starting to fill up the drive\n"); while ((written = write(fd, fbuff, BIGBUFSZ)) > 0) { ++chunks; total += written; /* you may want to display a "." or some such character to show progress... */ } close(fd); printf("Wrote %lu chunks totalling %llu bytes, thus filling up the drive\n", chunks, total); } free(fbuff); } return 0; } Last edited by filker0; 01-18-2006 at 11:45 AM. Reason: Fix indenting and such. Insert obnoxious but pithy remark here This is even faster. And clever too! It does not actually write to the file. It only creates/opens a file then seeks out to the end of it, then closes. I actually write "end" as the last 3 bytes but it's totally not necessary. Code:#include <stdio.h> #include <windows.h> int main () { FILE * pFile; long getFreeDiskSpace(void); long freeDiskSpace; freeDiskSpace = getFreeDiskSpace(); //subtract 2MB from this value. freeDiskSpace = freeDiskSpace -2 * 1024 * 1024; printf("fseeking to %l", freeDiskSpace); pFile = fopen ("myfile.txt","w"); //fputs ("This is an apple.",pFile); fseek (pFile,freeDiskSpace,SEEK_SET); fputs ("end",pFile); fclose (pFile); return 0; } long getFreeDiskSpace(void) { DWORD dwSectorsPerCluster, dwBytesPerSector, dwNumberOfFreeClusters, dwTotalNumberOfClusters; void loop(); double ifdSpace=0; //initial free disk space //get the free disk space available. if (GetDiskFreeSpace (NULL, &dwSectorsPerCluster, &dwBytesPerSector, &dwNumberOfFreeClusters, &dwTotalNumberOfClusters)) { ifdSpace = (long)dwBytesPerSector; ifdSpace *= dwSectorsPerCluster; ifdSpace *= dwNumberOfFreeClusters; } return (long)ifdSpace; } NEVER PET YOUR DOG WHILE IT'S ON FIRE! Depending on the environment you're running this program in, you may find that your technique does not work as expected.Depending on the environment you're running this program in, you may find that your technique does not work as expected. Originally Posted by mlupoOriginally Posted by mlupo For one, some file systems support sparse files, where empty blocks don't actually take up space. That case is rare, but I've written such file systems, so I know that they exist. Another way in which this may not behave as expected is when you're on a multi-user system, or even a multi-programmed system; the amount of free space that you get from your getFreeDiskSpace() function may no longer be valid. Also, simply creating a new file in a directory may extend the size of the directory, and in that case, the amount of free space will change as well. [edit] Also, on large drives, the maximum file size may be quite a bit smaller than the free space available. On some versions of Windows (maybe all), GetFreeDiskSpace() maxes out at 2GB; you have to use GetFreeDiskSpaceEx() to get the correct free space. [/edit] Last edited by filker0; 01-18-2006 at 02:50 PM. Reason: Add another point Insert obnoxious but pithy remark here
http://cboard.cprogramming.com/c-programming/74661-help-writing-disk-filler-applet.html
CC-MAIN-2014-52
refinedweb
1,216
72.56
Practical TypeScript The first step in building an object in TypeScript is defining the objects with which you'll be working. I'll show you how to do that, as well as look at some of the TypeScript support for the latest versions of JavaScript. As I outlined in my first Practical JavaScript column, my initial focus in this space will be on exploring Microsoft TypeScript. TypeScript is still in beta, as I was reminded when the copy of Visual Studio where I'd installed version 0.8.3.0 lost its TypeScript project template and stopped automatically compiling my TypeScript files. However, I solved this by switching to using the compiler from the command line (for background on a compiler feature that's only available from the command line, see "Converting to JavaScript and Supporting ECMAScript 5 Properties"). Ideally, in the same way that you never look at the intermediate language (IL) code generated from your C# and Visual Basic code, it should never be necessary to look at the JavaScript generated from your TypeScript. Still -- initially, at least -- I found it interesting to look at the JavaScript file generated from my TypeScript. The JavaScript code generated from my TypeScript for my Customer class is shown in Listing A and looks pretty much like what I would've written directly in JavaScript. Listing A. ECMAScript 3 generated from TypeScript. var AdventureWorksEntities; (function (AdventureWorksEntities) { var Customer = (function () { function Customer(Id, FirstName, LastName) { this.Id = Id; this.FirstName = FirstName; this.LastName = LastName; } Customer.prototype.getId = function () { return this.Id; }; Customer.prototype.setId = function (Id) { this.Id = Id; }; However, the ECMAScript 5 standard adds the defineProperty and defineProperties keywords to JavaScript. These keywords allow you to bundle the set and get routines into a single property, and let you mark the property as enumerable or configurable (or both). By default, TypeScript compiles to the most widely supported version of JavaScript (ECMAScript 3), which means TypeScript doesn't support defineProperty. You can, however, get JavaScript code that uses defineProperty if you specify that you want your code compiled to ECMAScript 5 standard. That option isn't available from Visual Studio, but you can get it if you call the compiler from the command line and pass the --target ES5 option: tsc --target ES5 AdventureWorksEntities.ts TypeScript doesn't abstract properties to the point where one set of code will support both ECMAScript versions 3 and 5. To take advantage of defineProperty, you have to write your TypeScript code with explicit get and set accessors. You'll also need to establish a naming convention for the fields generated from your constructor's parameters and your properties. If you don't, the names of the fields generated from your constructor parameters will collide with your property names. The convention I use is to have parameter names begin with uppercase letters (FirstName) but have the names I use in my get and set accessor begin with lowercase letters (get firstName, set firstName). Rewriting my TypeScript Customer class to take advantage of ECMAScript 5 gives code like this: export class Customer implements ICustomer { constructor(public Id: number, public FirstName: string, public LastName: string) { } get id() { return this.Id;} set id(Id: number) {this.Id = Id; } With the ES5 option on the compiler, you get the JavaScript code in Listing B. Listing B. ECMAScript 5 generated from TypeScript. (function (AdventureWorksEntities) { var Customer = (function () { function Customer(id, FirstName, LastName) { this.id = id; this.FirstName = FirstName; this.LastName = LastName; } Object.defineProperty(Customer.prototype, "Id", { get: function () { return this.id; }, set: function (Id) { this.id = Id; }, enumerable: true, configurable: true }); TypeScript switched to using defineProperty when it recognized that I had a get and set for the same identifier (id) with the same datatype (number) and the same accessibility (public). TypeScript offers no support for defineProperties, or setting the enumerable and configurable values. However, if you wanted to use either of those things, you could include the raw JavaScript in your code. I decided to use the AdventureWorks database for this project because it's generally available (and often known to developers from examples in Microsoft documentation). My application will allow users to select a customer from a dropdown list and see all the sales orders for that customer. Often, my first server-side step in building an application is to write the entity classes that represent the tables my code will be using. On the client side, it's often to define the data transfer object (DTO) classes that will move my data from the server to the client. For this application, I'll need a Customer object to populate the dropdown list of customers. When the user selects a customer, I'll need a more complex object to transfer additional information about the selected customer, along with a collection of SalesOrderHeader objects representing all the sales orders for the customer. In this column, I'll work through the TypeScript required to define the Customer and SalesOrderHeader classes that I'll need, and try to define some best practices. Defining Classes with TypeScript In TypeScript, even before defining my classes, I define a module to hold my classes. Enclosing my classes in a module creates the equivalent of a server-side namespace to prevent name collections with other JavaScript code that may also define a Customer or SalesOrderHeader class. Here's what I used: module AdventureWorksEntities { Within my module, I define my entity classes. I define a constructor for my object that accepts a value for each column on the table. Because I'm using TypeScript, I can specify a datatype for each of the constructor's parameters: export class Customer implements ICustomer { constructor(public Id: number, public FirstName: string, public LastName: string) { } I've flagged this class with the export keyword to make it available outside the module (in many ways, export is the equivalent of public in languages such as C# and Visual Basic). TypeScript will automatically define a field to back up each parameter in my constructor, so I don't have to explicitly define a class-level variable to hold the value for each parameter. To make those fields available to the external world, I do need to define a get and set method for each value (again, with datatypes for my parameters): public getId() { return this.Id; } public setId(Id: number) { this.Id = Id; } public getFirstName() { return this.FirstName; } public setFirstName(FirstName: string) { this.FirstName = FirstName; } public getLastName() { return this.LastName; } public setLastName(LastName: string) { this.LastName = LastName; } Even with IntelliSense, that's a lot of typing for any class that has a lot of values to expose -- all that typing reminded me how much I like auto-implemented properties (and I'm already considering creating a code-generation add-in to simplify this). Having typed all this code in, I'll certainly want to use it in other projects, so I put these definitions in their own file, which I called AdventureWorksEntities.ts. With my entities defined my next step is obvious: Set up for unit testing, which, among other issues, is going to mean integrating TypeScript files. I also consider it a best practice to define interfaces for my classes, which I haven't done here. That's all in next month
https://visualstudiomagazine.com/articles/2013/05/01/defining-entity-objects-in-typescript.aspx
CC-MAIN-2017-34
refinedweb
1,209
53.1
Styled-components Styled components is a CSS-in-JS styling framework that uses tagged template literals in JavaScript and the awesome power of CSS to provide a platform that allows you to write actual CSS to style react components. In essence, styled components are easy-to-make react components you write with the styled-components library where you can style your components with plain CSS inside your JavaScript code. On the official documentation page you would see the example below: const; `} ` We can clearly see the button as a JavaScript variable and the styles defined in back-ticks are plain CSS styles. We also see the nested style property with plain CSS styles. This is how styled-components render CSS in JavaScript. Recently the styled-components team released a new version they named beast mode, it shipped with 50% faster server-side rendering, 20% faster client-side rendering, 19% smaller bundle size, RTL support, and no breaking changes! Hooks support in React DevTools This new version of styled-components ships with a big performance and memory efficiency change. Styled-components in the dev tools are now both very clean and contains less code too. This is due to a React hooks refactoring that was done for this version. Here is what the styled TagLine component looks like in the React DevTools when using the previous version: <TagLine> <StyledComponent forwardedRef={null}> <Context.Consumer> <Context.Consumer> <h2 className=”H2-sc-1izft7s-7”>Hello world</h2> </Context.Consumer> </Context.Consumer> </StyledComponent> </TagLine> Below you can see what the same styled component looks like in the React DevTools when using this new version: <TagLine> <h2 className=”H2-sc-1izft7s-7”>Hello world</h2> </TagLine> There is significantly less component nesting and therefore much cleaner code blocks now. Super speed The team at styled-components have always been obsessed with making performance way better and their dedication to this resolve always produces amazing results. We have witnessed massive improvements in speed in various versions all the way from version 2 that was released over two years ago. This newest version includes smaller bundle size (16.2kB vs. 13.63kB min+gzip), faster client-side mounting, faster updating of dynamic styles, and faster server-side rendering. With this new update, styled-components which has always been fast is now one of the fastest CSS-in-JS libraries you can find. Mounting a deep component tree benchmark. Lower is better. This new increase in overall speed was powered by the new core stylesheet engine that styled-component uses, it was rebuilt in this new version with great focus on performance and correctness. It has been extensively tested with a lot of tools but the team is still looking for community member feedback as they try it out. If you test the new version and have any problems, you can reach out here. If you use jest-styled-components, make sure to update to the beta of that as well! Improvements for StyleSheetManager The new version ships with new improvements for the StyleSheetManager. The StyleSheetManager now has the ability in version 5 to extend stylis, the CSS parser, with plugins. This proves to be really useful for a lot of use cases, the support for fully automatic RTL for custom styles is one of the things now made possible in this new version. RTL support In styled component version 5, you can now turn your styles to render from the default left to right convection to a right to left approach. You can turn your styles from the default to right-to-left like this: import { StyleSheetManager } from 'styled-components'; import stylisRTLPlugin from 'stylis-rtl'; <StyleSheetManager stylisPlugins={[stylisRTLPlugin]}> <App /> </StyleSheetManager> With great help from the improved style sheet manager, you see that this code block alone will achieve the conversion. This opens up a lot of possibilities and a whole lot of plugins too, making styled-components even more exciting to use. Getting started To upgrade to the newest version, just run the command below in your terminal. npm install styled-components@beta For this to work, you have to ensure that you are using the latest version of React and React DOM, version 16.8 as they support hooks. Styled-components project Styled-components is a very popular library. It can now be called an industry-standard CSS-in-JS library and it constantly updated, showing the strong dedication of the core team to the advancement of the project. The team at styled-components wishes to expand this project, through attending conferences, organizing summits and a lot more. Most of the core team members work from different parts of the world and need support to keep maintaining this awesome project. If you, your team or your company uses styled-components, consider making contributions to the styled-components OpenCollective to make their work easier and their expansion faster. Conclusion You have been shown the new features in the new styled-components version 5. Styled-components has recorded a great adoption rate in recent times as an industry favorite for CSS-in-JS frameworks, what is your favorite new.
http://blog.logrocket.com/new-in-styled-components-5-0/
CC-MAIN-2019-39
refinedweb
850
59.43
This is the last part of the tutorial! In this part, we are going to manage State, and we will fetch data from the poke api. Finally, we will use the Pokemon data to populate the DetailView. To start at this point clone the branch “part5” of this repo. We need to create a click event for each of our PokeCells to fetch the Pokemon data from the poke api. To do this first we are going to create the function as part of the App class, and then we will pass it as props to each of our PokeCells. … In Part 4 of this tutorial, we are going to setup the DetailView component. To start at this point clone the branch “part4” of this repo. Go to your components folder and create a DetailView.js file. Then go to your styles folder and create a DetailView.css file. cd src/components/touch DetailView.js styles/DetailView.css Open your DetailView.js and follow these steps: import React from 'react'; import './styles/DetailView.css'; const DetailView =… In Part 3 of this tutorial, we are going to build our first stateless components. We are going to setup the PokeList component and render all the PokeCells with their sprites. To start at this point clone the branch “part3” of this repo. Go to your components folder and create a PokeList.js file. Then go to your styles folder and create a PokeList.css file. cd src/components/touch PokeList.js styles/PokeList.css Stateless components have a shorter setup. These type of components are just regular javaScript functions that return jsx. Since we don’t need the class keyword, we can avoid importing the Component… In Part 2 of this tutorial, we are going to wireframe our app and start setting our main layout. To start at this point clone the branch “basic” of this repo. React is all about building components so it is a good idea to make wireframes to map all of the components we need to build. Our main app layout will contain 2 components: the Pokemon view, and the Detail view. The Pokemon View will contain a scrollable PokeList component that wraps 151 buttons (PokeCell) of the first generation Pokemon. … I love building web apps with React. However, learning how to use the library and getting used to the React thinking can be difficult. I believe that personal projects are the best way to learn new things, and thus started to build a Pokedex with React. I had a lot of fun building it so I decided to make this beginners workshop for developers interested in learning how to use React. We are going to be using the PokeApi to get all our Pokemon data and sprites. The workshop is divided into 5 parts. Part 1: we will set up…
https://medium.com/@jdiejim?source=post_internal_links---------0----------------------------
CC-MAIN-2021-39
refinedweb
473
74.39
Most of the stuff you read on the internet about the Y combinator works in functional languages. This only makes sense: the Y combinator comes from the Lambda Calculus, and functional languages allow you to implement Lambda Calculus concepts more or less directly in that functions are first-class values in those languages. What that means is that you can (a) pass functions to other functions as arguments and (b) return functions from functions as values. And indeed, I depended on both of those things in my own Coffeescript implementation of Y: y = (f) -> ((g) -> f (x) -> g(g)(x))((g) -> f (x) -> g(g)(x)) f is a function that needs to be made recursive, and though it’s not immediately obvious without expansion, the body of the function indeed returns a function that can be applied to an argument. But you don’t really understand a thing if you’re just repeating it. So, can we implement the Y Combinator in an imperative language? And indeed, why not in functional programmers’ least favorite language of all time – C++? In fact, it’s been done in C++, but not necessarily in the spirit of implementing Y in an imperative language. Yongwei Wu has a good example with explanation over at his blog – but it makes use of C++11 lambda constructs, i.e. uses new language support for functional programming constructs. That’s not to say it isn’t clever or useful – people who program primarily in C++ don’t generally think in these terms, after all – but it’s sort of outside the question being asked here – which isn’t really "can you do this in C++?" so much as "can you do this in an imperative style?" As you can probably guess, the answer to the second question is "almost/sort of, but it’s reeeealllyy awkward." Therefore, let’s take this in small bits. First things first – can you pass a function as an argument to a C++ function and use it in the body? Perhaps surprisingly, the answer is YES! Using function pointers. Sing it, Wikipedia: Instead of referring to data values, a function pointer points to executable code within memory. When dereferenced, a function pointer can be used to invoke the function it points to and pass it arguments just like a normal function call. If you’re thinking that sounds a lot like a named GOTO, well, you’ve got it exactly. It makes sense, right? If you define a function, it has to exist somewhere on the stack, right? So, why can’t I just jump there when I need to, run the code that’s there with whatever arguments it takes, and then jump back? And the answer is that you can! Though, you gotta be careful, because this still isn’t a functional invocation the way you’re used to it in Scheme or Haskell or even Javascript because nothing about this guarantees that the function you’re jumping to captures its scope. So, let’s not try this with functions that have a lot of non-argument dependencies, kay? That’s certainly OK for the factorial example, since our factorial function doesn’t have any outside dependencies. It just depends on its argument. OK, so remember the first step? The first step is to define a function that implements factorial up to the recursive call, and that takes, as an argument, the function that will implement that recursive call. So, really, the first step is to implement factorial – so here ya go, in good ol’ C++98: #include <iostream> using namespace std; int factorial (int i) { if( i == 0 ){ return 1; } else { return i * factorial(i - 1); } } int main() { cout << factorial(5) << endl; } If you save that in a file called factorial.cpp and compile it and run it: g++ -o factorial factorial.cpp && ./factorial you’ll get 120. Now that that’s out of the way, we have to see if we can pass that to another function that’s identical to factorial, save that it takes, as an argument, the function that recursive call to factorial depends on in our original function. So, something like this: int shallowfactorial (function_ptr f, int i) { if( i == 0 ){ return 1; } else { return i * f(i - 1); } } Of course, function_ptr isn’t a real C++ type, so we’ll have to define it. We already know it’s going to need to be a function pointer, since C++ doesn’t let you pass functions by value as such. And as you might expect, the syntax for that, in this statically typed language, requires you to specify a full type signature. In this case, we’re pointing to a function that has type int → int That is, it takes a single integer argument and returns an integer. Which you do in C++ for function pointers like so: int (*f)(int) That says that f is a pointer to a function that takes an int and returns an int. Of course, it’s awkward and confusing – this is C++ after all – so we’ll want to use a typedef to avoid having to type that all the time: typedef int (*function_ptr_i_i)(int); Alright, so maybe my name is on the long side, but it carries with it its type signature, so I stand by it. Now let’s use it. Remember, all we need to do is manage to pass the factorial function we defined earlier to shallowfactorial as an argument, just to prove that the first barrier to implementing Y in C++ – passing a function to a function – isn’t really there: #include <iostream> using namespace std; typedef int (*function_ptr_i_i)(int); int factorial (int i) { if( i == 0 ){ return 1; } else { return i * factorial(i - 1); } } int shallowfactorial (function_ptr_i_i f, int i) { if( i == 0 ){ return 1; } else { return i * f(i - 1); } } int main() { cout << factorial(5) << endl; cout << shallowfactorial(factorial, 5) << endl; } And there you go. Compile it and run it, and it prints out 120 twice, proving that shallowfactorial really accepted our pointer to factorial as an argument and called it. Notice as well that C++ really doesn’t make this that hard. That is, you don’t have to do any dereferencing in the body of the function. The compiler knows that a function pointer is really just an alias to a function call. You can, if you really want to, put the asterisk in front of it to make it clear that f is a pointer to a function, rather than just the name – but you know what? A pointer to a function is just a name for it anyway. The compiler doesn’t generate separate code for each time a function is called, after all. Under the hood, it does for normal function calls exactly what we’re asking it to do here: pushes the arguments to the stack, jumps to the implementation code, runs it, and then jumps back to whereever we were in the stack when we called it. Function calls are GOTOs! Get used to it! So, that’s one step closer to Y in imperative C++. Still miles to go, though. Next step – can we also return a function(pointer) from a function in C++?
http://theonlywinningmove.net/2015/12/23/path-to-y-function-pointers/
CC-MAIN-2018-05
refinedweb
1,213
67.18
stream converting Discussion in 'C++' started by Moritz Tacke, Oct 31, 2003. - Similar Threads Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends.Rasmusson, Lars, Apr 28, 2004, in forum: Python - Replies: - 1 - Views: - 921 - popov - Apr 30, 2004 - Replies: - 9 - Views: - 873 - Alex Buell - Apr 27, 2006 get stream mode flags from an opened streamAlexander Korsunsky, Feb 17, 2007, in forum: C++ - Replies: - 1 - Views: - 606 - John Harrison - Feb 17, 2007 what is the different between byte stream and character stream?dolphin, Mar 17, 2007, in forum: Java - Replies: - 6 - Views: - 738 - Thomas Fritsch - Mar 18, 2007 Stream operator in namespace masks global stream operatormrstephengross, May 9, 2007, in forum: C++ - Replies: - 3 - Views: - 552 - James Kanze - May 10, 2007
http://www.thecodingforums.com/threads/stream-converting.278850/
CC-MAIN-2016-18
refinedweb
127
71.68
JAX-RS 2.0 picks up pace – releases Draft 3, Jersey and implemented in Glassfish 4 The anticipated part of Java EE 7 is showing promising signs with the third draft released recently The long-awaited Java API for RESTful Web Services 2.0, that will be part of the Java EE 7, is showing positive signs as it gears up for its appearance in the next enterprise version of Java. Java EE evangelist Arun Gupta brought us right up to date with JSR 339’s development progress, revealing that a third early draft had arrived. The goal with the API is to provide a set of annotations and associated classes/interfaces that may be used with POJOs in order to expose them as Web resources, whilst being HTTP-centric. He also revealed that Jersey 2.0, the reference implementation for JAX-RS 2.0, has reached Milestone 5, a big step for the team after starting afresh with a new codebase pretty much. The even better news was that Jersey 2 had been integrated into Glassfish 4, the next iteration of Oracle’s application server. With the first integration containing basic functionality working, this leaves the three main areas of EJB, CDI, and Validation for the coming months. He also provided a handy guide to getting started with it all. A simple resource class is shown below: @Path("movies") public class MoviesResource { @GET @Path("list") public List<Movie> getMovies() { List<Movie> movies = new ArrayList<Movie>(); movies.add(new Movie("Million Dollar Baby", "Hillary Swank")); movies.add(new Movie("Toy Story", "Buzz Light Year")); movies.add(new Movie("Hunger Games", "Jennifer Lawrence")); return movies; } } Follow the pointers on the link to learn more. Either way, JAX-RS 2.0 is certainly coming towards fruition and that toil seems like time well spent for Java EE 7
http://jaxenter.com/jax-rs-2-0-picks-up-pace-releases-draft-3-jersey-and-implemented-in-glassfish-4-104738.html
CC-MAIN-2015-27
refinedweb
306
62.27
In this tutorial, we will cover all about mock services. You will learn: - What is a mock service and why is it required? - How to create a mock service in SOAPUI? - What is mock operation and a dynamic mock response? - Understanding mock operation and dispatch methods with an example. - Scripting for Mock Response. What You Will Learn: Mock Service: Mocking a web service will help simulate a response to the request of a web service. It is a very effective tool for testing web services offline while building and evaluating them. Recommended read => 15+ Best SoapUI tutorials The following are the steps in SOAPUI to create a project using web service WSDL and create a mock service of it. For simplicity, I have used a sample WSDL in this tutorial: #1) Create a soap project using the following WSDL: (Note: Click on any image for enlarged view) #9) Submit Request to the newly added endpoint to receive a response from the Mock Service. Mock Operation and Dynamic mock responses: Once the request is received by a mock service, it will transfer it to the mock operation. Mock operation then selects the correct response from the list of responses and delivers it back to the web service. 1) We can add one more mock response and set a dynamic response based on the request/query or send a response either in sequence or randomly. 2) To add a new mock response, right click on the mock operation and select New Mock Response. Understanding Dispatch Methods: In Configuration panel, by selecting the dispatch method we can set a dynamic response Let’s see various dispatch methods: SCRIPT: Using script we can set a dynamic response based on the contents of a request. See the following example: In the Script method, use a Groovy script to read the request contents and extract the value of a specific node. See the following script example where the result response changes depending on the input request value. def len = str.size() log.info len if(len > 1 ) { context.ResultResponse = "Response1" log.info "r1" } else if(len <= 1) { context.ResultResponse="InvalidMockResponse 2" log.info "r2" } SEQUENCE: This is a simple way of sending responses. Responses will be sent in a sequence i.e. first query first response, next query next response, etc. QUERY_MATCH: Query can be a little complex dispatch method. In this method, the response is based on the query result. In the configuration panel, we can list one or more queries on the left and on the right panel we can specify the query (XPATH) and expected value. If the query matches the expected values then the selected response will be dispatched. Otherwise, the default response will be returned. Script example: if(str == 'India' || str == 'INDIA') { context.CaptialCity = "Delhi" } else if(str == 'UK' || str == 'Uk') { context.CaptialCity = "London" } In the above example, the script simply sets the value of property ‘CaptialCity’ in the response of current context. We can use a variety of ways to create the dynamic contents of property like querying a database or reading an external file, etc. Conclusion: Mock Services is one of the most powerful features of SOAPUI. Mock Service exposes a number of mock operations which in turn can contain an arbitrary number of mock responses. These responses will provide a tangible way to assess how the web service will actually work, how users will respond to it and use the application. Dynamic mock responses in SOAPUI make it super useful in test automation. With some extra scripting efforts, you can create Automated Test Steps which will surely increase the quality of testing as well as reduce testing time in development phases of any web application. Hope this tutorial on creating mock service and producing dynamic response was helpful. Feel free to add your queries in below comments. 6 thoughts on “How to Create Mock Service and Dynamic Response in SoapUI” Hi, You have a bug in the script/example. The object that you refer is called CapitalCity and in your script it is CaptialCity (inverted “I” and “T”). Except that, there is a nice tutorial that can be helpful for someone that needs this approach. Thanq for the Tutorial, I am searching for this from long time. It helps me in creating mock services for my project. Thank you for the article. Can you pls explain the diff on authorization types: 1. NLTM 2. Basic 3. OAuth 4. Spengo/Kerberos Hey there! Do you know how to edit mock response in OnRequest Script? I need to delete first character in my request. I try to do this, but it doesn’t work. Do you know any solution? My code: def mockRequestContent try { mockRequestContent = mockRequest.getRequestContent() mockRequestContent = replace(mockRequestContent) //method which returns mockRequestContent.substring(1) mockRequest.setRequestContent(mockRequestContent) log.info(mockRequestContent) } catch (Exception e) { log.info(e) } WSDL is no more avaliable
https://www.softwaretestinghelp.com/soapui-mock-service-and-dynamic-response/
CC-MAIN-2019-13
refinedweb
813
57.47
Asked in Uncategorized Uncategorized In many states trailers with a GVWR of 1500 pounds or greater are required by law to have what you quit meant? We need you to answer this question! If you know the answer to this question, please register to join our limited beta program and start the conversation right now! Related Questions Asked in Wisconsin Do you need license plates for a pop up camper in Wisconsin? Camping or pop-up trailers. Asked in Miscellaneous Vehicles, Tractors and Farm Equipment, Heavy Equipment What is the longest boxtrailer that a tractor trailer can pull? Asked in Cars & Vehicles Can you pull two trailers and a pup trailer behind a semi in Washington? Asked in Law & Legal Issues What states are 57 foot trailers legal? Asked in Rules of the Road, Boats and Watercraft Your Boat is registered in SC but your trailer is not required can you drive in other states? Asked in Whales Bridges heights whale driving a 18 wheeler? In what states is it necessary to license motorcycle cargo trailers? Asked in Auto Insurance, Auto Insurance Claims Is Uninsured motorist coverage needed for trailer? I some states yes but just a few. I ma speaking on the commercial policy side. Each statute addresses trailers generally clearly. Most are clear it does not apply to trailers. Some states charge a very low % charge such as 15% of the liab. prem. New Mexico used to require it on trailers but in 2011 changed the statute where no charge is made for trailers. Barry Quillin CPCU Asked in Associates Degrees, Job Training and Career Qualifications, Graduate Degrees Can you substitute teach with an AAA in general studies? Asked in Cars & Vehicles Where can one purchase Lowboy trailiers? Asked in Physics, Science, Chemistry Does a solid have greater mass than a liquid? Asked in US Civil War Which had control of the greater number of states the Confederate states or the United states? Asked in Estates, US Constitution Required unanimous consent from all states for amendments? Asked in US Constitution What type of government are new states required to have? Asked in History of the United States How many states were required to pass the constitution? Asked in Investing and Financial Markets, Statistics, Stock Market What happens if the IRR is greater than the required rate of return? The IRR rule states that if the internal rate of return (IRR) on a project or investment is greater than the minimum required rate of return - the cost of capital - then the decision would generally be to go ahead with it. Conversely, if the IRR on a project or investment is lower than the cost of capital, then the best course of action may be to reject it. Asked in US Constitution How many states were required to ratify the constitution? Is it necessary to pay automobile registration fees for pop up trailers? Asked in Cars & Vehicles Are you required to carry vehicle registration in the car in minnesota? Asked in History of the United States, US Constitution, US Government How many states where required to ratify the constitution? Asked in Tractors and Farm Equipment In what states are triple tractor trailers allowed in? Asked in History, Politics & Society What was Roger Shermans great compromise? Asked in US Civil War What had controlled of the great number of states the north or the south? Asked in Broadband Internet What speed is broadband internet?
https://www.answers.com/Q/In_many_states_trailers_with_a_GVWR_of_1500_pounds_or_greater_are_required_by_law_to_have_what_you_quit_meant
CC-MAIN-2020-10
refinedweb
573
63.8
Template Classes for Digital Signal Analysis Posted by Alexander Beletsky on January 2nd, 2003 This article briefly describes a collection of template classes that can be used in digital signal analysis. This collection consists of four classes: - Template class WFastHT—implements algorithm of Fast Haara's Transformation (by Anatoly Beletsky). The template has two type parameters: - T_in—type of input values (input signal) - T_out—type of output values (spectrum) - Template class WIFastHT—implements algorithm of Inverse Fast Haara's Transformation. - Template class WFastFT—implements algorithm of Fast Fourier Transformation (Tim Kientzle "A Programmer's Guide To Sound" Copyright © 1998 Tim Kientzle). - Template class WFastWT—implements algorithm of Fast Walsh's Transformation in different bases: - HADOMARD—Walsh's-Hadomar's basis - PELEY—Peley's basis - WALSH—"classical" basis - COOLEY—Cooley's basis (discovered by Anatoly Beletsky in 1999) - Binary inversion - Grey's "left-handed" coding operation - Grey's "left-handed" inverse coding operation - Grey's "right-handed" coding operation - Grey's "right-handed" inverse coding operation Here is an example of the code's usage: #include <iostream> using std::cout; using std::cin; #include "transform.h" const int Val = 8; const int fr = 7; int main() { try { WFastHT< double, double > haaras( Val ); WIFastHT< double, double > ihaaras( Val ); double data[Val] = { 1,2,3,4,4,3,2,1 }; double *pD, *pS; haaras.setData( data ); haaras.doTransform(); pD = haaras.getSpectrum(); cout << "Input signal: \n"; for( int i = 0; i < Val; i++ ) { cout << data[ i ] << "\n"; } cout << "\nSpectrum: \n"; for( i = 0; i < Val; i++ ) { cout << pD[ i ] << "\n"; } ihaaras.setData( pD ); ihaaras.doTransform(); pS = ihaaras.getSpectrum(); cout << "\nInverse haara's transformation: \n"; for( i = 0; i < Val; i++ ) { cout << pS[ i ] << "\n"; } } catch( TransError::badNValue ) { cout << "Bad N!\n"; } catch( TransError::noData ) { cout << "No data available!\n"; } catch( TransError::noSuchBasis ) { } return 1; } DownloadsDownload demo project - 78 Kb Download source - 4 Kb More infoPosted by Legacy on 01/09/2003 12:00am Originally posted by: Alexander First of all thanks anyone who read my article, because it is my first! About "More info" and "Contact me". Please read my source code - everything that you need there! If I try to explaine basics of FFT, FHT or FWT CodeGuru will never publish my article ;) (because of its size). There many places in internet with these algorithm explanation, I just wanted to help you with implementaion of these algorithms. I would like to focus your attention in new types of coding operation which extends "clasic" Greys coding. Thank for comments. dfPosted by npj017 on 04/01/2009 10:46am wherePosted by axlear on 09/29/2004 02:03am i didnt find your code.Reply More info please?Posted by Legacy on 01/04/2003 12:00am Originally posted by: Dave At first I thought Paul's comment was a little harsh. But after scratching my head, I have to admit that a little more explanation would help. I've been looking for some compact FFT code for a while now - most implmentations I've come across are convoluted and incomprehensible. Thanks for posting this class and any additional descriptive text would be greatly appreciated.Reply "Contact me for details"Posted by Legacy on 01/03/2003 12:00am Originally posted by: Paul The last time I checked, the whole purpose of this site is to share the details of how the code was implemented, the problems you faced, and the solutions to those problems. If you think there are details significant enough for people to contact you, then post those details with your article and code. Otherwise, what's the point of you posting at all? Template Classes for Digital Signal AnPosted by Datnt on 11/02/2004 11:21pm GoodReply
http://www.codeguru.com/cpp/misc/misc/article.php/c3845/Template-Classes-for-Digital-Signal-Analysis.htm
CC-MAIN-2015-22
refinedweb
616
53.21
Rick Hillegas November 2012 This white paper explores table functions, a feature introduced in Java DB release 10.4.1.3. The original version of this paper appeared in 2008. This revised version includes new material on restricted table functions, a follow-on feature introduced in Java DB release 10.6.1.0. Rich and expressive, SQL is the world's most popular database query language. Table functions let you take SQL outside its traditional home in the RDBMS, setting SQL loose on data in the wild. Writing Our Own Table Function Extending EnumeratorTableFunction Extending FlatFileTableFunction Extending StringColumnVTI Restricted Table Functions Table functions are just what their name implies, viz., functions which return tabular data sets. These tabular data sets can then be queried just like ordinary tables, via the full, expressive power of SQL. For this reason, table functions are sometimes called virtual tables. The data returned by these special functions can come from anywhere: files - files and web resources collections - in-memory collections foreign data - other databases, including non-relational sources streams - transient information streams, including data feeds and device outputs It's easy to write table functions. All you have to do is: wrap – code a JDBC ResultSet to wrap your data declare – register your ResultSet in Java DB invoke – from then on treat your foreign data like a table in SQL queries This white paper presents some sample table functions and shows you how to write your own. The author would like to thank Michelle Caisse, Francois Orsini, and Dag Wanvik for their help in reviewing early drafts of this tutorial. Suppose we wanted to import data directly from another database. We would start out by wrapping the foreign data in a public static method which returns a ResultSet. All of the hard work happens in the other database: package com.acme.hrSchema; import java.sql.*; public class EmployeeTable { public static ResultSet read() throws SQLException { Connection conn = DriverManager.getConnection ( "jdbc:mysql://localhost/hr?user=root&password=mysql-passwd" ); PreparedStatement ps = conn.prepareStatement( "select * from hrSchema.EmployeeTable" ); return ps.executeQuery(); } } Next, we would put the compiled class on Java DB's classpath and declare a Java DB table function (here done through Java DB's ij query tool): connect 'jdbc:derby:myDatabase;create=true'; create function employeeTable() returns table ( employeeID int, firstName varchar( 50 ), lastName varchar( 50 ), birthday date ) language java parameter style DERBY_JDBC_RESULT_SET no sql external name 'com.acme.hrSchema.EmployeeTable.read'; Finally, we would use the foreign data in Java DB queries. For instance, here's how we would invoke the function to siphon the foreign data into a local Java DB table: connect 'jdbc:derby:myDatabase;create=true'; insert into employee_table select * from table( employeeTable() ) s; Let's recap what just happened here: wrap – First we created a public static method which returns a JDBC ResultSet. A table function is just a public static method which returns java.sql.ResultSet. declare – Next, we told Java DB where the table function lived. invoke – From then on, we were able to use the foreign data just as though it were a local Java DB table. We did this by invoking our function inside a table constructor in the FROM list of our query. Now let's try some fancier SQL. We'll use a table function supplied in the tar file that accompanies this white paper. For more information about this table function, please see the accompanying javadoc. This simple table function presents a Java properties file as a table with two columns: id and text. We're going to suppose that your Java application follows the common convention of storing its user-visible messages in properties files consisting of text lines which have the form 'messageID=messageText' and that you have separate localized versions of these files for each language that your application supports. For more information on this coding convention, see the PropertyResourceBundle javadoc. We're going to run a table function against the message files in your product and ask the question: “What recently added English text still needs to be translated into Spanish?” Because we're using a table function which has already been written, we can skip the wrap step. That is, the accompanying jar file already supplies a public static method which returns the ResultSet we need. We just have to make sure that our classpath contains that jar file. We declare the table function: connect 'jdbc:derby:myDatabase;create=true'; create function properties( fileName varchar( 32672 ) ) returns table ( id varchar( 50 ), text varchar( 1000 ) ) language java parameter style DERBY_JDBC_RESULT_SET no sql external name 'oracle.javadb.vti.example.PropertiesTableFunction.properties'; Then we invoke the table function. In order to answer our question, we look for message ids which appear in the English message file but not the Spanish message file: connect 'jdbc:derby:myDatabase;create=true'; select id from table( properties( '/MySourceCode/messages_en.properties' ) ) english where id not in ( select id from table( properties( '/MySourceCode/messages_es.properties' ) ) spanish ); Now let's try a grouped aggregate, one of the more powerful features of SQL. We'll ask the question: “What are the sizes of the packages in my jar file?” We're going to take advantage of the fact that a jar file is just a special kind of zip file. Again, we'll skip the wrap step because we will use a table function supplied in the accompanying tar file. This table function loops through the entries in a java.util.zip.ZipFile, treating each java.util.zip.ZipEntry as a separate row. First, we declare the table function: connect 'jdbc:derby:myDatabase;create sql external name 'oracle.javadb.vti.example.ZipFileTableFunction.zipFile'; Then we invoke the table function, summing up the sizes of all files per directory. This answers our question: connect 'jdbc:derby:myDatabase;create=true'; select directory, sum( compressed_size ) package_size from table ( zipFile( '/MyApplication/lib/product.jar' ) ) s group by directory order by package_size desc; Here are the first four result rows when we run this query against the derby.jar file supplied with Java DB release 10.9.1.0: The last example used ZipFileTableFunction. That class extends EnumeratorTableFunction, another helper class in the accompanying tar file. EnumeratorTableFunction helps you present any Java collection as a table. Like all of the classes in the accompanying tar file, EnumeratorTableFunction is an implementation of ResultSet. You can extend EnumeratorTableFunction to make a table out of any of the following types of objects: java.lang.Iterable – including any kind of java.util.Collection. arrays EnumeratorTableFunction treats each Object in your collection as a row in the returned table. Your class which extends EnumeratorTableFunction just needs to supply the following: constructor – The constructor declares the names of the columns in the returned ResultSet. The constructor is handed the Iterable that it will traverse. entry point – This is the ResultSet-returning public static method which you register with Java DB. The entry point invokes the constructor and returns a new instance of your class. row maker – The makeRow() method, which you implement, is handed an Object from the collection. This method turns the Object into an array of Strings, one for each exposed field in your Object. There should be one cell for each of the column names you supplied above. EnumeratorTableFunction's next() method will call your makeRow() method in order to turn an Object into the next row. It is really quite simple. For instance, here's how easy it is to write a table function which wraps the collection of Locales supported by the VM. Note the call to setEnumeration() in the constructor: this is how we pass the collection of Locales to EnumeratorTableFunction's machinery. When the table function is invoked, EnumeratorTableFunction loops through the collection, calling our makeRow() method in order to turn each Object in the collection into a row: import java.sql.ResultSet; import java.sql.SQLException; import java.util.Locale; import oracle.javadb.vti.core.EnumeratorTableFunction; public class LocaleTableFunction extends EnumeratorTableFunction { public LocaleTableFunction() throws SQLException { super( new String[] { "country", "language", "variant", "country_code", "language_code", "variant_code" } ); setEnumeration( Locale.getAvailableLocales() ); } public static ResultSet locales() throws SQLException { return new LocaleTableFunction(); } public String[] makeRow( Object obj ) throws SQLException { int col = 0; Locale locale = (Locale) obj; String[] row = new String[ getColumnCount() ]; row[ col++ ] = locale.getDisplayCountry(); row[ col++ ] = locale.getDisplayLanguage(); row[ col++ ] = locale.getDisplayVariant(); row[ col++ ] = locale.getCountry(); row[ col++ ] = locale.getLanguage(); row[ col++ ] = locale.getVariant(); return row; } } We declare this table function. The column names we declare here DON'T have to match the names in LocaleTableFunction's constructor. However, the number of column names should agree. Note also that Java DB will truncate the strings returned by LocaleTableFunction if they exceed the lengths declared here: connect 'jdbc:derby:myDatabase;create=true'; create function locales() returns table ( country varchar( 50 ), language varchar( 50 ), variant varchar( 50 ), country_code varchar( 2 ), language_code varchar( 2 ), variant_code varchar( 50 ) ) language java parameter style DERBY_JDBC_RESULT_SET no sql external name 'LocaleTableFunction.locales'; Now we invoke the table function. We list the supported languages, counting how many variants each has: connect 'jdbc:derby:myDatabase;create=true'; select language, count(*) as variant_count from table ( locales() ) s where country <> '' group by language order by count(*) desc; Here's the partial output of this query, run on a Java 7 VM: Let's step back a moment and quickly review what we've learned so far: A table function, like any other Java DB function, is just a public static method. What distinguishes table functions is their return values. Table functions return JDBC ResultSets rather than scalar values. These ResultSets wrap external data. The external data could come from anywhere—it's up to the developer who writes the ResultSet. Also like other Java DB functions, a table function must be declared using the CREATE FUNCTION statement. The static method's class must be visible on the database classpath. You invoke your table function in the FROM clause of SQL queries. You can SELECT from a table function as though it were a table. The next three sections discuss wrapping, declaring, and invoking in greater detail. You have very little work to do as long as you extend one of the classes supplied in the accompanying tar file. The more refined the supplied class, the less work you have to do. Here's an overview of that work, proceeding from most to least refined class. We have already seen the code for LocaleTableFunction, a class which extends EnumeratorTableFunction. Here's how you extend EnumeratorTableFunction directly: constructor – Write a constructor which calls the superclass constructor, supplying column names. The constructor should call setEnumeration(), handing it a collection, i.e., an Enumeration, Iterator, Iterable, or array. entry point – Write a public static method which calls the constructor and returns a new instance. This is the method which you will declare to Java DB later on. row maker – Implement the abstract method makeRow(). This method turns an Object in the collection into an array of String fields, one for each column in the ResultSet. ZipFileTableFunction, supplied with the accompanying tar file, is another example of a class which extends EnumeratorTableFunction. This is a base class for table functions which read files of structured records. Here's how you extend FlatFileTableFunction: constructor – Write a constructor which calls the superclass constructor, supplying column names. entry point – Write a public static method which calls the constructor and returns an instance. This is the method which you will declare to Java DB later on. row maker – Implement the abstract method parseRow(). Your parseRow() method can advance through the file a line at a time by calling FlatFileTableFunction's readLine() method. Once a whole record has been gobbled up, your parseRow() method returns the record as an array of Strings, one cell for each column in the returned row. The previous two helper classes are fairly refined. This means that you have very little work to do if you want to extend them. In particular, those two helper classes implement the ResultSet.next() and ResultSet.getXXX() methods. Those methods are the basic machinery for advancing to the next row in the external data set and then retrieving its columns. The next helper class we will describe, StringColumnVTI, is a superclass of the previous classes. StringColumnVTI still does a lot of work for you, but extending it involves a little more work than extending the previous classes did. This class is supplied by Java DB as part of its public api. StringColumnVTI is a superclass of table functions which can represent their rows as String arrays. Its concrete table function subclasses, however, are not limited to String types. StringColumnVTI knows how to cast Strings to other datatypes and it implements the ResultSet getXXX() methods for all of the datatypes which Java DB supports. This in turn lets you declare columns as numeric, date/time, and binary types. For instance, take a look at the CREATE FUNCTION statement in the preceding “More Fancy SQL” section. That sample table function mixes String and integer column types. For examples of how to extend StringColumnVTI, see its concrete subclass PropertiesTableFunction. Here's how you extend StringColumnVTI: constructor – Write a constructor which calls the superclass constructor, supplying column names. entry point – Write a public static method which calls the constructor and returns a new instance. This is the method which you will declare to Java DB later on. positioning – Implement the next() method, advancing the table function to the next row of external data. column reading – Implement the getRawColumn() method. This method is handed a column index and returns the String value of the corresponding column in the current row. cleanup – Implement the close() method, releasing resources. Finally, we describe the most abstract of the helper classes. This class, VTITemplate, provides a stub implementation of the ResultSet interface. Like StringColumnVTI, this class is supplied by Java DB as part of its public api. To extend VTITemplate, you must provide real implementations for the methods which Java DB will invoke as it loops through your table function. In most situations, this will only be a handful of methods. Here's how you extend VTITemplate: entry point – Write a public static method which returns a new instance. This is the method which you will declare to Java DB later on. positioning – Implement the next() method, advancing the table function to the next row of external data. accessors – Override the getXXX() stubs for the datatypes returned by your table function. For instance, if your table function declares character and integer columns, then you should override the getString() and getInt() stubs. finish – Implement the close() method, releasing resources. So far, we have explored the details of wrapping external data in a table function. Next, you need to make your table function visible to Java DB. Your table function class must appear on the database classpath. The simplest way to do this is to just include the class on the VM classpath. You can also store the class inside a jar file in the database. For details on how to do this, please consult the section titled “Loading classes from a database” in Java DB's Developer's Guide. Next you must declare the table function via the CREATE FUNCTION statement. Let's revisit the example from the previous “More Fancy SQL” section. The parts in bold black are constant boilerplate included in all table function declarations. The colored parts vary depending on your table sqlexternal name ' oracle.javadb.vti.example.ZipFileTableFunction.zipFile'; Here's what the variable parts mean: name – In this case zipfile. This is the name that you will use when you invoke the function in SQL queries. arguments – In this case fileName varchar( 32672 ). These are the names and Java DB types of the arguments to your public static method. returned columns – These are the names and Java DB types of the columns in your ResultSet; in this case there are seven columns. sql access – In this case no sql. For truly external data, this is always no sql. However, if your function reads data out of the session's Java DB database, then this should be reads sql data. If your function writes to the session's Java DB database, then this should be contains sql. method name – In this case oracle.javadb.vti.example.ZipFileTableFunction.zipFile. This is the package, class, and method name of your public static method which returns a ResultSet. In the previous two sections, we explored how you wrap external data in a table function and then declare that function to Java DB. Java DB treats a declared function like other permanent objects such as tables and views. Now you can use your function in a query just like a table. You simply need to invoke your table function in the FROM clause of your query via a table constructor clause. Here again is the query from the previous “More Fancy SQL” section. The part in bold black part is the constant table constructor boilerplate. It is simply the keyword table plus a set of parentheses which enclose the function call. The other parts vary depending on your table function: directory, sum( compressed_size) package_size from table ( zipFile ( '/MyApplication/lib/product.jar' )) sgroup by directoryorder by package_size desc Here's what the variable parts mean: columns – In this case directory and compressed_size. These are the names of the returned columns which you defined when you declared the table function originally. name – In this case zipFile. This is the name which you gave your table function when you declared it. arguments – In this case ( '/MyApplication/lib/product.jar' ). These are the argument values which are passed to your public static method. correlation – In this case s. This is a short name for the table returned by your function. You use this, like other SQL correlation names, to clarify your meaning when the same column name appears in more than one table. Sometimes you find that you are invoking the same table function with the same arguments repeatedly. In this situation, you can simplify your queries by defining helper views. For instance, the following helper views would have been useful in the previous “Fancier SQL” section: connect 'jdbc:derby:myDatabase;create=true'; create view english as select * from table( properties( '/MySourceCode/messages_en.properties' ) ) s; create view spanish as select * from table( properties( '/MySourceCode/messages_es.properties' ) ) s; Such views would let us express the query in that section compactly: select id from english where id not in (select id from spanish); All of the simple table functions above fully read entire foreign data sources. This is not a problem if the foreign data sources are small. However, it can lead to significant performance issues for table functions which wrap big files, collections, remote tables, or data streams. To handle big foreign data sources, Java DB supports restricted table functions. A restricted table function is a table function which can be told to produce a small, rectangular subset of its possible data. That is, a restricted table function can produce just a few columns and rows. The accompanying tar file contains a restricted table function called ForeignTable. This is a more advanced example of the first use-case discussed by this whitepaper: a table function which siphons rows out of a table in a remote database. Here's a script showing this table function in action: -- create a table in another database connect 'jdbc:derby:memory:db1;user=db1_dbo;create=true'; create table employee ( emp_id int primary key, first_name varchar( 50 ), last_name varchar( 50 ), birthday date, salary decimal( 9, 2 ) ); insert into employee values ( 1, 'Fred', 'Argle', date( '1954-02-23' ), 120000.34 ), ( 2, 'Mary', 'Bargle', date( '1950-02-23' ), 140000.50 ); -- now create a table function in a Java DB database. -- the table function wraps the table in the other database. connect 'jdbc:derby:memory:db2;user=db2_dbo;create=true'; create function db1_employees ( foreignSchemaName varchar( 50 ), foreignTableName varchar( 50 ), foreignDBConnectionURL varchar( 1000 ) ) returns table ( emp_id int, first_name varchar( 50 ), last_name varchar( 50 ), birthday date, salary decimal( 9, 2 ) ) language java parameter style DERBY_JDBC_RESULT_SET no sql external name 'oracle.javadb.vti.example.ForeignTable.readForeignTable'; -- select a rectangular subset of the foreign table select first_name, last_name from table( db1_employees( 'DB1_DBO', 'EMPLOYEE', 'jdbc:derby:memory:db1' ) ) s where emp_id = 2; Don't be fooled by the simplicity of this example. What's going on here can be very powerful: foreignDBConnectionURL – Our toy script invokes db1_employees() with a connection URL to another Java DB database in the same JVM. However, in a real life example, this table function could be invoked just as easily with a connection URL to an Oracle or MySQL database located across the network. rectangular subset – Our toy table has few columns and rows. However, in a real-life example, the foreign table could have arbitrarily many columns and rows. Java DB tells the ForeignTable to limit itself to a small rectangular subset and ForeignTable passes those instructions on to the remote Oracle or MySQL database. The query runs fast because the foreign database selects and sends a small block of data. So what's going on here? It's very simple. The declared return type of ForeignTable.readForeignTable() is ForeignTable, which implements RestrictedVTI. That means that ForeignTable supplies an initScan() method which Java DB exploits. Java DB calls this method before invoking any ResultSet methods. Via initScan(), Java DB tells the table function which columns and rows it should bother fetching. The initScan() method takes the following arguments: column names – This is an array of Strings, one cell for each column name declared in the TABLE clause of the table function's CREATE FUNCTION statement. Java DB fills a cell with its column name only if the column is referenced by the invoking query. This includes references in the SELECT list, the WHERE clause, or any other query clause. The query above references EMP_ID, FIRST_NAME, and LAST_NAME. So when Java DB calls initScan(), Java DB passes a String array with 5 cells and Java DB only fills in the first 3 cells, corresponding to the columns mentioned in the query. The trailing 2 cells are filled with NULL. fragments from the WHERE clause – Java DB examines the WHERE clause of the query, looking for fragments which compare table function columns to constant values. The query above has one such fragment: "emp_id = 2". Java DB wraps these fragments in a tree-shaped structure called a Restriction and passes the Restriction to initScan(). (Note that Java DB considers ? parameters to be constant values since the ?s have to be filled by the time that Java DB runs the query.) For more information on restricted table functions, please consult the following resources: Developer's Guide – See the section titled "Writing restricted table functions". Java DB javadoc – See the javadoc for RestrictedVTI and Restriction. ForeignTable – In particular, see the implementation of the initScan() method in this class which is bundled in the accompanying tar file. A more sophisticated version of ForeignTable can be found in the ForeignTableVTI class attached to DERBY-4962. ForeignTableVTI is useful for data migration as well as ongoing integration of data from a foreign database. That class supplies the following functionality: Foreign schema introspection – ForeignTableVTI supplies a database procedure which examines all of the tables in a schema in a foreign database. The procedure then declares a restricted table function for each foreign table and a view which hides the parameters needed to invoke the table function. Restricted table function – ForeignTableVTI also supplies a slightly more sophisticated version of ForeignTable. In this whitepaper we explored table functions, a feature introduced in Java DB release 10.4.1.3. We also explored restricted table functions, a feature introduced in Java DB release 10.6.1.0. Table functions let you run expressive SQL queries against arbitrary data. It's easy to write table functions. All you have to do is: wrap – Write a public static method which returns a JDBC ResultSet. This is particularly simple if the enclosing class extends one of the helper classes supplied in the accompanying jar file. The returned ResultSet loops through your external data, making rows out of records or objects. declare – Use the CREATE FUNCTION statement to tell Java DB where your public static method lives. invoke – From then on, query your external data just like a table or view in your Java DB database. For more information on table functions, please see the section titled “Programming Derby-style table functions” in Java DB's Developer's Guide.
http://www.oracle.com/technetwork/java/javadb/tablefunctionswhitepaper-156705.html
CC-MAIN-2016-26
refinedweb
4,082
55.74
riggerlib 1.1.7 An event hook framework Introduction Rigger is an event handling framwork. It allows for an arbitrary number of plugins to be setup to respond to events, with a namspacing system to allow data to be passed to and from these plugins. It is extensible and customizable enough that it can be used for a variety of purposes. Plugins The main guts of Rigger is around the plugins. Before Rigger can do anything it must have a configured plugin. This plugin is then configured to bind certain functions inside itself to certain events. When Rigger is triggered to handle a certain event, it will tell the plugin that that particular event has happened and the plugin will respond accordingly. In addition to the plugins, Rigger can also run certain callback functions before and after the hook function itself. These are call pre and post hook callbacks. Rigger allows multiple pre and post hook callbacks to be defined per event, but does not guarantee the order that they are executed in. Let’s take the example of using the unit testing suite py.test as an example for Rigger. Suppose we have a number of tests that run as part of a test suite and we wish to store a text file that holds the time the test was run and its result. This information is required to reside in a folder that is relevant to the test itself. This type of job is what Rigger was designed for. To begin with, we need to create a plugin for Rigger. Consider the following piece of code: from riggerlib import RiggerBasePlugin import time class Test(RiggerBasePlugin): def plugin_initialize(self): self.register_plugin_hook('start_test', self.start_test) self.register_plugin_hook('finish_test', self.finish_test) def start_test(self, test_name, test_location, artifact_path): filename = artifact_path + "-" + self.ident + ".log" with open(filename, "w") as f: f.write(test_name + "\n") f.write(str(time.time()) + "\n") def finish_test(self, test_name, artifact_path, test_result): filename = artifact_path + "-" + self.ident + ".log" with open(filename, "w+") as f: f.write(test_result) This is a typical plugin in Rigger, it consists of 2 things. The first item is the special function called plugin_initialize(). This is important and is equivilent to the __init__() that would usually be found in a class definition. Rigger calls plugin_initialize() for each plugin as it loads it. Inside this section we register the hook functions to their associated events. Each event can only have a single function associated with it. Event names are able to be freely assigned so you can customize plugins to work to specific events for your use case. The register_plugin_hook() takes an event name as a string and a function to callback when that event is experienced. Next we have the hook functions themselves, start_test() and finish_test(). These have arguments in their prototypes and these arguments are supplied by Rigger and are created either as arguments to the fire_hook() function, which is responsible for actually telling Rigger that an even has occured, or they are created in the pre hook script. Local and Global Namespaces To allow data to be passed to and from hooks, Rigger has the idea of global and event local namespaces. The global values persist in the Rigger instance for its lifetime, but the event local values are destroyed at the end of each event. Rigger uses the global and local values referenced earlier to store these argument values. When a pre, post or hook callback finishes, it has the opportunity to supply updates to both the global and local values dictionaries. In doing this, a pre-hook script can prepare data, which will could be stored in the locals dictionary and then passed to the actual plugin hook as a keyword argument. When a hook function is called, the local values override global values to provide a single set of keyword arguments that are passed to the hook or callback. In the example above would probably fire the hook with something like this: rigger.fire_hook('start_test', test_name="my_test", test_location="var/test/") Notice that we don’t specify what the artifact_path value is. In the concept of testing, we may want to store multiple artifacts and so we would not want each plugin to have to compute the artifact path for itself. Rather, we would create this path during a pre-hook callback and update the local namespace with the key. So the process of events would follow like so. - Local namespace has {test_name: “my_test”, test_location: “var/test”} - Prehook callback fires with the arguments [test_name, test_location] - Prehook exits and updates the local namespace with artifact_path - Local namespace has {test_name: “my_test”, test_location: “var/test”, artifact_path: “var/test/my_test”} - Hook ‘start_test’ is called for the ‘test’ plugin with the arguments [test_name, test_location, artifact_path] - Hook exits with no updates - Posthook callback fires with the arguments [test_name, test_location, artifact_path] - Posthook exits See how the prehook sets up a key value which is the made available to all the other plugin hooks. TCP Server Rigger comes with a TCP server which can be started up to allow either non-Python or remote machines to still communicate with the Rigger process. Rigger has a client that can be imported to use within Python projects, called RiggerClient. An instance of the RiggerClient is initialised with a server address and port like so: from riggerlib import RiggerClient rig_client = RiggerClient('127.0.0.1', 21212) Events can then be fired off in exactly the same way as before with the fire_hook method, which emulates the same API as the in-object Rigger instance. Internally the data is converted to JSON before being piped across the TCP connection. In this way data sent over the TCP link must be JSON serializable. The format is as follows: {'hook_name': 'start_session', 'data': {'arg1': 'value1', 'arg2': 'value2' } } Queues and Backgrounding Instances Rigger has two queues that it uses to stack up hooks. In the first instance, all hooks are delivered into the _global_queue. This queue is continually polled in a separate thread and once an item is discovered, it is processed. During processing, after the pre-hook callback, if it is discovered that the plugin instance has the background flag set, then the hook is passed into the _background_queue to be processed as and when in a separate thread. In this way tasks like archiving can be dealt with in the background without affecting the main thread. Threading There are three main threads running in Rigger. The main thread, which will be part of the main loop of the importing script, the background thread, and the global queue thread. During hook processing an option is available to thread and parallelise the instance hooks. Since Rigger doesn’t guarantee the order of plugin instances processing anyway, this is not an issue. If order is a concern, then please use a second event signal. Configuration Rigger takes few options to start, it, an example is shown below: squash_exceptions: True threaded: True server_address: 127.0.0.1 server_port: 21212 server_enabled: True plugins: test: enabled: True plugin: test - squash_exceptions option tells Rigger whether to ignore exceptions that happen inside the fire_hook() call and just log them, or if it should raise them. - threaded option tells Rigger to run the fire_hook plugins as threads or sequentially. - server_address option tells Rigger which ip to bind the TCP server to. - server_port option tells Rigger which port to bind the TCP server to. - server_enabled option tells Rigger if it should run up the TCP server. - Downloads (All Versions): - 194 downloads in the last day - 749 downloads in the last week - 3679 downloads in the last month - Author: Pete Savage - Keywords: event,linux,hook - License: PSF - Categories - Package Index Owner: psav - Package Index Maintainer: Sean.Myers - DOAP record: riggerlib-1.1.7.xml
https://pypi.python.org/pypi/riggerlib/1.1.7
CC-MAIN-2016-07
refinedweb
1,287
61.56
Vector library - update topo for areas (lower level functions) More... #include <stdlib.h> #include <grass/Vect.h> #include <grass/glocale.h> Go to the source code of this file. Vector library - update topo for areas (lower level functions) Lower level functions for reading/writing/manipulating vectors. This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. Definition in file plus_area.c. Allocate space for new area and create boundary info from array. Then for each line in area, update line (right,left) info. Neither islands nor centroids area filled. Definition at line 173 of file plus_area.c. References tools::box, dig_alloc_area(), dig_alloc_areas(), dig_area_alloc_line(), dig_area_set_box(), dig_box_copy(), dig_box_extend(), dig_line_add_updated(), dig_line_get_box(), dig_spidx_add_area(), G_debug(), G_warning(), and NULL. Referenced by Vect_build_line_area(). Allocate space for new island and create boundary info from array. The order of input lines is expected to be counter clockwise. Then for each line in isle, update line (right,left) info. Area number the island is within is not filled. Definition at line 634 of file plus_area.c. References tools::box, dig_alloc_isle(), dig_alloc_isles(), dig_box_copy(), dig_box_extend(), dig_isle_alloc_line(), dig_isle_set_box(), dig_line_add_updated(), dig_line_get_box(), dig_spidx_add_isle(), G_debug(), G_warning(), and NULL. Referenced by Vect_build_line_area(). Find number line of next angle to follow an line. Assume that lines are sorted in increasing angle order and angles of points and degenerated lines are set to 9 (ignored). Definition at line 474 of file plus_area.c. References python.core::debug_level, G__getenv(), G_debug(), and NULL. Referenced by dig_build_area_with_line(), dig_node_angle_check(), and V2_delete_line_nat(). Add isle to area if does not exist yet. Definition at line 253 of file plus_area.c. References dig_area_alloc_isle(), G_debug(), G_fatal_error(), and NULL. Referenced by Vect_attach_isle(). Delete isle from area. Definition at line 290 of file plus_area.c. References G_debug(), G_fatal_error(), and NULL. Referenced by dig_del_isle(). Set area bounding box. Definition at line 441 of file plus_area.c. Referenced by dig_add_area(). Build topo for area from lines. Area is built in clockwise order. Take a given line and start off to the RIGHT/LEFT and try to complete an area. Possible Scenarios: After we find an area then we call point_in_area() to see if the specified point is w/in the area Old returns -1: error 0: no area (1: point in area) -2: island !! Definition at line 49 of file plus_area.c. References python.core::debug_level, dig__falloc(), dig__frealloc(), dig_angle_next_line(), dig_node_angle_check(), dig_node_line_angle(), dig_out_of_memory(), G__getenv(), G_debug(), and NULL. Referenced by Vect_build_line_area(). Delete area from Plus_head structure. This function deletes area from the topo structure and resets references to this area in lines, isles (within) to 0. Possible new area is not created by this function, so that old boundaries participating in this area are left without area information even if form new area. Not enabled now: If area is inside other area, area info for islands within deleted area is reset to that area outside. (currently area info of isles is set to 0) Definition at line 341 of file plus_area.c. References dig_line_add_updated(), dig_spidx_del_area(), G_debug(), G_fatal_error(), G_warning(), and NULL. Referenced by V2_delete_line_nat(). Delete island from Plus_head structure. Reset references to it in lines and area outside. Definition at line 746 of file plus_area.c. References dig_area_del_isle(), dig_line_add_updated(), dig_spidx_del_isle(), G_debug(), G_fatal_error(), and NULL. Referenced by V2_delete_line_nat(). Set isle bounding box. Definition at line 720 of file plus_area.c. Referenced by dig_add_isle(). Checks if angles of adjacent lines differ. Negative line number for end point. Assume that lines are sorted in increasing angle order and angles of points and degenerated lines are set to 9 (ignored). Definition at line 578 of file plus_area.c. References dig_angle_next_line(), dig_node_line_angle(), and G_debug(). Referenced by dig_build_area_with_line().
http://grass.osgeo.org/programming6/plus__area_8c.html
crawl-003
refinedweb
600
62.54
Journal Journal: For all you people who logged on Slashdot (East coast) after the ball dropped... ...happy new year. But seriously we all have an addiction... ...happy new year. But seriously we all have an addiction... After a late night with the friends, I am eager to begin the final parts of my "education" this coming week...go JMU dukes. "I welcome our new ________ overlords" Should be shot on sight. It's not funny unless its entirely irrelevant and original. Every time an article is posted about some animal or robot, we do not need this posting! After that nuke the oil spill article, I would really love to see a modern day nuclear explosion with our camera technologies. Furthermore, since it would be planned, much geological effects could be carefully measured, perhaps providing intelligence into detecting (*cough* North Korea) other nuclear explosions. Lastly it should be noted, how many times have you thought the phrase: "aww just nuke it!", and the possibility that this could be used: awesome. _public class Bored{ ___public Object value; ___public Object next; ___public void entertain(){ __________throws WhiteNoiseException ______Bored temp = new Bored(); ______value = Google.fetch(); ______next = temp; ______if(entertain.value == null) __________temp.entertain; }} (The linked list from hell) Computer Science is merely the post-Turing decline in formal systems theory.
https://slashdot.org/users2.pl?uid=1800118&view=userjournal&fhfilter=%22author%3Amasterwit%22+journal&startdate=2011
CC-MAIN-2017-30
refinedweb
216
59.7
Hello everyone, I created a program that check's if the input is a palindrome, if it is, it returns true, else it is false. ( I must use recursion) This is my code: str="abaa" def is_palindrome(str): n=len(str) if n==0: return True if str[n-1]==str[-n]: is_palindrome(str[-(n)+1:n-1]) return True else: return False Now, the problem is, that for some reason, it does not work properly. I checked it on python tutor, and for some reason unknown to me, it made all the inputs as true. I thank you very much for your help.
http://forums.devshed.com/python-programming-11/help-python-recursion-954076.html
CC-MAIN-2015-32
refinedweb
104
74.22
Details Description The current thrift version is virtually useless because it's not getting updated when backward compatibility is broken (it's always 20080411-exported on all the snapshots,) I can't just tell people to use the trunk and not breaking things due things like namespace changes etc. Many projects maintain a reasonable versioning scheme even when system is in alpha state. Thrift overall is stable enough to warrant a working versioning scheme. Can we at least start to discuss a version scheme, e.g., major.minor.patch or major.minor.micro.patch, where patch number changes are bug fixes and minor or micro are backward compatible changes and major changes indicate breaking backward compatibility or just marketing hype. I propose that we call the current thrift version 1.0.0.0 after all the namespace changes and stick to a reasonable scheme instead of using suffixes (like beta<n>/rc<n> etc.) as it's much friendlier to other components that uses thrift. Issue Links - is depended upon by THRIFT-1259 Automate versioning - Closed - is related to - Activity - All - Work Log - History - Activity - Transitions
https://issues.apache.org/jira/browse/THRIFT-274?page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel
CC-MAIN-2016-07
refinedweb
186
54.42
The problem involves loading many entity beans and is one that was also encountered by a Sun representative who visited us recently. We deal with pharmaceutical data. One typical data type represents a DNA sequence. As a sequence represents a row in the database the obvious modeling choice is to make a sequence an entity bean. When you do an ejbFindBy on the entity bean it is possible to get hundreds or thousands of primary keys returned. The container then calls load with each primary key. The problem is that for every load call there is at least one database call instead of just one call that loads all the data for the primary keys at once. So many database calls is very slow. Furthermore there are typically hundreds of thousands or millions of sequences in these databases so smart caching would be a problem. For example if we wanted to show all the sequences returned in a graph we have to load all of the entity beans with all of their data. We overcame this by creating a session bean that returns lightweight pass by value objects containing only the data that was needed for displaying them in the graph. Each PBV contained a reference so that it could navigate to the real bean if necessary, (to update it for example). The Sun rep who visited us had implemented an airline booking system over the reference implementation. The final stage of the booking system involved drawing a picture of an airplane superimposing all the reserved seats on top of it. Each seat was represented by an entity bean and as there are around 400 seats on a 747 this was taking quite a while! Their solution was to provide a session bean returning pass by value versions of the seat data, i.e. a similar solution to ours. Would anyone like to comment on the ideal solution to this problem? It seems like a bit of a hack to EJB model having to create lightweight PBVs of the real thing! Problem with loading many entity beans. (13 messages) - Posted by: Jeremy Dickson - Posted on: June 13 2000 11:48 EDT Threaded Messages (13) - Problem with loading many entity beans. by Floyd Marinescu on June 13 2000 13:14 EDT - Problem with loading many entity beans. by Subrahmanyam Allamaraju on June 13 2000 19:28 EDT - Problem with loading many entity beans. by Jeremy Dickson on June 14 2000 06:16 EDT - Problem with loading many entity beans - from Value to Entity? by Subrahmanyam Allamaraju on June 14 2000 09:21 EDT - Use Command Pattern? by Michael Bushe on June 15 2000 10:56 EDT - Re: Use Command Pattern? by Subrahmanyam Allamaraju on June 15 2000 02:20 EDT - Re: Use Command Pattern? by Jeremy Dickson on June 16 2000 10:08 EDT - Reality Kicks In by Michael Bushe on June 19 2000 02:48 EDT - Re: Use Command Pattern? by Jeff Gutierrez on June 22 2000 02:59 EDT - Re: Use Command Pattern? by Vicki Bell on June 30 2000 10:46 EDT - Re: Use Command Pattern? by Ed Robinson on July 25 2000 05:17 EDT - Re: Use Command Pattern? by Saravanan Thangaraju on May 03 2002 05:50 EDT - Problem with analysis model? by Stephane Boisson on June 14 2000 09:02 EDT Problem with loading many entity beans.[ Go to top ] Jeremy, - Posted by: Floyd Marinescu - Posted on: June 13 2000 13:14 EDT - in response to Jeremy Dickson Most containers won't load the bean until a business method is called. So if you query 100,000 entity beans, they won't be loaded until a business method (such as the method to get a value object) is called. If you do get a value object for every item in the resultset, then the following optimizations could help: 1) There may be CMP implementations that perform bulk loads. 2) Use dbIsShared. <-- forces app. server to cache entity bean state in memory, make second call for same data VERY FAST. 3) Not use entity beans. You may also consider using JDBC to show just the data you need for your particular usecase, and load your entity beans when you want more information, such as information about a particular sequence. You may be wondering why EJB requires n+1 database calls. This happens in order to support entity caching. That is, the finders return a set of primary keys so that the app.server can return a reference to an entity bean that it had allready stored in memory. This will really speed up most deployments, but I guess it would also slow down others like yours which only query particular subsets of data once in a while. But then again, for a system like the one you are building, you probably have the budget for a mega machine with globs of memory, so maybe you can take advantage of caching after all. Floyd Problem with loading many entity beans.[ Go to top ] - Posted by: Subrahmanyam Allamaraju - Posted on: June 13 2000 19:28 EDT - in response to Jeremy Dickson By modeling each sequence as an entity bean, the expectation is to have one "remote" business object per sequence. In the scenario you explained, one of the applications of these beans to construct a graph. In such cases, I'm not sure if a sequence can be modeled as an entity. In fact, if the data that a sequence represents is not transactional, what's the need for defining this as an entity. If caching is the sole objective, caching dependent objects is much more simpler and more effective in this case. So I think a better alternative is to model these as dependent objects. I also consider the airline example a bad candidate for demonstrating entity beans. In this case, each object represents some data with one of the attributes representing if a seat is reserved. A better choice would be to model these as dependent objects. As long as you model such collections as entities, the problem of n+1 calls can not be solved, since each sequence entity will be loaded by a finder, and the finder will have to make atleast one trip to the database. - Subrahmanyam Problem with loading many entity beans.[ Go to top ] In the case of drawing a graph with these sequences, it would seems sensible alright to have them as dependant objects. However there are other times when you might want to update these remote objects, i.e. you would genuinely need a transactional remote object. - Posted by: Jeremy Dickson - Posted on: June 14 2000 06:16 EDT - in response to Subrahmanyam Allamaraju Perhaps a better way would be to write a 'Value' object (the pattern in which a normal Java class implements the business interface and the entity bean extends it). These Value objects could be returned from a session bean. If one needed to update a sequence it would probably be possible to navigate to the entity bean. I was thinking about the ejbFind methods as the way that one must navigate to this data. But I suppose it would be ok to get a session bean to return representations of this data as value objects. Session beans generally carry out business logic so this bean could be though of as carrying out a specific piece of logic- retuning sequence data to plot a graph. Any comments?! Problem with loading many entity beans - from Value to Entity?[ Go to top ] - Posted by: Subrahmanyam Allamaraju - Posted on: June 14 2000 09:21 EDT - in response to Jeremy Dickson I disagree with the idea of navigating from value objects to respective entities. From an implementation point of view, this could mean embedding remote object handles/references in the Value object. This reduces the utility of the value object. Apart from this, we should be able to transport Value objects from VM to VM safely with no awareness or concern for EJBs. - Subrahmanyam Use Command Pattern?[ Go to top ] Without knowing too much about what you are doing (and still at the very beginning of my first EJB impl) it seems like a command pattern implementation would help you. - Posted by: Michael Bushe - Posted on: June 15 2000 10:56 EDT - in response to Subrahmanyam Allamaraju How about something like this: Use the ejbFind to get the Sequence. The Sequence has value objects that can quickly and easily share your data. Then use a session bean called SequenceService (or SequenceManager) which has a method like modifySequence(SequencePK, newSequenceValueData); I think this also gives you the right transactional level (um, I don't mean isolation level, I mean it does the right number of steps as one transaction). I suppose you will update the Sequence a number of times and then say - "Yup, save that baby". This would make versioning of sequences easier as well if that is ever a requirement (but if YouArentGonnaNeedIt, don't worry about it). I plan doing alot of things this way, but I'm not sure of all the issues I'll run into yet. Thought folks? Also, in this case why use EJB at all? Where is the value-add over a JDBC connection.commit() and rollback()? Especailly if you have a lot of infrequently used data. Michael Re: Use Command Pattern?[ Go to top ] - Posted by: Subrahmanyam Allamaraju - Posted on: June 15 2000 14:20 EDT - in response to Michael Bushe Though I get the general idea of your excellent (I mean it) solution, I would like to extend it. - Model the collection of sequences as an entity, and each sequence as a value object. - Provide accessors and modifiers on the entity to operate on sequences. Of course, you are better modeling the collection as an entity to benefit from container-managed semantics on the collection. The moral of the story seems to be - Don't apply client-side OO modeling principles on the server side. Subrahmanyam Re: Use Command Pattern?[ Go to top ] Thanks for all your replys! - Posted by: Jeremy Dickson - Posted on: June 16 2000 10:08 EDT - in response to Subrahmanyam Allamaraju I agree with your solution of having a collection bean and also your moral! However, how does the entity bean rule of thumb hold that there should be one entity bean per row in the database? As it happens one sequence does correspond to one entry in the database (it's not dependant on anything else) and having a sequence entity bean would seem obvious. How does a collection entity bean relate to this rule? Is this reality kicking in? Jeremy. Reality Kicks In[ Go to top ] The EntityBean rule of thumb is that EntityBeans should be course-grained, not fine-grained. So in fact, you do not want one row per entity bean. - Posted by: Michael Bushe - Posted on: June 19 2000 14:48 EDT - in response to Jeremy Dickson I'd like to hear more about the data involved, but here's my guess at what it would look like (should look like?), given a very poor-man's knowledge of genetics: public class SequenceEntity { String subjectId; //matches the sequence to an animal type, or particular lab rat List sequenceOrder;//the list of sequence members . . . } public class SequenceMember{ chromosomeNumber;//some higher level ordering, or maybethe sequenceOrderAbove is a List of Lists by Gene sequenceNumber;//the number of this base in the sequence baseLetter;//AGCT or U is the domain } So even though each row might look like this: animalId, chromo#, seqNumber, baseLetter There are actually many fewer entity beans than rows. In any case, there is one large Entity consisting of smaller parts. Both are stored in the table. But perhaps you have another table for which additional, high level information is stored - this is the entity and the sequence table is a dependent object. Depending on your analysis (lookjing for patterns in the entire sequence vs. trying to fill in specific parts of a sequence), you may want to have another level between big entity and the dependent List (such as chromosome, etc.), and this could be a candidate for your entity. I also think this is EJB 1.1 reality kicking in. The 2.0 spec (see the Javaworld article) talks about how in EJB 2.0 (supposedly downloaded in beta now from BEA - that's exciting), manages these dependant collections for you. one caveat - so far it looks like COllection is the only collection you get, though you definately need a List. I have a major issue with only being able to pass Collections back and forth, I suppose it is a question of how to deal with how the container is supposed to order it. I think even getting a dependent collection back and ordering it yourself later may be sufficient. How this helps. Hope to hear more. Michael Bushe Re: Use Command Pattern?[ Go to top ] You should really devite from the notion that a row in the table should be respresented as an EntityBean. In your particular case, I don't think it is necessary to make a Sequence an EntityBean since it does not need any transactional features of an EntityBean. You don't need the overhead of using EntityBeans if your objects are read-only. - Posted by: Jeff Gutierrez - Posted on: June 22 2000 02:59 EDT - in response to Jeremy Dickson I'm currently implementing a web-based catalog repository for use of our commerce server. I initially implemented Item as an EntityBean. This worked fine when I was using our sample database contain only 1k items. But when we tested it in a full database with 500k items, the server went to a grinding halt when users came in and made simultaneous searches. Faced with this, I changed my design. I provided a stateless session bean (Catalog) that does nothing but service search requests from users. I also converted the Item EntityBean to a vanilla Java class. The Catalog returns a collection of Item objects which were fetched from the DB. Re: Use Command Pattern?[ Go to top ] The advantage of using an entity bean, whether it is to represent a single row of data or a collection of data, is that once it has been instantiated, no database access is required to retreive data from it. - Posted by: Vicki Bell - Posted on: June 30 2000 10:46 EDT - in response to Jeff Gutierrez The principle is that since there is only one instance of the entity bean that is shared between all users and providing all updates to the data it represents (one or multiple rows) are done via the entity bean, its cached data is always in synch with the datebase. Therefore transactions are not required for read-only business methods. I think the decision on whether or not to use an entity bean should be based on whether it represents a set of data that is frequently 'used' and is not so big that it is unrealistic for it to be permanently cached in the server, rather than whether it represents a set of data that is more often read than updated. Re: Use Command Pattern?[ Go to top ] Vicki, - Posted by: Ed Robinson - Posted on: July 25 2000 17:17 EDT - in response to Vicki Bell Does that mean that if it's frequently used then it is a good candidate for an entity bean, or the opposite? Re: Use Command Pattern?[ Go to top ] Let's put your words in a different way. More than frequently, if it is prone to concurrency issues we can go for a perfect Enterprise JavaBean. - Posted by: Saravanan Thangaraju - Posted on: May 03 2002 17:50 EDT - in response to Ed Robinson Also it is a very good idea to have Read only Data as normal value object instead of having it as an EJb. Problem with analysis model?[ Go to top ] Maybe the "the obvious modeling choice is to make a sequence an entity bean" is not the right choice for your architecture. - Posted by: Stephane Boisson - Posted on: June 14 2000 09:02 EDT - in response to Jeremy Dickson I am not an expert in genetics so I cannot really help you, but I strongly advise you to make to follow a analysis & design process to make choice about what to put in EJBs.. If you've already done that, take a look at the pattern described at
http://www.theserverside.com/discussions/thread.tss?thread_id=47
CC-MAIN-2015-18
refinedweb
2,747
61.06
We’ve just finished migrating our infrastructure completely from Heroku to AWS. There are a ton of awesome benefits we will get from this switch, but one I want to specifically talk about here is scheduled tasks. To run our “scheduled tasks” (aka cron tasks) we mostly relied on Heroku Scheduler. This is a super simple add-on to Heroku that you can use to run tasks on one of their predefined frequencies. This tool was too limiting for us because: - The only interval choices you have are “Daily”, “Hourly” or “Every 10 minutes”, meaning there’s no way to run a job every minute (it’s still completely unclear to me why this is so limited and why these were the options they landed on 🤷) - There’s no way to see execution statistics or history beyond “Last Run” - Built for your Heroku app, which only allows you to run scheduled tasks within your Heroku app environment (Rails in our case) - These tasks are solely managed through the Heroku Scheduler Dashboard (web UI), not in source control So, when planning out how to move the scheduled task infrastructure to AWS, we put together this list of requirements: - Schedules must be configured / managed in code. This is helpful for keeping track of all the running scheduled tasks in one place, and having a history in git of previous task schedules - Schedules should support cron scheduler syntax for maximum flexibility - Each task should have a unique lock, to prevent two instances of the same task from running concurrently - Support for multiple app environments and not just rake tasks - Failure alerts and monitoring One option was to run a Cron process somewhere and kick off jobs on defined schedules based on the crontab. This would work, but would require more overhead as it’s basically the same as starting a new app service that we would have to maintain. What runtime environment would it run in? How would it start new jobs? How would we update and configure the schedule through code? What happens if that process was killed or fails? Because of the added complexity of maintaining a running cron process with no simple way to manage it given our requirements, we decided to try a solution of running tasks on ECS and scheduling them using Cloudwatch events. We were already in the process of moving our app servers to ECS, so piggy-backing off of some of the work we were already putting into running our application(s) in ECS made a lot of sense for scheduled tasks. ECS doesn’t have a built-in solution for this use case, but we could take advantage of a bunch of AWS services and put them together to get exactly what we wanted. With AWS, once you buy in, there are a ton of awesome tools at your disposal that work really nicely together. Our solution we came up with uses a combination of Cloudwatch, Lambda, DynamoDB and ECS. The basic structure looks something like this, and I’ll go into detail about each component below: Cloudwatch Events to Trigger the Task on a Schedule We use Cloudwatch Event Rules to trigger a lambda function on a schedule of our choosing. This is way more expressive than the Heroku Scheduler, and supports both cron expressions and rate expressions, which allows us to define “every 5 minutes” in two ways: cron(0/5 * * * ? *) means “run every 5 minutes on the multiple of 5th minute (:00, :05, :10, etc), or rate(5 minutes)which means “run every 5 minutes starting from when the event rule was created”. The rate expressions are just nice because they’re easier to understand at a quick glance if you don’t care about exactly when the task runs. Lambda Function to Bridge the Gap Between the Event Trigger and the ECS Task This step is really only necessary to bridge the gap between the Cloudwatch Event and the ECS Task. Unfortunately, Cloudwatch Events can trigger Lambda functions but not ECS tasks, so we use a Lambda function that mostly just forwards the request to the ECS task: import boto3 import os def event_handler(event, context): """ Lambda function that will run a task on ECS with the given command on the given task definition family. The ECS task will run a wrapper script that handles the dynamodb lock and will exit if the task is already running. """ ecs_client = boto3.client('ecs') cluster_arn = os.environ['ECS_CLUSTER_ARN'] task_definition_family = os.environ['ECS_TASK_DEFINITION_FAMILY'] container_name = os.environ['CONTAINER_NAME'] task_name = os.environ['SCHEDULED_TASK_NAME'] command = os.environ['SCHEDULED_TASK_COMMAND'] function_name = os.environ['AWS_LAMBDA_FUNCTION_NAME'] task_command = [ '/usr/local/bin/scheduled_task_runner.py', # This wrapper scripts handles the locking code '--task_name', task_name, command, ] task_definition = get_task_definition(ecs_client, task_definition_family) response = ecs_client.run_task( cluster=cluster_arn, taskDefinition=task_definition, startedBy="{}/{}".format(function_name, context.aws_request_id)[0:36], overrides={'containerOverrides': [ { 'name': container_name, 'command': task_command, } ]} ) if response['failures']: raise RuntimeError("Failure for task name {}".format(task_name)) return {"completed": True} def get_task_definition(client, family): task_definition = client.describe_task_definition(taskDefinition=family) if not task_definition: raise ValueError("Unable to find task definition corresponding to {}".format(family)) revision = task_definition['taskDefinition']['revision'] return "{}:{}".format(family, revision) view rawrun_scheduled_task.py hosted with ❤ by GitHub Running Tasks on ECS We have a few services already set up using ECS, so we take advantage of the pre-defined task definitions for our web apps, and the container overrides to override the command that we want to run (for example, bundle exec rake send_nightly_analytics_email). This is nice because we don’t have to spin up new instances for the scheduled tasks to run, they run in the same ECS cluster as all of our other services and tasks and use the same IAM roles and permissions. DynamoDB as a Lock At this point most of the basic requirements are met by using Cloudwatch, Lambda and ECS to run tasks on a defined schedule. Next, we need to ensure that every tasks can only be run once at any given time, so we need some sort of global lock. For that, we use DynamoDB, which is a NoSQL database service run on AWS. It can be used as a lock by taking advantage of its conditional updates. import boto3 import datetime import logging import sys import traceback from contextlib import contextmanager logger = logging.getLogger() class DynamoDBLock(object): def __init__(self, lock_name, dynamodb_table_name, **session_kwargs): self.lock_name = lock_name self.should_release_lock_when_done = True self.dynamodb_table_name = dynamodb_table_name self.dynamodb = boto3.session.Session(**session_kwargs).client('dynamodb') @contextmanager def lock(self): self._obtain_lock() try: yield self.release_lock() except Exception as e: # Explicitly *not* releasing the lock when there is a failure, until an # engineer can fix the root issue and manually release the lock. # To have the lock released on erors, add a `finally` block and call # `release_lock` from there. logger.error("Exception {} {} raised, not releasing lock {}".format( e, e.message, self.lock_name)) traceback.print_exc() def _obtain_lock(self): try: self.dynamodb.put_item( TableName=self.dynamodb_table_name, Item={ 'LockType': {'S': self.lock_name}, 'LockedAt': {'S': datetime.datetime.utcnow().isoformat()}, }, # This will fail if the lock cannot be obtained ConditionExpression='attribute_not_exists(LockType)' ) except boto3.exceptions.botocore.exceptions.ClientError as e: err_msg = e.response['Error']['Message'] e.response['Error']['Message'] = "{} - unable to obtain {} lock".format( err_msg, self.lock_name) raise type(e), type(e)(e.response, e.operation_name), sys.exc_info()[2] def release_lock(self): if self.should_release_lock_when_done: try: self.dynamodb.delete_item( TableName=self.dynamodb_table_name, Key={'LockType': {'S': self.lock_name}} ) except boto3.exceptions.botocore.exceptions.ClientError as e: err_msg = e.response['Error']['Message'] e.response['Error']['Message'] = "{} - unable to release {} lock".format( err_msg, self.lock_name) raise type(e), type(e)(e.response, e.operation_name), sys.exc_info()[2] view rawdynamodb_lock.py hosted with ❤ by GitHub By using Python’s contextmanager, this lock can be used to wrap any block of code like this: merge_lock = DynamoDBLock(lock_name, dynamodb_table_name, region_name=’us-east-1′) with merge_lock.lock(): # Run scheduled task… The great thing about Dynamodb is that it’s accessible from any app or service running within our AWS infrastructure — so it’s not app-specific. Terraform Looking at the process like this makes it seem really complex — is it really worth the added complexity of setting up each task like this? Yes! We wouldn’t dream of setting up something like this without the help of Terraform. One of the main benefits of moving off of Heroku and onto AWS was the ability to manage our infrastructure as code (and it was one of the requirements of this scheduled task project). By taking advantage of Terraform modules, we were able to package up all the resources required for a task to the point where creating a new scheduled task looks like: module "send_daily_report" { source = "git@github.com:finventures/lambda-ecs-scheduled-task" task_name = "send_daily_report" # Unique name, to use for locking command = "bundle exec rake send_daily_report" # The actual command to be run event_schedule = "cron(0 7 * * ? *)" # This schedule represents "Daily at 7:00 GMT" ecs_cluster_arn = "${var.ecs_cluster_arn}" # ECS Cluster to run the task in task_definition_family = "${var.task_def_family}" # Task definition for ECS container_name = "${var.ecs_container_name}" # ECS container name to run the task in lambda_role_arn = "${var.lambda_role_arn}" # The IAM role used by the lambda function locks_table_name = "ScheduledTaskLocks" # The DynamoDB table, used for locking is_enabled = "true" # Enable or disable the Cloudwatch event } view rawgistfile1.txt hosted with ❤ by GitHub You can see the full Terraform module here. One decision we explicitly are making here is that the schedules for these tasks are not coupled with our Rails app code. Some engineers brought that up as a concern because they felt that it should work that way, but we decided against it because: - This module can be used for multiple apps/services, so coupling it with our Rails code limits our ability to do that - The tasks themselves should be defined as part of app code, but the schedules to run them make more sense as infrastructure - The ability to turn tasks on or off without a full app deploy is powerful Lessons Learned / Benefits we’ve enjoyed thus far… Monitoring There were two scheduled jobs that were running on Heroku Scheduler for over a year that were running rake tasks that were no longer defined in our codebase. Because of the enhanced logging and alerting we get from our own scheduler, these became immediately obvious — and we fixed up all the errors within the first hour of launching. ##Locking We had an implementation of a Postgresql lock within our Rails code that we needed to remember to add to each rake task that “needed” it. The problem was that we were relying on every engineer to know to wrap their rake task definition with the lock, plus the lock in Postgresql was again limiting the lock to be Rails-app specific. The forced locking in the new system makes it impossible to accidentally run two jobs at the same time, plus the locks can be used for other services and apps within our AWS account. Reliability and Security AWS is super reliable, and it allows us to not worry about maintaining our own Cron server. By using IAM roles for each process, each role/process only has permissions to perform the actions that it needs to and no other permissions. By limiting actions to only the ones we expect, we limit the scope of what can go wrong when there is a bug or something else unexpected happens. — Greg Einfrank
https://m.fin.com/2017/05/12/how-to-build-a-robust-scheduled-task-cron-service-in-aws-using-cloudwatch-lambda-dynamodb-and-ecs/
CC-MAIN-2019-04
refinedweb
1,888
52.7
I have a function that perform a calc but i'm using a var to receive the value of a recursive function and i would like to avoid mutable variables. def scoreNode(node:Option[Tree], score:Double = 0, depth:Int = 0):Double = { node.map(n => { var points = score n.children.filter(n => n.valid == Some(true)).foreach(h => { points = scoreNode(Some(h), 10, depth+1) }) points }).getOrElse(score) } What you are essentially doing is summing something over all the nodes in a tree. Try to write a more idiomatic code, like this. def scoreNode(node:Option[Tree], depth:Int = 0):Double = (for { n <- node h <- n.children if h.valid == Some(true) res = scoreNode(Some(h), depth + 1) + scala.math.pow(0.8, depth) } yield res).sum I do not guarantee this works completely. It is your homework to make it right.
https://codedump.io/share/RjA7hAOVb2tQ/1/scala---avoid-use-mutable-variables
CC-MAIN-2017-17
refinedweb
142
70.9
.48 ! anton 6: @dircategory GNU programming tools ! 7: @direntry ! 8: * Gforth: (gforth). A fast interpreter for the Forth language. ! 9: @end direntry 1.4 anton 10: @comment @setchapternewpage odd 1.1 anton 11: @comment %**end of header (This is for running Texinfo on a region.) 12: 13: @ifinfo 1.43 anton 14: This file documents Gforth 0.3 1.1 anton 15: 1.43 anton 16: Copyright @copyright{} 1995-1997 Free Software Foundation, Inc. 1.1 anton 17: 18: Permission is granted to make and distribute verbatim copies of 19: this manual provided the copyright notice and this permission notice 20: are preserved on all copies. 21: 1.4 anton 22: @ignore 1.1 anton 23: Permission is granted to process this file through TeX and print the 24: results, provided the printed document carries a copying permission 25: notice identical to this one except for the removal of this paragraph 26: (this paragraph not being relevant to the printed manual). 27: 1.4 anton 28: @end ignore 1.1 anton: 1.24 anton 43: @finalout 1.1 anton 44: @titlepage 45: @sp 10 1.17 anton 46: @center @titlefont{Gforth Manual} 1.1 anton 47: @sp 2 1.43 anton 48: @center for version 0.3 1.1 anton 49: @sp 2 50: @center Anton Ertl 1.25 anton 51: @center Bernd Paysan 1.17 anton 52: @sp 3 53: @center This manual is under construction 1.1 anton 54: 55: @comment The following two commands start the copyright page. 56: @page 57: @vskip 0pt plus 1filll 1.43 anton 58: Copyright @copyright{} 1995--1997 Free Software Foundation, Inc. 1.1 anton 1.17 anton 83: Gforth is a free implementation of ANS Forth available on many 1.43 anton 84: personal machines. This manual corresponds to version 0.3. 1.1 anton 85: @end ifinfo 86: 87: @menu 1.4 anton 88: * License:: 1.17 anton 89: * Goals:: About the Gforth Project 1.4 anton 90: * Other Books:: Things you might want to read 1.43 anton 91: * Invoking Gforth:: Starting Gforth 1.17 anton 92: * Words:: Forth words available in Gforth 1.40 anton 93: * Tools:: Programming tools 1.4 anton 94: * ANS conformance:: Implementation-defined options etc. 1.17 anton 95: * Model:: The abstract machine of Gforth 1.43 anton 96: * Integrating Gforth:: Forth as scripting language for applications 1.17 anton 97: * Emacs and Gforth:: The Gforth Mode 1.43 anton 98: * Image Files:: @code{.fi} files contain compiled code 99: * Engine:: The inner interpreter and the primitives 1.4 anton 100: * Bugs:: How to report them 1.29 anton 101: * Origin:: Authors and ancestors of Gforth 1.4 anton 102: * Word Index:: An item for each Forth word 1.43 anton 103: * Concept Index:: A menu covering many topics 1.1 anton 104: @end menu 105: 1.47 anton 106: @node License, Goals, Top, Top 1.20 pazsan. 1.1 anton 497: 498: @iftex 499: @unnumbered Preface 1.23 pazsan 500: @cindex Preface 1.17 anton 501: This manual documents Gforth. The reader is expected to know 1.1 anton 502: Forth. This manual is primarily a reference manual. @xref{Other Books} 503: for introductory material. 504: @end iftex 505: 1.47 anton 506: @node Goals, Other Books, License, Top 1.1 anton 507: @comment node-name, next, previous, up 1.17 anton 508: @chapter Goals of Gforth 1.1 anton 509: @cindex Goals 1.17 anton 510: The goal of the Gforth Project is to develop a standard model for 1.43 anton 511: ANS Forth. This can be split into several subgoals: 1.1 anton 512: 513: @itemize @bullet 514: @item 1.43 anton 515: Gforth should conform to the Forth standard (ANS Forth). 1.1 anton: 1.17 anton 524: To achieve these goals Gforth should be 1.1 anton: 1.17 anton 540: Have we achieved these goals? Gforth conforms to the ANS Forth 541: standard. It may be considered a model, but we have not yet documented 1.1 anton 542: which parts of the model are stable and which parts we are likely to 1.17 anton. 1.1 anton 548: 1.43 anton 549: @node Other Books, Invoking Gforth, Goals, Top 1.1 anton 550: @chapter Other books on ANS Forth 1.43 anton 551: @cindex books on Forth 1.1 anton 552: 553: As the standard is relatively new, there are not many books out yet. It 1.17 anton 554: is not recommended to learn Forth by using Gforth and a book that is 1.1 anton 555: not written for ANS Forth, as you will not know your mistakes from the 556: deviations of the book. 557: 1.43 anton 558: @cindex standard document for ANS Forth 559: @cindex ANS Forth document 1.1 anton 560: There is, of course, the standard, the definite reference if you want to 1.19 anton 1.48 ! anton 571: @*@url{}. 1.1 anton 572: 1.43 anton 1.1 anton 578: introductory book based on a draft version of the standard. It does not 579: cover the whole standard. It also contains interesting background 1.41 anton 580: information (Jack Woehr was in the ANS Forth Technical Committee). It is 1.1 anton 581: not appropriate for complete newbies, but programmers experienced in 582: other languages should find it ok. 583: 1.43 anton 1.1 anton 591: 592: You will usually just say @code{gforth}. In many other cases the default 1.17 anton 593: Gforth image will be invoked like this: 1.1 anton 1.43 anton 612: @cindex -i, command-line option 613: @cindex --image-file, command-line option 1.1 anton 614: @item --image-file @var{file} 1.43 anton 615: @itemx -i @var{file} 1.1 anton 616: Loads the Forth image @var{file} instead of the default 1.43 anton 617: @file{gforth.fi} (@pxref{Image Files}). 1.1 anton 618: 1.43 anton 619: @cindex --path, command-line option 620: @cindex -p, command-line option 1.1 anton 621: @item --path @var{path} 1.43 anton 622: @itemx -p @var{path} 1.39 anton). 1.1 anton 628: 1.43 anton 629: @cindex --dictionary-size, command-line option 630: @cindex -m, command-line option 631: @cindex @var{size} parameters for command-line options 632: @cindex size of the dictionary and the stacks 1.1 anton 633: @item --dictionary-size @var{size} 1.43 anton 634: @itemx -m @var{size} 1.1 anton: 1.43 anton 642: @cindex --data-stack-size, command-line option 643: @cindex -d, command-line option 1.1 anton 644: @item --data-stack-size @var{size} 1.43 anton 645: @itemx -d @var{size} 1.1 anton 646: Allocate @var{size} space for the data stack instead of using the 647: default specified in the image (typically 16K). 648: 1.43 anton 649: @cindex --return-stack-size, command-line option 650: @cindex -r, command-line option 1.1 anton 651: @item --return-stack-size @var{size} 1.43 anton 652: @itemx -r @var{size} 1.1 anton 653: Allocate @var{size} space for the return stack instead of using the 1.43 anton 654: default specified in the image (typically 15K). 1.1 anton 655: 1.43 anton 656: @cindex --fp-stack-size, command-line option 657: @cindex -f, command-line option 1.1 anton 658: @item --fp-stack-size @var{size} 1.43 anton 659: @itemx -f @var{size} 1.1 anton 660: Allocate @var{size} space for the floating point stack instead of 1.43 anton 661: using the default specified in the image (typically 15.5K). In this case 1.1 anton 662: the unit specifier @code{e} refers to floating point numbers. 663: 1.43 anton 664: @cindex --locals-stack-size, command-line option 665: @cindex -l, command-line option 1.1 anton 666: @item --locals-stack-size @var{size} 1.43 anton 667: @itemx -l @var{size} 1.1 anton 668: Allocate @var{size} space for the locals stack instead of using the 1.43 anton 669: default specified in the image (typically 14.5K). 1.1 anton 670: 1.43 anton}). 1.1 anton 697: @end table 698: 1.43 anton 699: @cindex loading files at startup 700: @cindex executing code on startup 701: @cindex batch processing with Gforth 1.1 anton 702: As explained above, the image-specific command-line arguments for the 703: default image @file{gforth.fi} consist of a sequence of filenames and 1.41 anton 704: @code{-e @var{forth-code}} options that are interpreted in the sequence 1.1 anton: 1.43 anton 712: @cindex versions, invoking other versions of Gforth 1.22 anton: 1.1 anton: 1.43 anton 727: @node Words, Tools, Invoking Gforth, Top 1.1 anton 728: @chapter Forth Words 1.43 anton 729: @cindex Words 1.1 anton 730: 731: @menu 1.4 anton 732: * Notation:: 733: * Arithmetic:: 734: * Stack Manipulation:: 1.43 anton 735: * Memory:: 1.4 anton 736: * Control Structures:: 737: * Locals:: 738: * Defining Words:: 1.37 anton 739: * Tokens for Words:: 1.4 anton 740: * Wordlists:: 741: * Files:: 742: * Blocks:: 743: * Other I/O:: 744: * Programming Tools:: 1.18 anton 745: * Assembler and Code words:: 1.4 anton 746: * Threading Words:: 1.1 anton 747: @end menu 748: 749: @node Notation, Arithmetic, Words, Words 750: @section Notation 1.43 anton 751: @cindex notation of glossary entries 752: @cindex format of glossary entries 753: @cindex glossary notation format 754: @cindex word glossary entry format 1.1 anton 755: 756: The Forth words are described in this section in the glossary notation 1.43 anton 757: that has become a de-facto standard for Forth texts, i.e., 1.1 anton 758: 1.4 anton 759: @format 1.1 anton 760: @var{word} @var{Stack effect} @var{wordset} @var{pronunciation} 1.4 anton 761: @end format 1.1 anton 762: @var{Description} 763: 764: @table @var 765: @item word 1.43 anton 766: @cindex case insensitivity 1.17 anton 767: The name of the word. BTW, Gforth is case insensitive, so you can 1.14 anton 768: type the words in in lower case (However, @pxref{core-idef}). 1.1 anton 769: 770: @item Stack effect 1.43 anton 771: @cindex stack effect 1.1 an, 1.17 anton 776: i.e., a stack sequence is written as it is typed in. Note that Gforth 1.1 anton: 1.19 anton: 1.43 anton 790: @cindex pronounciation of words 1.1 anton 791: @item pronunciation 1.43 anton 792: How the word is pronounced. 1.1 anton 793: 1.43 anton 794: @cindex wordset 1.1 anton 1.19 anton. 1.1 anton 806: 807: @item Description 808: A description of the behaviour of the word. 809: @end table 810: 1.43 anton 811: @cindex types of stack items 812: @cindex stack item types 1.4 anton 813: The type of a stack item is specified by the character(s) the name 814: starts with: 1.1 anton 815: 816: @table @code 817: @item f 1.43 anton 818: @cindex @code{f}, stack item type 819: Boolean flags, i.e. @code{false} or @code{true}. 1.1 anton 820: @item c 1.43 anton 821: @cindex @code{c}, stack item type 1.1 anton 822: Char 823: @item w 1.43 anton 824: @cindex @code{w}, stack item type 1.1 anton 825: Cell, can contain an integer or an address 826: @item n 1.43 anton 827: @cindex @code{n}, stack item type 1.1 anton 828: signed integer 829: @item u 1.43 anton 830: @cindex @code{u}, stack item type 1.1 anton 831: unsigned integer 832: @item d 1.43 anton 833: @cindex @code{d}, stack item type 1.1 anton 834: double sized signed integer 835: @item ud 1.43 anton 836: @cindex @code{ud}, stack item type 1.1 anton 837: double sized unsigned integer 838: @item r 1.43 anton 839: @cindex @code{r}, stack item type 1.36 anton 840: Float (on the FP stack) 1.1 anton 841: @item a_ 1.43 anton 842: @cindex @code{a_}, stack item type 1.1 anton 843: Cell-aligned address 844: @item c_ 1.43 anton 845: @cindex @code{c_}, stack item type 1.36 anton 846: Char-aligned address (note that a Char may have two bytes in Windows NT) 1.1 anton 847: @item f_ 1.43 anton 848: @cindex @code{f_}, stack item type 1.1 anton 849: Float-aligned address 850: @item df_ 1.43 anton 851: @cindex @code{df_}, stack item type 1.1 anton 852: Address aligned for IEEE double precision float 853: @item sf_ 1.43 anton 854: @cindex @code{sf_}, stack item type 1.1 anton 855: Address aligned for IEEE single precision float 856: @item xt 1.43 anton 857: @cindex @code{xt}, stack item type 1.1 anton 858: Execution token, same size as Cell 859: @item wid 1.43 anton 860: @cindex @code{wid}, stack item type 1.1 anton 861: Wordlist ID, same size as Cell 862: @item f83name 1.43 anton 863: @cindex @code{f83name}, stack item type 1.1 anton 864: Pointer to a name structure 1.36 anton 865: @item " 1.43 anton 866: @cindex @code{"}, stack item type 1.36 anton 867: string in the input stream (not the stack). The terminating character is 868: a blank by default. If it is not a blank, it is shown in @code{<>} 869: quotes. 1.1 anton 870: @end table 871: 1.4 anton 872: @node Arithmetic, Stack Manipulation, Notation, Words 1.1 anton 873: @section Arithmetic 1.43 anton 874: @cindex arithmetic words 875: 876: @cindex division with potentially negative operands 1.1 anton 1.4 anton 885: former, @pxref{Mixed precision}). 886: 887: @menu 888: * Single precision:: 889: * Bitwise operations:: 890: * Mixed precision:: operations with single and double-cell integers 891: * Double precision:: Double-cell integer arithmetic 892: * Floating Point:: 893: @end menu 1.1 anton 894: 1.4 anton 895: @node Single precision, Bitwise operations, Arithmetic, Arithmetic 1.1 anton 896: @subsection Single precision 1.43 anton 897: @cindex single precision arithmetic words 898: 1.1 anton 899: doc-+ 900: doc-- 901: doc-* 902: doc-/ 903: doc-mod 904: doc-/mod 905: doc-negate 906: doc-abs 907: doc-min 908: doc-max 909: 1.4 anton 910: @node Bitwise operations, Mixed precision, Single precision, Arithmetic 1.1 anton 911: @subsection Bitwise operations 1.43 anton 912: @cindex bitwise operation words 913: 1.1 anton 914: doc-and 915: doc-or 916: doc-xor 917: doc-invert 918: doc-2* 919: doc-2/ 920: 1.4 anton 921: @node Mixed precision, Double precision, Bitwise operations, Arithmetic 1.1 anton 922: @subsection Mixed precision 1.43 anton 923: @cindex mixed precision arithmetic words 924: 1.1 anton 925: doc-m+ 926: doc-*/ 927: doc-*/mod 928: doc-m* 929: doc-um* 930: doc-m*/ 931: doc-um/mod 932: doc-fm/mod 933: doc-sm/rem 934: 1.4 anton 935: @node Double precision, Floating Point, Mixed precision, Arithmetic 1.1 anton 936: @subsection Double precision 1.43 anton 937: @cindex double precision arithmetic words 1.16 anton 938: 1.43 anton 939: @cindex double-cell numbers, input format 940: @cindex input format for double-cell numbers 1.16 anton 941: The outer (aka text) interpreter converts numbers containing a dot into 942: a double precision number. Note that only numbers with the dot as last 943: character are standard-conforming. 944: 1.1 anton 945: doc-d+ 946: doc-d- 947: doc-dnegate 948: doc-dabs 949: doc-dmin 950: doc-dmax 951: 1.4 anton 952: @node Floating Point, , Double precision, Arithmetic 953: @subsection Floating Point 1.43 anton 954: @cindex floating point arithmetic words 1.16 anton 955: 1.43 anton 956: @cindex floating-point numbers, input format 957: @cindex input format for floating-point numbers 1.16 anton 958: The format of floating point numbers recognized by the outer (aka text) 959: interpreter is: a signed decimal number, possibly containing a decimal 960: point (@code{.}), followed by @code{E} or @code{e}, optionally followed 1.41 anton 961: by a signed integer (the exponent). E.g., @code{1e} is the same as 1.35 anton 962: @code{+1.0e+0}. Note that a number without @code{e} 1.16 anton). 1.4 anton 970: 1.43 anton 971: @cindex angles in trigonometric operations 972: @cindex trigonometric operations 1.4 anton 973: Angles in floating point operations are given in radians (a full circle 1.17 anton 974: has 2 pi radians). Note, that Gforth has a separate floating point 1.4 anton 975: stack, but we use the unified notation. 976: 1.43 anton 977: @cindex floating-point arithmetic, pitfalls 1.4 anton 1.11 anton 983: avoid them), you might start with @cite{David Goldberg, What Every 1.6 anton 984: Computer Scientist Should Know About Floating-Point Arithmetic, ACM 985: Computing Surveys 23(1):5@minus{}48, March 1991}. 1.4 anton 1.6 anton 1004: doc-falog 1.4 anton: 1.43 anton 1020: @node Stack Manipulation, Memory, Arithmetic, Words 1.1 anton 1021: @section Stack Manipulation 1.43 anton 1022: @cindex stack manipulation words 1.1 anton 1023: 1.43 anton 1024: @cindex floating-point stack in the standard 1.17 anton 1025: Gforth has a data stack (aka parameter stack) for characters, cells, 1.1 anton 1.4 anton 1035: it. Instead, just say that your program has an environmental dependency 1036: on a separate FP stack. 1037: 1.43 anton 1038: @cindex return stack and locals 1039: @cindex locals and return stack 1.4 anton 1040: Also, a Forth system is allowed to keep the local variables on the 1.1 anton: 1.4 anton 1047: @menu 1048: * Data stack:: 1049: * Floating point stack:: 1050: * Return stack:: 1051: * Locals stack:: 1052: * Stack pointer manipulation:: 1053: @end menu 1054: 1055: @node Data stack, Floating point stack, Stack Manipulation, Stack Manipulation 1.1 anton 1056: @subsection Data stack 1.43 anton 1057: @cindex data stack manipulation words 1058: @cindex stack manipulations words, data stack 1059: 1.1 anton: 1.4 anton 1079: @node Floating point stack, Return stack, Data stack, Stack Manipulation 1.1 anton 1080: @subsection Floating point stack 1.43 anton 1081: @cindex floating-point stack manipulation words 1082: @cindex stack manipulation words, floating-point stack 1083: 1.1 anton 1084: doc-fdrop 1085: doc-fnip 1086: doc-fdup 1087: doc-fover 1088: doc-ftuck 1089: doc-fswap 1090: doc-frot 1091: 1.4 anton 1092: @node Return stack, Locals stack, Floating point stack, Stack Manipulation 1.1 anton 1093: @subsection Return stack 1.43 anton 1094: @cindex return stack manipulation words 1095: @cindex stack manipulation words, return stack 1096: 1.1 anton 1097: doc->r 1098: doc-r> 1099: doc-r@ 1100: doc-rdrop 1101: doc-2>r 1102: doc-2r> 1103: doc-2r@ 1104: doc-2rdrop 1105: 1.4 anton 1106: @node Locals stack, Stack pointer manipulation, Return stack, Stack Manipulation 1.1 anton 1107: @subsection Locals stack 1108: 1.4 anton 1109: @node Stack pointer manipulation, , Locals stack, Stack Manipulation 1.1 anton 1110: @subsection Stack pointer manipulation 1.43 anton 1111: @cindex stack pointer manipulation words 1112: 1.1 anton 1113: doc-sp@ 1114: doc-sp! 1115: doc-fp@ 1116: doc-fp! 1117: doc-rp@ 1118: doc-rp! 1119: doc-lp@ 1120: doc-lp! 1121: 1.43 anton 1122: @node Memory, Control Structures, Stack Manipulation, Words 1123: @section Memory 1124: @cindex Memory words 1.1 anton 1125: 1.4 anton 1126: @menu 1.43 anton 1127: * Memory Access:: 1.4 anton 1128: * Address arithmetic:: 1.43 anton 1129: * Memory Blocks:: 1.4 anton 1130: @end menu 1131: 1.43 anton 1132: @node Memory Access, Address arithmetic, Memory, Memory 1133: @subsection Memory Access 1134: @cindex memory access words 1.1 anton: 1.43 anton 1150: @node Address arithmetic, Memory Blocks, Memory Access, Memory 1.1 anton 1151: @subsection Address arithmetic 1.43 anton 1152: @cindex address arithmetic words 1.1 anton: 1.43 anton 1161: @cindex alignment of addresses for types 1.1 anton 1162: ANS Forth also defines words for aligning addresses for specific 1.43 anton 1163: types. Many computers require that accesses to specific data types 1.1 anton 1164: must only occur at specific addresses; e.g., that cells may only be 1165: accessed at addresses divisible by 4. Even if a machine allows unaligned 1166: accesses, it can usually perform aligned accesses faster. 1167: 1.17 anton 1168: For the performance-conscious: alignment operations are usually only 1.1 anton: 1.43 anton 1177: @cindex @code{CREATE} and alignment 1.1 anton 1178: The standard guarantees that addresses returned by @code{CREATE}d words 1.17 anton 1179: are cell-aligned; in addition, Gforth guarantees that these addresses 1.1 anton 1180: are aligned for all purposes. 1181: 1.9 anton 1182: Note that the standard defines a word @code{char}, which has nothing to 1183: do with address arithmetic. 1184: 1.1 anton 1185: doc-chars 1186: doc-char+ 1187: doc-cells 1188: doc-cell+ 1.43 anton 1189: doc-cell 1.1 anton 1190: doc-align 1191: doc-aligned 1192: doc-floats 1193: doc-float+ 1.43 anton 1194: doc-float 1.1 anton 1.10 anton 1205: doc-maxalign 1206: doc-maxaligned 1207: doc-cfalign 1208: doc-cfaligned 1.1 anton 1209: doc-address-unit-bits 1210: 1.43 anton 1211: @node Memory Blocks, , Address arithmetic, Memory 1212: @subsection Memory Blocks 1213: @cindex memory block words 1.1 anton: 1.43 anton 1226: @node Control Structures, Locals, Memory, Words 1.1 anton 1227: @section Control Structures 1.43 anton 1228: @cindex control structures 1.1 anton 1229: 1230: Control structures in Forth cannot be used in interpret state, only in 1.43 anton. 1.1 anton 1235: 1.4 anton 1236: @menu 1237: * Selection:: 1238: * Simple Loops:: 1239: * Counted Loops:: 1240: * Arbitrary control structures:: 1241: * Calls and returns:: 1242: * Exception Handling:: 1243: @end menu 1244: 1245: @node Selection, Simple Loops, Control Structures, Control Structures 1.1 anton 1246: @subsection Selection 1.43 anton 1247: @cindex selection control structures 1248: @cindex control structures for selection 1.1 anton 1249: 1.43 anton 1250: @cindex @code{IF} control structure 1.1 anton: 1.4 anton 1267: You can use @code{THEN} instead of @code{ENDIF}. Indeed, @code{THEN} is 1.1 anton: 1.31 anton}. 1.1 anton 1291: 1.43 anton 1292: @cindex @code{CASE} control structure 1.1 anton 1293: @example 1294: @var{n} 1295: CASE 1296: @var{n1} OF @var{code1} ENDOF 1297: @var{n2} OF @var{code2} ENDOF 1.4 anton 1298: @dots{} 1.1 anton: 1.4 anton 1307: @node Simple Loops, Counted Loops, Selection, Control Structures 1.1 anton 1308: @subsection Simple Loops 1.43 anton 1309: @cindex simple loops 1310: @cindex loops without count 1.1 anton 1311: 1.43 anton 1312: @cindex @code{WHILE} loop 1.1 anton 1313: @example 1314: BEGIN 1315: @var{code1} 1316: @var{flag} 1317: WHILE 1318: @var{code2} 1319: REPEAT 1320: @end example 1321: 1322: @var{code1} is executed and @var{flag} is computed. If it is true, 1.43 anton 1323: @var{code2} is executed and the loop is restarted; If @var{flag} is 1324: false, execution continues after the @code{REPEAT}. 1.1 anton 1325: 1.43 anton 1326: @cindex @code{UNTIL} loop 1.1 anton 1327: @example 1328: BEGIN 1329: @var{code} 1330: @var{flag} 1331: UNTIL 1332: @end example 1333: 1334: @var{code} is executed. The loop is restarted if @code{flag} is false. 1335: 1.43 anton 1336: @cindex endless loop 1337: @cindex loops, endless 1.1 anton 1338: @example 1339: BEGIN 1340: @var{code} 1341: AGAIN 1342: @end example 1343: 1344: This is an endless loop. 1345: 1.4 anton 1346: @node Counted Loops, Arbitrary control structures, Simple Loops, Control Structures 1.1 anton 1347: @subsection Counted Loops 1.43 anton 1348: @cindex counted loops 1349: @cindex loops, counted 1350: @cindex @code{DO} loops 1.1 anton: 1.46 anton 1376: doc-i 1377: doc-j 1378: doc-k 1379: 1.1 anton: 1.18 anton 1.30 anton 1397: unsigned loop parameters. 1.18 anton 1398: 1.1 anton 1399: @code{LOOP} can be replaced with @code{@var{n} +LOOP}; this updates the 1400: index by @var{n} instead of by 1. The loop is terminated when the border 1401: between @var{limit-1} and @var{limit} is crossed. E.g.: 1402: 1.18 anton 1403: @code{4 0 +DO i . 2 +LOOP} prints @code{0 2} 1.1 anton 1404: 1.18 anton 1405: @code{4 1 +DO i . 2 +LOOP} prints @code{1 3} 1.1 anton 1406: 1.43 anton 1407: @cindex negative increment for counted loops 1408: @cindex counted loops with negative increment 1.1 anton 1409: The behaviour of @code{@var{n} +LOOP} is peculiar when @var{n} is negative: 1410: 1.2 anton 1411: @code{-1 0 ?DO i . -1 +LOOP} prints @code{0 -1} 1.1 anton 1412: 1.2 anton 1413: @code{ 0 0 ?DO i . -1 +LOOP} prints nothing 1.1 anton 1414: 1.18 anton.: 1.1 anton 1420: 1.18 anton 1421: @code{-2 0 -DO i . 1 -LOOP} prints @code{0 -1} 1.1 anton 1422: 1.18 anton 1423: @code{-1 0 -DO i . 1 -LOOP} prints @code{0} 1.1 anton 1424: 1.18 anton 1425: @code{ 0 0 -DO i . 1 -LOOP} prints nothing 1.1 anton 1426: 1.30 anton 1427: Unfortunately, @code{+DO}, @code{U+DO}, @code{-DO}, @code{U-DO} and 1428: @code{-LOOP} are not in the ANS Forth standard. However, an 1429: implementation for these words that uses only standard words is provided 1430: in @file{compat/loops.fs}. 1.18 anton. 1.1 anton 1437: 1438: @code{UNLOOP} is used to prepare for an abnormal loop exit, e.g., via 1439: @code{EXIT}. @code{UNLOOP} removes the loop control parameters from the 1440: return stack so @code{EXIT} can get to its return address. 1441: 1.43 anton 1442: @cindex @code{FOR} loops 1.1 anton 1443: Another counted loop is 1444: @example 1445: @var{n} 1446: FOR 1447: @var{body} 1448: NEXT 1449: @end example 1450: This is the preferred loop of native code compiler writers who are too 1.17 anton 1451: lazy to optimize @code{?DO} loops properly. In Gforth, this loop 1.1 anton 1452: iterates @var{n+1} times; @code{i} produces values starting with @var{n} 1453: and ending with 0. Other Forth systems may behave differently, even if 1.30 anton 1454: they support @code{FOR} loops. To avoid problems, don't use @code{FOR} 1455: loops. 1.1 anton 1456: 1.4 anton 1457: @node Arbitrary control structures, Calls and returns, Counted Loops, Control Structures 1.2 anton 1458: @subsection Arbitrary control structures 1.43 anton 1459: @cindex control structures, user-defined 1.2 anton 1460: 1.43 anton 1461: @cindex control-flow stack 1.2 anton 1462: ANS Forth permits and supports using control structures in a non-nested 1463: way. Information about incomplete control structures is stored on the 1464: control-flow stack. This stack may be implemented on the Forth data 1.17 anton 1465: stack, and this is what we have done in Gforth. 1.2 anton 1466: 1.43 anton 1467: @cindex @code{orig}, control-flow stack item 1468: @cindex @code{dest}, control-flow stack item 1.2 anton: 1.3 anton 1474: doc-if 1475: doc-ahead 1476: doc-then 1477: doc-begin 1478: doc-until 1479: doc-again 1480: doc-cs-pick 1481: doc-cs-roll 1.2 anton 1482: 1.17 anton 1483: On many systems control-flow stack items take one word, in Gforth they 1.2 anton: 1.3 anton 1491: doc-else 1492: doc-while 1493: doc-repeat 1.2 anton 1494: 1.31 anton 1495: Gforth adds some more control-structure words: 1496: 1497: doc-endif 1498: doc-?dup-if 1499: doc-?dup-0=-if 1500: 1.2 anton 1501: Counted loop words constitute a separate group of words: 1502: 1.3 anton 1503: doc-?do 1.18 anton 1504: doc-+do 1505: doc-u+do 1506: doc--do 1507: doc-u-do 1.3 anton 1508: doc-do 1509: doc-for 1510: doc-loop 1511: doc-+loop 1.18 anton 1512: doc--loop 1.3 anton 1513: doc-next 1514: doc-leave 1515: doc-?leave 1516: doc-unloop 1.10 anton 1517: doc-done 1.2 anton 1.3 anton 1522: through the definition (@code{LOOP} etc. compile an @code{UNLOOP} on the 1523: fall-through path). Also, you have to ensure that all @code{LEAVE}s are 1.7 pazsan 1524: resolved (by using one of the loop-ending words or @code{DONE}). 1.2 anton 1525: 1526: Another group of control structure words are 1527: 1.3 anton 1528: doc-case 1529: doc-endcase 1530: doc-of 1531: doc-endof 1.2 anton 1532: 1533: @i{case-sys} and @i{of-sys} cannot be processed using @code{cs-pick} and 1534: @code{cs-roll}. 1535: 1.3 anton: 1.30 anton 1575: That's much easier to read, isn't it? Of course, @code{REPEAT} and 1.3 anton 1576: @code{WHILE} are predefined, so in this example it would not be 1577: necessary to define them. 1578: 1.4 anton 1579: @node Calls and returns, Exception Handling, Arbitrary control structures, Control Structures 1.3 anton 1580: @subsection Calls and returns 1.43 anton 1581: @cindex calling a definition 1582: @cindex returning from a definition 1.3 anton 1583: 1584: A definition can be called simply be writing the name of the 1.17 anton 1585: definition. When the end of the definition is reached, it returns. An 1586: earlier return can be forced using 1.3 an: 1.4 anton 1596: @node Exception Handling, , Calls and returns, Control Structures 1.3 anton 1597: @subsection Exception Handling 1.43 anton 1598: @cindex Exceptions 1.3 anton 1599: 1600: doc-catch 1601: doc-throw 1602: 1.4 anton 1603: @node Locals, Defining Words, Control Structures, Words 1.1 anton 1604: @section Locals 1.43 anton 1605: @cindex locals 1.1 anton 1606: 1.2 anton: 1.24 anton 1613: The ideas in this section have also been published in the paper 1614: @cite{Automatic Scoping of Local Variables} by M. Anton Ertl, presented 1615: at EuroForth '94; it is available at 1.48 ! anton 1616: @*@url{}. 1.24 anton 1617: 1.2 anton 1618: @menu 1.17 anton 1619: * Gforth locals:: 1.4 anton 1620: * ANS Forth locals:: 1.2 anton 1621: @end menu 1622: 1.17 anton 1623: @node Gforth locals, ANS Forth locals, Locals, Locals 1624: @subsection Gforth locals 1.43 anton 1625: @cindex Gforth locals 1626: @cindex locals, Gforth style 1.2 anton: 1.43 anton 1659: @cindex types of locals 1660: @cindex locals types 1.2 anton: 1.43 anton 1671: @cindex flavours of locals 1672: @cindex locals flavours 1673: @cindex value-flavoured locals 1674: @cindex variable-flavoured locals 1.17 anton 1675: Gforth currently supports cells (@code{W:}, @code{W^}), doubles 1.2 anton 1.41 anton 1681: left). E.g., the standard word @code{emit} can be defined in terms of 1.2 anton 1682: @code{type} like this: 1683: 1684: @example 1685: : emit @{ C^ char* -- @} 1686: char* 1 type ; 1687: @end example 1688: 1.43 anton 1689: @cindex default type of locals 1690: @cindex locals, default type 1.2 anton: 1.17 anton 1697: Gforth allows defining locals everywhere in a colon definition. This 1.7 pazsan 1698: poses the following questions: 1.2 anton 1699: 1.4 anton 1700: @menu 1701: * Where are locals visible by name?:: 1.14 anton 1702: * How long do locals live?:: 1.4 anton 1703: * Programming Style:: 1704: * Implementation:: 1705: @end menu 1706: 1.17 anton 1707: @node Where are locals visible by name?, How long do locals live?, Gforth locals, Gforth locals 1.2 anton 1708: @subsubsection Where are locals visible by name? 1.43 anton 1709: @cindex locals visibility 1710: @cindex visibility of locals 1711: @cindex scope of locals 1.2 anton 1.41 anton 1745: rest of this section. If you really must know all the gory details and 1.2 anton: 1.43 anton 1758: doc-unreachable 1759: 1.2 anton 1760: Another problem with this rule is that at @code{BEGIN}, the compiler 1.3 anton 1.2 anton 1765: loops). Perhaps the most insidious example is: 1766: @example 1767: AHEAD 1768: BEGIN 1769: x 1770: [ 1 CS-ROLL ] THEN 1.4 anton 1771: @{ x @} 1.2 anton 1.41 anton 1800: warns the user if it was too optimistic: 1.2 anton 1801: @example 1802: IF 1.4 anton 1803: @{ x @} 1.2 anton 1.4 anton 1819: @{ x @} 1.2 anton 1.17 anton 1834: visible after the @code{BEGIN}. However, the user can use 1.2 anton 1835: @code{ASSUME-LIVE} to make the compiler assume that the same locals are 1.17 anton 1836: visible at the BEGIN as at the point where the top control-flow stack 1837: item was created. 1.2 anton 1838: 1839: doc-assume-live 1840: 1841: E.g., 1842: @example 1.4 anton 1843: @{ x @} 1.2 anton 1.4 anton 1864: @{ x @} 1.2 anton 1865: ... 0= 1866: WHILE 1867: x 1868: REPEAT 1869: @end example 1870: 1.17 anton 1871: @node How long do locals live?, Programming Style, Where are locals visible by name?, Gforth locals 1.2 anton 1872: @subsubsection How long do locals live? 1.43 anton 1873: @cindex locals lifetime 1874: @cindex lifetime of locals 1.2 anton: 1.17 anton 1887: @node Programming Style, Implementation, How long do locals live?, Gforth locals 1.2 anton 1888: @subsubsection Programming Style 1.43 anton 1889: @cindex locals programming style 1890: @cindex programming style, locals 1.2 anton 1.4 anton 1901: unlikely to become a conscious programming objective. Still, the number 1902: of stack manipulations will be reduced dramatically if local variables 1.17 anton 1903: are used liberally (e.g., compare @code{max} in @ref{Gforth locals} with 1.4 anton 1904: a traditional implementation of @code{max}). 1.2 anton 1905: 1906: This shows one potential benefit of locals: making Forth programs more 1907: readable. Of course, this benefit will only be realized if the 1908: programmers continue to honour the principle of factoring instead of 1909: using the added latitude to make the words longer. 1910: 1.43 anton 1911: @cindex single-assignment style for locals 1.2 anton 1.36 anton 1924: addr1 c@@ addr2 c@@ - 1.31 anton 1925: ?dup-if 1.2 anton @} 1.36 anton 1947: s1 c@@ s2 c@@ - 1.31 anton 1948: ?dup-if 1.2 anton 1949: unloop exit 1950: then 1951: s1 char+ s2 char+ 1952: loop 1953: 2drop 1954: u1 u2 - ; 1955: @end example 1956: Here it is clear from the start that @code{s1} has a different value 1957: in every loop iteration. 1958: 1.17 anton 1959: @node Implementation, , Programming Style, Gforth locals 1.2 anton 1960: @subsubsection Implementation 1.43 anton 1961: @cindex locals implementation 1962: @cindex implementation of locals 1.2 anton 1963: 1.43 anton 1964: @cindex locals stack 1.17 anton 1965: Gforth uses an extra locals stack. The most compelling reason for 1.2 anton: 1.12 anton 1986: doc-compile-@local 1987: doc-compile-f@local 1.2 anton: 1.43 anton 2000: @cindex wordlist for defining locals 1.17 anton 2001: A special feature of Gforth's dictionary is used to implement the 1.2 anton 2002: definition of locals without type specifiers: every wordlist (aka 2003: vocabulary) has its own methods for searching 1.4 anton 2004: etc. (@pxref{Wordlists}). For the present purpose we defined a wordlist 1.2 anton 1.4 anton 2041: level at the @var{orig} point to the level after the @code{THEN}. The 1.2 anton 2042: first @code{lp+!#} adjusts the locals stack pointer from the current 2043: level to the level at the orig point, so the complete effect is an 2044: adjustment from the current level to the right level after the 2045: @code{THEN}. 2046: 1.43 anton 2047: @cindex locals information on the control-flow stack 2048: @cindex control-flow stack items, locals information 1.2 anton: 1.17 anton 2093: @node ANS Forth locals, , Gforth locals, Locals 1.2 anton 2094: @subsection ANS Forth locals 1.43 anton 2095: @cindex locals, ANS Forth style 1.2 anton 2096: 2097: The ANS Forth locals wordset does not define a syntax for locals, but 2098: words that make it possible to define various syntaxes. One of the 1.17 anton 2099: possible syntaxes is a subset of the syntax we used in the Gforth locals 1.2 anton: 1.1 anton 2112: 1.2 anton 2113: @itemize @bullet 2114: @item 1.17 anton 2115: Locals can only be cell-sized values (no type specifiers are allowed). 1.2 anton 2116: @item 2117: Locals can be defined only outside control structures. 2118: @item 2119: Locals can interfere with explicit usage of the return stack. For the 2120: exact (and long) rules, see the standard. If you don't use return stack 1.17 anton 2121: accessing words in a definition using locals, you will be all right. The 1.2 anton 2122: purpose of this rule is to make locals implementation on the return 2123: stack easier. 2124: @item 2125: The whole definition must be in one line. 2126: @end itemize 2127: 1.35 anton 2128: Locals defined in this way behave like @code{VALUE}s (@xref{Simple 2129: Defining Words}). I.e., they are initialized from the stack. Using their 1.2 anton 2130: name produces their value. Their value can be changed using @code{TO}. 2131: 1.17 anton 2132: Since this syntax is supported by Gforth directly, you need not do 1.2 anton 2133: anything to use it. If you want to port a program using this syntax to 1.30 anton 2134: another ANS Forth system, use @file{compat/anslocal.fs} to implement the 2135: syntax on the other system. 1.2 an 1.17 anton 2147: syntax to make porting to Gforth easy, but do not document it here. The 1.2 anton. 1.3 anton 2153: 1.37 anton 2154: @node Defining Words, Tokens for Words, Locals, Words 1.4 anton 2155: @section Defining Words 1.43 anton 2156: @cindex defining words 1.4 anton 2157: 1.14 anton 2158: @menu 1.35 anton 2159: * Simple Defining Words:: 2160: * Colon Definitions:: 2161: * User-defined Defining Words:: 2162: * Supplying names:: 2163: * Interpretation and Compilation Semantics:: 1.14 anton 2164: @end menu 2165: 1.35 anton 2166: @node Simple Defining Words, Colon Definitions, Defining Words, Defining Words 2167: @subsection Simple Defining Words 1.43 anton 2168: @cindex simple defining words 2169: @cindex defining words, simple 1.35 anton 1.43 anton 2186: @cindex colon definitions 1.35 anton 1.43 anton 2205: @cindex user-defined defining words 2206: @cindex defining words, user-defined 1.35 anton 2207: 2208: You can create new defining words simply by wrapping defining-time code 2209: around existing defining words and putting the sequence in a colon 2210: definition. 2211: 1.43 anton 2212: @cindex @code{CREATE} ... @code{DOES>} 1.36 anton 2213: If you want the words defined with your defining words to behave 2214: differently from words defined with standard defining words, you can 1.35 anton} 1.36 anton: 1.35 anton 2247: 2248: @example 2249: : constant ( w "name" -- ) 2250: create , 2251: DOES> ( -- w ) 1.36 anton 2252: @@ ; 1.35 anton: 1.43 anton 2260: @cindex stack effect of @code{DOES>}-parts 2261: @cindex @code{DOES>}-parts, stack effect 1.35 an>} 1.43 anton 2270: @cindex @code{CREATE} ... @code{DOES>}, applications 1.35 anton 2271: 1.36 anton 2272: You may wonder how to use this feature. Here are some usage patterns: 1.35 anton 2273: 1.43 anton 2274: @cindex factoring similar colon definitions 1.35 anton 1.41 anton 2281: : ori, ( reg-target reg-source n -- ) 1.35 anton 2282: 0 asm-reg-reg-imm ; 1.41 anton 2283: : andi, ( reg-target reg-source n -- ) 1.35 anton 2284: 1 asm-reg-reg-imm ; 2285: @end example 2286: 2287: This could be factored with: 2288: @example 2289: : reg-reg-imm ( op-code -- ) 2290: create , 1.41 anton 2291: DOES> ( reg-target reg-source n -- ) 1.36 anton 2292: @@ asm-reg-reg-imm ; 1.35 anton 2293: 2294: 0 reg-reg-imm ori, 2295: 1 reg-reg-imm andi, 2296: @end example 2297: 1.43 anton 2298: @cindex currying 1.35 anton ) 1.36 anton 2308: @@ + ; 1.35 anton 2309: 2310: 3 curry+ 3+ 2311: -2 curry+ 2- 2312: @end example 2313: 2314: @subsubsection The gory details of @code{CREATE..DOES>} 1.43 anton 2315: @cindex @code{CREATE} ... @code{DOES>}, details 1.35 anton 2316: 2317: doc-does> 2318: 1.43 anton 2319: @cindex @code{DOES>} in a separate definition 1.35 anton: 1.43 anton 2341: @cindex @code{DOES>} in interpretation state 1.35 an 1.41 anton 2354: This is equivalent to the standard 1.35 anton 1.43 anton 2369: @cindex names for defined words 2370: @cindex defining words, name parameter 1.35 anton 2371: 1.43 anton 2372: @cindex defining words, name given in a string 1.35 anton: 1.43 anton 2389: @cindex defining words without name 1.35 anton 2390: Sometimes you want to define a word without a name. You can do this with 2391: 2392: doc-noname 2393: 1.43 anton 2394: @cindex execution token of last defined word 1.35 anton 1.43 anton 2428: @cindex semantics, interpretation and compilation 1.35 anton 2429: 1.43 anton 2430: @cindex interpretation semantics 1.36 anton: 1.43 anton 2438: @cindex compilation semantics 1.36 anton: 1.43 anton 2445: @cindex execution semantics 1.36 anton: 1.43 anton 2456: @cindex immediate words 1.36 anton 2457: You can change the compilation semantics into @code{execute}ing the 2458: execution semantics with 2459: 1.35 anton 2460: doc-immediate 1.36 anton 2461: 1.43 anton 2462: @cindex compile-only words 1.36 anton: 1.35 anton 2474: doc-interpret/compile: 2475: 1.36 anton:}: 1.35 anton 2497: 1.36 anton: 1.43 anton 2511: @cindex state-smart words are a bad idea 1.36 anton: 1.43 anton 2537: @cindex defining words with arbitrary semantics combinations 1.36 anton}. 1.4 anton 2586: 1.37 anton 2587: @node Tokens for Words, Wordlists, Defining Words, Words 2588: @section Tokens for Words 1.43 anton 2589: @cindex tokens for words 1.37 anton 2590: 2591: This chapter describes the creation and use of tokens that represent 2592: words on the stack (and in data space). 2593: 2594: Named words have interpretation and compilation semantics. Unnamed words 2595: just have execution semantics. 2596: 1.43 anton 2597: @cindex execution token 1.37 anton: 1.43 anton 2610: @cindex code field address 2611: @cindex CFA 1.37 anton: 1.43 anton 2627: @cindex compilation token 1.37 anton: 1.38 anton 2638: You can compile the compilation semantics with @code{postpone,}. I.e., 2639: @code{COMP' @var{word} POSTPONE,} is equivalent to @code{POSTPONE 2640: @var{word}}. 2641: 2642: doc-postpone, 2643: 1.37 anton 2644: At present, the @var{w} part of a compilation token is an execution 2645: token, and the @var{xt} part represents either @code{execute} or 1.41 anton 2646: @code{compile,}. However, don't rely on that knowledge, unless necessary; 1.37 anton 2647: we may introduce unusual compilation tokens in the future (e.g., 2648: compilation tokens representing the compilation semantics of literals). 2649: 1.43 anton 2650: @cindex name token 2651: @cindex name field address 2652: @cindex NFA 1.37 anton 1.4 anton: 1.18 anton 2674: @node Programming Tools, Assembler and Code words, Other I/O, Words 1.4 anton 2675: @section Programming Tools 1.43 anton 2676: @cindex programming tools 1.4 anton 2677: 1.5 anton 2678: @menu 2679: * Debugging:: Simple and quick. 2680: * Assertions:: Making your programs self-checking. 2681: @end menu 2682: 2683: @node Debugging, Assertions, Programming Tools, Programming Tools 1.4 anton 2684: @subsection Debugging 1.43 anton 2685: @cindex debugging 1.4 anton 2686: 2687: The simple debugging aids provided in @file{debugging.fs} 2688: are meant to support a different style of debugging than the 2689: tracing/stepping debuggers used in languages with long turn-around 2690: times. 2691: 1.41 anton 2692: A much better (faster) way in fast-compiling languages is to add 1.4 anton 1.5 anton 2704: source level using @kbd{C-x `} (the advantage over a stepping debugger 2705: is that you can step in any direction and you know where the crash has 2706: happened or where the strange data has occurred). 1.4 anton: 1.5 anton 2716: @node Assertions, , Debugging, Programming Tools 1.4 anton 2717: @subsection Assertions 1.43 anton 2718: @cindex assertions 1.4 anton 2719: 1.5 anton 2720: It is a good idea to make your programs self-checking, in particular, if 2721: you use an assumption (e.g., that a certain field of a data structure is 1.17 anton 2722: never zero) that may become wrong during maintenance. Gforth supports 1.5 anton 1.17 anton 2745: keep others turned on. Gforth provides several levels of assertions for 1.5 anton: 1.18 anton 2776: @node Assembler and Code words, Threading Words, Programming Tools, Words 2777: @section Assembler and Code words 1.43 anton 2778: @cindex assembler 2779: @cindex code words 1.18 anton 2780: 2781: Gforth provides some words for defining primitives (words written in 2782: machine code), and for defining the the machine-code equivalent of 2783: @code{DOES>}-based defining words. However, the machine-independent 1.40 anton 2784: nature of Gforth poses a few problems: First of all, Gforth runs on 1.18 anton 2785: several architectures, so it can provide no standard assembler. What's 2786: worse is that the register allocation not only depends on the processor, 1.25 anton 2787: but also on the @code{gcc} version and options used. 1.18 anton 2788: 1.25 anton 2789: The words that Gforth offers encapsulate some system dependences (e.g., the 1.18 anton 1.19 anton 2805: present). You can load them with @code{require code.fs}. 1.18 anton 2806: 1.43 anton 2807: @cindex registers of the inner interpreter 1.25 anton: 1.43 anton 2840: @cindex code words, portable 1.18 anton 2841: Another option for implementing normal and defining words efficiently 2842: is: adding the wanted functionality to the source of Gforth. For normal 1.35 anton}. 1.18 anton 2847: 2848: 2849: @node Threading Words, , Assembler and Code words, Words 1.4 anton 2850: @section Threading Words 1.43 anton 2851: @cindex threading words 1.4 anton 2852: 1.43 anton 2853: @cindex code address 1.4 anton 2854: These words provide access to code addresses and other threading stuff 1.17 anton 2855: in Gforth (and, possibly, other interpretive Forths). It more or less 1.4 anton 2856: abstracts away the differences between direct and indirect threading 2857: (and, for direct threading, the machine dependences). However, at 1.43 anton 2858: present this wordset is still incomplete. It is also pretty low-level; 2859: some day it will hopefully be made unnecessary by an internals wordset 1.4 anton 2860: that abstracts implementation details away completely. 2861: 2862: doc->code-address 2863: doc->does-code 2864: doc-code-address! 2865: doc-does-code! 2866: doc-does-handler! 2867: doc-/does-handler 2868: 1.18 anton 2869: The code addresses produced by various defining words are produced by 2870: the following words: 1.14 anton 2871: 1.18 anton 2872: doc-docol: 2873: doc-docon: 2874: doc-dovar: 2875: doc-douser: 2876: doc-dodefer: 2877: doc-dofield: 2878: 1.35 anton 2879: You can recognize words defined by a @code{CREATE}...@code{DOES>} word 2880: with @code{>DOES-CODE}. If the word was defined in that way, the value 2881: returned is different from 0 and identifies the @code{DOES>} used by the 2882: defining word. 1.14 anton 2883: 1.40 anton 2884: @node Tools, ANS conformance, Words, Top 2885: @chapter Tools 2886: 2887: @menu 1.43 anton 2888: * ANS Report:: Report the words used, sorted by wordset. 1.40 anton 2889: @end menu 2890: 2891: See also @ref{Emacs and Gforth}. 2892: 2893: @node ANS Report, , Tools, Tools 2894: @section @file{ans-report.fs}: Report the words used, sorted by wordset 1.43 anton 2895: @cindex @file{ans-report.fs} 2896: @cindex report the words used in your program 2897: @cindex words used in your program 1.40 anton: 1.43 anton 2937: @c ****************************************************************** 1.40 anton 2938: @node ANS conformance, Model, Tools, Top 1.4 anton 2939: @chapter ANS conformance 1.43 anton 2940: @cindex ANS conformance of Gforth 1.4 anton 2941: 1.17 anton 2942: To the best of our knowledge, Gforth is an 1.14 anton 2943: 1.15 anton 2944: ANS Forth System 1.34 anton 2945: @itemize @bullet 1.15 anton 1.34 anton 2964: @item providing @code{;CODE}, @code{AHEAD}, @code{ASSEMBLER}, @code{BYE}, @code{CODE}, @code{CS-PICK}, @code{CS-ROLL}, @code{STATE}, @code{[ELSE]}, @code{[IF]}, @code{[THEN]} from the Programming-Tools Extensions word set 1.15 anton 2965: @item providing the Search-Order word set 2966: @item providing the Search-Order Extensions word set 2967: @item providing the String word set 2968: @item providing the String Extensions word set (another easy one) 2969: @end itemize 2970: 1.43 anton 2971: @cindex system documentation 1.15 anton 1.17 anton 2978: change during the maintenance of Gforth. 1.15 anton 2979: 1.14 anton ===================================================================== 1.43 anton 3002: @cindex core words, system documentation 3003: @cindex system documentation, core words 1.14 anton 3004: 3005: @menu 1.15 anton 3006: * core-idef:: Implementation Defined Options 3007: * core-ambcond:: Ambiguous Conditions 3008: * core-other:: Other System Documentation 1.14 anton 3009: @end menu 3010: 3011: @c --------------------------------------------------------------------- 3012: @node core-idef, core-ambcond, The Core Words, The Core Words 3013: @subsection Implementation Defined Options 3014: @c --------------------------------------------------------------------- 1.43 anton 3015: @cindex core words, implementation-defined options 3016: @cindex implementation-defined options, core words 3017: 1.14 anton 3018: 3019: @table @i 3020: @item (Cell) aligned addresses: 1.43 anton 3021: @cindex cell-aligned addresses 3022: @cindex aligned addresses 1.17 anton 3023: processor-dependent. Gforth's alignment words perform natural alignment 1.14 anton 3024: (e.g., an address aligned for a datum of size 8 is divisible by 3025: 8). Unaligned accesses usually result in a @code{-23 THROW}. 3026: 3027: @item @code{EMIT} and non-graphic characters: 1.43 anton 3028: @cindex @code{EMIT} and non-graphic characters 3029: @cindex non-graphic characters and @code{EMIT} 1.14 anton 3030: The character is output using the C library function (actually, macro) 1.36 anton 3031: @code{putc}. 1.14 anton 3032: 3033: @item character editing of @code{ACCEPT} and @code{EXPECT}: 1.43 anton 3034: @cindex character editing of @code{ACCEPT} and @code{EXPECT} 3035: @cindex editing in @code{ACCEPT} and @code{EXPECT} 3036: @cindex @code{ACCEPT}, editing 3037: @cindex @code{EXPECT}, editing 1.14 anton: 1.43 anton 3045: @cindex character set 1.14 anton 3046: The character set of your computer and display device. Gforth is 3047: 8-bit-clean (but some other component in your system may make trouble). 3048: 3049: @item Character-aligned address requirements: 1.43 anton 3050: @cindex character-aligned address requirements 1.14 anton 3051: installation-dependent. Currently a character is represented by a C 3052: @code{unsigned char}; in the future we might switch to @code{wchar_t} 3053: (Comments on that requested). 3054: 3055: @item character-set extensions and matching of names: 1.43 anton 3056: @cindex character-set extensions and matching of names 3057: @cindex case sensitivity for name lookup 3058: @cindex name lookup, case sensitivity 3059: @cindex locale and case sensitivity 1.17 anton 3060: Any character except the ASCII NUL charcter can be used in a 1.43 anton 3061: name. Matching is case-insensitive (except in @code{TABLE}s). The 1.36 anton. 1.14 anton 3073: 3074: @item conditions under which control characters match a space delimiter: 1.43 anton 3075: @cindex space delimiters 3076: @cindex control characters as delimiters 1.14 anton: 1.43 anton 3086: @cindex control flow stack, format 1.14 anton 1.43 anton 3096: @cindex digits > 35 1.14 anton 3097: The characters @code{[\]^_'} are the digits with the decimal value 3098: 36@minus{}41. There is no way to input many of the larger digits. 3099: 3100: @item display after input terminates in @code{ACCEPT} and @code{EXPECT}: 1.43 anton 3101: @cindex @code{EXPECT}, display after end of input 3102: @cindex @code{ACCEPT}, display after end of input 1.14 anton 3103: The cursor is moved to the end of the entered string. If the input is 3104: terminated using the @kbd{Return} key, a space is typed. 3105: 3106: @item exception abort sequence of @code{ABORT"}: 1.43 anton 3107: @cindex exception abort sequence of @code{ABORT"} 3108: @cindex @code{ABORT"}, exception abort sequence 1.14 anton 3109: The error string is stored into the variable @code{"error} and a 3110: @code{-2 throw} is performed. 3111: 3112: @item input line terminator: 1.43 anton 3113: @cindex input line terminator 3114: @cindex line terminator on input 3115: @cindex newline charcter on input 1.36 anton 3116: For interactive input, @kbd{C-m} (CR) and @kbd{C-j} (LF) terminate 3117: lines. One of these characters is typically produced when you type the 3118: @kbd{Enter} or @kbd{Return} key. 1.14 anton 3119: 3120: @item maximum size of a counted string: 1.43 anton 3121: @cindex maximum size of a counted string 3122: @cindex counted string, maximum size 1.14 anton 3123: @code{s" /counted-string" environment? drop .}. Currently 255 characters 3124: on all ports, but this may change. 3125: 3126: @item maximum size of a parsed string: 1.43 anton 3127: @cindex maximum size of a parsed string 3128: @cindex parsed string, maximum size 1.14 anton 3129: Given by the constant @code{/line}. Currently 255 characters. 3130: 3131: @item maximum size of a definition name, in characters: 1.43 anton 3132: @cindex maximum size of a definition name, in characters 3133: @cindex name, maximum length 1.14 anton 3134: 31 3135: 3136: @item maximum string length for @code{ENVIRONMENT?}, in characters: 1.43 anton 3137: @cindex maximum string length for @code{ENVIRONMENT?}, in characters 3138: @cindex @code{ENVIRONMENT?} string length, maximum 1.14 anton 3139: 31 3140: 3141: @item method of selecting the user input device: 1.43 anton 3142: @cindex user input device, method of selecting 1.17 anton 3143: The user input device is the standard input. There is currently no way to 3144: change it from within Gforth. However, the input can typically be 3145: redirected in the command line that starts Gforth. 1.14 anton 3146: 3147: @item method of selecting the user output device: 1.43 anton 3148: @cindex user output device, method of selecting 1.36 anton. 1.14 anton 3154: 3155: @item methods of dictionary compilation: 1.17 anton 3156: What are we expected to document here? 1.14 anton 3157: 3158: @item number of bits in one address unit: 1.43 anton 3159: @cindex number of bits in one address unit 3160: @cindex address unit, size in bits 1.14 anton 3161: @code{s" address-units-bits" environment? drop .}. 8 in all current 3162: ports. 3163: 3164: @item number representation and arithmetic: 1.43 anton 3165: @cindex number representation and arithmetic 1.14 anton 3166: Processor-dependent. Binary two's complement on all current ports. 3167: 3168: @item ranges for integer types: 1.43 anton 3169: @cindex ranges for integer types 3170: @cindex integer types, ranges 1.14 anton: 1.43 anton 3178: @cindex read-only data space regions 3179: @cindex data-space, read-only regions 1.14 anton 3180: The whole Forth data space is writable. 3181: 3182: @item size of buffer at @code{WORD}: 1.43 anton 3183: @cindex size of buffer at @code{WORD} 3184: @cindex @code{WORD} buffer size 1.14 anton: 1.43 anton 3192: @cindex cell size 1.14 anton 3193: @code{1 cells .}. 3194: 3195: @item size of one character in address units: 1.43 anton 3196: @cindex char size 1.14 anton 3197: @code{1 chars .}. 1 on all current ports. 3198: 3199: @item size of the keyboard terminal buffer: 1.43 anton 3200: @cindex size of the keyboard terminal buffer 3201: @cindex terminal buffer, size 1.36 anton 3202: Varies. You can determine the size at a specific time using @code{lp@@ 1.14 anton 3203: tib - .}. It is shared with the locals stack and TIBs of files that 3204: include the current file. You can change the amount of space for TIBs 1.17 anton 3205: and locals stack at Gforth startup with the command line option 1.14 anton 3206: @code{-l}. 3207: 3208: @item size of the pictured numeric output buffer: 1.43 anton 3209: @cindex size of the pictured numeric output buffer 3210: @cindex pictured numeric output buffer, size 1.14 anton 3211: @code{PAD HERE - .}. 104 characters on 32-bit machines. The buffer is 3212: shared with @code{WORD}. 3213: 3214: @item size of the scratch area returned by @code{PAD}: 1.43 anton 3215: @cindex size of the scratch area returned by @code{PAD} 3216: @cindex @code{PAD} size 3217: The remainder of dictionary space. @code{unused pad here - - .}. 1.14 anton 3218: 3219: @item system case-sensitivity characteristics: 1.43 anton 3220: @cindex case-sensitivity characteristics 1.36 anton. 1.14 anton 3226: 3227: @item system prompt: 1.43 anton 3228: @cindex system prompt 3229: @cindex prompt 1.14 anton 3230: @code{ ok} in interpret state, @code{ compiled} in compile state. 3231: 3232: @item division rounding: 1.43 anton 3233: @cindex division rounding 1.14 anton 3234: installation dependent. @code{s" floored" environment? drop .}. We leave 1.43 anton 3235: the choice to @code{gcc} (what to use for @code{/}) and to you (whether 3236: to use @code{fm/mod}, @code{sm/rem} or simply @code{/}). 1.14 anton 3237: 3238: @item values of @code{STATE} when true: 1.43 anton 3239: @cindex @code{STATE} values 1.14 anton 1.36 anton 3246: typically results in a @code{-55 throw} (Floating-point unidentified 1.14 anton 3247: fault), although a @code{-10 throw} (divide by zero) would be more 3248: appropriate. 3249: 3250: @item whether the current definition can be found after @t{DOES>}: 1.43 anton 3251: @cindex @t{DOES>}, visibility of current definition 1.14 anton 3252: No. 3253: 3254: @end table 3255: 3256: @c --------------------------------------------------------------------- 3257: @node core-ambcond, core-other, core-idef, The Core Words 3258: @subsection Ambiguous conditions 3259: @c --------------------------------------------------------------------- 1.43 anton 3260: @cindex core words, ambiguous conditions 3261: @cindex ambiguous conditions, core words 1.14 anton 3262: 3263: @table @i 3264: 3265: @item a name is neither a word nor a number: 1.43 anton 3266: @cindex name not found 3267: @cindex Undefined word 1.36 anton 3268: @code{-13 throw} (Undefined word). Actually, @code{-13 bounce}, which 3269: preserves the data and FP stack, so you don't lose more work than 3270: necessary. 1.14 anton 3271: 3272: @item a definition name exceeds the maximum length allowed: 1.43 anton 3273: @cindex Word name too long 1.14 anton 3274: @code{-19 throw} (Word name too long) 3275: 3276: @item addressing a region not inside the various data spaces of the forth system: 1.43 anton 3277: @cindex Invalid memory address 1.14 anton: 1.43 anton 3284: @cindex Argument type mismatch 1.14 anton: 1.43 anton 3290: @cindex Interpreting a compile-only word, for @code{'} etc. 3291: @cindex execution token of words with undefined execution semantics 1.36 anton 3292: @code{-14 throw} (Interpreting a compile-only word). In some cases, you 3293: get an execution token for @code{compile-only-error} (which performs a 3294: @code{-14 throw} when executed). 1.14 anton 3295: 3296: @item dividing by zero: 1.43 anton 3297: @cindex dividing by zero 3298: @cindex floating point unidentified fault, integer division 3299: @cindex divide by zero 1.14 anton 3300: typically results in a @code{-55 throw} (floating point unidentified 3301: fault), although a @code{-10 throw} (divide by zero) would be more 3302: appropriate. 3303: 3304: @item insufficient data stack or return stack space: 1.43 anton. 1.14 anton 3318: 3319: @item insufficient space for loop control parameters: 1.43 anton 3320: @cindex insufficient space for loop control parameters 1.14 anton 3321: like other return stack overflows. 3322: 3323: @item insufficient space in the dictionary: 1.43 anton). 1.14 anton 3332: 3333: @item interpreting a word with undefined interpretation semantics: 1.43 anton 3334: @cindex interpreting a word with undefined interpretation semantics 3335: @cindex Interpreting a compile-only word 3336: For some words, we have defined interpretation semantics. For the 3337: others: @code{-14 throw} (Interpreting a compile-only word). 1.14 anton 3338: 3339: @item modifying the contents of the input buffer or a string literal: 1.43 anton 3340: @cindex modifying the contents of the input buffer or a string literal 1.14 anton 3341: These are located in writable memory and can be modified. 3342: 3343: @item overflow of the pictured numeric output string: 1.43 anton 3344: @cindex overflow of the pictured numeric output string 3345: @cindex pictured numeric output string, overflow 3346: Not checked. Runs into the dictionary and destroys it (at least, 3347: partially). 1.14 anton 3348: 3349: @item parsed string overflow: 1.43 anton 3350: @cindex parsed string overflow 1.14 anton 3351: @code{PARSE} cannot overflow. @code{WORD} does not check for overflow. 3352: 3353: @item producing a result out of range: 1.43 anton 3354: @cindex result out of range 1.14 anton: 1.43 anton 3364: @cindex stack empty 3365: @cindex stack underflow 1.14 anton 3366: The data stack is checked by the outer (aka text) interpreter after 3367: every word executed. If it has underflowed, a @code{-4 throw} (Stack 1.43 anton). 1.14 anton 3375: 1.36 anton 3376: @item unexpected end of the input buffer, resulting in an attempt to use a zero-length string as a name: 1.43 anton 3377: @cindex unexpected end of the input buffer 3378: @cindex zero-length string as a name 3379: @cindex Attempt to use zero-length string as a name 1.14 anton: 1.43 anton 3386: @cindex @code{>IN} greater than input buffer 1.41 anton 3387: The next invocation of a parsing word returns a string with length 0. 1.14 anton 3388: 3389: @item @code{RECURSE} appears after @code{DOES>}: 1.43 anton 3390: @cindex @code{RECURSE} appears after @code{DOES>} 1.36 anton 3391: Compiles a recursive call to the defining word, not to the defined word. 1.14 anton 3392: 3393: @item argument input source different than current input source for @code{RESTORE-INPUT}: 1.43 anton 3394: @cindex argument input source different than current input source for @code{RESTORE-INPUT} 3395: @cindex Argument type mismatch, @code{RESTORE-INPUT} 3396: @cindex @code{RESTORE-INPUT}, Argument type mismatch 1.27 anton: 1.36 anton 3403: In the future, Gforth may be able to restore input source specifications 1.41 anton 3404: from other than the current input source. 1.14 anton 3405: 3406: @item data space containing definitions gets de-allocated: 1.43 anton 3407: @cindex data space containing definitions gets de-allocated 1.41 anton 3408: Deallocation with @code{allot} is not checked. This typically results in 1.14 anton 3409: memory access faults or execution of illegal instructions. 3410: 3411: @item data space read/write with incorrect alignment: 1.43 anton 3412: @cindex data space read/write with incorrect alignment 3413: @cindex alignment faults 3414: @cindex Address alignment exception 1.14 anton,}: 1.43 anton 3422: @cindex data space pointer not properly aligned, @code{,}, @code{C,} 1.14 anton 3423: Like other alignment errors. 3424: 3425: @item less than u+2 stack items (@code{PICK} and @code{ROLL}): 1.43 anton 3426: Like other stack underflows. 1.14 anton 3427: 3428: @item loop control parameters not available: 1.43 anton 3429: @cindex loop control parameters not available 1.14 anton 3430: Not checked. The counted loop words simply assume that the top of return 3431: stack items are loop control parameters and behave accordingly. 3432: 3433: @item most recent definition does not have a name (@code{IMMEDIATE}): 1.43 anton 3434: @cindex most recent definition does not have a name (@code{IMMEDIATE}) 3435: @cindex last word was headerless 1.14 anton 3436: @code{abort" last word was headerless"}. 3437: 3438: @item name not defined by @code{VALUE} used by @code{TO}: 1.43 anton). 1.14 anton 3444: 1.15 anton 3445: @item name not found (@code{'}, @code{POSTPONE}, @code{[']}, @code{[COMPILE]}): 1.43 anton 3446: @cindex name not found (@code{'}, @code{POSTPONE}, @code{[']}, @code{[COMPILE]}) 3447: @cindex Undefined word, @code{'}, @code{POSTPONE}, @code{[']}, @code{[COMPILE]} 1.14 anton 3448: @code{-13 throw} (Undefined word) 3449: 3450: @item parameters are not of the same type (@code{DO}, @code{?DO}, @code{WITHIN}): 1.43 anton 3451: @cindex parameters are not of the same type (@code{DO}, @code{?DO}, @code{WITHIN}) 1.14 anton 3452: Gforth behaves as if they were of the same type. I.e., you can predict 3453: the behaviour by interpreting all parameters as, e.g., signed. 3454: 3455: @item @code{POSTPONE} or @code{[COMPILE]} applied to @code{TO}: 1.43 anton 3456: @cindex @code{POSTPONE} or @code{[COMPILE]} applied to @code{TO} 1.36 anton 3457: Assume @code{: X POSTPONE TO ; IMMEDIATE}. @code{X} performs the 3458: compilation semantics of @code{TO}. 1.14 anton 3459: 3460: @item String longer than a counted string returned by @code{WORD}: 1.43 anton 3461: @cindex String longer than a counted string returned by @code{WORD} 3462: @cindex @code{WORD}, string overflow 1.14 anton 3463: Not checked. The string will be ok, but the count will, of course, 3464: contain only the least significant bits of the length. 3465: 1.15 anton 3466: @item u greater than or equal to the number of bits in a cell (@code{LSHIFT}, @code{RSHIFT}): 1.43 anton 3467: @cindex @code{LSHIFT}, large shift counts 3468: @cindex @code{RSHIFT}, large shift counts 1.14 anton 3469: Processor-dependent. Typical behaviours are returning 0 and using only 3470: the low bits of the shift count. 3471: 3472: @item word not defined via @code{CREATE}: 1.43 anton 3473: @cindex @code{>BODY} of non-@code{CREATE}d words 1.14 anton 3474: @code{>BODY} produces the PFA of the word no matter how it was defined. 3475: 1.43 anton 3476: @cindex @code{DOES>} of non-@code{CREATE}d words 1.14 anton --------------------------------------------------------------------- 1.43 anton 3491: @cindex other system documentation, core words 3492: @cindex core words, other system documentation 1.14 anton 3493: 3494: @table @i 3495: @item nonstandard words using @code{PAD}: 1.43 anton 3496: @cindex @code{PAD} use by nonstandard words 1.14 anton 3497: None. 3498: 3499: @item operator's terminal facilities available: 1.43 anton 3500: @cindex operator's terminal facilities available 1.26 anton 3501: After processing the command line, Gforth goes into interactive mode, 3502: and you can give commands to Gforth interactively. The actual facilities 3503: available depend on how you invoke Gforth. 1.14 anton 3504: 3505: @item program data space available: 1.43 anton 3506: @cindex program data space available 3507: @cindex data space available 1.42 anton 3508: @code{UNUSED .} gives the remaining dictionary space. The total 3509: dictionary space can be specified with the @code{-m} switch 1.43 anton 3510: (@pxref{Invoking Gforth}) when Gforth starts up. 1.14 anton 3511: 3512: @item return stack space available: 1.43 anton 3513: @cindex return stack space available 1.42 anton 3514: You can compute the total return stack space in cells with 3515: @code{s" RETURN-STACK-CELLS" environment? drop .}. You can specify it at 1.43 anton 3516: startup time with the @code{-r} switch (@pxref{Invoking Gforth}). 1.14 anton 3517: 3518: @item stack space available: 1.43 anton 3519: @cindex stack space available 1.42 anton 3520: You can compute the total data stack space in cells with 3521: @code{s" STACK-CELLS" environment? drop .}. You can specify it at 1.43 anton 3522: startup time with the @code{-d} switch (@pxref{Invoking Gforth}). 1.14 anton 3523: 3524: @item system dictionary space required, in address units: 1.43 anton 3525: @cindex system dictionary space required, in address units 1.14 anton 3526: Type @code{here forthstart - .} after startup. At the time of this 1.42 anton 3527: writing, this gives 80080 (bytes) on a 32-bit system. 1.14 anton 3528: @end table 3529: 3530: 3531: @c ===================================================================== 3532: @node The optional Block word set, The optional Double Number word set, The Core Words, ANS conformance 3533: @section The optional Block word set 3534: @c ===================================================================== 1.43 anton 3535: @cindex system documentation, block words 3536: @cindex block words, system documentation 1.14 anton 3537: 3538: @menu 1.43 anton 3539: * block-idef:: Implementation Defined Options 1.15 anton 3540: * block-ambcond:: Ambiguous Conditions 3541: * block-other:: Other System Documentation 1.14 anton 3542: @end menu 3543: 3544: 3545: @c --------------------------------------------------------------------- 3546: @node block-idef, block-ambcond, The optional Block word set, The optional Block word set 3547: @subsection Implementation Defined Options 3548: @c --------------------------------------------------------------------- 1.43 anton 3549: @cindex implementation-defined options, block words 3550: @cindex block words, implementation-defined options 1.14 anton 3551: 3552: @table @i 3553: @item the format for display by @code{LIST}: 1.43 anton 3554: @cindex @code{LIST} display format 1.14 anton 3555: First the screen number is displayed, then 16 lines of 64 characters, 3556: each line preceded by the line number. 3557: 3558: @item the length of a line affected by @code{\}: 1.43 anton 3559: @cindex length of a line affected by @code{\} 3560: @cindex @code{\}, line length in blocks 1.14 anton 3561: 64 characters. 3562: @end table 3563: 3564: 3565: @c --------------------------------------------------------------------- 3566: @node block-ambcond, block-other, block-idef, The optional Block word set 3567: @subsection Ambiguous conditions 3568: @c --------------------------------------------------------------------- 1.43 anton 3569: @cindex block words, ambiguous conditions 3570: @cindex ambiguous conditions, block words 1.14 anton 3571: 3572: @table @i 3573: @item correct block read was not possible: 1.43 anton 3574: @cindex block read not possible 1.14 anton 3575: Typically results in a @code{throw} of some OS-derived value (between 3576: -512 and -2048). If the blocks file was just not long enough, blanks are 3577: supplied for the missing portion. 3578: 3579: @item I/O exception in block transfer: 1.43 anton 3580: @cindex I/O exception in block transfer 3581: @cindex block transfer, I/O exception 1.14 anton 3582: Typically results in a @code{throw} of some OS-derived value (between 3583: -512 and -2048). 3584: 3585: @item invalid block number: 1.43 anton 3586: @cindex invalid block number 3587: @cindex block number invalid 1.14 anton 3588: @code{-35 throw} (Invalid block number) 3589: 3590: @item a program directly alters the contents of @code{BLK}: 1.43 anton 3591: @cindex @code{BLK}, altering @code{BLK} 1.14 anton}: 1.43 anton 3597: @cindex @code{UPDATE}, no current block buffer 1.14 anton 3598: @code{UPDATE} has no effect. 3599: 3600: @end table 3601: 3602: @c --------------------------------------------------------------------- 3603: @node block-other, , block-ambcond, The optional Block word set 3604: @subsection Other system documentation 3605: @c --------------------------------------------------------------------- 1.43 anton 3606: @cindex other system documentation, block words 3607: @cindex block words, other system documentation 1.14 anton ===================================================================== 1.43 anton 3623: @cindex system documentation, double words 3624: @cindex double words, system documentation 1.14 anton 3625: 3626: @menu 1.15 anton 3627: * double-ambcond:: Ambiguous Conditions 1.14 anton 3628: @end menu 3629: 3630: 3631: @c --------------------------------------------------------------------- 1.15 anton 3632: @node double-ambcond, , The optional Double Number word set, The optional Double Number word set 1.14 anton 3633: @subsection Ambiguous conditions 3634: @c --------------------------------------------------------------------- 1.43 anton 3635: @cindex double words, ambiguous conditions 3636: @cindex ambiguous conditions, double words 1.14 anton 3637: 3638: @table @i 1.15 anton 3639: @item @var{d} outside of range of @var{n} in @code{D>S}: 1.43 anton 3640: @cindex @code{D>S}, @var{d} out of range of @var{n} 1.14 anton ===================================================================== 1.43 anton 3650: @cindex system documentation, exception words 3651: @cindex exception words, system documentation 1.14 anton 3652: 3653: @menu 1.15 anton 3654: * exception-idef:: Implementation Defined Options 1.14 anton 3655: @end menu 3656: 3657: 3658: @c --------------------------------------------------------------------- 1.15 anton 3659: @node exception-idef, , The optional Exception word set, The optional Exception word set 1.14 anton 3660: @subsection Implementation Defined Options 3661: @c --------------------------------------------------------------------- 1.43 anton 3662: @cindex implementation-defined options, exception words 3663: @cindex exception words, implementation-defined options 1.14 anton 3664: 3665: @table @i 3666: @item @code{THROW}-codes used in the system: 1.43 an. 1.14 anton 3675: @end table 3676: 3677: @c ===================================================================== 3678: @node The optional Facility word set, The optional File-Access word set, The optional Exception word set, ANS conformance 3679: @section The optional Facility word set 3680: @c ===================================================================== 1.43 anton 3681: @cindex system documentation, facility words 3682: @cindex facility words, system documentation 1.14 anton 3683: 3684: @menu 1.15 anton 3685: * facility-idef:: Implementation Defined Options 3686: * facility-ambcond:: Ambiguous Conditions 1.14 anton 3687: @end menu 3688: 3689: 3690: @c --------------------------------------------------------------------- 3691: @node facility-idef, facility-ambcond, The optional Facility word set, The optional Facility word set 3692: @subsection Implementation Defined Options 3693: @c --------------------------------------------------------------------- 1.43 anton 3694: @cindex implementation-defined options, facility words 3695: @cindex facility words, implementation-defined options 1.14 anton 3696: 3697: @table @i 3698: @item encoding of keyboard events (@code{EKEY}): 1.43 anton 3699: @cindex keyboard events, encoding in @code{EKEY} 3700: @cindex @code{EKEY}, encoding of keyboard events 1.41 anton 3701: Not yet implemented. 1.14 anton 3702: 1.43 anton 3703: @item duration of a system clock tick: 3704: @cindex duration of a system clock tick 3705: @cindex clock tick duration 1.14 anton 3706: System dependent. With respect to @code{MS}, the time is specified in 3707: microseconds. How well the OS and the hardware implement this, is 3708: another question. 3709: 3710: @item repeatability to be expected from the execution of @code{MS}: 1.43 anton 3711: @cindex repeatability to be expected from the execution of @code{MS} 3712: @cindex @code{MS}, repeatability to be expected 1.14 anton 3713: System dependent. On Unix, a lot depends on load. If the system is 1.17 anton 3714: lightly loaded, and the delay is short enough that Gforth does not get 1.14 anton 3715: swapped out, the performance should be acceptable. Under MS-DOS and 3716: other single-tasking systems, it should be good. 3717: 3718: @end table 3719: 3720: 3721: @c --------------------------------------------------------------------- 1.15 anton 3722: @node facility-ambcond, , facility-idef, The optional Facility word set 1.14 anton 3723: @subsection Ambiguous conditions 3724: @c --------------------------------------------------------------------- 1.43 anton 3725: @cindex facility words, ambiguous conditions 3726: @cindex ambiguous conditions, facility words 1.14 anton 3727: 3728: @table @i 3729: @item @code{AT-XY} can't be performed on user output device: 1.43 anton 3730: @cindex @code{AT-XY} can't be performed on user output device 1.41 anton 3731: Largely terminal dependent. No range checks are done on the arguments. 1.14 anton ===================================================================== 1.43 anton 3742: @cindex system documentation, file words 3743: @cindex file words, system documentation 1.14 anton 3744: 3745: @menu 1.43 anton 3746: * file-idef:: Implementation Defined Options 1.15 anton 3747: * file-ambcond:: Ambiguous Conditions 1.14 anton 3748: @end menu 3749: 3750: @c --------------------------------------------------------------------- 3751: @node file-idef, file-ambcond, The optional File-Access word set, The optional File-Access word set 3752: @subsection Implementation Defined Options 3753: @c --------------------------------------------------------------------- 1.43 anton 3754: @cindex implementation-defined options, file words 3755: @cindex file words, implementation-defined options 1.14 anton 3756: 3757: @table @i 1.43 anton 3758: @item file access methods used: 3759: @cindex file access methods used 1.14 anton 3760: @code{R/O}, @code{R/W} and @code{BIN} work as you would 3761: expect. @code{W/O} translates into the C file opening mode @code{w} (or 3762: @code{wb}): The file is cleared, if it exists, and created, if it does 1.43 anton 3763: not (with both @code{open-file} and @code{create-file}). Under Unix 1.14 anton 3764: @code{create-file} creates a file with 666 permissions modified by your 3765: umask. 3766: 3767: @item file exceptions: 1.43 anton 3768: @cindex file exceptions 1.14 anton 3769: The file words do not raise exceptions (except, perhaps, memory access 3770: faults when you pass illegal addresses or file-ids). 3771: 3772: @item file line terminator: 1.43 anton 3773: @cindex file line terminator 1.14 anton 3774: System-dependent. Gforth uses C's newline character as line 3775: terminator. What the actual character code(s) of this are is 3776: system-dependent. 3777: 1.43 anton 3778: @item file name format: 3779: @cindex file name format 1.14 anton 3780: System dependent. Gforth just uses the file name format of your OS. 3781: 3782: @item information returned by @code{FILE-STATUS}: 1.43 anton 3783: @cindex @code{FILE-STATUS}, returned information 1.14 anton 3784: @code{FILE-STATUS} returns the most powerful file access mode allowed 3785: for the file: Either @code{R/O}, @code{W/O} or @code{R/W}. If the file 3786: cannot be accessed, @code{R/O BIN} is returned. @code{BIN} is applicable 1.41 anton 3787: along with the returned mode. 1.14 anton 3788: 3789: @item input file state after an exception when including source: 1.43 anton 3790: @cindex exception when including source 1.14 anton 3791: All files that are left via the exception are closed. 3792: 3793: @item @var{ior} values and meaning: 1.43 anton 3794: @cindex @var{ior} values and meaning 1.15 anton}. 1.14 anton 3799: 3800: @item maximum depth of file input nesting: 1.43 anton 3801: @cindex maximum depth of file input nesting 3802: @cindex file input nesting, maximum depth 1.14 anton 3803: limited by the amount of return stack, locals/TIB stack, and the number 3804: of open files available. This should not give you troubles. 3805: 3806: @item maximum size of input line: 1.43 anton 3807: @cindex maximum size of input line 3808: @cindex input line size, maximum 1.14 anton 3809: @code{/line}. Currently 255. 3810: 3811: @item methods of mapping block ranges to files: 1.43 anton 3812: @cindex mapping block ranges to files 3813: @cindex files containing blocks 3814: @cindex blocks in files 1.37 anton 3815: By default, blocks are accessed in the file @file{blocks.fb} in the 3816: current working directory. The file can be switched with @code{USE}. 1.14 anton 3817: 3818: @item number of string buffers provided by @code{S"}: 1.43 anton 3819: @cindex @code{S"}, number of string buffers 1.14 anton 3820: 1 3821: 3822: @item size of string buffer used by @code{S"}: 1.43 anton 3823: @cindex @code{S"}, size of string buffer 1.14 anton 3824: @code{/line}. currently 255. 3825: 3826: @end table 3827: 3828: @c --------------------------------------------------------------------- 1.15 anton 3829: @node file-ambcond, , file-idef, The optional File-Access word set 1.14 anton 3830: @subsection Ambiguous conditions 3831: @c --------------------------------------------------------------------- 1.43 anton 3832: @cindex file words, ambiguous conditions 3833: @cindex ambiguous conditions, file words 1.14 anton 3834: 3835: @table @i 1.43 anton 3836: @item attempting to position a file outside its boundaries: 3837: @cindex @code{REPOSITION-FILE}, outside the file's boundaries 1.14 anton 3838: @code{REPOSITION-FILE} is performed as usual: Afterwards, 3839: @code{FILE-POSITION} returns the value given to @code{REPOSITION-FILE}. 3840: 3841: @item attempting to read from file positions not yet written: 1.43 anton 3842: @cindex reading from file positions not yet written 1.14 anton 3843: End-of-file, i.e., zero characters are read and no error is reported. 3844: 3845: @item @var{file-id} is invalid (@code{INCLUDE-FILE}): 1.43 anton 3846: @cindex @code{INCLUDE-FILE}, @var{file-id} is invalid 1.14 anton 3847: An appropriate exception may be thrown, but a memory fault or other 3848: problem is more probable. 3849: 1.43 anton 3850: @item I/O exception reading or closing @var{file-id} (@code{INCLUDE-FILE}, @code{INCLUDED}): 3851: @cindex @code{INCLUDE-FILE}, I/O exception reading or closing @var{file-id} 3852: @cindex @code{INCLUDED}, I/O exception reading or closing @var{file-id} 1.14 anton 3853: The @var{ior} produced by the operation, that discovered the problem, is 3854: thrown. 3855: 1.43 anton 3856: @item named file cannot be opened (@code{INCLUDED}): 3857: @cindex @code{INCLUDED}, named file cannot be opened 1.14 anton 3858: The @var{ior} produced by @code{open-file} is thrown. 3859: 3860: @item requesting an unmapped block number: 1.43 anton 3861: @cindex unmapped block numbers 1.14 anton: 1.43 anton 3867: @cindex @code{SOURCE-ID}, behaviour when @code{BLK} is non-zero 1.14 anton 1.15 anton 3876: @section The optional Floating-Point word set 1.14 anton 3877: @c ===================================================================== 1.43 anton 3878: @cindex system documentation, floating-point words 3879: @cindex floating-point words, system documentation 1.14 anton 3880: 3881: @menu 1.15 anton 3882: * floating-idef:: Implementation Defined Options 3883: * floating-ambcond:: Ambiguous Conditions 1.14 anton 3884: @end menu 3885: 3886: 3887: @c --------------------------------------------------------------------- 3888: @node floating-idef, floating-ambcond, The optional Floating-Point word set, The optional Floating-Point word set 3889: @subsection Implementation Defined Options 3890: @c --------------------------------------------------------------------- 1.43 anton 3891: @cindex implementation-defined options, floating-point words 3892: @cindex floating-point words, implementation-defined options 1.14 anton 3893: 3894: @table @i 1.15 anton 3895: @item format and range of floating point numbers: 1.43 anton 3896: @cindex format and range of floating point numbers 3897: @cindex floating point numbers, format and range 1.15 anton 3898: System-dependent; the @code{double} type of C. 1.14 anton 3899: 1.15 anton 3900: @item results of @code{REPRESENT} when @var{float} is out of range: 1.43 anton 3901: @cindex @code{REPRESENT}, results when @var{float} is out of range 1.15 anton 3902: System dependent; @code{REPRESENT} is implemented using the C library 3903: function @code{ecvt()} and inherits its behaviour in this respect. 1.14 anton 3904: 1.15 anton 3905: @item rounding or truncation of floating-point numbers: 1.43 anton 3906: @cindex rounding of floating-point numbers 3907: @cindex truncation of floating-point numbers 3908: @cindex floating-point numbers, rounding or truncation 1.26 anton). 1.14 anton 3913: 1.15 anton 3914: @item size of floating-point stack: 1.43 anton 3915: @cindex floating-point stack size 1.42 anton 3916: @code{s" FLOATING-STACK" environment? drop .} gives the total size of 3917: the floating-point stack (in floats). You can specify this on startup 1.43 anton 3918: with the command-line option @code{-f} (@pxref{Invoking Gforth}). 1.14 anton 3919: 1.15 anton 3920: @item width of floating-point stack: 1.43 anton 3921: @cindex floating-point stack width 1.15 anton 3922: @code{1 floats}. 1.14 anton 3923: 3924: @end table 3925: 3926: 3927: @c --------------------------------------------------------------------- 1.15 anton 3928: @node floating-ambcond, , floating-idef, The optional Floating-Point word set 3929: @subsection Ambiguous conditions 1.14 anton 3930: @c --------------------------------------------------------------------- 1.43 anton 3931: @cindex floating-point words, ambiguous conditions 3932: @cindex ambiguous conditions, floating-point words 1.14 anton 3933: 3934: @table @i 1.15 anton 3935: @item @code{df@@} or @code{df!} used with an address that is not double-float aligned: 1.43 anton 3936: @cindex @code{df@@} or @code{df!} used with an address that is not double-float aligned 1.37 anton 3937: System-dependent. Typically results in a @code{-23 THROW} like other 1.15 anton 3938: alignment violations. 1.14 anton 3939: 1.15 anton 3940: @item @code{f@@} or @code{f!} used with an address that is not float aligned: 1.43 anton 3941: @cindex @code{f@@} used with an address that is not float aligned 3942: @cindex @code{f!} used with an address that is not float aligned 1.37 anton 3943: System-dependent. Typically results in a @code{-23 THROW} like other 1.15 anton 3944: alignment violations. 1.14 anton 3945: 1.43 anton 3946: @item floating-point result out of range: 3947: @cindex floating-point result out of range 1.15 anton 3948: System-dependent. Can result in a @code{-55 THROW} (Floating-point 3949: unidentified fault), or can produce a special value representing, e.g., 3950: Infinity. 1.14 anton 3951: 1.15 anton 3952: @item @code{sf@@} or @code{sf!} used with an address that is not single-float aligned: 1.43 anton 3953: @cindex @code{sf@@} or @code{sf!} used with an address that is not single-float aligned 1.15 anton 3954: System-dependent. Typically results in an alignment fault like other 3955: alignment violations. 1.14 anton 3956: 1.43 anton 3957: @item @code{BASE} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.}): 3958: @cindex @code{BASE} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.}) 1.15 anton 3959: The floating-point number is converted into decimal nonetheless. 1.14 anton 3960: 1.15 anton 3961: @item Both arguments are equal to zero (@code{FATAN2}): 1.43 anton 3962: @cindex @code{FATAN2}, both arguments are equal to zero 1.15 anton 3963: System-dependent. @code{FATAN2} is implemented using the C library 3964: function @code{atan2()}. 1.14 anton 3965: 1.43 anton 3966: @item Using @code{FTAN} on an argument @var{r1} where cos(@var{r1}) is zero: 3967: @cindex @code{FTAN} on an argument @var{r1} where cos(@var{r1}) is zero 1.15 anton 3968: System-dependent. Anyway, typically the cos of @var{r1} will not be zero 3969: because of small errors and the tan will be a very large (or very small) 3970: but finite number. 1.14 anton 3971: 1.15 anton 3972: @item @var{d} cannot be presented precisely as a float in @code{D>F}: 1.43 anton 3973: @cindex @code{D>F}, @var{d} cannot be presented precisely as a float 1.15 anton 3974: The result is rounded to the nearest float. 1.14 anton 3975: 1.15 anton 3976: @item dividing by zero: 1.43 anton 3977: @cindex dividing by zero, floating-point 3978: @cindex floating-point dividing by zero 3979: @cindex floating-point unidentified fault, FP divide-by-zero 1.15 anton 3980: @code{-55 throw} (Floating-point unidentified fault) 1.14 anton 3981: 1.15 anton 3982: @item exponent too big for conversion (@code{DF!}, @code{DF@@}, @code{SF!}, @code{SF@@}): 1.43 anton 3983: @cindex exponent too big for conversion (@code{DF!}, @code{DF@@}, @code{SF!}, @code{SF@@}) 1.15 anton 3984: System dependent. On IEEE-FP based systems the number is converted into 3985: an infinity. 1.14 anton 3986: 1.43 anton 3987: @item @var{float}<1 (@code{FACOSH}): 3988: @cindex @code{FACOSH}, @var{float}<1 3989: @cindex floating-point unidentified fault, @code{FACOSH} 1.15 anton 3990: @code{-55 throw} (Floating-point unidentified fault) 1.14 anton 3991: 1.43 anton 3992: @item @var{float}=<-1 (@code{FLNP1}): 3993: @cindex @code{FLNP1}, @var{float}=<-1 3994: @cindex floating-point unidentified fault, @code{FLNP1} 1.15 anton 3995: @code{-55 throw} (Floating-point unidentified fault). On IEEE-FP systems 3996: negative infinity is typically produced for @var{float}=-1. 1.14 anton 3997: 1.43 anton 3998: @item @var{float}=<0 (@code{FLN}, @code{FLOG}): 3999: @cindex @code{FLN}, @var{float}=<0 4000: @cindex @code{FLOG}, @var{float}=<0 4001: @cindex floating-point unidentified fault, @code{FLN} or @code{FLOG} 1.15 anton 4002: @code{-55 throw} (Floating-point unidentified fault). On IEEE-FP systems 4003: negative infinity is typically produced for @var{float}=0. 1.14 anton 4004: 1.43 anton} 1.15 anton 4009: @code{-55 throw} (Floating-point unidentified fault). @code{fasinh} 4010: produces values for these inputs on my Linux box (Bug in the C library?) 1.14 anton 4011: 1.43 anton} 1.15 anton 4017: @code{-55 throw} (Floating-point unidentified fault). 1.14 anton 4018: 1.43 anton 4019: @item integer part of float cannot be represented by @var{d} in @code{F>D}: 4020: @cindex @code{F>D}, integer part of float cannot be represented by @var{d} 4021: @cindex floating-point unidentified fault, @code{F>D} 1.15 anton 4022: @code{-55 throw} (Floating-point unidentified fault). 1.14 anton 4023: 1.15 anton 4024: @item string larger than pictured numeric output area (@code{f.}, @code{fe.}, @code{fs.}): 1.43 anton 4025: @cindex string larger than pictured numeric output area (@code{f.}, @code{fe.}, @code{fs.}) 1.15 anton 4026: This does not happen. 4027: @end table 1.14 anton 4028: 4029: @c ===================================================================== 1.15 anton 4030: @node The optional Locals word set, The optional Memory-Allocation word set, The optional Floating-Point word set, ANS conformance 4031: @section The optional Locals word set 1.14 anton 4032: @c ===================================================================== 1.43 anton 4033: @cindex system documentation, locals words 4034: @cindex locals words, system documentation 1.14 anton 4035: 4036: @menu 1.15 anton 4037: * locals-idef:: Implementation Defined Options 4038: * locals-ambcond:: Ambiguous Conditions 1.14 anton 4039: @end menu 4040: 4041: 4042: @c --------------------------------------------------------------------- 1.15 anton 4043: @node locals-idef, locals-ambcond, The optional Locals word set, The optional Locals word set 1.14 anton 4044: @subsection Implementation Defined Options 4045: @c --------------------------------------------------------------------- 1.43 anton 4046: @cindex implementation-defined options, locals words 4047: @cindex locals words, implementation-defined options 1.14 anton 4048: 4049: @table @i 1.15 anton 4050: @item maximum number of locals in a definition: 1.43 anton 4051: @cindex maximum number of locals in a definition 4052: @cindex locals, maximum number in a definition 1.15 anton. 1.14 anton 4057: 4058: @end table 4059: 4060: 4061: @c --------------------------------------------------------------------- 1.15 anton 4062: @node locals-ambcond, , locals-idef, The optional Locals word set 1.14 anton 4063: @subsection Ambiguous conditions 4064: @c --------------------------------------------------------------------- 1.43 anton 4065: @cindex locals words, ambiguous conditions 4066: @cindex ambiguous conditions, locals words 1.14 anton 4067: 4068: @table @i 1.15 anton 4069: @item executing a named local in interpretation state: 1.43 an). 1.14 anton 4076: 1.15 anton 4077: @item @var{name} not defined by @code{VALUE} or @code{(LOCAL)} (@code{TO}): 1.43 anton 4078: @cindex name not defined by @code{VALUE} or @code{(LOCAL)} used by @code{TO} 4079: @cindex @code{TO} on non-@code{VALUE}s and non-locals 4080: @cindex Invalid name argument, @code{TO} 1.15 anton 4081: @code{-32 throw} (Invalid name argument) 1.14 anton 4082: 4083: @end table 4084: 4085: 4086: @c ===================================================================== 1.15 anton 4087: @node The optional Memory-Allocation word set, The optional Programming-Tools word set, The optional Locals word set, ANS conformance 4088: @section The optional Memory-Allocation word set 1.14 anton 4089: @c ===================================================================== 1.43 anton 4090: @cindex system documentation, memory-allocation words 4091: @cindex memory-allocation words, system documentation 1.14 anton 4092: 4093: @menu 1.15 anton 4094: * memory-idef:: Implementation Defined Options 1.14 anton 4095: @end menu 4096: 4097: 4098: @c --------------------------------------------------------------------- 1.15 anton 4099: @node memory-idef, , The optional Memory-Allocation word set, The optional Memory-Allocation word set 1.14 anton 4100: @subsection Implementation Defined Options 4101: @c --------------------------------------------------------------------- 1.43 anton 4102: @cindex implementation-defined options, memory-allocation words 4103: @cindex memory-allocation words, implementation-defined options 1.14 anton 4104: 4105: @table @i 1.15 anton 4106: @item values and meaning of @var{ior}: 1.43 anton 4107: @cindex @var{ior} values and meaning 1.15 anton}. 1.14 anton 4112: 4113: @end table 4114: 4115: @c ===================================================================== 1.15 anton 4116: @node The optional Programming-Tools word set, The optional Search-Order word set, The optional Memory-Allocation word set, ANS conformance 4117: @section The optional Programming-Tools word set 1.14 anton 4118: @c ===================================================================== 1.43 anton 4119: @cindex system documentation, programming-tools words 4120: @cindex programming-tools words, system documentation 1.14 anton 4121: 4122: @menu 1.15 anton 4123: * programming-idef:: Implementation Defined Options 4124: * programming-ambcond:: Ambiguous Conditions 1.14 anton 4125: @end menu 4126: 4127: 4128: @c --------------------------------------------------------------------- 1.15 anton 4129: @node programming-idef, programming-ambcond, The optional Programming-Tools word set, The optional Programming-Tools word set 1.14 anton 4130: @subsection Implementation Defined Options 4131: @c --------------------------------------------------------------------- 1.43 anton 4132: @cindex implementation-defined options, programming-tools words 4133: @cindex programming-tools words, implementation-defined options 1.14 anton 4134: 4135: @table @i 1.43 anton 1.37 anton 4145: the input is processed by the text interpreter, (starting) in interpret 4146: state. 1.15 anton 4147: 4148: @item search order capability for @code{EDITOR} and @code{ASSEMBLER}: 1.43 anton 4149: @cindex @code{ASSEMBLER}, search order capability 1.37 anton 4150: The ANS Forth search order word set. 1.15 anton 4151: 4152: @item source and format of display by @code{SEE}: 1.43 anton 4153: @cindex @code{SEE}, source and format of output 1.15 anton 4154: The source for @code{see} is the intermediate code used by the inner 4155: interpreter. The current @code{see} tries to output Forth source code 4156: as well as possible. 4157: 1.14 anton 4158: @end table 4159: 4160: @c --------------------------------------------------------------------- 1.15 anton 4161: @node programming-ambcond, , programming-idef, The optional Programming-Tools word set 1.14 anton 4162: @subsection Ambiguous conditions 4163: @c --------------------------------------------------------------------- 1.43 anton 4164: @cindex programming-tools words, ambiguous conditions 4165: @cindex ambiguous conditions, programming-tools words 1.14 anton 4166: 4167: @table @i 4168: 1.15 anton 4169: @item deleting the compilation wordlist (@code{FORGET}): 1.43 anton 4170: @cindex @code{FORGET}, deleting the compilation wordlist 1.15 anton 4171: Not implemented (yet). 1.14 anton 4172: 1.15 anton 4173: @item fewer than @var{u}+1 items on the control flow stack (@code{CS-PICK}, @code{CS-ROLL}): 1.43 anton 4174: @cindex @code{CS-PICK}, fewer than @var{u}+1 items on the control flow stack 4175: @cindex @code{CS-ROLL}, fewer than @var{u}+1 items on the control flow stack 4176: @cindex control-flow stack underflow 1.15 anton: 1.43 anton 4182: @item @var{name} can't be found (@code{FORGET}): 4183: @cindex @code{FORGET}, @var{name} can't be found 1.15 anton 4184: Not implemented (yet). 1.14 anton 4185: 1.15 anton 4186: @item @var{name} not defined via @code{CREATE}: 1.43 anton 4187: @cindex @code{;CODE}, @var{name} not defined via @code{CREATE} 4188: @code{;CODE} behaves like @code{DOES>} in this respect, i.e., it changes 1.37 anton 4189: the execution semantics of the last defined word no matter how it was 4190: defined. 1.14 anton 4191: 1.15 anton 4192: @item @code{POSTPONE} applied to @code{[IF]}: 1.43 anton 4193: @cindex @code{POSTPONE} applied to @code{[IF]} 4194: @cindex @code{[IF]} and @code{POSTPONE} 1.15 anton 4195: After defining @code{: X POSTPONE [IF] ; IMMEDIATE}. @code{X} is 4196: equivalent to @code{[IF]}. 1.14 anton 4197: 1.15 anton 4198: @item reaching the end of the input source before matching @code{[ELSE]} or @code{[THEN]}: 1.43 anton 4199: @cindex @code{[IF]}, end of the input source before matching @code{[ELSE]} or @code{[THEN]} 1.15 anton 4200: Continue in the same state of conditional compilation in the next outer 4201: input source. Currently there is no warning to the user about this. 1.14 anton 4202: 1.15 anton 4203: @item removing a needed definition (@code{FORGET}): 1.43 anton 4204: @cindex @code{FORGET}, removing a needed definition 1.15 anton 4205: Not implemented (yet). 1.14 anton 4206: 4207: @end table 4208: 4209: 4210: @c ===================================================================== 1.15 anton 4211: @node The optional Search-Order word set, , The optional Programming-Tools word set, ANS conformance 4212: @section The optional Search-Order word set 1.14 anton 4213: @c ===================================================================== 1.43 anton 4214: @cindex system documentation, search-order words 4215: @cindex search-order words, system documentation 1.14 anton 4216: 4217: @menu 1.15 anton 4218: * search-idef:: Implementation Defined Options 4219: * search-ambcond:: Ambiguous Conditions 1.14 anton 4220: @end menu 4221: 4222: 4223: @c --------------------------------------------------------------------- 1.15 anton 4224: @node search-idef, search-ambcond, The optional Search-Order word set, The optional Search-Order word set 1.14 anton 4225: @subsection Implementation Defined Options 4226: @c --------------------------------------------------------------------- 1.43 anton 4227: @cindex implementation-defined options, search-order words 4228: @cindex search-order words, implementation-defined options 1.14 anton 4229: 4230: @table @i 1.15 anton 4231: @item maximum number of word lists in search order: 1.43 anton 4232: @cindex maximum number of word lists in search order 4233: @cindex search order, maximum depth 1.15 anton 4234: @code{s" wordlists" environment? drop .}. Currently 16. 4235: 4236: @item minimum search order: 1.43 anton 4237: @cindex minimum search order 4238: @cindex search order, minimum 1.15 anton 4239: @code{root root}. 1.14 anton 4240: 4241: @end table 4242: 4243: @c --------------------------------------------------------------------- 1.15 anton 4244: @node search-ambcond, , search-idef, The optional Search-Order word set 1.14 anton 4245: @subsection Ambiguous conditions 4246: @c --------------------------------------------------------------------- 1.43 anton 4247: @cindex search-order words, ambiguous conditions 4248: @cindex ambiguous conditions, search-order words 1.14 anton 4249: 4250: @table @i 1.15 anton 4251: @item changing the compilation wordlist (during compilation): 1.43 anton 4252: @cindex changing the compilation wordlist (during compilation) 4253: @cindex compilation wordlist, change before definition ends 1.33 anton. 1.14 anton 4259: 1.15 anton 4260: @item search order empty (@code{previous}): 1.43 anton 4261: @cindex @code{previous}, search order empty 4262: @cindex Vocstack empty, @code{previous} 1.15 anton 4263: @code{abort" Vocstack empty"}. 1.14 anton 4264: 1.15 anton 4265: @item too many word lists in search order (@code{also}): 1.43 anton 4266: @cindex @code{also}, too many word lists in search order 4267: @cindex Vocstack full, @code{also} 1.15 anton 4268: @code{abort" Vocstack full"}. 1.14 anton 4269: 4270: @end table 1.13 anton 4271: 1.43 anton 4272: @c *************************************************************** 1.34 anton 4273: @node Model, Integrating Gforth, ANS conformance, Top 4274: @chapter Model 4275: 4276: This chapter has yet to be written. It will contain information, on 4277: which internal structures you can rely. 4278: 1.43 anton 4279: @c *************************************************************** 1.34 anton 1.36 anton 4290: importantly, it is not based on ANS Forth, and it is apparently dead 1.34 anton 1.36 anton 4307: variables of the interface with @code{#include <forth.h>}. 1.34 anton 4308: 4309: Types. 1.13 anton 4310: 1.34 anton 1.4 anton 4329: 1.43 anton 4330: @node Emacs and Gforth, Image Files, Integrating Gforth, Top 1.17 anton 4331: @chapter Emacs and Gforth 1.43 anton 4332: @cindex Emacs and Gforth 1.4 anton 4333: 1.43 anton 1.17 anton 4342: Gforth comes with @file{gforth.el}, an improved version of 1.33 anton 4343: @file{forth.el} by Goran Rydqvist (included in the TILE package). The 1.4 anton 4344: improvements are a better (but still not perfect) handling of 4345: indentation. I have also added comment paragraph filling (@kbd{M-q}), 1.8 anton}. 1.4 anton 4351: 1.43 anton 4352: @cindex source location of error or debugging output in Emacs 4353: @cindex error output, finding the source location in Emacs 4354: @cindex debugging output, finding the source location in Emacs 1.17 anton 4355: In addition, Gforth supports Emacs quite well: The source code locations 1.4 anton: 1.43 anton 4363: @cindex @file{TAGS} file 4364: @cindex @file{etags.fs} 4365: @cindex viewing the source of a word in Emacs 1.4 anton 1.17 anton 4370: several tags files at the same time (e.g., one for the Gforth sources 1.28 anton 4371: and one for your program, @pxref{Select Tags Table,,Selecting a Tags 4372: Table,emacs, Emacs Manual}). The TAGS file for the preloaded words is 4373: @file{$(datadir)/gforth/$(VERSION)/TAGS} (e.g., 1.33 anton 4374: @file{/usr/local/share/gforth/0.2.0/TAGS}). 1.4 anton 4375: 1.43 anton 4376: @cindex @file{.emacs} 1.4 anton: 1.43 anton. 1.45 anton 4401: * Fully Relocatable Image Files:: better yet. 1.43 anton 1.45 anton 4412: definitions written in Forth. Since the Forth compiler itself belongs to 4413: those definitions, it is not possible to start the system with the 1.43 anton 4414: primitives and the Forth source alone. Therefore we provide the Forth 4415: code as an image file in nearly executable form. At the start of the 1.45 anton 4416: system a C routine loads the image file into memory, optionally 4417: relocates the addresses, then sets up the memory (stacks etc.) according 4418: to information in the image file, and starts executing Forth code. 1.43 anton 1.45 anton 4431: By contrast, our loader performs relocation at image load time. The 4432: loader also has to replace tokens standing for primitive calls with the 4433: appropriate code-field addresses (or code addresses in the case of 4434: direct threading). 1.43 anton 1.44 anton 4453: The only kinds of relocation supported are: adding the same offset to 4454: all cells that represent data addresses; and replacing special tokens 4455: with code addresses or with pieces of machine code. 1.43 anton).} 1.44 anton 1.45 anton 4480: executions tokens of appropriate words (see the definitions of 1.44 anton 4481: @code{docol:} and friends in @file{kernel.fs}). 1.43 anton., 1.45 anton 1.43 anton 4528: 1.45 anton} 1.43 anton 4548: @cindex @file{comp-image.fs} 1.45 anton 4549: @cindex @file{gforth-makeimage} 1.43 anton 4550: 1.45 anton 4551: You will usually use @file{gforth-makeimage}. If you want to create an 4552: image @var{file} that contains everything you would load by invoking 4553: Gforth with @code{gforth @var{options}}, you simply say 1.43 anton 4554: @example 1.45 anton 4555: gforth-makeimage @var{file} @var{options} 1.43 anton 1.45 anton 4563: gforth-makeimage asm.fi asm.fs 1.43 anton 4564: @end example 4565: 1.45 anton: 1.43 anton 4574: 1.45 anton 4575: @example 4576: 78DC BFFFFA50 BFFFFA40 4577: @end example 1.43 anton 4578: 1.45 anton). 1.43 anton 4584: 1.48 ! anton} 1.45 anton} 1.43 anton 4603: @cindex cross-compiler 4604: @cindex metacompiler 1.45 anton 4605: 4606: You can also use @code{cross}, a batch compiler that accepts a Forth-like 4607: programming language. This @code{cross} language has to be documented 1.43 anton 4608: yet. 4609: 4610: @cindex target compiler 1.45 anton: 1.43 anton 1.45 anton: 1.43 anton 4632: 4633: @example 1.45 anton 4634: gforth-makeimage gforth.fi -m 1M 1.43 anton 4635: @end example 4636: 4637: In other words, if you want to set the default size for the dictionary 1.45 anton 4638: and the stacks of an image, just invoke @file{gforth-makeimage} with the 4639: appropriate options when creating the image. 1.43 anton 1.48 ! anton}}. 1.43 anton 4668: 1.48 ! anton 4669: doc-#! 1.43 anton 1.45 anton 4683: processing (by default, loading files and evaluating (@code{-e}) strings) 1.43 anton: 1.48 ! anton: 1.43 anton 4715: @c ****************************************************************** 4716: @node Engine, Bugs, Image Files, Top 4717: @chapter Engine 4718: @cindex engine 4719: @cindex virtual machine 1.3 anton 4720: 1.17 anton 4721: Reading this section is not necessary for programming with Gforth. It 1.43 anton 4722: may be helpful for finding your way in the Gforth sources. 1.3 anton 4723: 1.24 anton 1.48 ! anton 4728: @*@url{}. 1.24 anton 4729: 1.4 anton 4730: @menu 4731: * Portability:: 4732: * Threading:: 4733: * Primitives:: 1.17 anton 4734: * Performance:: 1.4 anton 4735: @end menu 4736: 1.43 anton 4737: @node Portability, Threading, Engine, Engine 1.3 anton 4738: @section Portability 1.43 anton 4739: @cindex engine portability 1.3 anton: 1.43 anton 4747: @cindex C, using C for the engine 1.3 anton 1.43 anton 4755: significantly slower. Another problem with C is that it is very 1.3 anton 4756: cumbersome to express double integer arithmetic. 4757: 1.43 anton 4758: @cindex GNU C for the engine 4759: @cindex long long 1.3 anton, , 1.33 anton 4766: Double-Word Integers, gcc.info, GNU C Manual}) corresponds to Forth's 1.32 anton. 1.3 anton 4777: 4778: Writing in a portable language has the reputation of producing code that 4779: is slower than assembly. For our Forth engine we repeatedly looked at 4780: the code produced by the compiler and eliminated most compiler-induced 1.43 anton 4781: inefficiencies by appropriate changes in the source code. 1.3 anton 4782: 1.43 anton 4783: @cindex explicit register declarations 4784: @cindex --enable-force-reg, configuration flag 4785: @cindex -DFORCE_REG 1.3 anton 1.43 anton. 1.3 anton 4796: 1.43 anton 4797: @node Threading, Primitives, Portability, Engine 1.3 anton 4798: @section Threading 1.43 anton 4799: @cindex inner interpreter implementation 4800: @cindex threaded code implementation 1.3 anton 4801: 1.43 anton 4802: @cindex labels as values 1.3 anton: 1.43 anton 4810: @cindex NEXT, indirect threaded 4811: @cindex indirect threaded inner interpreter 4812: @cindex inner interpreter, indirect threaded 1.3 anton 4813: With this feature an indirect threaded NEXT looks like: 4814: @example 4815: cfa = *ip++; 4816: ca = *cfa; 4817: goto *ca; 4818: @end example 1.43 anton 4819: @cindex instruction pointer 1.3 anton: 1.43 anton 4827: @cindex NEXT, direct threaded 4828: @cindex direct threaded inner interpreter 4829: @cindex inner interpreter, direct threaded 1.3 anton: 1.4 anton 4839: @menu 4840: * Scheduling:: 4841: * Direct or Indirect Threaded?:: 4842: * DOES>:: 4843: @end menu 4844: 4845: @node Scheduling, Direct or Indirect Threaded?, Threading, Threading 1.3 anton 4846: @subsection Scheduling 1.43 anton 4847: @cindex inner interpreter optimization 1.3 anton 1.4 anton: 1.3 anton 4872: @example 4873: n=sp[0]+sp[1]; 4874: sp++; 4875: NEXT_P1; 4876: sp[0]=n; 4877: NEXT_P2; 4878: @end example 1.4 anton 4879: This can be scheduled optimally by the compiler. 1.3 anton 4880: 4881: This division can be turned off with the switch @code{-DCISC_NEXT}. This 4882: switch is on by default on machines that do not profit from scheduling 4883: (e.g., the 80386), in order to preserve registers. 4884: 1.4 anton 4885: @node Direct or Indirect Threaded?, DOES>, Scheduling, Threading 1.3 anton 4886: @subsection Direct or Indirect Threaded? 1.43 anton 4887: @cindex threading, direct or indirect? 1.3 anton 4888: 1.43 anton 4889: @cindex -DDIRECT_THREADED 1.3 anton: 1.43 anton. 1.3 anton 4910: 1.4 anton 4911: @node DOES>, , Direct or Indirect Threaded?, Threading 1.3 anton 4912: @subsection DOES> 1.43 anton 4913: @cindex @code{DOES>} implementation 4914: 4915: @cindex dodoes routine 4916: @cindex DOES-code 1.3 anton 4917: One of the most complex parts of a Forth engine is @code{dodoes}, i.e., 4918: the chunk of code executed by every word defined by a 4919: @code{CREATE}...@code{DOES>} pair. The main problem here is: How to find 1.43 anton 4920: the Forth code to be executed, i.e. the code after the 4921: @code{DOES>} (the DOES-code)? There are two solutions: 1.3 anton 4922: 4923: In fig-Forth the code field points directly to the dodoes and the 1.43 anton 4924: DOES-code address is stored in the cell after the code address (i.e. at 4925: @code{@var{cfa} cell+}). It may seem that this solution is illegal in 4926: the Forth-79 and all later standards, because in fig-Forth this address 1.3 anton 4927: lies in the body (which is illegal in these standards). However, by 4928: making the code field larger for all words this solution becomes legal 1.43 anton). 1.3 anton 4936: 1.43 anton 4937: @cindex DOES-handler 1.3 anton 4938: The other approach is that the code field points or jumps to the cell 4939: after @code{DOES}. In this variant there is a jump to @code{dodoes} at 1.43 anton. 1.3 anton 4949: 1.43 anton 4950: @node Primitives, Performance, Threading, Engine 1.3 anton 4951: @section Primitives 1.43 anton 4952: @cindex primitives, implementation 4953: @cindex virtual machine instructions, implementation 1.3 anton 4954: 1.4 anton 4955: @menu 4956: * Automatic Generation:: 4957: * TOS Optimization:: 4958: * Produced code:: 4959: @end menu 4960: 4961: @node Automatic Generation, TOS Optimization, Primitives, Primitives 1.3 anton 4962: @subsection Automatic Generation 1.43 anton 4963: @cindex primitives, automatic generation 1.3 anton 4964: 1.43 anton 4965: @cindex @file{prims2x.fs} 1.3 anton 4966: Since the primitives are implemented in a portable language, there is no 4967: longer any need to minimize the number of primitives. On the contrary, 1.43 anton 4968: having many primitives has an advantage: speed. In order to reduce the 1.3 anton: 1.43 anton 4975: @cindex primitive source format 1.3 anton */ 1.4 anton 5006: @{ 1.3 anton) */ 1.4 anton 5015: @{ 1.3 anton 5016: n = n1+n2; /* C code taken from the source */ 1.4 anton 5017: @} 1.3 anton 5018: NEXT_P1; /* NEXT part 1 */ 5019: TOS = (Cell)n; /* output */ 5020: NEXT_P2; /* NEXT part 2 */ 1.4 anton 5021: @} 1.3 anton: 1.4 anton 5043: @node TOS Optimization, Produced code, Automatic Generation, Primitives 1.3 anton 5044: @subsection TOS Optimization 1.43 anton 5045: @cindex TOS optimization for primitives 5046: @cindex primitives, keeping the TOS in a register 1.3 anton 5047: 5048: An important optimization for stack machine emulators, e.g., Forth 5049: engines, is keeping one or more of the top stack items in 1.4 anton 5050: registers. If a word has the stack effect @var{in1}...@var{inx} @code{--} 5051: @var{out1}...@var{outy}, keeping the top @var{n} items in registers 1.34 anton 5052: @itemize @bullet 1.3 anton: 1.43 anton 5060: @cindex -DUSE_TOS 5061: @cindex -DUSE_NO_TOS 1.3 anton: 1.43 anton 5074: @cindex -DUSE_FTOS 5075: @cindex -DUSE_NO_FTOS 1.3 anton: 1.34 anton 5090: @itemize @bullet 1.3 anton 5091: @item In the case of @code{dup ( w -- w w )} the generator must not 5092: eliminate the store to the original location of the item on the stack, 5093: if the TOS optimization is turned on. 1.4 anton 5094: @item Primitives with stack effects of the form @code{--} 5095: @var{out1}...@var{outy} must store the TOS to the stack at the start. 5096: Likewise, primitives with the stack effect @var{in1}...@var{inx} @code{--} 1.3 anton 5097: must load the TOS from the stack at the end. But for the null stack 5098: effect @code{--} no stores or loads should be generated. 5099: @end itemize 5100: 1.4 anton 5101: @node Produced code, , TOS Optimization, Primitives 1.3 anton 5102: @subsection Produced code 1.43 anton 5103: @cindex primitives, assembly code listing 1.3 anton 5104: 1.43 anton 5105: @cindex @file{engine.s} 1.3 anton 5106: To see what assembly code is produced for the primitives on your machine 5107: with your compiler and your flag settings, type @code{make engine.s} and 1.4 anton 5108: look at the resulting file @file{engine.s}. 1.3 anton 5109: 1.43 anton 5110: @node Performance, , Primitives, Engine 1.17 anton 5111: @section Performance 1.43 anton 5112: @cindex performance of some Forth interpreters 5113: @cindex engine performance 5114: @cindex benchmarking Forth systems 5115: @cindex Gforth performance 1.17 anton: 1.43 anton 5128: @cindex Win32Forth performance 5129: @cindex NT Forth performance 5130: @cindex eforth performance 5131: @cindex ThisForth performance 5132: @cindex PFE performance 5133: @cindex TILE performance 1.17 anton 5134: However, this potential advantage of assembly language implementations 5135: is not necessarily realized in complete Forth systems: We compared 1.26 anton 1.30 anton 5140: language. We also compared Gforth with three systems written in C: 1.32 anton. 1.17 anton 5152: 5153: We used four small benchmarks: the ubiquitous Sieve; bubble-sorting and 5154: matrix multiplication come from the Stanford integer benchmarks and have 5155: been translated into Forth by Martin Fraeman; we used the versions 1.30 anton). 1.17 anton 5161: 5162: @example 1.30 anton 5163: relative Win32- NT eforth This- 5164: time Gforth Forth Forth eforth +opt PFE Forth TILE 1.32 anton 5165: sieve 1.00 1.39 1.14 1.39 0.85 1.58 3.18 8.58 5166: bubble 1.00 1.31 1.41 1.48 0.88 1.50 3.88 1.38 anton 5167: matmul 1.00 1.47 1.35 1.46 0.74 1.58 4.09 5168: fib 1.00 1.52 1.34 1.22 0.86 1.74 2.99 4.30 1.17 anton 1.43 anton 5178: per NEXT (@pxref{Image File Background}). 1.17 anton 5179: 1.26 anton: 1.30 anton 5185: The speedup of Gforth over PFE, ThisForth and TILE can be easily 1.43 anton. 1.17 anton: 1.43 anton} 1.26 anton 1.46 anton 5208: version of Gforth is 2%@minus{}8% slower on a 486 than the direct 5209: threaded version used here. The paper available at 1.48 ! anton 5210: @*@url{}; 1.43 anton 5211: it also contains numbers for some native code systems. You can find a 5212: newer version of these measurements at 1.48 ! anton 5213: @url{}. You can 1.43 anton 5214: find numbers for Gforth on various machines in @file{Benchres}. 1.24 anton 5215: 1.43 anton 5216: @node Bugs, Origin, Engine, Top 1.4 anton 5217: @chapter Bugs 1.43 anton 5218: @cindex bug reporting 1.4 anton 5219: 1.17 anton 5220: Known bugs are described in the file BUGS in the Gforth distribution. 5221: 1.24 anton 5222: If you find a bug, please send a bug report to 1.48 ! anton 5223: @email{bug-gforth@@gnu.ai.mit.edu}. A bug report should 1.17 anton 5224: describe the Gforth version used (it is announced at the start of an 5225: interactive Gforth session), the machine and operating system (on Unix 5226: systems you can use @code{uname -a} to produce this information), the 1.43 anton 5227: installation options (send the @file{config.status} file), and a 1.24 anton. 1.17 anton 5232: 5233: For a thorough guide on reporting bugs read @ref{Bug Reporting, , How 5234: to Report Bugs, gcc.info, GNU C Manual}. 5235: 5236: 1.29 anton 5237: @node Origin, Word Index, Bugs, Top 5238: @chapter Authors and Ancestors of Gforth 5239: 5240: @section Authors and Contributors 1.43 anton 5241: @cindex authors of Gforth 5242: @cindex contributors to Gforth 1.29 anton 5243: 5244: The Gforth project was started in mid-1992 by Bernd Paysan and Anton 1.30 1.29 anton 5248: @file{glosgen.fs}, while Stuart Ramsden has been working on automatic 5249: support for calling C libraries. Helpful comments also came from Paul 1.37 anton 5250: Kleinrubatscher, Christian Pirker, Dirk Zoller, Marcel Hendrix, John 1.39 anton 5251: Wavrik, Barrie Stott and Marc de Groot. 1.29 anton 5252: 1.30 anton: 1.29 anton 5258: @section Pedigree 1.43 anton 5259: @cindex Pedigree of Gforth 1.4 anton 5260: 1.17 anton 5261: Gforth descends from BigForth (1993) and fig-Forth. Gforth and PFE (by 1.24 anton 5262: Dirk Zoller) will cross-fertilize each other. Of course, a significant 5263: part of the design of Gforth was prescribed by ANS Forth. 1.17 anton 5264: 1.23 pazsan 1.24 anton 5271: UltraForth there) in the mid-80s and ported to the Atari ST in 1986. 1.17 anton 5272: 1.34 anton 5273: Henry Laxen and Mike Perry wrote F83 as a model implementation of the 1.17 anton 5274: Forth-83 standard. !! Pedigree? When? 5275: 5276: A team led by Bill Ragsdale implemented fig-Forth on many processors in 1.24 anton 5277: 1979. Robert Selzer and Bill Ragsdale developed the original 5278: implementation of fig-Forth for the 6502 based on microForth. 5279: 5280: The principal architect of microForth was Dean Sanderson. microForth was 1.41 anton 5281: FORTH, Inc.'s first off-the-shelf product. It was developed in 1976 for 1.24 anton 5282: the 1802, and subsequently implemented on the 8080, the 6800 and the 5283: Z80. 1.17 anton 5284: 1.24 anton 5285: All earlier Forth systems were custom-made, usually by Charles Moore, 1.30 anton 5286: who discovered (as he puts it) Forth during the late 60s. The first full 5287: Forth existed in 1971. 1.17 anton: 1.43 anton 5295: @node Word Index, Concept Index, Origin, Top 5296: @unnumbered Word Index 1.4 anton 5297: 1.18 anton 5298: This index is as incomplete as the manual. Each word is listed with 5299: stack effect and wordset. 1.17 anton 5300: 5301: @printindex fn 5302: 1.43 anton. 1.17 anton 5309: 1.43 anton 5310: @printindex cp 1.1 anton 5311: 5312: @contents 5313: @bye 5314:
http://www.complang.tuwien.ac.at/cvsweb/cgi-bin/cvsweb/gforth/Attic/gforth.ds?annotate=1.48;sortby=log;f=h;only_with_tag=MAIN
CC-MAIN-2020-45
refinedweb
19,791
62.04
DE-Shaw Interview Experience (On-Campus) DE-Shaw came to IIT Indore for internship interviews on 9th September. There were 3 technical rounds in total followed by an HR round. First Round- The first round was a coding round which lasted for 1 hour and had 2 problems given below- Q1.There is a bookshelf with N number of books. Each book is of type A or type B. There is an infinite supply of books of each type A and B. An arrangement of books on the bookshelf is called good if all the books of type A are on the left of all the books of type B. You are allowed to replace books on the shelf with books not on the shelf. Find the minimum number of replacements so that the arrangement of books becomes good. Example: Consider the arrangement- BBAAAABBBB. If we replace the first two BB with AA then the arrangement becomes good. Hence the answer is 2. Q2. There is a grid of size NxN. There are certain cells that are marked as special. Consider all the windows of arbitrary width and length <= k. For each such window we assign “sum” as the sum of distance between all pairs of special cells enclosed in the window. Find the maximum value of this sum. On the basis of the coding round, 16 students were shortlisted for round 2. Second Round (Technical Interview)- The round lasted around 1 hour 15 mins. A few CP problems were asked in the interview then the interviewers moved on to C/C++ and DBMS questions. The following questions were asked- Q1. What is the difference between C and C++? Q2. What are OOP concepts? Q3. What is inheritance? (A few cases were given to test the concept) Q4. Difference between protected and private access specifier. Q5. What is the use of virtual functions and virtual class? Q6. What is extern and name mangling? Q7. What is normalization? Q8. What is BCNF? Give an example of a table that satisfies BCNF. Q9. An example of train scheduling system was given and a few tables were given that might exist in such a system. The interviewer asked if the given system of tables was free of redundancy and wanted changes to be made to the design of the tables to keep them redundancy free. At the end he wanted to partition the table so that it is in BCNF. After this round, 6-7 students were selected for the 3rd round. Third Round (Technical Interview) – This round lasted around 1 hour 30 mins for all candidates. This round focussed mostly on a system design problem along with a few CP questions and C++ questions. Two CP questions were asked in this round Q1. Given an array A, find the maximum value of | Ai – Aj | + | i – j | in O(n) time complexity. Q2. Design a data structure that can do value retrieval in O(logn), deletion in O(logn), insertion in O(logn) and preserves the order of insertion after a value is deleted and we can also traverse over the inserted values. (Hint for Q2. – consider a map with a doubly-linked list) Then after solving the above two problems, I was asked the following – Consider a file that contains different log entries from different applications. Design an algorithm or way that with which logs of similar type can be classified together. After discussing my solution for around 45 mins, we moved to the final part of the interview where I was asked questions about C++. Few questions that were asked were – Q1. What are smart pointers? Q2. Questions about the calling of constructors and destructors. Q3. What are namespaces and what is their use? Q4. How is inheritance affected by the virtual and pure virtual functions? After this round, all the candidates had a short HR round which was just a casual talk with the HR. Finally, DE-Shaw selected 3 students as interns for Summer 2020. Overall my experience was good, the interviewers were frank and ready to help us in case we got stuck somewhere while solving any of the problems. Recommended Posts: - MathWorks Interview Experience (EDG, Oncampus) - UHG Interview Experience | OnCampus- 2019 - ServiceNow Interview Experience Oncampus - InfoEdge Interview Experience | OnCampus-2019 -) -) - Nagarro Interview Experience for Xamarin.
https://www.geeksforgeeks.org/de-shaw-interview-experience-on-campus/
CC-MAIN-2020-16
refinedweb
718
66.44
P ecosystem, including pandas (DataFrames), NumPy (arrays), and Matplotlib (visualization). In this blog post, you’ll get some hands-on experience using PySpark and the MapR Sandbox. Example: Using Clustering on Cyber Network Data to Identify Anomalous Behavior Unsupervised learning is an area of data analysis that is exploratory. These methods are used to learn about the structure and behavior of the data. Keep in mind that these methods are not used to predict or classify, but rather to interpret and understand. Clustering is a popular unsupervised learning method where the algorithm attempts to identify natural groups within the data. K-means is the most widely used clustering algorithm where “k” is the number of groups that the data falls into. In k-means, k is assigned by the analyst, and choosing the value of k is where the interpretation of the data comes into play. In this example, we will be using a dataset from an annual data mining competition, The KDD Cup ( ). One year (1999), the topic was network intrusion and the data set is still available ( ). The data set will be the kddcup.data.gz file and consists of 42 features and approximately 4.9 million rows. Using clustering on cyber network data to identify anomalous behavior is a common utilization of unsupervised learning. The sheer amount of data collected makes it impossible to go through each log or event to properly determine if that network event was normal or anomalous. Intrusion Detection Systems (IDS) and Intrusion Prevention Systems (IPS) are often the only applications networks have to filter this data, and the filter is often assigned based on anomalous signatures that can take time to be updated. Before the update occurs, it is valuable to have analysis techniques to check your network data for recent anomalous activity. K-means is also used in analysis of social media data, financial transactions, and demographics. For example, you can use clustering analysis to identify groups of Twitter users who Tweet from specific geographic regions using their latitude, longitude, and sentiment scores. Code for computing k-means in Spark using Scala can be found in many books and blogs. Implementing this code in PySpark uses a slightly different syntax, but many elements are the same, so it will look familiar. The MapR Sandbox offers an excellent environment where Spark is already pre-installed and allows you to get right to the analysis and not worry about software installation. Install the Sandbox The instructions in this example will be using the Sandbox in Virtual Box, but either VMware or Virtual Box can be used. For directions on installing the Sandbox in Virtual Box, click on this link. Start the Sandbox in Your Virtual Machine To begin, start the MapR Sandbox that you have installed using VMware or Virtual Box. It might take a minute or two to get fully initiated. NOTE: you need to press the “command” key in MacOS or the right “control” key in Windows to get your mouse cursor out of the console window. Once the Sandbox is started, take a look at what comes up. The Sandbox itself is an environment where you can interact with your data, but if you go to you can access the file system and familiarize yourself with how the data is stored. For this tutorial, we will be in HUE. Launch HUE and type in the username/password combination: Username: Username: mapr Password: mapr Once HUE opens, go to the file browser: When you are the in the file browser, you will see you are in the /user/mapr directory. We are going to operate as user01. To get to that directory, click on the /user directory Make sure you see user01. Now we have access to user01 within our Sandbox. This is where you can create folders and store data to be used to test out your Spark code. When working with the Sandbox itself, you can use the Sandbox command line if you choose, or you can connect via the terminal or PuTTY on your machine as “user01”. If you choose to connect via a terminal, use ssh and the following command: $ ssh [email protected] Welcome to your Mapr Demo Virtual machine. [[email protected] ~]$ For this tutorial, I am using a Mac laptop and a terminal application called iTerm2. I could also use my normal default terminal in my Mac as well. The Sandbox comes with Spark installed. Python is also installed on the Sandbox, and the Python version is 2.6.6. ~]$ python --version Python 2.6.6 PySpark uses Python and Spark; however, there are some additional packages needed. To install these additional packages, we need to become the root user for the sandbox. (password is: mapr) [[email protected]~]$ su - Password: [[email protected] ~]# [[email protected] ~]# yum -y install python-pip [[email protected] ~]# pip install nose [ [email protected] ~]# pip install numpy The numpy install might take a minute or two. NumPy and Nose are packages that allow for array manipulation and unit tests within Python. ~]$ PySpark in the Sandbox To start PySpark, type the following: [<a href="/cdn-cgi/l/email-protection" data-[email protected]</a> ~]$ pyspark --master yarn-client Below is a screen shot of what your output will approximately look like. You will be in Spark, but with a Python shell¬¬¬. The following code will be executed within PySpark at the >>> prompt. Copy and paste the following to load dependency packages for this exercise: from collections import OrderedDict from numpy import array from math import sqrt import sys import os import numpy import urllib import pyspark from pyspark import SparkContext from pyspark.mllib.feature import StandardScaler from pyspark.mllib.clustering import Kmeans, KmeansModel from pyspark.mllib.linalg import DenseVector from pyspark.mllib.linalg import SparseVector from collections import OrderedDict from time import time Next,we will check our working directory, put the data into it, and check to make sure it is there. Check the directory: os getcwd() >>>> os.getcwd() '/user/user01' Get the Data f = urllib.urlretrieve ("", "kddcup.data.gz") Check to see the data is in the current working directory os.listdir('/user/user01') Now you should see kddcup.data.gz in the directory “user01”. You can also check in HUE. Data Import and Exploration PySpark can import compressed files directly into RDDs. data_file = "./kddcup.data.gz" kddcup_data = sc.textFile(data_file) kddcup_data.count(). from pyspark.sql.types import * from pyspark.sql import DataFrame from pyspark.sql import SQLContext from pyspark.sql import Row kdd = kddcup_data.map(lambda l: l.split(",")) df = sqlContext.createDataFrame(kdd) df.show(5) Now we can see the structure of the data a bit better. There are no column headers for the data, as they were not included in the file we downloaded. These are in a separate file and can be appended to the data. That is not necessary for this exercise, as we are more concerned with the groups within the data than the features themselves. This data has already been labeled, meaning the types of malicious cyber behavior have been assigned to a row. This label is the last feature, _42, in the above screen capture. The first five rows off the dataset are labeled “normal.” However, we should determine the counts of the labels for the entire dataset. Now let’s get an idea of the different types of labels in this data, and the total number for each label. Let’s time how long this takes. labels = kddcup_data.map(lambda line: line.strip().split(",")[-1]) start_label_count = time() label_counts = labels.countByValue() label_count_time = time()-start_label_count sorted_labels = OrderedDict(sorted(label_counts.items(), key=lambda t: t[1], reverse=True)) for label, count in sorted_labels.items(): #simple for loop print label, count We see there are 23 distinct labels. Smurf attacks are known as directed broadcast attacks, and are a popular form of DoS packet floods. This dataset shows that “normal” events are the third most occurring type of event. While this is fine for learning the material, this dataset shouldn’t be mistaken for a real network log. In a real network dataset, there will be no labels and the normal traffic will be much larger than any anomalous traffic. This results in the data being unbalanced, making it much more challenging to identify the malicious actors. Now we can start preparing the data for our clustering algorithm. Data Cleaning K-means only uses numeric values. This dataset contains three features (not including the attack type feature) that are categorical. For the purposes of this exercise, they will be removed from the dataset. However, performing some feature transformations where these categorical assignments are given their own features and are assigned binary values of 1 or 0 based on whether they are “tcp” or not could be done. First, we must parse the data by splitting the original RDD, kddcup_data, into columns and removing the three categorical variables starting from index 1 and removing the last column. The remaining columns are then converted into an array of numeric values, and then attached to the last label column to form a numeric array and a string in a tuple. def parse_interaction(line): line_split = line.split(",") clean_line_split = [line_split[0]]+line_split[4:-1] return (line_split[-1], array([float(x) for x in clean_line_split])) parsed_data = kddcup_data.map(parse_interaction) pd_values = parsed_data.values().cache() We are putting the values from the parser into cache for easy recall. The Sandbox does not have enough memory to process the entire dataset for our tutorial, so we will take a sample of the data. kdd_sample = pd_values.sample(False, .10, 123) kdd_sample.count() We have taken 10% of the data. The sample() function is taking values without replacement (false), 10% of the total data and is using a the 123 set.seed capability for repeating this sample. Next, we need to standardize our data. StandardScaler standardizes features by scaling to unit variance and setting the mean to zero using column summary statistics on the samples in the training set. Standardization can improve the convergence rate during the optimization process, and also prevents against features with very large variances exerting an influence during model training. standardizer = StandardScaler(True, True) Compute summary statistics by fitting the StandardScaler standardizer_model = standardizer.fit(kdd_sample) Normalize each feature to have unit standard deviation. data_for_cluster = standardizer_model.transform(kdd_sample) Clustering the data How is doing k-means in Python’s scikit-learn different from doing it in Spark? Pyspark’s MLlib implementation includes a parallelized variant of the k-means++ method (which is the default for Scikit-Learn’s implementation) called k-means || which is the parallelized version of k-means. In the Scala Data Analysis Cookbook (Packt Publishing 2015) , Arun Manivannan gives this explanation of how they differ: K-means++ Instead of choosing all the centroids randomly, the k-means++ algorithm does the following: - It chooses the first centroid randomly (uniform) - It calculates the distance squared of each of the rest of the points from the current centroid - A probability is attached to each of these points based on how far they are. The farther the centroid candidate is, the higher is its probability. - We choose the second centroid from the distribution that we have in step 3. On the ith iteration, we have 1+i clusters. Find the new centroid by going over the entire dataset and forming a distribution out of these points based on how far they are from all the precomputed centroids. These steps are repeated over k-1 iterations until k centroids are selected. K-means++ is known for considerably increasing the quality of centroids. However, as we see, in order to select the initial set of centroids, the algorithm goes through the entire dataset k times. Unfortunately, with a large dataset, this becomes a problem. K-means|| With k-means parallel (K-means||), for each iteration, instead of choosing a single point after calculating the probability distribution of each of the points in the dataset, a lot more points are chosen. In the case of Spark, the number of samples that are chosen per step is 2 * k. Once these initial centroid candidates are selected, a k-means++ is run against these data points (instead of going through the entire dataset). For this example, we are going to stay with k-means++ because we are still in the sandbox and not a cluster. You will see this in our initialization in the code where it says: initializationMode="random" If we wanted to do k-means parallel: initializationMode="k-means||" Refer to the MLlib documentation for more info. ( ) When performing k-means, the analyst chooses the value of k. However, rather than run the algorithm each time for k, we can package that up in a loop that runs through an array of values for k. For this exercise, we are just doing three values of k. We will also create an empty list called metrics that will store the results from our loop. k_values = numpy.arange(10,31,10) metrics = [] One way to evaluate the choice of k is to determine the Within Set Sum of Squared Errors (WSSSE). We are looking for the value of k that minimizes the WSSSE. def error(point): center = clusters.centers[clusters.predict(point)] denseCenter = DenseVector(numpy.ndarray.tolist(center)) return sqrt(sum([x**2 for x in (DenseVector(point.toArray()) - denseCenter)])) Run the following in your Sandbox. It could take a while to process, which is why we are only using three values of k. for k in k_values: clusters = Kmeans.train(data_for_cluster, k, maxIterations=4, runs=5, initializationMode="random") WSSSE = data_for_cluster.map(lambda point: error(point)).reduce(lambda x, y: x + y) results = (k,WSSSE) metrics.append(results) metrics In this case, 30 is the best value for k. Let’s check the cluster assignments for each data point when we have 30 clusters. The next test would be to run for k values of 30, 35, 40. Three values of k is not the most you test on in a single run, but only used for this tutorial. k30 = Kmeans.train(data_for_cluster, 30, maxIterations=4, runs=5, initializationMode="random") cluster_membership = data_for_cluster.map(lambda x: k30.predict(x)) cluster_idx = cluster_membership.zipWithIndex() cluster_idx.take(20) Your results might be slightly different. This is due to the random placement of the centroids when we first begin the clustering algorithm. Performing this many times allows you to see how points in your data change their value of k or stay the same. I hope you were able to get some hands-on experience using PySpark and the MapR Sandbox. It is an excellent environment to test your code and tune for efficiency. Also, understanding how your algorithm will scale is an important piece of knowledge when transitioning from using PySpark on a local machine to a cluster. The MapR Platform has Spark integrated into it, which makes it easier for developing and then migrating your code into an application. MapR also supports streaming k-means in Spark as opposed to the batch k-means we are performing in this tutorial.
http://126kr.com/article/94cn047m2q2
CC-MAIN-2017-09
refinedweb
2,504
56.25
-28-2014 Subjects Genre: newspaper ( sobekcm ) Record Information Source Institution: University of Florida Holding Location: University of Florida Rights Management: System ID: AA00019282:00354 This item is only available as the following downloads: ( PDF ) Full Text PAGE 1 D006652 FSU RALLIES TO BEAT N. CAROLINA STATE 56-41, SPORTS C1 TELEVISION: Upcoming Judge Judy episode to feature Tavares case A3 HEALTH: Mosquito-borne virus spreads rapidly throughout Latin America A7 LEESBURG, FLORIDA Sunday, September 28, 2014 Vol. 138 No. 271 5 sections INDEX CLASSIFIED D1 COMICS INSIDE CROSSWORDS D2 DIVERSIONS E5 LEGALS D1 BUSINESS E1 NATION A6 OBITUARIES A4 SPORTS C1 VOICES B1 WORLD A7 TODAYS WEATHER Detailed forecast on page A8. 88 / 74 Showers and a thunderstorm $1 LIVI STANFORD | Staff Writer livi.stanford@dailycommercial.com W ith more than a month to go until election day, Thomas Poole Jr. contin ues to challenge his opponent, incumbent Commissioner Les lie Campione, on her recent proposal to balance the budget without a tax increase. I do not believe that it is pos sible to deliver the same level of community service that you have delivered without an in crease in revenue, he said. I would challenge, if it were pos sible why wasnt it done in pri or years? Campione had argued this summer that the county budget could be balanced by using solid waste reserves, by adjusting the budget to account for $2.4 mil lion in revenues that are actually collected but not budgeted, and by using $5.74 million from the penny sales tax to pay down the interest on the courthouse and deferring capital projects, among other measures. But board members voted 3-2, with Campione and Tim Sullivan dissenting on Tuesday, to raise the property tax rate to 13.8 percent. Poole, the senior pastor of Mount Moriah Church in Wildwood and son of Thomas Campione, Poole focus on county budget as election nears DAILY COMMERCIAL FILE PHOTO District 4 Lake County Commissioner candidate Thomas Poole Jr. speaks at a forum at the clubhouse of Hawthorne at Leesburg on July 28 in Leesburg. BRETT LE BLANC / DAILY COMMERCIAL Lake County Commissioner Leslie Campione speaks with former Lake County School Board member Jim Miller, not pictured, at an event in downtown Leesburg on Thursday. District 4 showdown SEE CAMPAIGN | A2 BASSEM MROUE Associated Press BEIRUT U.S.-led co alition warplanes struck Islamic State ghters in Syria attacking a town near the Turkish border for the rst time Satur day, as well as positions in the countrys east, ac tivists and a Kurdish of cial said. The Islamic State groups assault on the Syrian Kurdish town of Kobani has sent more than 100,000 refugees streaming across the border into Turkey in recent days as Kurd ish forces from Iraq and Turkey have raced to the front lines to defend the town. Nawaf Khalil, a spokesman for Syr ias Kurdish Democrat ic Union Party, or PYD, said the strikes targeted Islamic State positions near Kobani, also known US-led planes strike IS fighters attacking Syrian border town AP PHOTO In this photo provided by the U.S Air Force, an F-22A Raptor taxis in the U.S. Central Command area of responsibility prior to strike operations in Syria on Tuesday. ROXANNE BROWN | Staff Writer roxanne.brown@dailycommercial.com Groveland will be re funding approximately $100,000 in overcharged utility fees because of a clerical error, ofcials say. The error was made following city council meetings on Aug. 4 and Aug. 8, when the board voted to adopt a new fee schedule including sev eral service fee hikes, such as water meter in stallations. The fee that was calculated was the fee associated with installing a meter from the main to the house being built, when in fact, a portion of that fee is paid by impact fees the city receives, City Manager Redmond Jones explained. Groveland to refund $100K in overcharges SEE CHARGES | A2 SEE SYRIA | A2 LLOYD DUNKELBERGER H-T Capital Bureau TALLAHASSEE Who will be the Rick Scott that places his hand on the Bible and is sworn in for a second term as Floridas 45th governor on Jan. 6? That is a hypothetical be cause Scott is being challenged by former Gov. Charlie Crist and Libertarian Adrian Wyllie in the Nov. 4 general election. But it is also a pivotal ques tion in the highest prole gov ernors race in the country this fall. Will Scott return to his Tea Party roots that helped get him elected in 2010? Or has Scott, a political neophyte when he took ofce, moved more to the political center, as his recent months of governing suggest? What direction Scott would lead in a second term has fu eled plenty of speculation, from Democrats to establish ment Republicans to the Tea Party. All have a different take. Democrats scoff at the no tion that Scott has become a centrist. It would be Rick Scott un chained, former state Sen. Dan Gelber, D-Miami Beach, said about a potential second term for the Republican gov ernor. This last year has been Rick Scott on good behavior because he has to convince the electorate that hes not the per son they think he is. Once he doesnt have the specter of a re-election, I think hes going to be far worse than hes ever been. But J.M. Mac Stipanovich, a chief of staff to Gov. Bob Mar tinez and key adviser to twoterm Gov. Jeb Bush, said like other governors heading into a second term, Scotts experi ence in his rst term will shape How Gov. Rick Scott will lead the state if re-elected DAILY COMMERCIAL FILE PHOTO Gov. Rick Scott speaks in Leesburg on June 4. SEE SCOTT | A2 PAGE 2 A2 DAILY COMMERCIAL Sunday, September 28, 2014 his agenda. I think that the gover nor would accurately inter pret his re-election as being in large part due to a move to the center from the fur ther reaches on the right from which he began, Sti panovich said. I would ex pect to see him continue that, to be right of center. Scott rode into ofce on a surge of Tea Party sup port in 2010, famously announcing on the night of his GOP primary vic tory that Tallahassee in siders would be crying in their cocktails when he took ofce. He promised to boost jobs. But he also vowed to crack down on illegal im migrants, cut taxes, curb spending and reduce the reach of government. He announced his rst bud get, which included a 10 percent cut in per-stu dent school funding, at a Tea Party rally in Central Florida. Yet heading toward his re-election, Scott has pre sided over a state bud get that has grown from $69 billion to $77 billion. He backed legislation this year allowing undocu mented immigrants to qualify for in-state tuition at colleges and universi ties. Last year, he prom ised to back an expansion of Medicaid although he hasnt done much to make it happen. Scott has cut taxes. And he is promising another $1 billion in tax cuts. But he is also promising record spending on schools and a $1 billion increase in envi ronmental funding. Neutral observers say they dont expect Scott to stray far from his conser vative, business-oriented roots if he wins re-election. You judge the future based on the past, said Darryl Paulson, a profes sor emeritus of govern ment at the University of South Florida St. Peters burg. I think you can say hes learned some lessons and maybe he has adjust ed or moderated his po sitions. But I think hes going to be pretty con sistent in how he gov erns. If I had to describe it I would say its going to be a pretty conservative, pro-business, pro-growth oriented administration. I dont see him all of a sudden moving com pletely to the politi cal middle. I dont think thats who he is. Tea Party disappointed Scott was one of Re publican candidates who was swept into ofce in 2010 by the sudden emer gence of the Tea Party, a staunchly conservative wing of the GOP that ex poses limited govern ment and lower taxes. Tapping some of his vast personal wealth, Scott, a former health care compa ny executive, managed in the Republican primary to run to the right of Attorney General Bill McCollum, who as a congressman had led the effort to impeach President Bill Clinton. Among other issues, Scott accused McCollum of be ing soft on immigration, promising to bring an Ar izona-style immigration law to Florida if elected. But Henry Kelley, a Tea Party leader from Okaloo sa County, said Scott pur sued a different agenda once he was elected. Hes denitely changed from what he campaigned on. What I see is the state budget getting bigger, businesses getting more breaks and he hasnt done a whole lot for Northwest Florida, said Kelley, jok ingly asserting his area may be better off if it be came part of Alabama. Henry Poole Sr., a prominent NAACP civil rights leader and teacher in Eustis, said balancing the budget using reserves is not prudent. The point of the reserves is to have the fund in reserves and not to balance the budget, he said. For the past four years we have cut, cut, cut and cut some more. Now you dont have any more places you can reasonably cut without (resorting to) draconian measures. But Campione defended her budget proposal, stating she was opposed vehemently to the tax increase. I knew it would affect individ ual people and businesses, but I also knew it would make it more difcult for us to attract new job opportunities to Lake County, she said. My job, if I am fortunate enough to be re-elected, is to try to salvage the pro-business image. I continue to be focused on quality of life issues and govern ment efciency, she added. Be cause if we can create efciency within our government opera tions, we can save taxpayers a lot of money. When asked why other board members did not support her pro posal, Campione said, It is be cause they wanted to spend more money than they spent last year. Poole, however, said putting off budget priorities for another year simply delays dealing with the important issues, such as having a realistic pool of resources that will sustain our sheriffs department to the levels being requested. Campione said her proposal did include raises for sheriff deputies. Poole, who is running unafliat ed, will face Campione, a Repub lican and incumbent in the Nov. 4 race for Lake County Commis sion District 4, which includes the Golden Triangle area of Eustis, Mount Dora and Tavares. Campione said she believes she has proposed reasonable solutions to pressing issues facing Lake County, from leading the effort when rst elected to open public lands, to addressing low water lev els at the Dora Canal, to prevent ing a sex offender village coming to Sorrento. I hope to be the voice for scal constraint, she said. We can do a lot of things by coming together as a community focusing on things that dont cost a whole lot of money. For example, she said she would like to get the community togeth er to help clean up the litter and trash in Lake County. If elected, Poole said he would remain open to all options. I have no ideological purities, he said. I dont have an ideological test that all times I shall be purely con servative or purely progressive. Poole said he would ask the tax payers what services they would want funded. Dont get hung up on the no tion of no new taxes, he said. You fund the services you want. Above all, Poole said he wants to be the commissioner focused on a broader picture for economic de velopment. The economic driver in Lake County is our senior citizens, he said. Therefore the economic in dustry that is most associated with senior citizens is health care. Attracting health care industries to the county is the key to eco nomic development, Poole said, citing that 32 percent of the coun tys population are senior citizens. He also cited the Wellness Way Sector Plan, which is expect ed to transform 16,000 acres in the southeast corner of the coun ty into a hub for high-tech health care jobs and other industries, as a good example of something he would like to see in other parts of the county. Why not put satellite medical centers in the northwest part of Lake County? he said. Campione, however, said the county is already focusing on health care and wellness. The most important thing we need to do is diversify our econo my, she said. The key is to have a mix of young people, families and retirees. I am more concerned about focusing on those areas where we have a workforce that could be providing jobs for local manufacturers but does not have the training available. Campione helped to implement the Center for Advanced Manufac turing at Lake Technical College, a partnership between the county and the tech school to train work ers in manufacturing, machining and welding. There was another miscalcula tion involving fees charged when utility lines were connected to houses, he added. The council held an emergency meeting last week to discuss how to handle the situation. Mayor Tim Loucks said he felt the overages constituted an emergency. After recognizing the problem, I gured addressing it immediate ly and xing the problem would be the most responsible way to handle it, he said. I didnt want to continue overcharging people knowing we were charging them incorrectly. The refunds stand at approxi mately $100,000, but calculations are still being made to determine a nal number, Jones said Friday af ternoon. We were in the process of recal culating the fees, he said. Based on the gravity of the situation, we didnt have a handle on it We (the staff) were trying to get it right ever since we found out it was wrong. Jones said there were nine items on the newly adopted fee schedule that were mistakenly noted with incorrect fees in association with meter installation services. The price for re-inspection fees is also incorrect, he said. Jones estimated that about 90 per cent of the refunds will be made to developers; the other 10 percent go ing to those building custom homes or those billed for meter installa tions to owner occupied homes. HOW TO REACH US SEPT. 27 CASH 3 ............................................... 6-7-9 Afternoon .......................................... 9-7-7 PLAY 4 ............................................. 4-8-8-8 Afternoon ...................................... -4-2-8-5 FLORIDA LOTTERY SEPT. 26 FANTASY 5 ........................... 7-20-23-28-36 LUCKY MONEY ....................... 2-6-26-3913 MEGA MILLIONS .............. 17-26-35-46-6 CAMPAIGN FROM PAGE A1 CHARGES FROM PAGE A1 SYRIA FROM PAGE A1 as Ayn Arab, destroying two tanks. He said the jihadi ghters later shelled the town, wounding a number of civilians. The United States and ve Arab allies launched an aerial campaign against Is lamic State ghters in Syria early Tues day with the aim of rolling back and ul timately crushing the extremist group, which has created a proto-state span ning the Syria-Iraq border. Along the way, the militants have massacred cap tured Syrian and Iraqi troops, terrorized minorities in both countries and be headed two American journalists and a British aid worker. The latest airstrikes came as Syrias For eign Presi dent Bashar Assads government, which is at war with the Islamic State group as well as Western-backed rebels. BIO BOX RICHARD RICK LYNN SCOTT AGE: 61 JOB: Floridas 45th governor since 2011 PARTY: Republican FAMILY: Wife, Ann Scott, married since 1972. Two daughters. Three grandchildren. EDUCATION: Business administration degree, University of MissouriKansas City; law de gree Southern Methodist University. WORK HISTORY: Lawyer, former chief executive of Columbia/HCA, businessman, investor. POLITICAL HISTORY: First ran for ofce in 2010, beating Attorney General Bill McCollum in the Republican primary for governor. Beat Chief Financial Ofcer Alex Sink in the 2010 gen eral election for governor. SCOTT FROM PAGE A1 BRETT LE BLANC / DAILY COMMERCIAL Lake County Commissioner Leslie Campione, right, speaks with former Lake County School Board member Jim Miller, left, at an event in downtown Leesburg on Thursday. PAGE 3 Sunday, September 28, SORRENTO Motorcyclist accused of DUI, marijuana possession A Sorrento motorist was charged with DUI after he was allegedly trav eling 81 mph in a 45 mph posted zone. According to the Lake County Sheriffs Ofce, a deputy spotted Thurman Marshall Chandler, 46, on Thursday speed ing on a motorcycle on Colmar Avenue when he stopped him. Another deputy said Chandler smelled of alcohol, his eyes were watery and bloodshot, and his speech was slightly slurred. A metal pipe containing a leafy substance that was partially burnt was found in his front right pocket but Chandler denied smoking mar ijuana and ownership of the pipe. Chandler allegedly admitted to hav ing four beers. The deputy added a breath-alco hol test revealed Chandler wasnt over the legal limit but he was ar rested after a series of sobriety tests. The results of a urine test were not reported but he was cited for possession of marijuana and drug paraphernalia. MOUNT DORA Man arrested after fight over marijuana An argument between two men about who had any marijuana ended with one arrest. David Paul Dufresne, 45, of Mount Dora, was charged with possession of a small amount of marijuana and placed in the Lake County jail in lieu of $1,000 bail. According to the Lake County Sheriffs Ofce, deputies were sent Thursday eve ning to a home on Old Highway 441 in Mount Dora about a complaint of a trespassing neighbor. When deputies reached the scene, they were approached by Dufresne, who allegedly said an argument erupted after the neighbor came to his house asking for some marijua na and he told the man he didnt want to give him any. An arrest afdavit adds when the deputy asked Dufresne if he had any marijuana on him, he not only ad mitted he had six joints, but volun teered to show them to the deputy. Dufresne then allegedly hand ed the deputy a shot glass with the marijuana cigarettes inside and he was arrested. GROVELAND Public meeting scheduled for State Road 50 project The Florida Department of Transportation is holding a public meeting to present the design plans for the State Road 50 realignment proj ect from 6 to 8 p.m. on Tuesday at the E.L. Puryear Building, 243 S. Lake Ave. The project limits are from County Road 565/Villa City Road to Brown Street. The roadway improvement will realign S.R. 50 to the north of downtown Groveland. For information, call Kevin Moss at 386-943-5255 or email kevin. moss@dot.state..us. State & Region NEWS EDITOR SCOTT CALLAHAN scott.callahan@dailycommercial.com 352-365-8203 CHANDLER ROXANNE BROWN | Staff Writer roxanne.brown@dailycommercial.com After more than sev en months of waiting, the CM Box Car Rac ings rst soap box der by in Lake County ar rived with more than 30 kids ages 7 to 16 ready to go and its founder, John Bomm, just as excited as the racers. Bomm funded the race and most of the cars, which he built himself with his tax re turn, so that any child interested could par ticipate for free. Indi viduals and business es from the nine cities represented in Satur days race sponsored the cars. Im trying to make these kids and their families happy. Thats why Im doing this. Ive built these cars for these children, Bomm said. The race, held at a stretch of Wilson Lake Parkway between the Cherry Lake and Trilo gy communities, went well except there was not enough incline on the road and no tail winds to help reach the speeds Bomm and his crew were hoping for. It was a little slow today, but thats OK. Its working out well for being our rst race and I think the kids are still excited about be ing here, Bomm said, adding that he may consider other loca tions with a steeper slope for Decembers derby. Regardless, the start ing ramps were ele vated Saturday morn ing after the rst cars could not make it to the nish line and the races continued. This has been a blast. We were here at 5:30 a.m. to get every thing ready and folks started coming in as ear ly as 6 a.m., Groveland City Manager Redmond Jones said. Theres a lot of excitement here to day. The kids are loving it and you can just see the smiles on their fac es and thats awesome. Patricia Butts, of Montverde, said she is glad the opportunity was made available to the kids in the area. Its a fun, nice expe rience and it gets the kids outside and ac tive, she said, adding that her and her hus band are consider ing purchasing the car their daughter Ava, 7, has been using. GROVELAND CM Racing hosts its first event in Lake County PHOTOS BY LINDA CHARLTON / SPECIAL TO THE DAILY COMMERCIAL Two soap box derby participants race to the nish line on Saturday in Groveland. Lemiyah Garbutt comes off the ramp during her rst heat of the derby. Soap box derby SEE DERBY | A4 MILLARD K. IVES | Staff Writer millard.ives@dailycommercial.com A single-vehicle ac cident near Mascotte early Saturday morn ing ripped a 2008 Nis san Altima in half, killed one young man and sent three others to area hos pitals, the Florida High way Patrol said. Markie Conley, 21, of Cl ermont, died at the scene. The crash occurred about 2 a.m. on Lee Road near the intersection of State Road 50. Accord ing to FHP Sgt. Kim Mon tes, Stanley Evans, 21, of Groveland, was driving the Altima north on Lee Road when he failed to stop at the intersection. Lee Road does not con tinue north of the high way but a long driveway, next to a fenced pasture, does. Montes said the Alti ma continued down the driveway until the left MASCOTTE Collision with oak tree severs car, kills 1 SEE WRECK | A4 MILLARD K. IVES | Staff Writer millardives@dailycommercial.com Ofcials arrested a Leesburg man Saturday afternoon who they believe may be a serial rap ist and the suspect in a sexual battery against an elderly wom an during a burglary of her home this summer. The 46-year-old Anthony Maurice Foster was identied as the suspect after a joint investi gation between the Lake County Sheriffs Ofce, Leesburg police and the Florida Department of Law Enforcement, said sheriffs Lt. John Herrell. According to Herrell, the vic tim, who is in her 70s and lives in the Sunnyside area of Lake County, reported to deputies that she was awakened by an unknown male in her bedroom about 11:30 p.m. on July 20. The suspect then sexually battered her by forcing her to perform sexual acts. BRANDON LARRABEE The News Service of Florida TALLAHASSEE Summer of cially ended Monday, and the tem perature seemed to drop in Talla hassee. It wasnt cool, per se, but at least going outside wasnt walking into a skin-melting blast furnace. But even as the weather cooled, two long-running dramas heat ed up. At Florida State University, a controversial and at times bum bling presidential search nally settled on the man many assumed would get the job all along: Sen. John Thrasher, R-St. Augustine. And in the governors race, sup porters of incumbent Gov. Rick Scott and Democratic candidate Charlie Crist traded charges of dirty tricks in one of the nations most closely-watched contests. Crists campaign and its Demo cratic allies slammed the Repub lican Party of Florida for alleged ly spying on a fundraiser, while AUSTIN FULLER | Staff Writer austin.fuller@dailycommercial.com Tavares resident Jim Dia mond is scheduled to appear on court show Judge Judy on Thursday in a lawsuit against his neighbor. Diamond sued his neighbor for allegedly striking him. His neighbor then countersued. A report from the Tavares Po lice Department says Diamond told police his neighbor, Frank Nettles, hit him in the head. Nettles claims Diamond hit him in the arm with a pump spray er nozzle, the report states. Mr. Nettles stated he defended himself by pushing Mr. Diamond, the police report reads, adding that Nettles also told police he swung at Diamond and was unsure if he had hit him. Diamond said he was con tacted by the show, which uses researchers to nd interesting court cases that have been led. He said the show was taped in July. I wanted to embarrass the guy, I got slugged and it made me mad, he said. The episode will be on at 4 p.m. on Thursday on the Fox Judge Judy episode to feature Tavares case COURTESY OF PR NEWSFOTO Judge Judy Sheindlin presides over the courtroom during her television series Judge Judy. SEE TV | A4 DUFRESNE LEESBURG Man accused of multiple sexual assaults dating back to 2006 SEE FOSTER | A3 The mercury drops, but politics heat up SEE POLITICS | A4 PAGE 4 A4 DAILY COMMERCIAL Sunday, September 28, 2014 After the alleged incident, deputies used prolers, conducted surveillance details, canvassed neighborhoods and conducted patrols in an effort to develop information on the suspect. They received information from a resident who suggested Fos ter should be looked at because of some bizarre behavior on his part. Detectives met with Foster but he refused to provide a requested DNA sample. However, Herrell said they were able to collect DNA samples from his family members, including his son. The DNA results presented a match to four other similar cases in Leesburg dating back to 2006 in volving elderly victims. Herrell added the Leesburg Police Department expects to add charges on the additional four cases Mon day and will likely clear several oth er similar cases in their jurisdiction. Foster was arrested without inci dent and was still being questioned by detectives at 3:30 p.m. Saturday. No bail information was available at that time. Herrell said they were unable to nd any prior arrests for Foster. Detectives say it is possible that there could be other victims of sim ilar crimes who have not yet come forward. They are asking anyone who has had a similar experience, or would like to provide informa tion regarding Foster, to call the sheriffs ofce at 352-343-2101. rear of the car clipped a palm tree. The im pact caused the Al tima to spin and its right side slammed into a large oak tree. The force of this second impact tore the vehicle into two pieces, with the rear half coming to rest near the oak tree and the front half con tinuing east until it stopped in front of a home. Conley was thrown from the vehicle after it hit the oak tree, Montes said. Evans received seri ous injuries and was transported to Orlan do Regional Medical Center, along with se riously injured pas senger Tevin Hart, 20, of Groveland. A third passenger, Earl Gra ham, 21, of Clermont, was taken to South Lake Hospital with mi nor injuries. Hart and Graham were on the track team last year at South Lake High School. Montes said it is not clear if any of the men were wearing seat belts. Alcohol tests are pending and the crash remains under investi gation. This is the sec ond time in two days that a single-vehi cle crash has claimed a life in south Lake. Early Friday morn ing, a 33-year-old Davenport wom an died at the scene when she lost con trol of her 2008 Chev rolet sedan, drove off U.S. Highway 27 near Bradshaw Road and hit a pole, the FHP said. On St age Al aska Come pr eview the wonders of an Alaskan vacation at our On Stage Alaskamulti-media pr esentation. Listen as experts fr om AAA Tr avel shar e tips on wher e to go, what to see and what to bring. Plus, lear n about exclusive AAA Member Benets including up to $200 per stater oom onboar d cr edit on select Alaska departur es! rf mWa terfr ont Inn1105 Lake Shor e Drive, The Villages, FL 32162 Space is limited. Reserve your seat today online ntb ff n One person in travel party must be a AAA member to receive member benets. Shipboard Credit and Onboard Va lue Booklet include Te rms & Conditions on specic offers. All offers are capacity controlled and may be modie d or withdrawn without notice. Other conditions may apply Ask your AAA Tr avel Consultant for complete details. Holland America Line and The Auto Club Group are not responsible for any errors or omissions in the printing of this promotion. 2014 Holland America Line. Ships Registr y: The Netherlands. TR-0300E r f f n t DENTURE REP AIR/RELINE ONE HOUR WEDNESDA YS ONL YSUNRISE DENT AL1380 N. Blvd., We st Leesburg, Florida352-326-3368 Tu esday September 30th at 3PM IN MEMORY OBITUARIES Jamileo Tuason Nibungco Jamileo Tuason Ni bungco, 76, of Leesburg died Friday, September 26, 2014 at The Villages Regional Hospital. He was born in the Phillip ines on May 5, 1938. Mr. Nibungco was a Pro fessor of English at the City Univerisity of New York, as well as in the Phillipines before mov ing to the United States in 1973. He is survived by his brothers, Virge lio Nibungco; Midelo Ed Nibungco; Deo gelio Del Nibungco; Darfrente Jun Nibung co; nieces, nephews, great nieces and great nephews. He was pre deceased by his wife, Carmen L. Nibung co in June 2012 and his brother Fiel Nibung co. Services will be held on Sunday, September 28, 2014 at 10:00am at Beyers Funeral Chapel, Leesburg. Online con dolences may be left at alhome.com. Arrange ments entrusted to Bey ers Funeral Home and Crematory, Leesburg, FL. DERBY FROM PAGE A3 Ava wrecked her soap box during practice, but that didnt stop her from giving it another go. I felt excited until my rst practice run when I wrecked, then I got a little scared but I decided to go back and do it again, Ava said. I had fun and, to me, when it goes slow, its kind of funny. Food and conces sions were available and for those who missed Saturdays ac tivities, there are more races to come, Bomm said. Bomm plans to offer an old-school race with area scouts in Decem ber and a race dubbed Super Kids for chil dren with special needs in March 2015. There are more rac es being planned and in the future, Bomm plans to start building adult-sized cars. Ive never been to a boxcar race, but theyre exciting. I think that Groveland may be come the boxcar racing capital of Florida, said Groveland Mayor Tim Loucks, who was at the race. I raced mo torcycles in my young er days until I broke too many bones, so my rst question for John (Bomm) today was, Do they make these (cars) in adult sizes? Bomm said sponsors are needed for future races. For information, contact Bomm at 352708-4207 or send an email to cmboxcarrac ing@gmail.com. WRECK FROM PAGE A3 TV FROM PAGE A3 station WOFL. She was just like she was on television. It was her playpen and she controlled it, Di amond said of Judge Judy, whose full name is Judith Sheindlin. Nettles told po lice that Diamond had sprayed a chemical on his property line which Nettles thought was in tended to kill his dog, the report states. According to the re port, Diamond said he has been killing weeds in another neighbors yard for three years and was spraying when two other neighbors told him to leave the yard, which is when Nettles and his ance came over. I was actually in a neighbors yard an el derly neighbors yard killing weeds for her. She was very incapacitated and I was killing weeds for her. She lives on one side of me, Frank Nettles lives on the other side of me, Diamond said. The incident occurred on May 9. Judge Judy start ed national syndication in 1996, according to the shows website. The show is produced by Big Ticket Television in Los Angeles. Sheindlin started in family court in 1972 in New York, and currently lives in Florida, accord ing to the website. Since the show has yet to air, the Daily Com mercial is not report ing the outcome of the case. FOSTER FROM PAGE A3 POLITICS FROM PAGE A3 Scott and the state GOP accused Democrat ic National Commit tee Chairwoman and Florida Congresswom an Debbie Wasserman Schultz of crossing the line with comments that seemed to com pare Republican poli cies to domestic abuse. Neither story is like ly to die down anytime soon. Thrasher is still technically running for re-election his ap pointment doesnt be come ofcial until its approved by the state university systems Board of Governors and the election that will end the governors race remains more than a month away. PRESIDENT THRASHER (FINALLY) In 2012, Thrasher, a former House speak er, took part in what amounted to a palace coup that would have moved up his potential presidency of the Sen ate. The effort failed, though, and Thrash er faced the prospect of serving out the last four years of his tenure with little to no chance of leading the chamber. But the inuential senator will still get the title of president, this time as the head of his alma mater. The Florida State University Board of Trustees voted 11-2 on Tuesday to give the job to Thrasher, who had long been seen as the front-runner for the position. In addition to the perks of the job like free admission to football games played by his beloved Semi noles Thrasher now faces the challenge of moving the institution forward while winning the support of large portions of the faculty and student body who opposed him. This is the scary choice, not the safe choice, Faculty Senate President Gary Tyson, who sits on the board, told his fellow trustees Tuesday. Others also expressed concerns that Thrash er wouldnt live up to the expectations that he could increase the Leg islatures support for the school or that his polit ical fundraising skills wouldnt translate to the need to raise money for academia. One oppo nent called the search process sketchy, one labeled Thrasher an overlord, another said the trustees were announcing support for athletics over aca demics, and one even threatened, We will make John Thrashers life here at Florida State a living hell. Thrasher stayed away from any premature celebrations, given that the Board of Gover nors has to approve his candidacy though that is largely expect ed to be a formality. He was also beginning to reach out to those who opposed him or ran against him for the presidency, from Tyson to FSU Provost Garnett Stokes, who has served as interim president. LINDA CHARLTON / SPECIAL TO THE DAILY COMMERCIAL Lilli Rapaport nears the end of her rst race heat. This is the second time in two days that a single-vehicle crash has claimed a life in south Lake. Early Friday morning, a 33-year-old Davenport woman died at the scene when she lost control of her 2008 Chevrolet sedan, drove off U.S. Highway 27 near Bradshaw Road and hit a pole, the FHP said. PAGE 5 Sunday, September 28, 2014 DAILY COMMERCIAL A5 Come discover your brand-new Publix in The Vi llages. Yo ull enjoy top-notch service fr om knowledgeable, friendly associates who ar e happy to answer questions, of fer cooking tips, and take your gr oceries right to your car To day at 8 a.m.Yo u can sample delicious foods and if your e one of the rst 500 customers re ceive a FREE cooler N S. Mai n St. E.GulfAtlanticHwy. PowellRd. 44 Publix at Grand Tr averse Plaza2925 T raverse T rail The Vi llages, FL 32163Stor e Hours:MondaySunday: 7 a.m. to 9 p.m.Grand Opening Hours:8 a.m. to 9 p.m.Pharmacy Hours:MondayFriday: 9 a.m. to 8 p.m. Satur day: 9 a.m. to 6 p.m. Sunday: 11 a.m. to 5 p.m. Stor e: 352.750.1056 Pharmacy: 352.750.2714 publix.comScan this code with your smartphone QR re ader for a map and driving dir ections to your Publix stor e. PAGE 6 A6 DAILY COMMERCIAL Sunday, September 28, 2014 rrr f n t b r r f r 10 /1 1 10 /1 1 10 /1 1 DONT MI SS!f ntb ft r rr Ev ery ThursdayJAM NIGH T7:00P M Ev ery Friday 7:30P M r r fnt 2 Shows! 2:30P M & 7:30P M b Thursday 7 PM SU PE R JAM! 10 /1 1 10 /1 1 10 /1 1 DONT M ISS! DONT M ISS! 2 Shows! 2:30P M & 7:30P M DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! 10 /1 1 10 /1 1 10 /1 1 DONT M ISS! 10 /1 1 DONT M ISS! 10 /1 1 DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! 10 /1 1 10 /1 1 10 /1 1 DONT M ISS! 10 /1 1 DONT M ISS! 10 /1 1 DONT M ISS! 10 /1 1 10 /1 1 10 /1 1 DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! DONT M ISS! 10 /1 1 DONT M ISS! 10 /1 1 DONT M ISS! ntb f t 10 /16 10 /25 r 2 Shows! 2:30P M & 7:30P M b t JAMES GREGOR YNonSt op La ughter rf r KEN THOMAS and STEVE PEOPLES Associated Press WASHINGTON Hillary Rodham Clinton is the one gure uniting religious conservatives frustrated by a leader less Republican Party thats divided over for eign policy, immigra tion and social issues. The prospect of an other Clinton White House stirred anguish at the Voters Value Sum mit this weekend where hundreds of conserva tive activists debated the GOPs future and warned that the acknowledged but unannounced 2016 Democratic front-run ner would cement what they see as President Barack Obamas attack on religious freedom. Never forget she will be Barack Obamas third and fourth term as president of the United States, Minnesota Rep. Michele Bachmann, an unsuccessful GOP pres idential candidate in 2012, said Friday night. She was among the high-prole Republi cans, including past and prospective White House contenders, at the annual conference attended by some of the most promi nent social conservatives and hosted by the Fami ly Research Council, well known for its opposition to abortion and same-sex marriage. This years gathering expanded its focus to re ligious freedom or the persecution of Chris tians and their values at home and abroad. It was a message that GOP ofcials hope will help unify a fractured party and appeal to new vot ers ahead of Novembers elections and the next presidential contest. But it was Clintons name that was as much a rallying cry as the theme of religious liberty. Texas Sen. Ted Cruz, a prospective presiden tial candidate, chal lenged Clinton to spend a day debating the Den ver nuns who run nurs ing homes for the poor, called the Little Sis ters of the Poor Home for the Aged, and have challenged the Obama health laws requirement that some religious-afl iated organizations pro vide insurance that in cludes birth control. Former Arkansas Gov. Mike Huckabee, a once and perhaps future contender, described Clinton as tenacious. Shes got all the skills and would be an incred ibly formidable candi date, Huckabee told re porters, suggesting that Clinton is politically vul nerable. Shes got to go out and defend Barack Obama and her record in the rst four years she was secretary of state. Clinton would be the overwhelming favorite to win the Democrat ic presidential nomi nation, while the GOPs eld is large and lacks a clear front-runner. Two GOP establishment fa vorites, New Jersey Gov. Chris Christie and for mer Florida Gov. Jeb Bush, were not invited to the conference. As he did last year, Cruz won the summits sym bolic presidential pref erence straw poll with 25 percent of the vote, fol lowed by conservative rebrand Ben Carson and Huckabee. Clinton earned one vote among more than 900 cast, al though Family Research Council president Tony Perkins joked that even Mickey Mouse would have gotten a vote if list ed on the ballot. AMY TAXIN Associated Press LOS ANGELES Most of the nearly 60,000 Central Amer ican children who have arrived on the U.S.-Mexico border in the last year still dont have lawyers to repre sent them in immigra tion court, and advo cates are scrambling to train volunteer attor neys to help cope with the massive caseload. With the number of unaccompanied im migrant children more than doubling this past scal year, the need for attorneys has surged, and it has been exacer bated by the immigra tion courts decision to fast-track childrens cas es, holding initial hear ings within a few weeks instead of months. Immigrants can have counsel in immigration courts, but lawyers are not guaranteed or pro vided at government ex pense. Having an at torney can make a big difference: While almost half of children with at torneys were allowed to remain in the country, only 10 percent of those without representation were allowed to stay, ac cording to an analysis of cases through June by the Transactional Records Access Clearinghouse at Syracuse University. Religious conservatives opposed to Hillary MANUEL BALCE CENETA / AP Former Secretary of State Hillary Rodham Clinton speaks at the Womens Leadership Forum on Sept. 19 in Washington. Help wanted: Free lawyers for immigrant children PAGE 7 WEEKDAY MORNING6:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSWESH 2 News Sunrise Today Live! With Kelly and MichaelToday TodaySid the Science KidArthur Wild KrattsWild KrattsCurious GeorgeCurious GeorgeDaniel TigerDaniel TigerSesame Street Dinosaur TrainDinosaur TrainCaillou Martha SpeaksWild KrattsWild KrattsCurious GeorgeCurious GeorgeDaniel TigerDaniel TigerSesame Street Dinosaur TrainDinosa ur TrainLocal 6: Morning News at 6aCBS This Morning Rachael Ray Lets Make a Deal The Price Is RightNewsChannel 8 Today Today Today Daytime Rachael Ray(5:00) Eyewitness News DaybreakGood Morning America Steve Harvey RightThisMinuteName GameThe View10 News, 6am10 News 6:30amCBS This Morning Studio 10 Inside EditionDaytime JeopardyThe RightThisMinuteRightThisMinuteThe ViewAndrew WommackJoseph PrinceToday Joyce MeyerVaried ProgramsKenneth CopelandRod ParsleyVaried ProgramsHerman & SharronDoug KaufmannJames RobisonVaried ProgramsCaillou Arthur Wild KrattsWild KrattsCurious GeorgeCurious GeorgeDaniel TigerDaniel TigerSesame Street Dinosaur TrainDinosaur Trai nFlip My FoodOK! TV Eyewitness News This Morning The 700 Club Are We There Yet?Are We There Yet?Law & Order: Special Victims UnitABC Action News at 6 AM Good Morning America The Meredith Vieira Show RightThisMinuteLets Ask AmericaThe ViewShepherds Chapel CheatersCheatersSupreme JusticeJudge MableanDivorce CourtDivorce CourtDivorce CourtDivorce CourtJerry SpringerGood Day Orlando at 6am Good Day Orlando at 7am Good Day Orlando at 8am Good Day Orlando at 9am The Wendy Williams Show The RealPaid ProgramPaid ProgramVaried ProgramsPaid ProgramLove-RaymondCommunityThe 700 Club Maury The Peoples CourtrJames RobisonVarietyKenneth CopelandVaried ProgramsJoseph PrinceRod ParsleyVariety Joyce MeyerThe 700 Club Variety John HageefThe Daily Buzz The MiddleThe MiddleBe a MillionaireBe a MillionaireJudge FaithJudge FaithJustice for AllJustice for AllGood Day Orlando at 6am Good Day Orlando at 7am Good Day Orlando at 8am Good Day Orlando at 9am Live! With Kelly and MichaelThe Peo ples CourtnEnjoyingAndrew WommackVaried ProgramsKerry ShookWalk in the Word ProgramDeland KiaVaried ProgramsThe Doctors The Dr. Oz Show To Be AnnouncedCABLE CHANNELSA&EPaid ProgramPaid ProgramParking WarsParking WarsDog Bounty HunterDog Bounty HunterDog Bounty HunterDog Bounty HunterCriminal Minds Criminal Minds A M CMPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramThe Three Stooges(:45) Ghostbusters (1984) Bill Murray. Ghost fighters battle ghouls in a Manhattan high-rise.TPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid Program(:15) Walking Tall (2004, Action) The Rock, Johnny Knoxville. Aliens (1986) Carrie HennWPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramGood Morning, Vietnam (1987) Robin Williams. Airman Adrian Cronauer, DJ in 1965 Saigon. Trapped-Para.ThPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid Program(:15) Ghost (1990, Fantasy) Patrick Swayze, Demi Moore. A murder victim returns to save his beloved fiancee. FPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid Program(:15) Apollo 13 (1995) Tom Hanks, Bill Paxton. Based on the true story of the ill-fated 1970 moon mission. A N P LMOrangutan IslandChimp EdenBig Cat Diary Big Cat Diary The Crocodile Hunter Dirty Jobs Dirty Jobs Dirty JobsTOrangutan IslandChimp EdenBig Cat Diary Big Cat Diary The Crocodile Hunter Animal Cops Houston Pit Bulls and Parolees Pit Bulls and Parolees WOrangutan IslandChimp EdenBig Cat Diary Big Cat Diary The Crocodile Hunter Animal Cops Houston Pit Bulls and Parolees Pit Bulls and Parolees ThOrangutan IslandChimp EdenBig Cat Diary Big Cat Diary The Crocodile Hunter Animal Cops Houston Pit Bulls and Parolees Pit Bulls and Parolees FOrangutan IslandChimp EdenBig Cat Diary Big Cat Diary The Crocodile Hunter (Part 1 of 2) Animal Cops Houston Pit Bulls and Parolees Pit Bulls and Parolees BETBET InspirationVaried ProgramsLets Stay TogetherLets Stay TogetherFamily FeudFamily FeudHusbandsHo.HusbandsHo.MovieBRAVOTabatha Takes Over Tabatha Takes Over Tabatha Takes OverComedy CentralDaily ShowThe Colbert Report(:18) South Park(10:48) South Park(:19) BeerfestTPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramThe Half HourDaily ShowThe Colbert Report(:18) Community(10:48) South Park(:19) MallratsWPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramThe Half HourDaily ShowThe Colbert Report(:18) Community(10:48) South Park(:19) FuturamaThPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramThe Half HourDaily ShowThe Colbert Report(:18) South Park(10:48) South ParkNational-EuropeanFPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramComedy CentralDaily ShowThe Colbert Report(:18) South Park(10:48) South Park(:19) South Park D S CMPaid ProgramPaid ProgramPaid ProgramJames RobisonJoyce MeyerPaid ProgramI (Almost) Got Away With It Disappeared Wicked Attraction TPaid ProgramPaid ProgramForbes LivingJames RobisonJoyce MeyerPaid ProgramI (Almost) Got Away With It Disappeared Wicked Attraction WPaid ProgramPaid ProgramPaid ProgramJames RobisonJoyce MeyerPaid ProgramWicked Attraction Wicked Attraction Wicked Attraction ThPaid ProgramPaid ProgramPaid ProgramJames RobisonJoyce MeyerPaid ProgramDisappeared Disappeared Disappeared FPaid ProgramPaid ProgramPaid ProgramPaid ProgramJoyce MeyerPaid ProgramStalked: Someones Watching Stalked: Someones Watching Stalked: Someones Watching E!Paid ProgramPaid ProgramE! News Varied) SportsCenter (N) (Live) ESPN2Mike & Mike First TakeFAMJoyce MeyerVaried ProgramsThat s ShowThat s ShowThat s ShowThat s ShowThe Middle700/InteractiveThe 700 Club Gilmore GirlsF ProgramEllen An Unfinished Life (2005, Drama) Robert Redford, Morgan Freeman.Twin Dragons (1991, Comedy) Jackie Chan, Maggie Cheung, Nina Li Chi.Tears of the SunTPaid ProgramPaid ProgramTwin Dragons (1991, Comedy) Jackie Chan, Maggie Cheung, Nina Li Chi.Tears of the Sun (2003) Bruce Willis. Navy SEALs protect Nigerian refugees from ruthless rebels.FreedomlandWPaid ProgramPaid ProgramBuffy the Vampire Slayer Freedomland (2006, Crime Drama) Samuel L. Jackson, Julianne Moore, Edie Falco.Immortals (2011, Adventure) Henry Cavill, Stephen Dorff.ThPaid ProgramPaid ProgramBuffy the Vampire Slayer The Mummy: Tomb of the Dragon Emperor (2008, Adventure) Brendan Fraser, Jet Li, Maria Bello.Transformers: Dark of the Moon (2011) Shia LaBeouf.FPaid ProgramPaid ProgramBuffy the Vampire Slayer SuperstarStealing Harvard (2002, Comedy) Jason Lee, Tom Green, Leslie Mann.Jack and Jill (2011, Comedy) Adam Sandler, Katie Holmes, Al Pacino. G O L FMLive From the Ryder Cup Morning Drive (N) (Live) Morning Drive Playing Lessons From the ProsTGolf Central Morning Drive (N) (Live) Morning Drive PGA Tour GolfWGolf Morning Drive (N) (Live) Morning DriveQuest for the CardLearning CenterThGolf Morning Drive (N) (Live) European PGA Tour Golf Alfred Dunhill Links Championship, First Round. From St. Andrews, Scotland. (N) (Live)FGolf Morning Drive (N) (Live) European PGA Tour Golf Alfred Dunhill Links Championship, Second Round. From St. Andrews, Scotland. (N) (Live) September 28 October 4, 2014 TV Week 7 PAGE 8 A8 DAILY COMMERCIAL Sunday, September 28, 2014 rf nrffffft ffffbb nffffb f nf fffff f ffffft fffffftb f f f f f f r f r f$349,900 f tbbbt f f ff f f f $164,950 f ttttt ff f fr rf r $399,719 f ff tbb rf nf f n f$190,000 bb bbbt rf t r f f r f f$225,000 f ff ttt ff f r f ff r f$515,000 bbtb f ff f f f $90,000 f nf tt f n f f f rr f f $165,000 ff tt r ff f r f fr$33,400 rf btbtt f f nf r f$147,250 bb bbb f rf f r $135,000 rf bttt r r f r f f f$265,000 bbb f f r rff$495,000 r r f r f f$114,900 f t r nf f f r f $399,000 f ff tttt n f f $70,000 f ttb f f f fr f $436,000 n bttbb n rr r f r f f rf f f f$195,000 bbt fffffft SP ACIOUS SORRENTO 4/2 HOME plus a den/of ce. Large fenced backyar d with a handy man shop. Gr eat Location for the Orlando commuter .$174,900 rf n t bt r f r $172,000 f tbttbb nf f ff r r r f $140,000 f ttttb f r f r rff f $499,900 f tbbtbb ff r f frr rr f ff f$94,000 f nf b PAGE 9 5 x 2 ad house ad 1 x 2 ad piece of mind 2 x 2 ad 3rd generation estate auction ACROSS 1. Melissa McCarthys role (2) 9. __ Gun; 1986 movie for Tom Cruise 10. __ Ono 11. Nickname for Dr. Cliff Huxtables portrayer 13. Perfect. The __; Roger Moore series of the 1960s 17. Ward, June and the boys 18. I Shouldnt __ Alive (2005-12) 20. The __ Set; 2006 film for Sigourney Weaver 21. 2012 British Open champ 23. Actor on Touched by an Angel 24. Author Stevensons monogram 25. 1996-97 Ted Danson series 26. __ Femme Nikita 29. Deezer D series, once 30. Actor on NCIS 34. Stacy, for one 36. Part of the title of Jon Cryers series (2) 38. Alan Cummings role on The Good Wife 39. Actress Barbara 42. __ Race; 2001 film for Whoopi 43. Role on NCIS: Los Angeles (2) DOWN 1. The __ Squad (-) 2. Middle East alliance, for short 3. Country singer Lovett 4. Greeting from Stallone 5. Initials for Freddy from A Nightmare on Elm Street 6. Parker Lewis Cant __ (1990-93) 7. Series for Mark Harmon 8. __-Stop; 2014 Liam Neeson movie 9. Singer & actor Justin __ 12. Minutes host (2) 14. 1986-90 sitcom alien 16. Mr. Carney 19. Queen of Jazz 20. Tim Dalys sister 22. Initials for Gloria Bunkers portrayer 23. Most famous bride of 1981 27. 814 years ago 28. No kidding, sarcastically 30. Actress Campbell 31. Newscaster Huntley 32. Lois __; Smallville role 33. One of the boys on Home Improvement 35. Shade provider 37. __ Vegas 40. Ending for mud or dad 41. ONeill or Bradley September 28 October 4,005186 PAGE 10MDouble Victory Modern Marvels Balls Modern Marvels Bathroom Tech Modern Marvels Bathroom technology.Modern Marvels Beans Modern Marvels BBQ Tech TPaid ProgramPaid ProgramModern Marvels Alaska Alaska: Big America Distances, weather, landscapes. Top Gear Alaskan Adventure Top Gear Cool Cars for GrownupsWPaid ProgramPaid ProgramTo Be AnnouncedThPaid ProgramPaid ProgramTo Be AnnouncedFPaid ProgramPaid ProgramTo Be Announced L I F EMPaid ProgramPaid ProgramThe Balancing ActThe Balancing ActUnsolved Mysteries Frasier Frasier Frasier The Kid Frasier Frasier Frasier TPaid ProgramPaid ProgramThe Balancing ActThe Balancing ActUnsolved Mysteries Frasier Frasier Frasier Frasier Frasier Frasier WPaid ProgramPaid ProgramThe Balancing ActDesigning SpacesUnsolved Mysteries Frasier Frasier Frasier Frasier Frasier Frasier ThPaid ProgramPaid ProgramThe Balancing ActDesigning SpacesUnsolved Mysteries Frasier Frasier Frasier Frasier Frasier Frasier FPaid ProgramPaid ProgramThe Balancing ActDesigning SpacesUnsolved Mysteries Frasier Frasier Frasier Frasier Frasier Frasier MTVMusic Feed Varied Programs N B C S NMPaid ProgramPaid ProgramNBCSN Sunday Sports ReportNBCSN Sunday Sports ReportThe Dan Patrick Show Sports talk radio. (N) (Live)TPaid ProgramPaid ProgramEnglish Premier League Soccer (Taped) The Dan Patrick Show Sports talk radio. (N) (Live)WPaid ProgramPaid ProgramEnglish Premier League Soccer (Taped) The Dan Patrick Show Sports talk radio. (N) (Live)ThPaid ProgramPaid ProgramEnglish Premier League Soccer (Taped) The Dan Patrick Show Sports talk radio. (N) (Live)FPaid ProgramPaid ProgramPremier LeaguePrem-Lea-NewsMatch PackPrem-Lea-NewsThe Dan Patrick Show Sports talk radio. (N) (Live)NICKGeorge LopezGeorge LopezSpongeBobSpongeBobSpongeBobPAW PatrolTeam UmizoomiDora the ExplorerBubble GuppiesBubble GuppiesWallykaz am!PAW PatrolSPIKEPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramVaried Programs S U NMFishing the FlatsShip Shape TVScubaNationSportsmans Adv.Paid ProgramRays Live!Rays Live!Fight Sports: In 60 Playing ThroughSwin g ClinicJimmy HanlinTReel TimeONeill OutsideTravis JohnsonFSU HeadlinesCapital DatelineReel AnimalsScubaNationP1 AquaX USA (N)P1 PowerboatBoat Show TVSpecial Oly.how to Do floridaWInto the BlueSaltwater Exp.how to Do floridaLive With LoriCapital Dateline (N)Running XTERRA Advent.Extreme FishinJimbo Fisher Show P1 AquaX USAP1 PowerboatThSportsmans Adv.Sport FishingReel AnimalsFSU HeadlinesCapital DatelineSportsMoney PowerboatingP1 PowerboatBig 12 ShowcaseACC Gridiron Live GatorZoneFPaid ProgramPaid ProgramSpecial Oly.P1 AquaX USAP1 PowerboatFlorida SportShip Shape TVSport FishingFishing the FlatsSport Fishi ngSportsmans Adv.Extreme Fishin S Y F YMPaid ProgramPaid ProgramPaid ProgramPaid ProgramFriday the 13th: The Series Friday the 13th (1980, Horror) Betsy Palmer, Adrienne King, Harry Crosby.Friday the 13th, Part 2 (1981, Horror)TPaid ProgramPaid ProgramPaid ProgramPaid ProgramProm Night (2008) Brittany Snow. A madman terrorizes prom-going teenagers.Resident Evil: Extinction (2007, Horror) Milla Jovovich, Oded Fehr. WPaid ProgramPaid ProgramPaid ProgramPaid ProgramGhost Hunters Moonshine & MadnessGhost Hunters City Hell Ghost Hunters Frighternity Ghost Hunters The U.S. Naval Institute.ThPaid ProgramPaid ProgramPaid ProgramPaid ProgramScare TacticsScare TacticsScare TacticsWitchville (2010) Luke Goss. Prince Malachy returns home from the Crusades.Witchslayer GretlFPaid ProgramPaid ProgramPaid ProgramPaid ProgramBats: Human Harvest (2007, Horror) David Chokachi, Michael Jace. Vampyre Nation (2012, Horror) Andrew Lee Potts, Neil Jackson. TBSFull HouseRules/EngagementMarried... WithMarried... WithLove-RaymondLove-RaymondMovie Americas Funniest Home Videos T C MMDoctors OrdersThe Life of the Party (1930, Comedy) Winnie Lightner.(:15) Three Faces East (1930) Constance Bennett.My Past (1931) Bebe Daniels.(:45) Barbary Coast Gent (1944, Western) Wallace Beery.TMGM on Move(:45) Vacation From Marriage (1945) Robert Donat, Deborah Kerr. The Hucksters (1947, Drama) Clark Gable, Deborah Kerr. Edward, My Son (1949, Drama) Spencer Tracy. WThe Adventures of Prince Achmed(:15) The Student Prince in Old Heidelberg (1927) Ramon Navarro.(:15) The Merry Widow (1934) Maurice Chevalier, Jeanette MacDonald. Expensive Husbands (1937)Th(:15) That Forsyte Woman (1950, Drama) Errol Flynn, Greer Garson. (:15) The Doctor and the Girl (1950, Drama) Glenn Ford, Charles Coburn. MGM ParadeRoom Service (1938) Groucho Marx, Chico Marx. FThe Circus (1928) Charlie Chaplin.(:15) Polly of the Circus (1932, Drama) Clark Gable. Circus Clown (1934) Joe E. Brown.(:45) Fixer Dugan (1939) Lee Tracy, Virginia Weidler.At the Circus (1939) TLCTo Be AnnouncedQuints by SurpriseQuints by Surprise19 Kids-Count19 Kids-CountKnow-PregnantKnow-PregnantHoarding: Buried AliveMy Big Fat American Gypsy WeddingTNTSmallville Charmed Charmed Supernatural Supernatural SupernaturalTOONLegends of ChimaTenkai KnightsPokmon: XYTeen Titans Go!Teen Titans Go!World of GumballWorld of GumballMovie Tom and JerryTom and JerryTRAVELPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramAmerican Grilled Anthony Bourdain: No ReservationsVaried ProgramsTVLPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramAndy Griffith ShowAndy Griffith ShowBeverly HillbilliesBeverly HillbilliesWalker, Texas Ranger U S AMNCIS A new special agent arrives. NCIS Out of the Frying Pan ... NCIS Tell-All (DVS) NCIS Two-Faced (DVS) NCIS A murder is caught on tape.NCIS Tony revisits his time in Baltimore.TLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitWHouse Words and Deeds House House returns to the hospital.The Ladykillers (2004) Tom Hanks. Five thieves try to kill an old woman. NCIS Reunion The death of a Marine. NCIS A blogger turns up dead.ThCase 39 (2009, Horror) Rene Zellweger, Jodelle Ferland, Ian McShane. CSI: Crime Scene InvestigationCSI: Crime Scene InvestigationCSI: Crime Scene InvestigationCSI: Crime Scene InvestigationFLaw & Order: Criminal Intent Law & Order: Criminal Intent ShandehLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitVH1VH1 Plus Music VH1 Plus Music VH1 Plus Music Big Morning Buzz Live The Gossip TableVH1 Plus MusicVaried ProgramsWGN-APaid ProgramJoyce MeyerAndrew WommackCreflo DollarJames RobisonPaid ProgramWalker, Texas Ranger Walker, Texas Ranger In the Heat of the NightPREMIUM CHANNELSDISNOctonautsOctonautsMickey MouseMickey MouseNever LandSofia the FirstCal. Wild WestDoc McStuffinsDoc McStuffinsVaried Programs H B OMAll-Star Superman (2011) PG (:15) Ethel (2012) Ethel Kennedy discusses family, marriage and politics. NRREAL Sports With Bryant Gumbel Vanishing Point (1997, Action) Viggo Mortensen. Prime (2005)TMuppets From Space (1999) Jeffrey Tambor. G Casting By (2012, Documentary) NR The Secret Life of Walter Mitty (2013, Comedy) Ben Stiller. PG Beautiful Creatures (2013) PG-13WRememberingSupernova (2000) James Spader. PG-13 Pleasantville (1998, Comedy) Tobey Maguire. Premiere. PG-13 (:15) Jack the Giant Slayer (2013, Fantasy) Nicholas Hoult. PG-13 Th(5:10) The Girl (:45) Garfield: A Tail of Two Kitties (2006) PG The 50 Year Argument (2014, Documentary) NR (:45) Life of Pi (2012, Adventure) Suraj Sharma, Irrfan Khan, Tabu. PG FThe Emperors Club (2002, Drama) Kevin Kline. Premiere. PG-13 (7:50) A Simple Wish (1997) Martin Short. PG Cheaper by the Dozen 2 (2005) Steve Martin. PG (:15) R.I.P.D. (2013) Jeff Bridges. M A XM(:10) Sunshine (2007, Science Fiction) Cillian Murphy, Chris Evans. R Were the Millers (2013, Comedy) Jennifer Aniston, Jason Sudeikis. R (9:50) The Shining (1980, Horror) Jack Nicholson, Shelley Duvall. R T(:05) Behind Enemy Lines II: Axis of Evil (2006) R (:45) The Whole Ten Yards (2004, Comedy) Bruce Willis. PG-13 Rush Hour (1998, Action) Jackie Chan. PG-13 (:15) 47 Ronin (2013) PG-13 WSix Days, Seven Nights (1998) Harrison Ford. PG-13 (:45) Dominion: Prequel to the Exorcist (2005) Stellan Skarsgard. R (:45) Unleashed (2005, Action) Jet Li, Bob Hoskins, Morgan Freeman. R Transporter 2Th(:15) Shes the Man (2006, Romance-Comedy) Amanda Bynes. PG-13 (:10) Mama (2013, Horror) Jessica Chastain, Megan Charpentier. PG-13 (9:50) Undercover Brother (2002) Eddie Griffin. PG-13(:20) The RingerF(:05) Changeling (2008) Angelina Jolie. A woman insists that another boy has replaced her son.Girl, Interrupted (1999, Drama) Winona Ryder, Angelina Jolie. R (:45) The Worlds End (2013) Simon Pegg. R S H O WM(5:15) The Chaperone (2011) PG-13Bad News Bears (2005, Comedy) Billy Bob Thornton. PG-13 The Horse Whisperer (1998) Robert Redford. A cowboy helps an injured girl and her traumatized horse. PG-13 T(5:15) Dantes Peak (1997) PG-13(:15) The Last Big Thing (1996, Comedy) Dan Zukovic. R Ed Wood (1994) Johnny Depp. Cult filmmaker makes his mark in the s.(:15) Dark Skies (2013) PG-13W(4:15) Ed Wood RSnow Falling on Cedars (1999) Ethan Hawke. A reporter covers a murder trial.(:40) Will (2011) Damian Lewis. An orphan travels across Europe to go to a game.(:25) A Case of You (2013) Justin Long. R Th(5:10) Glena (2013)(:35) Barricade (2012, Horror) Eric McCormack. PG-13 The Ghost Writer (2010, Drama) Pierce Brosnan, Kim Cattrall. PG-13 (:15) Alex Cross (2012) Tyler Perry. A serial killer pushes Cross to the edge.FThe Truman Show (1998) Jim Carrey. PG (:45) Legendary (2010, Drama) Patricia Clarkson, John Cena. PG-13 (:35) Save the Last Dance (2001, Romance) Julia Stiles. PG-13 Dangerous Minds T M CM(5:55) Aprs Vous... (2003, Romance) Daniel Auteuil. (Subtitled) R Gosford Park (2001) Eileen Atkins. A murder occurs at a hunting party in England. R Scary Movie V (2013) Ashley Tisdale. PG-13 T(5:55) Nixon (1995, Biography) Anthony Hopkins. Oliver Stones portrait of Americas 37th president. R (:10) The Other Sister (1999, Romance-Comedy) Juliette Lewis, Diane Keaton. PG-13 (:20) The IllusionistWThe Way Back (:45) Breakaway (2011, Comedy) Russell Peters, Rob Lowe. PG-13 The Kings of Appletown (2009) Dylan Sprouse. PG (:05) Skeletons in the Closet (2000) Treat Williams. RDangerous LvsTh(:05) Alive (1993, Docudrama) Ethan Hawke, Vincent Spano. R (:15) The Impossible (2012, Drama) Naomi Watts, Tom Holland. PG-13 (:10) The Twilight Saga: Breaking Dawn Part 2 (2012) Kristen Stewart. PG-13F(5:00) Ed Wood (1994) R (:10) Blast (2004, Action) Eddie Griffin, Vivica A. Fox. R (:45) Some Girl(s) (2013) Adam Brody, Kristen Bell. NR (:15) Step Up Revolution (2012, Drama) Ryan Guzman. PG-13 10 TV Week September 28 October 4, 2014 PAGE 11 WEEKDAY AFTERNOON12:0012:301:001:302:002:303:003:304:004:305:005:30LOCAL BROADCAST CHANNELSNews Paid ProgramDays of our Lives The Meredith Vieira Show The Ellen DeGeneres ShowWESH 2 News at 4:00 WESH 2 News at 5 PMCharlie Rose Varied Programs Curious GeorgeSesame StreetArthur Arthur Wild KrattsRick Steves EuropePeg Plus CatPeg Plus CatSuper Why!Thomas & FriendsSesame StreetCat in the HatCurious GeorgeCurious GeorgeArthur WordGirlWUFT NewsWorld NewsNews The Young and the RestlessBold/BeautifulThe Talk The Queen Latifah Show Extra The InsiderLocal 6 NewsLocal 6 NewsToday Days of our Lives Steve Harvey The Ellen DeGeneres ShowNewsChannel 8 First at 4PMNews NewsEyewitness News at Noon The Chew General Hospital Be a MillionaireFamily FeudEyewitness News at 4 News Eyewitness News10 News, 12NThe Young and the RestlessBold/BeautifulThe Talk Lets Make a Deal Dr. Phil 10 News, 5pm10 News, 5:30pmFOX13 News at NoonAccess HollywoodDish NationThe Real TMZ Live Judge JudyJudge JudyFOX13 5:00 NewsFOX13 5:30 NewsNewslineVaried Programs Journal TravelscopeCheatersCheatersThe Steve Wilkos Show Jerry Springer The Bill Cunningham ShowMaury MauryNews Be a MillionaireThe Chew General Hospital The Meredith Vieira Show Dr. Phil Be a MillionaireNewsJoseph PrinceThrough the BibleArth. RippyVaried ProgramsThe Jim Bakker Show The 700 Club Your Health with Dr. RichardHerman & SharronRod ParsleyPeg Plus CatPeg Plus CatSuper Why!Thomas & FriendsSesame StreetCat in the HatCurious GeorgeWordGirlArthur Arthur Wild KrattsWild KrattsHot BenchHot BenchCommunityCommunityKing of QueensKing of QueensTo Be Announced Hot in ClevelandHot in ClevelandLove-RaymondLove -RaymondABC Action News at Noon The Chew General Hospital The Dr. Oz Show The Now Tampa Bay News NewsCheatersCheatersThe Steve Wilkos Show The Steve Wilkos Show Jerry Springer Jerry Springer How I Met/MotherHow I Met/MotherDr. Phil TMZ Live The Dr. Oz Show Dr. Phil Judge JudyJudge JudyFOX 35 News at 5Judge Mathis The Doctors Judge Mathis Maury The Peoples Court Family FeudName GamerKnow the CauseVariety Jim Bakker Variety Varied ProgramsVariety Kids VarietySuperChannel Presents Variety VarietyfAmericas CourtAmericas CourtPaternity CourtPaternity CourtHot BenchHot BenchThe Bill Cunningham ShowRules/EngagementRules/EngagementThe Queen Latifah ShowDivorce CourtDivorce CourtThe Peoples Court TMZ Live The Wendy Williams Show The Real FOX 35 News at 5nVaried Programs Trinity FamilyVaried ProgramsJames RobisonVaried ProgramsThe 700 ClubJohn Hagee TodayVaried Programst(11:00) Movie Varied ProgramsbDivorce CourtDivorce CourtJudge JudyJudge JudyJudge Mathis The Peoples Court The Wendy Williams Show The RealCABLE CHANNELSA&ECSI: MiamiVaried ProgramsCSI: MiamiVaried ProgramsCriminal Minds Criminal Minds The First 48 The First 48 A M CM(:15) Hitman (2007, Action) Timothy Olyphant, Dougray Scott. (:15) Walking Tall (2004, Action) The Rock, Johnny Knoxville. The Shawshank Redemption (1994) Tim Robbins, Morgan Freeman.T(11:00) Aliens (1986, Science Fiction) Sigourney Weaver, Carrie Henn.Jurassic Park (1993, Adventure) Sam Neill, Laura Dern. Cloned dinosaurs run amok at an island-jungle theme park.The Lost World: Jurassic Park W(11:30) Trapped in Paradise (1994, Comedy) Nicolas Cage, Jon Lovitz. Godzilla (1998) Matthew Broderick, Jean Reno. Nuclear testing in the South Pacific produces a giant mutated lizard. Ghost (1990) Patrick Swayze.Th(:15) The Breakfast Club (1985, Comedy-Drama) Emilio Estevez, Molly Ringwald. The School of Rock (2003) Jack Black. An unemployed guitarist poses as a teacher. Apollo 13 (1995) Tom Hanks.F(:15) Vertical Limit (2000) Chris ODonnell, Bill Paxton. Mountain climbers are trapped in an icy cave on K2. Repo Men (2010) Jude Law. Agents repossess transplanted organs for nonpayment. Terminator 3 A N P LMDirty Jobs Dirty Jobs Dirty Jobs Dirty Jobs To Be Announced To Be AnnouncedTPit Boss Dirty Jobs Dirty Jobs Dirty Jobs To Be Announced To Be AnnouncedWPit Boss Dirty Jobs Dirty Jobs Dirty Jobs To Be Announced To Be AnnouncedThPit Boss Dirty Jobs Dirty Jobs Dirty Jobs To Be Announced To Be AnnouncedFPit Boss Dirty Jobs Dirty Jobs Dirty Jobs To Be Announced To Be AnnouncedBET(11:00) Movie Movie Varied Programs The GameThe Game106 & ParkBRAVOHousewives/Atl.Varied ProgramsHousewives/Atl.Varied ProgramsHousewives/Atl.Varied ProgramsCNBCFast Money Halftime ReportPower Lunch Street Signs Closing Bell Fast MoneyVaried ProgramsCNNLegal View With Ashleigh BanfieldWolfCNN Newsroom With Brooke BaldwinCNN Newsroom With Brooke BaldwinThe Lead With Jake TapperThe Situation Room C O MM(11:19) Beerfest (2006) Jay Chandrasekhar. (:21) Your Highness (2011, Comedy) Danny McBride, James Franco. (:23) Key & Peele(3:54) Key & Peele(:25) Key & Peele(4:56) Futurama(:26) FuturamaT(11:19) Mallrats (1995) Shannen Doherty, Jeremy London.(:21) Tosh.0 (1:51) Tosh.0 (:22) Tosh.0 (2:52) Tosh.0 (:23) Tosh.0 (3:54) Futurama(:25) Futurama(4:56) Futurama(:26) FuturamaW(11:49) Futurama(:20) Futurama(12:50) Futurama(:21) South Park(1:51) South Park(:22) South Park(2:52) South Park(:23) South Par k(3:54) South Park(:25) South Park(4:56) Futurama(:26) FuturamaTh(11:19) National Lampoons European Vacation (1985)Its Always SunnyIts Always SunnyIts Always Sunny(2:52) Workaholics(:23) Workaholics(3:54) Workaholics(:25) Workaholics(4:56) Futurama(:26) FuturamaF(11:49) First Sunday (2008, Comedy) Ice Cube, Katt Williams. (1:51) Dance Flick (2009, Comedy) Shoshana Bush. To Be Announced(3:54) Futurama(:25) Futurama(4:56) Futurama(:26) Futurama D S CMSins & Secrets Highway to Sell Mustang MisfireHighway to Sell Surf Wagon WipeoutHighway to Sell Hell Camino Fast N Loud Fast N Loud One of a Kind WoodillTSins & Secrets Alaska Marshals Deadliest Catch Deadliest Catch Deadliest Catch Yukon Men Breaking Points WWicked Attraction Naked and Afraid Naked and Afraid Naked and Afraid Naked and Afraid Breaking Borneo Naked and Afraid Dunes of DespairThDisappeared Vegas Rat Rods (DVS) County Jail Las Vegas Vegas Rat Rods Ranch Rod Vegas Rat Rods Mack Rod Vegas Rat Rods Tuxedo RodFStalked: Someones Watching Airplane Repo Airplane Repo Airplane Repo Blood & Mud Airplane Repo Wounded Warbird Bering Sea Gold E!E! News Sex and the CitySex and the CitySex and the CitySex and the CitySex and the CitySex and the CityVaried Programs E S P NMSportsCenter (N) (Live) SportsCenter (N) (Live) NFL PrimeTime (N) (Live) NFL Insiders (N) (Live) NFL Live (N) (Live) Around the HornPardon/InterruptionTSportsCenter (N) (Live) SportsCenter (N) (Live) SportsCenter (N)Coll. Football LiveNFL Insiders (N) Mike and MikeN) SportsCenter (N)Coll. Football LiveNFL Insiders (N) (Live) NFL Live (N) (Live) Around the HornPardon/InterruptionFSportsCenter (N) (Live) SportsCenter (N) (Live) SportsCenter (N)Coll. Football LiveNFL Insiders (N) (Live) NFL Live (N) (Live) Around the HornPardon/InterruptionESPN2Numbers Never Lie First Take Varied Programs SportsNation QuestionableYou Herd MeOlbermannOutside the LinesFAMGilmore Girls:30) Tears of the Sun (2003, Action) Bruce Willis, Monica Bellucci. How I Met/MotherHow I Met/MotherHow I Met/MotherHow I Met/MotherTwo and Half MenTwo and Half MenSnow White and the HuntsmanT(11:30) Freedomland (2006) Samuel L. Jackson, Julianne Moore, Edie Falco.How I Met/MotherHow I Met/MotherHow I Met/MotherAnger ManagementAnger ManagementTwo and Half MenTwo and Half MenMike & Molly W(10:30) Immortals (2011, Adventure)How I Met/MotherHow I Met/MotherHow I Met/MotherAnger ManagementAnger ManagementTwo and Half MenTwo and Half MenMike & Molly Mike & Molly Mike & Molly Th(10:30) Transformers: Dark of the Moon (2011) Shia LaBeouf, Josh Duhamel.How I Met/MotherHow I Met/MotherHow I Met/MotherHow I Met/MotherAnger ManagementAnger ManagementTwo and Half MenTwo and Half MenFTwo and Half MenTwo and Half MenHow I Met/MotherHow I Met/MotherHow I Met/MotherHow I Met/MotherHow I Met/MotherHow I Met/Mothe rHow I Met/MotherTwo and Half MenTwo and Half MenThats My Boy G O L FM2014 Ryder Cup Final Day. From the Gleneagles Golf Club in Perthshire, Scotland.T(11:00) PGA Tour Golf Champions: Nature Valley First Tee Open, Final Round.The Golf Fix Golf Big Break Invitational, Day 1 Modified Stableford. From Great Waters Golf Course in Greensboro, Ga. (N) (Live)WPGA Tour Golf Champions: Nature Valley First Tee Open, Final Round. From Pebble Beach Golf Resort in Calif. Golf Big Break Invitational, Day 2 Modified Stableford. From Great Waters Golf Course in Greensboro, Ga. (N) (Live)ThLPGA Tour Golf Reignwood LPGA Classic, First Round. From Beijing. Golf Big Break Invitational, Day 3 Match Play. From Great Waters Golf Course in Greensboro, Ga. (N) (Live)FLPGA Tour Golf Reignwood LPGA Classic, Second Round. From Beijing. Golf Big Break Invitational, Final Day Stroke Play. From Great Waters Golf Course in Greensboro, Ga. (N) (Live) September 28 October 4, 2014 TV Week 11 PAGE 12 3 x 4 ad lakeridge village By Jay Bobbin Zap2it Reconfigure Pygmalion and its musical descendant My Fair Lady for the age of Facebook and Twitter, and the result is Selfie. The main characters are even named Eliza and Henry in the ABC sitcom premiering Tuesday, Sept. 30. Instead of giving compulsive social media poster Eliza Dooley (think Doolittle) lessons in proper English, Henry Higenbottam (a la Higgins) is enlisted to help her relate to the real world at least as much as to cyberspace. Developed by Emily Kapnek (Suburgatory), Selfie stars Scottish actress Karen Gillan who played Amy Pond on Doctor Who as Eliza, and John Cho (of the Harold & Kumar and most recent Star Trek movies) as Henry. We started off talking about relationship shows and potential romantic comedies, Kapnek explains, what the modern obstacles are, and sort of the presence of technology in relationships ... the everpresent phone and laptops and tablets at dinner tables and bedrooms and every sort of occasion. And we realized that in telling a story where that is an obstacle and someone (is) sort of trying to wean themselves (off it), there was inherently a Pygmalion sort of aspect. We sort of embraced it and kind of went into it, but it didnt start off from a place of, Lets tell a modern version of My Fair Lady or Pygmalion. Gillan became social media-conscious upon learning she was being talked about on it, she recalls. Then I realized you should probably never Google yourself, so that became a rule in my life. I did join Twitter while on Doctor Who. It was very exciting. Relating strongly to filling the Henry Higgins slot on Selfie, Cho notes that character was a linguistics expert, and I was thinking how as an immigrant, I kind of have that. When youre not born in this country, you tend to study how the natives talk and a little bit like Gatsby or something. It doesnt work when you look different, which is the lesson I learned later. While social media expectedly plays a big role in Selfie in the early going. Kapnek forecasts it wont always be that way but she admits knowing when to ease up on it is tricky. The idea is, obviously, this is (Elizas) sort of evolution and growth away from some of those devices, away from some of those habits, the writerproducer says, so maybe it starts to dwindle. But because this is sort of one of the main things shes fighting against and one of her characteristics, we wanted to prop it up at just the right time with just the right degree of it. I mean, thats a balance were hoping to strike. 2 x 3 ad full bloom orist 12 TV Week September 28 October 4, 2014 EDITOR'S PICK Selfie updates My Fair Lady Karen Gillan stars in Selfie, premiering Tuesday on ABC. D005373 SPECTACULARSEPT/OCTFUNUP CO MIN G EV E NT SSu n 9/ 28 2: 30Hon ey of a DA Y! BE ES & WH AT TH EY DO FO R US !We d 10 /1 1: 30 De nt al Hy gi en e Wh at is ne w! Fr i 10 /3 10 :3 0 Br ea st Ca nc er ta lk Le ar n al l yo u ca n! 3: 30 Fr au d & Sa fe ty Pr ot ec ti on yo u sh ou ld kn ow Sa t 10 /4 11 :0 0 Ha rv es t Fe st iv al Gu ar an te ed to be fun Su n 10 /5 11 :3 0 Ch il i Co ok o Ta st e th e be st Har vest Festivals coming! Call for details PAGE 13 full page ad advanced hearing group September 28 October 4, 2014 TV Week 13 PAGE 14MModern Marvels Breakfast Tech Modern Marvels The journey of an egg.Modern Marvels Corn Modern Marvels Convenience StoresModern Marvels Chocolate Modern Marvels Wine TTop Gear Off Road Big Rigs Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars Pawn Stars WTo Be Announced To Be AnnouncedThTo Be Announced To Be AnnouncedFTo Be Announced To Be Announced L I F EMHow I Met/MotherHow I Met/MotherGreys Anatomy Izzies mother visits. Greys Anatomy Greys Anatomy Heres to Future DaysHoarders Hoarders THow I Met/MotherHow I Met/MotherGreys Anatomy Now or Never Greys Anatomy Good Mourning Greys Anatomy Goodbye Celebrity Wife Swap Celebrity Wife Swap WHow I Met/MotherHow I Met/MotherGreys Anatomy Greys Anatomy Greys Anatomy Celebrity Wife Swap Celebrity Wife Swap ThHow I Met/MotherHow I Met/MotherGreys Anatomy Greys Anatomy Greys Anatomy Wife Swap Wife Swap FHow I Met/MotherHow I Met/MotherGreys Anatomy Greys Anatomy Greys Anatomy Wife Swap Wife Swap MTVVaried Programs N B C S NMPremier LeaguePremier League Match of the DayPrem-Lea-NewsPremier League Live (N) (Live)English Premier League Soccer Stoke City FC vs Newcastle United FC. (N) (Live)Prem Goal ZonePro Football TalkTField SportsWhitetail DiariesField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsNA SCAR AmericaPro Football TalkWField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsBig RandyNASCAR Ame ricaPro Football TalkThField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsNASCAR AmericaPro Football TalkFField SportsField SportsField SportsField SportsField SportsField SportsField SportsField SportsMotorsports Hour Countdown to F1 Pro Football TalkNICKDora and FriendsWallykazam!PAW PatrolPAW PatrolSpongeBobSpongeBobSpongeBobOdd ParentsOdd ParentsSpongeBobSpongeBobSpongeBobSPIKEVaried Programs Cops Varied ProgramsCops Varied ProgramsCops Varied ProgramsCops Varied Programs S U NMMLB Baseball Tampa Bay Rays at Cleveland Indians. Golf AmericaGolf Destination (N)Golfing the WorldSeminole SportsJimbo Fisher Show (N) Earl HolmesPleasure BoaterTThe Fittest CEOCanoe World ChampionshipsExtreme FishingInto the BlueSaltwater Exp.The Butch Jones Show (N)A Special Edition of how to Do floridaSeminole SportsCllege FootballWBoxing From Ontario, California. April 24, 2010. Starting Gate (N) (Live) SpurrierB-CU Wild. Ftb.Graham BensingerInside Orange3 Wide Life (N) GatorZone (N)ThSaltwater Cowboys (N) Park & Pipe Open Series Starting Gate (N) (Live) Football: FloodInside N.D. FootballUSF Football: New Future Phenoms (N)Prep Zone SpoMark Stoops ShowFSaltwater Exp.Into the BlueACC Gridiron Live The New College Football ShowC-USA ShowcaseACC All-Access (N)Womens College Soccer Virginia Tech at North Carolina. (N) (Live) S Y F YM(11:00) Friday the 13th, Part 2 (1981)Friday the 13th Part III (1982, Horror) Dana Kimmell, Paul Kratka.Jeepers Creepers 2 (2003, Horror) Ray Wise, Jonathan Breck. Vacancy (2007) Luke Wilson.TFace Off Life and Death Face Off American Gangster Face Off Ancient Aliens Face Off Twisted tree characters. Face Off Animal Attraction Face Off Re-imagining characters. WGhost Hunters A Family of Spirits Ghost Hunters Haunted by HeroesThe Dead (2010) Rob Freeman. A man treks through an African landscape where zombies roam.Dead Season (2011, Horror) Scott Peat, Marissa Merrill. Th(11:30) Witchslayer Gretl (2012) Shannen Doherty. Night of the Demons (2009, Horror) Monica Keena, Shannon Elizabeth. Halloween II (2009, Horror) Malcolm McDowell, Tyler Mane, Sheri Moon Zombie. FThe Bleeding (2009) Vinnie Jones. A man must slay his vampire brother. My Bloody Valentine (2009, Horror) Jensen Ackles, Jaime King. Wrong Turn 5: Bloodlines (2012, Horror) Camilla Arfwedson, Roxanne McKee. TBSCleveland ShowCleveland ShowAmerican DadAmerican DadFamily GuyFamily GuyKing of QueensKing of QueensFriends Friends Friends Varied Programs T C MM(:15) Road to Paradise (1930) Loretta Young, Jack Mulhall.(:45) Penrod and Sam (1931) Leon Janney, Matt Moore.Father Takes a Walk (1935) Paul Graetz, Chili Bouchier.One Thrilling Night (1942) John Beal.(:45) Phantom KillerTEdward, My SonPlease Believe Me (1950) Deborah Kerr. Count Your Blessings (1959) Deborah Kerr. (:45) The Sundowners (1960) Deborah Kerr. Australian sheep drovers face a challenging daily life.W(:15) Two Guys From Milwaukee (1946) Dennis Morgan, Jack Carson. Kismet (1955, Fantasy) Howard Keel, Ann Blyth, Dolores Gray. The Prince and the Showgirl (1957) Marilyn Monroe, Laurence Olivier. ThGo West (1940) Groucho Marx, Chico Marx. The Big Store (1941, Comedy) The Marx Brothers. Double Dynamite (1951, Comedy) Frank Sinatra. A Girl in Every Port (1952, Comedy) Groucho Marx. FAt the Circus (1939)The Wagons Roll at Night (1941) Humphrey Bogart. Thousands Cheer (1943, Musical) Kathryn Grayson, Gene Kelly. (:15) Our Vines Have Tender Grapes (1945, Drama) Edward G. Robinson. TLCFour Weddings 19 Kids-Count19 Kids-Count19 Kids-Count19 Kids-CountVaried ProgramsTNTBones Bones Bones Bones Castle CastleTOONTeen Titans Go!Teen Titans Go!World of GumballWorld of GumballVaried Programs Adventure TimeAdventure TimeWorld of GumballWorld of GumballTeen Titans Go!TRAVELVaried Programs Food ParadiseVaried Programs Man v. FoodMan v. FoodTVLGunsmoke Bonanza Bonanza Walker, Texas Ranger Walker, Texas Ranger Walker, Texas Ranger U S AMNCIS Tracking the Port-to-Port killer.NCIS The Port-to-Port killer is revealed.NCIS Tony searches for answers.NCIS A beloved Marine is fatally stabbed.NCIS The Penelope Papers NCIS Thirst (DVS)TLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitLaw & Order: Special Victims UnitWNCIS A Marines body surfaces. NCIS A Navy pilot is found dead. NCIS Jack Knife (DVS) NCIS Gibbs former mother-in-law. NCIS A Navy diver is murdered.NCIS Officers death links to a prostitute.ThCSI: Crime Scene InvestigationCSI: Crime Scene InvestigationCSI: Crime Scene InvestigationCSI: Crime Scene InvestigationCSI: Cr ime Scene Investigation WGN Midday News Law & Order Law & Order Blue Bloods Blue BloodsPREMIUM CHANNELSDISNVaried Programs H B OM(11:30) Prime (2005) Meryl Streep. PG-13 Fight GameThe Truth About Charlie (2002) Mark Wahlberg. PG-13(:45) Man of Steel (2013, Action) Henry Cavill, Amy Adams, Michael Shannon. PG-13 T(11:00) Beautiful Creatures (2013)(:15) My Big Fat Greek Wedding (2002) Nia Vardalos. PG Enders Game (2013, Science Fiction) Harrison Ford. PG-13 Real Time With Bill Maher W(:15) Big Mommas House (2000, Comedy) Martin Lawrence. PG-13 (:15) Fast & Furious 6 (2013) Vin Diesel. Hobbs offers Dom and crew a full pardon for their help.Leap Year (2010) Amy Adams, Matthew Goode. PG ThFight Game2 Days: SergeyThe Man in the Iron Mask (1998, Adventure) Leonardo DiCaprio. PG-13 (:15) The 50 Year Argument (2014, Documentary) NR Last Week To.Cinderella ManF(11:15) R.I.P.D. (2013) Jeff Bridges.Beavis and Butt-head Do America (1996) PG-13 REAL Sports With Bryant Gumbel Kingdom Come (2001, Comedy) LL Cool J. PG (:15) R.I.P.D. (2013) Jeff Bridges. M A XM(:15) The Legend of Hercules (2014, Adventure) Kellan Lutz. PG-13 Rush (2013, Docudrama) Chris Hemsworth, Daniel Brhl. R (:10) This Is 40 (2012, Romance-Comedy) Paul Rudd, Leslie Mann. R T(11:15) 47 Ronin (2013) PG-13(:15) Bullet to the Head (2012, Action) Sylvester Stallone, Sung Kang. R (2:50) Commando (1985) Arnold Schwarzenegger. RGrudge Match (2013) Robert De Niro. PG-13 W(11:30) Transporter 2 (2005) Blue Streak (1999, Comedy) Martin Lawrence. PG-13 (:40) 2 Guns (2013, Action) Denzel Washington, Mark Wahlberg. R Harry Potter and the Goblet of Fire (2005) PG-13Th(11:20) The Ringer (2005) PG-13The Incredible Burt Wonderstone (2013) Steve Carell.(:45) For a Good Time, Call... (2012) Ari Graynor. R (:15) Doom (2005, Science Fiction) The Rock, Karl Urban. R FThe Worlds End(:45) The Omen (2006) Liev Schreiber. A diplomats adopted son is pure evil.(:35) The Place Beyond the Pines (2012, Crime Drama) Ryan Gosling, Bradley Cooper. R Hot Shots! (1991) Charlie Sheen. S H O WMDantes Peak (1997, Action) Pierce Brosnan, Linda Hamilton. PG-13 (1:50) Bad News Bears (2005) Billy Bob Thornton. (:45) The Longest Yard (2005, Comedy) Adam Sandler. PG-13 Lee-ButlerT(11:15) Dark Skies (2013) PG-13Election (1999, Comedy) Matthew Broderick, Reese Witherspoon. R (2:55) Dick (1999, Comedy) Kirsten Dunst. PG-13 Exorcismus (2010, Horror) Sophie Vavasseur. NR WI Am Divine (2012) The life and work of cultural icon Divine.Snow Falling on Cedars (1999) Ethan Hawke. A reporter covers a murder trial.(:45) Judge Dredd (1995, Action) Sylvester Stallone, Armand Assante. R Last Exorcism 2ThA Walk on the Moon (1999, Drama) Diane Lane, Viggo Mortensen. R The 13th Warrior (1999, Adventure) Antonio Banderas, Diane Venora. R (3:55) Dawn Rider (2012, Western) Donald Sutherland. R Double JeopardyF(11:30) Dangerous Minds (1995) R(:15) Cocaine Cowboys (2006, Documentary) Drug lords invade 1980s Miami. R Deep Impact (1998, Drama) Robert Duvall, Tea Leoni. PG-13 T M CMBreaking Upwards (2009) Daryl Wein. NR Knife Fight (2012, Drama) Rob Lowe, Julie Bowen. R (:10) Passion Play (2010) Mickey Rourke. R (:45) Mindhunters (2004, Suspense) LL Cool J. R T(11:20) The Illusionist (2006) (:10) Three Men and a Baby (1987, Comedy) Tom Selleck. PG Three Men and a Little Lady (1990) Tom Selleck. PG (:45) Nixon (1995) Anthony Hopkins. R W(11:35) The Dangerous Lives of Altar Boys (2002) R(:20) After Image (2001) John Mellencamp. R Up Close & Personal (1996, Romance) Robert Redford. PG-13 Hannah Montana/Miley CyrusTh(:10) The Million Dollar Hotel (2000, Drama) Jeremy Davies. Premiere. R (:15) Donovans Echo (2011, Drama) Bruce Greenwood. Premiere. PG-13 Mumford (1999) Loren Dean. A man poses as a psychologist in a small town.FWhat About Bob? (1991) Bill Murray. PG (:40) Mr. Destiny (1990, Fantasy) James Belushi. PG-13 Some Girl(s) (2013, Comedy-Drama) Adam Brody. NR Gucci: The Director (2013) NR 14 TV Week September 28 October 4, 2014 PAGE 15 MONDAY PRIME TIME SEP. 296:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSNewsNightly NewsEntertainmentAccess H.The Voice The Blind Auditions, Part 3 The auditions continue.The Blacklist (N) NewsTonight ShowWorld NewsBusiness Rpt.PBS NewsHour (N) Antiques Roadshow KnoxvilleAntiques Roadshow The Hispanic Heritage AwardsRebel: Voces SpecialNews at 6Business Rpt.PBS NewsHour (N) Antiques Roadshow KnoxvilleAntiques Roadshow The Hispanic Heritage AwardsWorld NewsTavis SmileyLocal 6 NewsEvening NewsLocal 6 NewsInside EditionBig Bang(:31) MomScorpion (N) (9:59) NCIS: Los AngelesNewsLettermanNewsNightly NewsNewsExtra (N) The Voice The Blind Auditions, Part 3 The auditions continue.The Blacklist (N) NewsTonight ShowNewsWorld NewsJeopardy! (N)Wheel FortuneDancing With the Stars (N) (Live) (:01) Castle Driven Eyewit. NewsJimmy Kimmel10 News, 6pmEvening NewsWheel FortuneJeopardy! (N) Big Bang(:31) MomScorpion (N) (9:59) NCIS: Los Angeles10 NewsLettermanNewsNewsTMZ (N) The Insider (N)Gotham Selina Kyle (N) Sleepy Hollow The Kindred FOX13 10:00 News (N) NewsAccess H.Sesame Street (DVS) Cat in the HatPeg Plus CatSteves EuropeRudy MaxaTravelscopeIn the AmericaGlobe Trekker (DVS) Tavis SmileyCharlie RoseMike & MollyMike & MollyTwo/Half MenTwo/Half MeniHeartradio Music Festival Night 1 (N) News on CW18How I MetHow I MetEngagementTV20 NewsWorld NewsEntertainmentAsk AmericaDancing With the Stars (N) (Live) (:01) Castle Driven KnoxvilleRoyal Paintbox (2013)The Hispanic Heritage AwardsCharlie Rose (N) The MiddleThe MiddleFamily FeudFamily FeudSteve Harvey Law & Order: SVU NewsNews 10:30pmThisMinuteCougar TownNewsWorld NewsThe List (N) ThisMinuteDancing With the Stars (N) (Live) (:01) Castle Driven NewsJimmy KimmelModern FamilyModern FamilyBig BangBig BangLaw & Order: SVU Law & Order: SVU AngerAngerThe OfficeThe OfficeFOX 35 News TMZ (N) Modern FamilyModern FamilyGotham Selina Kyle (N) Sleepy Hollow The Kindred FOX 35 News at 10 (N) NewsTMZ rName GameFamily FeudFamily FeudEntertainmentLaw & Order: SVU Law & Order: SVU Cops Rel.Cops Rel.Hot, ClevelandCougar TownfVarietyThe 700 Club Turning PointLove a ChildGive Me the Bible JentezenStudio Direct Hour-HealingJoseph PrinceKingKingMike & MollyMike & MollyiHeartradio Music Festival Night 1 (N) Two/Half MenTwo/Half MenFriends Friends nTMZ (N) The SimpsonsBig BangBig BangGotham Selina Kyle (N) Sleepy Hollow The Kindred FOX 35 News at 10 (N) TMZ (N) Access H.tLeft Behind II: TribulationSam RodriguezPotters TouchTrinity FamilySecretsKingdom Conn.J. DuplantisbbbLoves Long Journey (2005) Erin Cottrell.Best of PraiseCriminal Minds Criminal Minds Compulsion Criminal Minds Criminal Minds Plain Sight Blue Bloods Pilot Blue Bloods Samaritan The SimpsonsThe SimpsonsBig BangBig BangLaw & Order: SVU Law & Order: SVU Family GuyFamily GuyThe OfficeThe OfficeCABLE CHANNELSA&EStorage WarsStorage WarsStorage WarsStorage WarsDuck DynastyDuck DynastyWahlburgersWahlburgersLove Prison (N) (:02) Love Prison AMCThe Shawshank RedemptionbbbJurassic Park (1993) Sam Neill. Cloned dinosaurs run amok at an island-jungle theme park.bbThe Lost World: Jurassic Park (1997) Jeff Goldblum. (V)ANPLTo Be Announced To Be Announced Gator Boys Rattlesnake Republic: TexasNorth Woods Law: On the HuntGator BoysBETThe Real (N) bWild Wild West (1999, Action) Will Smith, Kevin Kline, Kenneth Branagh. bbMalibus Most Wanted (2003, Comedy) Jamie Kennedy, Taye Diggs. (V)BRAVOHousewives/NJ Housewives/NJ Housewives/NJ Housewives/NJ Housewives/NJWhat HappensHousewivesCNBCMad Money (N) To Be Announced The Profit The Profit Restaurant StartupTo Be AnnouncedCNNSituation RoomCrossfire (N) Erin Burnett OutFront (N) Anderson Cooper 360 (N) The Hunt With John WalshCNN Tonight Anderson Cooper 360 COMColbert ReportDaily ShowSouth Park(:29) Tosh.0FuturamaFuturamaSouth ParkSouth ParkSouth ParkSouth ParkDaily ShowColbert ReportDSCFast N Loud Fast N Loud Street Outlaws Street Outlaws Highway to Sell (N) Street Outlaws E!Total Divas Divas UnchainedE! News (N) Live from E!bbbThe Devil Wears Prada (2006, Comedy) Meryl Streep, Anne Hathaway. (V)E! News (N)ESPNMonday Night Countdown (N) (Live) (:15) NFL Football New England Patriots at Kansas City Chiefs. (N Subject to Blackout) (Live) SportsCenterESPN2SportsCenter (N) (Live) Baseball Tonight (N) World of X Games (N) 2014 World Series of Poker2014 World Series of Poker(:15) College Football FinalFAMBoy Meets...Boy Meets...bbDirty Dancing: Havana Nights (2004, Romance) Diego Luna.bbbMean Girls (2004) Lindsay Lohan, Rachel McAdams. (V)The 700 Club FNCSpecial Report With Bret BaierOn Record, Greta Van SusterenThe OReilly Factor (N) The Kelly File (N) Hannity (N) The OReilly Factor FOODDiners, DriveDiners, DriveGuys Grocery GamesRewrapped (N)RewrappedDiners, DriveDiners, DriveDiners, DriveDiners, DriveDiners, DriveDiners, DriveFX(5:00) bbSnow White and the Huntsman (2012, Fantasy) (V)bbAmerican Reunion (2012, Comedy) Jason Biggs, Alyson Hannigan. (V)bbAmerican Reunion (2012) Jason Biggs. (V)GOLFGolf Central (N) (Live) The Golf Fix (N) LearningQuest-CardbbThe Greatest Game Ever Played (2005) Shia LaBeouf, Stephen Dillane. (V)Golf CentralHALLThe Waltons The Odyssey The Waltons The Separation The Waltons The Theft The MiddleThe MiddleThe MiddleThe MiddleGolden GirlsGolden GirlsHGTVLove It or List It, Too Love It or List It Love It or List It Love It or List It (N) House HuntersHunters IntlLove It or List It HISTModern Marvels Pawn StarsPawn StarsPawn StarsPawn StarsPawn StarsPawn StarsCounting CarsCounting CarsCounting CarsCounting CarsLIFEHoarders Hoarders bbHocus Pocus (1993, Comedy) Bette Midler. (V)bbHocus Pocus (1993, Comedy) Bette Midler. (V)MTVRidiculousnessRidiculousnessRidiculousnessRidiculousnessAre You the One? Are You the One? Are You the One? Are You the One?NBCSN(5:30) Pro Football Talk (N) NASCAR America (N) The Grid (N) (Live)Men in BlazersPremier League ReviewPremier DownNICKiCarlyiCarlyHenry DangerNicky, RickyFull HouseFull HouseFull HouseFull HouseFresh PrinceFresh PrinceHow I MetHow I MetSPIKECops Cops Cops Cops Cops Cops Cops Cops Cops Cops Cops Cops SUNSport FishingP1 PowerboatSport FishingShip Shape TVSportsmanReel TimeFishing FlatsAddict. FishingInto the BlueSaltwater Exp.Jimbo Fisher Show (N)SYFY(5:00) bbVacancy (2007) (V)bbThe Crazies (2010) Timothy Olyphant, Radha Mitchell. bbResident Evil: Extinction (2007, Horror) Milla Jovovich. bbJeepers Creepers 2 TBSSeinfeld Seinfeld Seinfeld Seinfeld Family GuyFamily GuyBig BangBig BangBig BangBig BangConan (N) TCM(5:45) bPhantom Killer (1942)bMystery of the 13th GuestbbbDodge City (1939) Errol Flynn, Olivia de Havilland. bbbbGone With the Wind (1939) Clark Gable. (V)TLCSay Yes, DressSay Yes, DressLittle People, Big World Little People, Big World Little People, Big World Little People, Big World Little People, Big World TNTCastle A Dance With Death Castle Valkyrie Castle Dreamworld (:01) Castle Need to Know(:02) Major Crimes Flight Risk(:03) Law & Order Bible StoryTOONTeen TitansSteven Univ.Wrld, GumballUncle GrandpaKing of the HillKing of the HillClevelandClevelandAmerican DadRick and MortyFamily GuyFamily GuyTRAVBizarre Foods/ZimmernMan v. FoodMan v. FoodBizarre Foods America Bizarre Foods America Bizarre Foods America Bizarre Foods America TVLBev. HillbilliesBev. HillbilliesBev. HillbilliesBev. HillbilliesFamily FeudFamily FeudFamily FeudThe Soul ManThe ExesHot, ClevelandFriends Pilot Friends USANCIS Devils Triangle NCIS Housekeeping WWE Monday Night RAW (N) (Live) ChrisleyNCIS: LAVH1Love & Hip Hop: HollywoodLove & Hip Hop: HollywoodLove & Hip Hop: Hollywood (N)T.I. and TinyAtlanta Exes (N) Love & Hip Hop: HollywoodT.I. and TinyWGN-AAmer. Funniest Home VideosAmer. Funniest Home VideosAmer. Funniest Home VideosAmer. Funniest Home VideosAmer. Funniest Home VideosParks/RecreatParks/RecreatPREMIUM CHANNELSDISNGirl MeetsAustin & AllyDog With BlogLiv & MaddieJudy Moody and the NOT Bummer Summer (V)(:40) JessieAustin & AllyGood-CharlieDog With BlogGirl MeetsHBOLast Week To.(:45) bbbPacific Rim (2013, Science Fiction) Charlie Hunnam. PG-13 (V)bbbThe 50 Year Argument (2014) NR (:45) Boardwalk Empire Fight GameMAXbbThis Is 40(:25) bbbEnough Said (2013) PG-13 The Knick(:45) bbFast & Furious 6 (2013, Action) Vin Diesel, Paul Walker. PG-13 The KnickWe the MillersSHOW(5:45) bbbLee Daniels The Butler (2013) Forest Whitaker. (V)Ray Donovan The Captain Masters of Sex Ray Donovan The Captain Masters of SexTMCMindhuntersbScary Movie V (2013) Ashley Tisdale. PG-13bbbManhunter (1986, Suspense) William L. Petersen. R (:05) bbbKilling Them Softly (2012) Brad Pitt.Aint-Bodies 9 p.m. on (13) (35) (51)Sleepy HollowBenjamin Franklin (guest star Timothy Busfield) is drawn into Ichabod and Abbies (Tom Mison, Nicole Beharie) plan to save Katrina (Katia Winter) from the Headless Horseman in the new episode The Kindred. The scheme involves a being not unlike the Dr. Frankenstein-created synthetic man, this one created by Franklin. Jenny (Lyndie Greenwood) and the new local sheriff get off on the wrong foot with each other. Orlando Jones and John Noble also star.9:59 p.m. on (6) (10)NCIS: Los AngelesCallen and Sam (Chris ODonnell, LL Cool J) are up to their necks in danger quite literally as the drama series moves to its new night to start its sixth year with Deep Trouble, Part II. MONDAYS BEST BETS Katia Winter September 28 October 4, 2014 TV Week 15 1 x 4 ad advantage chrysler jeep PAGE 16 September 28 October 4, 2014 SUDOKU ANSWERS ARE ON PAGE 28.005196 I chose Lakeview Te rr ace for the Li fe Ca re if I needed it. I lo ve the lifestyle, the countr y setting, the activities and amenities. r ff n t b f Gi ve Yo urself an Aor dable Li fe Ca re In sur ance Po licy! L b Fr eedom Se curity b Pe ace of Mi nd b b b 1-800-343-1588 Choose Yo ur Br and Ne w Vi lla! n www .LakeviewT errace.com Gi ve Y ourself an Aor dable Li fe C ar e I nsur ance P olicy! WILD WOOD CYCLER Y rfrnf rt Bikes for Ever y Te rain & Budget PAGE 17 AUTO RACINGAAA Insurance Midwest Nationals, Qualifying.(ESPN2) Sun. 3 pm AAA Insurance Midwest Nationals. (Same-day Tape) (ESPN2) Sun. 4 pm Global RallyCross Series: Seattle. (Taped) (2) Sun. 4:30 pm (8) Sun. 4:30 pm Lucas Oil Series. (Taped) (ESPN2) Sun. 10:30 pm Sprint Cup: AAA 400. (Sameday Tape) (ESPN2) Mon. 1 am NASCAR AMERICA (Live) (NBCSN) Wed. 5 pm NASCAR AMERICA (Live) (NBCSN) Thu. 5 pm Japanese Grand Prix, Practice. (Live) (NBCSN) Thu. 9 pm Japanese Grand Prix, Practice. (Live) (NBCSN) Fri. 1 am Nationwide Series: Kansas Lottery 300, Practice. (Live) (ESPN2) Fri. 4 pm Sprint Cup: Hollywood Casino 400, Qualifying. (Live) (ESPN2) Fri. 5:30 pm Japanese Grand Prix, Qualifying. (Live) (NBCSN) Sat. 1 am Japanese Grand Prix, Qualifying.(NBCSN) Sat. 12:30 pm F1 EXTRA (Live) (NBCSN) Sun. 1:30 am Japanese Grand Prix. (Live) (NBCSN) Sun. 2 am Nationals, Qualifying. (Sameday Tape) (ESPN2) Sun. 3:30 am SPORTS THIS WEEK F1 EXTRA (Live) (NBCSN) Sun. 4:30 am BASEBALLMLB Baseball (Live) (TBS) Sun. 1 pm LEAD-OFF MAN (Live) (WGNA) Sun. 1:30 pm Chicago Cubs at Milwaukee Brewers. (Live) (WGN-A) Sun. 2 pm 10TH INNING (Live) (WGN-A) Sun. 5:15 pm MLB Baseball (Live) (TBS) Tue. 8 pm National League Wild Card: Teams TBA. (Same-day Tape) (ESPN2) Thu. 3 am MLB Baseball (Live) (TBS) Thu. 6 pm MLB Baseball (Live) (TBS) Thu. 9:30 pm BASEBALL TONIGHT (Live) (ESPN2) Fri. 1:30 am MLB Baseball (Live) (TBS) Fri. 6 pm MLB Baseball (Live) (TBS) Fri. 9:30 pm BOXINGHassan NDam vs. Curtis Stevens. (Live) (ESPN2) Wed. 9 pm Slo Boxeo (43) Sun. 12:00 am FOOTBALLCOLINS FOOTBALL SHOW (Live) (ESPN2) Sun. 9 am FANTASY FOOTBALL NOW (Live) (ESPN2) Sun. 11 am THE NFL TODAY (Live) (6) Sun. 12:00 pm (10) Sun. 12:00 pm FOX NFL SUNDAY (Live) (13) Sun. 12:00 pm (35) Sun. 12:00 pm (51) Sun. 12:00 pm Tampa Bay Buccaneers at Pittsburgh Steelers. (Live) (13) Sun. 1 pm (35) Sun. 1 pm (51) Sun. 1 pm Jacksonville Jaguars at San Diego Chargers. (Live) (6) Sun. 4 pm (10) Sun. 4 pm Philadelphia Eagles at San Francisco 49ers. (Live) (13) Sun. 4:25 pm (35) Sun. 4:25 pm (51) Sun. 4:25 pm FOOTBALL NIGHT IN AMERICA (Live) (2) Sun. 7 pm (8) Sun. 7 pm THE OT (Live) (13) Sun. 7:30 pm (35) Sun. 7:30 pm (51) Sun. 7:30 pm New Orleans Saints at Dallas Cowboys. (Live) (2) Sun. 8:20 pm (8) Sun. 8:20 pm Teams TB A. (ESPN2) Mon. 4 am COLLEGE FOOTBALL LIVE (Live) (ESPN2) Mon. 2:30 pm PRO FOOTBALL TALK (Live) (NBCSN) Mon. 5:30 pm Teams TB A. (ESPN2) Tue. 4 am PRO FOOTBALL TALK (Live) (NBCSN) Tue. 5:30 pm FANTASY FOOTBALL LIVE (Live) (NBCSN) Tue. 6:30 pm PRO FOOTBALL TALK (Live) (NBCSN) Wed. 5:30 pm FANTASY FOOTBALL LIVE (Live) (NBCSN) Wed. 6:30 pm PRO FOOTBALL TALK (Live) (NBCSN) Thu. 5:30 pm FANTASY FOOTBALL LIVE (Live) (NBCSN) Thu. 6:30 pm NFL THURSDAY NIGHT KICKOFF (Live) (6) Thu. 7:30 pm (10) Thu. 7:30 pm NFL THURSDAY NIGHT KICKOFF (Live) (6) Thu. 8 pm (10) Thu. 8 pm Minnesota Vikings at Green Bay Packers. (Live) (6) Thu. 8:25 pm (10) Thu. 8:25 pm PRO FOOTBALL TALK (Live) (NBCSN) Fri. 5:30 pm Norcross (Ga.) at North Gwinnett (Ga.). (Live) (ESPN2) Fri. 7 pm Calgary Stampeders at Saskatchewan Roughriders. (Live) (ESPN2) Fri. 10 pm Teams TBA. (Live) (20) Sat. 12:00 pm (28) Sat. 12:00 pm Southern Mississippi at Middle Tennessee State. (Live) (38) Sat. 12:00 pm Teams TBA. (Live) (ESPN2) Sat. 12:00 pm ACC Game of the Week: Teams TBA. (Live) (44) Sat. 12:30 pm NOTRE DAME FOOTBALL PREGAME (Live) (2) Sat. 3 pm COLLEGE FOOTBALL TODAY (Live) (6) Sat. 3 pm NOTRE DAME FOOTBALL PREGAME (Live) (8) Sat. 3 pm COLLEGE FOOTBALL TODAY (Live) (10) Sat. 3 pm FOX COLLEGE FOOTBALL PREGAME (Live) (13) Sat. 3 pm COLLEGE FOOTBALL COUNTDOWN (Live) (20) Sat. 3 pm (28) Sat. 3 pm FOX COLLEGE FOOTBALL PREGAME (Live) (35) Sat. 3 pm (51) Sat. 3 pm COLLEGE FOOTBALL SCOREBOARD (Live) (ESPN2) Sat. 3 pm Stanford at Notre Dame. (Live) (2) Sat. 3:30 pm (8) Sat. 3:30 pm Teams TBA. (Live) (6) Sat. 3:30 pm (10) Sat. 3:30 pm (13) Sat. 3:30 pm (20) Sat. 3:30 pm (28) Sat. 3:30 pm (35) Sat. 3:30 pm (51) Sat. 3:30 pm (ESPN2) Sat. 3:30 pm New Mexico at Texas-San Antonio. (Live) (38) Sat. 3:30 pm COLLEGE FOOTBALL POSTGAME (Live) (20) Sat. 6:30 pm (28) Sat. 6:30 pm COLLEGE FOOTBALL SCOREBOARD (Live) (ESPN2) Sat. 6:30 pm FOX COLLEGE FOOTBALL EXTRA (Live) (13) Sat. 7 pm Hawaii at Rice. (Live) (18) Sat. 7 pm FOX COLLEGE FOOTBALL EXTRA (Live) (35) Sat. 7 pm (51) Sat. 7 pm COLLEGE FOOTBALL SCOREBOARD (Live) (ESPN2) Sat. 7 pm Teams TBA. (Live) (13) Sat. 7:30 pm (35) Sat. 7:30 pm Teams TBA. (Live) (51) Sat. 7:30 pm Teams TBA. (Live) (20) Sat. 8 pm (28) Sat. 8 pm (ESPN2) Sat. 8 pm COLLEGE FOOTBALL FINAL (Live) (ESPN2) Sun. 1:30 am 5 x 4 ad orida heart & vascular September 28 October 4, 2014 TV Week 17 PAGE 18 TUESDAY PRIME TIME SEP. 306:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSNewsNightly NewsEntertainmentAccess H.The Voice The Blind Auditions, Part 4 The auditions continue.Chicago Fire Wow Me (N) NewsTonight ShowWorld NewsBusiness Rpt.PBS NewsHour (N) Finding Your RootsMakers Women in Comedy Frontline American casinos in Macau. (N) Latino AmerNews at 6Business Rpt.PBS NewsHour (N) Finding Your RootsMakers Women in Comedy Frontline American casinos in Macau. (N) Tavis SmileyLocal 6 NewsEvening NewsLocal 6 NewsInside EditionNCIS A lieutenant is murdered.NCIS: New Orleans (N) (:01) Person of Interest (N) NewsLettermanNewsNightly NewsNewsExtra (N) The Voice The Blind Auditions, Part 4 The auditions continue.Chicago Fire Wow Me (N) NewsTonight ShowNewsWorld NewsJeopardy! (N)Wheel FortuneSelfie PilotManhattan LovMarvels Agents of S.H.I.E.L.D.Forever (N) Eyewit. NewsJimmy Kimmel10 News, 6pmEvening NewsWheel FortuneJeopardy! (N)NCIS A lieutenant is murdered.NCIS: New Orleans (N) (:01) Person of Interest (N) 10 NewsLettermanNewsNewsTMZ (N) The Insider (N)Utopia (N) New Girl (N) Mindy ProjectFOX13 10:00 News (N) NewsAccess H.Sesame Street (DVS) Cat in the HatPeg Plus CatFather Brown Doc Martin Nowt So Queer Scott & Bailey Tavis SmileyCharlie RoseMike & MollyMike & MollyTwo/Half MenTwo/Half MeniHeartradio Music Festival Night 2 (N) News on CW18How I MetHow I MetEngagementTV20 NewsWorld NewsEntertainmentAsk AmericaSelfie PilotManhattan LovMarvels Agents of S.H.I.E.L.D.Forever ) Finding Your RootsMakers Women in Comedy Frontline American casinos in Macau. (N) Metro CenterThe MiddleThe MiddleFamily FeudFamily FeudSteve Harvey Law & Order: SVU NewsNews 10:30pmThisMinuteCougar TownNewsWorld NewsThe List (N) ThisMinuteSelfie PilotManhattan LovMarvels Agents of S.H.I.E.L.D.Forever (N) NewsJimmy KimmelModern FamilyModern FamilyBig BangBig BangLaw & Order: SVU Law & Order: SVU AngerAngerThe OfficeThe OfficeFOX 35 News TMZ (N) Modern FamilyModern FamilyUtopia (N) New Girl (N) Mindy ProjectFOX 35 News at 10 (N) NewsTMZ rName GameFamily FeudFamily FeudEntertainmentLaw & Order: Criminal IntentLaw & Order: Criminal IntentCops Rel.Cops Rel.Hot, ClevelandCougar TownfVarietyThe 700 Club (N) Pastor BabersVarietyPerry StoneVarietyVarietyStudio Direct Hour-HealingJoseph PrinceKingKingMike & MollyMike & MollyiHeartradio Music Festival Night 2 (N) Two/Half MenTwo/Half MenFriends Friends nTMZ (N) The SimpsonsBig BangBig BangUtopia (N) New Girl (N) Mindy ProjectFOX 35 News at 10 (N) TMZ (N) Access H.tLoves LongBest of PraiseSupernaturalPotters TouchTrinity FamilyJoyce MeyerJoseph PrinceSteven FurtickPraise the Lord (N) (Live) bCriminal Minds Derailed Criminal Minds Cults. Criminal Minds Blood HungryCriminal Minds Criminal Minds Poison The Listener The Wrong ManThe SimpsonsThe SimpsonsBig BangBig BangLaw & Order: Criminal IntentLaw & Order: Criminal IntentFamily GuyFamily GuyThe OfficeThe OfficeCABLE CHANNELSA&EStorage WarsStorage WarsBrandi-JarrodBrandi-JarrodStorage WarsStorage WarsStorage WarsStorage WarsBrandi-JarrodStorage WarsStor age WarsStorage WarsAMC(5:00) The Lost World: Jurassic Park (1997) Jeff Goldblum.Jurassic Park III (2001) Sam Neill, William H. Macy. (V) 4th and Loud (N) 4th and LoudANPLTo Be Announced Wild Russia Wild Russia Wild Russia Wild Russia Wild Russia BETThe Real (N) Barbershop (2002, Comedy) Ice Cube, Anthony Anderson. (V) ComicViewComicView (N) ComicView (N)ComicViewComicViewBRAVOBelow Deck Below Deck Below Deck Below Deck (N) The Singles Project (iTV) (N)What HappensBelow DeckCNBCMad Money (N) Restaurant StartupShark Tank Shark Tank Secret LivesSecret LivesShark Tank CNNSituation RoomCrossfire (N) Erin Burnett OutFront (N) Anderson Cooper 360 (N) CNN Special ReportCNN Tonight (N) (Live) Anderson Cooper 360 COMColbert ReportDaily ShowSouth Park(:29) Tosh.0ChappellesTosh.0 Tosh.0 Tosh.0 Tosh.0 (N) BrickleberryDaily ShowColbert ReportDSCYukon Men Day of ReckoningYukon Men The Longest DayYukon Men: Revealed (N) Yukon Men (N) Ice Lake Rebels: Deep FreezeYukon Men E!(4:30) The Devil Wears PradaE! News (N) Live from E!Live from E!Kardashian Kardashian E! News (N)ESPNSportsCenter (N) (Live) E:60 (N) SEC Storied (N) SportsCenter (N) (Live) ESPN2Around/HornInterruptionBaseball Tonight (N) NFL Live (N) NFLs Greatest Games (N) NFLs Greatest Games (N)FAMBoy Meets...Mean Girls (2004) Lindsay Lohan, Rachel McAdams. (V)New Years Eve (2011, Romance-Comedy) Halle Berry, Jessica Biel. (V) The 700 Club FNCSpecial Report With Bret BaierOn Record, Greta Van SusterenThe OReilly Factor (N) The Kelly File (N) Hannity (N) The OReilly Factor FOODChopped Step Right Up! Chopped Yuzu Never Know Chopped A Guts Reaction Chopped Pizza PerfectChopped Short Order CooksChoppedFXMike & MollyMike & MollyMike & MollyImmortals (2011, Adventure) Henry Cavill, Stephen Dorff, Isabel Lucas. (V)Sons of Anarchy (N) (:15) Sons of AnarchyGOLFGolf CentralLearningPlaying Lessons From the ProsGolf Big Break Invitational, Day 1 Modified Stableford. Golf CentralGolf CentralHALLThe Waltons The Waltons The Prize The Waltons The Braggart The MiddleThe MiddleThe MiddleThe MiddleGolden GirlsGolden GirlsHGTVHouse Hunters RenovationFlip or FlopFlip or FlopFlip or FlopFlip or FlopJennie GarthJennie GarthHouse HuntersHunters IntlFlip or FlopFlip or FlopHISTPawn StarsPawn StarsPawn StarsPawn StarsPawn StarsPawn StarsTop Gear What Can It TakeCounting CarsCounting CarsCounting CarsCounting CarsLIFEKim of Queens Dance Moms Abbys Studio RescueDance Moms (N) Kim of Queens (N) (:01) Kim of Queens MTVTrue Life Girl CodeGirl CodeGirl CodeGirl CodeFaking ItAwkward.Awkward. (N) Faking It (N)Happyland (N)Awkward.NBCSNPro Ftb TalkFantasy FtbTriathlon (Taped) Triathlon Kona Triathlon Preview (N) Triathlon Spartan RaceNICKiCarly iCarly Sam & CatThundermansFull HouseFull HouseFull HouseFull HouseFresh PrinceFresh PrinceHow I MetHow I MetSPIKEInk Master Ink Master Pin up Pittfalls Ink Master Ink Master Ink Master Glass on Blast (N)Tattoo; MiamiTattoo; MiamiSUNCllege FootballSport FishingSport FishingShip Shape TVSportsmanReel TimeFishing FlatsAddict. FishingRunning SportsMoneyNew College Football ShowSYFYFace Off Killer Instinct Face Off Serpent Soldiers Face Off Scared Silly Face Off Teachers Pets (N) Z Nation Philly Feast Face Off Teachers PetsTBSSeinfeld Seinfeld Seinfeld MLB on DeckMLB Baseball (N) (Live) Inside MLBTCMMarriage on the Rocks (1965) Frank Sinatra. (V)The Young Lions (1958, Drama) Marlon Brando, Montgomery Clift, Dean Martin. (V)The Way We Were TLCLittle People, Big World 19 Kids-Count19 Kids-Count19 Kids and Counting 19 Kids-Count19 Kids-CountLittle People, Big World (N)19 Kids-Count19 Kids-CountTNTCastle Headhunters Castle Undead Again Rizzoli & Isles (:01) Rizzoli & Isles (:02) Rizzoli & Isles (:03) CSI: NY Do Not Pass GoTOONBizarre Foods America Hotel Impossible Rat Race Hotel Impossible Man v. Food B.Man v. Food BUModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyVH1T.I. and TinyT.I. and TinyAtlanta Exes Love & Hip Hop: HollywoodLove & Hip Hop: HollywoodMadeas Family Reunion (2006, Comedy) Tyler Perry. (V)WGN-AAmer. Funniest Home VideosAmer. Funniest Home VideosE.T. the Extra-Terrestrial (1982, Science Fiction) Henry Thomas, Dee Wallace. (V) Manhattan The UnderstudyPREMIUM CHANNELSDISN(:05) JessieJessie Dog With BlogLiv & MaddieElla Enchanted (2004) Anne Hathaway. (V)Mickey MouseAustin & AllyGood-CharlieJessie Dog With BlogHBOThe Secret Life of Walter Mitty (2013) Ben Stiller. PG On the Run Tour: Beyonc and Jay Z The couple perform in Paris, France. (:45) Bill Maher: Live From D.C.2 Days: SergeyMAXGrudge MatchVehicle 19 (2013) Paul Walker. R (V)47 Ronin (2013, Adventure) Keanu Reeves. PG-13 (V)The Knick(:45) Taken 2 (2012) Liam Neeson. NR (V)SHOW(:15) Dark Skies (2013) Keri Russell. PG-13 (V) Masters of Sex Inside the NFL (N) Ray Donovan The Captain Inside the NFL TMC(4:45) Nixon (1995, Biography) Anthony Hopkins. R The Illusionist (2006) Edward Norton. PG-13 (V)Deep Impact (1998, Drama) Robert Duvall. PG-13 (V) 8 p.m. on (6) (10)NCISWas a Navy lieutenants murder one of several muggings plaguing Washington, D.C., or was it committed to keep him from making it to a private meeting he had scheduled with the occupant of the Oval Office? Thats what Gibbs (Mark Harmon) and the team have to determine in the new episode Kill the Messenger. NFL veteran turned football analyst Tony Gonzalez guest stars as an NCIS agent. Michael Weatherly, Pauley Perrette and David McCallum also star.8 p.m. on (20) (28)SelfiePygmalion and My Fair Lady comes into the modern age in a big way with this new sitcom from Suburgatory creator-producer Emily Kapnek. The Pilot presents Doctor Who alum Karen Gillan as an avid tweeter named Eliza, no less who realizes having lots of friends in cyberspace isnt the same as having actual flesh-and-blood pals. John Cho also stars as this versions Henry, a marketer who tries to help her readjust to the real world.9 p.m. on (3) (5) (24)MakersThe documentary franchise continues with several new programs on women who have made marks in various areas, beginning with Women in Comedy. The episode includes one of the last on-camera interviews given by Joan Rivers, for whom the word trailblazer was used frequently by those reminiscing about her upon her passing. Ellen DeGeneres, Kathy Griffin, Sarah Silverman, Jane Lynch and Chelsea Handler also talk about challenges theyve faced. TUESDAYS BEST BETS John Cho 18 TV Week September 28 October 4, 2014 PAGE 19 WEDNESDAY PRIME TIME OCT. 16:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSNewsNightly NewsEntertainmentAccess H.The Mysteries of Laura (N) Law & Order: SVU Chicago PD (N) (DVS) NewsTonight ShowWorld NewsBusiness Rpt.PBS NewsHour (N) Penguins: Spy in the HuddleNOVA Rise of the Black Pharaohs (N)Latino AmericansNews at 6Business Rpt.PBS NewsHour (N) Penguins: Spy in the HuddleNOVA Rise of the Black Pharaohs (N)BBC NewsTavis SmileyLocal 6 NewsEvening NewsLocal 6 NewsInside EditionSurvivor (N) Criminal Minds X Stalker Pilot NewsLettermanNewsNightly NewsNewsExtra (N) The Mysteries of Laura (N) Law & Order: SVU Chicago PD (N) (DVS) NewsTonight ShowNewsWorld NewsJeopardy! (N)Wheel FortuneThe Middle (N)The GoldbergsModern Family(:31) black-ishNashville (N) Eyewit. NewsJimmy Kimmel10 News, 6pmEvening NewsWheel FortuneJeopardy! (N) Survivor (N) Criminal Minds X Stalker Pilot 10 NewsLettermanNewsNewsTMZ (N) The Insider (N)Hells Kitchen (N) (PA) Red Band Society (N) FOX13 10:00 News (N) NewsAccess H.Sesame Street (DVS) Cat in the HatPeg Plus CatPilgrimage with Simon ReeveOld HouseHometimeDCI Banks The murder of a paralyzed woman.Charlie RoseMike & MollyMike & MollyTwo/Half MenTwo/Half MenArrow The Scientist Arrow Three Ghosts News on CW18How I MetHow I MetEngagementTV20 NewsWorld NewsEntertainmentAsk AmericaThe Middle (N)The GoldbergsModern Family(:31) black-ishNashville (N) News at 11Jimmy KimmelChrist. FitnessTodayJack Van ImpeGreat Awakening BridgesPlace/MiraclesA. WommackSid Roth Its RobisonLove of GodGreat AwakenMartha SpeaksWorld NewsPBS NewsHour (N) Penguins: Spy in the HuddleNOVA (DVS)Rise of the Black Pharaohs (N)Charlie Rose (N) The MiddleThe MiddleFamily FeudFamily FeudSteve Harvey Law & Order: SVU NewsNews 10:30pmThisMinuteCougar TownNewsWorld NewsThe List (N) ThisMinuteThe Middle (N)The GoldbergsModern Family(:31) black-ishNashville (N) NewsJimmy KimmelModern FamilyModern FamilyBig BangBig BangLaw & Order: SVU Law & Order: SVU AngerAngerThe OfficeThe OfficeFOX 35 News TMZ (N) Modern FamilyModern FamilyHells Kitchen (N) (PA) Red Band Society (N) FOX 35 News at 10 (N) NewsTMZ rName GameFamily FeudFamily FeudEntertainmentThe Walking Dead The Walking Dead Guts Cops Rel.Cops Rel.Hot, ClevelandCougar TownfVarietyThe 700 Club (N) IsraelLove a ChildKeith MooreEndtime Min.Jewish VoiceStudio Direct Hour-HealingJoseph PrinceKingKingMike & MollyMike & MollyArrow The Scientist Arrow Three Ghosts Two/Half MenTwo/Half MenFriends Friends nTMZ (N) The SimpsonsBig BangBig BangHells Kitchen (N) (PA) Red Band Society (N) FOX 35 News at 10 (N) TMZ (N) Access H.tThe Rapture: BeginningBilly Graham Classic CrusadesTrinity FamilyTurning PointJoseph PrinceLiving By FaithPraise the Lord (N) (Live) bCold Case Sabotage Cold Case Spiders Cold Case Andy in C Minor Cold Case The Road Cold Case Bad Reputation Cold Case Slipping The SimpsonsThe SimpsonsBig BangBig BangThe Walking Dead The Walking Dead Guts Family GuyFamily GuyThe OfficeThe OfficeCABLE CHANNELSA&EStorage WarsStorage WarsDuck DynastyDuck DynastyDuck DynastyDuck DynastyDuck-BeforeDuck-BeforeWahlburgers(:32) Epic Ink(:02) Du ck Dynasty AMC(5:00) Ghost (1990) Patrick Swayze, Demi Moore. (V)The Bucket List (2007) Jack Nicholson, Sean Hayes. (:01) The School of Rock (2003) Jack Black. (V)ANPLTo Be Announced Dirty Jobs: Down Under Dirty Jobs: Down Under Dirty Jobs: Down Under Dirty Jobs Cedar Log PeelerDirty Jobs: Down Under BETThe Real (N) Barbershop 2: Back in Business (2004, Comedy) Ice Cube. (V)The Janky Promoters (2009, Comedy) Ice Cube, Mike Epps. (V)BRAVOMillion Dollar LA Million Dollar LA Million Dollar LA Million Dollar LA Top Chef Duels (N) What HappensTop ChefCNBCMad Money (N) American Greed American Greed American Greed American Greed American GreedCNNSituation RoomCrossfire (N) Erin Burnett OutFront (N) Anderson Cooper 360 (N) Anthony Bourdain PartsCNN Tonight (N) Anderson Cooper 360 COMColbert ReportDaily ShowSouth Park(:29) Tosh.0Key & PeeleSouth ParkSouth ParkSouth ParkSouth Park (N)Key & PeeleDaily ShowColbert ReportDSCNaked and Afraid Naked and Afraid Alaska: The Last FrontierAlaska: The Last FrontierAlaska: The Last FrontierAlaska: The Last FrontierE!(4:30) The Wedding Planner (V)E! News (N) Live from E!Rich Kids ofTotal Divas Divas UnchainedThe Soup (N) The SoupE! News (N)ESPNSportsCenter (N) (Live) Baseball Tonight (N) MLB Baseball National League Wild Card: Teams TBA. (N Subject to Blackout) (Live) SportsCenter (N) (Live) ESPN2(5:30) Baseball Tonight (N) SportsCenter (N) (Live) NFL Live (N) Boxing Hassan NDam vs. Curtis Stevens. From Santa Monica, Calif. (N) (Live)FAMBoy Meets...The Last Song (2010, Drama) Miley Cyrus, Greg Kinnear, Liam Hemsworth.The Lucky One (2012, Drama) Zac Efron, Taylor Schilling.The 700 Club FNCSpecial Report With Bret BaierOn Record, Greta Van SusterenThe OReilly Factor (N) The Kelly File (N) Hannity (N) The OReilly Factor FOODDiners, DriveDiners, DriveRestaurant: ImpossibleMystery DinersMystery DinersMystery DinersMystery DinersRestaurant: ImpossibleRestaurant: ImpossibleFXMike & MollyTransformers: Dark of the Moon (2011, Science Fiction) Shia LaBeouf, Josh Duhamel, John Turturro. (V)The Bridge Jubilex The Bridge JubilexGOLFGolf CentralEuropean TourSchool of Golf (N) Golf Big Break Invitational, Day 2 Modified Stableford. LPGA Tour GolfHALLThe Waltons (Part 1 of 2) The Waltons (Part 2 of 2) The Waltons The Substitute The MiddleThe MiddleThe MiddleThe MiddleGolden GirlsGolden GirlsHGTVBuying and Selling Buying and Selling Buying and Selling Buying and Selling (N) House HuntersHunters IntlProperty Brothers HISTTo Be Announced American Pickers American Pickers American Pickers American Pickers LIFECelebrity Wife Swap Bring It! Bring It! (N) Girlfriend Intervention (N) (:01) Kim of Queens MTVTeen Mom 2 Teen Mom 2 Teen Mom 2 Teen Mom 2 Teen Mom 2 Girl CodeGirl CodeNBCSNPro Ftb TalkFantasy FtbSpartan Race National Pro Grid League First Semifinal. (Taped) NFL Turning Point (N) NFL Turning PointNICKiCarly iCarly Sam & CatThundermansFull HouseFull HouseFull HouseFull HouseFresh PrinceFresh PrinceHow I MetHow I MetSPIKECops Cops Cops CopsCops Cops iMPACT Wrestling (N) Ink Master Glass on BlastSUNPowerboatingPleasure BoatSport FishingShip Shape TVSportsmanReel TimeFishing FlatsSport FishingACC Gridiron Live (N) (Live) Special how to Do floridaSYFYDead SeasonHalloween II (2009, Horror) Malcolm McDowell, Tyler Mane. (V)Freddy vs. Jason (2003, Horror) Robert Englund. (V) Battledogs (2013, Horror) TBSSeinfeld Seinfeld Seinfeld Seinfeld Big BangBig BangBig BangBig BangBig BangBig BangConan (N) TCMMore Than a Miracle (1967, Fantasy) Sophia Loren. The Romance of Rosy Ridge (1947) Van Johnson. If Winter Comes (1948) Walter Pidgeon, Deborah Kerr. TLCExtreme CouExtreme CouOutrageousOutrageousExtreme Cheapskates Extreme Chea.Extreme Chea.OutrageousOutrageousExtreme Chea.Extreme Chea.TNT(4:00) I, RobotThe Book of Eli (2010) Denzel Washington, Gary Oldman. (DVS) (V) Legends Iconoclast (N) (:01) Franklin & Bash (N) (:02) Legends IconoclastTOONHalloween Crazy Halloween Crazier Halloweens Most ExtremeMan v. Food B.Man v. Food B.TVLBev. HillbilliesBev. HillbilliesBev. HillbilliesBev. HillbilliesFamily FeudFamily FeudFamily FeudThe Soul ManThe ExesHot, ClevelandFriends Friends USANCIS Moonlighting NCIS Obsession NCIS (DVS) NCIS Once a Crook NCIS Better Angels NCIS Ex-File (DVS)VH1100 Greatest Songs of the s100 Greatest Songs of the sCouples TherapyCouples Therapy Called OutI-Nick CarterCouples Therapy Called OutI-Nick CarterWGN-AAmer. Funniest Home VideosAmer. Funniest Home VideosRaising HopeRaising HopeRaising HopeRaising HopeRaising HopeRaising HopeRaising HopeRaising HopePREMIUM CHANNELSDISNAustin & AllyAustin & AllyAustin & AllyDog With BlogJessie Austin & AllyMovie Girl MeetsDog With BlogHBO(:15) The Dukes of Hazzard (2005) Johnny Knoxville. Boardwalk Empire CuantoRiddick (2013, Science Fiction) Vin Diesel. R (V) Real Time With Bill MaherMAXHarry Potter-Goblet of Fire(:15) Catwoman (2004, Action) Halle Berry. PG-13 (V) The Knick(:45) The Heat (2013, Comedy) Sandra Bullock. R (V) ConfidentialSHOW(5:25) The Last Exorcism Part II(6:55) Lord of War (2005, Drama) Nicolas Cage. R (V)Ray Donovan The Captain Masters of Sex Inside the NFL TMCHannah(:20) Quartet (2012) Maggie Smith. Snake Eyes (1998) Nicolas Cage. R (V)(:40) Barb Wire (1996, Action) Pamela Anderson Lee. R Flirt.-Disaster 8 p.m. on (2) (8)The Mysteries of LauraAn investigation draws Laura and Jake (Debra Messing, Josh Lucas) back together maybe for good, maybe not in the new episode The Mystery of the Biker Bar. Their probe of the death of said bars owner takes them back to the scene of their first date, where memories leave them feeling nostalgic and romantic. Laura still has concerns about their twin sons, though, and she sends Max (Max Jenkins) to see how theyre faring with their new babysitter.8:30 p.m. on (20) (28)The GoldbergsDisappointed when he doesnt get the lead in a production of Jesus Christ Superstar, Adam (Sean Giambrone) has a big supporter in Beverly (Wendi McLendon-Covey) who makes him the star of another show, to her eventual regret in the new episode Mama Drama. Barry (Troy Gentile) becomes frustrated with traffic-hating Murrays (Jeff Garlin) habit of leaving sports games before they end. Ana Gasteyer guest stars. George Segal also stars.9 p.m. on (6) (10)Criminal MindsThe BAU gets a new agent in the persona of an actress very familiar to viewers as Season 10 opens with the aptly titled X. Jennifer Love Hewitt joins the regular cast as Kate Callahan, an experienced FBI operative who joins the team just as theyre on their way to probe bizarre (of course) crimes in Bakersfield, Calif. The perpetrator has seen to it that the victims cant be identified. Kerr Smith (Dawsons Creek) guest stars.9 p.m. on (13) (35) (51)Red Band SocietyJordi (Nolan Sotillo) gets an expected visitor who causes havoc not only for him, but also for everyone else in the ward in the new episode Liar, Liar, Pants on Fire. WEDNESDAYS BEST BETS Jennifer Love Hewitt September 28 October 4, 2014 TV Week 19 PAGE 20 2 x 11 ad corrective hearing By Jay Bobbin Zap2itQ: What years did Joan Rivers host her talk show on Fox? Carol Green, Providence, R.I.A: The show ran longer than her tenure with it. The Late Show With Joan Rivers premiered in October 1986, and it was destined to remain forever famous as the cause of Rivers broken friendship with Johnny Carson, who had made her his permanent guest host during his tenure on NBCs The Tonight Show. As she said often, she called him to tell him shed gotten the show; he never spoke to her again, explaining hed felt betrayed by her not telling him before the general announcement was made. As it turned out, Rivers was with The Late Show only until the following May, let go over declining ratings and less-than-cordial relations with then-Fox executives. Several guest hosts were enlisted afterward ... the most notable being Arsenio Hall, since The Late Show became his for a good chunk of the rest of its run, and it was the springboard for his own Arsenio Hall Show. The program that started with Rivers ultimately ended, with Ross Shafer hosting it, in the fall of 1988.Q: Ive heard that the Batman television series with Adam West and Burt Ward is finally coming out on home video. When will that happen? Henry Franklin, Glen Burnie, Md.A: Nov. 11. 20th Century Fox which made the show and Warner Home Video, whose corporate cousin DC Comics owns the characters, finally worked things out. Warner will be releasing the complete-series set on both DVD and Blu-ray with loads of bonus features, but for those who choose not to pay the not-inexpensive price for that, a DVD set of only the first season also will become available on the same day. Send questions of general interest via email to tvpipeline@ gracenote.com. Writers must include their names. Personal replies cannot be sent. By Jacqueline Cutler Zap2itDylan McDermott has an uncanny way of playing a character that can be interpreted several ways. In CBS Stalker premiering Wednesday, Oct. 1, McDermott is LAPD Det. Jack Larsen, working in the unit that investigates stalkers. Larsen, though on the force for good, could be quite bad. He appears to be a stalker himself, as he lurks in the bushes, trailing his estranged wife and son. In his most recent starring role before this, in Hostages, McDermott was also a rogue agent, and no one was quite sure what to make of him. I just finished a movie where I am an agent for the U.N., he says. So many of his roles have been as cops, especially on television, he says, I have been doctors, lawyers and cops. Stalker, which shows women meeting gruesome deaths, is crafted to ignite strong reactions. McDermotts hope is that it sparks discussion. We are not so mature in how we talk to other people, he says. McDermott, soft-spoken during an interview in Beverly Hills, Calif., considers the roles hes played and which shows resonated with audiences. His projects have taken him from stage to film and TV. With Hostages, everyone said, How do you sustain it? McDermott says, You dont want everything to run seven years. Thats not success for me. Mine is based on character. I had a homerun with The Practice. I like to create different projects. In American Horror Story, the poster, the subject matter, all that stuff grabbed attention very quickly, he says. This will be another one that grabs attention. Stalker McDermott acknowledges, is bound to trigger strong reactions. Its evocative, he says. Id rather have people have feelings than have people be blas. Its a lightning rod. Sometimes you become involved in projects that become that.Birth date: Oct. 26, 1961Hometown: Waterbury, Conn.TV credits: Ally McBeal, The Practice, The Grid, Big Shots, Dark Blue, American Horror Story, HostagesFilm credits: Freezer, Olympus Has Fallen, The Perks of Being a Wallflower, Wonderland, Jersey Girl CELEBRITY PIPELINE CELEBRITY SCOOP Joan Rivers The time when Joan Rivers was Late Checking in with Dylan McDermott 20 TV Week September 28 October 4, 2014 PAGE 21 THURSDAY PRIME TIME OCT. 26:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSNewsNightly NewsEntertainmentAccess H.The Biggest Loser (N) Bad JudgeA to Z Parenthood (N) (DVS) NewsTonight ShowWorld NewsBusiness Rpt.PBS NewsHour (N) ArtsGulf Coast JrnlAntiques Roadshow KnoxvilleMasterpiece Mystery! (DVS) Islands, CarsNews at 6Business Rpt.PBS NewsHour (N) The This Old House HourDoc Martin Haemophobia MI-5 Split Loyalties World NewsTavis SmileyLocal 6 NewsEvening NewsLocal 6 NewsNFL KickoffNFL Kickoff(:25) NFL Football Minnesota Vikings at Green Bay Packers. (N) (Live) (:15) Local 6 News at 11 (N)NewsNightly NewsNewsExtra (N) The Biggest Loser (N) Bad JudgeA to Z Parenthood (N) (DVS) NewsTonight ShowNewsWorld NewsJeopardy! (N)Wheel FortuneGreys Anatomy (N) Scandal (N) How to Get Away With MurderEyewit. NewsJimmy Kimmel10 News, 6pmEvening NewsWheel FortuneNFL KickoffNFL Kickoff(:25) NFL Football Minnesota Vikings at Green Bay Packers. (N) (Live) (:15) 10 News, 11pm (N)NewsNewsTMZ (N) The Insider (N)Bones (N) (PA) (DVS) Gracepoint (DVS) FOX13 10:00 News (N) NewsAccess H.Sesame Street (DVS) Cat in the HatPeg Plus CatEarthflight, A Nature SpecialGreat Plains-Lingering WildGreat Plains-Lingering WildTavis SmileyCharli e RoseMike & MollyMike & MollyTwo/Half MenTwo/Half MenThe Vampire Diaries Reign The Plague News on CW18How I MetHow I MetEngagementTV20 NewsWorld NewsEntertainmentAsk AmericaGreys Anatomy (N) Scandal (N) How to Get Away With MurderNewsOneDoc Martin Better the Devil Death in Paradise Charlie Rose (N) The MiddleThe MiddleFamily FeudFamily FeudSteve Harvey Law & Order: SVU NewsNews 10:30pmThisMinuteCougar TownNewsWorld NewsThe List (N) ThisMinuteGreys Anatomy (N) Scandal (N) How to Get Away With MurderNewsJimmy KimmelModern FamilyModern FamilyBig BangBig BangLaw & Order: SVU Law & Order: SVU AngerAngerThe OfficeThe OfficeFOX 35 News TMZ (N) Modern FamilyModern FamilyBones (N) (PA) (DVS) Gracepoint (DVS) FOX 35 News at 10 (N) NewsTMZ rName GameFamily FeudFamily FeudEntertainmentThe Mentalist Pilot The Mentalist Cops Rel.Cops Rel.Hot, ClevelandCougar TownfVarietyThe 700 Club Faith BuildersLife FaithVarietyCamp Meeting Hour-HealingJoseph PrinceKingKingMike & MollyMike & MollyThe Vampire Diaries Reign The Plague Two/Half MenTwo/Half MenFriends Friends nTMZ (N) The SimpsonsBig BangBig BangBones (N) (PA) (DVS) Gracepoint (DVS) FOX 35 News at 10 (N) TMZ (N) Access H.t(5:00) Praise the Lord Always GoodPotters TouchTrinity FamilyJoel OsteenJoseph PrinceHillsong TVPraise the Lord (N) (Live) bBlue Bloods Officer Down Blue Bloods What You See Blue Bloods Smack Attack Blue Bloods Brothers Blue Bloods Chinatown Blue Bloods Re-Do The SimpsonsThe SimpsonsBig BangBig BangThe Mentalist Pilot The Mentalist Family GuyFamily GuyThe OfficeThe OfficeCABLE CHANNELSA&EThe First 48 The First 48 The First 48 The First 48 Broad Daylight (:01) Dead Again (:02) The First 48 AMC(5:00) Apollo 13 (1995) Tom Hanks, Bill Paxton. (V)Terminator 3: Rise of the Machines (2003) Arnold Schwarzenegger. (V)(:31) Repo Men (2010) Jude Law. ANPLTo Be Announced Monsters Inside Me Monsters Inside Me Monsters Inside Me Monsters Inside Me Monsters Inside Me BETThe Real (N) XXX: State of the Union (2005, Action) Ice Cube, Willem Dafoe, Scott Speedman. (V)ComicViewComicViewHusbandsHo.HusbandsHo.BRAVOReal Housewives of MelbourneHousewives/NJ Housewives/NJ Housewives/NJ Below DeckWhat HappensHousewivesCNBCMad Money (N) American Greed American Greed American Greed American Greed American GreedCNNSituation RoomCrossfire (N) Erin Burnett OutFront (N) Anderson Cooper 360 (N) Anthony Bourdain PartsCNN Tonight Anderson Cooper 360 COMColbert ReportDaily ShowSouth Park(:29) Tosh.0ChappellesAlways SunnyAlways SunnyTosh.0 Tosh.0 Tosh.0 Daily ShowColbert ReportDSCAirplane Repo Airplane Repo Airplane Repo Fast N Loud Fast N Loud Highway to Sell E!(5:00) Maid in ManhattanE! News (N) Botched Human DollsTotal Divas Roadside RumbleTotal Divas Divas UnchainedE! News (N)ESPNSportsCenter (N) (Live) College Football Central Florida at Houston. From TDECU Stadium in Houston. (N) (Live) ScoreCollege Football Arizona at Oregon. (N) (Live)ESPN2Around/HornInterruptionSportsCenter (N) (Live) MLS Soccer Chicago Fire at Philadelphia Union. (N) (Live) City Slam From Los Angeles. SportsCenter (N) (Live) FAMBoy Meets...The Lucky One (2012, Drama) Zac Efron, Taylor Schilling.Never Been Kissed (1999) Drew Barrymore, David Arquette, Michael Vartan.The 700 Club FNCSpecial Report With Bret BaierOn Record, Greta Van SusterenThe OReilly Factor (N) The Kelly File (N) Hannity (N) The OReilly Factor FOODChopped Belly Dance! Chopped Food Truck Fight Food Truck Face Off (N) Chopped Beat BobbyBeat BobbyDiners, DriveDiners, DriveFXMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyThats My Boy (2012, Comedy) Adam Sandler, Andy Samberg.GOLFGolf CentralEuropean PGA Tour GolfGolf Big Break Invitational, Day 3 Match Play. From Great Waters Golf Course in Greensboro, Ga.LPGA Tour GolfHALLThe Waltons The Waltons The Triangle The Waltons The Awakening The MiddleThe MiddleThe MiddleThe MiddleGolden GirlsGolden GirlsHGTVRehab AddictRehab AddictRehab AddictRehab AddictRehab AddictRehab AddictRehab AddictRehab AddictHouse HuntersHunters IntlFixer Upper HISTTo Be Announced Pawn StarsPawn StarsPawn Stars (N) Pawn Stars (N)Pawn StarsPawn StarsPawn StarsPawn StarsLIFEWife Swap Project Runway Project Runway Project Runway (N) Project Runway MTVFantasy Fact.Fantasy Fact.RidiculousnessRidiculousnessRidiculousnessRidiculousnessRidiculousnessRidiculousnessRidiculousnessSnack-OffRidiculousnessRidiculousnessNBCSNPro Ftb TalkFantasy FtbSpartan Race National Pro Grid LeagueFormula One Racing Pirelli World Challenge Auto RacingNICKNicky, RickyiCarly Sam & CatThundermansInstant MomSee Dad RunFull HouseFull HouseFresh PrinceFresh PrinceHow I MetHow I MetSPIKE(5:30) A Man Apart (2003) Vin Diesel, Larenz Tate. (V)The Fast and the Furious (2001, Action) Vin Diesel, Paul Walker. (V)2 Fast 2 Furious (2003) Paul Walker. (V)SUNGolf AmericaGolf Dest.Golf LifeGolf the WorldPlaying ThroSwing ClinicJimmy HanlinBoxing 30Boxing From Aug. 22, 2014 in Fairfield, Calif.SYFYFreddy vs. Jason (2003, Horror) Robert Englund. (V)Haven Much Ado About MaraSpartacus: Vengeance (:05) Spartacus: Vengeance(:10) HavenTBSMLB Baseball (N) (Live) MLB Baseball (N) (Live)TCMOne Sunday Afternoon (1933) Fay Wray TCMTopper (1937) Cary Grant, Constance Bennett. (V)The Time of Their Lives (1946, Comedy)CantervilleTLCGypsy Sisters Gypsy Sisters Gypsy Sisters I Do... Take 2!Gypsy Sisters (N) Breaking Amish (N) Gypsy Sisters TNTCastle (DVS) Castle Number One Fan Castle Time Will Tell (:01) Castle Get a Clue (:02) Castle (DVS) (:03) CSI: NY Holding CellTOONTeen TitansSteven Univ.Wrld, GumballUncle GrandpaKing of the HillKing of the HillClevelandClevelandAmerican DadFamily GuyBlack JesusFamily GuyTRAVBizarre Foods/ZimmernMan v. FoodMan v. FoodThe Layover with BourdainThe Layover with BourdainNo Reservations Bourdain: No ReservationU Law & Order: SVUModern FamilyModern FamilyModern FamilyModern FamilyVH1Saturday Night Live in the 2000s: Time and Again Billy Madison (1995) Adam Sandler, Darren McGavin. (V)Elf (2003, Comedy) Will Ferrell, James Caan. Premiere. (V)WGN-AAmer. Funniest Home VideosAmer. Funniest Home VideosHow I MetHow I MetHow I MetHow I MetHow I MetHow I MetHow I MetHow I MetPREMIUM CHANNELSDISNJessie Jessie Austin & AllyDog With BlogJessie Austin & AllyMovie Girl MeetsDog With BlogHBO(5:30) Cinderella Man (2005) Russell Crowe. PG-13 Red 2 (2013, Action) Bruce Willis. PG-13 (V) Boardwalk Empire Cuanto Atlantic City HookersMAX47 Ronin (2013, Adventure) Keanu Reeves. PG-13 (V)8 Mile (2002, Drama) Eminem, Kim Basinger. R (V)The Devils Advocate (1997) Keanu Reeves. R (V)SHOW(5:30) Double Jeopardy(:15) Alex Cross (2012, Action) Tyler Perry. PG-13 (V)Jarhead (2005, War) Jake Gyllenhaal. R (V) Penn & TellerRay DonovanTMCThe Twilight Saga: Breaking Dawn Part 2 (2012) PG-13 (V)Dantes Peak (1997, Action) Pierce Brosnan. PG-13 The Impossible (2012, Drama) Naomi Watts. PG-13 8 p.m. on (20) (28)Greys AnatomyNew staff member Maggie (Kelly McCreary) has a tough time making a good impression on her colleagues in the new episode Puzzle With a Piece Missing. Several doctors have a difficult situation in dealing with a woman who wants her dying mother kept alive. Richard (James Pickens Jr.) is determined to keep his secret.9:30 p.m. on (2) (8)A to ZOn the heels of How I Met Your Mother, Cristin Milioti jumps back into series work as this new comedys Z Zelda, a lawyer whose romance with online-dating worker Andrew (Ben Feldman, Mad Men) is traced from start to finish. Each has friends and colleagues who weigh in with opinions about the relationship in the show, which premieres with A Is for Acquaintances. THURSDAYS BEST BETS Ben Feldman September 28 October 4, 2014 TV Week 21 1 x 4 ad lake county arms PAGE 22 FRIDAY PRIME TIME OCT. 36:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSNewsNightly NewsEntertainmentAccess H.Bad JudgeA to Z Dateline NBC (N) NewsTonight ShowWorld NewsBusiness Rpt.PBS NewsHour (N) WashingtonFloridaAustin City Limits Celebrates 40 Years (N) Billy Joel: A Matter of TrustNews at 6Business Rpt.PBS NewsHour (N) WashingtonCharlie RoseAustin City Limits Celebrates 40 Years (N) World NewsTavis SmileyLocal 6 NewsEvening NewsLocal 6 NewsInside EditionThe Amazing Race (N) Hawaii Five-0 Ka MakuakaneBlue Bloods (N) NewsLettermanNewsNightly NewsNewsExtra (N) Bad JudgeA to Z Dateline NBC (N) NewsTonight ShowNewsWorld NewsJeopardy! (N)Wheel FortuneLast Man Standing Shark Tank (N) (:01) 20/20 (N) Eyewit. NewsJimmy Kimmel10 News, 6pmEvening NewsWheel FortuneJeopardy! (N) The Amazing Race (N) Hawaii Five-0 Ka MakuakaneBlue Bloods (N) 10 NewsLettermanNewsNewsTMZ (N) The Insider (N)Utopia (N) Gotham Selina Kyle FOX13 10:00 News (N) NewsAccess H.Sesame Street (DVS) Cat in the HatPeg Plus CatAntiques Roadshow Miss Fishers Murder MysteriesMidsomer Murders Tavis SmileyCharlie RoseMike & MollyMike & MollyTwo/Half MenTwo/Half MenWhose LineWhose LineAmericas Next Top Model (N)News on CW18How I MetHow I MetEngagementTV20 NewsWorld NewsEntertainmentAsk AmericaLast Man Standing Shark Tank (N) (:01) 20/20 (N) News at 11Jimmy KimmelChrist. FitnessTodayShuttlesworthGreat Awakening The Good Life A. WommackGood NewsRobisonFruit of SpiritGreat AwakenMartha SpeaksWorld NewsPBS NewsHour (N) WashingtonCharlie RoseAustin City Limits Celebrates 40 Years (N) Charlie Rose (N) The MiddleThe MiddleFamily FeudFamily FeudSteve Harvey Law & Order: SVU NewsNews 10:30pmThisMinuteFootball FridayNewsWorld NewsThe List (N) ThisMinuteLast Man Standing Shark Tank (N) (:01) 20/20 (N) NewsJimmy KimmelModern FamilyModern FamilyBig BangBig BangLaw & Order: SVU Law & Order: SVU AngerAngerThe OfficeThe OfficeFOX 35 News TMZ (N) Modern FamilyModern FamilyUtopia (N) Gotham Selina Kyle FOX 35 News at 10 (N) NewsTMZ rName GameFamily FeudFamily FeudEntertainmentBones Bones The Bond in the Boot Cops Rel.Cops Rel.Hot, ClevelandCougar TownfVarietyThe 700 Club (N) VarietyConnectionJump Minist.VarietyVarietyKeith MooreFranklinGods MiracleJoseph PrinceKingKingMike & MollyMike & MollyWhose LineWhose LineAmericas Next Top Model (N)Two/Half MenTwo/Half MenFriends Friends nTMZ (N) The SimpsonsBig BangBig BangUtopia (N) Gotham Selina Kyle FOX 35 News at 10 (N) TMZ (N) Access H.t(5:00) Praise the Lord SupernaturalPotters TouchTrinity FamilyHal LindseyHarvest Perry StoneLeft Behind: World at War (2005) Lou Gossett Jr., Kirk Cameron.bCold Case The Dealer Blue Bloods Little Fish Blue Bloods Family Ties Blue Bloods Hall of Mirrors Rookie Blue Fresh Paint Rookie Blue The SimpsonsThe SimpsonsBig BangBig BangBones Bones The Bond in the Boot Family GuyFamily GuyThe OfficeThe OfficeCABLE CHANNELSA&EDead Again Criminal Minds MasterpieceCriminal Minds The Instincts(:01) Criminal Minds (:01) Criminal Minds (:02) Criminal Minds AMC(5:30) Terminator 3: Rise of the Machines (2003) (V)Van Helsing (2004) Hugh Jackman. A monster-hunter battles creatures in Transylvania. Volcano (1997) (V)ANPLTo Be Announced Tanked: Unfiltered Tanked SHAQ-SIZED! Tanked (N) Tanked SHAQ-SIZED!BETThe Real (N) Are We There Yet? (2005, Comedy) Ice Cube, Nia Long, Jay Mohr. (V)HusbandsHo.Real Husbands of HollywoodComicViewComicViewBRAVOPearl Harbor (2001, War) Ben Affleck, Josh Hartnett, Kate Beckinsale. R (V)Pearl Harbor (2001, War) Ben Affleck, Josh Hartnett, Kate Beckinsale. R (V)CNBCMad Money (N) To Be AnnouncedCNN(5:00) The Situation Room (N)Erin Burnett OutFront (N) Anderson Cooper 360 (N) This Is Life With Lisa LingCNN SpotlightUnguardedAnthony Bourdain PartsCOMColbert ReportDaily ShowSouth Park(:29) Tosh.0Key & PeeleGabriel Iglesias: Im Not FatGabriel Iglesias: Hot and FluffyGabriel Iglesias: Aloha Fluffy DSCBering Sea Gold Bering Sea Gold Bering Sea Gold: Dredged UpBering Sea Gold (N) (:02) Airplane Repo (N) (:02) Bering Sea Gold E!Sex and the City E! News (N) E! News Fashion Police (N) Fashion Police E! News (N)ESPNSportsCenter (N) (Live) College Football Louisville at Syracuse. From the Carrier Dome in Syracuse, N.Y. (N) (Live) (:15) College Football Utah State at BYU. (N) (Live)ESPN2NASCAR Racing High School Football Norcross (Ga.) at North Gwinnett (Ga.). (N) (Live)CFL Football Calgary Stampeders at Saskatchewan Roughriders.FAMCinderella StorNever Been Kissed (1999) Drew Barrymore, David Arquette, Michael Vartan.The Princess Bride (1987) Cary Elwes, Robin Wr, DriveDiners, DriveDiners, DriveDiners, DriveFX(5:30) Thats My Boy (2012) Adam Sandler, Andy Samberg. (V)21 Jump Street (2012) Jonah Hill. Young cops go under cover as high-school students. (V)21 Jump Street (2012)GOLFGolf CentralEuropean PGA Tour Golf Golf Big Break Invitational, Final Day Stroke Play. LPGA Tour GolfHALLThe Waltons The Heritage The Waltons The Gift The Waltons The Cradle The MiddleThe MiddleThe MiddleThe MiddleGolden GirlsGolden GirlsHGTVLove It or List It Love It or List It, Too Love It or List It, Too Love It or List It, Too (N) House HuntersHunters IntlHunters IntlHunters IntlHISTTo Be Announced American Pickers American Pickers American Pickers American Pickers LIFECelebrity Wife Swap Celebrity Wife Swap She Made Them Do It (2012, Docudrama) Jenna Dewan Tatum.The Surrogate (2013, Suspense) Cameron Mathison, Amy Scott.MTVRidiculousnessRidiculousnessRidiculousnessRidiculousnessMTV SpecialFinal Destination 3 (2006, Horror) Mary Elizabeth Winstead.NBCSNPro Ftb TalkNFL Turning Point Prem. LeagueMLS Soccer Sporting Kansas City at D.C. United. (N) (Live) National Pro Grid League Finals. (Taped)NICKiCarly iCarly Sam & CatHenry DangerTeenage Mut.Teenage Mut.Full HouseFull HouseFresh PrinceFresh PrinceHow I MetHow I MetSPIKECops Cops Cops Cops Cops Cops Bellator MMA Live (N) (Live) (:15) Cops(:26) CopsSUNReel Animalsto Do FloridaNHL Hockey From Oct. 5, 2013. (Subject to Blackout) Lightning PreInside the LightningIns. LightningLightning PreIns. LightningSYFYResident Evil: Extinction (2007, Horror) Milla Jovovich. WWE Friday Night SmackDown! (N) Z Nation Full Metal ZombieSpartacus: Gods of the ArenaTBSMLB Baseball (N) (Live) MLB Baseball (N) (Live)TCM(:15) 7 Faces of Dr. Lao (1964) Tony Randall. (V)The African Queen (1951) Humphrey Bogart. (V)Sahara (1943) Humphrey Bogart, Bruce Bennett. (V)TLCI Found-GownI Found-GownLittle People, Big World 19 Kids-Count19 Kids-CountFour Weddings (N) Four Weddings (N) Four Weddings TNTCastle Probable Cause Castle The Final Frontier On the Menu Chilis Sherlock Holmes (2009, Action) Robert Downey Jr., Jude Law. (DVS) On the MenuTOONTeen TitansSteven Univ.Wrld, GumballUncle GrandpaKing of the HillKing of the HillClevelandClevelandAmerican DadAmerican DadFamily GuyFamily GuyTRAVMysteries at the MuseumMysteries at the MuseumMysteries at the MuseumMysteries at the Museum (N)Mysteries at the MuseumMysteries at the MuseumTVLBev. HillbilliesBev. HillbilliesBev. HillbilliesBev. HillbilliesFamily FeudFamily FeudFamily FeudFamily FeudLove-RaymondLove-RaymondFriends Friends USALaw & Order: SVU Law & Order: SVUModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyModern FamilyVH1T.I. and TinyT.I. and TinyT.I. and TinyT.I. and TinyLove & Hip Hop: HollywoodLove & Hip Hop: HollywoodLove & Hip Hop: HollywoodCouples Therapy Called OutWGN-AAmer. Funniest Home VideosAmer. Funniest Home VideosBackdraft (1991) Kurt Russell. Chicago firefighters work overtime to stop a mad arsonist.How I MetHow I MetPREMIUM CHANNELSDISNI Didnt Do ItI Didnt Do ItAustin & AllyDog With BlogGirl MeetsGirl MeetsStar Wars Rebels I Didnt Do ItLiv & MaddieDog With BlogDog With BlogHBO(5:15) R.I.P.D. (2013) PG-13The Secret Life of Walter Mitty (2013) Ben Stiller. PG REAL Sports Bryant GumbelReal Time With Bill Maher (N)Real Time With Bill MaherMAXHot Shots! Grudge Match (2013) Robert De Niro. PG-13 (V) (:25) Gravity (2013) Sandra Bullock. The Knick (N) The Knick SHOWSave the Last Dance (2001) Julia Stiles. PG-13 (V) Masters of SexMistaken for Strangers (2013) NR Django Unchained (2012) Jamie Foxx.TMCGucci-DirectorStep Up Revolution (2012) Ryan Guzman.(:10) StreetDance (2010) Nichola Burley. PG-13 (V) StreetDance 2 (2012) Tom Conti. NR (V) Sunset Strip 8 p.m. on (TNT)On the MenuHome cooks work with professional chefs to create new menu items for American food businesses in this new food competition series hosted by Ty Pennington. The winning dish is added to the business menu the next day. In the series premiere, the home cooks vie to create the best new burger for the Chilis restaurant chain. Chef Emeril Lagasse also appears.9 p.m. on (3) (5) (24)Austin City Limits Celebrates 40 YearsCountless music stars have made their way through this series during its four-decade history, and this new special compiles memorable moments while also offering new performances. Willie Nelson, Foo Fighters, Bonnie Raitt, Kris Kristofferson, Emmylou Harris, Lyle Lovett, Buddy Guy and Alabama all pay tribute to the showcase. Sheryl Crow and two best actor Oscar winners, Jeff Bridges and Matthew McConaughey, serve as hosts of the two-hour program.10 p.m. on (6) (10)Blue BloodsShunned as a turncoat after she testifies against her partner, an officer (guest star Tonya Glanz) gets a new patrol mate in volunteer Jamie (Will Estes) who also finds himself an outcast for supporting her in the new episode Forgive and Forget. Even Eddie (Vanessa Ray) turns against him. Football veteran Boomer Esiason appears as himself, asking Frank (Tom Selleck) for a favor. Guest star Eric Laneuville also directed the episode.10 p.m. on (FOOD)Diners, Drive-Ins and DivesHost Guy Fieri confirms that some small towns in America have some very big food flavor in the new episode Small Town Standouts. FRIDAYS BEST BETS Tom Selleck 22 TV Week September 28 October 4, 2014 PAGE 23Varied ProgramsCharlie Rose Varied ProgramsLetterman(:37) Inside EditionFergusonVaried Programs(:07) Extra(:37) Paid ProgramUp to the MinuteVaried ProgramsCBS Morning NewsMorning NewsMorning NewsTonight Show(:36) Late Night With Seth MeyersLast Call/Daly(:07) Today Steve Harvey Early TodayNewsChannel 8NewsChannel 8NewsChan nel 8Jimmy Kimmel Live(:37) NightlineBe a MillionaireName Game(FOX13 11:00 News(:34) Paid Program(:04) Paid ProgramAccess Hollywood(:03) Dish Nation(:31) TMZFOX13 11:00 NewsFOX13s Good DayFOX13s Good DayVaried ProgramsCharlie RoseRick Steves EuropeVaried Programs Power YogaRules/EngagementFriends Friends Paternity CourtCops ReloadedCops ReloadedJerry Springer Paid ProgramPaid ProgramPaid ProgramFirst BusinessJimmy Kimmel Live(:37) Nightline(:07) Inside Edition(:37) The InsiderWCJB TV20 NewsABC World NewsVaried Programs America MorningNews Varied ProgramsGreat AwakeningYou & Me Charles VanceThe 700 Club Varied ProgramsArth. RippyTavis SmileyVaried ProgramsRaising HopeSeinfeldSeinfeldKing of the HillCleveland ShowComics UnleashedPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramJimmy Kimmel Live(:37) Nightline(:07) The Dr. Oz Show News(:40) Paid ProgramABC World NewsVaried Programs America MorningNews NewsFamily GuyFamily GuyAmerican DadAmerican DadCleveland ShowSteve Harvey ShowMarried... WithPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramDish NationFOX 35 News at 10 Paid ProgramPaid ProgramPaid ProgramPaid ProgramDish NationTMZGood Day OrlandoGood Day OrlandoVaried ProgramsHot in ClevelandEntertainment Ton.SeinfeldBridezillas Forensic FilesCommunityPaid ProgramCougar TownAsk the LawyerShepherds ChapelVaried ProgramsrVariety SuperChannelVaried ProgramsVariety Varied ProgramsVariety Varied ProgramsVariety Varied ProgramsJim BakkerVaried ProgramsJoseph PrincefRaising HopeOK! TV The SimpsonsKing of the HillComics UnleashedPaid ProgramPaid ProgramEmotional MojoPaid ProgramPaternity CourtQueen Latifah Programs Bless the LordtVaried Programs NUMB3RS NUMB3RS Paid ProgramPaid ProgramInspiration Today Camp MeetingbTo Be AnnouncedTo Be AnnouncedPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramAmerican DadPaid ProgramPaid ProgramShepherds ChapelVaried ProgramsA&EVaried Programs(:02) Paid ProgramPaid ProgramPaid ProgramPaid ProgramAMC(10:00) MovieVaried ProgramsThe Three StoogesANPLVaried ProgramsBETThe Wendy Williams Show The Real The Queen Latifah Show The GameThe GameBET InspirationVaried Programs Rev. Peter PopoffBRAVOVaried Programs Million Dollar Listing: Los AngelesWhat HappensHousewives/NJVaried ProgramsPaid ProgramPaid ProgramPaid ProgramP aid ProgramCNBCVaried Programs Paid ProgramPaid ProgramPaid ProgramPaid ProgramWorldwide Exchange Varied ProgramsCNNAnthony Bourdain Parts UnknownCNNI SimulcastVaried ProgramsCNNI Simulcast CNNI Simulcast Early Start With John BermanEarly StartV aried ProgramsCOM(12:01) At MidnightVaried ProgramsDaily ShowThe Colbert Report(:03) At MidnightVaried Programs Paid ProgramPaid ProgramDSCVaried Programs(:33) Paid Program(:02) Paid Program(:31) Paid ProgramPaid ProgramPaid ProgramE!Live from E!Varied Programs Rich Kids ofRich Kids ofPaid ProgramPaid ProgramPaid ProgramPaid ProgramESPN(11:20) SportsCenter SportsCenterVaried ProgramsSportsCenter Varied Programs SportsCenter SportsCenterESPN2Baseball Tonight Varied Programs ESPN FCSportsCenter Varied ProgramsFAMMovie Paid, DriveDiners, DriveVaried Programs Paid ProgramPaid ProgramFX(10:30) MovieVaried Programs Paid ProgramVaried Programs Paid ProgramPaid ProgramPaid ProgramGOLFLPGA Tour GolfVaried Programs Golf(12:01) Pawn StarsVaried Programs(:02) Paid ProgramPaid ProgramPaid ProgramPaid ProgramLIFEVaried Programs(:02) Paid ProgramPaid ProgramPaid ProgramPaid ProgramMTVVaried Programs Clubland Music FeedNBCSNVaried Programs Paid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramNICK(12:12) How I Met Your MotherHow I Met/Mother(:24) FriendsFriends Fresh Prince(:12) The Fresh Prince of Bel-AirGeorge Lopez(:24) George LopezGeorge LopezGeorge LopezSPIKEVaried Programs Jail Jail Jail Jail Jail Paid ProgramPaid ProgramPaid ProgramPaid ProgramSUNVaried Programs Paid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramSYFY(11:00) Movie Movie Varied Programs Movie Varied Programs Paid ProgramTBSVaried Programs Married... WithMarried... WithMarried... WithMarried... WithTCM(10:00) Movie Varied Programs Movie Varied Programs Movie Varied ProgramsTLCVaried Programs Paid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramTNTVaried Programs SmallvilleVaried ProgramsTOONRobot ChickenAqua Teen HungerThe BoondocksAmerican DadAmerican DadFamily GuyFamily GuyRobot ChickenYoure WholeThe BoondocksCleveland ShowKing of the HillTRAVVaried Programs Paid ProgramPaid ProgramPaid ProgramPaid ProgramTVLKing of QueensKing of QueensKing of QueensKing of QueensLove-RaymondLove-RaymondRoseanneRoseanneThrees CompanyThrees CompanyW hos the Boss?Whos the Boss?USAVaried Programs Law & Order: Special Victims UnitLaw & Order: Special Victims UnitVH1Varied Programs Morning BuzzVaried ProgramsWGN-AHow I Met/MotherVaried ProgramsParks/RecreatParks/RecreatRules/EngagementRules/Engagement30 Rock30 Rock OT(12:15) 2 Guns (2013, Action) Denzel Washington, Mark Wahlberg. R Last Week To. (:45) Real Time With Bill Maher (:45) The 50 Year Argument (2014, Documentary) NR Flight of ConchordsW(12:15) Boardwalk Empire Cuanto(:15) Trance (2013, Crime Drama) James McAvoy, Rosario Dawson. R 12 Years a Slave (2013, Historical Drama) Chiwetel Ejiofor. R Flight of ConchordsRememberingThLast Week To.(:35) Prisoners (2013) Hugh Jackman. A desperate father takes the law into his own hands. R(:10) Riddick (2013, Science Fiction) Vin Diesel, Karl Urban. R (:10) The Girl (2012) Toby Jones.F(12:05) Were the Millers (2013, Comedy) Jennifer Aniston. R The Purge (2013, Suspense) Ethan Hawke. R True Lies (1994) Arnold Schwarzenegger. A man lives the double life of a spy and a family man.SaOn the Run Tour: Beyonc and Jay Z The couple perform in Paris, France. The 40-Year-Old Virgin (2005, Romance-Comedy) Steve Carell. R Up in the Air (2009) George Clooney. R M A XT(11:45) Were the Millers (2013) Jennifer Aniston. R (:35) Atomic Hotel Erotica (2014) Sophia Bella. NR Gothika (2003, Horror) Halle Berry. R (:40) Prowl (2010, Horror) Ruta Gedmintas. R W(10:45) Taken 2The Wolverine (2013, Action) Hugh Jackman, Hiroyuki Sanada. PG-13 (:40) Stacked Racks From Mars (2014) Erika Jordan. NR(:05) Broken Arrow (1996, Action) John Travolta, Christian Slater. R ThCo-Ed ConfidentialFemme Fatales (12:50) Con Air (1997, Action) Nicolas Cage. R (:45) Carnal Awakening (2013, Adult) Reena Sky. NR (:10) Ladyhawke (1985, Fantasy) Matthew Broderick. PG-13 FDevil AdvocateObsession (2013, Adult) Kiara Diane, Tasha Reign. NR The Generals Daughter (1999, Suspense) John Travolta. R Life on Top (:40) Jackie Chans First Strike (1996) Jackie Chan. SaThe Knick Working Late a Lot Girls GuideGirls Guide (1:55) The Heat (2013, Comedy) Sandra Bullock, Melissa McCarthy. R (3:55) Zanes Sex Chronicles (4:50) Hot Shots! (1991) PG-13 S H O WTFour Brothers (2005, Crime Drama) Mark Wahlberg, Tyrese Gibson. R Blue Caprice (2013) Isaiah Washington. R (:35) The Motel Life (2012) Emile Hirsch. Premiere. R (:15) Dantes Peak (1997) PG-13WRaze (2013, Action) Zoe Bell, Rachel Nichols. R (:35) 21 Grams (2003, Drama) Sean Penn, Benicio Del Toro. R SuicideGirls (:15) Ed Wood (1994, Biography) Johnny Depp, Martin Landau. R ThNational Lampoons Van Wilder (2002) Ryan Reynolds.(:35) The Last Exorcism Part II (2013) Ashley Bell. PG-13(:05) Lord of War (2005, Drama) Nicolas Cage, Jared Leto. R (:10) Glena (2013) NR FRay Donovan (:35) Richard Pryor: Omit the Logic (2013) NR Sommore: Chandelier Status Quiz Show (1994) John Turturro. Congress investigates a TV game show for fraud in the 1950s.Sa(10:30) Django Unchained (2012)(:15) Masters of Sex (:15) Ray Donovan The Captain (:15) Inside the NFL (:15) Deep Impact (1998, Drama) Robert Duvall, Tea Leoni. PG-13 T M CT(11:45) Aint Them Bodies Saints (2013) Rooney Mara.Sexpresso (2013, Adult) NR (2:50) Blood Out (2011) Curtis Cent Jackson. R (:20) Clerks (1994, Comedy) Brian OHalloran. R W(12:05) An American Werewolf in London (1981) R(:45) Breaking the Waves (1996) Emily Watson. A paralyzed seaman asks his shy Scottish wife to take lovers. R The Way Back (2010) Jim Sturgess. PG-13 Th(11:30) Flirting With Disaster R (:05) Crash (2004, Drama) Sandra Bullock, Don Cheadle. R Beautiful Creatures (2013) Alden Ehrenreich. PG-13For Ellen (2012, Drama) Paul Dano, Jon Heder. NR FA Dark Truth (2012, Suspense) Andy Garcia, Kim Coates. R Booty Hunter (2011, Adult) NR (:10) Men of War (1995, Action) Dolph Lundgren, Charlotte Lewis. R Ed Wood (1994) Johnny Depp.Sa(11:30) Sunset Strip (2012) NR (:10) Nature Calls (2012, Comedy) Patton Oswalt. R Afterschool (2008, Drama) Ezra Miller, Jeremy White, Emory Cohen. NR (:20) Little Buddha (1993) Keanu Reeves. PG September 28 October 4, 2014 TV Week 23 PAGE 24 SATURDAY DAYTIME OCT. 49:009:3010:0010:3011:0011:3012:0012:301:001:302:002:303:003:304:004:305:005:30LOCAL BROADCAST CHANNELS(8:00) TodayRaw TravelAstroblastChica ShowTree Fu TomLazyTownRaw TravelEnglish Premier League Soccer Goal ZonePregameCollege Football Stanford at Notre Dame. (N) (Live) Rick StevesBurt WolfRudy MaxaHometimeOld HouseOld HouseKitchenMarthaMoveableChefCookLifestyleHubertSciTechNOVA Penguins: SpySesame St.DinosaurTest KitchenCookSarasLidiaThe ChefsVictoryOld HouseOld HouseOld HouseHometimeWoodwrightMotorWeekCookingMarthaHistory Detectives Lucky DogDr. Chris-VetInnovationRecipeAll InChangersPaid Prog.Paid Prog.RecipeFood RushKnock It OffFootballCol. FootballCollege Football Teams TBA. (N) (Live) News AstroblastChica ShowTree Fu TomLazyTownNewsEnglish Premier League Soccer Goal ZonePregameCollege Football Stanford at Notre Dame. (N) (Live) Good Morning America (N)Jack HannaOcean Mys.Sea RescueWildlifeCollege Football Teams TBA. (N) (Live) FootballCollege Football Teams TBA. (N) (Live)CBS This MorningLucky DogDr. Chris-VetInnovationRecipeTrust DaleDokkenTBATo Be AnnouncedFootballCol. FootballCollege Football Teams TBA. (N) (Live) Live LifeSports StarsXplor. PlanetOuter SpaceEarth 2050Animal SciPaid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.PregameCollege Football Teams TBA. (N) (Live)PaintingCraftingScrapbookYour HomeGardenGreenerSimon Reeve Antiques Roadshow Rick StevesRudy MaxaTravelscopeAmericasWoodshopWoodsmithRough CutCraftsmansB. BarrB. BarrExped. WildExped. WildRock-ParkReluctantly On the SpotAqua KidsWild Amer.HollywoodRaw TravelReal GreenLatiNationAmer. LatinoWhite Collar All In Entertainers: Byron AllenMyOcalaTVDragonFlyTVDog TalesKids NewsDragonFlyTVYoung IconsCollege Football Teams TBA. (N) (Live) FootballCollege Football Teams TBA. (N) (Live)Dr. WonderSuperbookFitnessCitylifeWalk, WaterAdrian RgrsTheresa WommackNewswatchNewsCTN SpecialBack toBridgesJosephGaither Homecoming HourChristian Worship HourMotorWeekHometimeOld HouseOld HouseCookMarthaKitchenPepinHubertLidiaMoveableSarasRick StevesAntiques Roadshow NOVA (DVS) PenguinsNews SavingPaid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.HelmetHelmetPaid Prog.Paid Prog.First FamilyBox OfficeThere Yet?The re Yet?KingKingABC Action NewsJack HannaOcean Mys.Sea RescueWildlifeCollege Football Teams TBA. (N) (Live) FootballCollege Football Teams TBA. (N) (Live)Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Movie Movie The Pinkertons The OfficeThe Office(8:00) Good Day OrlandoPaid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.To Be Announced PregameCollege Football Teams TBA. (N) (Live)rPaid Prog.Paid Prog.Name GameRaymondCommunityHollywoodCollege Football Southern Mississippi at Middle Tennessee State. (N) (Live)College Football New Mexico at Texas-San Antonio. Alamodome. (N)fVarietyVarietyVarietyVarietyVarietyVarietySid RothStudio DirectHealing SoulHal LindseyVarietyEndJump Minist.VarietyVarietyVarietyVarietyB. BarrB. BarrExped. WildExped. WildRock-ParkReluctantly ACC BlitzCollege Football ACC Game of the Week: Teams TBA. (N) (Live) ComicsHispanicTunnel to Tower 2014The MiddlenBiz Kid$WinningPaid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Big BangBig BangPregameCollege F ootball Teams TBA. (N) (Live)tRocKids TVAuto B. GdPenguins!VeggieTalesMonsterHopkinsLassie (EI) GoliathIshine KnectInsp. StationPaws/TailsVeggieTalesHeroes & LegendsCameronNewsbbNatalies Rose (1998)Paid.Judge J udyJudge JudyMovieCABLE CHANNELSA&ECriminal MindsCriminal Minds Criminal Minds To Be AnnouncedWahlburgersWahlburgersWahlburgersWahlburgersTo Be AnnouncedAMCRiflemanHell on Wheels bbRooster Cogburn (1975) John Wayne, Katharine Hepburn. bbbSeraphim Falls (2006) Liam Neeson, Pierce Brosnan. (V)bbThe Quick and the Dead (1995, Western) Sharon Stone. ANPLPit Bulls and ParoleesPit Bulls and ParoleesPit Bulls and ParoleesPit Bulls and ParoleesPit Bulls and ParoleesPit Bulls and Par oleesPit Bulls and ParoleesPit Bulls and ParoleesPit Bulls and ParoleesBETHusbandsHusbandsHusbandsHusbandsHusbandsHusbandsHusbandsHusbandsHusbandsHo.bbThe Longshots (2008, Docudrama) Ice Cube, Keke Palmer. bbAre We There Yet? (2005) (V)BRAVOMillion Dollar LAMillion Dollar LAMillion Dollar LAMillion Dollar LABelow Deck Below Deck Below Deck Below Deck Below DeckCNBCPaid Prog.Paid Prog.Cook SafePaid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Pro g.Paid Prog.Paid Prog.Paid Prog.Paid Prog.Paid Prog.CNNSmerconish (N) (Live) CNN Newsroom With Fredricka Whitfield (N) CNN NewsCNN MoneyCNN Newsroom (N) GuptaCNN Newsroom (N)COMKey & Peele(:21) bbSex Drive (2008) Josh Zuckerman, Amanda Crew. (11:51) bbDance Flick (2009) TBA(1:52) bbWhite Chicks (2004, Comedy) Shawn Wayans. (V)(:24) bBubble Boy (2001, Comedy) DSCFast N Loud Fast N Loud Fast N Loud Fast N Loud Highway to Sell Highway to Sell Highway to Sell Highway to Sell Naked and Afraid E!Sex and the City E! News WeekendThe SoupKardashian Kardashian Kardashian Kardashian Kardashian E! News WeekendThe WomenESPNCollege GameDay (N) (Live) College Football Teams TBA. (N) (Live) ScoreNASCAR Racing Nationwide Series: Kansas Lottery 300. (N) (Live)ESPN2SportsCenter (N) (Live) College Football Teams TBA. (N) (Live) ScoreCollege Football Teams TBA. (N) (Live)FAMbbHoney, I Blew Up the Kid (1992) Rick Moranis. (V)bbLiar Liar (1997) Jim Carrey, Maura Tierney. (V)bbThe Sorcerers Apprentice (2010) Nicolas Cage.bbbHook (1991, Fantasy) Dustin Hoffman, Robin Williams, Julia Roberts. (V)FNCFOX and Friends SaturdayBulls, BearsBusinessForbes/FOXCashin InAmericas News HQAmericas News HQJour.Americas News Headquarters (N) Healthy YouNews HQThe FiveFOODFarmhousePioneer Wo.Pioneer Wo.TrishasThe Kitchen (N) Diners, Drive RewrappedBeat BobbyRestaurant: ImpossibleDiners, DriveDiners, DriveGuys Grocery GamesFood Truck RaceFXTwo MenTwo MenTwo MenTwo MenbbKnight and Day (2010, Action) Tom Cruise, Cameron Diaz. (V)bThis Means War (2012, Action) Reese Witherspoon, Chris Pine.bbbMission: Impossible -Ghost Protocol (2011)GOLF(8:00) European PGA Tour Golf Alfred Dunhill Links Championship, Third Round. (N)LPGA Tour Golf Reignwood LPGA Classic, Third Round. From Beijing. Golf Big Break Invitational, Day 1 Modified Stableford.HALLGolden GirlsGolden GirlsA Lesson in Romance (2014) Kristy Swanson. bbSee Jane Date (2003) Charisma Carpenter. Reading, Writing & Romance (2013) Eric Mabius. Remember Sunday (2013) Alexis Bledel. HGTVHse CrashHse CrashMy Big FamMy Big FamMy Big FamMy Big FamMy Big FamMy Big FamFlip or FlopFlip or FlopFlip or FlopFlip or FlopF lip or FlopFlip or FlopJennie GarthJennie GarthJennie GarthJennie GarthHISTTo Be Announced To Be AnnouncedLIFEPaid Prog.Paid Prog.Paid Prog.Paid Prog.Unsolved Mysteries Cradle of Lies (2006) Shannon Sturges, Dylan Neal.Stolen From the Womb (2014) Laura Mennell.Gone Missing (2013) Daphne Zuniga, Gage Golightly.MTVRidiculous.Ridiculous.Ridiculous.Ridiculous.bbFinal Destination 2 (2003) Ali Larter, A.J. Cook.bbFinal Destination 3 (2006, Horror) Ryan MerrimanTeen Mom 2 HappylandFaking ItAwkward.Awkward.NBCSNPremier League Live (N) English Premier League Soccer (Taped) PremierFormula One Racing Onward Notre DameBig RandyPolo (Taped) Horse Racing (Taped)NICKSpongeBobSpongeBobSpongeBobSanjayBreadSpongeBobPowerOdd ParentsOdd ParentsOdd ParentsSpongeBobSpongeBobSpongeBobSpongeBobiCarly iCarly Sam & CatSam & CatSPIKEContractorContractorContractorContractorContractorContractorContractorContractorCops Cops Cops Cops Cops Cops Cops Jail Cops Cops SUNBoaterCllege FootballACC Gridiron LiveACC AccessSeminolesThe Florida Keys: Real Canoe Worlds Boxing From July 9, 2014 in Las Vegas. Trackside LiveXTERRASYFYScare TacticScare TacticScare TacticbbSwamp Devil (2008, Horror) Bruce Dern. Tasmanian Devils (2013) Danica McKellar. bbbHellboy (2004, Fantasy) Ron Perlman, John Hurt. (V)Resident Evil: ExtinctionTBSKingKingKingKingbThe Spy Next Door (2010, Comedy) Jackie Chan.bThe Tuxedo (2002, Comedy) Jackie Chan. (V) CougarCougarFriendsFriendsFriendsFriendsTCM(8:00) bbThe CobwebCarsonbbDr. Kildares Crisis (1940) bbThe Mummy (1959) Peter Cushing.(:45) A Night at the Movies bbbPeeping Tom (1960, Horror) Carl Boehm. bbbLolita (1962) (V)TLCTo Be Announced To Be AnnouncedTNTLaw & Order Thrill Law & Order DenialbbSherlock Holmes (2009, Action) Robert Downey Jr. (DVS)(:45) bbbRoad to Perdition (2002, Crime Drama) Tom Hanks. (:15) bbbbSaving Private Ryan (1998) Tom Hanks.TOONClarenceGumballGumballTeen TitansTeen TitansbbScooby-Doo! Pirates Ahoy! (2006)ClarenceClarenceGumballGumballTeen TitansTeen TitansTeen TitansAdventureAdventureAdventureTRAVMysteries at the MuseumMysteries at the MuseumBourdain: No ReservationsMan v. FoodMan v. FoodMan v. FoodMan v. FoodGhost Adventures Ghost Adventures Ghost Adventures Ghost Adventures TVLThe NannyThe NannyFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudCosby ShowCosby ShowCosby ShowCosby ShowCosby ShowCosby ShowCosby ShowCosby ShowUSANCIS Under Covers NCIS Boxed In NCIS Sandblast NCIS Once a Hero NCIS Smoked NCIS Sharif Returns NCIS (DVS) NCIS Iceman NCIS Grace PeriodVH1Top 20 Video CountdownTop 20 Video CountdownSaturday Night Live Saturday Night Live Saturday Night Live Saturday Night Live Saturday Night Live Saturday Night Live Saturday Night Live WGN-AWalker, Texas RangerWalker, Texas RangerIn the Heat of the NightIn the Heat of the NightIn the Heat of the NightLaw Order: CI La w Order: CI Law & Order Law & Order PREMIUM CHANNELSDISNGirl MeetsDogJessieI Didnt Do ItGirl MeetsGirl MeetsGood LuckGood LuckGood LuckJessieJessieJessieAustinAustinAustinAustinLiv-Mad.Liv-Mad.HBO(8:30) The Secret Life of Walter Mitty (V)bbbThe Case Against 8 (2014) NR bbMonster-in-Law (2005) PG-13 (:15) bbbDuma (2005) Alexander Michaletos. PGbbThe Secret Life of Walter Mitty (2013) Ben Stiller.MAXBig Daddy(:20) bbNext of Kin (1989) R (V) (:10) bbMade (2001) Jon Favreau. R(:45) bbThe Hobbit: An Unexpected Journey (2012) Ian McKellen. PG-13 (:40) bBlue Streak (1999) PG-13 The Legend of HerculesSHOWGlena (2013, Documentary) NR (:25) bbJudge Dredd (1995) R bThe Last Exorcism Part II (2013) bScary Movie V (2013) Ashley Tisdale.Homeland Homeland Homeland TMC(8:00) bbbLincoln (2012) PG-13 bbSpy Hard (1996) Leslie Nielsen. (V)Hannah Montana(:15) bbbThe Perks of Being a Wallflower (2012)bbbLincoln (2012) Daniel Day-Lewis, Sally Field. PG-13 (V) Warrior Way 24 TV Week September 28 October 4, 2014 PAGE 25 By Kate OHare Zap2itIts a drizzly May day on a beach outside of the city of Victoria on Vancouver Island, Canada. When the sun breaks out, piles of soaked logs down on the sand start to steam, filling the air with mist. Down near the waterline, the cast of Foxs murder drama Gracepoint, premiering Thursday, Oct. 2, are doing a photo shoot, as a camera drone flies overhead. The story of Gracepoint begins on a beach, where a young boy is found dead. If that sounds familiar, its because its also the starting point of the British-produced BBC America drama Broadchurch, upon which Gracepoint is based. Toward the end of the day, after more bits of sun, interspersed with rain, star David Tennant, dressed in his detective uniform of suit, badge, overcoat and three-day scruff, comes into a tent to talk to reporters. If this also sounds familiar, its because the Scottish actor starred in Broadchurch as well, playing essentially the same character, a bigcity police detective transplanted to a small seaside town, only now with a different name Emmett Carver and a different nationality American. The setting is also different, since Gracepoint is in Northern California, not the U.K.s Dorset coast. Carvers still partnered with local Detective Ellie Miller, but here shes played by Anna Gunn (Breaking Bad, Deadwood). Filling out the rest of the Fox cast are Michael Pena, Kevin Zegers, Nick Nolte, Jacki Weaver, Kevin Rankin, Sarah-Jane Potts and Josh Hamilton. Broadchurch creator Chris Chibnall wrote the Gracepoint pilot, but the showrunners for the Fox version are the husband-andwife team of Anya Epstein and Dan Futterman. If the Gracepoint producers were looking for a David Tennanttype to play Carver, apparently they couldnt do better than the original. As it turns out, says Tennant, Im about the only one there is. I COVER STORY The role so nice, Tennant played it twice 2 x 4" ad breakpoint alley WORD SEARCH 1 x 4" ad budget blinds 1 x 3" ad canadian meds 1 x 2" ad house ad Gracepoint premieres Thursday on Fox. daresay they could have gone different ways, and Alec Hardy and Emmett Carver didnt need to look the same, but it turns out that they do. So, yeah, it just felt like it was such an unusual opportunity, and yet had so many positives attached to it, that it was something of a nobrainer in the end, I guess. Gracepoint features characters and storylines not featured in Broadchurch, and Tennant cant assume Carver has all the same issues as his U.K. counterpart. Carvers past is shrouded in mystery, he says, so quite what happened to him before he came to Gracepoint, what it has done to him, and where it might take him in the future, you dont want to get too specific, because it doesnt help the storytelling. September 28 October 4, 2014 TV Week 25As for the ending, Epstein and Futterman have said its different from the ending of the U.K. show, but, as Tennant says, They could be lying; it could be a double bluff. 26 SATURDAY PRIME TIME OCT. 46:006:307:007:308:008:309:009:3010:0010:3011:0011:30LOCAL BROADCAST CHANNELSCollege Football Entertainment Tonight (N) The Mysteries of Laura Law & Order: SVU Saturday Night Live NewsSat. Night LiveNewsHour WkCharlie RoseThe Lawrence Welk ShowBeing Served?Keeping UpTime Goes ByFoot in GraveVicar of DibleyVicious Masterpiece Mystery!The Lawrence Welk ShowAntiques Roadshow KnoxvilleDoc Martin Old Dogs Keeping UpYouve GoneMoone BoyBlack AdderAustin City Limits BeckCollege Football Teams TBA. Local 6 Sports Saturday (N) NCIS: Los AngelesStalker Pilot 48 Hours (N) NewsInside EditionCollege Football Bucs BonusNewsThe Mysteries of Laura Law & Order: SVU Saturday Night Live NewsSat. Night LiveFootballPostgameNewsWheel FortuneCollege Football Teams TBA. (N) (Live) NewsCollege Football Teams TBA.Wheel FortuneJeopardy!NCIS: Los AngelesStalker Pilot 48 Hours (N) 10 NewsPaid ProgramCollege Football Teams TBA. College ExtraCollege Football Teams TBA. (N) (Live) NewsFOX13 News Earthflight, A Nature SpecialCrane Song Death in ParadiseAn American in Paris (1951) Gene Kelly, Leslie Caron.Austin City Limits BeckThe Pinkertons College Football Hawaii at Rice. From Rice Stadium in Houston. (N) (Live) NewsTwo/Half MenMovieFootballPostgameEntertainment Tonight (N) College Football Teams TBA. (N) (Live) News at 11Turning Point With DavidJack Van ImpeProph. in NewsEnd of AgesWe the PeopleLeslie Hale ProphecyAll Over WorldCTN SpecialPure PassionPenguins: SpyNewsHour WkThe Lawrence Welk ShowBeing Served?Keeping UpGood NeighbrsYes, MinisterDoc Martin Better the Devil Austin City Limits BeckRaising HopeRaising HopeThe MiddleThe MiddleBlue Bloods Smack Attack The Good Wife Unorthodox NewsSports NightThisMinuteCougar TownFootballPostgameNewsAmerican MedCollege Football Teams TBA. (N) (Live) NewsrFamily GuyFamily GuyBig BangBig BangLeverage The Van Gogh Job Leverage Parker is trapped. AngerAngerMoviefCollege Football Teams TBA. College ExtraCollege Football Teams TBA. (N) (Live) FOX 35 News at 10 (N) College FootballGreat RowdiesNASL Soccer FC Edmonton at Tampa Bay Rowdies. (N) (Live)Name GameRing of Honor Wrestling Bones nVarietyBishop BlairJim RaleyHealing Touch MinistriesRabbi Messer VarietyGaitherVarietyMarye AnglinVarietytKingKingTwo/Half MenTwo/Half MenWhite Collar All In White Collar Taking Account EngagementEngagementFriends Friends bCollege Football Teams TBA. College ExtraCollege Football Teams TBA. (N) (Live) FOX 35 News at 10 (N) Natalies RoseWithout Res.Gaither: Precious MemoriesIn Touch W/Charles StanleyHour Of Power with BobbyBilly Graham Classic CrusadesAngel in the House (V)Law & Order: Criminal IntentLaw & Order: Criminal IntentLaw & Order: Criminal IntentLaw & Order: Criminal IntentLaw & Order: Cr iminal IntentLaw & Order: Criminal IntentGlee The Quarterback Glee A Katy or a Gaga Burn Notice Burn Notice Eye for an Eye The Closer The Life TBATBACABLE CHANNELSA&ECriminal Minds Coda Criminal Minds (DVS) Criminal Minds Valhalla Criminal Minds Lauren Criminal Minds (DVS) To Be AnnouncedAMCTombstone (1993, Western) Kurt Russell, Val Kilmer, Michael Biehn. (V) Hell on Wheels (N) TURN: Washingtons SpiesHell on Wheels ANPLPit Bulls and Parolees Pit Bulls and Parolees Pit Bulls and Parolees Pit Bulls and Parolees (N) Pit Bulls and ParoleesPit Bulls AftershowBET(4:30) Are We There Yet?Seven Pounds (2008) Will Smith. Premiere. A man changes the lives of seven strangers. The Janky Promoters (2009) Ice Cube, Mike Epps. (V)BRAVOMovie Movie MovieCNBCPaid ProgramPaid ProgramTo Be Announced To Be Announced The Suze Orman Show American Greed American GreedCNNCNN Newsroom (N) NewsroomCNN SpotlightAnthony Bourdain PartsAnthony Bourdain PartsThis Is Life With Lisa LingAnthony Bourdain PartsCOMBubble BoyGabriel Iglesias: Im Not FatGabriel Iglesias: Hot and FluffyGabriel Iglesias: Aloha Fluffy Kevin Hart: Grown Little ManKevin Hart: Laugh at My PainDSCNaked and Afraid Naked and Afraid Naked and Afraid Naked and Afraid Naked and Afraid (N) Naked and Afraid E!(5:30) The Women (2008) Meg Ryan, Annette Bening. (V)The Wedding Planner (2001) Jennifer Lopez, Matthew McConaughey. (V)Maid in Manhattan (2002) Jennifer Lopez.ESPNNASCARScoreCollege Football Teams TBA. (N) (Live) ScoreCollege Football Teams TBA. (N) (Live)ESPN2FootballScoreCollege Football ScoreboardCollege Football Teams TBA. (N) (Live) SportsCenter (N) (Live) FAMThe Princess Bride (1987) Cary Elwes, Robin Wright. (V)The Sandlot (1993, Comedy-Drama) Tom Guiry, Mike Vitar.Bedtime Stories (2008) Adam Sandler, Keri Russell. (V)FNCAmericas News HeadquartersFOX Report (N) Huckabee (N)Justice With Judge Jeanine (N)Geraldo at Large (N) Red EyeFOODChopped Wheatgrass Roots Diners, DriveDiners, DriveHalloween Wars Halloween Wars Halloween Wars Halloween Wars NightmaresFXMission: Imposs.-GhostMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyMike & MollyLouieLoui eGOLFGolf CentralEuropean PGA Tour Golf Golf Big Break Invitational, Day 2 Modified Stableford. LPGA Tour GolfHALLThe Lost Valentine (2011) Jennifer Love Hewitt. Cedar Cove (Season Finale) (N)Accidentally in Love (2010) Jennie Garth, Ethan Erickson. Cedar Cove HGTVHouse HuntersHunters IntlHouse HuntersHunters IntlProperty Brothers Property Brothers House Hunters Renovation (N)House HuntersHunters IntlHISTTo Be Announced Pawn StarsPawn StarsMovie To Be AnnouncedLIFEMovieRun for Your Life (2014) Amy Smart, Aislyn Watson. Premiere. The Assault (2014, Drama) Makenzie Vega, Khandi Alexander.MTVLegally Blonde (2001) Reese Witherspoon, Luke Wilson. (V) MTV SpecialRidiculousnessRidiculousnessRidiculousnessRidiculousnessNBCSNMLS Soccer Houston Dynamo at New York Red Bulls. (N) (Live) PremierEnglish Premier League Match of the Day MLS SoccerNICKNicky, RickyNicky, RickyHenry DangerHathawaysHenry DangerNicky, RickyThundermansAwesomenessFresh PrinceFresh PrinceHow I MetHow I MetSPIKECops Cops Cops Cops Cops (N) Cops Cops Cops Cops Cops Walking Tall (2004) (V)SUNBoxing 30BensingerNHL Hockey From Oct. 10, 2013. (Subject to Blackout) Top MomentsLightning PreInside the LightningIns. LightningTop MomentsSYFY(5:00) Resident Evil: ExtinctionThe Reaping (2007, Horror) Hilary Swank, David Morrissey.Dark Haul (2014) Tom Sizemore, Rick Ravanello. Premiere.Hellboy (2004) (V)TBSRush Hour 3 (2007, Action) Jackie Chan, Chris Tucker. (DVS)Big BangBig BangBig BangBig BangBig BangBig BangTower Heist (2011) (DVS)TCM(5:00) Lolita (1962) James Mason, Sue Lyon. (DVS)Twentieth Century (1934) John Barrymore. (V)The Lady Vanishes (1938) Margaret Lockwood. TLCTo Be Announced Untold Stories of the E.R.Untold Stories of the E.R.Secret Sex Lives Sex Sent Me to the E.R. TNT(4:15) Saving Private Ryan (1998, War) Tom Hanks. (V)Law Abiding Citizen (2009) Jamie Foxx. (DVS) (V)(:01) Inglourious Basterds (2009) Brad Pitt. (DVS) (V)TOONMarmaduke (2010) Voices of Owen Wilson. Premiere. (V)King of the HillKing of the HillAmerican DadAmerican DadBoondocksBoondocksFamily GuyAttack on TitanTRAVGhost Adventures Ghost Adventures Ghost Adventures Ghost Adventures The Dead Files The Dead Files TVLCosby ShowCosby ShowFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudFamily FeudLove-RaymondLove-RaymondFriends Friends USANCIS Directors contact is killed.NCIS A blind photographer.NCIS A murder victim in a taxi.NCIS Angel of Death NCIS Bury Your Dead NCIS Internal AffairsVH1Saturday Night Live Couples TherapyCouples Therapy Death TrapCouples TherapyCouples Therapy Called OutMovieWGN-ABones Blue Bloods Blue Bloods Blue Bloods Blue Bloods Blue Bloods PREMIUM CHANNELSDISNDog With BlogDog With BlogDog With BlogDog With BlogJessie Jessie Jessie Jessie Mighty MedKickin ItAustin & AllyAustin & AllyHBOFast & Furious 6 (2013, Action) Vin Diesel. PG-13 (V)(:15) Ride Along (2014) Ice Cube. Premiere. PG-13 (V)Jerrod Carmichael: LoveBoardwalk Empire CuantoMAX(5:15) The Legend of HerculesThe Counselor (2013) Michael Fassbender. R (V) The Knick Gravity (2013) Sandra Bullock. PG-13(:35) The KnickSHOWHomeland Game On Homeland The Yoga Play Homeland Still Positive Boxing ShoBox Special Edition. (N) (Live)TMC(5:30) The Warriors Way(:10) Exorcismus (2010) Sophie Vavasseur. NR (V) Nurse (2014) Paz de la Huerta. R (V)Office Killer (1997) Carol Kane. R (V) 10:30 a.m. on (FOOD)Trishas Southern KitchenIn the new episode All Things Miniature, Trisha and her friend Glenda try to incorporate their respective passions for miniature things and theme events as they plan a tea party. The resulting menu includes individually portioned creamy asparagus soup, followed by bitesized mini egg-salad sandwiches, mini stuffed peppers and mini monkey bread muffins, all served on miniature dishware.3:30 p.m. on (2) (8)College FootballTwo teams with bowl game aspirations clash today at South Bend, Ind., where the 11th-ranked Fighting Irish of Notre Dame play host to the No. 15 Stanford Cardinal. Senior quarterback Everett Golson leads a top-flight Irish offense that scored 79 points in its first two games. That will certainly test a stingy Cardinal defense that allowed just 13 points in its first two games.8 p.m. on (HALL)Cedar CoveFew relationships are left untested in the Season 2 finale, Resolutions and Revelations, in which Seths (Corey Sevier) tense return forces Justine (Sarah Smyth) to come clean about the future she has planned without him. Elsewhere, Olivia (Andie MacDowell) worries that she and Jack (Dylan Neal) are drifting apart, but Jack is more concerned that Eric (Tom Stevens) is trapped in an untenable business situation that could land him in jail.8 p.m. on (TCM)Movie: Twentieth CenturyBroadway director Oscar Jaffe (John Barrymore) has succeeded through sheer drive and talent, regardless of the fact that he is also a complete ham. When one of his discoveries, Lily Garland (Carole Lombard), leaves his show for Hollywood, his career hits the skids. A chance meeting on a train gives him the idea to re-sign his former star to regain glory. SATURDAYS BEST BETS Everett Golson 26 TV Week September 28 October 4, 2014 PAGE 27 SUNDAY EARLY MORNING SEP. 2812:0012:301:001:302:002:303:003:304:004:305:005:30LOCAL BROADCAST CHANNELS(11:29) Saturday Night Live (:02) 1st LookOpen House NYCOpen House NYCCars.TV Entertainers: With Byron Allen HouseCallsBlack EnterpriseWESH 2 News Early Sunrise Weekend(11:00) American Masters NOVA Scientists work to keep data safe.POV Koch Three-term New York Mayor Ed Koch. Katmai: AlaskaSecrets of the Dead (DVS) America After Ferguson MI-5 NOVA Scientists work to keep data safe.POV Koch Three-term New York Mayor Ed Koch. Katmai: AlaskaSecrets of the Dead (DVS) America After Ferguson (:05) The Insider (N)Gus Bradley Show(:05) Motion(:35) Paid Program(:05) Paid ProgramPaid ProgramEZ CleaningNew TV Offer!Paid ProgramPaid ProgramGrowing BolderGrowing Bolder(11:29) Saturday Night Live (:02) Paid Program(:32) Paid Program(:02) 1st LookOpen House NYCOpen House NYCPaid ProgramAnimal AdventuresAnti-AgingExtra (N) (:05) Hot TopicsThe Good Wife Conjugal Castle The Human Factor Forensic FilesConspiracyRightThisMinute (N)Forensic FilesMissing (N) Eyewitness News Daybreak Sunday (N)(:05) Paid Program(:35) Paid Program(:05) Paid Program(:35) Paid Program(:05) Paid Program(:35) Paid ProgramBest Pressure Cooker! Laura McKenziePaid ProgramInside EditionPaid ProgramAnimation Domination High-Def TMZ (N) Paid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramEZ CleaningGraham BensingerBonnie and Clyde (1967, Crime Drama) Warren Beatty, Faye Dunaway. (V)No Way Out (1987, Suspense) Kevin Costner, Gene Hackman, Sean Young.Secrets of Her Majestys Secret ServiceConnect EnglishBarefoot College(10:30) Armed and Dangerous (1986)Cheaters (N) Jerry Springer Family Fistfight Leverage The Hot Potato Job Paid ProgramPaid ProgramLarry King ReportsWealth-TradingScandal Hell Hath No Fury The Closer A shooting leaves one dead.Comedy.TV Entertainers: With Byron Allen Entertainment Tonight (N) On the Money (N) HomeownerI Want to Be a Part of The Soul PurposeTime of RefreshingTV One LifeMXTV CTN SpecialChristian Worship Hour Gaither Homecoming Hour Infinity Hall Live Joan Osborne performs.NOVA Scientists work to keep data safe.POV Koch Three-term New York Mayor Ed Koch. Katmai: AlaskaSecrets of the Dead (DVS) America After Ferguson Seinfeld Seinfeld Forensic FilesForensic FilesConspiracyPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid Program(:05) Scandal Hell Hath No Fury (:05) Castle Always (:05) Entertainers: With Byron Allen(:05) Paid ProgramPaid ProgramPaid ProgramPaid ProgramRightThisMinute (N) RightThisMinute (N)rThe City of Your Final DestinationCheaters (N) Jerry Springer Family Fistfight Armed and Dangerous (1986) (V)Paid ProgramPaid ProgramLarry King Spc.Paid ProgramfAnimation Domination High-Def Paid ProgramWrinkle-Free Face!Paid ProgramPaid ProgramFREE TV!Larry King ReportsPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramName GameEntertainment Tonight (N) Community Futurama The Jorge ShowFuturama Ring of Honor Wrestling Paid ProgramPaid ProgramnChanging Your The Brody FileVariety Variety Variety Variety Variety Variety Camp Meeting Ministry, live worship.tPaid ProgramThe Game PlaneQ With JianBuck McNeelyComedy.TV Paid ProgramPaid ProgramThrow Out Your Makeup! Wen Hair NEW Special TV Offer!bAnimation Domination High-Def Burn Notice An extraction mission. Paid ProgramPaid ProgramPaid ProgramPaid ProgramFast Joint ReliefPaid ProgramPaid ProgramPaid ProgramBehind ScenesLast Flight Out (2003, Drama) Richard Tyson, Bobbie Phillips.The Indestructible Book 40 Years of Gods Miracles Miracles over the past 40 years.Solomon and Sheba (1959) (V)Law & Order: Criminal Intent Flashpoint Never Let You Down Flashpoint The Farm (DVS) Paid ProgramPaid ProgramInspiration Today Camp MeetingThe Office To Be AnnouncedPaid ProgramPaid ProgramSexy Face atWealth-TradingBarefoot CleanPaid ProgramWealth-TradingPaid ProgramFast Joint ReliefPaid ProgramCABLE CHANNELSA&E(:01) Criminal Minds Corazon (:01) Criminal Minds (:01) Criminal Minds Sense Memory (:02) Criminal Minds Today I Do (:02) Paid ProgramPaid ProgramPaid ProgramPaid ProgramAMCThe Fugitive (1993, Suspense) Harrison Ford. An innocent man must evade the law as he pursues a killer. (V)Hell on Wheels CSI: Miami Cheating Death CSI: Miami Gone Baby Gone ANPL(:04) Pit Bulls & Parolees: Unchained(:05) Pit Bulls and Parolees(:06) Pit Bulls and Parolees Fatal Attractions: Intervention Infested! A woman is bitten by a spider.Monsters Inside Me BET(10:30) Diary of a Mad Black Woman (V)Scandal More Cattle, Less Bull Scandal Olivia faces a difficult decision.The Game The Game Rev. Peter PopoffBET InspirationBRAVO(10:30) Movie Million Dollar Listing: Los AngelesMillion Dollar Listing: Los AngelesMillion Dollar Listing: Los AngelesPaid Prog ramPaid ProgramPaid ProgramLast LongerCNBCThe Suze Orman Show American Greed Paid ProgramPaid ProgramThe Suze Orman Show The Suze Orman Show The Suze Orman Show CNNAnthony Bourdain Parts UnknownAnthony Bourdain Parts UnknownAnthony Bourdain Parts UnknownCNNI Simulcast CNNI Simulcast CNNI Simu lcastCOM(11:51) Chris Rock: Bigger & Blacker (:27) Katt Williams: Kattpacalypse Katt Williams: The Pimp Chronicles Pt. 1(:28) Chris Rock: Bigger & Blacker Paid ProgramPaid ProgramDSCStreet Outlaws (:05) Last Tiger Standing Street Outlaws Rev. Peter PopoffPaid ProgramNever FearPaid ProgramPaid ProgramPaid ProgramE!Scary Movie 3Total Divas Roadside Rumble Keeping Up With the KardashiansKeeping Up With the KardashiansThe SoupPaid ProgramPaid ProgramPaid ProgramPaid ProgramESPN(10:30) College Football Oregon State at USC. (N) (Live) SportsCenter (N) (Live) College Football Scoreboard (N) NFL Matchup (N) College Football Teams TBA. ESPN2SportsCenter (N) (Live) SportsCenter (N) College Football Scoreboard (N) Baseball Tonight (N) (Live) NHRA Drag Racing College Football Teams TBA. FAMCant Buy Me Love (1987, Comedy) Patrick Dempsey, Amanda Peterson. (V)Paid ProgramPaid ProgramPaid ProgramDisney VacationsPaid ProgramPaid ProgramPaid ProgramZ. Levitt PresentsFNCJustice With Judge JeanineGeraldo at Large Red Eye Huckabee Justice With Judge JeanineHuckabeeFOODGuys Grocery Games Guys Grocery Games Guys Grocery Games Guys Grocery Games Cart to Table Paid ProgramPaid ProgramPaid ProgramPaid ProgramFXMike & Molly Mike & Molly Mike & Molly Mike & Molly Louie Louie remembers his past. Louie (Part 2 of 2) Archer Archer Two and Half MenPaid ProgramPaid ProgramGOLF(8:00) 2014 Ryder Cup Day Two. Live From the Ryder Cup Ryder Cup coverage from Gleneagles in Scotland. PGA Tour Golf Champions: Nature Valley First Tee Open, Second Round. Live From the Ryder Cup (N) (Live)HALLThe Golden GirlsThe Golden GirlsThe Golden GirlsThe Golden GirlsFrasier Frasier Bla-Z-BoyFrasier Frasier Cheers Cheers I Love Lucy I Love Lucy HGTVProperty Brothers Nadine & Greg House Hunters Renovation House HuntersHunters IntlProperty Brothers Paid ProgramPaid ProgramPaid ProgramPaid ProgramHIST(:01) Pawn Stars(:31) Pawn Stars(:01) Pawn Stars(:31) Pawn Stars(:01) Pawn Stars(:32) Pawn Stars(:04) Pawn Stars(:33) Pawn Star s(:02) Paid ProgramKnife Paid ProgramPaid ProgramLIFE(:02) Hocus Pocus (1993, Comedy) Bette Midler, Sarah Jessica Parker. (:02) Hocus Pocus (1993, Comedy) Bette Midler, Sarah Jessica Parker. Old ChristineOld ChristineTummy TuckPaid ProgramMTVHarold & Kumar Go to White Castle (2004, Comedy) John Cho, Kal Penn. (V)Guy CodeGuy CodeGuy CodeGuy CodeGirl CodeGirl CodeGirl CodeGirl CodeNBCSNPremier League Match of the DayEnglish Premier League Soccer (Taped) Paid ProgramPaid ProgramPaid ProgramPaid ProgramReal RecoveryPaid ProgramNICK(:12) How I Met Your Mother How I Met/Mother(:24) Friends Friends (:36) George Lopez(:12) George Lopez George Lopez(:24) George LopezThat s ShowThat s ShowSPIKE(11:30) The Rundown (2003, Adventure) The Rock, Seann William Scott. (V)The Marine (2006, Action) John Cena. Thugs kidnap the wife of a soldier. (V)Paid ProgramKnife Grave DiggersNo DefrostingSUNMLB Baseball Tampa Bay Rays at Cleveland Indians. Arthritis PainMake LovePaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramPaid ProgramSYFY(11:30) Interview With the Vampire: The Vampire Chronicles (1994, Horror)30 Days of Night (2007, Horror) Josh Hartnett. Hungry vampires descend on an Alaskan town. Friday the 13th: The Series BedazzledThe Twilight ZoneTBS(11:00) Hitch (2005) Will Smith. (DVS) (V)My Babys Daddy (2004, Comedy) Eddie Griffin. (V) TBS PreviewMarried... WithMarried... WithMarried... WithJeff FoxworthyMarried... WithTCMAuntie Mame (1958, Comedy) Rosalind Russell, Forrest Tucker, Coral Browne. (V)Darktown Strutters (1975) Trina Parks, Roger E. Mosley.(:15) Sweet Jesus, Preacher Man (1973) Roger E. Mosley, William Smith.TLC(:03) 19 Kids and Counting (:04) 19 Kids and Counting (:02) Extreme Cheapskates Rev. Peter PopoffWeight Loss 2.0Paid ProgramNever FearPaid ProgramPaid ProgramTNT(:02) Minority Report (2002) Tom Cruise, Colin Farrell. A cop tries to establish his innocence in a future crime. (V)(:02) Daredevil (2003) Ben Affleck. A blind attorney fights crime at night. Law & Order Legacy (DVS)TOONBleach (N) Space Dandy (N)Naruto: ShippudenOne Piece Gurren LagannBeware the BatmanHellsing Ultimate Hellsing IIIFullmetal AlchemistCowboy BebopStar Wars: CloneSamurai JackTRAVGhost Adventures The Dead Files The Dead Files Ghost Adventures Excalibur NightclubDisney VacationsPaid ProgramPaid ProgramPaid ProgramTVL(:12) Everybody Loves Raymond Love-RaymondLove-RaymondThrees CompanyThrees CompanyThrees CompanyThrees CompanyThrees CompanyThrees CompanyThrees Compa nyThrees CompanyUSALaw & Order: Special Victims UnitLaw & Order: Special Victims UnitWWE A.M. Raw (N) House A deaf 14-year-old collapses. House Under My Skin House Both Sides Now VH1Couples TherapyDating Naked Lost EpisodeI Heart Nick Carter(:05) Rock Star (2001, Drama) Mark Wahlberg, Jennifer Aniston. A singer lands a gig with his heavy-metal heroes. (4:50) Couples TherapyWGN-ABlue Bloods Danny shoots a cop. Blue Bloods Critical Condition Rules/EngagementRules/EngagementParks/RecreatDistrict 9 (2009, Science Fiction) Sharlto Copley, Jason Cope, David James. (V)PREMIUM CHANNELSDISNA.N.T. Farm Girl Meets WorldDog With a BlogLiv & Maddie Jessie Go Figure (2005, Drama) Jordan Hinson. Suite Life on DeckSuite Life on DeckPhineas and FerbPhineas and FerbHBO(11:00) Riddick (2013) Vin Diesel.Identity Thief (2013) Jason Bateman. A victim of identity theft fights back. R (V)Fight Game(:25) Closed Circuit (2013, Suspense) Eric Bana. R (:05) Witness (Subtitled-English) MAXThe Knick (:45) Grudge Match (2013, Comedy) Robert De Niro, Kevin Hart. PG-13 (:40) Stacked Racks From Mars (2014) Erika Jordan. NR(:10) Lake Mungo (2008) Talia Zucker. Premiere. R (V) (:40) MAX on SetSHOW(11:00) Adult World(:35) Ray Donovan Rodef (:35) Masters of Sex(:45) City of God (2002) Matheus Nachtergaele. Two young Cariocas deal drugs, kill and steal. RStreetDance 2 (2012) Tom Conti. NR (V)TMC(10:35) ScannersThe Brood (1979, Horror) Oliver Reed. R (V)(:05) Scanners (1981, Science Fiction) Stephen Lack, Jennifer ONeill. R Soul Plane (2004, Comedy) Kevin Hart. R (V) Nobody Walks R September 28 October 4, 2014 TV Week 27 PAGE 28 AACCEPTED Justin Long. A college reject and his friends create a fake university. (2:00) (FAM) Thu. 12 a.m. THE ADVENTURES OF PRINCE ACHMED Silent. Animated. A prince has many adventures. (1:15) (TCM) Wed. 6 a.m. THE AFRICAN QUEEN Humphrey Bogart. A spinster and a sailor try to destroy a WWI German gunboat. (CC) (2:00) (TCM) Fri. 8 p.m. AGENT CODY BANKS 2: DESTINATION LONDON Frankie Muniz. Un agente de la CIA debe recuperar un programa computacional robado. (2:00) (43) Sun. 8 a.m. ALIENS Sigourney Weaver. Space Marines battle an army of deadly monsters. (3:00) (AMC) Sun. 9 a.m.; Tue. 2:45 a.m., 11 a.m. THE AMAZING SPIDER-MAN Andrew Garfield. Peter Parker investigates his parents disappearance. (3:00) (FX) Sun. 4 p.m. AN AMERICAN IN PARIS Gene Kelly. A GI stays in Paris to paint and falls in love with a young woman. (2:00) (16) Sat. 9 p.m. AMERICAN REUNION Jason Biggs. The gang from American Pie has a high-school reunion. (2:30) (FX) Mon. 8 p.m., 10:30 p.m. APOLLO 13 Tom Hanks. Based on the true story of the ill-fated 1970 moon mission. (CC) (3:00) (AMC) Thu. 5 p.m.; Fri. 9:15 a.m. ARE WE THERE YET? Ice Cube. A divorcees two children torment a man on a road trip. (CC) (2:30) (BET) Fri. 7 p.m.; Sat. 4:30 p.m. AT THE CIRCUS Groucho Marx. Two circus employees scheme to save a bankrupt big top. (CC) (1:30) (TCM) Fri. 11 a.m.BBABYS DAY OUT Joe Mantegna. Un beb secuestrado origina una persecucin increble. (SS) (2:00) (43) Sun. 10 a.m. BACKDRAFT Kurt Russell. Chicago firefighters work overtime to stop a mad arsonist. (3:00) (WGN-A) Fri. 8 p.m. BARBARY COAST GENT Wallace Beery. A con artist becomes a Robin Hood before he is incarcerated. (1:30) (TCM) Mon. 10:45 a.m. BARBERSHOP Ice Cube. A barbershop owner considers selling his establishment. (CC) (2:30) (BET) Tue. 7 p.m.; Wed. 11 a.m. BARBERSHOP 2: BACK IN BUSINESS Ice Cube. A barbershop owner considers selling his establishment. (CC) (2:30) (BET) Wed. 7 p.m.; Thu. 11 a.m. BARCELONA Taylor Nichols. Two American cousins pursue life and love in Spain. (2:00) (TCM) Sun. 10 p.m. BATTLE: LOS ANGELES Aaron Eckhart. U.S. Marine troops fight off alien invaders. (CC) (DVS) (2:31) (TNT) Sun. 8 p.m., 10:31 p.m. BEAT THE DEVIL Humphrey Bogart. Absurd uranium-seekers meet in Italy and on a boat to Africa. (CC) (2:00) (TCM) Sat. 12 a.m. BEDTIME STORIES Adam Sandler. A handymans tall tales begin to come true. (2:00) (FAM) Sat. 10 p.m. BEYOND TOMORROW Richard Carlson. Three spirits return at Christmas to mend a broken romance. (1:30) (TCM) Fri. 4:30 a.m. THE BIG STORE The Marx Brothers. The Marx Brothers turn out to be poor store detectives. (CC) (1:30) (TCM) Thu. 1:30 p.m. BLACK MASK Jet Li. Un dcil bibliotecario es en realidad un poderoso luchador. (SS) (2:00) (43) Sat. 1 p.m. THE BLIND SIDE Sandra Bullock. A well-to-do white couple adopts a homeless black teen. (3:00) (FAM) Sun. 8:30 p.m. BODY OF LIES Leonardo DiCaprio. Agente de CIA planea infiltrarse en cadena de un terrorista. (SS) (2:30) (43) Sat. 3 p.m. THE BOOK OF ELI Denzel Washington. A lone warrior carries hope across a post-apocalyptic wasteland. (CC) (DVS) (2:30) (TNT) Wed. 6:30 p.m. saloon singer. (CC) (2:00) (TCM) Sun. 2 p.m.CCANT BUY ME LOVE Patrick Dempsey. A desperate nerd hires a girl to pose as his girlfriend. (2:00) (FAM) Sun. 11:30 a.m. A CANTERBURY TALE Eric Portman. U.S. soldier, British sergeant and girl see minor miracles. (2:15) (TCM) Sun. 6 a.m. THE CANTERVILLE GHOST Charles Laughton. GI billets in castle haunted by cowardly ghost. (CC) (1:45) (TCM) Thu. 11:30 p.m. CASABLANCA Humphrey Bogart. Nazis, intrigue and romance clash at a Moroccan nightclub. (CC) (DVS) (2:00) (TCM) Sat. 2 a.m. CIRCUS CLOWN Joe E. Brown. Country boy falls for female impersonator, joins circus. (CC) (1:15) (TCM) Fri. 8:30 a.m. CIRQUE DU FREAK: THE VAMPIRES ASSISTANT John C. Reilly. A sideshow vampire turns a teenager into one of the undead. (CC) (2:00) (USA) Sat. 2 a.m. CLAIRES KNEE Jean-Claude Brialy. A diplomat is obsessed with part of a ladys anatomy. (2:00) (TCM) Mon. 2:30 a.m. CLAWS OF STEEL Lin-kit Lee. Un experto en las artes marciales ataca una red de esclavos. (SS) (2:00) (43) Mon. 8 p.m.; Tue. 2 p.m. THE COBWEB Richard Widmark. Psychiatric clinic director handles crisis over new curtains. (CC) (2:15) (TCM) Sat. 8 a.m. THE COCKEYED MIRACLE Frank Morgan. A ghostly spirit returns to look after his family. (1:30) (TCM) Fri. 3 a.m. COUNT YOUR BLESSINGS Deborah Kerr. An Englishwoman waits for her husband, a French soldier. (CC) (1:45) (TCM) Tue. 2 p.m.DDAREDEVIL Ben Affleck. Abogado invidente lucha contra el crimen por las noches. (SS) (2:00) (43) Mon. 2 p.m. DARK PASSAGE Humphrey Bogart. Art student hides escaped convict after his plastic surgery. (CC) (DVS) (2:00) (TCM) Sat. 6 a.m. DIARY OF A MAD BLACK WOMAN Kimberly Elise. A woman starts over after her husband leaves her. (CC) (2:30) (BET) Sun. 7 p.m. DIRTY DANCING Jennifer Grey. A sheltered teen falls for a street-wise dance instructor. (2:30) (FAM) Sun. 6 p.m. DIRTY DANCING: HAVANA NIGHTS Diego Luna. Love blossoms between a Cuban and an American teen. (2:00) (FAM) Sun. 4 p.m.; Mon. 7 p.m. THE DOCTOR AND THE GIRL Glenn Ford. A doctor disapproves of his sons choice for a wife. (CC) (1:45) (TCM) Thu. 8:15 a.m. DR. KILDARES CRISIS Lew Ayres. Kildare finds that his fiancees brother may have epilepsy. (CC) (1:30) (TCM) Sat. 10:30 a.m. DOCTORS ORDERS Leslie Fuller. A traveling medical mans only son gets his medical degree. (CC) (:30) (TCM) Mon. 6 a.m. DODGE CITY Errol Flynn. Cattleman dons badge, cleans up Dodge City. (CC) (2:00) (TCM) Mon. 8 p.m. DOUBLE DYNAMITE Frank Sinatra. Bank tellers gain is loss on his teller girlfriends shift. (CC) (1:30) (TCM) Thu. 3 p.m. DUE DATE Robert Downey Jr.. A high-strung man takes a road trip with an annoying stranger. (DVS) (2:00) (TBS) Tue. 9 a.m.EEDWARD, MY SON Spencer Tracy. A businessman tries to shield his crooked son. (CC) (2:00) (TCM) Tue. 10:30 a.m. E.T. THE EXTRA-TERRESTRIAL Henry Thomas. A California boy befriends a homesick alien. (3:00) (WGN-A) Tue. 8 p.m.FFACE/OFF John Travolta. An FBI agent and a violent terrorist switch identities. (CC) (3:15) (A&E) Sun. 12 p.m. FARGO Frances McDormand. An overextended salesman hires goons MOVIES2 x 2 ad miraculous thrift store Crossword Solution from puzzle on page 9 Suduko Solution from puzzle on page 16Client will ll 2 x 5 ad house ad BORN RECKLESS Mamie Van Doren. A woman and a rodeo rider team up in more ways than one. (CC) (1:30) (TCM) Sun. 12:30 p.m. THE BREAKFAST CLUB Emilio Estevez. Five teenagers make strides toward mutual understanding. (CC) (2:15) (AMC) Thu. 12:30 a.m., 12:15 p.m. THE BUCKET LIST Jack Nicholson. Dying men make a list of things to do before they expire. (CC) (2:01) (AMC) Wed. 8 p.m.; Thu. 2:45 a.m. BUS STOP Marilyn Monroe. A lovestruck cowboy pursues a vulnerable THE CHANGE-UP Ryan Reynolds. An overworked lawyer and his carefree buddy switch bodies. (DVS) (2:00) (TBS) Mon. 9 a.m. THE CHOSEN Robby Benson. Sons of Zionist and rabbi are friends in 1940s Brooklyn. (CC) (:45) (TCM) Wed. 3:15 a.m. A CINDERELLA STORY Hilary Duff. A teenager meets a high-school quarterback online. (2:00) (FAM) Fri. 12 a.m., 4:30 p.m. THE CIRCUS Charlie Chaplin. Silent. A handyman gets to perform under the big top. (1:15) (TCM) Fri. 6 a.m. 28 TV Week September 28 October 4, 2014 Sudoku solution from puzzle on page 16.: PAGE 29 full page ad orida heart & vascular September 28 October 4, 2014 TV Week 29 PAGE 30 to kidnap his wife. (2:00) (18) Sun. 4 p.m. THE FAST AND THE FURIOUS Vin Diesel. An undercover cop infiltrates the world of street racing. (2:30) (SPIKE) Thu. 12:30 p.m., 8 p.m. THE FASTEST GUITAR ALIVE Roy Orbison. Rebel spies rob a mint, then learn that Lee surrendered. (1:30) (TCM) Sun. 3:30 a.m. FATHER TAKES A WALK Paul Graetz. Old London store owner walks away from it all. (1:30) (TCM) Mon. 3 p.m. FINAL DESTINATION 3 Mary Elizabeth Winstead. Death stalks young survivors of a horrible roller-coaster accident. (CC) (2:00) (TBS) Tue. 2 a.m. FIXER DUGAN Lee Tracy. Circus trouble-shooter flirts with lion tamer between shows. (1:15) (TCM) Fri. 9:45 a.m. FOOLPROOF Ryan Reynolds. Un criminal chantajea a unos jvenes que planean un robo. (SS) (2:00) (43) Sun. 8 p.m. FOOLS RUSH IN Matthew Perry. Pregnancy pushes one-shot lovers into a difficult marriage. (CC) (2:00) (32) Sun. 3 p.m. John Cusack. A skeptical author spends a night in a reputedly haunted hotel room. (2:00) (TBS) Thu. 2 a.m. FREEDOMLAND Samuel L. Jackson. A detective searches for the truth behind a boys abduction. (2:30) (FX) Tue. 11:30 a.m.; Wed. 8 a.m.GTHE GAME PLAN Dwayne The Rock Johnson. A carefree football player learns he has a daughter. (CC) (2:00) (USA) Sun. 12 a.m. GANGS OF NEW YORK Leonardo DiCaprio. A man vows vengeance on the gangster who killed his father. (3:30) (BRAVO) Fri. 2:30 p.m.; Sat. 12 a.m. GET SMART Steve Carell. Agent Maxwell Smart battles the KAOS crime syndicate. (2:00) (TBS) Fri. 9 a.m.; Sat. 1:30 a.m. GHOST Patrick Swayze. A murder victim returns to save his beloved fiancee. (CC) (3:00) (AMC) Wed. 5 p.m.; Thu. 9:15 a.m. GHOSTBUSTERS Bill Murray. Ghost fighters battle ghouls in a Manhattan high-rise. (CC) (2:30) (AMC) Sun. 12 p.m. GHOSTBUSTERS Bill Murray. Ghost fighters battle ghouls in a Manhattan high-rise. (2:30) (AMC) Mon. 9:45 a.m. GHOSTBUSTERS II Bill Murray. A long-dead Carpathian warlock attempts to return to Earth. (CC) (2:30) (AMC) Sun. 2:30 p.m. A GIRL IN EVERY PORT Groucho Marx. Trouble-prone sailors hide two racehorses on their ship. (CC) (1:30) (TCM) Thu. 4:30 p.m. GLADIATOR Russell Crowe. A fugitive general becomes a gladiator in ancient Rome. (CC) (3:15) (A&E) Sun. 3:15 p.m. GO WEST Groucho Marx. A madcap trio acquires property wanted by the railroad. (CC) (1:30) (TCM) Thu. 12 p.m. GODZILLA Matthew Broderick. Nuclear testing in the South Pacific produces a giant mutated lizard. (CC) (3:00) (AMC) Wed. 2 p.m. GONE WITH THE WIND Clark Gable. Civil War rogue Rhett Butler loves Southern belle Scarlett OHara. (CC) (4:00) (TCM) Mon. 10 p.m. GOOD MORNING, VIETNAM Robin Williams. Airman Adrian Cronauer, DJ in 1965 Saigon. (CC) (2:30) (AMC) Wed. 9 a.m. THE GREATEST GAME EVER PLAYED Shia LaBeouf. An underdog plays a champion golfer at the 1913 U.S. Open. (2:30) (GOLF) Mon. 9 p.m.; Tue. 12 a.m. GREEN FOR DANGER Alastair Sim. A murderer stalks the corridors of a hospital. (CC) (1:45) (TCM) Sun. 8:15 a.m.HHEARTS OF THE WEST Jeff Bridges. Pulp writer turns stuntman in s Hollywood. (2:00) (TCM) Wed. 1:15 a.m. HENRY V Laurence Olivier. Shakespeares king attacks France. (2:30) (TCM) Sun. 10 a.m. HILLS OF HOME Edmund Gwenn. A Scottish doctor tries to cure Lassies fear of water. (CC) (1:45) (TCM) Thu. 2:15 a.m. HITCH Will Smith. A smoothtalker helps a shy accountant woo an run in 2019. (CC) (DVS) (3:00) (TNT) Mon. 1:02 a.m. IT HAPPENED ONE NIGHT Claudette Colbert. A newspaperman shields a runaway heiress from her father. (CC) (2:00) (TCM) Sun. 6 p.m.JJURASSIC PARK Sam Neill. Cloned dinosaurs run amok at an island-jungle theme park. (CC) (3:00) (AMC) Mon. 7 p.m. JURASSIC PARK Sam Neill. Cloned dinosaurs run amok at an island-jungle theme park. (3:00) (AMC) Tue. 2 p.m. JURASSIC PARK III Sam Neill. A search party encounters new breeds of prehistoric terror. (2:00) (AMC) Tue. 8 p.m.; Wed. 12 a.m. JUST WRIGHT Queen Latifah. A physical therapist falls in love with her patient. (CC) (3:00) (BET) Sun. 1:30 p.m.KKISMET Howard Keel. A Baghdad beggar-poet helps his daughter woo a caliph. (CC) (2:00) (TCM) Wed. 2 p.m. KNIGHT AND DAY Tom Cruise. A woman becomes the reluctant partner of a fugitive spy. (2:30) (FX) Sat. 11 a.m. the Civil War. (CC) (DVS) (2:15) (TCM) Thu. 12 a.m. LOLITA James Mason. A middle-aged professor becomes smitten with a 12-year-old. (CC) (DVS) (3:00) (TCM) Sat. 5 p.m. THE LONGSHOTS Ice Cube. A girl becomes a Pop Warner quarterback. (CC) (2:00) (BET) Fri. 2 p.m.; Sat. 2 p.m. THE LOST VALENTINE Jennifer Love Hewitt. A reporter seeks the truth about a World War II pilot. (CC) (2:00) (HALL) Sat. 6 p.m. THE LOST WORLD: JURASSIC PARK Jeff Goldblum. An expedition returns to monitor dinosaurs progress. (3:00) (AMC) Mon. 10 p.m. THE LOST WORLD: JURASSIC PARK Jeff Goldblum. An expedition returns to monitor dinosaurs progress. (CC) (3:00) (AMC) Tue. 5 p.m. LOTTERY TICKET Bow Wow. A young man wins a multimillion-dollar prize. (CC) (2:00) (TBS) Mon. 2:30 a.m. THE LUCKY ONE Zac Efron. A war vet looks for the woman he believes brought him luck. (2:00) (FAM) Wed. 9 p.m.; Thu. 6:30 p.m.MMALIBUS MOST WANTED Jamie Kennedy. A rapper jeopardizes his fathers bid to become governor. (CC) (2:30) (BET) Mon. 9:30 p.m.; Tue. 1:30 p.m. MAMMA MIA! Meryl Streep. A single hotelier prepares for her daughters wedding. (2:30) (FAM) Sun. 1:30 p.m. THE MAN WITH THE GOLDEN ARM Frank Sinatra. Dried-out heroin addict returns to wife and habit in Chicago. (2:00) (16) Sun. 2 a.m. MARRIAGE ON THE ROCKS Frank Sinatra. A quarreling couple gets divorced during a Mexican holiday. (CC) (2:00) (TCM) Tue. 6 p.m. MEAN GIRLS Lindsay Lohan. A teen becomes friends with three cruel schoolmates. (2:00) (FAM) Mon. 9 p.m.; Tue. 6:30 p.m. MEET THE BROWNS Tyler Perry. A woman meets her late fathers uproarious family for the first time. (CC) (2:30) (BET) Sun. 4:30 p.m. THE MERRY WIDOW Mae Murray. Silent. Ruritanian royals vie for a U.S. dancer. (2:30) (TCM) Mon. 12 a.m. THE MERRY WIDOW Maurice Chevalier. A king tries seducing a wealthy widow to save his country. (CC) (1:45) (TCM) Wed. 9:15 a.m. METROPOLITAN Carolyn Farina. A West Side loner gets a taste of the upper crust. (2:00) (TCM) Sun. 8 p.m. MISS CONGENIALITY Sandra Bullock. A clumsy FBI agent goes under cover at a beauty pageant. (2:00) (FAM) Tue. 12 a.m. MISSION: IMPOSSIBLE GHOST PROTOCOL Tom Cruise. Ethan Hunt goes off the grid after the IMF is shut down. (3:00) (FX) Sat. 4 p.m. MONKEY BUSINESS Cary Grant. A bumbling chemist learns how to reverse the aging process. (2:00) (16) Sun. 12 p.m. MONKEY BUSINESS Cary Grant. A bumbling chemist learns how to reverse the aging process. (CC) (2:00) (15) Sun. 2 p.m. MORE THAN A MIRACLE Sophia Loren. A Spanish prince chooses a peasant over his mothers princesses. (CC) (2:00) (TCM) Wed. 6 p.m. THE MUMMY Peter Cushing. A 3,000-year-old monstrosity stalks HOOK Dustin Hoffman. Lawyer turns into Peter Pan to save kids from Captain Hook. (3:00) (FAM) Sat. 3 p.m. HOUSE PARTY 2 Christopher Reid. Rappers try for college and quick cash. (CC) (2:30) (BET) Mon. 11 a.m. THE HUCKSTERS Clark Gable. A war veteran fights for business ethics on Madison Avenue. (CC) (2:00) (TCM) Tue. 8:30 a.m. THE HUNTING PARTY Richard Gere. Tres periodistas buscan a un criminal de guerra en Bosnia. (SS) (2:00) (43) Sat. 5:30 p.m.II AM LEGEND Will Smith. Bloodthirsty plague victims surround a lone survivor. (CC) (DVS) (2:00) (TNT) Sun. 3:30 p.m. I, ROBOT Will Smith. A homicide detective tracks a dangerous robot in 2035. (CC) (DVS) (2:30) (TNT) Wed. 4 p.m. IF WINTER COMES Walter Pidgeon. Writer befriends pregnant girl, loses wife and job. (CC) (2:00) (TCM) Wed. 10 p.m. IMMORTALS Henry Cavill. A stonemason revolts against a bloodthirsty king. (2:30) (FX) Tue. 7:30 p.m.; Wed. 10:30 a.m. THE IN-LAWS Michael Douglas. A CIA agent wreaks havoc on his future MOVIES3 x 3 ad house ad LTHE LADY VANISHES Margaret Lockwood. An elderly Englishwoman disappears from a moving train. (CC) (2:00) (TCM) Sat. 10 p.m. THE LADYKILLERS Tom Hanks. Five thieves try to kill an old woman. (CC) (2:00) (USA) Wed. 8 a.m. THE LAST SONG Miley Cyrus. A man tries to reconnect with his estranged daughter. (2:30) (FAM) Wed. 6:30 p.m. LAWS OF ATTRACTION Pierce Brosnan. Rival divorce attorneys fall in love. (CC) (2:00) (LIFE) Sun. 1 p.m. LIAR LIAR Jim Carrey. A fasttalking lawyer cannot tell a lie. (2:00) (FAM) Sat. 12 a.m., 11 a.m. THE LIFE OF THE PARTY Winnie Lightner. Two store clerks set their sights on a wealthy gentleman. (1:45) (TCM) Mon. 6:30 a.m. LITTLE WOMEN June Allyson. The March sisters experience life during heiress. (CC) (DVS) (2:15) (TBS) Sun. 5:45 p.m. HITMAN Timothy Olyphant. An assassin becomes embroiled in a political conspiracy. (1:58) (AMC) Mon. 3:04 a.m. HITMAN Timothy Olyphant. An assassin becomes embroiled in a political conspiracy. (CC) (2:00) (AMC) Mon. 12:15 p.m. HOCUS POCUS Bette Midler. Youths conjure up three child-hungry witches on Halloween. (CC) (2:00) (LIFE) Sun. 7 p.m., 11:02 p.m.; Mon. 8 p.m., 10 p.m.; Tue. 12:02 a.m., 2:02 a.m. HONEY, I BLEW UP THE KID Rick Moranis. The toddler of a wacky inventor grows as big as a casino. (2:00) (FAM) Sat. 9 a.m. HONEY, I SHRUNK THE KIDS Rick Moranis. An inventors ray gun makes his and his neighbors kids peasize. (2:00) (FAM) Sat. 7 a.m. in-law. (2:00) (18) Sun. 2 p.m. (44) Sun. 12 p.m. IN TOO DEEP Omar Epps. Un polica encubierto empieza a perder su verdadera identidad. (SS) (2:00) (43) Sun. 10 p.m. THE INFORMER Victor McLaglen. A slow-witted traitor doesnt understand his punishment. (CC) (2:00) (TCM) Tue. 2 a.m. INGLOURIOUS BASTERDS Brad Pitt. Soldiers seek Nazi scalps in German-occupied France. (CC) (DVS) (3:31) (TNT) Sat. 10:01 p.m.; Sun. 1:32 a.m. THE INVENTION OF LYING Ricky Gervais. A writer learns to lie for personal gain. (2:00) (FAM) Wed. 12 a.m. IRON MONKEY Rongguang Yu. A Chinese folk hero distributes stolen wealth to the poor. (CC) (2:00) (AMC) Sun. 4 a.m. THE ISLAND Ewan McGregor. A mercenary pursues two clones on the 30 TV Week September 28 October 4, 2014 PAGE 31 archaeologists. (CC) (1:45) (TCM) Sat. 12 p.m. THE MUMMY: TOMB OF THE DRAGON EMPEROR Brendan Fraser. A young archaeologist awakens a cursed Chinese emperor. (2:30) (FX) Thu. 8 a.m. MY PAST Bebe Daniels. A famous actress is trapped between two loves. (1:15) (TCM) Mon. 9:30 a.m.NNEVER BEEN KISSED Drew Barrymore. A reporter poses as a highschool student. (2:30) (FAM) Thu. 8:30 p.m.; Fri. 6:30 p.m. NO WAY OUT Kevin Costner. The Secretary of Defense makes a Pentagon aide lead a spy manhunt. (2:00) (5) Sun. 3 p.m. NOW, VOYAGER Bette Davis. A psychiatrist helps a Boston spinster, who finds a man. (CC) (DVS) (2:00) (TCM) Tue. 4 a.m.OONE SUNDAY AFTERNOON Gary Cooper. Dentist thinks he married the wrong woman. (1:30) (TCM) Thu. 6 p.m. OUR VINES HAVE TENDER GRAPES Edward G. Robinson. Residents of a small Wisconsin town share joys and sorrows. (CC) (2:00) (TCM) Fri. 4:15 p.m.PTHE PEACEKEEPER Dolph Lundgren. Un soldado debe impedir el lanzamiento de un misil nuclear. (SS) (2:00) (43) Sun. 12 p.m.; Mon. 2 a.m. PEARL HARBOR Ben Affleck. Best friends become fighter pilots and romantic rivals in 1941. (3:00) (BRAVO) Fri. 6 p.m., 9 p.m. PEEPING TOM Carl Boehm. A killer photographs the panic-stricken faces of his prey. (CC) (2:00) (TCM) Sat. 3 p.m. PENNY SERENADE Irene Dunne. A young couple decide to adopt a baby. (2:00) (16) Fri. 1 p.m.; Sun. 12 a.m. A PLACE OF ONES OWN Margaret Lockwood. A couple moves into a mansion, unaware of its history. (1:45) (TCM) Fri. 1:15 a.m. PLEASE BELIEVE ME Deborah Kerr. A recent heiress attracts the interest of three bachelors. (CC) (1:30) (TCM) Tue. 12:30 p.m. POLLY OF THE CIRCUS Clark Gable. A daring trapeze artist falls for a young clergyman. (CC) (1:15) (TCM) Fri. 7:15 a.m. THE PRINCE & ME Julia Stiles. A collegian and a Danish prince fall in love. (2:30) (FAM) Sun. 9 a.m. THE PRINCE AND THE SHOWGIRL Marilyn Monroe. Balkan prince courts Milwaukee chorus girl in 1911 London. (CC) (2:00) (TCM) Wed. 4 p.m. THE PRINCESS BRIDE Cary Elwes. A stableboy in disguise sets out to rescue his beloved. (2:00) (FAM) Fri. 9 p.m.; Sat. 6 p.m.QTHE QUICK AND THE DEAD Sharon Stone. A female gunslinger enters a deadly quick-draw competition. (CC) (2:30) (AMC) Sat. 3:30 p.m. try to nail a criminal. (2:30) (SPIKE) Thu. 3 p.m., 10:30 p.m. TWO GUYS FROM MILWAUKEE Dennis Morgan. A prince and a cab driver search for girls in Brooklyn. (CC) (1:45) (TCM) Wed. 12:15 p.m. TYLER PERRYS MADEA GOES TO JAIL Tyler Perry. Madea raises hell behind bars. (CC) (DVS) (2:15) (TBS) Sun. 10:15 p.m. TYLER PERRYS MADEAS BIG HAPPY FAMILY Tyler Perry. Madea takes charge when her niece receives a distressing diagnosis. (CC) (DVS) (2:15) (TBS) Sun. 8 p.m. TYLER PERRYS THE FAMILY THAT PREYS Kathy Bates. Greed and scandal test the mettle of two family matriarchs. (CC) (2:00) (TBS) Sun. 10:30 a.m.; Mon. 12:30 a.m.UUNCLE BUCK John Candy. An easygoing relative takes care of three children. (2:15) (AMC) Fri. 3:45 a.m. AN UNFINISHED LIFE Robert Redford. A Wyoming rancher shelters his abused daughter-in-law. (2:00) (FX) Mon. 7:30 a.m.; Tue. 1 a.m.VVACATION FROM MARRIAGE Robert Donat. An unhappy British couple serve in World War II and come out better. (CC) (1:45) (TCM) Tue. 6:45 a.m. VAN HELSING Hugh Jackman. A monster-hunter battles creatures in Transylvania. (CC) (3:00) (AMC) Fri. 8 p.m.; Sat. 1:30 a.m. VERTICAL LIMIT Chris ODonnell. Mountain climbers are trapped in an icy cave on K2. (CC) (2:45) (AMC) Fri. 1 a.m., 12:15 p.m. VOLCANO Tommy Lee Jones. Earthquakes and lava ravage Los Angeles. (CC) (2:30) (AMC) Fri. 11 p.m.WTHE WAGONS ROLL AT NIGHT Humphrey Bogart. A carnival owner considers killing his sisters new beau. (CC) (1:30) (TCM) Fri. 12:30 p.m. WALKING TALL The Rock. A sheriff and a deputy try to rid their town of thugs. (CC) (1:45) (AMC) Mon. 2:15 p.m.; Tue. 1 a.m., 9:15 a.m. WALKING TALL The Rock. A sheriff and a deputy try to rid their town of thugs. (2:00) (SPIKE) Sat. 11 p.m. THE WAY WE WERE Barbra Streisand. Political differences threaten a couples romance. (CC) (2:15) (TCM) Tue. 11 p.m. THE WIND AND THE LION Sean Connery. An American family is kidnapped by a Moroccan leader. (CC) (2:00) (TCM) Sat. 4 a.m. WITHOUT RESERVATIONS Claudette Colbert. Sparks fly when two Marines meet a traveling novelist. (CC) (2:00) (TCM) Sun. 12 a.m. WORDS AND MUSIC Mickey Rooney. The lives and music of Richard Rodgers and Lorenz Hart. (CC) (2:15) (TCM) Thu. 4 a.m.XXXX: STATE OF THE UNION Ice Cube. Agent XXX must thwart a plot to depose the president. (CC) (3:00) (BET) Thu. 7 p.m.; Fri. 11 a.m.YTHE YOUNG LIONS Marlon Brando. Two U.S. soldiers and a Nazi meet amid World War II inhumanity. (CC) (3:00) (TCM) Tue. 8 p.m. MOVIESRRENDITION Jake Gyllenhaal. Analista de la CIA observa un interrogatorio poco ortodoxo. (SS) (2:00) (43) Tue. 8 p.m.; Wed. 2 p.m. ROAD TO PERDITION Tom Hanks. A Depression-era mob enforcer and his son flee after a fatal betrayal. (CC) (2:30) (TNT) Sat. 1:45 p.m. THE ROMANCE OF ROSY RIDGE Van Johnson. A Missouri family scrutinizes their daughters new suitor. (CC) (2:00) (TCM) Wed. 8 p.m. ROOM SERVICE Groucho Marx. Penniless entertainers fake measles to stay at a hotel. (CC) (1:30) (TCM) Thu. 10:30 a.m. ROOSTER COGBURN John Wayne. A former deputy helps the daughter of a murdered minister. (CC) (2:30) (AMC) Sat. 10:30 a.m. THE RUNDOWN The Rock. A bounty hunter must find his boss son in the Amazon. (2:30) (SPIKE) Sun. 1 a.m.SSAHARA Humphrey Bogart. Nazi troops harass an Allied tank crew in the Sahara. (CC) (2:00) (TCM) Fri. 10 p.m. THE SANDLOT Tom Guiry. The new boy in town falls in with neighborhood ballplayers. (2:00) (FAM) Sat. 8 p.m. SAVING PRIVATE RYAN Tom Hanks. U.S. troops look for a missing comrade during World War II. (CC) (DVS) (3:45) (TNT) Sat. 4:15 p.m. THE SCHOOL OF ROCK Jack Black. An unemployed guitarist poses as a teacher. (CC) (2:29) (AMC) Wed. 10:01 p.m.; Thu. 2:30 p.m. SEE JANE DATE Charisma Carpenter. A single gal must find the perfect match to a made-up beau. (CC) (2:00) (HALL) Sat. 12 p.m. SERAPHIM FALLS Liam Neeson. A hunter and four gunmen relentlessly pursue an injured man. (CC) (2:30) (AMC) Sat. 1 p.m. FACES OF DR. LAO Tony Randall. A Chinese showmans appearances include Merlin, Pan and Medusa. (CC) (1:45) (TCM) Fri. 6:15 p.m. SEVEN POUNDS Will Smith. A man changes the lives of seven strangers. (CC) (3:00) (BET) Sat. 7 p.m. THE SHAWSHANK REDEMPTION Tim Robbins. An innocent man goes to a Maine penitentiary for life in 1947. (3:00) (AMC) Mon. 4 p.m. SHERLOCK HOLMES Robert Downey Jr.. The detective and his astute partner face a strange enemy. (CC) (DVS) (2:31) (TNT) Fri. 9 p.m.; Sat. 11 a.m. SHOOTER Mark Wahlberg. A wounded sniper plots revenge against those who betrayed him. (3:00) (SPIKE) Sun. 7 p.m., 10 p.m. SNOW WHITE AND THE HUNTSMAN Kristen Stewart. A huntsman sent to capture Snow White becomes her ally. (3:00) (FX) Sun. 7 p.m.; Mon. 5 p.m. THE SORCERERS APPRENTICE Nicolas Cage. A master wizard takes on a reluctant protege. (2:00) (FAM) Sat. 1 p.m. SOUL MEN Samuel L. Jackson. Estranged singers reunite for a tribute concert. (CC) (2:30) (BET) Wed. 1:30 p.m. SPIDER-MAN 2 Tobey Maguire. Peter Parker fights a man who has mechanical tentacles. (3:00) (FX) Sun. 10 a.m. private, puts on Army show. (CC) (2:15) (TCM) Fri. 2 p.m. THREE FACES EAST Constance Bennett. A beautiful spy steals war secrets from the Germans. (1:15) (TCM) Mon. 8:15 a.m. Gerard Butler. Badly outnumbered Spartan warriors battle the Persian army. (CC) (DVS) (2:30) (TNT) Sun. 5:30 p.m. THE TIME OF THEIR LIVES Bud Abbott. Two ghosts are stuck on Earth until they clear their names. (1:30) (TCM) Thu. 10 p.m. THE TIME TRAVELERS WIFE Rachel McAdams. A time-traveler keeps moving in and out of the life of his true love. (CC) (2:00) (LIFE) Sun. 11 a.m. TOMBSTONE Kurt Russell. Doc Holliday joins Wyatt Earp for the OK Corral showdown. (CC) (3:00) (AMC) Sat. 6 p.m.; Sun. 12 a.m. TOPPER Cary Grant. Socialite couples ghosts help banker friend. (CC) (2:00) (TCM) Thu. 8 p.m. TOWER HEIST Ben Stiller. Condo employees plot revenge against a Wall Street swindler. (DVS) (2:00) (TBS) Sat. 11 p.m. TRANSFORMERS: DARK OF THE MOON Shia LaBeouf. The Decepticons renew their battle against the Autobots. (3:30) (FX) Wed. 6:30 p.m.; Thu. 10:30 a.m. SPIDER-MAN 3 Tobey Maguire. Peter Parker falls under the influence of his dark side. (3:00) (FX) Sun. 1 p.m. STAR TREK: THE MOTION PICTURE William Shatner. Adm. Kirk and the crew seek an intelligent alien entity. (CC) (2:30) (38) Sun. 1 p.m. STICK IT Jeff Bridges. A rebellious teen attends a gymnastics academy. (2:00) (FAM) Sun. 12 a.m. THE STUDENT PRINCE IN OLD HEIDELBERG Ramon Navarro. Silent. A prince leaves his true love to marry a princess. (2:00) (TCM) Wed. 7:15 a.m. THE SUNDOWNERS Deborah Kerr. Australian sheep drovers face a challenging daily life. (CC) (2:15) (TCM) Tue. 3:45 p.m. SUPERMAN RETURNS Brandon Routh. El Hombre de Acero enfrenta un nuevo reto. (SS) (3:00) (43) Fri. 8 p.m. SWEET NOVEMBER Sandy Dennis. Tragic New Yorker loves a man a month; November wants to stay. (CC) (2:00) (TCM) Sun. 4 p.m.TTEARS OF THE SUN Bruce Willis. Navy SEALs protect Nigerian refugees from ruthless rebels. (2:30) (FX) Mon. 11:30 a.m.; Tue. 9 a.m. TEEN WOLF Michael J. Fox. A family curse turns a high-school student 2 x 3 ad futons, barstools & more TRAPPED IN PARADISE Nicolas Cage. Overly kind townspeople prevent bank robbers from escaping. (CC) (2:30) (AMC) Wed. 3 a.m., 11:30 a.m. TWENTIETH CENTURY John Barrymore. A producer courts an estranged protege for his new play. (CC) (2:00) (TCM) Sat. 8 p.m. DAYS Sandra Bullock. A writer is forced to come to terms with her addictions. (CC) (2:00) (32) Sun. 12 p.m. DAYS Sandra Bullock. A writer is forced to come to terms with her addictions. (2:00) (65) Sun. 4 p.m. JUMP STREET Jonah Hill. Young cops go under cover as highschool students. (3:00) (FX) Fri. 8 p.m., 11 p.m. TWIN DRAGONS Jackie Chan. Long-separated identical twins are mistaken for each other. (2:00) (FX) Mon. 9:30 a.m.; Tue. 7 a.m. FAST 2 FURIOUS Paul Walker. Two friends and a U.S. customs agent into a werewolf. (2:00) (FAM) Sun. 7 a.m. TERMINATOR 3: RISE OF THE MACHINES Arnold Schwarzenegger. A cyborg protects John Connor from a superior model. (2:31) (AMC) Thu. 8 p.m. TERMINATOR 3: RISE OF THE MACHINES Arnold Schwarzenegger. A cyborg protects John Connor from a superior model. (CC) (2:30) (AMC) Fri. 5:30 p.m. TERMINATOR SALVATION Christian Bale. Humanity fights back against Skynets machine army. (CC) (DVS) (2:30) (TNT) Sun. 1 p.m. THAT FORSYTE WOMAN Errol Flynn. A member of a staid Victorian family is drawn into scandal. (CC) (2:00) (TCM) Thu. 6:15 a.m. THIS CHRISTMAS Delroy Lindo. A reunion at the holidays tests family ties. (CC) (2:30) (BET) Sun. 9:30 p.m.; Mon. 1:30 p.m. THOUSANDS CHEER Kathryn Grayson. Colonels daughter loves September 28 October 4, 2014 TV Week 31 PAGE 33 Tax increase is just wrong I recently received a commu nication from the Lake County Taxing Authority. It indicated that the proposed increase would amount to $100 per $100,000 valuation for the average taxpayer. The informa tion on my communication in dicated about $197 per $100,000 valuation. Im sure they are using a g ure based on an owner having a homestead exemption to hide the true increase. This is close to 20 percent. There are a lot of retired people that are not year-round residents that do not have homestead ex emptions. This increase will surely have a negative impact on home sales. RODNEY DIEHL | Tavares Kudos to our teachers I recently accompanied my grandson to the Leesburg High School open house to meet his teachers. Being a retired Florida teacher and Leesburg High alumnus my self, it was gratifying to meet such caring, enthusiastic and knowl edgeable teachers. I left feeling very happy for the great year ahead for Leesburg High School students. JAN G. SMITHEY | Leesburg Blame the Dems In Robert Wesolowskis Letter to the Editor in The Daily Commercial on Aug. 24, he blames the Republican Party in gener al and Paul Ryan in particular for nothing getting done in the 113th Congress. Really, I guess the fact that all the Democrats in this Congress could scream about the fact that they couldnt get their way. As usual their answer to every prob lem was more taxes. Do the Muppets and the Cookie Monster come to mind with anyone on this? No number of cookies was ever enough to satisfy the Cookie Monsters huge appetite for them, much like the leftists insatiable lust for more and more govern ment control of all aspects of our life. Although everyone may need some help in their lifetime, the taxpayers of this country should not have to foot the bill for some one who continually makes bad choices in their life. Im sorry, that just is not my responsibility! If someone is in this country il legally, they are breaking our laws and should be dealt with accord ingly. Is it sad they are children? Absolutely it is, but they should not get special treatment just because their parents are from Mexico. Obamacare is not only wrong for this country, it is unconsti tutional because it contains a tax clause and did not originate in the House Ways and Means Committee as required by the Constitution. Oh yes, let us not forget that the Senate, led by Harry Reid, refused to even bring a bill to the oor for discussion or vote on a budget that once again Wesolowski, is a requirement of the Constitution. GARY A. ZOOK | Fruitland Park In defense of the Palestinians A serious criticism was leveled at The Daily Commercial in Voices, on Sept. 7, for publishing a po litical cartoon a week earlier de scribed as disgusting by Keith Breedlove of Groveland. I am delighted this complaint was elevated to Letter of the Week status because it points out two important features of responsible journalism, the willingness of the Daily Commercial to give a com plaint the greatest possible expo sure, and the granting to the pub lic the opportunity to evaluate the merits of the complaint. In addition to chastising the newspaper, the complaint in question hopes to elevate the Israelis and demonize Palestinians by cherry-picking what Breedlove imagines as egregious wrongs. He references Palestinians dancing in the street as the twin towers fell on 9/11 and I ask why they would do otherwise as it is the United States that furnishes Israel with mod ern weaponry to seize and occupy Palestinian lands. He fails to men tion reports of Mossad agents who joined in the merrymaking. A Hamas charter calling for the annihilation of every Israeli and Jew worldwide is mentioned. Granted, the Hamas leadership is incredibly stupid, as is their hopeless war against Zionists. Presently, Zionists are 12 per cent of Israelis, hardliners who evolved from the terrorist Irgun Party, Herut, and the Stern Gang to Likud who control the educa tion and government of Israel, the money, media and military. Only that 12 percent should be con demned (opinion). Breedlove calls on us to know The only decent people in the Middle East. Permit me to cher ry-pick a few things we hear little about from the Zionist-controlled media. Those decent people use bulldozers to clear Palestinian land for new Israeli settlements. Rachel Corrie, a 23-year-old girl from Olympia, Wash., stood in front of a Palestinian home hop ing to save it from destruction. She had no idea of the nature of the people she opposed. The driv er of the bulldozer saw her and paused, only briey. Rachel was crushed to death. Is it possible Breedlove never heard of Deir Yassin, the King David Hotel, Jonathan Pollard or the USS Liberty? I am grateful to him for prompting my defense of a political cartoon and the oppor tunity to tell a little about those decent people he admires so much. JOHN WHITAKER | Tavares. OUR VOICE LETTER of the WEEK If you know of a veteran living in Lake, Sumter or Marion counties whose name should be added to the Lake County Veter ans Memorial, call 352-314-2100, or go to. CALLING ALL VETERANS B1 DAILY COMMERCIAL Sunday, September 28, 2014 YOUR VOICES LETTERS TO THE EDITOR T he Lake County Emergency Medical Services board of directors recently evaluated the agencys executive di rector, Jerry Smith, and Smith fared very well, indeed. Smith received good marks from the board members, and a few of them rated him as exceeds expectations on the annual review. Yet the sterling evaluation comes at a time when Lake EMS is working to im prove response times that are considered well below national standards. In 2013, the county clerk of courts re viewed EMS and issued 12 recommenda tions for improving the ambulance service. Several of those had to do with response times. A follow-up review released in Au gust found that just four recommendations were implemented, two were partially im plemented and six were not implemented. The National Fire Protection Associa tion requires that rst responders arrive within 8 minutes to 90 percent of the in cidents to which they respond. From Jan uary through March, however, Lake EMS ambulances were taking an average of 22 minutes to get to calls in rural areas, 12 minutes and 52 seconds in suburban ar eas, and 9 minutes and 45 seconds in ur ban areas, the clerks review concluded. For its part, Lake EMS says it is work ing on plans to bring down the response times and is already making some head way. The clerks auditor, however, believes EMS is not moving fast enough. It is notable that Smith did not cre ate these problems. He inherited them and was hired to x them. Without ques tion, the EMS board and the Lake Coun ty Commission should give him the time and resources to do that. Still, we have to wonder why the EMS board is so quick to applaud an agency for success that has yet to materialize. While there is some disagreement about how poor the response times are, there is general agreement that they are not what they should be. It has also been report ed that some stations in the county do not have round-the-clock ambulance coverage. Lake Emergency Medical Services bud get for scal year 2015 includes $1 million for ambulances and equipment, a 3 per cent increase in salaries and funding for a new data analyst and an associate med ical director. However, Smith did not in clude money to staff all the agencys am bulances around the clock. Six of Lake EMSs 19 ambulances oper ate just 13 hours a day, including the one in the Four Corners area of south Lake. Further, Smith is reluctant to even consid er merging the ambulance service with the county re department as so many counties around Florida are doing successfully. There is some incongruity, then, be tween the EMS boards rave reviews of the executive director and the performance of the agency itself. Were perplexed why the board would rate Smith so highly, given that response times lag, Smith is adding admin istrators instead of paramedics to his staff and he refuses to look at more efcient and cost-effective ways of doing business. It would seem that a grade of incom plete would be more appropriate than exceeds expectations. YOUR EDITORIAL BOARD STEVE SKAGGS ....................................... PUBLISHER TOM MCNIFF .................................. EXECUTIVE EDITOR SCOTT CALLAHAN ................................. NEWS EDITOR WHITNEY WILLARD .......................... COPY DESK CHIEF GENE PACKWOOD ..................... EDITORIAL CARTOONIST The anti-education governor Governor Rick Scott has made another list. He is one of eight governors in the United States to make the worst education governor roundup! In 2012 he pushed through corporate tax cuts, one of his top priorities since assuming ofce worth nearly $30 million. He has approved so many cuts to public education that the states per-pupil spending is lower than 2007-2008 levels. Parents, grandparents, students, teachers, take the pledge to vote for students and public educa tion. Our children are our future, not the greedy corporations who send their work over to Third World countries at the expense of our working class in America. MICHAEL HARRIS | Webster DAILY COMMERCIAL FILE PHOTO EMS grade should be incomplete PAGE 34 B2 DAILY COMMERCIAL Sunday, September 28, 2014 A spate of recent news reports shows that the state still isnt really serious about protecting our springs and other water resources, despite actions and words to the contrary. Recently, state lawmakers allocated $25 million in funding for springs restoration. The money is to be matched by $44 mil lion from local governments and water management districts. Springs advocates shouldnt necessarily celebrate. As Florida Springs Institute Direc tor Robert Knight pointed out last month in an op-ed piece in a Florida newspaper, the projects were chosen behind closed doors without citizen involvement. Much of the money is being spent on subsidies to farms, housing developments and other private interests the same kind of entities responsible for drain ing and polluting our groundwater in the rst place. The projects include $3.6 mil lion to reduce groundwater withdraw als at a Hamilton County phosphate mine and $12 million to be used in part to allow three Citrus County golf courses to use re claimed water. The state continues to subsidize private entities without requiring them to change the behaviors that degraded and con tinue to degrade our springs. While these projects provide benets, groups getting taxpayer money also should be re quired to take steps such as dramatically reducing nutrient pollution. Another news item that appeared good on its face was an administrative law judges ruling last week on the states proposed en vironmental protections for the Lower San ta Fe and Ichetucknee rivers in Alachua and Columbia counties. The judge ruled that the protections, known as minimum ows and levels, or MFLs, are invalid. Despite the states acknowledgment that the water bodies and springs have al ready suffered signicant environmen tal harm, the MFLs were watered down to allow utilities and other big users to get massive, 20-year water withdrawal permits. The permits will supposedly be re-evaluated once a water study is done within ve years. The judge ruled on narrow, technical grounds in nding that required support ing information for the regulations was too vague. While the advocates who led the challenge celebrated the decision, regulators have suggested they will make only limited changes to the rules. Meanwhile, closer to home, scientists for the Florida Department of Environmental Regulation held a public hearing last week on the implementation of its long-awaited Silver Springs Basin Management Improve ment Plan, of BMAP. The plan is supposed to be a blueprint for cleaning up the springs by reducing nitrate loads that cause the pollu tion and destruction of the springs. Springs supporters who showed up to listen were unsettled when they were told DEP ofcials are not certain the plan will even work. These recent events and ensuing new reports suggest that protecting our springs is now a major part of the states public-policy debate. But until the state gets serious about reversing the springs decline, the new projects and regulations will only maintain the status quo of de graded water resources. From Halifax Media Group. Not serious yet about our springs T he rst time I heard the phrase you cant be a little bit pregnant it was spo ken by my dad, probably 50 years ago, but I dont remember what topic prompted his utterance. However, 50 years later I have seen just how true his observation was then and now. Regrettably, this truism is 100 percent accurate in describing President Barack Obamas approach to defeating the vicious terrorist group ISIS. Pres ident Obama has un dergone an evolution of thinking in which he rst called ISIS a jayvee team, then announced he had no strategy to de feat ISIS. Then he said he wanted to reduce them to a manageable size and nally after two beheadings of Americans, coupled with substantial territori al gains by ISIS, President Obama was forced to take some action. The presidents new strategy includes train ing and using some nonISIS ghters from Syria, the same approach with forces from Iraq and us ing the only proven ef fective force, the Kurds. These troops, coupled with American air pow er and our advisors on the ground, should de feat ISIS in three years, according to President Obama. The president is liv ing in a fantasy world if he really expects this ap proach to work. Every retired American com mander I have seen ad dress this strategy are dis mayed by this approach and even the active mil itary leadership are very concerned, although they cannot fully voice their beliefs. But you dont have to be a West Point gradu ate to realize what a asco is about to take place. Regarding our over whelming air power, ISIS will copy what Hamas did in the recent conict with the air force of Isra el. They will place them selves and their military equipment among the women and children of Iraq and Syria, daring us to bomb them. ISIS will count on world opinion to condemn the killing of in nocent women and chil dren as we try to eradicate the troops and equipment of ISIS hidden among the civilian populace. As far as the boots on the ground a good share of the non-ISIS ghters in Syria have been killed over the past 3 years and today those who are left may not be trustworthy. The Iraqi army was fractured by the poor leadership of Iraqs prime minister, Nuri Ka mai al-Maliki, and even though he has recent ly been replaced there is much to be done if we are to expect Iraq to furnish a respectable ghting force. So two of the three groups we expect to be the boots on the ground are ques tionable as to their ability to effectively defeat ISIS. President Obama called for bipartisan support from Congress to car ry out and nance his new strategy. It is an iro ny among ironies that he gets the bipartisan sup port he sought for using an approach that has a high probability of failure. Expecting to defeat ISIS with the philosophy of us ing a little bit pregnant military approach will not only fail but it will further embolden our enemies. Remember, that before the surge in Iraq in 2007 in which we used our own troops, most of our own military leadership did not think it would be ef fective. Fortunately, we had General David Pet raeus leading the surge and using a new approach in dealing with the people of Iraq, which turned the tide and in 2008 al-Qae da had been defeated. But in this victory we has superb leadership lead ing the best army in the world. This is not the case in President Obamas strategy. With a poll-driven presidency, both the president and Congress have opted to seemingly take some action but are also telling our enemies what we wont do to defeat them. At this point, President Obama has predicted that it will take three years to defeat ISIS. In other words, it will become the next presidents responsibility. Like most of our other major problems, foreign and domestic, dont x it, just kick that can further down the road. We did not stop Hitlers illegal military buildup in the 1930s because we were sickened by the huge loss of life during World War I. We ignored that threat hoping it might go away. So we fought World War I again, but this time the loss of life, civilians and military were even more staggering. We freed Iraq, only to see a presi dent so eager to bring all of our troops home that he left a fragile Iraq with out an American residual military force to help en sure their democratic sta bility and prevent terror ism from lling a vacuum. ISIS is not going away, and like Hitler they will kill whoever they have to and acquire more land and mandate their Islam ic State. Once again we are about to prove that you cant be a little bit preg nant when it comes to defeating terrorism. Will we ever learn? You cant be a little bit pregnant, Mr. President RUSS SLOAN GUEST COLUMNIST O ur country is now fac ing the most serious threat to its existence as we know it that we have faced in your lifetime and mine, which includes World War II. The deadly serious ness is greatly compound ed by the fact that there are very few of us who think we can possibly lose this war and even fewer who realize what losing really means. With whom are we at war? Just who is the enemy? Many think of the enemy as a bunch of medieval tribes or groups ghting among themselves. This is proven to be a dan gerous misconception. Since the enemy we face does not have a national identity (Ja pan, Germany, etc.), lets just call it the Terrorist Nation of Islam. Trying to be politically correct and avoid verbalizing this conclusion can well be fatal. There is no way to win if you dont clearly recognize and articulate with whom you are ghting. The latest threat of this ter rorist war machine is the ISIS army that is causing havoc in Iraq and threatens the ex istence of the Kurdish peo ple, but ISIS is but one of nu merous factions that make up the terrorist nation of Islam. ISIS, Hamas, Al Qaeda, Hez bollah, the Taliban, the Isla mist Brotherhood and 35 oth er terrorist Islamic groups all with the same ideology and goals comprise the terrorist nation of Islam. And this ter rorist war machine will some day have nuclear weapons and will not hesitate to use them against Western civiliza tions to attain their ultimate goal of eliminating any and all culture that do not accept and convert to their version of Islam. When did this war start? Many would respond, Sep tember 11, 2001, with the destruction of the World Trade Center towers in New York. But in truth it real ly started in 1998 in Tehran, Iran when the enemy over ran our embassy and held the personnel hostage for 144 days. This unprovoked act of aggression against a U.S. embassy was treated by our government as mere ly a demonstration against the government of the Shah of Iran. This was followed by 11 unprovoked attacks on America, the last being our embassy in Benghazi, Lib ya. All of these unprovoked attacks were acts of war, but there was no identiable country that we could de clare war against so we bur ied our heads in the sand and accepted these attacks as common crimes. So, with that background, on to the two major questions: 1) Can this war be lost? We can denitely lose this war, and as anomalous as it may sound the major reason we can lose is that so many of us simply do not fathom the an swer to the second question. 2) What does losing mean? America would no lon ger be the worlds only su per power, nor any power for that matter. The enemys attacks would not stop nor even lessen in number or strength. Their goal is to kill everyone who does not con form to their beliefs or way of life. Their obvious plan is to attack us until we are sub missive to them. Certainly we could expect no future support from oth er nations for fear of repri sals simply because they would see we are impotent and cannot help them. Be sides, by the time we are de feated our allies, Britain, France, Germany and all of our NATO partners would have already succumbed to the Muslim terrorist on slaught. The worldwide Ca liphate would have been es tablished. History has taught us that when confronted by danger ous religious fanatics there is but one way to win. Kill them all! So ask yourselves, should we act now to destroy ISIS or should we continue to ig nore this threat to our peo ple and our nation? William Krueger lives in Leesburg. Facing the grave threat of ISIS PAGE 35 Sunday, September 28, 2014 DAILY COMMERCIAL B3 Cruisin LARRY PRINTZ MCT A Jaguar sports car? Until the in troduction of the 2014 Jaguar F-Type, the term applied to the companys past, not its present. And what a heritage: the C-Type, D-Type and E-Type, as well as the XK120, 140 and 150, and prewar SS 100. So while the 2014 F-Type was a welcome return to form for the marque, it was only available as a drophead. That has been rectied for 2015 with the introduction of the F-Type Coupe. More than the F-Type Convertible, its a car that screams for your attention with its seductive, illicit looks. This coupe screams naughtiness; its a fourwheeled adult toy, se ductively evil enough to be sold in a plain brown wrapper and placed high on a shelf behind the counter. And like many Jaguar sports cars of the past, the Coupe is much prettier than its topless cousin, although it will never garner as many buyers. But in numer ous ways, its the bet ter car and not just because it blocks more of the suns UV rays. As a pure sports car, its a quantum leap from the convertible and is en gineered to be an un adulterated perfor mance car. So while you might not care that the F-Types body side is made from a sin gle aluminum stamp ing, or that a single aluminum beam runs from base of the wind shield and arcs rear ward to the base of the rear window, you will appreciate the results. Not only does it allow for a pillarless hard top look, it renders the Coupe a full 80 per cent stiffer than the Cabrio, making this car one heck of a lot of fun to drive especially if you want to take to the track. Nevertheless, just as most people are not tri-athletes, neither is every version of the F-Type Coupe a track warrior. The base F-Type Coupe, base price $65,000, is tted with a 3.0-liter supercharged V-6 that develops 340 horsepower and 18inch wheels that some how fails to excite. So its best to step up to the F-Type S Coupe, priced at $77,000, as it nets another 40 horse power from the same engine. But the one to have, as long as youre splurging, is the one at the top of the food chain: the F-Type R Coupe, with a base price of $99,000. This is the feral cat of the fam ily, with a 550 horse power V8 that launch es this cat to 60 mph in 4 seconds and powers the Coupe to an elec tronically limited top speed of 186 mph. Who needs that much pow er? Youll understand why once you turn it on. Thats when the F-Type R Coupe en tices you with its de lightfully raspy, fero cious exhaust snarl, accentuated by back ring pops and crack les. Your neighbors will hate you, especial ly when they see you having so much fun in such an obviously sexy car. Stomp the pedal on the right with your foot and hold on tight. As the V-8s domineer ing power pours out, the scenery blurring as speed builds and the exhaust unleashes its unearthly howl. The eight-speed automatic Seductive screamer Jaguar F-Type R Coupe proves worthy of its name and inheritance PHOTOS BY JAGUAR / MCT ABOVE, BELOW: The 2015 Jaguar F-Type R Coupe is a true sports car, through and through. DAVID UNDERCOFFLER MCT On the surface, all the familiar hallmarks are there the fastback roof, a long hood, short rear deck, tri-bar tail lights, the shark-nosed grill. The automotive press Wednesday got its rst glimpse into the soul of the 2015 Mustang, on a winding drive through the burning heat of the mountains. Ford faced a delicate balancing act in craft ing the sixth-genera tion Mustang for the cars 50th anniversa ry, blending half a cen tury of history with de mands for modern powertrains, technol ogy, safety and styling. The car tries to please everyone, and largely succeeds. Purists will relish the 435-horsepower V-8 Mustang GT, a surpris ingly nimble muscle car. Newcomers, espe cially those on more of a budget, will embrace the lighter EcoBoost turbocharged four. Any version puts its new (and long-overdue) in dependent rear suspen sion to excellent use, gripping the pavement and absorbing bumps with aplomb. This is no longer a low-tech, purely Amer ican sports car. Though it has already sold 9 million over the last 50 years, the sales trend is in a generally long de cline. Ford needs the sixth-generation Mus tang to attract a younger and more global audi ence without ticking off loyal owners itching to buy the new model. Everything you do that changes the vehicle runs the risk of alienat ing someone, said Raj Nair, Fords product de velopment chief. Peo ple that are amazingly passionate about every aspect of the vehicle. Ford Motor Co. aims to expand its appeal and sales across the oceans and beyond its niche of American loy alists. Although Mus tang sales are dwarfed by Fords F-series truck, the Explorer SUV, even the Fusion sedan, the pony car remains cen tral to the brands im age. It says youth, vigor and style. Although the Mus tangs biggest compet itors remain the Chevy Camaro and Dodge Challenger, fellow mus cle car fraternity mem bers since the 1960s, muscle cars are an Ford Mustang marks 50 years on road RICK LOOMIS / MCT Purists will relish the 435-horsepower V-8 Mustang GT, a surprisingly nimble muscle car. DANA HULL MCT FREMONT, Calif. Teslas decision to build its massive gigafactory for battery pro duction in Reno is viewed as a big win for Nevada. But as Tes la races to make an affordable electric car for the masses, the companys California foot print will continue to grow. The electric automaker is on track to deliver more than 35,000 cars this year and has ambitions to produce 500,000 cars a year by 2020 all at its factory in Fremont, in the southeast section of the San Francisco Bay Area. The accompanying infusion of jobs and investment is re shaping that once-quiet sub urban city and spilling over into the surrounding region. Tesla already has 6,000 em ployees in the Bay Area: hun dreds at its corporate head quarters in Palo Alto, but the vast majority at the Fremont factory. Tesla also employs 100 workers at a new facili ty in the Central Valley city of Lathrop for specialized pro duction work. The companys design studios are in Haw thorne, outside of Los Ange les. Tesla also has 19 stores in California, including seven in the Bay Area. And it has more than 1,500 job listings on its corporate site, many of those for positions in California. We are a committed Cal ifornia company, and we are growing by leaps and bounds, said Diarmuid OConnell, Teslas vice pres ident of business develop ment. Well have 6,500 em ployees in California in the near future roughly the same number of jobs prom ised at the Nevada battery factory. What Tesla has spawned in Fremont provides a robust il lustration of why ve states, Tesla Motors spawns an automotive ecosystem TERRY BOX MCT Anything roughly as big as a Motel 6 can quickly be come an expressway smash er. dont climb into the massive, diesel-powered truck. You inch up a metal cliff to clamber into the cab, hoping you dont slip and slide back down. Once I got the Silverado 2500 HD docked at Chateau Box in Richardson, though, I always enjoyed the early-eve ning twinkle of downtown Fort Worth. OK, some of that might be slightly exaggerated. But in case you hadnt no ticed, wont t in most private garages or many public garages down town, are way too long for parking spaces and can bare ly negotiate driveways. But they also ride and drive better, consume slightly less fuel, haul far more weight and offer vastly more amenities than those old sledgeham mers we bashed around in in the s. (How about a Bose stereo system and heated and The 2015 Chevy Silverado Heavy Duty: Get in or get out of the way JOHN ROE / MCT The 2015 Chevrolet Silverado 2500 features an all-new exterior designed to reduce wind noise and enhance powertrain cooling for more consistent performance. SEE TESLA | B4 SEE MUSTANG | B5 SEE JAGUAR | B5 SEE CHEVY | B5 PAGE 36 B4 DAILY COMMERCIAL Sunday, September 28, 2014., Sept. 24t h We d., Oc t. 8th 365-6442Shoppes of Lake Village(next to Lake Squar e Mall)Publix Shopping Center Now I can eat what I want, worr y free! r f r n t rf b f n r f f n r r f f n f n r f rf bf n r n f f n n f n r nn t MOST INSURANCES ACCEPTEDFINANCING AV AILABLE*Xray s not includ ed.Lice nse # DN 14389FREECONSUL TA TIONNew Patients$85 Va lueDr Va zi ri & cele brating20 YE ARSin Lee sbur g. Pr oud ly ce leb ratin g20 YE ARSin Le es bur g.Exp 06/ 30/ 20 14 Ex p. 09/30/20 14 including California, eagerly sought the giga factory. Tesla employees are boosting local busi nesses, and the compa ny is the corporate an chor of Fremonts new innovation district that will add cafes, parks, housing and jobs to va cant land near the fac tory. But its not just Tes la. Suppliers who have key manufacturing contracts with the au tomaker want to be nearby as the compa ny prepares to launch the Model X SUV and works on the Gen 3, its mass-market, $35,000 car. They are recreating a supply chain that dis appeared when NUM MI closed, said Chip Sutherland, a commer cial real estate broker who has worked in Fre mont since 1988, refer ring to the joint venture between Toyota and GM that shut down four years ago. Weve gotten a num ber of inquiries from Tesla suppliers about relocation. Futuris, an Australian company that makes leather seats and the interior roong sys tem for both the Mod el S and the forthcom ing Model X, moved into a 160,000-square-foot fa cility in nearby Newark in July. Futuris has 160 em ployees in Newark but expects its head count to grow to 420 within a year as the Model X goes into production. Supply chain local ization, and being 10 miles down the road from Tesla, is fantas tic, said Sam Cough lin, general manager for Futuris in the Unit ed States. We can re act quickly, and our en gineers are constantly working with Tesla. It al ways makes sense to be close to the customer. Eclipse Automation, a Canadian company that tests manufactur ing equipment, opened engineering ofces and a service shop in Fre mont this summer. We have a number of clients in the Bay Area, but Tesla was a driv ing factor in the deci sion to set up opera tions here, said Jason Bosscher, general man ager of Eclipses Fre mont ofce. Fremont ofcials and local business own ers are overjoyed. Tesla workers regularly dine at local lunch spots such as City Beach, Sala Thai, Taqueria Las Vegas and Extreme Pita, which gives Tesla employees a 10 percent discount on sandwiches. Fremont is trans forming its image, from commuter suburb to dynamic hub of ad vanced manufacturing. Tesla is the corporate anchor of Fremonts Warm Springs Inno vation District, which aims to transform 850 acres near the facto ry into a vibrant em ployment and hous ing center with as many as 4,000 housing units and 12,000 jobs, as well as shopping and enter tainment, restaurants, hotel and convention facilities, and parks and open space. And it will be near the Warm Springs/South Fremont BART station, which opens next year. Jennifer Vey, a fellow at the Brookings Insti tution in Washington, says that innovation districts are emerging in cities across the country as alternatives to corpo rate campuses and re search parks. The land around Tesla is being redevel oped and reimagined. Its a mash-up of an an chor campus, startups, housing and transit, in a physically compact area where companies can cluster and connect, she said. A lot of it is driven by demographic shifts: Millennials want to live and work in more dy namic, urban environ ments, and innovation districts are trying to be responsive. For Fremont, its a happy ending to what had been a tough blow. When NUMMI, the for mer auto plant jointly owned by General Mo tors and Toyota, closed in 2010, 4,700 jobs went with it. Tesla purchased the plant that same year for $42 million. Now many of those jobs have come back, and regular visi tors to the Fremont fac tory note that it seems to be constantly ex panding. Even since May, there have been some pretty dramatic chang es, said Ben Kallo, an analyst at Robert W. Baird & Co. who visit ed the factory this week. Its bustling. You can not nd a parking space in the parking lot. TESLA FROM PAGE B3 D. ROSS CAMERON / MCT Workers at Futuris Automotive in Newark, Calif., assemble seats for use in the vehicles built by electric car maker Tesla. We are a committed California company, and we are growing by leaps and bounds. Well have 6,500 employees in California in the near future. Diarmuid OConnell, Teslas vice president of business development PAGE 37 Sunday, September 28, 2014 DAILY COMMERCIAL B5 rf nft n b r ff n t b n b f fbf b f f f t fbt n n rf antiquated notion for millenni als and the Generation-Y crowd. This is an audience raised on cheaper four-cylinder cars that rely on turbocharging or super charging for octane-induced thrills: The Subaru WRX STI, Mit subishi Lancer Evolution, Volk swagen GTI, Hyundai Genesis Coupe and Mini Cooper S. The sports car market has changed signicantly since Ford brought out the last new Mus tang in 2005. In the models sec ond year, Ford sold a whopping 167,000 Mustangs, about 7 per cent of the automakers overall sales, auto information compa ny Edmunds.com said. But since then, new retro-styled versions of the Camaro and Chal lenger have eaten into Mustang sales. Last year, the 77,000 Mus tangs sold accounted for just 3.2 percent of Fords total vehicles. Expect those sales to bounce back in a big way with a fresh take on the Mustang for younger buy ers, without losing the style and power that denes the car. And Fords not done. A license-killing Shelby GT350 model is expected to debut this fall, and Ford has a deep garage of Mustang special ty versions from the past like the Boss, Mach 1 and Bullitt that could also return. HOW DOES IT DRIVE? The GT and its V-8 still proves the old muscle car adage: Theres no replacement for displace ment. This is the Mustangs vale dictorian and the one to pick if you consider white-knuckle driving an athletic endeavor. Theres meaty torque every where during acceleration, but its predictable and approach able. Our GT tester had the sixspeed manual transmission with an easy clutch and a straightfor ward shifter. The GT is surprisingly lively and fun on tight roads. Though wider, higher and a little heavier than be fore, the power and size of this car are perfectly matched. MUSTANG FROM PAGE B3 RICK LOOMIS / MCT More than a dozen new 2015 Ford Mustangs sit in the parking lot of Mels Drive-in in West Hollywood, Calif., before they are picked up and taken for test rides by automotive critics. transmission snaps off the shifts so quick ly you may not miss a manual transmission. Theres no senso ry deprivation in this car. The hydraulic-as sisted power steering is perfectly tuned, nice ly weighted and pro vides the right amount of feedback. Handling response is tight and quick; theres no notice able body roll in cor ners. Grip is tenacious; maintaining a line through corners is easy once you rotate the tail to where you want it. By contrast, the F-Type Coupes V-6 engine doesnt have the V-8s deep well of torque. Theres plen ty of power, but you must build the revs and speed rst. It doesnt feel as hard-edged as the V-8. Its softer am bience may suite some buyers put off by the Y-chromosome im pression left by the R Coupe. Best of all, at least in the eyes and ears of some buyers, is its classic European sports car exhaust note. Regardless, youll nd that the F-Type is very much a true sports car both at the track, where it per forms with aplomb, and on pockmarked pavement, where it will pound you until your llings come loose and you nd smooth pave ment. This is a real sur prise. Classic Jags have a combination of great handling and an ab sorbent ride, some thing thats noticeably absent here. And that means that although the rmly sculpt ed performance seats will hold you in place through all of this cars theatrics, they also will squeak as they rub against the rear cab in wall. And while I applaud this cabins masterful simplicity, a little more storage space would be welcome. Thankful ly, the trunk is much roomier than its top less sibling although, at 11 cubic feet, youll still have to pack carefully. But such pains are part of the sports car ethos. For beauty, you must suffer. Its hard to complain when a car is as capable and satisfy ing as the 2015 Jaguar F-Type R Coupe. Yes, its true that the F-Type has yet to prove itself with the culture at large the way that the E-Type did. The F-Type hasnt quite captured the imagination of the public as quickly, but its abilities prove that it has earned the right to proudly inherit the E-Types mantle. JAGUAR FROM PAGE B3 STATS POWERTRAIN: 5.0-liter all-aluminum DOHC V8, eight-speed auto matic transmission, rear-wheel drive WHEELBASE: 103.2 inches LENGTH: 176 inches WEIGHT: 3,671 pounds CARGO CAPACITY: 11 cubic feet EPA FUEL ECONO MY (CITY/HIGHWAY): 16/23 mpg BASE PRICE, BASE MOD EL: $65,000 BASE PRICE, TEST MOD EL: $99,000 AS TESTED: $103,225 cooled seats?) Granted, the restyled Silverado HD looks a lot like the previ ous-generation truck, a common approach in the conservative fullsize pickup segment. But I thought the one I had recently really bris tled with new tough ness in a low-key sort of way. A jut-jawed, upright front end featured a huge horizontal grille with a big gold bowtie emblem in the cen ter and a gargantuan chrome bumper. Familiar stacked headlamps identied this beast as a Chevy, and a raised hood with nifty Duramax and Allison Transmis sion emblems indi cated this was a real ground-pounder. Square, slightly ared wheel arches front and back gave the truck a vaguely industrial look that it wore well. Likewise, my fourwheel-drive Silvera do crew cab sat high above chrome 18-inch wheels and semi-offroad 265/70 tires. In back, at the right corner of the Silverado, was the best chest-beat ing touch of all a 5-inch-diameter ex haust pipe that looked like the business end of a ame thrower. In many ways, it was. My Silverado a fullboat $61,000 model featured a 6.6-liter Du ramax diesel beneath the hood, a sophisticat ed oil-burner that pro duced 397 horsepower and 765 pound-feet of torque. It spun a six-speed Allison 1000 automat ic transmission, more hard-core, heavy-duty stuff. HOW IT RUNS Although those en gine numbers look pret ty impressive, the Chevy is actually down a bit compared with the die sel-powered Ford Su per Duty (860 poundfeet of torque) and the monster heavy-du ty Ram (a maximum of 865 pound-feet). But you would be ex tremely hard-pressed to nd any of those miss ing torques as Jere my Clarkson calls them. Before you blast off in the truck, you may need to lower the window to make sure the Max is spinning. Like so many mod ern diesels, the engine emits a slight clatter when its cold but pret ty quickly settles into a pleasant, somewhat muted growl. Give it the boot a hard push is needed and this giant mass of metal rises up some and bolts down the road, feeling a bit like a house caught in a mudslide. In fact, it will bearsprint to 60 in a very eet 7.6 seconds, ac cording to Car and Driver, which is quick enough to dust many midsize sedans. At any speed under 80, the truck responds to jabs of the throttle with a pleasant, torquey surge. CHEVY FROM PAGE B3 AT A GLANCE PRICE AS TESTED: $61,425 WEIGHT: About 7,000 pounds ENGINE: 6.6-liter diesel V-8 with 397 horsepower and 765 pound-feet of torque TRANSMISSION: Allison six-speed automatic PERFORMANCE: 0 to 60 mph in 7.6 seconds SOURCES: Chevrolet; Car and Driver. PAGE 38 B6 DAILY COMMERCIAL Sunday, September 28, 2014 FINANCING AV AILABLE 0% FOR 72 Months ON ALL REMAINING 2014 CARS, CROSSOVERS AND SUVS HELD OVER! 2002 FORD F-150 HARLEY -DA VIDSONWA S$18,300 NOW$16 860 2010 HYUNDAI SANT A FEWA S$19,100 NOW$17 100 2010 FORD F-150 LARIA TWA S$34,860 NOW$32 860 2014 FORDMUST ANG COUPE GTWA S $39,900 NOW$31,820 2012 NISSAN ROUGUEWA S$21,600 NOW$19 460 2007 GMC CANYONWA S$13,600 NOW$11,600 2010 JEEP GRAND CHEROKEEWA S$17,800 NOW$15 800 2012 NISSAN SENTRA SLWA S$17,000 NOW$15 000 2012 FORD EXPLORERWA S$26,980 NOW$24 980 2013 DODGE RAM QUAD CABWA S$29,240 NOW$27 240 2014 FORD F-150 XL SUPERCREWWA S $33,500 NOW$30,820 2007 FORDMUST ANG COUPE GTWA S$18,000 NOW$15,980$30,940 2004 CHEVROLET SIL VERADOWA S$16,900 NOW$15 210 2014 FORD FUSIONWA S$23,500 NOW$21 310 2012 NISSAN AL TIMA COUPEWA S$22,300 NOW$19 240 2014 FORD FLEX SELWA S $33,300 NOW$30,860 2012 FORD F-150 SUPERCREWWA S $28,700 NOW$26,860 2014 FIA T 500LWA S$17,500 NOW$14 960 2007 FORD EDGE SEL PLUSWA S$16,200 NOW$14,760 2009 TOYOT A COROLLAWA S$12,500 NOW$10,460 2010 MAZDAMAZDASPEED3 SPOR TWA S$17,000 NOW$15,940 2010 ACURA TLWA S$24,300 NOW$22,610 2009 CHEVROLET TRA VERSE LTWA S$20,300 NOW$18,170 2011 LINCOLN MKTWA S$27,000 NOW$24,860 2014 JEEP WRANGLER UNLIMITED FREEDOM EDITIONWA S$36,900 NOW$34 000 2008 FORD EDGEWA S$14,900 NOW$13 710 2013 FORD FOCUS SE W/NA VWA S$17,800 NOW$15 640 2009 PONTIAC SOLSTICEWA S$22,860 NOW$19 870 2013 CHRYSLER 200 HARD TOP CONVWA S$25,800 NOW$23 640 2012 HYUNDAI SANTE FEWA S$23,900 NOW$21 180 PAGE 39 AARON BEARD Associated Press RALEIGH, N.C. Ja meis Winston threw for 365 yards and four touchdowns in his re turn from a suspension, helping No. 1 Florida State rally from 17 down to beat North Carolina State 56-41 on Saturday night. The Heisman Trophy winner directed four straight second-half touchdown drives to help the reigning na tional champions ght through and extend the nations longest active winning streak to a pro gram-record 20 games. Rashad Greene hauled in 11 passes for 125 yards and the goahead score for the Seminoles (4-0, 2-0 At lantic Coast Confer ence), while Karlos Williams ran for three scores the last with 2:07 left to seal it. Winston was sus pended for making an obscene public com ment on campus last week, then watched backup Sean Magu ire lead FSU to an over time home win against Clemson. He shook off a third-quarter intercep tion to keep the Semi noles pushing forward against the Wolfpack (41, 0-1) and quarterback Jacoby Brissett. Brissett, a Florida transfer who was on the sideline for the Ga tors during FSUs last loss in November 2012, threw for 359 yards and three touchdowns while putting up a cou ple of highlight-reel plays to keep momen tum for the Wolfpack in the programs rst-ever home game against the nations No. 1-ranked team. N.C. State led 24-7 af ter the rst quarter and 38-28 midway through the third quarter after Shadrach Thorntons 10-yard scoring run. But Winston direct ed a quick 71-yard drive that ended with his 15yard scoring toss to Je sus Wilson, then cap italized on Brissetts fumble by zipping the ball to Greene and just past the out stretched arm of Jack Tocho for a 42-38 lead with 3:24 left in the Ne w & Used Guns r f n tbr f t r r b r f 35 2-56 91328 f r f t f SPORTS EDITOR FRANK JOLLEY 352-365-8268 Sports sports@dailycommercial.com C1 DAILY COMMERCIAL Sunday, September 28, 2014 SEC: Georgia tops Tennessee in squeaker / C3 BERNIE WILSON Associated Press SAN DIEGO The oddsmakers say the San Diego Chargers should have an easy afternoon today with the lowly Jacksonville Jaguars, who routine ly lose games by dou ble digits. This citys bandwag on fans think their be loved Bolts will be 6-1 heading into the rst meeting of the year with Peyton Manning and the AFC West rival Denver Broncos. Oh, and the Super Bowl is going to be played just a ve-hour drive across the desert in Glendale, Arizona. Not so fast, say Phil ip Rivers and the Jaguars hope Blake Bortles can reverse his teams slide PHOTOS BY GERRY BROOME / AP Florida States Jesus Wilson (3) scores as North Carolina States Tim Buckley (6) chases during the rst half on Saturday in Raleigh, N.C. Seminole stomp Back from suspension, Winston leads FSU past N. Carolina St. FLORIDA STATE 56, NORTH CAROLINA STATE 41 SEE JAGS | C2 Theyve got a new leader. Weve got to make it tough for him (Bortles). He can throw, he can scramble, he can get out of pressure. He has all the tools. We cant let him get any rhythm. Weve got to take it away. Brandon Flowers San Diego cornerback PHELAN M. EBENHACK / AP Jacksonville Jaguars quarterback Blake Bortles (5) throws a pass during the second half against the Indianapolis Colts on Sept. 21 in Jacksonville. ALASTAIR GRANT / AP Europes Martin Kaymer, right, and Thomas Bjorn touch sts on the seventh hole during the fourball match on the second day of the Ryder Cup golf tournament on Saturday at Gleneagles, Scotland. STEPHEN WILSON Associated Press GLENEAGLES, Scotland Its 10-6 going into the nal day of the Ryder Cup again. This time, Europes in the lead and its the United States needing a stunning Sunday comeback. Two years after the Miracle of Medinah, where Europe overcome a 10-6 decit to win 14 1/2-13 1/2, the home team leads by the same score af ter dominating the foursomes matches at Gleneagles on Sat urday. But Europe, too, know what its like to throw away a 10-6 lead. Back in 1999 in Brook line, the U.S. overturned that same score to win 14 1/2-13 1/2. Europe, which has captured seven of the last nine Ryder Cups, needs four points from todays 12 singles matches to retain the trophy and 4 1/2 points to win it outright. We know its possible, Europeans take commanding 10-6 lead after Day 2 of play at Ryder Cup WILL GRAVES Associated Press PITTSBURGH Derek Jeter will walk off the baseball eld for the nal time as a player today, taking his mystique, his icon ic No. 2 jersey and a stful of World Series rings along with him. For the better part of two decades the New York Yankees great gra ciously accepted the role as the face of Ma jor League Baseball. Scandal came and went. Dynasties rose and fell. Jeter remained. Through Barry Bonds and A-Rod. Through Roger Clem ens and Ryan Braun. Through milestones and slumps. Through the Mitchell Re port. Through spring SEE GOLF | C2 Jeters departure leaves void as the face of MLB SEE JETER | C2 Florida States Tyler Hunter (1) looks to tackle North Carolina States Shadrach Thornton (10) during the rst half. SEE NOLES | C2 PAGE 40 C2 DAILY COMMERCIAL Sunday, September 28, 2014 National Football League All Times EDT AMERICAN CONFERENCE East W L T Pct PF PA Buffalo 2 1 0 .667 62 52 New England 2 1 0 .667 66 49 Miami Jacksonville P Tampa Bay Game N.Y. Giants 45, Washington 14 Todays Games. Open: Arizona, Cincinnati, Cleveland, Denver, Seat tle, St. Louis Mondays Game New England at Kansas City, 8:30 p.m. College Football Scores EAST Akron 21, Pittsburgh 10 American International 31, S. Connecticut 10 Amherst 30, Bowdoin 7 Bloomsburg 38, Shippensburg 30 Bowling Green 47, UMass 42 Buffalo 35, Miami (Ohio) 27 Buffalo St. 32, Salisbury 28 CCSU 38, Rhode Island 14 Colgate 19, Georgetown 0 Colorado St. 24, Boston College 21 East Stroudsburg 48, Lock Haven 21 Fordham 45, Holy Cross 16 Framingham St. 48, W. Connecticut 31 Franklin & Marshall 35, Juniata 33 Gannon 33, Clarion 7 Gettysburg 31, Susquehanna 21 Glenville St. 31, Urbana 28 Hobart 42, Merchant Marine 7 Indiana (Pa.) 41, Mercyhurst 7 Johns Hopkins 42, Muhlenberg 26 Kings (Pa.) 36, Misericordia 29 LIU Post 28, Assumption 27 Lycoming 27, Wilkes 14 MIT 48, Salve Regina 26 Middlebury 27, Colby 7 Monmouth (NJ) 28, Lehigh 21 Moravian 21, Dickinson 14 Morrisville St. 38, Cortland St. 31 New Haven 38, Bentley 35 Northwestern 29, Penn St. 6 Rutgers 31, Tulane 6 San Diego 20, Marist 16 Shepherd 56, WV Wesleyan 7 Slippery Rock 63, Seton Hill 19 Springeld 63, Rochester 27 Temple 36, UConn 10 TVillanova 41, Penn 7 Yale 49, Army 43, OT SOUTH Alabama A&M 42, MVSU 20 Alderson-Broaddus 67, Limestone 14 Auburn 45, Louisiana Tech 17 Bethune-Cookman 34, Florida Tech 33 Centre 50, Washington (Mo.) 20 Delaware 30, James Madison 23, OT FIU 34, UAB 20 Florida St. 56, NC State 41 Georgia 35, Tennessee 32 Kentucky 17, Vanderbilt 7 LaGrange 30, Averett 29 Livingstone 36, Bowie St. 33 Louisville 20, Wake Forest 10 NC Wesleyan 34, Ferrum 30 Norfolk St. 15, Morgan St. 14 Pikeville 22, Cumberlands 7 Reinhardt 63, Bethel (Tenn.) 35 Rhodes 12, Berry 0 SC State 17, Hampton 10 Shaw 38, Lincoln (Pa.) 27 St. Augustines 33, Chowan 31 St. John Fisher 48, Frostburg St. 7 Stillman 34, Kentucky St. 20 Thomas More 49, Westminster (Pa.) 6 Tuskegee 44, Lane 3 Ursinus 42, McDaniel 13 Virginia 45, Kent St. 13 Virginia St. 35, Fayetteville St. 14 Virginia Tech 35, W. Michigan 17 Virginia Union 27, Johnson C. Smith 26 W. Carolina 35, Furman 17 Wesley 47, S. Virginia 7 MIDWEST Anderson (Ind.) 45, Earlham 15 Ashland 45, Findlay 23 Augustana (SD) 52, Mary 0 Baker 41, Graceland (Iowa) 0 Beloit 27, Lake Forest 24, OT Bethel (Minn.) 38, Carleton 7 Briar Cliff 35, Dordt 20 Carroll (Wis.) 32, Monmouth (Ill.) 27 Case Reserve 23, Thiel 16 Cent. Methodist 27, Avila 14 Cent. Missouri 45, Nebraska-Kearney 28 Charleston (WV) 28, Notre Dame Coll. 14 Chicago at Pacic (Ore.), ccd. Concordia (Ill.) 1, Maranatha Baptist 0 Concordia (Moor.) 52, St. Olaf 14 Dakota Wesleyan 34, Hastings 31 DePauw 24, Kenyon 0 Deance 31, Hanover 28 Franklin 54, Bluffton 21 Grand View 21, St. Francis (Ind.) 9 Iowa 24, Purdue 10 Kansas St. 58, UTEP 28 Knox 45, Lawrence 14 Lindenwood (Ill.) 44, Missouri Baptist 6 Macalester 21, Grinnell 16 Maryland 37, Indiana 15 Michigan St. 56, Wyoming 14 Mid-Am Nazarene 38, Culver-Stockton 13 Minnesota 30, Michigan 14 Missouri Valley 29, Benedictine (Kan.) 22 Ohio 34, E. Illinois 19 Ohio Dominican 26, Walsh 8 Texas 23, Kansas 0 William Penn 14, Taylor 10 Wis.-Stevens Pt. 34, North Central (Ill.) 27 Wisconsin 27, South Florida 10 Wittenberg 48, Oberlin 10 SOUTHWEST Austin 19, Howard Payne 16 Cent. Arkansas 52, Nicholls St. 18 Hardin-Simmons 30, Langston 29 Hendrix 48, Birmingham-Southern 31 Louisiana College 37, Bacone 13 NW Missouri St. 36, Cent. Oklahoma 13 Okla. Panhandle St. 70, Texas College 27 Oklahoma Baptist 51, Southwestern (Kan.) 7 S. Arkansas 62, NW Oklahoma St. 21 Sul Ross St. 27, Wayland Baptist 24 TCU 56, SMU 0 Texas A&M 35, Arkansas 28, OT FAR WEST CSU-Pueblo 45, W. New Mexico 7 Chadron St. 24, Mesa St. 13 Chapman 49, Whitworth 34 Idaho St. 44, Sacramento St. 24 Montana 38, N. Colorado 13 Montana St. 29, North Dakota 18 NM Highlands 45, Fort Lewis 10 South Alabama 34, Idaho 10 Stanford 20, Washington 13 GOLF GOLFRyder Cup Results At Gleneagles Resort (PGA Centenary Course) Gleneagles, Scotland Yardage: 7,243; Par: 72 EUROPE 10, UNITED STATES 6 Saturday Fourballs United States 2, Europe 1 Justin Rose and Henrik Stenson, Europe, def. Bubba Watson and Matt Kuchar, United States, 3 and 2. Jim Furyk and Hunter Mahan, United States, def. Ja mie Donaldson and Lee Westwood, Europe, 4 and 3. Patrick Reed and Jordan Spieth, United States, def. Thomas Bjorn and Martin Kaymer, Europe, 5 and 3. Jimmy Walker and Rickie Fowler, United States, halved with Rory McIlroy and Ian Poulter, Europe. Foursomes Europe 3, United States Jamie Donaldson and Lee Westwood, Europe, def. Zach Johnson and Matt Kuchar, United States, 2 and 1. Sergio Garcia and Rory McIlroy, Europe, def. Jim Furyk and Hunter Mahan, United States, 3 and 2. Jordan Spieth and Patrick Reed, United States, halved with Justin Rose and Martin Kaymer, Europe. Victor Dubuisson and Graeme McDowell, Europe, def. Jimmy Walker and Rickie Fowler, United States, 5 and 4. Friday Martin Kaymer, Eu rope., Europe, def. Jim Furyk and Matt Kuchar, United States, 2 up. Justin Rose and Henrik Stenson, Europe, def. Hunter Mahan and Zach Johnson, United. TV 2 DAY SCOREBOARD AUTO RACING 2 p.m. ESPN NASCAR, Sprint Cup, AAA 400, at Dover, Del. 4 p.m. ESPN2 NHRA, Midwest Nationals, at Madison, Ill. GOLF 7 a.m. NBC Ryder Cup, nal day matches, at Perthshire, Scotland 4 p.m. TGC Champions Tour, First Tee Open, nal round, at Pebble Beach, Calif. MAJOR LEAGUE BASEBALL 1:05 p.m. SUN Tampa Bay at Cleveland 1:30 p.m. TBS N.Y. Yankees at Boston 1:35 p.m. FS-Florida Miami at Washington 2 p.m. WGN Chicago Cubs at Milwaukee MOTORSPORTS 7 a.m. FS1 MotoGP World Championship, Grand Prix of Aragon, at Alcaniz, Spain 3 p.m. FS1 MotoGP Moto3, Grand Prix of Aragon, at Alcaniz, Spain 4 p.m. FS1 MotoGP Moto2, Grand Prix of Aragon, at Alcaniz, Spain NFL 1 p.m. CBS Carolina at Baltimore FOX Tampa Bay at Pittsburgh 4:05 p.m. CBS Jacksonville at San Diego 8:20 p.m. NBC New Orleans at Dallas SOCCER 10:55 a.m. NBCSN Premier League, Burnley at West Bromwich 8:30 p.m. ESPN2 MLS, N.Y. at Los Angeles Chargers, who upset the defending Super Bowl champion Seat tle Seahawks two weeks ago and then went cross country to beat the Buf falo Bills. Overcondent? I dont think so, with the maturity of our team, Rivers said. There is no guaran tee to you in this league. Every week is a ght, a battle. The Bolts (2-1), fueled by Rivers passing accu racy, will face a Jaguars team that is 0-3 and has been outscored 119-44. All 32 teams can win any week, Rivers said. I wouldnt be jumping on the bandwagon they are winless. Its the third week, Rivers said. Its not like it is Week 15 and they are winless. That is a different. Were going to get their best shot. We know what we were going to get. Jacksonville hopes its best shot will nally carry some punch now that rookie Blake Bor tles is the starting quar terback. Asked whether hes ready for his rst start, Bortles said: I dont know. Im going to go out there and prepare this week and do everything that Ive done go over everything I possibly can to get ready and Im going to go play foot ball, he said. Were go ing to play Sunday (to day) whether Im ready or not, so I might as well get as ready as I can possibly be. There are high expec tations for the Char gers. The Jaguars are young and inexperi enced, especially on of fense, and in the second year of a complete re build. Theyve lost 21 of their past 35 games by double digits, including four in a row dating to last years nale. The third pick overall in Mays draft, Bortles showed poise in throw ing for 223 yards and two touchdowns in the second half of a 44-17 loss to Indianapolis. He also threw an intercep tion that was returned for a touchdown. Learn from it, move on and try not to make that same mistake again, Bortles said. The Jags had to speed up their timetable for Bortles after Chad Henne struggled and the lopsided losses con tinued. Cornerback Brandon Flowers says the Char gers need to jump on the Jaguars early. Its like a new season for them with a new quarterback. Theyve got new life. Its almost like their record is 0-0 right now. Theyve got a new leader, Flow ers said. Weve got to make it tough for him. He can throw, he can scramble, he can get out of pressure. He has all the tools. We cant let him get any rhythm. Weve got to take it away. Chargers running back Danny Wood head is out for the sea son with a broken leg. Itll take a committee of Donald Brown, Bran den Oliver and Shaun Draughn to replace him. JAGS FROM PAGE C1 Europe star Justin Rose said. The nish line is nowhere near yet. Still have 4 1/2 points to earn tomor row. Thats four or ve guys that need to go out and play great golf, and thats nearly half the team. So the way I see it, we have some work to do. The Americans said they are up to the chal lenge. Everyone in our team room believes that we can do that, U.S. rookie Jordan Spi eth said. They have to win 4 1/2 points out of 12 matches. Brook line was 10-6, Medi nah was 10-6 the oth er way. Hopefully, we get some good pair ings and some guys out early to go make a move. Saturdays play be gan with Europe lead ing 5-3. The Unit ed States won 2 1/2 points in the morn ing fourballs to cut the lead to 6 1/2-5 1/2. Then the Europe ans seized command in the afternoon, win ning three of the al ternate-shot match es and halving the fourth. It was the sec ond day in a row Eu rope grabbed 3 1/2 points from the four somes. Lee Westwood and rookie Jamie Donald son got the ball rolling, beating Zach John son and Matt Kuchar 2 and 1 in the rst four somes. Then, Graeme Mc Dowell and rookie Victor Dubuisson ex tended the lead to 8 1/2-5 1/2, beating Ricky Fowler and Jim my Walker 5 and 4. Dubuisson has won both of his matches in a sensational debut, while Fowler remains without a win in his Ryder Cup career. The third win of the afternoon came from Rory McIlroy and Ser gio Garcia, who de feated Jim Furyk and Hunter Mahan 3 and 2. It was the marquee duos rst win in three matches after two halves. Its nice to put that rst win on the board, McIlroy said. In the nal match, Rose and Martin Kay mer halved with U.S. rookies Spieth and Patrick Reed. With the Americans 1-up go ing to the nal bun ker as Kaymer on No. 18 but had a bad lie and couldnt hit the ball toward the hole. Spieth missed a po tential match-winning putt from long range. The morning ses sion featured a re cord-breaking per formance by Rose and Henrik Stenson, who nished with 10 straight birdies to beat Bubba Watson and Matt Kuchar 3 and 2. The European duos 12-under score was a Ryder Cup record in fourballs. The 21-un der total for the two pairings was also a re cord. GOLF FROM PAGE C1 ALASTAIR GRANT / AP Patrick Reed celebrates after sinking a birdie putt to win the 13th hole during the fourball match on Saturday at Gleneagles, Scotland. trainings and October after October (and in one memorable case, November). When he quietly slips out of the visiting club house at Fenway Park and into history, the Yankees will lose more than their captain. The game will lose a Hall of Famer between the lines and an eloquent ambassador for the sport outside them. There will be a void that nobody will re place, Pittsburgh Pi rates manager Clint Hurdle said. But there will be another oppor tunity for someone in some other place. Like say, Pittsburgh or Los Angeles or a dozen other cities where a new generation of stars are poised to grab the man tle Jeter so delicately cu rated during 20 singu lar seasons that brought MLB into the 21st cen tury. Not that the likely candidates want to talk about it. Press Andrew Mc Cutchen, Mike Trout or Bryce Harper on if theyre part of the group who will pick up where Jeter left off and they sound downright Jeteresque: professional and polite, even if their play screams theyre more than ready to be the next chain in a link that stretches from Jeter to Cal Ripken Jr. to Mike Schmidt to Hank Aaron to Mickey Mantle and beyond. It really doesnt mat ter, said McCutchen, the reigning National League MVP. Im just trying to do the right thing, play the game the right way. If somebody feels I should be in that category, so be it. The 27-year-old cen ter elder has already accomplished some thing Jeter never strug gled with: transforming a moribund franchise into a contender. His trademark dreadlocks a bobbing blur as he darts around the bases, McCutchen has guid ed the Pirates to a sec ond consecutive playoff berth after two decades of losing. wJeter, though, has ve World Series rings tucked away some where while McCutch ens ngers are cur rently bare save for his wedding band. And maybe thats why it could take a handful of players to move the sport forward, rather than just one. Jeter be came Jeter in October. He became the face for his World Series and his postseason num bers, Oakland outeld er Jonny Gomes said. He earned it. Want to become the face of the game? Do it when the spotlight shines brightest. JETER FROM PAGE C1 third. Williams 1-yard scor ing run pushed that lead to 49-38 early in the fourth, a cushion that ultimately held up. Winston also came through with two key third-down conversions in the nal minutes af ter the Wolfpack kicked a eld goal to make it a one-possession game the last being a 20-yard run on third-and-11 with about 3 minutes left. Williams capped that drive with his 12-yard score, giving him 126 yards rushing for the day. FSU has now won 17 straight games against ACC opponents, a run that began after a loss here in October 2012. It was a frustrating nish for N.C. State considering its promis ing start. Brissett con nected with freshman Bo Hines for a 54-yard touchdown pass just 18 seconds into the game. Brissett later came up with a jaw-dropping play, ducking under the grasp of a Seminoles defender in the pocket then stay ing on his feet to break away from another near the sideline to throw an 8-yard scoring pass. NOLES FROM PAGE C1 GERRY BROOME / AP FSU quarterback Jameis Winston (5) looks to pass against North Carolina State on Saturday in Raleigh, N.C. PAGE 41 Sunday, September 28, 2014 DAILY COMMERCIAL C3 Associated Press EAST LANSING, Mich. Michigan States record-setting offense didnt score 73 points again, but it looked like it might in its nal Big Ten tuneup on Saturday. The No. 9 Spartans (3-1) settled for a 56-14 rout of Wyoming, com pleting their most ex plosive rst four games in school history with a 50.3-point average. Very impressive start of the game by our of fense, Michigan State coach Mark Dantonio said. Really, the rst six drives, every drive in the rst half, resulted in a touchdown. You have 42 in the rst half, tough to overcome that. De fensively, came up with three turnovers and a blocked kick, which is like a turnover, so big momentum swings in the football game. Jeremy Langford rushed for 137 of the Spartans 533 total yards, and Connor Cook was 6-for-8 through the air for 109 yards and two touchdowns, helping Michigan State score more than 50 points in back-to-back games for the rst time since 1978. Weve all been with each other so long, we have the timing, Cook said of an offense that came together in Octo ber last year and helped Michigan State n ish 13-1. It shows in games. The Spartans have scored 174 points in three home games head ing into a visit from un beaten No. 21 Nebraska next Saturday night. Tony Lippett had four catches for 76 yards and a touchdown, and Keith Mumphery scored on a run and a reception vs. the Cowboys (3-2). Wyoming nished with 286 yards of of fense but lost the ball on two fumbles and an interception, three mis takes too many against a team that is averaging nearly a point per min ute at home. Langford began the game with a 36-yard sweep of left end, re versing his eld to trav el more than 80 yards. Seven plays later, Cook bulled in from the 1 on an option keeper to open the scoring. Cook got his arm loosened up on the Spartans second se ries, hitting Lippett for 18, 14 and a TD toss of 19 yards on a post route between three Wyo ming defenders. It was 157-2 in total offense when the Cow boys nally got a rst down. They got more than that three plays later when Shaun Wick burst up the middle, eluded safety RJ Wil liamson and sprinted 57 yards to cut the de cit to 14-7. Week 5 PAUL NEWBERRY AP Sports Writer ATHENS, Ga. Todd Gur ley ran for a career-high 208 yards and two touchdowns, including a 51-yarder in the fourth quarter, as No. 12 Georgia bounced back from an early 10-0 decit and held off gritty Tennessee 35-32 on Saturday. The lackluster Bulldogs (31, 1-1 Southeastern Confer ence) struggled with the Vol unteers for the second year in a row. Tennessee (2-2, 0-1) wouldnt quit, even after Ja len Hurd fumbled a hand off and Josh Dawson fell on it in the end zone for a Georgia touchdown. Tennessee (2-2, 0-1) has lost 21 straight road games against ranked teams. The Vols might have pulled off the upset if senior quarter back Justin Worley had not been sidelined for part of the second half with an apparent elbow injury. Gurley had another bril liant showing, scoring on a 1-yard leap in the sec ond quarter before break ing straight up the middle for a TD with 9 1-2 minutes re maining. Worley wasnt too shabby, either. The senior quarter back completed 23 of 35 for 264 yards and three touch downs, leading a pair of touchdown drives after he re-entered the game in the fourth quarter. He hooked up with Pig Howard on a 31-yard touch down, followed by a twopoint conversion pass. Wor ley then went to Marquez North for a 6-yard score that pulled the Vols within a eld goal with 2:14 remaining. But Georgia recovered an onside kick and Gurley, ap propriately enough, picked up the clinching rst down on his 28th and nal carry of the game. With that, the Bulldogs breathed a big sigh of relief, much like they did a year ago when the Vols took them overtime in Knoxville before losing 34-31. Tennessee jumped ahead on Aaron Medleys 46-yard eld goal and Hurds 1-yard touchdown run. The Bull dogs appeared to be in con trol after three straight touchdowns put them ahead 21-10. Quarterback Hutson Ma son scored on a 3-yard boot leg, Gurley scored his rst TD with a Herschel Walk er-like leap over a pile at the goal line, and freshman Nick Chubb hauled in a 20-yard touchdown pass with just 1:17 left in the half. The Vols, in a sign of things to come, raced down the eld on an 83-yard drive that took less than a minute, capped off by Worleys 23yard touchdown pass to Ja son Croom that made it 2117 at the break. Both teams were slug gish in the third quarter, the Bulldogs curiously attempt ing to open up their passing game without much success, while Tennessee staggered after Worley left the game, appearing to slam his elbow off a Georgia players helmet while throwing a pass. Back up Nathan Peterman fum bled an attempted hand off with the Vols driving for a possible go-ahead touch down and also was called for intentional grounding. Worley returned to the game in the fourth, setting up a wild nish in which the teams kept trading touch downs before the clock nal ly ran out. Gurley turned in anoth er Heisman-like perfor mance, eclipsing his previ ous career high of 198 yards in the season-opening victo ry over Clemson. Most mem orably, he broke off a 26-yard run that included two broken tackles in the backeld, then a leap over a defender like a hurdler to tack on an ex tra 10 yards. Spartans rush for 539 yards in rout JOHN BAZEMORE / AP Georgia running back Todd Gurley (3) struggles to get away from Tennessee defensive lineman Corey Vereen (50) in the second half on Saturday in Athens, Ga. Georgia won 35-32. NO. 12 GEORGIA 35, TENNESSEE 32 NORTHWESTERN 29, PSU 6 NO. 6 TEXAS A&M 35, ARKANSAS 28 (OT) NO. 9 MICHIGAN STATE 56, WYOMING 14 Gurley helps Georgia sneak past Tennessee AL GOLDIS / AP Wyoming quarterback Colby Kirkegaard (11) is sacked by Michigan States Shilique Calhoun during the rst quarter on Saturday in East Lansing, Mich. GENE J. PUSKAR / AP Northwestern running back Justin Jackson (28) catches a pass in front of Penn State linebacker Mike Hull (43) during the rst quarter on Saturday in State College, Pa. Associated Press UNIVERSITY PARK, Pa. Trevor Siemi an ran for three touch downs and passed for 258 yards to lead North western past Penn State 29-6 on Saturday. Siemian, who was 21 of 37, and the Wild cats (2-2, 1-0) estab lished control early with short passes and ball-control offense that netted 361 yards. Northwesterns de fense held Penn State (4-1, 1-1) to 50 rush ing yards and just 266 overall, pressuring Penn State quarter back Christian Hack enberg all game. The Wildcats led 14-6 and broke the game open in the fourth when lineback er Anthony Walker in tercepted Hacken berg and returned it 49 yards for a score. On the next posses sion, Xavier Washing ton sacked Hacken berg, forcing a fumble. Jack Mitchells ensu ing 23-yard eld goal made it a three-score margin. Siemians oneyard plunge set the nal score. Northwesterns Mat thew Harris was carted off late in the third after a collision with Hack enberg. Harris was re sponsive and offered the thumbs-up signal while leaving the eld. Ten Wildcat receivers caught Siemian passes, including seven by Dan Natale for 113 yards. Justin Jackson rushed for 50 yards and War ren Long carried nine times for 49 yards. Any mistake the Wildcats made on of fense or special teams to give Penn State a chance at gaining mo mentum was quickly corrected by their de fense. Penn States Jesse Della Valle returned a punt 41 yards to Northwesterns 30 but the Wildcats limited the damage to a 36yard eld goal by Sam Ficken. The Wildcats lim ited Penn State to 18 rushing yards through three quarters, includ ing nine carries by Hackenberg. Northwestern tops Penn State in cakewalk STEPHEN HAWKINS AP Sports Writer ARLINGTON, Texas Kenny Hill and No. 6 Texas A&M provid ed quite a late thrill. Hill threw for 386 yards and four touchdowns, including a 25-yarder to Malcome Kennedy on the rst play of overtime, and the undefeated Aggies rallied to beat Arkansas 35-28 on Saturday. Johnny Manziel, Hills prede cessor, was on hand with the NFLs Cleveland Browns on a bye week, and the 2012 Heisman Trophy winner got to see his Ag gies improve to 5-0 for the rst time since 2001. Arkansas (3-2, 0-2), the only un ranked team in the SEC West, has lost 14 consecutive Southeastern Conference games since 2012. The Aggies (5-0, 2-0) trailed 28-14 before Hill threw two long scoring passes in the fourth quarter 86 yards to Edward Pope and 59 yards to Josh Reyn olds, the later with 2:08 left only two plays after Arkansas missed a eld goal. After Hills quick strike in over time, Arkansas faced fourthand-1 when a handoff went to Alex Collins, who nished with 131 yards rushing. But Collins was stuffed at the line by defen sive end Julien Obioha. Texas A&M had a chance to end the game in regulation, get ting the ball back with 1:18 left and no timeouts. The Aggies got a quick rst down on Kennedys 13-yard catch, but let the clock run out while facing fourthand-13 short of mideld and Kennedy got the big catch in overtime. Hill tosses 4 TDs as Aggies edge Arkansas PAGE 42 C4 DAILY COMMERCIAL Sunday, September 28, 2014 Box scores and results for games ending after 10 p.m. will appear in our next edition. AMERICAN LEAGUE EAST W L PCT GB WCGB L10 STR HOME AWAY x-Baltimore 95 66 .590 4-6 L-3 50-31 45-35 New York 83 78 .516 12 4 6-4 L-1 43-38 40-40 Toronto 83 78 .516 12 4 6-4 W-2 46-34 37-44 Tampa Bay 76 84 .475 18 11 4-6 L-3 36-45 40-39 Boston 71 90 .441 24 16 5-5 W-1 34-46 37-44 CENTRAL W L PCT GB WCGB L10 STR HOME AWAY x-Los Angeles 98 62 .613 4-6 L-1 52-29 46-33 Oakland 87 73 .544 11 4-6 W-1 48-33 39-40 Seattle 85 75 .531 13 2 4-6 W-2 39-40 46-35 Houston 70 90 .438 28 17 3-7 W-1 38-43 32-47 Texas 66 94 .413 32 21 8-2 L-1 32-47 34-47 NATIONAL LEAGUE EAST W L PCT GB WCGB L10 STR HOME AWAY x-Washington 95 66 .590 8-2 W-1 50-30 45-36 Atlanta 77 83 .481 17 9 2-8 L-2 42-39 35-44 New York 77 83 .481 17 9 5-5 L-2 38-41 39-42 Miami 77 84 .478 18 10 3-7 L-1 42-39 35-45 Philadelphia 73 87 .456 21 13 4-6 W-1 37-42 36-45 CENTRAL W L PCT GB WCGB L10 STR HOME AWAY z-St. Louis 89 71 .556 6-4 W-1 51-30 38-41 z-Pittsburgh 88 73 .547 1 7-3 L-1 51-30 37-43 Milwaukee 81 79 .506 8 5 3-7 L-2 41-38 40-41 Cincinnati 75 86 .466 14 12 4-6 W-1 43-37 32-49 Chicago 72 88 .450 17 14 6-4 W-3 41-40 31-48 WEST W L PCT GB WCGB L10 STR HOME AWAY x-Los Angeles 92 68 .575 6-4 W-3 43-36 49-32 y-San Francisco 87 74 .540 5 4-6 W-1 44-36 43-38 San Diego 77 84 .478 15 10 7-3 L-1 48-33 29-51 Colorado 66 94 .413 26 20 7-3 L-2 45-36 21-58 Arizona 63 97 .394 29 23 1-9 L-3 32-47 31-50 FRIDAYS GAMES Cleveland 1, Tampa Bay 0 Toronto 4, Baltimore 2 Minnesota 11, Detroit 4 Houston 3, N.Y. Mets 1 N.Y. Yankees 3, Boston 2 Oakland 6, Texas 2 Kansas City 3, Chicago White Sox 1 Seattle 4, L.A. Angels 3 FRIDAYS GAMES Washington 4, Miami 0, 1st game Philadelphia 5, Atlanta 4 Miami 15, Washington 7, 2nd game Houston 3, N.Y. Mets 1 Pittsburgh 3, Cincinnati 1 Chicago Cubs 6, Milwaukee 4 St. Louis 7, Arizona 6, 10 innings L.A. Dodgers 7, Colorado 4 San Diego 4, San Francisco 1 SATURDAYS GAMES Boston 10, N.Y. Yankees 4 Toronto 4, Baltimore 2 Tampa Bay at Cleveland, late Minnesota at Detroit, late Houston at N.Y. Mets, late Kansas City at Chicago White Sox, late Oakland at Texas, late L.A. Angels at Seattle, late SATURDAYS GAMES Cincinnati 10, Pittsburgh 6, 10 innings Washington 5, Miami 1 San Francisco 3, San Diego 1 Atlanta at Philadelphia, late Chicago Cubs at Milwaukee, late Houston at N.Y. Mets, late St. Louis at Arizona, late Colorado at L.A. Dodgers, late CHARLES KRUPA / AP Fan (foreground) holds up sign honoring New York Yankees shortstop Derek Jeter prior to a baseball game at Fenway Park on Saturday in Boston. TODAYS GAMES Tampa Bay (Cobb 10-8) at Cleveland (Salazar 6-8), 1:05 p.m. Baltimore (M.Gonzalez 9-9) at Toronto (Dickey 14-12), 1:07 p.m. Minnesota (Gibson 13-11) at Detroit (D.Price 14-12), 1:08 p.m. Houston (Tropeano 1-2) at N.Y. Mets (B.Colon 14-13), 1:10 p.m. N.Y. Yankees (Pineda 4-5) at Boston (Buchholz 8-10), 1:35 p.m. Kansas City (Ventura 14-10) at Chicago White Sox (Bassitt 1-1), 2:10 p.m. Oakland (Gray 13-10) at Texas (N.Martinez 5-11), 3:05 p.m. L.A. Angels (Cor.Rasmus 3-1) at Seattle (F.Hernandez 14-6), 4:10 p.m. END OF REGULAR SEASON TODAYS GAMES Houston (Tropeano 1-2) at N.Y. Mets (B.Colon 14-13), 1:10 p.m. Pittsburgh (Cole 11-5) at Cincinnati (Cueto 19-9), 1:10 p.m. Atlanta (A.Wood 11-11) at Philadelphia (Hamels 9-8), 1:35 p.m. Miami (H.Alvarez 12-6) at Washington (Zimmermann 13-5), 1:35 p.m. Chicago Cubs (Ja.Turner 5-11) at Milwaukee (Fiers 6-4), 2:10 p.m. San Diego (Erlin 4-4) at San Francisco (Heston 0-0), 4:05 p.m. Colorado (Bergman 3-4) at L.A. Dodgers (Greinke 16-8), 4:10 p.m. St. Louis (Wainwright 20-9) at Arizona (Collmenter 11-8), 4:10 p.m. END OF REGULAR SEASON AMERICAN LEAGUE LEADERS BATTING: Altuve, Houston, .342; VMartinez, Detroit, .336; Brantley, Cleveland, .328; Beltre, Texas, .325; Cano, Seat tle, .316; MiCabrera, Detroit, .315; JAbreu, Chicago, .314. RUNS: Trout, Los Angeles, 115; Dozier, Minnesota, 110; Bautista, Toronto, 101; MiCabrera, Detroit, 101; Kinsler, Detroit, 99; Brantley, Cleveland, 94; Reyes, Toronto, 93. RBI: Trout, Los Angeles, 111; MiCabrera, Detroit, 109; NCruz, Baltimore, 108; JAbreu, Chicago, 105; Pujols, Los Angeles, 105; Ortiz, Boston, 104; Bautista, Toronto, 103; VMartinez, Detroit, 103. HITS: Altuve, Houston, 223; Brantley, Cleveland, 199; Mi Cabrera, Detroit, 190; VMartinez, Detroit, 187; Cano, Se attle, 186; Kinsler, Detroit, 185; AJones, Baltimore, 179. DOUBLES: MiCabrera, Detroit, 52; Altuve, Houston, 46; Brantley, Cleveland, 45; Kinsler, Detroit, 40; Plouffe, Minnesota, 40; Trout, Los Angeles, 39; Cano, Seattle, 37; Pujols, Los Angeles, 37. TRIPLES: Bourn, Cleveland, 10; Eaton, Chicago, 10; Trout, Los Angeles, 9; De Aza, Baltimore, 8; Gardner, New York, 8; Kiermaier, Tampa Bay, 8; Rios, Texas, 8. HOME RUNS: NCruz, Baltimore, 40; Carter, Houston, 37; Trout, Los Angeles, 36; JAbreu, Chicago, 35; Bautista, Toronto, 35; Ortiz, Boston, 35; Encarnacion, Toronto, 34. STOLEN BASES: Altuve, Houston, 56; Ellsbury, New York, 39; RDavis, Detroit, 36; JDyson, Kansas City, 36; AEsco bar, Kansas City, 31; LMartin, Texas, 31; Reyes, Toronto, 30. PITCHING: Scherzer, Detroit, 18-5; Weaver, Los Angeles, 18-9; Kluber, Cleveland, 18-9; Shoemaker, Los Angeles, 16-4; WChen, Baltimore, 16-5; PHughes, Minnesota, 1610; Lester, Oakland, 16-11. ERA: Sale, Chicago, 2.17; FHernandez, Seattle, 2.34; Kluber, Cleveland, 2.44; Lester, Oakland, 2.46; Les ter, Oakland, 2.46; Richards, Los Angeles, 2.61; Cobb, Tampa Bay, 2.75. STRIKEOUTS: Kluber, Cleveland, 269; DPrice, Detroit, 263; Scherzer, Detroit, 252; FHernandez, Seattle, 241; Les ter, Oakland, 220; Sale, Chicago, 208; PHughes, Minne sota, 186. SAVES: Rodney, Seattle, 48; GHolland, Kansas City, 46; DavRobertson, New York, 39; ZBritton, Baltimore, 36. NATIONAL LEAGUE LEADERS BATTING: Morneau, Colorado, .319; JHarrison, Pittsburgh, .318; AMcCutchen, Pittsburgh, .314; Posey, San Fran cisco, .310; Revere, Philadelphia, .307; Span, Washing ton, .299; Puig, Los Angeles, .297. RUNS: Rendon, Washington, 111; Pence, San Francisco, 106; MCarpenter, St. Louis, 98; Yelich, Miami, 94; CGo mez, Milwaukee, 93; Span, Washington, 93; FFreeman, Atlanta, 92; DGordon, Los Angeles, 92. RBI: AdGonzalez, Los Angeles, 112; Stanton, Miami, 105; JUpton, Atlanta, 100; Howard, Philadelphia, 93; La Roche, Washington, 91; Desmond, Washington, 90; Hol liday, St. Louis, 90. HITS: Revere, Philadelphia, 182; Span, Washington, 181; Pence, San Francisco, 180; DGordon, Los Angeles, 176; McGehee, Miami, 175; Rendon, Washington, 175. DOUBLES: Lucroy, Milwaukee, 52; FFreeman, Atlanta, 43; AdGonzalez, Los Angeles, 40; Goldschmidt, Arizona, 39; Rendon, Washington, 39; AMcCutchen, Pittsburgh, 38. TRIPLES: DGordon, Los Angeles, 12; BCrawford, San Francisco, 10; Hechavarria, Miami, 10; Pence, San Fran cisco, 10; DPeralta, Arizona, 9; Puig, Los Angeles, 9. HOME RUNS: Stanton, Miami, 37; Rizzo, Chicago, 31; Duda, New York, 28; Frazier, Cincinnati, 28; JUpton, At lanta, 28; LaRoche, Washington, 26; Byrd, Philadelphia, 25; AdGonzalez, Los Angeles, 25; AMcCutchen, Pitts burgh, 25; Mesoraco, Cincinnati, 25. STOLEN BASES: DGordon, Los Angeles, 64; BHamilton, Cin cinnati, 56; Revere, Philadelphia, 48; CGomez, Milwau kee, 34; Span, Washington, 31; EYoung, New York, 30. PITCHING: Kershaw, Los Angeles, 21-3; Wainwright, St. Louis, 20-9; Cueto, Cincinnati, 19-9; Bumgarner, San Francisco, 18-10; Fister, Washington, 16-6; Greinke, Los Angeles, 16-8; WPeralta, Milwaukee, 16-11. ERA: Kershaw, Los Angeles, 1.77; Cueto, Cincinnati, 2.29; Wainwright, St. Louis, 2.38; Fister, Washington, 2.41; Hamels, Philadelphia, 2.47; HAlvarez, Miami, 2.70. STRIKEOUTS: Kershaw, Los Angeles, 239; Cueto, Cincin nati, 235; Strasburg, Washington, 235; Bumgarner, San Francisco, 219; Kennedy, San Diego, 207. SAVES: Kimbrel, Atlanta, 45; Rosenthal, St. Louis, 45; Jansen, Los Angeles, 44; FrRodriguez, Milwaukee, 43. Red Sox 10, Yankees 4 New York Boston ab r h bi ab r h bi ISuzuki rf 5 0 2 0 Betts 2b 4 2 1 0 Jeter dh 2 0 1 0 Bogarts ss 5 2 2 0 Cervelli ph-dh 3 1 2 0 Nava rf 4 1 3 3 BMcCn c 2 0 0 0 Cespds dh 4 1 2 2 AuRmn c 3 1 1 0 Rivero ph-dh 1 0 1 0 Headly 1b 5 1 2 0 Craig 1b 5 1 0 0 CYoung lf 4 0 2 1 Cecchin 3b 4 1 2 1 Drew ss 3 0 1 2 RCastll cf 3 1 3 1 Pirela 2b 3 1 1 0 Brentz lf 4 0 1 0 B.Ryan 3b 3 0 0 1 Vazquz c 3 1 1 1 EPerez cf 4 0 0 0 Totals 37 4 12 4 Totals 37 10 16 8 New York 000 000 130 4 Boston 180 001 00x 10 EHeadley (3), E.Perez 2 (2). DPNew York 3, Bos ton 1. LOBNew York 9, Boston 7. 2BHeadley (8), C.Young (8), Drew (14), Betts (11), Bogaerts (28), Rivero (2), Cecchini 2 (3). 3BPirela (2). SBR.Cas tillo (3). SFB.Ryan. IP H R ER BB SO New York Tanaka L,13-5 1 2 / 3 7 7 5 2 2 Claiborne 1 / 3 3 2 0 1 0 Mitchell 4 4 1 1 0 3 Whitley 2 2 0 0 0 4 Boston J.Kelly W,4-2 7 1 / 3 9 4 4 2 3 Layne 0 1 0 0 0 0 R.De La Rosa 1 2 / 3 2 0 0 0 4 Layne pitched to 1 batter in the 8th. HBPby Mitchell (Nava). UmpiresHome, Vic Carapazza; First, Larry Vanover; Second, Angel Hernandez; Third, Paul Nauert. T:04. A,147 (37,071). Nationals 5, Marlins 1 Miami Washington ab r h bi ab r h bi Yelich lf 3 0 0 0 Span cf 3 1 2 0 Solano 2b 4 0 0 0 MchlA ph-cf 2 0 0 0 McGeh 3b 4 1 2 0 Rendon 3b 3 0 1 0 Bour 1b 4 0 1 0 Werth rf 4 0 2 0 KHrndz cf 4 0 0 0 SouzJr rf 0 0 0 0 Vldspn rf 4 0 0 0 LaRoch 1b 3 0 0 1 Hchvrr ss 3 0 0 0 Zmrmn 1b 1 0 1 0 Mathis c 3 0 1 0 Dsmnd ss 3 1 1 0 Sltlmch ph 1 0 0 0 Harper lf 3 2 1 0 Eovaldi p 1 0 0 0 WRams c 4 1 2 0 GJones ph 1 0 0 0 ACarer 2b 4 0 1 3 Capps p 0 0 0 0 Strasrg p 1 0 0 1 DeSclfn p 0 0 0 0 Schrhlt ph 1 0 0 0 Blevins p 0 0 0 0 Clipprd p 0 0 0 0 Frndsn ph 0 0 0 0 Storen p 0 0 0 0 Totals 32 1 4 0 Totals 32 5 11 5 Miami 000 000 001 1 Washington 010 010 03x 5 EZimmerman (4), Rendon (15). DPMiami 1. LOB Miami 7, Washington 9. 2BMathis (7), A.Cabrera (9). SEovaldi, Strasburg. IP H R ER BB SO Miami Eovaldi L,6-14 7 8 2 2 3 5 Capps 1 / 3 3 3 3 2 0 DeSclafani 2 / 3 0 0 0 0 2 Washington Strasburg W,14-11 6 2 0 0 1 7 Blevins H,9 1 0 0 0 0 1 Clippard H,40 1 0 0 0 1 1 Storen 1 2 1 0 0 0 WPDeSclafani. UmpiresHome, Lance Barksdale; First, Alan Porter; Second, Gary Cederstrom; Third, Mark Ripperger. T:57. A,529 (41,408). Reds 10, Pirates 6, 10 innings Pittsburgh Cincinnati ab r h bi ab r h bi JHrrsn 3b 4 1 1 0 Negron 3b 4 1 2 0 Snider rf 3 0 0 0 Phillips 2b 5 2 2 0 GPolnc pr-rf 1 1 0 0 Frazier 1b 2 4 1 2 AMcCt cf 3 1 1 1 Mesorc c 4 0 1 2 NWalkr 2b 5 0 2 3 Heisey cf 5 1 1 1 SMarte lf 5 1 1 0 Ludwck lf 3 1 1 1 I.Davis 1b 3 0 0 0 YRdrgz rf 3 0 0 0 GSnchz 1b 2 0 0 0 B.Pena ph 1 0 0 0 Mercer ss 4 1 2 2 RSantg ss 5 1 1 4 CStwrt c 4 0 0 0 Simon p 2 0 0 0 FLirian p 2 1 1 0 Hoover p 0 0 0 0 JHughs p 0 0 0 0 Hannhn ph 1 0 0 0 Lambo ph 1 0 0 0 LeCure p 0 0 0 0 Hldzkm p 0 0 0 0 Ju.Diaz p 0 0 0 0 Tabata ph 1 0 0 0 AChpm p 0 0 0 0 JuWlsn p 0 0 0 0 Bourgs ph 1 0 0 0 Watson p 0 0 0 0 Axelrod p 0 0 0 0 Axford p 0 0 0 0 LFrms p 0 0 0 0 Totals 38 6 8 6 Totals 36 10 9 10 Pittsburgh 010 030 200 0 6 Cincinnati 300 010 200 4 10 Two outs when winning run scored. ES.Marte (6). DPPittsburgh 1. LOBPittsburgh 6, Cincinnati 5. 2BJ.Harrison (38), S.Marte (29), Mer cer (27), Negron (10). 3BN.Walker (3). HRMercer (12), Frazier (29), R.Santiago (2). SBJ.Harrison (18), G.Polanco (14). CSLudwick (2). IP H R ER BB SO Pittsburgh F.Liriano 5 5 4 3 5 5 J.Hughes 1 0 0 0 0 0 Holdzkom BS,1-2 1 2 2 2 0 2 Ju.Wilson 1 0 0 0 0 2 Watson 1 0 0 0 0 2 Axford L,0-1 1 / 3 1 3 3 2 0 LaFromboise 1 / 3 1 1 1 0 0 Cincinnati Simon 5 5 4 4 2 4 Hoover 1 0 0 0 0 2 LeCure 1 2 2 2 0 0 Ju.Diaz 1 1 0 0 0 2 A.Chapman 1 0 0 0 0 2 Axelrod W,2-1 1 0 0 0 0 1 HBPby J.Hughes (Y.Rodriguez), by Simon (J.Harri son), by LeCure (Snider). WPF.Liriano. UmpiresHome, Jim Joyce; First, Marvin Hudson; Second, Doug Eddings; Third, Cory Blaser. T:41. A,268 (42,319). Blue Jays 4, Orioles 2 Baltimore Toronto ab r h bi ab r h bi ACasill 3b-2b 4 0 0 0 Reyes ss 3 1 2 2 Pearce rf-1b 4 0 1 0 Bautist rf 4 0 0 0 A.Jones cf 4 1 1 1 Gose cf 0 0 0 0 N.Cruz dh 4 1 1 0 Encrnc dh 4 0 0 0 DYong lf 3 0 1 1 Valenci 3b 2 0 0 0 Pareds ph 1 0 0 0 DNavrr c 4 0 1 0 JHardy ss 3 0 0 0 Mayrry 1b 4 0 0 0 CWalkr 1b 2 0 0 0 Pompy cf-lf 3 0 0 0 Clevngr ph 0 0 0 0 Pillar lf-rf 3 2 2 0 Lough pr-rf 0 0 0 0 StTllsn 2b 2 1 1 1 CJosph c 2 0 0 0 Goins 2b 0 0 0 0 Schoop 2b 2 0 0 0 KJhnsn ph-3b 0 0 0 0 Totals 29 2 4 2 Totals 29 4 6 3 Baltimore 010 001 000 2 Toronto 002 010 10x 4 EA.Casilla (1), Brach (3), C.Walker (1). DPTo ronto 2. LOBBaltimore 4, Toronto 5. 2BPearce (26), Reyes (32), St.Tolleson (7). 3BN.Cruz (2). HRA.Jones (29). SBValencia (1). SSt.Tolleson. SFReyes. IP H R ER BB SO Baltimore W.Chen L,16-6 6 5 3 2 1 3 Brach 1 1 1 0 0 0 Z.Britton 1 0 0 0 1 0 Toronto Happ W,11-11 6 1 / 3 4 2 2 2 4 Aa.Sanchez H,7 1 2 / 3 0 0 0 2 1 Janssen S,25-30 1 0 0 0 0 0 UmpiresHome, Jim Wolf; First, Jeff Gosney; Second, David Rackley; Third, Tony Randazzo. T:25. A,996 (49,282). Giants 3, Padres 1 San Diego San Francisco ab r h bi ab r h bi Venale rf 5 1 1 0 GBrwn cf 4 0 2 0 Spngnr 2b 4 0 2 0 MDuffy 2b 4 2 2 0 Grandl c 1 0 0 1 Belt 1b 3 1 1 1 S.Smith lf 4 0 2 0 Susac c 3 0 1 0 Solarte 3b 4 0 0 0 Arias 3b 3 0 0 0 Amarst ss 4 0 0 0 Sandovl ph-3b 1 0 0 0 Goeert 1b 3 0 0 0 BCrwfr ss 4 0 1 2 Maybin cf 3 0 0 0 CDmng lf 4 0 0 0 Stults p 3 0 0 0 J.Perez rf 3 0 1 0 Thayer p 0 0 0 0 Peavy p 1 0 0 0 RAlvrz p 0 0 0 0 Duvall ph 1 0 0 0 Rivera ph 1 0 0 0 Affeldt p 0 0 0 0 Pence ph 1 0 0 0 Strckln p 0 0 0 0 SCasill p 0 0 0 0 Totals 32 1 5 1 Totals 32 3 8 3 San Diego 000 010 000 1 San Francisco 100 000 02x 3 ESpangenberg (5), J.Perez (1). LOBSan Diego 9, San Francisco 7. 2BSpangenberg (2), Belt (7). SB Spangenberg 2 (4). SFGrandal. IP H R ER BB SO San Diego Stults 7 6 1 1 0 5 Thayer L,4-5 2 / 3 2 2 2 2 1 R.Alvarez 1 / 3 0 0 0 0 1 San Francisco Peavy 5 4 1 1 3 3 Affeldt 2 1 0 0 0 3 Strickland W,1-0 1 0 0 0 0 1 S.Casilla S,19-23 1 0 0 0 0 1 HBPby Affeldt (Goebbert). UmpiresHome, Chris Guccione; First, Brian Knight; Second, Tom Hallion; Third, Eric Cooper. T:35. A,157 (41,915). LATE FRIDAY BOX SCORES Indians 1, Rays 0 Tampa Bay Cleveland ab r h bi ab r h bi Zobrist 2b 4 0 0 0 Bourn cf 4 0 0 0 DeJess dh 4 0 0 0 JRmrz ss 3 1 1 1 Longori 3b 4 0 1 0 Brantly lf 3 0 0 0 Loney 1b 4 0 2 0 CSantn 1b 2 0 1 0 Frnkln ss 4 0 0 0 Kipnis dh 3 0 0 0 Joyce rf 3 0 1 0 YGoms c 2 0 0 0 Guyer lf 3 0 0 0 DvMrp rf 3 0 0 0 Kiermr cf 2 0 1 0 Chsnhll 3b 3 0 0 0 Hanign c 3 0 0 0 Aviles 2b 3 0 1 0 Totals 31 0 5 0 Totals 26 1 3 1 Tampa Bay 000 000 000 0 Cleveland 100 000 00x 1 DPTampa Bay 1, Cleveland 1. LOBTampa Bay 6, Cleveland 3. 3BKiermaier (8). HRJ.Ramirez (2). IP H R ER BB SO Tampa Bay Archer L,10-9 7 2 / 3 3 1 1 2 6 Beliveau 1 / 3 0 0 0 0 0 Cleveland Kluber W,18-9 8 5 0 0 2 11 Allen S,24-28 1 0 0 0 0 1 UmpiresHome, Brian ONora; First, D.J. Reyburn; Second, Jeff Kellogg; Third, Adam Hamari. T:33. A,131 (42,487). Marlins 15, Nationals 7 Second Game Miami Washington ab r h bi ab r h bi Yelich cf-lf 5 1 1 0 MchlA cf 5 1 2 0 Solano 2b 6 0 2 0 Frndsn 3b 5 1 2 2 McGeh 3b 5 1 1 1 Werth rf 4 2 3 1 GJones rf 5 2 3 0 WRams c 5 0 1 1 ARams p 0 0 0 0 TMoore 1b 5 1 2 1 DeSclfn p 0 0 0 0 SouzJr lf 4 1 1 1 RJhnsn lf 4 2 2 1 Espinos ss 3 0 0 0 Hatchr p 0 0 0 0 Koerns 2b 3 1 0 0 Vldspn rf 1 1 1 0 T.Hill p 2 0 1 0 Bour 1b 4 4 3 2 Detwilr p 0 0 0 0 Realmt c 5 2 3 4 Hairstn ph 1 0 0 0 Hchvrr ss 5 1 4 2 XCeden p 0 0 0 0 Heaney p 2 0 1 0 Barrett p 0 0 0 0 Lucas ph 1 0 0 0 RSorin p 0 0 0 0 Penny p 0 0 0 0 Zmrmn ph 1 0 0 0 Capps p 0 0 0 0 Stmmn p 0 0 0 0 KHrndz ph-cf 2 1 1 4 Matths p 0 0 0 0 Totals 45 15 22 14 Totals 38 7 12 6 Miami 110 050 305 15 Washington 301 011 100 7 ESouza Jr. (1), Barrett (1). DPMiami 1, Washington 3. LOBMiami 6, Washington 8. 2BG.Jones (33), R.Johnson (15), Bour (3), Realmuto (1), Hechavarria (20), Michael A.Taylor (3), Werth (37). 3BRealmuto (1), Werth (1). HRK.Hernandez (2), T.Moore (4), Souza Jr. (2). CSHechavarria (5). IP H R ER BB SO Miami Heaney 4 6 4 4 1 3 Penny 1 2 / 3 3 2 2 0 1 Capps H,1 1 / 3 1 0 0 0 0 Hatcher 1 1 1 1 0 1 A.Ramos W,7-0 H,21 1 0 0 0 0 1 DeSclafani 1 1 0 0 0 1 Washington T.Hill L,0-1 4 2 / 3 10 7 7 2 4 Detwiler 1 1 / 3 2 0 0 0 1 X.Cedeno 0 3 3 2 0 0 Barrett 1 1 0 0 0 1 R.Soriano 1 0 0 0 0 0 Stammen 0 6 5 5 0 0 Mattheus 1 0 0 0 0 0 X.Cedeno pitched to 3 batters in the 7th. Stammen pitched to 6 batters in the 9th. HBPby Penny (Kobernus), by Heaney (Espinosa), by Capps (Werth), by T.Hill (McGehee). UmpiresHome, Mark Ripperger; First, Toby Basner; Second, Alan Porter; Third, Gary Cederstrom. T:34. A ,190 (41,408). Cubs 6, Brewers 4 Chicago Milwaukee ab r h bi ab r h bi Coghln lf 4 3 2 1 CGomz cf 4 1 2 1 J.Baez ss 5 2 3 2 RWeks 2b 3 0 0 1 Rizzo 1b 3 0 1 1 Braun rf 3 0 1 0 Soler rf 5 0 1 2 Lucroy c 5 0 0 0 Valuen 3b 2 0 0 0 KDavis lf 4 0 1 0 Alcantr 2b 4 0 0 0 GParra lf 1 0 0 0 Szczur cf 4 0 0 0 JRogrs 1b 2 0 0 0 RLopez c 4 0 1 0 Overay ph-1b 3 0 0 0 Jokisch p 1 0 0 0 HGomz 3b 3 1 1 0 Watkns ph 1 1 1 0 Segura ss 4 2 3 1 Straily p 0 0 0 0 JNelsn p 2 0 0 0 Olt ph 1 0 0 0 Estrad p 0 0 0 0 Grimm p 0 0 0 0 Gennett ph 1 0 0 0 NRmrz p 0 0 0 0 Grzlny p 0 0 0 0 Kalish ph 1 0 0 0 Kintzlr p 0 0 0 0 Strop p 0 0 0 0 Clark ph 1 0 0 0 HRndn p 0 0 0 0 Duke p 0 0 0 0 Totals 35 6 9 6 Totals 36 4 8 3 Chicago 102 020 100 6 Milwaukee 011 001 010 4 EValbuena (8), J.Baez (10). DPMilwaukee 1. LOB Chicago 7, Milwaukee 11. 2BCoghlan (28), Rizzo (27), Watkins (3), Braun (30), K.Davis (37), H.Gomez (1), Segura (14). HRCoghlan (9), Segura (5). IP H R ER BB SO Chicago Jokisch 4 3 2 1 4 2 Straily 1 1 0 0 0 1 Grimm H,10 1 2 1 1 0 2 N.Ramirez W,3-3 H,16 1 0 0 0 0 1 Strop H,20 1 2 1 1 0 2 H.Rondon S,28-32 1 0 0 0 0 1 Milwaukee J.Nelson L,2-9 4 1 / 3 6 5 5 1 4 Estrada 1 2 / 3 2 0 0 0 2 Gorzelanny 1 / 3 1 1 1 2 0 Kintzler 1 2 / 3 0 0 0 0 0 Duke 1 0 0 0 1 1 HBPby Grimm (R.Weeks, Braun), by Gorzelanny (Coghlan). WPJ.Nelson 2. UmpiresHome, Ben May; First, Scott Barry; Second, Jeff Nelson; Third, John Tumpane. T:34. A,880 (41,900). PAGE 43 Sunday, September 28, 2014 DAILY COMMERCIAL C5 Week 5 GENARO C. ARMAS AP Sports Writer MADISON, Wis. Melvin Gordon rushed for 181 yards and two touchdowns, and No. 19 Wisconsin overcame a sluggish start to hold off South Florida 27-10 on Saturday. Gordon scored on car ries of seven and 43 yards on the Badgers rst two drives of the second half after running room nally opened up for the star tailback. The Bulls (2-3) put up an admirable effort in their rst road con test of the year, getting to within 17-10 midway through the third quar ter on Rodney Adams 26-yard touchdown run off a reverse. South Floridas defense had held Gordon to 50 yards in the rst half. But Wisconsin (3-1) inched away in the nal 20 minutes to ex tend their nonconfer ence safety Lubern Figaro. Linebacker Vince Biegel recovered at the 10. From there, Wiscon sin marched 90 yards in 18 plays on a series that ended with Tanner McEvoys 1-yard touch down pass to tight end Sam Arneson with 5:17 left for a 17-point lead with 5:17 left. Still, the offense re mains a work in prog ress with Big Ten play beginning next week at Northwestern. A week after compil ing a league-record 644 yards rushing, Wiscon sin had to overcome a very slow start. South Florida won the matchup in the trench es in the rst half, even with starting defensive tackle Todd Chandler missing the game When Wisconsin ball carriers did slip through, they were met by a gag gle of Bulls ying to the ball. Gordon had just 50 yards on 17 carries in the rst half; the previ ous week Gordon had amassed 179 yards and four touchdowns by halftime alone. Bulls put up fight but fall to Badgers 27-10 NO. 19 WISCONSIN 27, SOUTH FLORIDA 10 MORRY GASH / AP USFs Deonte Welch catches a pass in front of Wisconsins Sojourn Shelton on Saturday in Madison, Wis. PAGE 44 C6 DAILY COMMERCIAL Sunday, September 28, 2014 rf nt b fnf rfntbr rfntbffr r fn tbbGreat greens, lush fair ways, friendly staff.Come enjoy the updated Continental for the 1st time again!SEPTEMBER 4-SOME SPECIAL(golf & car t)$48plus tax.Or Enjoy Golf, Hot Dog & Draft Beer or Soda For$17plus tax per personHome of Step he n Wres h Go lf Acad em y rrf rfr nf tb rf r rfbn rn r b. Ca ll fo r Te e Ti me s352-753-7711Te e Ti me s ma y be ma de 3 da ys in ad va nc e. pro pe r gol f at ti re re qu ir ed r f r ntb Vo ted #1 by STYLE Magazine 2014 To m Leimberger PGA Class A, (352)753-7711 Joe Redoutey Master Club Fitter (352)205-0217ALL INCLUSIVE END OF SUMMER GOLF SPECIAL18 HOLES OF GOLF BURGER & DRAFTBEER OR SOFT DRINK$3499+ TA XTUESDA Y, SEPT 23RD TUESDA Y, SEPT 30TH PLEASE CALL PRO-SHO P Week 5 No. 1 FLORIDA ST. 56, NC STATE 41 Florida St. 7 14 21 14 56 NC State 24 0 14 3 41 First Quarter NCStHines 54 pass from Brissett (Sade kick), 14:42. FSUWilson 32 pass from Winston (Aguayo kick), 12:03. NCStThornton 3 run (Sade kick), 6:05. NCStFG Sade 37, 5:16. NCStAlston 8 pass from Brissett (Sade kick), 2:06. Second Quarter FSUK.Williams 4 run (Aguayo kick), 13:51. FSUC.Green 22 pass from Winston (Aguayo kick), 11:58. Third Quarter NCStDayes 10 pass from Brissett (Sade kick), 12:40. FSUD.Cook 19 run (Aguayo kick), 8:14. NCStThornton 10 run (Sade kick), 6:37. FSUWilson 15 pass from Winston (Aguayo kick), 5:06. FSUGreene 4 pass from Winston (Aguayo kick), 3:24. Fourth Quarter FSUK.Williams 1 run (Aguayo kick), 12:23. NCStFG Sade 25, 6:08. FSUK.Williams 12 run (Aguayo kick), 2:07. A,583. FSU NCSt First downs 28 29 Rushes-yards 33-166 37-161 Passing 365 359 Comp-Att-Int 26-38-2 32-50-0 Return Yards 18 25 Punts-Avg. 3-39.7 5-47.6 Fumbles-Lost 2-2 3-2 Penalties-Yards 10-73 7-68 Time of Possession 27:33 32:27 INDIVIDUAL STATISTICS RUSHINGFlorida St., K.Williams 21-126, D.Cook 6-45, Team 1-(minus 2), Winston 5-(minus 3). NC State, Thornton 18-85, Brissett 13-38, Samuels 2-30, Underwood 1-5, Dayes 3-3. PASSINGFlorida St., Winston 26-38-2-365. NC State, Brissett 32-48-0-359, Hines 0-1-0-0, Leatham 0-1-0-0. RECEIVINGFlorida St., Greene 11-125, Wilson 6-109, K.Williams 3-29, C.Green 2-31, Whiteld 2-26, Ru dolph 1-40, D.Cook 1-5. NC State, Hines 8-103, Thornton 7-60, Alston 5-54, Grinnage 4-87, Dayes 4-35, Valdes-Scantling 3-13, Purvis 1-7. No. 5 AUBURN 45, LOUISIANA TECH 17 Louisiana Tech 0 3 7 7 17 Auburn 7 17 0 21 45 First Quarter AubArtis-Payne 5 run (Carlson kick), 8:28. Second Quarter AubFG Carlson 25, 11:49. AubD.Williams 18 pass from Marshall (Carlson kick), 1:36. AubBray 37 pass from Marshall (Carlson kick), :34. LaTFG J.Barnes 25, :00. Third Quarter LaTDixon 1 run (J.Barnes kick), 6:54. Fourth Quarter AubBray 44 pass from Marshall (Carlson kick), 14:24. AubBray 76 punt return (Carlson kick), 13:21. LaTDixon 9 run (J.Barnes kick), 10:27. AubUzomah 15 pass from Johnson (Carlson kick), 7:53. A,451. LaT Aub First downs 14 23 Rushes-yards 33-105 48-254 Passing 216 219 Comp-Att-Int 20-35-1 14-22-0 Return Yards 0 165 Punts-Avg. 9-42.2 5-36.2 Fumbles-Lost 3-1 0-0 Penalties-Yards 5-40 5-51 Time of Possession 31:43 28:17 INDIVIDUAL STATISTICS RUSHINGLouisiana Tech, Craft 9-41, Dixon 14-29, Martin 2-16, Henderson 3-15, Lee 1-9, King 2-8, Sokol 2-(minus 13). Auburn, Artis-Payne 22-116, Marshall 13-105, Barber 3-24, Grant 8-13, Thomas 1-(minus 1), Johnson 1-(minus 3). PASSINGLouisiana Tech, Sokol 20-35-1-216. Au burn, Marshall 10-17-0-166, Johnson 4-5-0-53. RECEIVINGLouisiana Tech, T.Taylor 8-80, Dixon 4-21, Lee 3-24, Turner 2-41, Gaston 1-36, S.Grifn 1-11, Sokol 1-3. Auburn, Bray 3-91, Louis 3-26, D.Williams 2-33, Coates 2-19, Uzomah 1-15, Artis-Payne 1-12, Truitt 1-12, Thomas 1-11. No. 6 TEXAS A&M 35, ARKANSAS 28, OT Arkansas 7 14 7 0 0 28 Texas A&M 7 7 0 14 7 35 First Quarter TAMB.Williams 13 run (Lambo kick), 13:55. ArkJon.Williams 9 run (Henson kick), 9:06. Second Quarter ArkA.Collins 50 run (Henson kick), 13:21. TAMPope 8 pass from Hill (Lambo kick), 10:06. ArkIrwin-Hill 51 run (Henson kick), 1:03. Third Quarter ArkDerby 44 pass from B.Allen (Henson kick), 5:02. Fourth Quarter TAMPope 86 pass from Hill (Lambo kick), 11:59. TAMReynolds 59 pass from Hill (Lambo kick), 2:08. Overtime TAMKennedy 25 pass from Hill (Lambo kick). A,113. Ark TAM First downs 22 21 Rushes-yards 47-285 27-137 Passing 199 386 Comp-Att-Int 15-27-0 21-41-1 Return Yards 7 (-1) Punts-Avg. 7-43.4 6-40.8 Fumbles-Lost 3-1 0-0 Penalties-Yards 8-76 9-70 Time of Possession 37:00 23:00 INDIVIDUAL STATISTICS RUSHINGArkansas, A.Collins 21-131, Jon.Wil liams 18-95, Irwin-Hill 1-51, Marshall 3-19, Team 1-(minus 1), B.Al len 2-(minus 4), Derby 1-(minus 6). Texas A&M, Carson 8-55, Hill 6-30, T.Williams 9-26, B.Williams 2-19, Noil 1-10, Kennedy 1-(minus 3). PASSINGArkansas, B.Allen 15-27-0-199. Texas A&M, Hill 21-41-1-386. RECEIVINGArkansas, Henry 4-36, Derby 3-58, Hatcher 3-35, Cornelius 2-22, Edwards 1-28, Sprinkle 1-13, Hol lister 1-7. Texas A&M, Pope 4-151, Reynolds 4-89, SealsJones 4-29, Kennedy 3-44, Holmes 2-38, T.Williams 1-15, Noil 1-8, Carson 1-6, Tabuyo 1-6. No. 9 MICHIGAN ST. 56, WYOMING 14 Wyoming 7 7 0 0 14 Michigan St. 21 21 7 7 56 First Quarter MSUCook 1 run (Geiger kick), 11:11. MSULippett 19 pass from Cook (Geiger kick), 5:47. WyoWick 57 run (Williams kick), 2:40. MSUMumphery 33 run (Geiger kick), 1:19. Second Quarter MSUPrice 19 pass from Cook (Geiger kick), 13:53. MSUMumphery 6 pass from OConnor (Geiger kick), 4:11. MSUD.Williams 4 run (Geiger kick), 1:24. WyoKrill 4 pass from Kirkegaard (Williams kick), :42. Third Quarter MSULangford 29 run (Geiger kick), 4:02. Fourth Quarter MSUOConnor 12 run (Cronin kick), 12:08. A,227. Wyo MSU First downs 11 25 Rushes-yards 27-98 52-338 Passing 188 195 Comp-Att-Int 16-24-1 16-20-0 Return Yards 1 19 Punts-Avg. 4-41.5 1-43.0 Fumbles-Lost 2-2 0-0 Penalties-Yards 5-43 9-84 Time of Possession 24:29 35:31 INDIVIDUAL STATISTICS RUSHINGWyoming, Wick 5-85, May 8-40, Hill 6-9, Kirkegaard 8-(minus 36). Michigan St., Langford 16137, Hill 10-71, Mumphery 3-46, D.Williams 9-34, Terry 3-16, Shelton 1-15, OConnor 3-14, Cook 3-3, Burbridge 1-2, Kings Jr. 2-2, Team 1-(mi nus 2). PASSINGWyoming, Kirkegaard 16-24-1-188. Mich igan St., Cook 8-12-0-126, Terry 6-6-0-56, OConnor 2-2-0-13. RECEIVINGWyoming, Rufran 4-35, Hollister 3-33, Claiborne 2-59, Krill 2-6, E.Nzeocha 2-2, Gentry 1-41, Maulhardt 1-9, Wick 1-3. Michigan St., Lippett 4-76, Shelton 2-20, Barksdale 2-16, Madaris 2-15, Langford 2-12, Price 1-19, D.Williams 1-17, Hill 1-14, Mumphery 1-6. No. 12 GEORGIA 35, TENNESSEE 32 Tennessee 10 7 0 15 32 Georgia 7 14 0 14 35 First Quarter TennFG Medley 46, 11:39. TennHurd 1 run (Medley kick), 5:04. GeoMason 3 run (Morgan kick), 1:07. Second Quarter GeoGurley 1 run (Morgan kick), 8:45. GeoChubb 20 pass from Mason (Morgan kick), 1:17. TennCroom 23 pass from Worley (Medley kick), :18. Fourth Quarter GeoGurley 51 run (Morgan kick), 9:31. TennHoward 31 pass from Worley (Helm pass from Worley), 8:07. GeoJ.Dawson recovered fumble in end zone (Mor gan kick), 4:27. TennNorth 6 pass from Worley (Medley kick), 2:14. A,746. Tenn Geo First downs 22 25 Rushes-yards 34-117 53-289 Passing 284 147 Comp-Att-Int 27-44-0 16-25-2 Return Yards 4 41 Punts-Avg. 8-44.6 7-42.0 Fumbles-Lost 2-2 2-0 Penalties-Yards 7-49 7-57 Time of Possession 28:13 31:47 INDIVIDUAL STATISTICS RUSHINGTennessee, Hurd 24-119, Malone 1-20, Howard 1-8, Lane 5-1, Peterman 1-(minus 14), Worley 2-(minus 17). Geor gia, Gurley 28-208, Chubb 11-32, Mason 10-30, Michel 3-17, Hicks 1-2. PASSINGTennessee, Worley 23-35-0-264, Peterman 4-9-0-20. Georgia, Mason 16-25-2-147. RECEIVINGTennessee, Wolf 5-69, Malone 5-43, Croom 4-60, Howard 4-46, Hurd 3-19, North 3-15, Jo.Johnson 1-24, Young 1-6, Robertson 1-2. Georgia, Bennett 4-31, Gurley 4-30, Conley 3-30, R.Davis 2-14, Chubb 1-20, Michel 1-16, Maxey 1-6. No. 19 WISCONSIN 27, USF 10 South Florida 3 0 7 0 10 Wisconsin 3 0 17 7 27 First Quarter USFFG Kloss 26, 6:49. WisFG Gaglianone 24, :52. Third Quarter WisGordon 7 run (Gaglianone kick), 10:43. WisGordon 43 run (Gaglianone kick), 8:04. USFAdams 26 run (Kloss kick), 6:05. WisFG Gaglianone 19, 1:04. Fourth Quarter WisArneson 1 pass from McEvoy (Gaglianone kick), 5:17. A,111. USF Wis First downs 8 26 Rushes-yards 19-72 57-294 Passing 173 160 Comp-Att-Int 8-19-1 11-18-0 Return Yards 23 43 Punts-Avg. 5-45.6 3-38.0 Fumbles-Lost 2-1 2-1 Penalties-Yards 11-90 4-35 Time of Possession 19:09 40:51 INDIVIDUAL STATISTICS RUSHINGSouth Florida, Mack 10-34, Adams 2-33, Johnson 2-7, Swanson 1-6, White 4-(minus 8). Wisconsin, Gordon 32-181, Clement 16-77, McEvoy 6-23, Rushing 1-8, Ogunbowale 2-5. PASSINGSouth Florida, White 8-19-1-173. Wis consin, McEvoy 11-18-0-160. RECEIVINGSouth Florida, Swanson 2-74, McFarland 2-44, Adams 2-20, Welch 1-26, Price 1-9. Wisconsin, Erickson 6-91, Clement 1-28, Fredrick 1-17, Fumagalli 1-14, Doe 1-9, Arneson 1-1. KENTUCKY 17, VANDERBILT 7 Vanderbilt 0 7 0 0 7 Kentucky 7 10 0 0 17 First Quarter KyTimmons 20 pass from Towles (MacGinnis kick), 6:10. Second Quarter VanSims 13 interception return (Openshaw kick), 10:19. KyFG MacGinnis 44, 6:09. KyTowles 1 run (MacGinnis kick), :08. A,940. Van Ky First downs 8 23 Rushes-yards 22-54 50-183 Passing 85 201 Comp-Att-Int 8-25-3 23-30-1 Return Yards 13 56 Punts-Avg. 8-44.8 5-46.8 Fumbles-Lost 1-0 4-2 Penalties-Yards 2-10 5-55 Time of Possession 21:38 38:22 INDIVIDUAL STATISTICS RUSHINGVanderbilt, Webb 13-44, Seymour 3-33, Team 1-0, Freebeck 5-(minus 23). Kentucky, Heard 15-62, Kemp 8-60, Horton 6-31, S.Williams 5-27, Towles 15-3, Timmons 1-0. PASSINGVanderbilt, Freebeck 8-25-3-85. Kentucky, Towles 23-30-1-201. RECEIVINGVanderbilt, Duncan 3-48, Rayford 2-21, Scheu 1-7, Dorrell 1-6, Webb 1-3. Kentucky, J.Blue 4-35, S.Wil liams 3-39, Robinson 3-34, Timmons 3-34, Baker 2-15, Heard 2-6, G.Johnson 2-2, T.Williams 1-15, Warren 1-9, Kemp 1-8, C.Walker 1-4. No. 25 KANSAS ST. 58, UTEP 28 UTEP 0 0 7 21 28 Kansas St. 10 21 21 6 58 First Quarter KStFG McCrane 25, 9:36. KStWaters 1 run (McCrane kick), 2:01. Second Quarter KStC.Jones 3 run (McCrane kick), 8:52. KStLockett 58 punt return (McCrane kick), 6:27. KStC.Jones 9 run (McCrane kick), :17. Third Quarter KStC.Jones 4 run (McCrane kick), 13:00. KStTrujillo 44 pass from Waters (McCrane kick), 9:48. UTEPHamilton 4 pass from Showers (Mattox kick), 5:26. KStRobinson 40 run (McCrane kick), 2:55. Fourth Quarter UTEPAa.Jones 3 pass from Showers (Mattox kick), 9:35. KStHubener 2 run (kick failed), 5:05. UTEPHamilton 69 pass from Showers (Mattox kick), 3:29. UTEPTomlinson 2 pass from Showers (Mattox kick), :17. A,899. UTEP KSt First downs 10 16 Rushes-yards 31-59 37-188 Passing 201 263 Comp-Att-Int 18-28-0 13-19-0 Return Yards 0 150 Punts-Avg. 8-39.3 3-29.7 Fumbles-Lost 1-0 2-1 Penalties-Yards 5-40 6-55 Time of Possession 31:28 28:32 INDIVIDUAL STATISTICS RUSHINGUTEP, Aa.Jones 19-47, Jeffery 6-17, Hamm 1-2, Showers 4-(minus 2), Team 1-(minus 5). Kansas St., C.Jones 12-76, Robinson 9-56, Waters 4-29, Leverett Jr. 5-20, Morss 1-9, Hubener 4-9, Ertz 1-6, Lochbihler 1-(minus 17). PASSINGUTEP, Showers 18-28-0-201. Kansas St., Waters 10-15-0-209, Hubener 3-4-0-54. RECEIVINGUTEP, Hamilton 5-112, Bell 4-16. KANSAS STATE 58, UTEP 28 DAVE SKRETTA AP Sports Writer MANHATTAN, Kan. Kan sas State forced UTEP into threeand-outs on its rst ve posses sions, leaving Wildcats coach Bill Snyder pleased when the Miners nally picked up a long-awaited rst down. It gave me something to com plain about at halftime, Snyder said with a wry smile. Charles Jones ran for three touchdowns, Tyler Lockett re turned a punt for another score and Snyders 25th-ranked Wild cats romped to a 58-28 victory Saturday. DeMarcus Robinson and Jake Waters also had touchdown runs, and Waters threw for 209 yards and another score as the Wildcats (3-1) nished non-con ference play by taking out their frustrations from a close loss to fth-ranked Auburn on the hap less Miners. UTEP (2-2) managed one rst down and 23 yards of offense in the rst half, when Kansas State raced to a 31-0 lead. Running back Aaron Jones, the nations second-leading rusher, was held to 47 yards all but nine of them after halftime. Kansas States run defense was one of the best defenses Ive seen in a long time, UTEP coach Sean Kugler said. They were very ef fective at stopping the run. Jameil Showers threw four TD passes for the Miners, all with the game well out of reach. Kansas State blew a chance to beat Auburn nine days ago in part by missing three eld goals, but took control early Saturday mainly on the strength of its spe cial teams. The Wildcats blocked a punt on the games rst series to set up a eld goal, then had another block wiped out by a referees in advertent whistle. Kansas State wide receiver Tyler Lockett (16) heads downeld as he runs back a punt for a touchdown during the rst half against UTEP on Saturday in Manhattan, Kan. Kansas States Jake Waters ran for a pair of touchdowns and threw for 209 yards. CHARLIE RIEDEL / AP Kansas State (3-1) annihilates UTEP PAGE 45 Sunday, September 28, 2014 DAILY COMMERCIAL C r Re ro of s, Re pairs &R oof Co nsultin g & R oof C onsulti ng 352.728.1857 352.259.R OOF rf n Roong Services Bathroom Services RE-TILE 352-391-5553 b b f b b bff n f t n RE-TILE 352-391-5553 b b f bb bff n f t n PAGE 46 Sunday, September 28, 2014 DAILY COMMERCIAL D1 DAY, MONTH XX, YEAR DAILY COMMERCIAL XX 47 D2 DAILY COMMERCIAL Sunday, September 28, 2014 DAY, MONTH XX, YEAR DAILY COMMERCIAL XX NASCAR ROCKS!BY MICHAEL ASHLEY / EDITED BY WILL SHORTZNo. 0921RELEASE DATE: 9/28/2014 ACROSS1 Coping mechanisms?5 Dog for a gentleman detective9 White, informally14 Germinal novelist18 Ton19 Drama critic John of The New Yorker20 Teeing off22 Popular childrens find it book series23 Rescue film of 201224 Its normal for NASA25 Comedy classic of 197827 Hey, what did you think when you missed that last pit stop? [The Who, 1971]30 ___ rating system (world chess standard)31 Ken of thirtysomething32 Surgically remove33 Who, me?36 Bogs down38 Hydroxyl compound40 Fanny42 Did you do anything for luck before todays race? [Katy Perry, 2008]48 Scrumptious49 Like this50 Seth of Late Night52 Rocks Everly or Collins53 Stopover spot54 Summoned, in a way57 Perform some magic60 Okla. City-to-Dallas direction62 4 letters63 Gen ___64 Exams for some coll. applicants65 How did that new car handle out there on the track? [Maroon 5, 2011]70 Soft-shell clam73 Steinful, maybe74 Article in Aachen75 Orly bird, once?78 Tend80 Giant in heating and air-conditioning83 Hack85 City SSW of Moscow86 Toy company on track to success?89 Unacceptable to polite society91 Late disc jockey Casey93 What did you try to do after the caution flag came out? [The Doors, 1967]96 Cover with a hard outer surface99 Dame ___100 Cast part101 Ming of the N.B.A.102 Relatively up-todate106 Beauties108 Slow-witted109 Are you enjoying your time out on the Nascar circuit? [Ricky Martin, 1999]114 Movie with the line Old age. Its the only disease, Mr. Thompson, that you dont look forward to being cured of117 Lend a dirty hand to118 ___ do119 George Will piece120 Someone a little short?121 The Swedish Nightingale122 Sporty option123 Love letter signoff 124 Outfit125 Antoine Domino Jr., familiarly126 Ditz DOWN1 Only Literature Nobelist also to win an Oscar2 Dynamic start?3 Ring lovers4 Impeccable5 Succulent plant6 ___ Domingo7 Posthumous John Donne poem that includes It suckd me first, and now sucks thee8 At it9 ___-Caspian Depression10 Bay Area gridder11 Skate12 Green beans13 Asian wild ass14 Jerusalem15 Big Ten sch.16 Old track holders17 Reply to a captain21 Candied, as fruit26 Assail28 Yenta29 Huge, in poetry33 Semitransparent fabrics34 Suffering a losing streak, in poker35 Rustic poems36 Noon, in Nantes37 Sacred images: Var.39 Not be straight41 ___ Delight, pioneering song by the Sugarhill Gang43 Writer LeShan44 Almost any poem that starts Roses are red 45 lves destination46 High-speed ride47 Sounds of equivocation51 Still55 So-so responses56 Eye opener?58 Kwik-E-Mart guy59 Stop: Abbr.61 Spammer, e.g.63 Classic sports car66 Words of retreat?67 Nov. honoree68 Actress Massey69 Travel option70 Poster bear71 European capital72 Romanian Rhapsodies composer76 Be prepared77 Sierra follower, in code79 Needle81 Drama with masks 82 Online investment option84 Big name in house paint87 Squeeze (out)88 Place to dangle ones legs90 Tameness92 Frankie who starred on Malcolm in the Middle94 See 97-Down95 Home of some Bushmen97 94-Down x 1498 Coiled about103 Tattoo artist104 Glam band with six #1 hits in Britain105 Brief name?107 Trail109 Death in Venice locale110 ___ libre (poetry style)111 Old Fords112 Get old113 Dog Chow alternative114 Crew member115 One means of corp. financing116 Okla. neighbor 1234 5678 910111213 14151617 18 19 20 2122 23 24 25 26 27 28 29 30 31 32 333435 3637 38 39 40 41 42 4344 454647 48 49 50 51 52 53 54 5556 57 5859 6061 62 63 64 656667 68 69 707172 73 74 757677 78 79 80 81828384 85 86 8788 89 90 91 92 93 9495 96 9798 99 100 101 102 103104105106 107108 109 110 111 112113 114115116 117 118 119 120 121 122 123 124 125 126 Online subscriptions: Todays puzzle and more than 4,000 past puzzles, nytimes.com/crosswords ($39.95 a year). Sunday Crossword Puzzle Crossword puzzle answers are on page D4. Thank you for reading the local newspaper, the Daily Commercial PAGE 48 Sunday, September 28, 2014 DAILY COMMERCIAL D3 DAY, MONTH XX, YEAR DAILY COMMERCIAL XX PAGE 49 D4 DAILY COMMERCIAL Sunday, September 28,. S A W S A S T A A N G L O Z O L A H E A P L A H R R I L I N G I S P Y A R G O O N E G A N I M A L H O U S E W O N T G E T F U E L E D A G A I N E L O O L I N R E S E C T M O I M I R E S E N O L R E A R E N D I K I S S E D A G R I L L E T A S T Y D O A S I D O M E Y E R S P H I L I N N P A G E D C A S T A S P E L L S S E G H I X E R A P T E S T S M O V E S L I K E J A G U A R S T E A M E R A L E E I N S S T M I N I S T E R T O T R A N E C A B O R E L L I O N E L N O T D O N E K A S E M B R A K E O N T H R O U G H E N C R U S T E D N A A C T O R Y A O N E W I S H G E M S D I M L I V I N L A V E H I C L E L O C A C I T I Z E N K A N E A B E T I T L L O P E D N E E D E R L I N D T T O P X O X O D R E S S F A T S Y O Y O Sunday crossword puzzle is on page D2. SEIZETHE DA Y SLOCAL AREANEWS.www .dailycommer cial.com PAGE 50 Sunday, September 28, 2014 DAILY COMMERCIAL D5 DAY, MONTH XX, YEAR DAILY COMMERCIAL XX 6865PETS rrfntttbn fb r nfffbtttb frf rnffb rtttrfr tr SEIZETHE DA Y SSPOR TSNEWS.www .dailycommer cial.com PAGE 51 D6 DAILY COMMERCIAL Sunday, September 28, n nt n nt n bf nt ft bf f ft ft f nt n nt fn fnt nt n f nt n bfn fn tft nt bn ff ft nt n t t nt nf nt n nt n 52 E1 DAILY COMMERCIAL Sunday, September 28, 2014 Business scott.callahan@dailycommercial.com DRONES: Trafc control has new headache / E6 From the redwood forest to the Gulf Stream waters This land was made for you and me. This Land is Your Land written by Woody Guthrie H ave you watched any of the PBS documentary se ries by Ken Burns on the Roosevelt fami ly? The historic, grainy lm of Theodore Roo sevelt traversing the countryside on horse back, inspecting a steam shovel in the Panama Canal and gesturing emphatical ly in political speeches is remarkable. Yosemi tes towering redwoods and giant sequoias and the vistas of the Grand Canyon are accessible today because of Roo sevelts desire that fu ture generations be al lowed to enjoy such natural grandeur. Inserting the feder al government into the role of arbiter in the 1902 coal strike, how ever, was a much more controversial use of ex ecutive power. Anthra cite coal miners had MARGARET MCDOWELL GUEST COLUMNIST Roosevelt, Guthrie and the color of money JIM PUZZANGHERA MCT One in ve U.S. workers was laid off in the past ve years and about 22 percent of those who lost their jobs still havent found another one, accord ing to a new survey that showed the extent Americans have strug gled in the sluggish la bor market since the Great Recession ended. Those who did nd work had a difcult time with their job search and the effects of unemployment, the survey by the John J. Heldrich Center for Workforce Develop ment at Rutgers Uni versity found. Nearly 40 percent said it took more than seven months to nd employment and about one in ve of laid-off workers said all they could nd was a temporary position. Almost half 46 per cent of the estimated 30 million layoff vic tims who found new jobs said they paid less then their old ones, according to the sur vey of 1,153 U.S adults AUSTIN FULLER | Staff Writer austin.fuller@dailycommercial.com A 27-year-old wed ding cake de signer from Mi ami has opened a new gourmet sweet shop in downtown Mount Dora. Brittany Baker, who owns Le Petit Sweet, said she was visiting her boyfriends par ents in Howey-in-theHills, when they drove through Mount Dora. They then came back to explore the town. We just kind of came up here on a whim one weekend for vacation and fell in love, Baker said. I was at the point in my career where I Study: 20 percent of workforce laid off in past 5 years JIM PUZZANGHERA MCT WASHINGTON The Obama administrations tougher rules on offshore corporate inversions had an immediate effect Tuesday, pushing down the stock pric es of companies considering such moves. But the highly technical changes to the tax code did not appear to go far enough to derail the controversial deals, in which U.S. companies avoid higher tax rates by buying smaller foreign rms and moving their headquarters abroad. The measures unveiled Monday by the Treasury De partment would make it less protable for American companies to reincorporate overseas, largely by limiting the ability to shelter foreign earnings from U.S. taxes, an alysts said. Still, there proba bly are enough potential tax savings remaining to pursue those moves. It changes the economics of the deals, but it does not seem to rise to the level of where you have made them un-economical, said Ed ward Mills, a policy analyst with FBR Capital Markets. Burger King Worldwide Inc. and Canadian cof fee-and-doughnut chain Tim Hortons said Tuesday that they would go ahead with their planned deal, the high est-prole inversion so far. Miami-based Burger King drew the ire of many con sumers and lawmakers when it announced last month that it would acquire Tim Hortons and reincorporate in low er-tax Canada. Burger King is trying to boost its breakfast New inversion rules punish some firms stocks JESSICA WOHL MCT McDonalds probably wont be sorry to see 2014 come to a close. The worlds largest restaurant company has posted three con secutive months of declines in global sales at long-standing lo cations, its longest such slide since early 2003. McDonalds itself, under the leadership of CEO Don Thompson since July 2012, knows it has work to do. There is no one silver bul let or single solution for driving sustained growth, Thompson said on a July 22 conference call when Oak Brook, Ill.-based Mc Donalds posted another quar ter that disappointed Wall Street. Were moving forward thoughtfully and with a sense of urgency, he said. Some of McDonalds trou bles can be traced to the chang ing tastes of American con sumers. Critics say it has been slow to offer products that sat isfy consumer preferences for fresher ingredients and adven turous avors. McDonalds also has been a prominent target of union and fast-food workers, who are pushing the company and its peers to raise wages. To be sure, some of McDon alds other challenges remain MARK LENNIHAN / AP Protesters picket in front of a McDonalds restaurant on 42nd Street in New Yorks Times Square as police ofcers move in to begin making arrests on Sept. 4. Experts: No easy fix for McDonalds slump PHOTOS BY BRETT LE BLANC / DAILY COMMERCIAL Brittany Baker, owner of Le Petit Sweet in Mount Dora, prepares food on Wednesday. Le Petit Sweet is a bakery that specializes in treats of all sizes. Baker cooks all of the pies, miniature cup cakes, macarons and other sweets daily. Miami transplants open new bakery in downtown Mount Dora Small, sweet and special Mike Grady, boyfriend of owner Brittany Baker, helps a customer at Le Petit Sweet. SEE SWEET | E3 SEE INVERSION | E2 SEE SLUMP | E4 SEE MCDOWELL | E2 SEE WORKERS | E2 PAGE 53 E2 DAILY COMMERCIAL Sunday, September 28, 2014 offerings, a fast-growing segment of the restau rant industry. As weve said previ ously, this deal has al ways been driven by long-term growth and not by tax benets, the companies said in a joint statement. Meanwhile, medical device maker Medtron ic Inc., which an nounced in June that it would acquire Europe an rival Covidien and reincorporate in lowtax Ireland, said Tues day that it was studying the new rules. The deal has a provision allowing either company to back out if tax laws change. Shares in those com panies and other poten tial inversion candidates were down Tuesday. The declines were part of a broader market slide after U.S. airstrikes in Syria and poor econom ic news from Europe. The Dow Jones indus trial average fell 116.81 points, or about 0.7 per cent, to 17,055.87. The S&P 500 index lost 11.52 points, or 0.6 percent, to 1,982.77, and the Nasdaq composite index was off 19 points, or about 0.4 percent, to 4508.69. Burger King shares dropped about 2.7 per cent, Medtronic was off 2.9 percent and Covi dien fell about 2.5 per cent. Tim Hortons was down only slightly. Shares in British pharmaceutical com pany AstraZeneca were down about 5 percent. It has been rumored to be an acquisition target of New York-based Pz er Inc., which could re duce its taxes after a deal by reincorporating in Britain. Pzer was off about 0.4 percent. There are still benets to be had from inverting, said Ryan Dudley, an in ternational tax expert at accounting and advising rm Friedman. Its just a question of whether they now outweigh the costs. The calculation will change for each potential transaction, he said. The 35 percent corpo rate tax rate in the U.S. is the highest of any ma jor developed economy, and businesses say thats whats driving the recent wave of inversions. Rather than piece meal, onerous actions, the administration should undertake com prehensive tax reform that lowers rates for all businesses and shifts to an internationally com petitive system that wel comes investment and produces the econom ic growth this country needs, the U.S. Cham ber of Commerce said. Democrats and Re publicans agree that a broad overhaul of cor porate taxes, including eliminating some loop holes and lowering the overall rate, would be the best solution. But they cant agree on how to do it. As more compa nies seek to reincor porate abroad, Presi dent Obama and many congressional Demo crats have pushed for legislation narrowly fo cused on limiting inver sions. Key Republicans, however, prefer dealing with the issue through broader tax reform, but legislation has stalled. With Congress re cessed until after the November elections, Treasury Secretary Jacob J. Lew said Monday that he was enacting regula tory changes, effective immediately, to make inversions less econom ically appealing. Although the moves will curb some inver sions, he conceded that legislation is the only way to close the door on these transactions entirely. Corporate tax experts agreed the regulatory changes fell short of what Congress could do and even what Treasury could do on its own. Lew did not restrict socalled earnings stripping, in which a foreign-head quartered company re duces its taxes through loans to its U.S. subsid iary. The interest on the loans is deductible on the subsidiarys U.S. taxes. The tactic provides one of the biggest nan cial benets of inver sion. But short of leg islation, Treasury cant fully limit the practice, analysts said. As part of the new reg ulations, Treasury asked for public comments about how to address earnings stripping. Steven Rosenthal, a senior fellow at the Ur ban-Brookings Tax Poli cy Center, said Treasury was taking a sensible approach in moving slowly. One step at a time, start small ... see if in versions continue to take place, see how Congress reacts and see what more needs to be done, he said. The question is whether Treasury is still leaving enough tax ben ets on the table for U.S. companies to in vert, Rosenthal said. Its really hard to say. AP FILE PHOTO Treasury Secretary Jacob Lew speaks in the Cash Room of the Treasury Department in Washington. INVERSION FROM PAGE E1 not enjoyed a pay raise in some 20 years, and mine owners steadfast ly refused to negotiate with the miners union. With the country fac ing the prospect of a long winter without adequate coal sup plies to heat business es and homes, Roos evelt intervened, rst by threatening to na tionalize the mining companies. Eventual ly a 10 percent pay in crease (the miners had lobbied for 20 percent) and a nine-hour day (the miners had lob bied for an eight-hour, six-day work week) was negotiated. Roosevelts use of executive authori ty was historic and his actions established a precedent whose shock waves are still being felt today. How so? Six years ago mar kets were oundering in the worst econom ic crisis since the Great Depression. The gov ernment actively en tered the crisis, saving some corporations but not others; creating a bond-buying program that inuenced mar kets; and holding inter est rates at a sustained, low level in an attempt to reinate the stock market and to encour age mortgage lending. Today its not just the executive branch, but other governmental bodies whose actions cause markets to re act. W hether we agree or disagree with partic ular uses of executive authority or actions by, say, the Federal Reserve vis-a-vis the economy, is immateri al. Indeed, government may be too much with us. But to ignore the far reaching implications of government actions designed to inuence the economy is to do so at ones own eco nomic peril, regard less of politics. Its not blue states or red, as in votes. Its green, as in the color of money. When Federal Re serve Chair Yellen at tempts to establish a consensus on how best to wean ourselves from quantitative eas ing, markets are affect ed. Analyzing these ac tions intelligently and applying this knowl edge to investment ac counts is what matters. Astute portfolio man agers see Shinzo Abe in the early stages of the Japanese version of quantitative eas ing and consider the possibility that Japans central bank will drive markets in the same fashion that they have been inuence d here. Margaret R. McDowell, ChFC, AIF, a syndicated econom ic columnist, is the founder of Arbor Wealth Management, LLC, (850-608-6121~www. arborwealth.net), a Fee-On ly and Fiduciary Regis tered Investment Advisory Firm located near Destin. MCDOWELL FROM PAGE E1 done over the summer. While job growth has been consistent, it has been insufcient gure has been declin ing, it still is high. The effects of long-term unemployment can be traumatic, the survey found. While a majority of Americans were affect ed by the Great Recession, those who had longterm periods of unemployment experienced severe, negative changes in their standard of liv ing, the study concluded. About one-third of those who were unable to nd work for more than six months reported a major and permanent change in their lifestyle, according to the study. Asked to compare their salary and savings now to ve years ago, 42 percent said they had less. That gure included 25 percent of respon dents who said they had a lot less. WORKERS FROM PAGE E1005103 Midway Baptist Chur ch327 07 Blo sso m Lan e, Leesbur gSu nda ys 10 :3 0 a. m. & 6: 00 p. m. We still Do!Remember When .! Fo r Ma nu fa ct ur ed Ho me s PAGE 54 Sunday, September 28, 2014 DAILY COMMERCIAL E3 needed to open up a store and I just didnt want it to be in Miami, so we decided this was the perfect place. Baker said they loved the smalltown vibe, as well as the fact there is a lot of culture and quality restau rants. The sweet shop opened on Sept. 20, at 110 W. Fifth Ave., Baker said. It features items such as French mac arons, mini cupcakes, pinch pies and cake petites, which are served in small cups. Flavors of the cake petites for Wednesdays menu on the stores Facebook page includ ed coconut tres leches, orange grand marnier and champagne and strawberry. Baker said she had her own wed ding cake company in Miami for ve years before opening the new sweet shop in Mount Dora. She said she will still be making wedding cakes and dessert tables. Rob English, the president of the Mount Dora Area Chamber of Com merce, said that stretch of Fifth Av enue needs development on both sides. The more activity that we get of diversied businesses on that one block of Fifth creates more foot trafc so that the other businesses, that are already there prior to them coming, benet and vice versa, he said. English was glad to hear about how they decided on Mount Dora. With Mount Dora going in the direction of more ne arts and more of an entertainment district, and presenting itself with its best foot forward in those areas, youre always a visitor to a place before you decided to move, he said. So, that being said, if people see that type of atmosphere when they come here, theyre more inclined to move and open up business, or theyre more inclined to retire, more inclined to take a transfer here. SWEET FROM PAGE E1 BRETT LE BLANC / DAILY COMMERCIAL Brittany Baker, right, owner of Le Petit Sweet, and her boyfriend Mike Grady, prepare the food at Le Petit Sweet in Mount Dora. DANIEL SALAZAR MCT WASHINGTON President Barack Obama isnt expected to get the federal min imum-wage hike hes wanted anytime soon, but advocates hope that public support for the issue gets a boost from an unusual set of states this Election Day. Alaska, Arkansas, Ne braska and South Da kota four solid-red states whose voters of ten oppose the presi dents agenda might be next to raise the wage oor of Americas low est-paid hourly work ers. On Nov. 4, they will vote on ballot measures to increase their mini mum wages. Some advocates hope that victories on the ballot, especially in four Republican strong holds, will change the national narrative of the economic debate. It becomes a lot harder for members of Congress who might not support these kinds of things to continually say no when it comes up in Washington, said Josh Levin, a vice presi dent at the left-leaning Ballot Initiative Strategy Center, which supports activists on state ballot measures. The issue has gained a lot of attention this year. Earlier this month, fast-food workers across the country par ticipated in a strike in favor of a $15-per-hour livable wage, more than double the current federal oor of $7.25. The Seattle City Council passed a $15 hourly rate in June, and some activ ists are pushing that g ure elsewhere in Wash ington state. The ballot measures in Alaska, Arkansas, Ne braska and South Da kota would bring about much smaller increases. But that doesnt bother Steve Copley, chairman of the Give Arkansas a Raise Now coalition. Every penny that somebody who is work ing hard can get helps, Copley said. Activists must be re alistic about what in creases they push for at the polls, said Peg gy Shorey, the director of state government re lations at the AFL-CIO, whose state federations support the ballot ini tiatives. Arkansas is not the same as Seattle, she said. The current $6.25-per-hour state minimum wage makes Arkansas one of three states lower than the federal oor for hour ly wages. Only Georgia and Wyoming are low er, according to the U.S. Department of Labor. (When state minimum wages differ from the federal rate, the high er rate is adhered to in that particular state, as employers dont want to violate federal law.) Last year, about 91,000 workers earned the federal minimum wage or below em ployees who earn tips, for example in the four states with Novem ber ballot proposals, ac cording to the Labor Departments Bureau of Labor Statistics. How ever, thousands more would be affected as the state wage oors rose gradually. While all four initia tives would begin wage increases Jan. 1, the ap proaches are split on their long-term consid erations of how to link the minimum wage to cost-of-living increases. Under Alaskas ballot proposal, the minimum wage would be tied to increases in the Anchor age Consumer Price In dex caused by ina tion starting in 2017. South Dakotas initia tive would raise the minimum wage based on changes to a nation al CPI metric starting in 2016. Tying annual increas es to CPI uctuations is controversial. Oppo nents in South Dako ta say its one of their biggest concerns of the ballot proposal there. The economies in Florida, California and New Jersey are going to dictate how employers in our state are going to have to do (wage) in creases every year, said Shawn Lyons, the ex ecutive director of the South Dakota Retail ers Association, a wagehike opponent. Ten states, includ ing Florida and Wash ington, have minimum wages legally tied to CPI metrics, according to the Department of Labor. New Jersey will join them in January, with the District of Co lumbia, Minnesota and Michigan scheduled to follow suit in upcoming years. Copley said such a measure in Arkan sas would have been a non-starter at the polls. We didnt feel like we could get it passed, he said. Instead, the minimum hourly rates would top off at $8.50 per hour in 2017 in Arkansas and $9 per hour in 2016 in Ne braska under their ballot proposals. Activists look for wage-hike support from red states AP FILE PHOTO Timothy Russell, 17, of Chicago, participates in a rally in support of raising the minimum wage in the rotunda at the Illinois State Capitol Wednesday in Springeld, PAGE 55 E4 DAILY COMMERCIAL Sunday, September 28, 2014 $25 OFF$150all servicesCleaning Completed By 9/30/14 Promo Code: Sept AIR DUCT CLEANING$50 OFF(MINIMUM CHARGES APPL Y) FL#CAC1816408Cleaning Completed By 9/30/14 Promo Code: Sept TILE/GROUTCLEANING & SEAL$1500OFF(MINIMUM CHARGES APPL Y)Cleaning Completed By 9/30/14 Promo Code: Sep t Now @ Lake Squar e Mall Near Cuba s Restaur ant.Buy your nearly new Furnitur e, Art and Curios at a fr action of re tail.OR Call us to consign your Fine Fu rnitur e352-343-4447www .FabFindsFur nitur e.com largely out of its con trol. Among them: a food safety scandal at a key supplier in China and some Russian restau rants being shut after un scheduled inspections retaliation, some sug gest, over U.S sanctions imposed in the wake of the Ukraine crisis. McDonalds has been through a prolonged slump before. Glob al same-store sales, a measure of retail health, declined in 2001 and 2002 and were down in early 2003. But the 2002 launch of a Dollar Menu in the United States (now known as the Dol lar Menu & More) and the 2003 kickoff of the internal Plan to Win strategy, which includ ed a global push to re model restaurants, helped it rebound. What follows is a look at what ofcials are planning, and steps that industry watchers said could help bring some shine back to the gold en arches. STEP 1: IMPROVE OPERATIONAL EXECUTION In the United States, McDonalds same-store sales have fallen in sev en of eight months this year, after declines in ve months during 2013. We think theyll over come this, but it looks pretty dark right now. This is not a unit growth story. This is a samestore-sales story, and they have to somehow get more sales out of the existing (locations) that they have in place, said Jack Russo, an analyst at Edward Jones. McDonalds has efforts underway to reduce wait times and improve cus tomer ratings. One part of that includes ways to speed payments with digital options. Thats why McDonalds joined with other national re tailers to announce that it would participate in Apple Pay, a new iP hone-based payment system launching in October. If we can take out any of the friction in a McDonalds experi ence, any of the incon venience of visiting Mc Donalds, then clearly, thats an improvement from the customer per spective, said Steve Easterbrook, McDon alds global chief brand ofcer. Speed is one of those things. The company is also addressing the speed of it s kitchens. In the vast majority of its U.S. restaurants, it add ed preparation tables that keep condiments cool and easily accessi ble, which should allow for simpler and quicker customization. We have to make a greater commitment to operational execution in our restaurants, said Scott Lang, who owns and operates six Mc Donalds in North Car olina and has been part of the McDonalds sys tem for 38 years. Ab solutely, we have to do better. Thompson asserts that once McDonalds can secure the founda tional elements of the business in the United States, it will be ready to really forge ahead with initiatives that could help it attract din ers who are looking for something different. The operational foundation has to be strong enough for us to be able to move forward with customization and personalization at the level that we want to at McDonalds, Thomp son said. STEP 2: MAKE THE FOOD STAND OUT For decades, McDon alds well-known Big Macs, Quarter Pound ers, fries, Chicken McNuggets and Egg Mc Mufns were enough to keep the company growing. In fact, those ve menu items ac count for about 40 per cent of sales today. McDonalds is focus ing on what it knows has worked. It is rein vigorating its marketing on those items to help drive sales. Such efforts include the current 20 McNuggets for $5 pro motion. At the same time, Mc Donalds is pushing new and limited-time items in four catego ries in which it believes its growth will out pace the overall indus try. Those categories are beef, chicken, breakfast and beverages such as coffee and blended ice drinks. Were placing great emphasis on the bal ance between our core classics and the number of new products that are being introduced, Thompson said in July. And this is to ensure that they can be deliv ered at the speed and convenience that cus tomers expect from Mc Donalds. A coffee giveaway in the spring brought in more breakfast diners and helped McDonalds post at U.S. samestore sales in April, the rst month without a decline since Octo ber. The U.S. business has pulled out another free coffee promotion through Sept. 29. Though franchisee Lang said the menu has gotten a bit unwieldy, others say the variety is key to helping ensure McDonalds can bring in the widest variety of diners. You have to be able to have a menu attrac tion that can draw the crowd, said Christo pher Rowane, vice presi dent and portfolio man ager at Cincinnati-based Bahl & Gaynor, which held nearly 1.28 million McDonalds shares as of the end of June. Last years Mighty Wings were a op, but items such as snack wraps introduced in the United States in 2006 have done better. Mc Donalds is also trying to cater to people look ing for healthier fare, with items like the Egg White Delight McMuf n, introduced in 2013, and fruit and yogurt op tions in kids meals. Today, the McDonalds menu ranges from pre mium Bacon Clubhouse sandwiches cus tomers pick a burger or grilled or crispy chick en to fruit smooth ies and McCafe espres so-based drinks. With one eye on value and the other on offering some thing new, it recently added the $2 Jalapeno Double two patties topped with pickled and crispy jalapenos, white cheddar and ranch sauce to the Dollar Menu & More. STEP 3: BOOST BRANDING EFFORTS To connect with to days consumers, Mc Donalds is taking part in the launch of Ap ple Pay, the new mobile payment system offered by Apple Inc. Its testing everything from cus tomized burgers to loy alty programs in various parts of the world. And it sends out mes sages on Twitter and other social media plat forms on topics ranging from free coffee to sus tainable sourcing. I think its fair to say that we pushed the reset button on really work ing hard to truly put the customer at the heart of what were planning, said Easterbrook, who said the company is working to truly under stand what matters to customers most. McDonalds multi year focus on value, a key message for a large chunk of its customers, could be hurting them, some suggested. They have been so entrenched in being all things to all people, mostly for a buck, that they have actually for gotten about brand, said Robert Passikoff, president of Brand Keys, a consulting rm. On the surface, Mc Donalds has the right formula, in terms of the four Ps; product, place, price and pro motion, Passikoff said. People know the prod uct, they know where to nd it, they know it has low-priced items, and the brand is a major ad vertiser. Still, it no lon ger stands out, Passikoff suggests. Lang, the franchisee, said he can deal with is sues such as operational execution and employ ees, but Im not quite as much in control of the bad halo, so to speak, of brand image, pointing to issues such as wage protests staged outside restaurants. AP FILE PHOTO Boys open the door to a McDonalds restaurant in Beijing. SLUMP FROM PAGE E1 PAGE 56 Sunday, September 28, 2014 DAILY COMMERCIAL E5 (352) 787-3013rfntnbntr rfntrCALL TO RESER VE YOUR SEA T TODA Y!Box Office HoursMonday-Friday 9:00am-1:00pm(also 1 hour before show time)$18 Adult/$9 StudentShow Ti mesAll Fridays @ 8pm Sat. May 10 & 17 @ 8pm Sat. May 24 @ 2pm All Sundays @ 2pmMELONPAT CHTHEA TREpresentsTh e Lit tle Fo xesA 1939 Play by Lillian Hellman A story of the struggles of a southern aristocrat woman within the confines of an early 20th century society May 9-11, 16-18 & 23-25, 2014 Supporting sponsor: Romac Lumber & Supply Inc. Va ny a an d So ny a an d Ma sh a an d Spi ke*By Ch ri sto ph er Du ra ng Wi nn er Be st Pl ay 2013 To ny Aw ar d 3 Si bl in gs 1 We ek en d Ex tr em e Co me dy*A du lt Co me dy wi th Ad ul t La ng ua ge & em esOc to be r 3-5, 10-12, 17-19 2014Ti tl e Sp on so r: Fr an ks Pl aceBox Ofce HoursMonday-Friday 9:00am-1:00pm(also 1 hour before show time)$18 Adult/$9 StudentShow TimesAll Fridays and Saturdays @ 8pm All Sundays @ 2pm D006649, Sept. 28 the 271st day of 2014. There are 94 days left in the year. Todays Highlight in History : On Sept. 28, 1787, the Congress of the Confed eration voted to send the just-completed Constitu tion of the United States to state legislatures for their approval. On this date : In 1066 William the Conqueror invaded En gland to claim the English throne. In 1542 Portuguese navigator Juan Rodriguez Cabrillo arrived at pres ent-day San Diego. In 1841 Henry Wad sworth Longfellow com pleted his poem Excel sior. In 1850 flogging was abolished as a form of punishment in the U.S. Navy. In 1914 the First Bat tle of the Aisne during World War I ended incon clusively. In 1924 three U.S. Army planes landed in Se attle, having completed the first round-the-world trip by air in 175 days. In 1939 during World War II, Nazi Germany and the Soviet Union signed a treaty calling for the par titioning of Poland, which the two countries had in vaded. In 1958 voters in the African country of Guinea overwhelmingly favored in dependence from France. In 1964 comedian Har po Marx, 75, died in Los Angeles. In 1974 first lady Betty Ford underwent a mastec tomy at Bethesda Naval Medical Center in Mary land, following discovery of a cancerous lump in her breast. In 1989 deposed Phil ippine President Ferdi nand E. Marcos died in exile in Hawaii at age 72. In 1994 an Estonian ferry capsized and sank in the Baltic Sea with the loss of 852 lives. HAPPY BIRTHDAY for Sunday, Sept. 28, 2014 : This year you see life with renewed vitality. Your im mediate circle of friends expands, and you enjoy your new pals a lot. If you are single, you will want a friendship as well as a rela tionship. It could be difcult to nd someone who knows how to mix both success fully, but you will! If you are attached, the two of you of ten can be found with your friends. You will have the ability to manifest a mutu al long-term goal. Both you and your partner could be very excited! SAGITTARIUS knows how to help you re lax. ARIES (March 21-April 19) You might spend a lot of time with one particu lar person today. By late af ternoon, you will want to spread your wings. You will be quite content to go off to the movies or stop in on a jam session. You need some time to let your mind wander. TAURUS (April 20-May 20) You have the ability to draw others out. Your cha risma might make you feel overwhelmed, as so many people seek you out. You would prefer to be on a oneon-one level with a special person. GEMINI (May 21-June 20) Pace yourself, and know how much you need to do. You will get as much done as you want, but ex pect to be distracted lat er by a loved one or dear friend. Take off for a leisure ly dinner together. CANCER (June 21-July 22) Know what you expect from a new friend. This per son might not meet the bar you have set, as it is very high. Relax a little, and give him or her some space. Go off and do something you really enjoy. Invite a dear friend along. LEO (July 23-Aug. 22) You might need some time at home to nish up a proj ect or to get some more R and R. Be aware of an ef fort you must make toward a family member. This inter action will be crucial to pre serving your relationship. VIRGO (Aug. 23-Sept. 22) You are likely to say what you mean, and peo ple might be disconcert ed by what they hear. Let it go. They probably do need to hear your words. Visiting with friends might be nice, but you will want to head home earlier than usual. L IBRA (Sept. 23-Oct. 22) Understand that what is im portant to you at this very moment might not be im portant to someone else. Accept that fact and re lax. You will have a better time together as a result. Touch base with a neighbor and catch up on his or her news. SCORPIO (Oct. 23-Nov. 21) Indulge yourself. Your mood seems to be so much more relaxed than usual, and you will draw a loved one into some fun. Dont forget to join friends, as they have planned a get-to gether for a while. You wont want to miss all the fun and laughter. SAGITTARIUS (Nov. 22Dec. 21) You will need all the rest you can get today. Be a couch potato. Enjoy reading the paper. Take a nap or two. By later today, be ready to take the world by storm. Others will be de lighted to see you in this mood. CAPRICORN (Dec. 22Jan. 19) Accept an invita tion that throws you in the middle of the raving crowds, some of whom will be your friends! Youll enjoy the change of pace. Someone you meet today could be more important to you than you realize. AQUARIUS (Jan. 20Feb. 18) You could be over whelmed by a responsibili ty, but you will fulll it. You wont have a question in your mind about what to do afterward. You always know where your friends are, and that is where you will be. PISCES (Feb. 19-March 20) Take an overview of re cent events. You sudden ly could recognize that you missed someones expres sion of his or her caring. You might want to back track and nd this individu al. Read between the lines a little more often. HOROSCOPES TODAY IN HISTORY DEAR ABBY: My wife is in a nursing home and will be for a long time. While I was caring for her at home, I was very lonely. She wasnt there for me except to de mand that I do this and that. I did what I could to keep her happy, but nothing worked. I had no life of my own. My life was wrapped around her and doing the best I could to take care of her. I did all the chores that were required to keep the home running. Would it be wrong to nd a lady friend to do a few things with, like have dinner, go to a movie or just for a ride in the country or to the beach? My son thinks I shouldnt do it, but he doesnt know how lone ly I am, nor do the other kids in the family. NO LIFE OF MY OWN DEAR NO LIFE: Youre asking me a question no one can decide FOR you. Much depends upon the quality of your marriage before your wife became ill. You promised to love and cherish her until death do you part. If shes still in her right mind, you owe it to her to be there for her to the extent that you can just as she would be if you were sick and in a nursing home. You should discuss all of this with your chil dren. While it is im portant that you spend enough time with your wife to ensure that shes being well cared for, you are also entitled to have a life. Some hus bands WANT to spend every possible minute at their wifes bedside, while others do what you are contemplating. Only you can look into your heart and decide what would be best for all concerned, because it may affect your entire family. DEAR ABBY: My boy friend of ve years, Spencer, has always been very sweet un til this year. This year he has become verbally abusive, telling me Im a drunk (I dont drink li quor) and insane. (No one else says there is anything insane about my behavior.) Spen cer frequently tells me my opinions prove Im a jerk. Until this year, I have been deeply in love with him. I know his verbal attacks on me are un warranted. All I want is some peace and quiet. Please advise. BEATEN DOWN IN L.A. DEAR BEATEN DOWN: Your boyfriend is show ing all the signs of a man who wants out of a relationship, but doesnt have the cour age to come out and be direct about it. If you want peace and qui et in your life, nd a man who appreciates what you have to offer, doesnt make false accu sations and treats you well. Youll nd what youre looking for after you tell Spencer youre NOT drunk, youre NOT crazy and youre not in love with him anymore, so GOODBYE. DEAR ABBY: I have been having a problem with my husband ever since his mom died. All he talks about is how much he misses her and how he wants to die. I loved his mother like she was my own, but it has been a year since she went, and Im get ting tired of the attitude and the behavior he dis plays. He is so mean now that I am thinking of leaving him because I cant take it anymore. Can you help? TIRED OF IT DEAR TIRED OF IT: It is one thing to grieve for a deceased loved one, and quite another to say you wish you could join the person. Your husband is stuck in his grieving process and needs pro fessional intervention. Please urge him to get help. Was he always mean and abusive? If the an swer is yes, by all means give serious thought to getting away. If not, tol erate it a little longer providing hes willing to admit he needs to talk to someone and follows through.. Husband craves companionship after wife enters nursing home JEANNE PHILLIPS DEAR ABBY JACQUELINE BIGAR BIGARS STARS PAGE 57 E6 DAILY COMMERCIAL Sunday, September 28, 2014 D.O.T. & WORK PHYSICALS MOST LABS DONE ON PREMISES PNEUMONIA SHOTS AVAILABLED006590 JOAN LOWY Associated Press WASHINGTON De signers of the ambitious U.S. air trafc control system of the future ne glected to take drones into account, raising questions about wheth er it can handle the es calating demand for the unmanned aircraft and predicted congestion in the sky. We didnt under stand the magnitude to which (drones) would be an oncoming tidal wave, something that must be dealt with, and quickly, said Ed Bolton, the Federal Aviation Ad ministrations assistant administrator for Next Gen, as the program is called. Congress passed leg islation creating Next Gen in 2003, and di rected the agency to accommodate all types of aircraft, including drones. The program, which is not expected to be completed for at least another decade, is re placing radar and radio communications, tech nologies rooted in the early 20th century, with satellite-based naviga tion and digital com munications. The FAA has spent more than $5 billion on the complex program and is nearly nished installing hardware and software for several key systems. But the further it progresses, the more difcult it becomes to make changes. Government and in dustry ofcials have long maintained that drones must meet the same rules that apply to manned aircraft if they are to share the sky. That is changing, however, said Chris Stephenson, who represents the Na tional Air Trafc Con trollers Association on several U.S. and inter national unmanned air craft committees. Its becoming pain fully apparent that in order to get (drones) in there, there is going to have to be a fair amount of accommodation, at least in the beginning, he said. Michael Whitaker, the FAAs deputy adminis trator, acknowledged that drones werent re ally part of the equation when you go back to the origin of NextGen, but now need to be consid ered. The NextGen plans for the next ve years do not address how drones will t into a sys tem designed for planes with pilots on board, but the agency will have consider wheth er to do that, Whitaker told a recent meeting of the NextGen Institute, a nonprot association sponsored by the FAA so that industry can as sist with research. ALEX VEIGA Associated Press Some lenders are pre paring to reissue cred it or debit cards to cus tomers to head off possible losses following the breach of customer data at Home Depot. Capital One Financial and JPMorgan Chase & Co. said they are pre paring to assign new cards to accounthold ers due to the data theft at the home-improve ment retailer. Earlier this month, Home Depot conrmed that malicious software lurking in its check-out terminals between April and September affected 56 million debit and cred it cards. Target, Michaels and Neiman Marcus also have been attacked by hackers in the past year. While lenders often will issue customers a card after its been lost, stolen or used to make an unauthorized pur chase, Capital One and JPMorgan are taking ac tion based merely on whether accounts may be compromised. Capital One, which is sues debit cards in ad dition to its namesake credit card, is preparing to do a proactive, mass reissue of credit and debit cards on accounts that it believes are at risk due to the Home Depot data breach, said spokes woman Pam Girardo. She declined to say how many accounthold ers would be receiving new cards. JPMorgan Chase & Co. began notifying some of its customers last week to expect new cards, said Chase spokesman Edward Kozmor. In one of the notices Chase sent to custom ers with a United-brand card, the bank said it would be reissuing their cards because the secu rity breach at Home De pot may have put their United card at risk. Drones left out of air traffic control plans AP FILE PHOTO A drone prepares to land after ying over the scene of an explosion that leveled two apartment buildings in East Harlem in New York. Some banks reissuing cards over Home Depot breach PAGE 58 Sunday, September 28, 2014 DAILY COMMERCIAL 1 r 217 Nor th 2nd Street Leesburg, Florida 34748352-326-8855Let Our Newest Stylist, Erin Hagg and The Ta lented Staff of Nicki sC reate Yo ur Signature Style. PAGE 59 2 DAILY COMMERCIAL Sunday, September 28, 2014 352-406-9059
http://ufdc.ufl.edu/AA00019282/00354
CC-MAIN-2017-51
refinedweb
62,841
64.61
struts opensource framework struts opensource framework i know how to struts flow ,but i want struts framework open source code Jobs developers and architects how to integrate Quartz with leading open source Java... its original design free of charge. Open source code is typically created...Open Source Jobs Open Source Professionals Search firm Java is an opensource program or not? why??? Java is an opensource program or not? why??? Java is an open source program or not.. why Best Open Source Software (and sometimes incorrectly) called freeware, shareware, and "source code," open... obvious how Open Source works economically. Probably the worst consequence of this lack of understanding is that many people don't understand how Open Source could Testing Open Source Testing Open Source Security Testing Methodology Manual The Open Source Security Testing Methodology Manual (OSSTMM) is a peer-reviewed... are regularly added and updated. Open Source Open Source Content Management Management Systems In this article we'll focus on how Open Source and CMS combine... code for open-source CMSes is freely available so it is possible to customize...; How to Choose an Open Source Content Management System The most Open Source Business Model , how open source business models work so as to provide a starting point... with publication of their source code on the Internet, as the Open CASCADE...Open Source Business Model What is the open source business model Open Source Movement developing nations, generally has a positive view on the open source movement. Malaysia...Open Source Movement Open source movement Wikipedia The open source movement is an offshoot of the free software movement that advocates Open Source Accounting but play with code. With easy access to an open source application, the techie can...Open Source Accounting Turbocase open source Accounting software TurboCASH .7 is an open source accounting package that is free for everyone Open Source HTML . It's not immediately obvious how Open Source[1] works economically. Probably the worst...Open Source HTML HTML Tidy Library Project A quorum...; Open Source HTML Parsers in Java NekoHTML is a simple HTML Open Source E-mail code for complete control. POPFile: Open Source E-Mail...Open Source E-mail Server MailWasher Server Open Source MailWasher Server is an open-source, server-side junk mail filter package MIT Open Source MIT Open Source Open Source at MIT The goal of this project is to provide a central location for storing, maintaining and tracking Open Source... open-source story brings bloggers in Wouldn't you know it? I finally caught Media Center Open Source Media Center Open source media center for Windows Why buy.../nothing/nada/nopes and best of all it is open source. This means anyone can...; Elish Media center Elisa is a project to create an open source Open Source Metaverses Open Source Metaverses OpenSource Metaverse Project The OpenSource Metaverse Project provides an open source metaverse engine along the lines... of an emerging concept in massively multiplayer online game circles: the open-source Open Source Web Page Open Source Web Page The Open Source Page Open Source Initiative... Certified Open Source Software certification mark and program. You can read about... is "Open Source." We also make copies of approved open source licenses here Open Source Community how the software giant can better work with the open-source world. ..., open source or not; neither open source nor proprietary code should be considered...Open Source Community Open Source Research Community Open Source software written in Java Code Coverage Open Source Java Collections API... Billing Software How To Use Open Source Fonts.. source code source code how to get the fields from one page to another page in struts by using JSTL Open Source CD the largest number of software packages. Open source code... to contain source code from the open-source project LAME, an MP3 encoder and player...Open Source CD TheOpenCD TheOpenCD is a collection of high quality Open Source content Management System Open Source content Management System The Open Source Content Management System OpenCms is a professional level Open Source Website Content... existing modern IT infrastructure. OpenCms runs in a "full open source" environment Open Source Dreamweaver Open Source Dreamweaver Open Source Alternatives to Dreamweaver Templating... for a couple of important reasons. Aptana open source IDE... as dreamweaver. Aptana is a robust, free & open source (source available soon source code source code how to use nested for to print char in java language? Hello Friend, Try the following code: class UseNestedLoops{ public static void main(String[] args){ char[][] letters = { {'A', 'B'}, {'C','D open source help desk Open Source Help Desk Open Source Help Desk Software As my help desk... of the major open source help desk software offerings. I?m not doing...?s out there. The OneOrZero Open Source Task Management What is Open Source? are of the view that open source creates problems of a different kind...What is Open Source? Introduction Open source is a concept referring to production Why Open Source? users can view source code, this can help to spot all the bugs and fix them...Why Choose Open Source? Introduction Open source refers to a production and development system Open Source XML Editor on how different projects were using XML. Open Source Swing... benefits: it?s Open Source, so you can see the code. As a set of Cocoa classes it?s...Open Source XML Editor Open source Extensible XML Editor Open Source e-commerce code and J2EE best practices. Open Source E...Open Source e-commerce Open Source Online Shop E-Commerce Solutions Open source Commerce is an Open View source code of a html page using java .. View source code of a html page using java .. I could find the html source code of a web page using the following program, i could get the html code Open Source Software Open Source Software Open Source Software Open source doesn't just mean access to the source code. The program must include source code, and must allow distribution in source code Open Source PHP with phc. PHP shopping cart with open source code Most... by hindering competition and plagiarism. X-Cart is a software with open source code. We... with open source code is a good way to get the right features quickly.   Open Source web mail Open Source web mail Open Web Mail Project Open WebMail... Outlook to Open WebMail.Open WebMail project is an open source effort made... WebMail project is working to accomplish. Open Intelligence Chris Messina and I were talking about how open source principles could...Open Source Intelligence Open source Intelligence The Open Source..., a practice we term "Open Source Intelligence". In this article, we use three Open Source VoIP not be exactly how you wanted it). Open Source E-Book Reader... readers how to combine Asterisk open source software with industry-standard... how a substantial enterprise could use open source software to run its Open Source Software . Open source software is very useful because source code also distributed... is also know as OSS. Simply open source means the availability of the Source code...Open Source Software In this section we are discussing Open source software Microsoft Open source is inferior. Open Source Code Finds Way into Microsoft.... How Microsoft invented open Need source code - Swing AWT Need source code Hai friends, How can I, view all the datas from the mysql database table in the jframe........ Hi Friend, Try the following code: import java.awt.*; import java.sql.*; import Java source code Java source code How are Java source code files named Open Source Blog "open source" had been invented. And, how I contributed to the death of that project...Open Source Blog About Roller Roller is the open source blog server...; The Open Source Law Blog This blog is designed to let you know about Outlook of the code base and hosting the additions on the same open source basis.  ... Open Source Outlook Open Source Outlook Sync Tool Calendaring..., vertically locked down world; we need an open source solution for extracting Wiki of explaining or justifying Free and/or Open Source Software (F/OSS) in order to ask how...Open Source Wiki Open Source Wiki Roundup The purpose of this article... that choice if the need arises. The open source wiki behind MySql Open Source . Under the Open Source License, you must release the complete source code for the application that is built on MySQL. You do not need to release the source code.. source code security source code security how to obfuscate the code? please answer as soon as possible Open Source c++ geodesics. C++ source code is included. Open Source C...Open Source c++ Open Source C++ During our professional...; Astronomy C/C++ source code From time to time, I'm asked to provide source source code in jsp source code in jsp how to insert multiple images in jsp page of product catalog source code - JSP-Servlet source code I want source code for Online shopping Cart. Application Overview The objective of the Shopping Cart is to provide an abstract view... Rakesh, I am sending a link where u will found complete source code Open Source PDF . ? Open source software (OSS), where the source-code is released with the binary...Open Source PDF Open Source PDF Libraries in Java.... Open Source Development with CVS The complete Open Source Open Source Java or specifics of licence arrangements. We haven't worked out how to open-source... to open source Java Sun Microsystems is planning to release the source code... open source Java, the question is how, " Schwartz told delegates in his opening Open Source Hardware , similar to how Linux developers and other open-source programmers share...Open Source Hardware What is open source hardware Open-ness in hardware terms can have a whole range Source Groupware Open Source Groupware Open Groupware Open Group... Software This list is focused on open source software projects relating... see the Free Software Foundation and Open Source Intiative for definitions of Free Open Source Intranet have generally not made source code available.) Open source software is usually...Open Source Intranet Digger Solutions-Intranet Open Source Digger... newsletter software (previously Newsletter Open Source) that has been ported Open Source PVR Open Source PVR MythTV: The Open Source PVR Linux users have been... Tivo illegal. That's why it's heartening to see open source alternatives...-based On2 said the licenses and source code for its VPVision software can Open Source Frameworks Open Source Frameworks Open Source Web Frameworks in Java...; Building enterprise with open source frameworks Any software developer worth... Frameworks Apache Struts is an open-source framework for creating Java web source code of java source code of java how to create an application using applets is front end and back end is sqlwith jdbc application is enter the student details and teaching & non teaching staff details and front end is enter in internet why the php is open source? why the php is open source? why the php is open source Open Source Code Open Source Code What is SOAP SOAP is a protocol for exchanging..., and how pervasive open-source software is in certain areas, the software powerhouse.... Open source code in Linux If the Chinese have IT, get Source Code - Java Beginners Source Code How to clear screen on command line coding like cls in DOS? Hi Friend, Here is the code to execute cls command of DOS through the java file but only one restriction is that it will execute Source code Source code source code of html to create a user login page Open Source Chat Open Source Chat Open Source Chat Program FriendlyTalk is a simple... most people think of open source database products what comes to mind more often...; Open Source APIs for Java Technology Games Welcome to today's Java Live chat Open Source Books Open Source Books Open Books O'Reilly has published a number... books. Open Source Revolution Linux creator Linus... for the Open Source community in the story of Pauling's foundational work that made How source code source code sir...i need an online shopping web application on struts and jdbc....could u pls send me the source code IBM Open Source a searchable database containing an index of open-source computer code...IBM Open Source Open source: IBM's deadly weapon Once... working on open-source software free and unfettered access to innovations open source project open source project i am a b.tec 3rd year ,i want to work in some open source java project, please suggest me source code source code hellow!i am developing a web portal in which i need to set dialy,weekly,monthly reminers so please give me source code in jsp Open Source SQL Open Source SQL Open Source SQL Clients in Java SQuirreL SQL Client.... The minimum version of Java supported is 1.3. iSQL-Viewer is an open-source JDBC 2.x... out common database tasks. Open Source: Data from MS SQL Open Source DBMS Open Source DBMS Open Source Database Management Systems The rapid acceptance and media glare surrounding Linux has enlivened the Open Source community. Indeed, the open source software movement is a rolling freight train open source - Java Beginners open source hi! what is open source? i heard that SUN has released open source .what is re requisite to understand that open source. i know core concepts only Hi friend, Open source is an approach to design Advertisements If you enjoyed this post then why not add us on Google+? Add us to your Circles
http://www.roseindia.net/tutorialhelp/comment/53238
CC-MAIN-2015-40
refinedweb
2,265
73.58
08 June 2011 16:28 [Source: ICIS news] TORONTO (ICIS)--Canadian housing starts rose 2.7% in May from April to an annual rate of 183,600 units, a government housing agency said on Wednesday. Ottawa-based Canada Mortgage and Housing Corporation (CMHC) said the increase was primarily the result of more starts of multiple-unit construction projects in most provinces, while starts for single units fell. Urban housing starts rose 0.6% to an annual rate of 161,000 units in May. ?xml:namespace> Mathieu Laberge, manager for economics and housing analysis at CHMC, said overall Canada’s housing market is healthy - in both the new housing and the resale market. Laberge added that Canadian interest rates continue to be low, which provides stimulus for the housing market. In related news, a government statistics agency said this week that the value of Canadian building permits in April dropped 21.1% to Canadian dollar (C$) 5.3bn ($5.4bn)from March. Both non-residential and residential sectors declined in April, with April's decline in the value of permits came after sequential increases in March and February of 16.8% and 9.8%, respectively. (
http://www.icis.com/Articles/2011/06/08/9467622/canada-may-housing-starts-rise-2.7-from-april.html
CC-MAIN-2015-18
refinedweb
194
55.24
Introduction IBM Business Process Manager (IBM BPM) is a comprehensive Business Process Management platform that provides tools and runtime for modeling, design, execution, monitoring and optimization, while at the same time providing powerful integration features to extend process capabilities of existing enterprise systems. SAP is one of the largest enterprise business software in the market. IBM Business Process Manager can simplify access to SAP processes by providing powerful tools to invoke SAP Enterprise Services in BPM process flows. IBM BPM abstracts the technical interface details of SAP without resorting to complex coding. This article demonstrates a simple scenario where IBM BPM uses SAP Enterprise Services to access a customer's master data in SAP as part of an order entry validation process. With a few steps, you can establish a seamless and secure integration with SAP to build flexible and re-usable process flows. Pre-requisites - Software versions: - SAP ECC 6.0 or higher and SAP NetWeaver 7.0 or higher - IBM BPM 7.5 Advanced or higher - This article assumes that you are familiar with IBM BPM (Advanced version) tooling and possess sufficient skills to create and run a basic business process using IBM Process Designer and IBM Integration Designer tools. - It will be helpful if you are familiar with the basic features of SAP ECC system. SAP Enterprise Services SAP Enterprise Services are standards-based web service definitions that are based on SAP business objects and processes. They support synchronous and asynchronous transmission styles and can be used to implement transaction or batch integration patterns. The SAP Enterprise Services Workplace page provides a central repository of available Enterprise Services provided by SAP. The available enterprise services should be evaluated to see how well they address your specific requirements. However, note that the catalog of Enterprise Services delivered out-of-the-box is not comprehensive, and may limit your option in using these services. Where an Enterprise Service is not available, it is possible to build and expose a custom process in SAP as a web service. IBM BPM Framework for accessing SAP processes Using IBM BPM's powerful tooling, you can access SAP processes in different ways: - Guided Workflow for orchestrating and automating SAP transactions based on the model imported from SAP Solution Manager (IBM BPM V8.x and higher) - BPM Integration Services using WebSphere JCA Adapters, which integrate with SAP using proprietary technologies such as BAPI, Remote Function Call (RFC), Application Link Enabling (ALE), and Advanced Event Processing (AEP) - BPM Integration Services built using SAP Enterprise Services based on Simple Object Access Protocol (SOAP) and Web Services framework To enable IBM BPM to use SAP Enterprise Services, Web Services Definition Language (WSDL) files generated from SAP can be manually imported into the IBM Integration Designer tool to automatically generate Service Component Architecture (SCA) components, such as interfaces and business objects. Alternatively, SAP WSDLs can be managed via WebSphere Services Registry and Repository (WSRR) to better manage, automate, and govern the web services (this is the recommended approach). In this article, we will directly import WSDLs into Integration Designer for demonstration purposes. Use case scenario To demonstrate invoking SAP Enterprise Services from BPM, we will use a simple use case where, as part of a customer pre-approval process, a customer lookup is performed from the SAP Customer Master record to retrieve customer details. The retrieved data can be used in the process, for example, to identify the customer as a preferred customer to offer incentives. To implement this use case, we will define a "Customer Pre-approval" process in Process Designer using a BPMN flow, an integration service to look up SAP Customer Master using a web service (SOAP over HTTP) implemented in IBM Integration Designer, and an enterprise service exposed in SAP ECC to retrieve customer details (see Figure 1). Figure 1. Customer pre-approval process Preparing the SAP environment Many standard SAP transactions are exposed as web services. SAP ES Workplace provides a list of exposed services in your SAP installation. In this article, we will work with an exposed enterprise service that is implemented in the ABAP back-end out-of-the-box in SAP. The following simple steps enable SAP to accept requests over the web service interface: - Activate the pre-built enterprise service in the SAP Internet Connection Framework (SICF) page. - Create a binding for the activated enterprise service using the SAP SOAMANAGER tool. - Export the generated WSDL file. Activate the Enterprise Service First, locate the SAP enterprise service for which you want to build the integration service: - Go to the SAP Enterprise Services Workplace site and search for customer master related enterprise services by entering "read customer basic data" in the Search field. - From the search results, locate the "Read Customer Basic Data_V2" service and click to open it. Here, you can see the details of this out-of-the-box service under Technical Data. It shows relevant details of interest about this service, such as the version of SAP it supports, direction (inbound or outbound), mode (synchronous or asynchronous), and the WSDL for the service. Make a note of the "Related Web Service Definition" value for this service (ECC_CUSTBASICDATABYIDQR_V2). You will use this definition name to look for it under the SICF transaction code (Figure 2). Figure 2. Read Customer Basic Data_V2 service in SAP ES Workplace - Click on the WSDL link to download it. You will upload this WSDL into Integration Designer to build the web service call. Next, activate the web service that you identified in the SAP system. Note that activating an enterprise service is client specific. You have to activate the service in each SAP client that you connect to. - Log on to the SAP system with valid credentials and invoke the SICF transaction. This transaction is part of the SAP Internet Connection Framework (ICF). In the Maintain Services screen, enter SERVICEas the criteria for Hierarchy Type and DEFAULT_HOSTfor the Virtual Host as shown in Figure 3. Click Execute. Figure 3. Maintain Services query screen in SICF - In the Maintain service results screen, under the Virtual Hosts/Services section, expand the default_host node and go all the way to default_host > sap > bc > srt > xip > sap sub-node. srt stands for the soap runtime, xip is the XI interface, and sap is the namespace. - All the enterprise services available in this version of SAP are listed here. Scroll down and locate the service with the name of ECC_CUSTBASICDATABYIDQR_V2. Recall that this is the enterprise service definition name you noted down from the ES Workplace portal earlier (Tip: Use the Find button to search for the definition name). This service is grayed out as it has not been activated yet. Right-click on this service and select Activate Service from the context menu as shown in Figure 4. Click Yes in the pop-up with the question "Do you want to activate service…". Now this service is active for consumption. Figure 4. Activate enterprise service in SICF Create binding The next step is to create a binding for this web service so that it can be invoked from the BPM flow. Binding is the step where the protocol with which the web service will be invoked is assigned, along with the web service security setting, among other things. To create the binding, we use the SOAMANAGER interface, which was introduced in SAP NetWeaver V7.0 SP14. - In the command window, enter /nSOAMANAGERto open up the SOA Manager portal in a Web Dynpro session. - Click the Log On button and enter your SAP user ID and password one more time to enter the SOA Manager portal. In the portal, switch to the Service Administration tab and click to open the Single Service Configuration page. Enter ECC_CUSTBASICDATABYIDQR_V2in the Search Pattern field. Select Both Names as the Field value and click Go. The Search Results table shows the external and internal names of your service, along with its namespace. Select the row to highlight it and press the Apply Selection button (Figure 5). Figure 5. Enterprise service search in SOAMANAGER page - This opens a section called "Details of Service Definition" below. Switch to the Configuration tab and click on Create Endpoint. A pop-up opens showing the service name, the description, and the new binding name. Change the New Binding Name value to ECC_CUSTBASICDATABYIDQR_V2_Binding and click Apply Settings to generate the binding details (Figure 6). Figure 6. Generate binding for enterprise service in SOAMANAGER Click to see larger image - Scroll down to Configuration of Web Service End Point section of the screen and under the Provider Security tab. Leave the Transport Guarantee with the default values (None (HTTP) – we will use a plain HTTP connection for this demo). Under Authentication Settings > Authentication Method, select the User ID/Password option. This automatically selects sapsp: HTTPBasic as the Authentication Method. Click the Save button to save the configuration settings. Now the binding for your enterprise web service is successfully generated (Figure 7). Figure 7. Generated binding with HTTP basic authentication setting Export the WSDL and perform a quick test Now export the WSDL with the specified binding so that it can be imported into the Integration Designer workspace. - Scroll up to the Details of Service Definition section, switch to the Overview tab and click on the second link, Open WSDL document for selected binding or service, to open the WSDL with the generated binding. - Save the file into your desktop with a name of ECC_CUSTBASICDATABYIDQR_V2.wsdl. Now the WSDL is ready to be imported into Integration Designer. Now let us do a quick test of the new web service to verify that it works with HTTP basic authentication as expected. - While still under the Overview tab, click on the Open Web Service navigator for the selected binding link to open the service test client in a new browser window. Enter the user ID and password to authenticate to the navigator. - Now you can enter a customer number in the search criteria and test the service. (Figure 8). Figure 8. Testing the enterprise service Click to see larger image - To verify the binding, go back to SICF and verify that the newly generated binding is displayed (Figure 9). Figure 9. Generated binding in SICF This completes the SAP setup for invoking this web service. Setting up IBM BPM to access SAP Enterprise Services The BPM example process consists of a simple flow where a Coach UI is used to enter customer number, and a Customer Lookup button in the coach invokes an Advanced Integration Service (AIS) to retrieve customer record from SAP and displays it on the screen. A real-life process typically consists of additional steps, such as assigning customer priority, applying special promotions and such, but we will focus on the first step. The implemented solution consists of two parts: - A Business Process Definition (BPD) called "Customer Pre-approval" in Process Designer. This process contains the Customer Lookup AIS. - A Business Process Execution Language (BPEL) based flow in Integration Designer that implements the AIS. This process invokes the SAP Enterprise Service that we set up in the Preparing the SAP environment section. Create the business process - Log on to the Process Designer and create a process application called "Customer Pre-approval PA" with an abbreviation of "CUSTSAP". Create a new Business Process Definition (BPD) under the Processes library called "Customer Pre-approval". Create the process flow as shown in Figure 10. The flow contains two steps: - Enter Customer HT human activity - Assign Customer Priority GS service. You will implement the Enter Customer activity as a Human Service in this demonstration. Fig 10. Customer Pre-approval process diagram - Create the business objects to be used in the flow. For our example, you will create just one business object called "Customer". In real life, the complete process in real-life may contain more data objects. Click the + sign next to Data to create the Customer data object. The data object contains the following structure: - customerID - customerName - description - industry - category - tier - salesOrganization - address - contactInfo - Create a new Private variable in the process under the Variables tab called customer of type "Customer". - Create a new Human Interface called "Enter Customer HS" by clicking the New button in the Implementation tab of the Enter Customer activity. Create an input and output variable with the same name called "customer" of data type Customer. This is passed into the human service from the Customer Pre-approval BPD. - Drag and drop a Coach object in the canvas and create the coach with the following layout using the customer variable. Except for the Customer ID field, make all other fields read only. Add three buttons called Customer Lookup, Submit, and Cancel (see Figure 11). For brevity, we will provide the steps needed to create the coach layout. See the attached CustomerPreapproval.zip file for the implemented solution. Figure 11. Coach layout for Customer Entry Now create an AIS to perform the customer lookup: - Create an Advanced Integration Service under Implementation with a name of "Customer Lookup AIS". The AIS accepts customerId (of type String) as the input variable. - Create an output variable called customer of type "Customer". The AIS returns the customer details in this object. Create a fault variable called "invokeFault of type String" to capture any exception messages returned from SAP. In real life, the fault object will perhaps be a structure containing a more complete fault message structure. Save the AIS. - Back in the Process tab of the Enter Customer HS service, select Customer Lookup AIS from Implementation and drag it into the canvas. Wire the Customer Entry Coach to the Customer Lookup AIS with the Lookup Customer button as the boundary event. Under Data Mapping, assign tw.loca.customer.customerID as the input variable map and tw.local.customer as the output variable map. The flow looks like Figure 12. Figure 12. Customer HS service flow - To complete the flow, go back to the Customer Pre-approval process and assign a customer variable as the output variable. The Enter Customer human service returns the complete customer data object to the process. Implement the Advanced Integration Service The following steps assume that your Integration Designer environment is already connected to your Process Center: - Launch Integration Designer and accept the default workspace (or you may change to your preferred workspace). - If it challenges you to enter the Process Center URL and user ID and password, enter the relevant values for your environment to connect to your Process Center. - Switch to Process Center perspective. In the Process Center view, under Process Applications, locate the Customer Pre-approval PA (CUSTSAP) created earlier and click Open in the workspace. - Integration Designer automatically generates the AIS related artifacts. The AIS, implementation module, and the associated library are created under the Customer Pre-approval PA Main container project. - The Customer Lookup AIS shows up as "Unimplemented". Right-click on it and choose Implement. Choose Microflow as the type and enter CustomerLookup_BPas the name. The process is now created in the Assembly diagram as shown in Figure 13. Figure 13. Customer Lookup assembly diagram To invoke the SAP Enterprise Service for the customer master, import the SAP WSDL generated in Export the WSDL and perform a quick test for the Customer Pre-approval project. Note: As of BPM V8.x, there is a known issue when importing the SAP-generated WSDL due to the WSDL missing the soapAction attribute for the SOAP 1.2 binding. This has to be manually fixed after importing the WSDL as explained below. - In Integration Designer, right-click the Customer Pre-approval PA Main project, click Import, choose WSDL and XSD as the type, select Customer_Pre-approval_PA_Implementation as the target module, and import the ECC_CUSTBASICDATABYIDQR_V2.wsdl from your desktop (check the Import dependent resources box). The interfaces and business objects for invoking this enterprise service are generated automatically. - Integration Designer flags the following error under the Problems tab: "WSDL: The soapAction attribute is missing. It is required when soapActionRequired is set to or defaults to true". To fix this error, right-click on the error and select Quick Fix. In the Quick Fix window, select the first fix, Add the missing value for SOAPAction attribute, as shown in Figure 14 and click Finish. Figure 14. SOAPAction attribute fix The error under the Problems tab should now disappear. Create the BPEL flow Proceed to implement the BPEL flow to retrieve the customer details from SAP. - In the project's Assembly diagram, create an import with the WS binding with SOAP 1.1 version and assign the interface generated from SAP WSDL named "CustomerERPBasicDataByIDQueryResponse_In_V2". Set the import name as SAP_EntSvc_IMP_WS. - Wire the CustomerLookup_BP module to the import. It automatically creates a reference to the import (Figure 15). Figure 15. Import component for SAP enterprise service - Right-click CustomerLookup_BP and click the Generate implementation to generate a skeleton BPEL implementation. In the BPEL editor, create a flow that looks like Figure 16. Figure 16. CustomerLookup_BP flow - The following steps create the flow: - A Receive step with the AIS interface is automatically generated. Assign a variable to receive the input by clicking New. Accept the default variable name of "customerID". - Create two new variables called customerSAP of type CustERPBscDataByIDQuMsg_s_V2 and customerSAPResult of type CustERPBasDataByIDRpMsg_s_V2 (both these types are generated from the SAP WSDL). - Drag and drop a Java snippet that writes an informational message in the log. Code the snippet in the visual editor as shown in Listing 1. Listing 1. Snippet to write entry log System.out.println(">>>> Entering Customer Look up process with customer id " + customerID); - Drag and drop a Data map that maps input message from the business process to the SAP object. Choose the XML map as the type and MapX_Customer_CustomerSAP as the name. Assign customerID as the input variable and customerSAP as the output variable. - The Business object map editor opens. Map the fields as shown in Figure 17. Map the customer ID to LowerBoundaryCustomerID and assign 1 to IntervalBoundaryTypeCode. Click Save and close it. Figure 17. Customer to CustomerSAP mapping - Create an invoke step below the Data map that invokes the SAP Enterprise Service operation, CustomerERPBasicDataByIDQueryResponse_In_V2. This is a synchronous invoke and gets the Customer details as a response from SAP. Assign the customerSAP variable as input and customerSAPResult variable as output to the invoke step. - Drop another Java snippet below the invoke step that writes a message in the log related to the returned result. Code the snippet as shown in Listing 2. Listing 2. Snippet to write an SAP invoke result String customerID = ""; String searchTerm = ""; ListIterator list = customerSAPResult.getList("Customer").listIterator(); if (list.hasNext()) { DataObject customer = (DataObject) list.next(); customerID = customer.getString("ID"); searchTerm = customer.getDataObject("Common").getString("KeyWordsText"); } System.out.println("<<<< Customer lookup returned customer ID " + customerID + ", " + searchTerm); - Create another business object map called "Map_CustomerSAP_Customer" that maps the SAP's returned object to the Customer object. Map the customer and address fields from the SAP object to the customer process object as shown in Figure 18. This is a simple one-to-one move style map. - The Reply step returns the mapped SAP result to the calling Customer Pre-approval business process. Figure 18. Map SAP Result to Customer object - This completes the BPEL flow. Save and close the editor. There should not be any errors listed under the Problems tab. If there are errors listed, review the steps to make sure the errors are resolved. Enable authentication The last step is to enable the user name based authentication to the invocation and to authenticate BPM client to SAP. As you recall from the Create binding section, we enabled HTTP basic authentication. - Log on to WebSphere Admin console as an administrative user. Under Services > Policy sets, click the Application policy to open it. Click New to create a new policy set. - Enter the name as BPMHTTPOnlyBasicAuthas shown in Figure 19. Optionally, enter a description. Click the Add button and select HTTP Transport to add it. Click Save to save the policy. Figure 19. Policy set for HTTP transport - Next, you need to create a client binding using this policy to assign the user name and password. Click General client policy set bindings under Services > Policy sets to open it. - Click New to create a new client binding. Enter the Binding configuration name as SAPRSABasicAuthBindingand optionally enter a description. Click Add and select HTTP Transport (see Figure 20). - In the HTTP transport screen, under Basic authentication for outbound transport requests section, enter your SAP user name and password. - Click OK then Save to save your changes. Figure 20. Client policy set binding Export the new client policy binding as a zip file so that it can be imported into Integration Designer. - Click Services > Policy sets > Application policy sets to open it. Click the checkbox next to the BPMHTTPOnlyBasicAuth policy set that you created and click Export. - The console generates a zip file called "BPMSAPBasicAuth.zip". Click to download the zip file to your workstation. - Click Services > Policy sets > General client policy bindings to open it. Click the checkbox to select the new SAPRSABasicAuthBinding binding and click Export. - The console generates a zip file called "BPMSAP Client.zip". Click to download it into your workstation. - Log off from the console. Assign the new policy set and binding to the SAP Import component in the Integration Designer Assembly diagram for the project. - Right-click on the Customer Pre-approval PA Library and select Import. Select Web services > WebSphere Policy Sets as the import source wizard. - Locate and select the BPMHTTPOnlyBasicAuth.zip that you exported in the previous step and click Finish. - To import the client binding, right-click on the Customer Pre-approval PA Library and select Import. Select Web services > WebSphere General Bindings as the import source wizard and import BPMRSABasicAuthBinding.zip binding zip file. - Open the Customer Pre-approval Assembly diagram and click on the SAP_EntSvc_IMP_WS import component to select it. - Under the Properties tab, click on the Policy Sets tab under Binding. In the Default policy set selection list, the "BPMHTTPOnlyBasicAuth" policy now appears as a selection (see Figure 21). Select it to assign it. - In the Binding selection list, the "BPMRSABasicAuthBinding" binding appears. Select it to assign it. Figure 21. Assign policy set and client binding to SAP Import - Save the changes. The last step is to publish the new module to Process Center. Right-click the Customer Pre-approval Process project and click Refresh and Publish. The "changed" status disappears and the module status should say "Synchronized". This completes the build for the SCA component of the solution. To summarize, we created a simple Business Process Definition called "Customer Pre-approval Process" that accepts the customer ID as input from the business user in a Coach, and looks up customer detail from the SAP system. The look up is done using an Advanced Integration Service, which is implemented as a BPEL that invokes the SAP Enterprise Service to retrieve customer details from SAP. The returned result is mapped back to the BPM business object and displayed in the Coach. Security is implemented using the HTTP basic authentication mechanism. Testing the flow You can test the flow by using the playback function of Process Designer. Alternatively, the business process can be exposed to and run from the Portal. - Log on back the Process Designer and open the Customer Pre-approval process in Designer. Click the Playback button. - In the Customer Pre-approval Coach, enter a valid Customer ID that exists in the SAP system that you are connected to. In this example, we entered "3556" as the customer ID. - Click the Customer Lookup button. The Customer Lookup AIS invokes the Customer Pre-approval SCA component, which invokes SAP over the web services interface, using HTTP basic authentication to authenticate with SAP with a user ID and password. Customer details are retrieved from SAP for the entered customer and displayed in the Coach. Figure 22. Customer Entry Coach displaying results - Open Integration Designer and click the Console tab. If the Console tab does not show, click Window > Show View > Console to display it. The server logs display the messages that you entered in the Java snippets in the BPEL flow. Conclusion This article demonstrated the ease of consuming SAP Enterprise Services from IBM Business Process Manager over the standard SOAP protocol. It described the steps to prepare the SAP system to accept enterprise service requests, create a business process that included an integration service to call the SAP enterprise service to look up business data, and implement a basic security mechanism to implement the integration securely. Download Resources - IBM Business Process Manager V8.0 Information Center - IBM Business Process Management zone - SAP Enterprise Services Workplace - SAP Service Marketplace.
http://www.ibm.com/developerworks/bpm/library/techarticles/1312_gopalan/1312_gopalan.html
CC-MAIN-2014-35
refinedweb
4,113
55.13
Cool topics to wrap up this hot and exciting week: - Are you using the derived analytical model? - Pick room in current project or linked model - Determine whether custom export was cancelled - Multi-threading with the single-threaded Revit API - Beginner’s guide to abstraction Are You Using the Derived Analytical Model? If so, please provide feedback on your experiences to Charlene Portante, Building Engineering User Experience Research Coordinator at Autodesk. She is seeking feedback from developers regarding the Derived Analytical Model Revit API: Are you a developer who interacts with the Revit API regarding the Derived Analytical Model? If so, please take 5 minutes to provide your input. We would like to hear from you. Our goal is to get a better understanding what functions developers are using and how they are using them. Please feel free to forward this on to a developer you work with. Please click here to provide input: Thank you! Pick Room in Current Project or Linked Model Richard RPThomas108 Thomas and I cooperated nicely and enjoyably to develop a novel solution for PickObject to select a room in current model or linked models: Question: I’m working on a Revit add-in and would like to prompt the user to select a room in the model. The room can be from either the current project or the linked models. With the help from previous posts in the forum I’m able to make some progress so far, but still none of the approaches is ideal. Here are what I’ve tried and the downsides: - PickObject( ObjectType.Element, roomSelectionFilter) – This works great for rooms in current model, but won’t allow user to select rooms from linked models. - PickObject( ObjectType.LinkedElement, roomSelectionFilter_linkedRoom) – This is the opposite of above: it works great for rooms in linked models, but won’t allow user to select rooms from current model. - PickObject(ObjectType.PointOnElement) – This one allows user to select elements in both current and linked models. However, it’s not limited to rooms – or at least I haven’t come up with a proper ISelectionFilterto achieve so. So, any ideas? I’m thinking if there’s a way to combine 1. and 2. in one pick, or maybe there can be an ISelectionFilter to filter out anything that is not a room for 3.? Appreciate your help! Answer: To cut a long story short, we ended up implementing the latter suggestion, asking PickObject to pick a point and limiting the valid selection to room elements, either directly in the current model or in two steps in one of the linked models. I cleaned up the solution originally implemented by Richard and added it to The Building Coder samples. Here is the diff to the previous version. The selection filter looks like this: public class ElementInLinkSelectionFilter<T> : ISelectionFilter where T : Element { private Document _doc; public ElementInLinkSelectionFilter( Document doc ) { _doc = doc; } public Document LinkedDocument { get; private set; } = null; public bool LastCheckedWasFromLink { get { return null != LinkedDocument; } } public bool AllowElement( Element e ) { return true; } public bool AllowReference( Reference r, XYZ p ) { LinkedDocument = null; Element e = _doc.GetElement( r ); if( e is RevitLinkInstance ) { RevitLinkInstance li = e as RevitLinkInstance; LinkedDocument = li.GetLinkDocument(); e = LinkedDocument.GetElement( r.LinkedElementId ); } return e is T; } } Here is the resulting external command for testing it: public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements ) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; Reference r; ElementInLinkSelectionFilter<Room> filter = new ElementInLinkSelectionFilter<Room>( doc ); try { r = uidoc.Selection.PickObject( ObjectType.PointOnElement, filter, "Please pick a room in current project or linked model" ); } catch( Autodesk.Revit.Exceptions.OperationCanceledException ) { return Result.Cancelled; } Element e; if( filter.LastCheckedWasFromLink ) { e = filter.LinkedDocument.GetElement( r.LinkedElementId ); } else { e = doc.GetElement( r ); } TaskDialog.Show( "Picked", e.Name ); return Result.Succeeded; } Richard confirms that it still works for him as well. Determine Whether Custom Export was Cancelled A quickie from the StackOverflow question on how to get info that Revit custom export of a view is cancelled: Question: I used Revit custom export of a model for exporting a 3D view based on IExportContext. It works fine. But I found that the export process can be cancelled: If the custom export is cancelled, a dialog box is shown: I have 2 questions: - How to get info that exporting was cancelled? - Why is the name of the operation Printing? Answers: - Implement and handle the IExportContext IsCanceledmethod. - Because the custom export is in fact a printing or exporting context, cf. the CustomExporterdocumentation: The Export method of this class triggers standard rendering or exporting process in Revit, but instead of displaying the result on screen or printer, the output is channelled through the given custom context that handles processing of the geometric as well as non-geometric information. Multi-Threading with the Single-Threaded Revit API Question: I have a quick question here: does Revit addin run as a child process of Revit or the addins run in the same process of Revit? Also, where in the code do we start the execution of an addin? Answer: I believe that it is the same process. In fact, you have to be careful to keep execution of API from the addin code on the main thread of Revit. As to where execution begins, an addin is packaged as an application class and there are startup/shutdown methods. To quote: "You have to be careful to keep execution of API from the addin code on the main thread of Revit." Question: Why do we need to be careful to keep the execution in the main thread? Answer: You cannot call Revit API from multiple threads, because most of Revit code is a critical section. Weird corruptions and crashes; it's totally against the way Revit runs. It can be quite easy to accidentally let some code call Revit API from a non-main thread. I think it can happen when you have timers and UI containers that update asynchronously and need to update something in Revit. Here is an explantion of why the Revit API is never ever thread safe. Response: Okay, I understand the thread-safety and critical section ideas. I think 'process' and 'thread' are different concepts. Processes are typically independent of each other, while threads exist as the subset of a process. Does it mean: Revit addin runs in the main thread of Revit, so addin and Revit are in the same process, they share the memory? This is the question we want to know. Answer: Yes. Although, no, that is not entirely true. Revit addins can be multi-threaded. The Revit API can only be correctly accessed from the main thread. That is one reason we have external events that give addins a chance to safely call Revit API methods when another thread says they need to. Question: Is it entirely true that Revit and the addin share the same memory? Answer: The way I understand it is that an addin can spawn threads for computation or UI purposes, but calls to Revit API should be made from the same thread, the one that calls those Startup/OnDocumentOpen methods, etc. Edit: external events appear to be a special case. The Revit process owns the main thread which executes both code inside of Revit and the .NET code. You are able to see a call stack that starts in the addin and goes all the way down to Revit. Past the managed/unmanaged transition. In fact, there can be several such transitions. Question: Is it entirely true that Revit and the addin share the same memory? Could you rephrase? Answer: What is being attempted or prevented? Again, note that there is no multithreading in Revit. Question: We are trying to understand the exact relationship between Revit and its addins, so we ask experts if an addin can snoop on Revit's memory and find secrets like service credentials. Answer: I think that can be phrased as a general question for security experts: if you call code in a managed assembly, can it see memory inside of the caller? I think it is possible, but .NET is rather sophisticated about tracking trust level of the assemblies. Response: Yes – I like that rephrase. Response: Thank you! You got exactly what we want to know! Answer: I can't add much, particularly not much about how managed code is restricted. At a low level, any process like the one that is running Revit.exe has a single address space. All threads and all DLLs that exist in the process "see" the same data. Yes, a given thread of execution can transition between native and managed, which, at higher level, each present a different world to the executing code. We know that the way physical memory is mapped into address space cannot be changing very much on these transitions, or when switching among threads, because remapping so often would be too slow. Security? Native code, in particular, could be trampling on anything at any time. It's the Wild Wild West. Exploits like Spectre feed on that freedom. Addins are simply DLLs, but well-behaved addins are limited by the managed architecture and, well, correctness. The so-called main or UI thread of Revit is usually in charge. That's the one your addin code is running in by default. Managed code running within an Addin is permitted to create managed side threads. There are a lot of things the code can make happen in these threads, including ending up in native code, but for correctness, such should not be calling arbitrary Revit APIs. Beginner’s Guide To Abstraction We end this week with a beautiful Beginner’s Guide To Abstraction presented by Jesse Duffield in a Pursuit of Laziness. Nothing new for an experienced programmer, but beautifully put for less experienced coders. The nice name of Jesse's blog may or may not be inspired by Larry Wall's three virtues. Have a nice weekend!
https://thebuildingcoder.typepad.com/blog/2020/07/selection-link-support-cancel-custom-export-multithreading.html
CC-MAIN-2020-34
refinedweb
1,656
56.05
Get the highlights in your inbox every week. Build a game framework with Python using the module Pygame Build a game framework with Python using the Pygame module The first part of this series explored Python by creating a simple dice game. Now it's time to make your own game from scratch. Subscribe now In my first article in this series, I explained how to use Python to create a simple, text-based dice game. This time, I'll demonstrate how to use the Python module Pygame to create a graphical game. It will take several articles to get a game that actually does anything, but by the end of the series, you will have a better understanding of how to find and learn new Python modules and how to build an application from the ground up. Before you start, you must install Pygame. Installing new Python modules There are several ways to install Python modules, but the two most common are: - From your distribution's software repository - Using the Python package manager, pip Both methods work well, and each has its own set of advantages. If you're developing on Linux or BSD, leveraging your distribution's software repository ensures automated and timely updates. However, using Python's built-in package manager gives you control over when modules are updated. Also, it is not OS-specific, meaning you can use it even when you're not on your usual development machine. Another advantage of pip is that it allows local installs of modules, which is helpful if you don't have administrative rights to a computer you're using. Using pip If you have both Python and Python3 installed on your system, the command you want to use is probably pip3, which differentiates it from Python 2.x's pip command. If you're unsure, try pip3 first. The pip command works a lot like most Linux package managers. You can search for Python modules with search, then install them with install. If you don't have permission to install software on the computer you're using, you can use the --user option to just install the module into your home directory. $ pip3 search pygame [...] Pygame (1.9.3) - Python Game Development sge-pygame (1.5) - A 2-D game engine for Python pygame_camera (0.1.1) - A Camera lib for PyGame pygame_cffi (0.2.1) - A cffi-based SDL wrapper that copies the pygame API. [...] $ pip3 install Pygame --user Pygame is a Python module, which means that it's just a set of libraries that can be used in your Python programs. In other words, it's not a program that you launch, like IDLE or Ninja-IDE are. Getting started with Pygame A video game needs a setting; a world in which it takes place. In Python, there are two different ways to create your setting: - Set a background color - Set a background image Your background is only an image or a color. Your video game characters can't interact with things in the background, so don't put anything too important back there. It's just set dressing. Setting up your Pygame script To start a new Pygame project, create a folder on your computer. All your game files go into this directory. It's vitally important that you keep all the files needed to run your game inside of your project folder. A Python script starts with the file type, your name, and the license you want to use. Use an open source license so your friends can improve your game and share their changes with you: #! <>. Then you tell Python what modules you want to use. Some of the modules are common Python libraries, and of course, you want to include the one you just installed, Pygame. import pygame # load pygame keywords import sys # let python use your file system import os # help python identify your OS Since you'll be working a lot with this script file, it helps to make sections within the file so you know where to put stuff. You do this with block comments, which are comments that are visible only when looking at your source code. Create three blocks in your code. ''' Objects ''' # put Python classes and functions here ''' Setup ''' # put run-once code here ''' Main Loop ''' # put game loop here Next, set the window size for your game. Keep in mind that not everyone has a big computer screen, so it's best to use a screen size that fits on most people's computers. There is a way to toggle full-screen mode, the way many modern video games do, but since you're just starting out, keep it simple and just set one size. ''' Setup ''' worldx = 960 worldy = 720 The Pygame engine requires some basic setup before you can use it in a script. You must set the frame rate, start its internal clock, and start ( init) Pygame. fps = 40 # frame rate ani = 4 # animation cycles clock = pygame.time.Clock() pygame.init() Now you can set your background. Setting the background Before you continue, open a graphics application and create a background for your game world. Save it as stage.png inside a folder called images in your project directory. There are several free graphics applications you can use. - Krita is a professional-level paint materials emulator that can be used to create beautiful images. If you're very interested in creating art for video games, you can even purchase a series of online game art tutorials. - Pinta is a basic, easy to learn paint application. - Inkscape is a vector graphics application. Use it to draw with shapes, lines, splines, and Bézier curves. Your graphic doesn't have to be complex, and you can always go back and change it later. Once you have it, add this code in the setup section of your file: world = pygame.display.set_mode([worldx,worldy]) backdrop = pygame.image.load(os.path.join('images','stage.png').convert()) backdropbox = world.get_rect() If you're just going to fill the background of your game world with a color, all you need is: world = pygame.display.set_mode([worldx,worldy]) You also must define a color to use. In your setup section, create some color definitions using values for red, green, and blue (RGB). ''' Setup ''' BLUE = (25,25,200) BLACK = (23,23,23 ) WHITE = (254,254,254) At this point, you could theoretically start your game. The problem is, it would only last for a millisecond. To prove this, save your file as your-name_game.py (replace your-name with your actual name). Then launch your game. If you are using IDLE, run your game by selecting Run Module from the Run menu. If you are using Ninja, click the Run file button in the left button bar. You can also run a Python script straight from a Unix terminal or a Windows command prompt. $ python3 ./your-name_game.py If you're using Windows, use this command: py.exe your-name_game.py However you launch it, don't expect much, because your game only lasts a few milliseconds right now. You can fix that in the next section. Looping Unless told otherwise, a Python script runs once and only once. Computers are very fast these days, so your Python script runs in less than a second. To force your game to stay open and active long enough for someone to see it (let alone play it), use a while loop. To make your game remain open, you can set a variable to some value, then tell a while loop to keep looping for as long as the variable remains unchanged. This is often called a "main loop," and you can use the term main as your variable. Add this anywhere in your setup section: main = True During the main loop, use Pygame keywords to detect if keys on the keyboard have been pressed or released. Add this to your main loop section: ''' Main loop ''' while main == True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit(); sys.exit() main = False if event.type == pygame.KEYDOWN: if event.key == ord('q'): pygame.quit() sys.exit() main = False Also in your main loop, refresh your world's background. If you are using an image for the background: world.blit(backdrop, backdropbox) If you are using a color for the background: world.fill(BLUE) Finally, tell Pygame to refresh everything on the screen and advance the game's internal clock. pygame.display.flip() clock.tick(fps) Save your file, and run it again to see the most boring game ever created. To quit the game, press q on your keyboard. In the next article of this series, I'll show you how to add to your currently empty game world, so go ahead and start creating some graphics to use! 6 Comments Thanks for writing an article on Pygame, it is much appreciated. However, I'd like to point out some tips on writing more "Pythonic" code (as according to PEP8): * Don't align comments, equals signs, brackets or anything else for aesthetics. * Comments on the same line as code should be preceded by two spaces. * When using multi-line comments, use double quotes rather than single, even if you're using single quotes for strings. * Spaces go after commas. * In conditional expressions (e.g. the while loop condition) don't explicitly test for equality with `True` (`while main == True`); instead, just do `while main`. If you absolutely need to test that something is `True` rather than truthy, do `while main is True` (identity comparison instead of equality). * Don't use the semi-colon to include multiple statements on one line. You seem to be missing the ending parenthesis on the following line: backdrop = pygame.image.load(os.path.join('images','stage.png').convert()) Sorry, I meant: backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() Hey, thanks. I'll get that fixed. Cheers! Thanks for providing this information. Can we intergrate some Machine Learning or Deep Learning in this framework for the Game Development. Thanks for the article. I tried and followed all the steps but I am unable to get anything. Can you please provide a complete script with what goes into Object, Set up and else where.
https://opensource.com/article/17/12/game-framework-python
CC-MAIN-2020-34
refinedweb
1,720
73.58
. Hashes are used to assign some form of identification to a piece of information. The trick is that every time that information is hashed, it results in the same identification. This is useful for tracking files to see if they've changed, or for using hash tables to store large sets of data. This code is based on the FNV hash, but is greatly simplified for clarity. If you're planning on using it for a real application, I urge you to download the original source, which does serveral tests to ensure portability and speed. This sample code only demonstrates the 32 bit version of the hash. It also comes in 64, 128, 256, 512, and 1024 bit version, which require different constants. #include <string.h> #define FNV_PRIME_32 16777619 #define FNV_OFFSET_32 2166136261U uint32_t FNV32(const char *s) { uint32_t hash = FNV_OFFSET_32, i; for(i = 0; i < strlen(s); i++) { hash = hash ^ (s[i]); // xor next byte into the bottom of the hash hash = hash * FNV_PRIME_32; // Multiply by prime number found to work well } return hash; } char *teststring = "This is a test"; uint32_t hash_of_string = FNV32(teststring); // This is technically the FNVa hash, which reverses the xor and // multiplication, but is believed to give better mixing for short strings // (ie 4 bytes). To decrease the inevitable collisions, use the 64 bit variant of the hash. To translate the hash to any other size (ie 24 bit, 56 bit, etc), right shift the top of the hash and xor with the bottom: uint32_t hash24 = (hash32>>24) ^ (hash32 & 0xFFFF
http://ctips.pbworks.com/w/page/7277591/FNV%20Hash
CC-MAIN-2020-45
refinedweb
254
63.53
Asked by: windows integrated security instead Forms authentication Question - User-1987530657 posted.Tuesday, May 13, 2008 12:24 PM All replies - User-1440131788 posted Once you change the web.config file to use Windows Integrated security, users will have to log in using a valid Windows account on the network. Changing the web.config file disables the forms authentication.<?xml:namespace prefix = o<o:p></o:p>Check this article from ScottGu: <o:p></o:p> also got all the info you need.Tuesday, May 13, 2008 1:06 PM - User555306248 posted.Tuesday, May 13, 2008 11:39 PM - User-1987530657 posted [:)]Wednesday, May 14, 2008 2:34 AM - User555306248 posted Yes, you need to add these user to roles, because it defines the rigthts to particular usersMonday, June 2, 2008 11:26 PM - User555306248 posted Any updates on thisTuesday, December 2, 2008 10:22 PM - User555306248 posted Are you able to solve this oneMonday, December 8, 2008 10:28 PM
https://social.msdn.microsoft.com/Forums/en-US/99691d3d-55c9-4dd5-a18e-63ec952ccd1b/windows-integrated-security-instead-forms-authentication?forum=asptimetrackertracker
CC-MAIN-2022-40
refinedweb
161
62.68
Why is threading slowing down over time? If I run the following sample code the calls getting slower and slower: #include "opencv2\opencv.hpp" #include <vector> #include <chrono> #include <thread> using namespace cv; using namespace std; using namespace std::chrono; void blurSlowdown(void*) { Mat m1(360, 640, CV_8UC3); Mat m2(360, 640, CV_8UC3); medianBlur(m1, m2, 3); } int main() { for (;;) { high_resolution_clock::time_point start = high_resolution_clock::now(); for (int k = 0; k < 100; k++) { thread t(blurSlowdown, nullptr); t.join(); } high_resolution_clock::time_point end = high_resolution_clock::now(); cout << duration_cast<microseconds>(end - start).count() << endl; } } Why does that happen? Is it a bug? Some observations / remarks: -The effect is amplified when using the debug Library, even if no debugger is used -The processor boost clock is stable and is not causing the problem -It does not matter if m1 and m2 are allocated on the heap instead of the stack -The slowdown effect does not appear when medianBlur isn't called My system: -Windows 10 64bit -MSVC compiler -Newest offical OpenCV 3.4.2 binaries I think you used the number of threads so much. Did you try with k=4,8 ?? (Depend on your CPU) The are only 2 threads active at the same time. thread tis getting destroyed after each loop. @Tycos, please avoid using your own multithreading with opencv. a lot of functions are explicitly not thread-safe. rather rebuild the opencv libs with TBB or openmp support. (and debug builds have most optimizations off, so, no wonder it's slow) @berak this is not the problem. First only one thread is interfering with any cv context at the same time. Second the performance is good but it is getting worse and worse over time. Third opencv is mostly thread safe and wants you to use multithreading:... that is about internal parallelism. again, imho, you're on the wrong path here. "OpenCV philosophy here is that application should be multi-threaded, not OpenCV functions." -... sorry dear, but you misread all of it. it says the opposite. I don't think so. From the context I clearly understand that internal parallelism (TBB) is only supported in a "may be a dozen" functions yet because OpenCV philosophy is that application should use multiple thread on their own to call the functions instead. definitively not so. So can you explain me what Iam getting wrong?
https://answers.opencv.org/question/195828/why-is-threading-slowing-down-over-time/
CC-MAIN-2019-43
refinedweb
390
66.23
Re: Simple maths question - From: "slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx> - Date: 10 May 2007 18:27:47 -0700 On May 11, 5:27 am, Mark Janssen <mpc.jans...@xxxxxxxxx> wrote: On 10 mei, 22:32, Frem <freminl...@xxxxxxxxx> wrote: Hello, I was demonstrating how easy Tcl is to use (or at least to learn to use) when I was immediately flummoxed. On a Windows XP machine I created a trivial proc: (bin) 289 % proc subtract {a b} { return [expr {$a - $b}] } (bin) 290 % subtract 3 2.2 0.7999999999999998 Eh? This was using Tcl 8.5a4. It works properly in 8.4.11. Is this a known bug (sorry if it is)? Thanks, Frem. It is working properly in 8.5 as well. The difference between 8.4 and 8.5 is that the tcl_precision global is set differently by default. In 8.5 the two lines: set tcl_precision 12 subtract 3 2.2 will give the same result as in 8.4. The real reason you get this result however is that floating point math is not precise on a computer (0.2 is a repeating binary fraction). People should be reminded with floating point, any fraction that doesn't end in a '5' is imprecise. Just like with regular pen-on-paper decimal math, 1/3 is imprecise (interestingly if you do your math in base 3, 1/3 is not a repeating fraction and can be precisely represented). . - Follow-Ups: - Re: Simple maths question - From: suchenwi - References: - Simple maths question - From: Frem - Re: Simple maths question - From: Mark Janssen - Prev by Date: Re: TWAPI - how to register a callback to a Shutdown (or similar) event? - Next by Date: setting "current" namespace - Previous by thread: Re: Simple maths question - Next by thread: Re: Simple maths question - Index(es):
http://coding.derkeiler.com/Archive/Tcl/comp.lang.tcl/2007-05/msg00360.html
crawl-002
refinedweb
299
74.59
New Firmware Release Candidate v1.20.0 @xykon Deep-sleep current on G01 with v1.20.0.rc3 built today from source: import machine machine.deepsleep() Result: 7uA OK import machine import network lte=network.LTE() lte.deinit() machine.deepsleep() Result: 29mA Not OK! Both tests are included in this graph: Edit: Tested with FiPy on custom board (no FTDI or other peripherals) powered with 3.75V from Otii Arc. Results are almost the same as for G01! - 22uA for the first test code (includes quiescent current of voltage regulator) - 27mA for the second test code. Same results if LTE is attached between init and deinit. The modem starts attach after first lte.isattached() is called! It can be clearly verified when monitoring consumption with Otii Arc or similar tool. - please rename branch "release-candiate" -> "release-candidate" - I had to install pyserial package manually, before I was getting this error: # make BOARD=GPY TARGET=boot Use make SECURE=on [optionally SECURE_KEY ?= secure_boot_signing_key.pem] to enable Secure Boot and Flash Encryption mechanisms. Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity. BASE Variant mkdir -p build/GPY/release/bootloader/ CC bootloader/bootloader.c CC bootloader/bootmgr.c CC bootloader/mperror.c CC bootloader/gpio.c CC bootloader/flash_qio_mode.c AR build/GPY/release/bootloader/bootloader.a LINK xtensa-esp32-elf-gcc *** -nostdlib -Wl,-Map=build/GPY/release/bootloader/bootloader.map -Wl,--no-check-sections -u call_user_start_cpu0 -Wl,-static -Wl,--undefined=uxTopUsedPriority -Wl,--gc-sections -T esp32.bootloader.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.bootloader.rom.ld -T esp32.rom.spiram_incompatible_fns.ld *** -Wl,--start-group -Lbootloader/lib -Lbootloader -Lbuild/GPY/release/bootloader -L/root/micropython_esp32/pycom-esp-idf/components/esp32/ld -L/root/micropython_esp32/pycom-esp-idf/components/esp32/lib -llog -lcore -lbootloader_support -lspi_flash -lsoc -lmicro-ecc -lgcc -lstdc++ -lgcov build/GPY/release/bootloader/bootloader.a -Wl,--end-group -Wl,-EL -o build/GPY/release/bootloader/bootloader.elf text data bss dec hex filename 19086 1992 40 21118 527e build/GPY/release/bootloader/bootloader.elf IMAGE build/GPY/release/bootloader/bootloader.bin Traceback (most recent call last): File ".../micropython_esp32/pycom-esp-idf/components/esptool_py/esptool/esptool.py", line 35, in <module> import serial.tools.list_ports as list_ports ImportError: No module named tools.list_ports application.mk:552: recipe for target 'build/GPY/release/bootloader/bootloader.bin' failed make: *** [build/GPY/release/bootloader/bootloader.bin] Error 1 Environment: Ubuntu 16.04.3 LTS 64-bit @xykon Yesterday I did some tests with PSM-related AT commands. Is seems that following commands should sent before attaching (after first boot). Of course timer values of '+CPSMS' may be adapted. self.lte.send_at_cmd('AT+CPSMS=1,,,"01000001","00000001"') self.lte.send_at_cmd('AT+CEREG=4') After successful attach '+CEREG?' returns Active time and Periodic TAU values allocated by the network which may be identical to requested values (this is the case in NB-IoT network of Slovak Telekom) but in other networks they may be limited by the network. It seems that '+CPSMS' command has to be called after consequent boots from deep-sleep (with LTE already attached) as well. - Xykon administrators last edited by Xykon @danielm said in New Firmware Release Candidate v1.20.0.rc0: . I will try to post more details about PSM/eDRX as soon as possible. Generally the standard 3GPP AT commands should be used using lte.send_at_command(). However in order to tell the modem to go into PSM/eDRX mode, lte.deinit(dettach=False)should be called. The wrong spelling of dettachaside, the modem checks the state of the flow control pins to see if it is OK to go into low power mode. The deinitcommand releases the flow control pins thus allowing the modem to go into the configured sleep mode. In regards to the release candidate, after uploading v1.20.0.rc2 earlier today, which includes the latest Sequans firmware updater and Pybytes scripts, I have realised an error was made in pycom_config.hthat causes the fs_type flag to be stored at an incorrect position. This is also the reason why the setting from the firmware updater is ignored. I have already uploaded a correction to the release-candidatebranch as I had issues updating the perviously used v1.20.0.rc0branch. I will upload a new version shortly but wanted to give people a heads-up to check the file system type in the firmware updater when updating. This should only affect people who used the commands I posted above to manually switch the fs_type with the pycom_bootmgrcommand. @einarj There are some eDRX-related commands as well: - eDRX Read Dynamic Parameters: +CEDRXRDP - eDRX Setting: +CEDRXS - Specific eDRX Settings: +SQNEDRX I have no idea if PSM/eDRX commands are implemented and working as expected because I did not test them yet. . @danielm I've tried, but it doesn't seem to have any effect. I can see it's being disabled by default in the LTE init, so I've set the command manually after that. The PSM should,in theory, cause the LTE modem go into PSM mode right after the data is sent, but that doesn't seem to happen. Maybe it's becsuse the the flag for going into PSM is not being passes to the modem. But, PSM is useless if you don't cannot setup eDRX. The modem gives me an error if I try the setting specified in the AT-command specs. Do you know if the vendor has implemented these features into the FW? @einarj I did not perform any tests with those features yet but I think you must set requested mode and related timers by AT commands, e.g.: Power Saving Mode Setting: +CPSMS=[<mode>[,<Requested_Periodic-RAU>[,<Requested_GPRSREADYtimer>[,<Requested_PeriodicTAU>[,<Requested_Active-Time>]]]]] Hello @robert-hh, sorry I misunderstood your initial PR, somehow I thought there was a need to control keyboard interrupts in normal REPL, which why I had to do these modifications for it to work. I agree with you, your PR is then sufficient and no further modifications needed, will correct this shortly @iwahdan The Exposed Keyboard Interrupts Control to Micropython does not work. Reason: The API changes the persistent flags, but the code in machuart.c and telnet.c looks at the non-persistent flags. IMHO, these non-persistent flags are not required, because it is a user script which modifies the flags and can set it back. At the REPL loop in pyexec.c, these flags are anyhow reset to the default state, once REPL gets control again. So better use the mechanism of the initial PR. - serafimsaudade last edited by serafimsaudade Now I'm having another problem :/. When I call rtc.ntp_sync(pool.ntp.org) func the rtc get the correct time and date but the rtc.synced() never return True. Using the 1.19.0.b5 fw this problem disappear. When using the Pycom Upgrade software for linux. When I chose LittleFS, the pycom finish the upgrade and start with FatFs - Xykon administrators last edited by @serafimsaudade said in New Firmware Release Candidate v1.20.0.rc0: But when I try format to littleFS. It don't work. Please try the following: import pycom pycom.bootmgr(fs_type=pycom.LittleFS, reset=True) This will update the configuration to use LittleFS instead of FatFS. The board will reset automatically. Similarly you can switch back to FatFS: import pycom pycom.bootmgr(fs_type=pycom.FAT, reset=True) Note: When switching between LittleFS and FatFS, the flash file system will be re-formatted thus erasing all content. - Paul Thornton last edited by @serafimsaudade HI. Can you give us any more details on the issue your having. do you get any error messages? Hello All , I've released a new version of Release candidate v1.20.0.rc1having the following updates: Improvments - Exposed Keyboard Interrupts Control to Micropython Bug Fixes - Fixed DeepSleep high current Consumption when LTE is not Initialized - Increased Delay before initialising RGB color to not Have RGB turn green at startup Link to release on GitHub you can also download this Firmware via Firmware updater using developmentas firmware type.
https://forum.pycom.io/topic/4099/new-firmware-release-candidate-v1-20-0/53?lang=en-US
CC-MAIN-2020-50
refinedweb
1,349
51.14
We aggregate and tag open source projects. We have collections of more than one million projects. Check out the projects section.. First, to use Thymeleaf, we need to declare its XML namespace in the html tag, as follows: <html xmlns:th=””> 1. Text display When using Thymeleaf, we can display text in many ways. We will discuss all possible cases. To display text, we need to use th:text attribute. Displaying static text A text literal can be accessed by using ‘<string>’ as value of th:text attribute, where <string> indicates the text we want to display. Note: Text literal should be enclosed between single quotes. This, in turn, is placed between double quotes to form the value of th:text attribute. <li th:text=”’Static Text’”></li> During run-time, this will be interpreted as: <li>Static Text</li> Display text or content from a model / controller If we want to display dynamic content then the content can be passed as model attribute. @Controller public class HomeController { @GetMapping(“/”) public String home(Model model) { model.addAttribute(“description”, “Dynamic Text From Controller”); return “home”; } } A model attribute can be accessed by using ${<model-name>} as value of th:text attribute, where <model-name> indicates the name of the model attribute. <li th:text=”${description}”></li> During run-time, this will be interpreted as: <li> Dynamic Text From Controller </li> Displaying text from message properties file Another scenario is to access text from message resource. Few content which require localization will be put in message resources so that localized strings can be easily displayed. Consider we have following content in the message resource file: menu-id-about-us=About Us menu-id-contact-us=Contact Us A message can be accessed by using #{<message-id>} as value of th:text attribute, where <message-id> indicates the key. <li th:text=”#{menu-id-contact-us}”></li> During run-time, this will be interpreted as: <li> Contact Us</li> 2. Iteration To iterate over a list, we can use th:each, as shown below. Let’s say we have a list called suits (card game). If we want to render a list-item for each element of suits, then th:each will iterate and render the content. <li th:text=”${suit}” th:each=”suit: ${suits}”></li> Here, th:each causes suit variable to have current element value for each iteration, and th:text causes that value to be displayed as list element text. 3. Conditionals We can make a html tag to conditionally render by using th:if attribute, as shown below: <p th:</p> This Thymeleaf snippet causes rendering of Text “2 is greater than 1” if the condition in value of th:if is true (which is yes in this case). The text will not be rendered if the condition is false. Integrate Thymeleaf with Spring Install Spring Tool Suite Download Spring Tool Suite and expand the zip file in desired location. Create the project Create a Controller package com.example.text_demo; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @Controller public class HomeController { @GetMapping("/") public String home(Model model) { model.addAttribute(“description”, “Dynamic Text From Controller”); List<String> suits = new ArrayList<String>(Arrays.asList("Diamond", "Club", "Heart", "Spade")); model.addAttribute("suits", suits); return "home"; } } Create a Thymeleaf template <!DOCTYPE html> <html xmlns: <head> <meta http- <title>Thymeleaf Demo</title> </head> <body> <ol> <li>Default Text</li> <li th:</li> <li th:</li> <li th:</li> </ol> <p>Suits:</p> <ul> <li th:</li> </ul> <p th:</p> </body> </html> Run the application References Sponsored: To find embedded technology information about MCU, IoT, AI etc Check out embedkari.com. Subscribe to our newsletter.We will send mail once in a week about latest updates on open source tools and technologies. subscribe our newsletter knew that Apace Spark- the most famous parallel computing model or processing the massive data set is written in Scala programming language. The Apace foundation offered a tool to support the Python in Spark which was named PySpark. The PySpark allows us to use RDDs in Python programming language through a library called Py4j. This article provides basic introduction about PySpark, RDD, MLib, Broadcase and Accumulator... a popular and widely used open source NoSQL database. MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution is quite possible. It is licensed under Server Side Public License. Recently they moved to Server Side Public License, before that MongoDB was released under AGPL. This article will provide basic example to connect and work with MongoDB using Java. Lucene is most powerful and widely used Search engine. Here is the list of 7 search engines which is built on top of Lucene. You could imagine how powerful they. I could see many many students posting this question in many forums, I want to contribute to open source but How to contribute? There are many ways to do that. I have listed a few and I hope it might be useful...
https://www.findbestopensource.com/article-detail/thymeleaf-introduction
CC-MAIN-2019-22
refinedweb
843
56.15
Best coding practices Outlined in this section is a detailed explanation of what are to be considered the best coding practices within AutoIt. These recommendations are based on accepted coding practices common to a number of other programming languages. You do not need to follow them, but it is recommended that you do. Note: You must use AutoIt v3.3.10.0 or above to run the examples below. Contents Using Functions If a function sets the @error flag, you should always check it before using a return value - if @error indicates an error then the function return value is generally undefined. Learn more about using Functions by reading "Function Notes" from HelpFile. Names of Variables The variable naming convention used in AutoIt is based on Apps Hungarian notation. The prefix defines the logical data type rather than the physical data type: in this way, it gives a hint as to what the variable's purpose is, or what it represents. The prefix does not encode the actual data type: this occurs during assignment. See the table below for accepted standards. Variables are named following this schema: Examples: ; Assign a local variable the integer 7. Local $iWeekDays = 7 ; Assign a local variable the value of Pi. Local $fPi = 3.14159265358979 ; Assign a local variable an array of strings. Local $asArray[7] = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] ; Assign a local variable an array of numbers. Local $anArray[4] = [0, 0.25, 3 / 4, 12] Variable Initialization When initializing variables there are several points to consider. It is bad practice to hog memory by assigning data which is not immediately required. It is therefore recommended that you declare and initialize variables immediately prior to use. If you wish to assign a default value to a variable which you intend to overwrite later, then the data should be of the same (or the most logical representation of its) type and use as little memory as possible. Examples: ; Inconsistent data types are considered bad. Local $iInteger = "0" Local $sString = False ; Correct initialization Local $iInteger = 0 Local $sString = '' In the following table, recommended default values are shown for each data type. Some data types have more than one possibile default value which can be used for initialization. Example: ; Declare and initialize a variable with the recommended default value. Local $vUndefined = Null ; This does not require much memory. ; Some time later: $vUndefined = 0xB0AD1CEA ; Assign an appropriate value as and when needed. To reduce bloat, multiple variables can be declared on a single line. When declaring multiple variables on the same line, it is generally recommended that you stick to declaring one data type on each line. The intention here is to make the code easier to follow and manage in a future, however the best layout will vary according to circumstance. Example: ; Not recommended Local $sString = "", $iInteger = 0, $asArray = ["a","b","c"] ; Mixed data types ; Recommended Local $iLeft = 10, $iTop = 10 ; integers Local $idGo = GUICtrlCreateButton("Go", $iLeft, $iTop), $idQuit = GUICtrlCreateButton("Quit", 50, 10) ; controlIDs In some languages it is essential to initialize variables on declaration, but this is not the case with AutoIt. Regarding data type, variables declared without being initialized should be considered as being undefined. Scopes of Variables Variables should also be named according to their scope. With this method, you will avoid non wanted re-assignments. Example: #include <MsgBoxConstants.au3> ; Assign a Global variable the number 0. Global $iSomeVar1 = 0 ; Assign a Global variable the number 5. Global $g_iSomeVar2 = 5 SomeFunc() Func SomeFunc() ; Assign Local variables respectively the numbers 3 and 4. Local $iSomeVar1 = 3, $iSomeVar2 = 4 ; Note: The user inadvertently re-assigned the global variable $iSomeVar1, because this one is not named as "global". ; Display the value of $iSomeVar1. MsgBox($MB_SYSTEMMODAL, "", "Value of $iSomeVar1: " & $iSomeVar1) ; Display the value of $iSomeVar2. MsgBox($MB_SYSTEMMODAL, "", "Value of $iSomeVar2: " & $iSomeVar2) ; Display the value of $g_iSomeVar2. MsgBox($MB_SYSTEMMODAL, "", "Value of $g_iSomeVar2: " & $g_iSomeVar2) EndFunc - A variable declared globally (with the Global keyword) is visible anywhere in the script. Always declare your global variables in the global scope, not in the functions. It will prevent another function to use it before its declaration and the declaration is implicit (see examples). - A variable declared locally (with the Local keyword), has a visibility which depends of the scope where it's declared. - Declaration in the global scope: the variable is nonetheless visible everywhere; declare it as Local if this one is only used in the same scope. - Declaration in a function: the variable is visible by the function itself and nowhere else. Structure of a code scope: ; Global scope. ; Include the Constants file, it contains various constants; it's needed here for the $MB_SYSTEMMODAL flag of the MsgBox function). #include <MsgBoxConstants.au3> ; This scope is either Global or Local, depending on where do you use the variables. ; Assign a Global variable the number 0 (which corresponds to an initialization of a variable number), its scope is Global because it's used at least in one function. Global $g_iVar1 = 0 ; Assign a Local variable the string "foo", its scope is Local because it's use is restricted to this scope. Local $sVar2 = "foo" ; Display the content of $sVar2 MsgBox($MB_SYSTEMMODAL, "", "Value of $sVar2: " & $sVar2) ; Re-assign a Local variable the string returned by the function MyFunc. $sVar2 = MyFunc() ; Re-Display the content of $sVar2 MsgBox($MB_SYSTEMMODAL, "", "Value of $sVar2: " & $sVar2) ; Declare a function (its main utility is described later in Functions, we can see one here which is to create a Local scope). Func MyFunc() ; Local scope. ; Display the content of $g_iVar1. MsgBox($MB_SYSTEMMODAL, "", "Value of $g_iVar1: " & $g_iVar1) ; Assign a Local variable the string "bar", its scope is Local because it's use is restricted to the function's scope. Local $sVar3 = "bar" ; Display the content of $sVar3. MsgBox($MB_SYSTEMMODAL, "", "Value of $sVar3: " & $sVar3) ; Return the $sVar3 content, it will be visible (if used) to the scope where the function is called. Return $sVar3 EndFunc ;==>MyFunc Concerning the Dim keyword, its recommended usage is limited to empty an existing array (Example 1) or to redeclare a function parameter (Example 2). Example 1: ;) ; Empty the array (and keep its size). Dim $aArray[5] ; Display the contents. _ArrayDisplay($aArray) Remark: The variable type of the emptied array is a string, every variable non initialized is a string. Example 2: #include <Array.au3> ; Call MyFunc with default parameters ($vParam1 = 0). MyFunc() ; Assign a Local variable an array containing integers. Local $aiArray[3] = [3, 4, 5] ; Call MyFunc with $aiArray as parameter ($vParam1 = $aiArray). MyFunc($aiArray) Func MyFunc($vParam1 = 0) ; If $vParam1 is NOT an array then redeclare it to an array. If IsArray($vParam1) = 0 Then Dim $vParam1[3] = [0, 1, 2] EndIf ; Display the array. _ArrayDisplay($vParam1) EndFunc ;==>MyFunc And for the ReDim keyword, limit its use to resize an array you want to keep its content: ;) ; Resize the array (and keep its content). ReDim $aArray[3] ; Display the contents. _ArrayDisplay($aArray) Why using Dim over Local/Global is not always a good option: #include <MsgBoxConstants.au3> Dim $g_vVariableThatIsGlobal = "This is a variable that has ""Program Scope"" aka Global." MsgBox($MB_SYSTEMMODAL, "", "An example of why Dim can cause more problems than solve them.") Example() Func Example() MsgBox($MB_SYSTEMMODAL, "", $g_vVariableThatIsGlobal) ; That looks alright to me as it displays the following text: This is a variable that has "Program Scope" aka Global. Local $vReturn = SomeFunc() ; Call some random function. MsgBox($MB_SYSTEMMODAL, $vReturn, $g_vVariableThatIsGlobal) ; The Global variable ($g_vVariableThatIsGlobal) changed because I totally forgot I had a duplicate variable name in "SomeFunc". $g_vVariableThatIsGlobal = "" For $i = 1 To 10 $g_vVariableThatIsGlobal &= $i ; This will return 12345678910 totally wiping the previous contents of $g_vVariableThatIsGlobal. Next Return $g_vVariableThatIsGlobal EndFunc ;==>SomeFunc Declaring Global variables in a Function is never a good idea: #include <MsgBoxConstants.au3> ; Calling Example() first will initialise the Global variable $g_vVariableThatIsGlobal and therefore calling SomeFunc() won't return an error. ; Now look at Example 2. Example() was initialised this will not return an error. EndFunc ;==>SomeFunc Example 2: #include <MsgBoxConstants.au3> ; Calling SomeFunc() first will bypass the Global variable $g_vVariableThatIsGlobal being initialised and therefore AutoIt has no idea of what data the variable ; $g_vVariableThatIsGlobal contains. SomeFunc() wasn't initialised this will return an error of "variable used without being declared." EndFunc ;==>SomeFunc Declaring variables in loops (For, While, Do etc..) can have an affect on efficiency: #include <MsgBoxConstants.au3> ; Declaring variables inside loops should be avoided as the variable is re-declared on each repetition. For $i = 1 To 10 ; $i is in 'loop scope.' Local $iInt = $i Next MsgBox($MB_SYSTEMMODAL, '', $iInt) ; This will display 10. #include <MsgBoxConstants.au3> ; Declaring variables outside of loops is more efficent in the long run. Local $iInt = 0 For $i = 1 To 10 ; $i is in 'loop scope.' $iInt = $i Next MsgBox($MB_SYSTEMMODAL, '', $iInt) ; This will display 10. There is no requirement to declare the iteration count variable in a loop: ; Correct Local Const $iCount = 99 Local $aArray[$iCount] For $i = 0 To UBound($iCount) - 1 ; $i is only used in the loop, so there is no requirement to declare it. $aArray[$i] = $i Next ; Incorrect Local Const $iCount = 99 Local $aArray[$iCount] Local $i ; This is only used to store the iteration count value in the loop and therefore doesn't need to be declared. This is known as loop scope. For $i = 0 To UBound($iCount) - 1 $aArray[$i] = $i Next As you can see, there is the Const keyword in the example, we are going to talk about it. Const, Static, Enum Const We won't talk about the advantages of a constant variable, they are neglibible (for your information, an autoit constant variable is marked as read-only and remains a variable as read-only when compiled). The Const keyword may be used in a first by some of you to avoid re-assignments. The best way to use them is not this last case, the constants should be used for real static variables, meaning that their value won't change regardless to the instance of the program. Example: ; Not recommended Local Const $hGUI = GUICreate("MyGUI") ; The handle of the window is unique, it's generated by Windows and changes. ; Recommended Local Const $iMyAge = 19 Static Static variables are the solution to the global variables used in only one function. e.g: Retain variable data once returned from a Function and only use that variable in that particular Function. Example() Func Example() SomeFunc() ; This will display a message box of 1, 1. SomeFunc() ; This will display a message box of 1, 2. SomeFunc() ; This will display a message box of 1, 3. EndFunc ;==>Example Func SomeFunc() ; This initialises a Static variable in Local scope. When a variable is declared just in Local scope (within a Function,) ; it's destroyed when the Function ends/returns. This isn't the case for a Static variable. The variable can't be ; accessed from anywhere else in the script apart from the Function it was declared in. Local Static $vVariableThatIsStatic = 0 Local $vVariableThatIsLocal = 0 $vVariableThatIsLocal += 1 ; This will always be 1 as it was destroyed once returned from SomeFunc. $vVariableThatIsStatic += 1 ; This will increase by 1. MsgBox(4096, $vVariableThatIsLocal, $vVariableThatIsStatic) EndFunc ;==>SomeFunc Enum This statement is often practical in certain situations: #include <MsgBoxConstants.au3> Example() Func Example() ; Create variables in Local scope and enumerate through the variables. Default is to start from 0. Local Enum $eCat, $eDog, $eMouse, $eHamster ; $eHamster is equal to the value 3, not 4. ; Create an array in Local scope with 4 elements. Local $aAnimalNames[4] ; Assign each array element with the name of the respective animal. For example the name of the cat is Jasper. $aAnimalNames[$eCat] = 'Jasper' ; $eCat is equal to 0, similar to using $aAnimalNames[0] $aAnimalNames[$eDog] = 'Beethoven' ; $eDog is equal to 1, similar to using $aAnimalNames[1] $aAnimalNames[$eMouse] = 'Pinky' ; $eMouse is equal to 2, similar to using $aAnimalNames[2] $aAnimalNames[$eHamster] = 'Fidget' ; $eHamster is equal to 3, similar to using $aAnimalNames[3] ; Display the values of the array. MsgBox($MB_SYSTEMMODAL, '', '$aAnimalNames[$eCat] = ' & $aAnimalNames[$eCat] & @CRLF & _ '$aAnimalNames[$eDog] = ' & $aAnimalNames[$eDog] & @CRLF & _ '$aAnimalNames[$eMouse] = ' & $aAnimalNames[$eMouse] & @CRLF & _ '$aAnimalNames[$eHamster] = ' & $aAnimalNames[$eHamster] & @CRLF) ; Sometimes using this approach for accessing an element is more practical than using a numerical value, due to the fact changing the index value of ; the enum constant has no affect on it's position in the array. Therefore changing the location of $eCat in the array is as simple as changing the order ; it appears in the initial declaration e.g. ; Local Enum $eDog, $eMouse, $eCat, $eHamster ; Now $eCat is the 2nd element in the array. If you were using numerical values, you would have to manually change all references of $aAnimalNames[0] to ; $aAnimalNames[2], as well as for the other elements which have now shifted. EndFunc ;==>Example Au3Check directive As you may know (and we hope), the Au3Check tool checks your code for syntax errors, variables used without being declared etc. which is a good thing to fix your script. With the official custom directive used to check the helpfile examples/includes, you can apply the good coding practices listed above: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 Magic Numbers Magic numbers are arbitrary numbers interspersed throughout a program's source code which do not have an associated identifier. The downside to this is not being able to derive a meaning from the number. For example: MsgBox(262144, "Magic Numbers", "It's Adventure Time!") In this example, the magic number is 262144 with the identifier being $MB_TOPMOST according to the helpfile. The corrected example: MsgBox($MB_TOPMOST, "Magic Numbers", "It's Adventure Time!") Example 2: ; Imagine you're a new user to AutoIt and you come across this code, where would you find -3, -4 or -5 in the help file? ; Since AutoIt is relatively a new concept to you, your first thought isn't to search through all the include files, I mean ; why would you, the help file is there for a reason. Example() Func Example() Local $hGUI = GUICreate('') GUICtrlCreateLabel('Why magic numbers are counter productive.', 5, 5) GUICtrlSetState(Default, 128) ; Does this hide, show or disable it? GUICtrlSetState(Default, 64) ; Does this hide, show or disable it? GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case -3 ; Doesn't really tell much about what it does. ExitLoop Case -4, -5 ; Again, no idea what these are. MouseMove? MouseClick? Restore? MsgBox(4096, '', 'Do something when this action takes place.') EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Did you understand the numbers were these: #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI = GUICreate('') GUICtrlCreateLabel('Why magic numbers are counter productive.', 5, 5) GUICtrlSetState(Default, $GUI_DISABLE) ; Better, this is documented in the help file. GUICtrlSetState(Default, $GUI_ENABLE) ; Better, this is documented in the help file. GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Better, this is documented in the help file. Ah, it's the close action. ExitLoop Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_RESTORE ; Better, this is documented in the help file. MsgBox($MB_SYSTEMMODAL, '', 'Do something when this action takes place.') ; Better, this is documented in the help file. EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Magic number (programming) Include-once directive This one is designed for standard includes and UDFs, it's highly recommended to use it. Those includes may be included in more than one script of your project because they are needed for some includes or your script itself. In that case, the code will be duplicated which is not a good thing especially if you have (and it's mainly the case) constants declared in those files, in so far as the constants cannot be redeclared/reassigned; same thing for functions. Put the directive in top of your UDF (library) to avoid itself to be included more than once : #include-once
https://www.autoitscript.com/wiki/Best_coding_practices
CC-MAIN-2015-32
refinedweb
2,623
54.93
This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues. This enhancement refers to the Go To Imported File action (Ctrl+click on file name in import statement) Lets assume this statement: import {Stuff} from '../stuff' If the path does not resolve to a file (../stuff.js) then the editor should look for a '../stuff/index.js' file. As far as I understand, this is not specified in ES6. But node.js, babel, webpack and others will correctly resolve the path. This convention is increasingly popular and the enhancement would be of value for developers.
https://bz.apache.org/netbeans/show_bug.cgi?id=270610
CC-MAIN-2020-16
refinedweb
113
66.44
Issues updating from 0.9.8.0 to 0.9.9.3Posted Wednesday, 28 October, 2009 - 12:12 by Jablo in Replacing the OpenTK dlls for my application from 0.9.8.0 to 0.9.9.3, results in two issues. 1. issue (minor but ugly) I get following warning for all functions needed for tesselation (eg. OpenTK.Graphics.Glu.TessNormal, OpenTK.Graphics.Glu.NextContour): 'OpenTK.Graphics.Glu' is obsolete: 'Use OpenTK math functions instead.' But this functions only exists in namespace OpenTK.Graphics.Glu. Obsolete message can't be suppressed. 2. issue (wrong output) There is also a warning 'OpenTK.Graphics.Glu' is obsolete: 'Use OpenTK math functions instead.' for function OpenTK.Graphics.Glu.LookAt but if I use function OpenTK.Matrix4d.LookAt instead, the values are not set and my application shows wrong graphic. Have I misunderstood something ? Any help appreciated. Re: Issues updating from 0.9.8.0 to 0.9.9.3 Regarding GLU, this has been deprecated upstream, there's nothing we can really do about that (other than reimplemeting GLU methods in OpenTK.Math, help is always appreciated on this). You can disable deprecation warnings completely through your project properties (go to compile tab and enter the numerical value "0612" to the relevant field). Matrix4.LookAtreturns a matrix that you have to apply yourself. The math toolkit doesn't access OpenGL directly, it is completely independent as a module! Re: Issues updating from 0.9.8.0 to 0.9.9.3 Thanks so far, will the GLU methods remain part of compatibility dll and will this dll be kept in current versions ? Re: Issues updating from 0.9.8.0 to 0.9.9.3 Yes, OpenTK.Compatibility will be kept as is in future versions. Re: Issues updating from 0.9.8.0 to 0.9.9.3 Thanks, this was important to know (because we have to use tesselation). One question left, if I want to use orthogonal projection in the same way (create matrix and apply to current) as with perspective projection, it does not work the way I thouth it must be correct. //*#1# works as expected (old way), but //*#2# results in an empty screen Does I miss the basics? Thanks for your help. Re: Issues updating from 0.9.8.0 to 0.9.9.3 Right now, there's no good alternative to GLU tesselation, which is the most useful part of GLU. I hope this can change at some future point (if you happen to learn of a free alternative, please say so!) The equivalent method to GL.Orthois called Matrix4d.CreateOrthographicOffCenter. It accepts the same parameters and should return the exact same matrix (if it doesn't, please file a bug): CreateOrthographicis defined like this: which explains why your scene appears empty: your original projection has twice the width and height of the projection you are creating with code>Matrix4d.CreateOrthographic. Re: Issues updating from 0.9.8.0 to 0.9.9.3 The projection matrix is equal in both cases, if have checked it with GL.GetDouble( GetPName.ProjectionMatrix, out m ); There must be something else what GL.Ortho does additionally. Any hints ? Re: Issues updating from 0.9.8.0 to 0.9.9.3 GL.Orthosimply constructs an orthographic projection and multiplies the current matrix with it (reference). If the projection matrices are identical, then the problem lies elsewhere. Are you resetting the matrix mode back to modelview afterwards? (Your code above does not, but I thought you just pasted the important parts, leaving the rest out). Re: Issues updating from 0.9.8.0 to 0.9.9.3 The projection matrix is NOT equal in both cases. I have compared it inattentively ! The element M44 is different: - GL.Ortho generated M44=1.0 - the combination of OpenTK.Matrix4d.CreateOrthographic and GL.MultMatrix generates M44=0.0 If I adjust M44 manually the graphic output is ok. OpenTK.Matrix4d mProjection = OpenTK.Matrix4d.CreateOrthographic( dSizeScene * dAspRat, dSizeScene, 0.1, 20.0 ); mProjection.M44 = 1.0; GL.MultMatrix( ref mProjection ); This must be the extra functionality which GL.Ortho does automatically ? Re: Issues updating from 0.9.8.0 to 0.9.9.3 Or a bug, more likely. I distinctly recall this issue being fixed on a previous release, which makes me suspect something sinister having to do with merging feature branches back to trunk. Can you please file a bug report?
http://www.opentk.com/node/1298
CC-MAIN-2016-26
refinedweb
743
54.29
So i’m working on the markov chain final project and it is pretty much done, but i can’t write a text file because of this encoding issue: UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u2013’ in position 18: ordinal not in range(128) I tried to encode the string before writing in into the file which is the answer to this problem according to the internet but it just doesn’t work. Thanks in advance. import urllib2 from bs4 import BeautifulSoup def fetch_text(url): html = urllib2.urlopen(url).read() soup = BeautifulSoup(html, "lxml") for script in soup(["script", "style"]): script.extract() text_data = soup.get_text() return text_data text_string = fetch_text("") new_text = str(text_string).encode('utf-8') with open("string.txt", "w") as my_file: my_file.write(new_text)
https://discuss.codecademy.com/t/encoding-issue/393810
CC-MAIN-2019-47
refinedweb
127
58.18
My earlier post on how to validate email address, SSN and phone number validation using Java regex still attracts lot of visitors. Today I realized that another piece of data that many programmers need to validate is the date. Many Java applications have to process input date values, so I thought it will be beneficial to this blog readers to show how regular expression can be used to validate date in java. First I’ll show you how to validate date using java reg ex in US format and later I’ll show you how that same logic can be applied to validate date in English format (used in most countries outside North America). Let’s begin by writing the Java code to validate the date. import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegExDateValidation{ public static boolean isValidDate(String date){ boolean isValid = false; String expression = "^[0-1][1-2][- / ]?(0[1-9]|[12][0-9]|3[01])[- /]?(18|19|20|21)\\d{2}$"; /* * ^[0-1][1-2] : The month starts with a 0 and a digit between 1. */ CharSequence inputStr = date; Pattern pattern = Pattern.compile(expression,Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(inputStr); if(matcher.matches()){ isValid = true; } return isValid; } /*Here is a simple test method to test an input date using Java reg ex*/ public static void main(String args[]){ boolean isValid = RegExDateValidation.isValidDate(args[0]); System.out.println(args[0] + " is " + (isValid?"valid":"invalid")); } } I included the explanation on how the regular expression is constructed in the code, however the day part of the date needs a little more explanation. The expression for day validation is a group of three mutually exclusive sub-expressions or alternatives. Only one of these conditions can be true. (0[1-9]|[12][0-9]|3[01]). This is done to verify that the combination of the digits in the day string falls between 01 and 31. - The first part checks that the day has a value between 01 and 09. Therefore the expression starts with a 0 followed by a range of digit from 1 to 9. - The second part validates the days between 10 to 29. [12] means that the first digit can be a 1 or a 2. [0-9] shows that the second digit can be any value from 0 to 9. - The third subgroup checks for days 30 and 31. This expression will validate dates in US format from years 1800 to 2199. For example 03/15/2009, 10/12/1885 are valid dates but the date 31/01/1999 will not pass validation. For date in European (English) format we can rearrange the regular expression as follows. ^(0[1-9]|[12][0-9]|3[01])[- /]?[0-1][1-9][- / ]?(18|19|20|21)\\d{2,4} Here the day comes before the month. So the date 17/08/2009 is valid but 08/17/2009 will not pass this validation. The logic is same but the elements are re-arranged. You can use following method to switch between American and English date formats dynamically at runtime based on an additional boolean parameter. public static boolean checkDate(String date, boolean isEnglish){ String monthExpression = "[0-1][1-9]"; String dayExpression = "(0[1-9]|[12][0-9]|3[01])"; boolean isValid = false; //RegEx to validate date in US format. String expression = "^" + monthExpression +"[- / ]?" + dayExpression + "[- /]?(18|19|20|21)\\d{2}"; if(isEnglish){ //RegEx to validate date in Metric format. expression = "^"+dayExpression + "[- / ]?" + monthExpression + "[- /]?(18|19|20|21)\\d{2,4}"; } CharSequence inputStr = date; Pattern pattern = Pattern.compile(expression,Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(inputStr); if(matcher.matches()){ isValid=true; } } Hope this is useful to all the Java developers. Share your opinions below. Enjoy. Your Date regex is incorrect; you have it set to collect months between 01-19 which isn’t valid. it should be: “^(0[1-9]|1[012])[- / ]?(0[1-9]|[12][0-9]|3[01])[- /]?(19|20)\\d{2}$” Regardless, great explanations. I appreciate your explanations of the email, ssn, and phone. I didn’t understand the syntax before. Now I do. great articles and great regex CED !! Thanks I have been struggling with regex for a good while in one of my project, which eventually one day becoma a working spider, but to be honest I have never thought that this tool can be used for date validatin also, thanks for sharing your knowledge Zaheer Bravo CED, you just saved a LOT of my time ! CED’s regex expression is OK, still doesn’t take into account the fact that 30/02/1945 is not a valid date. It’s quite complicate to verify a date as a correct one. One might use SimpleDateFormat to validate it. The problem persist as 02/02/4325 is valid and yet not a valid DOB. Great article nonetheless, as I’m struggling with regex. Hi, I wonder after testing date “12/30-2011” as an argument for ur regex pattern, which is giving true as return. ur code is right but the patten u’ve used is not absolute for date validation. Thanks! Just put the limitation as: function validate_date(date) { var pattern= new RegExp(“^(0[1-9]|1[012])[/]?(0[1-9]|[12][0-9]|3[01])[/]?(2012)$”); return pattern.test(date); } if(!validate_date(data_date)){ alert(‘Invalid Date. Correct format is dd/mm/yyyy’); return false; } so, user may type / symbol only.. What is the regex for yyyy-MM-dd’T’HH:mm:ss date format in java, Thanks, Meg What is the correct date format for the string “2011-10-02T01:01:01.111-04:00” in java Great explanation, however, how would it take care of wrong entry of date ? Example 04/31/2012 (mm/dd/yyyy), it passes the regex, however the date is invalid as April only has 1 to 30 days. Also, How would it take care of non leap year date, example 02/29/2013, it passes per regexp but there is not 29th on 2013. I guess there needs to be some checking required. Regardless, I appreciate the explanations. There is another sample for Phone number and Email address validation at
http://zparacha.com/how-to-validate-date-using-java-regular-expression/
CC-MAIN-2017-17
refinedweb
1,024
57.67
[Screenshots of Minecraft on the Raspberry Pi can’t be made with VNC or screenshot tool like scrot, but they can be made with the excellent raspi2png.] We did some Python programming in Minecraft on the Raspberry Pi for our summer projects. Child 2 made some lovely houses and enjoyed destroying things much more efficiently than when you do it by hand: and Child 0 made a spell book. You can see the “elements” spell has been cast in the background (earth, air, water and fire), the “topsy-turvy” spell on the right, the “frozen” spell on the left, and on the far left you can just see a bit of the “river” spell: To cast spells you must first utter the magical incantations: python and then: from spells import * then each spell can be cast by simply saying its name followed by the double brackets of power, for example: topsyturvy()
https://www.artificialworlds.net/blog/category/minecraft/
CC-MAIN-2020-05
refinedweb
151
59
File Passing Tutorial - Passing References to Files Between Components¶ References to files can be passed between Components in OpenMDAO using variables called FileRefs. A FileRef is just an object that contains a file name and an absolute file path which is calculated by the framework. The fname attribute can be a simple name or a name that includes a relative or absolute directory path. Calculation of Absolute Directory Paths¶ During setup, OpenMDAO determines the absolute file system path for each FileRef variable based on the directory path of the Component that contains it. The process works like this: - Starting at the root System of the tree, we calculate its absolute directory based on its ‘directory’ attribute. If the ‘directory’ attribute is empty, then the absolute directory is just the current working directory. If directory contains a relative pathname, then the absolute directory is the current working directory plus the relative path. If directory is already an absolute path, then we just use that. - For each child System in the tree, we calculate its absolute directory based on the absolute directory we’ve already calculated for its parent System, in the same manner as in step 1, except that instead of the current working directory, we use the parent absolute directory as our starting point. - In each Component we encounter as we traverse the tree, after we’ve calculated its absolute directory, we look for any FileRef variables it may have. We set the absolute directory for each FileRef in a similar way as in step 2, but in this case the Component is the parent, so we use its absolute directory as our starting point in determining the absolute path of the FileRef. Note Sometimes you may not want to hard-code the directory name. If you want to delay picking a name until runtime, you can specify directory as a function. If directory is a function, we will call that function, passing in the rank for the current process. That function should return a string containing either a relative or absolute path, which we will resolve to an absolute directory as mentioned above. Using FileRefs¶ So lets make some components that pass FileRefs between them. We’ll just use ascii files here to keep things as simple as possible, but FileRefs can be binary if you set binary=True in the metadata when you add them to a component. First, we’ll make a simple component that takes a single parameter, does a simple calculation, then writes the result to a file. from openmdao.api import Problem, Group, Component, FileRef class FoutComp(Component): """A component that writes out a file containing a number.""" def __init__(self): super(FoutComp, self).__init__() # add a simple parameter that we can use to calculate the # number we write to our output file self.add_param('x', 1.0) # add an output FileRef for our output file 'dat.out' self.add_output("outfile", FileRef("dat.out")) def solve_nonlinear(self, params, unknowns, resids): # do some simple calculation val = params['x'] * 2.0 + 1.0 # write the new value to our output FileRef with unknowns['outfile'].open('w') as f: f.write(str(val)) Now we need a component to read a number from our first component’s output file and use that to calculate a new number. class FinComp(Component): """A component that reads a file containing a number.""" def __init__(self): super(FinComp, self).__init__() # add an input FileRef for our input file 'dat.in' self.add_param("infile", FileRef("dat.in")) # here's the output we'll calculate using the number we read # from our input FileRef self.add_output('y', 1.0) def solve_nonlinear(self, params, unknowns, resids): # read the number from our input FileRef with params['infile'].open('r') as f: val = float(f.read()) # now calculate our new output value unknowns['y'] = val + 7.0 Now we have our two file transferring components, so we can build our model. p = Problem(root=Group()) outfilecomp = p.root.add("outfilecomp", FoutComp()) infilecomp = p.root.add("infilecomp", FinComp()) # connect our two FileRefs together p.root.connect("outfilecomp.outfile", "infilecomp.infile") p.setup() We’ll set a value of 3.0 in our first component’s x value. That should give us a y value in our second component of 14.0. p['outfilecomp.x'] = 3.0 p.run() print(p['infilecomp.y']) 14.0 In this example, our files were both in the same directory, but you can control where they are found by modifying the directory attribute of systems in the tree. For example, if we wanted outfilecomp.outfile to be located in a sub1 subdirectory, we could do the following: p = Problem(root=Group()) outfilecomp = p.root.add("outfilecomp", FoutComp()) # specify the subdirectory here outfilecomp.directory = 'sub1' # since 'sub1' doesn't exist, we need to tell the component to create it. # otherwise, we'll get an error that the directory doesn't exist. outfilecomp.create_dirs = True infilecomp = p.root.add("infilecomp", FinComp()) # connect our two FileRefs together p.root.connect("outfilecomp.outfile", "infilecomp.infile") p.setup() Notice that none of the code in our components or any of our other configuration code has changed. When we run this problem, we get the same answer as before. p['outfilecomp.x'] = 3.0 p.run() print(p['infilecomp.y']) 14.0 FileRefs under MPI¶ When running under MPI, there are certain situations where you may need to create subdirectories dynamically based on the rank of the current MPI process. You can accomplish that by assigning a function to a system’s directory instead of just a simple string. For example, suppose we had a group in our model that we wanted to perform parallel finite difference on, and that group happened to have output FileRefs in it. In that situation, different MPI processes would try to write to the same output file at the same time. In order to prevent this, we can specify that in each MPI process, our group will have a directory specific to that process. Assigning directory to a function instead of a string will let us do that. For example, let’s say we want our group to write its files in a subdirectory called ‘foo_n’, where ‘n’ is the rank of the current process. In that case, setting our group’s directory would look like this: mygrp.directory = lambda rank: "foo_%d" % rank mygrp.create_dirs = True # create the directories if they don't exist The function you assign to directory should expect a single argument that is the rank of the current process, and it should return the desired directory string. Note that it’s also valid to assign a method of your component to directory if you happen to need more information than just the rank in order to determine the directory name. For example: class MyComp(FoutComp): def get_dirname(self, rank): return "%s_%d" % (self.name, rank) mycomp = MyComp() mycomp.directory = mycomp.get_dirname mycomp.create_dirs = True
http://openmdao.readthedocs.io/en/1.7.3/usr-guide/tutorials/file-passing.html
CC-MAIN-2017-17
refinedweb
1,157
54.83
Table of contents Xapian::PostingSource is an API class which you can subclass to feed data to Xapian's matcher. This feature can be made use of in a number of ways - for example: As a filter - a subclass could return a stream of document ids to filter a query against. As a weight boost - a subclass could return every document, but with a varying weight so that certain documents receive a weight boost. This could be used to prefer documents based on some external factor, such as age, price, proximity to a physical location, link analysis score, etc. As an alternative way of ranking documents - if the weighting scheme is set to Xapian::BoolWeight, then the ranking will be entirely by the weight returned by Xapian::PostingSource. When first constructed, a PostingSource is not tied to a particular database. Before Xapian can get any postings (or statistics) from the source, it needs to be supplied with a database. This is performed by the init() method, which is passed a single parameter holding the database to use. This method will always be called before asking for any information about the postings in the list. If a posting source is used for multiple searches, the init() method will be called before each search; implementations must cope with init() being called multiple times, and should always use the database provided in the most recent call: virtual void init(const Xapian::Database & db) = 0; Three methods return statistics independent of the iteration position. These are upper and lower bounds for the number of documents which can be returned, and an estimate of this number: virtual Xapian::doccount get_termfreq_min() const = 0; virtual Xapian::doccount get_termfreq_max() const = 0; virtual Xapian::doccount get_termfreq_est() const = 0; These methods are pure-virtual in the base class, so you have to define them when deriving your subclass. It must always be true that: get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max() PostingSources must always return documents in increasing document ID order. After construction, a PostingSource points to a position before the first document id - so before a docid can be read, the position must be advanced by calling check(). The get_weight() method returns the weight that you want to contribute to the current document. This weight must always be >= 0: virtual double get_weight() const; The default implementation of get_weight() returns 0, for convenience when deriving "weight-less" subclasses. You also need to specify an upper bound on the value which get_weight() can return, which is used by the matcher to perform various optimisations. You should try hard to find a bound for efficiency, but if there really isn't one then you can set DBL_MAX: void get_maxweight(double max_weight); This method specifies an upper bound on what get_weight() will return from now on (until the next call to init()). So if you know that the upper bound has decreased, you should call set_maxweight() with the new reduced bound. One thing to be aware of is that currently calling set_maxweight() during the match triggers an recursion through the postlist tree to recalculate the new overall maxweight, which takes a comparable amount of time to calculating the weight for a matching document. If your maxweight reduces for nearly every document, you may want to profile to see if it's beneficial to notify every single change. Experiments with a modified FixedWeightPostingSource which forces a pointless recalculation for every document suggest a worst case overhead in search times of about 37%, but reports of profiling results for real world examples are most welcome. In real cases, this overhead could easily be offset by the extra scope for matcher optimisations which a tighter maxweight bound allows. A simple approach to reducing the number of calculations is only to do it every N documents. If it's cheap to calculate the maxweight in your posting source, a more sophisticated strategy might be to decide an absolute maximum number of times to update the maxweight (say 100) and then to call it whenever: last_notified_maxweight - new_maxweight >= original_maxweight / 100.0 This ensures that only reasonably significant drops result in a recalculation of the maxweight. Since get_weight() must always return >= 0, the upper bound must clearly also always be >= 0 too. If you don't call get_maxweight() then the bound defaults to 0, to match the default implementation of get_weight(). If you want to read the currently set upper bound, you can call: double get_maxweight() const; This is just a getter method for a member variable in the Xapian::PostingSource class, and is inlined from the API headers, so there's no point storing this yourself in your subclass - it should be just as efficient to call get_maxweight() whenever you want to use it. The at_end() method checks if the current iteration position is past the last entry: virtual bool at_end() const = 0; The get_docid() method returns the document id at the current iteration position: virtual Xapian::docid get_docid() const = 0; There are three methods which advance the current position. All of these take a Xapian::Weight parameter min_wt, which indicates the minimum weight contribution which the matcher is interested in. The matcher still checks the weight of documents so it's OK to ignore this parameter completely, or to use it to discard only some documents. But it can be useful for optimising in some cases. The simplest of these three methods is next(), which simply advances the iteration position to the next document (possibly skipping documents with weight contribution < min_wt): virtual void next(double min_wt) = 0; Then there's skip_to(). This advances the iteration position to the next document with document id >= that specified (possibly also skipping documents with weight contribution < min_wt): virtual void skip_to(Xapian::docid did, double min_wt); A default implementation of next() repeatedly. This works but The final method of this group is check(). In some cases, it's fairly cheap to check if a given document matches, but the requirement that skip_to() must leave the iteration position on the next document is rather costly to implement (for example, it might require linear scanning of document ids). To avoid this where possible, the check() method allows the matcher to just check if a given document matches: virtual bool check(Xapian::docid did, double min_wt); The return value is true if the method leaves the iteration position valid, and false if it doesn't. In the latter case, next() will advance to the first matching position after document id did, and skip_to() will act as it would if the iteration position was the first matching position after did. The default implementation of check() is just a thin wrapper around There's also a method to return a string describing this object: virtual std::string get_description() const; The default implementation returns a generic answer. This default is provided to avoid forcing you to provide an implementation if you don't really care what get_description() gives for your sub-class. Here is an example of a Python PostingSource which contributes additional weight from some external source (note that in Python, you call next() on an iterator to get each item, including the first, which is exactly the semantics we need to implement here): class ExternalWeightPostingSource(xapian.PostingSource): """ A Xapian posting source returning weights from an external source. """ def __init__(self, db, wtsource): xapian.PostingSource.__init__(self) self.db = db self.wtsource = wtsource def init(self, db): self.alldocs = db.postlist('') def get_termfreq_min(self): return 0 def get_termfreq_est(self): return self.db.get_doccount() def get_termfreq_max(self): return self.db.get_doccount() def next(self, minweight): try: self.current = self.alldocs.next() except StopIteration: self.current = None def skip_to(self, docid, minweight): try: self.current = self.alldocs.skip_to(docid) except StopIteration: self.current = None def at_end(self): return self.current is None def get_docid(self): return self.current.docid def get_maxweight(self): return self.wtsource.get_maxweight() def get_weight(self): doc = self.db.get_document(self.current.docid) return self.wtsource.get_weight(doc) ExternalWeightPostingSource doesn't restrict which documents match - it's intended to be combined with an existing query using OP_AND_MAYBE like so: extwtps = xapian.ExternalWeightPostingSource(db, wtsource) query = xapian.Query(query.OP_AND_MAYBE, query, xapian.Query(extwtps)) The wtsource would be a class like this one: class WeightSource(object): def get_maxweight(self): return 12.34; def get_weight(self, doc): return some_func(doc.get_docid()) In order to work with searches across multiple databases, or in remote databases, some additional methods need to be implemented in your Xapian::PostingSource subclass. The first of these is clone(), which is used for multi database searches. This method should just return a newly allocated instance of the same posting source class, initialised in the same way as the source that clone() was called on. The returned source will be deallocated by the caller (using "delete" - so you should allocate it with "new"). If you don't care about supporting searches across multiple databases, you can simply return NULL from this method. In fact, the default implementation does this, so you can just leave the default implementation in place. If clone() returns NULL, an attempt to perform a search with multiple databases will raise an exception: virtual PostingSource * clone() const; To work with searches across remote databases, you need to implement a few more methods. Firstly, you need to implement the name() method. This simply returns the name of your posting source (fully qualified with any namespace): virtual std::string name() const; Next, you need to implement the serialise and unserialise methods. The serialise() method converts all the settings of the PostingSource to a string, and the unserialise() method converts one of these strings back into a PostingSource. Note that the serialised string doesn't need to include any information about the current iteration position of the PostingSource: virtual std::string serialise() const; virtual PostingSource * unserialise(const std::string &s) const; Finally, you need to make a remote server which knows about your PostingSource. Currently, the only way to do this is to modify the source slightly, and compile your own xapian-tcpsrv. To do this, you need to edit xapian-core/bin/xapian-tcpsrv.cc and find the register_user_weighting_schemes() function. If MyPostingSource is your posting source, at the end of this function, add these lines: Xapian::Registry registry; registry.register_postingsource(MyPostingSource()); server.set_registry(registry);
https://fossies.org/linux/xapian-core/docs/postingsource.rst
CC-MAIN-2020-05
refinedweb
1,704
50.26
Introduction to SOAP Web Services Interview Questions And Answers SOAP is an abbreviation of the Simple Object Access Protocol. XML protocol is used for Soap web services. SOAP is recommended by W3C for communication between two web applications. Soap is platform-independent as well as language-independent. Using SOAP one can interact with several types of programming languages and applications too. SOAP has its own security standard known as WS Security. SOAP uses XML format which is first parsed to be able to be read. It defines many standards that must be followed. Sometimes, soap is slow and consumes more resources and bandwidth. SOAP uses WSDL only and hence it doesn’t have other mechanisms to identify the service. SOAP can be used in multiple types of messaging systems. It can be delivered through a lot of transport protocols. An initial focus of SOAP is remote procedure calls which are transported using HTTP. CORBA, DCOM, and Java RMI are other frameworks that provide similar functionality to SOAP the one important difference being SOAP messages are written entirely in XML as stated above. Now, if you are looking for a job which is related to SOAP Web Services then you need to prepare for the 2021 SOAP Web Services Interview Questions. It is true that every interview is different as per the different job profiles. Here, we have prepared the important Interview Questions and Answers which will help you get success in your interview. In this 2021 SOAP Web Services Interview Questions article, we shall present 10 most important and frequently used SOAP Web Services interview questions. These interview questions are divided into two parts are as follows: Part 1 – SOAP Web Services Interview Questions (Basic) This first part covers basic Interview Questions and Answers. Q1. Explain how does SOAP work? Answer: SOAP provides a user interface that is accessed by the client object. The request that it sends goes to the server and is accessed using the server object. It contains other information like the interface name and methods. HTTP is used to send the XML to the server via POST method. After this method is analyzed and the result is sent to the client. The server creates more XML that consists of responses to those requests using HTTP. SMTP server or POP3 protocol can also be used by a client to send the XML. Q2. How can users make maximum benefits from the functionalities which are provided by SOAP? Answer: - For entering an address in the webpage or an address instance that can be done on the SOAP call use PutAddress(). - For allowing the insertion of a complete document of XML type into the web page, use PutListing(). - Forgetting a query name and also to get the result that best matches given query, use GetAddress(). Q3. Explain available approaches to develop SOAP-based web services? Answer: Two different methods are available to develop SOAP-based web services. - Contract-first approach: In this approach, the contract is first defined by XML and WSDL, while Java classes are derived from the contract at a later stage. - Contract-last approach: In this approach, Java classes are first defined. contract generation is done after that. Q4. Define elements of a SOAP message structure? Answer: This is the common SOAP Web Services Interview Questions asked in an interview. Elements of a SOAP message structure are as follows : - Envelope: It translates the XML document and defines the beginning and end of the message, it is the root element. - Header: It contains information about the message that is sent. It is optional. - Body: XML data that comprises the message is included in the body. - Fault: Errors that occur during message processing comes here. Q5. Mention some syntax rules for SOAP message? Answer: They are as Follows: - SOAP messages must use encoded XML. - It must use the Envelope namespace. - Encoding namespace is also mandatory. - It must not have a DTD reference. - XML processing instruction should not be there. Part 2 – SOAP Web Services Interview Questions (Advanced) Let us now have a look at the advanced Interview Questions and Answers. Q6. Explain some of the important characteristics of a SOAP envelope element? Answer: Important characteristics of a SOAP envelope element are as given below: - Envelope element is at the root of a SOAP message. - It is an obligatory section of the SOAP message. - An envelope includes only one header element. - Envelop version gets changed with SOAP version change. - prefix ENV is used for envelope version and also the envelope element. Q7. Explain the transport method in SOAP? Answer: - SOAP uses the application layer and transport layers; HTTP and SMTP are the valid protocol for the application layer. Out of the two, HTTP is more preferable. - HTTP GET method is used to send SOAP requests and specification contains details about HTTP POST methods. Q8. Mention some of the major functionalities that are provided by the SOAP protocol class? Answer: Simple access methods are provided by SOAP protocol class for all the applications available on the Internet. Some of the important functionalities are as below: - Call: This class provides the main functionality applicable to remote methods. A call is needed for that. Create the call() method and specify the encoding style of the registry if necessary. call () function, in this case, is used by the RPC call as well. This represents the options of the call object as explained. - Deployment Descriptor: This class is used to provide information regarding the SOAP services. It can enable easy deployment that too without any need for other approaches. - DOM2 Writer: This class is used to serializes and use DOM node as XML string. It is to provide greater functionalities. - RPC Message: This class can be used as a base class which calls and make replies to the request submitted to another or same server. Q9. When SOAP APIs are used? Answer: This is the most popular SOAP Web Services Interview Questions asked in an interview.SOAP APIs are used to create, update, retrieve and delete records. It can handle accounts, leads, and also user-defined objects. SOAP API is used to manage passwords and perform searches. SOAP API can be used in any language that has support for web services. Q10. Provide some of the advantages of SOAP? Answer: Advantages of SOAP are as follows : - SOAP web services are both platform and language agnostic. - SOAP can separate the encoding protocol and communications protocol from its runtime environment. - Web service can also retrieve and also receive SOAP user data from a remote server. Source’s platform here is completely independent of each other. - Using SOAP, anyone can generate XM. Perl scripts, C++, J2EE app servers all can do the same. - SOAP uses XML for sending and receiving messages. - SOAP can use standard internet protocol which is HTTP. - SOAP generally runs over HTTP. Hence firewall problems are eliminated. When HTTP is used as the binding protocol, an RPC call is made automatically to an HTTP request. This way the RPC response is assigned to an HTTP reply. - SOAP is very easy to use compared to RMI, CORBA, or DCOM. - SOAP can be considered as a protocol to move information in a distributed as well as decentralized environment. - SOAP is independent of the transport protocol which it means is that it can be used to coordinate different protocols. Recommended Articles This has been a guide to the list of SOAP Web Services Interview Questions and Answers so that the candidate can crackdown these Interview Questions easily. Here in this post, we have studied top SOAP Web Services Interview Questions which are often asked in interviews. You may also look at the following articles to learn more –
https://www.educba.com/soap-web-services-interview-questions/?source=leftnav
CC-MAIN-2022-33
refinedweb
1,280
58.18
bioscripts.convert 0.4 Biopython scripts for converting molecular sequences between formats. Introduction Biopython scripts for converting molecular sequences. Bioinformatics is bedevilled by a large number of file formats. Biopython provides classes and IO functions that allow interconversion. This module provides scripts that use Biopython internally to simply convert multiple files on the commandline. Installation bioscripts.convert [1] can be installed in a number of ways. Biopython [2] is a prerequisite. Via easy_install or equivalent From the commandline call: % easy_install bioscripts.convert Superuser privileges may be required. Via setup.py Download a source tarball, unpack it and call setup.py to install: % tar zxvf bioscripts.convert.tgz % cd bioscripts.convert % python setup.py install Superuser privileges may be required. Usage convbioseq.py [options] FORMAT INFILES ... or: convalign.py [options] FORMAT INFILES ... with the options: FORMAT must be one of clustal, fasta, genbank, nexus, phd, phylip, qual, stockholm, tab. The input formats inferred from extensions are clustal ('.aln'), genbank ('.genbank'), nexus ('.nxs'), nexus ('.nexus'), phylip ('.phylip'), stockholm ('.sth'), phd ('.phd'), qual ('.qual'), phylip ('.phy'), clustal ('.clustal'), genbank ('.gb'), tab ('.tab'), fasta ('.fasta'), stockholm ('.stockholm'). The default extensions for output formats are '.aln' (clustal), '.nexus' (nexus), '.phy' (phylip), '.phd' (phd), '.qual' (qual), '.gb' (genbank), '.sth' (stockholm), '.fasta' (fasta). For example: % convbioseq.py clustal one.fasta two.nxs three.stockholm will produce three clustal formatted files 'one.aln', 'two.aln' and 'three.aln' from files it assumes are Fasta, Nexus and Stockholm formatted respectively. % convbioseq.py -i phylip clustal one.fasta two.nxs will produce two Phylip formatted files 'one.phy' and 'two.phy' and from files it assumes are Fasta formatted. % convbioseq.py -e foo clustal one.fasta two.nxs will produce two Clustal formatted files 'one.foo' and 'two.foo' from files it assumes are Fasta and Nexus formatted respectively. Limitations This module is not intended for importing, but the setuptools packaging and infrastructure make for simple distribution of scripts, allowing the checking of prerequisites, consistent installation and updating. The bioscripts namespace was chosen as a convenient place to "keep" these scripts and is open to other developers. Due to limitations on identifiers in certain formats, sequence names may differ between input and output files. Also, not all formats understood by Biopython have been enabled, due to being untested or incomplete. Depending on your platform, the scripts may be installed as .py scripts, or some form of executable, or both. Some formats (e.g. FASTA) do not specify sequence type, while others (e.g. NEXUS), absolutely require it. Thus, the sequence type option may need to be explicitly specified. Older versions of Biopython contain a bug that will prevent conversion to nexus format for associated reasons. References Changelog 0.2 - 2009/4/14 - Initial release 0.3.1 - 2009/4/16 - First public release - Added alignment converter - Corrections to documentation - Author: Paul-Michael Agapow - Keywords: bioinformatics conversion - License: BSD - Categories - Package Index Owner: agapow - DOAP record: bioscripts.convert-0.4.xml
http://pypi.python.org/pypi/bioscripts.convert/0.4
crawl-003
refinedweb
490
53.17
Project hierarchy with subfolders hello! when I create new project, I don't have subfolders such as header, source and form folders for my project files. all my files are located at one folder (project folder). How can I change the organization of project files? this is part of my .pro file SOURCES += \ album.cpp \ pictures.cpp \ databasemanager.cpp \ albumdao.cpp HEADERS += \ album.h \ gallery-core_global.h \ pictures.h \ databasemanager.h \ albumdao.h and this is screen shot of the project hierarchy: thanks for help! :) - jsulm Moderators @YoniBE You can put your files in subdirectories and edit the pro file to reflect these changes: SOURCES += \ somedir/album.cpp \ somedir/pictures.cpp \ somedir/databasemanager.cpp \ somedir/albumdao.cpp HEADERS += \ someotherdir/album.h \ someotherdir/gallery-core_global.h \ someotherdir/pictures.h \ someotherdir/databasemanager.h \ someotherdir/albumdao.h if you include files from an other directory you'll have to adjust the include statement: #include "someotherdir/pictures.h" or add the directory to your Includepath in your *pro file INCLUDEPATH +=$$PWD/someotherdir @jsulm @J-Hilk Dosen't work.. I create new folder at the project folder named "sources", then I added to pro file SOURCES += \ sources/album.cpp \ sources/pictures.cpp \ sources/databasemanager.cpp \ sources/albumdao.cpp But I don't see any difference at the project hierarchy. I tried to create a new project and do the same but still I don't see any difference. I remember that once it was automatically... like in visual studio - jsulm Moderators @jsulm still, I don't see any differences. this is the output of the qmake 11:35:33: Running steps for project untitled... 11:35:33: Starting: "C:\Qt\5.11.1\msvc2017_64\bin\qmake.exe" "C:\Users\yonib\Documents\QT\Mastering QT\1\untitled\untitled.pro" -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" 11:35:33: The process "C:\Qt\5.11.1\msvc2017_64\bin\qmake.exe" exited normally. 11:35:33: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" qmake_all jom 1.1.2 - empower your cores 11:35:33: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited normally. 11:35:33: Elapsed time: 00:01. slove it. I changed the hierarchy view to file system view instead of project view and it worked. Thanks!!
https://forum.qt.io/topic/93252/project-hierarchy-with-subfolders
CC-MAIN-2018-51
refinedweb
375
53.07
Intro: Valentine's Sunflower With Valentine’s Day coming up, we started looking for project ideas with a romantic twist. While searching for ideasthis Valentine's Sunflower! Spread the love. Step 1: The Electronics If you’ve been following our tutorials, you should already know the drill: 1. Click on this magic link to circuito.io with the exact components you need for this project. 2. Make adjustments if needed. For example, if you want to use a battery instead of the wall adapter or if you have a different type of Arduino. We used a pro-mini for this project. If you want to use a different one, make sure that it fits in the flower. 3. Click Generate (the red button at the bottom of the builder). Step 2: Make Sure You Have All the Components Check that you have all the parts you need, including the peripherals - resistors, cables, jumper wires etc. The list will appear in the first step of the Step-by-Step guide. You can click on the different parts on the list (on the app) and you’ll be redirected to a website where you can purchase them if needed. Step 3: Wiring Scroll down a bit in the reply you got, and you’ll see a step-by-step guide that will navigate you through the wiring of your circuit. Step 4: Code In the code section on circuito.io, you'll see an example code that integrates all the components used in the project. 1. Download the code from circuito.io 2. Unzip\extract it to your computer 3. Upload it to your Arduino IDE (which you can download here) 4. Replace the firmware.ino code with the code at the end of this tutorial. 5. Copy the new code below and paste it into the firmware.ino tab. This code is specific for the Valentine's Sunflower project. #include "Global.h" int pos = 10; //Starting position /* This code sets up the essentials for your circuit to work. It runs first every time your circuit is powered with electricity. */ void setup() { // Setup Serial which is useful for debugging // Use the Serial Monitor to view printed messages Serial.begin(9600); Serial.println("start"); servo.attach(SERVO_PIN); servo.write(pos); } /* This code is the main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop. */ void loop() { // Get current light reading, substract the ambient value to detect light changes int ldrSample = ldr.readAverage(1000); Serial.print(ldrSample); Serial.print('\t'); pos = map(ldrSample,200,900,10,95); pos = constrain(pos, 10,95); Serial.println(pos); servo.write(pos); delay(1000*20); } Step 5: Making the Flower Step 6: Assembly - For the petals, the bar and the sepal we used a thin flexible steel wire. There are small drills built in to the design exactly for this. - The servo motor is connected with 2 small screws to the side of the base and with a nail to the sepal. - Place the Mini photocell in the dedicated drill in the base, underneath the servo pedestal. Step 7: That's It! Once everything is built and ready, you can start testing your flower and making tweaks and changes to the code if needed. Here's one of the tests we did to check the movement of the servo in reaction to light changes. Have a Sunny Valentine's Day :) Discussions
https://www.instructables.com/id/Valentines-Sunflower/
CC-MAIN-2018-39
refinedweb
579
75
The most simple IoC Container of Dart and Flutter If you looking for a package that is light-weight and provide production-ready of inversion of control, then this package is right for you. This package provides only 2 main api, easy to learn and use, but definitely fits most use case in your flutter project. If you are a server developer developing small or medium scale project, it's very likely you want to use this package. However, large scale project may need more powerful heavy-weight IoC library. You can use it in your angular project, but we highly recommend you use dependency injection system provided by angular. Keep it minimal, light-weight bind to a string: import 'package:ioc/ioc.dart'; main() { Ioc().bind('MyClass', (ioc) => new MyClass()); // later Ioc().use('MyClass'); // you will get an instance of MyClass // with generic if you want Ioc().use<MyClass>('MyClass'); } bind to self: import 'package:ioc/ioc.dart'; main() { Ioc().bind(MyClass, (ioc) => new MyClass()); // later Ioc().use(MyClass); // you will get an instance of MyClass } bind to other: import 'package:ioc/ioc.dart'; main() { Ioc().bind(MyClass, (ioc) => new OtherClass()); // later Ioc().use(MyClass); // you will get an instance of OtherClass } bind with other dependency import 'package:ioc/ioc.dart'; main() { Ioc().bind('MyClass', (Ioc ioc) { OtherClass other = ioc.use<OtherClass>('OtherClass'); return new MyClass(other); }); // later Ioc().use<MyClass>('MyClass'); // you will get an instance of OtherClass } using singleton: import 'package:ioc/ioc.dart'; class A { void someMethod() {} } main() { // use singleton on one Ioc().bind('A', (ioc) => new A(), singleton: true); Ioc().use<A>('A').someMethod(); // use singleton on all Ioc().config['singlton'] = true; Ioc().use<A>('A').someMethod(); } using lazy-loading singleton: import 'package:ioc/ioc.dart'; class A { void someMethod() {} } main() { // use lazy loaded singleton on one Ioc().bind('A', (ioc) => new A(), singleton: true, lazy: true); // class A will only be instantiated after first .use('A') Ioc().use<A>('A').someMethod(); // use lazy loaded singleton on all Ioc().config['lazy'] = true; Ioc().use<A>('A').someMethod(); } example/ioc_example.dart import 'package:ioc/ioc.dart'; class A { void someMethod() { } } class B {} main() { Ioc().bind('A', (ioc) => new A()); Ioc().use<A>('A').someMethod(); } Add this to your package's pubspec.yaml file: dependencies: ioc: ^0:ioc/ioc.dart'; We analyzed this package on Jun 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using: Detected platforms: Flutter, web, other No platform restriction found in primary library package:ioc/ioc.dart. Fix lib/ioc.dart. (-0.50 points) Analysis of lib/ioc.dart reported 1 hint: line 3 col 1: Prefer using /// for doc comments. The description is too long. (-10 points) Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.
https://pub.dev/packages/ioc
CC-MAIN-2019-26
refinedweb
484
53.68
painter2 1.0.1 A fork of the original painter plugin that adds some missing functionality. painter2 # A simple flutter widget to paint with your fingers. Features # The widget supports: - Changing fore- and background color - Setting an image as background - Changing the thickness of lines you draw - Exporting your painting as png - Undo/Redo drawing a line - Clear the whole drawing Installation # In your pubspec.yaml file within your Flutter Project: dependencies: painter2: any Then import it: import 'package:painter2/painter2.dart'; Use it # In order to use this plugin, first create a controller:. Then, to display the painting area, create an inline Painter object and give it a reference to your previously created controller: Painter(controller) By exporting the painting as PNG, you will get an Uint8List object which represents the bytes of the png final file: await controller.exportAsPNGBytes(); The library does not handle saving the final image anywhere. Example # For a full example take a look at the example project. Here is a short recording showing it. Note that the color picker is an external dependency which is only required for the example.
https://pub.dev/packages/painter2
CC-MAIN-2020-45
refinedweb
186
53.51
Warning: This post is several years old and the author has marked it as poor quality (compared to more recent posts). It has been left intact for historical reasons, but but its content (and code) may be inaccurate or poorly written. So I’m working on building a crystal oven to keep my QRSS MEPT (radio transmitter) at an extremely stable frequency. Even inside a thick Styrofoam box, slight changes in my apartment temperature caused by the AC turning on and off is enough to change the crystal temperature of the transmitter, slightly modifying its oscillation frequency. For a device that vibrates exactly 10,140,070 times a second, even 3 to many or too few vibrations per second is too much. Keeping in the spirit of hacking things together with a minimum of parts, this is what I came up with! It uses a thermistor, potentiometer, and comparator of a microcontroller (ATTiny44a) to tightly sense and regulate temperature. The heater element is a junk MOSFET I found in an old battery backup system. I simply have pass a ton of current (turned on/off by the gate) to generate heat, transferred into a piece of steel for smooth regulation. One of the unexpected advantages is that the light flickers rapidly near equilibrium, which is great because it has the ability to turn the heater on a little or a lot based upon the averaging effect of the flicker. Here is the code I wrote on the microcontroller to handle the comparator. It couldn’t be simpler! #include <avr/io.h> #include <util/delay.h> int main(void) { DDRA=0; // all inputs DDRB=255; // all outputs while (1){ if (ACSR & _BV(ACO)) { /* AIN0 is more positive than AIN1 right now */ PORTB|=(1<<PB0); PORTB&=~(1<<PB1); } else { /* AIN0 is more negative than AIN1 */ PORTB|=(1<<PB1); PORTB&=~(1<<PB0); } } }
https://swharden.com/wp/category/programming/cc/page/4/
CC-MAIN-2020-45
refinedweb
309
59.03
Another interesting question came in by email, this week. Fredrik Skeppstedt, a long-time user of the TXTEXP Express Tool, wanted to perform a similar operation using C#: to explode text objects – as TXTEXP does – but then be able to manipulate the resulting geometry from .NET. TXTEXP is an interesting command: in order to explode text objects, it actually exports them to a Windows Metafile (.WMF) using the WMFOUT command, and then reimports the file back in using WMFIN. This, in itself, is trickier than it sounds, as WMFOUT creates the graphics in the file relative to the top left of the drawing area, and it takes some work to generate the WCS location to pass into the WMFIN command for the geometry to be in the same location. So why does TXTEXP use a format such as WMF to do this? Well, to reduce text into its base geometry, AutoCAD needs to us its plotting pipeline to generate the primitives with a high degree of fidelity. Generating the graphics isn’t enough, as text is generally displayed directly (yes, I’m simplifying this somewhat, but anyway) rather than being decomposed into underlying vectors. WMF is as good a way as any to do this – at least it was back in the late 1990s when this was implemented, and frankly I’m not aware of a better way to capture the data, today (please to post a comment if I’m missing something obvious, of course). Even the approach shown earlier in the week won’t work, as it just gets “text” callbacks for each of the objects. I went down a few warm-looking rabbit-holes while researching a solution to this problem: I looked into manually reading the graphics primitives from a WMF file using .NET – which would take a lot of work and GDI/GDI+ knowledge, apparently – as well as scripting the WMFOUT and WMFIN commands. I ended up realizing that the TXTEXP command does some very useful heavy lifting of its own, and if we’re calling commands to do the work then we may as well call this one. Which reduced the problem to being able to call the TXTEXP command (which happens to be defined using LISP) and then capture the results in order to work with them. I’m generally not a fan of calling commands, but avoiding doing so – especially with complex commands doing a lot of legwork – can often lead to you reinventing the wheel. There are still things to watch out for – such as fiber-based re-entrancy issues – but these are gradually going away (in the coming weeks we’ll talk more about the pros and cons of calling commands vs. using “low-level” APIs). As the TXTEXP command erases the source text objects, I decided to add a feature to copy the objects prior to calling the command, which leaves the originals unerased. I had previously tried just unerasing the originals, but TXTEXP does some really funky things to the text objects it explodes – such as mirroring them a few times and setting the direction to be backwards – so I found the copying approach to be both simpler and less dependent on the internal workings of TXTEXP. That’s enough of the preliminaries… here’s the C# command defining our EXPVECS command: using System.Linq; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; //using System.Reflection; namespace GetTextVectors { public class Commands { private ObjectIdCollection _entIds; [CommandMethod("EXPVECS")] public void ExplodeToVectors() { var doc = Application.DocumentManager.MdiActiveDocument; var db = doc.Database; var ed = doc.Editor; _entIds = new ObjectIdCollection(); var pso = new PromptSelectionOptions(); pso.MessageForAdding = "Select text objects to explode"; var psr = ed.GetSelection(pso); if (psr.Status != PromptStatus.OK) return; // Pass the objects to explode via the pickfirst selection // set and save them to be unerased in the next command var origIds = psr.Value.GetObjectIds(); var msId = SymbolUtilityServices.GetBlockModelSpaceId(db); // We're going to copy the original text entities and then // pass the copies into TXTEXP, which will then go and erase // them, leaving the originals intact // If you want the originals erased, just pass origIds into // the call to SetImpliedSelection() and delete the lines // of code prior to it var map = new IdMapping(); db.DeepCloneObjects( new ObjectIdCollection(origIds), msId, map, false ); // Use a handy LINQ "map" to extract the ObjectId of the copy // for each of the input IDs var copiedIds = (from id in origIds select map[id].Value).ToArray<ObjectId>(); ed.SetImpliedSelection(copiedIds); // We'll use COM's SendCommand, but using InvokeMember() // on the type rather than using the TypeLib var odoc = doc.GetAcadDocument(); var docType = odoc.GetType(); // Check for objects added to the database db.ObjectAppended += new ObjectEventHandler(ObjectAppended); // Call SendCommand passing in both the Express Tools' // TXTEXP command and then the custom TXTFIX command // to fix the results //var args = new object[] { "TXTEXP\nTXTFIX\n" }; //docType.InvokeMember( // "SendCommand", BindingFlags.InvokeMethod, null, odoc, args //); // Actually, no. I've switched back to SendStringToExecute, // as in any case the mode we're using is asynchronous doc.SendStringToExecute( "TXTEXP\nTXTFIX\n", false, false, false ); } [CommandMethod("TXTFIX", CommandFlags.NoHistory)] public void FixText() { var doc = Application.DocumentManager.MdiActiveDocument; var db = doc.Database; var ed = doc.Editor; // Remove the event handler db.ObjectAppended -= new ObjectEventHandler(ObjectAppended); if (_entIds.Count == 0) { ed.WriteMessage( "\nCould not find any entities created by TXTEXP." ); return; } // To show we can, let's change the colour of each of // the entities generated by TXTEXP to red using (var tr = doc.TransactionManager.StartTransaction()) { foreach (ObjectId id in _entIds) { // TXTEXP erases quite a few temporary objects, so be // sure to check their erased status first if (!id.IsErased) { var ent = (Entity)tr.GetObject(id, OpenMode.ForWrite); ent.ColorIndex = 1; } } tr.Commit(); } } void ObjectAppended(object sender, ObjectEventArgs e) { if (e.DBObject is Entity) { _entIds.Add(e.DBObject.ObjectId); } } } } We use a “database reactor” (or the .NET equivalent, an event handler off the Database object) to capture the objects that get created while the command executes. We also use COM’s SendCommand() to launch the TXTEXP command (and then the TXTFIX one – more on that in a tick) but we don’t use the COM TypeLib to do so: we use a technique that Viru Aithal showed me when he wrote the sample that evolved into ScriptPro 2.0, calling InvokeMember() to essentially use reflection to bind to the method dynamically. We use a separate command called TXTFIX to manipulate the results because SendCommand() – while synchronous – doesn’t execute quite soon enough for our database reactor to pick them up. This two-command technique is interesting for current versions of AutoCAD but shouldn’t be necessary once fibers finally go the way of the dodo. Here’s a quick view on some AutoCAD text before calling the EXPVECS command… … and then after calling it: TXTFIX adjusts the resultant geometry to be red, but it could do all sorts of other things instead, of course (that was just a “for instance”). And you could also apply this general mechanism to all kinds of other problems where you have commands generating database-resident data but that provide no direct .NET API to use. Update: After a quick discussion over the weekend with Tony Tanzillo, via this post’s comments, I realised I’d been using SendCommand() when I’d otherwise not have: I’d previously been using it to call WMFOUT and WMFIN synchronously but when I’d come to the conclusion that was not going to work – and had introduced the TXTFIX command – I’d forgotten to switch across to use SendStringToExecute() when I went with a more asynchronous approach. I’ve updated the above code, commenting out the (still very interesting when appropriate) technique of calling SendCommand() via InvokeMember(). Recent Comments Archives More...
http://through-the-interface.typepad.com/through_the_interface/linq/
CC-MAIN-2014-41
refinedweb
1,297
53.71
If you think that TensorFlow and PyTorch are the only ways to Neural Networks with Python then I would tell you that you are wrong. As there is another package to build Neural Networks with Scikit-Learn and Python. In this article, I will take you through the easiest way to build Neural Networks with Scikit-Learn. Before I introduce you to how we can build a Neural Network using Scikit-Learn, let’s start this from scratch for all the beginners in Machine Learning who are reading this article. Also, Read – Binary Search Algorithm with Python. What are Neural Networks? Networks that mimic the functioning of the human brain; computer programs that actually learn patterns; forecasts without having to know the statistics are neural networks. Building a Neural Network takes a lot of time as compared to training a classification or prediction model. Tensorflow and PyTorch are the two common methods for building Neural Networks, and it would not be wrong if I say that using TensorFlow or PyTorch to build a Neural Network are the best methods. Because a neural network needs to be explicitly trained to make predictions as it does not relies on statistics to make predictions. TensorFlow and PyTorch do not lack anywhere to build a neural network, so why I am introducing you to another way to build neural networks using scikit-learn. The answer is that not every beginner is capable of using the workflow of TensorFlow and PyTorch. As both of these methods require deep knowledge of every concept of Deep Learning. Neural Networks with Scikit-Learn When it comes to classification models, I have always preferred to use Scikit-Learn, and I hope other machine learning experts prefer it too. But for the tasks of Deep Learning Scikit-Learn needs more introduction to be used globally. For the implementation of neural networks with Scikit-Learn, scikit-neuralnetwork package is used. So here we will learn how we can use this package to build Neural Networks. To build neural networks using Scikit-Learn you need to install scikit-neuralnetwork package, which can be easily installed by using the pip command – pip install scikit-neuralnetwork. Now, if you have installed this package successfully, let’s get started to build neural networks with scikit-learn. Building Neural Networks with Scikit-Learn scikit-neuralnetwork offers an easy way to create a custom neural network. Scikit-learn users will feel right at home with a familiar API: Code language: JavaScript (javascript)Code language: JavaScript (javascript) from sknn.mlp import Classifier, Layer nn = Classifier( layers=[ Layer("Maxout", units=100, pieces=2), Layer("Softmax")], learning_rate=0.001, n_iter=25) nn.fit(X_train, y_train) X_train and y_train are NumPy arrays, so you can simply replace your scikit-learn model with a Neural Net of sknn. It even supports sparse data sets. Also, Read – One Hot Encoding in Machine Learning. I hope you liked this article on implementing a neural network with scikit-learn. Feel free to ask your valuable questions in the comments section below. You can also follow me on Medium to learn every topic of Machine Learning.
https://thecleverprogrammer.com/2020/08/28/neural-networks-with-scikit-learn-and-python/
CC-MAIN-2021-04
refinedweb
520
54.32
Source Akhet / docs / architecture.rst Pyramid Architecture The Zzz application you created has several aspects similar to Pylons: INI files, a startup function, views (called Controllers in Pylons), templates, and models. However, the filenames are different and the API syntax is different. Pyramid is more flexible than Pylons, so you can create a minimal application in a single Python module, and run it in the same module without an INI file or "pserve". However, we'll stick to the 'alchemy' scaffold which creates a directory structure scalable to large applications. Directory layout The default application contains the following files after you install it: Zzz ├── CHANGES.txt ├── MANIFEST.in ├── README.txt ├── development.ini ├── production.ini ├── setup.cfg ├── setup.py ├── zzz │ ├── __init__.py │ ├── models.py │ ├── scripts │ │ ├── __init__.py │ │ └── populate.png │ │ ├── pyramid-small.png │ │ └── transparent.gif │ ├── templates │ │ └── mytemplate.pt │ ├── tests.py │ └── views.py └── Zzz.egg-info ├── dependency_links.txt ├── entry_points.txt ├── not-zip-safe ├── PKG-INFO ├── requires.txt ├── SOURCES.txt └── top_level.txt development.ini development.ini has the same structure as Pylons, and it's actually simpler than earlier versions of Pyramid. The application and server sections look like this: [app:main] use = egg:Zzz pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false pyramid.debug_templates = true pyramid.default_locale_name = en pyramid.includes = pyramid_debugtoolbar pyramid_tm sqlalchemy.url = sqlite:///%(here)s/Zzz.db [server:main] use = egg:pyramid#wsgiref host = 0.0.0.0 port = 6543 The logging sections will be covered in the logging chapter. Differences between development.ini and production.ini will be covered in the deployment chapter. When you run "pserve development.ini", it does the following: - Activate logging based on the logging sections. - Read the "[app:main]" section and instantiate the specified application. - Read the "[server:main]" section and instantiate the specified server. - Launch the server with the application, and let it process requests forever. In the app section, the "use = egg:Zzz" tells which Python distribution to load, in this case our "Zzz" application. The "pyramid.*" options are mostly debugging variables. Set any of them to "true" to enable various kinds of debug logging. "pyramid.default_locale_name" sets the predominent region/language for the application. "pyramid.reload_templates" tells whether to recheck the timestamp of template source files whenever it renders a template, in case the file has been updated since startup. (Mako and Chameleon respect this value, but not all template engines understand it.) "pyramid_includes" specifies optional "tweens" to wrap around the application. Tweens are like WSGI middleware but are specific to Pyramid. In other words, they're generic services that can be wrapped around a variety of applications. "pyramid_debugtoolbar" is the debug toolbar at the right margin of browser screens, and shows an interactive traceback screen if an exception occurs. "pyramid_tm" is the transaction manager, which is covered in a later chapter. (To see the interactive traceback in action, skip the "populate_Zzz" step or delete the "Zzz.db" file, and run pserve. It will error out because a database table doesn't exist. If it doesn't give an error, add a raise RuntimeError line in the my_view function in zzz/views.py.) "sqlalchemy.url" tells which database the application should use. "%(here)s" expands to the path of the directory containing the INI file. The "[server:main]" section is the same as in Pylons. It tells which WSGI server to run. Pyramid 1.3 defaults to the wsgiref HTTP server in the Python standard library. It's single-threaded so it can only handle one request at a time, but that's good enough for development or debugging. Pyramid no longer uses WSGI middleware by default. If you want to add your own middleware, see the PasteDeploy manual for the syntax. But first consider whether making a Pyramid tween would be more convenient. Init module and main function A Pyramid application revolves around a top-level main() function in the application package. "pserve" does the equivalent of this: # Instantiate your WSGI application import zzz app = zzz.main(**settings) The Pylons equivalent to main() is make_app() in middleware.py. The main() function replaces Pylons' middleware.py, config.py, and routing.py but is much shorter: (Doc limitation: XXsettings in line 6 is actually **settings. We had to alter it in the docs to prevent Vim's syntax highlighting from going bezerk.) This main function is short and sweet. Later we'll discuss lots of things you can add here to add features. "pserve" parses the "[app:main]" options into a dict called "settings". It calls the main() function with the settings as keyword args. (The global_config arg is not used much; it's covered later.) Lines 9-10 instantiate a database engine based on the "sqlalchemy." settings in the INI file. DBSession is a global object used to access SQLAlchemy's object-relational mapper (ORM). Line 11 instantiates a Configurator which will instantiate the application. (It's not the application itself.) Line 12 tells the configurator to serve the static directory (zzz/static) under URL "/static". The arguments are more than they appear, as we'll see in the customization section. Line 13 creates a route for the home page. This is more or less like a Pylons route, except it doesn't specify a controller and action. Line 14 scans the application's Python modules looking for views to register. This imports all the modules under zzz. Line 15 instantiates a Pyramid WSGI application based on the configuration, and returns it. Models This is where you define your domain model; i.e., what makes this application different from other Pyramid applications. A good application structure separates domain logic (not Pyramid-specific or UI-related) from view logic (Pyramid-specific or UI-related). This makes it easy to use the domain code outside of the web application (in standalone utilities) or to port it to another framework (if you ever decide to do so). Note: the term "model" is used in two different ways. Collectively it means all your ORM classes and domain logic together. (One model per application.) Individually it means a single ORM class. (Several models in one application.) Either way is fine, but beware that the word "model" (singular) can mean one or the other. This led to a controversy in both Pylons and Pyramid on whether to put "model" or "models" in the scaffolds. Pylons chose "model"; Pyramid chose "models". But it doesn't matter, and you can rename models.py to model.py if you wish. Just be aware that the word "model" can mean either one class or all classes together. At minimum you should define your database tables and ORM classes here. Some people also put other business logic here, either as methods in the ORM classes or as functions. Other people put miscellaneous domain logic into a 'lib' package (zzz/lib). Others put the entire models and domain logic in a separate Python distribution, which they import into the Pyramid application. Others put domain logic directly into the views, but this is not recommended unless it's a small amount of code because it mixes framework-independent and framework-dependent code. The default zzz/models.py looks like this: MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text, unique=True) value = Column(Integer) def __init__(self, name, value): self.name = name self.value = value import logging import sqlahelper import sqlalchemy as sa import sqlalchemy.orm as orm import transaction log = logging.getLogger(__name__) Base = sqlahelper.get_base() Session = sqlahelper.get_session() #class MyModel(Base): # __tablename__ = "models" # # id = sa.Column(sa.Integer, primary_key=True) # name = sa.Column(sa.Unicode(255), nullable=False) This represents one way to organize a SQLAlchemy model. Pylons applications have a "zzz.model.meta" model to hold SQLAlchemy's housekeeping objects, but Akhet uses the SQLAHelper library which holds them instead. This gives you more freedom to structure your models as you wish, while still avoiding circular imports (which would happen if you defined Session in the main module and then import the other modules into it; the other modules would import the main module to get the Session, and voilà circular imports). A real application would replace the commented MyModel class with one or more ORM classes. The example uses SQLAlchemy's "declarative" syntax, although of course you don't have to. SQLAHelper The SQLAHelper library is a holding place for the application's contextual session (normally assigned to a Session variable with a capital S, to distinguish it from a regular SQLAlchemy session), all engines used by the application, and an optional declarative base. We initialized it via the sqlahelper.add_engine line in the main function. Because we did not specify an engine name, the library set the engine name to "default", and also bound the contextual session and the base's metadata to it. There's not much else to know about SQLAHelper. You can call get_session() at any time to get the contextual session. You can call get_engine() or get_engine(name) to retrieve an engine that was previously added. You can call get_base() to get the declarative base. If you need to modify the session-creation parameters, you can call get_session().config(...). But if you modify the session extensions, see the "Transaction Manager" chapter to avoid losing the extension that powers the transaction manager. View handlers The default zzz.handlers package contains a main module which looks like this: import logging from pyramid_handlers import action import zzz.handlers.base as base import zzz.models as model log = logging.getLogger(__name__) class Main(base.Handler): @action(renderer="index.html") def index(self): log.debug("testing logging; entered Main.index()") return {"project":"Zzz"} This is clearly different from Pylons, and the @action decorator looks a bit like TurboGears. The decorator has three optional arguments: name The action name, which is the target of the route. Normally this is the same as the view method name but you can override it, and you must override it when stacking multiple actions on the same view method. renderer A renderer name or template filename (whose extension indicates the renderer). A renderer converts the view's return value into a Response object. Template renderers expect the view to return a dict; other renderers may allow other types. Two non-template renderers are built into Pyramid: "json" serializes the return value to JSON, and "string" calls str() on the return value unless it's already a Unicode object. If you don't specify a renderer, the view must return a Response object (or any object having three particular attributes described in Pyramid's Response documentation). In all cases the view can return a Response object to bypass the renderer. HTTP errors such as HTTPNotFound also bypass the renderer. permission A string permission name. This is discussed in the Authorization section below. The Pyramid developers decided to go with the return-a-dict approach because it helps in two use cases: 1. Unit testing, where you want to test the data calculated rather than parsing the HTML output. This works by default because @action itself does not modify the return value or arguments; it merely sets function attributes or interacts with the configurator. 2. Situations where several URLs render the same data using different templates or different renderers (like "json"). In that case, you can put multiple @action decorators on the same method, each with a different name and renderer argument. Two functions in pyramid.renderers are occasionally useful in views: The handler class inherits from a base class defined in zzz.handlers.base: """Base classes for view handlers. """ class Handler(object): def __init__(self, request): self.request = request #c = self.request.tmpl_context #c.something_for_site_template = "Some value." Pyramid does not require a base class but Akhet defines one for convenience. All handlers should set self.request in their .__init__ method, and the base handler does this. It also provides a place to put common methods used by several handler classes, or to set tmpl_context (c) variables which are used by your site template (common to all views or several views). (You can use c in view methods the same way as in Pylons, although this is not recommended.) Note that non-template renders such as "json" ignore c variables, so it's really only useful for HTML-only data like which stylesheet to use. The routes are defined in zzz/handlers/__init__.py: """View handlers package. """ def includeme(config): """Add the application's view handlers. """ config.add_handler("home", "/", "zzz.handlers.main:Main", action="index") config.add_handler("main", "/{action}", "zzz.handlers.main:Main", path_info=r"/(?!favicon\.ico|robots\.txt|w3c)") includeme is a configurator "include" function, which we've already seen. This function calls config.add_handler twice to create two routes. The first route connects URL "/" to the index view in the Main handler. The second route connects all other one-segment URLs (such as "/hello" or "/help") to a same-name method in the Main handler. "{action}" is a path variable which will be set the corresponding substring in the URL. Pyramid will look for a method in the handler with the same action name, which can either be the method's own name or another name specified in the 'name' argument to @action. Of course, these other methods ("hello" and "help") don't exist in the example, so Pyramid will return 400 Not Found status. The 'path_info' argument is a regex which excludes certain URLs from matching ("/favicon.ico", "/robots.txt", "/w3c"). These are static files or directories that would syntactically match "/{action}", but we want these to go to a later route instead (the static route). So we set a 'path_info' regex that doesn't match them. Redirecting and HTTP errors To issue a redirect inside a view, return an HTTPFound: from pyramid.httpexceptions import HTTPFound def myview(self): return HTTPFound(location=request.route_url("foo")) # Or to redirect to an external site return HTTPFound(location="") You can return other HTTP errors the same way: HTTPNotFound, HTTPGone, HTTPForbidden, HTTPUnauthorized, HTTPInternalServerError, etc. These are all subclasses of both Response and Exception. Although you can raise them, Pyramid prefers that you return them instead. If you intend to raise them, you have to define an exception view that receives the exception argument and returns it, as shown in the Views chapter in the Pyramid manual. (On Python 2.4, you also have to call the instance's .exception() method and raise that, because you can't raise instances of new-style classes in 2.4.) A future version of Pyramid may have an exception view built-in; this would conflict with your exception view so you'd need to delete it, but there's no need to worry about that until/if it actually happens. Pyramid catches two non-HTTP exceptions by default, pyramid.exceptions.NotFound and pyramid.exceptions.Forbidden, which it sends to the Not Found View and the Forbidden View respectively. You can override these views to display custom HTML pages. More on routing and traversal Routing methods and view decorators Pyramid has several routing methods and view decorators. The ones we've seen, from the pyramid_handlers package, are: config.add_handler calls two lower-level methods which you can also call directly: Two others you should know about: Route arguments and predicates config.add_handler accepts a large number of keyword arguments. We'll list the ones most commonly used with Pylons-like applications here. For full documentation see the add_route API. Most of these arguments can also be used with config.add_route. The arguments are divided into predicate arguments and non-predicate arguments. Predicate arguments determine whether the route matches the current request: all predicates must pass in order for the route to be chosen. Non-predicate arguments do not affect whether the route matches. name [Non-predicate] The first positional arg; required. This must be a unique name for the route, and is used in views and templates to generate the URL. right side of the URL, and should be avoided otherwise. factory [Non-predicate] A callable (or asset spec). In URL dispatch, this returns a root resource which is also used as the context. If you don't specify this, a default root will be used. In traversal, the root contains one or more resources, and one of them will be chosen as the context. xhr [Predicate] True if the request must have an "X-Reqested-With" header. Some Javascript libraries (JQuery, Prototype, etc) set this header in AJAX requests. request_method [Predicate] An HTTP method: "GET", "POST", "HEAD", "DELETE", "PUT". Only requests of this type will match the route. path_info [Predicate] A regex compared to the URL path (the part of the URL after the application prefix but before the query string). The URL must match this regex in order for the route to match the request. request_param [Predicate] If the value doesn't contain "=" (e.g., "q"), the request must have the specified parameter (a GET or POST variable). If it does contain "=" (e.g., "name=value"), the parameter must. header [Predicate] If the value doesn't contain ":"; it specifies an HTTP header which must be present in the request (e.g., "If-Modified-Since"). If it does contain ":", the right side is a regex which the header value must match; e.g., "User-Agent:Mozilla/.*". The header name is case insensitive. accept [Predicate] A MIME type such as "text/plain", or a wildcard MIME type with a star on the right side ("text/*") or two stars ("*/*"). The request must have an "Accept:" header containing a matching MIME type. custom_predicates [Predicate] A sequence of callables which will be called in order to determine whether the route matches the request. The callables should return True or False. If any callable returns False, the route will not match the request. The callables are called with two arguments, info and request. request is the current request. info is a dict which contains the following:info["match"] => the match dict for the current route info["route"].name => the name of the current route info["route"].pattern => the URL pattern of the current route Use custom predicates argument when none of the other predicate args fit your situation. See <>` in the Pyramid manual for examples. to prevent the route from matching the request; this will ultimately case HTTPNotFound if no other route or traversal matches the URL. The difference between doing this and returning HTTPNotFound in the view is that in the latter case the following routes and traversal will never be consulted. That may or may not be an advantage depending on your application. View arguments The 'name', 'renderer' and 'permission' arguments described for @action can also be used with @view_config and config.add_view. config.add_route has counterparts to some of these such as 'view_permission'. config.add_view also accepts a 'view' arg which is a view callable or asset spec. This arg is not useful for the decorators which already know the view. The 'wrapper' arg can specify another view, which will be called when this view returns. (XXX Is this compatible with view handlers?) The request object The Request object contains all information about the current request state and application state. It's available as self.request in handler views, the request arg in view functions, and the request variable in templates. In pshell or unit tests you can get it via pyramid.threadlocal.get_current_request(). (You shouldn't use the threadlocal back door in most other cases. If something you call from the view requires it, pass it as an argument.) Pyramid's Request object is a subclass of WebOb Request just like 'pylons.request' is, so it contains all the same attributes in methods like params, GET, POST, headers, method, charset, date, environ, body, and body_file. The most commonly-used attribute is request, shadowing the functions in pyramid.url. (One function, current_route_url, is available only as a function.) Rather than repeating the existing documentation for these attributes and methods, we'll just refer you to the original docs: - Pyramd Request, Response, HTTP Exceptions, and MultiDict - Pyramid Request API - WebOb Request API - Pyramid Response API - WebOb Response API MultiDict is not well documented so we've written our own MultiDict API page. In short, it's a dict-like object that can have multiple values for each key. request.params, request.GET, and request.POST are MultiDicts. Pyramid has no pre-existing Response object when your view starts executing. To change the response status type or headers, you can either instantiate your own pyramid.response.Response object and return it, or use these special Request attributes defined by Pyramid: request.response_status = "200 OK" request.response_content_type = "text/html" request.response_charset = "utf-8" request.response_headerlist = [ ('Set-Cookie', 'abc=123'), ('X-My-Header', 'foo')] request.response_cache_for = 3600 # Seconds Akhet adds one Request attribute. request.url_generator, which is used to implement the url template global described below. Templates Pyramid has built-in support for Mako and Chameleon templates. Chameleon runs only on CPython and Google App Engine, not on Jython or other platforms. Jinja2 support is available via the pyramid_jinja2 package on PyPI, and a Genshi emulator using Chameleon is in the pyramid_chameleon_genshi package. Whenever a renderer invokes a template, the template namespace includes all the variables in the view's return dict, plus the following: The subscriber in your application adds the following additional variables: Advanced template usage If you need to fill a template within view code or elsewhere, do this: from pyramid.renderers import render variables = {"foo": "bar"} html = render("mytemplate.mako", variables, request=request) There's also a render_to_response function which invokes the template and returns a Response, but usually it's easier to let @action or @view_config do this. However, if your view has an if-stanza that needs to override the template specified in the decorator, render_to_response is the way to do it. @action(renderer="index.html") def index(self): records = models.MyModel.all() if not records: return render_to_response("no_records.html") return {"records": records} For further information on templating see the Templates section in the Pyramid manual, the Mako manual, and the Chameleon manual. You can customize Mako's TemplateLookup by setting "mako.*" variables in the INI file. Site template Most applications using Mako will define a site template something like this: <!DOCTYPE html> <html> <head> <title>${self.title()}</title> <link rel="stylesheet" href="${application_url}/default.css" type="text/css" /> </head> <body> <!-- *** BEGIN page content *** --> ${self.body()} <!-- *** END page content *** --> </body> </html> <%def Then the page templates can inherit it like so: <%inherit <%defMy Title</def> ... rest of page content goes here ... Static files Pyramid has five ways to serve static files. Each way has different advantages and limitations, and requires a different way to generate static URLs. config.add_static_route This is the Akhet default, and is closest to Pylons. It serves the static directory as an overlay on "/", so that URL "/robots.txt" serves "zzz/static/robots.txt", and URL "/images/logo.png" serves "zzz/static/images/logo.png". If the file does not exist, the route will not match the URL and Pyramid will try the next route or traversal. You cannot use any of the URL generation methods with this; instead you can put a literal URL like "${application_url}/images/logo.png" in your template. Usage:config.include('akhet') config.add_static_route('zzz', 'static', cache_max_age=3600) # Arg 1 is the Python package containing the static files. # Arg 2 is the subdirectory in the package containing the files. config.add_static_view This is Pyramid's default algorithm. It mounts a static directory under a URL prefix such as "/static". It is not an overlay; it takes over the URL prefix completely. So URL "/static/images/logo.png" serves file "zzz/static/images/logo.png". You cannot serve top-level static files like "/robots.txt" and "/favicon.ico" using this method; you'll have to serve them another way. Usage:config.add_static_view("static", "zzz:static") # Arg 1 is the view name which is also the URL prefix. # It can also be the URL of an external static webserver. # Arg 2 is an asset spec referring to the static directory/ To generate "/static/images/logo.png" in a Mako template, which will serve "zzz/static/images/logo.png":href="${request.static_url('zzz:static/images/logo.png')} One advantage of add_static_view is that you can copy the static directory to an external static webserver in production, and static_url will automatically generate the external URL:# In INI file static_assets = "static" # -OR- static_assets = ""config.add_static_view(settings["static_assets"], "zzz:static")href="${request.static_url('zzz:static/images/logo.png')}" ## Generates URL "" Other ways There are three other ways to serve static files. One is to write a custom view callable to serve the file; an example is in the Static Assets section of the Pyramid manual. Another is to use paste.fileapp.FileApp or paste.fileapp.DirectoryApp in a view. (More recent versions are in the "PasteOb" distribution.) These three ways can be used with request.route_url() because the route is an ordinary route. The advantage of these three ways is that they can serve a static file or directory from a normal view callable, and the view can be protected separately using the usual authorization mechanism. Session, flash messages, and secure forms Pyramid's session object is request.session. It has its own interface but uses Beaker on the back end, and is configured in the INI file the same way as Pylons' session. It's a dict-like object and can store any pickleable value. It's pulled from persistent storage only if it's accessed during the request processing, and it's (re)saved only if the data changes. Unlike Pylons' sesions, you don't have to call session.save() after adding or replacing keys because Pyramid does that for you. But you do have to call session.changed() if you modify a mutable value in place (e.g., a session value that's a list or dict) because Pyramid can't tell that child objects have been modified. You can call session.invalidate() to discard the session data at the end of the request. session.created is an integer timestamp in Unix ticks telling when the session was created, and session.new is true if it was created during this request (as opposed to being loaded from persistent storage). Pyramid sessions have two extra features: flash messages and a secure form token. These replace webhelpers.pylonslib.flash and webhelpers.pylonslib.secure_form, which are incompatible with Pyramid. Flash messages are a session-based queue. You can push a message to be displayed on the next request, such as before redirecting. This is often used after form submissions, to push a success or failure message before redirecting to the record's main screen. (This is different from form validation, which normally redisplays the form with error messages if the data is rejected.) To push a message, call request.session.flash("My message.") The message is normally text but it can be any object. Your site template will then have to call request.session.pop_flash() to retrieve the list of messages, and display then as it wishes, perhaps in <div>'s or a <ul>. The queue is automatically cleared when the messages are popped, to ensure they are displayed only once. The full signature for the flash method is: session.flash(message, queue='', allow_duplicate=True) You can have as many message queues as you wish, each with a different string name. You can use this to display warnings differently from errors, or to show different kinds of messages at different places on the page. If allow_duplicate is false, the message will not be inserted if an identical message already exists in that queue. The session.pop_flash method also takes a queue argument to specify a queue. You can also use session.peek_flash to look at the messages without deleting them from the queue. The secure form token prevents cross-site request forgery (CSRF) attacts. Call session.get_csrf_token() to get the session's token, which is a random string. (The first time it's called, it will create a new random token and store it in the session. Thereafter it will return the same token.) Put the token in a hidden form field. When the form submission comes back in the next request, call session.get_csrf_token() again and compare it to the hidden field's value; they should be the same. If the form data is missing the field or the value is different, reject the request, perhaps by returning a forbidden status. session.new_csrf_token() always returns a new token, overwriting the previous one if it exists. WebHelpers and forms Most of WebHelpers works with Pyramid, including the popular webhelpers.html subpackage, webhelpers.text, and webhelpers.number. Pyramid does not depend on WebHelpers so you'll have to add the dependency to your application if you want to use it. The only part that doesn't work with Pyramid is the webhelpers.pylonslib subpackage, which depends on Pylons' special globals. We are working on a form demo that compares various form libraries: Deform, Formish, FormEncode/htmlfill. To organize the form display-validate-action route, we recommend the pyramid_simpleform package. It replaces @validate in Pylons. It's not a decorator because too many people found the decorator too inflexible: they ended up copying part of the code into their action method. WebHelpers 1.3 has some new URL generator classes to make it easier to use with Pyramid. See the webhelpers.paginate documentation for details. (Note: this is not the same as Akhet's URL generator; it's a different kind of class specifically for the paginator's needs.) Shell paster pshell is similar to Pylons' "paster shell". It gives you an interactive shell in the application's namespace with a dummy request. Unlike Pylons, you have to specify the application section on the command line because it's not "main". Akhet, for convenience, names the section "myapp" regardless of the actual application name. $ paster pshell development.ini myapp Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 Type "help" for more information. "root" is the Pyramid app root object, "registry" is the Pyramid registry object. >>> registry.settings["sqlalchemy.url"] 'sqlite:////home/sluggo/exp/pyramid-docs/main/workspace/Zzz/db.sqlite' >>> import pyramid.threadlocal >>> request = pyramid.threadlocal.get_current_request() >>> As the example above shows, the interactice namespace contains two objects initially: root which is the root object, and registry from which you can access the settings. To get the request, you have to use Pyramid's threadlocal library to fetch it. This is one of the few places where it's recommended to use the threadlocal library. Deployment Deployment is the same for Pyramid as for Pylons. Use "paster serve" with mod_proxy, or mod_wsgi, or whatever else you prefer.
https://bitbucket.org/sluggo/akhet/src/c2797022651a6c596eb7ef641c97f2fd998cb913/docs/architecture.rst
CC-MAIN-2015-11
refinedweb
5,122
59.3
The famous Black-Litterman (1992) portfolio choice model that we describe in this notebook notebook, we shall use some rates of convergence results and some simulations to verify how means are more difficult to estimate than variances. Among the ideas in play in this notebook will be mean-variance portfolio theory Bayesian approaches to estimating linear regressions A risk-sensitivity operator and its connection to robust control theory %matplotlib inline import numpy as np import scipy as sp import scipy.stats as stat import matplotlib.pyplot as plt from ipywidgets import interact, FloatSlider This notebook describes two lines of thought that modify the classic mean-variance portfolio choice model in ways designed to make its recommendations more plausible. As we mentioned above, the two approaches build on a common embarassment to mean-variance portfolio theory, namely, that it usually implies taking very extreme long-short portfolio positions. , \quad (1) $$ where $\delta > 0 $ is a risk-aversion parameter. The first-order condition for maximizing (1) with respect to the vector $w$ is$$ \mu = \delta \Sigma w , \quad (2) $$ which implies the following design of a risky portfolio:$$ w = (\delta \Sigma)^{-1} \mu , \quad (3) $$ The key inputs into the portfolio choice model (3). When estimates of $\mu$ and $\Sigma$ from historical sample means and covariances have been combined with ``reasonable'' values of the risk-aversion parameter $\delta$ to compute an optimal portfolio from formula (3), a typical outcome has been $w$'s with extreme long and short positions. A common reaction to these outcomes is that they are so unreasonable that a portfolio manager cannot recommend them to a customer. #======================================== # Primitives of the laboratory #========================================) Mu = (np.random.randn(N) + 5)/100 # mean excess return (risk premium) S = np.random.randn(N, N) # random matrix for the covariance matrix V = S @ S.T # turn the random matrix into symmetric psd Sigma = V * (w_m @ Mu)**2 / (w_m @ V @ w_m) # make sure that the Sharpe ratio is one # Risk aversion of market portfolio holder delta = 1 / np.sqrt(w_m @ Sigma @ w_m) # Generate a sample of excess returns excess_return = stat.multivariate_normal(Mu, Sigma) sample = excess_return.rvs(T) #================================== # Mean-variance portfolio #================================== # Estimate mu and sigma Mu_est = sample.mean(0).reshape(N, 1) Sigma_est = np.cov(sample.T) # Solve the constrained problem for the weights (with iota @ w = 1) #iota = np.ones((N, 1)) # column vector of ones #def lamb(mu, sigma, delta): # aux_vector = iota.T @ np.linalg.inv(delta * sigma) # save memory # return ((1 - aux_vector @ mu) / (aux_vector @ iota))[0] # lagrange multiplier on the const #w = np.linalg.solve(d_m * sigma_hat, mu_hat) + lamb(mu_hat, sigma_hat, delta) * iota) w = np.linalg.solve(delta * Sigma_est, Mu_est) fig, ax = plt.subplots(figsize = (8, 5)) ax.set_title('Mean-variance portfolio weights recommendation and the market portfolio ', fontsize = 12) ax.plot(np.arange(N) + 1, w, 'o', color = 'k', label = '$w$ (mean-variance)') ax.plot(np.arange(N) + 1, w_m, 'o', color = 'r', label = '$w_m$ (market portfolio)') ax.vlines(np.arange(N) + 1, 0, w, lw = 1) ax.vlines(np.arange(N) + 1, 0, w_m, lw = 1) ax.axhline(0, color = 'k') ax.axhline(-1, color = 'k', linestyle = '--') ax.axhline(1,'s responded to this situation in the following way: They continue to accept (3) (3) equal the actual market portfolio $w_m$, so that$$ w_m = (\delta \Sigma)^{-1} \mu_{BL} \quad (4) $$ (3). Evidently, portfolio rule (3) then implies that $ r_m - r_f = \delta_m \sigma^2 $ or$$ \delta_m = \frac{r_m - r_f}{\sigma^2} $$ or$$ \delta_m = \frac{\bf SR}{\sigma}, \quad (5) $$ (3) at the market portfolio $w = w_m$:$$ \mu_m = \delta_m \Sigma w_m $$ The starting point of the Black-Litterman portfolio choice model is thus a pair $(\delta_m, \mu_m) $ that tells the customer to hold the market portfolio. # ===================================================== # Derivation of Black-Litterman pair (\delta_m, \mu_m) # ===================================================== # Observed mean excess market return r_m = w_m @ Mu_est # Estimated variance of market portfolio sigma_m = w_m @ Sigma_est @ w_m # Sharpe-ratio SR_m = r_m/np.sqrt(sigma_m) # Risk aversion of market portfolio holder d_m = r_m/sigma_m # Derive "view" which would induce market portfolio mu_m = (d_m * Sigma_est @ w_m).reshape(N, 1) fig, ax = plt.subplots(figsize = (8, 5)) ax.set_title(r'Difference between $\hat{\mu}$ (estimate) and $\mu_{BL}$ (market implied)', fontsize = 12) ax.plot(np.arange(N) + 1, Mu_est, 'o', color = 'k', label = '$\hat{\mu}$') ax.plot(np.arange(N) + 1, mu_m, 'o', color = 'r', label = '$\mu_{BL}$') ax.vlines(np.arange(N) + 1, mu_m, Mu_est, lw = 1) ax.axhline(0, start with a baseline customer who asserts that he or she shares the ``market's views'', which means that his or her believes that excess returns are governed by $$ \vec r - r_f {\bf 1} \sim {\mathcal N}( \mu_{BL}, \Sigma) , \quad (3) to choose a portfolio. Suppose that the customer's view is expressed by a hunch that rather than (6), excess returns are governed by$$ \vec r - r_f {\bf 1} \sim {\mathcal N}( \hat \mu, \tau \Sigma) , \quad (7) $$) , \quad (8) $$ Black and Litterman would then advice the customer to hold the portfolio associated with these views implied by rule (3):$$ \tilde w = (\delta \Sigma)^{-1} \tilde \mu , \quad (9) $$(lamb, mu_1, mu_2, Sigma_1, Sigma_2): """ This function calculates the Black-Litterman mixture mean excess return and covariance matrix """ sigma1_inv = np.linalg.inv(Sigma_1) sigma2_inv = np.linalg.inv(Sigma_2) mu_tilde = np.linalg.solve(sigma1_inv + lamb * sigma2_inv, sigma1_inv @ mu_1 + lamb * sigma2_inv @ mu_2) return mu_tilde #=================================== # Example cont' # mean : MLE mean # cov : scaled MLE cov matrix #=================================== tau = 1 mu_tilde = Black_Litterman(1, mu_m, Mu_est, Sigma_est, tau * Sigma_est) # The Black-Litterman recommendation for the portfolio weights w_tilde = np.linalg.solve(delta * Sigma_est, mu_tilde) tau_slider = FloatSlider(min = 0.05, max = 10, step = 0.5, value = tau) @interact(tau = tau_slider) def BL_plot(tau): mu_tilde = Black_Litterman(1, mu_m, Mu_est, Sigma_est, tau * Sigma_est) w_tilde = np.linalg.solve(delta * Sigma_est, mu_tilde) fig, ax = plt.subplots(1, 2, figsize = (16, 6)) ax[0].set_title(r'Relationship between $\hat{\mu}$, $\mu_{BL}$ and $\tilde{\mu}$', fontsize = 15) ax[0].plot(np.arange(N) + 1, Mu_est, 'o', color = 'k', label = r'$\hat{\mu}$ (subj view)') ax[0].plot(np.arange(N) + 1, mu_m, 'o', color = 'r', label = r'$\mu_{BL}$ (market)') ax[0].plot(np.arange(N) + 1, mu_tilde, 'o', color = 'y', label = r'$\tilde{\mu}$ (mixture)') ax[0].vlines(np.arange(N) + 1, mu_m, Mu_est, lw = 1) ax[0].axhline(0, color = 'k', linestyle = '--') ax[0].set_xlim([0, N + 1]) ax[0].xaxis.set_ticks(np.arange(1, N + 1, 1)) ax[0].set_xlabel('Assets', fontsize = 14) ax[0].legend(numpoints = 1, loc = 'best', fontsize = 13) ax[1].set_title('Black-Litterman portfolio weight recommendation', fontsize = 15) ax[1].plot(np.arange(N) + 1, w, 'o', color = 'k', label = r'$w$ (mean-variance)') ax[1].plot(np.arange(N) + 1, w_m, 'o', color = 'r', label = r'$w_{m}$ (market, BL)') ax[1].plot(np.arange(N) + 1, w_tilde, 'o', color = 'y', label = r'$\tilde{w}$ (mixture)') ax[1].vlines(np.arange(N) + 1, 0, w, lw = 1) ax[1].vlines(np.arange(N) + 1, 0, w_m, lw = 1) ax[1].axhline(0, color = 'k') ax[1].axhline(-1, color = 'k', linestyle = '--') ax[1].axhline(1, color = 'k', linestyle = '--') ax[1].set_xlim([0, N + 1]) ax[1].set_xlabel('Assets', fontsize = 14) ax[1].xaxis.set_ticks(np.arange(1, N + 1, 1)) ax[1].legend(numpoints = 1, loc = 'best', fontsize = 13) plt.show() Consider the following Bayesian interpretation of the Black-Litterman recommendation. The prior belief over the mean excess returns is consistent with the market porfolio \quad \quad (10)$$ where $\bar d\in\mathbb{R}_+$ denotes the (transformation) of a particular density value. The curves defined by equation (10) can be labelled as iso-likelihood ellipses. Remark: More generally there is a class of density functions that possesses this feature, i.e.$$\exists g: \mathbb{R}_+ \mapsto \mathbb{R}_+ \ \ \text{ and } \ \ c \geq 0, \ \ \text{s.t. the density } \ \ f \ \ \text{of} \ \ Z \ \ \text{ has the form } \quad f(z) = c g(z\cdot z)$$ This property is called spherical symmetry (see p 81. in Leamer (1978)). In our specific example, we can use the pair $(\bar d_1, \bar d_2)$ as being two "likelihood" values for which the corresponding isolikelihood ellipses in the excess return space are given by\begin{align} (\vec r_e - \mu_{BL})'\Sigma^{-1}(\vec r_e - \mu_{BL}) &= \bar d_1 \\ (\vec r_e - \hat \mu)'\left(\tau \Sigma\right)^{-1}(\vec r_e - \hat \mu) &= \bar d_2 \end{align}. Leamer (1978) calls this curve information contract curve and describes it by the following program: maximize the likelihood of one view, say the Black-Litterman recommendation, while keeping the likelihood of the other view at least at a prespecified constant $\bar d_2$.\begin{align*} {align*} ) \quad \quad (11)$$ Note that if $\lambda = 1$, (11) is equivalent with (8) and it identifies one point on the information contract curve. Furthermore, because $\lambda$ is a function of the minimum likelihood $\bar d_2$ on the RHS of the constraint, by varying $\bar d_2$ (or $\lambda$), we can trace out the whole curve as the figure below illustrates. #======================================== # Draw a new sample for two assets #======================================== np.random.seed(1987102) N_new = 2 # number of assets T_new = 200 # sample size tau_new = .8 # random market portfolio (sum is normalized to 1) w_m_new = np.random.rand(N_new) w_m_new = w_m_new/(w_m_new.sum()) Mu_new = (np.random.randn(N_new) + 5)/100 S_new = np.random.randn(N_new, N_new) V_new = S_new @ S_new.T Sigma_new = V_new * (w_m_new @ Mu_new)**2 / (w_m_new @ V_new @ w_m_new) excess_return_new = stat.multivariate_normal(Mu_new, Sigma_new) sample_new = excess_return_new.rvs(T_new) Mu_est_new = sample_new.mean(0).reshape(N_new, 1) Sigma_est_new = np.cov(sample_new.T) sigma_m_new = w_m_new @ Sigma_est_new @ w_m_new d_m_new = (w_m_new @ Mu_est_new)/sigma_m_new mu_m_new = (d_m_new * Sigma_est_new @ w_m_new).reshape(N_new, 1) N_r1, N_r2 = 100, 100 r1 = np.linspace(-0.04, .1, N_r1) r2 = np.linspace(-0.02, .15, N_r2) lamb_grid = np.linspace(.001, 20, 100) curve = np.asarray([Black_Litterman(l, mu_m_new, Mu_est_new, Sigma_est_new, tau_new*Sigma_est_new).flatten() for l in lamb_grid]) lamb_slider = FloatSlider(min = .1, max = 7, step = .5, value = 1) @interact(lamb = lamb_slider) def decolletage(lamb): dist_r_BL = stat.multivariate_normal(mu_m_new.squeeze(), Sigma_est_new) dist_r_hat = stat.multivariate_normal(Mu_est_new.squeeze(), tau_new * Sigma_est * Sigma_est[:, 0], curve[:,). lamb_grid2 = np.linspace(.001, 20000, 1000) curve2 = np.asarray([Black_Litterman(l, mu_m_new, Mu_est_new, Sigma_est_new, tau_new*np.eye(N_new)).flatten() for l in lamb_grid2]) lamb_slider2 = FloatSlider(min = 5, max = 1500, step = 100, value = 200) @interact(lamb = lamb_slider2) def decolletage(lamb): dist_r_BL = stat.multivariate_normal(mu_m_new.squeeze(), Sigma_est_new) dist_r_hat = stat.multivariate_normal(Mu_est_new.squeeze(), tau_new * np.eye(N * np.eye(N2[:, 0], curve2[:,) realtively small. Suppose that $\beta_0$ is the "true" value of the coefficent, (8) characterizing the Black-Litterman recommendation\begin{align*} {align*}{align*} {align*}negativenegative.$$ \eqalign{ { } $$ This asserts that ${\sf T}$ is an indirect utility function for a minimization problem in which an ``evil agent'' chooses a distorted probablity {\bf 1}) $ where $\vec r - r_f {\bf {\bf 1}) $, $$ {\sf T} (\vec r - r_f {\bf 1}) = w' \mu + \zeta - \frac{1}{2\theta} w' \Sigma w $$ and entropy is $$ \frac{v'v}{2} = \frac{1}{2\theta^2} w' C C' w. $$ According to criterion (1), the mean-variance portfolio choice problem chooses $w$ to maximize$$ E [w ( \vec r - r_f {\bf 1})]] - {\rm var} [ w ( \vec r - r_f {\bf 1}) ] \quad (10) $$ which equals$$ w'\mu - \frac{\delta}{2} w' \Sigma w $$ A robust decision maker can be modelled , \quad (11) $$ or$$ w' (\mu - \theta^{-1} \Sigma w ) - \frac{\delta}{2} w' \Sigma w, \quad (12) $$ The minimizer of (12) is$$ w_{\rm rob} = \frac{1}{\delta + \gamma } \Sigma^{-1} \mu , \quad (13) $$ where $\gamma \equiv \theta^{-1}$ is sometimes called the risk-sensitivity parameter. An increase in the risk-sensitivity paramter $\gamma$ shrinks the portfolio weights toward zero in the same way that an increase in risk aversion does. We want to illustrate the "folk theorem" that with high or moderate frequency data, it is more difficult to esimate means than variances. In order to operationalize this statement, we take two analog estimators:$,\begin{align} \lim_{N\to \infty} \ \ P\left\{ \left |\bar X_N - \mathbb E X \right| > \varepsilon \right\} = 0 \quad \quad \text{and}\quad \quad \lim_{N\to \infty} \ \ P \left\{ \left| S_N - \mathbb V X \right| > \varepsilon \right\} = 0 \end{align} A necessary condition for these convergence results is that the associated MSEs vanish as $N$ goes to infintiy, autocovari sampling frequency. mu = .0 kappa = .1 sigma = .5 var_uncond = sigma**2 / (2 * kappa) n_grid = np.linspace(0, 40, 100) autocorr_h1 = np.exp(- kappa * n_grid * 1) autocorr_h2 = np.exp(- kappa * n_grid * 2) autocorr_h5 = np.exp(- kappa * n_grid * 5) autocorr_h1000 = np.exp(- kappa * n_grid * 1e8) fig, ax = plt.subplots(figsize = (8, 4)) ax.plot(n_grid, autocorr_h1, label = r'$h = 1$', color = 'darkblue', lw = 2) ax.plot(n_grid, autocorr_h2, label = r'$h = 2$', color = 'darkred', lw = 2) ax.plot(n_grid, autocorr_h5, label = r'$h = 5$', color = 'orange', lw = 2) ax.plot(n_grid, autocorr_h1000, label = r'"$h = \infty$"', color = 'darkgreen', lw = 2) ax.legend(loc = 'best', fontsize = 13) ax.grid() ax.set_title(r'Autocorrelation functions, $\Gamma_h(n)$', fontsize = 13) ax.set_xlabel(r'Lags between observations, $n$', fontsize = 11) plt.show(){align} {align}{align} .i.d. case}} \left(1 + 2 \frac{1 - \exp(-\kappa h)^{N-1}}{1 - \exp(-\kappa h)} \right) \end{align}): phi = (1 - np.exp(- kappa * h)) * mu rho = np.exp(- kappa * h) s = sigma**2 * (1 - np.exp(-2 * kappa * h)) / (2 * kappa) mean_uncond = mu std_uncond = np.sqrt(sigma**2 / (2 * kappa)) eps_path = stat.norm(0, np.sqrt(s)).rvs((M, N)) y_path = np.zeros((M, N + 1)) y_path[:, 0] = stat.norm(mean_uncond, std_uncond).rvs(M) for i in range(N): y_path[:, i + 1] = phi + rho*y_path[:, i] + eps) - mu)*, color = 'darkblue', lw = 2, label = r'large sample relative MSE, $B(h)$') ax.axhline(benchmark_rate, color = 'k', linestyle = '--', label = r'iid benchmark') ax.set_title('Relative MSE for large samples as a function of sampling frequency \n MSE($S_N$) relative to MSE($\\bar X_N$)', fontsize = 12) ax.set_xlabel('Sampling frequency, $h$', fontsize = 11) ax.set_ylim([1, 2.9]) ax.legend(loc = 'best', fontsize = 10). Black, F. and Litterman, R., 1992. "Global portfolio optimization". Financial analysts journal, 48(5), pp.28-43. Dickey, J. 1975. "Bayesian alternatives to the F-test and least-squares estimate in the normal linear model", in: S.E. Fienberg and A. Zellner, eds., "Studies in Bayesian econometrics and statistics" (North-Holland, Amsterdam) 515-554. Hansen, Lars Peter and Thomas J. Sargent. 2001. "Robust Control and Model Uncertainty." American Economic Review, 91(2): 60-66. Leamer, E.E., 1978. Specification searches: Ad hoc inference with nonexperimental data, (Vol. 53). John Wiley & Sons Incorporated.
http://nbviewer.jupyter.org/github/QuantEcon/QuantEcon.notebooks/blob/master/black_litterman.ipynb
CC-MAIN-2017-04
refinedweb
2,398
50.63
You are browsing the documentation for Symfony 4.0 which is not maintained anymore. Consider upgrading your projects to Symfony 5.3. Create your First Page in Symfony Create your First Page in Symfony¶ Creating a new page - whether it’s an HTML page or a JSON endpoint - is a. Screencast Do you prefer video tutorials? Check out the Stellar Development with Symfony screencast series.: <?php // src/Controller/LuckyController.php namespace App\Controller; use Symfony\Component\HttpFoundation\Response; class LuckyController { public function number() { $number = random_int(0, 100); return new Response( '<html><body>Lucky number: '.$number.'</body></html>' ); } } Now you need to associate this controller function with a public URL (e.g. /lucky/number) so that the number() method is executed when a user browses to it. This association is defined by creating a route in the config/routes.yaml file: That’s it! If you are using Symfony web server, try it out by going to: If you see a lucky number being printed back to you, congratulations! But before you run off to play the lottery, check out how this works. Remember the two steps to creating a page? - - Create a controller: This is a function where you build the page and ultimately return a Responseobject. You’ll learn more about controllers in their own section, including how to return JSON responses. Annotation Routes¶ Instead of defining your route in YAML, Symfony also allows you to use annotation routes. To do this, install the annotations package: You can now add your route directly above the controller: That’s it! The page - will work exactly like before! Annotations are the recommended way to configure routes. Tip To create controllers faster, let Symfony generate it for you: Auto-Installing Recipes with Symfony Flex¶ You may not have noticed, but when you ran composer require annotations, two special things happened, both thanks to a powerful Composer plugin called Flex. First, annotations isn’t a real package name: it’s an alias (i.e. shortcut) that Flex resolves to sensio/framework-extra-bundle. Second, packages so you can get back to coding. You can learn more about Flex by reading “Using Symfony Flex to Manage Symfony Applications”. But that’s not necessary: Flex works automatically in the background when you add packages. The bin/console Command¶ Your project already has a powerful debugging tool inside: the bin/console command. Try running it: You should see a list of commands that can give you debugging information, help generate code, generate database migrations and a lot more. As you install more packages, you’ll see more commands. To get a list of all of the routes in your system, use the debug:router command: You should see your one route so far: You’ll learn about many more commands as you continue! The Web Debug Toolbar: Debugging Dream¶ One of Symfony’s killer features is the Web Debug Toolbar: a bar that displays a huge amount of debugging information along the bottom of your page while developing. To use the web debug toolbar, install the Profiler pack first: As soon as this finishes, refresh your page. You should see a black bar along the bottom of the page. You’ll learn more about all the information it holds along the way, but feel free to experiment: hover over and click the different icons to get information about routing, performance, logging and more. This is also a great example of Flex! After downloading the profiler package, the recipe created several configuration files so that the web debug toolbar worked instantly. Rendering a Template¶ If you’re returning HTML from your controller, you’ll probably want to render a template. Fortunately, Symfony comes with Twig: a templating language that’s easy, powerful and actually quite fun. First, install Twig: Second, make sure that LuckyController extends Symfony’s base Symfony\Bundle\FrameworkBundle\Controller\Controller class: Now, use the handy render() function to render a template. Pass it a number variable so you can use it in Twig: // src/Controller/LuckyController.php // ... class LuckyController extends Controller { /** * @Route("/lucky/number") */ public function number() { $number = random_int(0, 100); return $this->render('lucky/number.html.twig', array( 'number' => $number, )); } } Template files live in the templates/ directory, which was created for you automatically when you installed Twig. Create a new templates/lucky directory with a new number.html.twig file inside: The {{ number }} syntax is used to print variables in Twig. Refresh your browser to get your new lucky number! Now you may wonder where the Web Debug Toolbar has gone: that’s because there is no </body> tag in the current template. You can add the body element yourself, or extend base.html.twig, which contains all default HTML elements. In the Creating and Using Templates article, you’ll learn all about Twig: how to loop, render other templates and leverage its powerful layout inheritance system. Checking out the Project Structure¶ Great news! You’ve already worked inside the most important directories in your project: config/ - Contains… configuration of course!. You will configure routes, services and packages. src/ - All your PHP code lives here. templates/ - All your Twig templates live here. Most of the time, you’ll be working in src/, templates/ or config/. As you keep reading, you’ll learn what can be done inside each of these. So what about the other directories in the project? bin/ - The famous bin/consolefile lives here (and other, less important executable files). var/ - This is where automatically-created files are stored, like cache files ( var/cache/) and logs ( var/log/). vendor/ - Third-party (i.e. “vendor”) libraries live here! These are downloaded via the Composer package manager. public/ - This is the document root for your project: you put any publicly accessible files here. And when you install new packages, new directories will be created automatically when.
https://symfony.com/doc/4.0/page_creation.html
CC-MAIN-2021-25
refinedweb
973
57.16
The held back Mandrake 9.2 ISO’s because of the LG CD-ROM issues, are now available for download. Anyone knows if the 250 MB of additional updates MandrakeSoft issued a few days after the release of the ISOs in the MandrakeClub last month also included in these download-edition ISOs? Mandrake 9.2 ISO’s now Available for Download Submitted by Darin Hadley 2003-11-14 Mandriva, Mandrake, Lycoris 32 Comments I am only seeing ISO image 1. Where are 2 and 3? I have been to several US mirrors and they only seem to have ISO 1. The mandrake site is giving MD5 sums for ISOs 1,2 and 3 so I assume that all 3 are required. Any idea what the problem might be? Here’s a mirror that I use. The isos are the same isos the member of the club have for weeks (ie with no updates) Checksums (not present on some ftps) are : 40c8812dce7b9f8fb0a3b364af62b974 Mandrake92-cd1-inst.i586.iso e07fe7b1474eb3ba35cac3dfd479777e Mandrake92-cd2-ext.i586.iso 2b6ffc5957533c927f14197ec99a0372 Mandrake92-cd3-i18n.i586.iso Mandrake will release soon a second bootable CD ( CDn°0) which will contain the updates, and will install the distribution. Good news of the day (cooker mailing-list) Dead LG’s drive are not so dead LG has released updated firmware for mandrake as well as a method to rescucite the dead ones Rubrique Device driver > cd-rom > mergency download for Physical Dead Drive from Mandrake Linux 9.2 Installation This does not concern only mandrake users, since Gentoo and SuSE have the same problem. Even windows user should update the firmware, since a virus with root priviledges can abuse the flaw in the ATAPI thing to destroy your hardware You need DOS to update the firmware. As an alternative, you can use the Free/Libre software freedos Take the floppy version, dezip it, and do dd if=FDBOOT.IMG of=/dev/fd0 bs=1440k Then copy the two files from LG on the floppy, boot on the floppy, and read the README Oh, last but not least, there is a .torrent here… (All my infos come from mandrakelinux.com and ) yes they are, that’s why they release the iso late (they were supposed to be ready one week ago No, you are wrong. Some of us have compare the md5sums with the earlier of the club. The updates of the firmware are now here, that’s why they release the iso late. Wait for the cd 0 of download the updates with urpmi. “The isos are the same isos the member of the club have for weeks (ie with no updates)” So they aren’t bothering to update it before releasing it to the public? Sheesh! Given all the problems with this particular release, that doesn’t seem to me to be a very smart way to win over new users! It seems to me that if they choose to withhold releasing isos to the public, and have over 200MB of patches and fixes, they should perhaps spin a new iso with the patches and fixes before releasing to the mass public. The Internet is wonderful, but it also allows for urban legends to be formed at the speed of light. I must have heard this a thousands times and I want to put this to rest. Get a CLUE! The 250MB of updates includes six 20MB kernels, and a 42MB kernel source. Let me do the math for you, that is 162MB of the 250MB total, out of which you will install at the most 62MB. Most of the rest is a KDE and apache update, probably bugs that Mandrake has ZERO control over. The toal # of MB is not a concern. A 62 MB update is rather large but perfectly acceptable. In fact, Suse 9.0 also needs to update Apache and KDE right out of the box. Also consider how big is your average Windows service pack and that only covers the base OS? So let’s relax and enjoy the good thing we’ve got. Perhaps you can wait 1 or 2 days that your new iso comes ? Please stop with the “200 MO, man, the distro is really buggy” Sure, it sounds impressive, but the truth is : * The story with the LG drives is not their fault. The kernel was tested with some LG drives, and only more testers could have avoided that ===> 6 new versions of the kernel, it’s a bunch of mo * A problem with kdebase which concern only asian people. 99% of the users are safe, but it represents too a bunch of MO * For example, there was a security problem with SSL _after_ the freeze, and Mandrake have udpated the package. You don’t want them to make their work, like Microsoft who releases updates for IE every 6 months so you can think it’s not buggy ? btw: Sorry, leaving out the kernel-source is unacceptable. And if they’ve got KDE, Apache, and other important security fixes they should apply them to the distro and spin a new iso. It takes long enough as it is on dialup to download the 3 isos that one shouldn’t have to download another half-iso of stuff that should have been in there to begin with. My point is simply this: if they have fixes and patches, why not just wire them into a new isos for download and not make people have to suffer through broken packages/missing kernel-source until they can download the patches themselves? If for no other reason, Mandrake should do it as a courtesy. It just seems to make good sense, that is all. And the difference with SuSE is that sure the boxed version needs to be updated online right out of the box, but that’s because the boxes are made like 6 weeks ago, *before* the Apache/KDE security fixes. Same with the Mandrake boxed set. But we’re not talking about the boxed set here. We’re talking about downloadable isos. That’s a big difference. These isos sit on Mandrake’s server until they are farmed out to the mirrors. Mandrake could easily patch the isos before sending it out. Understand the difference? I wonder if they fixed this problem with these new ISOs as well? I don’t have a floppy disk drive with my linux box and it makes the fix they suggested impossible. (On the other hand, just why do we still need floppy disks for these things? Nowadays a lot of computers don’t even come with a floppy disk drive…) I hope the retail packs will be available soon. I wanted to buy one a few weeks ago, but then the LG CDROM issue blew up… Does anybody know when they will be out? eom. So what’s the bottom line here? Am I better off waiting until “cd0” is available before downloading? Or is there going to be a 9.2.1 release soon that will superceed this release and update/patch/fix the problems discussed here in this forum? Or are these 9.2 ISO’s already fixed/updated? Mandrake Linux 9.2 is available for free download, but the date of availability is several weeks after the release became available to Mandrake Club members. The timing correctly balances the need to increase user base–free (as in free food) software is especially attractive to many users–and the need to provide value to those who pay MandrakeSoft. The FACTS are as follows: 1. No decent web-browser that works with all sites correctly. True, the web-browsers in this and any other linux distro don’t work (as their creators intented) on some malicious web-sites (ref:… ) 2. No applications other than the same ole ones, like Open Orffice, Stoned Office ect… I haven’t heard of Stoned Office before, do you have any links so that I can try it out. As for the other same old apps; they work fine. 3. X-Windows is a ram hog, it requires a lot of memory and large processor to work at any normal speed. I think X-Windows works comfortably with at least 32 MB of RAM, but that also depends on your choice of Window Managers. Some require more, others less. As for the large processor; I don’t think physical dimensions of CPU have any effect on X-Windows’ performance. 4. No hardware support or drivers that come with devices. I am sure you’ll agree that Mandrake 9.2, like any other software, runs on hardware. It will be some time until we crack that problem. As for the “drivers that come with devices”, most popular devices doesn’t require additional drivers (they are already in the kernel). For the new devices, you can try searching on the Internet. 5. No fucntionality of any sort, if you like (segmentation faults, no support, crummy apps, non-working devices, and just a bunch of problems). I totally agree. No such functionality like segmentation faults, no support, crummy apps, etc. But I’m not sure why you’d want that functionality. So to sum it up, nothing of any vaule for the end user. Not sure about “vaule”. If you mean “value”, yes it possible to obtain these distros free of charge, however if you want to support your favorite distro, I’d recommend purchasing or donating some money. Then they will become more “valuable” for you or the end user. Well, at least I like its simplified interface; this is the second Linux distro (RH Bleucurve was first) with a professional default interface and simplified menus. I have yet to explore it further; just finished installation. But, there’s one bug I have noticed with partitioning; when you select a manual partitioning, delete/select filesystem, if you click the last “Ok” button and move the mouse, system freezes a while and comes back into action with the mouse permanently not moving. This bug has been with Mandrake since version 8.1 (the first Mandrake I attempted). Have just discovered; there’s no browsers menu in the Gnome “Networking” menu. The Xfce that comes with Mandrake 9.2 is way too old; it’s version 3.x. The plugins (java vm & flash) are missing. I am a MDK linux (also Gnome and Kde) contributor (a translation team coordinator) and it’s been 3 days I’ve been using this latest release. Here are my first impressions and disappointments: 1. Great apps do not ship: anjuta, rox-filer, nano, gdesklets, abiword, xmms (ships old version), rhythmbox, poedit, gtranslator, gpg, gimp-devel, gnome-system-tools, xfce 4, no plugins and winmodem drivers. This is the first time I have no choise in translation software except Kbabel and I don’t use KDE. Being a dial-up user you can imagine that pain to get all of them. Some distros even include Gimp-devel version, but not Mandrake. 2. Improved graphics (quite good), graphical boot and desktop polish. But again it does not catch up Suse’s boot interface I sow nearly 2 years ago on Live CD Also menus in Gnome and KDE are still cluttered. I was amazed by the menu structure I saw yesterday on TurboLinux screenshot. 3. Ovarall improved speed and responsive ui but not hardware detection. MDK 9.2 couldn’t detect my Diva usb mp3 player (I was using that one on 9.1) no matter what I do, found but could not configure Epson Perfection 1670 (I was not expecting it to configure it because the scanner is pretty new and I checked the Sane site, it has support for it in CVS), and of course I could not manage to use my Apache HCF 56K modem Will try HCF drivers some time later. 4. Gnome 2.4 really rocks in speed, much faster than the previous one. But absence of unicode fonts prevented Gnome and KDE to look good. I had to install Tahoma and Arial Unicode MS. 5. Discovered 2 bugs in keyboard definition file. (I had reported one of them, easy to fix but still bug) 6. While playing songs with Xmms bass just gives distortion. I played with settings but no way. MDK 9.1 did not have this. Totem for example plays music good and clear without bass distortion. 7. I could not manage to install and run File Runner and Gdesklets. Here are the errors I got: [matt@localhost matt]$ fr /file-runner /usr/bin/fr: line 3: exec: wish: not found [matt@localhost matt]$ gdesklets Traceback (most recent call last): File “/usr/bin/gdesklets”, line 4, in ? from main import HOME File “/usr/share/gdesklets/main/__init__.py”, line 39, in ? import gnome.ui ImportError: No module named gnome.ui 8. There are too many Gtk1 apps that have Gtk2 alternatives. (see image magic-gthumb-eog) and they look really ugly. 9. Bug with displaying ugly and big fonts when using unicode locale with Gtk1 apps is still there 10. OpenOffice is RC4 and is DOG slow ! Really. Menus open for3 seconds on my 1.7 P4 and 512 Ram box. I think I can find some if I play some more. But I think it’s enough to think that MDK just put this distro out without any QA Sorry for not giving KDE comments. KDE is the same and I don’t use it so much. Anyways XFCE 4 rpms for MDK 9.1 still work here and I am glad. I just wish Nvidia drivers get updated and I could play Quake 3… So what should I do? Wait for next Fedora? ‘Novel?’ or what? Metin Amiroff I’ve also encountered some problems with this distribution:. For me it’s essencial to have this driver installed, becaused it’s the only way to avoid having the display moved to the right (so there’s a part of the desktop that I don’t see…) It also happened to me in 9.1 until I installed the nvidia driver. 2) Audio wasn’t working. I had to specify an Audigy driver (though my sound card is just a Sound Blaster Live!) and play a lot with Kmix settings… 3) I can’t update anything. It simply says there are some dependencies that couldn’t be resolved because one of the packages couldn’t be installed… 4) I can’t find Epiphany on Gnome, just Galeon… and Totem gives me an error message each time a play something, although it just keeps on playing… until it crashes when I try to close it. On the other hand, and considering that I got this thing for free and that my experience is very limited, I like it. The issues I mentioned made me return to windows until I find I way to solve them. I specially like the new menus, the boot up screens and thousands of other details .” that’s because mandrake chose not to include the kernel-source for some insane reason. you need to download and install that before your nvidia drivers will compile. this is exactly what some of the other posters have talked about. mandrake could have fixed this by patching the isos to include the kernel-source so people don’t come away with a bad impression of 9.2, but instead they chose not to do so. dumb move, I think. they should have fixed the isos before releasing them into the wild. Well, regarding the Nvidia driver issue, I went to the Linux forum that Nvidia has (or at least there is a link in their page) and I saw a message with the same problem. They told him to update the kernel to kernel-source-2.4.22-10mdk.i586.rpm, which is what I’m doing right now, and seeing that you say the same here, I’ll probably be able to fix it. I really, really like this Gnome 2.4 desktop. Until now I had always used KDE, but now that I’ve played a bit with Gnome settings I’m starting to enjoy the simple interface of this DE. And, a as side note, the translation to Spanish of the whole distribution is very accurate (hey, I come from windows so I’ve got the right to be surprised by this kind of things I just got it installed on my Dell Latitude D800. Out of Fedora, Knoppix and Suse, it was the first to come close to setting everything up correctly (namely the 1900X1260 display). It looks nice to me, so far. Yes !! Someone on #mandrake, and someone else here were able to give a second life to their LG cdrom drive, althoug it’s a bit complicated. the thing is to * plug the cdrom on the second IDE (and don’t plug the electricity), * put the jumper of the cd, like it’s writtent on Dead.gif * boot on DOS, * when you have booted, press the eject button of the CD, and while you keep it pressed, plug the electricity for CD (yeah, it’s hotplug). you will see the LED of the cd * wait some seconds * launch xferlg (name of the firmware) * shutdown the pc * put the jumper of the cd in its original state (master or slave) * should work If not, post feedback, both here and to LG. If yes, post feedback here if you want. Links : you need Dead.gif, and the flasher corresponding to your CD ( zip file with xferlg.exe and the firmware , that you have to copy on the DOS floppy you get here ) it’s not bad. Having to Google for the kernel source was a pain. I tried urpmi, but I got a “bad signature” error and it wouldn’t install. Anyways, got the kernel source and the nvidia driver was like butter. Losing the Kmenu sucked and having to run update-menus -v was a pi$$er. But, after getting everything setup, it’s alright. A lot of needless hassles just for some upgraded packages (KOffice is pretty sweet, and it saves to the OOo format). If you have ‘drake9.1 set up the way you like, 9.2 isn’t worth the hassles. Too bad really, from 8.2 -> 9.0 -> 9.1 Mandrake just got better and better. 9.2 seems like a step backwards. Just my opinion. snowdog I used to be a dedicated mandrake fan, until I tried SuSe 9.0. Just a few things :- 1. The installer is incredible – Yast2 is the most powerful and configurable I’ve yet seen and ALL my hardware is detected and configured correctly, including network cards (which mandrake has often messed up for me in the past) Mandrakes installer is klunky and ugly by comparison. 2. The software selection is really detailed for the pro version – altho I’m sure the Mandrake box set is also very full features 3. X runs faster – there’s no dought in my mind about this, KDE and Gnome are both far zippier than Mandrake (or RedHat for that matter) 4. Polished desktop appearance. While Mandrake is starting to ‘get there’ in terms of Desktop Appearance, SuSe is streets ahead. I’ve not seen such a polished default desktop since BlueCurve. 5. After install configuration – an absolute breeze with Yast. I had SuSe up and running on my windows network in seconds. Yes, there are some drawbacks – getting the Nvidia 3D drivers installed is buggy until you find a fix – took me a good while to find a forum that had help which worked, but then, installing Nvidia drivers has always been dodgy for many distros, however, there is an option to ‘update’ to the Nvidia drivers after install – I haven’t tried this, but perhaps it functions without the problems of a manual install. Overall, I would recommend SuSe 9.0 above Mandrake 9.2 for a Linux box set purchase. > Anyways, got the kernel source and the nvidia driver was like butter Dude, could you give us some info on where to get that rpm and what to do after? I really have no internet connection to investigate Thanks ! Ignore my last post. Here it is:… –Metin Yay! I got my Apache HCF modem run after installing two rpms from MDK club and configuring it manually from command line. Kudos ! –Metin Sorry, I may have given a false information. There was a lot of talk about a CD n°0 in the cooker mailing-lists, but it seems that there is now no need to release another CD. The real fix is not to produce new isos, but to correct the firmware. The other problems can be solved by the usual infrastructure (ie: run MandrakeUpdate after the installation ) If you want to share mandrake with people with a slow internet connection like me, you can alwas download all the tree of the updates. Something like this : $ wget -r…. Burn it, you have your cd with updates. After the install, just add your new CD as a source for updated packages. I don’t use Mandrake in this moment, but it can be done within Mandrake Control Center, and should be something like this on the command line. $ urpmi.addmedia –update 92updates removable:///mnt/cdrom/RPMS Hope this helps. i just got it up & running in an extra disk partition, so far it is running good here, one thing i thought was cool, i looked in /mnt to see my Windoze FAT32 disk partitions and they were all labeled the same as how i labeled them in Redhat, so the Mandrake installer must have read Redhat’s /etc/fstab file to do that. Mandrake-9.2 gets a thumbs up from me :^) >I looked in /mnt … The same here. It detected the mount points I had on my previous MDK installation even though I did a clean install. Good! i’ve been using dos and then windows from the early 90’s and started to use linux on 1998. While i have to admit that linux has made great progress on the client side, it’s still got a lot to go before even thinking of being a real trat for windows, and the new mandrake, with tese bugs, is no exception. This could never happen installing windows xp, and after 12 years linux still doesnt have a rational way to install/uninstall programs and drivers with a click of the mouse (and for all the raging “linux “purists” out there: we are in 2003, not in the friging 80’s…). And please let’s stop this old story about “windows insecurity”: it all depends on the user: you just have to set up a good firewall, an antivirus and little else and you are done. I’ve never had any intrusion problems since i started using windows on the net in 1994. Sure, the dumb user could have problems but the pc is not and will never be a domestic appliance. It will required always a bit of brain. Sorry about that but it’s the reality. So, up to now I think we have to admit that windows is still light years ahead on the desktop. Regards
https://www.osnews.com/story/5133/mandrake-92-isos-now-available-for-download/
CC-MAIN-2019-09
refinedweb
3,881
80.51
Elm, Eikonal, and Sol LeWitt We saw this cool Sol LeWitt wall at MASS MoCA. It did not escape our attention that it was basically an eikonal equation and that the weird junctures were caustic lines. It was drawn with alternating colored marker lines appearing a cm away from the previous line. This is basically Huygens principal. So I hacked together a demo in elm. Elm is a Haskell-ish language for the web. So I made a quick rip and run elm program to do this. This is the output, which I could make more dynamic. The algorithm is to turn a list of points into their connecting lines. Then move the line perpendicular to itself, then recompute the new intersection points. It’s somewhat reminiscent of Verlet integration. Lines coordinates are momentum-like and points are position like and we alternate them. This is a finite difference version of the geometric Huygen’s principle. Alternative methods which might work better include the Fast Marching Method or just using the wave equation and then plotting iso surfaces. I also had to resample the function to get only the maximum y value for each x value in order to duplicate the LeWitt effect. These are the helper functions with lots of junk in there module LineHelpers exposing (..) -- Maybe should just be doubles or nums import Debug fromJust : Maybe a -> a fromJust x = case x of Just y -> y Nothing -> Debug.crash "error: fromJust Nothing" toPointString : List (number, number) -> String toPointString xs = case xs of (x,y) :: ys -> (toString x) ++ "," ++ (toString y) ++ " " ++ (toPointString ys) _ -> "" crossProd : (number,number,number) -> (number,number,number) -> (number,number,number) crossProd (a,b,c) (d,e,f) = (b * f - c * e, c * d - a * f, a * e - b * d) type alias PointListH number = List (number,number,number) type alias LineListH number = List (number,number,number) -- gives the mapping function the list and the list shifted by 1 neighbormap f a = let a_ = fromJust (List.tail a) in List.map2 f a a_ crossNeighbor = neighbormap crossProd norm a b = sqrt (a * a + b * b) shiftLine delta (a,b,c) = (a,b, (norm a b) * delta + c) connectingLines = crossNeighbor shiftLines delta = List.map (shiftLine delta) intersections = crossNeighbor -- nearly striaght lines will find their intersection at infinity. -- maybe filter out a lower threshold on c -- keep first and last point last xs = let l = List.length xs in fromJust (List.head (List.drop (l - 1) xs)) timestep : Float -> List (Float,Float, Float) -> List (Float,Float, Float) timestep delta points = let firstpoint = fromJust (List.head points) lastpoint = last points connectlines = connectingLines points newlines = shiftLines delta connectlines newpoints = intersections newlines filterednewpoints = List.filter (\(a,b,c) -> (abs c) > 0.01) newpoints normpoints = List.map normalize filterednewpoints result = firstpoint :: (normpoints ++ [lastpoint]) resample = List.map (maxfunc (List.map dehomogenize result)) initx --result2 = removeoutoforder (-100000, 0,00) result in List.map homogenize (zip initx resample) homogenize (a,b) = (a,b,1) dehomogenize (a,b,c) = (a / c, b / c) normalize = dehomogenize >> homogenize zip = List.map2 (,) initx = List.map (toFloat >>((*) 4.5)) (List.range -200 400) --inity = List.map (\x -> x * x / 50) initx --inity = List.map (\x -> 300 + x * x / -50) initx --inity = List.map (\x -> 25 * sin (x / 20) + 250) initx inity = List.map (\x -> 25 * sin (x / 20) + 250 + 15 * sin (x/13)) initx initxy = zip initx inity initxyh = List.map homogenize initxy iterate n f x = if n == 0 then [] else (f x) :: iterate (n - 1) f (f x) paths = (List.map << List.map) dehomogenize (iterate 60 (timestep 5.0) initxyh) colors = List.concat (List.repeat (List.length paths) ["red", "blue", "yellow"] ) removeoutoforder prev xs = case xs of y :: ys -> if prev < y then (y :: removeoutoforder y ys) else removeoutoforder prev ys _ -> [] neighborzip a = let a_ = fromJust (List.tail a) in zip a a_ linearinterp x ((x1,y1), (x2,y2)) = (y1 * (x2 - x) + y2 * (x - x1)) / (x2 - x1) maxfunc : List (Float, Float) -> Float -> Float maxfunc points x = let pairs = neighborzip points filterfunc ((x1,y1), (x2,y2)) = (xor (x < x1) (x < x2)) candidates = List.filter filterfunc pairs yvals = List.map (linearinterp x) candidates in Maybe.withDefault 100 (List.maximum yvals) And this is the svg main program. import Html exposing (Html, button, div, text) import Html.Events exposing (onClick) import Svg exposing (..) import Svg.Attributes exposing (..) import LineHelpers exposing (..) roundRect : Html.Html msg roundRect = svg [ width "1000", height "1000",viewBox "-100 0 350 350" ] (List.reverse ([--[ rect [ x "10", y "10", width "100", height "100", rx "15", ry "15" ] [], -- polyline [ fill "none", stroke "red", points "20,100 40,60 70,80 100,20" ] [], polyline [ fill "none", stroke "black", strokeWidth "5.0", points (LineHelpers.toPointString LineHelpers.initxy) ] []] ++ (List.map2 (\path color -> polyline [ fill "none", stroke color, strokeWidth "3.0", points (LineHelpers.toPointString path)] []) LineHelpers.paths LineHelpers.colors))) main = Html ] [ Html.text "-" ] , div [] [ Html.text (toString model) ] , button [ onClick Increment ] [ Html.text "+" ], roundRect ] notes on elm elm is installed with npm elm-repl you import packages (including your own) with import ThisPackage and you check types by just writing them and hitting enter rather than :t elm-live is a very handy thing. A live reloading server that watches for changes in your files. elm-make myfile.elm will generate the javascript and html This is a good tutorial and a good snippet to get you going Differences from Haskell: elm isn’t lazy which is probably good. The composition operator (.) is now « elm doesn’t have the multiline pattern match of haskell. You need to use case expressions. I miss them. typeclass facilities are not emphasized. The list type is List a rather than [a]
https://www.philipzucker.com/elm-eikonal-sol-lewitt/
CC-MAIN-2021-39
refinedweb
933
67.45
I need to Write a program that creates a Dice object. getValue( ) method for returning the value showing on the dice An isEven( ) method which checks if the value is even or odd An isHigh( ) method which checks if the value is high or low The main application should do the following: 1. Create a Dice object 2. Roll the dice every time the user hits enter 3. Print out the new value showing on the dice 4. Print out whether the value is even or odd, high or low So far I have this. Just wondering if someone could help me with the remaining methods import java.util.Scanner*; public class Dice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Dice dice1 = new Dice(); System.out.println("dice1 is " + dice1.roll()); } } public class Dice{ int roll(){ return 1 + (int)(Math.random()* 6)+1; }
http://www.javaprogrammingforums.com/object-oriented-programming/11588-help-creating-dice-rolling-program-java.html
CC-MAIN-2015-11
refinedweb
148
75.81
The: """A hand of cards (bridge style)""" def __init__(self, north, east, south, west): # Input parameters are lists of cards ('Ah', '9s', etc.) self.north = north self.east = east self.south = south self.west = west # ... (other possibly useful methods omitted) ... This is. Let’s start with model fields. If you break it down, a model field provides a way to take a normal Python object – string, boolean, datetime, or something more complex like Hand – and convert it to and from a format that is useful when dealing with the database. (Such a format is also useful for serialization, but as we’ll see later, that is easier you will need a: Handclass in our example. Fieldsubclass. This is the class that knows how to convert your first class back and forth between its permanent storage form and the Python form. ignore the editable parameter ( auto_now being set implies editable=False). No error is raised in this case. This behavior simplifies the field classes, because they don’t need to check for options that aren’t necessary. They pass all the options to the parent class and then don’t use them later on. It’s up to you whether you want your fields to be more strict about the options they select, or to use the. The counterpoint to writing your __init__() method is writing the deconstruct() method. It’s used during model migrations to tell. deconstruct()().__init__(*args, **kwargs) def deconstruct(self): name, path, args, kwargs = super().deconstruct() del kwargs["max_length"] return name, path, args, kwargs If you add a new keyword argument, you need to write code in deconstruct() that puts its value into kwargs yourself. You should also omit the value from kwargs when it isn’t necessary to reconstruct the state of the field, such as when the default value is being used: from django.db import models class CommaSepField(models.Field): "Implements comma-separated storage of lists" def __init__(self, separator=",", *args, **kwargs): self.separator = separator super().__init__(*args, **kwargs) def deconstruct(self): name, path, args, kwargs = deconstructing and reconstructing the field: name, path, args, kwargs = my_field_instance.deconstruct() new_instance = MyField(*args, **kwargs) self.assertEqual(my_field_instance.some_attribute, new_instance.some_attribute).)") Once you’ve created your Field subclass, you might consider overriding a few standard methods, depending on your field’s behavior. The list of methods below is in approximately decreasing order of importance, so start from the top.. You can handle this in a db_type() method by checking the connection.settings_dict['ENGINE'] attribute. For example: class MyDateField(models.Field): def db_type(self, connection): if connection.settings_dict['ENGINE'] == 'django.db.backends.mysql': return 'datetime' else: return 'timestamp' The db_type(), implement Field.__init__(), like so: # This is a much more flexible example. class BetterCharField(models.Field): def __init__(self, max_length, *args, **kwargs): self.max_length = max_length, but this gives you a way to tell Django to get out of the way.: Handin our ongoing example). get. Since using a database requires conversion in both ways, if you override from_db_value()().formfield(**defaults) This assumes we’ve imported a MyFormField field class (which has its own default widget). This document doesn’t cover the details of writing custom form fields.>.base.DatabaseWrapper. To customize how the values are serialized by a serializer, you can override value_to_string(). Using value_from_object() is the best way to get the field’s value prior to serialization. For example, since HandField uses strings for its data storage anyway, we can reuse some existing conversion code: class HandField(models.Field): # ... def value_to_string(self, obj): value = self.value_from_object(obj) return self.get_prep_value(value) Writing a custom field can be a tricky process, particularly if you’re doing complex conversions between your Python types and your database and serialization formats. Here are a couple of tips to make things go more smoothly: django/db/models/fields/__init__.py) for inspiration. Try to find a field that’s similar to what you want and extend it a little bit, instead of creating an entirely new field from scratch. __str__()method on the class you’re wrapping up as a field. There are a lot of places where the default behavior of the field code is to call str()on the value. (In our examples in this document, valuewould be a Handinstance, not a HandField). So if your __str__()method automatically converts to the string form of your Python object, you can save yourself a lot of work. FileFieldsubclass, assign the new File subclass to the special attr_class attribute of the FileField subclass. In addition to the above details, there are a few guidelines which can greatly improve the efficiency and readability of the field’s code. ImageField(in django/db/models/fields/files.py) is a great example of how to subclass FileFieldto support a particular type of file, as it incorporates all of the techniques described above.
https://django.readthedocs.io/en/3.1.x/howto/custom-model-fields.html
CC-MAIN-2022-40
refinedweb
806
57.67
.css.text.syntax.javacc.lib;20 21 /**22 * Support for JavaCC version 1.1. When JavaCC is required to read directly23 * from string or char[].24 * <p>25 * Added support for JavaCC 3.2 generated TokenManagers: extends SimpleCharStream.26 *27 * @author Petr Kuzel28 */29 public class StringParserInput extends SimpleCharStream implements CharStream {30 /** the buffer */31 private char[] buffer;32 33 /** the position in the buffer*/34 private int pos;35 36 /** Begin of current token, for backup operation */37 private int begin;38 39 /** Length of whole buffer */40 private int len;41 42 /** buffer end. */43 private int end;44 45 public StringParserInput() {}46 47 48 public void setString(String s) {49 buffer = s.toCharArray();50 begin = pos = 0;51 len = s.length();52 end = len;53 }54 55 /** Share buffer with e.g. syntax coloring. */56 public void setBuffer(char[] buf, int offset, int len) {57 buffer = buf;58 begin = pos = offset;59 this.len = len;60 end = offset + len;61 }62 63 /**64 * Returns the next character from the selected input. The method65 * of selecting the input is the responsibility of the class66 * implementing this interface. Can throw any java.io.IOException.67 */68 public char readChar() throws java.io.IOException {69 if (pos >= end)70 throw new java.io.EOFException ();71 return buffer[pos++];72 }73 74 /**75 * Returns the column position of the character last read.76 * @deprecated77 * @see #getEndColumn78 */79 public int getColumn() {80 return 0;81 }82 83 /**84 * Returns the line number of the character last read.85 * @deprecated86 * @see #getEndLine87 */88 public int getLine() {89 return 0;90 }91 92 /**93 * Returns the column number of the last character for current token (being94 * matched after the last call to BeginTOken).95 */96 public int getEndColumn() {97 return 0;98 }99 100 /**101 * Returns the line number of the last character for current token (being102 * matched after the last call to BeginTOken).103 */104 public int getEndLine() {105 return 0;106 }107 108 /**109 * Returns the column number of the first character for current token (being110 * matched after the last call to BeginTOken).111 */112 public int getBeginColumn() {113 return 0;114 }115 116 /**117 * Returns the line number of the first character for current token (being118 * matched after the last call to BeginTOken).119 */120 public int getBeginLine() {121 return 0;122 }123 124 /**125 * Backs up the input stream by amount steps. Lexer calls this method if it126 * had already read some characters, but could not use them to match a127 * (longer) token. So, they will be used again as the prefix of the next128 * token and it is the implemetation's responsibility to do this right.129 */130 public void backup(int amount) {131 if (pos > 1)132 pos -= amount;133 }134 135 /**136 * Returns the next character that marks the beginning of the next token.137 * All characters must remain in the buffer between two successive calls138 * to this method to implement backup correctly.139 */140 public char BeginToken() throws java.io.IOException {141 begin = pos;142 return readChar ();143 }144 145 /**146 * Returns a string made up of characters from the marked token beginning147 * to the current buffer position. Implementations have the choice of returning148 * anything that they want to. For example, for efficiency, one might decide149 * to just return null, which is a valid implementation.150 */151 public String GetImage() {152 return new String (buffer, begin, pos-begin);153 }154 155 156 /** @return token length. */157 public int getLength() {158 return pos - begin;159 }160 161 /**162 * Returns an array of characters that make up the suffix of length 'len' for163 * the currently matched token. This is used to build up the matched string164 * for use in actions in the case of MORE. A simple and inefficient165 * implementation of this is as follows :166 *167 * {168 * String t = GetImage();169 * return t.substring(t.length() - len, t.length()).toCharArray();170 * }171 */172 public char[] GetSuffix(int l) {173 char[] ret = new char[l];174 System.arraycopy(buffer, pos - l, ret, 0, l);175 return ret;176 }177 178 /**179 * The lexer calls this function to indicate that it is done with the stream180 * and hence implementations can free any resources held by this class.181 * Again, the body of this function can be just empty and it will not182 * affect the lexer's operation.183 */184 public void Done() {185 }186 187 public String toString() {188 return "StringParserInput\n Pos:" + pos + " len:" + len + " #################\n" + buffer; // NOI18N189 }190 }191 Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ |
http://kickjava.com/src/org/netbeans/modules/css/text/syntax/javacc/lib/StringParserInput.java.htm
CC-MAIN-2017-17
refinedweb
767
62.17
fun with maths recursion The provided code uses recursion to calculate the sum of all items in the input list. Change the code to calculate and output the sum of the squares of all the list items def calc(list): if len(list)==0: return 0 else: return list[0] + calc(list[1:]) list = [1, 3, 4, 2, 5] x = calc(list) print(x) 7/4/2021 9:43:45 AMLokendra Gupta 3 AnswersNew Answer So what's your question? Please post only programming-related questions in sololearn. Q&A discussion is only for asking programming-related questions. You can post it in your activity feed and also you can post it in the comments of the python recursion lesson: To calculate and sum squares of the `list` items you multiply the LHS operand of the + operator by itself in the `else` block. P.S. Avoid use of built-in class name for variable name. Use other name rather than 'list' for a `list` object. def calc( lst ): if len( lst ) == 0: return 0 return ( lst[0] * lst[0] ) + calc( lst[1:] ) lst = [1, 3, 4, 2, 5] x = calc( lst ) print( x ) def calc(list): if len(list)==0: return 0 else: return list[0]**2 + calc(list[1:]) list = [1, 3, 4, 2, 5] x = calc(list) print(x)
https://www.sololearn.com/Discuss/2827962/fun-with-maths-recursion
CC-MAIN-2021-39
refinedweb
221
64.14
I posted a while ago about running a locally hosted server using MAMP, and I have been successfully using a PHP script on this server to read and write to a database. Then a friend suggested I could use Python instead of PHP, e.g. using “CherryPy” as a light-weight server. I am a big fan of python, so I want to try this. The basic overview is: - Use the CherryPy python library to run the server (though more recently I have switched to Django) - Use the MySQLdb python library to interface with MySQL - Use the MAMP-installed instance of MySQL Here’s how I made it work: - Download CherryPy (or Django or any other Python-based framework) from the link above. I had to use sudoin front of the python setup.py buildcommand. - Download MySQLdb from the link above. - Check it works by going to the terminal, typing pythonand then import MySQLdb - It doesn’t work, for several reasons: - It can’t find the “ mysql_config” file associated with MAMP. To fix this, open site.cfg(in the directory you installed MySQLdb) and add the line below. Note this points to the MAMP installation of my_sql, not the default of /usr/local/bin: mysql_config = /Applications/MAMP/Library/bin/mysql_config - It couldn’t find llvm. To solve this, open XCode, go to Preferences, choose the Components tab, and install the command line tools. - MAMP does not include the required .h files. This post describes how to get around this: I downloaded the 64bit MySQL from here, and copied files from its includedirectory into the new directory MAMP/Library/include, and from its libdirectory into MAMP/Library/lib. (Don’t use the 32bit files.) - The final magic touch is you need to type export DYLD_LIBRARY_PATH=/Applications/MAMP/Library/lib into the terminal before you go into python. (But note – this will mess up git. So when you need git, type export DYLD_LIBRARY_PATH=''. Urrggh!) - Now both import MySQLdband import _mysqlwork in python. - To access MySQL from the terminal, open MAMP and start the servers. Then type /Applications/MAMP/Library/bin/mysql --host localhost -uroot -proot You can now do things like show databases;to look at the databases you have available. - So far so good, but when I try to connect to a database, I got the error “Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)” (error number 2002). The solution is nicely explained in this post, and is: sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock - Strangely, when I came back to this a week later, I got an error: “Library not loaded: libmysqlclient.18.dylib”. I found this works: sudo ln -s /Applications/MAMP/Library/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib I also found I had to repeat the previous point to recreate the /tmp/mysql.sock file. To summarise the on-going usage: - Before using python, you need to type export DYLD_LIBRARY_PATH=/Applications/MAMP/Library/lib - In order to use MySQL in the terminal, you need to type /Applications/MAMP/Library/bin/mysql --host -localhost -uroot -proot In Django, you will need to use the following DATABASE values in settings.py: 'HOST': '/Applications/MAMP/tmp/mysql/mysql.sock', 'PORT': '8888', One more thing. When I write apps that interface with the MAMP localhost, I need to replace localhost with the local IP address (from the Mac Network Utility program), and append port :8888. However the CherryPy localhost has the local IP address 127.0.0.1 (and :8080). Why are the two local IP addresses different? From here: - There are a few tutorials on using MySQL from python, e.g. one at ZetCode and one at TutorialsPoint. - File downloads and uploads using CherryPy are covered in the CherryPy documentation. Any thoughts?
http://racingtadpole.com/blog/mamp-python-and-mysqldb/
CC-MAIN-2019-43
refinedweb
634
56.15
How to run multiple webpack instances on the same page…and avoid any conflicts Last week i was developing my first Angular 2 app. It was a simple widget based app that needed to be installed on multiple webpages on multiple sites. Using the Angular CLI tool, development was fairly painless. All was well and after building the final app in production mode i was feeling confident. The Problem I then went to install the app on a webpage within a Sqaurespace website. And thats where the errors started. Uncaught d {__zone_symbol__error: Error: Zone already loaded. Uncaught TypeError: __webpack_require__(…) is not a function` I was getting a couple of different types of errors based on two different Squarespace websites i was trying (running different themes). Due to my lack of experience with webpack it took me a whole day to figure out what was wrong. After a couple of table head banging moments i managed to figure it out. The Solution From my first Zone already loaded error i thought that the issue lied with Zone.js but its nothing to do with that. The issue happens when a webpage loads two or more JS scripts that run different instances of webpack. Ultimately its a webpack conflict. Webpack does not run in the global namespace…so whats causing the issue? Its a webpack plugin called CommonsChunkPlugin which is used for ansyc on demand loading of code via JSONP. The plugin registers and uses a global function named window.webpackJsonp and thats where conflict occurs. However do no fear…webpack configuration setting to the rescue! This is the solution. Simply change the name of the webpackJsonp function for at least one on the webpack instances running and the conflict is resolved. Hope this helps anyone with the same issue. This kind of issue can very fustrating for newcomers to webpack.
https://medium.com/@cliffers/how-to-run-multiple-webpack-instances-on-the-same-page-and-avoid-any-conflicts-4e2fe0f016d1
CC-MAIN-2021-21
refinedweb
309
66.54
0 I dont know wats wrong with my code but what am trying to do is for salary its an addition of DA and HRA. Here is my code. #include <iostream.h> class teacher{ private: char name[20]; char subject[10]; float DA , HRA ; float salary; public: void getdata(); void display(); int payrol(); }; int teacher::payrol(){ salary = DA + HRA ; return 0; }; void teacher::getdata(){ cout << "Specify your name. \n"; cin >> name ; cout << "Specify your subject.\n"; cin >> subject ; cout << "Specify your DA (Daily Allowence).\n"; cin >> DA ; cout << "Specify your HRA (Home Rent Allowence).\n"; cin >> HRA; }; void teacher::display(){ cout << " Name : " << name << endl ; cout << " Subject : " << subject << endl ; cout << " DA : " << DA << endl ; cout << " HRA : " << HRA << endl ; cout << " Salary : " << salary << endl ; }; int main(){ teacher st; st.getdata(); st.display(); cin.get(); cin.ignore(); return 0; } here every thing working fine except salary. I want salary as a sum of DA and HRA as i coded. But its not working :( Edited by brainfo: n/a
https://www.daniweb.com/programming/software-development/threads/389748/class
CC-MAIN-2017-09
refinedweb
163
81.73
Content-type: text/html atoi, atol, strtol, strtoul - Convert a character string to the specified integer data type Standard C Library (libc.a) #include <stdlib.h> int atoi( const char *nptr); long int atol( const char *nptr); long int strtol( const char *nptr, char **endptr, int base); unsigned long int strtoul( const char *nptr, char **endptr, int base); Points to the character string to convert. Points to a pointer in which the function stores the position in the string specified by the nptr parameter where a character is found that is not a valid character for the purpose of this conversion. Specifies the radix to use for the conversion. The atoi(), atol(), strtol(), and strtoul() functions are used to convert a character string pointed to by the nptr parameter to an integer having a specified data type. The atoi() and atol() functions convert a character string containing decimal integer constants, but the strtol() and strtoul() functions can convert a character string containing a integer constant in octal, decimal, hexadecimal, or a base specified by the base parameter. The atoi() function converts the character string pointed to by the nptr parameter, up to the first character inconsistent with the format of a decimal integer, to an integer data type. Leading white-space characters are ignored. A call to this function is equivalent to a call to strtol(nptr, (char**) NULL, 10). The int value of the input string is returned. The atol() function converts the character string pointed to by the nptr parameter, up to the first character inconsistent with the format of a decimal integer, to a long integer data type. Leading white-space characters are ignored. A call to this function is equivalent to a call to strtol(nptr, (char**) NULL, 10). The long int value of the input string is returned. The strtol() function converts the initial portion of the character string pointed to by the nptr parameter to a long integer representation. The input character string is first broken down into three parts: White space -- an initial (possibly empty) sequence of spaces (as specified by the isspace() function) Subject sequence -- a sequence of characters that are valid in an integer constant of the radix determined by the base parameter Unrecognized characters -- final sequence of unrecognized character codes, including the terminating null character If possible, the subject is then converted to a long 0X followed by a sequence consisting of decimal digits and the letters in the range a (or A) to f (or F). If the base value is between 2 and 36, the subject string can be a sequence of digits and letters a (or A) to z ( or Z ) that are used to represent an integer in the specified base. Alphabetic characters represent digits with an equivalent decimal value from 10 (for the letter A) to 35 (for the letter Z). The subject string can only have digits with a value less than base and alphabetic characters with equivalent values less than base. For example, when the value of the base parameter is 20, only the following value assignments are converted: character string is parsed to skip the initial space characters (as determined by the isspace() function). Any nonspace character is the starting strtol() function sets the location pointed to by the endptr parameter to point to this final sequence of unrecognized characters except when endptr is a null pointer. The LC_CTYPE category of the locale controls what characters are treated as spaces but does not effect the interpretation of characters as part of the subject string. The characters in the subject string are always treated as if the locale was the C locale. The strtoul() function is the same as the strtol() function, except that strtoul() returns an unsigned long integer. The following example converts a character string to a signed long integer. #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <errno.h> #define LENGTH 40 main() { char String[LENGTH], *endptr; long int retval; (void)setlocale(LC_ALL, ""); if (fgets(String, LENGTH, stdin) != NULL) { errno = 0; retval = strtol ( String, &endptr, 0 ); if (retval == 0 && (errno != 0 || String == endptr)) { /* No conversion could be performed */ printf("No conversion performed\n"); } else if (errno !=0 && (retval == LONG_MAX || retval == LONG_MIN)) { /* Error handling */ } else { /* retval contains long integer */ printf("Integer in decimal is %d\n", retval); } } } The atoi() function returns the converted value of an integer if the expected form is found. If no conversion could be performed, a value of 0 (zero) is returned. If the converted value is outside the range of representable values, INT_MAX or INT_MIN is returned (according to the sign of the value). The atol() and strtol() functions return the converted value of long integer if the expected form is found. If no conversion could be performed, a value of 0 (zero) is returned. If the converted value is outside the range of representable values, LONG_MAX or LONG_MIN is returned (according to the sign of the value). The strtoul() function returns the converted value of long integer if the expected form is found. If no conversion could be performed, a value of 0 (zero) is returned. If the converted value is outside the range of representable values, ULONG_MAX is returned. In the strtol() and strtoul() functions, if the endptr parameter is not a null pointer, the function stores a pointer to the final sequence of unrecognized characters in the object pointed to by endptr except when the subject sequence is empty or invalid. In this case, the function stores the nptr pointer in the object pointed to by the endptr parameter. Since these functions return 0 (zero), INT_MIN, INT_MAX, LONG_MIN, LONG_MAX, and ULONG_MAX in the event of an error and these values are also valid returns if the function is successful, applications should set errno to 0 (zero) before calling these functions, and check errno after return from the function. If errno is nonzero, an error occurred. Additionally, for the strtol() and strtoul() functions, if 0 (zero) is returned, applications should check if the endptr parameter equals the nptr parameter. In this case, there was no valid subject string. If any of the following conditions occurs, the atoi(), atol(), strtol(), or strtoul() function sets errno to the corresponding value. The base parameter has a value less than 0 or greater than 36. Functions: atof(3), scanf(3), wcstol(3), wcstoul(3). delim off
http://backdrift.org/man/tru64/man3/atoi.3.html
CC-MAIN-2016-50
refinedweb
1,060
50.46
I made the fairly bold statement at my PDC09 talk that a DomainService IS A WCF Service. That is, everything you know about a WCF service should be true of a DomainService. I didn’t have time to get into this in my talk, so I thought I’d hit the highlights here. And in the process show how to consume a DomainService from a WinForms. You can also see more examples at: You need: You can download the completed solution as well. and be sure to check out the full talk. The first thing we need to do is get at the data underlying service. In the mainstream Silverlight case this is all handled for you by the implicit link between the Silverlight client and the ASP.NET server. However, in the vanilla WCF case, you get the full control. The URL to the service is of the following format: http://[hostname]/[namespacename]-[classname].svc so in my case that is: Hitting that URL in the browser gives you the very familiar WCF proxy help screen: And tacking on the ?wsdl gives you the WSDL for this service The rest is easy for anyone halfway familiar with WCF… Create a new WinForms project and select Add Service Reference. Enter the URL (note discover doesn’t work for this sort of service yet)… The you have a service! Now, we have a service, let’s look at actually getting data out of it. In this case I already have a WinForms DataGridView on my form. So getting data into it should be no problem. In line 3, we create a new instance of the web service client and point it at the right binding. The service exposes a couple of different bindings as you can see in the app.config file for the WinForms app: In line 4, we call the service to get our list of Plates… in this case we are doing things synchronously.. you could of course do it async if you’d like. In line 5, we bind the DataGridView to the results of this call. In lines 6-9, we are saving off the “original” values.. for each item we got.. this will help us when we do updates. In line 10, we handle the cell edit event, we will come back to look at that later. in line 11, we sign up for the selection changed event so we can initialize the picture… Be patient with this one… sometimes it takes a while load a picture. it is using hanselman’s server which gets slammed sometimes ;-) Now we have our data, we can scroll through it and view the pretty pictures. But how do we update the data… well, let’s take a look at CellEditEnd event handler… In line 3, we are creating a new context. we could be sharing with the load method, but I thought this would be cleaner to follow. In line 4, we save off the currently selected plate. In lines 5-10 we are building up a changeset to send to the server. Notice we need to give it the original values we saved off in the load method. Getting the original values right is the likely the hardest part here. Keep in mind that assignment in C# (and VB) is by default by reference. So you can’t just store off a reference, you must actually make a copy of the original values. Then in line 12, we submit the changes. Make a change, tab off it.. This will call the server and post your update. Re run the app to see that it took. Notice here we are sending one item in the change set. You could of course build up a change set on the client with many entries and then send them as a batch. I hope that helps to make it clear how a DomainService IS A WCF Service… You can download the completed solution as well. and be sure to check out the full talk.
http://blogs.msdn.com/b/brada/archive/2009/11/22/ria-services-a-domainservice-is-a-wcf-service-add-service-reference.aspx?Redirected=true
CC-MAIN-2014-23
refinedweb
673
81.33
I want to use feature dropout like dropout2d and fill it with mean value (or Gaussian noise for example) instead of zeros. How to do so? Easiest thing to do is runing dropout2d and fill zeros, but i have zeros in data. I want to use feature dropout like dropout2d and fill it with mean value (or Gaussian noise for example) instead of zeros. You could sample a binary mask using the drop probability p and fill the tensor with your desired value: x = torch.ones(10, 20) p = 0.5 mask = torch.distributions.Bernoulli(probs=(1-p)).sample(x.size()) x[~mask.bool()] = x.mean() Note that dropout scales also the activation to make sure the expected activation ranges are equal during training and validation via: # manual dropout out = x * mask * 1/(1-p) So you would have to take care of this scaling for your approach. Can i sample values from tensor for mask values? Also do i really need to scale, if dropping out with non zero values? I’m not sure I understand the first question. In my code I sample the mask manually. Would that work of what would you like to sample additionally? If you enable dropout during training and disable it during evaluation, the expected activation values will have a different range and thus your model will most likely perform poorly. The scaling is described in the original Dropout paper. I want to calculate mean frame with taking into account zero padding and replace some random frames with it. This code raises an error. What is the right way? def mean_frame_dropout(x, lens, p=0.2): x = x.clone() batch_size, length, features = x.size() mask = torch.distributions.Bernoulli( probs=(1 - p)).sample((batch_size, length)).to(x.device) mask = ~mask.bool() mask = mask.unsqueeze(-1).expand(-1, -1, features) mean = x.detach().sum(1) / lens x[mask] = mean return x What kind of error are you getting? Could you post the stack trace as well as the shapes of the input tensors? Mean and x sizes torch.Size([1, 128]) torch.Size([1, 167, 128]) RuntimeError: shape mismatch: value tensor of shape [128] cannot be broadcast to indexing result of shape [5120] The mean tensor has the shape [1, 128] as it’s calculated by x.sum(1). However, x[mask] has a variable number of elements so how should the assignment work? E.g. lets assume mask samples 5120 True values, thus x[mask] would have the shape [5120]. How should the 128 values of mean be assigned to which value? What is the right way to mask it? It depends, what you want to achieve. The original mask before the unsqueeze and expand operations can be used to index x directly, which would yield: x = torch.ones([1, 167, 128]) batch_size, length, features = x.size() p = 0.5 mask = torch.distributions.Bernoulli( probs=(1 - p)).sample((batch_size, length)).to(x.device) mask = ~mask.bool() print(mask.shape) > torch.Size([1, 167]) print(x[mask].shape) > torch.Size([81, 128]) print(mask.sum()) > tensor(81) So would you like to replace all these 81 values in dim1 with the sum of them? Should you advice, how to replace some block of channels with mean values? And perform it independly for each sample in batch. Im not sure how to select indexes over batch and len axis at the same time. For x = torch.rand(32, 1024, 128) def mean_freq_mask(x, p=0.2): if torch.rand(1) < p: x = x.clone() batch_size, length, features = x.size() F = features // 3 mean = x.detach().mean(2) mask_len = (torch.rand(batch_size)*F).long() mask_start = (torch.rand(batch_size)*(features-F)).long() x[mask_start:mask_start+mask_len] = mean.unsqueeze(-1).expand(-1, -1, features)[mask_start:mask_start+mask_len] return x This gives error only integer tensors of a single element can be converted to an index What is the correct way to use this block inside a model class? Let’s say I have the following CNN: cfg = { 'VGG16': [64, 'Dp', 64, 'M', 128, 'Dp', 128, 'M', 256, 'Dp', 256, 'Dp', 256, 'M', 512,'Dp', 512,'Dp', 512, 'M', 512,'Dp', 512,'Dp', 512, 'A', 'Dp'], #dropouts dependent from a single parameter (useful for hyper-par optim.) } class VGG(nn.Module, NetVariables, OrthoInit): def __init__(self, params): self.params = params.copy() nn.Module.__init__(self) NetVariables.__init__(self, self.params) OrthoInit.__init__(self) self.features = self._make_layers(cfg['VGG16']) self.classifier = nn.Linear(512, self.num_classes) self.weights_init() #call the orthogonal initial condition def forward(self, x): outs = {} L2 = self.features(x) outs['l2'] = L2 Out = L2.view(L2.size(0), -1) Out = self.classifier(Out) outs['out'] = Out return outs def _make_layers(self, cfg): layers = [] in_channels = 3 for x in cfg: if x == 'M': layers += [nn.MaxPool2d(kernel_size=2, stride=2)] elif x=='A': layers += [nn.AvgPool2d(kernel_size=2, stride=2)] elif x == 'D3': layers += [nn.Dropout(0.3)] elif x == 'D4': layers += [nn.Dropout(0.4)] elif x == 'D5': layers += [nn.Dropout(0.5)] elif x == 'Dp': layers += [nn.Dropout(self.params['dropout_p'])] else: layers += [nn.Conv2d(in_channels, x, kernel_size=3, padding=1), nn.Tanh() ,nn.GroupNorm(int(x/self.params['group_factor']), x) ] in_channels = x layers += [nn.AvgPool2d(kernel_size=1, stride=1)] return nn.Sequential(*layers) I’d like to substitute the dropout layer with the block you proposed, giving each time I forward the mask as input; how should I do it? If you want to pass the mask as an additional argument to the forward method of your custom Dropout layer, you should write this logic into the forward method of VGG explicitly and remove the usage of the nn.Sequential block as it expects a single input/output in the default implementation. Is there some other way around to keep the code more flexible and clean; in the above solution with nn.Sequential I can easly modify the architecture ‘chain’ of modules directly from cfg dict. Can I do something similar without nn.Sequential? You could try to use an nn.ModuleList or nn.ModuleDict, add the layers using your cfg, and iterate it in the forward method.
https://discuss.pytorch.org/t/how-to-dropout-with-non-zero-value/79561
CC-MAIN-2022-21
refinedweb
1,023
69.68
Implement 3D vector using dunder methods In this tutorial, we will learn how to implement a 3D vector using Dunder methods in Python. First, we will look at what dunder methods are. Next, we look at the basic properties of a 3D vector. Finally, we will implement a 3D vector class with dunder methods in Python. Dunder methods in Python The word ‘dunder’ comes from joining the words ‘double’ and ‘underscore’. Dunder methods are those methods of a class which have names beginning and ending with a double underscore (__). They help us implement certain functionalities to objects of a class that are similar to existing datatypes. Consider this simple example. Although the ‘+’ (binary addition) operator generally refers to the addition of numeric types, Python allows it to be used for the concatenation of strings. This is done with the help of a dunder method called ‘__add__’. Properties of 3D vectors We wish to implement the following simple properties of vectors. - Firstly, we wish to be able to initialise an object with 3 components. We use the ‘__init__’ dunder method to do so. - Next, we wish to represent the vector as some ‘ai + bj + ck‘. We use the ‘__repr__’ dunder method to do this. This helps us to format the way the vector is printed. - We define a function to display the magnitude of the vector. This is not a dunder method. - We implement a method to work with the negative of a vector. We use the ‘__neg__’ dunder method to do so. - For addition and subtraction of vectors, we use the help of the ‘__add__’ and ‘__sub__’ dunder methods. - Multiplication in vectors is a little more complex. We overload the ‘*’ operator to have two meanings. We can use it for scalar multiplication as well as the dot product of two vectors. The dunder methods we use in this regard are ‘__mul__’ and ‘__rmul__’. - Since a vector can also be divided by a scalar, we implement this with the ‘__truediv__’ dunder method. (This is to work with the ‘/’ operator). - Finally, we implement the cross product of 2 vectors. I decided to use the ‘**’ operator as the symbol to denote cross product. The dunder method for this is ‘__pow__’. We require a good understanding of operator overloading in Python to implement this program. Implementation in Python: 3d vector We implement the concepts so far in the following Python code. # We define a class vector to handle vector objects class vector: # For initialising the vector def __init__(self, x_comp = None, y_comp = None, z_comp = None): self.x_comp = x_comp self.y_comp = y_comp self.z_comp = z_comp # Representing the vector # Used to print a valid string def __repr__ (self): return '{}i {} {}j {} {}k'.format(self.x_comp, '+' if self.y_comp >= 0 else '-', abs(self.y_comp), '+' if self.z_comp >= 0 else '-', abs(self.z_comp)) # Magnitude of the vector def mag(self): return ((self.x_comp ** 2 + self.y_comp ** 2 + self.z_comp ** 2) ** 0.5) # Negative of a vector def __neg__(self): return (vector(-self.x_comp, -self.y_comp, -self.z_comp)) # Addition of 2 vectors def __add__(first, second): return (vector(first.x_comp + second.x_comp, first.y_comp + second.y_comp, first.z_comp + second.z_comp)) # Subtraction of 2 vectors def __sub__(first, second): return (vector(first.x_comp - second.x_comp, first.y_comp - second.y_comp, first.z_comp - second.z_comp)) # We use '*' for both scalar multiplication # as well as dot product def __mul__(first, second): if (isinstance(second, (int, float))): return (vector(second * first.x_comp, second * first.y_comp, second * first.z_comp)) else: return (first.x_comp * second.x_comp + first.y_comp * second.y_comp + first.z_comp * second.z_comp) def __rmul__(second, first): return (vector(first * second.x_comp, first * second.y_comp, first * second.z_comp)) # Scalar division def __truediv__(first, second): return vector(first.x_comp / second, first.y_comp / second, first.z_comp / second) # We use '**' for cross product def __pow__(first, second): return vector(first.y_comp * second.z_comp - first.z_comp * second.y_comp, first.z_comp * second.x_comp - first.x_comp * second.z_comp, first.x_comp * second.y_comp - first.y_comp * second.x_comp) if __name__ == "__main__": # Creating a vector and printing it v = vector(-2, 3, -7) print(v) # Print magnitude print(v.mag()) # Negative of the vector print(-v) # Scaling the vector print(v * 4) print(v / 2) # The following line if uncommented, produces an error # print(2 / v) # Addition of two vectors print(v + vector(1, 23, 2)) # Subtraction of two vectors print(v - vector(7, 3, 11)) # Dot product of two vectors print(v * vector(1, 23, 2)) # Cross Product aka Vector Product of two vectors print(v ** vector(5, 2, 4)) Output -2i + 3j - 7k 7.874007874011811 2i - 3j + 7k -8i + 12j - 28k -1.0i + 1.5j - 3.5k -1i + 26j - 5k -9i + 0j - 18k 53 26i - 27j - 19k Conclusion In this tutorial, we learnt about how to implement 3D vectors in Python with the help of Dunder methods. We use the basic principles of operator overloading to achieve this.
https://www.codespeedy.com/implement-3d-vector-using-dunder-methods/
CC-MAIN-2021-43
refinedweb
807
60.01
PRISM, also known as Composite WPF, has established itself as a very popular framework for building modular, scalable Silverlight applications. A newer contender, the Managed Extensibility Framework (MEF), has also grown in popularity. In fact, these two frameworks have left people scratching their heads wondering which one to use, when, how, and why. Please feel free to read the rest of this series, but if you are interested in pairing MVVM with MEF in Silverlight, I strongly recommend you check out my Jounce MVVM with MEF framework for Silverlight. The framework was written from the ground up using the Managed Extensibility Framework and has been used in production line of business applications. Visit the link above to learn more, read the case studies of successful projects that have used the framework, and to download and try out the framework for yourself.. MEF will be packaged with Silverlight 4, and indeed has several preview releases available that will work on Silverlight 3 and 4. PRISM is coming out with newer releases that embrace the MEF framework. In fact, both frameworks work well together and know how to talk to each other's containers. In this series of posts I want to explore some concepts and aspects of solving the Silverlight application problem using both PRISM and MEF. I will use. My primary goal in this short series will be to establish patterns for binding the view model to the view, and to dynamically load views and modules. We'll look at how to do this in the current version of Silverlight 3. It's important to note that future MEF releases may address some of the issues I tackle here and will make some workarounds obsolete, so stay tuned with that. I also want to express my sincere gratitude to Glenn Block (or, if you prefer, @gblock), a key member of the MEF team (and former member of the PRISM team, I believe, as well) for helping me with some of these examples and providing invaluable insights related to the inner workings of MEF. Today we're going to leave MEF to the side and focus on what PRISM and the IoC container that comes with it, Unity, provide. The challenge is something I see discussed quite often, and that is how to meld the view model and the view together. Some people seem to abhor using code-behind at all, so I want to tackle a few solutions to this while also providing my own pragmatic way that, ahem, does use a little bit of code behind (and explain why I really don't care). So, let's get started. We're going to have three main views today. The first will be the outer shell, which binds to a message and a button to dynamically load a second module. The module will have a second view that, in turn, will activate a third view. I am also going to show you three ways to bind your view model to your view using Unity. I will use view models with depedencies because these are the ones that cannot be referenced directly in XAML because the XAML parser doesn't implicitly know how to resolve dependencies. The pattern for establishing a PRISM project is fairly well-established by now. We create a new Silverlight Application, blow away the default user control provided, then make a shell and a bootstrapper class that inherits from UnityBootstrapper. I'll also add a class project called "common" to hold interfaces, base clases, and other services or parts that are used by the entire application. In common, we'll define our service behavior. This could be wired to a "real" service but for now is just a mock one to demonstrate how these various methods work. The service contract looks like this: public interface IService { void GetStuff(Action<List<string>> action); void GetMoreStuff(Action<List<string>> action); } I'm using the method outlined in Simplifying Asynchronous Calls in Silverlight Using Action. We call the service, and send it a method to call back on us with the returned value. In this case, it is just two different lists of strings. I created a separate project "service" to implement the interface. The code is simple, and is also the first place I use a little MEF. I'm simply exporting the service so that if I want to use MEF to import it, I can. Today we'll let Unity wire it up and I'll show you how. The service implementation is straightforward. Again, we'll add some MEF so it's ready when we look into it. In this case, instead of calling a "real" service, I just hit the callback with a pre-determined list of numbers that most will recognize. The second method does the same, only in Spanish. The class looks like this: [Export(typeof(IService))] public class Service : IService { public void GetStuff(Action<List<string>> action) { action(new List<string> { "One", "One", "Two", "Three", "Five", "Eight", "Thirteen" }); } public void GetMoreStuff(Action<List<string>> action) { action(new List<string> { "Uno", "Uno", "Dos", "Tres", "Cinco", "Ocho", "Trece" }); } #endregion }Method 1: Provider So now we can work on our view models. The main shell simply shows a title and exposes a button to click to dynamically load another module. The model looks like this: public class ShellViewModel { const string APPLICATION = "This is the PRISM/MEF project demonstration."; public ShellViewModel(IModuleManager moduleManager) { ModuleCommand = new DelegateCommand<object>(o => { moduleManager.LoadModule("Module"); }); } public ShellViewModel() { } public string Title { get { return APPLICATION; } } public DelegateCommand<object> ModuleCommand { get; set; } } Our problem with instantiating this in XAML is that the XAML parser doesn't understand how to resolve the dependency for IModuleManager. This is needed because I am going to dynamically load another module when you click the button bound to the ModuleCommand. As I mentioned, there are several ways to make the glue and one way is to use a provider. The provider is a base class which has only two purposes. First, it is typed to a class so that multiple view models will generate multiple type instances. We need this so we can have different ways to resolve our classes. Second, it exposes a mechanism to resolve our models. In this way, I'm not tightly coupled to Unity. I recognize that there has to be some external force supplying me with the object to resolve dependencies, but I'll hold off on understanding just what that is. This leaves me with something like this: public abstract class ViewModelProviderBase<T> : INotifyPropertyChanged where T: class { public static Func<T> Resolve { get; set; } public ViewModelProviderBase() { T viewModel = Resolve(); if (viewModel != null) { _viewModel = viewModel; } } private T _viewModel; public T ViewModel { get { return _viewModel; } set { _viewModel = value; OnPropertyChanged("ViewModel"); } } protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion } So what we have is a base class typed to something. It exposes a static method to resolve that something. This is why the generic type works, so we have one method for resolution per type. It holds a reference to "whatever" and exposes it in the ViewModel property, all the while playing nice with the property changed notifications to update any bindings. What does this buy us? Now, to resolve my main view model, I can create a provider like this: public class ShellViewModelProvider : ViewModelProviderBase<ShellViewModel> { } Fairly straightforward, now we have a typed instance. In my bootstrapper or somewhere that "knows" what I've chosen to manage my objects, I can assign the resolver function like this: ShellViewModelProvider.Resolve = Container.Resolve<ShellViewModel>; Now the provider knows how to ask for a new instance of the type, with all dependencies sorted out. Then, in the XAML, we can simply bind the view model with no code behind by pointing to the provider, like this: <UserControl.Resources> <vm:ShellViewModelProvider x: </UserControl.Resources> <Grid x: The resource creates a new instance of the provider. This calls to our resolver (in this case, the Unity container) and returns the view model, then binds it through the exposed ViewModel property. We've achieved a binding without code behind, but it feels a little "artificial." While there wasn't code behind, we did have to do some extra work up front to glue the resolver to the type. Let's try something a little more natural in our dynamic module. Method 2: View Injection To me, this method feels like it makes the most sense. It is able to facilitate giving me objects and resolving dependency trees without the classes really knowing "how" it's done. In the last example, we had a base provider that was a sort of liason and had knowledge of the model and the way the model is resolved. With constructor injection, you simply have a class and are given your concrete instances. You program to the interface, and don't worry about how those interfaces were resolved. It's the pure essence of a Unity pattern where the bootstrapper wires it up, then starts making objects and injecting what they need. To make our dynamically loaded module, we add a new project as a Silverlight Application (this is important, it's added as an application, not as a class library). I called this just "Module." I can add all of the references that the parent project has, then right click and set "copy local" to false. The references will be there when the module is loaded, so doing this lets you code to the references without having a bloated XAP file. Most of the modular XAPs with dynamic PRISM are a few kilobytes as opposed to the 100K+ "main" XAPs that get generated due to this layering and reuse. Set up a module catalog by adding a type of "Silverlight Resource Dictionary" which generates a XAML file with no code behind and a content type of "page." You can change this to extend to the PRISM module namespace and declare your modules, like this (mine is in a subfolder called Modules, and I called the file ModuleCatalog.xaml). <m:ModuleCatalog <m:ModuleInfoGroup <m:ModuleInfo </m:ModuleInfoGroup> </m:ModuleCatalog> Here, I'm giving the module all it needs: a name, the XAP it will load from, and how the assembly and types marry in. PRISM wants the type of the module class to call to initialize everything once the XAP file is loaded. You wire this type of catalog into PRISM by doing this in the bootstrapper: protected override IModuleCatalog GetModuleCatalog() { return ModuleCatalog.CreateFromXaml( new Uri("PRISMMEF;component/Modules/ModuleCatalog.xaml", UriKind.Relative)); } If you don't remember, in the main view model we took in a reference to the module manager and wired a command to do this: moduleManager.LoadModule("Module");. This causes the module manager to look up in the catalog, find the entry, note that it is not yet loaded, then pull in and parse the XAP. This is the dynamic loading. Let's hop over to the dynamically loaded module. This module is going to use the service and bind a list of controls to the first method (the one that returns numbers in English). The view model looks like this: public class StuffViewModel : INotifyPropertyChanged { public StuffViewModel(IService service) { ListOfStuff = new ObservableCollection<string>(); service.GetStuff(stuff => { foreach (string thing in stuff) { ListOfStuff.Add(thing); } }); } private DelegateCommand<object> _dynamicViewCommand; public DelegateCommand<object> DynamicViewCommand { get { return _dynamicViewCommand; } set { _dynamicViewCommand = value; PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs("DynamicViewCommand")); } } } public ObservableCollection<string> ListOfStuff { get; set; } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion } A few things to notice here. First, there is a dependency on the service and when constructed, it will immediately call to the service to get the list of strings. Second, we have a command to dynamically load view (in this case, the view is loaded with the module, so a better term would be dynamically display the view), but we leave the resolution or implementation of the command up to external forces to decide. Back in our Bootstrapper class, I need to tell Unity how to resolve the service. I override ConfigureContainer and give it this code: protected override void ConfigureContainer() { base.ConfigureContainer(); Container.RegisterType&type;IService, Service.Service>(); } Now Unity knows that when I ask for IService, I want Service. In my new module, everything is set up in the ModuleInit. This is the type referenced in the catalog, and also implements IModule. We're going to to do two key things here. First, we'll take in a region manager and register the main view for this module. Second, we're going to tell Unity how to give us the view we'll show dynamically when we ask for it. This happens here: public class ModuleInit : IModule { IRegionManager _regionManager; public ModuleInit(IUnityContainer container, IRegionManager regionManager) { container.RegisterType<UserControl, DynamicView>("DynamicView"); _regionManager = regionManager; } #region IModule Members public void Initialize() { _regionManager.RegisterViewWithRegion("MainRegion", typeof(StuffView)); } #endregion } Don't worry about the DynamicView control just let. We set up Unity to say, "If I want a UserControl, labeled DynamicView, give me the DynamicView type." We could just as easily made the label "foo" and provided the type "bar". The module initializer is a great place to configure the parts of the container specific to that module. The StuffView is what is displayed. You've seen the view model, so let's talk about the view. The XAML looks like this: <Grid x: <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <ListBox ItemsSource="{Binding ListOfStuff}"/> <Button Grid. </Grid> Two columns, one for the list of stuff, and the other a button to show the next view. How do we glue our view model? As I mentioned, this does involve code behind but makes the most sense to me. We take advantage of the way Unity resolves dependencies and code our view like this: public partial class StuffView : UserControl { public StuffView() { InitializeComponent(); } public StuffView(StuffViewModel viewModel, IUnityContainer container) : this() { LayoutRoot.DataContext = viewModel; viewModel.DynamicViewCommand = new DelegateCommand<object>(o => { container.Resolve<IRegionManager>().RegisterViewWithRegion("MainRegion", () => container.Resolve<UserControl>("DynamicView")); }); } } We could do this with properties and attribute them with the Dependency attribute as well. In this case, we reference the view model so it is wired in by Unity with any dependencies. Because we get the container, we're also able to resolve the IRegionManager and tell it to add the dynamic view to the region when the command is executed. Notice that here we are resolving UserControl, which we set up in the module initialization function. The important part is that my view doesn't have to understand how a region manager does what it does or know what the other view is, it simply calls the contract and passes along what the container resolves for us. Of course, that command is not going to do much unless we have the actual view. The dynamic view will share the same view model and show the same list for the sake of simplicity, but I wanted to show another way of wiring the view model to the view. Method 3: Behaviors Again, our challenge is that XAML doesn't know how to resolve dependencies. So, we can use constructors or decorated properties and let Unity wire them in, or create our own constructs that have to be notified about what to do and then supply the needed classes. This method uses an attached property to create the view model and attach it to the view. This time instead of keeping it overly generic, I went ahead and referenced the unity container. The behavior needs to be wired up with the container so it can resolve view models, but the view model type is passed dynamically. The behavior looks like this: public static class ViewModelBehavior { // this is the part I like the least, could abstract it // but this example is long enough already! public static IUnityContainer Container { get; set; } public static DependencyProperty ViewModelProperty = DependencyProperty.RegisterAttached( "ViewModel", typeof(string), typeof(ViewModelBehavior), new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnModelAttached))); public static string GetViewModel(DependencyObject obj) { return obj.GetValue(ViewModelProperty).ToString(); } public static void SetViewModel(DependencyObject obj, string value) { obj.SetValue(ViewModelProperty, value); } public static void OnModelAttached(object sender, DependencyPropertyChangedEventArgs args) { FrameworkElement element = sender as FrameworkElement; if (element != null) { if (args.NewValue is string) { string viewModelContract = args.NewValue.ToString(); if (!string.IsNullOrEmpty(viewModelContract)) { Type type = Type.GetType(viewModelContract); element.DataContext = Container.Resolve(type); } } } } } So what's interesting here is that we have a reference to the unity container, and what happens when the property is attached. It is expecting a fully qualified type passed in a string. We use the Type class to resolve the type, then use the containe to resolve the instance and bind it to the data context of the element that had the behavior attached. This leaves our code-behind clean: public partial class DynamicView : UserControl { public DynamicView() { InitializeComponent(); } } And gives us flexibility to use the behavior to wire in whatever we want in the XAML: <Grid x: <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <TextBlock Text="This list was bound using the behavior."/> <ListBox Grid. Notice the fully qualified view model type on the ListBox, which uses the behavior to resolve and then bind the view model. Wrapping Up What we can do now is show a view with a button that was bound with no code behind and let Unity wire in dependencies. Clicking the button dynamically loads a new module that takes in a service reference, calls the service, and shows items returned from the service. This is wired in and bound in the code behind and uses constructor injection. This new view then displays the list next to a button that adds another view, bound to the same list. All of these scenarios require a bit of work to get where we need to go. Will MEF give us something better? Perhaps. Next post, I will explore why out of the box in Silverlight 3 we can't simply glue pieces together using MEF without digging into the internals and providing some infrastructure. Much of that infrastructure will be out of the box in future versons, but this will help us understand what is going on behind the scenes. We will set up the infrastructure in anticipation of using MEF, then the third and final installment will involve another dynamically loaded module that wires it all together using MEF with a little help from Unity. Stay tuned!. Jeremy, good Prism/MEF/Unity part 1 of 3 article!! I'm very interested in 2 of 3 and 3 of 3. When do you expect to have the next one completed? Have a nice Christmas! Jerry I'll obviously take a break for the holidays, but look for part 2 between Christmas and New Year's, and part 3 shortly thereafter! Thanks for this article. A good one. I'm waiting for the other parts. Thanks. Can't wait for part 2 and 3! only 2 days till new year... ;) Jeremey, great meeting you last night at the Atlanta Silverlight Meetup. I'm reading over this article and others now. It's helping me understanding things more. Be sure to check out. We've not been very active lately, but I hope to get it started again this year. Thanks, Josh Thanks for this. BTW, if you manually edit the SLN file and put the PRISMMEF.Web reference first, it'll automatically be the StartUp project. Not a big deal but might save you a line or two of explanation in your posts. When trying the source code in VS2010 I get the following error when I try and build the solution, error: "ValidateXaml task falied unexpectadly." Any thoughts? Sorry, I wrote earlier that I could not get it to work in VS2010. The prolem was that some of the files referenced were "blocked" by Windows 7 since they were downloaded from the web. Once I changed their properties everything was fine. could you provide valid link to the source code?
http://csharperimage.jeremylikness.com/2009/12/prism-mef-and-mvvm-part-1-of-3-unity.html
CC-MAIN-2015-40
refinedweb
3,344
54.02
Show multiple views for an app Help your users be more productive by letting them view independent parts of your app in separate windows. When you create multiple windows for an app, each window behaves independently. The taskbar shows each window separately. Users can move, resize, show, and hide app windows independently and can switch between app windows as if they were separate apps. Each window operates in its own thread. Important APIs: ApplicationViewSwitcher, CreateNewView When should an app use multiple views? There's a variety of scenarios that can benefit from multiple views. Here are a few examples: - An email app that lets users view a To create separate instances of your app, see Create a multi-instance UWP app. What is a view? An app view is the 1:1 pairing of a thread and a window that the app uses to display content. It's represented by a Windows.ApplicationModel.Core.CoreApplicationView object. Views are managed by the CoreApplication object. You call CoreApplication.CreateNewView to create a CoreApplicationView object. The CoreApplicationView brings together a CoreWindow and a CoreDispatcher (stored in the CoreWindow and Dispatcher properties). You can think of the CoreApplicationView as the object that the Windows Runtime uses to interact with the core Windows system. You typically don’t work directly with the CoreApplicationView. Instead, the Windows Runtime provides the ApplicationView class in the Windows.UI.ViewManagement namespace. This class provides properties, methods, and events that you use when your app interacts with the windowing system. To work with an ApplicationView, call the static ApplicationView.GetForCurrentView method, which gets an ApplicationView instance tied to the current CoreApplicationView’s thread. Likewise, the XAML framework wraps the CoreWindow object in a Windows.UI.XAML.Window object. In a XAML app, you typically interact with the Window object rather than working directly with the CoreWindow. Show a new view While each app layout is unique, we recommend including a "new window" button in a predictable location, such as the top right corner of the content that can be opened in a new window. Also consider including a context menu option to "Open in a new window". Let's look at the steps to create a new view. Here, the new view is launched in response to a button click. private async void Button_Click(object sender, RoutedEventArgs e) { CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0;; }); bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); } To show a new view Call CoreApplication.CreateNewView to create a new window and thread for the view content. CoreApplicationView newView = CoreApplication.CreateNewView(); Track the Id of the new view. You use this to show the view later. You might want to consider building some infrastructure into your app to help with tracking the views you create. See the ViewLifetimeControlclass in the MultipleViews sample for an example. int newViewId = 0; On the new thread, populate the window. You use the CoreDispatcher.RunAsync method to schedule work on the UI thread for the new view. You use a lambda expression to pass a function as an argument to the RunAsync method. The work you do in the lambda function happens on the new view's thread. In XAML, you typically add a Frame to the Window's Content property, then navigate the Frame to a XAML Page where you've defined your app content. For more info, see Peer-to-peer navigation between two pages. After the new Window is populated, you must call the Window's Activate method in order to show the Window later. This work happens on the new view's thread, so the new Window is activated. Finally, get the new view's Id that you use to show the view later. Again, this work is on the new view's thread, so ApplicationView.GetForCurrentView gets the Id of the new view.; }); Show the new view by calling ApplicationViewSwitcher.TryShowAsStandaloneAsync. After you create a new view, you can show it in a new window by calling the ApplicationViewSwitcher.TryShowAsStandaloneAsync method. The viewId parameter for this method is an integer that uniquely identifies each of the views in your app. You retrieve the view Id by using either the ApplicationView.Id property or the ApplicationView.GetApplicationViewIdForWindow method. bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); The main view The first view that’s created when your app starts is called the main view. This view is stored in the CoreApplication.MainView property, and its IsMain property is true. You don’t create this view; it’s created by the app. The main view's thread serves as the manager for the app, and all app activation events are delivered on this thread. If secondary views are open, the main view’s window can be hidden – for example, by clicking the close (x) button in the window title bar - but its thread remains active. Calling Close on the main view’s Window causes an InvalidOperationException to occur. (Use Application.Exit to close your app.) If the main view’s thread is terminated, the app closes. Secondary views Other views, including all views that you create by calling CreateNewView in your app code, are secondary views. Both the main view and secondary views are stored in the CoreApplication.Views collection. Typically, you create secondary views in response to a user action. In some instances, the system creates secondary views for your app. Note You can use the Windows assigned access feature to run an app in kiosk mode. When you do this, the system creates a secondary view to present your app UI above the lock screen. App-created secondary views are not allowed, so if you try to show your own secondary view in kiosk mode, an exception is thrown. Switch from one view to another Consider providing a way for the user to navigate from a secondary window back to its parent window. To do this, use the ApplicationViewSwitcher.SwitchAsync method. You call this method from the thread of the window you're switching from and pass the view ID of the window you're switching to. await ApplicationViewSwitcher.SwitchAsync(viewIdToShow); When you use SwitchAsync, you can choose if you want to close the initial window and remove it from the taskbar by specifying the value of ApplicationViewSwitchingOptions. Do's and don'ts - Do provide a clear entry point to the secondary view by utilizing the "open new window" glyph. - Do communicate the purpose of the secondary view to users. - Do ensure that your app works is fully functional in a single view and users will open a secondary view only for convenience. - Don't rely on the secondary view to provide notifications or other transient visuals.
https://docs.microsoft.com/en-us/windows/uwp/design/layout/show-multiple-views
CC-MAIN-2018-26
refinedweb
1,108
57.87
Marshaling .NET and STL Collections in C++/CLI August 25, 2014 When working with C++/CLI, you often have to convert C++ types to CLR types and vice versa. This most commonly happens with strings, but custom types and collections are just as painful. Visual C++ ships with a marshaling library in the msclr::interop namespace, which focuses on marshaling strings. However, it is notably lacking in the ability to marshal collections -- so you're left to your own devices if you have a std::map<std::string, std::vector<double>> that you need to mash into a .NET Dictionary<string, List<double>>. My wife and I spent a weekend writing a template library that marshals .NET and STL collections.... one comment
https://blogs.microsoft.co.il/sasha/2014/08/
CC-MAIN-2019-35
refinedweb
122
63.8
-Baptiste" == Jean-Baptiste Cazier <Jean-Baptiste.cazier@...> writes: Jean-Baptiste> I do not see the utilitiy of the b variable. Is it Jean-Baptiste> to keep some kind of scheme ? or just a left over Jean-Baptiste> from set_visible ? It's a bug, just use def get_visible(self): "return the artist's visiblity" return self._visible Jean-Baptiste> By the way on which backend is the alpha channel Jean-Baptiste> supported Agg, TkAgg, GTKAgg. Since I know you are a GTK user, I suspect you'll be interested in GTKAgg. It's identical to the GTK backend in terms of the widget set, but the figures are renderer with agg. I know you are interested in object_picker so I might as well deal with that now :-). You have to make a couple of minor changes to object_picker.py to work with GTKAgg. In my apps I import FigureCasvasGTK or FigureCanvasGTKAgg renamed as FigureCanvas, which makes it easy to switch back and forth if you want. import matplotlib matplotlib.use('GTKAgg') from matplotlib.backends.backend_gtk import NavigationToolbar, \ error_msg, colorManager from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas Then create your picker canvas like class PickerCanvas(FigureCanvas): def button_press_event(self, widget, event): width = self.figure.bbox.x.interval() height = self.figure.bbox.y.interval() self.pick(event.x, height-event.y) The rest is OK. JDH S=E6l ! I think there is a bug in the definition of get_visible in the artist.py def get_visible(self, b): "return the artist's visiblity" return self._visible I do not see the utilitiy of the b variable. Is it to keep some kind of sch= eme ? or just a left over from set_visible ? By the way on which backend is the alpha channel supported Takk Kv. Jean-Baptiste --=20 ----------------------------- Jean-Baptiste.Cazier@... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details
https://sourceforge.net/p/matplotlib/mailman/message/5556769/
CC-MAIN-2017-09
refinedweb
353
52.26
Integration of zope.testrunner-style test layers into py.test framework Project description The gocept.pytestlayer distribution Integration of zope.testrunner-style test layers into the py.test framework This package is compatible with Python versions 2.7 and 3.5 - 3.7 including PyPy implementation. (To run its tests successfully you should use at least Python 2.7.4 because of a bug in earlier Python 2.7 versions.) Quick start Make sure your test files follow the conventions of py.test’s test discovery In particular, a file named tests.py will not be recognised. Add a buildout section to create the py.test runner: [buildout] parts += pytest [pytest] recipe = zc.recipe.egg eggs = gocept.pytestlayer pytest <YOUR PACKAGE HERE> gocept.pytestlayer registers itself as a py.test plugin. This way, nothing more is needed to run an existing Zope or Plone test suite. Advanced usage Version 2.1 reintroduced fixture.create() to be able to define the name of the generated to py.test fixtures. So it is possible to use them in function style tests. Example (Code has to be in contest.py!): from .testing import FUNCTIONAL_LAYER import gocept.pytestlayer.fixture globals().update(gocept.pytestlayer.fixture.create( FUNCTIONAL_LAYER, session_fixture_name='functional_session', class_fixture_name='functional_class', function_fixture_name='functional')) This creates three fixtures with the given names and the scopes in the argument name. The session and class fixtures run setUp() and tearDown() of the layer if it has not been run before while the function fixture runs testSetUp() and testTearDown() of the layer. The function fixture depends on the session one. The fixtures return the instance of the layer. So you can use the functional fixture like this: def test_mymodule__my_function__1(functional): assert functional['app'] is not None Not supported use cases - Inheriting from a base class while changing the layer. See issue #5 - Mixing classes inheriting unittest.TestCase and a test_suite() function (e. g. to create a DocTestSuite or a DocFileSuite) in a single module (aka file). - This is a limitation of the py.test test discovery which ignores the doctests in this case. - Solution: Put the classes and test_suite() into different modules. - A doctest.DocFileSuite which does not have a layer is silently skipped. Use the built-in doctest abilities of py.test to run those tests. Developing gocept.pytestlayer Change log for gocept.pytestlayer 6.0 (2018-10-24) - Add support for Python 3.6, 3.7 and PyPy3. - Drop support for Python 3.4. - Fix tests to run with pytest >= 3.9.1. - Release also as universal wheel. - Update to new pytest fixture API to avoid DeprecationWarnings. (#10) 5.1 (2016-12-02) - Make installation process compatible with setuptools >= 30.0. 5.0 (2016-08-23) - Fix tests to pass if pytest >= 3.0 is used for testing. 4.0 (2016-04-27) - Support Python 3.4, 3.5 and PyPy. - Use tox as testrunner. 3.0 (2016-04-14) - Claim compatibility with py.test 2.9.x. - Drop Python 2.6 support. 2.1 (2014-10-22) - Update handling of keywords and doctest testnames for py.test-2.5. [wosc] - Re-introduce gocept.pytestlayer.fixture.create() method, to allow giving created fixtures a non-random name, so other fixtures can depend on them. [tlotze, wosc] - Generate session-scoped fixtures from layers in addition to class-scoped ones, if a session-scoped one is required somewhere, the class-scoped ones are simply ignored. [tlotze, wosc] 2.0 (2013-09-19) - Remove need to explicitely create fixtures. [gotcha] - Add plone.testing.layered test suites support. [gotcha] - Made tests a bit more robust. [icemac] 1.0 (2013-08-28) - Initial release. [tlotze, icemac, gotcha] Project details Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/gocept.pytestlayer/
CC-MAIN-2019-26
refinedweb
628
63.36
Learning Clojure/Reader Macros< Learning Clojure Reader MacrosEdit A reader macro (not to be confused with a regular macro) is a special character sequence which, when encountered by the reader, modifies the reader behavior. Reader macros exist for syntactical concision and convenience. 'foo ; (quote foo) #'foo ; (var foo) @foo ; (clojure.core/deref foo) #^{:ack bar} foo ; (clojure.core/with-meta foo {:ack bar}) ^{:ack bar} foo ; (clojure.core/with-meta foo {:ack bar}) #"regex pattern" ; create a java.util.regex.Pattern from the string (this is done at read time, ; so the evaluator is handed a Pattern, not a form that evaluates into a Pattern) #(foo %2 bar %) ; (fn [a b] (foo b bar a)) The #() syntax is intended for very short functions being passed as arguments. It takes parameters named %, %2, %3, %n ... %&. The most complicated reader macro is syntax-quote, denoted by ` (back-tick). When used on a symbol, syntax-quote is like quote but the symbol is resolved to its fully-qualified name: `meow ; (quote cat/meow) ...assuming we are in the namespace cat Applying syntax-quote to an atomic value expands to that same value. For instance: `10 ; expands to 10 `1/2 ; expands to 1/2 `"hello" ; expands to "hello" When used on a list, vector, or map form, syntax-quote quotes the whole form except, a) all symbols are resolved to their fully-qualified names and, b) components preceded by ~ are unquoted: (defn rabbit [] 3) `(moose ~(rabbit)) ; (quote (cat/moose 3)) ...assume namespace cat (def zebra [1 2 3]) `(moose ~zebra) ; (quote (cat/moose [1 2 3])) Components preceded by ~@ are unquote-spliced: `(moose ~@zebra) ; (quote (cat/moose 1 2 3)). `(x#) ; (x__2804__auto__) For all forms other than Symbols, Lists, Vectors and Maps, `x is the same as 'x. Syntax-quotes can be nested within other syntax-quotes: `(moose ~(squirrel `(whale ~zebra))) For Lists syntax-quote establishes a template of the corresponding data structure. Within the template, unqualified forms behave as if recursively syntax-quoted. `(x1 x2 x3 ... xn) is interpreted to mean (clojure.core/seq (clojure.core/concat |x1| |x2| |x3| ... |xn|)) where the | | are used to indicate a transformation of an xj as follows: - |form| is interpreted as (clojure.core/list `form), which contains a syntax-quoted form that must then be further interpreted. - |~form| is interpreted as (clojure.core/list form). - |~@form| is interpreted as form. If the syntax-quote syntax is nested, the innermost syntax-quoted form is expanded first. This means that if several ~ occur in a row, the leftmost one belongs to the innermost syntax-quote. An important exception is the empty list: `() is interpreted to mean (clojure.core/list) Following the rules above, and assuming that the var a contains 5, an expression such as ``(~~a) would be expanded (behind the curtains) as follows: a))))))))) and then evaluated, producing; (clojure.core/seq (clojure.core/concat (clojure.core/list 5))) Of course the same expression could also be equivalently expanded as (clojure.core/list `list a) which is indeed much easier to read. Clojure employs the former algorithm which is more generally applicable in cases where there is also splicing. The principle is that the result of an expression with syntax-quotes nested to depth k is the same only after k successive evaluations are performed, regardless of the expansion algorithm (Guy Steele). For Vectors, Maps, and Sets we have the following rules: `[x1 x2 x3 ... xn] ; is interpreted as (clojure.core/apply clojure.core/vector `(x1 x2 x3 ... xn)) `{x1 x2 x3 ... xn} ; is interpreted as (clojure.core/apply clojure.core/hash-map `(x1 x2 x3 ... xn)) `#{x1 x2 x3 ... xn} ; is interpreted as (clojure.core/apply clojure.core/hash-set `(x1 x2 x3 ... xn)) Nested Syntax-quotesEdit Syntax-quote is easiest to understand if we define it by saying what a syntax-quoted expression returns. To evaluate a syntax-quoted expression, you remove the syntax-quote and each matching tilde, and replace the expression following each matching tilde with its value. Evaluating an expression that begins with a tilde causes an error. A tilde matches a syntax-quote if there are the same number of tildes as syntax-quotes between them, where b is between a and c if a is prepended to an expression containing b, and b is prepended to an expression containing c. This means that in a well-formed expression the outermost syntax-quote matches the innermost tilde(s). Suppose that x evaluates to user/a, which evaluates to 1; and that y evaluates to user/b, which evaluates to 2. You can prepare that from the REPL as follows: user=> (def x `a) user=> (def y `b) user=> (def a 1) user=> (def b 2) To evaluate the expression ``(w ~x ~~y ) we remove the first syntax-quote and evaluate what follows any matching tilde. The rightmost tilde is the only one that matches the first syntax-quote. If we remove it and replace the expression it's prepended to, y, with its value, we get: `(w ~user/x ~user/b) Notice how x got "resolved" to user/x. Any unqualified symbol gets resolved in Clojure! This differentiates it (for the better) from Common Lisp. In this latter expression, both of the tildes match the syntax-quote, so if we were to evaluate it in turn, we would get: (w user/a 2) A tilde-at (~@) behaves like a tilde, except that the expression it's prepended to must both occur within and return a list or sequence in general. The elements of the returned sequence are then spliced into the containing sequence. So ``( w ~x ~~@(list `a `b)) evaluates to `(w ~user/x ~user/a ~user/b) User-defined Reader MacrosEdit At this time, Clojure does not allow you to define your own reader macros, but this may change in the future.
https://en.m.wikibooks.org/wiki/Learning_Clojure/Reader_Macros
CC-MAIN-2016-44
refinedweb
972
63.39
Are you so happy to already know what memory leaks can do with a browser? Did you learn how to subscribe to document's events to release resources you used in javascript class? If you use ASP.NET AJAX, it gives a couple of good ways of handling scripts that need cleanup operation. What is cleanup? Ok, javascript is not ideal environment to develop large code bases. There is garbage collector for javascript objects, but it has some problem when dealing with some specific situations. Check out this MSDN article by Justin Rogers to learn more. Actually we are not having trouble only with IE. Any browser has specific leaks. This became a big problem in my current project. The project has one main page. And that page is loaded only once ! No refresh, no postback - it stays opened for whole lifecycle of a user session. There are hundreds of controls that are loading later using AJAX. And using this architecture with a lot of client-side logic, memory leaks - if not detected on early stages - can become a real headache later. Another problem is third-party scripts (calendars, sliders, etc.) that are not optimized to be used in AJAX environment, so cleanup after each usage should be very high priority task in such a project. To solve the problem you need to release resources in some stage of page lifecycle in the browser. Normally it is onunload event of the window object. How to write disposable class You don't have to know the name of event in every browser, or how to subscribe to it. We will solve this implementing on client-side IDisposable interface that is defined in ASP.NET AJAX library. Simplest javascript class implementing IDisposable interface looks like this: /// <reference name="MicrosoftAjax.debug.js" /> /// <reference name="MicrosoftAjaxTimer.debug.js" /> /// <reference name="MicrosoftAjaxWebForms.debug.js" /> // Register namespace Type.registerNamespace('MyNamespace'); //constructor MyNamespace.MyClass = function() { // register the object as disposable, so the application will call it's dispose method when needed if(typeof(Sys) !== "undefined")Sys.Application.registerDisposableObject(this); // initialize class level variables from arguments this.MyVar1 = $get(arguments[0]); this.MyVar2 = $get(arguments[1]); // initialize other class level variables and constants this._myCssClassName = "someClass"; }; MyNamespace.MyClass.prototype = { dispose : function() { /// <summary> /// Implements dispose method /// of IDisposable interface, /// cleanup resources here. /// mainly detach events you attached earlier, /// assign nulls to elements that may leak etc... /// </summary> this.MyVar1 = null; this.MyVar2 = null; alert("dispose executed!"); }, myMethod1 : function(param1, param2) { // TODO: implement logic }, myMethod2 : function(param1, param2) { // TODO: implement logic }, myMethod3 : function(param1, param2) { // TODO: implement logic } }; // claim the class is implementing IDisposable if(typeof(Sys) !== "undefined")MyNamespace.MyClass.registerClass('MyNamespace.MyClass', null, Sys.IDisposable); // standard call for non-embedded scripts. if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded(); So the interesting part of the script is: MyNamespace.MyClass.registerClass('MyNamespace.MyClass', null, Sys.IDisposable); with this line we are saying - our object implements IDisposable interface. Other important line is in the constructor of an object: Sys.Application.registerDisposableObject(this); this line registers our object(note - object is an instance of our class!) as disposable object. This way AJAX framework knows that it should call our dispose method when needed. And don't forget to implement "dispose" function itself: dispose : function() {this.MyVar1 = null; this.MyVar2 = null; alert("dispose executed!"); }, Here we made some dummy cleanup - in real application it depends on many factors. most often you will need to remove handlers from DOM elements and assign null-s to some specific variables that are the reason of memory leak. You can read more about registerClass and registerDisposableObject on official ASP.NET AJAX documentation website. That's it - now we can write some small test page to test the script and try to leave the page bypassing dispose method execution(you can do it only by killing a process in a task manager - but in this case you have nothing to cleanup :) ) <%@ Page <html xmlns=""> <head runat="server"> <title>Implementing IDisposable interface</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager <Scripts> <asp:ScriptReference </Scripts> </asp:ScriptManager> <div> <input type="button" value="Do Something" onclick="myObj.myMethod1();" /> <p> Before you try to leave (or refresh) this page, you should see alert saying "dispose executed!". This means AJAX framework called our object to let us cleanup the resources </p> </div> </form> <script type="text/javascript"> var myObj = new MyNamespace.MyClass(); </script> </body> </html> Now if we try to leave the page dispose method is called in our object: You can download the source code, or test it live!
http://blog.devarchive.net/2008/02/implementing-idisposable-interface-in.html
CC-MAIN-2017-26
refinedweb
758
51.24
#include <openssl/rsa.h> RSA *RSA_generate_key(int num, unsigned long e, void (*callback)(int,int,void *), void *cb_arg); RSA_generate_key() generates a key pair and returns it in a newly allo- cated RSA structure. The pseudo-random number generator must be seeded prior to calling RSA_generate: o While a random prime number is generated, it is called as described in BN_generate_prime(3). o When the n-th randomly generated prime is rejected as not suitable for the key, callback(2, n, cb_arg) is called. o When a random p has been found with p-1 relatively prime to e, it is called as callback(3, 0, cb_arg). The process is then repeated for prime q with callback(3, 1, cb_arg). If key generation fails, RSA_generate_key() returns NULL; the error codes can be obtained by ERR_get_error(3). callback(2, x, cb_arg) is used with two different meanings. RSA_generate_key() goes into an infinite loop for illegal input values. ERR_get_error(3), rand(3), rsa(3), RSA_free(3) The cb_arg argument was added in SSLeay 0.9.0. 0.9.8d 2002-09-25 RSA_generate_key(3)
http://www.syzdek.net/~syzdek/docs/man/.shtml/man3/RSA_generate_key.3.html
crawl-003
refinedweb
181
55.74
In linear search algorithm, we compare targeted element with each element of the array. If the element is found then its position is displayed. The worst case time complexity for linear search is O(n). Input: arr[] = { 12, 35, 69, 74, 165, 54} Sea=165 Output: 165 is present at location 5. linear search (Searching algorithm) which is used to find whether a given number is present in an array and if it is present then at what location it occurs. It is also known as sequential search. It is straightforward and works as follows: We keep on comparing each element with the element to search until it is found or the list ends. #include <iostream> using namespace std; int main() { int sea, c, n=6; int arr[] = { 12, 35, 69, 74, 165, 54}; sea=165; for (c = 0; c < n; c++) { if (arr[c] == sea) { printf("%d is present at location %d.\n", search, c+1); break; } } if (c == n) printf("%d isn't present in the array.\n", search); return 0; }
https://www.tutorialspoint.com/c-cplusplus-program-for-linear-search
CC-MAIN-2021-39
refinedweb
173
80.41
I'm working on a project which takes some images from user and then creates a PDF file which contains all of these images. Is there any way or any tool to do this in Python? E.g. to create a PDF file (or eps, ps) from image1 + image 2 + image 3 -> PDF file? Here is my experience after following the hints on this page. pyPDF can't embed images into files. It can only split and merge. (Source: Ctrl+F through its documentation page) Which is great, but not if you have images that are not already embedded in a PDF. pyPDF2 doesn't seem to have any extra documentation on top of pyPDF. ReportLab is very extensive. (Userguide) However, with a bit of Ctrl+F and grepping through its source, I got this: Then try this on Python command line: from reportlab.pdfgen import canvas from reportlab.lib.units import inch, cm c = canvas.Canvas('ex.pdf') c.drawImage('ar.jpg', 0, 0, 10*cm, 10*cm) c.showPage() c.save() All I needed is to get a bunch of images into a PDF, so that I can check how they look and print them. The above is sufficient to achieve that goal. ReportLab is great, but would benefit from including helloworlds like the above prominently in its documentation.
https://pythonpedia.com/en/knowledge-base/2252726/how-to-create-pdf-files-in-python
CC-MAIN-2020-16
refinedweb
221
75.61
WSPutSymbol (C Function) Details - The character string must be terminated with a null byte, corresponding to ∖0 in C. - WSPutSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds. - Use WSError() to retrieve the error code if WSPutSymbol() fails. - WSPutSymbol() is declared in the WSTP header file wstp.h. Examples Basic Examples (1) #include "wstp.h" /* send the expression Integrate[Sin[x],x] to a link */ void f(WSLINK lp) { if(! WSPutFunction(lp, "Integrate", 2)) { /* unable to put the function to lp */ } if(! WSPutFunction(lp, "Sin", 1)) { /* unable to put the function to lp */ } if(! WSPutSymbol(lp, "x")) { /* unable to put the symbol to lp */ } if(! WSPutSymbol(lp, "x")) { /* unable to put the symbol to lp */ } if(! WSEndPacket(lp)) { /* unable to send the end-of-packet indicator to lp */ } if(! WSFlush(lp)) { /* unable to flush any outgoing data buffered in lp */ } }
https://reference.wolfram.com/language/ref/c/WSPutSymbol.html
CC-MAIN-2020-05
refinedweb
148
68.57
postgresql problem linking libpq with c program using gcc 12.04 This code does not link with libpq: i have undefined reference to 'PQconnectdb' i do: gcc -I /usr/include/ libpq.a is in /usr/lib directory size 301928, i have a brand new 12.04 (64 bits) system with postgres 9.1, i have installed package libpq-dev when i do 'nm libpq.a' i can see PQconnectdb symbols, the linker do not see the PDconnectdb symbol in libpq.a i dont understand the problem.. no clue. is it 32/64 bits problem, c/c++ name mangling ? Source code here: #include "libpq-fe.h" int main(int argc, char *argv[]) { PGconn *pgConn = PQconnectdb( if (pgConn != NULL) { printf("Connected to database.\n"); } else { printf("Cannot connect to database.\n"); } } Question information - Language: - English Edit question - Status: - Solved - Assignee: - No assignee Edit question - Solved: - 2012-05-07 - Last query: - 2012-05-07 - Last reply: - 2012-05-04 Thanks Ubfan, that solved my question. Move the -lpq to the end of the line, then it works.
https://answers.launchpad.net/ubuntu/+source/postgresql-8.3/+question/195878
CC-MAIN-2018-13
refinedweb
174
69.07
LaxarJS UiKit Bootstrap 3 compatible base styles for LaxarJS widgets, plus a few i18n-UI helpers This is the home of the default theme for LaxarJS. Based on the SCSS version of Bootstrap 3.3 together with Font Awesome 4.7, it contains only a small number of additional classes. Also, this repository contains a number of JavaScript library functions, which are too UI-specific to be included into LaxarJS core. They are mostly related to formatting and parsing of values (numbers, decimals, dates) in i18n applications. Learn what's in there for you, by consulting the API docs. Of course, the additional JavaScript code will only be bundled as part of your application if it actually imports the laxar-uikit module. What is the default theme? Several types of artifacts in a LaxarJS application may be themed, namely widgets, controls and layouts. The CSS and HTML of such an artifact lives in a subfolder named after each theme that the artifacts support. However, to allow for reuse of artifacts in different applications, all artifacts should support at least the so-called "default theme". For example, if a widget called my-widget supports the default theme and the cube theme, it will use two folders ( my-widget/default.theme and my-widget/cube.theme), and each folder may contain a CSS file and an HTML file for the widget. Although it has a few extra classes (those starting with the ax- prefix), you may think of the default theme as just Bootstrap 3. When creating custom themes, it is recommended to use a Bootstrap-compatible set of classes, so that any widget can be themed without having to create new HTML markup. Usually, only the folder default.theme will contain the widget HTML, and the other theme folders just specify custom CSS when needed. If your application is using a custom theme (such as the cube.theme), not all widgets need to specify custom CSS for that theme, because LaxarJS will always fall back to the default theme of a widget. Refer to the LaxarJS manual on themes for more information on themes. Using LaxarJS UiKit in a project Including LaxarJS UiKit is currently recommended for any LaxarJS application, except if you're aiming to use a non-standard default theme (see below). Starting with LaxarJS v2, obtain the UiKit either by starting from the Yeoman generator or by using NPM: npm install --save laxar-uikit Using the Library To use the parser and formatter library functions, import them into a widget or control: import { formatter } from 'laxar-uikit'; const format = formatter.create( 'decimal', { decimalPlaces: 1 } ); format( Math.PI ); // --> "3.1" Or, if using CommonJS modules: var formatter = require( 'laxar-uikit' ).formatter; // ... And, to use i18n: import { localized } from 'laxar-uikit'; const axI18n = // ... obtained by widget injection, depends on the integration technology const format = localized( axI18n ).formatter.create( 'decimal' ); // assuming the locale is "de" format( Math.PI ); // --> "3,14" Using the default.theme To load the default theme, your loader (webpack) needs to be setup correctly. This is already the case if you project was created using the LaxarJS v2 Yeoman generator. If creating a project from scratch, first make sure you have the dependencies: npm install --save-dev laxar-loader sass-loader Then add a resolve alias and a rule configuration for the default.theme: // webpack.config.js resolve: { // ..., alias: { // ..., 'default.theme': 'laxar-uikit/themes/default.theme' } }, module: { rules: [ // ..., { test: /[/]default[.]theme[/].*[.]s[ac]ss$/, loader: 'sass-loader', options: require( 'laxar-uikit/themes/default.theme/sass-options' ) } ] } When using webpack and the laxar-loader, the default theme will now be available for use in your application (through the init.js): // init.js import { create } from 'laxar'; import artifacts from 'laxar-loader/artifacts?flow=main&theme=default'; create( [ /* ... adapters ... */ ], artifacts, { /* ... configuration ... */ } ) .flow( 'main', document.querySelector( '[data-ax-page]' ) ) .bootstrap(); Using a custom default theme In some cases, your application simply does not work with Bootstrap: For example, if you're working with a legacy code base, your options may be limited. Also, you may be producing a mobile-only application an incompatible CSS-framework such as material design. You can change to a different default theme by creating a module laxar.config.js in your project root, and by setting its default.theme export to the path of your own default theme (which should be a directory named default.theme containing a folder css and a theme.css inside of that). Of course, now you need to make sure that all default.theme folders of your project's artifacts are compatible with you own default theme! Building LaxarJS UiKit from source Instead of using a pre-compiled library within a project, you can also clone this repository: git clone cd laxar-uikit npm install To see changes in your application, configure your project to work with the sources (e.g. by using webpack), or rebuild the bundles: npm run dist To run the automated karma tests: npm test To generate HTML spec runners for opening in your web browser, so that you can e.g. use the browser's developer tools: npm start Now you can run the specs by browsing to.
http://www.laxarjs.org/docs/laxar-uikit-latest/
CC-MAIN-2020-10
refinedweb
862
55.54
On Wednesday, July 10, 2002, at 12:46 , costinm@covalent.net wrote: > > Adding namespace support in ant1 is perfectly possible, as you know. > There is a working PluginHelper in proposals, that works with > ant1.5. > Adding namespace support is not a backward compatible change, though <project name="test" default="test"> <target name="test"> <taskdef name="test:echo" classname="org.apache.tools.ant.taskdefs.Echo"/> <test:echo </target> </project> Of course this is a contrived example but it illustrates just how limiting the backward compatibility requirement really is. So sorry, no namespace support possible. >>. Encapsulation is fundamental and Ant1 does not have it, severely complicating evolution. Nevertheless I do not hope to change your mind. > > Of course, any proposal needs to start by saying that whatever was > before is broken and can never be fixed. I identified what was wrong with Ant1. There is no point proposing a change unless you have issues with the current system. If you think the current system is cool maybe you should hang out on ant-user. Putting all jars in ANT_HOME/lib is not my idea of a good system. > Most revolutions I know > are far for perfect, and some were far worse than what it was > before ( I'm thinking about general history here, not jakarta :-) So, some revolutions are necessary and liberate people from the yoke of tyranny :-) (Not thinking of Ant1, of course) > > I still have to see one real issue that can't be resolved by > the current codebase but can be by a proposal. Sure you can do anything in Ant1. But it is harder than it has to be. Want to build a GUI, sure just pop in your own parsing code. Want to reuse the copy task outside ant, grab project, project helper, etc, etc. Give me polymorphism, run me a task which uses a different XML parser from that used by Ant, etc, etc. For me the question has become whether it is worthwhile continuing to develop Mutant at all. If the broad consensus of the committers is to continue along the Ant1 evolutionary path then lets just say so. There is a lot of committers from whom nothing has been heard on these threads. You don't want a vote but the alternative is limbo. Conor -- To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
http://mail-archives.eu.apache.org/mod_mbox/ant-dev/200207.mbox/%3C20020709154417.JGXT8986.mta03.mail.mel.aone.net.au@localhost%3E
CC-MAIN-2021-10
refinedweb
404
64.91
OData.Feed Syntax OData.Feed(serviceUri as text, optional headers as nullable record, optional options as any) as any About Returns a table of OData feeds offered by an OData service from a uri serviceUri, headers headers. A boolean value specifying whether to use concurrent connections or an optional record parameter, options, may be specified to control the following options: Query: Programmatically add query parameters to the URL without having to worry about escaping. Headers: Specifying this value as a record will supply additional headers to an HTTP request. ExcludedFromCacheKey: Specifying this value as a list will exclude these HTTP header keys from being part of the calculation for caching data. ApiKeyName: If the target site has a notion of an API key, this parameter can be used to specify the name (not the value) of the key parameter that must be used in the URL. The actual key value is provided in the credential. Timeout: Specifying this value as a duration will change the timeout for an HTTP request. The default value is 600 seconds. EnableBatch: A logical (true/false) that sets whether to allow generation of an OData $batch request if the MaxUriLength is exceeded (default is false). MaxUriLength: A number that indicates the max length of an allowed uri sent to an OData service. If exceeded and EnableBatch is true then the request will be made to an OData $batch endpoint, otherwise it will fail (default is 2048). Concurrent: A logical (true/false) when set to true, requests to the service will be made concurrently. When set to false, requests will be made sequentially. When not specified, the value will be determined by the service’s AsynchronousRequestsSupported annotation. If the service does not specify whether AsynchronousRequestsSupported is supported, requests will be made sequentially. ODataVersion: A number (3 or 4) that specifies the OData protocol version to use for this OData service. When not specified, all supported versions will be requested. The service version will be determined by the OData-Version header returned by the service. FunctionOverloads: A logical (true/false) when set to true, function import overloads will be listed in the navigator as separate entries, when set to false, function import overloads will be listed as one union function in the navigator. Default value for V3: false. Default value for V4: true. MoreColumns: A logical (true/false) when set to true, adds a "More Columns" column to each entity feed containing open types and polymorphic types. This will contain the fields not declared in the base type. When false, this field is not present. Defaults to false. IncludeAnnotations: A comma separated list of namespace qualified term names or patterns to include with "*" as a wildcard. By default, none of the annotations are included. IncludeMetadataAnnotations: A comma separated list of namespace qualified term names or patterns to include on metadata document requests, with "*" as a wildcard. By default, includes the same annotations as IncludeAnnotations. OmitValues: Allows the OData service to avoid writing out certain values in responses. If acknowledged, we will infer those values from the omitted fields. Options include: ODataOmitValues.Nulls: Allows the OData service to omit null values. Implementation: Specifies the implementation of the OData connector to use. Valid values are "2.0" or null.
https://docs.microsoft.com/en-us/powerquery-m/odata-feed
CC-MAIN-2020-24
refinedweb
540
56.96
Is there a 128 bit integer in C++? I need to store a 128 bits long UUID in a variable. Is there a 128-bit datatype in C++? I do not need arithmetic operations, I just want to easily store and read the value very fast. A new feature from C++11 would be fine, too. GCC and Clang support __int128 Is there a 128 bit integer in gcc?, Am I doing something wrong or is this a bug in gcc? The problem is in 47942806932686753431 part, not in __uint128_t p . According to gcc docs there's no way� A 128-bit integer type is only ever available on 64-bit targets, so you need to check for availability even if you have already detected a recent GCC version. In theory gcc could support TImode integers on machines where it would take 4x 32-bit registers to hold one, but I don't think there are any cases where it does. Although GCC does provide __int128, it is supported only for targets (processors) which have an integer mode wide enough to hold 128 bits. On a given system, sizeof() intmax_t and uintmax_t determine the maximum value that the compiler and the platform support. Assigning 128 bit integer in C, 6.9 128-bit Integers. As an extension the integer scalar type __int128 is supported for targets which have an integer mode wide enough to hold 128 bits. Simply� A 128-bit type provided by a C compiler can be available in Perl via the Math::Int128 module. A 128-bit register can store 2 128 (over 3.40 × 10 38) different values. The range of integer values that can be stored in 128 bits depends on the integer representation used. #include <boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; int128_t v = 1; This is better than strings and arrays, especially if you need to do arithmetic operations with it. 6.9 128-bit Integers, If there is 128-bit integer type introduce in the C++ standard, what would it be called as a How can I replace/modify a particular string in a file using c++?. Answers: Although GCC does provide __int128, it is supported only for targets (processors) which have an integer mode wide enough to hold 128 bits. On a given system, sizeof () intmax_t and uintmax_t determine the maximum value that the compiler and the platform support. Your question has two parts. 1. 128-bit integer. As suggested by @PatrikBeck boost::multiprecision is good way for really big integers. 2.Variable to store UUID / GUID / CLSID or whatever you call it. In this case boost::multiprecision is not a good idea. You need GUID structure which is designed for that purpose. As cross-platform tag added, you can simply copy that structure to your code and make it like: struct GUID { uint32_t Data1; uint16_t Data2; uint16_t Data3; uint8_t Data4[8]; }; This format is defined by Microsoft because of some inner reasons, you can even simplify it to: struct GUID { uint8_t Data[16]; }; You will get better performance having simple structure rather than object that can handle bunch of different stuff. Anyway you don't need to do math with GUIDS, so you don't need any fancy object. If there is 128-bit integer type introduce in the C++ standard, what , You can write your own 128-Bit support on 32 bit CPU, the reason why it is not implemented is, that on 32 bit CPU there is no assembly opcode� The cairo graphics library has two files which implement portable 128-bit integer arithmetic: cairo-wideint-private.h, cairo-wideint.c. We include just these two in our project to get 128-bits. There is no 128-bit integer in Visual-C++ because the Microsoft calling convention only allows returning of 2 32-bit values in the RAX:EAX pair. The presents a constant headache because when you multiply two integers together with the result is a two-word integer. Most load-and-store machines support working with two CPU word-sized integers but working with 4 requires software hack, so a 32-bit CPU cannot process 128-bit integers and 8-bit and 16-bit CPUs can't do 64-bit integers without a rather costly software hack. 64-bit CPUs can and regularly do work with 128-bit because if you multiply two 64-bit integers you get a 128-bit integer so GCC version 4.6 does support 128-bit integers. This presents a problem with writing portable code because you have to do an ugly hack where you return one 64-bit word in the return register and you pass the other in using a reference. For example, in order to print a floating-point number fast with Grisu we use 128-bit unsigned multiplication as follows: #include <cstdint> #if defined(_MSC_VER) && defined(_M_AMD64) #define USING_VISUAL_CPP_X64 1 #include <intrin.h> #include <intrin0.h> #pragma intrinsic(_umul128) #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define USING_GCC 1 #if defined(__x86_64__) #define COMPILER_SUPPORTS_128_BIT_INTEGERS 1 #endif #endif #if USING_VISUAL_CPP_X64 UI8 h; UI8 l = _umul128(f, rhs_f, &h); if (l & (UI8(1) << 63)) // rounding h++; return TBinary(h, e + rhs_e + 64); #elif USING_GCC UIH p = static_cast<UIH>(f) * static_cast<UIH>(rhs_f); UI8 h = p >> 64; UI8 l = static_cast<UI8>(p); if (l & (UI8(1) << 63)) // rounding h++; return TBinary(h, e + rhs_e + 64); #else const UI8 M32 = 0xFFFFFFFF; const UI8 a = f >> 32; const UI8 b = f & M32; const UI8 c = rhs_f >> 32; const UI8 d = rhs_f & M32; const UI8 ac = a * c; const UI8 bc = b * c; const UI8 ad = a * d; const UI8 bd = b * d; UI8 tmp = (bd >> 32) + (ad & M32) + (bc & M32); tmp += 1U << 31; /// mult_round return TBinary(ac + (ad >> 32) + (bc >> 32) + (tmp >> 32), e + rhs_e + 64); #endif } Why does C only have 128-bit integers on 64-bit CPUs (GCC , This implements 128-bit unsigned integer using C++14. It works on std:: uint64_t is consistently misspelt throughout the code, and may be a poor choice anyway (since an exact 64-bit type need not be provided). It's better to� __m128i is a packed vector of integers elements. SSE/AVX supports packed integer add/sub with element widths from 8b to 64b, but not 128b. Of course, boolean operations with no carry between bits (like AND/OR/XOR) Just Work. 128-bit unsigned integer, This is simple implementation of an unsigned 128 bit integer type in C++. It's meant to be used like a standard uintX_t , except with a larger bit size than those � long double: Real floating-point type, usually mapped to an extended precision floating-point number format. Actual properties unspecified. It can be either x86 extended-precision floating-point format (80 bits, but typically 96 bits or 128 bits in memory with padding bytes), the non-IEEE "double-double" (128 bits), IEEE 754 quadruple-precision floating-point format (128 bits), or the same as calccrypto/uint128_t: C++ unsigned 128 bit integer type, As a non-standard extension, both GCC and Clang provide __uint128_t and __int128_t for emulated 128-bit integer arithmetic in C. The basic� GUID is backed by a 128 bit integer in .NET framework; though it doesn't come with any of the typical integer type methods. I've written a handler for GUID before to treat it as a 128 bit integer, but this was for a company I worked for ~8 years ago. I no longer have access to the source code. 128-bit Integer Arithmetic, SSE2 has native 128-bit math, AVX has 256-bit native integer math, and AVX- 512 has This strikes me as a little nuts for C but it definitely explains this thread. CHAR_BIT 8 Defines the number of bits in a byte. SCHAR_MIN-128 Defines the minimum value for a signed char. SCHAR_MAX +127 Defines the maximum value for a signed char. UCHAR_MAX 255 Defines the maximum value for an unsigned char. CHAR_MIN-128 Defines the minimum value for type char and its value std::bitsetmight be useful. - There's libuuid for linux available BTW. - You're asking two different questions ... a 128-bit datatype doesn't need to be a 128-bit integer. Just use a struct consisting of two 64-bit integers, or any other combination that adds up to 128 bits. - @JimBalter: If a user-defined struct is a standard type, what exactly would qualify as a non-standard type? - Definitely an XY problem. Simply said, a "128 bit integer type" is a "128 bit type with the usual integer arithmetic operators". UUID's do not need arithmetic operators; UUID * 42does not make sense. However, operator==is relevant. - only for 64-bit architectures, though. See gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html - Non 64-bit desktops are very rare and if your arduino would totally ever need 128bits to store a single value that's a different topic. @user3342339 - Is there a preprocessor define such as HAVE_INT_128_Tor something similar we could check? - Upvoted because it points out an issue with the accepted answer. - This isn't quite correct: __int128_tis supported on x86-64 (but not i386). It's implemented in 64bit integer registers using addition-with-carry, and extended-precision code for shifts, multiplies, and so on. (The 128b SSE vector registers aren't useful for anything except boolean (AND/OR/XOR), because they can't do a single 128b add. SSE can do two 64b adds, or multiple smaller elements). - Boost also has a uuid library btw. - @JesseGood I may use that library, but I'd like store the ids in a standard type.
https://thetopsites.net/article/56190314.shtml
CC-MAIN-2021-25
refinedweb
1,602
60.95
from decimal import Decimal '%.2E' % Decimal('40800000000.00000000000000') # returns '4.08E+10' In your '40800000000.00000000000000' there are many more significant zeros that have the same meaning as any other digit. That's why you have to tell explicitly where you want to stop. If you want to remove all trailing zeros automatically, you can try: def format_e(n): a = '%E' % n return a.split('E')[0].rstrip('0').rstrip('.') + 'E' + a.split('E')[1] format_e(Decimal('40800000000.00000000000000')) # '4.08E+10' format_e(Decimal('40000000000.00000000000000')) # '4E+10' format_e(Decimal('40812300000.00000000000000')) # '4.08123E+10' Here's an example using the format() function: >>> "{:.2E}".format(Decimal('40800000000.00000000000000')) '4.08E+10' original format() proposal
https://pythonpedia.com/en/knowledge-base/6913532/display-a-decimal-in-scientific-notation
CC-MAIN-2020-40
refinedweb
114
54.29
From: Bjorn.Karlsson_at_[hidden] Date: 2004-02-24 10:00:36 > From: Peter Dimov [mailto:pdimov_at_[hidden]] > > > You can always shorten it in your code with an alias. > > This is precisely what makes it dangerous. Design mistakes that have a > trivial workaround are the worst, because you will never get > the feedback > that will set you on the right path. Everyone just patches around it > locally. I agree. If a name "works", programmers will use it. If it's too long, it'll be aliased or removed with using declarations/directives. If it's too cryptic, it'll be aliased or removed with using declarations/directives. I think that two equally valid points have been made in this thread: 0) If the name is too long, people won't use it as-is. This diminishes the information that the name carries. 1) If the name is too short/cryptic, people won't even know what it's supposed to mean. If one agrees to the above, it seems reasonable to search for a short name with lots of expressive power (oh yeah, why didn't I think of _that_...). I'd say that for boost::filesystem, Dave's suggestion "files" would be a great compromise. I'd say that for algorithms, a special name isn't actually needed; it doesn't add any information, because anyone who calls sort, trim, hash, or whatever, understands that somewhere an algorithm is involved. boost::, std::, you_name_it::, will get the job done. [Note: Some libraries (Spirit and MPL come to mind) are sexy enough to handle a non-related word/acronym as their name, without sacrificing informational value. Now that's good branding!] > No we do not. The abbrv anlgy is flwd. It's more like English::this > English::kind English::of English::writing versus en::this > en::alternative > en::style. What's "en"? ;-) > > Also a global search is easier if the letters to be searched for are > > more or less a unique set. > > Of course it isn't. Your global search for 'filesystem' will > only find using > directives and namespace alias directives. A global search > for 'fs' will > stand a better chance to point you to the lines that actually > use something > from 'fs'. Good point. Bjorn "Put the bicycle shed next to my office" Karlsson Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2004/02/61645.php
CC-MAIN-2021-25
refinedweb
405
74.9
Schemas are an extremely useful means of checking preconditions on XML documents before processing them. While schema validation normally can't detect every possible violation of an application's constraints, it can often detect a lot of them. However, some schema languages ( especially the W3C XML Schema Language) have a second, less salutary purpose. Although support is mostly experimental so far, the W3C XML Schema specifications indicate that a truly schema-aware parser should produce a post-schema validation information set (PSVI). The concept is that the PSVI includes not only the actual content of the XML document but also annotations about that content from schemas. In particular, it defines types for elements and attributes. Thus you can know, for example, that a Price element has type xsd:double , a CurrentStock element has type xsd:nonNegativeInteger , an expires attribute has type xsd:date , and a Weight element has type xsd:decimal . This sounds good in theory. In practice, the real world is rarely so simple. The types defined in the schema are only occasionally the correct types to be used in the local processing environment. A Price element might be declared as a double. However, to avoid round-off errors when adding and subtracting prices, it might need to be processed as a fixed point type as in Cobol or as an instance of a custom Money class that never has round-off errors. CurrentStock might always be non-negative (that is, greater than or equal to zero), but it might still be represented as a signed int in languages such as Java that don't have unsigned types. An expires attribute may contain a date, but the local database into which the dates are fed might represent dates as an integer containing the number of days since December 1, 1904, or the number of seconds since midnight, December 31, 1969. It might round all dates to the nearest month or the nearest week. It might even convert them to a non-Gregorian calendar. A Weight element might be declared as type xsd:decimal , equivalent to BigDecimal in Java. However, local processing might change it to a double for efficiency of calculation if the local process doesn't need the extra precision or size of the decimal type. It might also need to convert from pounds to kilograms, or ounces to grams, or grams to kilograms. The mere annotation as a decimal is insufficient to truly determine the weight. The fact is schema-defined types just aren't all that useful. XML 1.0 also has a notion of types based purely on element and attribute names . Along with the namespace and the outer context (that is, the parents and ancestors of the element and attribute), this is normally all you need to convert XML into some local structure for further processing. If you can recognize that the CurrentStock element represents the number of boxes sitting in the warehouse, you normally know that it's a non-negative integer, and you know how to handle it in your code. In fact, you can handle it a lot better by understanding that it is the number of boxes sitting in the warehouse than you can merely by knowing that it's a non-negative integer. Look at it this way: It's very rare to assign different types to the same element. What is the chance you'll have a CurrentStock element that is an integer in one place and a string in the next , or any other element for that matter? This does happenfor example, in a medical record, a Duration element might contain minutes when describing the length of a procedure and days, months, and years when describing a preexisting conditionbut normally this indicates that the type is really some broader type that can handle both types, in this case perhaps an ISO 8601 duration that handles everything from years down to fractions of a second. Almost always, knowing the name , namespace, and context of an element is sufficient to deduce its nature and to do this in a far more robust and useful way than merely knowing the type. Adding the schema type really does not provide any new information. The normal response of PSVI proponents is that the type is necessary for documentationthat it serves as some sort of contract between the producer of the data and the consumer of the data. The type tells the eventual recipient that the sender intended a particular element to be treated as a non-negative integer, or a date in the Gregorian calendar, or in some other way. A schema and its types can certainly be useful for documentation purposes. It helps to more unambiguously define what is expected, and like all extra-document context it can be used to inform the development of the process that receives the document. However, the software generally won't dispatch based on the type. It will decide what to do with elements based on the element's name, namespace, position within the document, and sometimes content. The type will most often be ignored. Even more importantly, there is absolutely no guarantee that the type the sender assigns to a particular element is in any way, shape, or form the type the recipient needs or can process. For example, some languages don't have integer types, only decimal types. Thus they might choose to parse an integer as a floating point number. Even more likely, they may choose to treat all numbers as strings or to deserialize data into a custom class or type such as a money object. The idea that each data has a type that can satisfy all possible uses of the data in all environments is a fantasy. Regardless of what type it's assigned, different processes will treat the data differently, as befits their local needs and concerns. Some more recent W3C specifications, especially XPath 2.0, XSLT 2.0, and XQuery, are based on the PSVI, and this has caused no end of problems. The specifications are far more complex and elaborate than they would be if they were based on basic XML 1.0 structures. They impose significant additional costs on implementers, significant enough that several developers who have implemented XPath and XSLT 1.0 have announced they won't be implementing version 2 of the specification. They also impose noticeable performance penalties on users because schema validation becomes a prerequisite for even the simplest transformation. What exactly is bought for this extra cost? Honestly, that's hard to say. It's not clear what, if anything, can be done with XPath 2.0/XSLT 2.0/XQuery as currently designed that couldn't be done with a less typed language. It is possible to search a document for all the elements with type int or for all the attributes with type date , but that's rarely useful without knowing what the int or date represents. Indeed, in the XQuery Use Cases specification (May 2003, working draft), only 12 of 77 examples actually use typed data, and most of those could easily be rewritten to depend on element names rather than element types. Some developers suspect they can use strong typing information to optimize and speed up certain queries, but so far this is no more than a hypothesis without any real evidence to back it up. Indeed, the main purpose of all the static typing seems to be soothing the stomachs of the relational database vendors in the working group who are constitutionally incapable of digesting a dynamically typed language. The PSVI also causes trouble in many of the data binding APIs such as Castor, Zeus, JAXB, and others. Here the problem is a little less explicit. These APIs start with the assumption that they can read a schema to determine the input form of the document and then deserialize it into equivalent local objects. They rely on schema types to determine which local forms the data takes: int, double, BigDecimal, and so on. There are numerous problems with this approach, which are not shared by more type- agnostic processes. More documents don't have schemas than do. Limiting yourself only to documents with schemas cuts way down on what you can usefully process. Documents that have schemas don't always have schemas in the right language. Most data binding APIs such as JAXB are based around the W3C XML Schema Language. Most actual schemas are DTDs. A few tools can handle DTDs, but what do you do when the schema language is RELAX NG or something still more obscure? Documents that do have schemas aren't always valid. Just because some expected content is missing doesn't mean there isn't useful information still in the document. It's even more likely that extra, unexpected content will not get in the way of your processing. However, because most data binding tools take validity as a prerequisite, they throw up their hands in defeat at the first sign of trouble. Type-agnostic processes soldier on. Many data binding tools make assumptions about types, particularly complex types, that simply aren't true of many, perhaps most, XML documents. For instance, they assume order doesn't matter, mixed content doesn't exist, elements aren't repeated (the normalization fallacy), and more. In essence, they're trying to fit XML into object or relational structures rather than building objects or tables around XML. Too often when somebody talks about strong typing in XML, they really mean limiting XML to just a few types they happen to be familiar with that work well in their environment. They aren't considering approaching XML on its own terms. The PSVI is a useful theory for talking about schema languages and what they mean. However, its practice remains to be worked out. For the time being, simple validation is the most you can or should ask of a schema.
https://flylib.com/books/en/1.130.1.93/1/
CC-MAIN-2018-34
refinedweb
1,656
60.14
. Unfortunately... (Score:5, Funny) ...theologians have recently determined that God has a "MicrosoftMode". Watch out for the Blue Screen of Death. Re:Unfortunately... (Score:5, Funny) Re:Unfortunately... (Score:5, Funny) I think the user experience design meeting at MS must have gone something like this... "Listen, we've developed this feature that lets users manage their systems very conveniently. Access to everything from one place." "Wow, that does look good. All in favor of hiding it?" (all, in unison) "Aye!" Re:Unfortunately... (Score:5, Insightful) God bless their souls. I would want Grandma to be atleast 3 clicks away from the desktop from settings such as "Create and Format Hard Disk Partitions". Me? I just put the folder on the desktop as a easy way to tweak my gaming desktop. Re:Unfortunately... (Score:4, Interesting) A few years back, I had my (~80) mother set up with a PC running a fairly well locked down Linux setup. It was set up with icewm, and she had menu items for email, (thunderbird) solitaire, (pysol) and a few others. Basically I tailored is specifically to her needs. The mail was kept on a local imap server, and thunderbird connected to it. That way if she did something really weird to thunderbird and made it crash, her mail would be safe in server-space. I did most of what I could to grandma-proof the system. Somehow she kept changing the theme on icewm. I don't know how... For the particular theme she kept getting, you have to be 4 clicks into a menu tree. But she did, and I'd ssh into her machine and tweak things back the way they belonged, from a spare copy. At one point I marked a bunch of her files as read-only, but some software sees that, sees that she owns the file, and "kindly" changed it back to read-write and made the bogus update. I kept wanting to change things so she didn't even own her own configuration files - they would belong to someone else, and she would have group-level read permission. Never had the chance to do it - testing was the hard part - I'd have to be there for that, and when we were there we had more important things to do that spend a lot of time on the computer. Re: (Score:3, Funny) So what you are basically saying is that seniors are very efficient at finding Linux bugs? Looks like a good opportunity for crowdsourcing if you ask me... Re: (Score:3, Funny) Re: (Score:3, Informative) Noah's already experienced it but God gave us a new colorful interface element and promised it'll never happen again. So that explains the Apple "Beachball of Death" :-) The beachball (pinwheel, etc.) is the equivalent of the Windows hourglass, *not* the equivalent of the BSoD. Apple's BSoD is the kernel panic, just like any other self-respecting Unix. Re:Another way to trigger god mode (Score:4, Interesting) Open up a command line and type IDDQD, press enter, and see what happens. ...or not You know, suddenly I have an urge to add a "sudo" alias called "iddqd"... Re:Another way to trigger god mode (Score:4, Funny) Re: (Score:3, Funny) "women still bleed for no freakin' reason" ... the occasion you seem to be referring to is NOT bleeding as you know it at all, it's a monthly cycle of cleaning and renewal. And although it is painful, and ugly, a lot of women still see the menstrual cycle as the gift it is - the ability to create a miracle. As for all the other stuff about God vs. Lucifer - you're correct, "He's an absentee landlord! Worship that? Never!" At least I know where I stand with the devil, well, I tend to kneel, actually... (use yo Re:Unfortunately... (Score:4, Funny) .... oh shit [google.com]. Re: (Score:2) It's the WTOL* not the BSOD and is already quite famous. * White Tunnel of Light Re:Unfortunately... (Score:5, Funny) That would explain why he freaked so much about his users interfacing with that Apple a while back... Direct Copy article (Score:5, Insightful) 2) More importantly, from the article, I inferred these god mode settings were just (basically) command lines to initiate control panel activities? Not a big deal if that is the case. It is shortcuts of a way I guess. Or is there something more to this? Re:Direct Copy article... i.e. PLAGIARISM (Score:5, Informative) I guess Slashdot is now advocating outright plagiarism by giving it the eyeballs instead of what it rips-off? Do I get three guesses who the "anonymous reader" was that submitted the summary text? Re:Direct Copy article... i.e. PLAGIARISM (Score:5, Funny) You do indeed. Go ahead and post them and then I'll copy what you wrote and post it too - it makes it better, apparently. Re: (Score:3, Insightful) There's imaginary property, and then there's ethics and general courtesy. The former is not a prerequisite for the latter... or at least it damned well shouldn't be. Re: (Score:2) Re:Direct Copy article (Score:5, Interesting) Check the datestamps. Cnet's article was posted the day before. Re:Direct Copy article (Score:5, Informative) These folders are a bit more than mere shortcuts. They expose the contents of the corresponding folder to anything using the proper APIs to examine it. One of the canonical uses is to create a folder named "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" in the path used for start menu entries, which results in a start menu folder that contains all the control panel icons, allowing you to directly select one of them. This feature is not really as useful in Vista or Windows 7 (with the nice program finding box), but was quite useful before then. Whooo!!! Its God on my Windows Computer w00t l33t (Score:5, Informative) What to find all these God Modes? Just go to your registry and navigate to HKEY_CLASSES_ROOT\CLSID and search for "System.ApplicationName". Every GUID listed under CLSID with a System.ApplicationName entry can be used to do this same thing. While you are at it, delete the key. There. That should help. Why not link to the real article? (Score:5, Informative) Identical to the summary link, except from the actual source. Re: (Score:2) Not quite ... the summary calls him "teven Sinofsky" ... It's not like anyone proofreads here. Not when the average reader doesn't know the difference between rain/rein/reign, or break/brake, or lose/loose. Re: (Score:3, Informative) I don't get it.... (Score:5, Insightful). Re:I don't get it.... (Score:5, Insightful) "In other words, what's wrong with the Control Panel interface that hinders developers to the point where they have to hack in these types of kludges?" You don't use Windows, hey? My thought when I read the article was similar. If your developers are making themselves obscure shortcuts, you might want to have your UI team rethink their design. Re:I don't get it.... (Score:5, Insightful) well that's why they're developers, not users. Your developers need to see stuff in the OS on a more regular basis than the average user. Finding connected hardware ID strings, even as a guy getting a PhD in computer science isn't exactly top of my priority list. If you look at the godmode everyone was playing with it's not exactly insightful. It's just a list, sorted alphabetically by type of task, of menus. Useful if you're changing stuff for the sake of changing stuff (say the first time you set up your computer or if you're testing), but there's no obvious logical connection between my folder display settings, my windows defender settings and my 'location and other sensors' options. It's handy to have if you want to see a list of a lot of stuff you can do, but not really very functional. If anything they don't really belong together unless you're doing stuff with the operating system that is very different than your average user, like say, trying to test the functionality of all this stuff, in order. Admittedly control panel isn't a great implementation, I think MS is still grappling with which direction to take your system settings, either the sort of godmode exhaustive list, which IMO is far too confusing for the average user (albeit alphabetical at least), and the task dependent options where you only see your folders settings options if you're messing with folders, mouse settings with mouse software etc. In the end they've settled on an ugly hybrid of the two, but I think that covers all bases better than the alternatives. Re:I don't get it.... (Score:5, Interesting) I guess the more relevant factor is not that the developers created all kinds of shortcuts for themselves, but that a subset of the users found them and think they're really useful. As you point out, that doesn't necessarily mean your design is bad, but it's a pretty good indication that you might want to consider the possibility. Personally I think Windows has gone way too far with the wizards. I was trying to connect to a shared printer the other day and kept going in circles, bouncing from wizard to wizard. Things like the TCP/IP settings and wireless connection wizard seem to keep popping up when you're trying to use Network Neighborhood, which has always seemed to be broken, and manually connecting only works if you know the address AND share name. Re: (Score:2) If your developers are making themselves obscure shortcuts, you might want to have your UI team rethink their design. Unfortunately, it seems they do, since with every "upgrade" of their OS and apps you have to relearn the thing all over again. More unfortunately, they're just not very good at UI or they wouldn't have to. Re:I don't get it.... (Score:4, Interesting) This has always been the case and is nothing new. This was already possible on 2k/XP and was actually abused by hackers like this: 1) Create directory and add a string that makes it look like the recycle bin (the folder will actually link to the recycle bin when clicked on by the user that tries to view the map and take on the same icon). 2) In that dir put whatever you want to be hidden from the operators of said computer 3) ??? 4) Profit Re:I don't get it.... (Score:5, Informative) Hmm. I just went for a stumble through the Win XP registry... Some other types that hide their contents, and what opens when you double-click them (not sure if they’ll work on other versions of Windows): {E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31} - Compressed folder access denied error message {21EC2020-3AEA-1069-A2DD-08002B30309D} - Control Panel {2559a1f5-21d7-11d4-bdaf-00c04f60b9f0} - Default e-mail client {2559a1f4-21d7-11d4-bdaf-00c04f60b9f0} - Default web browser {0CD7A5C0-9F37-11CE-AE65-08002B2E1262} - Folder, but seems empty {63da6ec0-2e98-11cf-8d82-444553540000} - FTP folder {871C5380-42A0-1069-A2EA-08002B30309D} - IE with extensions disabled {20D04FE0-3AEA-1069-A2D8-08002B30309D} - My Computer {208D2C60-3AEA-1069-A2D7-08002B30309D} - My Network Places {7007ACC7-3202-11D1-AAD2-00805FC1270E} - Network connections {992CFFA0-F557-101A-88EC-00DD010CCC48} - Network connections {9DB7A13C-F208-4981-8353-73CC61AE2783} - Nothing {C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1} - Nothing {AFDB1F70-2A4C-11d2-9039-00C04F8EEB3E} - Offline files folder {2227A280-3AEA-1069-A2DE-08002B30309D} - Printers and Faxes {645FF040-5081-101B-9F08-00AA002F954E} - Recycle bin {E211B736-43FD-11D1-9EFB-0000F8757FCD} - Scanners and cameras {FB0C9C8A-6C50-11D1-9F1D-0000F8757FCD} - Scanners and cameras {D6277990-4C6A-11CF-8D87-00AA0060F5BF} - Scheduled tasks {1f4de370-d627-11d1-ba4f-00a0c91eedba} - Search results folder {e17d4fc0-5564-11d1-83f2-00a0c90dc849} - Search results folder {F5175861-2688-11d0-9C5E-00AA00A45957} - Subscription folder {BDEADF00-C265-11d0-BCED-00A0C90AB50F} - Web folders Re: (Score:2) having more than one way to do something can have a variety of benefits: 1) power users can take a faster path to the action and avoid confirmation dialogues when they know what they're doing. Terminal/console windows are great examples. 2) there's often two or more "intuitive" places for something to be. instead of picking one, put it in both places and it becomes a tad easier for 50% of the population to use. Is sleep after so long in screensaver a screensaver feature or an energysaver feature? Give acc Re: (Score:2) In other words, what's wrong with the Control Panel interface that hinders developers to the point where they have to hack in these types of kludges? Is the Control Panel accessible via the CLI? That would be a reason. Still an awful way to provide CLI access to these functions. Re: (Score:2) This isn't a special way to access the Control Panel for developers because there is some sort of problem with the new layout. Rather, this is part of a more general feature for developers to create and display namespaces within Windows. Microsoft simply used the same method for managing the Control Panels applets that it suggests its developers use for their own applications. Now, the article points out there is a way users can exploit this feature to get the Control Panel applets listed discretely without a Re: (Score:3, Informative) “Basically, this” is synonymous for “what he said”. My use of it had nothing to do with the “this” reference in programming. Calm down. Yes, I repeated what he said, but I also said it in such a way that most people aren’t going to say “huh?” when they read it. Re: (Score:2). I think 'developers' in that context meant Microsoft Developers who develop Windows and possibly testers of the OS. They would need it to quickly test something instead of going through an additional step. And no, it's not a kludge, atleast it wasn't created for the GodMode features. Control Panel items have been 'special' folders internally with those 'special strings' internally ever since atleast Windows 95.. All it does is call a COM component with that Class ID as a GUID which populates the folder with Re: (Score:2) It takes a lot less time to type a dozen characters into a box/console than it does to click through a half dozen menus and panel interfaces to get where you're going. Re: (Score:2) I'm not totally certain what this is, but I already make shortcuts to commonly used Control Panel items and put them where ever I like. I've done it on Windows 2000. Display properties, network configuration mouse settings are the three that I use most, it saves me a couple clicks. Re: (Score:2) This is obviously how the control panel and other special folders are implemented in the first place. Not a short cut. Put in the right code & you'll get the regular control panel directory. Re: (Score:2) We create shortcuts to the places we need to go often. The average user doesn't go the same places the devs or support guys do, most likely. Re: (Score:2) Re: (Score:2) Yeah, if you wanted to formalize something like this why not add a system call that accepts a GUID and a void* and then if the GUID is a 'special' one then it forwards to the internal code to interpret the void* argument and do random stuff? Why tie it in with the filesystem and string parsing at all? Re: (Score:2) The developers need it because the settings exist before the control panels that manipulate them. Totally different teams of people are involved in kernel/infrastructure coding as opposed to UI/HMI. The "special strings" are a general feature used since Windows 95 to make things appear in the file system that don't actually reside on the disk, including printers and the standard control panel. Re: (Score:3, Insightful) You mean besides the fact that it's been completely rearranged and the various bits renamed and specific settings moved from place to place so many times nobody can find anything? It took me three minutes playing around in the Windows Seven control panel just to figure out how to change the TCP/IP settings. They're in a different place from Vista, where they were in a different place from XP, which in turn put them in a different plac The real question is... (Score:5, Funny) Does Windows 7 have Quad Damage? Re:The real question is... (Score:4, Funny) Only if you dual wield dual core processors... Re: (Score:3, Funny) Only if you dual wield dual core processors... I prefer to equip my quad core offhand and lay about me like a madman with a USB cable... but to each his own. Using this for evil (Score:4, Interesting) Reading the article, seems that this crash 64 bits versions of Windows 7/Vista. It could be a good idea to create folders like that, inside zip files, and send that zip file to people with these OS versions. Or maybe create folders in USB pendrives with that name, to protect these drives from be view in a 64 bits Windows 7. etc. Some thoughts (Score:5, Informative) Firstly, it's just a trick involving the GUID that points to a shell folder - all of which is documented on MSDN. Ed Bott also concurs in his blog post [edbott.com]. Secondly, Vista had this too although it was then called "Master Control". Same thing so it's not exactly new. Thirdly, it's doesn't offer you anything more than you would normally find in the Control Panel. Yes, it is all in one place but I can't be the only one that just types a couple of letters into the Start Menu to find the option I want. Fourthly, the list of them are as follows: Enjoy. Re: (Score:2) Slashdot God{aa29f560-cc37-11cf-bff4-4449932ba000} (Score:2) Nope, didn't work :( 'GodMode' strings do the following: (Score:2, Informative) woog.{00C6D95F-329C-409a-81D7-C46C66EA7F33} -enter a default location for gps and other location aware programs woog.{0142e4d0-fb7a-11dc-ba4a-000ffe7ab428} -biometric devices control woog.{025A5937-A6BE-4686-A844-36FE4BEC8B6D} -power plan management woog.{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} -taskbar icons and notifications woog.{1206F5F1-0569-412C-8FEC-3204630DFB70} -windows credential manager woog.{15eae92e-f17a Linked article is plagiarism (Score:5, Informative) Re: (Score:2) Mod Parent up (hopefully the /. editors will notice this and correct the link to the actual author). We've had these since Win95 (Score:2, Informative) These have existed since Win95. I remember in Win95 using these tricks to put a Control Panel and Dial-Up Networking shortcuts on my Start Bar that expanded out just like later became in option in I think 98 or XP. I haven't done this in years, but I do recall that in '95, you could find all the correct values to use for these "tricks" by searching RegEdit. False prophet (Score:2) "God Mode?" (Score:2) Didn't we just used to call these "back doors?" Maybe I'm missing the point. -- Toro This is not news. It is well documented. (Score:5, Informative) Stuck in Satan-mode (Score:3, Funny) Re:Those strings can't be right (Score:5, Insightful) Re:Those strings can't be right (Score:5, Funny) Using that will doom you :) Re:Those strings can't be right (Score:5, Funny) Re: (Score:2, Interesting) IDDQD was good, but was much better teamed up with IDKFA. IDSPISPOPD was fun for a while, but I really only used it to find the easter eggs in Doom2. Re: (Score:2) I just did "bind q impulse 255", never needed a god mode. Re: (Score:2) Oh yeah, and I think I may be the only student to use Doom for my Geometry project in high school. That was fun. I built a castle that used geometric shapes we were covering in class... Not that hard to do but my teacher thought it was cool, haha. Oh, early nineties how I miss thee, it was a simp Re: (Score:2) Re: (Score:2) IDSPISPOPD Despite not knowing what it stood for until checking it just now. Re: (Score:2) Smashing Pumpkins Into Small Piles Of Putrid Debris Re: (Score:2) "Your memory serves you well" Re:Those strings can't be right (Score:5, Informative) "On the eighth day god created turok" without vowels. Not that hard to remember. Re: (Score:3, Funny) Re: (Score:3, Interesting) NTHGTHDGDCRTDTRK On the eight day god created Turok. All the other cheats have meaning too. Some have evaded me for all these years... All Weapons CMGTSMMGGTS Come get some, maggots. Big Heads GSHNTTBNCTPRDCRD ??? Dana Mode DNCHN Dana Chan. Disco Mode SNFFRR Saturday Night Fever forever. Fancy Colors LLTHCLRSFTHRNB All the colors of the rainbow. Fly Mode LKMBRD Look, I'm a bird! Greg Mode GRGCHN Greg Chan. Infinite Lives FRTHSTHTTRLSCK For those that truly suck. Pen and Ink Mode DLKTDR Do you like to draw? Quack Mode CLLTHTNMTN You call that animation Re:Undocumented features! (Score:5, Informative) The "God Mode" is just a different view for the many things available in the control panel. There is such a thing as overdocumenting your software, this is rather an easter egg that happens to be very handy. Re:Undocumented features! (Score:5, Informative) Re: (Score:2) All these stupid articles are simply fanboys trying to get clicks on their sites Well, this one may be; it's firewalled off at work. But Google shows me a lot of FAs on the subject so I RTF C|NET A. Computerworld and a host of other larger sites also covered it. Re:Undocumented features! (Score:5, Informative) Covered it exactly. TFA is just plagiarized from cnet [cnet.com]. Re:Undocumented features! (Score:4, Interesting) The original "God Mode" one isn't in that list. And, this doesn't say anything about creating folders with the canonical name as the extension. It's an interesting hack. Re: (Score:3, Informative) It is meant for developers, and was documented in the Microsoft Developer Network documentation, of which you must be a subscriber to get. In other words, Microsoft told the people who they cared to tell about it via their well known documentation system, and dumbass bloggers found it and said "Oh oh! Undocumented features!" Tell me, how the hell can it be "undocumented" if Microsoft was the one who revealed it in their standard documentation system in the first place? Dumbasses. Re: (Score:2) Ummm... What do you mean by "undocumented"? [microsoft.com] All these stupid articles are simply fanboys trying to get clicks on their sites. This is old news. Move along. All are on the linked MSDN article except {ED7BA470-8E54-465E-825C-99712043E01C} This is the undocumented Master Control Panel showing all the "Hidden" options that do not appear on the regular control panel..... Documentation on this would be nice? Re:Undocumented features! (Score:4, Insightful) And all the stupid posts like the GP are simply anti-M$ zealots that are just trying to get karma points. (Seeing how it is at +4 insightful right now shows how successful they are at gaming the moderator system). Oh, wah, popular sentiments get modded up! I'm gonna tell! Re: (Score:2) Why don't you document everything and release it at the same time as the software? It's odd that as their OSes became more complex, they also had less and less documentation. The IBM XT came with fat books that completely explained line commands, interrupts, and all sorts of other goodies. Now you get a skinny booklet geared to a 5th grade reader. Re: (Score:2) You have to consider the userbase too. It became steadily non-technical and only the technically inclined would even open the manual. Just like car manuals, TV manuals, etc. Not to mention the growth of the internet which made it easy to get up-to-date documents with a click. Printing out the whole of MSDN(which will outdated quick) into telephone directory sized books and distributing it with every computer is a colossal waste of rainforest. Re:Undocumented features! (Score:5, Informative) It's odd that as their OSes became more complex, they also had less and less documentation. This is not even remotely true. I have in my drawer a large DVD case filled with MSDN documentation on primarily Microsoft OS and Server products. I get a new disk every couple of months. This is the Microsoft documentation, and it is vast. In fact, if it were on paper, I'd probably need an entire library dedicated to it. In other words, you don't know what you are talking about. There is, in fact, so much documentation that it can be difficult to find exactly what you need in the MSDN library. The documentation isn't meant for end users, Microsoft designs their OS to be as easy as they can manage to make it for the user at the expense of making things more difficult for the developer. As such, all of the documentation is for developers, not users, because it is the developers who need it. Getting the full documentation requires a subscription, but there is a lot online at [msdn.microsoft.com] Re: (Score:3, Informative) All the MSDN library stuff is free and on-line. See this [msdn.com]. Has been for years. There is nothing like this for Apple, Linux, or any other OS - not even close. Re: (Score:2) This feature is deocumented. Take a look at the tips.txt file from Windows 95: [microsoft.com] That file first describes these magical folders. I will admit that it does not clearly document that other items can be created by using their GUID, but I suspect someplace they have documented that. I will note the "All Tasks" GUID is undocumented (a search of msdn.microsoft.com, and the whole of microsoft.com confirms this, since the GUID only comes up in user posted content), with the excep Re: (Score:2) Wrong. MS didn't write DOS - they bought it. [patersontech.com]. $10k for the right to sell it, + $15k for the sale of an OEM license to ... IBM. Total: $25k. Lawsuits eventually drove the final price to $1M. Considering that Microsoft made tens of billions in profit (not revenue - profit) off dos, ... Re:How about a not-suck mode? (Score:5, Informative)? Windows-L. How about being able to edit the parameters of something you've "pinned to the taskbar"? Right click the icon. The top item in the popup list is a shortcut, so you can right click and select 'properties' (like any shortcut) and modify the parameters. Whats up with this whole "Library" thing? What is wrong with "My Documents" Library may refer to multiple folder locations. Got music in two separate locations (like a portable drive a local one)? Now it's all accessible from one place. Thank God at least they put your whole user profile in the c:\users\ directory - wait, do they, or is user crap still sprinkled around in c:\program files\blah All of the microsoft stuff is there, but I suppose there's nothing stopping a program from not using it (UAC perhaps would complain about an app trying to create files in Program Files). Re:How about a not-suck mode? (Score:5, Informative) Re: (Score:2)? Winkey-L locks your screen, no waiting, no confirmations. Whats up with this whole "Library" thing? What is wrong with "My Documents" Libraries allow you to add other folders (e.g. public photo or music folders) and have their contents appear alongs Re: (Score:2) Whats up with this whole "Library" thing? What is wrong with "My Documents" The problem with "My Documents" is that it (and the rest of one's home folder, i.e. C:\Users\Foo) only open for read to the user who owns it. Which is as it should be, of course, but when you have multiple user accounts, you do sometimes (quite often, in fact) want certain documents shared between users. Now, there was a folder for "All Users", which did just that, since... er... NT I believe? 2K and above had it for sure. The problem is that few people actually knew it was there and used it. The idea of libr Re: (Score:2) How about hitting your Windows Key along with the L key to instantly lock your workstation without question? How about holding shift and right clicking the pinned item to get access to the properties link? What's up with having My Music, My Photos, and My Videos INSIDE My Documents? I'd rather have a Libraries folder with Documents/Music/Photos separated properly... The Users folder does contain your full profile, but really, what are you going to do with it even if it wasn't? All of these answers exis Re: (Score:2) Unix existed when MS wrote and sold DOS. McDonalds' $0.99 turds-in-a-box are a relatively new concept too. Instant gratification at any cost is what sells these days. Re: (Score:2) How about a mode where I can hit Ctrl-Alt-Del and hit Enter, and have it lock my screen Windows key + L will do that. How about being able to edit the parameters of something you've "pinned to the taskbar"? To quote the late Lilly Tomlin's "Ernestine" character, "we're the phone company. We don't HAVE to." What is wrong with "My Documents" The "my computer" and "my documents" and the "my this" and "my that" has irked me ever since they implimented it. How about letting me make my own directories and name them wh Re: (Score:2) That last remark of you was totally useless and unrelated. Quite true. Microsoft was more practical, sacrificing correctness for ship dates. On the other end of the spectrum we have GNU/Hurd, which might be never finished because it is too ideological and ambitious. But if finished, would it be the Holy Grail of computing? Doubtful at best. MS always was more practical and it's blind focus on backwards compatibility and shipping products quickly was one of the big reasons it succeeded, at the cost of bloat and kludges .When Vista broke the trend and cleaned up a lo Re: (Score:2) [microsoft.com] godmode isn't needed, that's just the name of the folder (Cnet named thiers thankscnet). Also, that so-called 'godmode' folder probably isn't documented because it's broken on x64. Re: (Score:2) I think they're referring to Microsoft developers developing the OS, not other developers developing for the OS. Re: (Score:3, Informative) Why would it be intuitive? I don't think MS intended for people to be using it, which is why it doesn't come with an install icon. Unless you meant you don't understand how to enable it, in which case I suggest you read the article more carefully. Re:Liars (Score:4, Informative) I did the following to recover from my crash: Press Ctrl-Alt-Del Load the task manager Run cmd Rename "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" to "folder" Then I can delete "folder" in Explorer as it no longer crashes Re: (Score:3, Informative)
https://tech.slashdot.org/story/10/01/07/1437234/windows-7-has-lots-of-god-modes?sdsrc=nextbtmnext
CC-MAIN-2017-13
refinedweb
5,290
64.1
SSL This is a guide to setting up SSL using the C/C++ driver. This guide will use self-signed certificates, but most steps will be similar for certificates generated by a certificate authority (CA). The first step is to generate a public and private key pair for all Cassandra nodes and configure them to use the generated certificate. Some notes on this guide: - Keystore and truststore might be used interchangeably. These can and often times are the same file. This guide uses the same file for both (keystore.jks) The difference is keystores generally hold private keys and truststores hold public keys/certificate chains. - Angle bracket fields (e.g. <field>) in examples need to be replaced with values specific to your environment. - keytool is an application included with Java 6+ SSL can be rather cumbersome to setup; if assistance is required please use the mailing list or #datastax-drivers on irc.freenode.net <> for help. Generating the Cassandra Public and Private Keys The most secure method of setting up SSL is to verify that DNS or IP address used to connect to the server matches identity information found in the SSL certificate. This helps to prevent man-in-the-middle attacks. Cassandra uses IP addresses internally so that’s the only supported information for identity verification. That means that the IP address of the Cassandra server where the certficate is installed needs to be present in either the certficate’s common name (CN) or one of its subject alternative names (SANs). It’s possible to create the certficate without either, but then it will not be possible to verify the server’s identity. Although this is not as secure, it eases the deployment of SSL by allowing the same certficate to be deployed across the entire Cassandra cluster. To generate a public/private key pair with the IP address in the CN field use the following: keytool -genkeypair -noprompt -keyalg RSA -validity 36500 \ -alias node \ -keystore keystore.jks \ -storepass <keystore password> \ -keypass <key password> \ -dname "CN=<IP address goes here>, OU=Drivers and Tools, O=DataStax Inc., L=Santa Clara, ST=California, C=US" If SAN is preferred use this command: keytool -genkeypair -noprompt -keyalg RSA -validity 36500 \ -alias node \ -keystore keystore.jks \ -storepass <keystore password> \ -keypass <key password> \ -ext SAN="<IP address goes here>" \ -dname "CN=node1.datastax.com, OU=Drivers and Tools, O=DataStax Inc., L=Santa Clara, ST=California, C=US" NOTE: If an IP address SAN is present then it overrides checking the CN. Enabling client-to-node Encryption on Cassandra The generated keystore from the previous step will need to be copied to all Cassandra node(s) and an update of the cassandra.yaml configuration file will need to be performed. client_encryption_options: enabled: true keystore: <Path to keystore>/keystore.jks keystore_password: <keystore password> ## The password used when generating the keystore. truststore: <Path to keystore>/keystore.jks truststore_password: <keystore password> require_client_auth: <true or false> NOTE: In this example keystore and truststore are identical. The following guide has more information related to configuring SSL on Cassandra. Setting up the C/C++ Driver to Use SSL A CassSsl object is required and must be configured: #include <cassandra.h> void setup_ssl(CassCluster* cluster) { CassSsl* ssl = cass_ssl_new(); // Configure SSL object... // To enable SSL attach it to the cluster object cass_cluster_set_ssl(cluster, ssl); // You can detach your reference to this object once it's // added to the cluster object cass_ssl_free(ssl); } Exporting and Loading the Cassandra Public Key The default setting of the driver is to verify the certificate sent during the SSL handshake. For the driver to properly verify the Cassandra certificate the driver needs either the public key from the self-signed public key or the CA certificate chain used to sign the public key. To have this work, extract the public key from the Cassandra keystore generated in the previous steps. This exports a PEM formatted certificate which is required by the C/C++ driver. keytool -exportcert -rfc -noprompt \ -alias node \ -keystore keystore.jks \ -storepass <keystore password> \ -file cassandra.pem The trusted certificate can then be loaded using the following code: “`c int load_trusted_cert_file(const char* file, CassSsl* ssl) { CassError rc; char* cert; long cert_size; FILE *in = fopen(file, “rb”); if (in == NULL) { fprintf(stderr, “Error loading certificate file ‘%s’\n”, file); return 0; } fseek(in, 0, SEEK_END); cert_size = ftell(in); rewind(in); cert = (char*)malloc(cert_size); fread(cert, sizeof(char), cert_size, in); fclose(in); // Add the trusted certificate (or chain) to the driver rc = cass_ssl_add_trusted_cert_n(ssl, cert, cert_size); if (rc != CASS_OK) { fprintf(stderr, “Error loading SSL certificate: %s\n”, cass_error_desc(rc)); free(cert); return 0; } free(cert); return 1; } “` It is possible to load multiple self-signed certificates or CA certificate chains. In the event where self-signed certificates with unique IP addresses are being used this will be required. It is possible to disable the certificate verification process, but it is not recommended. // Disable certifcate verifcation cass_ssl_set_verify_flags(ssl, CASS_SSL_VERIFY_NONE); Enabling Cassandra identity verification If a unique certificate has been generated for each Cassandra node with the IP address in the CN or SAN fields, identity verification will also need to be enabled. NOTE: This is disabled by default. // Add identity verification flag: CASS_SSL_VERIFY_PEER_IDENTITY cass_ssl_set_verify_flags(ssl, CASS_SSL_VERIFY_PEER_CERT | CASS_SSL_VERIFY_PEER_IDENTITY); Using Cassandra and the C/C++ driver with client-side certificates Client-side certificates allow Cassandra to authenticate the client using public key cryptography and chains of trust. This is same process as above but in reverse. The client has a public and private key and the Cassandra node has a copy of the private key or the CA chain used to generate the pair. Generating and loading the client-side certificate A new public/private key pair needs to be generated for client authentication. keytool -genkeypair -noprompt -keyalg RSA -validity 36500 \ -alias driver \ -keystore keystore-driver.jks \ -storepass <keystore password> \ -keypass <key password> The public and private key then need to be extracted and converted to the PEM format. To extract the public: keytool -exportcert -rfc -noprompt \ -alias driver \ -keystore keystore-driver.jks \ -storepass <keystore password> \ -file driver.pem To extract and convert the private key: keytool -importkeystore -noprompt -srcalias certificatekey -deststoretype PKCS12 \ -srcalias driver \ -srckeystore keystore-driver.jks \ -srcstorepass <keystore password> \ -storepass <key password> \ -destkeystore keystore-driver.p12 openssl pkcs12 -nomacver -nocerts \ -in keystore-driver.p12 \ -password pass:<key password> \ -passout pass:<key password> \ -out driver-private.pem Now PEM formatted public and private key can be loaded. These files can be loaded using the same code from above in load_trusted_cert_file(). CassError rc = CASS_OK; char* cert = NULL; size_t cert_size = 0; // Load PEM-formatted certificate data and size into cert and cert_size... rc = cass_ssl_set_cert_n(ssl, cert, cert_size); if (rc != CASS_OK) { // Handle error } char* key = NULL; size_t key_size = 0; // A password is required when the private key is encrypted. If the private key // is NOT password protected use NULL. const char* key_password = "<key password>"; // Load PEM-formatted private key data and size into key and key_size... rc = cass_ssl_set_private_key_n(ssl, key, key_size, key_password, strlen(key_password)); if (rc != CASS_OK) { // Handle error } Setting up client authentication with Cassandra The driver’s public key or the CA chain used to sign the driver’s certificate will need to be added to Cassandra’s truststore. If using self-signed certificate then the public key will need to be extracted from the driver’s keystore generated in the previous steps. Extract the public key from the driver’s keystore and add it to Cassandra’s truststore. keytool -exportcert -noprompt \ -alias driver \ -keystore keystore-driver.jks \ -storepass cassandra \ -file cassandra-driver.crt keytool -import -noprompt \ -alias truststore \ -keystore keystore.jks \ -storepass cassandra \ -file cassandra-driver.crt Client authentication in cassandra.yaml will also need to be enabled require_client_auth: true
https://docs.datastax.com/en/developer/cpp-driver/2.3/topics/security/ssl/
CC-MAIN-2021-49
refinedweb
1,284
55.24
I haven't been able to get gprof to output results that make any sense for some time now. I'd be interested if you actually get it to work. Marc Manolo to Anton Shepelev: >>while they clearly take different times to com- >>plete. > >How do you know this? Have you measured times? I measured the times manually, but here I do it in the code: #include "test.h" #include <stdlib.h> #include <stdio.h> #include <time.h> void genwait( unsigned t ) { clock_t before, after; unsigned i; char line[3]; double time_sec; before = clock(); for( i = 0; i < t; i++ ) { sprintf(line, "a"); } after = clock(); time_sec = ((double)(after - before)) / CLOCKS_PER_SEC; printf( "%i cycles took %2.3g seconds.\n", t, time_sec ); } void wait1() { genwait(100000000); } void wait2() { genwait(800000000); } void wait3() { genwait(1600000000); } void WorkHard() { int i=0; wait1(); wait2(); wait3(); } And the program outputs different execution times: 100000000 cycles took 0.344 seconds. 800000000 cycles took 2.86 seconds. 1600000000 cycles took 5.7 seconds. The modified test sample is here: but gprof still shows the average time of about 2.7 seconds for each test run. ------------------------------------------------------------------------------ _______________________________________________
http://mingw.5.n7.nabble.com/Strange-gprof-results-td35276.html
CC-MAIN-2017-13
refinedweb
188
76.93
Facets are used to group documents based on some crtiteria, for example specific terms or date range. This topic explains how to use facets based on geographical distance. How it works Geographic distance facets group documents with a GeoLocation type property by distance from a location. Geographical distance facets are requested of, and extracted from, search results via the GeoDistanceFacetFor method. Geographic distance facets need several ranges into which to group documents. Use the the NumericRange class to do this. Example Assume you indexed a number of restaurants as instance of this class: using EPiServer.Find; public class Restaurant { public string Name { get; set; } public GeoLocation Location { get; set; } } Request the number of restaurants within 1, 5, and 10 kilometers of a location via the GeoDistanceFacetFor method, as shown below., use the GeoDistanceFor method (same name as the method used to retrieve facets). This returns"); } Last updated: Oct 31, 2016
https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/searching/Facets/Geographical-distance-facets/
CC-MAIN-2021-39
refinedweb
150
56.35
Hello, i am very interested in the c++ language, i decided to make my own small program and test how arrays work with classes with private variables and private operations and then calling them any way i'd like from the main function. a very big reason about this is probably because i'm trying to pass by reference, which i thought was necesary if i'm keeping the changes everywhere within the program, and using a void function. If there is any advice as to coding better, i'd like those too. there are syntax errors, line 20 only, please help me :) ////.header file for class arrays. #include <string> using namespace std; class arrays { private: string hold; int keep; int raekwon[]; public: void Talk(string&, int&); }; ///this is my arrays header function #include "arrays.h" void arrays::Talk(hold&, keep&) { ///this creates the array based from the size parameter raekwon[keep]; //this displays the information cout << "okay, you are feeling " << hold << " today.\n"; cout << "also, the size of the array you asked for is " << keep << "\n"; cout << "the elements in the array are: " << raekwon << "\n"; } ///this is the main function #include "arrays.h" #include <iostream> #include <string> using namespace std; main() { arrays a; string feelings; int array_size; cout << "how are you feeling today?\n"; cin >> feelings; cout << "\n" << "what size array you want?\n"; cin >> array_size; a.Talk(feelings&, array_size&); return 0; } //////////////////////////////////////////////////
https://www.daniweb.com/programming/software-development/threads/266226/very-simple-code-help-beginner
CC-MAIN-2018-17
refinedweb
233
69.92
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: ----------------------------------------------------------- Advertising (Updated Oct. 17, 2016, 7:12 p.m.) Review request for mesos, Jie Yu and Qian Zhang. Changes ------- Added an exception to iptables jump rule in OUTPUT chain. Made `CNI_CONTAINERID` a required property of the port-mapper plugin. Bugs: MESOS-6023 Repository: mesos Description ------- Added the logic for installing and removing DNAT rules. Diffs (updated) ----- src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.hpp 7fad707a240234e35828917aea1bc79f42fe130e src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.cpp 2ff8b0e76a11b6f6c98b839d3ac91a81e41285f5 Diff: Testing ------- Ran the CNI plugin against a network namespace with the following JSON input: ``` { "name": "mynet", "type": "port-mapper", "chain": "MESOS-TEST", "excludeDevices": ["mesos-cni0"], "delegate": { "type" : "bridge", "bridge": "cni0", "isGateway": true, "ipMasq": true, "ipam": { "type": "host-local", "subnet": "192.168.37.0/24", "routes": [ { "dst": "0.0.0.0/0" } ] } }, "args" : { "org.apache.mesos" : { "network_info" : { "port_mappings": { "host_port" : 8080, "container_port" : 9000 } } } } } ``` Used the ADD command to test that the CNI plugin correctly invokes the delegate plugin (a CNI bridge plugin in this case) and also inserts the correct iptable entries for the given port mapping. After running this plugin, this was the output of the `iptables -t nat -S MESOS-TEST` command: ``` sudo iptables -t nat -S MESOS-TEST -N MESOS-TEST -A MESOS-TEST ! -i mesos-cni0 -p tcp -m tcp --dport 8080 -j DNAT --to-destination 192.168.37.21:9000 ``` Ran a python HTTP server in this network namespace and verified that DNAT works from outside the box. Was able to connect to port 9000 of this server, by connecting to port 8080 on the host. Used the DEL command to test the CNI plugin correctly deletes the DNAT rule and chain, if there are no DNAT rules exist in the chain. After running the DEL command (by injecting `NetworkInfo` into the above JSON schema) verified the chain and the DNAT rule is deleted from iptables. Apart from these tests ran a single node cluster and did an end-to-end test with a modified `mesos-execute` binary that can setup port-mapping. Thanks, Avinash sridharan
https://www.mail-archive.com/reviews@mesos.apache.org/msg47962.html
CC-MAIN-2017-51
refinedweb
350
57.16