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 |
|---|---|---|---|---|---|
NAME
BN_copy, BN_dup, BN_with_flags - copy BIGNUMs
SYNOPSIS
#include <openssl/bn.h> BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); BIGNUM *BN_dup(const BIGNUM *from); void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
DESCRIPTION
BN_copy() copies from to to. BN_dup() creates a new BIGNUM containing the value from.
BN_with_flags creates a temporary shallow copy of b in dest. It places significant restrictions on the copied data. Applications that do no adhere to these restrictions may encounter unexpected side effects or crashes. For that reason use of this function is discouraged. Any flags provided in flags will be set in dest in addition to any flags already set in b. For example this might commonly:
dest should be a newly allocated BIGNUM obtained via a call to BN_new(). It should not have been used for other purposes or initialised in any way.
dest must only be used in "read-only" operations, i.e. typically those functions where the relevant parameter is declared "const".
dest must be used and freed before any further subsequent use of b
RETURN VALUES
BN_copy() returns to on success, NULL on error. BN_dup() returns the new BIGNUM, and NULL on error. The error codes can be obtained by ERR_get_error(3).
SEE ALSO
Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at. | https://www.openssl.org/docs/manmaster/man3/BN_dup.html | CC-MAIN-2017-51 | refinedweb | 238 | 66.94 |
#include <MEvent.h>
The MEvent class is used for querying system events such as mouse presses.
Events are handled by an MPxContext derived class in which MEvents are passed and can be accessed.
Since Maya has default actions for several events, only a subset are avalaible through the API. The events that can be accessed are:
A modifier can be used to determine if two mouse events occur simulaneously. The second mouse event is registered as a modifier in the hold event of the first mouse button. So if you wanted to determine if both the left and middle buttons are pressed then you would query the modifier in the hold event of the first mouse button using the isModifierMiddleMouseButton() and isModifierLeftMouseButton() methods.
componentScaleManip.cpp, customAttrManip.cpp, helixTool.cpp, lassoTool.cpp, marqueeTool.cpp, meshRemapTool.cpp, meshRemapTool.h, meshReorderTool.cpp, meshReorderTool.h, moveManip.cpp, moveNumericTool.cpp, moveTool.cpp, rotateManip.cpp, and surfaceBumpManip.cpp.
Modifier key types.
Mouse button types.
Constructor.
Destructor.
Get the location of the event in view co-ordinates. The origin is at the lower left corner of the window.
set the location of the event to the specified location. The origin is at the lower left corner of the window.
This routine is used by responders to query the position of the pointer when the event occurred. It is given in screen co-ordinates.
The origin is at the upper left corner of the window.
Get the mouse button of the last event.
Was a modifier key released.
This routine is used by responders to find the state of the modifiers during the event.
set the event modifiers.
Determines if there are any modifiers for this event.
return state of shift key.
return state of control key.
Return the state of the left mouse button.
This method is only valid when called in the hold event for another mouse press.
Return the state of the middle mouse button.
This method is only valid when called in the hold event for another mouse press. | http://download.autodesk.com/us/maya/2009help/API/class_m_event.html | crawl-003 | refinedweb | 335 | 67.96 |
TL;DR: - In this article, we are going to go over the new updates and features added in the major release of the
create-react-app tool. We will go over the changes that ReactJS announced and what we can find in this great update. We will also go over the addition of TypeScript support and how that can benefit your project.
Create React App 2.0 - The Big Reveal
On October 1, 2018, ReactJS tweeted their release announcement of Create React App 2.0.
We’ve just released Create React App 2.0, including a year’s worth of improvements. pic.twitter.com/sV8YbY7IED— React (@reactjs) October 2, 2018
The Useful Create React App
Once released, developers were excited, to say the least. If you have used ReactJS, chances are you have used the bash command:
create-react-app name-of-app
Once that command starts running, you get to sit back and relax. You will see that ReactJS is taking care of all the setup and configuration. Once it’s finished, the
package.json is compiled, starting dependencies are installed, and it gives you the initial project structure. What’s in this new and flashy Create React App 2.0? Let’s check it out!
"On October 1, 2018, ReactJS tweeted their release announcement of Create React App 2.0. Once released, developers were excited, to say the least."
Sass and CSS Modules
Have you ever had to install Sass loaders yourself? Have you had to configure Sass throughout your project yourself? Well now, in Create React App 2.0, you can get Sass running in your project with a simple bash command and some file name changes. Run:
npm install node-sass
Change your
src/App.css to
src/App.scss and make sure to update that file name in the top part of
src/App.js and you are ready to use and reuse your stylesheets. It’s great!
Babel 7
Babel released their Babel 7 version this year as well and it did not take long for React to switch over. You can learn all about the new Babel 7 features here. Babel is important because it converts ES6 into code that browsers can read. Babel 7 is faster, can now parse TypeScript syntax, and even gives support for the React fragment syntax.
Want to learn more about React fragments? Dive into the React docs on Fragments.
Webpack 4
React, having always used Webpack, has now updated to Webpack 4. Webpack 4 is much faster, decreases your build time, and allows you to set up a particular environment whether it's development or production.
In short, it is a module bundler for JavaScript applications and version 4 splits the bundles into a more intelligent and better performant way. There is so much that goes with Webpack 4, if you want to learn more about it, you can visit the Webpack website here.
"React has now updated to Webpack 4, a module bundler for JavaScript applications."
Jest 23
When Create React App 2.0 came out, they launched it with that latest version of Jest. Jest 23 is more stable and much quicker, which will help you when running tests. You’ll feel more confident with more immediate feedback and reliable results.
Jest is an open-source testing framework that has just been updated to version 23. It has some great new features. One of those updates is the new watch menu option called Interactive Snapshot Mode. You are able to look through each snapshot and review your failed ones. While reviewing you can choose to update or skip each one. Jest has a great list of some of the updates that you can find here on Jest’s blog.
PostCSS
PostCSS, a great tool with over 200 custom plugins has been added to Create React App 2.0. By using JavaScript, you are able to easily transform your CSS. Create React App did not have this neat feature, but the team at React thought that adding this in would be a great for developers. I would have to agree!
If you were to head over to PostCSS.org you would see a list of features that come with PostCSS.
- Increased code readability
- Converts modern CSS into a more readable version for browsers
- Uses CSS Modules which keeps all class and animation names local
- Utilizes stylelint, a modern CSS linter
- Offers a powerful grid system
Apollo, Relay Modern, MDX, and other third-party Babel Macros transforms
Imagine being able to use a third-party platform like Apollo, MDX, or Relay Modern without extra configuration or setup. There is no longer the issue of being able to use Babel Macros without ejecting first, Create React App 2.0 is taking care of that setup for us.
Check out this tutorial on how to create a React app with MDX.
SVG
We have all seen an SVG tag:
<svg width="100" height="100"> <circle cx=“50” cy=“50” r=“40” stroke=“blue” stroke-width=“5” </svg>
This one is a simple circle but some SVG tags can get pretty long and confusing. SVG’s are great because they allow for cleaner looking lines, richer color, and change your images into code.
What if I told you that now you can import an SVG as a React component?
Simply import the component at the top:
import SVGIcon from "./svgicon";
And use it down within the file:
<SVGIcon name="image" width={50} fill={red} />
or
<SVGIcon />
This can give a lot of flexibility in where you use your SVG’s and allows for better readability.
Yarn Plug’n’Play
Hmmm, getting rid of the
node_modules seems far-fetched but this experimental Yarn Plug’n’Play allows for just that. If you look at the bullet points in this GitHub PR conversation, you’ll see that there are some awesome aspects to it:
- Installs ran using Plug'n'Play are up to 70% faster than regular ones.
- Starting from this PR, Yarn will now be on the path to make yarn install a no-op on CI (Continuous Integration).
- Yarn will now be able to tell you precisely when you forgot to list packages in your dependencies.
- Your applications will boot faster through a hybrid approach of static resolutions.
This is something that if you want to try out in your React project, go ahead. This feature is just a fun new add-on that is completely optional.
Here you'll see Dan Abramov trying out Yarn Plug-n-Play:
I’m trying out Yarn Plug’n’Play and it’s pretty incredible. This GIF is *not* speeded up. I literally created a project in five seconds (on a warm cache). No node_modules. It works. pic.twitter.com/AjJP5vXxEi— Dan Abramov (@dan_abramov) October 3, 2018
Proxy Implementation
Want to configure your own proxy? Create React App 2.0 let’s you do that now!
All you need to do is install the dependency:
npm install http-proxy-middleware
And then create a file called
src/setupProxy.js. Once you import that dependency, you are ready to go! It’s that easy to get it started!
Use packages written for latest Node versions
Use any Node version package and with the help of Babel 7 and Webpack 4, it won’t break the build. You will not need to do any addition configuration and will feel confident that it’s being bundled correctly.
A Smaller CSS Bundle
Chances are you are going to be pointing your project towards modern browsers. If you decide to only target those, maybe a smaller CSS bundle would be beneficial for your project and you could experience faster load times by making fewer requests.
Avoid targeting the following:
-webkit
-ms
in your CSS and that will help in keeping those bundled. Instead point the browsers to the
package.json.
Service Workers
Service workers are now opt-in and are built using Google’s Workbox. Workbox is a JavaScript library that gives offline support to your project. It can help with your project’s performance and resilience by caching assets such as:
- Fonts
- Images
- JavaScript
- CSS
- Other files
The Addition of TypeScript
TypeScript, an Object-oriented programming language, can be beneficial to use versus JavaScript. Some strong benefits of using TypeScript are:
- It can help find errors more efficiently.
- Checks for "types" being correct.
- Same syntax as JavaScript, so easy to start with.
When starting your React project with
create-react-app, simply add to the bash command:
--typescript
to add TypeScript to your project.
Add TypeScript To Create React App Project
There are two ways to get TypeScript active in your project.
Add it into an already existing project:
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
or add it in at the beginning of a new project:
npx create-react-app name-of-app --typescript
Files that end in
.js change to
.tsx and you are good to go.
src/index.js -->
src/index.tsx
If you add TypeScript to an already existing project, be sure to restart your development server to get the new changes going. You can find the documentation on this new TypeScript addition here.
Moving Forward with Create React App 2.0
With React’s new Create React App 2.0 being released, the next thought is, “Should I update all my past projects to 2.0?”. Unless it’s broken, just leave it as is. But in the future, when using the command
create-react-app to start your project, you’ll know you have so many new features to help you build an amazing project.
To find out which version of Create React App you are using in a particular project, head on over to your
package.json and find this line telling you which version you are currently utilizing:
"react-scripts": "2.0.3"
This is also the place where you would update to 2.0 if desired.
Happy coding!. | https://auth0.com/blog/create-react-app-2.0-whats-new/ | CC-MAIN-2020-40 | refinedweb | 1,666 | 73.27 |
Red Hat Bugzilla – Bug 23221
up2date fails on run, AttributeError: Up2dateConfig (wrong config is read)
Last modified: 2015-01-07 18:42:41 EST
up2date consistently fails to run on RH 62.
up2date version:
Name : up2date Relocations: (not relocateable)
Version : 2.1.7 Vendor: Red Hat, Inc.
Release : 0.6.x Build Date: Thu 21 Dec 2000
08:25:52 PM IST
Install date: Tue 02 Jan 2001 09:29:25 PM IST Build Host:
porky.devel.redhat.com
Group : System Environment/Base Source RPM:
up2date-2.1.7-0.6.x.src.rpm
Size : 219264 License: GPL
Packager : Red Hat, Inc. <>
Summary : Automatically update RPMs for a Red Hat Linux Systemrequires
Description :
Errors are from any utility that uses up2date configs, like:
Traceback (innermost last):
File "/usr/sbin/up2date-config", line 312, in ?
main()
File "/usr/sbin/up2date-config", line 307, in main
gui = Gui()
File "/usr/sbin/up2date-config", line 55, in __init__
self.cfg = config.Up2dateConfig()
AttributeError: Up2dateConfig
and same error from up2date. Seems to be because python
(python-1.5.2-27.6.x) also has config.py and the script includes that
config.py instead of up2date's. If I change config to config2 in every
place in up2date (imports and config.Up2dateConfig()), it works.
that shouldn't matter. Works fine on my RHL 6.2 box.
Can I see the output of:
rpm -V up2date
rpm -V up2date-gnome
rpm -V python
rpm -V up2date
SM?....T c /etc/sysconfig/rhn/up2date
missing /usr/share/rhn/up2date/config.pyc
S.5....T /usr/share/rhn/up2date/translate.pyc
S.5....T /usr/share/rhn/up2date/up2date.py
SM5....T /usr/share/rhn/up2date/up2date.pyc
rpm -V up2date-gnome
S.5....T /usr/sbin/up2date-config
S.5....T /usr/share/rhn/up2date/checklist.pyc
S.5....T /usr/share/rhn/up2date/configdlg.py
S.5....T /usr/share/rhn/up2date/configdlg.pyc
S.5....T /usr/share/rhn/up2date/gui.pyc
S.5....T /usr/share/rhn/up2date/progress.pyc
rpm -V python
did not produce any output
Assigned QA to jturner
You are missing the compiled up2date python config class:
missing /usr/share/rhn/up2date/config.pyc
Doh.
Yes, it is missing, because *I had to remove it to make it run*.
OK, seems I did not make myself clear.
Python has config. up2date has config. When up2date uses "config" it thinks it's
config for up2date, but apparently it's config for python. If I change every
reference of config to config2, it works. I'm not sure if removing config.pyc
necessary to make it run, but renaming was necessary. I guess these two lines
are the cause:
sys.path.append("/usr/share/rhn/up2date/")
import config
I'm not a big Python pro, but I imply that if you append directory to the path,
it is searched after all others? And if some previous path has config, the
import will be taken from there? Am I wrong?
Look:
Something is _different_ about your system than ANY other Red Hat Linux system
out there. I'm not sure what, but something. We don't have this problem on any
of our test boxes. THOUSANDS of other people are using up2date without this
issue.
This config class you speak of that python has -- we don't ship any "config.py"
class with python by default. so you have added something to your system.
More info.
[pbrown@xanadu pbrown]$ rpm -q python
python-1.5.2-27.6.x
[pbrown@xanadu pbrown]$ rpm -V python
[pbrown@xanadu pbrown]$ rpm -ql python | grep config
[pbrown@xanadu pbrown]$ rpm -ql python |grep config
[pbrown@xanadu pbrown]$ | https://bugzilla.redhat.com/show_bug.cgi?id=23221 | CC-MAIN-2017-13 | refinedweb | 612 | 60.51 |
OverviewRAPID provides live GPS tracking and it is potentially one of the most useful tools a fleet monitoring service can provide. It allows you to visualize where each one of your vehicles is on a map alongside how fast they are going and other vehicle status information-very useful for making sure your trucks are keeping on schedule. Setting up a PC with a USB GPS dongle is perhaps the simplest way to provide vehicle GPS data and also the simplest part of displaying this data. We utilize a third-party publish-subscribe MQTT service to allow for communication of vehicle data between our edge devices and our cloud API.
Building Real-Time Vehicle TrackingOne way to set this up is to have the module take a snapshot of the current GPS data every second using gpsd. GPSD is an open-source solution for Unix-like systems that support TCP/IP transportation of GPS data from serial connections. Once we’ve captured a series of GPS coordinates, we can then pump that data up to the cloud. But how do we visualize this for our customers? One way is to use realtime subscribers to listen for the GPS data. We run a PubNub subscriber in the frontend of our web application that is subscribed to the channel devices are sending their GPS data to. This allows us to display incoming location data neatly and quickly since there will be zero database queries to get the vehicle data to display on our map. As for assigning a vehicle to the GPS data, we provide an identifier for each vehicle along with the GPS data payload over MQTT. This allows us to display multiple vehicles with their information on the map at the same time, making it easier to get a full picture of where all the fleet vehicles are at any given moment. The following is an example of how we would set up a subscriber to track fleets in our frontend using EmberJS:
import ENV from 'project/config/environment'; import AbstractPubnub from 'project/services/pubnub'; import PubNub from 'pubnub'; export default class PubnubService extends AbstractPubnub { constructor() { super(...arguments); this.client = new PubNub({ publishKey: ENV.pubnub.publishKey, subscribeKey: ENV.pubnub.subscribeKey, uuid: this.currentUser.user.id }); this.client.addListener({ status: this.status.bind(this), message: this.message.bind(this), presence: this.presence.bind(this) }); } } | https://esg-usa.com/live-vehicle-tracking/ | CC-MAIN-2021-04 | refinedweb | 393 | 53.1 |
As promised by Daniel in part one, here is part two!
In this post I’ll try to explain how we could automatically deploy our mapped properties that we use to get strongly typed properties (see Daniels post) in our templates by using some reflection, conventions and attributes.
First we create a new Web Form/Page Template in Visual Studio and change the inheritance from EPiServer.TemplatePage to our own extended class TemplatePage<T>.
To add properties we create a class-file for the properties that we will use in our template. Neither the PageType or associated properties has to be present in EPiServer.
1: public class MyPageProperties : PropertiesBase
2: {
3: public PropertyString Heading { get; set; }
4: public PropertyXhtmlString MainBody { get; set; }
5: public PropertyUrl SomeUrl { get; set; }
6: }
PageTypeBuilder is the tool responsible for creating and updating PageTypes and properties in EPiServer.
To execute it, we need to add some code when the application starts, for instance in a PlugIn or in Global.asax.
1: public class PageTypeDefPlugin : EPiServer.PlugIn.PlugInAttribute
2: {
3: public static void Start()
4: {
5: var builder = new PageTypeBuilder<PropertiesBase>(Assembly.GetExecutingAssembly().FullName)
6: {
7: Settings = new PageTypeBuilderSettings {TabName = "Information", VirtualPathRoot = @"\Pages\"}
8: };
9:
10: builder.UpdatePageTypes();
11: }
12: }
PropertiesBase is added as a generic type and the BuildPageTypes method takes a params string[] with names of assemblies to scan for mapping classes.
The tool will look for classes that are subclasses of T (= PropertiesBase) and build PageTypes out of these. Each class will become a PageType and each property will be added as a EPiServer property.
For global default settings a PageTypeBuilderSettings object is used. Here it’s possible to add virtual path, default tab, if unmapped properties should be deleted or not and if existing properties should be updated.
But what about Help texts, Tabs and Descriptions? The tool will guess/use conventions for these. The class name - “Properties” will be the name for the PageType (class “StartProperties” = PageType “Start”), if no Tab name is specified, the property will be added to the “Information” tab (if not overridden by the global settings) and so forth.
To override this and to add additional information we could decorate our mapping classes with attributes. Attributes could be Name of the page/property, Edit Heading, Tab, Default value, Language specific and some others. Pretty much the same as we have in Admin mode.
If we have properties that are shared between templates these could be added to either the PropertiesBase class or to another class that inherits PropertiesBase and then use this class as subclass for our mappings. Since we don’t want this class to be a PageType there is a [Ignore] attribute that could come in handy.
The sort order of the properties will be the same as the order in our mapping classes.
some pictures might say more than 1000 words…
For mapping class we use this:
1: public class MyPageProperties : PropertiesBase
2: {
3: [HelpText("Ingress")]
4: public PropertyString MainIntro { get; set; }
5: [HelpText("Primär text")]
6: public PropertyXhtmlString MainBody { get; set; }
7: [HelpText("Länk till bild")]
8: public PropertyImageUrl ImageUrl { get; set; }
9: }
This will result in this new PageType:
Sort order of properties will be the same as in the mapping class
Since we add, update and delete properties when the application starts we will not depend on a specific database. This could be useful in a continuous integration scenario where the development database differs from the database used for test and of course if all developers in a team have their own (local) database.
This tool is pretty much a “proof of concept” that could be used to complement our way to handle strongly typed properties. It' can not (yet) handle all features of PageTypes that exists in EPiServer (dynamic properties to mention one) but will ease the pain of creating PageTypes and adding properties ;)
So, what do you think? | https://world.episerver.com/blogs/Mikael-Nordberg/Dates/2009/5/Strongly-typed-property-access--Part-two/ | CC-MAIN-2020-05 | refinedweb | 649 | 57.91 |
Help with symbolic sum
Simple things that I will do with Maple in seconds, with Sage often drive me desperate to Ask-Sage. Sigh.
With Maple:
for n from 0 to 4 do add(j!*stirling1(n,j)*(x-1)^(-j-1), j=0..n) od; 1 ----- x - 1 1 -------- 2 (x - 1) 1 2 - -------- + -------- 2 3 (x - 1) (x - 1) 2 6 6 -------- - -------- + -------- 2 3 4 (x - 1) (x - 1) (x - 1)
With Sage 6.3:
x = SR.var('x') for n in range(4): S = sum(factorial(j)*stirling_number1(n,j)*(x-1)^(-j-1) for j in (0,n)) print S
Returns:
2/(x - 1) (x - 1)^(-2) 2/(x - 1)^3 6/(x - 1)^4 24/(x - 1)^5
Or:
from sage.calculus.calculus import symbolic_sum x, j = SR.var('x, j') for n in range(5): S = symbolic_sum(factorial(j)*stirling_number1(n,j)*(x-1)^(-j-1),j,0,n) print S
Returns:
TypeError: unable to convert x (=j) to an integer
I ask for enlightenment.
What is your question ? Why are you unhappy with your first attempt ?
I am unhappy because the results of Maple and Sage obviously diverge and I suspect that Maple's answer is the correct one; or isn't it?
You used (0,n), and this thing is a pair. What you wanted to use was range(n+1) or [0..n].
+1 for Nathann. Yes. Thanks. I was hopping between different languages until I was blind. Nathann please convert your comment to an answer and I will accept it.
It also appears at the bottom of my other answer. But I will never compare to tmonteil where it comes to Karma! | https://ask.sagemath.org/question/25463/help-with-symbolic-sum/ | CC-MAIN-2019-04 | refinedweb | 282 | 74.9 |
Simple Concurrency And Parallelism in Python
INTRODUCTION .
What Is Concurrency?
Concurrency is simultaneous occurrence. In Python, the things that are occurring simultaneously are called by different names (thread, task, process) but at a high level, they all refer to a sequence of instructions that run in order.
What Is Parallelism?
You’ve looked at concurrency that happens on a single processor. What about all of those CPU cores your cpu has ? How can you make use of them? answer is by
multiprocessing.
With multiprocessing, Python creates new processes. A process here are often thought of as almost a totally different program, though technically they’re usually defined as a set of resources where the resources include memory, file handles and things like that. a method to believe it’s that every process runs in its own Python interpreter.
Because they’re different processes, each one of those during a multiprocessing program can run on a special core. Running on a special core means they really can run at an equivalent time, which is really great. There are some complications that arise from doing this, but Python does a reasonably good job of smoothing them over most of the time.
Python offers four possible ways to handle that. First, you’ll execute functions in parallel using the multiprocessing module. Second, an alternate to processes are threads. Technically, these are lightweight processes, and are outside the scope of this text . For further reading you’ll have a glance at the Python threading module. Third, you’ll call external programs using the system(); method of the os module, or methods provided by the subprocess module, and collect the results afterwards.
Multiprocessing:
It means distributing your tasks over CPU cores, to understand how many core your CPU has type type in terminal lscpu and it’ll display number of cores in your computer. For any CPU bound tasks ( like — doing numerical computations ), we will use python’s multiprocessing module . We simply create a Pool object in multiprocessing which offers a convenient means to parallelize the execution of a function across multiple input values.
from multiprocessing import Pooldef square(x):# calculate the square of the value of x return x*xif __name__ == ‘__main__’:# Define the dataset dataset = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]# Output the dataset print(‘Dataset: ‘ + str(dataset))# Run this with a pool of 5 agents having a chunksize of 3 until #finished agents = 5 chunksize = 3 with Pool(processes=agents) as pool:
result = pool.map(square, dataset, chunksize)# Output the result print (‘Result: ‘ + str(result))
Output of the Above code :
$ python3 pool_multiprocessing.py
Dataset: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
Result: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196]
What’s Synchronous and Asynchronous execution?
In multiprocessing , there are two kinds of execution: Synchronous and Asynchronous.
A synchronous execution is one the processes are completed within the same order during which it had been started. this is often achieved by locking the most program until the respective processes are finished.
Asynchronous, on the opposite hand, doesn’t involve locking. As a result, the order of results can get involved but usually gets done quicker.
There are 2 main objects in multiprocessing to implement parallel execution of a function: The Pool Class and also the Process Class.
- Pool Class
- Synchronous execution
- Pool.map() and Pool.starmap()
- Pool.apply()
- Asynchronous execution
- Pool.map_async() and Pool.starmap_async()
- Pool.apply_async())
- Process Class
So how do we achieve parallelism in any function?
The general method to parallelize any operation is to take a specific function that ought to be run multiple times and make it run parallelly in several processors.
To do this, you initialize a Pool with n number of processors and pass the function you would like to parallelize to at least one of Pools parallization methods.
multiprocessing.Pool() provides the apply(), map() and starmap() methods to form any function run in parallel.
Nice! So what’s the difference between apply() and map()?
These two function apply and map takes the function to be parallelized as their main argument. But the difference is, apply() takes an args argument that accepts the parameters passed to the ‘function-to-be-parallelized’ as an argument, whereas, map can take just one iterable as an argument.
So, map () is basically more suitable for less complicated iterable operations, but does the work faster.
Asynchronous Parallel Processing
The asynchronous uses apply_async(), map_async() and starmap_async() these functions can help you execute the processes in parallel order asynchronously , consecutive process can start as soon as previous one process gets over without regard for the starting order of the different processes. As a result, there’s no guarantee that the result are going to be within the same order because the input.
Asynchronous Programming
Asynchronous programming, where the OS isn’t participating. As far as OS cares you’re getting one process and there’s going to be one thread within that process, but you’ll be able to do multiple things right away.So how do we achive this?
For that we have module asyncio
asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc.
asyncio provides a set of high-level APIs to:
· Run Python coroutines concurrently and have full control over their execution;
· Perform network IO and IPC;
· Control subprocesses;
· Distribute tasks via queues;
· Synchronize concurrent code;
There are low-level APIs for library and framework developers to:
- Create and manage event loops, which provide asynchronous APIs for networking, running subprocesses, handling OS signals, etc;
- Implement efficient protocols using transports;
- Bridge callback-based libraries and code with async/await syntax.
Best Practices For Writing Parallel Code in Python:
Writing high-performance parallel code in Python are often challenging since you’ll have many new factors to stay track of, from the kind of your CPU to its L2 cache size, to not mention Python’s system for handling communication between parallel programs. during this section, we share our top three recommendations on the way to get parallelization right during a Python project.
Know your machine architecture
When writing a parallel program, knowing what’s under the hood on your development and production machines will determine whether your parallel program could be a only little faster or significantly faster than a single-core program. find out how many CPU cores are there on your machine and whether it can run more processes than there are physical cores (frequently available in Intel processors with Hyper-Threading). Know the dimensions s of your Python data structures in memory and the way those sizes compare with the size of your CPU’s L1 and L2 caches. Since access is significantly slower than most CPU instructions, taking advantage of the CPU’s caching can dramatically improve your program’s performance.
Make use of messages rather than shared state
When processing an outsized arrangement with parallel processes or threads, you’ll eventually need how for the individual tasks to coordinate with one another . the simplest method of coordination is to possess threads or processes write to a shared arrangement , for instance , multiprocessing.Array. However, using shared memory creates a variety of coordination problems where tasks can overwrite each other’s data and cause runtime problems.
Instead, use primitives like locks and semaphores to coordinate processes and threads, and use queues or pipes to send messages between tasks.
What’s worth parallelizing and what’s not
Defining a parallel program is very complex in nature as compared to normal programs.As software gets increasingly complex, it becomes less maintainable within the future , and other engineers can’t dive as quickly into the program to form changes. In teams where it’s essential to possess multiple developers performing on an equivalent applications, this extra complexity can hamper progress for the whole group or organization.
When writing a replacement program in Python, believe whether the speed gain from parallelization are going to be well worth the additional complexity for your team. Consider the long-term consequences of writing complex parallel code as against single-threaded programs, which are slower but more straightforward, more understandable, and easier to debug.
Conclusion:
We use python’s multiprocessing module to attain parallelism whereas concurrency in Python is achieved with the help of threading and Async IO modules . A program running in parallel are going to be called as concurrent but the reverse isn’t true .
Reference: Python Official Documentaion | https://axatjpr.medium.com/simple-concurrency-and-parallelism-in-python-8a7287c86761?source=post_internal_links---------5---------------------------- | CC-MAIN-2021-21 | refinedweb | 1,433 | 51.68 |
Disclaimer : Very new to django & python.
What is your opinion of this kind of code, where I use a view function which has classes in it for rendering to a template?
#objects for use in view
class Article():
def getContent(self): return "this is an amazing hard-coded article" #I guess you could link this to a model
Create your views here.
def index(request):
#template template = loader.get_template('index.html') #objects article = Article() #collection of objects collection = { 'article': article, } #pass to the template the collection for use in the template return HttpResponse(template.render(collection, request))
Yay or nay? and reasons why please. | https://forum.djangoproject.com/t/mixing-classes-and-view-functions/3686 | CC-MAIN-2022-21 | refinedweb | 104 | 57.67 |
puppet.conf
my config has the following...
path /facts
auth any
allow *
path /fact
auth any
allow *
path /facts_search
allow *
I think also I had to create an empty file called namespaceauth.conf like so;
namespaceauth.conf
touch /etc/puppet/namespaceauth.conf
/etc/puppet/auth.conf
I had the same issue and found that line 99 in /etc/puppet/auth.conf corresponded to the following:
# this one is not stricly necessary, but it has the merit
# to show the default policy which is deny everything else
path /
auth any
Commenting out path / and auth any allowed the Dashboard to access inventory using the following config:
path /
auth any
path /facts
auth yes
method find, search
allow dashboard
...as taken from.
namespace.conf and the other paths weren't necessary for me.
namespace.conf
It's an ordering issue - make sure the section:
is BEFORE the default section:
That worked + resolved the issue for me. Or as above, you could just comment it out!
The problem that you are having is two-fold. First, your auth.conf file needs to have the proper access. Many of the solutions mentioned here achieve that but at great risk! By using the following:
... you are allowing * access
"asterisk" means EVERYONE!!!
To fix this problem, you need auth.conf to have:
Then you need to create certs for "dashboard" user, just like you do for nodes. On CentOS 6 with puppet-dashboard-1.2.23-1.el6.noarch, these are the steps:
1) ensure that config/settings.yml have the correct hostname and
port for your puppetmaster
2) generate your keypair for dashboard:
sudo -u puppet-dashboard rake cert:create_key_pair
3)generate the cert request for dashboard:
sudo -u puppet-dashboard rake cert:request
4) on the puppetmaster, sign the cert:
puppet cert sign dashboard
5) get the cert from the puppetmaster
sudo -u puppet-dashboard rake cert:retrieve
6) restart dashboard
All of this will allow dashboard access to your puppetmaster facts with Certificate authentication.
Enjoy!
By posting your answer, you agree to the privacy policy and terms of service.
asked
3 years ago
viewed
2997 times
active
2 years ago | http://serverfault.com/questions/392697/puppet-dashboard-could-not-retrieve-facts-from-inventory-service/559033 | CC-MAIN-2016-18 | refinedweb | 357 | 65.73 |
Introduction: Practical Guide to LEDs 3 - Switching & Dimming 3 of a short series. Use the table of contents below to browse the content I've already published.
Your LEDs are working, so now it's time to make them do exactly what you want! This chapter covers everything from adding a simple switch to advanced dimming, suitable for almost all LEDs. Have fun and share the projects you come up with!
Chapters:
- Pick your LED!
- Essential Circuits
- Switching & Dimming
Step 1: On & Off
Turning LEDs on and off manually is as simple as it can get: Just put a switch in series with the LEDs you want to control. Most buttons and small switches will handle 100mA or so. More rugged switches, such as those used in power supplies, will handle a few amps.
In many projects you want the LED do something, such as blinking, without you pushing a button constantly. While most basic chips and circuits are able do drive a standard LED at 20mA, they are likely to be damaged at higher loads. For example the ATMEGA328P, the chip of the ARDUINO, can only deliver around 20mA (40mA, if you stress the chip to the limit).
To provide a higher current the signal needs to be amplified. Fortunately this is a fairly easy!
For this task usually one of the following components is chosen:
- (Bipolor) Transistor
- (Mos-)FET
These parts come in two types, NPN & PNP or N-Channel & P-Channel, respectively. While both types can be used to switch LEDs, NPN transistors and N-channel FETs require less circuitry to work. For now we'll stick to the simple solution.
NPN transistors and N-channel FETs will be used as a "low side switch", meaning they cut the connection between the LEDs and gound. Although it seems counter-intuitive at first it does not matter whether a load (such as an LED) is switched. Current flow requires a conducting path from the plus to the minus terminal. As soon as this loop is broken, it doesn't matter where, the current will stop flowing.
Step 2: Switching - NPN Transistor
Bipolar transistors are best suited for light to medium loads. They are cheap, widely available and often come in THT packages.
The example project: Ambient light activated lamp
The operating conditions:
- 3 white LEDs are connected in series with a resistor
- ILED = 30mA (total current to switch)
- The logic signal voltage is
- UIO = 5V
- The transistor chosen is the common BC817/BC337, but almost any will work
The circuit:
The circuit consits of two parts, the LEDs in series with R1 and the transistor with R2. The external circuitry provides a 5V signal if the LEDs should be turned on.
LEDs & R1:
The first thing you need to do is to calculate the value of R1 as described in chapter 2 - LEDs in Series.
Transistor & R2:
A bipolar transistor is turned on by a current flow from its base (B) to its emitter (E). The larger this current is, the more current can flow from its collector (C) to its emitter. Those currents are called IBE and ICE, respectively. Their ratio is called GAIN.
IBE * GAIN = ICE.
The gain varies a LOT in between parts, across temperature and current. For reliable results it is crucial to pick the lowest possible value from the datasheet for these calculations (see picture above). With the LED current and the the gain you can calculate the required switching current:
IBE = ICE / GAIN = ILED / GAIN
Now it is important to know that the connection from B to E is a diode, hence the little diode-like arrow in the schematic. This this BE-diode has a forward voltage of about 0.7V. To set the current through it a resistor is required. Fortunatly the calculations are identical to those of a single LED.
R2 = (UIO - UBE) / IBE = (UIO - UBE) * GAIN / ILED
With our values this results in:
R2 = (5V - 0.7V) * 100 / 0.03A = 14.3kΩ
R2 may be sligtly smaller than calculated to ensure IBE is large enough to drive the LEDs. Therefore
R2≈ 12kΩ
Transistor power dissipation:
Lastly we need to check if the transistor can handle the load without overheating. The maximum power disapation can be found in the datasheet:
Ptot = 250mW
The power dissipated is calculated as:
P = PBE + PCE = UBE * IBE + UCE * ICE
PBE is so small that we'll ignore it. UCE depends on ICE as Fig 8. from the datasheet shows. To illustrate how to read the diagram I've uploaded an annotated screenshot. The "@" below refers to a specific operating condition, in this case UCE is depended on ICE.
P = PCE = UCE@ICE * ICE = UCE@30mA * 30mA = 20mV * 30mA = 0.6mW
Since P is way smaller than Ptot the transistor is suitable for this application.
Step 3: Switching - N-Channel Mosfet
Mosfets are slightly more expensive but can drive huge currents effortlessly. Unfortunately they often come in SMD packages, which can be complicated to work with.
The example project: Ambient light activated lamp - 5050 LED strip Edition
The operating conditions:
- The power supply voltage is
- USYS = 12V typical.
- The LEDs are a 2m long 5050 LED strip with 120LEDs
- ILED = 0.8A
- The logic signal voltage is
- UIO = 5V
- The mosfet choosen is the common AO3400, it has a low on-resistance
The circuit:
The circuit consits of two parts, the LED strip and the mosfet with R2. The external circuitry provides a 5V signal if the LEDs should be turned on.
Mosfet & R2:
Unlike a transistor a mosfet is turned on by a voltage between its gate (G) and its source (S). This voltage is called VGS. As soon as VGS exceeds a certain threshold the connection from the drain (D) to the source will turn into a resistor with a very low value, RDS(ON).
There is no current flowing into the gate of a mosfet, and thus no resistor to limit the current is required. Instead R2 switches the mosfet off when no signal is applied. Its value is not critical and can be anything from 1kΩ to 100kΩ.
Mosfet turn-on voltage:
Some mosfets can require a quite high voltage (VGS) to turn on completely. If a part contains information like
RDS(ON) (at VGS = 4.5V) < XX mΩ
in the datasheet, it means it can be controlled voltages larger 4.5V. This information can also be hidden in the parameter tables, so check them carefully!
Mosfet power dissipation:
Again we check if the part is suitable for the load. The maximum power dissipation is
Ptot = 1.4W
The power dissipated is calculated as:
P = RDS(ON) * IDS²
This resuslts in
P = 33mΩ * (0.8A)² = 21.12mW
Under the identical conditions a BC817 transistor would generate
P = UCE * ICE = 300mV * 0.8A = 240mW
in heat, which pushing it to its limits. If the ambient temperature is higher than 25°C the transistor would operate beyond it's rating and fail soon. I strongly recommend you to select better parts than required as it allows for some errors in your calculation without failing.
Step 4: Analog Dimming
Over the last few years LEDs got constantly brighter and more powerful.
However there are situations where exactly that isn't wanted:
To bright status lights can disturb your sleep or drain the battery of a portable device too fast.
The simplest solution is to increase the value of the resistor. Doubling the resistor value results in about half the current through the LED. This is common practice in the industry for simple applications, but has three major disadvantages:
- The brightness is fixed
- LEDs are non-linear, making it hard to set the brightness precisely
- At lower currents some LEDs change their color slightly
There are several circuits to to solve the first issue:
- Widely used are potentiometers, which are nothing but variable resistors. They come with either a knob or a slider to change the resistance from 0% to 100%. Add a normal resistor with the minimum resistance required in series to ensure the LED always stays within operating condition, even when the potentiometer is set to 0% (so basically no resistor at all).
- Another option is to use switches to select a certain resistor. You can a also use a simple on/off switch to 'switch in' a resistor parallel to the 'main' resistor to decrease the total value. Just make sure the total value is still higher than the minimum resistance. This method is especially useful if you only need a few modes of operation, e.g. bright, medium and dim for a flashlight.
- There are a variety of circuits which do not require user control. Instead they use analog parts such as transistors or operational amplifiers to set various currents.
As far as I know there are no current regulating circuits which can fix issue number 2 & 3. This does not render analog dimming useless, though. For many devices it is still good enough, and it's far superior in terms of price and simplicity.
Step 5: Digital Dimming
While analog dimming requires some engineering, digital dimming is as simple as pushing a switch. Literally.
Human eyes are slow. For a film around 24 frames per second (fps) are enough that out brain merges it into a moving image. The same thing can be done with LEDs. Turn them on and off fast enough and we won't see a blinking LED, but an LED with lower brightness.
To see continuous light the switching frequency needs to be higher than for a film, 100Hz at minimum and up to a few kHz for moving objects. The unit hertz - Hz for short - is the frequency and can be interpreted as cycles per second. In each cycle the LED will be turned on for some time and off till the next cycle starts. The emmited light is proportional to the on time compared to the duration of a single period. The diagram above illustrates the typical driving signal.
Do note however that the brightness perceived by humans is not equal to the amount of emitted light. This allows us to distinguish light and dark colors at very bright and dim light conditions. Correcting for that is possible, but requires more advanced code or circuitry. As such it won't be covered here, but might be included in future chapters.
The benefits over analog dimming are:
- great control & color accuracy
- simple & small circuitry
- lower power consumption
Obviously no human can push a button that fast. But electronics can.
There is a variety of circuits without microcontrollers which can generate PWM signals. Commonly used is the astable multivibrator based on two transistors or the IC NE555. While the basic design is quite simple it can be hard to tweak the values of all components. For advanced discrete (i.e. without a microcontroller) LED circuits I highly recommend to check out simpletronic's instructables. His projects go far beyond usual maker's circuits by using nothing but standard components.
For the remaining chapter we'll generate PWM waveforms with a micorcontroller. It can be programmed as you like, has many outputs (for many LEDs), and is widely available. In this guide we'll be using the ATMEGA328P, the chip used in many ARDUINOs, but other controllers will work as well.
illustration source:...
Step 6: Pulse Width Modulation (PWM)
Pulse Width Modulation - PWM for short - is the correct technical term for digital dimming. It can be also used for many other applications beside controlling LEDs, therefore most microcontrollers have specialized hardware build-in.
To get started connect either a single LED directly or a group of LEDs through a transistor/mosfet to the PWM output OC0B of the ATMEGA328P/ ARDUINO. Each of the six build in PWM channels can be controlled individually while running your normal application code! If more channels are desired you need to switch the IOs within your application code, which is called Soft-PWM.
This step is all about code required to set up and run a PWM channel. While this is not an introduction to programming, basic knowledge will be enough to follow along. To get in touch with the inner workings of the chip, all registers (the internal settings storage) will be accessed directly in C and not through some fancy library. It may take a bit longer to learn, but performance is worth it!
The example project: Brightness adjustable 5050 LED strip lamp
The circuit:
The circuit is taken from "Chapter Switching - N-Channel Mosfet", the external circuitry is replaced with the microcontroller. The schematic shows the minimum of external components required for the ATMEGA328P, they are all included on every ARDUINO board.
The goal:
Usually there is some sort of input, such as a button, a knob or a sensor, to determine the output brightness. To keep things as simple as possible we'll program in a fixed value. Feel free to expand the program to suit your needs!
Preparation:
The official datasheet is always the #1 resource for any question you have about a particular component. If you haven't done so, download and open the complete datasheet of the ATMEGA328P. On mobile this can be quite a hassle, therefore I've included the relevant parts as screenshots above. (All screenshots of the datasheet are property of Atmel and are not covered by the licence of this instructable)
All code is written in AtmelStudio (which is available for free here) and uploaded with an AVR Dragon ISP Programmer. It should work just as well in the ARDUINO programming environment, although I have to admit I've never tried it. Please let me know if there are any issues with the code.
Every new project contains:
#include <avr/io.h> int main(void) { /* Replace with your application code */ while (1) { /* main loop */ } }
The
#include <avr/io.h> defines all registers with short names instead of just numbers. After power on the microcontroller strats executing code beginning from
int main(void). After a few initializations the main loop
while (1) is started, which continues until power is turned off.
The Timer/Counter0:
The most basic timer is Timer0 (p. 93-110). On power on it is disabled like all other peripherals to prevents unintentional behaviour. The timer has multiple modes of operation with additional settings. For LEDs the Fast PWM Mode (p. 99) is generally best suited.
How it works:
In Fast PWM Mode the timer is counting from 0 to 255 and begins then from 0 again. The change from 255 to 0 is called overflow. The current timer value is stored in the register TCNT0 (p. 108), which can be read ad modified in software. The timer module features two Output Compare Registers (OCR0A & OCR0B). One setting enables a continues comparison between these two values:
- When TCNT0 < OCR0B ⇒ output on ⇒ LED on
- When TCNT0 ≥ OCR0B ⇒ output off ⇒ LED off
To get ¼ of the total brightness OCR0B must be set to 63, which is ¼ of the maximum 255 steps. The figure 15-6 from the datasheet illustrates this.
Configuration - Mode Setting:
To load this setting the Control Register A (TCCR0A) (p. 104) needs to be written:
TCCR0A = (1<<COM0B1)|(0<<COM0B0) // Turn output off when TCNT0 >= OCR0B |(1<<WGM01)|(1<<WGM00); // Select Fast PWM Mode
To write to a register type its name
TCCT0A the value after a
= . The expression
(1<<COM0B1) turns on the bit at the position of
COM0B1. A
| combines all individual bits to a single byte. All other bytes are set to 0. Before flashing AtmelSudio turns the well readable code into the byte
0b00100011, resulting in a very fast execution on the chip.
Configuration - Frequency Setting:
One cycle takes 256 steps to complete. Depending on the setting and external parts the ATMEGA328P runs at 1MHz (default factory setting), 8MHz (max frequency of internal RC oscillator) or 16MHz (with external crystal, default on all ARDUINO boards). The PWM frequency can be calculated with:
fPWM = fclock / steps
With values above this resuslts in:
fPWM = 3906Hz @ fclock = 1MHz
fPWM = 31250Hz @ fclock = 8MHz
fPWM = 62500Hz @ fclock = 16MHz
To avoid unforeseen issues (high switching losses, crosstalk, EMI) it is the best practice to keep all frequency as low as possible. To archive this the Timer0 features a prescaler which can divide the clock by 1, 8, 64, 256 or 1024. Setting a prescaler value also turns turns the timer on.
Assuming the clock is running at either 8MHz or 16MHz a prescaler of 256 results in the lowest frequency above 100hz.
fPWM = 31250Hz/256 ≈ 122Hz @ fclock = 8MHz
fPWM = 62500Hz/256 ≈ 244Hz @ fclock = 16MHz
It is set by writing to the Control Register B (TCCR0B) (p. 107):
TCCR0B = (0<<CS02)|(1<<CS01)|(0<<CS00); // Start timer with prescaler of /8
Configuration - Enable Output:
By default all IOs are configured as inputs to prevent damage to external circuitry. This setting also applies to the timer. The corresponding output to the PWM channel OC0B is PD5. This is done with:
DDRD |= (1<<DDD5); // Enable the output for the IO PD5A normal
=forces all other bits to zero which is highly impractical for IO ports. Instead
|=is used to set the individual bit. To turn of any amount of bits (examble for PD5 & PD6) use:
DDRD &= ~((1<<PD5)|(1<<PD6));
Configuration - Brightness Setting:
Currently the LED is running at the default brightness value of 0. To change this write the desired brightness level to the register OCR0B (p. 108):
OCR0B = 63; // Set brightness to 25%
You can edit this value at any time. To prevent glitches the value will be stored temporally and loaded to OCR0B when the cycle is completed (an overflow occurs).
Get playing!:
I get it, a static brightness is boring as hell. To help you to get started I've included an advanced example below. The code uses both PWM channels to drive tow colors of an RGB LED, it gracefully combines both colors with a smooth and slow transition. It uses an interrupt triggered by Timer0 overflow. If enabled, an interrupt pauses the main code (in the main loop), executes a few lines of code, and the returns to the main code. With interrupts there is no need for delays!
#include <avr/io.h> // Defines names most functions #include <avr/interrupt.h> // Provides access to the assmbler commands sei() and cli() volatile uint8_t brightness_LED1 = 0; // uint8_t generates a byte-sized variable, // volatile is required for access within an ISR volatile uint8_t brightness_rising = 1; // 0 = false, all other values = true int main(void) { TCCR0A = (1<<COM0A1)|(0<<COM0A0) // Turn output off when TCNT0 >= OCR0A |(1<<COM0B1)|(0<<COM0B0) // Turn output off when TCNT0 >= OCR0B |(1<<WGM01)|(1<<WGM00); // Select Fast PWM Mode TCCR0B = (1<<CS02)|(0<<CS01)|(0<<CS00); // Set the prescaler to /256 and start the timer DDRD |= (1<<DDD5)|(1<<DDD6); // Enable the output for the IO PD5, PD6 TIMSK0 = (1<<TOIE0); // Enable interrupts @ overflow sei(); // Enable interrupts in general while (1) { /* main loop */ } } ISR(TIMER0_OVF_vect) // This code will be executed every overflow! { // Load current values OCR0A = brightness_LED1; OCR0B = 255-brightness_LED1; // Prepare next values if(brightness_LED1 == 0) // Check if lowest value is reached { brightness_rising = 1; // Set direction to count up } else if (brightness_LED1 == 255) // Check if highest value is reached { brightness_rising = 0; // Set direction to count down } if (brightness_rising) // Check counting direction { brightness_LED1++; //increase brightness by 1 } else { brightness_LED1--; //decrease brightness by 1 } }
17 DiscussionsW
I Have broken down the equation as follows...
P = PCE
P = VCE@ICE * ICE
P = VCE@30mA * 30mA
P = 20mV * 30mA = 0.6mW
First, what is substituted for the @ in the calculation, also How do we calculate the 20mA value or where does it come from.
I'm not trying to be a pest, just trying to understand the equation.
Thanking you, merseytrainz (Steve)
That's an excellent question Steve, after re-reading that step I doubt that anybody understood what I meant.
VCE depends on ICE, but it can not be expressed through a formula. Instead you need to read the value from the diagram included in the datasheet. I've uploaded an annotated screenshot to the step to illustrate what I mean.
In general I use the "@" to refer to a specific operating condition. If a circuit is designed to run at different voltages I may note down the current consumption like this: 21mA@5V, 16mA@3.3V. Although I like this notation a lot, I have to admit it is not commonly done this way.
Actually I'm thankful if I get questions like yours. It's a chance to improve the content which may help dozens of future readers. So, thank you. :)
Greetings, Dennis
Hi nqtronix I'm having trouble solving one of the equations in 'Step 2: Switching - NPN Transistor'.
Does this equation...
R2 = (UIO - UBE) / IBE = (UIO - UBE) * GAIN / ILEDk
R2 = 4.3V * 100 / 0.03 = 14,333.333 = 14.3kΩ (using a GAIN of 100)
To get an answer of 143.3k I have to use a GAIN of 1000
R2 = 4.3V * 1000 / 0.03A = 143,333 or 143.3kΩ (using a GAIN of 1000)
I'm a newbie to electronics and need some help understanding. The series so far is great and I have learnt a lot. Many Thanks
Actually, I was the one having trouble solving the equation ;) . Sorry for the confusion, 14.3kΩ is indeed the right value for the calculation. Thank you for pointing this out! I've updated the instructable with the correct value and added the missing screenshot showing the gain value from the datasheet.
I'm glad this helped you to learn something new!
Well it's Monday and no Chapter 4. Are you goofing off again? Okay, just kidding. Being serious, this has been an amazingly excellent series and I am looking forward to the next chapters. Thanks you so very much.
Believe me, I'd rather write than doing all of the other things I have to. Unfortunatly there is often no choice.
Comments like this give me the motivation I need to keep going. Thank you!
When you get to chapter 5, would you be able to do as an example, the power requirements to run the 5050 LED strip if we wanted to light the eves of say a 2000 square foot house, which would be 61 meters? In this scenario I think we would need to take into consideration the maximum current the base material the led's are mounted on can carry, and voltage drop on the length of the strip. To compensate one would either need to run heavy bus wire parallel to the strip, or use multiple power supplies connected to the house mains wiring. Multiple power supplies are probably cheaper than the copper to carry the DC voltage, so one would likely run a lighter gauge of copper to carry the AC to the various power supplies.
This is also of great interest as I am going to be using led grow lights in my solarium this winter to try and get some fresh veggies. My plan for the moment is to use an ATX power supply to drive them, but I haven't even gotten that far yet.
I'm still in the process of choosing the the information to write about. I will mostly be about power losses at the various stages (which includes voltage drop across cables) an thermal design.
In your case I would suggest to use 12 individual 5m 5050 LED strips, each with its own wirering to a power supply. 24V LED strips can be up to 10m long. For even longer stripes you need a single (fairly thick) wire running back from one end to the beginning. This spreads out the resistance of LED strip across all LEDs and guarantees an even brightness. Use seperate power supplies for each room you want to light, this allows to turn them off completely (without any standby current).
Hope that helps!
"The brightness is proportional to the on time" you said on step 5.
Unfortunately, that's not true.
For human eye, brightness is proportional to the log of intensity, e.g. "on" time
Full brightness is for 100% duty cycle, you will achieve:
- half brightness with 35% duty cycle
- quarter brightness with 15% duty cycle
Google for "led duty cycle vs. brightness"
That's right, to cover the huge dynamic range our eyes are capable of the only way is to use a logarithmic scale. The first draft contained some information about this. The proposed fix requires a 16bit timer and a look up table at minimum, which may overwhelm beginners, so I decided to remove it for now.
By the term "brightness" above I actually meant the amount of light (= photons) emitted , which is in fact linear. I've updated this chapter with a clarification on that topic.
You made a mistake in your first illustration. You have both the NPN and PNP labeled as BC807. The NPN should be a BC817 or similar.
Otherwise, great series. Thanks for taking the time to document this so clearly.
You're right, thanks for pointing that out. It's fixed now :)
All this has been so helpful for me with understanding electronics more and messing round with LED's & stuff.
I really appreciate the time and effort you have put into it all.
Will be studying it some more come the weekend.
Thanks again.
Nice to see you back! If stuble upon something which is not mentioned here, drop me a message and I'll add it :)
Have fun!
Wow! Very informative. While I'm pretty confident with led's and driving them, this was a very informative piece covering a lot of information. Thanks for taking the time to put this up
Thanks.
Note that you can also make LEDs flash using analog electronics. Look up astable multivibrator. Example : . The end of that article integrates nicely with yours.
Yup, totaly forgot about that! While this instructable isn't meant to be about generating signals, I admit it can be pretty useful as a simple PWM generator. I've added a little paragraph mentioning that.
Thanks for the hint :) | https://www.instructables.com/id/Practical-Guide-to-LEDs-3-Switching-Dimming/ | CC-MAIN-2018-34 | refinedweb | 4,359 | 72.05 |
Quick tip: Custom Material-UI styles with Typescript
I recently started to use Typescript with Material-UI. I wanted to add color instances to the palette for the AppBar and Hero background. No problem, just edit
/src/gatsby-theme-material-ui-top-layout/theme.js like this.
import { createMuiTheme } from '@material-ui/core' const theme = createMuiTheme({ palette: { background: { appbar: '#0c052e', }, }, }) export default theme
Dang, now I have errors in my file.
Alright, we can fix this. Let's first find out where the issue is by hovering over the error.
So
TypeBackground is the culprit, let's find it in node_modules. Opening
@material-ui/core/styles/createPalette you will find it.
import { Color, PaletteType } from '..'; ... export interface TypeBackground { default: string; paper: string; } ... export default function createPalette(palette: PaletteOptions): Palette;
Now create a new file where we can extend the type
/src/types/createPalette.d.ts.
import * as createPalette from "@material-ui/core/styles/createPalette" declare module "@material-ui/core/styles/createPalette" { export interface TypeBackground { default: string paper: string appbar: string } }
Great, now we need to import this file somewhere. I have no idea what the best practice is, but I would like all the types to get imported into one file. I'm going to do it in index.tsx until someone tells me why I shouldn't.
import TypeBackground from '../types/createPalette'
VSCode is happy again! | https://jameskolean.tech/post/2020-07-30-quick-tip-materialui-typescript/ | CC-MAIN-2022-40 | refinedweb | 227 | 52.15 |
Hi people,
I have a C application that creates a UNIX socket in /tmp/server.socket. This is server-side.
Locally I have the Vue.app that is my web frontend. This is the client-side.
I want that Vue.app connects into that socket /tmp/server.socket to receive/transmit data.
Then with Vuex, all components will interact.
I had used the node-ipc in basic examples (not in a Vue.app) and works very well.
But now when I create a simple instance of node-ipc my application is not renderized and I received an error on browser console.
main.js :
import '@fortawesome/fontawesome-free/css/all.css' import Vue from 'vue' import App from './App.vue' import './config/bootstrap' import './config/msgs' import './config/axios' import './config/mq' import store from './config/store' import router from './config/router' Vue.config.productionTip = false const ipc = require('node-ipc') // <<<=== What is the problem here ? ipc.config.id = 'test'; new Vue({ store, router, render: h => h(App) }).$mount('#app')
Error on console browser :
Someone could help me what is the problem or tell me the best directions to implement this kind of communication?
Thanks a lot | https://forum.vuejs.org/t/how-to-implement-a-local-inter-process-communication-in-vue-app/98606 | CC-MAIN-2020-29 | refinedweb | 196 | 63.15 |
This looks reasonably unremarkable, just a shufling of the details of the system:
The.
But a corollary of this system is that everyone is going to have to file tax returns. So everyone is going to see quite how much tax they pay.
Which will inevitably increase the pressure for lower taxes.
Quite cute really.
This is a ‘devil in the detail’ one, isn’t it? I don’t follow your logic – my pay slip shows gross and net salary, and presumably the bank account will be credited only with net salary (or gross then immediately net) which seems exactly the same?
“The Tories, who are in talks with various technology providers who are developing the system”
Oh.
I’ve often wondered if the lower tax rates in the USA are down to the fact that everyone has to file their own tax return annually, and thus gets to see what the State steals from them.
Whether our infantilised nation could deal with the responsibility of a tax return (all that record keeping, and managing deadlines etc etc) remains to be seen.
What Matthew says.
We know it won’t work because HMRC (or whoever has bribed the Tories to give them the contract) will never get the codes right.
This would only work if we had a flat income tax deducted from all income.
S, no, people can’t cope with getting all bits of paper together, but neither can they in other countries.
I don’t think that’s what they’re saying. It’s more like… employer sends payment to (for instance) Crapita, Crapita take the government’s share and pass the rest to the employee’s bank account.
Which will be just fine until Crapita spectacularly fail and the payments don’t arrive and people’s direct debits start bouncing.
The bit you all seem to have missed is that this will give the government direct access to your bank account and carte blanche do take from it as much as they like, as often as they like and when they like. Mission creep will soon extend that access to the local council snodgrasses, myriad other agencies and, no doubt, a raft of private ones.
What Matthew says: Devil in the details.
Payroll is a PITA for small business owners. If the banks can roll it all in to one service, great. If the Government just DDs out what it thinks is right, bad.
Pingback: FCAblog » Goodbye, PAYE?
will this mean employers can no longer do the weekly cash wage packet as in e.g. the garage trade
I’m loving the American system, it’s like D.I.Y. P.A.Y.E. You tell your employer how much to withhold and therefore get to choose your own “net” pay – at least until the end of the tax year.
Set the level low and you get a tax bill at year end. Set it high and you have your own saving scheme.
This is a heads I win, tails you lose proposal.
Either the state gets first crack at you income, as Joseph Takagi suggests, opening the way for the eventual barring of transfers that do not go via “Crapita”, or whoever, or the state gets to deduct tax directly from you account, opening the way for arbitrary confiscation of any money you cannot adequately explain.
Oh! C’mon. If you are doing nothing wrong, what have you got to worry about? Just because a few tax/medical/personal details got left on a computer on the train the other day, there’s no need to be paranoid…
I see this as a means to give HMRC the right to take money OUT of our bank accounts at will.
They will screw up. Guaranteed. We will have to beg for our money back instead of them declaring what we owe/underpay and argue it out.
All part of the mentality that they have “first call” on our earnings.
Better we first remove many, then most from, while flattening and then ending income tax.
Oh how time changes one’s perspective, eh? | https://www.timworstall.com/2010/02/oh-very-cute-very-cute-indeed/ | CC-MAIN-2020-40 | refinedweb | 686 | 79.3 |
There are many applications in programming where we have to randomly pick an element in a list. Python has the random module which includes a randint function for this exact purpose. Here’s an example.
from random import randint if __name__ == '__main__': names = ['Bob Belcher', 'Linda Belcher', 'Gene Belcher', 'Tina Belcher', 'Lousie Belcher'] num = randint(0, len(names) - 1) # -1 because lists are 0 based print('Random number was', num) print('Name picked randomly is', names[num])
When run, this code produces the following output (which is different each time the script is ran).
Random number was 4 Name picked randomly is Lousie Belcher
Advertisements
One thought on “Random Int—Python” | https://stonesoupprogramming.com/2017/05/09/random-int-python/ | CC-MAIN-2018-05 | refinedweb | 111 | 58.82 |
Heart Attack Detection Using TensorFlow | Python
In this, post we will predict heart attack detection using deep neural networks in Python with the help of TensorFlow and Keras deep learning API.
To achieve this goal, I am going to use an open-source dataset and I will create a deep neural network model with the help of Keras deep learning API. You can download the dataset from the link Dataset
Download the dataset and look at the dataset carefully, you will find that the dataset is containing a categorical target variable in the form of 0’s and 1’s. Now let’s move forward to implement it with the help of TensorFlow and Keras deep learning API.
NOTE: Please install all the required libraries into your system, If possible otherwise please follow the tutorial with me using google colab’s runtime environment.
import numpy as np import pandas as pd %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt
import tensorflow as tf from tensorflow import keras
In the above two code snippet, you can see that I am importing the required library. I am importing two important libraries Keras and Tensorflow and that is going to play an important role in building our model for heart attack detection or prediction.
Let’s move forward and load our dataset.
df=pd.read_csv("/content/drive/My Drive/Internship/heart.csv") df.tail()
OUTPUT:
The above code is helpful to load the dataset into our notebook, I am using tail() to look at my dataset from the bottom.
df.head()
OUTPUT:
If you want to see the dataset from the top, you can use head() and it will result in showing you the dataset from the top.
Now we will get the information about our dataset, for this purpose we will use info().
df.info()
OUTPUT:
df.describe()
above code is helpful to describe the dataset, for this purpose I am using describe(). You can verify the output below. Your small task is to see the dataset’s parameters given below such as mean, std, min, and the max value.
OUTPUT:
Now moving forward to look at the correlation matrix of our dataset.
mpl.rcParams['figure.figsize'] = 20, 14 plt.matshow(df.corr()) plt.yticks(np.arange(df.shape[1]), df.columns) plt.xticks(np.arange(df.shape[1]), df.columns) plt.colorbar()
OUTPUT:
You can visualize the correlation matrix of the given datasets.
df.hist()
The above piece of code is useful to plot the histogram of our dataset. You can verify the output below.
OUTPUT:
Hope you are enjoying the tutorial as well as following this tutorial with me.
Now we will look at our dataset more closely and in a precise manner.
dataset=df mpl.rcParams['figure.figsize'] = 8,6 plt.bar(dataset['target'].unique(), dataset['target'].value_counts(), color = ['pink', 'green']) plt.xticks([0, 1]) plt.xlabel('Target Classes') plt.ylabel('Count') plt.title('Count of each Target Class')
OUTPUT:
You can visualize and count the target class of the given datasets.
from sklearn.preprocessing import StandardScaler df = pd.get_dummies(df, columns = ['sex', 'cp', 'fbs', 'restecg', 'exang', 'slope', 'ca', 'thal']) standardScaler = StandardScaler() columns_scale = ['age', 'trestbps', 'chol', 'thalach', 'oldpeak'] df[columns_scale] = standardScaler.fit_transform(df[columns_scale])
df.head()
OUTPUT:
As we have seen in our dataset that, there are lots of categorical values like 0’s and 1’s in our input feature so it is always a good idea to get dummies variable for those categorical variables.
For this purpose, you can use a library provided by pandas, as you can see in the above code I am using pd.get_dummies() to get the dummies variable for each categorical input feature.
If you have followed the last tutorial for Diabetes prediction you must know that we have to convert our dataset into a standard scaler format. And I have told you that basically standard scalar format is used to remove the mean and used to scale each feature to unit variance.
So in the above piece code, I am doing two things first is to get the dummies variable and then convert our input feature into standard scalar formate.
moving forward to the next and important step.
from sklearn.model_selection import train_test_split y = df['target'] X = df.drop(['target'], axis = 1) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.33, random_state = 0)
In the above code, I am splitting my dataset into a train and test set using the library provided by sklearn .
np.random.seed(42) tf.random.set_seed(42)
As you can see above, I am using a random seed to generate a pseudo-random number and assigning to our tf graph.
Let’s collect the shape of our input feature and create our model.
X_train.shape
OUTPUT:
(203, 30)
from keras.models import Sequential from keras.layers import Dense, Dropout model = Sequential() model.add(Dense(15, input_dim=30, activation='relu')) model.add(Dense(10, activation='relu')) model.add(Dense(8, activation='relu')) model.add(Dropout(.2)) model.add(Dense(1, activation='sigmoid'))
As you can see in the above snippet of code, I am using a sequential model. And as in the previous block of code, we have collected the shape of our input feature and that was 203 rows and 30 columns. So if you will look closely at our input layer then you will find that I am taking input_dim as 30, now you must get my point.
I am using relu activation function in the input layer and sigmoid activation in the output layer.
I am also using a 20% dropout layer.
model.summary()
look to the summary of our dataset, we have a total of 722 trainable parameters.
model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])
model_history = model.fit(X_train, y_train, epochs=200, validation_data=(X_test, y_test))
OUTPUT:
You can see in the above code that I am compiling my model with 200 epoch, with binary-cross entropy loss function and adam optimizer.
I have also given a link to the code at last where I have used SGD optimizer, Output looks like this. You can see the difference between both the output and that is above code is looking to overfitted but the below one is not overfitted.
model.compile(loss="binary_crossentropy", optimizer="SGD", metrics=['accuracy'])
OUTPUT:
model_history.history
OUTPUT:
You can visualize the history of the created model using the above code.
Now moving forward predict the values using our model.
y_pred = model.predict(X_test) print (y_pred)
OUTPUT:
you can see the predicted output, and also you can verify with the actual value.
THANK YOU
CONCLUSION:
Hope you enjoyed and followed the tutorial with me, you are welcome with any further suggestion.
You can further modify the code to increase the accuracy, like adding another optimizer, increasing the epochs.
As you have seen the differences between two optimizers that how they influence our model so always remember your requirement and then you use the parameters.
You can also use sigmoid instead of relu for final probability between 0 and 1.
You can make some changes in the code and see the effect of used parameters that how they are influencing our model’s accuracy, you can get the code with the help of the given link Heart_attack_detection
Thanks for your time. | https://valueml.com/heart-attack-detection-using-tensorflow-python/ | CC-MAIN-2021-25 | refinedweb | 1,213 | 55.03 |
There is no doubt that Microsoft’s VS App Center is an incredible resource
for mobile application programmers. The problem is that it seems hard to get started. The good news is that once you get started, it turns out to be wicked easy!
For this blog post, I’m going to assume that you are already sold that App Center is the Cat’s Meow; if not check out this article by Microsoft on why App Center is so cool.
The short version is that App Center allows you to Build your application in the cloud, directly from your repository. You can Test (using Xamarin Cloud) and you can Distribute to beta testers. You can also set up and view analytics and crash reports. Finally, you can set up push notifications.
In the next few blog posts I’ll go over each of these areas, and be sure to keep an eye out for my forthcoming course on App Center on LinkedIn Learning (part of my Azure Essentials series) . You’ll find these posts on Wintellect’s blog and on my own.
Getting Started
There are a number of ways into App Center, but the key thing to understand is that you can use Analytics, Crash Reports and more just by adding a couple lines of set up code to your program. Then it just works.
I like to divide my perspective on App Center into two groups: those things I do locally, and those I do through the App Center portal. We’ll start, however, with the fundamental set up; which will get you started, and which, incidentally, will get you analytics and crash reporting.
To begin, you need an AppCenter account. Go to where you will find the welcome screen. Click on Get Started and create an account. You can sign in to do so using your GitHub, Microsoft, Facebook or Google OAuth account, or you can create a username and password.
Once in, let’s pause and create a local app. I’ll create a basic Xamarin.Forms app in Visual Studio 2017 that I’ll call AppCenterBlogDemo. (Feel free to create whatever kind of app you like). Be sure to check that you want a local Git repo (you can always do this later, but it is easiest to do it when you create the app). Build it and make sure it runs.
Adding A New App
OK, from here you have a lot of options. We’re going to take it one step at a time, over the next few blog posts. Let’s start by going back to App Center and clicking on Add New App.
A dialog slides out, where you can name your new app (I’ll use the same name here: AppCenterBlogDemo) and optionally add a description.
Click Add New App. This takes you to a screen where you can add the sdk to your app. The instructions are precise and easy. The first step is to add the NuGet packages. They tell you (if you are on Windows) to install Microsoft.AppCenter.Analytics and Microsoft.AppCenter.Crashes.
Do the normal NuGet thing (search for App Center, load each package to all projects). Note that Microsoft.AppCenter should be installed automatically as the other two have a dependency on it. After the installation make sure AppCenter was installed; there is a bug and sometimes you have to install Microsoft.AppCenter explicitly.
Now, if you are creating a Xamarin.Forms app, open App.xaml.cs and add these using statements:
using Microsoft.AppCenter; using Microsoft.AppCenter.Analytics; using Microsoft.AppCenter.Crashes;
Once done, find OnStart and add this code:
AppCenter.Start("android=axx2a9x7-xxb2x-4a7a-xxxx-2exxc18axxd7;" + "uwp={Your UWP App secret here};" + "ios={Your iOS App secret here}", typeof(Analytics), typeof(Crashes));
Because I indicated this was an Android app, I have a “secret” for Android right there in my instructions. No extra work; cool. I now can go back and get one for iOS and/or UWP, but I’m going to stick with just Android for now. Thus, I’ll trim this statement down:
AppCenter.Start("android=a4a2a9b7-xxxxx-4a7a-xxxx-2exxx18a79d7;" , typeof(Analytics), typeof(Crashes));
Notice that we’ve added typeof(Analytics) and typeof(Crashes). That is where the magic is; we’ll be adding to this in later posts. Rebuild in Release mode (App Center only works with Release versions). Run. Done.
That’s It?
That’s all you have to do to get basic Analytics and Crash Reporting working. You can prove this to yourself by running your app; then going to the Analytics tab.
In the upper right corner is a drop down that says Last 30 days; change it to Last 7 days.
Hey! Presto! your sign-on shows.
Of course, the analytics will be much more valuable once you’ve distributed your app to a number of beta testers. Still, clearly, it is working. I find it kind of magical.
Next Steps
Next time we’re going to look at building your app in the cloud using AppCenter. We’ll do that by connecting App Center to your git repo on BitBucket (or Git or VSTS). You’ll then be able to build (and distribute) on demand or everytime a new checkin is pushed to the server. But that’s next time.
Be sincere to the major improves, specifically
about the switch and river because these people
often don’t bluff.
Cheers, here from yanex, me enjoyng this, will come back soon. | http://jesseliberty.com/2018/01/29/getting-started-with-vs-app-center/ | CC-MAIN-2019-22 | refinedweb | 920 | 74.79 |
enumerateUsers fails with unicode arguments
Bug Description
The enumerateUsers method of ZODBUserManager plugin does not
handle unicode arguments right. In the following example (taken
and modified from test_ZODBUserMa
('foo', 'bar', 'baz', 'bam' ) and then search for u'abc'. I would have
expected that nothing is found. Instead, we get three matches:
ID_LIST = ( 'foo', 'bar', 'baz', 'bam' )
for id in ID_LIST:
zum.addUser( id, '%<email address hidden>' % id, 'password' )
info_list = zum.enumerateUsers( id = u'abc',
=> 'bar', 'baz', 'bam'
Reason:
class ZODBUserManager
def enumerateUsers(
....
if isinstance( id, str ):
id = [ id ]
if isinstance( login, str ):
login = [ login ]
Because u'abc' is no str object, it is *not* transformed to a list.
Thus, later on we search for: "a", "b" and "c".
I dont know what is the best fix for this. Either we can
assume a standard encoding of the user names, then we can
encode to that string. Or we log an error, eg "string argument
required". But i think it is wrong to enumerate 'bar', 'baz' and
'bam' if we look for u'abc'.
The attached patch makes your test pass.
Thanks for the report, and the test. I have checked in the test and a fix
on the 1.4 branch, the 1.5 branch, and the trunk. Both are included in
the 1.5.3 release.
attached is a patch which includes the new unicode test. we expect zero matches but get three ones. | https://bugs.launchpad.net/zope-pas/+bug/189627 | CC-MAIN-2017-17 | refinedweb | 235 | 76.93 |
- Tools
- Using tools
- Builtin tools
- tools.accept
- tools.basic_auth
- tools.caching
- tools.decode
- tools.digest_auth
- tools.encode
- tools.err_redirect
- tools.etags
- tools.expires
- tools.flatten
- tools.gzip
- tools.ignore_headers
- tools.log_headers
- tools.log_tracebacks
- tools.nsgmls
- tools.proxy
- tools.referer
- tools.response_headers
- tools.session_auth
- tools.staticdir
- tools.staticfile
- tools.sessions
- tools.tidy
- tools.trailing_slash
- tools.xmlrpc
Tools
Using tools
Tools are a great way to package up behavior that happens outside your page handlers. For example, you can add static directory serving with the builtin staticdir tool with just a few lines in your config file:
[/docroot] tools.staticdir.on: True tools.staticdir.root: "/path/to/app" tools.staticdir.dir: 'static'
This turns on the staticdir tool for all URLs that start with "/docroot". You can also enable and configure tools per controller or per handler using _cp_config:!
Builtin tools, if no match is found, then HTTPError 406 (Not Acceptable) is raised. Note that most web browsers send */* as a (low-quality) acceptable media range, which should match any Content-Type. In addition, "...if no Accept header field is present, then it is assumed that the client accepts all media types."
tools.basic_auth
A tool for doing basic authentication..caching.
For more information see Caching.
tools.decode
Use this tool to decode cherrypy.request.params (GET and POST query arguments) from on-the-wire strings to Unicode. If you think you know exactly what encoding the client used, and want to be strict about it, set tools.decode.encoding; otherwise, set tools.decode.default_encoding as needed (it defaults to UTF-8). Note that, if the encodings you supply fail, the tool will fall back to decoding from ISO-8859-1 (as the HTTP spec requires).
tools.digest_auth
A tool for doing Digest authentication (RFC 2617)..encode
Encode the outgoing response body, from Unicode to an encoded string. If you specify tools.encode.encoding, the tool will error if the response cannot be encoded with it. Otherwise, the tool will use the 'Accept-Charset' request header to attempt to provide suitable encodings, usually attempting utf-8 if the client doesn't specify a charset, but following RFC 2616 and trying ISO-8859-1 if the client sent an empty 'Accept-Charset' header.
tools.err_redirect
Turn this tool on to redirect all unhandled errors to a different page. Supply the new URL via tools.err_redirect.url. By default, this raises InternalRedirect?. To use HTTPRedirect, set tools.err_redirect.internal to False.
tools.etags
This--your code must provide it before this tool is called (in the before_finalize phase)..flatten
Wraps response.body in a generator that recursively iterates over body. This allows cherrypy.response.body to consist of 'nested generators'; that is, a set of generators that yield generators.
tools.gzip
This tool gzips (compresses) the response body if possible, and sets the 'Content-Encoding' and 'Vary' headers appropriately. The client must send an 'Accept-Encoding' request header that prefers 'gzip' or 'x-gzip'. If a suitable encoding cannot be produced, then 406 Not Acceptable is raised.
tools.ignore_headers
Deletes request headers whose field names are included in tools.ignore_headers.headers. This is a useful tool for working behind certain HTTP servers and proxies; for example, Apache duplicates the work that CP does for 'Range' headers, and will doubly-truncate the response.
tools.log_headers
When enabled, the headers of every request will be sent to CherryPy's log.
tools.log_tracebacks
When turned on, all unhandled errors will have their tracebacks sent to CherryPy's log.
tools.nsgmls
A tool for validating the response according to NSGMLS. If errors are encountered, the response body is replaced with the error output.
tools.proxy
Example:.
Example config for a mod_python site running at:
[/] tools.proxy.on: True tools.proxy.base: ""
tools.referer
def referer(pattern, accept=True, accept_missing=False, error=403, message=):
Raises HTTPError if the client's Referer header does not pass our test.
- pattern: a regular expression pattern to test against the Referer.
- accept: if True (the default), the Referer must match the pattern; if False, the Referer must NOT match the pattern.
- accept_missing: if True, permit requests with no Referer header. Defaults to False.
- error: the HTTP error code to return to the client on failure. Defaults to 403 Forbidden.
- message: a string to include in the response body on failure. Defaults to 'Forbidden Referer header.'
tools.response_headers
Use this tool to set static response headers. Here's the complete source code for the Tool, to show you again how easy it can be to make your own tools:
def response_headers(headers=None): """Set headers on the response.""" for name, value in (headers or []): cherrypy.response.headers[name] = value cherrypy.tools.response_headers = cherrypy.Tool('on_start_resource', response_headers)
tools.session_auth
tools.staticdir
Serves static resources from the given (.root +) tools.staticdir.dir. See StaticContent.
tools.staticfile
Serves a static resource from the given (.root +) tools.staticfile.filename. See StaticContent.
tools.sessions
See CherryPySessions.
tools.tidy
A tool for validating the response according to HTML Tidy. If errors are encountered, the response body is replaced with the error output.
If either tools.tidy.indent or .wrap are specified, then response.body will be set to the output of tidy. If .warnings is True (the default), the response body will contain them. Otherwise, only errors will change the body. Note that we use the standalone Tidy tool rather than the python mxTidy module. This is because this module does not seem to be stable and it crashes on some HTML pages (which means that the server would also crash). You must set tools.tidy.tidy_path to the location of the Tidy executable on your system. You must also provide a value for temp_dir, the location in which to write the temporary files for shuttling output to the Tidy executable..xmlrpc
Don't use this directly. Instead, it's used by the XMLRPCController. To use it, have your controllers subclass cherrypy._cptools.XMLRPCController..:
[global] request.dispatch: cherrypy.dispatch.XMLRPCDispatcher() | http://cherrypy.org/wiki/BuiltinTools | crawl-001 | refinedweb | 990 | 51.44 |
Before you dive into a full-fledged peer-to-peer application, you need to understand some of the design issues that affect every peer-to-peer project. These are questions about peer identity, discovery, communication, and interaction. In this chapter, you'll investigate these issues and dissect different types of peer-to-peer architecture.
You'll notice that this is a fairly short chapter. There's a reason for that. Although peer-to-peer architecture is important, it's often more helpful to see live examples than volumes of theory. This chapter is only meant to introduce the basics that you need to understand the peer-to-peer examples developed throughout the book.
One characteristic you won't find in the peer-to-peer world is consistency. The more you learn about different peer-to-peer applications, the more you'll see the same problems solved in different ways. This is typical of any relatively new programming model in which different ideas and techniques will compete in the field. In the future, peer-to-peer applications will probably settle on more common approaches. But even today, most of these techniques incorporate a few core ingredients, which are discussed in the following sections.
In a peer-to-peer system, a peer's identity is separated into two pieces: a unique identifier, and a set of information specifying how to contact the peer. This separation is important—it allows users in a chat application to communicate based on user names, not IP addresses, and it allows peers to be tracked for a long period of time, even as their connection information changes.
The connectivity information that you need depends on the way you are connecting with the peer, although it typically includes information such as a port number and IP address. (We'll examine this information in detail in Chapter 7, which explains core networking concepts.) The peer ID is a little trickier. How can you guarantee that each peer's identifier is unique on a large network that changes frequently?
There are actually two answers. One approach is to create a central component that stores a master list of user information. This is the model that chat applications such as Windows Messenger use. In this case, the central database needs to store authentication information as well, in order to ensure that peers are who they claim to be. It's an effective compromise, but a departure from pure peer-to-peer programming.
A more flexible approach is to let the application create a peer identifier dynamically. The best choice is to use a globally unique identifier (GUID). GUIDs are 128-bit integers that are represented in hexadecimal notation (for example, 382c74c3-721d-4f34-80e5-57657b6cbc27). The range of GUID values is such that a dynamically generated GUID is statistically unique—in other words, the chance of two randomly generated GUIDs having the same value is so astonishingly small that it can be ignored entirely.
In .NET, you can create GUIDs using the System.Guid structure. A peer can be associated with a new GUID every time it joins the network, or a GUID value can be generated once and stored on the peer's local hard drive if you need a more permanent identity. Best of all, GUIDs aren't limited to identifying peers. They can also track tasks in a distributed-computing application (such as the one in Chapter 6) or files in a file-sharing application (as shown in Chapter 9). GUIDs can also be used to uniquely identify messages as they are routed around a decentralized peer-to-peer network, thereby ensuring that duplicate copies of the same message are ignored.
Regardless of the approach you take, creating a peer-to-peer application involves creating a virtual namespace that maps peers to some type of peer identifier. Before you begin to code, you need to determine the type of peer identifier and the required peer connection information.
Another challenge in peer-to-peer programming is determining how peers find each other on a network. Because the community of peers always changes, joining the network is not as straightforward as connecting to a well-known server to launch a client-server application.
The most common method of peer discovery in .NET applications is to use a central discovery server, which will provide a list of peers that are currently online. In order for this approach to work, peers must contact the discovery server regularly and update their connectivity information. If no communication is received from a peer within a set amount of time, the peer is considered to be no longer active, and the peer record is removed from the server.
When a peer wants to communicate with another peer, it first contacts the discovery server to learn about other active peers. It might ask for a list of nearby peers, or supply a peer identifier and request the corresponding connectivity information it needs to connect to the peer. The peer-to-peer examples presented in the second and third part of this book all use some form of centralized server.
The discovery-server approach is the easiest way to quickly implement are liable peer-to-peer network, but it isn't suitable for all scenarios. In some cases, there is no fixed server or group of servers that can play the discovery role. In this case, peers need to use another form of discovery. Some options include
Sending a network broadcast message to find any nearby peers. This technique is limited because broadcast messages cannot cross routers from one network to another.
Sending a multicast broadcast message to find nearby peers. This technique can cross networks, but it only works if the network supports multicasting.
Reading a list of super-peers from some location (typically a text file or a web page), and trying to contact them directly. This requires a fixed location to post the peer information.
The last approach is not perfect, but it's the one most commonly used in decentralized peer-to-peer applications such as Gnutella. You'll learn about broadcasting in Chapter 9.
Peer to peer applications often play two roles, and act both as a client and server. For example, in a file-sharing application every interaction is really a client-server interaction in which a client requests a file and a server provides it. The difference with peer-to-peer applications is every peer can play both roles, usually with the help of threading code that performs each task simultaneously. This is known as the server-mode/client-mode (SM/CM) model, as shown in Figure 2-1.
The dual roles in a file-sharing application are fairly obvious, but there are some types of applications that require more server work. For example, in a distributed-computing application, a work manager typically divides a task into multiple task segments, assigns it to a group of workers, and assembles their responses into a final solution. In some respects, this kind of application doesn't appear to be a true peer-to-peer application at all, because it centralizes functionality in a dedicated server module. However, you can make this application into more of a peer-to-peer solution by applying the SM/CM model. For example, you might create a peer that has the ability to request work and perform work for other requesters, as you will in our example in Chapter 6.
Remember, in a single interaction, the parts of a peer-to-peer system are not equivalent. One peer will take the role of a server, while the other acts as a client. However, over a longer time frame, each peer has the capability to play different roles.
Firewalls and network address translation (NAT) devices are the bane of all peer-to-peer applications and can make it all but impossible for peers to interact.
Firewalls act as gatekeepers separating the public Internet and an internal network (or individual computer). Firewalls typically work as a kind of one-way gate, allowing outgoing traffic, but preventing arbitrary outside computers from sending information to a computer inside the Internet. In some cases, firewalls can be configured to allow or deny connections on specific ports, thereby authorizing some channels for peer-to-peer communication, although it's becoming increasingly common for firewalls to lock down almost everything. Further complicating life is NAT, which hides a client's IP address so it's not publicly accessible. The NAT is intelligent enough to be able to route a response from a server to the original client, but other peers can't communicate with the hidden computer. Thus, a peer could work in client-mode, but not server-mode, which would cripple the functionality of the system.
The peer-to-peer working group () identifies some of the most common approaches for interacting over a firewall or NAT. Two basic techniques include
Reversing the connection. If PeerA can't contact PeerB due to a firewall, have PeerA contact PeerC, which will then notify PeerB. PeerB can then initiate the connection to PeerA. This won't work if both PeerA and PeerB are behind firewalls.
Using a relay peer. If PeerA and PeerB need to communicate but are separated by a firewall, have them route all communication through some PeerC that is visible to both. JXTA and Gnutella use variations of this approach.
Coding this sort of low-level networking logic is a chore at best. If you need to create peer-to-peer applications over a wide network that can tunnel through firewalls, your best choice may be a third-party tool such as the ones we'll explore in Part Four of this book. Or, you may want to incorporate some centralized components. For example, a typical chat application such as Windows Messenger avoids firewall problems because all clients connect directly to the server, rather than to each other. However, some features (for example, file transfer) use direct connections and are consequently not supported by all peers. You may want to take this approach in your own applications to guarantee basic functionality, while giving peers the option of using direct connections for some features whenever possible. | http://www.yaldex.com/vb-net-tutorial/LiB0012.html | CC-MAIN-2017-04 | refinedweb | 1,701 | 52.8 |
best camouflage clothing camouflage t-shirt military t shirts uk
US $2-2.5 / Piece
500 Pieces (Min. Order)
Bulk Wholesale Ladies second hand clothes/clothing uk,Three-quarters Pants Used Clothing uk
US $1.6-2 / Kilogram
0.5 Kilograms (Min. Order)
summer sports clothing man golf uniform UK style striped polo shirts
US $3-7 / Piece
100 Pieces (Min. Order)
cotton soft good quality maternity clothing uk
US $5-10 / Piece
100 Pieces (Min. Order)
Outdoor soft hot sales custom women clothing uk
US $10-12 / Piece
500 Pieces (Min. Order)
Daijun oem high quality cotton blank red women uk polo shirt importers
US $0.5-5 / Piece
100 Pieces (Min. Order)
Custom printing t shirt new design cheap plain t-shirt clothing manufacturers in china
US $0.46-6 / Piece
200 Pieces (Min. Order)
cheap designer clothes uk
US $1.25-3.45 / Piece
100 Pieces (Min. Order)
CHEFON Print tshirt uk mens clothing
US $5.5-9.5 / Piece
300 Pieces (Min. Order)
Dephect Lifestyle Heather T-shirt Streetwear UK Hip-Hop Clothing 100% Cottton
US $1.08-7.55 / Piece
200 Pieces (Min. Order)
china guangzhou uk clothing suppliers
US $5-12 / Piece
150 Pieces (Min. Order)
quality cheap second hand clothing and used clothing bales uk
US $50-200 / Bag
12 Tons (Min. Order)
Designer printed plain color uk clothing suppliers
US $2.2-5 / Piece
100 Pieces (Min. Order)
promotion hotsale uk flag printing childrens smocked clothing
US $1.5-7 / Piece
1200 Pieces (Min. Order)
2015 men stylish long tall t shirt cheap wholesale, street wear clothing for hip hop custom wholesale
US $1.85-6.35 / Piece
100 Pieces (Min. Order)
used clothing in south korea used clothing uk sorted wholesal used clothing shoe
US $0.7-1.5 / Kilogram
12 Tons (Min. Order)
Low Price Wholesale import second hand clothing,Second Hand Clothing uk
US $1.6-2 / Kilogram
0.5 Kilograms (Min. Order)
Wholesale Uk Second Hand Bales Of Mixed Used Clothing bales/Uk Cream Used Clothing Buyers
US $1.6-2 / Kilogram
0.5 Twenty-Foot Container (Min. Order)
used cloths in usa/used clothing for europe/used clothing uk for export
US $1.38-1.75 / Kilogram
1 Twenty-Foot Container (Min. Order)
UK cream big supply used clothing manila philippines
US $0.6-1.6 / Kilogram
12000 Kilograms (Min. Order)
Hot sale high quality cheap price UK used clothes used clothing
US $0.5-1.5 / Kilogram
20 Feet (Min. Order)
usa and uk brand used clothing , wholesale second hand clothes in bales,used clothes in bulk for sale
US $1.0-1.5 / Kilogram
1 Twenty-Foot Container (Min. Order)
Door To Door Wholesale Uk Unsorted Branded Ladies used clothing
US $1600.0-1600.0 / Ton
1 Ton (Min. Order)
import clothing from china polo shirt uk hot design
US $3-8 / Piece
500 Pieces (Min. Order)
Factory wholesale second hand clothes uk clothing suppliers
US $1-1111 / Twenty-Foot Container
1 Twenty-Foot Container (Min. Order)
used cream clothes from uk high end fashion clothing
US $0.7-1.5 / Kilogram
13000 Kilograms (Min. Order)
Used clothes from the UK used clothing in switzerland
US $40000-45000 / Forty-Foot Container
1 Twenty-Foot Container (Min. Order)
Unisex gender blank high quality t-shirts clothing for men,O-neck collar and men gender curved hem t shirt
US $6.5-8.5 / Piece
200 Pieces (Min. Order)
woman gold china wholesale women online shopping india 100% polyester v-neck uk t-shirt buyer clothing in turkey
US $5-6 / Piece
200 Pieces (Min. Order)
wholesale uk clothing/shirt
US $1.8-4.8 / Piece
120 Pieces (Min. Order)
oversized apparel tee-shirt uk london clothing colorful fashion red women
US $1-10 / Piece
300 Pieces (Min. Order)
2015 new arrival the United Kingdom cotton tshirt printing clothing brand for man
US $1-3.8 / Piece
1 Piece (Min. Order)
Fashion wholesale clothing in Guangzhou
US $2-10 / Piece
6 Pieces (Min. Order)
fashion designer clothing manufacturers in china/bulk wholesale clothing
US $5-18 / Piece
10 Pieces (Min. Order)
Body Fitting O Neck Wholesale T-Shirts 3D Fashion Clothing Latest New for uk market
US $2-6 / Piece
1000 Pieces (Min. Order)
Second Hand Clothes And shoes, door to door,original,used clothing
GB £1.00-1.10 / Kilogram
10 Tonnes (Min. Order)
BV Veritas New Design UK flag t shirts
US $0.1-0.5 / Piece
1 Piece (Min. Order)
Second Hand Clothing
US $1.0-1.0 / Kilograms
1000 Kilograms (Min. Order)
used bra wholesale used clothing in bales secondhand clothes sexy lady used bra
US $0.7-1.8 / Kilogram
13 Kilograms (Min. Order)
AliSourcePro
Haven't found the right supplier yet ? Let matching verified suppliers find you. Get Quotation NowFREE
Do you want to show uk clothing or other products of your own company? Display your Products FREE now!
Related Category
Product Features
Supplier Features
Supplier Types
Recommendation for you
related suppliers
related Manufactures
related Factory | http://www.alibaba.com/showroom/uk-clothing.html | CC-MAIN-2016-22 | refinedweb | 835 | 69.99 |
#include <sys/types.h> #include <netinet/in.h>−:
The calling process was not privileged (on Linux:
the calling process did not have the
CAP_NET_BIND_SERVICE capability in
the user namespace governing its network
namespace).
All privileged ports are in use.
sin is not
NULL and
sin->sin_family is
not
AF_INET.
For an explanation of the terms used in this section, see attributes(7).
The
bindresvport() function
uses a static variable that was not protected by a lock
before glibc 2.17, rendering the function MT-Unsafe.
Unlike some
bindresvport()
implementations, the glibc implementation ignores any value
that the caller supplies in
sin−>sin_port. | http://manpages.courier-mta.org/htmlman3/bindresvport.3.html | CC-MAIN-2019-18 | refinedweb | 102 | 59.7 |
This is my assaigment:
Write a program that prompts the user for a beginning bank balance and an interest rate. The program will display the value of the account at the end of each year for 10 years. The output should show the value of the account for three different methods of compounding interest:
1) Annually: The interest is added once per year, at the end of the year. You can assume that the interest is posted exactly one year from the date of deposit.
2) Monthly: The interest is added once per month, at the end of the month. You can assume that interest is posted exactly one month after the date of deposit. Hint: Be sure to adjust the interest rate for the time period of the interest. If the rate is 5%, you must use (5/12)% in the monthly case.
3)Daily: The interest is added once per day, at the end of the day. You do not need to worry about leap years, assume that all years have 365 days. Hint: Be sure to adjust the interest rate for the time period of the interest. If the rate is 5%, you must use (5/365)% in the daily case.
Your program should allow the user to perform the calculation multiple times for different starting balances. A negative starting balance indicates that the user is done.
import java.util.Scanner; import java.text.DecimalFormat; public class TestBankInterest { public static void main(String[] args) { double balance, interest, newBalance; Scanner keyboard = new Scanner(System.in); DecimalFormat formatter = new DecimalFormat("#0.00"); System.out.println("What is your account's starting balance? "); balance = keyboard.nextDouble(); System.out.println("What is the interest"); interest = keyboard.nextDouble(); for (int i = 0; i <= 12; i++) { newBalance = balance + (interest / 100) * balance; System.out.println("Month " + i + " = " + newBalance); } } }
My problem is that I don't know how to figure out the formula for Annually, Yearly, or Daily for example;
newBalance = balance + (interest/100) * balance
Also, I'm confuss because I don't know if I should ask the user if they want to do it monthly or annually or daily
any help will be a biiiggggg help..
Thank You
Ps: I wants us to use loop ..in fact, 3 loops will be the answer for this | https://www.daniweb.com/programming/software-development/threads/464587/using-loop | CC-MAIN-2017-51 | refinedweb | 382 | 64.3 |
Practical ASP.NET
Now that you know how to use them (see Part 1 if you don't), it's time to create custom ones.
Last time, we introduced the open source ConventionTests library. If you are new to ConventionTests be sure to check that article out first.
While ConventionTests comes with a number of pre-built supplied conventions, it is also possible to create your own custom conventions and then use them in your test code.
In this example we're going to create our own custom convention that we can use to check that all interfaces follow the traditional naming convention of starting with the letter "I".
The first thing we need to do is create a new class in our test project. Assuming that the TestStack.ConventionTests NuGet package is installed in the test project, our new class can implement the required ConventionTests interface.
If we want to inspect and check the types in the production code project we implement the IConvention<Types> interface. This interface defines a couple of members: an Execute method where our custom verification code will go; and the ConventionReason string property.
The Execute method has the following signature: public void Execute(Types data, IConventionResultContext result). The data parameter will contain a list of all the types we need to check, this is the list of types that are selected by us in our actual unit test code. The result parameter is used to signal back to our actual test whether any of the types in data did not meet the convention.
To complete the custom convention checking logic in our custom convention we call the Is method of the result object. This method takes a string representing the title of the convention when it is output in the test output. The second parameter of the Is method takes a list of all the types that have failed to meet the custom convention. If there are any types in this list the test will fail.
The ConventionReason property allows a descriptive explanation of what the custom convention represents.
Listing 1 shows our custom interface-naming convention.
Listing 1: Custom Interface-Naming Convention.
using System.Linq;
using TestStack.ConventionTests;
using TestStack.ConventionTests.ConventionData;
namespace MyClassLibrary.Tests
{
public class InterfaceNamingConvention : IConvention
{
public void Execute(Types data, IConventionResultContext result)
{
// Find any types passed to our custom convention from the test code
// that are interfaces and that also don't start with 'I'
var interfacesWithBadNames = data.TypesToVerify.Where(x => x.IsInterface &&
!x.Name.StartsWith("I"));
// Once we have a list, if it contains > 0 types the convention will
// fail and so will the tests
result.Is("Interfaces must begin with the letter 'I'.", interfacesWithBadNames);
}
public string ConventionReason
{
get
{
return "The naming convention is to start all interface names with the letter 'I'.";
}
}
}
}.
To use this convention in an actual unit test, our custom convention is treated the same way as one of the pre-built suppled conventions:
[Test]
public void AllInterfacesShouldBeNamedCorrectly()
{
var typesToCheck = Types.InAssemblyOf<MyClassLibrary.SomeClassInAssemblyBeingTested>();
var convention = new InterfaceNamingConvention();
Convention.Is(convention, typesToCheck);
}.
Notice in the above test, we are creating an instance of our custom convention rather than one that comes out of the box with ConventionTests.
If we now define a couple of interfaces in our production code "MyClassLibrary" project as follows:
public interface IEatable
{
}
public interface IDrinkable
{
}.
When we run our unit test, it will pass (see Figure 1) because both of the preceding interfaces start with I.
If we now change IDrinkable to just Drinkable (no preceding I) and run the test again it will fail (see Figure 2):
public interface IEatable
{
}
public interface Drinkable
{
}.
If we check the output from the test we can see the following:
'Interfaces must begin with the letter 'I'.' for 'Types in MyClassLibrary'
--------------------------------------------------------------------------
MyClassLibrary.Drinkable
.
Here we can see the detail of the failing convention, namely that the interface Drinkable is named incorrectly.
I hope this article and the last one was a helpful look at convention testings. Let me know your thoughts on this and future topics we can cover.. | https://visualstudiomagazine.com/articles/2015/03/26/conventiontests-part-2-asp-net.aspx | CC-MAIN-2019-04 | refinedweb | 676 | 54.32 |
Tutorial: Getting Started with Chaos Engineering
Earn $50 in AWS credit when you complete this tutorial! Just tweet a screenshot of your 3 completed attacks @GremlinInc or drop it in the #learning channel of the Chaos Engineering slack.
Chaos Engineering is a disciplined approach to finding failures before they become outages. You literally “break things on purpose” to learn how to build more resilient systems.
If you’re curious to try Chaos Engineering for yourself, but want to practice in a demo environment first, this tutorial is for you.
In this tutorial, we’ll walk through 3 chaos experiments to test the reliability of our demo app. We’ll do this using Gremlin, a simple, safe and secure service for performing Chaos Engineering experiments through a SaaS-based platform.
After completing this tutorial, you’ll have hands-on experience running chaos experiments in a demo environment and be able to run them with confidence on your own infrastructure.
To successfully complete this tutorial, you’ll need:
Chaos Engineering is a disciplined approach to identifying failures before they become outages. By testing how a system responds under stress, we can proactively fix vulnerabilities and make our systems more reliable.
So how does this work in practice? The best way to start is by creating a thoughtful, planned chaos experiment to validate expected behavior. First, ask yourself, “What could go wrong?” (For example, what happens when one of the third-party services we rely on goes down?) Then, use the scientific method to create a hypothesis, run a controlled experiment simulating the failure, and measure the impact.
After running your experiment, you’ll have one of two outcomes. Either you’ve verified that your system is resilient to the failure you introduced, or you’ve found a problem you need to fix. Both of these are good outcomes. On one hand, you’ve increased your confidence in the system and its behavior, on the other you can fix the problem before it causes an outage.
Will our demo app be resilient in the face of failure or will we experience an outage? Let’s find out with Chaos Engineering.
We’ll use Chaos Engineering to test how our demo app handles the following failure scenarios:
When we inject these failures into the demo app, we’ll be able to see if the system maintains its functionality or if its services degrade under stress.
We’ll use this open-source microservices application as our demo environment. The demo app has eCommerce functionality. We’ll refer to it as the Sock Shop going forward.
Follow instructions here to configure AWS CLI, kubectl and eksctl.
In your respective region, launch an EKS cluster. For example:
1eksctl create cluster --name sockshop-eks-cluster --version 1.15 --region us-west-2 --nodegroup-name standard-workers --node-type t3.medium --nodes 3 --nodes-min 1 --nodes-max 4
Using kubectl, deploy Sock Shop.
Clone the repo below and and go into the deploy/kubernetes folder.
1git clone
1kubectl create namespace sock-shop
1kubectl apply -f complete-demo.yaml
If you haven’t already, create your Gremlin Free account.
Activate your account using the link sent to your email.
To install the Gremlin Kubernetes client, you will need your Gremlin Team ID and Secret Key. If you already know what those are, you can skip ahead to installing the client. If you don’t know what your Team ID and Secret Key are, you can get them from the Gremlin web app.
Configuration. Make a note of your Team ID.
Resetbutton. You’ll get a popup reminding you that any running clients using the current Secret Key will need to be configured with the new key. Hit
Continue. Next you’ll see a popup screen that will show you the new Secret Key. Make a note of it.
(Skip this step if you are using secret-based authentication)
Download the Gremlin certificates (you need at least team manager access)
Unzip certificates.zip
Rename the files in the certificates folder.
Team Name.pub_cert.pem becomes
gremlin.cert.
Team Name.priv_key.pem becomes
Most Kubernetes deployments configure master nodes with the
node-role.kubernetes.io/master:NoSchedule taint. You can run the following command to see if any of your nodes have this taint:
1$ kubectl get no -o=custom-columns=NAME:.metadata.name,TAINTS:.spec.taints2NAME TAINTS3kube-01 [map[effect:NoSchedule key:node-role.kubernetes.io/master]]4kube-02 <none>
If you wish to install Gremlin on a Kubernetes master that has been tainted, add a tolerations section to the PodSpec of the Gremlin Client Manifest.
1tolerations:2 - key: node-role.kubernetes.io/master3 operator: Exists4 effect: NoSchedule
You will need to reapply the Gremlin client manifest after making this change.
If you are using certificate-based authentication:
Download and apply the k8s client manifest by running:
kubectl apply -f
If you are using secret-based authentication:
Download and apply the k8s client manifest by running:
kubectl apply -f
Questions? Get support from the Gremlin team by joining the Chaos Engineering Slack and asking questions in the #support channel.
For more information on using Container Insights, see this documentation.
Log in to the bastion host, and run
1kubectl get svc -o wide -n sock-shop | grep LoadBalancer
Copy the load balancer’s DNS name.
Paste this DNS into a browser to access the sock shop front-end.
Navigate around to get a feel of all the functions of the shop. Things to try out:
For this first experiment, we will check to see if this cluster has autoscaling policies dialed in correctly.
Recommended Scenariosin Gremlin, then click
View Detailsfor “Validate Auto Scaling” scenario.
Add targets and run.
Run Scenario.
In AWS Console, look into Container insights:
Go to the AWS Console and select
EC2 from Services.
On the left navigation bar, select
Auto Scaling Groups.
Each Cluster gets its own Auto Scaling Group. Select the one you need, and then at the lower navigation, select
Scaling Policies.
Add Policy, then
Create a simple scaling policy.
Give the Policy a name, we will call it “Cluster-ScaleUp” and select
Create New Alarm. Create the alarm to go off when CPU utilization is greater than or equal to 13% for at least 1 minute, and name it “Cluster-ScaleUp.”
Create Alarm. Now you will be taken back to finish editing the policy.
Edit the values to add “1” instance and then wait 120 seconds before the next activity. Press
Create when finished.
We want to follow the same steps as above, but instead the policy will be called “Cluster-ScaleDown,” we will be creating a new alarm. This Alarm will be for when CPU utilization is less than or equal to (<=) 13% within 15 minutes.
For this experiment, we will test and discover what happens when there is a service dependency outage as your primary service attempts to make requests to it.
In Gremlin, create a new attack.
Select the
Containers tab.
In the Search bar, look up
carts-db.
Scroll down and click
Choose a Gremlin.
Network ->
Blackhole Gremlin.
Change the
length of the attack to 300 seconds.
Click
Unleash Gremlin.
As the attack is running, try the following:
Is there any customer impact?
Are systems recovering gracefully?
Is there any way to mitigate this?
Halt All Attacksto stop this attack.
Did systems recover?
What did we learn?
For this experiment, we will test what happens if a container were to fail. Sometimes, especially in a containerized environment, your orchestration can automatically recover, but it takes time to detect and fix the issue, resulting in a potential partial outage.
In Gremlin, create a new attack.
Select the
Containers tab.
In the Search bar, look up
carts-db.
Scroll down and click
Choose a Gremlin.
State ->
Shutdown Gremlin.
Switch off
Reboot.
Click
Unleash Gremlin.
As the attack is running, try the following:
Is there any customer impact?
Are systems recovering gracefully?
How might you mitigate this?
Now that you’ve had a chance to run some pre-planned experiments, you can create your own experiment from start to finish. There is no wrong way to create an experiment, but it’s important to go through the full thought process.
How to create a chaos experiment:
Was this failure detected?
Did this failure have customer impact?
Did the impact of this failure expected, or, did it match your hypothesis?
Can this failure be handled or mitigated?
Share the results of your chaos experiments with our community of over 5,000 engineers in the Chaos Engineering Slack. Chat with us about getting started with Chaos Engineering, defining SLIs and establishing SLOs, reducing incidents, and more.
While running experiments on a demo app is admittedly pretty fun, it doesn’t improve the reliability of your systems. Start running experiments on your own infrastructure to test and validate your systems’ response to failure and improve overall reliability.
Check out our documentation to install Gremlin anywhere, including bare-metal, on-prem, VMs, containers, serverless and Kubernetes environments.
If you’d like to try all 13 Gremlin Attacks, including Packet Loss and Memory, request a demo and we’ll set you up with a free trial of Gremlin Pro.
Gremlin empowers you to proactively root out failure before it causes downtime. See how you can harness chaos to build resilient systems by requesting a demo of Gremlin.Get started | https://www.gremlin.com/community/tutorials/get-started-chaos-engineering/ | CC-MAIN-2020-34 | refinedweb | 1,561 | 58.08 |
BM(3) Library Functions Manual BM(3)
NAME
bm_comp, bm_exec, bm_free -- Boyer-Moore string search
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <<sys/types.h>>
#include <<bm.h>>
bm_pat *
bm_comp(u_char *pattern, size_t patlen, u_char freq[256]);
u_char *
bm_exec(bm_pat *pdesc, u_char *text, size_t len);
void
bm_free(bm_pat *pdesc);
DESCRIPTION
These routines implement an efficient mechanism to find an occurrence of
a byte string within another byte string.
bm_comp() evaluates the).
SEE ALSO
regexp(3), strstr(3)
Hume and Sunday, "Fast String Searching", Software Practice and
Experience, Vol. 21, 11, pp. 1221-48, November 1991.
NetBSD 6.1.5 April 8, 2001 NetBSD 6.1.5 | http://modman.unixdev.net/?sektion=3&page=bm_free&manpath=NetBSD-6.1.5 | CC-MAIN-2017-17 | refinedweb | 107 | 51.55 |
Based on Betteridge's law of headlines: no!
But based on recent twitter activity, that's no doubt a somewhat controversial opinion, so in this post I look at what a unit-test for an API controller might look like, what a unit-test is trying to achieve, and why I think integration tests in ASP.NET Core give you far more bang-for-your-buck.
I start by presenting my thesis, about why I don't find unit tests of controllers very useful, acknowledging the various ways controllers are used in ASP.NET Core. I'll then present a very simple (but representative) example of an API controller, and discuss the unit tests you might write for that class, the complexities of doing so, as well as the things you lose by testing the controller outside the ASP.NET Core MVC framework as a whole.
This post is not trying to suggest that unit tests are bad in general, or that you should always use integration tests. I'm only talking about API/MVC controllers here.
Where does the logic go for an API/MVC controller?
The MVC/API controllers people write generally fall somewhere on a spectrum:
- Thick controllers—The action method contains all the logic for implementing the behaviour. The MVC controller likely has additional services injected in the constructor, and the controller takes care of everything. This is the sort of code you often see in code examples online. You know the sort—where an EF Core
DbContext, or
IServiceis injected and manipulated in the action method body:
public class BlogPostController : Controller { // Often this would actually be an EF Core DB Context injected in constructor! private readonly IRepository _repository; public BlogPostController(IRepository repository) => _repository = repository; [HttpPost] public ActionResult<Post> Create(InputModel input) { if(!ModelState.IsValid) { return BadRequest(ModelState); } // Some "business logic" if(_repository.IsSlugAvailable(input.Slug) { ModelState.AddError("Slug", "Slug is already in use"); return BadRequest(ModelState); } var model = new Post { Id = model.Id, Name = model.Name, Body = model.Body, Slug = model.Slug }); _repository.Add(model); return model; } }
- Thin controllers—The action method delegates all the work to a separate service. In this case, most of the work is done in a separate handler, often used in conjunction with a library like Mediatr. The action method becomes a simple mapper between HTTP-based models/requests/responses, and domain-based models/commands/querys/results. Steve Smith's API endpoints project is a good example that is pushing this approach.
public class BlogPostController : BaseApiController { [HttpPost] public async Task<IActionResult> Create([FromBody]NewPostCommand command) { var result = await Mediator.Send(command); return Ok(result); } }
So which approach do I use? Well, as always it depends. In general, I think the second option is clearly the more scalable, manageable, and testable option, especially when used in conjunction with conventions or libraries that enforce that practice.
But sometimes, I write the other types of controllers. Sometimes it's because I'm being sloppy. Sometimes it's because I need to do some HTTP related manipulation which wouldn't make sense to do in a command handler. Sometimes the action is so simple it just doesn't warrant the extra level of indirection.
What I don't do (any more 🤦♂️), is put important domain logic in action methods. Why? Because it makes it harder to test.
"But you can unit-test controllers!" I hear you cry. Well…yes…but…
What don't you test in controller unit tests
MVC/API controllers are classes, and actions are just methods, so you can create and invoke them in unit tests the same way you would any other system under test (SUT).
The trouble is, in practice, controllers do most of their useful work as part of a framework, not in isolation. In unit tests, you (intentionally) don't get any of that.
In this section I highlight some of the aspects of MVC controllers that you can't easily test or wouldn't want to test in a unit test.
Routing
This is one of the most important roles of a controller: to serve as a handler for a given incoming route. Unit tests ignore that aspect.
You could certainly argue that's OK for unit tests—routing is a separate concern to the handling of a method. I can buy that, but routing is such a big part of what a controller is for, it feels like it's missing the point slightly.
Technically, it is possible to do some testing of the routing infrastructure for your app, as I showed in a previous post. I think you could argue both ways as to whether that's an integration test or a unit test, but the main point is it's pretty hard work!
Model Binding
When handling a request, the MVC framework "binds" the incoming request to a series of C# models. That all happens outside the controller, so won't be exercised by unit tests. The arguments you pass to a controller's action method in a unit test are the output of the model binding step.
Again, we're talking about unit tests of controllers, but model binding is a key part of the controller in practice, and likely won't be unit tested separately. You could have a method argument that's impossible to bind to a request, and unit tests won't identify that. Effectively, you may be calling your controller method with values that cannot be generated in practice.
For the simple, contrived, example model below, you'll get an exception at runtime when model binding tries to create an
InputModel instance, as there's no default constructor.
public class InputModel { public string Slug { get; } public InputModel(string slug) { Slug = slug; } }
Granted, a mistake like that, using read-only properties, is very unlikely in practice. But there are also pretty common mistakes like typos in property names that mean model binding would fail. Those won't be picked up in unit tests, where strong typing means you just set the property directly.
Again, I'm not arguing that a unit test of a controller should catch these things, just pointing out how many implicit dependencies on the framework that MVC controllers have.
Model validation
The above example is contrived, but it highlights another important point. The validation of input arguments and enforcing constraints is an important part of most C# methods, but not action methods.
Validation occurs outside the controller, as part of the MVC framework. The framework communicates validation failures by setting values on the
ModelState property. Controllers should typically check the
ModelState property before doing anything.
In some ways, this is good. Validation is moved outside the action method, so you can test it independently of the controller action method. Whether you're using
DataAnnotation attributes, of FluentValidation, you can ensure the models you're receiving are valid, and you can test those validation rules separately.
It feels a little strange in unit tests though, where passing in an "invalid" model, won't cause your action method to take the "sad" path, unless you explicitly match the
ModelState property to the model.
For example if you have the following model:
public class InputModel { [Required] public string Slug { get; set; } }
and you want to test the "sad" path of the "thick" controller shown previously, then you have to make sure to set the
ModelState:
[Fact] public void InvalidModelTest() { // Arrange var model = new InputModel{ Slug = "" }; // Invalid model var controller = new BlogPostController(); // Have to explictly add this controller.ModelState.AddModelError("Slug", "Required"); // Act var result = await controller.Create(model); // Assert etc }
Again, this isn't necessarily a deal-breaker, but it's extra coupling. If you want to test your controller with "real" inputs, you have to ensure you keep the
ModelState in sync with the method arguments, which means you need to keep it in-sync with the validation requirements of your model. If you don't, the behaviour of your controller in practice becomes undefined, or at least, untested.
Filter Pipeline
An exception to the previous validation example might be API controllers that are using the
[ApiController] attribute. Requests to these controllers are automatically validated, and a
400 is sent back as part of the MVC filter pipeline for invalid requests. That means an API controller should only be called with valid models.
That helps with unit testing controllers, as it's an aspect your controller can ignore. No need to try and match the incoming model with the
ModelState, as you know you should only have to handle valid models. When filters are used like this, to extract common logic, they make controllers easier to test.
But the filter pipeline isn't only used to extract functionality from controllers. It's sometimes used to provide values to your controllers. For example, think of a filter in a multi-tenant environment that sets common values for the tenant on the
HttpContext. If you use filters like this, that's something else you're going to have to take into account in your controller unit tests.
Surely noone would do that, right? The extra coupling it adds seems obvious. Maybe… but that's essentially how authentication works (though using middleware, rather than a filter).
Still filters aren't used that often in my experience, except for the
[Authorize] attribute of course.
Authorization
If you apply authorization policies declaratively using the
[Authorize] attribute, then they'll have no effect on the controller unit tests. That's a good thing really, it's a separate concern. You can test your authorization policies and handlers separately from your controllers.
Except if you have resource-based, imperative, authorization checks in your controller. These are very common in multi-user environments—I shouldn't be able to edit a post that you authored, for example. Resource-based authorization uses the
IAuthorizationService interface which you need to inject into your controller. You can mock this dependency pretty easily using a mocking framework, but it's just one more thing to have to deal with.
Each of these aspects on their own are pretty small, and easy to wave off as "not a big deal", but for me they just move the needle for how worthwhile it is to test your controllers.
So, what are you trying to test?
This is the crux of the matter for me— what are you trying to test by unit-testing MVC/API controllers? The answer will likely depend what "type" of controller you're trying to test.
Testing "thick" controllers
If you're testing the first type of controller, where the action method contains all the business logic for the action, then you're going to struggle. These controllers are doing everything, so the "unit" here is really too large to easily test. You're likely going to have to rely on mocking lots of services, which increases the complexity of tests, while generally reducing their efficacy.
Even ignoring all that, what are you trying to test. For the
Create() method, are you going to test that
_repository.Add() is called on a stub/mock of the
IRepository? Interaction-based tests like these are generally pretty fragile, as they're often specific to the internal implementation of the method. State-based tests are generally a better option, though even those have issues with action methods, as you'll see shortly.
Testing "thin" controllers
Thin controllers are basically just orchestrators. They provide a handler and hooks for interacting with ASP.NET Core, but they delegate the "real" work to a separate handler, independent of ASP.NET Core.
With this approach, you can more-easily unit test your "domain" services, as that work is not happening in the controller. Instead, unit tests of the controller would effectively be testing that any pre-condition checks run correctly, that input models are mapped correctly to "domain service" requests, and that "domain service" responses are mapped correctly to HTTP responses.
But as we've already discussed, most of that doesn't happen in the controller itself. So testing the controller becomes redundant, especially as all your controllers start to look pretty much the same.
Let's just try a unit test
I've ranted a lot in this post, but it's time to write some code. This code is loosely based on the examples of unit testing controllers in the official documentation, but it suffers from a lot of the points I've already covered.
These examples only deal with testing the "thick" controller scenarios, as in the documentation.
In the "thick" controller example from the start of this post, I injected a single service
_repository for simplicity, but often you'll see multiple services injected, as well as concrete types (like EF Core's
DbContext). The more complicated the method gets, and the more dependencies it has, the harder the action is to "unit" test.
I guess a "unit" test for this controller should verify that if a slug has already been used, you should get a
BadRequest result, something like this (for example using the Moq library):
[Fact] public async Task Create_WhenSlugIsInUse_ReturnsBadRequest() { // Arrange string slug = "Some Slug"; var mockRepo = new Mock<IRepository>(); mockRepo.Setup(repo => repo.IsSlugAvailable(slug)).Returns(false); var controller = new BlogPostController(mockRepo.Object); var model = new InputModel{ Slug = slug} // Act ActionResult<Post> result = controller.Create(model); // Assert Assert.IsType<BadRequestObjectResult>(result.Result); }
This test has some value—it tests that calling
Create() with a
Slug that already exists returns a bad request. There's a bit of ceremony around creating the mock object, but it could be worse. The need to call
result.Result to get the
IActionResult is slightly odd, but I'll come to that shortly.
Lets look at the happy case, where we create a new post:
[Fact] public async Task Create_WhenSlugIsNotInUse_ReturnsNewPost() { // Arrange string slug = "Some Slug"; var mockRepo = new Mock<IRepository>(); mockRepo.Setup(repo => repo.IsSlugAvailable(slug)).Returns(true); var controller = new BlogPostController(mockRepo.Object); var model = new InputModel{ Slug = slug} // Act ActionResult<Post> result = controller.Create(model); // Assert Post createdPost = result.Value; Assert.Equal(createdPost.Slug, slug); }
We still have the mock configuration ceremony, but now we're using
result.Value to get the
Post result. That
Result/Value discrepancy is annoying…
ActionResult<T> and refactorability.
ActionResult<T> was introduced in .NET Core 2.1. It uses some clever implicit conversion tricks to allow you to return both an
IActionResult or an instance of
T from your action methods. Which means the following code compiles:
public class BlogPostController : Controller { [HttpPost] public ActionResult<Post> Create(InputModel input) { if(!ModelState.IsValid) { return BadRequest(ModelState); // returns IActionResult } return new Post(); // returns T } }
This is very handy for writing controllers, but it makes testing them a bit more cumbersome. With the example above, the following test would pass:
// Arrange var controller = new BlogPostController() var model = new InputModel() // Act ActionResult<Post> result = controller.Create(); // Assert Post createdPost = result.Value; Assert.NotNull(createdPost);
But if we change the last line of our controller to the semantically-identical version:
return Ok(new Post()); // returns OkObjectResult() of T
Then our test fails. The behaviour of the controller is identical in the context of the framework, but we have to update our tests:
// Act ActionResult<Post> result = controller.Create(); // Assert OkObjectResult objectResult = Assert.IsType<OkObjectResult>(result.Result); Post createdPost = Assert.IsType<Post>(objectResult.Value); Assert.NotNull(createdPost);
Yuk. There are things you can do to try and reduce this brittleness (such as relying on
IConvertActionResult) but I just don't know that it's worth the effort.
Testing other aspects
This post is already way too long, so I'm not going to dwell on other difficulties. Here are a few highlights instead:
- Status Codes. These may or may not be set by the
IActionResult, so you can't reliably and consistency test for them. For example, if you return a
Tfor an action result, it returns an
ObjectResultwhich doesn't specify a
200code. That's set externally, by the framework.
- HttpContext. If your controller needs to interact directly with the
HttpContext, your controllers will have a lot more setup to do. The
DefaultHttpContextclass makes this easier than in previous version of ASP.NET, but it's yet another thing to make your tests more brittle.
- Direct stream response. In some cases you may need to read or write directly to or from the
HttpRequestor
HttpResponse. Setting this up in a test is possible, but a pain.
So what's the alternative?
Integration tests are often simpler, avoid that complexity and test more
In my experience, writing "integration" tests in ASP.NET Core are for controllers is far more valuable than trying to unit test them, and is easier than ever in ASP.NET Core.
Steve Gordon has a new Pluralsight course that describes a best-practices for integration testing your ASP.NET Core applications.
The in-memory
TestServer available in the Microsoft.AspNetCore.TestHost package lets you create small, focused, "integration" tests for testing custom middleware. These are "integration" in the sense that they're executed in the context of a "dummy" ASP.NET Core application, but are still small, fast, and focused.
At the other end, the
WebApplicationFactory<T> in the Microsoft.AspNetCore.Mvc.Testing package lets you test things in the context of your real application. You can still add stub services for the database (for example) if you want to keep everything completely in-memory.
On top of that, the rise of Docker has made using your real database for integration tests far more achievable. A few good end-to-end integration tests can really give you confidence that the overall "plumbing" in your application is correct, and that the happy path, at the very least, is working. And I'm not the only one who thinks like that:
I wrote a thing - "one good integration test is worth 1,000 unit tests" from Secrets of a .NET Professional #dotnet, #tips via @buhakmeh— Khalid (@buhakmeh) August 16, 2020
Again, saying that integration tests are more valuable for testing "heavily integrated" components like controllers is not saying you shouldn't unit test. Unit tests should absolutely be used where they add value. Just don't try and force them everywhere for the sake of it.
Summary
I don't find unit testing MVC/API controllers very useful. I find they require a lot of ceremony, are often brittle using many mocks and stubs, and often don't actually catch any errors. I think integration tests (coupled with unit tests of your domain logic) adds far more value, with few trade-offs in most cases. | https://andrewlock.net/should-you-unit-test-controllers-in-aspnetcore/ | CC-MAIN-2021-10 | refinedweb | 3,096 | 54.83 |
Tuesday, August 24, 2010
NCache 3.8 Service Pack 1 (SP1) contains important fixes and enhancements. The most important and demanded feature added in this release is the support of .Net frame work 4.0 The API is completely compatible with the 3.8 release version and applications can upgrade without re-building/re-compiling the application.
Following are some enhancements made in this release:
The code base of NCache cache server has been converted to .NET 4.0 and the NCache client is available in both .NET 2.0 and 4.0 versions.
There is an improvement in client cache management through NCache Manager where project files will contact to client nodes on refresh option and this has improved fast loading of NCache Manger project file.
We have resolved this issue by copying all the assemblies in the NCache bin/assembly folder and now Visual Studio does not have to locate the dependent assemblies in GAC. This has resolved the issue.
NCache samples are now builded with visual studio 2008.
VeriSign issue, default in service configuration file should be
generatePublisherEvidence. The enhancement is made.
ReadThru provider interface signature has been modified to support maximum features of NCache. There is new structure introduced under the namespace “Alachisoft.NCache.Runtime.Caching” called ProviderCacheItem which is similarly to the CacheItem. You can now easily specify expirations, tags, eviction hints, dependencies etc.
New interfaces
<p>public void LoadFromSource(string key, out ProviderCacheItem cacheItem)</p> <p>public Dictionary
LoadFromSource(string[] keys)</p>
Now, you can specify IsResyncExpiredItem property in Cache Loader so that the expired items can be reloaded automatically.
NCache is not supporting the latest version of NHibernate 2.1.2. We have also added region support in this release. NHibernate sample application is also modified with NHibernate regions support.
+1 (214) 764-6933 (US)
+44 20 7993 8327 (UK) | https://www.alachisoft.com/resources/release-notes/release-notes-ncache-3.8-sp1.html | CC-MAIN-2021-04 | refinedweb | 307 | 59.4 |
What is JSON?
JSON is used to store information in an organized, and easy-to-access manner. Its full form is JavaScript Object Notation. It offers a human-readable collection of data which can be accessed logically.
In this XML vs. JSON tutorial, you will learn:
- What is JSON?
- What is XML?
- History of JSON
- History of XML
- Features of JSON
- Features of XML
- Difference between JSON and XML
- JSON Code vs XML Code
- Advantages of using JSON
- Advantages of using XML
- Disadvantages of using JSON
- Disadvantages of using XML
What
History of JSON
Here are important landmarks that form the history of JSON:
- Douglas Crockford specified the JSON format in the early 2000s.
- The official website was launched in 2002.
- In December 2005, Yahoo! starts offering some of its web services in JSON.
- JSON became an ECMA international standard in 2013.
- The most updated JSON format standard was published in 2017.
History of XML
Here, are the important landmark from the history of XML:
- XML was also derived from SGML.
- Version 1.0 of XML was released in February 1998.
- Jan 2001:IETF Proposed Standard: XML Media Types
- XML is the Extensible Markup Language.
- 1970: Charles Goldfarb, Ed Mosher, and Ray Lorie invented GML
- The development of XML started in the year 1996 at Sun Microsystem
Features.
Features of XML
- XML tags are not predefined. You need to define your customized tags.
- XML was designed to carry data, not allows you to display that data.
- Mark-up code of XML is easy to understand for a human.
- Well, the structured format is easy to read and write from programs.
- XML is an extensible markup language like HTML.
Difference between JSON and XML
Here is the prime difference between JSON vs. XML
JSON Code vs XML Code
Let's see a sample JSON Code
{ "student": [ { "id":"01", "name": "Tom", "lastname": "Price" }, { "id":"02", "name": "Nick", "lastname": "Thameson" } ] }
Let's study the same code in XML
<?xml version="1.0" encoding="UTF-8" ?> <root> <student> <id>01</id> <name>Tom</name> <lastname>Price</lastname> </student> <student> <id>02</id> <name>Nick</name> <lastname>Thameson</lastname> </student> </root>
Advantages of using JSON
Here are the important benefits/ pros of using JSON:
- Provide support for all browsers
- Easy to read and write
- Straightforward syntax
- You can natively parse in JavaScript using eval() function
- Easy to create and manipulate
- Supported by all major JavaScript frameworks
- Supported by most backend technologies
- JSON is recognized natively by JavaScript
- It allows you to transmit and serialize structured data using a network connection.
- You can use it with modern programming languages.
- JSON is text which can be converted to any object of JavaScript into JSON and send this JSON to the server.
Advantages of using XML
Here are significant benefits/cons of using XML:
- Makes documents transportable across systems and applications. With the help of XML, you can exchange data quickly between different platforms.
- XML separates the data from HTML
- XML simplifies platform change process
Disadvantages of using JSON
Here are cons/ drawback of using JSON:
- No namespace support, hence poor extensibility
- Limited development tools support
- It offers support for formal grammar definition
Disadvantages of using XML
Here, are cons/ drawbacks of using XML:
- XML requires a processing application
- The XML syntax is very similar to other alternatives 'text-based' data transmission formats which is sometimes confusing
- No intrinsic data type support
- The XML syntax is redundant
- Does n't allow the user to create his tags.
KEY DIFFERENCE
- JSON object has a type whereas XML data is typeless.
- JSON does not provide namespace support while XML provides namespaces support.
- JSON has no display capabilities whereas XML offers the capability to display data.
- JSON is less secured whereas XML is more secure compared to JSON.
- JSON supports only UTF-8 encoding whereas XML supports various encoding formats. | http://www.test3.guru99.com/json-vs-xml-difference.html | CC-MAIN-2020-10 | refinedweb | 639 | 54.32 |
Results 1 to 9 of 9
- Member Since
- Feb 26, 2007
- 6
Hello,
I've done about everything I can think of to convert the tens of thousands of e-mails I have from an Outlook .PST format to e-mail and folders readable by Mail.app. Of course, neither program recognizes the existence of the other...
By all accounts that I've read, the Eudora middle-man method seems to be pretty straightforward, but when I attempted it the folder names showed up in Mac Mail, as did each e-mail, but no e-mail contents exist: no date, to, from, subject, body, nothing.
Has anyone else encountered this?
I've also tried using Netscape as a middle-man, but didn't have any success as no versions of Netscape that I could get my hands on were willing to handle mail the way the how-tos I used required.
Any other suggestions, magic methods that have only recently been discovered, etc.?
- Member Since
- Jan 04, 2006
- Location
- Hamburg, Germany
- 1,385
- Specs:
- MacBook Pro | iMac(2.1 G5) | MacBook(2.16 C2D) | MacMini (1.67 CD) | iPhone 4 | iPad (3rd Gen)
- Member Since
- Feb 26, 2007
- 6
I've now tried everything at that site that does not require a fee, which is not currently an option. The Mail conversion script cannot read from the Eudora (PC) files that I have, which is quite peculiar. And for the reason below, the Eudora (Mac) files aren't possible.
I've discovered the peculiarity that Eudora (Mac) can't even properly read Eudora (PC) -- some e-mails get lost or blanked in the transition: enough that it is not an option.
I -have- successfully imported everything into a Mozilla Thunderbird installation on this Mac, which works fine, but everything I've read about how to convert Thunderbird to Mail.app has failed. The last [n] Mail.app imports that I've attempted have resulted in each folder containing only one VERY large e-mail which includes the raw content of all other e-mails in each folder. Obviously, this is not a good solution.
Anything else??
I used this...
It worked like a charm.
It costs $10, but you've already wasted time worth more than that looking for a free solution, right?
- Member Since
- Feb 26, 2007
- 6
My concern is this: not one of the "this will work!" solutions I have attempted has been successful; if there is something that I have not yet identified that is preventing this migration from succeeding, I'm wary of spending money only to discover one more unsuccessful method.
However, I will run the possibility by the individual in charge of purchasing. I may yet end up trying it. Thank you for recommending it.
Well, if it's worth anything it worked flawlessly for me. I had 100s of valuable emails on an IBM Thinkpad and this little app transferred them all onto my Mac without a hitch.
- Member Since
- Feb 26, 2007
- 6
I'd like to thank the Academy....
No, actually, I want to thank you, MartinS -- it worked! After countless hours pulling my hair out over this matter, all the mail (75 folders containing roughly 12k e-mails) has been successfully imported! Huzzah! I used that piece of software after having it reviewed by the purchasing department, and now I can move on to other issues with a clear conscience.
Cheers!
Great stuff!
I'm too modest to mention the reputation system...
- Member Since
- Feb 26, 2007
- 6
*laugh*
Well, I'm glad you did mention it, since I've used these forums for exactly two problems, and signed up less than two weeks ago. If you hadn't mentioned it, I wouldn't have known, which would have been a shame.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
Migration Outlook 2011 to Mac MailBy Shuy Rz in forum macOS - Operating SystemReplies: 2Last Post: 07-28-2013, 09:56 PM
replies sorted in mail vs. outlook 2003By shechris in forum Switcher HangoutReplies: 0Last Post: 04-22-2008, 08:16 AM
Outlook 2003 to entourage or apple mail?By mrdinh in forum Switcher HangoutReplies: 6Last Post: 11-20-2007, 03:32 PM
import outlook 2003 to apple mailBy mrdinh in forum macOS - Apps and GamesReplies: 2Last Post: 09-23-2007, 06:04 PM
Can I import Outlook 2003 into ical, mail, etc.By markw10 in forum macOS - Apps and GamesReplies: 3Last Post: 11-02-2006, 11:11 AM | http://www.mac-forums.com/forums/os-x-apps-games/54862-e-mail-migration-outlook-2003-mac-mail.html | CC-MAIN-2018-13 | refinedweb | 762 | 70.94 |
SCHOLARSHIP, BLOGGING, AND TRADEOFFS: ON DISCOVERING, DISSEMINATING, AND DOING
- Clyde Gray
- 1 years ago
- Views:
Transcription
1 SCHOLARSHIP, BLOGGING, AND TRADEOFFS: ON DISCOVERING, DISSEMINATING, AND DOING EUGENE VOLOKH* How WE SHOULD SPEND OUR TIME Sometimes, when I'm in the middle of a heavy blogging spurt, I ask myself: Shouldn't I be spending this time writing law review articles instead? But maybe, when I'm in the middle of writing a law review article, I should ask myself: Shouldn't I be spending this time blogging instead? My blog gets about 20,000 unique visitors each weekday; I don't know how many people read my articles, but I'm pretty sure it's far from 20,000. True, the article readers are presumably more likely to be the ones we scholars want to influence with what we write. But how much more likely? Just how much influence do our law review articles actually have? Given this uncertainty, and the suspicion that a typical law review article's influence is far from vast, just how much should we value our "traditional scholarship," and what fraction of our years should we devote to it? These are not rhetorical questions; I honestly want to know the answers, and I suspect many other academic bloggers do too. The academic's job has long been understood as involving at least three components: (1) Discovering (or, if you prefer, creating) knowledge. (2) Disseminating knowledge and ideas, both (a) those discovered by oneself and (b) those discovered by others. This is often done by applying the knowledge and ideas to recent events, for instance when appearing on a radio program, writing an op-ed, or talking to a reporter. (3) Doing things in the sense of affecting law, culture, or the physical world-for instance, litigating landmark cases, helping draft statutes, translating scientific discoveries into products, helping fight environmental problems, and the like. Much doing is a * Professor, UCLA School of Law (volokh i~law.ucla.edu); founder and coauthor, The Volokh Conspiracy, HeinOnline Wash. U. L. Rev
2 1090 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 result of disseminating your views to the right people; but most disseminating never quite amounts to doing. All these have long been seen as fitting within the "scholarship, teaching, service" triad on which academics are often evaluated.' When we praise someone's creativity or originality, we're generally praising his ability to discover, which is often thought of as the highest calling of a scholar. But people also often praise people's writing or teaching ability, which chiefly relate to disseminating. We admire (or at least envy) "public intellectuals," who achieve prominence through effective commentary, including commentary that helpfully applies others' discoveries rather than their own. And most of us, I'd wager, also admire scholars who are able to change the world (or even a little corner of the world), even if they change the world mostly using others' ideas. Before blogging, most of us spent relatively little of our time disseminating ideas or knowledge to the public. The bulk of our time was likely spent in scholarship (discovering). A good deal was spent in teaching (dissemination to students). For some of us, but likely not most of us, a good deal was spent in doing (chiefly consulting on cases). And while we'd sometimes talk to reporters or write op-eds, this took up a small part of our day. Yet while this was partly influenced by professional norms-you'll get tenure, promotion, and colleagues' respect more easily through law review articles than through op-eds it was also largely shaped by the way the media works. Writing an op-ed is, I've found, a limiting and unpleasant experience. You need to write 650 words, generally not substantially more and not substantially less. The piece needs to be closely tied to a current news event; even a few days' delay can make your piece unsellable. Some topics aren't very sellable regardless of whether there's a news hook. You also need to spend time pitching the piece to newspaper editors, one at a time, until you either get an acceptance or your news hook fades away. Even someone who wants to disseminate his ideas to the public 1. See, e.g., Scott Baker, Stephen J. Choi & Mitu Gulati, The Rat Race as an Information- Forcing Device, 81 IND. L.J. 53, 58 n.9 (2006). Discovering generally corresponds to "scholarship." When we praise a scholar's creativity or originality, we're usually praising him as a discoverer. Disseminating fits both within "teaching" and within part of the "service" that people do: popularizing one's work for the public, writing op-eds, giving speeches to professional groups, civic groups, or high school students, and the like. Effectively disseminating a work to colleagues (for instance, by writing well, and by taking the trouble to present the work at conferences and workshops) also helps increase the influence of one's scholarship within the scholarly community. Doing fits within "service" as well, though in some disciplines such as classics or pure mathematics there are generally few opportunities for pure doing, as distinguished from discovering and disseminating. HeinOnline Wash. U. L. Rev
3 20061 ON DISCOVERING, DISSEMINATING, AND DOING 1091 might not want to go through this hassle. "Should I spend my time discovering legal knowledge or disseminating legal knowledge to the public?" wasn't much of a question for most of us. 2 Then along came blogging, and the question became much more important. Blogging is fun, something no one ever accused op-ed writing of being. It takes work, like all writing does, but the ratio of interesting work to scutwork is much higher. You write about whatever you want; never mind whether there's a news hook, never mind whether only five percent of your readers will find it interesting, 3 never mind whether it's only 100 words long or maybe You don't need to please, or even deal with, an editor. You don't even have to proofread and polish as much. Polished work is more effective, but people forgive typos and other little lapses more than they would in print: readers realize that many academic bloggers will be willing and able to blog-or at least blog timely and often-only if they can do so with a minimum investment of effort. And, to my surprise, when you blog you actually create and interact with a community-naturally not a community of friends but at least a community of friendly acquaintances. My op-eds in the Wall Street Journal which has an official circulation of over two million 4 would occasionally lead to a couple of s from readers. Before I had comments, blog posts would sometimes get me dozens of messages, some hostile but many friendly, thoughtful, and even flattering. Now that I've enabled comments, I get fewer s, but I still get some, sometimes arguing with me, sometimes complimenting me, often pointing me to other interesting stories to cover; and the comments themselves end up being a conversation triggered by our posts, and often responding in thoughtful ways to our posts. I suspect this means that many of my blog readers read my work more carefully, and take it more seriously, than do the readers of my occasional op-eds. Naturally, newspaper readers can't me as easily as can blog readers; but "Eugene Volokh" isn't hard to find with a quick Google search. I'd bet the main reason for the vast difference in the readers-to-e say this as someone who, despite all this, wrote over forty op-eds, in publications from the Wall Street Journal to the Topeka Capital-Journal, before I went into blogging, and a few dozen more since I went into blogging. 3. Well, maybe "mostly never mind." I know that if I keep writing stuff that only a few of my readers find interesting, eventually they'll turn off. But if I post such niche material math puzzles, abstruse doctrinal discoveries, and the like every so often, no one will complain. 4. Audit Bureau of Circulations, Top 200 Newspapers by Largest Reported Circulation (2006), HeinOnline Wash. U. L. Rev
4 1092 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 mailers ratios among the media is that people who read my blog posts read them because they're mine, and not just something they stumbled on. They feel a connection with me, and thus, I hope, are more likely to be open to being persuaded by what I say. What's more, their feeling and acting on a connection with me makes me feel more of a connection with them. I suspect that most bloggers, especially those who allow comments, like the feeling that they've built this odd relationship with a bunch of often interesting and thoughtful strangers-the feeling that they've "pioneer[ed] a new patch of common ground" that they and people like them can enjoy together. 5 It's hard to get that from an op-ed. 6 So, it's our choice, at least once we have tenure. But how should we exercise that choice? Yes, we're probably better off both discovering and disseminating, if we're good at both and enjoy both. But how much of both? THE PROMINENCE DIVIDEND? One good way of solving either/or problems is to find synergies rather than reconciling oneself to tradeoffs. Can we, at least sometimes, use blogging as a way of advancing our discovering and doing? Here's a tempting speculation: blogging makes you better known, and blogging on legal issues makes you better known among law students, lawyers, law clerks, and legal academics. And being well-known: (1) increases the likelihood that people who stumble across a law review article with your name on it for instance, in the results of a Westlaw or Lexis query-will actually read it; 5. Dar Williams, When Sal's Burned Down, on Dar Williams, The Honesty Room (Razor & Tie 1995). 6. Maybe it's easier to get it from a regular column, but those are even more work, and more scutwork, than op-eds. HeinOnline Wash. U. L. Rev
5 20061 ON DISCOVERING, DISSEMINATING, AND DOING 1093 (2) slightly increases the likelihood that law review articles editors will like your next submission, and will push it hard to their colleagues if they do like it; (3) increases the likelihood that law review editors will invite you to important symposia in your field; (4) increases the likelihood that legislative staffers will call you to get your advice on drafting and revising proposed statutes; (5) increases the likelihood that lawyers will call you for help on interesting cases. This would work best if the decisionmakers routinely read and like your blog, and feel like they're part of the blog's reader community. But it might also work if the decisionmakers have just visited your blog on occasion, or if friends have told them about it. And if this speculation proves accurate, then this means that blogging can help promote your discovering, and advance your doing. The trouble is that this is all speculation. It sounds reasonable to me, but I can't even provide personal anecdotal evidence for it. I had decent article placements, a decent amount of citations to my articles, and a decent number of calls from legislative staffers before I started blogging; I've had a decent amount after. I'd like to think that blogging can pay a prominence dividend. But does it? THE BLOG AS A TOOL FOR DISSEMINATING ONE'S OWN DiscOVERIES Regardless of whether blogging pays a prominence dividend, it gives the blogger an extra audience for posts about his own discoveries. Such disseminating of one's own research has long been seen as an important part of an academic's scholarly (rather than just teaching or service) role; if one has invested all this effort in discovering, it makes sense to spend at least some effort to help the discovery do as much good as possible. And while one can make the discoveries but leave the disseminating to others, in practice few people will be as interested as we are in publicizing our work. Blogging lets one potentially reach a lot of readers, both lay and professional, who would otherwise not have seen the original work. The cheapest option is just putting up an abstract (perhaps one you've already written) with a link to the paper. A second option is to post the Introduction, post excerpts, or even serialize much of the article by posting an excerpt every few days. The most effective option is also the costliest, though still easier and more flexible than writing an op-ed: summarize HeinOnline Wash. U. L. Rev
6 1094 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 your main arguments, and reframe them in a way that lay readers-or perhaps lawyer readers who are nonetheless not that familiar with the article's subject matter better understand. Now this might seem obvious at some level. But I find that I don't do as much of this as I probably should. I tend to blog something about my new articles; but while I've had success serializing portions of some of my articles, I probably should do this more. And I've done little to post key insights from my past articles, insights that might still be fresh to many of my readers even though they're years old for me. Should we, as bloggers and scholars, make it a practice to go over our past scholarship, identify the key nuggets of added value, and blog briefly about them? Should we urge our junior colleagues who are bloggers to do the same? THE BLOG'S READER COMMUNITY AS A RESEARCH TOOL A blog can also help the blogger discover things. First, a blog is a useful tool for some kinds of research. If you want to find examples of a certain argument or a certain phenomenon, for instance, a Lexis query might not get you far. But if you have thousands of readers-especially ones who feel a sense of community with you, and are thus pleased to help you-some of them might be willing to draw on their own memories, or even their own research skills, to help you. If even one percent can give you examples, that might do the job. And this is especially so if the phenomenon isn't itself a legal one, but rather a historical or a scientific one: many of your readers may have specialized knowledge in these fields that you, your research assistant, and your research librarians lack. Such posts (often called "blegging," referring to a mix of blog and begging 7 ) are pretty common; and I've gotten some useful feedback this way. 8 I've also wondered whether we can combine a blog community and a faculty community so that nonblogger colleagues can take advantage of 7. Thanks to John Derbyshire, who apparently coined this word, and to James Fulford, who responded to my own bleg on the subject and pointed me to Derbyshire as the likely originator of the word. See John Derbyshire, July Diary, NAT'L REV. ONLINE, Aug. 1, 2002; Posting of Eugene Volokh to The Volokh Conspiracy, Blegging About "Blegging" (Apr. 19, 2006, 1:16 EST); James Fulford comment on The Volokh Conspiracy, /posts/ shtml#83182 (Apr. 19, 2006, 1:36 EST). 8. One recent example, though involving research for a "teaching" book more than a "scholarship" book: I was updating my Academic Legal Writing book to include a chapter on participating in law review write-on competitions; I had some ideas for advice to give students, but I figured that current or recent law review editors would have some good tips that I had missed. I posted a query on the blog, and got a lot of useful input. HeinOnline Wash. U. L. Rev
7 20061 ON DISCOVERING, DISSEMINATING, AND DOING 1095 the bloggers' audiences-perhaps the blog readers will respond to a blogger's request even if the request comes on behalf of the blogger's colleague. This seems like a useful tool to experiment with, at least if one doesn't experiment often enough to alienate the blog's readers. Second, a blogger can, at least in theory, use the blog to get feedback on the arguments that he's putting in his articles. Blog readers might provide useful counterarguments, or at least identify places where the blogger's argument is less persuasive than he'd like it to be. Most blog readers won't be interested in taking the time to read one's arguments (either the whole article or even a short excerpt), and most won't be knowledgeable enough to provide very useful reactions. Reactions from colleagues, or reactions on academic discussion lists, are likely to be more helpful. But as we know, it's always hard to get readers for one's drafts, and beggars can't be choosers. Offering the article for commentary by blog readers (some of whom will be scholars or at least relatively knowledgeable professionals or students) might provide at least some extra feedback, though, in my experience, not a vast amount. THE BLOG AS A TOOL FOR DOING: BLOGGING ABOUT PENDING CASES Most law professors want their law review articles to influence courts. We hope our articles get cited by lawyers, and read by judges and their clerks. We sometimes even send reprints of our articles to the chambers of judges who are deciding cases to which the articles are relevant. Unfortunately, we rarely have articles that are squarely on point. At best, we may have an article that is relevant to a case, but the relevance might take some explaining. More likely, we may have ideas about a pending case that we haven't yet fully expressed in an article. We can, of course, write an article tailored to the pending case, but then we have to get the article published in time; and, after the case is decided, chances are the article will be obsolete. If the article influences the court, we can feel good and get credit. But if the court ignores the article (always the likelier scenario), we'll have done a lot of work for nothing. We can also write amicus briefs-but that's at least moderately time-consuming, and often involves some modest expense and hassle. Yet law clerks, I'm told, often read blogs. I suspect How Appealing is the most commonly read one, but I imagine that InstaPundit and even The Volokh Conspiracy have at least some law clerk readers. Especially when a case is being considered by a many-member court, such as the Supreme Court, chances are good that at least one of the clerks on the court will read any posts on the case that are linked to by How Appealing. And even HeinOnline Wash. U. L. Rev
8 1096 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 if the clerks who read the posts aren't working on the case themselves, they might pass it along to their friends who are. If the blog post is really interesting, it might make its way to one of the judges, either directly or by influencing the clerk's analysis. One piece of evidence for this is that blog posts have been cited over thirty times in court decisions. 9 Presumably even more blog posts have been read by the judges or clerks, and in some measure influenced their thinking, but haven't been cited. A blog post is thus a less reliable way of reaching judges and clerks than is an amicus brief-an amicus brief will be read by someone in each chambers, and a blog post might not be. But it's much easier and quicker to produce than an amicus brief; it's often all we can do, since in many cases we know that we won't take the time and trouble to write a brief; and it does double duty as a way of disseminating the blogger's views to the public as well as to the judges. (In fact, the blog post has to be written as a message to all the blog's readers; I'm pretty sure that a blog post that obviously aims to reach the judges or clerks working on a case will be looked down on, though I'm not exactly sure why. 10 ) Here, however, is an interesting data point: as of August 6, 2006, 24 of the 32 court citations to blogs refer to one blog, Professor Douglas Berman's Sentencing Law and Policy.' 1 The Volokh Conspiracy has been cited twice, and once was just for the lyrics of a humorous song that we posted. Other blogs have likewise been cited for their posts no more than once. 1 2 Douglas Berman is doing something right, at least if his goal is to be read by judges and clerks, and influencing court decisions. I'm not sure that the rest of us are. BLOGGING AND MICRO-DISCOVERIES: A GAP IN THE LEGAL PUBLISHING SYSTEM So far, I've assumed that blogging involves disseminating preexisting ideas. A blogger might, for instance, describe how existing legal doctrines or concepts apply to current events. Or he might use existing legal tools, 9. Law Blog Metrics [formerly 3L Epiphany], epiphany/ 2006/08/cases citing le.html, Cases Citing Legal Blogs Updated List (Aug. 6, 2006). 10. There'd be no violation of the rules of legal ethics: A blog post is no more an ex parte communication than a published law review article or an op-ed in the ANew York Times. 11. Law Blog Metrics, supra note Some have been mentioned more often than that as examples ofblogs, but not as sources of information or arguments. HeinOnline Wash. U. L. Rev
9 20061 ON DISCOVERING, DISSEMINATING, AND DOING 1097 whether precedent or certain analytical structures, to critique recent court decisions. But the process of applying existing principles to new fact patterns or new cases may itself involve "micro-discoveries": original thinking that isn't big-think or even middle-think, but that is still a valuable contribution. For example, some time ago there was a bunch of news stories about legislatures trying to ban funeral picketing. 13 Several readers ed them to me, and suggested I blog about this topic. Eventually, I cobbled together a short piece that I published in the National Review Online, 14 but that I could have easily done as a post instead. Much of the analysis is pretty banal application of basic First Amendment doctrine, but there are some nonobvious observations within it. For instance, while most lawyers who know anything about First Amendment law will quickly think of the analogy between funeral picketing bans and residential picketing bans, many lawyers don't realize that Madsen v. Women's Health Center, 15 an abortion clinic picketing case, also had something to say about residential picketing. And because of Madsen, bans on residential picketing and, by analogy, funeral picketing-are probably constitutional only if they are limited to picketing that's right in front of the home or cemetery that's being picketed, or perhaps very near. Three-hundred- or five-hundred-foot bubble zones around cemeteries, a favorite of recent funeral picketing bills, are thus likely unconstitutional. This might be at least a slightly useful micro-discovery. 16 Many law professors wouldn't want to take the time and trouble to turn it into a fullfledged law review article; there'd be too little payoff for the work involved. Yet there is some value, I think, in the observation. Authors of future articles on funeral picketing (probably law students more than law professors) might benefit from seeing it. So would lawyers who are drafting the laws, or litigating their constitutionality. It's the sort of 13. The proposed bans were largely responses to the unlovely Fred Phelps, who began by picketing funerals of gays with signs saying things like "God Hates Fags," and then moved on to picketing funerals of soldiers with signs saying things like "Thank God for 9/11" and "Thank God for Dead Soldiers" (the theory being that God is punishing America for its toleration of homosexuality). Eugene Volokh, Burying Funeral Protests, NAT'L REV. ONLINE, Mar. 23, See Volokh, supra note U.S. 753 (1994). 16. A later search revealed to me that a 2000 article on a different topic noted this point in a footnote; but my piece discussed this in a little more detail, and in any event the broader point remains: If it weren't for the 2000 piece, this would have been a novel, nonobvious, and useful point, though one that's too slight to turn into a separate law review article. HeinOnline Wash. U. L. Rev
10 1098 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 observation that should be published, and should be preserved for future scholars. The same is true of many blog posts I've seen only a small fraction of all law-related blog posts, but a large absolute number. Nonobvious commentary on recent cases, observations about how two seemingly different legal principles have something in common, and discoveries of interesting tidbits in long-forgotten cases or legal documents can all be of some use to future scholars, and are therefore worth preserving for them. One piece of evidence for this is that as of August 2006, there were nearly 500 citations to blog posts in law review articles, 17 and over thirty in court decisions. 18 Yet while blogging makes it easier for these micro-discoveries to be disseminated, this dissemination is ephemeral. Readers will read such blog posts; some other bloggers might even discuss them. But a few months later, they'll be largely forgotten and largely unfindable (though not entirely so, as the citations to blog posts prove), at least so long as Westlaw's JLR database and Lexis's LAWREV database are the main legal research tools. 19 So the law review article system is good at preserving substantial discoveries, but it's not useful for preserving the micro-discoveries. Blogging is good at disseminating micro-discoveries, but it too is bad at preserving them in a way that can help future researchers. So while my coblogger Orin Kerr is right that blog posts tend to be better than student casenotes at discussing recent cases, and that they should eventually largely supplant such casenotes, 20 I doubt that they can effectively do so, so long as blog posts aren't memorialized in publications searchable through Westlaw's JLR and Lexis's LAWREV. It seems to me that there's a good solution to this problem: have some online "publication" that republishes those blog posts (and even op-eds) that actually do contain potentially useful micro-discoveries. This publication-let's call it Law Notes would have to be filtered by some editor, but this could involve a relatively light screening. And while 17. Law Blog Metrics, epiphany/2006/08/law review arti.html, Law Review Articles Citing Legal Blogs (Aug. 16, 2006). 18. See Law Blog Metrics, supra note Many blogs, including my own, are now available on Lexis in the NEWS;CURNWS file; a service called Newstex syndicates them and sells them to Lexis, where they go into the NEWSTX file and from there into CURNWS. But legal researchers looking for legal analyses understandably look in the LAWREV database; searching through the mostly non-legal-analysis NEWS;CURNWS file is too likely to find false positives. 20. Orin S. Kerr, Blogs and the Legal Academy, 84 WASH. U. L. REV (2006). HeinOnline Wash. U. L. Rev
11 20061 ON DISCOVERING, DISSEMINATING, AND DOING 1099 scholars who submit posts to it will probably want to polish the posts a little, this too could be a quick and easy task compared to the law review editing process. Law school appointments committees won't and shouldn't see Law Notes "articles" as serious publications. Nor would publishing in Law Notes give a piece the imprimatur that publishing in a top-ranked law review provides (rightly or wrongly). But the point of publishing in Law Notes wouldn't be to build your publication record, or to add credibility to your piece. It would just be to preserve your ideas in a way that helps future scholars what the academic publishing process is supposed to be about, but without the hassles of that publishing process. To the extent a Law Notes piece ups some professional counter of yours, it would be your citation count, not your article publication count. I'm pretty sure that Westlaw and Lexis would be willing to include Law Notes in their publication list. Their business is providing access to publications that are potentially useful to their subscribers, and I'd think that Law Notes would be at least as useful to subscribers as are many legal journals. The tougher question is whether someone or some group will be willing to invest the time needed to screen submissions, and to deal with blowback from rejections. This should be a modest investment, since the point of Law Notes is to be quite unselective. But it's an investment that won't pay much of a personal return (being the editor of Law Notes is never going to be prestigious), so it may well be an investment that won't be made. Yet if I'm right, then if the investment isn't made, lots of microdiscoveries made by bloggers will be lost, and will have to be rediscovered by future scholars. And, of course, we law professors won't get as many citations as we could: a tragedy, a travesty, a disaster. BACK TO HOW WE SHOULD SPEND OUR TIME So I've talked briefly about ways in which our disseminating ideas through blogging can help us in discovering and doing; and of course discovering and doing can help us in disseminating, for instance by building our credentials as scholars, which can in turn help us draw readers. I've also talked about how blogging can itself involve micro- HeinOnline Wash. U. L. Rev
12 1100 WASHINGTON UNIVERSITY LAW REVIEW [VOL. 84:1089 discoveries, though I agree with others who say that more serious discoveries are likely to come through attempts to write in other media. 21 Yet even if I'm right about all this, I doubt that blogging is even close to the most efficient way of spending one's time if one is interested purely in discovering or in doing. Starting a blog is easy and not very timeconsuming. Building a blog that's successful enough to give you some of the benefits I describe is extremely time-consuming. If you just want to write more law review articles and place them in more prominent places, spend your time thinking about articles and writing articles, not blogging. No, we blog because we like it. Sometimes we even blog because it's a pleasant way to procrastinate instead of engaging in the often painful process of writing articles. We blog because we enjoy the feeling that people are listening to our ideas, ideas that are ours in the sense that we hold and express them, though usually not ours in the sense that we pioneered them. And we blog because of the possibility, however rarely realized, that we might actually persuade someone. So the question remains: how much should we value that, compared to the traditionally recognized value of discovering genuinely original knowledge? I wish I knew the answer. 21. See, e.g., Kerr, supra note 20; Randy Barnett, Caveat Blogging: Blogging and the Flight Jrom Scholarship, 84 WASH. U. L. REV (2006); Kate Litvak, Blog as a Bugged Water Cooler, 84 WASH. U. L. REV (2006); Lawrence B. Solum, Blogging and the Transbrmation ot Legal Scholarship, 84 WASH. U. L. REV (2006). HeinOnline Wash. U. L. Rev
Compass Interdisciplinary Virtual Conference 19-30 Oct 2009
Compass Interdisciplinary Virtual Conference 19-30 Oct 2009 10 Things New Scholars should do to get published Duane Wegener Professor of Social Psychology, Purdue University Hello, I hope you re having
>>
Profiles of Chemical Engineers
Profiles of Chemical Engineers James Monroe Associate Attorney Finnegan, Henderson, Farabow, Garrett & Dunner Washington, DC Education: B.S. - Chemical Engineering, Washington University J.D. - Ge
Permission-Based Marketing for Lawyers
Permission-Based Marketing for Lawyers Jim Hart is a divorce attorney in Cary, North Carolina. Previously, his law practice was based in Florida. He owns several websites. Jameshartlaw.com redirects
Google Lead Generation for Attorneys
1 Google Lead Generation For Attorneys Leverage The Power Of AdWords To Grow Your Law Business FAST You re about to discover the secrets of fast legal practice success with Google AdWords. Google AdWords
Flat Rate Per Claim -vs- Percentage Billing Fees. A Devil's Advocate View
Flat Rate Per Claim -vs- Percentage Billing Fees A Devil's Advocate View Assuming a full service solution, there are basically two methods billing services use to charge for their services, either a percentage
!.
Step-by-Step Guest Blogging for Lawyers
Step-by-Step Guest Blogging for Lawyers By James Druman In this short guide, you will learn how to harness one of the most powerful content marketing strategies on the Internet guest blogging. What
Generating Leads, Brand, Relationships, And Trust At The Same Time
Generating Leads, Brand, Relationships, And Trust At The Same Time By Mike Schultz Relationships. Trust. Delivery of superb value. These are core ingredients of a successful service firm. Talk to 100 service
Part II. Managing Issues
Managing Issues Part II. Managing Issues If projects are the most important part of Redmine, then issues are the second most important. Projects are where you describe what to do, bring everyone together,.
YOU WILL NOT BE EFFECTIVE READING THIS.
This is the most effective and powerful script for securing appointment with FSBO's you will ever put to use. This scrip will increase your appointment closing ratio by 50-60%. The thing to keep in mind
23 Ways to Sell More Using Social Media Marketing
23 Ways to Sell More Using Social Media Marketing 1. Be visible Don't just tweet/post once or twice and think your job is done. Get online and speak to people. Network and let your target market get to Boost Your Skills with On-Site Courses Tailored to Your Needs
Boost Your Skills with On-Site Courses Tailored to Your Needs The Applied Technology Institute specializes in training programs for technical professionals. Our courses keep you
ON APPLYING TO GRADUATE SCHOOL IN PSYCHOLOGY *
ON APPLYING TO GRADUATE SCHOOL IN PSYCHOLOGY * Admission to a graduate program in psychology can be quite competitive. High quality programs are, of course, more competitive than lower quality programs.
Jenesis Software - Podcast Episode 3
Jenesis Software - Podcast Episode 3 Welcome to Episode 3. This is Benny speaking, and I'm with- Eddie. Chuck. Today we'll be addressing system requirements. We will also be talking about some monitor
How to Write a Successful PhD Dissertation Proposal
How to Write a Successful PhD Dissertation Proposal Before considering the "how", we should probably spend a few minutes on the "why." The obvious things certainly apply; i.e.: 1. to develop a roadmap Importance of Citation
By Judy Hunter Grinnell College A citation is both a signpost and an acknowledgement. As a signpost, it signals the location of your source. As an acknowledgement, it reveals that you are indebted to that
The Right Stuff: How to Find Good Information
The Right Stuff: How to Find Good Information David D. Thornburg, PhD Executive Director, Thornburg Center for Space Exploration dthornburg@aol.com One of the most frustrating tasks you can have as a student
Secrets From OfflineBiz.com Copyright 2010 Andrew Cavanagh all rights reserved The Lucrative Gold Mine In Brick And Mortar Businesses If you've studied internet marketing for 6 months or more then there
EMPLOYEE JOB IMPROVEMENT PLANS. This Employee Job Improvement Plan designed by Kielley Management Consultants achieves results because:
EMPLOYEE JOB IMPROVEMENT PLANS This Employee Job Improvement Plan designed by Kielley Management Consultants achieves results because: it is simple and understandable it keeps supervisors and employees
Search Engine Optimization
Search Engine Optimization The Basic Facts Every Small Business Owner Should Know RICK EISENBART Contents 1. Introduction - Why Should You Care About SEO?...1 2. Search Engine Optimization Defined...3
Back to School: Working with Teachers and Schools
Back to School: Working with Teachers and Schools Starting school each fall is a challenge for the student and parents. The following article offers some valuable suggestions as your child starts a new
The Perfect (Elevator) Pitch
SPEAKING OF BUSINESS AUSTIN CORNELIO The Perfect (Elevator) Pitch It's a skill every businessperson needs. How to create it, rehearse it, and tailor it for a specific audience By Aileen Pincus One of
Guide for Local Business Google Pay Per Click Marketing!
Guide for Local Business Google Pay Per Click Marketing! Guide for Google Pay Per Click Marketing - Leverage The Power Of Adwords To Grow Your Business FAST You re about to discover the secrets of fast
Rome Workshop Cooperation between state officials and NGOs
Rome Workshop Cooperation between state officials and NGOs I understand that participants are expecting to engage in this workshop, so I do not intend to speak initially for very long. l will briefly introduce
For More Free Marketing Information, Tips & Advice, visit
For More Free Marketing Information, Tips & Advice, visit DISCLAIMER AND/OR LEGAL NOTICES The information presented in this E Book represents the views of the publisher as of the date of publication.:
Quick tips to answer the Personal Interview questions! As you go for a personal interview, always expect the question "Tell us something about yourself". Go prepared to answer it.! Understand the requirements
Managed Services in a Month - Part Five
Managed Services in a Month 59 Managed Services in a Month - Part Five Where we've been: Topic One: Start making a plan Topic Two: Create a three-tiered pricing structure Topic Three: Weed your client
Hip Replacement Recall. A Special Report
Hip Replacement Recall A Special Report What You MUST Know About Metal Toxicity and the Seven Biggest Mistakes that could prevent you from getting the compensation you deserve Your Hip Recall Help
Check Out These Wonder Tips About Reputation Management In The Article Below
Check Out These Wonder Tips About Reputation Management In The Article Below In the business world, reputation is just about everything. Without a good reputation, a business will have a hard time flourishing.
SARS_20131230_173118 Page 1 of 6
Speaker 1: In this episode, I want to discuss how to describe things in your personal statements or in your application materials when you have to talk about something that's a bad thing from your past,
Have Information to Make the Right Decisions!
Here's Your Free Report... How To Stop Foreclosure! Dear Homeowner, My name is Michael Riley. I am a Real Estate Investor and I can share with you the secrets to saving your home from foreclosure. I
Brought to you by: Josh Bradley Table of Contents: 1 - What Are MLM Genealogy Leads 2 - How To Recruit Using Genealogy Leads 3 -
Jenesis Software - Podcast Episode 2
Jenesis Software - Podcast Episode 2 All right, welcome to episode two with Chuck, Eddie, And Benny. And we're doing some technical talk today about network speed on episode two. Let's talk about, guys,
The
Interview With A Teen. Great Family. Outstanding Education. Heroine Addict
Interview With A Teen. Great Family. Outstanding Education. Heroine Addict I recently had the incredible opportunity to interview a young man, Gregor, who very quickly fell into a dependent situation with
How to Avoid Committing Plagiarism in Law School
How to Avoid Committing Plagiarism in Law School Ruth Ann McKinney Director, The Writing and Learning Resources Center The University of North Carolina School of Law 2006 By the time you ve gotten to law
Writing Op-Eds to affect Public Policy. Professor Felicity Vabulas
Writing Op-Eds to affect Public Policy Professor Felicity Vabulas Affecting public policy through writing We entered this field because we felt passionate about changing something Important for each,
Seven Things You Must Know Before Hiring a DUI Attorney
Seven Things You Must Know Before Hiring a DUI Attorney Seven Things to Know Before Hiring a DUI Attorney Copyright 2014 SmartWeb Online 1 Introduction Some people don t quite understand the severity of
Testing, What is it Good For? Absolutely Everything!
Testing, What is it Good For? Absolutely Everything! An overview of software testing and why it s an essential step in building a good product Beth Schechner Elementool The content of this ebook is provided
Analysis and Survey Design by Strategic Technology Solutions Rich La Valley, President
Analysis and Survey Design by Strategic Technology Solutions Rich La Valley, President Methodology Sample of College Graduate who went through IB from Social Network Sites Email sent to over 650 potential
Profiles of Civil Engineers
Profiles of Civil Engineers Chris A. Bell, Ph.D., P.E. Associate Dean Oregon State University Corvallis, OR Education: B.S., Civil Engineering, University of Nottingham, UK Ph.D., University of Notting INFORMATIONAL INTERVIEW Networking with Career Professionals
THE INFORMATIONAL INTERVIEW Networking with Career Professionals SUNY College at Potsdam Career Planning, Sisson Hall 130, Phone 267-2344 Web: e-mail: career@ potsdam.edu WHAT IS
Profiles of Mechanical Engineers
Profiles of Mechanical Engineers Adrienne Lavine Professor, Mechanical Engineering University of California at Los Angeles Los Angeles, CA Education: PhD, Mechanical Engineering, University of California/Berkeley
LEAD NURTURE HOW-TO HANDBOOK. Build and maintain more profitable relationships
LEAD NURTURE HOW-TO HANDBOOK Build and maintain more profitable relationships Congratulations! You've launched a successful marketing campaign, created and released some popular content, and succeeded
Writingin College, by Joseph M. Williams and Lawrence McEnerney 1. Some crucial differencesbetween high school and college writing
Writingin College, by Joseph M. Williams and Lawrence McEnerney 1. Some crucial differencesbetween high school and college writing From high school to college Some students make very smooth transitions
Academic research is one of the key functions of business schools,
Research Re-Examined AACSB s Impact of Research Task Force generates much dialogue and debate as it issues a report that calls for new ways to measure faculty scholarship. by Sharon Shinn Academic research
Teaching Public Speaking Online
Teaching Public Speaking Online By Tim Sheldon Bryant & Stratton College January 27, 2009 I teach public speaking Online using PowerPoint audio, and it has proven to be as effective in developing speaking
It is clear the postal mail is still very relevant in today's marketing environment.
Email and Mobile Digital channels have many strengths, but they also have weaknesses. For example, many companies routinely send out emails as a part of their marketing campaigns. But people receive hundreds
Ethical Policy for the Journals of the London Mathematical Society
Ethical Policy for the Journals of the London Mathematical Society This document is a reference for Authors, Referees, Editors and publishing staff. Part 1 summarises the ethical policy of the journals
Thinking about Information Sources
Writing Skills III Thinking about Information Sources Internet Resources & Magazine Articles Name Date Austin Community College Library Services 8/11 RW Part I: Internet Resources Directions for completing
Transcript of Simulated Presentation on the Chapter 7 Trustee and Counsel
Transcript of Simulated Presentation on the Chapter 7 Trustee and Counsel The following is a transcript of a simulated presentation to an audience of lawyers at the monthly meeting of a Bankruptcy Association. | http://docplayer.net/1717027-Scholarship-blogging-and-tradeoffs-on-discovering-disseminating-and-doing.html | CC-MAIN-2017-22 | refinedweb | 7,308 | 56.69 |
Framework agnostic, redis backed, cart system, Python library
Project description
E-Cart is a framework agnostic, redis backed, cart system, built in Python. It is not a POS, or a full fledged ecommerce system.
Installation
pip install ecart
Requirements
As E-Cart harnesses the power of Redis.You should have running Redis Server. and installed redis-py redis-py package.
Basic Usage
Import the Cart class from the ecart package:
from ecart.ecart import Cart
Create a new shopping cart:
cart_obj = Cart(user_id, redis_connection, ttl)
user_id : This a required parameter which acts as a unique identifier for the cart. If you don’t want a user to have more than one cart at a time, it’s generally best to set this to the user’s id.
redis_connection: This too is a required field and is used to communicate with the Redis database. This is basically a redis connection object obtained by calling the redis.Redis() function of the redis package. An sample function to create such object is available at redis_connection.py
ttl: This field used to set the expiry time of the user cart in the Redis in seconds. This is an optional field with a default value of 604800.
To add an item to the cart:
cart_obj.add(product_id, unit_cost, quantity)
This function take product_id, unit_cost and quantity and other details (**kwargs) if you like. Once executed this function add the given product and its details into the user cart in redis db.
To Retrieve the items:
cart_obj.get()
This function returns the complete cart of the user, basically a dictionary of product_id to product_details dictionary.
Functions Exposed
Following are the complete details of the methods exposed by cart_obj object:
add
add(product_id, unit_cost, quantity, **extra_details)
This function is the life blood of E-Cart. Below are the details of the arguments for the add function:
- product_id: (required) to store the ID of the model you’re adding
- quantity: (required) which will let you use the Cart#quantity and Cart#total methods without any extra configuration.
- unit_cost: (required) which will help you to calculate total value of cart.
- extra_details:(optional) if you want to store any extra information about the cart item just pass the details as **kwargs, ecart will take care of it.
remove
remove(product_id)
As you would have guessed, removes an item of the input product_id
contains
contains(product_id)
Returns a Boolean indicating whether an item of the given product_id is in the cart or not.
get_product
get_product(product_id)
For the input product_id, this function will return the Item dictionary with unit_cost, quantity etc details.
get
get()
This function returns the complete cart of the user, basically a dictionary of product_id to product_details dictionary.
total_cost
total_cost()
This will return the sum all of the cost return values of all of the items in the cart. For this to work, the :unit_cost and :quantity fields need to be set for all items.
count
count()
This will return the total number of items in the cart. Faster than cart.items.size because it doesn’t load all of the item data from redis.
quantity
quantity()
This will return the total quantity of all the items. The quantity field is set in the config block, by default it’s :quantity
get_ttl
get_ttl()
This will return the number of seconds until the cart expires.
set_ttl
set_ttl(ttl_value)
This will set the ttl of the user cart in redis to ttl_value. ttl_value must be integer and is in seconds
destroy
destroy()
This will delete the cart, and all the line_items out of it.
copy
copy(new_id)
This method will copy the current cart to the new unique_id. Will be useful for copying guest user’s cart to logged-in user’s cart or simply creating a copy of the cart.
Example
Lets walk through an example below:
from ecart.ecart import Cart cart = Cart(user_id, reddis_connection) # ttl is optional default is 604800 cart.add(product_id, unit_cost, quantity) # quantity defaults to 1, also you can pass optional dict(extra info) cart.total cart.quantity
How to Contribute
-. | https://pypi.org/project/ecart/ | CC-MAIN-2018-26 | refinedweb | 677 | 55.74 |
FileKit alternatives and similar libraries
Based on the "Files" category
FileBrowser8.0 0.0 L5 FileKit VS FileBrowserPowerful Swift file browser for iOS.
PathKit7.6 1.2 L4 FileKit VS PathKitEffortless path operations in Swift.
FileProvider6.6 0.1 L3 FileKit VS FileProviderNSFileManager replacement for Local and Remote (WebDAV/Dropbox/SMB2) files.
CFileWrapper0.3 0.0 L5 FileKit VS CFileWrapperRead/Write files in Swift without Foundation.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of FileKit or a related project?
README
Installation • Usage • License • Documentation
FileKit is a Swift framework that allows for simple and expressive file management.
Development happens in the
develop branch.
Installation
Compatibility
OS X 10.9+ / iOS 8.0+ / watchOS 2.0 / tvOS 9.0
Xcode 7.1+, Swift 2.1+
Install Using CocoaPods
CocoaPods is a centralized dependency manager for Objective-C and Swift. Go here to learn more.
Add the project to your Podfile.
use_frameworks! pod 'FileKit', '~> 5.0.0'
Run
pod installand open the
.xcworkspacefile to launch Xcode.
Import the FileKit framework.
import FileKit
Install Using Carthage
Carthage is a decentralized dependency manager for Objective-C and Swift.
Add the project to your Cartfile.
github "nvzqz/FileKit"
Run
carthage updateand follow the additional steps in order to add FileKit to your project.
Import the FileKit framework.
import FileKit
Usage
Paths
Paths are handled with the
Path structure.
let home = Path("~") let drive: Path = "/Volumes/Macintosh HD" let file: Path = "~/Desktop/file\(1)"
Operations
New Files
A blank file can be written by calling
createFile() on an
Path.
try Path(".gitignore").createFile()
New Directories
A directory can be created by calling
createDirectory() on an
Path.
try Path("~/Files").createDirectory() try Path("~/Books").createDirectory(withIntermediateDirectories: false)
Intermediate directories are created by default.
New Symlinks
A symbolic link can be created by calling
createSymlinkToPath(_:) on an
Path.
try Path("path/to/MyApp.app").symlinkFile(to: "~/Applications") print(Path("~/Applications/MyApp.app").exists) // true
Finding Paths
You can find all paths with the ".txt" extension five folders deep into the Desktop with:
let textFiles = Path.userDesktop.find(searchDepth: 5) { path in path.pathExtension == "txt" }
A negative
searchDepth will make it run until every path in
self is checked
against.
You can even map a function to paths found and get the non-nil results:
let documents = Path.userDocuments.find(searchDepth: 1) { path in String(path) }
Iterating Through Paths
Because
Path conforms to
SequenceType, it can be iterated through with a
for loop.
for download in Path.userDownloads { print("Downloaded file: \(download)") }
Current Working Directory
The current working directory for the process can be changed with
Path.Current.
To quickly change the current working directory to a path and back, there's the
changeDirectory(_:) method:
Path.userDesktop.changeDirectory { print(Path.current) // "/Users/nvzqz/Desktop" }
Common Ancestor
A common ancestor between two paths can be obtained:
print(Path.root.commonAncestor(.userHome)) // "/" print("~/Desktop" <^> "~/Downloads") // "~" print(.UserLibrary <^> .UserApplicationSupport) // "/Users/nvzqz/Library"
+ Operator
Appends two paths and returns the result
// ~/Documents/My Essay.docx let essay = Path.userDocuments + "My Essay.docx"
It can also be used to concatenate a string and a path, making the string value
a
Path beforehand.
let numberedFile: Path = "path/to/dir" + String(10) // "path/to/dir/10"
+= Operator
Appends the right path to the left path. Also works with a
String.
var photos = Path.userPictures + "My Photos" // ~/Pictures/My Photos photos += "../My Other Photos" // ~/Pictures/My Photos/../My Other Photos
% Operator
Returns the standardized version of the path.
let path: Path = "~/Desktop" path% == path.standardized // true
* Operator
Returns the resolved version of the path.
let path: Path = "~/Documents" path* == path.resolved // true
^ Operator
Returns the path's parent path.
let path: Path = "~/Movies" path^ == "~" // true
->> Operator
Moves the file at the left path to the right path.
Path counterpart:
moveFile(to:)
File counterpart:
move(to:)
->! Operator
Forcibly moves the file at the left path to the right path by deleting anything at the left path before moving the file.
+>> Operator
Copies the file at the left path to the right path.
Path counterpart:
copyFile(to:)
File counterpart:
copy(to:)
+>! Operator
Forcibly copies the file at the left path to the right path by deleting anything at the left path before copying the file.
=>> Operator
Creates a symlink of the left path at the right path.
Path counterpart:
symlinkFile(to:)
File counterpart:
symlink(to:)
=>! Operator
Forcibly creates a symlink of the left path at the right path by deleting anything at the left path before creating the symlink.
Subscripting
Subscripting an
Path will return all of its components up to and including
the index.
let users = Path("/Users/me/Desktop")[1] // /Users
standardize()
Standardizes the path.
The same as doing:
somePath = somePath.standardized
resolve()
Resolves the path's symlinks.
The same as doing:
somePath = somePath.resolved
Files
A file can be made using
File with a
DataType for its data type.
let plistFile = File<Dictionary>(path: Path.userDesktop + "sample.plist")
Files can be compared by size.
Operators
|> Operator
Writes the data on the left to the file on the right.
do { try "My name is Bob." |> TextFile(path: Path.userDesktop + "name.txt") } catch { print("I can't write to a desktop file?!") }
TextFile
The
TextFile class allows for reading and writing strings to a file.
Although it is a subclass of
File<String>,
TextFile offers some functionality
that
File<String> doesn't.
|>> Operator
Appends the string on the left to the
TextFile on the right.
let readme = TextFile(path: "README.txt") try "My Awesome Project" |> readme try "This is an awesome project." |>> readme
NSDictionaryFile
A typealias to
File<NSDictionary>.
NSArrayFile
A typealias to
File<NSArray>
NSDataFile
A typealias to
File<NSData>
DataFile
The
DataFile class allows for reading and writing
Data to a file.
Although it is a subclass of
File<Data>,
DataFile offers some functionality
that
File<Data> doesn't. You could specify
Data.ReadingOptions and
Data.WritingOptions
Encodable/Decodable
You can use any
Codable object with
File.
extension AnyCodableClass: JSONReadableWritable {} // if you want json encoding/decoding let codableFile = File<AnyCodableClass>(path: path) try codableFile.write(toEncode) let decoded: AnyCodableClass = try codableFile.read()
Alternatively you can use utility methods
try FileKit.write(toEncode, to: path) let decoded: AnyCodableClass = try FileKit.read(from: path)
File Permissions
The
FilePermissions struct allows for seeing the permissions of the current
process for a given file.
let swift: Path = "/usr/bin/swift" print(swift.filePermissions) // FilePermissions[read, execute]
Data Types
All types that conform to
DataType can be used to satisfy the generic type for
File.
Readable Protocol
A
Readable type must implement the static method
read(from: Path).
All
Readable types can be initialized with
init(contentsOfPath:).
Writable Protocol
A
Writable type must implement
write(to: Path, atomically: Bool).
Writing done by
write(to: Path) is done atomically by default.
WritableToFile
Types that have a
write(toFile:atomically:) method that takes in a
String
for the file path can conform to
Writable by simply conforming to
WritableToFile.
WritableConvertible
If a type itself cannot be written to a file but can output a writable type,
then it can conform to
WritableConvertible and become a
Writable that way.
FileKitError
The type for all errors thrown by FileKit operations is
FileKitError.
Errors can be converted to
String directly for any logging. If only the error
message is needed,
FileKitError has a
message property that states why the
error occurred.
// FileKitError(Could not copy file from "path/to/file" to "path/to/destination") String(FileKitError.copyFileFail(from: "path/to/file", to: "path/to/destination"))
License
FileKit and its assets are released under the [MIT License](LICENSE.md). Assets
can be found in the
assets
branch.
*Note that all licence references and agreements mentioned in the FileKit README section above are relevant to that project's source code only. | https://swift.libhunt.com/filekit-alternatives | CC-MAIN-2020-24 | refinedweb | 1,316 | 52.46 |
Coding Dojo June 2015
This dojo will be done a bit differently. The problem will be more practical, and unlike a normal dojo we encourage you to keep your solution to project I for project II
You will be paired up to work on Phase I from 7 to 7:45. We will then have a 15 minute group discussion, change partners, and either work more on project I or work on project II.
Everyone one is at different level. If you can't figure something out together, ask another pair or ask the facilitators. The idea is that we will all learn something by the end of the night and learn at our own pace.
Setup pip
This dojo will make use of 3rd party libraries which don't come with Python. There is a whole ecosystem of interesting libraries you can make use of, and once
pip is setup it's easy to access them.
However, setting
pip up is still a bit challenging. If you run into a problem please ask someone to help you.
The Python 3 Way
To make setting up
pip easier it has been included in Python 3 when you install it.
If you are running the Windows the easiest way to get access to
pip is to install Python 3.4 using the installer ( - scroll to the bottom of the page).
If you are running other OSes you should be able to something similar. Note you may need to use the command
python3 to access a Python 3 prompt.
pip 2014
You can follow the instructions here if you are using a Mac or Linux
You won't need virtualenv or a C compiler for this dojo, but some libraries you use in the future may executable flask ... $ python ... >>> from flask import Markup >>> Markup.isdigit(u'23') True >>> exit()
Project 1: Text Adventure Game
A text adventure game is a game without fancy graphics. It is completely text-based. A typical game will provide a set of "rooms" for the player to explore. The player will interact with the game by entering simple commands, such as
walk north,
take book, or
swing sword. As the player travels through your game world they should be presented with room descriptions and actions to take. The details are completely up to your imagination. Have fun with it!
Text Input in Python
We recommend you use the cmd library. It provides a command-line interface with some useful functionality, such as tab completion, history browsing, and a built-in help system. You will create a subclass of the Cmd class.
The textwrap library in python provides functionality to wrap lines of text at a desired length. This can be useful for making your commandline game a little nicer to play.
>>> import textwrap >>>>> print long_text The purple dog jumps over the blue moon when the yellow sun is gone for the day. The striped cat just stares, because that's what cats do. >>> for line in textwrap.wrap(long_text, 50): ... print(line) ... The purple dog jumps over the blue moon when the yellow sun is gone for the day. The striped cat just stares, because that's what cats do. >>>
Goal
Your goal is to write a Python function which you can call with the user's chosen action to get the next step of the scenario. Start by making a file called
game.py and copy this into it:
import cmd, textwrap class GameCmd(cmd.Cmd): prompt = '\nWhat would you like to do? > ' def default(self, arg): """The default action to take when the action is not understood.""" print('I do not understand that command. Type "help" for a list of commands.') def do_quit(self, arg): """Quit the game.""" return True if __name__ == "__main__": game = GameCmd() game.cmdloop()
Success
If you have successfully implement your function you should be able to do something like this:
$ python game.py What would you like to do? > help Documented commands (type help <topic>): ======================================== help put_on quit remove walk What would you like to do? > walk north You walk to the north. It starts snowing. What would you like to do? > put_on hat You are getting warmer. What would you like to do? > walk south You walk to the south. It is now getting really warm. What would you like to do? > remove hat You start to cool off. What would you like to do? > quit $
Bonus points for making it fun :).
You can keep running the script to test your progress or you can try Test Driven Development and writing unit tests to guide your coding.
Unit Tests
Start by making a file called
test_game.py and copy this into it:
import sys from unittest import TestCase from game import GameCmd from StringIO import StringIO class QuitTestCase(TestCase): def test_do_quit_returns_true(self): game = GameCmd() result = game.do_quit("") self.assertTrue(result) class DefaultTestCase(TestCase): def setUp(self): self.output = StringIO() # We need to capture standard out to verify the output of print sys.stdout = self.output def test_default_returns_expected_text(self): game = GameCmd() game.default("") self.assertEqual( 'I do not understand that command. Type "help" for a list of commands.', self.output.getvalue().strip() )
Here we have used the concept of monkey patching to switch out the normal stdout with a StringIO that we can easily inspect. You could also use a library such as mock to more safely patch code.
To run the unittests:
$ python -m unittest test_game .. ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK
Project 2: Simple Interactive Website With Forms
Using the command line isn't intuitive to most game players. A more flexible interface is the web, and it's pretty easy to write and run a website on your own computer which interacts with a open data API or even your own laptop.
There are a few different Python web frameworks, but the easiest to get started with is Flask. You can use
pip to install Flask
$ pip install --user flask
With Flask installed let's create the file
web_interface.py beside
game.py. You can start by copying the example
flask provides:
# web_interface.py from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run(debug=True) tells you that if you open a browser and put "" into the URL bar you will be taken to a web page generated by this Python script. Try it out!
When you make a change you will want to restart the website, and when you are done you will probably want to stop it. Go to your command line where you see output like this:
$ python web_interface.py * Running on 127.0.0.1 - - [15/Dec/2014 17:12:48] "GET / HTTP/1.1" 200 -
And type
control-c - that is hold down the
control key (sometimes abbreviated as
ctrl) your page you will see that it can no longer be found.
HTML
The web is built on a markup language called HTML. We won't go into too much detail here, but combining HTML with Python enables you to create dynamic websites. Let's use a triple quoted string in Python to output some HTML.
# web_interface.py from flask import Flask app = Flask(__name__) html = ''' <html> <head> <title>My Dynamic Website</title> </head> <body> <h1>{}</h1> </body> ''' @app.route("/") def hello(): return html.format("Hello World!") if __name__ == "__main__": app.run(debug=True)
Run
web_interface.py again and checkout the difference.
html holds a string of text that is a template we are using to render our web page. The
{} placeholder is populated with the value "Hello World!" via the
format function on strings.
Forms
To make your website interactive, you will want to gather user input. For this you will use a form. You will also need to deal with both the
GET and
POST http methods.
A
GET call is sent from the browser when you first load a web page. You will want your program's response to a
GET call to be html that contains a form.
The browser sends a
POST call when the user submits the form. This is where you will process any data from the user and return updated html.
Update the code in
web_interface.py to gather the user's name and say hi to him or her.
from flask import Flask from flask import request app = Flask(__name__) <p><label>What is your name?</label> <input type="text" name="name" required></p> <p><button type="submit">Send</button></p> </form> </body> </html> """ html_post = """ <html> <head> <title>My Interactive Website</title> </head> <body> <h1>{}</h1> </body> </html> """ @app.route("/", methods=['GET', 'POST']) def hello(): if request.method == 'POST': welcome_text = "Hello {}!".format(request.form['name']) return html_post.format(welcome_text) else: return html_get.format("Hello World!") if __name__ == "__main__": app.run(debug=True)
Bring it together
Your final task is to take your
GameCmd class from Project 1 and combine it with your interactive website. Make a website which will allow your users to play the game.
Ideas for further development:
- Investigate using templates instead of including html in the python code. Flask works with the Jinja2 templating language.
- Investigate using a form library for added functionality and ease of use. Flask-WTF is a popular form library.
- Add validation of the user input. It is generally unsafe to just blindly work with data submitted through web forms.
- Use sessions or cookies to remember the state of the game between commands | http://watpy.ca/learn/intro-projects/Python%20Dojo%20-%20Text%20Adventure%20Game.md | CC-MAIN-2018-13 | refinedweb | 1,577 | 76.11 |
Real-time Face Recognition with Python & OpenCV
Real-time Face recognition python project with OpenCV
In this beginner’s project, we will learn how to implement real-time human face recognition. We will build this project in Python using OpenCV.
We will study the Haar Cascade Classifier algorithms in OpenCV. Haar Cascade Classifier is a popular algorithm for object detection.
Keeping you updated with latest technology trends, Join TechVidvan on Telegram
Face Recognition Python Project:
Face Recognition is a technology in computer vision. In Face recognition / detection we locate and visualize the human faces in any digital image.
It is a subdomain of Object Detection, where we try to observe the instance of semantic objects. These objects are of particular class such as animals, cars, humans, etc. Face Detection technology has importance in many fields like marketing and security.
Cascade Classifiers and Haar Features:
Cascade Classifiers and Haar Features are the methods used for Object Detection.
It is a machine learning algorithm where we train a cascade function with tons of images. These images are in two categories: positive images containing the target object and negative images not containing the target object.
There are different types of cascade classifiers according to different target objects. In our project, we will use a classifier that considers the human face to recognize it as the target object.
Haar Feature selection technique has a target to extract human face features. Haar features are like convolution kernels. These features are different permutations of black and white rectangles. In each feature calculation, we find the sum of pixels under white and black rectangles.
Haar-cascade Detection in OpenCV:
OpenCV provides pre-trained models on Haar features and Cascade classifiers. These models are located in OpenCV installation. You can find the necessary XML files at:
/home/<username>/.local/lib/<python-version>/site-packages/cv2/data/
In the below code we will see how to use these pre-trained Haar cascade models to detect Human Face. We will implement a real-time human face recognition with python
Steps to implement human face recognition with Python & OpenCV:
First, create a python file face_detection.py and paste the below code:
1. Imports:
import cv2 import os
2. Initialize the classifier:
cascPath=os.path.dirname(cv2.__file__)+"/data/haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascPath)
3. Apply faceCascade on webcam frames:
video_capture = cv2.VideoCapture(0) while True: # Capture frame-by-frame ret, frames = video_capture.read() gray = cv2.cvtColor(frames,(frames, (x, y), (x+w, y+h), (0, 255, 0), 2) # Display the resulting frame cv2.imshow('Video', frames) if cv2.waitKey(1) & 0xFF == ord('q'): break
4. Release the capture frames:
video_capture.release() cv2.destroyAllWindows()
5. Now, run the project file using:
python3 face_detection.py
You will observe the bounding boxes in webcam frames. To stop the webcam capture press “q”.
Summary:
In this deep learning project, we developed a model for real-time human face recognition with python and opencv.
We discussed about Face detection, Cascade classifier, and Haar features, and finally how to use pre-trained model to detect human face in real-time.
Did you like the tutorial? Please rate TechVidvan on Facebook.
where is face recognition???
For advanced implementation of Face recognition project with source code, please refer:
It is only face detection….
Yes, this project only has implement of face detection. For face recognition, please refer:
I’m having error :
We have updated the code, the issue has been fixed.
Here, in this line they use ‘frames’ not ‘frame’ –
ret, frames = video_capture.read()
—-> 5 gray = cv2.cvtColor(frames, cv2.COLOR_BGR2GRAY)
use this above line in your code and
not working
change all “frame” to “frames”
please i want a source to stdy deep learning from 0 so i can start doing projects
For detailed deep learning tutorials, please refer Deep Learning DataFlair
I keep getting this error:
flags=cv2.CASCADE_SCALE_IMAGE
cv2.error: OpenCV(4.5.1-dev) /home/pi/opencv/modules/objdetect/src/cascadedetect.cpp:1689:
error: (-215:Assertion failed) !empty() in function ‘detectMultiScale’
Please some help me
James
import cv2
import os
cascPath=os.path.dirname(cv2.__file__)+”/data/haarcascade_frontalface_default.xml”
faceCascade = cv2.CascadeClassifier(cascPath)(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
# Display the resulting frame
cv2.imshow(‘Video’, frame)
if cv2.waitKey(1) & 0xFF == ord(‘q’):
break
video_capture.release()
cv2.destroyAllWindows()
Thanks for helping the community, keep learning. | https://techvidvan.com/tutorials/face-recognition-project-python-opencv/ | CC-MAIN-2021-17 | refinedweb | 727 | 51.24 |
Hey WPF devs – as of today you can get the Microsoft Surface 2.0 SDK and write your own surface app. You can even use a Windows 7 touch computer to create and test your app! To start playing and get more info, go to the!
Tag: Windows 7
WPF Shell Integration Library for .NET 3.5
One of the exciting new features in .NET 4 is the ability to use Windows 7 Shell features like Jump Lists, Thumbnail Buttons, and progress indicators in Taskbar buttons, with your WPF applications. These features are found in the System.Windows.Shell namespace in .NET 4. However, if you need to target .NET 3.5SP1, which ships with…
Fishbowl – A Facebook sample app in WPF…
.NET Framework 4 Beta 2 documentation now available
Docs…
Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 available for download
The Windows SDK for Windows 7 and the .NET Framework 3.5 SP1 is now available for download. Click here to download. For details on what’s in the SDK, see the Microsoft Windows SDK Blog. | https://blogs.msdn.microsoft.com/wpfsdk/tag/windows-7/ | CC-MAIN-2019-30 | refinedweb | 182 | 78.55 |
Overview of C++ and Object-Oriented Design
Contents
- Object-Oriented Design vs Procedural Design
- The HelloWorld Procedure and the HelloWorld Object
- C++ Data Types
- Expressions
- Coding Style
1. Object-Oriented Design vs Procedural Design
Many of you will already be familiar with one or more procedural languages. Examples of such languages are FORTRAN 77, Pascal and C. In the procedural programming paradigm, one focuses on the decomposition of software into various functional components. In other words, the program is organized into a collection of functions, (also known as procedures or subroutines), which will be executed in a defined order to produce the desired result.
By contrast, object-based programming focuses on the organization of software into a collection of components, called objects, that group together
- Related items of data, known as properties.
- Operations that are to be performed on the data, which are known as methods.
In other words, an object is a model of a real world concept, which posesses both state and behavior.
Programming languages that allow us to create objects are said to support abstract data types. Examples of such languages are CLU, Ada, Modula-2.® and Smalltalk.
2. The HelloWorld Procedure and the HelloWorld Object
Let's take a look two simple programs that print out the string, Hello World!
The HelloWorld Procedure
Here is the procedural version of the program, written in C. The first statement is a preprocessor directive that tells the compiler to include the contents of the header file stdio.h. We include this file because it declares the existence of the built-in function, printf(). Every C program must have a top-level function named main(), which provides the entry point to the program.
#include <stdio.h>
/* The HelloWorld procedure definition. */
void HelloWorld() {
printf("Hello World!\n");
}
/* The main program. */
int main() {
HelloWorld(); /* Execute the HelloWorld procedure. */
return 0; /* Indicates successful completion of the program. */
}
The HelloWorld Object
Here is the object-based version of the program, written in C++. We have created a new data type, HelloWorld, that is capable of printing out the words we want. In C++, the keyword class is used to declare a new data type. Our class has three publicly accessible methods, HelloWorld(), ~HelloWorld() and print(). The first two methods have special significance and they are respectively known as a constructor and the destructor. The constructor has the same name as the class. It is an initialization method that will be automatically invoked whenever we create a HelloWorld object. The destructor also has the same name as the class, but with a ~ prefix. It is a finalization method that will be automatically invoked whenever a HelloWorld object is destroyed. In our class, the print() method is the only one that actually does anything useful.>
// The HelloWorld class definition.
class HelloWorld {
public:
HelloWorld() {} // Constructor.
~HelloWorld() {} // Destructor.
void print() {
printf("Hello World!\n");
}
}; // Note that a semicolon is required here.
// The main progam.
int main() {
HelloWorld a; // Create a HelloWorld object.
a.print(); // Send a "print" message to the object.
return 0;
}
C++ as a Superset of C
Although C++ is generally thought of as an object-oriented language, it does support the procedural progamming paradigm as well. In fact, C++ supports all the features of C in addition to providing new features of its own. For example, a C++ program may include C-style comments that use the /* */ delimiters as well C++-style comments that use the // syntax.
/* C-style comments are also allowed in C++. */
// Alternative comment syntax that is only allowed in C++.
3. C++ Data Types
Built-in Data Types
(Ref. Lippman 3.1, 3.2)
C++ built-in data types are similar to those found in C. The basic built-in types include
- A boolean type: bool (only available in Standard C++).
- Character types: char, unsigned char and wchar_t (wchar_t supports wide characters and is only available in Standard C++).
- Integer types: short (or short int), int (or long int), unsigned short and unsigned int.
- Floating point types: float, double and long double.
Not all computing platforms agree on the actual size of the built-in data types, but the following table indicates the typical sizes on a 32-bit platform:
A literal constant is a constant value of some type. Examples of literal constants are
Note that there is no built-in data type for strings. Strings can be represented as character arrays or by using the string type provided in the Standard C++ library. A string literal constant is of the form
"Hello World!"
User-defined Data Types
We have already seen how we can define new data types by writing a class, and for the most part we will use classes. However, C++ also provides extended support for C-style structures. For example, C++ allows member functions to be packaged in a struct in addition to member data. The most significant difference between a class and a struct is that by default, the members of a class are private, whereas the members of a struct are public.
struct date {
int day;
int month;
int year;
void set_date(int d, int m, int y); // Member functions only allowed in C++.
};
int main() {
struct date a; /* C-style definition. */
date a; // Allowable C++ definition.
}
Pointer Types
(Ref. Lippman 3.3):
- the memory address of the object
- the type of the object
The following example illustrates the use of a pointer to an object of type double. The pointer is defined by the statement
Reference Types
(Ref. Lippman 3.6)
(Ref. Lippman 4.14)++.
}
const Keyword
(Ref. Lippman 3.5)
The const keyword is used to designate storage whose contents cannot be changed. A const object must be initialized at the time it is defined.
const int i = 10; /* Allowed both in C and C++. */
const int j; /* This is illegal. */
Variable Definitions
In C++, variable definitions may occur practically anywhere within a code block. A code block refers to any chunk of code that lies within a pair of scope delimiters, {}. For example, the following C program requires i and j to be defined at the top of the main() function.
;
}
4. Expressions
(Ref. Lippman 4.1-4.5, 4.7, 4.8, 4.13, 4.14)
Operator Precedence
An expression consists of one or more operands and a set of operations to be applied to them. The order in which operators are applied to operands is determined by operator precedence. For example, the expression.)
Arithmetic Conversions
The evaluation of arithmetic expressions follows two general guidelines:
- Wherever necessary, types are promoted to a wider type in order to prevent the loss of precision.
- Integral types (these are the various boolean, character and integer types) are promoted to the int data type prior to evaluation of the expression.
5. Coding Style
Coding styles tend to vary from one individual to another. While you are free to develop your own style, it is important to make your code consistent and readable. Software organizations frequently try to enforce consistency by developing a set of coding guidelines for programmers.");
}
} | http://ocw.mit.edu/courses/civil-and-environmental-engineering/1-124j-foundations-of-software-engineering-fall-2000/lecture-notes/overview_of_c-_and_object_oriented_design/ | crawl-003 | refinedweb | 1,174 | 56.76 |
This tutorial will guide you through using a Flask extension with
Quart. The code for this tutorial is present in the
examples/flask_ext directory. The example itself is a very simple
webpage that allows a user to login, check a protected route and
examples/flask_ext
To run the example, in examples/flask_ext the following should
start the server, (see Installation first),
$ export QUART_APP=flask_ext:app
$ quart run
this example is then available at.
It is always best to run python projects within a pipenv, which
should be created and activated as follows,
$ cd flask_ext
$ pipenv install quart flask-login
for this we will only need Quart and Flask-Login. Now pipenv can
be activated,
$ pipenv shell
Flask-Login is a very popular
Flask extension that manages user authentication. To use it with Quart
it is important to first activate the flask patching module in Quart,
by the following,
import quart.flask_patch
as this allows the extensions to find modules and objects in the flask
namespace.
Warning
This import must be the first line in your code, i.e. it must be in
the main or init module at the top. This line comes with a
performance cost.
The Flask-Login extension can now be used, as so,
import quart.flask_patch
import flask_login
from quart import Quart
app = Quart(__name__)
app.secret_key = 'secret' # Create an actual secret key for production
login_manager = flask_login.LoginManager()
login_manager.init_app(app)
Flask-Login requires the following code be present to manage the
users, notably to load a User given a request, to load a user given
their username and to return a message for unauthorized access,
from secrets import compare_digest
from quart import request
class User(flask_login.UserMixin):
pass
@login_manager.user_loader
def user_loader(username):
if username not in users:
return
user = User()
user.id = username
return user
@login_manager.request_loader
def request_loader(request):
username = request.form.get('username')
password = request.form.get('password', '')
if username not in users:
return
user = User()
user.id = username
user.is_authenticated = compare_digest(password, users[username]['password'])
return user
@login_manager.unauthorized_handler
def unauthorized_handler():
return 'Unauthorized'
All that is left is to provide login, logout and a protected route to
test that the app works. A user can then try to access the protected
route when not authorised and then after login. These routes are,
from quart import redirect, url_for
@app.route('/', methods=['GET', 'POST'])
async def login():
if request.method == 'GET':
return '''
<form method='POST'>
<input type='text' name='username' id='username' placeholder='username'></input>
<input type='password' name='password' id='password' placeholder='password'></input>
<input type='submit' name='submit'></input>
</form>
'''
username = (await request.form)['username']
password = (await request.form)['password']
if username in users and compare_digest(password, users[username]['password']):
user = User()
user.id = username
flask_login.login_user(user)
return redirect(url_for('protected'))
return 'Bad login'
@app.route('/protected')
@flask_login.login_required
async def protected():
return 'Logged in as: ' + flask_login.current_user.id
@app.route('/logout')
async def logout():
flask_login.logout_user()
return 'Logged out'
The example files contain this entire tutorial and a little more, so
they are now worth a read. Hopefully you can now go ahead and create
your own apps that use Flask extensions. | https://pgjones.gitlab.io/quart/tutorials/flask_ext_tutorial.html | CC-MAIN-2020-40 | refinedweb | 523 | 50.02 |
The SAPUI5 developer guide describes how to deploy a SAPUI5 application project to the SAPUI5 repository on the ABAP server in minute detail (). Technically, the files of the SAPUI5 application are stored as a BSP application on the server. You can create a BSP application with the wizard in Eclipse or use an application already existing on the server or create a new one manually on the server. What I miss from the guide are the subtle details around names if you create the BSP application manually. The name of the BSP application as well as the location and the name of the SICF service node must follow some rules.
According to the guide, the SAPUI5 application node in SICF has to be created in the branch /sap/bc/ui5_ui5/<namespace>. Usually, the namespace would be sap, which is what it has to be if you use the Eclipse wizard. But you can pick your own namespace as well, if you have one registered in the system. To use a custom namespace, you need to add a node with its name exactly like the namepsace as a child node of /sap/bc/ui5_ui5/. Your applications must then be published as child nodes of your namespace node e.g. /sap/bc/ui5_ui5/iprocon/testui5.
The reason for this comes from the logic in the http handler classes for SAPUI5, that are registered with the node /sap/bc/ui5_ui5. The mapping of the URL to the BSP application resources is done inside these classes.
All put together, if you want to use a custom namespace, then you need to create a child node for ui5_ui5 named as your namespace and add a child node to your namespace node with just the name of your BSP application without namespace prefix. The BSP application name itself nevertheless must contain the namespace prefix:
- SICF node for the SAPUI5 application in custom namespace: /sap/bc/ui5_ui5/iprocon/testui5
- BSP application name in custom namespace: /IPROCON/TESTUI5
If you do not want to use a custom namespace, you can simply pick any BSP application name from the customer namespace and create a sicf node with your application name as child of /sap/bc/ui5_ui5/sap.
- SICF node for the SAPUI5 application: /sap/bc/ui5_ui5/sap/ztestui5
- BSP application name: ZTESTUI5
Very helpful. I spent two hours on this topic before I found this guide. Thank you very much !!!
Hi Christian. Thank you for your post. The SAPUI5 applications located in our own namespace is working as expected. But when I create a service node in the same path (/sap/bc/ui5_ui5/mynamespace/zui5_test) and try to reach it from within the application I get the error ‘….zui5_test/index.html not found’. This works without any problems if I place the service node with the same handler in a higher node (e.g. as /sap/bc/zui5_test). It seems that the “index.html” is appended automatically. So my questions are:
– how to get rid of this “index.html” append?
– what is the best place for customer SAPUI5 services in the SICF path?
Regards
Matthias
Hi Christian.
Iam getting the same problem that Matthias said. Iam not able to find the index.html in server. Could you please help me in solve this issue
Thanks in advance
Regards
Surya.
Very helpful! | https://blogs.sap.com/2013/08/12/matching-sapui5-bsp-url-with-sicf-service-path/ | CC-MAIN-2018-51 | refinedweb | 552 | 63.09 |
MG 2004-04-01: I use this for getting menus in the system tray. Works on Win 98, and (I'm told) Win XP.
winico taskbar add $winico -callback {winicoCallback %m %x %y} -text $yourAppName proc winicoCallback {t {x 0} {y 0}} { if { $t == "WM_LBUTTONUP" } { wm deiconify . raise . focus . } elseif { $t == "WM_RBUTTONUP" } { .winicoPopup post $x $y .winicoPopup activate 0 } }where .winicoPopup is a menu I've already created, and . is the main GUI window of my application. That causes a left-click of the icon to bring the application up to the front, and a right-click to post the menu.Along with the winico.html documentation referenced immediately above, also be aware of these remarks from KBK and DRH:"to look 'normal' you need a .ico file with all the sizes. The Windows standards recommend including: 48x48 32bpp, 32x32 32bpp, 16x16 32bpp, 48x48 8bpp, 32x32 8bpp, 16x16 8bpp, (plus same sizes at 4bpp and monochrome). Nowadays, typically only 32bpp and possibly monochrome are relevant because few users use 4- or 8-bit depth color settings.Windows sometimes reduces the size to 16x16 automatically, but I think you have to give winico a 32x32. The stylized 'Tk' that appears in the upper left is at 16x16. You are also limited to 16 colors, if memory serves."
MG 2007-10-07: Just plugged winico 0.6 into an app (I'd used winico 0.3 before with past apps, I think) and went to test it, and found what seemed to be a bug: whenever I clicked the icon in the system tray when I had a -callback set, the main window (.) was raised and given focus, even though I hadn't told it to be. Had a look in the source to see if I could see the cause for it, and it seems it's deliberate, to work around a Windows bug that occurs when you post a menu from the system tray icon without giving the main window focus first (the menu doesn't disappear if you click another app without first clicking the menu).Anyone know if it's still totally necessary to do that? I'm using Win XP SP2, and don't see the problem with some other apps (like the latest Windows Live Messenger), so I'm wondering if there's a newer/better/different solution to the problem out there somewhere.
JMN 2007-12-07:Using winico 0.6, I can't seem to get 'winico taskbar add ..' to behave properly on Vista x64. It adds the icon to the systemtray ok at first, but then it just starts displaying one of the other icons in the panel.Also 'winico setwindow' only seems to affect the window when maximized. The minimized window on the taskbar shows the default red Tk icon. The same code worked ok on win2k.2008-03-06: Using png files, Tk 8.5+ and Img - the desired effect for the window and taskbar can be acheived without winico. This displays correctly both minimized & maximized (tested on vista x64)
package require Img image create photo mylabel -file ./ico16.png wm iconphoto . pcm- Using Winico for the systemtray; it seems it might be important to make sure
you're using a 32x32 version.e.g if your .ico file contains both a 16x16 & 32x32, you may need to set the -pos argument to 1
SES_home 2010-05-30 11:23:20:Thanks to package winico and a smart wrapper around it and on top of this a nice & simple GUI to customize the menu, will lead you to more consistent and fast results. To see what I mean, please have a look at : tG2 v1.05.02
Misc editHaO 2010-12-21: If an icon file has multiple sizes and color depth, one could search for 16x16 and a colordepth bigger or equal to the current colordepth:
package require Winico set hTaskbarIcon [winico createfrom $iconFile] # > Search for 16x16 and maximum or current colordepth set indexCur 0 set bppMax 0 foreach dPars [winico info $hTaskbarIcon] { if { [dict get $dPars -geometry] eq "16x16" } { set bppCur [dict get $dPars -bpp] if {$bppCur == [winfo depth .]} { set indexCur [dict get $dPars -pos] break } if {$bppCur > $bppMax} { set indexCur [dict get $dPars -pos] set bppMax $bppCur } } } winico taskbar add $hTaskbarIcon -pos $indexCur -text [wm title .]\ -callback [list [namespace code WinicoCallback] %m %x %y]For starpacks, it is possible to load the starpack icon resource (called TK). For me, this did only load the size 32x32 in 4 bit resolution. This was scaled to 16x16 32bit and looked not so nice.
set hTaskbarIcon [winico load TK [info nameofexecutable]]If the auto-icon-customization with a tclkit.ico file is used, it is also present in the starpack (why ?). So it might be loaded and you get all sizes and resolutions.
set hTaskbarIcon [winico createfrom [file join $starkit::topdir tclkit.ico]] | http://wiki.tcl.tk/4089 | CC-MAIN-2016-50 | refinedweb | 812 | 72.46 |
JavaFX ToolTip - A rough idea
By vaibhavc on Dec 23, 2008
I tried to write a very rough Tool Tip feature. Actually in JavaFX, we can write our own cool Tool tip. But in the meantime, we need to take care of boundary conditions of Tool tip. Here how it looks :
A shadow effect.
Right now its just a bad code, we will make it good in next post :D. Here it is :
package tooltip; import javafx.scene.CustomNode; import javafx.scene.effect.DropShadow; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.shape.ShapeIntersect; import javafx.scene.text.Font; import javafx.scene.text.Text; public class ToolTip extends CustomNode { public var x: Number; public var y: Number; //useless - content should decide public var width: Number = 100; public var height: Number = 50; //useless-Tooltip instance should be //added dynamically public var op: Number = 0.0; public var content: String; public override function create(): Node { return Group { content: [ ShapeIntersect { effect: DropShadow { offsetY: -5 offsetX: -5 color: Color.color(0.4, 0.4, 0.4) }; translateX: bind x translateY: bind y opacity: bind op stroke: Color.GRAY strokeWidth: 2 fill: Color.GREEN a: [ Rectangle { arcHeight:10 arcWidth:10 x: 0 y: 0 width: bind width height: bind height } Rectangle { rotate: 45 x: 40 y: 40 width: bind width / 5 height: bind 2 \* height / 5 } ] }, Text { font: Font { size: 14 } translateX: bind x translateY: bind y opacity: bind op x: 10, y: 12 content: bind content } ] }; } }
Main Code for this example :
package tooltip; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; import tooltip.ToolTip; import javafx.scene.shape.Rectangle; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.input.MouseEvent; var tt = new ToolTip; var rect = Rectangle { x: 10, y: 10 width: 180, height: 70 stroke: Color.WHITE strokeWidth: 4 fill: Color.YELLOWGREEN opacity: 0.8 }; var text = Text { font: Font { size: 14 name: "Arial" } x: 14, y: 30 content: "HelloWorld - Beginning of a \\nnew technology always say\\n - Hello World " }; var gp = Group { translateX: 60 translateY: 260 onMouseMoved: function( e: MouseEvent ):Void { tt.x = rect.x + tt.width; tt.y = rect.y - tt.height - 20; tt.op = 0.8; tt.content = "You can see \\n the help of \\nHelloWorld !"; } onMouseExited: function( e: MouseEvent ):Void { tt.op = 0.0; } content: [ rect, text,tt ] } Stage { title: "Tool-Tip" width: 450 height: 480 scene: Scene { fill:Color.BLACK content:[ gp ] } }⁞
If you are writing a generic tool tip take care of :
1. Scene size - it should not go off screen.
2. Height and Width of tool tip - Most of the tool tip has unit height but it depends on us, we can set it.
Hi Vaibhav,
Above code is not working in javafx 1.2
What change I need to do for that?
Really very nice tooltip It is works fine in older version of javafx
Please advice
Posted by Madhav Vyas on June 12, 2009 at 10:19 AM IST #
Hi Vaibhav,
Really very nice tooltip It is works fine in older version of javafx.
But one thing I want to mention that is
code is not working in javafx 1.2
What change I need to do for that?
Please advice
Posted by Madhav Vyas on June 12, 2009 at 10:20 AM IST #
Hmm a bug ! Let me raise this bug. Give me a day or two I will try to write something.
Posted by guest on June 12, 2009 at 06:36 PM IST #
@madhav
i guess you need to add
b: [clienarearectangle] in ShapeIntersect
its look like shapeintersect work as XOR between a & b attributes
Posted by hakim on June 21, 2009 at 03:19 AM IST #
Posted by Tag Heuer watches on December 20, 2009 at 02:22 PM IST # | https://blogs.oracle.com/vaibhav/entry/javafx_tooltip_a_rough_idea | CC-MAIN-2014-15 | refinedweb | 646 | 76.22 |
instances can't ping outside
Hey all,
I'm aware that this question was asked many times but...bear with me please. My network configuration looks like this: .
192.168.0.0/24 is my LAN network (my PC is connected to it) 10.0.0.0/24 is a subnet I created using Openstack dashboard.
Router1 has interface on 10.0.0.0/24 network active, while gateway interface is DOWN. Every service is up and running with no errors in logs.
My deployment consists of 3 servers following the official centos 7 install guide for juno: (...)
This is OVS-VSCTL output
ovs-vsctl show 158b1140-29eb-436e-9218-f31160be1c65 Bridge br-int fail_mode: secure Port br-int Interface br-int type: internal Port "qr-4856ff41-2d" tag: 3 Interface "qr-4856ff41-2d" type: internal Port "tap69ce898f-47" tag: 4095 Interface "tap69ce898f-47" type: internal Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} Port "qr-a3efb45d-b0" tag: 1 Interface "qr-a3efb45d-b0" type: internal Port "tap6344f8e2-f7" tag: 3 Interface "tap6344f8e2-f7" type: internal Port int-br-ex Interface int-br-ex type: patch options: {peer=phy-br-ex} Bridge br-ex Port phy-br-ex Interface phy-br-ex type: patch options: {peer=int-br-ex} Port "qg-bb37d248-47" Interface "qg-bb37d248-47" type: internal Port "eth2" Interface "eth2" Port br-ex Interface br-ex type: internal Port "qg-0eec4ee3-cf" Interface "qg-0eec4ee3-cf" type: internal Bridge br-tun Port br-tun Interface br-tun type: internal Port "gre-0a00011f" Interface "gre-0a00011f" type: gre options: {df_default="true", in_key=flow, local_ip="10.0.1.21", out_key=flow, remote_ip="10.0.1.31"} Port patch-int Interface patch-int type: patch options: {peer=patch-tun} ovs_version: "2.1.3"
ip route output
ip route default via 192.168.0.1 dev eth0 10.0.1.0/24 dev eth1 proto kernel scope link src 10.0.1.21 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.215 192.168.0.0/24 dev br-ex proto kernel scope link src 192.168.0.217
ifcfg-br-ex interface
DEVICE=br-ex DEVICETYPE=ovs TYPE=OVSBridge BOOTPROTO=static IPADDR=192.168.0.217 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 DNS1=192.168.0.200 ONBOOT=yes
ifcfg-eth2 interface
DEVICE=eth2 HWADDR="00:15:5D:00:66:d3" TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=br-ex ONBOOT=yes NAME=System eth2
Instances can ping each other but are unable to ping 192.168.0.1 which is the default gateway for ext-net. If you need any more info, please ask, I'll be happy to provide it.
Check that your router namespace has both network connections created, On your controller, use: $ ip netns To see all of the namespaces $ ip netns exec <qrotuer-uuid> ip a This will list the network interfaces in that particular namespace, you should see and interface on each network.
are you using nova-network or neutron? | https://ask.openstack.org/en/question/62631/instances-cant-ping-outside/ | CC-MAIN-2021-04 | refinedweb | 509 | 55.95 |
This is the fifth version of my .NET MIDI toolkit. I had thought that the previous version was the final one, but I have made many changes that have warranted a new version. This version takes a more traditional C#/.NET approach to flow-based programming, which I'll describe below. I wasn't comfortable with version four's implementation along these lines, so I took a step back and made changes that keep the flow-based approach while remaining within C#/.NET accepted idioms. I'm hoping that this will make the toolkit easier to use and understand.
The toolkit has seen many revisions over the past two to three years. Each revision has been an almost total rewrite of the previous one. When writing software, it is usually a bad idea to make updates that break software using previous versions. However, my goal in creating this toolkit has been to provide the best design possible. As I have grown as a programmer, I have improved my skills and understanding of software design. This has led me to revise the earlier designs of the toolkit without regard to how these revisions will break code. Not exactly the attitude one wants to adopt in a professional setting, but since the toolkit is free and since I have used it as a learning experience to improve my craft, my priorities are different.
top
Before I get into the specifics of the toolkit, I would like to talk about its architecture. With each version of the toolkit, I have struggled with how to structure the flow of messages through the system. I wanted an approach that would be versatile and allow customization. It would be nice, I thought, if users could plug their own classes into the flow of MIDI messages to do whatever they want. For example, say you wanted to write a harmonizer, a class capable of transposing notes in a specified key to create harmony parts automatically. It should be easy to simply plug the harmonizer into the toolkit without affecting other classes. In other words, the toolkit should be customizable and configurable.
Investigating this problem led me to J. Paul Morrison's excellent website on flow-based programming. He has written a book on the subject, which can be found on his website as well as at Amazon.
The idea is simple and will probably seem familiar to most: Data flows through a network of components. Each component can do something interesting with the data before passing it along to the next component. In design pattern terms, this approach is most like the Pipe and Filter pattern and is also similar to the Chain of Responsibility pattern. Please check out J. Paul Morrison's excellent book for more information.
(Just to be clear: when I say "component," I'm not necessarily talking about classes that implement the IComponent interface. I'm speaking in more general terms. A component is simply an object in a chain of objects designed to process the flow of messages.)
IComponent
Below is a very basic network of components designed to handle the flow of MIDI channel messages:
The flow of messages begins with the input device. An input device receives MIDI messages from an external source. Next, the messages flow through a user component. This component might want to do something like change the MIDI channel, transpose note messages, or change the messages in some way. Then the messages pass through the channel stopper. This component simply keeps track of all currently sounding notes. When the message flow stops, the channel stopper can turn off all sounding notes so that none of them hang. Finally, the messages reach the output device. Here they are sent to an external MIDI device.
Well, this is something I really struggled with. You can read a bit about the different ways I tried to achieve this by reading my blog. I found myself going round in circles on this. In version four of the toolkit, I settled on the idea of using a source/sink abstraction. I created an interface representing "Sources." A source represents a source of MIDI messages. "Sinks" were represented by delegates that could be connected to sources; a sink is simply a method capable of receiving a MIDI message. This worked well but it was a little confusing because the implementation looked a little "funny." That is to say, a C# programmer looking at the code for the first time might be confused as to what is going on.
I decided to do away with the sink/source infrastructure and use something more idiomatic. Sources of MIDI messages raise events when they have messages to send. Instead of implementing an interface and having Connect and Disconnect methods for hooking to sinks, they would simply have events. There are two advantages here: First, sources no longer have to implement an ISource interface, and second, .NET events are something very familiar to us. So sources of MIDI messages now look like your everyday class that just happens to have one or more events.
Connect
Disconnect
ISource
How about sinks, those objects that can receive MIDI messages? A sink can be anything. It's just an object that has a method that can receive a MIDI message. In version four, I had a Sink delegate for representing methods of objects capable of receiving MIDI messages. These delegates were used to connect with sources. This approach of using delegates to "connect" sources and sinks is still used in the toolkit but not as before. Instead, delegates are used as adaptors that connect to the events raised in sources and adapts the events so that objects that need to receive the messages can do so without any knowledge of the source.
Sink
Let's look at an example. Say that we're using an InputDevice to receive MIDI messages from a MIDI device, such as your soundcard. The InputDevice raises a ChannelMessageReceived event each time it receives a channel message. Suppose that we want to keep track of any note-on channel messages so that when we decide to stop receiving messages, we can turn off any currently sounding notes to keep them from "hanging." The ChannelStopper class is just for this purpose. However, the ChannelStopper has no knowledge of the InputDevice class. We need a way to hook them up so that messages generated by the InputDevice can be passed along to the ChannelStopper. Here is how we can do this with an anonymous method:
InputDevice
ChannelMessageReceived
ChannelStopper
InputDevice inDevice = new InputDevice(0);
ChannelStopper stopper = new ChannelStopper();
inDevice.ChannelMessageReceived += delegate(object sender, ChannelMessageEventArgs e)
{
stopper.Process(e.Message);
};
inDevice.StartRecording();
// ...
In this example, an anonymous method adapts events raised by the InputDevice so that they can be processed by a ChannelStopper. The InputDevice is the source of channel messages and the ChannelStopper is a sink capable of receiving and processing channel messages. The nice thing about this approach is that no explicit source/sink infrastructure is needed. Neither class knows anything about being a source or sink. The flow of messages is orchestrated by an external agent, in this case, an anonymous method.
There are several categories of MIDI messages: Channel, System Exclusive, Meta, etc. In designing a MIDI toolkit, the challenge is to decide how to represent these messages. One approach is to create two or three general MIDI classes and have specific types of MIDI messages represented through the properties of those classes. The Java MIDI API takes this route. Another approach is to create a large collection of finely grained classes to represent all of the different types of MIDI messages. For example, there are many types of Channel messages such as the Note-on, Note-off, Program change, and Pitch Bend messages. The fine grained approach would create a class for each of those message types. My approach was to take a middle ground. I created classes for the general categories of MIDI messages but left the specific types of messages as properties within those classes. This kept the class hierarchy lightweight and manageable while providing enough specialization to make working with MIDI messages easy.
Here is the hierarchy of MIDI message classes in the MIDI toolkit:
IMidiMessage
ShortMessage
ChannelMessage
SysCommonMessage
SysRealtimeMessage
SysExMessage
MetaMessage
Specific types of messages are represented through properties. For example, the ChannelMessage class has a Command property that can be set to represent the various types of Channel messages.
Command
All message classes are immutable. This makes sharing messages throughout an application safe. To create messages, you pass the desired property values to their constructor. Additionally, the toolkit provides a set of builder classes for making message creation more convenient.
The toolkit provides the following message builders:
ChannelMessageBuilder
SysCommonMessageBuilder
KeySignatureBuilder
MetaTextBuilder
SongPositionPointerBuilder
TempoChangeBuilder
TimeSignatureBuilder
The ChannelMessageBuilder and the SysCommonBuilder also use the Flyweight design pattern. When a new message is built, it is stored in a cache. When another message is needed that has the exact same properties as a message that has already been built, the previous message is retrieved rather than creating a new one. When you consider that a typical MIDI sequence is made up of thousands of messages, many of them identical, it is easy to see how the Flyweight pattern is applicable.
SysCommonBuilder
Here is an example of creating a ChannelMessage object representing a note-on message:
ChannelMessageBuilder builder = new ChannelMessageBuilder();
builder.Command = ChannelCommand.NoteOn;
builder.MidiChannel = 0;
builder.Data1 = 60;
builder.Data2 = 127;
builder.Build();
Console.WriteLine(builder.Result);
After the builder has been initialized with the desired properties, the MIDI message is built with a call to the Build method. The MIDI message can then be retrieved via the Result property.
Build
Result
There are several builder classes for creating specific types of meta messages. For example, to create a key signature meta message, you use the KeySignatureBuilder class:
KeySignatureBuilder builder = new KeySignatureBuilder();
builder.Key = Key.CMajor;
builder.Build();
Console.WriteLine(builder.Result);
Often there is a need to process a collection of IMidiMessages. How each message is processed depends on its type. The problem is that you cannot tell an IMidiMessage's type without an explicit check. The IMidiMessage provides a MessageType property just for this purpose. However, having to repeatedly check message types throughout your code can be cumbersome.
MessageType
The MessageDispatch class is designed to automate these checks. This class acts as a source for every type of MIDI message. It raises an event each time it dispatches a message. The type of event is determined by the type of message it is dispatching.
MessageDispatch
MIDI playback is driven by ticks that occur periodically. The source of these ticks are MIDI clocks. MIDI clocks come in all shapes and sizes. For example, playback can be driven by an internal or external clock. Also, the way in which the ticks are generated depends on whether the MIDI sequence has pulses per quarter note resolution or SMPTE resolution. For the vast majority of situations, an internal clock generating ticks with pulses per quarter note resolution is all you need.
The IClock interface represents the basic functionality for all MIDI clocks:
IClock
public interface IClock
{
event EventHandler Tick;
event EventHandler Started;
event EventHandler Continued;
event EventHandler Stopped;
bool IsRunning
{
get;
}
}
The Tick event occurs when a MIDI tick has elapsed. The Started, Continued, and Stopped events are self-explanatory. However, it should be pointed out that when the Started event occurs, sequence playback starts from the beginning of the sequence. When the Continued event occurs, playback starts from the current position. The IsRunning property indicates whether the clock is running.
Tick
Started
Continued
Stopped
Continued
IsRunning
You may notice that there are no methods in the interface for starting and stopping a clock. That is because with clocks that are driven by an external source, the source is responsible for starting and stopping the clock. The clocks receive messages via MIDI and based on those messages starts or stops generating ticks. Since all MIDI clocks implement IClock, it only represents the functionality common to all the clocks.
At this time, the toolkit provides only one clock class, the MidiInternalClock. This clock generates MIDI ticks internally using pulses per quarter note resolution. For the majority of situations, this clock will work fine.
MidiInternalClock
The MidiInternalClock has a Tempo property for setting the tempo in microseconds per beat. To set the tempo to 120 bpm, for example, you would set the Tempo property to 500000. It can receive meta tempo change messages. When a meta tempo change message is passed to it, it changes its tempo to match the tempo represented by the message.
Tempo
A MIDI file is made up of several tracks. Each track contains one or more timestamped MIDI messages. The timestamp represents the number of ticks since the last message was played. This timestamp is called delta ticks. The MidiEvent class represents a timestamped MIDI message. It has three public properties:
MidiEvent
public
DeltaTicks
AbsoluteTicks
MidiMessage
The DeltaTicks property represents the number of ticks since the last MidiEvent. In other words, this value represents how long to wait after playing the previous MidiEvent before playing the current MidiEvent. For example, if the DeltaTicks value is 10, we would allow 10 ticks to elapse before playing the MIDI message represented by the current MidiEvent.
MidiEvent
The AbsoluteTicks represents the overall position of the MidiEvent. This is the total number of ticks that have elapsed until the current MidiEvent.
The MidiMessage property is the IMidiMessage represented by the MidiEvent.
In addition there are two internal properties, one which points to the previous MidiEvent in the track, and one which points to the next MidiEvent in the track. In other words, the MidiEvent class acts as a node in a doubly linked list of MidiEvents.
The Track class represents a collection of MidiEvents. It is responsible for maintaining a collection of MidiEvents in proper order. MidiEvents are not directly added to a Track. Instead, you add an IMidiMessage, specifying its absolute position in the Track. The Track then creates a MidiEvent to represent the message and inserts it into its collection of MidiEvents.
Track
In addition to providing functionality for adding and removing MIDI events, the Track class also provides several iterators. There is a standard iterator that simply iterates over the MidiEvents one at a time. Another iterator takes a MessageDispatcher object and passes each IMidiMessage to the dispatcher which in turn raises an event specific to the type of message it is dispatching. The value the iterator returns is the absolute ticks for the current MidiEvent.
MessageDispatcher
Perhaps the most useful iterator is the one that when advanced moves forward only one tick at a time. The iterator keeps track of its tick position in the Track. When the tick count has reached a value in which it is time to play the next MidiEvent, it passes the IMidiMessage represented by the MidiEvent to the MessageDispatcher and returns the absolute tick count. This iterator also takes a ChannelChaser object as well as a start position value and "chases" up to the start position before switching to the playback mode. In essence, this iterator allows us to stream the Track in real-time.
ChannelChaser
The Sequence class represents a collection of Tracks. It also provides functionality for loading and saving MIDI files, so Sequences can load and save themselves.
Sequence
Every Sequence has a division value. This value represents the resolution of the Sequence and is represented by a property. There are two types of division values: Pulses per quarter note and SMPTE. The Sequence has a SequenceType property indicating the sequence type. Unfortunately, SMPTE sequences aren't supported at this time.
SequenceType
There are several MIDI device classes in the toolkit. Each device class is derived directly or indirectly from the abstract Device class in the Sanford.Multimedia namespace. The InputDevice class represents a MIDI device capable of receiving MIDI messages from an external source, such as a MIDI keyboard controller or synthesizer. The OutputDeviceBase class is an abstract class that serves as the base class for the output device classes. The OutputDevice class represents a MIDI device capable of sending MIDI messages to an external source or your soundcard. And the OutputStream class encapsulates the Windows Multimedia MIDI output stream API. It is capable of playing back timestamped MIDI messages.
Device
Sanford.Multimedia
OutputDeviceBase
abstract
OutputDevice
OutputStream
There can be more than one of these devices present on your computer. To determine the number of input devices present, for example, you would query the InputDevice's static DeviceCount property. The output device classes also have this property.
static
DeviceCount
Each MIDI device has its own unique ID. This is simply an integer value representing the device's order in the list of devices available. For example, the first output device on your system would have an ID of 0. The second output device would have an ID of 1, and so on. The same is true for the input devices. When you create a MIDI device, you pass it the ID of the device you wish to use to its constructor. If there was an error in opening the device, an exception is thrown.
To find out the capabilities of a device, you query the class' static GetDeviceCapabilities method, passing it the device ID of the device you are interested in. This method will return a structure filled with values representing the capabilities of the specified MIDI device.
GetDeviceCapabilities
Let's describe each device class in detail:
The InputDevice class represents a MIDI device capable of receiving MIDI messages. It has an event for each of the major MIDI message it can receive. To receive MIDI messages, you connect to one or more of these events. Then you call the StartRecording method. Recording will continue until either StopRecording or Reset is called. The InputDevice lets you set the size of the sysex buffer it uses to receive sysex messages. When the InputDevice has received a complete sysex message, it raises the SysExReceived event.
StartRecording
StopRecording
Reset
The OutputDeviceBase class is an abstract class that provides basic functionality for sending MIDI messages. It has several overloaded Send methods for sending various types of MIDI messages.
Send
The OutputDevice class represents a MIDI device capable of sending MIDI messages. It inherits most of its functionality from the OutputDeviceBase class. It also provides running status functionality.
The following code creates an OutputDevice, builds and sends a note-on message, sleeps for one second, and then builds and sends a note-off message:
using(OutputDevice outDevice = new OutputDevice(0))
{
ChannelMessageBuilder builder = new ChannelMessageBuilder();
builder.Command = ChannelCommand.NoteOn;
builder.MidiChannel = 0;
builder.Data1 = 60;
builder.Data2 = 127;
builder.Build();
outDevice.Send(builder.Result);
Thread.Sleep(1000);
builder.Command = ChannelCommand.NoteOff;
builder.Data2 = 0;
builder.Build();
outDevice.Send(builder.Result);
}
The OutputStream class is also derived from the OutputDeviceBase class. It encapsulates the Windows multimedia MIDI output stream API. It provides functionality for playing back MIDI messages.
To play MIDI messages, you call StartPlaying. The OutputStream will then begin playing back any MIDI messages in its queue. To place MIDI messages in the queue, you first write one or more MidiEvents using the Write method. After writing the desired number of MidiEvents, you call Flush. This flushes the events to the stream causing it to play them back.
StartPlaying
Write
Flush
The Sequencer class is back. It's a lightweight class for playing back Sequences. I felt the previous MidiFilePlayer class was not the best means for playing back MIDI sequences. I wanted to give the toolkit the ability to play Sequences your create programmatically. One issue that caused me to shy away from a Sequencer class (after having created one in earlier versions) is the problem of a Sequence changing as it's being played by a Sequencer. I still haven't solved that problem, but I didn't want that issue to prevent easy Sequence playback. So I'm putting in a new version of the Sequencer class with the understanding that it's meant to be used for simple playback. For something more sophisticated, you can use it as the basis for creating something more.
Sequencer
Sequence
MidiFilePlayer
The MIDI toolkit depends on the DelegateQueue class from my Sanford.Threading namespace; the InputDevice and OutputDevice classes use it for queueing MIDI events. In turn, the Sanford.Threading namespace depends on my Sanford.Collection namespace, so that assembly is also necessary for the toolkit to compile. Finally, the toolkit uses the Sanford.Multimedia namespace. I've provided all of the assemblies with the download. I've linked the projects that use them to the assemblies in hopes that the toolkit will compile out of the box. Hopefully, the days of having trouble compiling my projects because of not having the right assemblies are over.
DelegateQueue
Sanford.Threading
Sanford.Collection
This article has provided an overview of my .NET MIDI toolkit. My hope is that it will be a useful and powerful tool for writing MIDI applications. It has been a lot of fun to write. Each version has represented the very best of my skill and knowledge as a programmer. I welcome feedback and any bug reports you may have. Take care and thanks for your time.
Multimedia
This article, along with any associated source code and files, is licensed under The MIT License. | http://www.codeproject.com/Articles/6228/C-MIDI-Toolkit?fid=34097&df=90&mpp=50&sort=Position&spc=Relaxed&select=3929992&tid=3831223 | CC-MAIN-2014-52 | refinedweb | 3,570 | 56.76 |
I need to “touch” a file from my ruby script. (This is a unix-based
command that updates the timestamp on a file, creating it, if it
doesn’t already exist.) I’m running on Windows. A collegue found a port
of “touch” and installed it and called it using “system”, but i would
rather see a solution that requires less installation.
I am currently using the following code:
class File
def self.touch(filename)
File.open(filename, ‘a’){|f| f.puts ’ '}
end
end
This implementation is good enough for my present needs (touching an
xml file), but it has obvious side effects that could be a problem in
other contexts.
I did find a touch command in Ruby in the ptools package at but it did not work.
(It zeroed the file it touched!)
Any suggestions for a better “touch” in Ruby?
Bret | https://www.ruby-forum.com/t/touch/75995 | CC-MAIN-2021-39 | refinedweb | 144 | 74.69 |
reading dynamic sql columns in coldfusionfunandlearning333 Jun 8, 2010 11:23 AM
I have a query which has static as well as dynamic columns. something like below:
<cfset vMarks = "marks1, marks2, marks3">
<cfquery name="querymarks" datasource = "abc">
SELECT firstname, lastname,
<cfloop from="1" to="listlen(vMarks)" index="index">
marks_#index# <cfif #index# NEQ listlen(vMarks)>,</cfif>
</cfloop>
</cfquery>
The query result set will look like below:
firstname lastname marks1 marks2 marks3 ...
abc abc 112 113 114
def def 121 122 123
So when I am using coldfusion to display the above resultset I am doing the below:
<table>
<tr>
<td>FIRST NAME</td>
<td>FIRST NAME</td>
<td>FIRST NAME</td>
</tr>
<cfoutput query="querymarks">
<tr>
<td>querymarks.firstname</td>
<td>querymarks.lastname</td>
<cfloop from="1" to="listlen(vMarks)" index="index">
<td>querymarks.marks_#index#</td>
</cfloop>
</tr>
</cfoutput>
</table>
The number of marks column is dynamic but I have a variable which stores the list of marks. I am facing problem in displaying the marks with coldfusion. Can anyone let me know if this can be done?
1. Re: reading dynamic sql columns in coldfusionAdam Cameron. Jun 8, 2010 11:33 AM (in response to funandlearning333)
It's not immediately apparent in the docs, but one can use associative array notation with queries, eg:
myQuery[myColumn][myRow]
Where myQuery is the name of a query variable, myColumn is a column name or a string containing a column name, and myRow is the row number (positive integer) you want.
You can also get query metadata with getMetatdata(myQuery), which lists the columns in the order they were queried for (unlike myQuery.columnList which alphabeticised it, for some stupid reason best known to some Allaire developer of yore).
--
Adam
2. Re: reading dynamic sql columns in coldfusionfunandlearning333 Jun 8, 2010 11:51 AM (in response to Adam Cameron.)
Using either #querymarks[marks_index]# or querymarks[marks_#index#] is not helping
3. Re: reading dynamic sql columns in coldfusionilssac Jun 8, 2010 12:03 PM (in response to funandlearning333)
If you use array notation, you have to fully name the variable, including the row.
The short cuts provided by the <cfoutput...>and <cfloop...> query loops allow you to not do this. But when you go it on your own, the fully qualified referernce is query["column"][row].
I think you are looking for something like this.
#querymarks["marks_" & index][1]#
Where 1 would show you the value for the first row.
4. Re: reading dynamic sql columns in coldfusionReed Powell Jun 8, 2010 12:06 PM (in response to funandlearning333)
something like this:
<cfloop from="1" to="listlen(vMarks)" index="index">
<td>#querymarks[index][querymarks.currentRow]#</td>
</cfloop>
5. Re: reading dynamic sql columns in coldfusionAdam Cameron. Jun 8, 2010 12:07 PM (in response to funandlearning333)
funandlearning333 wrote:
Using either #querymarks[marks_index]# or querymarks[marks_#index#] is not helping
Well no. Note what I suggested the syntax was: myQuery[myColumn][myRow]. No part of that is optional, for your requirement.
--
Adam
6. Re: reading dynamic sql columns in coldfusionDan Bracuk Jun 8, 2010 3:50 PM (in response to funandlearning333)
You are actually very close. Since part of your column name is a variable, you do it like this:
queryname["static part" & variable part][row number]
But Adam's method is better. | https://forums.adobe.com/thread/655651 | CC-MAIN-2018-39 | refinedweb | 551 | 53.21 |
Producer/Consumer model in Kivy
(update: original title was “Publisher/Consumer model with Kivy”, but the literature usually refer to this as “Producer/Consumer”)
Few things are worse to an user than an unresponsive UI, well i can think of a crashing UI, of course, but not much more. So, in an event driven environment, it’s important to avoid blocking the UI for too long.
But sometime you have a task that will take an unacceptable time for such constraint, if the task can’t really be chunked, a Thread is likely to be the acceptable solution, but threads have constraints and in Kivy, you can’t update the UI from one, you have to schedule something to happen on the main thread, and update things from here. If the task is chunkable, it’s even easier, but the following idea can apply to both situation.
So, a solution that i find convenient, is to use a producer/consumer model.
The idea is simple, have a scheduled action each frame do a small part of your
task, until a timeout is triggered, and then wait for next frame to continue.
To trigger work, just put (produce) it in a list of tasks to be treated py the consumer.
So let’s start by setting a consumer for adding elements to a list, we don’t want to add 100 elements in the same frame, because that would take too much time.
from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ListProperty from kivy.uix.label import Label kv = ''' BoxLayout: ScrollView: GridLayout: cols: 1 id: target size_hint: 1, None height: self.minimum_height Button: text: 'add 100' on_press: app.consumables.extend(range(100)) ''' class ProdConApp(App): consumables = ListProperty([]) def build(self): Clock.schedule_interval(self.consume, 0) return Builder.load_string(kv)' def consume(self, *args): if self.consumables: item = self.consumables.pop(0) label = Label(text='%s' % item) self.root.ids.target.add_widget(label) if __name__ == '__main__': ProdConApp().run()
Now, i’m only taking one item each frame, it’s probably good enough, but if we have a lot of item, we still may want to take as much is possible, considering kivy loop is frame-limited to 60fps, 100 items will take more than a second, why wait if we have the power? Let’s use a slightly smarter version.
add this import near of the top
from kivy.clock import _default_time as time
then change
consume definition to be:
def consume(self, *args): limit = Clock.get_time() + 1 / 60. while self.consumables and time() < limit: item = self.consumables.pop(0) label = Label(text='%s' % item) self.root.ids.target.add_widget(label)
Of course, this only work because we know creating and adding one widget takes considerably less time than one frame, so it’s not like one of such operation will make our loop hang too long.
Now, filling the consumable list here is done from main UI, but it could totally be done from a Thread, assuming locking is correctly handled (or that extend/pop are atomic, which seems to be the case), so if your filling of work to be displayed is slow, doing the exact same thing as a background task will allow you to do heavy lifting, while keeping your app snappy.
A slightly more demonstrative version of this example can be found here | http://blog.tshirtman.fr/tags/thread | CC-MAIN-2016-07 | refinedweb | 567 | 62.78 |
>>.
Firstly, to mention why there was such a delay between initial release and this update.
Making easy to use Construct 2 plugins can be a bit of a trouble sometimes.
While the fact that you define UI and runtime parts of plugin separately is generally good, it also means that the process takes more time on average, since you need to define everything twice and also ensure that you did not make any mistakes and everything works as intended on both sides.
Another trouble is interface. For a plugin like GameJolt API you send data to site, and wait for response. Response is normally handled either synchronously (meaning that game freezes while it's waiting for a response) or via a callback function (that is called as soon as response arrives).
In Construct 2, however, you (by default) only have events, which are kind of like callbacks, but are global, and don't support arguments.
So... what I ended up doing after a while, is having global variables that allow you to determine, what the event applies to, dispatching the event, and having good faith in you not trying to access the variables outside of their respective events.
Anyway,
Additions
Highscores
You can now fetch contents of any given highscore table.
Mechanism is as following:
- You request highscores to be fetched via Scores - Get Scores (or Get Local Scores to get highscore table entries just for the current player).
- Extension forms and sends the request, and waits for response to arrive.
- Extension dispatches a Score - Scores received event. At this time you have ScoreTable to know which table the scores are coming from, and ScoreCount determining number of returned scores (in case you need to prepare for handling them).
- Extension dispatches series of Score - Score entry events, one per every score entry. These contain the multitude of variables starting with Score and correspond to individual score entry information. ScorePlace contains index/place of score entry in table, starting with 1 and ending at ScoreCount (inclusive). ScoreTable remains set and still can be used to distinguish score tables
- Extension dispatches a Score - Scores complete event to mark the fact of all score entries being processed.
Score submitted event has also been updated and now sets some of Score* variables, but only ones that have been provided in action itself (because GameJolt does not respond with information like place achieved).
Trophies
You can now also fetch trophy status(es) for your game.
The mechanism is very alike to that of scores, except for lack of "received"/"complete" events.
An important thing to note here is that you can provide trophy IDs as a comma-separated list, e.g. "5980,5981,5982".
"Trophy achieved" callback only gets to know TrophyID, and TrophyAchieved, which is set to "just now" if trophy achievement was confirmed, and an empty string if it failed.
Data Store
Finally, there are now functions and events to work with Data Store. Data Store is awesome.
Possibilities are almost endless, and are primarily only limited by your imagination & creativity.
Each Data Store action dispatches an according event of it's own, containing StoreKey (and StoreLocal) to allow telling requests apart, and StoreValue containing new or retrieved value.
It is also worth mentioning, that "update" events also return (updated) values, meaning that you don't have to spend an extra request to retrieve the new value.
You can get the updated extension and example from game's page, or via these links of fair convenience:
As usual, you can ask any questions, if needed.
And if you like what I'm doing, consider supporting me on Patreon :)
Hello there! I have a problem with downloading the extension. When I try to download the file, it says:
—–
“A problem”
“The requested resource does not exist.
If you came here from the blog, please leave
a comment and I’ll see about fixing the link.”
—–
If possible can you please fix this? Thanks.
Might be better to download it from GameJolt for now
Hi! Thanks for the plugin. But is there a manual how to add it? Whats the “Auth” action, what are Sessions? Do I need to “log in” with “On Start of Layout” or how does it work? The example has a “On Login” action, so does it login automatically?
The example capx did not work for me. I did not see scores or trophies.
Automatic login will only work if the game is uploaded to GameJolt or if you add your login credentials into the URL when testing locally.
There’s someone’s tutorial about it:
All functionality is as per official documentation:
I cannot promise an official tutorial/manual at this point.
But how do you make to upload a varibel.
Mady can you make a Ghost Shooter Demo?
By doing “Add score of VariableName VariableName to table 0″ after having added a highscore table to the game. See example or the first picture in the original post. If something does not work, try uploading your game to GameJolt first (and testing on page). | https://yal.cc/gamejolt-api-plugin-for-construct-2-update-aug14/ | CC-MAIN-2019-13 | refinedweb | 844 | 62.48 |
How to Make HTTP Requests
About HttpClient
Angular has the amazing HttpClient for communication with backend services. It is a layer on top and a simplified representation of XMLHttpRequest Web API. It also is the recommended agent by Angular for any HTTP request. There is nothing wrong with using the
HttpClient in your ABP project.
However,
HttpClient leaves error handling to the caller (method). In other words, HTTP errors are handled manually and by hooking into the observer of the
Observable returned.
getConfig() { this.http.get(this.configUrl).subscribe( config => this.updateConfig(config), error => { // Handle error here }, ); }
Although clear and flexible, handling errors this way is repetitive work, even when error processing is delegated to the store or any other injectable.
An
HttpInterceptor is able to catch
HttpErrorResponse and can be used for a centralized error handling. Nevertheless, cases where default error handler, therefore the interceptor, must be disabled require additional work and comprehension of Angular internals. Check this issue for details.
RestService
ABP core module has a utility service for HTTP requests:
RestService. Unless explicitly configured otherwise, it catches HTTP errors and dispatches a
RestOccurError action. This action is then captured by the
ErrorHandler introduced by the
ThemeSharedModule. Since you should already import this module in your app, when the
RestService is used, all HTTP errors get automatically handled by deafult.
Getting Started with RestService
In order to use the
RestService, you must inject it in your class as a dependency.
import { RestService } from '@abp/ng.core'; @Injectable({ /* class metadata here */ }) class DemoService { constructor(private rest: RestService) {} }
You do not have to provide the
RestService at module or component/directive level, because it is already provided in root.
How to Make a Request with RestService
You can use the
request method of the
RestService is for HTTP requests. Here is an example:
getFoo(id: number) { const request: Rest.Request<null> = { method: 'GET', url: '/api/some/path/to/foo/' + id, }; return this.rest.request<null, FooResponse>(request); }
The
request method always returns an
Observable<T>. Therefore you can do the following wherever you use
getFoo method:
doSomethingWithFoo(id: number) { this.demoService.getFoo(id).subscribe( foo => { // Do something with foo. } ) }
You do not have to worry about unsubscription. The
RestService uses
HttpClient behind the scenes, so every observable it returns is a finite observable, i.e. it closes subscriptions automatically upon success or error.
As you see,
request method gets a request options object with
Rest.Request<T> type. This generic type expects the interface of the request body. You may pass
null when there is no body, like in a
GET or a
DELETE request. Here is an example where there is one:
postFoo(body: Foo) { const request: Rest.Request<Foo> = { method: 'POST', url: '/api/some/path/to/foo', body }; return this.rest.request<Foo, FooResponse>(request); }
You may check here for complete
Rest.Request<T> type, which has only a few chages compared to HttpRequest class in Angular.
How to Disable Default Error Handler of RestService
The
request method, used with defaults, always handles errors. Let's see how you can change that behavior and handle errors yourself:
deleteFoo(id: number) { const request: Rest.Request<null> = { method: 'DELETE', url: '/api/some/path/to/foo/' + id, }; return this.rest.request<null, void>(request, { skipHandleError: true }); }
skipHandleError config option, when set to
true, disables the error handler and the returned observable starts throwing an error that you can catch in your subscription.
removeFooFromList(id: number) { this.demoService.deleteFoo(id).subscribe( foo => { // Do something with foo. }, error => { // Do something with error. } ) }
How to Get a Specific API Endpoint From Application Config
Another nice config option that
request method receives is
apiName (available as of v2.4), which can be used to get a specific module endpoint from application configuration.
putFoo(body: Foo, id: string) { const request: Rest.Request<Foo> = { method: 'PUT', url: '/' + id, body }; return this.rest.request<Foo, void>(request, {apiName: 'foo'}); }
putFoo above will request{id} as long as the environment variables are as follows:
// environment.ts export const environment = { apis: { default: { url: '', }, foo: { url: '', }, }, /* rest of the environment variables here */ }
How to Observe Response Object or HTTP Events Instead of Body
RestService assumes you are generally interested in the body of a response and, by default, sets
observe property as
'body'. However, there may be times you are rather interested in something else, such as a custom proprietary header. For that, the
request method receives
observe property in its config object.
getSomeCustomHeaderValue() { const request: Rest.Request<null> = { method: 'GET', url: '/api/some/path/that/sends/some-custom-header', }; return this.rest.request<null, HttpResponse<any>>( request, {observe: Rest.Observe.Response}, ).pipe( map(response => response.headers.get('Some-Custom-Header')) ); }
You may find
Rest.Observe enum here. | https://docs.abp.io/en/abp/2.9/UI/Angular/HTTP-Requests | CC-MAIN-2022-33 | refinedweb | 787 | 50.23 |
How do I install a GAP package in Sage?
I would like to install the package DiGraphs (...) into the GAP version that is part of Sage. I just installed the latest version of Sage, Sage 8.6, on a Mac. There is a page about doing this here:... but you will notice that at the top it says "Since GAP 4.10 release, in Sage 8.6 (Jan 2019), you should not use the following instructions!" Of course it offers no alternatives. The readme for the DiGraphs says that you should have the GAP packages IO and orb installed. I am not able to install the IO package, which I downloaded from here:... and then put in the folder where the other GAP packages are, namely Applications/SageMath/local/share/gap/pkg/
The readme file for the IO package says to change directories to the folder containing the IO package and then run "./configure", which I have done. Next it says to run "make", but this gives me the following error:
src/io.c:14:10: fatal error: 'src/compiled.h' file not found
#include "src/compiled.h" /* GAP headers */
Can anyone help me with this? I have had the DiGraphs package installed within GAP inside of Sage previously, but I recently got a new computer and had to reinstall everything, and it seems certain things have changed with the new version of Sage. | https://ask.sagemath.org/question/45902/how-do-i-install-a-gap-package-in-sage/?sort=votes | CC-MAIN-2020-50 | refinedweb | 234 | 76.72 |
MPLS Inter VRF route leaking
Hi,
is it possible to leake a route from one VRF to another VRF on the Same PE. without having a RR in picture.
Regards,
Rajiv Mahuli
Hi,
is it possible to leake a route from one VRF to another VRF on the Same PE. without having a RR in picture.
Regards,
Rajiv Mahuli
Dear rajivmahuli1982,
yes, but you must use the
import functionality of route-target and enable Border Gateway Protocol (BGP) on the router, This solution documented by Cisco in the below URL.
There is some changes in the below example as this is my self test for this document.
ip vrf VRF-A
rd 1:1
route-target export 1:1
route-target import 1:1
route-target import 2:1
!
ip vrf VRF-B
rd 2:1
route-target export 2:1
route-target import 2:1
route-target import 1:1
!
interface Serial1/0
ip vrf forwarding VRF-A
ip address 192.168.99.1 255.255.255.0
!
interface Serial1/1
ip vrf forwarding VRF-B
ip address 172.16.10.1 255.255.255.0
router bgp 1
!
address-family ipv4 vrf VRF-A
redistribute connected
!
address-family ipv4 vrf VRF-B
redistribute connected
Best Regards,
Mounir Mohamed
Hi Mounir,
thanks for the reply but what if there is no MPBGP peering at all if its a standalone router will this still work ??
Thanks i got the answer
thanks for the document. | https://supportforums.cisco.com/discussion/10337896/mpls-inter-vrf-route-leaking | CC-MAIN-2017-04 | refinedweb | 244 | 64.91 |
How to get started building with the new offering—Red Hat OpenShift on IBM Cloud.
Red Hat OpenShift on IBM Cloud enables enterprises to take on cloud-native development while also easing the pain of security and scale across the whole lifecycle of the software, allowing them to get started on their hybrid cloud journey.
Check out this tutorial video, where I walk you through the new OpenShift integrated experience on the IBM Cloud web console and show you how to create an OpenShift cluster and access all the new features.
Learn more
- IBM and Red Hat
- Red Hat OpenShift on IBM Cloud
- VIDEO – IBM + Red Hat
- VIDEO – What is OpenShift?
- VIDEO – Kubernetes and OpenShift: What's the Difference?
- VIDEO – Intro?
- Full playlist of lightboarding videos
Video Transcript
Guided Tour for Red Hat OpenShift on IBM Cloud
Hi everyone, my name is Sai Vennam with the IBM Cloud team.
Today, let's talk about Red Hat OpenShift on IBM Cloud.
What is OpenShift?
First, OpenShift. It's an open source application platform that aims to make the Kubernetes experience better for developers and operations team.
What is Red Hat OpenShift on IBM Cloud?
Red Hat OpenShift on IBM Cloud is a fully managed platform from the ground up. This has a number of advantages which we'll cover in this video.
It starts with an integrated OpenShift experience. You get automated provisioning of the infrastructure, as well as configuring OpenShift. You can take advantage of features for high availability to ensure your applications will never have any downtime. And finally, for all of your monitoring and logging needs, take advantage of direct integrations with Sysdig and LogDNA.
Creating an OpenShift cluster
Let's get started by walking through the process of creating an OpenShift cluster.
We'll navigate through the dashboard and choose an OpenShift cluster.
We see some information about this service, and we'll go ahead and hit Create. Now, we're asked to provide some information to start creating this cluster.
We see an option to choose between Kubernetes or OpenShift, so we can go with native Kubernetes but, in this example, we'll be working with managed OpenShift on IBM Cloud.
So, by choosing OpenShift, we can then scroll down and choose a number of different geographies.
We have multizone regions worldwide, which enables you to have highly available clusters spread across multiple data centers in the same region.
Next, we have choices for the default worker pool. We can take advantage of either shared or dedicated virtual compute. In addition, there's options for bare metal and GPU-enabled machines as well.
Finally, we'll choose the number of workers that we want, and we'll go ahead and provision that cluster.
The cluster will be ready shortly, but in the meantime, let's go ahead and jump to a cluster that's already started.
Overview of a cluster through the IBM Cloud console
Let's see the IBM Cloud console experience. We can see a basic overview of our cluster.
We can set up something like Key Protect, an encryption key management service to encrypt your applications and data. And this even supports bringing your own key.
Switching to the other tabs, you can fully configure the workers your cluster is using. This includes updating your worker nodes as well as configuring additional worker pools.
OpenShift web console
Let's get to the good stuff—the OpenShift web console. Here we have the OpenShift Container Platform web console.
Creating a project
We can first start by creating a project. A project is an OpenShift abstraction based on namespaces, but it has user management built-in. This means you get the best practices for security from the start.
With the project, we can start by navigating the catalog or importing an existing project.
Let's start by browsing the catalog and choosing a Node.js application which comes with a Mongo database attached.
We'll go ahead and choose the default configuration options and hit Create.
Within minutes, it starts to provision our application, the database, the access, and even sets up some routes for us.
Looking at an existing project with an application running
This build is going to take a couple of minutes. So let's go ahead and switch to a project where I’ve already got this application running.
Well, we have a deployment, but the first thing I want to do is actually enable access to it. We'll go into the routes view and create a new route.
We’ll go ahead and make sure this is connected up to the right service and hit Create.
Let's test that it works. We'll go into our routes and hit that host name, and there we go, we can access our Node.js application running in OpenShift.
Tackling Day 2 operations task with the OpenShift CLI
The OpenShift web console makes it easy for Day 1 tasks, like building and configuring applications. For Day 2 operations tasks, we will want to take advantage of the OpenShift CLI.
Let's take a look at the CLI experience with the OC commands.
After installing the CLI, we'll grab the login command from the OpenShift web console. We will then open up the terminal and paste in that same login command.
In a few seconds, it will lock us into the cluster and we can get started by first running the OC project and then putting in the name of the project that we just created.
We can run some environment health checks here and verify our running pods in containers. Let's start by running the
oc get nodes command. This will allow us to see the different worker nodes and the hosts that are running within our cluster.
Now let's see the pods that are running in our application. We can run the
oc get pods –o wide parameter. This is going to allow us to see our running pods as well as the node that they're running in.
Taking advantage of integrations with Sysdig and LogDNA
You can take advantage of integrations with Sysdig and LogDNA. By accessing the observability dashboard on IBM Cloud, you get access to all of this in a single location.
Here you can access your logs with LogDNA and gain rich container visibility using Sysdig.
Red Hat OpenShift is dedicated to making the Kubernetes experience easier
From its onset, Red Hat OpenShift has been focused on making the Kubernetes experience easier and enabling enterprises to take on a cloud-native development.
IBM Cloud builds on open source for advanced capabilities to ease the pain of security in scale, not just on Day 1 building but also Day 2 operations and across the lifecycle of software.
IBM and Red Hat are building an open hybrid cloud foundation
Together, IBM and Red Hat are building an open hybrid cloud foundation, built on open source technologies and principles, to allow you to get started on your hybrid cloud strategy—the right way.
Follow IBM Cloud
Be the first to hear about news, product updates, and innovation from IBM Cloud.Email subscribeRSS | https://www.ibm.com/cloud/blog/new-builders/guided-tour-to-red-hat-openshift-on-ibm-cloud | CC-MAIN-2019-47 | refinedweb | 1,197 | 63.39 |
IMPORTANT: No additional bug fixes or documentation updates will be released for this version. For the latest information, see the current release documentation.
Elasticsearch provides a full Java query dsl in a similar manner to the
REST Query DSL. The factory for query
builders is
QueryBuilders. Once your query is ready, you can use the
Search API.
To use
QueryBuilders just import them in your class:
import static org.elasticsearch.index.query.QueryBuilders.*;
Note that you can easily print (aka debug) JSON generated queries using
toString() method on
QueryBuilder object.
The
QueryBuilder can then be used with any API that accepts a query,
such as
count and
search. | https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/java-query-dsl.html | CC-MAIN-2020-16 | refinedweb | 108 | 66.74 |
Opened 8 years ago
Closed 8 years ago
#3662 closed (duplicate)
OneToOne edit_inline - can not add new object in Django admin
Description
Consider following code snipped (I tried to make it very simple just to explain this bug):
from django.db import models from django.contrib.sites.models import Site # Create your models here. class Article(models.Model): title = models.CharField(maxlength=50) description = models.TextField() class Admin: pass class CustomArticle(models.Model): fti_contents_list = models.TextField(null=True, blank=True) layout = models.CharField(maxlength=1,core=True) sites = models.ManyToManyField(Site,core=True) article = models.OneToOneField(Article,edit_inline=True)
Here I use OneToOne field to extend standard Article application with custom data I need to use with particular
customer.
The problem:
When I add new product in /admin it fails with error:
File "/usr/lib/python2.4/site-packages/django/db/models/related.py", line 71,
in get_list
if self.field.rel.min_num_in_admin:
AttributeError: 'OneToOneRel' object has no attribute 'min_num_in_admin'
The solution: see attached patch
Attachments (2)
Change History (9)
Changed 8 years ago by alex@…
Changed 8 years ago by alex@…
proposed patch
comment:1 Changed 8 years ago by Simon G. <dev@…>
- Keywords edit_inline added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to invalid
- Status changed from new to closed
Thanks for the patch, alex. We know that edit_inline has lots of problems (e.g.), but the new admin changes that will be coming after the 0.96 release should clear this up.
Because of this, I'm marking this as invalid for now, but I've placed it on the FeatureGrouping page, and we'll double check that it's no longer an issue once these changes have gone through.
comment:2 Changed 8 years ago by anonymous
Thanks Simon! I also listed another my bug on almost same combination but on Edit (3188) in this Wike page. Personally I think issues must stay open until they are either fixed or deprecated (as newadmin comes) but lets discuss this out of bug tracking system. I will post my suggestion on django-developers list.
comment:3 Changed 8 years ago by anonymous
I keep getting customer complaints about my software.
Installing my patch everywhere helps but its difficult to maintain this.
comment:4 Changed 8 years ago by Simon G. <dev@…>
- Resolution invalid deleted
- Status changed from closed to reopened
- Triage Stage changed from Unreviewed to Ready for checkin
comment:5 Changed 8 years ago by mtredinnick
- Has patch unset
- Triage Stage changed from Ready for checkin to Accepted
This isn't ready for checkin. We aren't applying any patches to existing admin because it will soon be replaced. So we need to wait for the support work to go into newforms-admin and then write a patch against that.
comment:6 Changed 8 years ago by Thomas Güttler <hv@…>
- Has patch set
- Triage Stage changed from Accepted to Ready for checkin
This patch is necessary and works. Please commit. As long as newforms-admin is not stable,
support for (old) admin must be continued.
comment:7 Changed 8 years ago by ubernostrum
- Resolution set to duplicate
- Status changed from reopened to closed
Complete Error .html | https://code.djangoproject.com/ticket/3662 | CC-MAIN-2015-18 | refinedweb | 534 | 56.45 |
On Sun, Feb 03, 2002 at 01:01:29AM -0900, Ethan Benson wrote:
> On Sun, Feb 03, 2002 at 08:49:59PM +1100, Nathan Scott wrote:
> > > does that mean libacl will need to know about the on disk format for
> > > ACL extended attributes for each filesystem it supports?
> > >
> >
> > No, we'll convert to/from a common (VFS) format into the XFS-specific
> > format before writing / after reading the ACL.
>
> hmm, but as im understanding this libacl will just be writing an
> extended attribute to a file, how will XFS, or whatever know this
> attribute is for ACLs rather then just some arbitrary attribute?
attributes in the system namespace will need to be converted to
the native filesystem format before/after being written/read.
> the acl.bestbits.at site is rather light on technical info..
yes, we'll need to improve some areas of the documentation -
several people have pointed this out now.
cheers.
--
eNathan | http://oss.sgi.com/archives/xfs/2002-02/msg01208.html | CC-MAIN-2014-35 | refinedweb | 154 | 64.34 |
Get first day of week
;
In this section, we will learn how to get the first day
of ...:
The following program helps us in getting the first day
of the week....
getFirstDayOfWeek():
This is the method that is used to get the first day
What is the first argument of the String array in main() method?
What is the first argument of the String array in main() method? Hi,
What is the first argument of the String array in main() method?
Thanks.... This is unlike C/C++ where the first element by default is the program name.
You also
Create First Program
is the video tutorial of: "Learn Java in a day - Create First Program"... of the
program, to start execution. First of all JVM
calls the main method... Create First Program
Learn Java in a day
Learn Java in a day
..., "Learn java in a day" tutorial will
definitely create your.... First you should learn how to download and install Java. Once
Java is configured
When is java main method called?
When is java main method called? When is java main method called? Please explain the main method in Java with the help of code.
In a java class, main(..) method is the first method called by java environment when
First Java Program
Welcome to java tutorial series. In this lesson, you will learn to create
your first Java program.
In Java, all source code is written in plain text file... Machine.
You can write a Hello World program as your first Java program. To write
First Java Program Example
First Java Program Example
In this section we will discuss about the first java program example.
To create a Java program we would be required to create... your first program in Java. In this example I have created a simple class
named
How to create first program in Java?
How to create first program in Java? Hi,
I am new in Java programming. Tell me How to create first program in Java?
Thanks
Hi,
Read more at First Java Program.
Thanks
What is Public static void main
the rules otherwise your program will not run.
Signature of main method in java...[]) //this is most classic signature of main method.
Remember the varargs version of java... not be any
certain way for JVM to find main method in Java.
Void : main is declared
Learn Java in 21 days
program
by watching a Java expert create it.
In order to learn Java in 21 days...,
the latest version of JDK is 7..
Hello world (First java program)
The very first program that a Java developers learns is Hello World program.
To write
First Lambda Expressions in Java
How to create First Lambda Expression in Java?
The Lambda Expression is the hot features added to the Java 8. The Lambda
expression is the first major... you have leaned how to create first Lambda expression example
in Java. Now
Can a main method be overloaded?
Can a main method be overloaded? Hi,
Can a main method be overloaded?
thanks,
Hi,
Yes, In Java program we could having multiple number of main() methods with different Signature and implementation in the class
main method
main method Why is the java main method static
Find the Day of the Week
the day number within a current year.
e.g. The first day of the year has value 1...
Find the Day of the Week
This example finds the specified date of an year and
a day
Find Day of Month
; finds the day of a month and the day of a
week by using get(field_name) method...
Find Day of Month
This example explores how to find
the day of a month and the day
Static keyword in public static void main
://
Explanation:
static keyword indicates that this method can be invoked simply by using the name... variables inside of a static method. Here is the output of the program:
Static
Learn Java - Learn Java Quickly
Development Kit (JDK), then its
time to write your first Java program.
Create..., TextPad etc. Java
program is a class with a main method in it. The main method... the function of JVM
How to write your First Java program
Ok
What is the return type of the main method?
What is the return type of the main method? hi,
What is the return type of the main method?
thanks
Hi,
In the java programming the Main() method doesn't return anything hence declared void. In Java, you need
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code... the GUI as it is more reliable and efficent - the current program that i am working
Main Thread and Child Thread
There are two types of threads in Java Progarm
In Java there are Main and Child Threads used in Programming.
Main thread is automatically created when program runs.
Child Thread gets created by the main thread .
Java Main
Create a java program using Java with LinkedLists
Create a java program using Java with LinkedLists Assignment... lists from your static helpers in a main method inside a class called TestLinkedList... class will have a main method that, when run, will cause a text-based menu
main() syntax - Java Beginners
of the main() in jdk1.5
with sample program.
Regards,
UsmanAli Shaik,
Hi Friend,
Structure of Java program:
[package declaration]
[import statements]
[class declaration]
[main() method]
For Example:
package
What is the arguement of main method?
What is the arguement of main method? hi,
What is the arguement of main method?
thanks,
Hi,
For main() method accepts only an array of String object as arguement. For moe details on
Learn Java in 24 hours
program)
Here the programmer will learn to create his/her first Hello World... you understand the concepts
behind Java class, method, keyword, function, etc... and install JDK (Java
Development Kit), install IDE and then help them create
java main program
java main program how to write a main program for the following code
public class JaroWinkler
{
private String compOne;
private String compTwo;
private String theMatchA = "";
private String theMatchB
Understanding public static void main function
function in Java programming language. In this section we will learn about main
function.
The main method is the first method, which the Java
Virtual Machine... method is the entry point in the Java program and java
program can't run without
How to create LineDraw In Java
is passed to the setStroke() method.
Program Description:
First of all, define a class...
How to create LineDraw In Java
Introduction
This is a simple java program . In this section, you
length() Method In Java
in main class. After
that we create one method which returns the integer type... length() Method In Java
In this section, you will learn how to use length()
method
main method
main method What is the argument type of a program's main() method
create main page
create main page <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@ page session="true
Java get Next Day
Java get Next Day
In this section, you will study how to get the next day in java... DateFormatSymbols in
order to get the names of the days of the week. The method getWeekdays
JDBC Training, Learn JDBC yourself
:
Learn Java in a Day and
Master... java program to connect java application and execute
sql query like create table... from given table through java code. Java code create connection between
program
Sample Java program for beginners
Here beginners in Java can learn to create there first Hello World program... of the special class.
Java First Example-Hello World:
Now we will create our first program..., a programmer is ready to
create their own Java program. Here we have also described
Day for the given Date in Java
Day for the given Date in Java How can i get the day for the user... java.util.*;
import java.text.*;
class CheckDay{
public static void main...");
String day=f.format(date);
System.out.println(day
How to Create Text Area In Java
How to Create Text Area In Java
In this section, you will learn how to create Text Area
in Java... defined. This class has main method in which frame and a panel are created
My first Java Program
My first Java Program I have been caught with a practical exam to do the following:
Write a program that takes input from a user through the command line.
The user must be prompt to enter a sentence (anything). The sentence
main method
can not make multiple main with in the same class program fails to compile. Compiler gives error that the main method is already defined in the class...main method hello,
Can I make multiple main methods in the same
main() method
main() method Can we define two main() methods having same parameter but with different return type in a
Learn Java
There is a need to learn Java programming in today?s world as it has become..., generic programming, writing a program in Java is much
easier than in any..., there is need of Java,
Hence it become more important for a programmer to learn
Method overloading in java program
Method overloading in java program How can we use method overloading in java program?
Method overloading:?In method overloading methods... are passing two char type parameters.
In main method we are calling the all three
Writing Simple Java Script Program
of JavaScript and
create your first JavaScript program.
Creating your first JavaScript Program
In the last lesson you learned how to create simple
java script...
Writing Simple Java Script Program
Why we should use string args[] in main method in java?
Why we should use string args[] in main method in java? we use only string in the main method not any other one.. specify the reason...
and tell me... line from the command prompt
In the main method,the String array args
Why is the main method declared static?
Why is the main method declared static? Hi,
Why is the main method declared static?
thanks
Hi,
When we declare main() method in any Java class always has the same signature, and we declare public static void for beginner
and is the
main reason behind its popularity.
More and more students are opting to learn Java... more.
One way to learn Java is through online training. Here a beginner in Java... helps you to learn Java and
clear your basic concepts. Once your concepts
What if the main() method is declared as private?
What if the main() method is declared as private? Hi,
What if the main() method is declared as private?
Thanks
Hi,
I have found some reference site for java programming coding for Main() method is declared
Can a main method be declared final?
be override in a subclass.
for more about main method be declared final in Java...Can a main method be declared final? Hi,
Can a main method be declared final?
Thanks
Hi,
Yes we can. The final method can
Java Create Directory - Java Tutorial
Java Create Directory - Java Tutorial
...: dir1/dir2/dir3 created
C:\nisha>
This program takes inputs to create...;. the mkdir( ) method is
used to create a single directory while the mkdirs( ) method
Java Video Tutorial: How to learn Java?
is to create and run the first Java program. Next you can
learn the basic...Java Video tutorial for beginners - Provides learn first information
about... technology. A beginner in the Java programming language first learn
the how
Easiest way to learn Java
There are various ways to learn Java language but the easiest way to learn..., video
tutorials and lectures that help beginners learn in Java. This tutorials..., Java classes, etc are covered. To make it easy for novices to
learn
Getting Previous, Current and Next Day Date
Getting Previous, Current and Next Day Date
In this section, you will learn how to get previous,
current and next date in java. The java util package provides
MAin error
MAin error Error while running hello program in another dir rather in bin.
path is already set.
java -version jdk1.6.0_24
no error while compilation but @ d tym of runnin error in main class is generated
Exception in thread
Hello world (First java program)
Hello world (First java program)
... for compiling
and running. Hello world
program is the first step of java...
and it is used to develop the robust application. Java application program
Create a Frame in Java
Create a Frame in Java
Introduction
This program shows you how to create a frame in java AWT package. The frame in java works like the main window where your
Create a JRadioButton Component in Java
Create a JRadioButton Component in Java
In this section, you will learn how to create a radio
button in java swing. Radio Button is like check box. Differences between check
Example of static method
of static method will get more clear after
this program. First of all create a class... a static method this way
Download this
program...
Example of static method
main func - Java Beginners
main func why do we pass array of strings in main function of java? Hi Friend,
It is used to signify that the user may opt to enter parameters to the java program at command line.
Thanks
String replaceFirst() Method
;
In this program you will learn how to replace words in
a text. We are going to use replaceFirst()
method of String class in Java... the following java program. In the program code given below, we
have taken a String
Clone method example in Java
an object in your java program.
If you are trying to use the clone method in a class...Clone method example in Java
Clone method example in Java programming
language
Given
clone method in Java
clone() method in Java is used to create and return copy of the object.
Clone() method is used in class where Cloneable interface is implemented but
throws... example we will learn how clone() method works and is used.
import java.util.
Java toUpperCase() Method
Java toUpperCase() Method In Java
In this section you will learn about how to use toUpperCase()
in Java. From
the name of the method you can also know what... to upper case in java. First we declare a
class named "Touppercase.java"
Hibernate saveOrUpdate Method
Hibernate saveOrUpdate Method
In this tutorial you will learn about... file to map a Person
object with table person. And finally create a simple java... Hibernate :
2. Inserts a new record using java program as follows :
3. When
Learn Java for beginners
your own first
Hello world Java program
and then they also teach you how...Beginners can learn Java online though the complete Java courses provided... a
programmer from basic to advance level of Java.
New programmers prefer to learn Java
sleep method in thread java program
sleep method in thread java program How can we use sleep method in thread ?
public class test {
public static void main(String... example ,we have used sleep method. we are passing some interval to the sleep
Best way to learn Java
download and install JDK, then install IDE,
create your first Hello World Program...Best way to learn Java is through online learning because you can learn... in your program, etc. Every chapter bring you
new topic of Java and explain
how to open one Jframe from main method call
how to open one Jframe from main method call I have downloaded... the main() method, when i run this Engine.java class game starts running...(containing main() method)
Snake.java
GameBoard.java
PlayGame.java
Final method in java
Final method in java
In this section we will learn about Final method in java. Final keyword
in java is used with class, variable and methods. If final is used with method
that method will not be overridden in subclass, if final
Main function.. - Java Beginners
Main function.. Hi Friend..
public static void main(String args[])
What does it mean...public - static - void - main -(String args[])
Can u plz...
Hi friend,
public: The method can be accessed outside the class
Java Program MY NAME
Java Program MY NAME Write a class that displays your first name...() { }, Then, method main should create an object of your class, then call the methods... should have the lines of code needed to display that
letter in a method
problem with main - Java Beginners
,
This is an applet code and applet doesn't have main method therefore compile it and run... a problem. when i compile it appears this message:
java.lang.NoSuchMethodError: main
Exception in thread "main" .
Should i put a main in another file? And how can
Create File in Java
;}
}
First, this program checks, the specified file "myfile.txt"
is exist...
Create a File
... in string, rows, columns and lines etc.
In this section, we will see
how to create
main function defnition in class - Java Beginners
and will subsequently invoke all the other methods required by your program.
The main method... of a main function
Hi friend,
The main method is similar to the main... because we can use that method(main) not only in the current directory
Day Format Example
Day Format Example
This example shows how to format day using Format class. In this program we use a pattern of special characters to day format.
Description of the code
How to Invoke method using Reflection API of Java?
of this example you
will learn the use of Reflection API in Java.
The Reflection... using
Reflection framework:
Step 1: First of all we have to create a Class... the
objects of a class.
Step 2: Now create a Method object by invoking getMethod
Method Signatures
and method definitions. To define a method in java
we need to abide by the certain java syntax known as the method signature to
create a method within a class...
Return Type is void
Method Name is main
List of Arguments with comma separation
Writing First Hibernate Code
First Persistence Class
Hibernate uses the Plain Old Java Objects (POJOs.... Hibernate Session is the main
runtime interface between a Java application... Writing First Hibernate Code
Create a Desktop Pane Container in Java
Create a Desktop Pane Container in Java
In this section, you will learn how to create a desktop
pane container in Java. The desktop pane container is a container, which has
Replacing the first subsequence of the input
pattern p.
matcher.replaceFirst("Java"):-This method will replace only the first...;}
}
Output of the program:-
Text before replacing first...
Replacing the first subsequence of the input
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?
class: filecopy.FileCopy. Program will exit.
Exception in thread "main" Java...How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ? run:
java.lang.NoClassDefFoundError: filecopy
JAVA what is different between static block and public static void main(String a[]) method
JAVA what is different between static block and public static void main(String... void main(String a[]) method,we execute method without main method(by static... are meant to be run once the corresponding class is loaded. The main() method
Java Get Method
Java Get Method
In this example you will learn how to use the get method in Java.
Java... to use get method in Java.
The example is going to show the date details Program
Java Program How to Write a Java program which read in a number... out in the standard output. The program should be started like this:
java... to be read. In this example, the program should create three threads for
Sum of first n numbers
Sum of first n numbers i want a simple java program which will show the sum of first
n numbers....
import java.util.*;
public class SumOfNumbers
{
public static void main(String[]args){
Scanner input=new
Hello world (First java program)
Hello world (First java program)
... and running. Hello world program is the first step of java programming ...
and it is used to develop the robust application. Java application program is
platform
Finalize method - Java Beginners
Finalize method I need a program demonstrating the use of finalize method, please can you suggest me a way out.
Hi method,
finalize :
Every class inherits the finalize() method from java.lang.Object the method
Java Create Directory - Java Tutorial
Java Create Directory - Java Tutorial
In the section of Java Tutorial you will learn how to
create directory using java program. This program also explains
Java Thread Priority
() method.
Java Thread Priority Example
public class priority implements...
Java Threads run with some priority
There are Three types of Java Thread...().getName());
}
public static void main(String[] args) {
Thread t1 = new
Advertisements
If you enjoyed this post then why not add us on Google+? Add us to your Circles | http://www.roseindia.net/tutorialhelp/comment/34322 | CC-MAIN-2015-35 | refinedweb | 3,507 | 65.52 |
42686/how-to-web-scrape-using-python-without-using-a-browser
Yes, you can use the headless mode. When you use headless mode, you do use a browser but there is no UI for it. To initialize it, you will need to change some options. Refer to the below command:
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu') # Last I checked this was necessary.
driver = webdriver.Chrome(CHROMEDRIVER_PATH, chrome_options=options)
In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)):
In ...READ MORE
Hey @Avinash,
Regarding your query, I would suggest ...READ MORE
down voteacceptTheeThe problem is that you're iterating ...READ MORE
Here is an easy solution:
def numberToBase(n, b):
...READ MORE
Hey. Refer to the following code:
driver.get("link")
html = ...READ MORE
Yes, you can do it by using ...READ MORE
You can specify the class you want ...READ MORE
I had a similar requirement, this is ...READ MORE
In Python 2, use urllib2 which comes ...READ MORE
In the easiest way, you can create ...READ MORE
OR
Already have an account? Sign in. | https://www.edureka.co/community/42686/how-to-web-scrape-using-python-without-using-a-browser | CC-MAIN-2020-45 | refinedweb | 193 | 70.9 |
Perl: Climbing TreesJune 6th, 2007 by
HTML!
June 7th, 2007 at 4:06 am
Perl *is* gibberish. ;-P
I’d use BeautifulSoup:
June 7th, 2007 at 5:36 am
This is no place for language bashing.
How about an example of the above code in YOUR preferred language?
June 7th, 2007 at 7:06 am
I don’t endorse the previous commenter’s rudeness, but here’s equivalent code for Beautiful Soup:
import urllib2
from BeautifulSoup import BeautifulSoup
#data = urllib2.urlopen(””)
data = open(”DevChix.html”)
soup = BeautifulSoup(data)
sidebar = soup.find(’div’, {’id’:’sidebarposts’})
for li in sidebar.findAll(’li’):
print li.a.string
June 7th, 2007 at 8:02 am
This blog is meant to inform — saying “x thing sucks, and y works better” is not really THAT helpful. Yes, I could search for Y and find out about it.. but if you have a better solution, at least say a few sentences on why you like that and if possible some examples.
June 7th, 2007 at 2:09 pm
Here is how you would do it in Ruby using the hpricot gem. :-)
June 7th, 2007 at 2:19 pm
I tried to find a way to do it in Java and found several capable libraries. However, it would have been much more complex. :-)
June 7th, 2007 at 3:01 pm
Thanks Angel … thats cool :)
June 11th, 2007 at 6:57 am
I tried to parse the pages from this site, but “id” appears twice. Why do people put out pages that are “tag soup”? XHTML was supposed to fix all this. {sigh}
June 11th, 2007 at 7:21 am
Could you be more clear? id appears twice? in the same element? where?
June 14th, 2007 at 4:10 pm
On this page, there are two items with id=”recent” and id=”comment”. That’s not permitted by XHTML, and nonsensical even with HTML DOMs. id must be unique.
June 14th, 2007 at 8:28 pm
@randal, tag soup is quite different from having accidentally used an ID twice. ;p I may have over looked that. We will fix this issue. Thanks for bringing it to our attention.
June 14th, 2007 at 9:10 pm
@randal, just following up. The devChix site is now Valid XHTML 1.0 Transitional. Happy parsing!
June 15th, 2007 at 1:06 pm
Note that passing
sub { $_[0]->id eq ’sidebarposts’ }is the same as passing
id => 'sidebarposts':
my $sidebar = $page->look_down(
_tag => 'div',
id => 'sidebarposts',
);
Also that look is just crying to be a
mapinstead:
map { $_->as_text() . "\n" }
$sidebar->look_down( _tag => li );
June 15th, 2007 at 3:49 pm
Thanks Aristole :) Very cool
June 28th, 2007 at 4:42 pm
i found this post very helpful for an HTML parsing project I’m doing in PERL. Thanks for posting it. | http://www.devchix.com/2007/06/06/perl-climbing-trees/ | crawl-002 | refinedweb | 469 | 83.66 |
Mark Pollack on Spring and Spring.NET
Recorded at:.
1. This is Floyd Marinescu and Charles Torre of Channel 9 at the JAOO Conference with Mark Pollack founder and co-leader to Spring.Net. Mark can you tell us a little bit about yourself and how you came to be doing Spring.Net?
Sure. I originally was doing Java development in the late 90s and early 2000 and then found myself doing .Net development. During the time I was doing Java development I came across the Spring framework, which was a very popular framework for doing dependency injections and declarative transaction management for Java, and the itch I had to scratch was I wanted to program the same way in .Net, the same programming model I found very productive in Java on the .Net platform. Once you start to think about it, does it make sense to have this in .Net the more I look the more I realized it was a good idea, and asked permission from the team to go ahead and not make a fork but start a total new code base from the ground up with all that .Net-isms so it would be very natural to .Net developers.
2. What does Spring .Net offer .Net developers?
It offers basically three main areas of functionality: one is an inversion control container to perform dependency injection this is an aids to creating loosely coupled of applications; flexible in terms of being able to plug in different implementations and also promoting practice of test driven development. The second major feature is Aspect Oriented Programming, which allows you to modularize certain functionalities and then sprinkle it across the code base, such as login and transaction management. There is also an important feature which goes by name portable service abstraction, where you can take a class and export it as a .NET remoting service or export it as a WCF service or export it as a COM+ component. Lastly there is a collection of helper libraries that basically tame complexities that are incidental to doing development. And these are in ASP.Net and ADO.NET. So if you can take an approach where you use dependency injection non-invasively, you have ties to the framework that supplies to ASP.NET pages as well as regular classes, but then you can inherit for example from Spring's page base class and get features like bi-directional data binding and validation, that is kind of stuff people do over and over again, and it is boilerplate code that gets encapsulated in ASP.Net framework.
3. Let's talk about the problem that you are solving. That was solved in Java and then you took it and transcribed it or transferred it over to .Net, dependency injections.
Dependency injection is basically a technique to configure your application. So generally speaking there are points in your application architecture for example where you would like to have some variability, so for example between your service layer and your presentation layer, those two are typical layers, your service layer might call into a data access layer. And that boundary should be well defined, so you can accommodate change in the future, maybe you change your data access layer, maybe you change your presentation layer. And so if in your code base you just explicitly refer to a particular implementation, changing your layer date becomes very hard. And the other more realistic aspect I think that is important to short term is promoting test driven development. You might have a need maybe a year from now to change let's say your data access layer but right now you might want to actually provide a stub or mark implementation of that to test your service layer in isolation. It's like your immediate point of variability is doing testing and having Spring to basically make it very easy to swap in and out different implementations is the core goal and the way it achieves that is with a sort of "a mother of all object factory" and it is very flexible, very configurable. The object factory is a central artifact that one could have written yourself. But if you really take it to the level it needs to perform this in a sophisticated way, you end up writing what essentially is a container that looks very far from the object factory you'll find let's say in the design patterns book.
4. Excellent. Did you rely on generics?
The implementation right now doesn't have generics in the part of the API that deals with the management. So when you actually use the API you would do casting, but the power of dependency injection is that you should actually never have to call an API directly, that you should give hints to the core or to whatever the configuration mechanism is - it could be XML - it could be attributes - basically that meta data describes the relationships, it says object A is related to object B. Those two can have generic methods, than can be generic classes and those are plugged together. That's the loose coupling story. So because there is no API to say "if you use XML there is no attribute your code isn't tied to the framework". And that's a very important feature so it is not invasive. You can take classes you wrote ten years ago or whatever even .Net 1.0 and wire them up. Or you can take a third party library for example TIBCO Rendezvous is a popular library in the financial community, and you want to basically configure your messaging server. You can do that with Spring.Net in this external XML configuration.
5. Cool. I have one more question I would like to ask. In the real world, are you seeing a lot of .Net developers leveraging this, using it and in particular the C++ .Net crowd?
I haven't seen anyone into C++.Net crowd period. So maybe I am out of touch but I don't see a user base having a large representation from C++ users. It's overwhelmingly C Sharp, followed by VB.Net
6. The reason I asked the question was the way that managing C++ works is you just use easily in an easy fashion you can use the power of the framework in various ways. So I was thinking something like this could be very helpful for if I am writing a C++ application I could use this framework.
Any language mapped on IO code is going to be usable by this. If you are a C++ developer and like to get this benefit, manage C++ then go ahead use it I would love to actually see that.
7. Actually what kind of usage patterns are you seeing for this?
There is one very showcase usage pattern which is a company called Mechado Electronico, a leading Latin American B2B company that is shifting from an ASP common infrastructure to .Net. And they are using Spring in many ways not just the dependency injections features but also ASP.Net framework. It's the core of its redesign to architect a new system. And then of course other companies that I can't mention their names but they are in the banking world and because they are already using Java and the service eye with Spring when they do .Net client development a natural choice for them is to use Spring on the client side as well.
Interoperability is usually web services and messaging.
9. What parts of Spring and are not being imported to spring.Net?
Right now the 1.1 release of Spring.Net has all the functionality that Spring 1.2 family and Java had. What the current one leaves behind is things that are not as mature in the .Net platform for example in Java. There is Aspect J which is a byte code weaving to integrated aspect engine that is equivalent on .Net to PostSharp and some others. That's one area we don't have. Another area is integration with dynamic languages, they can define objects that are managed by the container which are defined in Ruby or Python. Those are some of the features that we don't have but the nice part of design being very similar in .Net and Java is that it can start easily bring features into Spring.Net from the Java implementation quickly. And it is actually vice versa. One of the big features of Java version Spring 2 is a custom XML schema. The idea originated in the .Net, so that bidirectionality is used not just for feeding from Java to .Net but vice versa.
10. Spring in the Java community arose out of problems that existed using the Java EE platforms in the past. What are some problems in the .Net platform that might lead someone towards wanting to use Spring.Net?
One of the issues that I came across is transaction management. In the .Net 1.1 framework there's a enterprise services library that gave you the ability to declarative transaction management through attributes on the class. However that came with certain limitations. One was that you always had to use distributive transactions and that is a very heavy penalty to pay for such a feature. Going a step forward, what we provide is the clarity of transaction management but with local single resource transactions. The system transactions namespace has this kind of promotion model where you can start local and go to distributed but a quark of the usage is that you end up going to distributive transaction out of any realistic design you have of your data access layer. That really adds a lot of value there to bring that flexible programming model of declarative transaction management to .Net.
11. What does Spring.Net offer .Net developers in the area of Aspect Oriented Programming?
It offers a complete framework for doing Aspect Oriented Programming but usually as a first step people just want to use pretty built aspects, so transaction management is one of those. Recently we have added additional library support so that out of the box you can have Aspects for doing exception translations or login or caching. So it is much as we can present prebuilt aspects that you can use right away, that's a gentle introduction. Then you can write your own using API to introduce functionality that might be specific to you.
12. Spring AOP is very easy to use in the Java community and it's very cool that the .Net community has Spring.Net to bring the same features. Can you tell us a bit about what AOP actually is and how .Net developers can use it?
Sure. AOP addresses the so-called cross cutting concerns and this is a buzzword or catch phrase, to refer to code that is spread throughout your system but isn't encapsulated in object hierarchy. It goes in places Object Oriented Programming can't go. So for classic example is login code. Login code appears in your service layer, login code appears data access layer, it is just everywhere. And what if you want to change it? It is not modular, it is not encapsulated in one spot. If you start adding up other things that are spread around like that, for example caching; I might cache in various different places. Not only is it spread around and not modularized, but if you start to look at the method implementation it starts to be polluted with things that aren't related to the business. Caching isn't actually related to the business logic, neither is login, but the method implementation might be half of that, half of the method implementation might be related to this so called cross cutting concerns such as transaction management, caching, login, security checks. And so AOP gives you a way to put in one spot that particular implementation so you can focus on making a high quality implementation and then select points in your application to add that functionality. With the upcoming features in Visual C# 3.0 you can think of it in some way as extension methods that extend behavior of classes, you can add functionality from the outside to an existing class.
13. What's the difference between creating a bunch of static methods that do things whenever they want. So if I am writing a class that is doing something in the UI layer and I could just call a static method to run some log. What's the difference?
The difference is what amount of code noise is that you are going to start writing and say half the method is doing something that analyze the business. That's one concern. The other is that if you want to change what that method is doing with that static method, you have to refractor everywhere and maybe you can do something more drastic. For example the security API might change very fundamental way. If you expect these points to have some variability in particular, then having a way to easily change the implementation and reapply it round the method implementation is very powerful. Basically what you do at transactions: you have a transaction scope, goes around the block of code, and there is that block there. Usually it is more then one line, it is usually a series of lines, you can have cut and paste errors, and people actually end up having also error of omission. If you have a service layer and you say "I would like the service layer to be transactional". Then you'll have 80 classes, each of them have 10 methods, you better make sure in 800 places you have the code right. In AOP in one spot you have the transactional code, and you say "Apply it there, to the service layer", and now you really have confidence that you have done this. Or for example if you are calling it to a controlling layer, into a GUI and you say "I want that to be audited, if there is any errors", now you can simply say in my control layer it is going to be logged and next week I want to add a dialog box that pops up and gets additional contextual information from the user what happens there and now you can just chain another piece of advice as the behavior to what you currently have in your system. And you are done right? You just basically effected the code in multiple places but in a very well controlled manner.
14. And in Spring.Net how do you identify a pattern of classes that should be wrapped with Aspects?
There is a different point cut classes that give you the ability to define that. There are a couple that come out of the box, the most flexible which is the regular expression one where you basically have sensible conventional naming of your name spaces and you do a regular expression to pick up all the classes in the name space. That is the most common technique. But you have freedom to implement your own custom point cuts, to identify locations in the code. This is where domain specific languages help, that you can have a way to express that in a very high level manners compared to a regular expression or to a code itself, C# code.
15. What's the performance story in Spring.Net, using reflection isn't that a problem?
It is not a big problem in a fundamental sense that usually this wiring instantiation happens when the application starts. So it's kind of a one time cost. But because of an expression language we built into the framework out came this very optimized reflection library. So we generated IO code at runtime to do reflection and the end result is that you have a code that is reflection like, but executes basically the same speed as normal code.
17. Tell us more about the ASP.Net support in Spring.Net.
The ASP.NET support starts up really with enabling you to wire up your user pages, your controls, also custom HTTP modules, and custom provided classes such as membership and role providers. It gives you a great amount of configuration ability without any ties to Spring. Your page can refer to a service layer, to actually call in to do its work once you hit submit on a form for example. But then there is a long list of features, work that people do over and over again that are well represented in the base framework. So one example is data binding. The controllers you have for doing data binding are only one way, so you are constantly picking data out of controls, and then parsing them, and then maybe there are issues in the parsing, and you have to display those parsing errors. That is wrapped up into a very nice bi-directional data binding support, and the model management that you end up having to do as well is it a post back, is it not, get abstracted in a life cycle method that binds the model, unbind the model, so that typical state management you do is significantly simplified.
18. Portable service factory that almost sounds like a competitor to WCF. Is that true?
There are a lot of similarities in it but the Spring approach goes one step further, if you are very pure about it you might view the annotation itself is being artifact to the technology. But what WCF is doing is in fact very much along the line to what Spring has been doing all along in terms of giving you flexibility, in terms of configuration, what your middle where is, is it messaging, is it web service, is it secured, is it not secured. It meshes well and it probably has less value now as it did for example when you wanted to do .Net remoting and that actually required you to inherit from a special class. Or if you wanted to do web services and you had to add different attributes. Now it is unified but it still has some value if you choose to quickly export some things for administration reasons. You might just want to make a quick .Net management interface that you can use .Net remoting for, take a class, essentially an internal admin API quickly exported to .Net remoting, and you didn't really have to plan that ahead of time. You just later decide "Oh this class would be useful to be remoted" and if you think about it you don't want to make a fine grained API distributed but gives you the choice to do that if you choose to, gives you the opportunity.
19. Have you noticed any knee-jerk reactions against the framework just because it doesn't come from Microsoft?
There definitely are some people who are conservative almost and stick with the base framework altogether. They don't have any reliance in any external framework. I think to a large extend those people are a little bit misguided because they do bring value even though there is a learning curve. But at the end of the day, the issues of doing development better are most important and because the patterns and practice group are similar work if they choose to stick with pure Microsoft stack, meaning all comes from the Microsoft name space, then they can choose that and I think in scenarios we compete we are better in terms of implementation, then they might go that path and get hooked and then maybe want more and then look to Spring.Net for additional functionality.
20. You took a mature complete framework from one programming language and environment, and ported it to a whole different one. What was it like? What were some of the interesting twists you had to deal with in that effort?
Some of the interesting twists were around deciding which classes should have virtual methods. In .Net you have to make a conscious decision that a class has got to have this method overwritten. And in particular to a framework it is very important the contract you provide to people who might want to do subclasses. It requires you to think a lot more about the API contract. Clearly the last similarities, some are just boilerplate transformations, getter and setter to properties. But the most interesting part is that I dealt into areas of transaction management that I wouldn't have otherwise had to delve into really unless I was porting a framework. Even if the origins of the need are grounded in reality of usage on projects the depth in which you are exploring an API is greater than if you were doing regular business coding and that was rewarding to gain that level of knowledge.
Very nice introduction!
by
Laurent Kempé
Thanks
Laurent
Re: Very nice introduction!
by
Laurent Kempé
Hello stranger!You need to Register an InfoQ account or Login or login to post comments. But there's so much more behind being registered.
Get the most out of the InfoQ experience.
Tell us what you think | http://www.infoq.com/interviews/jaoo-mark-pollack/ | CC-MAIN-2015-32 | refinedweb | 3,560 | 61.16 |
C9 Lectures: Stephan T Lavavej - Advanced STL, 6 of 6
- Posted: Jul 11, 2011 at 10:24 AM
- 68,355 Views
- 94 Comments.
This is a very special episode—it was driven by you!
In Part 5, Niner KerrekSB commented that a great topic for this advanced series would be developing a generic mechanism for printing out STL containers (like a vector of ints). Then Sven Groot helped out with his usual brilliance. I love this Niner interaction!
You got STL to lecture on this stuff! That is HUGE
In fact, STL was so impressed that he decided to try it out himself and see how generic he could make it. He uses only those STL features available in VC10 SP1 (for example, variadic templates are not used in his solution because the feature is not implemented in VC 2010 SP1...).
What did Stephan come up with? Get STL's PrettyPrinter implementation, then watch this great episode to learn the details behind the code. Thanks STL, KerrekSB, and Sven Groot for an excellent exercise!
Watch STL's great introductory series on the ST
at 05:56
Can you post the code you were talking about ?
I'm curious and want to read it.
That code will hopefully work in vs next. If not there's always trusty gcc ;)
Another Cool Lecture by STL.
@STL How would you write a pretty print function for a Binary Tree.
I have a std::function question that I started on Stack Overflow ( and).
To summarize, with the original boost::function I can hold a function that returns any type of value in a function wrapper that returns void, effectively "swallowing" the return value.
int Foo();
boost::function<void()> Bar = Foo;
But this doesn't work in MSVC2008 using tr1::function (error C2562: 'std::tr1::_Callable_fun<_Ty>::_ApplyX' : 'void' function returning a value), and I'm told on Stack Overflow that it doesn't work in MSVC2010 either. Someone pointed out that the wording for the definitions of "callable" and the "INVOKE" meta-function that are used to describe std::function has changed between TR1 and C++0x, and that this change effectively rules out the boost::function behavior (since no types are implicitly convertible to void).
Can you comment on this issue?
Good video. Keep em coming.
Small nitpick. You probably meant:
"typedef MyAlloc<U> other;"
instead of
"typedef U other;"
Source code:
Ivan, Part 5's comments> why would you want to "include subheader repeatedly"
As I recall mentioning in an earlier video, VC10 simulates variadic templates like "template <typename T, typename... Args> shared_ptr<T> make_shared(Args&&... args)" with the preprocessor. We have a subheader, <xxshared>, that lacks idempotency guards and uses special macros. <memory> then includes <xxshared> repeatedly, defining the macros differently each time - for 0 arguments, 1 argument, 2 arguments, all the way up to 10 arguments. This "stamps out" overloads of make_shared<T>(), simulating the single variadic template.
Josh K> That code will hopefully work in vs next.
It contains an exact major version check for VC10 because VC11 will need something different. I can't say what, yet.
Tominator2005> How would you write a pretty print function for a Binary Tree.
It depends on how fancy you want to get. Do you want a linear string (e.g. with parentheses), or an ASCII art tree?
Chris> Can you comment on this issue?
Looks like we conform to C++0x (Howard Hinnant is a Committee member and knows what he's talking about). Which is nice, since I had previously identified this as a bug in our TR1 conformance.
KerrekSB> does it work in MSVC?
Yes, with VC10 SP1.
petke> Small nitpick. You probably meant: "typedef MyAlloc<U> other;" instead of "typedef U other;"
That's right, thanks for the correction.
STL, thanks for this episode! I didn't know about the global begin()/end(), I've now included that in our pretty-printer as well to handle static arrays -- cool. I also added the full type trait check for const_iterator, begin and end which I posted above.
I like the generality you get with your formatter class, that's great!
Perhaps a few notes about our own implementation:
Anyway, great episode, with lots to learn from it -- keep it up, and looking forward to next month!
(Also, there appeared to be a bug in this website: After typing all this and submitting, I got a "system error" response, possibly because you were posting just before my submission. Not being able to go "back" in my browser (Iron), I could only press "reload" to repost, but with no avail - I finally resorted to tcpdump to capture the resubmit, URL-decoded the POST and recovered the raw HTML of this post. Phew.)
> STL, thanks for this episode!
You're welcome!
> TE only comes in when you use a custom delimiter class
Fair enough - I didn't look very closely at the guts of your implementation. But mine doesn't use type erasure anywhere. :->
If you look at the STL, as a general principle, customization never involves additional costs. std::vector with a custom allocator or std::sort() with a custom comparator don't involve space or time costs beyond whatever's in the custom machinery itself. std::shared_ptr and std::function also follow this principle - they're performing type erasure anyways, so there's no additional cost for erasing custom deleters/allocators. (I have a todo to make them avoid storing empty allocators, which is something that we've already done to the containers.)
> But I suppose since you have an explicit print function, you do need to catch special cases like types with iterators that aren't containers...?
That's right. std::string could be handled within the general container machinery, by giving it a prefix and suffix of "\"" and a separator of "", but that would inefficiently print the string character-by-character. I built my pretty printer on top of iostreams, so performance is almost a lost cause anyways, but adding additional penalties would be even worse.
> The one thing I personally really really feared was the need to remember a function name
"print" is easy to remember. :->
The problem with op<<() is that it mixes code and data. I believe that Boost.Format's machinery is ideal, with two exceptions - it needs variadic templates instead of its op%() trick for C++98/03, and it needs to be built from scratch instead of above iostreams. My ideal I/O mechanism would look like print("format string", stuff, stuff, stuff), with customization along the lines of my pretty printer.
> keep it up, and looking forward to next month!
I will have to think of something to talk about. For fun, I wrote a implementation, but it's more intermediate-level than advanced.
@STL So you do not want to share it until vs next gets released ?
I'm talking about the code that didn't work at 05:56.
@STL and @EverybodyElse: At this point and given how this episode turned out, why not suggest topics for the next one?
C
@STL: Your philosophy of not mixing code and data is interesting, perhaps I should rethink how I print things in general. Cheers.
Speaking of, if iostreams is such a drag and you have an idea how to do it better, would you care to share? I'm sure many people would love to see a high-performance and easy to use alternative! (Can your solution can beat "printf("%06X", myMACaddr)" in compactness and ease of use?
)
Also, I'm comparing our pretty-print implementations; for simple examples they produce identical assembly!
ļoti izsmeļoši
Josh K> I'm talking about the code that didn't work at 05:56.
Oh, I deleted that when it didn't work. ("Source control? What's that?")
KerrekSB> Your philosophy of not mixing code and data is interesting, perhaps I should rethink how I print things in general.
It's not original to me, but I forget where I learned it from. One problem with mixing code and data is that it wreaks havoc with i18n.
KerrekSB> Speaking of, if iostreams is such a drag and you have an idea how to do it better, would you care to share?
Well, it'd be better if I had an actual implementation, which I don't. The pretty printer is a sketch of the techniques I'd use, though.
KerrekSB> (Can your solution can beat "printf("%06X", myMACaddr)" in compactness and ease of use? )
When printing hex, I overwhelmingly want three things: zero padding, hexits equal to the width of the data type, and uppercase. I want to be able to say %X and have that work for unsigned char and unsigned long long equally.
It looks like MAC addresses are 12 hexits, not 6. If they had their own type, they could be annotated with their width.
@ STL
Another great video(although I cant seem to think in template way- I miss my precious if statements, and template tricks are above my level :) ). That being said I really like the advanced series on The Next Generation of C++ although it is harder to understand than the The Original Series :P
BTW I have two STL questions
1.
often I use set s<T>
and then I check if the element is in the set( .count ). Problem is that I think that sorted vector<T>(because it is in sequential memory locations ) + binary_search() is faster way to do it? Am I right?
BTW I know you probably arent allowed to tell the details but if you were working on Office or VS GUI would you bother with this optimization?
2. Also if I call MULTIset insert with 100 elements-how many malloc calls is that? 1(you know the required space because it is multiset) or 100.
P.S. Tnx for drawing the dbl_linked list on the white-board-as an ComSci student I'm always trying to find a reason to claim that my college wasnt a waste of time. :)
P.P.S Regarding my stupid question about multiple includes, I now remember that you mentioned the MACRO_TRICK I just forgot how it was done.
@STL: Any idea why INVOKE was changed in this way? Is there some rationale - some gotcha that I can't see? Or is there some obvious workaround/alternative that renders it unnecessary? This could be a good topic for the next talk :) - it would likely touch on the machinery of std::function, possibly std::bind, lambda functions, forwarding, variadic templates, etc. and how they interact.
@STL An ascii art tree would be good. That way you can see the way the tree set up,
but one with Parentheses would be good too.
I have a topic for you; std::codecvt. C++ and Unicode. How do you convert between the different encoding in a standard and portable way. Some say C++ support for unicode is embarrassing, but that's all changed with C++0x, right?
C++ unicode issues are something I would very much like to see some coverage of ... but it really doesn't fall into STL's area I don't think. That's why (as I have suggested previously) I think there is room for a more general series of topics that ventures beyond STL's "turf" in the library. The challenge would be to find someone of STL's caliber to deliver such lectures. It would probably be a good place for rotating presenters.
Would you like to see a monthly show focusing on native dev with a rotating cast of characters and topics? Would you like a native-focused show that thrills and delights, educates and challenges? Well, hold on pardners... It's a comin'!
Yes please, thank you!
Good stuff Charles ... keep it coming.
thanks for a good video
@petke, @ryanb: The C++ language standard has no notion of "encoding". Moreover, it has no notion of "text" and "binary representation of text". Any explicit Unicode-related operations are strictly outside the scope of the language.
What C/C++ do do is to acknowledge that the historically misnamed type `char`, which should probably have been called `byte`, is insufficient for textual purposes, and it provides a platform-dependent, unspecified textual type `wchar_t` to hold a platform-dependent text character primitive. Acknowledging further that the outside world communicates in byte streams, the standard assumes that there exists a (platform-dependent) method to translate between fixed-width wide strings and variable-width byte streams, provided by `mbsrtowcs` and `wcsrtombs`. (I wrote a little rant about this on SO a while ago.)
In this sense, the native MSVC environment only supports UCS-2, or otherwise it gives you varibable-width 16-bit strings internally with no genuine "character" functions built into the language. It's also worth noting that most file systems accept null-terminated byte strings as file names (again with no notion of encoding or textual semantics), and NTFS is one of the rare kind to use null-terminated 16-bit strings (not: unicode) as filenames, necessitating non-standard file functions like `_wfopen`.
Personally, I think the notion of "text" is just very high-level, and instead of burdening a general purpose language like C or C++ with it, it's best left to something like ICU that can perform normalization and other deep text operations.
Ivan> I cant seem to think in template way- I miss my precious if statements, and template tricks are above my level
Try writing FizzBuzz with runtime recursion, avoiding runtime loops but using runtime conditionals.
Then try writing FizzBuzz with templates (i.e. compiletime recursion), avoiding both runtime loops and runtime conditionals.
This simple exercise is actually quite valuable.
Ivan> often I use set s<T> and then I check if the element is in the set( .count ).
I prefer s.find(key) != s.end() because it's equally efficient for sets and multisets.
Ivan> Problem is that I think that sorted vector<T>(because it is in sequential memory locations ) + binary_search() is faster way to do it?
It depends on what you're doing with your data.
If you build up your data structure in one phase, then repeatedly access it in another phase, then it's probably going to be more efficient to build up a vector, sort it, and then do lots of binary searches.
However, if your insertions are interleaved with lookups, and especially erasures, then a sorted vector is totally inappropriate and you definitely want a set.
Ivan> if you were working on Office or VS GUI would you bother with this optimization?
Only if (1) profiling identified the set as a bottleneck, and (2) I had the access pattern guarantee allowing me to use a sorted vector instead.
By the way, I dealt with this kind of issue in my Nurikabe solver.
> Also if I call MULTIset insert with 100 elements-how many malloc calls is that?
100. The node-based containers (list, forward_list, set/multiset/map/multimap, and their unordered variants) store elements in separate nodes.
Chris> Any idea why INVOKE was changed in this way?
No, sorry. Might have been intentional, might not.
Tominator2005> An ascii art tree would be good.
Here's an ASCII art pretty printer for a Huffman tree:
HomerSimpian> In regards to your comments around 12:56-13:10, will you be paying my company to do the upgrades and the necessary (and expensive) 3rd party library upgrades that would need to occur?
Your company bought third party libraries without the right to rebuild them, or request new builds for updated toolsets?
HomerSimpian> Will you say something similar about Vs2010 when VsNext is issued?
Yes. As I'm living in the future with VC11, VC10 already feels old to me.
HomerSimpian> It's easy to say everybody should upgrade to the latest, just not easy to do.
It's not always easy to do the right thing.
petke> I have a topic for you; std::codecvt.
That's a complicated area and I'm not an expert there.
About the next topic, what about some more template meta programming? The former videos did use some of it (notably some enable_if) but nothing specific yet.
@STL
First tnx for the answ and the FizzBuzz suggestion. Will look it up. To be clear my question about vector vs set was for case where there are no removals or new insertions. Disregarding my compsci knowledge erase-remove idiom is enough to scare me away from using vector in that way.
BTW I prefer .count() instead of find() because it allows me to do the horrible if(s.count(74656)) .
"Ivan> Also if I call MULTIset insert with 100 elements-how many malloc calls is that?
100. The node-based containers (list, forward_list, set/multiset/map/multimap, and their unordered variants) store elements in separate nodes."
Isnt that a wasted opportunity? Tp be clear I'm not talking about for (i=0;i<100;++i) ms.insert(v[i]), I'm talking about ms.insert(v.begin(),v.end());//v.size()==100
this overload
template<class InputIterator>
void insert(
InputIterator _First,
InputIterator _Last
);
Is this inherent limitation of the C++ allocators or choice by library implementers?
Again this might be a stupid question, but my knowledge of allocators is really limited...
@Ivan: Contiguous allocation is exactly the underlying idea of a vector. In an node-based container, you do want to have quick insertion and removal, so how could that work if elements didn't have their own memory? You'd end up with exactly the problem that vector has when you erase something from the middle. Or perhaps, since you don't require contiguousness, you would need a mechanism to free() a smaller chunk from amidst a larger allocated region -- as far as I know, no OS supports that sort of memory management. (Note that free() is only defined on a pointer that was previously allocated, you cannot say things like free(p+1).)
Oh, this is unfair Stephan, you are tempting us.
For next topics, I recently got a translated version of Effective C++ and I get fascinated with std::function and his friends (like bind) and how it interact with the containers. Expanding std::function and bind looks a nice topic, with examples of how wrap old/legacy algorithm with STL (one example i like is the sorting the vector with C str wrapped functions) or using it in some pattern like a visitor or observers.
As always, nice video, thank you @STL
@Charles, keep it comming
(edited/added) I just remember another topic that could be nice (but don't know if it fits on "advanced"):std::hash, and how make our own types container/STL friendly.
Yes, Unicode/Multibyte operations are outside the scope of the language, which is why I said it is beyond the scope of this series (and I never suggested it should be part of the language). But the fact that the language will physically handle the representation of different encodings has little to do with being able to work with those encodings in the real world. Especially when a lot of us need to produce portable code in the real world, these platform dependent and encoding dependent differences make things very difficult (as you are well aware). Having some coverage of strategies for structuring code (using the existing language features) to deal with these situations would be of value.
If normalization libraries and a common internal representation are the only means of working with mixed-encoding environments, that raises the question of whether a normalization library (such as ICU, already a quasi-standard) needs to be provided as a language standardized, portable library.
With the advent of domain specific libaries such as <atomic> and <thread> I'd say Unicode operations and data types could very well be part of the standard. It is exactly those platform specific functions and types that drive people to higher level languages like Java, even if those are heavily dumbed down; they at least provide this cross-platform functionality with easy to use interfaces.
Of course, Qt could be an option but I despise it. It's not even a library, it's a complete application framework that takes over your programming environment with custom build-tools and tries to reinvent the STL.
@ KerrekSB
IMHO you could have a vector of the adresses of the freed nodes so that map can use freed stuff for the new nodes. Ofc returning memory when (any node is deleted) to the os is a big no no because remembering when all the nodes allocated in one big alloc is hard(for me, it might be very very easy for someone smarter/more educated, best I can think of is atomic<size_t> n_block_nodes_in_use-when it reaches 0 you can return the memory). Again this leads to other problems you could alloocate 100x1M nodes, remove all but 20 and still end up with lets say 20X1M memory used(1 remaining node in each block). Then you end up with inserting memory usage balancing into the already hellish process of inserting a node in the RBTree. :)
But still c++ vector also "wastes" memory. STL explained why. Standard smartly says that amortized cost of insertion must be O(1) when it is resized you get new_size=k+old_size(k=1.5 for VC, 2 for GCC if i remember corectly).
error in previous comment :ofc new_size=k*old_size, not + , it was a keyboard error, I dont think that you can have floating point size. :D
Julien N> About the next topic, what about some more template meta programming? The former videos did use some of it (notably some enable_if) but nothing specific yet.
This pretty printer involved significant template metaprogramming. At first, it might not appear to involve very much TMP, but it's recursively analyzing the type of a container and its elements.
I could try to think of more.
@STL:
Great video, thanks so much!
Regarding the FizzBuzz task you recommended to Ivan, I guess I'll have to do the same thing.
In C# I have no problems with generics (which is IMO far from templates), but I can imagine when using it. In C++ I have the problem (and it is a problem IMO), that I can't detect when templates would be valuable. In C# we have e.g. a generic Presenter (MVP), where we can pass some other class that the derived class depends on (IOC) or some other examples, where I know when to use generics when I see it. I'm sure I have a lot of code that could be optimized using templates. Of course I should be creating a few, so I see/learn the benefits of when to use them.
C++/OpenGL I do for fun on some evenings, after doing C# all day at work (learnt a lot about C++ in the last 1.5 years -- if I compare myself to questions from KerrekSB etc. I've got tons to learn).
I like this diagram for choosing containers: (at the bottom. unordered_... not included), though I usually do look at a C++ reference site to see what's better for what case, i.e. inserting in middle, reading from middle, etc.
Previous video you mentioned in the comments, you can't comment on legal things, but you can say if we can use your code commercially/non-commercially etc. like the code above for printing an ASCII tree.
You actually used an ifstream this time
I often use "pure" C++ classes (including ifstream). What I don't get, I recently saw this on cplusplus.com: ifstream provides an interface to read data from files as input streams. IMO that means, it's an interface, so I'm suppose to use an fstream if it's not meant to be an interface or to pass it an fstream to a function I could use Do(const ifstream& aStream);??? Or what am I misunderstanding. Does interface in this case mean a facade/wrapper, and not an interface (i.e. C#'s meaning of interface). Must be, since its functions are obviously not pure virtual.
Another question that someone may know. If I inherit from a base class, is it a bad idea to do an inline on an overriden (for virtual)/implemented (pure virtual) function in the derived class (obviously)?
That sounds great: thanks Charles!
I'm looking forward to some of the Windows devs, like Larry Osterman and someone from lower-level too (e.g. Doron Holan, device drivers).
Some questions I'd like to ask to Larry is discussing why in their team they don't use C++ exceptions and prefer error codes, and what tools do they use to "develop Windows" (what editors? what debuggers? The great WinDBG? Some other tool?).
Thanks.
Thanks for this lecture, STL.
As next topic, I'd like to suggest developing a custom STL allocator: as an exercise, explain us how to convert this efficient pool allocator written in Win32/C++ to "STL/C++"
Thanks.
Deraynger> In C++ I have the problem (and it is a problem IMO), that I can't detect when templates would be valuable.
Do you want to handle arbitrary types? Then you want templates.
Deraynger> I like this diagram for choosing containers
I strongly disagree with that diagram for several reasons:
1. It gives terrible guidance around vector/deque/list. Absolutely horrible.
2. It doesn't understand how limited the container adaptors are.
3. It doesn't spell multimap and multiset properly. (That's not a big deal in and of itself, but if you can't spell a container's name correctly, you probably haven't used it very much...)
4. It makes the whole process look way more complicated than it is.
Here's what I recommend:
1. Be familiar with the container adaptors: stack, queue, and priority_queue. They intentionally have very narrow, highly restricted interfaces (e.g. you can't iterate through a stack's elements). In fact, stack and queue don't do anything *except* restrict the interface of an underlying container. (priority_queue does a bit of real work by gluing the heap algorithms to an underlying container.) When your needs can be satisfied by a container adaptor, then use it. Otherwise, don't. (For example, I use a queue in my Nurikabe solver, and a priority_queue in my Huffman tree code above. Note that priority_queue::top() returns the "highest priority" element, but Huffman wants the lowest frequency nodes, so I use greater-than to reverse the ordering accordingly.)
2. Be familiar with the ordered associative containers: set/multiset/map/multimap. It's pretty obvious when you need them, and it's pretty easy to determine whether you care about duplicates.
3. Be aware of the unordered associative containers and their different guarantees. They're less convenient (no auto-sorting, no worst-case logarithmic guarantees) and harder to use (providing equality and a good hash is harder than providing less-than), so I recommend using them only when you know that you really want their properties.
4. Be familiar with the sequence containers: vector, vector, vector, list, forward_list, and deque. vector is by far the best general-purpose sequence container - it is both extremely efficient and extremely powerful (random-access is a very important power). Use vector unless you specifically need the unique abilities of another container. This is actually pretty rare!
4a. list is significantly less efficient than vector and significantly less powerful (it's bidi instead of random-access). Summarizing its advantages: (1) list has true O(1) push_front() whereas vector intentionally lacks push_front() because it would be O(N) (you have to specifically request that with insert() which is more verbose), (2) list::push_back() is true O(1) whereas vector::push_back() is amortized O(1) (this is a theoretical advantage but I have never seen it matter in practice), (3) list has true O(1) arbitrary insertion, but you have to have an iterator to the insertion location in the first place, making this not nearly as useful as it sounds at first, and (4) most importantly, as a node-based container, list insertion/erasure never invalidates iterators/pointers/references to other elements. list does other things (e.g. splicing), but those are the big ones as far as I'm concerned. Actually needing them is quite uncommon.
4b. forward_list is slightly more space-efficient than list (one pointer per node instead of two, no sentinel node), but even less powerful (forward instead of bidi) and with a more unusual interface. I have extreme difficulty imagining real uses for forward_list. But in the ridiculously improbable event that you need it, it's there.
4c. deque is the strangest container in the STL, and really in the world. In wall-clock terms, it supports amortized O(1) push_front() and push_back(), and is yet true O(1) random-access. It also has really special invalidation guarantees (it is the only STL container capable of invalidating iterators while preserving pointers and references). In absolute terms, it's not very efficient, especially in VC's implementation. You should use deque only when you need its strange properties, which is virtually never.
Deraynger> Previous video you mentioned in the comments, you can't comment on legal things, but you can say if we can use your code commercially/non-commercially etc. like the code above for printing an ASCII tree.
I can point to the notice at the bottom of every C9 page, which may or may not apply to my C9 code, and wouldn't be useful if it did!
I could also ask my bosses and boss-like entities about releasing my C9 code under the Boost Software License, which would actually be useful. But that sounds like work.
Deraynger> I recently saw this on cplusplus.com: ifstream provides an interface to read data from files as input streams.
They didn't mean interface in the special polymorphic sense (even though iostreams is full of virtuals). Interpret this as: "ifstream is a thingy that reads data from files".
Deraynger> IMO that means, it's an interface, so I'm suppose to use an fstream if it's not meant to be an interface
ifstream is a thingy that reads data from files.
ofstream is a thingy that writes data to files.
fstream is a thingy that can read data from and write data to files.
iostreams are hideously complicated in general, but this part is simple.
Deraynger> Do(const ifstream& aStream);???
Doing anything to an ifstream/ofstream/fstream involves modifying it, so const is erroneous here.
Deraynger> If I inherit from a base class, is it a bad idea to do an inline on an overriden (for virtual)/implemented (pure virtual) function in the derived class (obviously)?
The "inline" keyword (both when it's explicitly written, and implicitly granted to a member function defined in a class definition) has two effects. First, it's a non-binding hint to actually inline the function. This will typically be ignored for virtuals except in the presence of a very advanced compiler. Second, it grants the Partial ODR Exemption (also granted to templates) allowing header-only code. It has no other semantic effects.
@STL: Thanks so much for elaborating.
STL> Do you want to handle arbitrary types? Then you want templates.
To what extent is it arbitrary? If I have an interface/abstract base class, then it's not arbitrary anymore, although with templates I could probably skip the base class and use a template that checks that the class contains the functions I need.
Deraynger> I like this diagram for choosing containers
STL> I strongly disagree with that diagram for several reasons
As I mentioned, I never really used the diagram, but "I usually do look at a C++ reference site to see what's better for what case, i.e. inserting in middle, reading from middle, etc."
Regarding vectors, that's what I mainly use (especially for vertices etc.), map/multimap and in one case a stack<x, vector<x>()>.
STL> I can point to the notice at the bottom of every C9 page, which may or may not apply to my C9 code, and wouldn't be useful if it did!
[Edit] I sent an e-mail to C9 regarding the different questions. Theoretically I consider it quite open for interpretation, so IMO your code falls under user-posted content (see:)">), where you can provide a CC-license (which doesn't state it has to be the same as C9s CC-license), so you could theoretically say that we can use all of your posted code freely and commercially and the license is the following:, with the extra permissions that we can use it with or without a copyright notice with your name (provided you want that)
, and as the license states, it has to be visible that this license is used.
I'll write when I get an answer from C9.
STL> [Inlines]
I use inline usually for tiny things (not even for calculations), but mainly just for setters/getters. But if I know that it shouldn't be for virtual functions, then I also won't use them there
Small question. If I use a for_each, can't I create a member function (preferably non-static) defined in the same class, or is it like a functor, where a seperate class/struct is necessary?
Thanks again for all your detailed answer (especially on the containers and the diagram).
STL> The problem with op<<() is that it mixes code and data.
Can you explain it, I don't get it
@Charles:
Charles> Would you like to see a monthly show focusing on native dev with a rotating cast of characters and topics? Would you like a native-focused show that thrills and delights, educates and challenges? Well, hold on pardners... It's a comin'!]
I'd love it!
@STL
is it possible in C++(without adding something to the STL implementation) to add for example .sort() member function to vector? I presume not, but I never understood the reasons. Also I dont know why it isnt defined in the standard. I mean I know that some people dislike Object languages, but C++ is supposed to give options to programmer , right?
@Ivan: C++ are based on 3 pilars: Containers, Iterators and Algorithm, this way they can provide a generic way to an algorithm like sort be applied to many type of containers through iterators interface. Here an except from sgi:
. "
@ new2STL
Yeah, but each container has begin and end. That makes implementing .sort() trivial.
@Ivan: Each container have begin and end because this is the way C++ had to implement interfaces (C++ don't have the interface keyword like other languages) and decouple it from the algorithms.
I can be wrong but, Sort as a member function looks like that sort belongs only to that container and need be implemented by it. Its not "C++ don't like Object", it was the solution they find when developing a library that fits on most generic way possible. As a member it only make inflate the container with a functionally that not belongs to it. Witch type of sort algorithm to use if an algorithm fits on more than one type of container, replicate code? Even if you think in sort member as a way to shortcut a call to sort(s_begin, s_end, d_begin) it only looks duplicating code and defeat the purpose of iterator (why make a iterator interface if sort will be on the object anyway?)
It's like the pretty printer above, you could want overload ostream and operator <<, but other prefer a separate print(...). What I know from now reading more and more C++ books and articles (and I'm aligning to it) is make a print(...) could be more interesting for keep the algorithm generic, decoupled and self-contained. In the way to chose commodity or discipline, choose the later
@new2STL
I dont really reakly understand that it would be hard to implement it.
Every .sort could be
{
sort(this->begin,this->end());
}
Maybe I'm wrong. :) That is why I would like STLs answer. He knows the standard very well and the reasons for certain decisions.
@Ivan the reason is: code duplication, maintenance and the like. You have std::sort which already does the job, why would you want to have another sort specific to a container? That's the whole beauty of generic programming. You've got an algorithm and it works on many different containers. Exponential growth (of number of algorithms/methods/fncs) is something what you want to avoid.
C++ is beautiful in this and every other way.
@aasss
like I replied before member function could be a wrapper around the real sort so I dont see a code duplication problem. Also why I want it? Because like I said it is easier for me to thing in object way. Again I would like STLs opinion because he is the expert.
P.S. there is a std::count, map::count, multimap::count
As for next episodes, I would like to see piece on allocators, writing your own etc.
Following your way of reason, you should add a sort() method to several containers, not only vector. Then why not adding also a binary_search() or search() method where applicable, to vector and to other containers? And add other do_some_cool_algorithm() method? Then the public interface of STL classes become bloated, contrary to STL's philosophy.
As I understand it, the STL's philosophy has a strong decoupling between containers and algorithms (iterators are the "glue"), and they try to keep container public interfaces minimal.
But I agree with you that is better waiting for STL's (Stephan) answer.
STL> Do you want to handle arbitrary types? Then you want templates.
Deraynger> To what extent is it arbitrary?
In the template world, "arbitrary" means exactly what it says on the box: the whole universe of types, until you choose to constrain it.
Deraynger> If I have an interface/abstract base class, then it's not arbitrary anymore, although with templates I could probably skip the base class and use a template that checks that the class contains the functions I need.
Think back to the intro series, where I believe I ranted against pre-STL containers (now extinct) that required their elements to derive from a common base class. (If I didn't rant against them, I should have.) That's obnoxious (and inefficient!) for lots of reasons, but the simplest one is that int doesn't have a base class. Inheritance schemes can't handle the built-in types, while templates can.
There is a time and place for inheritance (e.g. type erasure is powered by it), but it shouldn't be used when templates are more appropriate.
Deraynger> IMO your code falls under user-posted content
Remember that I am not a user, I am a Microsoft employee. The company owns everything I write on company time.
Deraynger> I use inline usually for tiny things (not even for calculations), but mainly just for setters/getters.
"getters" and "setters" are two of my least favorite words - especially "setters". Most classes should provide abstractions higher than the level of individual data members. When you provide a "getter", you're essentially exposing the existence of a data member. That's two steps away from having a public data member, which is thoughtcrime. (Two steps, because it's read-only, and the data member doesn't have to physically exist - but to outside users looking at the interface, it may as well, which is almost as bad.) "Setters" are even worse, only one step away from public data members..
Deraynger> Small question. If I use a for_each, can't I create a member function (preferably non-static) defined in the same class, or is it like a functor, where a seperate class/struct is necessary?
Are you asking about the operation provided to for_each() that will be executed on each element of the range? That has to be a functor. However, there are lots of ways to provide functors: function pointers, function object classes, lambdas, and helpers. mem_fn() from <functional> is such a helper - it takes a pointer-to-member-function (PMF) and returns a functor, because the syntax to invoke functors (which is func(obj, args) or func(*ptr, args)) differs from the syntax to invoke PMFs (which is (obj.*pmf)(args) or (ptr->*pmf)(args)). You can pass mem_fn(&YourClass::YourMethod) to an STL algorithm, which will adapt the syntax for you (but not quite as efficiently as a lambda due to optimizer limitations). Note that mem_fn() is super smart - the returned functor can be executed on objects/references, raw pointers, and smart pointers, and it just works.
Also note that mem_fun() and mem_fun_ref() (note the extra U) are C++98/03 tech, and are vastly inferior to TR1/C++0x mem_fn() (note: no U).
STL> The problem with op<<() is that it mixes code and data.
Deraynger> Can you explain it, I don't get it
Consider: cout << "I have " << n << " " << animals;
Now suppose that I want to internationalize my program. I can use Unicode, and load strings at runtime for different languages. But what if I have to deal with a language where the word order is different from English (e.g. putting the number after the "kittens" or "puppies" that I have, etc.)? The order is controlled by the *code*. That is not good.
With Boost.Format, this looks like format("I have %1% %2%") % n % animals. Now the order is controlled by the *data*, the string passed to boost::format. A language with a different word order can simply load the string "blah blah %2% %1%" and that'll reverse the order of n and animals.
Ivan> is it possible in C++(without adding something to the STL implementation) to add for example .sort() member function to vector?
No. Other languages have a feature called "extension methods", allowing people to glue member functions onto a class without being that class's author. In general, I believe that it's an anti-feature.
Ivan> Also I dont know why it isnt defined in the standard.
This was one of Alexander Stepanov's greatest insights, and I believe I talked about it in the intro series.
Remember that sort() isn't the only STL algorithm. There's something like over a hundred of them, and they usually come in pairs (default version, functor version). There are also lots of STL containers. Do you really want the STL to define X * Y member functions, where X is the number of algorithms and Y is the number of containers? Even worse, what if when writing a custom container, you had to define X member functions to wrap the algorithms? That is a recipe for interface bloat (look at std::string for an example of a bloaty interface, which Herb Sutter has explained in his books).
With the STL's container-iterator-algorithm scheme, we end up with X + Y definitions, which is much better than X * Y.
(Additionally, algorithms taking iterators are more general for two reasons. First, you can operate on subranges of a container, which isn't necessary that often, but when you want it, you really want it. Second, you can use custom iterators that do something special. back_inserter() is an example.)
There's no essential difference between (hypothetically) v.sort() and (actually) sort(v.begin(), v.end()). One puts the container on the outside, and one on the inside. It is slightly verbose to have to say begin and end in pairs, but the correct way to address that is to wrap pairs of iterators as ranges (which will probably appear in the STL someday in some form).
There's also nothing stopping you from writing container-based algorithm wrappers like sort(v). The STL could provide such things in a separate namespace, but it hasn't done so. (It would have to be a separate namespace, for an interesting reason. Putting iterator-based algorithms and container-based algorithms in the same namespace would lead to conflicts between sort(RanIt, RanIt) and sort(Container, Comparator) - with 1998-era tech there's no way to prevent conflicts there, and it wouldn't be especially fun even today.)
aasss> C++ is beautiful in this and every other way.
Heh, even I wouldn't say that (and I love C++ more than just about anyone). It's a big, complicated language and it has warts. But unlike everything else, it allows you to write extremely efficient code with a high level of abstraction in an elegant manner. You just have to be willing to tolerate low-level verbosity and clumsiness when judging elegance. For example, I think my pretty printer is elegantly structured.
Ivan> P.S. there is a std::count, map::count, multimap::count
The STL does make exceptions to its general rule of insulating algorithms from containers via iterators. This happens when algorithms can be implemented more efficiently (or at all) with "secret" knowledge of a container's internals. You've provided an excellent example. std::count() takes input iterators and is O(N), which is optimal in general (you have to look at every element in the range), even if the iterators are stronger, like bidi or random-access (it doesn't need and can't take advantage of those powers). However, the associative containers like multimap are special, because they're autosorted. multimap::count() is O(K + log N) where K is count()'s return value. This is much better than O(N). (If you're familiar with the basics of multimap's representation, as covered in the intro series, and the basics of computational complexity, then it should be obvious why it's O(K + log N).)
Similarly, std::sort() takes random-access iterators. list's bidirectional iterators are too weak for that, but list::sort() works through node relinking.
Masfo> As for next episodes, I would like to see piece on allocators, writing your own etc.
I would like to do allocators when I can show off VC11's new trickery here.
STL> There is a time and place for inheritance (e.g. type erasure is powered by it), but it shouldn't be used when templates are more appropriate.
Ok, so I'll see about rewriting everything
. I have an idea for you or the authors, provided you/they have enough time: Rewrite the Design Patterns: Elements of Reusable Object-Oriented Software book using templates instead of inheritance
STL> Remember that I am not a user, I am a Microsoft employee. The company owns everything I write on company time.
Yes, I asked with enough details in the e-mail. But Your ASCII tree etc. was probably written in your own time. Anyhow, then I'll just have to rewrite the code from scratch provided that I ever sell a product containing your code.
Deraynger> I use inline usually for tiny things (not even for calculations), but mainly just for setters/getters.
STL>.
As I mainly do OpenGL stuff, I do need a getter/setter for X, Y, Z etc., of course providing other functions too, based on those members. So it is a bit low level, but necessary IMO. Otherwise I agree that the functions should provide other things than just get/set. Other areas are when using inline is when checking e.g.
inline bool AreVertsEmpty(void) { return myTriangleStripVerts.empty() && myTriangleVerts.empty(); }
I don't like calling them float GetX( void ) const and void SetX( float ), so I write them like float X( void ) const and void X( float ).
STL> [mem_fn] & [op<<]
Ok, thanks for the details.
@STL Beauty is very subjective term. One likes when violins are playing and the other when he has dirty socks
. To me C++ is beautiful. In every way. To you may not be but that just you and me and the way we see world (C++). There is no reason to discuss it further, those are very subjective and personal opinions.
And as for you loving C++ just about more than anyone? Bet to dissagree. You may think you do but that's just you, you cannot possibly know other people's feeling.
Regards.
P.S.
Would you mind and confirm that what you've said about not having member sort in vector and reasons for that is practically the same what I've said in my previous post?
@STL
First again tnx for the great answers. I know that it is getting old but it is really interesting to hear opinion on this stuff from the expert. Regarding the MxN problem(see I was listening carefully before, here you used X and Y :) ).
why there arent templates based on container types. I mean why cant you define your own sort template that works on every container that meets certain requirement(has any iterator, has rand_access iterator)? That would avoid the MxN problem, I think.
Regarding multimap count I was a bit confused about the K part but then I remembered that it is a (multi)map. BTW does this mean that mm.count() is faster than count(mm.begin(),mm.end()); I presume that you can specialize count based on the input container..., but if you dont it will go through entire range(again I presume).
Re: the code at 37:33, which looks something like this:
wouldn't it be simpler and more readable to write it thus:
It's 7 instead of 10 lines, and has a proper loop condition instead of an infinite loop with a break, which makes it easier to reason about.
Ivan: check out Boost.Range. It allows you to do this:
@STL As I've said beauty is very subjective and it's better not to discuss it. But as you've started I will end it.
What for you is ugly and vile for me is merely a quirk which makes me love it even more.
Just like a birthmark. Most people associate them as something unwanted but this birthmark my wife has over her upper lip is something what makes her special, beautiful, unique and one of a kind.
Some people will say that birthmarks are vile and ugly. I say they give character.
Regards
@STL
"We do that for other algorithms, as I explained in Advanced Part 2. But not std::count(). Note that multimap::count()'s trick requires knowledge of the tree structure, not just bidirectional iterators. Therefore it must be a member function."
Isnt it possible to check if the input container is map? Again my understanding of TMP is pathetic, but cant you do something like
"if container is map"
return container.count(element)?
I presume you cant because you can only get info about built in types(like is_integral) and not about STL containers. And thre is no is_RB_TreeLike in standard :( :)
BTW compiler probably has enough info to print a warning about that, but I presume that it would be a bad business decision because you dont want people complaining that MS compiler gives warnings on legit code.
regarding the next topics:
I read something about
"implicitly-generated move operations" being broken. If you find it interesting you could do a quick video on it(I presume it is not 50 min lecture material).
Also regarding map and memory allocation(I know , "not again"). Are allocators powerful enough to "present" map in memory as one "vector of nodes" and memory allocation is just adding one node to the vector and pointers to the nodes are indexes in the vector. Ofc you would need a stack of freed nodes, and you would be unable to free the memory because of the fragmentation (unless you do an evil O(n) moving of nodes and restamping of idxs) . Again this is just my not so smart implementation, recently I did an implementation of node based structure that had all the deletes "in one place"(no inserts between first and last delete) in the program so I did it that way. Ofc not with allocators, I had std::vector of nodes. I presume it is impossible to this with allocators but if you can it would be a cool episode even before VC11 is no longer top secret.
Ivan> I presume you cant because you can only get info about built in types(like is_integral) and not about STL containers.
The STL can and does conspire with itself. However, given an iterator to an element, we can't find the parent container (without additional machinery that's expensive at runtime - we have such machinery to power our debug checks, as I explained in Advanced Part 3). Therefore, iterator-based algorithms can't perform trickery that requires access to the parent container.
(Technically, we could detect multimap iterators, and walk upwards until we found the root node. However, calling multimap::count() would be more efficient, since it can just start at the root node.)
> I read something about "implicitly-generated move operations" being broken.
That's "rvalue references v3", which isn't implemented in VC10. Additionally, the problems there were corrected before the Final Draft International Standard was released.
> Are allocators powerful enough to "present" map in memory as one "vector of nodes"
std::map gets memory from its allocator (by default std::allocator). It doesn't care where the memory comes from, only that the allocator obeys the STL's requirements (which, for example, forbid "internal storage" allocators that return memory from "inside" themselves). This allows you to use a pool allocator if you want.
Note that Windows (which ultimately powers std::allocator/new/malloc()) already does something very much like this. Their Low Fragmentation Heap is a bucket-based heap for small allocation sizes, such as tree nodes.
BTW STL, could you update your MinGW distro? New minor GCC and major Boost are out.
Off-topic: Great news everybody! New Visual Studio User Voice, a place for you make suggestions and vote for what wish in VS.Next
[edited7-24] Adding an interesting blog I found about the theme I suggested before (more insight on functional header) Some interesting usages of std::function, he touch std::function, std::shared_ptr and lambdas for an event dispatcher. The other posts on blog are interesting too (Pushing and pulling data in C++0x). Perhaps can inspire some usages like use C++11 on UI (adding here the back of Kenny Kerr in MSDN Magazine in Windows with C++)
And so it is:
C
@STL
We could need your input on this:
Any way to remove the overhead ?
spons: Please ask me at home about things I do at home, and vice versa for work.
JonasNo> Any way to remove the overhead ?
Reading and understanding a long, unstructured thread takes a lot of time, and I'm very busy right now. If you could condense it down to a specific question, I could give you a specific answer.
@STL: OK i'll try.
Goal: Create a template class that will execute a function / functor / lambda, with an arg, when leaving the scope.
Problem: Storing the function / functor / lambda efficiently without overhead.
Suggestion One:
Suggestion Two:
Usage example:
Both suggestions have big overhead.
So is there a way to minimize or remove the overhead ?
Like a template that would work with the compiler and inline everything efficiently (as i should)
Like in this example:
The main problem that cause the overhead is storing the function / functor / lambda.
Lambdas are difficult to store efficiently for later use without 'auto'.
auto so you know can't be use like this:
In my opinion i think the above code should work because auto is initialized in the constructor,.
Anyway there you go.
JonasNo: Oh goody, something I've already written a solution for.
Note that Suggestion One is more efficient than Suggestion Two, because std::function implements the Small Functor Optimization - resulting in zero dynamic memory allocations instead of two (you aren't using make_shared) for sufficiently small functors.
The tricky thing about doing this (usually referred to as a "scope guard") is that in order to provide automatic rollback in the presence of exceptions, the machinery shouldn't throw exceptions of its own.
So here's an E-mail that I sent to our internal C++ mailing list back in May:
Here's ScopeWarden, which has the following properties:
1. It stores a single raw pointer.
2. It's non-copyable and non-movable.
3. It doesn't copy or move the functor it's going to execute.
4. It never emits exceptions. Accordingly, it's marked __declspec(nothrow) to make the optimizer happier.
5. It can't be constructed from a temporary functor, preventing obvious badness.
6. Its helper macro, SCOPE_WARDEN(name, guts; guts; guts; ); , is template-friendly (as proven by map<int, string> below) thanks to variadic macros.
7. SCOPE_WARDEN stamps out a lambda with a reference capture-default, [&], which means that it can access anything in its enclosing scope without performing a copy, and can both observe mutations and perform mutations.
8. SCOPE_WARDEN even avoids constructing identifiers with unintentional double underscores. The helper lambda for a ScopeWarden g2 is xxg2xx.
I believe that this code is free of bugs, easy to use, and hard to misuse (not impossible, of course). In particular, because SCOPE_WARDEN doesn't throw, this sort of code is just fine:
@STL: Thanks for the feedback and information.
Sounds like that internal C++ mailing list got some juicy stuff, i wish i had read access to it
>Note that Suggestion One is more efficient than Suggestion Two, because std::function
> implements the Small Functor Optimization
How do you correctly make use of make_shared, i get strange errors when trying to use it.
Nice solution. Personally i do not fancy marcos.
I would have preferred something like this: (pseudo code)
Somehow it looks better.
So it's not possible to do this without overhead ?
Is the compiler not smart enough to see whats going on and inline it, that's sad.
> Sounds like that internal C++ mailing list got some juicy stuff, i wish i had read access to it
> How do you correctly make use of make_shared, i get strange errors when trying to use it.
These definitions are equivalent:
shared_ptr<T> sp(new T(zero or more args));
auto sp = make_shared<T>(zero or more args);
Except that make_shared is (1) significantly more efficient, (2) less verbose when T is 3+ characters, (3) invulnerable to the "unnamed shared_ptr leak".
> Nice solution. Personally i do not fancy marcos.
The SCOPE_WARDEN macro is for convenience, but ScopeWarden can be used directly.
> So it's not possible to do this without overhead ?
> Is the compiler not smart enough to see whats going on and inline it, that's sad.
I don't know what that usage example means.
@STL:
>
awwh!
> I don't know what that usage example means.
I was trying to demonstrate how i would have liked the scoped class usage syntax to look like.
See function "void test()" in code below
While your class ScopeWarden looks very nice can it be done i a different way with the same efficiency ?
That is with the usage syntax i would like it to be.
Ok lets begin from beginning take this example code:
Is there any way to remove this dynamic allocation in scoped::reset:
"reset_common(ptr, new scoped_func_...<...>(...)); "
This dynamic allocation have been bugging me for some time and i can't remove it. C++ rules doesn't seem to allow me to do it
You will always use a function with 'scoped' and with that information you should be able to do some template magic without this dynamic allocation trick to store the function for later use.
> I was trying to demonstrate how i would have liked the scoped class usage syntax to look like.
It looks like you want unique_ptr.
What scope guards (including ScopeWarden) do is remember an arbitrary action to be performed in the event of their premature destruction (and they're dismissable so they do nothing if they reach their full life expectancy). They're most useful for achieving the strong guarantee (transaction semantics) when copy-modify-swap isn't an option. As you perform actions, you create scope guards to exactly undo those actions in the event of an exception. If everything succeeds, you dismiss the scope guards, committing all of your actions.
Scope guards can be used for resource management (I did that with Boost in Advanced Part 5, when I didn't want to write wrappers for Windows' bcrypt.h), but dedicated resource managers like unique_ptr, shared_ptr, and vector should be used whenever possible.
> While your class ScopeWarden looks very nice can it be done i a different way with the same efficiency ?
ScopeWarden avoids both dynamic memory allocation and virtuals. (Remember that virtuals inhibit inlining, except with very advanced compilers, and even then the stars must align perfectly.)
> Is there any way to remove this dynamic allocation in scoped::reset:
You can with the Small Functor Optimization (keep a local buffer, placement-new your object into it), but it's rather tricky machinery.
> You will always use a function with 'scoped' and with that information you should be able to do some
> template magic without this dynamic allocation trick to store the function for later use.
If you know you're going to have a function *pointer*, then just store the function pointer. You need placement new trickery for arbitrary functors.
I did thought of unique_ptr but its not general enough.
For example it can't do this:
Or this:
Yes you can enclose the ptr in a class and pass it to unique_ptr but if you're only going to use it once that extra work and messes with locality etc...
I did see Advanced Part 5. But as i've said i don't like macros and the way boost does it is impossible to understand. I've tried to understand that macro but i got lost every time in the macro jungle
I'm having a hard time finding information on Small Functor Optimization.
>If you know you're going to have a function *pointer*, then just store the function pointer.
When i said function i meant (function, functor and lambda) We need a general group name for these :/
> You need placement new trickery for arbitrary functors.
Does this include lambdas too ?
That's sad news indeed, you would think c++0x would have fixed this issue so new trickery wasn't needed.
So now what, got any ideas or suggestions ?
autoLOL, I was looking at the STL's code and I felt like an idiot, because I couldnt understand couple of lines ... then I noticed the horizontal bar. xD
@ Charles
One business question that you probably cant answer, but Im curious in case you can. AFAIK VS cpp regex machinery has a fair amount of bugs. Was it ever considered to buy the boost regex code(because it is so old and part of the boost that has high standards I presume it is pretty much bug free). Also that would be a huge boost for boost community IMHO. :)
Regarding Boost would it be against the C9 rules if you would kidnap autors of some of the most used boost libs and asked them to do a couple of lectures on their library. I know boostcon has videos but they are relatively poor sound quality and relatively short.
P.S. First going native show had some flying code that was too simple, please use some epic STL's stuff for the ep2. :D
@ Charles && STL
I like the new Native show(again I found the PR parts about fresh CPP a bit boring, but it was first show and a very good intro for non cpp people IMHO), but I hope that STL will continue with this series. Native show is OK as general talk about, present feature in couple of mins, but I really really like STLs "deep" lectures.
@ STL
1) I know that you mentioned many times that you had a bunch of free time :P , so is there any chance to that you might review (some parts ofc, not entire manual) of the:
"Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms"
I know that it is a strange request, but manual seems very interesting and I would feel much better following if they have your stamp of approval .
2)I dont know if you remember your FizzBuzz suggestion(do it with templates). Im not asking for a solution(please please dont post the solution, I hate when I cant solve something and then I found out solution before I had time to figure it out) but could you explain the printing part of it. I mean AFAIK you cant cout during compilation. wikibook example for prime numbers uses function that is called at runtime:
3)recently I realized how my knowledge is fragile. I thought that i understand (theoretically ofc) implementation of all STL containers, but then i realized that i dont understand how dequeue is done.
I presume that it is like a vector with half of the reserved space before begin() and half of the reserved space after the end(). Am I right?
Regarding topics for the future shows:
1. you could do more on TMP but please explain slowly because I presume that most people(including me) have only basic understanding of it and arent familiar with all the tricks.
2. Ofc doing something like "Modern CPP: why very good Cpp programmer from 2001 needs to update himself". could be useful:) Just please keep it hardcore :)and specific without generic :P PR stuff.
3. Random problem solving using modern CPP is cool.
eg
P.S. sorry for the long comment
P.P.S
Am I looking at the wrong place or
#include <memory> // for std::addressof()
is not documented at msdn
@Ivan: "#include <memory> // for std::addressof() is not documented at msdn"
My guess is that addressof is a C++0x function and technically it haven't been finalized / released yet so i'm guessing that's why its not in msdn docs.
I would suggest you use the c++ working draft for stl stuff:
Even so msdn docs is infamous for its poor documentation quality and correctness. You should take what it say with a grain of salt and verify with other sources.
Jonas_No: unique_ptr wants to store a pointer, so it can't work with things that aren't pointers (e.g. arbitrary handles), but your
SecureZeroMemory example can easily be achieved by using custom deleters with unique_ptr.
Jonas_No> I'm having a hard time finding information on Small Functor Optimization.
It's an STL implementation detail.
Jonas_No> When i said function i meant (function, functor and lambda) We need a general group name for these :/
Different authors use different terminology, but I use "functor" to mean "anything callable" ("arbitrary functor" if I want to be very precise), "function object" to mean "class overloading op()" ("function object of class type" to be very precise), and "function" to mean "real function".
STL> You need placement new trickery for arbitrary functors.
Jonas_No> Does this include lambdas too ?
Yes. Lambdas with captures can contain an arbitrary amount of arbitrary state. Only stateless lambdas are convertible (in VC11) to function pointers.
Jonas_No> That's sad news indeed, you would think c++0x would have fixed this issue so new trickery wasn't needed.
There is no issue to fix, as far as I can tell.
Jonas_No> So now what, got any ideas or suggestions ?
Use ScopeWarden.
Ivan> so is there any chance to that you might review
No time, sorry.
Ivan> could you explain the printing part of it.
Oh, you can use cout (or printf, or puts) to print the fizzing and the buzzing. The trick is to avoid runtime testing, runtime iteration, and runtime recursion.
Ivan> i realized that i dont understand how dequeue is done.
deque is magic - probably the most magical STL container.
It stores elements in contiguous blocks. Unlike vector, which is a single contiguous block of memory, deque can contain multiple blocks. (Therefore, as far as users are concerned, deque does NOT provide the contiguity guarantee that vector and string have.) There can be 1 element in each block, or more (e.g. 16). deque has a "map" of pointers to blocks, to keep track of where they all are (this is essentially a vector of pointers, not a std::map).
When you push_front or push_back, the deque can allocate new blocks to store elements. From time to time, it has to reallocate its "map", which is why deque has the strangest invalidation guarantee in the whole STL - push_front and push_back can invalidate iterators, but they preserve pointers and references to elements (because the underlying blocks don't move around).
deque also has some truly complicated machinery to handle paired push_backs and pop_fronts, etc. for efficiency. (So complicated, it was broken in VC10. We've fixed that in VC11.)
@ STL super interesting answers esp deque(except the part about being the most magical container, RB_Tree based ones are my favs <3 :))... I know, I know it is just because I ask great questions :P
But seriously this deque really intrigues me.
a) i dont understand the last paragraph. Can you explain it a bit. If the explanation is to complicated can you just provide a example of program that uses "paired push_backs and pop_fronts". And I dont understand how can an "old" container be broken. Did you reimplemented it in VC10?
b) my model of the world is crumbling :)
how can container that has RA access (AFAIK) not weaker one like BID have nonsequential implementation. I know that it can have amortized O(1) but that implementation doesnt fee like amortized O(1). I know that it doesnt have to be "one operation" to be O(1)(in fact vector implementation that takes 73 seconds to return single element for any size of the array is O(1) :)) but that vector of pointers just feels strange. :)
And ofc I have other questions about the vector of pointers, how is dq[74656] translated to same internal block and the position in the block, but it is too long to explain I presume.
> except the part about being the most magical container, RB_Tree based ones are my favs <3
Red-black trees appear in textbooks, though. I can't name any other language/library that has a deque (specifically one with the trick of being random-access).
> i dont understand the last paragraph. Can you explain it a bit.
Imagine a program that repeatedly calls push_back(), pop_front(), push_back(), pop_front(). It would be lame if the deque had to constantly allocate new blocks (because one end of the deque is growing) and deallocate old blocks (because the other end of the deque is shrinking). Instead, the deque "wraps around", reusing its blocks. It needs to allocate new blocks only when the overall size of the deque is constantly expanding.
> If the explanation is to complicated can you just provide a example of program that uses "paired push_backs and pop_fronts".
Here's my regression test, which fails with VC10 SP1 and passes with VC11.
> And I dont understand how can an "old" container be broken. Did you reimplemented it in VC10?
My notes say that it was actually broken in VC8 with the addition of _HAS_ITERATOR_DEBUGGING.
This was Dev10#860421/Connect#533131:
> how can container that has RA access (AFAIK) not weaker one like BID have nonsequential implementation.
Loosely speaking, given an index, the deque figures out which block that index corresponds to (with a division), then which element in the block is needed (with a modulo). This is true O(1).
@ STL
so if I understand correctly deque has n(variable ofc) blocks of same size(same size so that it can do division to get the block from the idx( like when finding an row in a axb matrix from 1D idx , but this is not continuous memory ofc so "map" of pointers ), and also uses modulo trick(it also (I presume) knows where in the block is the "start" )to achieve circularity (for eg(numbers are idxs): 3 4 5 ...(free space)...0("start") 1 2 )to make the full use of all but the last allocated block.
Again this is kind of "trivia"(although I remember u saying something like "most of the time you dont need deque but when you need it, YOU NEED IT" :)) but I find it really interesting, if nothing else it made me think about the vector vs deque. Vector "cant" allocate +10 or +47 elements because of the copying(all elements must be continuous in the mem). Deque can, so it can use the trick that you mentioned.
Again this is AFAIK from what I have understood from your comments, lets hope that I'm right. :)
@Ivan: I like the definition on here and the articles about memory management here (The Visual C++ Weekly). Vector is the abstraction of an array with a plus you can grow it if needed (efficiency on only one side for insertion and removes) , the contiguous guaranty of vector make it able o use even on C function that waits pointer and size.
Deque are good when you need insertions and removes frequently and efficiently like a vector on both ends (that article about memory management: double stack), one could use deque for jitter buffers (perhaps not the best example) with consumer and producers on a non-reliable line where you can use a reasonable 'buffer' length but cause bursts or starves the size could vary greatly.
>Vector "cant" allocate +10 or +47 elements because of the copying
It can, you can create a vector with a chunk increase of 10, so it will be prepared and changes bellow this threshold will be efficient, but if you insert 47 will had cost (worst if do it frequently). Even when you use a deque you need measure the correct needs of your application
@STL: this cool discussion sure are equivalent to an episode itself! We gained an extra before the next video
Ivan: Yep, that's right.
Ivan> I remember u saying something like "most of the time you dont need deque but when you need it, YOU NEED IT"
That is something I would say!
new2STL> It can, you can create a vector with a chunk increase of 10
Nope, that would trigger quadratic complexity, violating vector's complexity guarantees. Calling vector::push_back() N times must be O(N), with each push_back() being amortized O(1). Only geometric/exponential reallocation (x1.5, x2, etc.) provides the necessary complexity. arithmetic/linear reallocation (+10, +1024, etc.) does not.
new2STL> this cool discussion sure are equivalent to an episode itself! We gained an extra before the next video
:->
I've been busy and don't have anything prepared yet, hence the long gap. I'll do Part 7 when I think of something, or when I can show off VC11.
@STL
can you tell us if this solution is the correct fizzbuzz solution
(I took the code from and modified it slightly when it wasnt working, probably i could make it not take 3 ints as template args, but if that is the only problem then it is not a problem xD ):
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
template<int N, int m3, int m5>
struct fizzbuzz_print {
static void print() {
cout << N << '\n';
}
};
template<int N, int m5>
struct fizzbuzz_print<N, 0, m5> {
static void print() {
cout << "fizz\n";
}
};
template<int N, int m3>
struct fizzbuzz_print<N, m3, 0> {
static void print() {
cout << "buzz\n";
}
};
template<int N>
struct fizzbuzz_print<N, 0, 0> {
static void print() {
cout << "fizzbuzz\n";
}
};
template<int N,int m3, int m5>
struct fizzbuzz:public fizzbuzz<N-1,(N-1)%3,(N-1)%5> {
fizzbuzz<N,m3,m5>() {
fizzbuzz_print<N,N%3,N%5>::print();
}
};
template<>
struct fizzbuzz<1,1,1> {
fizzbuzz<1,1%3,1%5>() {
fizzbuzz_print<1,1,1>::print();
}
};
int main() {
fizzbuzz<100,100%3,100%5> t;
}
Regarding part 7- I think that people understand that you are very busy, but if it means something(if you are thinking that nobody cares if you make video or not) please know that I(and a bunch of other people I presume) found these videos very valuable.
> can you tell us if this solution is the correct fizzbuzz solution
Yes, that's correct. At a minimum, I'd suggest default template arguments to make main() look nicer. Always try to make usage simple and resistant to error.
Now, if you want to really have fun, try it with Boost.Preprocessor.
> I(and a bunch of other people I presume) found these videos very valuable.
Thanks. :->
First sorry it took me so long to say than you(I was kind of busy :)). Secondly, thank you. :)
Regarding Boost.Peporcessor -it is out of my league. Only for now I hope.
Also do you consider it "really useful" or "cool" or both?
1. BTW Stephen do you have opinion about this article:
Don't be scared to click, it is short one.
1 b)do you know why it isnt possible (AFAIK) for example to calculate something during compile time using regular functions, not TMP.
For example I want to have an vector or array of sqrts. It would be much nicer if I could write something like const vector<int> roots=sqrt({0,1,2,3,4,5,6,7,8,9,10});(sqrt is idempotent function ofc)
and have it calculated at the compiler at the run time. Do you know why is that not possible, is it a bad idea, or just very hard to do it withing c++ syntax rules,or proving idempotence is "hard", or...
Hi. Not sure if this is the right place to ask this question, but here goes. I am using vector in C++/CLI, I have: static vector<CPerson^>^ people = gcnew vector<CPerson^>();. I am adding people to the vector at runtime to get people[0], people[1], etc. I give the user the option to delete a person (people[n]) if he/she would like. My question: How would I go about doing this? I tried people->erase(people->begin());, among other things. I appreciate your help. Thank you very much. Brian.
Nevermind, I think I found out what is wrong. When I erased people[0], I thought all the other elements "moved up" in the vector. I was trying to use people[0] elsewhere.
first it is not the right place, secondly for the usage you want you should learn the differences between STL containers. vector doesn't look right for this task, I think list or set is better choice.
Again wrong place, but if you like you should check out STL's video where he mentions remove erase idiom, or just look it up on wikipedia. Please note that erase remove idiom has bad performance if you remove just one element, then again just one element, ...
@STL - joined the party a bit late, I'm working through all of the videos now. Your style of teaching is first class as is your mastery of the subject. I hope to see more videos from you on C++.
Some suggestions for future episodes;
a) exceptions - when to use and when not to. also performance details
b) design patterns - intro into modern design patterns and which to use
c) intro into concurrency with Boost or c++11
d) compiler optimisations, inlining, STV vectorisation etc
^^^^typo above^^^^
meant to say inlining STL and STL vectorisation.
@STL
VS11 preview is out, can you show us some stuff. :)
P.S. I hope STL is fine, I presume that he was a bit sad to hear about no var templates in VS11 :)
Ivan> Regarding Boost.Peporcessor -it is out of my league. Only for now I hope. Also do you consider it "really useful" or "cool" or both?
It's interesting. I haven't used it in real projects yet, but there's one place (stamping out a bunch of typedefs) where I believe it would be useful.
Matt> @STL - joined the party a bit late, I'm working through all of the videos now. Your style of teaching is first class as is your mastery of the subject. I hope to see more videos from you on C++.
Thanks! I'm very busy with VC11 right now, but I'm definitely planning to do more videos in the future.
Matt> a) exceptions - when to use and when not to. also performance details
This is probably worth a video (although I view it as more Core Language than Standard Library).).
Matt> c) intro into concurrency with Boost or c++11
Definitely on the agenda. First we need to squash a bunch of bugs, though.
Matt> d) compiler optimisations, inlining, STV vectorisation etc
I'm not really the right person for this one - the compiler back-end is mostly a black box to me. C++ goes in, assembly comes out. I know "stuff", but not at an extreme level of detail - mostly what I need to get the STL to generate reasonably performant code.
(For example, vector's empty() is more efficient than size() == 0, so in VC11 I audited <vector> to internally call empty() whenever possible.)
Ivan> VS11 preview is out, can you show us some stuff.
I'd like to when I get some time. Plus I'd have to get VC11's IDE set up.
Ivan> P.S. I hope STL is fine, I presume that he was a bit sad to hear about no var templates in VS11
I heard about it long ago - as the compiler's first and best customer, I hear about their feature decisions long before everyone else. Variadic templates would certainly make my life much easier, but we have a new scheme for faking them (as I alluded to in Part 6) and I believe that it is better than the old scheme and already paying dividends.
@STL: I understand what you mean, but I think it's a good way to communicate intent. I still think you should do some STL videos regarding generally used "Patterns", I took ages to google, and find the right wording, to find CRTP. I think those are basics that anyone writing C++ should know. I would have written my code completely differently if I had known that. Especially I use the patterns quite often (the quality of it is another thing), so I knew, I need something that does X, and remembered something regarding that, by having read the Design Patterns book. Looked it up and implemented it. Now when I see the code I know, oh yeah, that's this or that pattern and works like this or that. Just my 2 cents.
I assume you used the patterns all before, just never thought of it as a pattern. If someone not so smart like you would look at it, I believe if they see certain constituents, they'd know what pattern you used, and if naming the methods/classes etc. in a similar way, it's even easier, like MakeXyz() or class AbcStrategy etc.).
I recently stumbled across the useful pretty_printer implementation STL presents in this nice lecture. Thinking about it, I have rewritten the code a little bit to use a traits class to detect tuple types. The traits class relies on std::tuple_element<0,T>::type being valid. The code works with vc2010 and g++ 4.6.1. You can find the code here:
Any comments welcome!
I miss you STL !
@Dan: We all do! He's killing bugs. He'll be back!!
C
@Charles: When? My favorite series has come to a halt for a while now
*Bump*
*I give up*
Remove this comment
Remove this threadclose | http://channel9.msdn.com/Series/C9-Lectures-Stephan-T-Lavavej-Advanced-STL/C9-Lectures-Stephan-T-Lavavej-Advanced-STL-6-of-n | CC-MAIN-2014-41 | refinedweb | 14,051 | 62.88 |
Hey Experts,
I have a question concerning lifecycle management on customer test tenants:
We created an add-on solution on a customer test tenant. Later, I created a patch to make further changes. When you do this, an additional patch version of the solution is created. At this point, a message pops up stating that the patch content would be copied back into the original solution after the "Assemble and download"-function is executed on the patch solution.
There's also a paragraph in the 1308 studio documentation which indicates the same:
Creating a Patch on a Customer's Test Tenant
When you create a patch of a solution on a customer's test tenant, the system creates a copy of your solution in a new namespace allowing you to make and test your changes without disrupting the original solution. This patch type is called a patch solution. When you want to test your patch solution in the test tenant, you first need to use the Implementation Manager in the studio to enable the patch solution instead of the original
solution in the test tenant. When you assemble the patch solution, the patch is copied back to the namespace of the original solution.
The patch solution is used for all future updates to the original solution. Any changes you need to make in the future can be made by creating a new patch again. To do this, open the existing patch solution in the Implementation Manager toolbar and click Create Patch. All future patches are created in the same patchsolution but each patch has a different version number.
Now, I just did "Assemble and download", no errors, the file was downloaded. But as it seems, the patch is not merged into the original solution automatically. Do I have to upload the patch into the original solution manually to get it on the same patch level??
PATCH SOLUTION:
ORIGINAL SOLUTION:
Kind Regards
Pablo | https://answers.sap.com/questions/10676124/patches-on-customer-test-tenant.html | CC-MAIN-2021-43 | refinedweb | 322 | 51.38 |
Created on 2011-02-22 17:05 by claytondarwin, last changed 2013-01-15 16:09 by serhiy.storchaka. This issue is now closed.
In working with the ttk.Combobox (Windows XP, Python 3.1), I have found that setting the values for the popdown using ttk.Combobox['values'] has an problem converting the string to the proper Tcl value when (and this is the only instance I have found) there is a backslash in the string but no spaces. In this case, the string will translate if it is enclosed in curly brackets '{'+mystring+'}', which I believe is the Tcl syntax to not make substitutions.
I have attached a short script that illustrates this issue.
Clayton
With 3.2, (Winxp) I get combobox with first line,
input as
r'C:\Python31\Lib\tkinter\test\test_ttk',
displayed as
"C:Python31Lib kinter est est_ttk"
Something either deleted \ or converted \t to tab.
Indeed, adding a space to the end of the string or enclosing as you specify inhibits deletion/conversion, so this seems like an error.
With imports fixed
from Tkinter import *
import ttk
the file runs fine in 2.7, so this seems 3.x specific problem.
This is a simple work around.
def fix_tcl_error(s):
if '\\' in s and not ' ' in s:
s = '{'+s+'}'
return s
You can get the text from the Combobox with no issues. The error is in posting it to the Combobox when you have backslashes and no spaces (I think). I have just been running everything through this def before adding it. It has worked with no problems so far using Windows paths and grep-type search strings.
CD
Does the attached patch work for you ?
I also ran into this issue in python 3.3 64bit on windows 7. I was adding paths into a combo box and was escaping all \'s myself. When I created a folder with a space I noticed the paths with the space had double the \'s I wanted.
I removed my escaping and tested the patch and the attached image shows that it works. The top of the image was before, the bottom of the image was after.
I should also add that I yellow highlighed where the space is in the image I attached so it easier to see.
On a side note:
If you pass raw string literals into the combo box as values this issue doesn't happen.
Issue15861 has a more general patch which fixes also this issue.
Fixed in issue15861. Thank you for report, Clayton Darwin. | https://bugs.python.org/issue11290 | CC-MAIN-2017-47 | refinedweb | 424 | 75.4 |
This article explains why C# interactive window is the best Code Snippet Compiler & Execution environment as compared to any other options like online C# pad, C# Code Editor, Online C# Code Compiler, Third Party tools to compile C# code snippet etc,
C# Interactive window is a very useful window which provide us the feature to test our code snippet without compiling the application.
Using C# interactive window we can do a lot of things like Execute & see your code output by just typing it in C# interactive window, Select your Code inside the Editor and see the output of that code snippet, supports C# 6 & C# 7 language features, write Using directive inside it, add a dll reference, call method of newly added dll, Open outside Visual Studio , execute an *.csx file and many more things. Let’s see all those features one by one.
Selecting your code snippet and execute it without compiling the application
I have written the following code in Visual Studio
void Multiply(int x, int y) { WriteLine($ "Multiply of {x} and {y} is : {x * y}"); } Multiply(10, 25);
Now select the above code snippet and press the shortcut “Ctrl+E, Ctrl+E”
It will automatically open C# interactive window and compile code snippet as in the following screenshot.
Keep history of last executed code snippet
It keeps the history of last executed code. To verify it close the C# interactive window and again press “Ctrl+E, Ctrl+E” to open it. You will find that it contains all those data which we have executed before closing this window.
Reset C# Interactive Window
There are two option to reset C# interactive window
a.Click on Reset icon ( located at top left corner of C# Interactive window )
b.Use the command “#reset”. Refer the below image.
Navigate History
We can navigate to history in C# interactive window for next and previous item.
Navigate to Previous : to Navigate to previous we use Up Arrow button (History Previous) located at top left of C# interactive window or shortcut: “Alt + Up Arrow”.
: We can navigate to next by using Down Arrow button (History Next) located at top left of C# interactive window or shortcut “Alt +Down Arrow”.
One of the best thing about C# Interactive window is that it maintains a lot of things in context of history e.g. when we close C# interactive window and reopen it data is not lost. So got the same window with same data which we have executed last time before closing it.
Clear C# Interactive Screen
To clear C# Interactive window screen we can use the clear screen button available at the top left side of the Window. Refer the below image for Clear screen button location inside C# interactive window.
Clearing the screen do not clear the data from history. It just clears the data from UI screen and if you use the history button or just press the shortcuts “Alt + Up Arrow” or “Alt + Down Arrow” you will get all those data from history.
Different ways to Open C# Interactive Window
We can open C# Interactive windows in 3 ways inside Visual Studio.
Using the shortcut Key.
We can use shortcut key : “Ctrl+E, Ctrl+E” to open Interactive window,
a.If we select some code snippet and then use the shortcut key “Ctrl + E, Ctrl + E” then it will open C# interactive Window and it also executes the selected code snippet.
b.If we do not select any code snippet and just press the shortcut key “Ctrl + E, Ctrl + E” in that case it will not execute any code snippet and just open the C# interactive window.
2. Open From Context Menu
We can open it by right clicking anywhere on Code window and select “Execute in Interactive” or select some code snippet and then right click >> Execute in Interactive ,
a.If we select some code snippet and open it from context menu then it will open C# interactive Window and it also executes the selected code snippet.
b.If we do not select any code snippet and just open it from context menu in that case it will not execute any code snippet and just open the C# interactive window.
From View Menu
We can also open it from view menu. Go to View Menu, then click C# Interactive ,
In the above screenshots you have seen multiple ways to open C# Interactive window inside Visual Studio. Currently it is available with Visual Studio 2015 Update 2 and Visual Studio Preview ‘15’. But it is not necessary that you use C# interactive with Visual Studio we can use it without Visual Studio too. This is a tool integrated with Visual Studio. Let’s see how we can use C# interactive outside the visual studio.
Opening C# Interactive Outside Visual Studio
Open Visual Studio 2015 Developer Command Prompt >> type “csi” inside the command prompt to open it as C# interactive. After that you can execute any scripts or do you calculations or whatever other tasks we are performing inside it when open from visual studio same tasks can be performed here also.
Supports C# 6 & C# 7
C# interactive window provides the support for C# 6 and C# 7 as well. We do not need to change anything for executing C# code features from C# 1.0 to C# 6.0 but for C# 7.0 feature we need to make a small change to compile it properly.
Change for C# 7
Solution Explorer, Select your Project, Right Click, Select Properties, Go to Build Tab, General, then Conditional compilation symbols:
Enter “ __DEMO__ & __DEMO_EXPERIMENTAL__ ” in the textbox as in the following screenshot,
Full support of intellisence
It provides the full support of intelliSense as you can see in the following screenshot.
Statement can be written in multiple lines
C# Interactive window provides the support to write your code snippet statements in multiple lines. If you have copied data from somewhere and just pasting those data inside Interactive window in that case it automatically expand to multiple line if your copied code have multiple lines. But if you are just typing the code in C# interactive window and if you press enter it might evaluate that code but if you want to type it in multiple lines just use the shortcut “Shift + Enter” to start a new line without executing the expression. When you press “Shift + Enter” it automatically adds a dot(.) at start of new line which indicates that statement is continued. You can refer the below screenshot for the same.
To test this code snippet,
using static System.Threading.Thread; List < string > fruits = new List < string > (); fruits.Add("Apple"); fruits.Add("Banana"); fruits.Add("Grape"); fruits.Add("Guava"); fruits.Add("Mango"); Parallel.ForEach(fruits, fruit => { Console.WriteLine ($ "Fruit Name: {fruit}, Thread Id= {CurrentThread.ManagedThreadId}"); } );
C# Interactive Commands
Using DLL reference Inside C# interactive window
We Use “#r” to include a dll reference. Refer the below screenshot for more details,We Use “#r” to include a dll reference. Refer the below screenshot for more details,
If you want to practice it for C# 7 feature I recommend you to test it with Visual Studio ‘15’ preview. To know more about Visual Studio ‘15’ you can go through the below C# Interactive With Visual Studio 2015
评论 抢沙发 | http://www.shellsec.com/news/10537.html | CC-MAIN-2017-30 | refinedweb | 1,216 | 59.33 |
Asked by:
How can I get an exported value in MEF for metro style apps
Question
I have an Interface like:
public Interface MyInterface { }
And a class implementing the interface:
[Export(typeof(MyInterface))] public class MyClass : MyInterface { }
In the normal MEF Version I can get the exported value from the container:
MyInterface value = container.GetExportedValue<MyInterface>();
How I can do this in Metro style apps? Im not asking for the SatisfyImportOnce method!
Thanks & Best regards,
MichaelThursday, March 8, 2012 8:18 PM
All replies
Hi,
I am also interested in an answer to the question! Why has Microsoft removed the "CompositionContainer" class? In my opinion is MEF useless without this class.
Bye,
SebastianSaturday, March 10, 2012 7:36 AM
Hi guys,
I just wanted to drop you a note that we're looking at getting you an answer to this.
-SteveMonday, March 12, 2012 6:17 PMModerator
Hi Steve,
thanks for reporting, I'm still waiting for a solution :)
MichaelTuesday, March 13, 2012 11:54 AM
Hi Michael,
Thanks for reporting this. I am on the team that works on MEF and currently SatisfyImportsOnce is the only method we are exposing for composition. This was done with the goal of simplifying composition. Are there specifics of the scenario, that you can share, that are not supported by SatisfyImportsOnce ?
Thanks
-alok
Tuesday, March 13, 2012 9:18 PM
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, March 15, 2012 12:28 AM
- Unmarked as answer by Michael Lehmann Thursday, March 15, 2012 12:34 PM
Hi Alok,
Yes there are some reasons.
First of all, I consider property or field injection as a stablity risk. In my opinion, dependencies have to be injected by the constructor, where I can check them for null reference once and assign it to readonly variables. With SatisfyImportOnce I have to instantiate the object with dependencies manually, so I can not take the advantage of constructor injection.
Second reason is the service locator pattern, where I retrieve specific exports from MEF. The servie locator does (should) not have access to the requesting instance and would have to create dinamically a type with the requested property to satisfy.
I also have ohter issues concerning MEF for metro style apps. I want to register existing service instances to MEF, which was quite easy with the container:
container.ComposeExportedValue<ILoggerFacade>(this.Logger);
If you ask me, I would not simplify MEF a lot. Composition is an advanced technique so people knows what they are doing when they use it and I consider MEF already as easy to use. These limitations fro metro style apps made it more difficult for me.
Thanks for asking and listening :)
MichaelWednesday, March 14, 2012 9:44 AM
Hi Alok,
for me the same things are important. Dependency injection via [ImportingConstructor] is the preferred method for me. And for this the composition container is essential!
Can you explain why you have removed the center piece of MEF and left all other classes in the System.ComponentModel.Composition namespace?
Bye,
SebastianWednesday, March 14, 2012 7:35 PM
- Hi, Ditto the above, I'm very interested to hear the outcome of this discussion. Cheers JonWednesday, March 14, 2012 9:35 PM
Michael, Sebastian, Jonathon,
Thanks for your feedback and interest. I will take this to the team ! We are striving the make MEF great, and your input is instrumental in guiding along. Will report back to the thread once I have some news.
Cheers
-alokThursday, March 15, 2012 11:29 PM
Hi Alok,
nice to hear that the microsoft team takes care our feedback and wishes :)
MichaelFriday, March 16, 2012 7:53 AM
@alokshriram
Do you now have an answer?Monday, May 7, 2012 3:09 PM
Hi All, Sorry for the delay.
This is a posting to a version of MEF that should address your issues with MEF with Metro style apps. Please give it a try and let us know what you think
thanks
-alokThursday, May 31, 2012 10:13 PM
Thanks alok,
I'm going to try it out, I will report you if it suits us or not.
MichaelFriday, June 1, 2012 3:15 PM
- DeletedTuesday, June 19, 2012 1:33 AM
- Hi Bill, great to hear you've checked it out! The Microsoft.Composition package can be installed in both Metro style apps as well as regular .NET 4.5 apps, so you should be able to use it in both cases with the same code. Hope this helps! NickFriday, June 22, 2012 8:52 PM
Hi everyone,
To address the original question, it is possible to register instances in the Metro version of MEF (Microsoft.Composition).
You need to use a small extension we provide as a sample in
This will enable syntax like:
configuration.WithExport<IFoo>(foo);
We will consider including this in the core in future, please send feedback on the extension if you have a chance to try it out.
Thanks!
Nick
Friday, June 22, 2012 8:59 PM
- Proposed as answer by Nicholas Blumhardt Friday, June 22, 2012 8:59 PM
- DeletedFriday, June 22, 2012 11:33 PM | https://social.msdn.microsoft.com/Forums/en-US/6aff302d-867a-4921-86ae-b8088c47560f/how-can-i-get-an-exported-value-in-mef-for-metro-style-apps?forum=winappswithcsharp | CC-MAIN-2019-47 | refinedweb | 854 | 60.75 |
block scope?
Discussion in 'Python' started by Neal Becker, Apr 6, 2007.
Page 1 of 2
Page 1 of 2
- Similar Threads
IMPORT STATIC; Why is "import static" file scope? Why not class scope?Paul Opal, Oct 9, 2004, in forum: Java
- Replies:
- 12
- Views:
- 1,228
- Paul Opal
- Oct 11, 2004
Scope - do I need two identical classes, each with different scope?ann, Sep 12, 2005, in forum: Java
- Replies:
- 13
- Views:
- 890
- Patricia Shanahan
- Sep 13, 2005
Fo:Block can you check to see if a block contains any text by using the block id?morrell, Oct 10, 2006, in forum: XML
- Replies:
- 1
- Views:
- 1,232
- roy axenov
- Oct 10, 2006
How do namespace scope and class scope differ?Steven T. Hatton, Jul 18, 2005, in forum: C++
- Replies:
- 9
- Views:
- 725
- Kev
- Jul 19, 2005
Re: Lexical scope vs. dynamic scopeXah Lee, Feb 26, 2009, in forum: Java
- Replies:
- 0
- Views:
- 2,481
- Xah Lee
- Feb 26, 2009
Store erb block and alter scope of erb block eval?Steve V, Apr 18, 2005, in forum: Ruby
- Replies:
- 6
- Views:
- 423
- Steve V
- Apr 20, 2005
CSPEC issue: lossing scope (or incorrect scope) in cspec subroutine., Feb 5, 2009, in forum: Perl Misc
- Replies:
- 0
- Views:
- 341
Having trouble understanding function scope and variable scopeAndrew Falanga, Nov 22, 2008, in forum: Javascript
- Replies:
- 2
- Views:
- 401
- Andrew Falanga
- Nov 22, 2008 | http://www.thecodingforums.com/threads/block-scope.497050/ | CC-MAIN-2016-40 | refinedweb | 234 | 74.02 |
I am a college student just starting out with java and I am working with pretty easy stuff here (I guess, lol), but im just trying to learn one bit at a time. I am just displaying my values in different ways and I can't seem to get my values to display one at time on new lines. I dont know why the \n isnt compiling. The part i am having trouble with has the "Not Working" tag in the code.
[highlight=Java]
//Trying to figure out how to use /n
public class Test
{
public static void main(String[] args)
{
int gold= 5;
int silver= 3;
int bronze= 1;
//Stacked titles
System.out.println(" gold\n silver\n bronze");
//Values stacked (not working)
System.out.print (gold\n silver\n bronze);
//Values side by side
System.out.println( gold + " " + silver + " " + bronze);
//Values added together
System.out.println(gold + silver + bronze);
}
} | http://www.javaprogrammingforums.com/%20whats-wrong-my-code/35830-easy-question-pro-printingthethread.html | CC-MAIN-2015-40 | refinedweb | 151 | 73.17 |
Analyzing the Stack Overflow SurveyMon 27 May 2019 by Moshe Zadka
The Stack Overflow Survey Results for 2019 are in! There is some official analysis, that mentioned some things that mattered to me, and some that did not. I decided to dig into the data and see if I can find some things that would potentially interest my readership.
import csv, collections, itertools
with open("survey_results_public.csv") as fpin: reader = csv.DictReader(fpin) responses = list(reader)
len(responses)
88883
Wow, almost 90K respondents! This is the sweet spots of "enough to make meaningful generalizations" while being able to analyze with rudimentary tools, not big-data-ware.
pythonistas = [x for x in responses if 'Python' in x['LanguageWorkedWith']]
len(pythonistas)/len(responses)
0.41001091322300104
About 40% of the respondents use Python in some capacity. That is pretty cool! This is one of the things where I wonder if there is bias in the source data. Are people who use Stack Overflow, or respond to surveys for SO, more likely to be the kind of person who uses Python? Or less?
In any case, I am excited! This means my favorite language, for all its issues, is doing well. This is also a good reminder that we need to think about the consequences of our decisions on a big swath of developers we will never ever meet.
opensource = collections.Counter(x['OpenSourcer'] for x in pythonistas)
sorted(opensource.items(), key=lambda x:x[1], reverse=True)
[('Never', 11310), ('Less than once per year', 10374), ('Less than once a month but more than once per year', 9572), ('Once a month or more often', 5187)]
opensource['Once a month or more often']/len(pythonistas)
0.1423318607139917
Python is open source. Almost all important libraries (Django, Pandas, PyTorch, requests) are open source. Many important tools (Jupyter) are open source. The number of people who contribute to them with any kind of regular cadence is less than 15%.
general_opensource = collections.Counter(x['OpenSourcer'] for x in responses) sorted(general_opensource.items(), key=lambda x:x[1], reverse=True)
[('Never', 32295), ('Less than once per year', 24972), ('Less than once a month but more than once per year', 20561), ('Once a month or more often', 11055)]
The Python community does compare well to the general populace, though!
devtype = collections.Counter(itertools.chain.from_iterable(x["DevType"].split(";") for x in pythonistas))
devtype['DevOps specialist']/len(responses)
0.052282213696657406
About 5% of total respondents are my peers: using Python for DevOps. That is pretty exciting! My interest in that is not merely theoretical, my upcoming book targets that crowd.
general_devtype = collections.Counter(itertools.chain.from_iterable(x["DevType"].split(";") for x in responses)) general_devtype['DevOps specialist']/len(responses), devtype['DevOps specialist']/len(pythonistas)
(0.09970410539698255, 0.12751420025793705)
In general, DevOps specialists are 10% of respondents.
devtype['DevOps specialist']/general_devtype['DevOps specialist']
0.524373730534868
Over 50% of DevOps specialists use Python!
def safe_int(x): try: return int(x) except ValueError: return -1 intermediate = sum(1 for x in pythonistas if 1<=safe_int(x['YearsCode'])<=5)
My next hush-hush (for now!) project is going to be targeting intermediate Python developers. I wish I could slice by "number of years writing in Python, but this is the best I could do. (I treat "NA" responses as "not intermediate". This is OK, since I prefer to underestimate rather than overestimate.)
intermediate/len(responses)
0.11346376697456206
11%! Not bad.
general_intermediate = sum(1 for x in responses if 1<=safe_int(x['YearsCode'])<=5) intermediate/len(pythonistas), general_intermediate/len(responses)
(0.27673352907279863, 0.2671264471271222)
Seems like using Python does not change much the chances of someone being intermediate.
Summary
- 40% of respondents use Python. Python is kind of a big deal.
- 5% of respondents use Python for DevOps. This is a lot! DevOps as a profession is less than 10 years old.
- 11% of respondents are intermediate Python users. My previous book targets this crowd.
(Thanks to Robert Collins and Matthew Broberg for their comments on an earlier draft. Any remaining issues are purely my responsibility.) | https://orbifold.xyz/python-analysis.html | CC-MAIN-2020-24 | refinedweb | 669 | 50.43 |
-forward a few months and our frustration with the SSRS-derived client reports available in .NET has come to a head. For our needs (basic ‘fact sheet’ type reports about entities) they are absurdly slow and support for them within Visual Studio is awful due to the lag between RDL and RDLC dialects. Coming from more of a web development background, I naturally gravitated towards something HTML based. I’ve had pretty good success with NHaml and Spark in ASP.net MVC before, so I looked at them, but found a need to reference System.Web along with both, which is a deal breaker (we’re looking to use these in a WinForms client application).
Enter Razor
All this searching led me back to Razor, the same view engine I’d said ‘meh’ to when it was first released. What immediately jumped out at me was a feature that I’d missed the first time around, namely that it can run outside an asp.net app domain for testability. It can be invoked rather easily from code too:
string template = "Hello @Model.Name! Welcome to Razor!"; string result = Razor.Parse(template, new { Name = "World" });
This certainly looked promising, so I set up a WinForms project to try it out. Sure enough, it worked against the client profile, and about as easily as I could have hoped. The key seems to be that it brings all of the web components it needs along for the ride in the included System.Web.Razor assembly.
The main calls to the static “Razor” class that we’re concerned with are:
string Parse<T> (template, model); void Compile (template, type, name); string Run<T> (model, name);
These methods don’t include everything available (such as the non-generic parse method used above) but everything we’ll need. As I think the quoted example above shows, Razor.Parse compiles the supplied template and processes it using the model supplied. The generic version does the same thing, only with a strongly-typed model. Compile and Run are provided for more complex views, where it makes sense to compile once and run several times. As easy as this all is, we can’t have static calls to Razor throughout our codebase. This post will mainly cover a bit of infrastructure I put around the Razor engine to make it a bit more user friendly.
Encapsulating the Engine
I wanted this code to be at least a bit testable, so I put an interface comprised of the three methods listed above around the static engine. Implementation is as you’d expect:
using RazorEngine; namespace RazorReport { public class Engine<T> : IEngine<T> { public void Compile (string preparedTemplate, string name) { Razor.Compile (preparedTemplate, typeof (T), name); } public string Run (T model, string name) { return Razor.Run<T> (model, name); } public string Parse (string template, T model) { return Razor.Parse<T> (template, model); } } }
This makes it easy to confirm that the report building classes we’ll implement are interacting with the engine as expected later, ie:
[Test] public void Recompiles_If_Stylesheet_Changed () { var mockery = new MockRepository (); var engine = mockery.StrictMock<IEngine<Example>> (); var templateName = "recompileIfChange"; var template = "template"; var css = "STYLES"; var model = new Example (); using (mockery.Record ()) { engine.Compile (template, templateName); LastCall.Repeat.Twice (); Expect.Call (engine.Run (model, templateName)).Repeat.Twice ().Return ("return"); } using (mockery.Playback ()) { var builder = ReportBuilder<Example>.CreateWithEngineInstance (templateName, engine) .WithTemplate (template) .WithPrecompilation (); builder.BuildReport (model); builder = builder.WithCss (css); builder.BuildReport (model); } }
At first I kind of lamented the fact that this stuff is offered through a static class (primarily for testability reasons) but kind of came around after a while. I’m sure having the engine static helps keep performance acceptable, and I’d rather be able to easily define a simple interface like this than be stuck with an interface that doesn’t quite do what I’d like.
Finding Templates
The other bit of code we need before getting started is a means of finding templates, both those included as embedded resources and those on the file system:
using System.IO; using System.Reflection; namespace RazorReport { class TemplateFinder { public static string GetTemplateFromResource (string resourceName, Assembly assembly) { using (var stream = assembly.GetManifestResourceStream (resourceName)) using (TextReader reader = new StreamReader (stream)) { return reader.ReadToEnd (); } } public static string GetTemplateFromFileSystem (string templatePath) { return File.ReadAllText (templatePath); } } }
I guess you could argue that this needs to be a non-static class with an interface for testability. And you’d be right. But I am not sure I’d be convinced that it’s needed.
Building Reports
I think the idea of using a fluent interface for report builder configuration came up in a conversation with my usual remote pairing partner. The idea is that you would set up a report builder like this:
var builder = ReportBuilder.Create<Foo>() .WithTemplate("template") .WithStylesheet("stylesheet") .WithPrecompilation();
Or something along those lines. It seemed to work well enough so I rolled with it. The complete interface looks like this:
using System.Reflection; namespace RazorReport { public interface IReportBuilder<T> { IReportBuilder<T> WithTemplate (string template); IReportBuilder<T> WithCss (string css); IReportBuilder<T> WithTemplateFromFileSystem (string templatePath); IReportBuilder<T> WithCssFromFileSystem (string cssPath); IReportBuilder<T> WithTemplateFromResource (string resourceName, Assembly assembly); IReportBuilder<T> WithCssFromResource (string resourceName, Assembly assembly); IReportBuilder<T> WithPrecompilation (); string BuildReport (T model); } }
The only thing added was some methods to get templates / stylesheets from the file system or embedded resources if needed. I thought about (and continue to think about) adding some kind of base template functionality, but I haven’t quite settled on how it should work so I’ve left it out for now. There is definitely some interesting stuff in Razor that could help with this though.
There isn’t time to cover everything, but calling BuildReport sends you through the following methods:
public string BuildReport (T model) { return precompile ? CompiledReport (model) : Report (model); } string CompiledReport (T model) { if (needsCompilation) { engine.Compile (PrepareTemplate (), name); needsCompilation = false; } return engine.Run (model, name); } string Report (T model) { return engine.Parse (PrepareTemplate (), model); }
The needsCompilation flag gets flipped whenever the template or stylesheet gets changed, to ensure that any template modifications are picked up when using precompilation.
Enough Already, Where’s the Code?
If you’re interested in taking a look what I’ve got so far is over at github. It’s still a work in progress, and may undergo significant change. I tagged the current state just so it will reflect what’s discussed here, but the trunk may be more interesting. Feel free to offer suggestions that would make it more useful to you. They will always be considered (especially if submitted as pull requests 🙂 )
I am looking at you razor report engine, and wondering if there is an easy way to do sub reports, or embedded reports.
Any thoughts.
Thanks
Did you got any memory leak issues with large resultsets using Razor Engine? | http://blogs.lessthandot.com/index.php/desktopdev/mstech/csharp/using-razor-as-an-embedded/ | CC-MAIN-2017-22 | refinedweb | 1,139 | 55.24 |
r""" Sparse distributed elements of free modules over multivariate (generalized) polynomial rings. This code and its data structures are very much like the distributed polynomials, except that the first "exponent" of the monomial is a module generator index. That is, the multi-exponent ``(i, e_1, ..., e_n)`` represents the "monomial" `x_1^{e_1} \dots x_n^{e_n} f_i` of the free module `F` generated by `f_1, \dots, f_r` over (a localization of) the ring `K[x_1, \dots, x_n]`. A module element is simply stored as a list of terms ordered by the monomial order. Here a term is a pair of a multi-exponent and a coefficient. In general, this coefficient should never be zero (since it can then be omitted). The zero module element is stored as an empty list. The main routines are ``sdm_nf_mora`` and ``sdm_groebner`` which can be used to compute, respectively, weak normal forms and standard bases. They work with arbitrary (not necessarily global) monomial orders. In general, product orders have to be used to construct valid monomial orders for modules. However, ``lex`` can be used as-is. Note that the "level" (number of variables, i.e. parameter u+1 in distributedpolys.py) is never needed in this code. The main reference for this file is [SCA], "A Singular Introduction to Commutative Algebra". """ from __future__ import print_function, division from itertools import permutations from sympy.polys.monomials import ( monomial_mul, monomial_lcm, monomial_div, monomial_deg, monomial_divides ) from sympy.polys.polytools import Poly from sympy.polys.polyutils import parallel_dict_from_expr from sympy import S, sympify # Additional monomial tools.[docs]def sdm_monomial_mul(M, X): """ Multiply tuple ``X`` representing a monomial of `K[X]` into the tuple ``M`` representing a monomial of `F`. Examples ======== Multiplying `xy^3` into `x f_1` yields `x^2 y^3 f_1`: >>> from sympy.polys.distributedmodules import sdm_monomial_mul >>> sdm_monomial_mul((1, 1, 0), (1, 3)) (1, 2, 3) """ return (M[0],) + monomial_mul(X, M[1:])[docs]def sdm_monomial_deg(M): """ Return the total degree of ``M``. Examples ======== For example, the total degree of `x^2 y f_5` is 3: >>> from sympy.polys.distributedmodules import sdm_monomial_deg >>> sdm_monomial_deg((5, 2, 1)) 3 """ return monomial_deg(M[1:])def sdm_monomial_lcm(A, B): """ Return the "least common multiple" of ``A`` and ``B``. IF `A = M e_j` and `B = N e_j`, where `M` and `N` are polynomial monomials, this returns `\lcm(M, N) e_j`. Note that ``A`` and ``B`` involve distinct monomials. Otherwise the result is undefined. >>> from sympy.polys.distributedmodules import sdm_monomial_lcm >>> sdm_monomial_lcm((1, 2, 3), (1, 0, 5)) (1, 2, 5) """ return (A[0],) + monomial_lcm(A[1:], B[1:])[docs]def sdm_monomial_divides(A, B): """ Does there exist a (polynomial) monomial X such that XA = B? Examples ======== Positive examples: In the following examples, the monomial is given in terms of x, y and the generator(s), f_1, f_2 etc. The tuple form of that monomial is used in the call to sdm_monomial_divides. Note: the generator appears last in the expression but first in the tuple and other factors appear in the same order that they appear in the monomial expression. `A = f_1` divides `B = f_1` >>> from sympy.polys.distributedmodules import sdm_monomial_divides >>> sdm_monomial_divides((1, 0, 0), (1, 0, 0)) True `A = f_1` divides `B = x^2 y f_1` >>> sdm_monomial_divides((1, 0, 0), (1, 2, 1)) True `A = xy f_5` divides `B = x^2 y f_5` >>> sdm_monomial_divides((5, 1, 1), (5, 2, 1)) True Negative examples: `A = f_1` does not divide `B = f_2` >>> sdm_monomial_divides((1, 0, 0), (2, 0, 0)) False `A = x f_1` does not divide `B = f_1` >>> sdm_monomial_divides((1, 1, 0), (1, 0, 0)) False `A = xy^2 f_5` does not divide `B = y f_5` >>> sdm_monomial_divides((5, 1, 2), (5, 0, 1)) False """ return A[0] == B[0] and all(a <= b for a, b in zip(A[1:], B[1:])) # The actual distributed modules code.[docs]def sdm_LC(f, K): """Returns the leading coeffcient of ``f``. """ if not f: return K.zero else: return f[0][1][docs]def sdm_from_dict(d, O): """ Create an sdm from a dictionary. Here ``O`` is the monomial order to use. >>> from sympy.polys.distributedmodules import sdm_from_dict >>> from sympy.polys import QQ, lex >>> dic = {(1, 1, 0): QQ(1), (1, 0, 0): QQ(2), (0, 1, 0): QQ(0)} >>> sdm_from_dict(dic, lex) [((1, 1, 0), 1), ((1, 0, 0), 2)] """ return sdm_strip(sdm_sort(list(d.items()), O))def sdm_sort(f, O): """Sort terms in ``f`` using the given monomial order ``O``. """ return sorted(f, key=lambda term: O(term[0]), reverse=True) def sdm_strip(f): """Remove terms with zero coefficients from ``f`` in ``K[X]``. """ return [ (monom, coeff) for monom, coeff in f if coeff ][docs]def sdm_add(f, g, O, K): """ Add two module elements ``f``, ``g``. Addition is done over the ground field ``K``, monomials are ordered according to ``O``. Examples ======== All examples use lexicographic order. `(xy f_1) + (f_2) = f_2 + xy f_1` >>> from sympy.polys.distributedmodules import sdm_add >>> from sympy.polys import lex, QQ >>> sdm_add([((1, 1, 1), QQ(1))], [((2, 0, 0), QQ(1))], lex, QQ) [((2, 0, 0), 1), ((1, 1, 1), 1)] `(xy f_1) + (-xy f_1)` = 0` >>> sdm_add([((1, 1, 1), QQ(1))], [((1, 1, 1), QQ(-1))], lex, QQ) [] `(f_1) + (2f_1) = 3f_1` >>> sdm_add([((1, 0, 0), QQ(1))], [((1, 0, 0), QQ(2))], lex, QQ) [((1, 0, 0), 3)] `(yf_1) + (xf_1) = xf_1 + yf_1` >>> sdm_add([((1, 0, 1), QQ(1))], [((1, 1, 0), QQ(1))], lex, QQ) [((1, 1, 0), 1), ((1, 0, 1), 1)] """ h = dict(f) for monom, c in g: if monom in h: coeff = h[monom] + c if not coeff: del h[monom] else: h[monom] = coeff else: h[monom] = c return sdm_from_dict(h, O)[docs]def sdm_LM(f): r""" Returns the leading monomial of ``f``. Only valid if `f \ne 0`. Examples ======== >>> from sympy.polys.distributedmodules import sdm_LM, sdm_from_dict >>> from sympy.polys import QQ, lex >>> dic = {(1, 2, 3): QQ(1), (4, 0, 0): QQ(1), (4, 0, 1): QQ(1)} >>> sdm_LM(sdm_from_dict(dic, lex)) (4, 0, 1) """ return f[0][0][docs]def sdm_LT(f): r""" Returns the leading term of ``f``. Only valid if `f \ne 0`. Examples ======== >>> from sympy.polys.distributedmodules import sdm_LT, sdm_from_dict >>> from sympy.polys import QQ, lex >>> dic = {(1, 2, 3): QQ(1), (4, 0, 0): QQ(2), (4, 0, 1): QQ(3)} >>> sdm_LT(sdm_from_dict(dic, lex)) ((4, 0, 1), 3) """ return f[0][docs]def sdm_mul_term(f, term, O, K): """ Multiply a distributed module element ``f`` by a (polynomial) term ``term``. Multiplication of coefficients is done over the ground field ``K``, and monomials are ordered according to ``O``. Examples ======== `0 f_1 = 0` >>> from sympy.polys.distributedmodules import sdm_mul_term >>> from sympy.polys import lex, QQ >>> sdm_mul_term([((1, 0, 0), QQ(1))], ((0, 0), QQ(0)), lex, QQ) [] `x 0 = 0` >>> sdm_mul_term([], ((1, 0), QQ(1)), lex, QQ) [] `(x) (f_1) = xf_1` >>> sdm_mul_term([((1, 0, 0), QQ(1))], ((1, 0), QQ(1)), lex, QQ) [((1, 1, 0), 1)] `(2xy) (3x f_1 + 4y f_2) = 8xy^2 f_2 + 6x^2y f_1` >>> f = [((2, 0, 1), QQ(4)), ((1, 1, 0), QQ(3))] >>> sdm_mul_term(f, ((1, 1), QQ(2)), lex, QQ) [((2, 1, 2), 8), ((1, 2, 1), 6)] """ X, c = term if not f or not c: return [] else: if K.is_one(c): return [ (sdm_monomial_mul(f_M, X), f_c) for f_M, f_c in f ] else: return [ (sdm_monomial_mul(f_M, X), f_c * c) for f_M, f_c in f ][docs]def sdm_deg(f): """ Degree of ``f``. This is the maximum of the degrees of all its monomials. Invalid if ``f`` is zero. Examples ======== >>> from sympy.polys.distributedmodules import sdm_deg >>> sdm_deg([((1, 2, 3), 1), ((10, 0, 1), 1), ((2, 3, 4), 4)]) 7 """ return max(sdm_monomial_deg(M[0]) for M in f) # Conversion[docs]def sdm_from_vector(vec, O, K, **opts): """ Create an sdm from an iterable of expressions. Coefficients are created in the ground field ``K``, and terms are ordered according to monomial order ``O``. Named arguments are passed on to the polys conversion code and can be used to specify for example generators. Examples ======== >>> from sympy.polys.distributedmodules import sdm_from_vector >>> from sympy.abc import x, y, z >>> from sympy.polys import QQ, lex >>> sdm_from_vector([x**2+y**2, 2*z], lex, QQ) [((1, 0, 0, 1), 2), ((0, 2, 0, 0), 1), ((0, 0, 2, 0), 1)] """ dics, gens = parallel_dict_from_expr(sympify(vec), **opts) dic = {} for i, d in enumerate(dics): for k, v in d.items(): dic[(i,) + k] = K.convert(v) return sdm_from_dict(dic, O)[docs]def sdm_to_vector(f, gens, K, n=None): """ Convert sdm ``f`` into a list of polynomial expressions. The generators for the polynomial ring are specified via ``gens``. The rank of the module is guessed, or passed via ``n``. The ground field is assumed to be ``K``. Examples ======== >>> from sympy.polys.distributedmodules import sdm_to_vector >>> from sympy.abc import x, y, z >>> from sympy.polys import QQ, lex >>> f = [((1, 0, 0, 1), QQ(2)), ((0, 2, 0, 0), QQ(1)), ((0, 0, 2, 0), QQ(1))] >>> sdm_to_vector(f, [x, y, z], QQ) [x**2 + y**2, 2*z] """ dic = sdm_to_dict(f) dics = {} for k, v in dic.items(): dics.setdefault(k[0], []).append((k[1:], v)) n = n or len(dics) res = [] for k in range(n): if k in dics: res.append(Poly(dict(dics[k]), gens=gens, domain=K).as_expr()) else: res.append(S.Zero) return res # Algorithms.[docs]def sdm_spoly(f, g, O, K, phantom=None): """ Compute the generalized s-polynomial of ``f`` and ``g``. The ground field is assumed to be ``K``, and monomials ordered according to ``O``. This is invalid if either of ``f`` or ``g`` is zero. If the leading terms of `f` and `g` involve different basis elements of `F`, their s-poly is defined to be zero. Otherwise it is a certain linear combination of `f` and `g` in which the leading terms cancel. See [SCA, defn 2.3.6] for details. If ``phantom`` is not ``None``, it should be a pair of module elements on which to perform the same operation(s) as on ``f`` and ``g``. The in this case both results are returned. Examples ======== >>> from sympy.polys.distributedmodules import sdm_spoly >>> from sympy.polys import QQ, lex >>> f = [((2, 1, 1), QQ(1)), ((1, 0, 1), QQ(1))] >>> g = [((2, 3, 0), QQ(1))] >>> h = [((1, 2, 3), QQ(1))] >>> sdm_spoly(f, h, lex, QQ) [] >>> sdm_spoly(f, g, lex, QQ) [((1, 2, 1), 1)] """ if not f or not g: return sdm_zero() LM1 = sdm_LM(f) LM2 = sdm_LM(g) if LM1[0] != LM2[0]: return sdm_zero() LM1 = LM1[1:] LM2 = LM2[1:] lcm = monomial_lcm(LM1, LM2) m1 = monomial_div(lcm, LM1) m2 = monomial_div(lcm, LM2) c = K.quo(-sdm_LC(f, K), sdm_LC(g, K)) r1 = sdm_add(sdm_mul_term(f, (m1, K.one), O, K), sdm_mul_term(g, (m2, c), O, K), O, K) if phantom is None: return r1 r2 = sdm_add(sdm_mul_term(phantom[0], (m1, K.one), O, K), sdm_mul_term(phantom[1], (m2, c), O, K), O, K) return r1, r2[docs]def sdm_ecart(f): """ Compute the ecart of ``f``. This is defined to be the difference of the total degree of `f` and the total degree of the leading monomial of `f` [SCA, defn 2.3.7]. Invalid if f is zero. Examples ======== >>> from sympy.polys.distributedmodules import sdm_ecart >>> sdm_ecart([((1, 2, 3), 1), ((1, 0, 1), 1)]) 0 >>> sdm_ecart([((2, 2, 1), 1), ((1, 5, 1), 1)]) 3 """ return sdm_deg(f) - sdm_monomial_deg(sdm_LM(f))[docs]def sdm_nf_mora(f, G, O, K, phantom=None): r""" Compute a weak normal form of ``f`` with respect to ``G`` and order ``O``. The ground field is assumed to be ``K``, and monomials ordered according to ``O``. Weak normal forms are defined in [SCA, defn 2.3.3]. They are not unique. This function deterministically computes a weak normal form, depending on the order of `G`. The most important property of a weak normal form is the following: if `R` is the ring associated with the monomial ordering (if the ordering is global, we just have `R = K[x_1, \dots, x_n]`, otherwise it is a certain localization thereof), `I` any ideal of `R` and `G` a standard basis for `I`, then for any `f \in R`, we have `f \in I` if and only if `NF(f | G) = 0`. This is the generalized Mora algorithm for computing weak normal forms with respect to arbitrary monomial orders [SCA, algorithm 2.3: # TODO better data structure!!! Th = [(g, sdm_ecart(g), gp) for g, gp in zip(T, Tp) if sdm_monomial_divides(sdm_LM(g), sdm_LM(h))] if not Th: break g, _, gp = min(Th, key=lambda x: x[1]) if sdm_ecart(g) > sdm_ecart(h): T.append(h) if phantom: Tp.append(hp) if phantom: h, hp = sdm_spoly(h, g, O, K, phantom=(hp, gp)) else: h = sdm_spoly(h, g, O, K) if phantom: return h, hp return hdef sdm_nf_buchberger(f, G, O, K, phantom=None): r""" Compute a weak normal form of ``f`` with respect to ``G`` and order ``O``. The ground field is assumed to be ``K``, and monomials ordered according to ``O``. This is the standard Buchberger algorithm for computing weak normal forms with respect to *global* monomial orders [SCA, algorithm 1.6: try: g, gp = next((g, gp) for g, gp in zip(T, Tp) if sdm_monomial_divides(sdm_LM(g), sdm_LM(h))) except StopIteration: break if phantom: h, hp = sdm_spoly(h, g, O, K, phantom=(hp, gp)) else: h = sdm_spoly(h, g, O, K) if phantom: return h, hp return h def sdm_nf_buchberger_reduced(f, G, O, K): r""" Compute a reduced normal form of ``f`` with respect to ``G`` and order ``O``. The ground field is assumed to be ``K``, and monomials ordered according to ``O``. In contrast to weak normal forms, reduced normal forms *are* unique, but their computation is more expensive. This is the standard Buchberger algorithm for computing reduced normal forms with respect to *global* monomial orders [SCA, algorithm 1.6.11]. The ``pantom`` option is not supported, so this normal form cannot be used as a normal form for the "extended" groebner algorithm. """ h = sdm_zero() g = f while g: g = sdm_nf_buchberger(g, G, O, K) if g: h = sdm_add(h, [sdm_LT(g)], O, K) g = g[1:] return h[docs]def sdm_groebner(G, NF, O, K, extended=False): """ Compute a minimal standard basis of ``G`` with respect to order ``O``. The algorithm uses a normal form ``NF``, for example ``sdm_nf_mora``. The ground field is assumed to be ``K``, and monomials ordered according to ``O``. Let `N` denote the submodule generated by elements of `G`. A standard basis for `N` is a subset `S` of `N`, such that `in(S) = in(N)`, where for any subset `X` of `F`, `in(X)` denotes the submodule generated by the initial forms of elements of `X`. [SCA, defn 2.3.2] A standard basis is called minimal if no subset of it is a standard basis. One may show that standard bases are always generating sets. Minimal standard bases are not unique. This algorithm computes a deterministic result, depending on the particular order of `G`. If ``extended=True``, also compute the transition matrix from the initial generators to the groebner basis. That is, return a list of coefficient vectors, expressing the elements of the groebner basis in terms of the elements of ``G``. This functions implements the "sugar" strategy, see Giovini et al: "One sugar cube, please" OR Selection strategies in Buchberger algorithm. """ # The critical pair set. # A critical pair is stored as (i, j, s, t) where (i, j) defines the pair # (by indexing S), s is the sugar of the pair, and t is the lcm of their # leading monomials. P = [] # The eventual standard basis. S = [] Sugars = [] def Ssugar(i, j): """Compute the sugar of the S-poly corresponding to (i, j).""" LMi = sdm_LM(S[i]) LMj = sdm_LM(S[j]) return max(Sugars[i] - sdm_monomial_deg(LMi), Sugars[j] - sdm_monomial_deg(LMj)) \ + sdm_monomial_deg(sdm_monomial_lcm(LMi, LMj)) ourkey = lambda p: (p[2], O(p[3]), p[1]) def update(f, sugar, P): """Add f with sugar ``sugar`` to S, update P.""" if not f: return P k = len(S) S.append(f) Sugars.append(sugar) LMf = sdm_LM(f) def removethis(pair): i, j, s, t = pair if LMf[0] != t[0]: return False tik = sdm_monomial_lcm(LMf, sdm_LM(S[i])) tjk = sdm_monomial_lcm(LMf, sdm_LM(S[j])) return tik != t and tjk != t and sdm_monomial_divides(tik, t) and \ sdm_monomial_divides(tjk, t) # apply the chain criterion P = [p for p in P if not removethis(p)] # new-pair set N = [(i, k, Ssugar(i, k), sdm_monomial_lcm(LMf, sdm_LM(S[i]))) for i in range(k) if LMf[0] == sdm_LM(S[i])[0]] # TODO apply the product criterion? N.sort(key=ourkey) remove = set() for i, p in enumerate(N): for j in range(i + 1, len(N)): if sdm_monomial_divides(p[3], N[j][3]): remove.add(j) # TODO mergesort? P.extend(reversed([p for i, p in enumerate(N) if not i in remove])) P.sort(key=ourkey, reverse=True) # NOTE reverse-sort, because we want to pop from the end return P # Figure out the number of generators in the ground ring. try: # NOTE: we look for the first non-zero vector, take its first monomial # the number of generators in the ring is one less than the length # (since the zeroth entry is for the module generators) numgens = len(next(x[0] for x in G if x)[0]) - 1 except StopIteration: # No non-zero elements in G ... if extended: return [], [] return [] # This list will store expressions of the elements of S in terms of the # initial generators coefficients = [] # First add all the elements of G to S for i, f in enumerate(G): P = update(f, sdm_deg(f), P) if extended and f: coefficients.append(sdm_from_dict({(i,) + (0,)*numgens: K(1)}, O)) # Now carry out the buchberger algorithm. while P: i, j, s, t = P.pop() f, sf, g, sg = S[i], Sugars[i], S[j], Sugars[j] if extended: sp, coeff = sdm_spoly(f, g, O, K, phantom=(coefficients[i], coefficients[j])) h, hcoeff = NF(sp, S, O, K, phantom=(coeff, coefficients)) if h: coefficients.append(hcoeff) else: h = NF(sdm_spoly(f, g, O, K), S, O, K) P = update(h, Ssugar(i, j), P) # Finally interreduce the standard basis. # (TODO again, better data structures) S = set((tuple(f), i) for i, f in enumerate(S)) for (a, ai), (b, bi) in permutations(S, 2): A = sdm_LM(a) B = sdm_LM(b) if sdm_monomial_divides(A, B) and (b, bi) in S and (a, ai) in S: S.remove((b, bi)) L = sorted(((list(f), i) for f, i in S), key=lambda p: O(sdm_LM(p[0])), reverse=True) res = [x[0] for x in L] if extended: return res, [coefficients[i] for _, i in L] return res | http://docs.sympy.org/0.7.6/_modules/sympy/polys/distributedmodules.html | CC-MAIN-2018-30 | refinedweb | 3,109 | 54.22 |
|
Membership
Technical Assistance
|
Updates
| News
Archive
|
Links
Vietnam
Says It Still Hopes For WTO Entry In 2005
DOW JONES NEWSWIRES
June 24, 2004 9:46 a.m.
HANOI (AP)--Vietnam on Thursday
downplayed the World Trade Organization's assertion that it wouldn't be ready
to join the body by the start of next year, saying its goal is to join
sometime in 2005.
"Vietnam strives to join the WTO
as soon as possible, in 2005 if possible," Foreign Ministry spokesman Le
Dung said. "In the past, Vietnam has set the target of joining WTO by
2005, but it does not necessarily mean Jan. 1."
During Vietnam's most recent round of
talks with WTO officials in Geneva, it was praised for submitting a better
plan for trade liberalization, but officials said Hanoi still needs to amend
its laws and reach bilateral agreements with member states.
"Vietnam is not going to achieve
its earlier ambition to join by Jan 1, 2005," the WTO said in a written
summary of the meetings released last week.
Hanoi has offered to reduce its average
import duties to 18%, but several countries still are concerned that it
subsidizes some exports and restricts the amount of imports it will accept.
Negotiators plan to meet again in
December. It is still possible for Vietnam to join in 2005 if it completes all
its procedures.
The 2005 deadline is particularly
crucial for Vietnam, since its textile and garment industry - the country's
second largest source of exports - is subject to quotas until it joins the
147-member world trade body. The quota system will be dropped. | http://old.usvtc.org/News/2004/June%202004/vietnam_says_it_still_hopes_for_.htm | crawl-001 | refinedweb | 269 | 64.34 |
I am extracting two feature responses from two separate machine/deep-learning frameworks. I now have two matrices that have NxF dimensions where N is the number of samples and F is the number of features. I want to do a comparison of how similar the learned features are. I have tried several things, but the main idea is using correlation (tried Pearson and Spearman) to correlate the feature responses into a FxF matrix. I then take the absolute value, max across a single axis, and then compute the mean of those max values. I actually have several frameworks that I would like to compare, but I am getting very similar results. Has anybody done this? Does anyone else have any better suggestions? My code sample is below.
from scipy.stats import spearmanr
import numpy as np
def similarity(resp1, resp2):
rho, p = spearmanr(resp1,resp2)
corr = rho[:resp1.shape[1],resp1.shape[1]:]
sim_mtrx = np.abs(corr)
feature_match = np.max(sim_mtrx,axis=1)
return np.mean(feature_match)
Has anybody done this? Does anyone else have any better suggestions? My code sample is below.
To be honest this makes no sense. Why? Because there is no ordering in features in things like deep nets. Consequently comparison you are doing cannot be used to draw any reasonable conclusions. Your matrix
N x F is probably your weight matrix from your first layer. Consequently each of (column) vectors of these matrices represent a single neuron. The trick is -
ith neuron in one network (trained with one framework) can has nothing to do with
ith neuron in the other one, while it might be identical to
jth. For example consider a network trained on images with
F=3, you might find that these neurons learned to detect horizontal (neuron 1), vertical (neuron 2) lines and maybe a circle (neuron 3). Now you train again, either with different framework, or even with the same one but different random seed. Now even if this second network learns exactly the same thing - to detect horizontal line, vertical one and a circle - but simply in different neurons (like horizontal-2, vertical-3, circle-1) your method will claim that these are completely different models, which is obviously false. The problem of "having similar representations" is a research direction on its own.
The minimum you have to do is to find best matching between neurons in two networks, before applying basic analysis you are proposing. You can do this by brute forcing (F^2 possible mappings, just take the one claiming the biggest similarity) or use something like Hungarian algorithm to find perfect matching.
The most imporatnt thing is to keep reference comparison, to avoid problems like the above, so instead of training a single model per framework, train at least 2 per framework. And now instead of claiming "method A and B produce (dis)similar representations because representations generated by a single experiment with A and B are (dis)similar" you should check whether there is a statisticaly significant difference between (dis)similarity between two runs (with different seeds) of the same algorithm and single runs of two different algorithms, in other words:
Just to show why the metric considered is wrong, lets use it on:
>>> x array([[0, 3, 6], [1, 4, 7], [2, 5, 8]]) >>> y array([[ 6, 0, 0], [ 7, -1, -123], [ 8, 0, 1000]]) >>> similarity(x,y) 1.0
You end up with just a single match, you do not care that 90% of data is completely different - you still report maximum similarity. | https://codedump.io/share/7w8jrkvwBptL/1/comparing-feature-responses-from-two-deep-learning-frameworks | CC-MAIN-2017-51 | refinedweb | 590 | 53.21 |
Both Object-Oriented Programming and Functional paradigms of programming operate on the same principle - Separation of Concerns. While Object-Oriented Programming does this by combining properties and their actions in a
class, functional programming keeps properties and their actions separate and use functions to perform actions on objects.
Today, I explored the functional programming concepts as applied to Python and looked at how we can implement functional programming techniques to organize Python code.
In the developer universe, there is often a debate between which style of programming paradigm is better. While many have strong opinions about either writing pure Object Oriented code or pure functional code. The more pragmatic approach is to understand the benefits of both paradigms along with their caveats and embrace the best of both worlds whenever necessary.
Here are some of the important concepts of functional programming and their implementation in Python.
Pure Functions
Pure functions are the heart and soul of functional programming just like classes and objects are of Object-Oriented programming.
A pure function is a function that follows these two rules:
- If provided the same input, it will return the same output always.
- It does not result in any side-effects.
Side-Effects generally mean changing data outside the scope of the function such as printing to console, doing a network request, making a database change, accessing a global variable etc.
def doubler(num): ''' Accepts a number and multiplies it by 2 ''' return num * 2 print(doubler(5))
def emoji_appender(list, emoji): ''' Accepts a list and a emoji and appends to every item of list ''' new_list = [] for item in list: new_list.append(str(item) + emoji) return new_list print(emoji_appender([1,2,3], '😀')) # ['1😀', '2😀', '3😀'] print(emoji_appender(['alpha','beta','gamma'], '😀')) # ['alpha😀', 'beta😀', 'gamma😀']
What are the benefits of Pure Functions?
A pure function should ideally perform only a single, specific action. Since pure functions always return the same output, provided the same input, they are very easy to test as they are predictable. This predictability feature always allows several pure functions to be run in parallel as they don't have in side-effects. It makes code easier to read and understand.
Some important built-in functions
Python comes with some built-in set of functions that allows code to be written in a functional style or in a more declarative way. These functions being pure, do not modify the input data either create any side-effects.
- map()
map function takes a function as the first argument that does some kind of action and an iterable as the second argument. It basically loops over each item of the iterable and applies the passed function.
numbers = [1,2,3,4,5] def multiply_by5(num): return num * 5 result = map(multiply_by5, numbers) print(result) # <map object at 0x7f572dcb7730> (Memory location of the map object) print(list(result)) # [5, 10, 15, 20, 25] (to get the updated list) print(numbers) # [1,2,3,4,5] (Unmodified)`
map function returns a reference to the memory location of the
map object. To get the resultant data, it needs to be passed as an argument to the list function. An important thing to note about the
map function is the input and output of the function has the same length.
map does not modify the input iterable.
- filter()
filter, as the name suggests filters an input iterable data based on the passed function
color_to_remove = 'red' colors = ['blue', 'green', 'black', 'red'] def remove_color(color): return color != color_to_remove result = filter(remove_color, colors) print(list(result)) # ['blue', 'green', 'black'] print(colors) # ['blue', 'green', 'black', 'red'] (Unmodified)
just like
map,
filter function returns the reference to the address in the memory where the filter object is stored and to get the actual result it needs to be passed to the list function. The length of the output can be equal or less than that of the input depending on the condition.
filter also does not change or mutate the input data
- zip()
The
zip built-in function accepts multiple iterables and groups or zips them as tuples. This kind of feature can be very helpful in scenarios when different user data are stored in different columns in a database and they need to combined together based on their relationship.
emails = ['alan@gmail.com', 'ross@gmail.com'] usernames = ['alan', 'ross'] users = list(zip(emails,usernames)) print(users) # [('alan@gmail.com', 'alan'), ('ross@gmail.com', 'ross')] print(emails) # ['alan@gmail.com', 'ross@gmail.com'] (Unmodified) print(usernames) # ['alan', 'ross']
- reduce()
reduce is a bit different from the other functions mentioned above.
reduce is not a part of the built-in python functions. It is a part of a package or a toolbelt that gets downloaded along with the python interpreter and packages. So it needs to be imported from the
functools module. Will explore more about modules later.
reduce is a bit tricky to understand. However, borrowing from the JavaScript universe, where the
array method
reduce also does the same thing. It keeps a track of the resultant value in the accumulator.
reduce accepts a function and an iterable as required parameters and an optional initializer which is set to 0 by default.
reduce can be thought of as a way to reduce or merge iterable values into a single value.
A great article to understand the reduce function in depth.
from functools import reduce numbers = [1,2,3,4] def accumulator(acc, curr): return acc + curr sum = reduce(accumulator, numbers, 0) print(sum) # 10
That's all for today. The core concepts have been explored mostly, I believe the concepts of functional programming will re-appear in the further advanced sections of Python. I would like to go through few other remaining functional programming terminologies tomorrow and share the same in a lucid way. I am getting more and more excited as I am unlocking new concepts and exploring new territories in Python. Hope you are equally excited and curios to follow along.
Have a great one!
Discussion (0) | https://practicaldev-herokuapp-com.global.ssl.fastly.net/arindamdawn/30-days-of-python-day-11-functional-programming-i-4d9o | CC-MAIN-2021-10 | refinedweb | 996 | 52.7 |
Board index » perl modules
All times are UTC
A new version of libwin32 is making its way into the CPAN. This version features precompiled binaries for x86, and is available in both tar.gz and zip formats..*-*-*.com/.*-*-*.com/
The README from the distribution follows.
Just give it,
- Sarathy.
--------------------------------------------------------------------------
Welcome to libwin32 version 0.10.
WHAT ----
This is a bundle of "Win32-only" extensions that provides a quick migration path for people wanting to use the core support for win32 in perl 5.004 and later. It features the complete set of Win32-specific extensions available from CPAN that could previously only be used with Activeware's "Perl for Win32"(TM).
Most other non-Win32 extensions should build fairly smoothly using the MakeMaker support available in perl 5.004 and later, so they are not included in this bundle.
This distribution has been pre-compiled for the x86 architecture. See the "WHAT TO DO" section for installation instructions.
WHAT HAS CHANGED ----------------
The top level "Changes" file contains a version by version overview of the most significant changes.
This release has the following changes over the previous one:
related modules. The Win32::Event module is new. In his own words:
The Win32::IPC modules
Win32::ChangeNotify Win32::Event Win32::IPC Win32::Mutex Win32::Semaphore
have been almost completely rewritten and are now at version 1.00. The rather inconsistent ActiveWare interface is still supported, but you should really use the newer and more powerful interface (using lower case method names).
Consult the documentation for each module for details on how to convert from the old interface.
In addition, Win32::Process has been slightly altered to work with Win32::IPC. Process objects should now work with Win32::IPC's wait_* functions (they were supposed to work before, but they didn't). You will have to load Win32::IPC yourself, because Win32::Process does not.
+ Updated FileSecurity to base version 0.67.
+ Win32::Registry sports additional functions that correspond to the Win32 Registry API functions.
+ Misc. changes - fixed buggy InitiateSystemShutdown() - New compatibility XSUBs: MsgBox(), LoadLibrary(), FreeLibrary(), GetProcAddress(), RegisterServer(), UnregisterServer()
+ Other minor bugs have been fixed. See "Changes" files in individual module subdirectories.
Many thanks to all the contributors.
WHAT IT HAS -----------
This bundle contains:
* The collection of modules originally distributed by the Activeware folks as part of their "Perl for Win32"(TM) port. These have been modified so that they will build under MakeMaker using perls greater than 5.004 and Visual C++. Along the way, I have added many bugfixes to make these modules work correctly.
The complete list of Activeware extensions is available:
Win32/ChangeNotify Win32/EventLog Win32/File Win32/FileSecurity Win32/IPC Win32/Mutex Win32/NetAdmin Win32/NetResource Win32/OLE Win32/Process Win32/Registry Win32/Semaphore Win32/Service Win32/WinError
Note this covers all of the Win32 extensions distributed by Activeware (as of build 315).
These extensions have been re-engineered to use the XS interface language, yet the changes are compatible with the originals. This should minimize any problems for people wanting to migrate their application to 5.004. The design of these modules is subject to change in future.
The only deliberately incompatible change is in the Win32::OLE module. While the Activeware port used the "OLE::" and "Win32::" namespaces for the functionality contained in this module, this port uses "Win32::OLE::" consistently. For a list of other incompatibilities in Win32::OLE, see the embedded documentation in "OLE/OLE.pm".
* The following five modules maintained by Aldo Calpini
Win32/Clipboard Win32/Console Win32/Internet Win32/Shortcut Win32/Sound
These also have been converted back to XS. I have added bug fixes as I found them during the conversion process.
Win32/ODBC Win32/Pipe
These have only received just the bare modifications needed to build them under MakeMaker. *.xs are really C/C++ files masquerading as XS. Win32/ODBC hasn't been tested much.
WHAT TO DO ----------
You can either use the binaries that come with this distribution, or choose to recompile them from scratch (recommended if you have a C compiler that is capable of building perl).
If you want to use the precompiled binaries:
+ Download:.*-*-*.com/ Unzip that, thoroughly read the README file, and install it. Note that the it comes with an older version of libwin32, but you'll be completely replacing that in the next few steps.
+ Make sure the newly installed perl is available from the command line. Typing "perl -v" should report version 5.004_02. If not, make sure you've added the installed location of perl.exe to your PATH correctly.
+ cd to wherever you uncompressed this distribution, and type "install.bat". This should take care of installing everything in the right place.
+ Many modules come with their own test files. You may want to use them as a source of examples. Many of the test files will only run on Windows NT, others may require Windows NT 4.0, and still others may require Administrator privileges, or a full fledged Windows network.
The following applies only if you want to rebuild using your C compiler. Otherwise, skip to the next section.
This set of modules will build with perl5.004_01 and later on the Windows NT platform. Building on Windows 95 is not supported (but it may be possible if you use the 4DOS command shell, but YMMV).
+ First you need to build perl 5.004_01 or later (you will need either Visual C++ 4.x+ or Borland C++ 5.02+), and install it. See README.win32 in the perl distribution for details on how to build perl for the Win32 platform.
+ That done, you need to extract this distribution into an NTFS partition (the tests in the FileSecurity module and Net* modules will fail otherwise). The testsuite for OLE needs Excel to run. NetAdmin will only work if you have some kind of live network connection, and are in a domain with a properly configured domain controller. NetResource requires that you be part of a domain or workgroup. You may also need Administrator privileges for running some of the tests. If one or more of these conditions will not be met, you may wish to build in the subdirectories one by one. The steps below will work either at the toplevel directory, or in each of the individual extension subdirectories.
+ You need either MS Visual C++ (NetAdmin needs ver. 4.x+, Internet needs ver. 5.0. ver. 2.0 should suffice for the others) or Borland C++ 5.02. Make sure you have the full installation of either of these compilers ("Minimal" installations or CDROM-based installations may have problems finding all the libraries).
+ If the Internet extension doesn't build due to lack of libraries (the wininet.h header is included), fetch the libraries from Aldo Calpini's website: ".*-*-*.com/ ;. Look for a file named "WinInet.zip". If the wininet.h or wininet.dll in your system are newer than the ones in WinInet.zip, discard them before copying WinInet.lib into the Internet/ directory.
+ Remove the 'blib' directory (it contains the precompiled binaries)
+ perl Makefile.PL [either at toplevel or in subdirs]
+ $MAKE [either at toplevel or in subdirs]
+ $MAKE test [optional, some interactive tests]
+ $MAKE install [either at toplevel or in subdirs]
$MAKE above stands for either "dmake" or "nmake" depending on your available compiler, and perl configuration.
WHAT THEN ---------
A brief statment of intent: I am doing this to ease the transition for many people who may wish to start using the latest perl on win32 platforms. Long term development of these modules remains the responsibility of the respective authors.
I wish to thank the authors of these modules for their effort in making them useful, and for making them freely available.
If you find any problems with these modules, kindly report them to me. While I have fixed many problems in these modules, I may also have introduced brand new bugs in the process :)
Suggestions, patches, testsuite additions, wholesale rewrites and additional ports of modules welcome.
Enjoy!
Gurusamy Sarathy
6 February 1998
WHATEVER --------
Copyright for many of the modules is held by their respective authors. Look in the module subdirectories for any conditions of use.
The following copyright applies to all files that don't have an explicit copyright statement:
(c) 1995 Microsoft Corporation. All rights reserved. Developed by ActiveWare Internet Corp.,.*-*-*.com/
You may distribute under the terms of either the GNU General Public
...
read more »
I am new at perl and am trying to install a new module HTTP::Request::Form that was recently announced on this newsgroup. I am using perl v5.004_02 under win95 and using the dmake that came with the perl.
The command "perl makefile.pl" runs fine, but the command "dmake install" comes back with the error msg " line 624: Error -- Expecting macro or rule defn, found neither".
The relevent section of the makefile follows and "$(PM_TO_BLIB)" is line 624.
# --- MakeMaker pm_to_blib section:
pm_to_blib: $(TO_INST_PM)
"-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \ -e "pm_to_blib(qw[ <<pmfiles.dat ],'$(INST_LIB)\auto')"
$(PM_TO_BLIB) <<
# --- MakeMaker selfdocument section:
Does anyone know why I'm getting this error and how to fix it? Thanks very much,
Chuck Paulson
Oh, you can just drop the Form.pm into the http/request/ folder (where HTTP::Request::Common lives). That's all the makefile is supposed to do to the package. It's perl-only, so actually the Makefile.pl is a bit overkill.
bye, Georg
1. ANNOUNCE: libwin32 version 0.09 released
2. ANNOUNCE: Inline::Python version 0.10
3. ANNOUNCE: Inline::CPR version 0.10
4. ANNOUNCE - Spreadsheet::WriteExcel, Version 0.10
5. libwin32 version 0.12 released
6. ANNOUNCE: Text::Vpp 0.1 BETA release
7. ANNOUNCE: Tk::ObjScanner Beta version 0.1
8. ANNOUNCE: Tcl Dynamic Loader package version 0.1
9. ANNOUNCE: XML::Writer::String version 0.1
10. ANN: Archive::Zip version 0.10 on CPAN
11. ANNOUNCE: HTML::FormatNroff 0.10
12. ANNOUNCE: Net::DNS 0.10 has dynamic updates | http://computer-programming-forum.com/52-perl-modules/9d536814f2d9922e.htm | CC-MAIN-2021-10 | refinedweb | 1,659 | 67.96 |
When you write code in a namespace and use functions and constants from "root" namespace (like built-un functions and constants) autocompletition inserts a function/constant name with a backslash.
Example:
namespace NS\Test;
$dir = __D[ctrl+space] -> \__DIR__
$includePath = get_inc[ctrl+space] -> \get_include_path()
Name resolving for functions and constants is different from resolving classes: backslash is not required. Moreover, backslash is not used in modern coding standards for such situations.
So it will be cool to have another default behaviour for root functions and constants, or just an option in settings to change it.
Example:
namespace NS\Test;
$dir = __D[ctrl+space] -> __DIR__
$includePath = get_inc[ctrl+space] -> get_include_path()
Backslash prefixing global functions was removed.
Related "function backslash" bug.
Fixed in web-main:
I would like to transplat it into 7.0. Could I ask QA to test it? Thanks.
Integrated into 'main-golden', will be available in build *201103280400* on (upload may still be in progress)
Changeset:
User: Ondrej Brejla <OndrejBrejla@netbeans.org>
Log: #191495 - Autocomplete of functions and constants from "root" namespace
verified
The fix was transplanted to the release70
To Whom It may concern,
Can someone help me to remove this backslash prefixing?
I am using mac and this backslash always show when I select Classes or Functions in the dropdown of the autocomplete.
Much appreciated your help.
Thank you and regards,
nhatzbulawan
(In reply to OndrejBrejla from comment #1)
> Backslash prefixing global functions was removed.
Do not reopen verified and fixed issues, thanks. Especially if you just have a question. If you have some problem, try the latest dev build (e.g. 8.0 RC1 [1]) and if the problem persists, then file a new issue a describe step-by-step reproducible test case. Thanks.
[1] | https://netbeans.org/bugzilla/show_bug.cgi?id=191495 | CC-MAIN-2017-22 | refinedweb | 290 | 55.44 |
This post was provoked by a recent Stack Overflow question which asked whether there was an efficient representation of ASCII strings in .NET.
In particular, the questioner wanted to store hundreds of thousands – possibly millions – of strings in memory, and knowing (or assuming) that they all consisted of ASCII characters, he wanted to avoid the waste of space that comes from storing each character in a .NET string as a UTF-16 code unit.
My answer to the question mostly consisted of saying that I didn’t think it would be worth the effort, and giving some reasons. But the more reasons I gave, the more I thought about the subtleties involved, and that it’s actually quite an interesting case study into memory use in .NET.
How are we going to measure object size?
If we’re going to work out any sort of benefit from a more compact string representation, we’ll need to be able to calculate how much memory our objects are taking to start with. Rather than work this out in a purely theoretical way, I’ve been running tests using code like this:
class Program
{
static void Main(string[] args)
{
int size = 10000000;
object[] array = new object[size];
long before = GC.GetTotalMemory(true);
for (int i = 0; i < size; i++)
{
array[i] = new object();
}
long after = GC.GetTotalMemory(true);
double diff = after – before;
Console.WriteLine(“Per object: “ + diff / size);
// Stop the GC from messing up our measurements
GC.KeepAlive(array);
}
}
Obviously that doesn’t take into account factors such as memory used by JITting, or anything that could be going on in other threads, but by using a suitably large number of objects, and by performing the division in floating point arithmetic (to avoid a slight variation making an 11.99999 come out as an 11, when it’s really just a “12 with something else going on”, we can work out the size of objects pretty clearly. The sample above measures the size of a vanilla object, but the code can be adapted very easily.
The first important thing to point out is that C# doesn’t guarantee the results of this – it isn’t responsible for determining how all of an object is laid out in memory; that’s the runtime’s job. While there are attributes to affect the layout and padding of the data members of a type in memory, there are other aspects that are out of your control. In this post I won’t use any of the layout attributes – we’ll just use the defaults.
Not all runtimes are created equal, either. On my laptop I’ve got Mono 2.8, .NET 3.5 and .NET 4, with the two versions of .NET each having the 32-bit (x86) and 64-bit (x64) CLRs. For the sake of simplicity, I’m going to stick with .NET 4 for this post, but I’ll give results for both the x64 and x86 CLRs. To test each of them, I’m compiling with “/platform:x64” or “/platform:x86”.
Some simple starter measurements
Before I start creating my own types, let’s try a few built-in types, including strings:
Note that all the x86 sizes are rounded up to the nearest 4 bytes, and all x64 sizes are rounded up to the nearest 8 bytes.
The string numbers are interesting, because strings are the only non-array types in .NET which vary in size. A long string consists of a single large object in memory. Compare this with Java, where a String is a “normal” type in terms of memory consumption, containing an offset and length into a char array – so a long string consists of a small object referring to a large char array. This distinction will be very important when we come to build an AsciiString type. Another point about measuring string sizes is that it’s relatively tricky to measure the size of an empty string – because even if you use the “new string(‘x’, 0)” constructor, the result is still cached – the same reference is returned each time.
You might be forgiven for looking at the numbers above and thinking that the “overhead” of an object is 12 bytes in x86 and 24 in x64… but that’s not quite right. Let’s build our own straightforward classes and measure them…
Custom classes containing primitives
Here are six classes, all of which are measured with the same simple test code:
class OneInt32 { int x; }
class TwoInt32 { int x, y; }
class ThreeInt32 { int x, y, z; }
class Mixed1
{
int x;
byte b1, b2, b3, b4;
int y, z;
}
class Mixed2
{
int x;
byte b1;
int y, z;
byte b2, b3, b4;
}
The last case is mostly to check how the CLR handles an “awkward” class declaration, where the int variables won’t naturally be aligned on 4-byte boundaries. The results look odd at first, but we’ll make sense of them in a minute:
A few interesting things to note here:
- There’s a “base” overhead of 8 bytes per object in x86 and 16 per object in x64… given that we can store an Int32 of “real” data in x86 and still have an object size of 12, and likewise we can store two Int32s of real data in x64 and still have an object of x64.
- There’s a “minimum” size of 12 bytes and 24 bytes respectively. In other words, you can’t have a type which is just the overhead. Note how the “Empty” class takes up the same size as creating instances of Object… there’s effectively some spare room, because the CLR doesn’t like operating on an object with no data. (Note that a struct with no fields takes up space too, even for local variables.)
- The x86 objects are padded to 4 byte boundaries; on x64 it’s 8 bytes (just as before)
- By default, the CLR is happy to pack fields pretty densely – Mixed2 only took as much space as ThreeInt32. My guess is that it reorganized the in-memory representation so that the bytes all came after the ints… and that’s what a quick bit of playing around with unsafe pointers suggests too… but I’m not sufficiently comfortable with this sort of thing to say for sure. Frankly, I don’t care… so long as it all works, what we’re interested in is the overall size, not the precise layout.
So what does an ASCII string look like?
In this blog post I’m not actually going to implement an ASCII string at all (well, not much). I’m merely pointing out what the data structures would look like. However, it’s worth working out what desirable qualities it should have. As far as possible, it should feel like System.String. In particular:
- It should be immutable.
- It should have fast access to individual characters, and the length.
- It should mostly “feel” like an immutable reference type, in that passing a value of type AsciiString around should be cheap, like copying a reference.
- It should use as little memory as possible… less than the equivalent string, or it’s pointless.
- One caveat to this: in theory that could mean storing 8 characters in every 7 bytes, as ASCII really only uses 7 bits per character. I’m not going to those extremes, but you can think about them if you want.
We’re going to store the characters as a byte array. We have three options as to exactly how we handle that byte array:
- We could go the Java way, where several strings share references to the same array. Each string then has an offset and a length to say which bit of the array they’re interested in.
- Pros: Substring becomes really cheap
- Cons: You can end up having just a tiny substring responsible for keeping a huge character array alive
- We could go the .NET way, where each string has its own character data, but the buffer may be longer than necessary… so it stores the length too. (A bit like a List<T>.)
- Pros: Can potentially make building strings cheap, if you just keep whatever potentially oversized buffer you’ve already got.
- Cons: Wasted space for the unused part of the array, and a field for the length.
- We could just have a byte array of exactly the right size – and it already knows its size.
I’m going to assume the third option here. So all the data our type needs is a byte array. That’s going to be pretty cheap… we hope. Let’s look at what we can build.
Option 1: A simple class
To give a flavour of the implementation, I’ve decided to implement four members for each option:
- A way of creating an AsciiString from a regular string
- The Substring overload with both a start and length
- The Length property
- The indexer returning a char
Hopefully that will give enough of an idea of what’s going on to be useful. Note that these aren’t production-quality implementations at all… none of the code has ever been run at all. I have made sure it compiles, so just be grateful for that :)
using System.Text;
public sealed class AsciiString
{
private readonly byte[] data;
public AsciiString(string text)
{
// TODO: Rather more data validation etc!
data = Encoding.ASCII.GetBytes(text);
}
private AsciiString(byte[] data)
{
// This constructor is private: we can trust that it’s been called
// by code which isn’t going to modify the contents of the array
// afterwards.
this.data = data;
}
public AsciiString Substring AsciiString(newData);
}
public int Length { get { return data.Length; } }
public char this[int position] { get { return (char) data[position]; } }
// etc…
}
Hopefully this is pretty straightforward – it’s meant to be the most “obvious” solution. Note that we’ve not got the nice locality of reference which the real String class has – it’s possible that the an AsciiString could end up with its backing array a long way away in memory, so a indexer operation for a single character could end up with three cache misses – one for the AsciiString object, one for part of the data array storing the length (for argument validation) and one for the part of the data array containing the character we’re looking for. That may be unlikely, and it’s not the kind of thing I normally think about – but it’s probably the kind of thing the BCL team pay a lot of attention to.
We get the same “immutable reference type” behaviour present in the normal string type, however – you can have a null AsciiString reference just as normal, any assignments will just be reference assignments, etc.
What about the size though? There are two objects to consider:
- The array, of size 12 + length or 24 + length (x86 and x64 respectively; rounded up to 4 or 8 bytes as well)
- The object itself, of size 12 or 24
So we’ve got a total size of 24 + length or 48 + length, depending on architecture. To show how the break-even point works, here’s a little table showing the sizes of string and AsciiString for various sizes on both architectures:
As you can see, the break-even point in x86 is at length 10; in x64 it’s at length 16. After that, we start winning – as we’d expect. The penalty for very small strings is quite hefty though – you’d really better hope you didn’t have lots of single-character strings, taking 56 bytes each in x64.
Let’s see if we can do better…
Option 2: A simple struct
A lot of the overhead here has come from the fact that we’ve got an object which only has a single field..
It all sounds good, but there are two snags:
- The value can never be null; that at least diverges from the familiar string behaviour
- We won’t be able to prevent code from creating an instance of our struct with new AsciiString() – and that won’t be good.
We can actually pit these two downsides against each other by making the “default” value a pseudo-null value… we can even throw NullReferenceException just as if it were a reference type. We don’t even need to do any work in order to get that NullReferenceException – every member is going to use the data array anyway, and dereferencing that will automatically throw an exception. We might want to change things around a bit to make that the very first thing that can throw an exception, but that’s all.
It’s nasty, but it appeals very slightly. In an evil kind of way. It makes things slightly more familiar, but at the cost of being generally weird in other ways.
We still need to be able to check whether an AsciiString value is the logical null value. I’ll add an IsNull property for that purpose. (An alternative would be HasValue, but that would be confusing with Nullable<T>.)
Most of the code remains untouched – it looks like this:
{
private readonly byte[] data;
public bool IsNull { get { return data == null; } }
// Remainder of code as before
}
Now let’s look at the sizes, which should be a lot more favourable than before. Note that I had to change the size-checking code to create an array of type AsciiStruct[] instead of object[] to avoid boxing. Should we take the size of the array itself into consideration when computing the size of the AsciiString? We haven’t when working out the size of string… in each case the size of any individual element will be the size of a reference. For the table below, I haven’t included it… but bear in mind that this form of measurement would count the size of most value types (int etc) as 0. It just goes to show that when you talk about the size of a data type, you really need to be very precise in what you mean.
This time, unsurprisingly, AsciiString is always more space-efficient than the normal string. It just takes a certain amount of holding our noses. Speaking of which…
Option 3: Extension methods on byte[]
Suppose we really, really want to have “proper” null references. We don’t really need the struct. We could treat any byte array as an array of ASCII characters, with extension methods like this:
{
public static byte[] Substring(this byte[] data,Data;
}
}
The size is the same as with option 2 – in both cases there’s just the byte array, basically. This option is truly horrible in many ways though:
- You can no longer tell in your code (just through typing) what’s meant to be an AsciiString and what isn’t
- Kiss immutability goodbye
- We can’t guarantee that all the characters will be valid ASCII any more
- We can’t add extension properties or extension indexers
- We can’t make it implement the interfaces we want it to
Obviously, we’d never take this route. I just thought I’d include it for a regular dose of evil-ness.
Conclusion
Implementing an ASCII-only string representation sounds like it should be an obvious win in terms of memory, at the cost of doing a lot of work that’s already been done for us in String. However, the most obvious implementation takes a while to break even in memory usage, compared with the normal string type, due to the “special” nature of string within the CLR. We can’t mimic the “stretchiness” of string ourselves. The BCL/CLR teams could, of course, if they really wanted to. I’m not holding my breath though.
If we’re dead keen on saving space at the cost of some design wonkiness, we can use a value type instead of a reference type. Other than nullity, it works pretty well… but you have all the disadvantages which go with value types, such as the unavoidable parameterless constructor and the need to watch out for boxing.
Aside from anything else, I hope this was useful as a delve into how much space objects actually take up in .NET – and as a way of highlighting the extra memory used when running in the x64 CLR.… | https://codeblog.jonskeet.uk/2011/04/05/of-memory-and-strings/?like_comment=12969&_wpnonce=c8189d21bd | CC-MAIN-2021-49 | refinedweb | 2,717 | 65.25 |
Adding System Calls (an OpenBSD Example)by Kevin Lo
10/09/2003
This article is a quick example of how to add a system call to OpenBSD. The following description is based on OpenBSD 3.4-beta on i386 machine architecture. Also, it is assumed that readers are familiar with building the OpenBSD kernel.
What is a System Call?
programs too specifically to one single brand or a precise, specific combination
of system hardware components. System calls also serve this generalization
function across programming languages. For example, the
write
system call will write data to the object referenced by a file descriptor. To
the programmer, this looks like another C function, but in actuality, the code
for
write is contained within the kernel.
Should I Add a New System Call?
In most cases, you don't want to create a new system call. Adding a new system call to the kernel and then creating programs that use this call take away the program's portability. Adding a system call can also introduce a serious security problem into your system. The best solution is usually not to write your own system calls, but sometimes they solve problems. For example, you might want to add Access Control Lists support for your system, or make it possible to bind a process to a particular CPU.
Implementation of System Calls
There are four main source and header files associated with system calls. These are:
/usr/src/sys/kern/syscalls.c, containing the table of names of system calls.
/usr/src/sys/kern/init_sysent.c, containing a table
sysent, of which each entry stores two things: the number of parameters to the system call and the function that implements the system call.
/usr/src/sys/sys/syscallargs.h, containing system call argument lists.
/usr/src/sys/sys/syscall.h, containing system call numbers. For example, the line:
#define SYS_fork 2
means
fork()is system call number 2.
Now let's see how to implement a new system call,
hello, which
will print
Hello World message to the console. To do this, edit
/usr/src/sys/kern/syscalls.master to add an entry for
sys_hello.
There are multiple types of system calls:
STD: always included in the kernel.
OBSOL: obsolete, not included in system.
UNIMPL: unimplemented, not included in system.
NODEF: included, but don't define the syscall number.
NOARGS: included, but don't define the syscall args structure.
INDIR: included, but don't define the syscall args structure, and allow it to be a "real" varargs function.
Each entry in the file has the following format:
Systemcall-Number Type { Pseudo-Prototype } [Alias]
When adding a new system call, always add it to the end of the
syscalls.master file. Bump up the last number of system call and
assign it to
sys_hello. For example, let's assign number 287 to
sys_hello in syscalls.master:
287 STD { int sys_hello(void); }
Save that file, then run make init_sysent.c in the
/usr/src/sys/kern directory. This will regenerate the
init_sysent.c,
syscalls.c,
syscallargs.h, and
syscalls.h files, all of which
depend on syscalls.master.
The following function implements our
hello system call in
sys_hello.c:
#include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/mount.h> #include <sys/syscallargs.h> /* * Print "Hello World" message to the console */ int sys_hello(p, v, retval) struct proc *p; void *v; register_t *retval; { printf("Hello World\n"); return (0); }
Modify the file /usr/src/sys/conf/files to include
sys_hello.c and recompile the kernel. Reboot into the fresh
kernel. Now you can invoke the system call from a user program. The following
program uses
syscall(2) to test the newly created system call:
#include <sys/syscall.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { syscall(287); }
To compile, use the command:
$ gcc -I/usr/src/sys/sys
to instruct the compiler to use our include file.
A slightly more instructive example is
mysyscall, which prints
a string passed in by the user. The entry for
sys_mysyscall in
syscalls.master should look like this:
288 STD { int sys_mysyscall(size_t len, char *string); }
The
sys_mysyscall function that implements the
mysyscall system
call in sys_mysyscall.c is:
#include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/mount.h> #include <sys/syscallargs.h> /* * Print a string passed in by the user, after copying to a kernel buffer. * The len argument isn't actually used, it's just to demonstrate * bounds checking. */ int sys_mysyscall(struct proc *p, void *v, register_t *retval) { struct sys_mysyscall_args /* { syscallarg(size_t) len; syscallarg(char *) string; } */ *uap = v; int error; size_t len; char buffer[1024]; /* must bounds check all user values */ if (SCARG(uap, len) > (size_t)1024) return (EINVAL); /* must use copy(9) functions to access user pointers */ if ((error = copyinstr(SCARG(uap, string), buffer, sizeof(buffer), &len))) return (error); printf("The user sent\n%s\n", buffer); return (0); }
If you want to call the system call by name, you must recompile
libc after editing /usr/src/libc/sys/Makefile.inc to
include hello.o on the ASM line.
An alternative way to implement system calls is using Loadable Kernel Modules (LKM). In this case, you don't have to modify the kernel sources to append your own code. In a future article, I will introduce LKM and tell you how to implement system calls and device drivers via the LKM interface.
Acknowledgments
I would like to thank Philipp Buehler, Tobias Weingartner, and Ted Unangst
for reviewing this article. I would also like to thank Ted Unangst for
contributing to an example of the system call
mysyscall.
Kevin Lo is an OpenBSD developer and a teacher at Kaiping Vocational School.
Return to the BSD DevCenter.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 6 of 6.
- Great!
2003-10-15 13:28:55 lizardo [Reply | View]
Great job ;)
Its not /usr/src/libc/sys/Makefile.inc,
must be /usr/src/lib/libc/sys/Makefile.inc
- Good Article
2003-10-12 09:04:39 anonymous2 [Reply | View]
Short, but instructive. I look forward to your article on LKM.
It was said the main idea.
--
I have always wanted write system calls for Linux. But all documatations are very large and dificult. So I have not got time for searching the idea.
Now I'm going to write system call for BSD:
"Sveikas pasauli!"
Thanks | http://www.onlamp.com/pub/a/bsd/2003/10/09/adding_system_calls.html | crawl-001 | refinedweb | 1,096 | 68.97 |
Changes to the C++ Compiler in Microsoft Visual Studio 2010
In a previous article I wrote about some of the changes to VC++ in Visual Studio 2010, new build system, multi-targeting, new IntelliSense. There is more in store for VC++ in this new version and this article will focus on the changes to the C++ compiler. I already wrote an article dedicated to lambda expressions, but the purpose of this new article is to cover all of these changes.
C++0x will be the next standard for C++. It was code-named 0x because it was supposed to be finished at latest in 2009. We are now in 2010 and it's for sure that the standard won't be approve this year either. Boris Jabes joked saying they will probably use hex values, and he is probably right. However, there is a set of features that were already approved and some of them were included in the C++ compiler from Visual Studio 2010. This includes lambda expressions, auto, decltype, rvalue references and static_assert. I will write about all of them, without getting very deep though. I suggest additional readings from the MSDN library or the VC++ Team blog.
static_assert
Checks if an expression holds true at compile time. If the expression if false a custom error message is displayed and the compilation fails. If the expression is true the declaration has no effect.
This feature is especially powerful together with the type traits clases introduced in tr1 namespace in Visual Studio 2008.
In the following example I create a comparison template function, that is used later to compare values.
template <typename T> bool CompareNumbers(T v1, T v2) { return v1 > v2; } int main() { bool ret1 = CompareNumbers(1, 20); bool ret2 = CompareNumbers("b", "a"); return 0; }
The problem is that I don't what this function to be used to anything else than integral types (maybe because it doesn't make sense for other types, even if they have an operator > defined). But the code compiles and runs, and actually I would like a compilation error for the call to Compare where I passed strings.
Adding a static_assert check will generate an compilation error for the second call to the function.
#include <type_traits> template <typename T> bool CompareNumbers(T v1, T v2) { static_assert(std::tr1::is_integral<T>::value, "Type is not numeric"); return v1 > v2; }
1>d:\marius\vc++\cpp0x\cpp0x.cpp(62): error C2338: Type is not numeric 1> d:\marius\vc++\trainnings\cpp0x\cpp0x.cpp(75) : see reference to function template instantiation 'bool CompareNumbers<const char*>(T,T)' being compiled 1> with 1> [ 1> T=const char * 1> ]
auto
The auto keyword existed before, but in the previous version of the standard it didn't have basically any meaning. So the new version has given it a new purpose. The keyword is used to deduce the type of a declared variable from its initialization expression. The initialization expression can be an assignment, direct initialization or operator new expression. However, the auto keyword is just a placeholder, not a type, and cannot be used with sizeof or typeid. Here are some examples:
auto i = 13; // i is int auto s = "marius"; // s is std::string auto p = new foo(); // p is foo*
Auto is pretty useful, for instance, for avoiding writing long types in for statements.
vector<int> numbers; generate_n(back_inserter(numbers), 10, rand); for(vector<int>::const_iterator it = numbers.begin(); it != numbers.end(); ++it) { cout << *it << endl; }
The for can be now written simply as this:
for(auto it = numbers.begin(); it != numbers.end(); ++it) { cout << *it << endl; }
lambda expressions
As I mentioned in the beginning of the article I already wrote an article dedicated solely to the lambda expressions in C++. I will not reiterate all the points from that article; instead I will try a short overview on lambdas.
A lambda functions is a function object whose type is implementation dependent; its type name is only available to the compiler. The lambda expression is composed of several parts:
- lambda_introducer: this is the part that tells the compiler a lambda function is following. Inside the angled brackets a capture-list can be provided; this is used for capturing variables from the scope in which the lambda is created.
- lambda-parameter-declaration: used for specifying the parameters of the lambda function.
- lambda-return-type-clause: used for indicating the type returned by the lambda function. This is optional, because most of the time the compiler can infer the type. There are cases when this is not possible and then the type must be specified. For the example above, the return type (-> bool) is not necessary.
- compound-statement: this is the body of the lambda.
Let's see a lambda:
vector<int> numbers; generate_n(back_inserter(numbers), 10, rand); for_each(numbers.begin(), numbers.end(), [](int n) {cout << n << endl;});
Here [] is the lambda introducer, (int n) is the lambda parameter declaration, and {cout << n << endl;} is the lambda compound statement. There is no return type clause, because that is auto inferred by the compiler. There are cases when the compiler cannot deduce the return value and then it must be specified explicitly. A lambda expression is a syntactic shortcut for a functor. The code above is equivalent to:
class functor_lambda { public: void operator()(int n) const { cout << n << endl; } }; vector<int> numbers; generate_n(back_inserter(numbers), 10, rand); for_each(numbers.begin(), numbers.end(), functor_lambda());
Lambdas can capture variables from their scope by value, reference or both in any combination. In the example above, there was no value captured. This is a stateless lambda. On the other hand, a lambda that captures variables is said to have a state.
Lambdas are very useful used together with algorithms and make writing function objects obsolete.
rvalue references
Writing about rvalue references doesn't make too much sense after Stephan T. Lavavej explained everything already on VC++ Team's blog, in a post that I consider the ultimate guide to lvalues and rvalue, rvalue references and move semantics. The only thing I will attempt is to give a very short summary on the topics. You must read Stephan's post to get a grip on this topic.
In C++ there are two types of expressions: lvalue and rvalue. lvalues name objects that persist beyond the expression in which they are used, rvalue name temporaries that are destroyed at the end of the expression in which they were created. lvalues are observable from different parts of a program, rvalues are temporaries and are not visible outside the expression in which they were defined. An operator like operator+ for string takes two const references to string (or one const reference to string and one const char*) and returns a temporary string. However, when we chain several such operations, like "hello" + " world" + "!", there are several temporaries that are created and discarded immediateley. However, operator+ cannot modify its parameters, because they are lvalues and can be used elsewhere, but the temporary object it returns is not used anywhere else, being an rvalue, so it could be actually modified without side effects.
This is where rvalue references enter the scene. They are used to hold a reference to a rvalue or lvalue expression, and are introduced with &&. They enable the implementation of move semantics and perfect forwarding.
Move semantics enable transferring resources from one temporary object to another. This is possible because temporary objects (i.e. rvalues) are not referred anywhere else outside the expression in which they live. To implement move semantics you have to provide a move constructor and optionally a move assignment operator. The Standard Template Library was changed to take advantage of this feature. For instance, the operator+ for string was modified to use rvalue references, and can now append one string to another. The result is a lower number of memory allocations and deallocations and temporary objects created, which eventually increases speed.
Another classic example for the move semantics is represented by operation with sequences like vector or list. A vector allocates memory for a given number of objects. You can add elements to it and no re-allocation is done until the full capacity is reached. But when that happens, the vector has to reallocate memory. In this case it allocates a new larger chunk, copies all the existing content, and then releases the pervious memory. When an insertion operation needs to copy one element several things happen: a new element is created, its copy constructor is called, and then the old element is destroyed. With moves semantics, the allocation of a new element and its copy is no longer necessary, the existing element can be directly moved.
A second scenario where rvalue references are helpful is the perfect forwarding. The forwarding problem occurs when a generic function takes references as parameters and then needs to forward these parameters to another function. If a generic function takes a parameter of type const T& and needs to call a function that takes T&, it can't do that. So you need an overloaded generic function. What rvalue references enable is having one single generic function that takes arbitrary arguments and then forwards them to another function.
struct foo { foo(int&) {} }; struct bar { bar(const int&) {} }; template <typename T, typename A> T* make(A&& arg) { return new T(arg); } int main() { int x = 42; auto f = make<foo>(x); auto b = make<bar>(42); return 0; }
decltype operator
This is used to yield the type of an expression. Its primary purpose is for generic programming, in conjunction with auto, for return types of generic functions where the type depends on the arguments of the function. Here are several examples:
int i = 42; // decltype(i) yields int const int&& f(); // decltype(f()) yields const int&& struct foo {int i;}; // decltype(f.i) yields int (f being an object of type foo)
It can be used together with auto to declare late specified return type, with the alternative function declaration syntax, which is (terms in squared brackets indicate optional parts)
auto function_name([parameters]) [const] [volatile] -> decltype(expression) [throw] {function_body};
In general, the expression use with decltype here should match the expression used in the return statement. Here is an example:
struct Feet { double value; explicit Feet(double val):value(val){} }; struct Meters { double value; explicit Meters(double val):value(val){} }; ostream& operator<<(ostream& os, const Feet& f) { os << f.value << "ft"; return os; } ostream& operator<<(ostream& os, const Meters& m) { os << m.value << "m"; return os; } Feet operator+(const Feet& f1, const Feet& f2) { return Feet(f1.value + f2.value); } Meters operator+(const Meters& m1, const Meters& m2) { return Meters(m1.value + m2.value); } Feet operator+(const Feet& f, const Meters& m) { return Feet(f.value + m.value*3.2808); } Meters operator+(const Meters& m, const Feet& f) { return Meters(m.value + f.value*0.30480); } template <typename T1, typename T2> auto Plus(T1&& v1, T2&& v2) -> decltype(forward<T1>(v1) + forward<T2>(v2)) { return forward<T1>(v1) + forward<T2>(v2); } int main() { cout << Plus(f1, f2) << endl; cout << Plus(m1, m2) << endl; cout << Plus(f1, m1) << endl; cout << Plus(m2, f2) << endl; return 0; }
The result of the execution is:
30ft 6m 26.404ft 7.096m
In this example function Plus takes two arguments that can be of possible different types. If we pass two arguments of the same type, then the return argument is obviously the same time. However, if we pass arguments of two different types, then the result type depends of the arguments. In our case, when the first argument is Feet and second is Meters, than the result type must be Feet. But if the first argument is Meters and second is Feet, then the result argument must be Meters. This is where auto and decltype are of help. Otherwise, the Plus functions and its calls should have looked like this:
template <typename T, typename T1, typename T2> T Plus(T1&& v1, T2&& v2) { return forward<T1>(v1) + forward<T2>(v2); } int main() { cout << Plus<Feet>(f1, f2) << endl; cout << Plus<Meters>(m1, m2) << endl; cout << Plus<Feet>(f1, m1) << endl; cout << Plus<Meters>(m2, f2) << endl; return 0; }
Obviously, anyone would prefer the former, because you don't have to explicitly specify the type of the return value. With auto and decltype it can be inferred by the compiler.
References
For more information about these topics please see:
I like your site, this great article is very much.Posted by dorsBoureauri on 12/11/2012 10:32pm
Wools and diploma styling permit young boys and girls to support comfortable usually they are take pleasure in Halloween. [URL=][IMG][/IMG][/URL] are merely created for the winter months, which often meant for that reason toasty and high. [URL=]north face pro code[/URL] in making use of this original textile, tend to be more when compared with to as much as the career about holding a person cosy within the wintertime.Reply | http://www.codeguru.com/cpp/article.php/c17009/Changes-to-the-C-Compiler-in-Microsoft-Visual-Studio-2010.htm | CC-MAIN-2014-42 | refinedweb | 2,160 | 52.49 |
Use WaxJS
The WaxJS library exposes four primary components:
- wax.userAccount. WAX Account user name, returned when you make a call to
wax.login().
- wax.pubKeys. A user’s active and owner keys. Available once a user’s logged in or if you pass the keys in the WaxJS constructor.
- wax.api. Use this to execute standard eosjs transactions.
- wax.rpc. Use this to make API calls to the WAX Blockchain. Refer to WAX RPC API for more information.
To use WaxJS:
Import the Library. React style apps using npm or yarn can import the library via:
import * as waxjs from "@waxio/waxjs/dist";
You can also download and save WaxJS from GitHub and include the file on a web page:
<script src='waxjs.js'></script>
There are several ways to instantiate the WaxJS constructor, depending on what information you have for your users. Constructor parameters include:
- The URL for the RPC Server you wish to connect to (required)
- A user’s WAX Blockchain Account name (optional)
- An Array of public keys for a specific account (optional)
- Autologin bool value (optional)
To let WaxJS to assign the appropriate user values, you can simply pass an RPC URL:
const wax = new waxjs.WaxJS({ rpcEndpoint: '' });
Notice: The constructor for WaxJS changed with version 1.0. If you are updating from a previous version you will need to change the constructor.
The library can also be instantiated with the user account and public keys. If you have this information, you can pass it to the WaxJS constructor.
const wax = new waxjs.WaxJS({ rpcEndpoint: '', userAccount: '3m1q4.wam', pubKeys: ['EOS6rjGKGYPBmVGsDDFAbM6UT5wQ9szB9m2fEcqHFMMcPge983xz9','EOS7wTCoctybwrQWuE2tWYGwdLEGRXE9rrzALeBLUhWfbHXysFr9W'] });
Tip: If you pass these additional parameters, you won’t need to call the autoLogin method.
Before you can start signing transactions from your dApp, a user must be logged in. WaxJS includes an
isAutoLoginAvailablefunction that:
- Securely checks for WAX Cloud Wallet credentials
- Checks to see if your dApp is whitelisted
If both conditions are true, a user’s userAccount and public keys are set in your WaxJS object, and you don’t need to call the
login()function. You’ll also have access to wax.userAccount and wax.pubKeys.
//if true, popup won't be triggered; user is now logged in var isAutoLoginAvailable = await wax.isAutoLoginAvailable(); var userAccount = wax.userAccount var pubKeys = wax.pubKeys
If auto-login is not available, you can easily use the
login()function to allows users to sign in or sign up using WAX Cloud Wallet.
//normal login. Triggers a popup for non-whitelisted dapps async function login() { try { const userAccount = await wax.login(); const pubKeys = wax.pubKeys; } catch (e) { } }
The
login()function opens WAX Cloud Wallet in a new browser window. Users are prompted that your dApp would like to “Know your WAX Account Name.” Once they click Approve, they’re redirected back to your dApp
A successful login returns the userAccount (e.g., jq3ao.wam), and you can also access this property by calling
wax.userAccount.
Send a Transaction
Now that you have a user’s WAX Account name, you can use the
wax.apiobject to build your transaction.
Note: The
wax.apimethod is not initialized until you log a user in or pass a user’s information in the WaxJS constructor.
const result = await wax.api.transact({ actions: [{ account: 'eosio.token', name: 'transfer', authorization: [{ actor: wax.userAccount, permission: 'active', }], data: { from: wax.userAccount, to: 'eosio', quantity: '0.00000001 WAX', memo: '', }, }] }, { blocksBehind: 3, expireSeconds: 1200, });
Tip: The
wax.apimethod is an instance of the eosjs object, and provides the same functionality. Refer to the eosjs docs for more information.
The
wax.api.transact()function launches WAX Cloud Wallet in a new browser window. On this screen, users can review the transaction details and Approve or Deny the transaction. Once users click Approve, the transaction is signed on the WAX Blockchain and users are returned to your dApp. | https://developer.wax.io/en/wax-cloud-wallet/waxjs/waxjs_use.html | CC-MAIN-2022-33 | refinedweb | 640 | 67.25 |
Selenium is great for Automated Testing - I thought I’d revisit my old testing tools and so this is an update for 2020 and covers the basics of installing Selenium, Chromedriver
Install the software
- You can head over to the Chromedriver Project page and download the latest package or you can use Homebrew. If you don’t have Homebrew, go install it.
Install ChromeDriver with
Brew cask install chrom Chromedriver and Selenium
Having completed these steps, you can now run a basic test - you need to have Chrome installed on your mac for this to work
Open a terminal window and enter
python3 to start Python …
Type the following, pressing enter at the end of each line
from selenium import webdriver driver = webdriver.Chrome() driver.get("")
After a few seconds, if all is well a new instance of Chrome will open
To exit Python from your open Terminal, type
exit() and press enter
Did you find this helpful? Please let me know | https://damien.co/blog/2020-06-24-install-chromedriver-selenium-python-testing-tools/ | CC-MAIN-2021-31 | refinedweb | 162 | 56.32 |
All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…
[Updated 5/17/2012 for Visual Studio 11 Beta]
In Visual Studio 11 Beta, C++ AMP enables you to accelerate your applications using heterogeneous hardware such as GPUs.
If you are a .NET developer, you can still use C++ AMP in your applications. You’ll write most of your code in C#, the pieces to execute on the GPU in C++ AMP, and then use your favorite interop mechanism to bridge the gap. This blog post explains how to do just that, using P/invoke.
However,# is to open this sample project in Visual Studio 11 Ultimate and begin experimenting with the code.
If you have an existing application that you’d like to modify to use C++ AMP – or you’d like to understand how the sample is set up – you can follow the steps below. In summary, you need to take the following steps:
The steps are explained in detail below.
First, you need to open or create a C# project. The rest of the article assumes that the project is named HelloWorldCSharp and is created from the Visual C# Console Application template.
Note that you need Visual Studio 11 Ultimate to create a Console Application project because Visual Studio 11 Express can only create Metro style applications.
You may need to adjust two project settings:
You also need to add a Win32 DLL that will contain the C++ AMP code. In this walkthrough, we’ll create a “Win32 Console Application” and name it “HelloWorldLib”:
After clicking Next, choose the “DLL” application type:
If you build the solution we have so far, both projects should build. However, HelloWorldLib.dll will not be copied to the HelloWorldCSharp binaries. We need HelloWorldLib.dll copied here, so that HelloWorldCSharp.exe can find it at runtime.
To get HelloWorldLib.dll to copy each time you build, you need to add a build step into the HelloWorldCSharp project. First, unload the HelloWorldCSharp project in Solution Explorer:
Then, you can edit HelloWorldCSharp.csproj in Visual Studio by right-clicking the project in Solution Explorer and selecting “Edit HelloWorldSharp.csproj”:
Insert the following XML just above the line that imports “Microsoft.CSharp.targets”:
<ItemGroup>
<Content Include="..\$(Configuration)\HelloWorldLib.dll">
<Link>HelloWorldLib.dll</Link>
</Content>
</ItemGroup>
After reloading HelloWorldLib (the same way as you unloaded it), HelloWorldLib.dll should show up in the Solution Explorer.
In the Properties window, make sure “Copy to Output Directory” is set to “Copy if newer”, and “Build Action” is set to “Content”:
For better usability of the solution, it is nice to set the HelloWorldLib project as a dependency for the HelloWorldCSharp project. Then, whenever you build HelloWorldCSharp, HelloWorldLib should build as well.
Right-click HelloWorldCSharp in Solution Explorer and click Project Dependencies:
And then add a dependency on HelloWorldLib:
To verify that everything is building correctly, you can try to rebuild the solution. After rebuilding, the binaries folder for HelloWorldCSharp (e.g., HelloWorldCSharp\HelloWorldCSharp\bin\Debug) should contain both HelloWorldCSharp.exe and HelloWorldLib.dll.
Now, we should be ready to call into the C++ AMP code from C#. Modify HelloWorldLib.cpp as follows:
#include "stdafx.h"
#include "amp.h"
using namespace concurrency;
extern "C" __declspec ( dllexport ) void _stdcall square_array(float* arr, int n)
{
// Create a view over the data on the CPU
array_view<float,1> dataView(n, &arr[0]);
// Run code on the GPU
parallel_for_each(dataView.extent, [=] (index<1> idx) restrict(amp)
{
dataView[idx] = dataView[idx] * dataView[idx];
});
// Copy data from GPU to CPU
dataView.synchronize();
}
We just added a simple square_array function that squares an array using C++ AMP. Also, we decorated the function to export it from the DLL.
Now, let’s edit the managed HelloWorldCSharp application to call into the C++ AMP code. Modify Program.cs in HelloWorldCSharp project as follows:
using System;
using System.Runtime.InteropServices;
class Program
{
/// <summary>
/// Function defined in HelloWorldLib.dll to square an array using C++ AMP
/// </summary>
[DllImport("HelloWorldLib", CallingConvention = CallingConvention.StdCall)]
extern unsafe static void square_array(float* array, int length);
static unsafe void Main()
{
// Allocate an array
float[] arr = new[] { 1.0f, 2.0f, 3.0f, 4.0f };
// Square the array elements using C++ AMP
fixed (float* arrPt = &arr[0])
{
square_array(arrPt, arr.Length);
}
// Enumerate the results
foreach (var x in arr)
{
Console.WriteLine(x);
}
}
}
… and that’s it! Now, you should be able to run the HelloWorldCSharp project and see your application call into C++ AMP code..
Thanks, great! Hower I have one problem. Debugging is not working. Do you know why?
Sorry, now I am just reading that GPU debugging is not supported on Win7.
See: social.msdn.microsoft.com/.../46da1c69-cf2f-4f24-8d83-531d67af1848
So, this line doesn't compile at all in Visual Studio 11 (Ultimate) Beta and Windows 7:
parallel_for_each(dataView.grid, [=] (index<1> idx) mutable restrict(direct3d)
error C2039: 'grid' : is not a member of 'Concurrency::array_view<_Value_type,_Rank>'
error C3936: 'direct3d' : unrecognized restriction specifier
What's the frequency, Kenneth?
Outdated sample, I guess, since the documentation would seem to agree with the compiler's assessment. Perhaps working samples could be provided? I'm sure we'd all appreciate that.
SB, I'll get in touch with Igor about updating the sample.
In the meantime, please see changes to the Beta on our blog here:
blogs.msdn.com/.../changes-in-vs-11-beta-for-c-amp.aspx
As you can see there, you should change
grid to extent,
and change
restrict(direct3d) to restrict(amp).
You can probably delete the word mutable, that is rarelly needed.
SB, et al. The attached sample and code within the post have been updated to use the Visual Studio 11 Beta syntax.
It does not work on VS2015.
Does anyone can tell me how it works on it.
Any way it works on VS2013
Many thanks | http://blogs.msdn.com/b/pfxteam/archive/2011/09/20/how-to-use-c-amp-from-c.aspx | CC-MAIN-2016-26 | refinedweb | 973 | 58.08 |
Thank you very much for this, because I didn't know anything about that. I'll try to put in practise, althoug if you could send me a completed example to know how is working would be great. Thanks again. Jp Calderone wrote: > On Mon, 03 Oct 2005 16:13:22 +0100, Alberto Trujillo > <alberto.trujillo at ucd.ie> wrote: > >> Hi: >> I'm trying to understand how works LivePage, but everything is very >> confuse and I'm listening that a lot of changes are happening in >> LivePage. >> Could anybody give me a little idea, tutorial, o explanation about >> LivePage, and how can I use LivePage in the templates, I mean with >> out using Stan. >> >> Thanks in advance. >> > > There's pretty much just one requirement. You need to invoke the > "liveglue" renderer: > > <html namespace junk> > <head><nevow:invisible nevow:</head> > ... > </html> > > Sprinkle with Javascript to taste. The current client-side API is > "server.handle('name', ...)" (no return value). The API under > development will most likely turn out as "server.callRemote('name', > ...')" with a Deferred as the return value. > > Jp > > _______________________________________________ > Twisted-web mailing list > Twisted-web at twistedmatrix.com > | http://twistedmatrix.com/pipermail/twisted-web/2005-October/001957.html | CC-MAIN-2016-36 | refinedweb | 188 | 68.57 |
While working on a project that needs to check the quality of the network connection, I've found that there is no easy way to ping another computer. I expected there would be something in the framework (somewhere in the
System.NET namespace) to do this as it seems like a common thing to want to do, but I could find nothing so my search turned to the web. While I was able to find some c# ping examples, none of them were very well designed. I wanted a ping utility that would let me ping a remote machine any number of times and return the ping statistics in a sensible manner (that is, not something I'd have to parse) so I decided that I'd make my own.
Most of the ping code I saw on the net seemed to be derived from this MSDN article written by Lance Olson which was written way back when for the Beta 1 release of .Net (whether it cited him or not...). I based my ping utility on this code along with this article, written by Peter A. Bromberg, PhD, which updated the Olson's code to work with .NET version 1. Using this code as a starting point I've tried to make it a little more OO by creating a couple more classes and moving the code around, so that they do their own work. I think the code makes a lot more sense now and is much easier to understand and use. I used the Windows command line ping command as a baseline for the information I wanted to return, so I created a
PingResponse object that encapsulates all and gets returned instead of an
int or
string. I'm not going to write up a detailed description of exactly how the code works as it is either self-explanatory or simply works because that's how you have to do it (most of the ICMP class). I've included a very simple client form to show how to use the ping utility asynchronously, which I imagine, how you'd want to use it most of the time.
To use this component simply create a
Ping object and call the
PingHost or
BeginPingHost function.
private void Ping(string hostname) { //Create ping object Ping netMon = new Ping(); //Ping host (this will block until complete) PingResponse response = netMon.PingHost(hostname, 4); //Process ping response if (response != null) { ProcessResponse(response); } }
//Create ping object Ping netMon = new netMon(); private void Load() { //Wire events (in constructor or InitializeComponent) netMon.PingError += new PingErrorEventHandler(netMon_PingError); netMon.PingStarted += new PingStartedEventHandler(netMon_PingStarted); netMon.PingResponse += new PingResponseEventHandler(netMon_PingResponse); netMon.PingCompleted += new PingCompletedEventHandler(netMon_PingCompleted); } private void Ping(string hostname) { //Start ping IAsyncResult result = netMon.BeginPingHost( new AsyncCallback(EndPing), hostname, 4); } private void EndPing(IAsyncResult result) { netMon.EndPingHost(result); } private void netMon_PingStarted(object sender, PingStartedEventArgs e) { //Process ping started } private void netMon_PingResponse(object sender, PingResponseEventArgs e) { //Process ping response } private void netMon_PingCompleted(object sender, PingCompletedEventArgs e) { //Process ping completed } private void netMon_PingError(object sender, PingErrorEventArgs e) { //Process ping error }
PingResponseevent is fired. It would be nice to be able to cancel at any time and have it processed immediately.
PingReponseyet.
General
News
Question
Answer
Joke
Rant
Admin | http://www.codeproject.com/KB/dotnet/CSharpPing.aspx | crawl-002 | refinedweb | 537 | 60.95 |
# Initializing some things import numpy as np from scipy.optimize import curve_fit import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.animation as animation %matplotlib inline mpl.rcParams['lines.linewidth'] = 1.5 mpl.rcParams['lines.marker'] = "o" mpl.rcParams['axes.grid'] = True mpl.rcParams['legend.labelspacing'] = 0.0 cmap = mpl.cm.get_cmap(name='YlOrRd') colors3 = [cmap(x) for x in [0.4, 0.6, 0.9]]
Magnetism on a microscopic level is caused by electrons in the atom "shells". The Ising model is a intuitive but powerful way of describing such a system. In this notebook, we'll first learn about the Ising model and try to get some intuition for it. To look into the physical consequences, we'll solve it numerically with my c++ solver magneto. Code for that program and this notebook is on github.com/s9w/magneto. After the physics, we'll have a look at the algorithms that are used to solve it and their differences at the end of the article.
Quantum Mechanics tells us that electrons have a property called spin which is in one of two states, usually called "up" and "down". In Ising model, that is represented by $\sigma=+1$ and $\sigma=-1$, with $\sigma$ just being the standard symbol for spin states. The spins are arranged in a two or three dimensional square lattice. We'll look at two dimensions here. Example for a small 4x4 system:
+1 +1 -1 +1 -1 -1 +1 +1 -1 +1 -1 -1 +1 -1 -1 +1
The behaviour of all physical systems boils down to minimizing the overall energy. So let's try to reason about the energy of such a system: Each electron spin produces either a positive or negative magnetic field. But it's also influenced by such fields, both external and those of the other spins. So there is an interaction between them. In good approximation, it's enough to only look at the interaction between next neighbor spins. So each spin only is affected by its four direct adjacent spins.
A positive field will push an electron spin towards a positive alignment and vice versa. So it's intuitive that without external fields and disturbances, a configuration where many spins are parallel (in the same state) is energetically beneficial. Put into an equation, the energy of the whole system (without an external magnetic field) is given by the Hamiltonian:$$H = -J\sum_{\langle ij\rangle } \sigma_i \sigma_j$$
That way of writing a sum just means a summation over next neighbors for every single spin. We'll assume the coupling constant $J=1$ for the moment, more on that later.
Real systems consist of an astronomical number of spins, so a large lattice is crucial for good numerical results. To help cope with "finite size effects", periodic boundary conditions are used. So for a 2x2 grid with either all positive or all negative spins, the energy would be -8. Usually the energy is divided by the number of sites in the grid so that it's in a nice range between -2 and 0.
So we know what energy a specific configuration has. But a square grid with length $L$ has $L^2$ positions, which amounts to $2^{(L^2)}$ possible states. Even with conservative grid sizes that's a large number. Which of those configurations are actually physically realized and how often? More precise: What's their probability distribution? Statistical mechanics has the answer: The Boltzmann distribution$$\exp\left(-\frac{H}{T}\right)$$
Normalized, it looks like this:
ax = plt.subplot(xlabel="Energy", ylabel="Probability", title="Boltzmann distribution") E = np.linspace(0, 4.5, num=50) for i, T in enumerate([0.8, 1.5, 3.5]): ax.plot(E, 1.0/T*np.exp(-E/T), "-", label="T={}".format(T), color=colors3[i]) ax.legend();
It depends on the system temperature $T$. As expected, configurations with the lowest total energy are always the most probable. But at high temperatures, the distribution becomes flatter and states with higher energies become more likely. Therefore we expect the average total energy to increase with temperature.
Physical interpretation: A higher temperature increases thermal energy and therefore thermal fluctuations. They compete with the magnetic interactions between the spins. While the magnetic forces will push the system towards parallel alignments (uniform state), thermal effects have a random nature. With high T, the thermal effects get stronger and eventually dominate over the spin interactions.
Now we got everything we need. To recap: Ising model says we can write such a system as grids with $\pm 1$; the Hamiltonian gives the relationship between a spin configuration and its energy; the Boltzmann distribution gives us a probability for each energy. So when we have algorithms to get system configurations that follow these rules, we can do physics. We'll do physics first, then look at the algorithms later.
To visualize how a typical system looks at different temperatures, we'll run a first simulation. The two spin states are represented with white and black. Note that all simulation inputs are included, but commented out because some of them run quite long. For documentation of the use of magneto itself, have a look at the github repo.
# !magneto -N1=20000 -N2=0 -TMin=1.3 -TMax=3.3 -L=62 -TSteps=3 -states=states def draw_state(ax, grid, title): ax.grid(False) ax.imshow(grid, cmap=plt.cm.Greys, interpolation="none") ax.set_title(title) def load_states(filename): with open(filename) as f: T = float(f.readline()) grid = np.loadtxt(filename, delimiter=",", skiprows=1) return T, grid def draw_states(filename_base, n=3): fig = plt.figure(figsize=(3*n, n)) for i in range(n): T, grid = load_states(filename="{}{}.txt".format(filename_base, i)) ax = fig.add_subplot(1, n, i+1) draw_state(ax, grid, "T={:.2f}".format(T)) fig.tight_layout()
draw_states("states", 3)
As expected! At low temperatures, there is little thermal energy and the spin interactions dominate. This results in mostly uniform states. With rising temperatures, the thermal fluctuations become stronger and eventually turn the system into random noise.
# !magneto -L=30 -TSteps=15 -en=energy -dist=normal -alg=sw -N1=10 -N2=100 Tc = 2.0/np.log(1+np.sqrt(2)) ax = plt.subplot(xlabel="T/T_c", ylabel="Energy", ylim=(-2,0), xlim=(0,2)) T, E = np.loadtxt("energy.txt", delimiter=", ", unpack=True) ax.plot(T/Tc, E);
As expected! Here, the temperature on the x-axis was divided by a special temperature $T_c$ called the critical or Curie temperature. That's because a lot of things happen at that point.
To see that, we first have a look at the (specific) heat capacity $c_V$ of the system. It's a value that characterizes how much heat can be stored. Specifically: when you add an amount of heat $Q$ to a system and its temperature changes by $\Delta T$, the heat capacity is $\frac{Q}{\Delta T}$. Metal has a high heat capacity so it'll barely heat up if you add a certain amount of heat. But something like air will!
Statistical mechanics gives us two ways of calculating $c_V$. One is simply the temperature derivation of energy. The other is from its variance.$$c_V = \frac{dE}{dT} = \frac{1}{T^2}(\langle E^2\rangle - \langle E\rangle^2)$$
Let's look at both:
# !magneto -L=30 -TSteps=12 -cv=cv -dist=normal ax = plt.subplot(xlabel="T/T_c", ylabel="Heat capacity") # variance T, cv = np.loadtxt("cv.txt", delimiter=", ", unpack=True) ax.plot(T/Tc, cv, label="by variance") # derivation T, E = np.loadtxt("energy.txt", delimiter=", ", unpack=True) ax.plot(T[:-1]/Tc, np.diff(E)/np.diff(T), label="by derivation") ax.legend();
We see that both ways yield equal results up to a numerics. The heat capacity has a peak right at $T_c$. The 2D Ising system has been solved analytically, so the value of $T_c$ is known exactly:$$T_c=\frac{2}{\ln(1+\sqrt 2)}\approx 2.269$$
The peak looks sharp. In fact, the heat capacity diverges at $T_c$ if you would run the simulation on an infinitely large lattice etc!
Now we look at the magnetization of the total system, which is just the sum over all spins. It's basically what is left after the internal spin interactions are done with each other. A nonzero magnetization generates a magnetic field!
Systems with all negative or all positive spins result in the same energy and are therefore equally likely. Usually the absolute value is used because it makes the plots prettier and the calculations easier. So the (absolute) magnetization is $\lvert m \rvert=\lvert \sum \sigma_i \rvert$.
If we recall how the systems looked, it's easy to predict that magnetization should be at its maximum for low temperatures as those caused uniform systems. The mostly equal spins add up to some value. At high temps there should be equal numbers of both spins so we expect the magnetization to vanish. Let's have a look:
# !magneto -L=30 -TSteps=12 -N2=200 -mag=mag -dist=normal ax = plt.subplot(xlabel="T/T_C", ylabel="Magnetization |m|", xlim=(0,2), ylim=(0,1)) T, m = np.loadtxt("mag.txt", delimiter=", ", unpack=True) ax.plot(T/Tc, m);
Bingo! And now it's easy to see why $T_c$ is so important. It's the temperature where the magnetization of the system becomes zero. More generally, the system undergoes a phase transition, which is an important concept in physics. Usually there are two types of phase transitions: "First order" ones, for example the boiling and evaporating of water. And "second order" or continuous transitions like this system, which is actually a model for the transition between the ferromagnetic and paramagnetic phase.
Ferromagnetism means that when an external magnetic field is applied, the electron spins lign up with it and cause themselves a big magnetization. This only works at temperatures below the critical point. We saw that at low temperatures the spins are mostly uniform. When even a small external field is applied, they'll easily align to it.
Above $T_c$, magnetization is heavily disturbed by thermal fluctuations. An external field can still "force" the spins to align, but this paramagnetism is typically much weaker than ferromagnetism. Common magnets you can buy are therefore all in the ferromagnetic phase. They would lose their strength above their Curie temperature, which is quite high for quantum reasons.
How strong a system reacts to an external field is quantified by the magnetic susceptibility $\chi$. It's the factor between an externally applied magnetic field and the resulting magnetization of the system. Or: It's a measure of how strong the system responds to external fields. There are several ways to calculate it. One is by variance of the magnetization:$$\chi=\frac{1}{T}(\langle m^2\rangle - \langle m\rangle^2)$$
The other is to look at the correlation between two spins $\sigma_i$ and $\sigma_j$, measured by the correlation function:$$G(i,j) = \langle\sigma_i \sigma_j\rangle - \langle\sigma_i\rangle \langle\sigma_j\rangle $$
We can rewrite that as $G(d)$ with the distance between spins $d=\lvert i-j\rvert$. It's intuitive that the correlation between spins decreases with distance. In fact it's proportional to an exponential function: $G(d)\sim \exp(-\frac d \xi)$. The parameter $\xi$ is called correlation length and summarizes the character of the correlation. It can be interpreted as average size of clusters or as typical range of spin fluctuations. Let's look at some correlation functions:
# !magneto -L=60 -TSteps=9 -TMin=2.0 -TMax=2.6 -N2=100 -N3=1000 -corr=chi_corrfun -alg=metro -N1=5000 def corr_fun(x, corr_len, a): return np.exp(-x/corr_len)*a def ln_corr_fun(x, corr_len, a): return -x/corr_len + np.log(a) def lower_range(data, threshold): end_index = np.argmax(data<threshold) if end_index == 0: end_index = len(data) return data[:end_index] ax = plt.subplot(xlabel="Distance d", ylabel="Correlation function G(d)") data = np.loadtxt("chi_corrfun.txt", delimiter=", ") for i, T_index in enumerate([0,4,-1]): [T], corr_fun_data = np.split(data[T_index], [1]) corr_fun_data = lower_range(corr_fun_data, threshold = 0.01) distance = np.arange(corr_fun_data.size) corr_fun_data = np.log(corr_fun_data) [xi, a], _ = curve_fit(ln_corr_fun, distance, corr_fun_data) ax.semilogy(distance, np.exp(corr_fun_data), "o", color=colors3[i], label="T={:.2f}, $\\xi$={:.1f}".format(T, xi)) ax.semilogy(distance, np.exp(ln_corr_fun(distance, xi, a)), "-", color=colors3[i]) plt.legend(loc="lower right");
Note the logarithmic y-axis. The correlation vanishes in the distance - good! But at $T_c$ it does so infinitely slow, or: The correlation length $\xi$ is infinitely long. At least it would be if the lattice would be that big. In practice, $\xi$ is as big as the lattice itself! That means the spins correlate and interact with each other over the entire lattice!
To illustrate this, we'll look at the system at these exact temperatures and sizes again. With enough good will, the correlation length can be imagined as the average cluster size.
# !magneto -N1=100 -N2=0 -TMin=2.0 -TMax=2.6 -L=60 -TSteps=3 -states=states_corr -alg=sw draw_states("states_corr", n=3)
Since $G$ was an exponential function which quickly went to 0, the fit isn't trivial. The small values are difficult to pin down precisely and were cut at a threshold. That's also the reason why it's next to impossible to calculate correlations at very high or low temperatures: The correlation is simply too small to reasonably do numerics with it.
Also at $T_c$ it can be seen that the finite size of the lattice becomes a problem since the first few values make the result much worse. They could be "discussed away", depending on mood and effort.
The connection beween correlation lenght and susceptibility is given by$$\chi \sim \frac 1 T \xi$$
Before we look at that connection in more detail, let's calculate the susceptibility with the two discussed methods:
# !magneto -L=60 -TMin=2.0 -TMax=2.6 -TSteps=9 -N2=100 -N3=10 -chi=chi -dist=normal -N1=10 -alg=sw ax = plt.subplot(xlabel="T/T_c", ylabel="Magnetic susceptibility $\chi$") T, chi = np.loadtxt("chi.txt", delimiter=", ", unpack=True) ax.plot(T/Tc, chi, label="by variation") data = np.loadtxt("chi_corrfun.txt", delimiter=", ") T = data[:,0] chi_corrfun = [] for i in range(9): _, corr_fun_data = np.split(data[i], [1]) corr_fun_data = lower_range(corr_fun_data, threshold = 0.01) distance = np.arange(corr_fun_data.size) [xi, a], _ = curve_fit(ln_corr_fun, distance, corr_fun_data) chi_corrfun.append(xi/T[i]) ax.plot(np.asarray(T/Tc), np.asarray(chi_corrfun), "red", label="by correlation") plt.legend();
The susceptibility can be used to look at the critical behaviour with more detail. Not only does it diverge at $T_c$, but like many properties it follows a power law. If we define a "reduced temperature" $\tau=\frac{T-T_c}{T_c}$, then $\chi$ is on both sides of the divergence proportional to $\lvert\tau\rvert^{-\gamma}$. That $\gamma$ is called a critical exponent.
For our 2D ising case, the theoretical value is $\frac 7 8$. Let's try to calculate it with a fit. We'll do the same calculation, but closer "zoomed in" and with a longer calculation.
# !magneto -L=60 -TSteps=15 -N2=200 -N3=10 -chi=chi_exp -TMin=2.7 -TMax=3.5 -dist=normal -alg=sw -N1=10 ax = plt.subplot(111, xlabel="Reduced temperature $\\tau$", ylabel="Magnetic susceptibility $\chi$") # Fit def chi_fit(tau, gamma, a): return a*np.power(tau,-gamma) T, chi = np.loadtxt("chi_exp.txt", delimiter=", ", unpack=True) tau = (T-Tc)/Tc popt, pcov = curve_fit(chi_fit, tau, chi) # Plot ax.plot(tau, chi, "o", label="data") ax.plot(tau, chi_fit(tau, *popt), "--", label="fit") ax.legend(loc="upper right") # Result gamma = popt[0]; gamma0 = 1.75 print("gamma: {:.2f}, deviation: {:.1f}%".format(gamma, 100.0*(gamma-gamma0)/gamma0))
gamma: 1.63, deviation: -6.8%
This run was within ±10%.
There are many other critical exponents and they can all be found like this. It's a very general principle that can be found not only in Ising models but many others.
So we have limited computer speed and therefore have to use a finite system size $L$. The effect of that is that the calculated positions of $T_c$ drift away from the theoretical value for grids with finite size. That drift can be used to extrapolate the ideal value for $L\to\infty$.
To do so, we use a trick: The critical temperature is plotted against the inverse grid size. Since the inverse grid size of an infinitely large grid is $\frac 1 L = 0$, we just read the fit value there. That results in a much better value of $T_C$ than any of the direct computations.
There are different ways to get $T_c$ out of those plots. One way would be to take the peak position. But the data is often noisy, so a fit often is better. The correct function to fit would be $\lvert\tau\rvert^{-\gamma}$ but I found it very hard to make it converge. Instead a normal function worked much better. Example for one grid size:
# !magneto -L=8 -TSteps=12 -TMin=2.0 -TMax=3.5 -alg=sw -N2=500 -N3=30 -chi=chi_finite_8 # !magneto -L=10 -TSteps=12 -TMin=1.8 -TMax=2.8 -alg=sw -N2=400 -N3=30 -chi=chi_finite_10 # !magneto -L=12 -TSteps=15 -TMin=2.0 -TMax=3.5 -alg=sw -N2=300 -N3=25 -chi=chi_finite_12 # !magneto -L=16 -TSteps=15 -TMin=2.0 -TMax=3.5 -alg=sw -N2=200 -N3=20 -chi=chi_finite_16 # !magneto -L=32 -TSteps=15 -TMin=1.8 -TMax=3.0 -alg=sw -N2=200 -N3=20 -chi=chi_finite_32
from scipy.stats import norm def chi_fun(x, x0, sigma, a, b): return norm.pdf(x, x0, sigma)*b + x*a L = 8 T, cv = np.loadtxt("chi_finite_{}.txt".format(L), delimiter=", ", unpack=True) popt, _ = curve_fit(chi_fun, T, cv, p0=[ 2.45, 0.1, 0.8, 0.6]) plt.title("Example of fit for L={}. Resulting Tc={:.2f}".format(L, popt[0])) plt.plot(T, cv, "o") plt.plot(T, chi_fun(T, *popt), "-");
And for all of them, with the fit:
# Plot critical temps vs inverse grid sizes grid_sizes = np.array([8,10,12,16,32]) L_inv = 1.0/grid_sizes T_critical_array = [] for L in grid_sizes: T, cv = np.loadtxt("chi_finite_{}.txt".format(L), delimiter=", ", unpack=True) popt, _ = curve_fit(chi_fun, T, cv, p0=[ 2.45, 0.1, 0.8, 0.6]) Tc0 = popt[0] T_critical_array.append(Tc0) ax = plt.subplot(xlabel="1/L", ylabel="Critical temperature", title="$T_c$ for different L") ax.plot(L_inv, T_critical_array, "o") ax.set_xticks(np.arange(0, 0.16, 0.05)) # Fit with a linear function def T_fit(x,a,b): return a+b*x popt, pcov = curve_fit(T_fit, L_inv, T_critical_array) x = np.linspace(0, 0.14) ax.plot(x, T_fit(x, *popt), "--") # Result gamma = popt[0]; gamma0 = 1.75 T_c_fit = T_fit(0, *popt) print("Calculated Tc: {:.3f}, deviation: {:.2f}%".format(T_c_fit, 100.0*(T_c_fit-Tc)/Tc)) ax.axhline(y=Tc, marker="");
Calculated Tc: 2.280, deviation: 0.47%
This fit was within 1% of the theoretical value!
We've seen at the beginning that for a lattice length of $L$ there are $2^{L\cdot L}$ possible configurations. Now one could generate all of them and weigh them with the Boltzmann factor $e^{-H/T}$. A much better approach is to generate the system configurations in a way so that they come out Boltzmann distributed.
The most popular way to do this is the Metropolis algorithm. It's based on markov chains and uses an equilibrium condition called detailed balance to prove a simple assumption: If the system is in a state with energy $E_0$ and we flip the value of a single spin so that the system has now $E_1$, the probability to accept that change should be:$$p=\min\left(1, \exp\left(-\frac{\Delta E}{T}\right)\right) \quad \text{ with } \Delta E=E_1-E_0$$
ax = plt.subplot(xlabel="$\Delta E$", ylabel="Probability", ylim=(0,1.1), title="Metropolis acceptance probability") dE = np.linspace(-2, 2) for i, T in enumerate([0.8, 1.5, 3.5]): ax.plot(dE, np.minimum(1, np.exp(-dE/T)), "-", label="T={}".format(T), color=colors3[i]) ax.legend();
That's quite simple and elegant! But Metropolis suffers from an effect called critical slowing down. That means it becomes increasingly ineffective near the critical temperature. To understand, recall that the system has large clusters of identical spins there. Those clusters are energetically stable. And because of their size, a single spin flip like in Metropolis isn't doing much.
As demonstration, we'll use a disk as an ideal cluster. We generate and save it with NumPy, then use it in magneto as starting configuration. The result is an animation of the first 100 metropolis sweeps on such a system.
L=80; a=L//2; r=30 y,x = np.ogrid[-a:L-a, -a:L-a] mask = x*x + y*y <= r*r array = np.zeros((L,L), dtype=int) array[mask] = 1 plt.grid(False) plt.imshow(array, cmap=plt.cm.Greys, interpolation="none") np.savetxt("circle.txt", array, fmt='%1u', delimiter=",")
# !magneto -N1=0 -N3=1 -N2=100 -TMin=2.0 -L=80 -TSteps=1 -states=slowdown_metro -alg=metro -initial=circle.txt -record=main def writeIsingMovie(file_in, file_out): fig = plt.figure(figsize=(1,1)) data = np.loadtxt(file_in, delimiter=",", skiprows=1) L = data.shape[1] grids = np.split(data, data.shape[0]/L) images = [] for grid in grids: images.append([plt.imshow(grid, cmap=plt.cm.Greys, interpolation ="none")]) plt.axis('off') plt.subplots_adjust(left=0.0, right=1.0, top=1.0, bottom=0.0) ani = animation.ArtistAnimation(fig, images, blit=True) ani.save(file_out, dpi=L*2, fps=25, extra_args=['-vcodec', 'libvpx', "-quality", "good", "-b:v", "350k"]) writeIsingMovie("slowdown_metro0.txt", "slowdown.webm")
%%html <video controls loop autoplay> <source src="slowdown.webm"> </video>
Even after 100 sweeps the cluster still isn't completely gone!
There is another class of algorithms called cluster algorithms, especially Swendsen-Wang. It works by starting a BFS (Breadth-first search) at every grid point to cover the entire grid. But the cluster can only contain same spins and is limited by a probability similar to Metropolis. Cluster algorithms don't suffer from critical slowing down. For demonstration, let's look at the same disk configuration again and only look at the first three Swendsen-Wang steps.
# !magneto -N1=0 -N3=1 -N2=5 -TMin=2.3 -L=80 -TSteps=1 -states=slowdown_sw -initial=circle.txt -record=main -alg=sw fig = plt.figure(figsize=(9,3)) data = np.loadtxt("slowdown_sw0.txt", delimiter=",", skiprows=1) L = data.shape[1] grids = np.split(data, data.shape[0]/L) for i in range(3): ax = fig.add_subplot(1, 3, i+1) ax.grid(False) ax.imshow(grids[i], cmap=plt.cm.Greys, interpolation="none") fig.tight_layout()
It's gone almost instantly. | https://nbviewer.ipython.org/github/s9w/magneto/blob/master/physics.ipynb | CC-MAIN-2021-49 | refinedweb | 3,830 | 52.26 |
#include <Ethernet.h>byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };byte ip[] = { 10, 0, 0, 177 };byte server[] = { 64, 233, 187, 99 }; // GoogleClient client(server, 80);
if (client.connect(server, 80)) {
if (client.connect(server, 81)) {
Are you using Arduino 1.0? Are you using Files->Examples->Ethernet->WebClient?
When you changed the IP address to the server on your local network did you also change the line:Code: [Select] if (client.connect(server, 80)) {toCode: [Select] if (client.connect(server, 81)) {
Does it work from a web browser when you use ""?
Have you tried changing "GET /search?q=arduino HTTP/1.0"? | http://forum.arduino.cc/index.php?topic=103940.msg779869 | CC-MAIN-2015-35 | refinedweb | 104 | 69.28 |
Hello,
I'm searching for a way to extract all text elements from a matplotlib
figure including their positions, styles, alignments etc. I first
tried to write a custom backend and to fetch all the texts from the
"draw_text()" method of the renderer. In contrast to the documentation
"draw_text()" does not receive a matplotlib.text.Text instance with
all the necessary information but only a simple string and a
pre-layouted position.
So I found this "findobj" method to get all Text elements from a
figure in a list, which is exactly what I was looking for. However, I
get some weird duplicates for all the tick labels and I don't know how
to handle them.
This is a small example that uses findobj on the axis objects and
prints the texts.
import matplotlib
import pylab as p
p.plot([1,2,3])
p.xticks([1],["tick"])
ax = p.gca()
fig = p.gcf()
p.draw()
def print_texts(artist):
for t in artist.findobj(matplotlib.text.Text):
if t.get_visible() and t.get_text():
print " %s @ %s" % (t.get_text(), t.get_position())
print "X-Axis"
print_texts(ax.xaxis)
print "Y-Axis"
print_texts(ax.yaxis)
On all my matplotlib installations, all tick labels have duplicates
positioned at the end of the axis. Why? How to filter them out from a
list of Text elements? Their get_visible() attribute is True.
Another thing is that I first had to do a "draw()" call in order to
have the ticks generated/updated at all. How do I force an update of
the tick labels. Colorbar seems to have a "update_ticks()" method, but
I can't find something similar for the axis ticks. | https://discourse.matplotlib.org/t/duplicate-ticks/17019 | CC-MAIN-2022-21 | refinedweb | 276 | 68.67 |
Assemblies in .NET
Assemblies form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions for a .NET-based application. Assemblies take the form of an executable (.exe) file or dynamic link library (.dll) file, and are the building blocks of the .NET applications. They provide the common language runtime with the information it needs to be aware of type implementations. You can think of an assembly as a collection of types and resources that form a logical unit of functionality and are built to work together.
In .NET Core and .NET Framework, an assembly can be built from one or more source code files. In .NET Framework, assemblies can contain one or more modules. This allows larger projects to be planned in such a way that several individual developers work on separate source code files or modules, which are combined to create a single assembly. For more information about modules, see How to: Build a Multifile Assembly.
Assemblies have the following properties:
Assemblies are implemented as .exe or .dll files.
For libraries that target the .NET Framework,#) or Reflection (Visual Basic).
You can load an assembly only to inspect it by calling a method Assembly.ReflectionOnlyLoadFrom.
Assembly manifest
Within every assembly is an assembly manifest. Similar to a table of contents, the assembly manifest contains the following:
The assembly's identity (its name and version).
A file table describing all the other files that make up the assembly, such as are available to all other applications. In .NET Core, they are coupled with a particular .NET Core runtime. In .NET Framework, they reside in the global assembly cache. The System.IO namespace is an example of an assembly in the global assembly cache. Private objects must be in a directory at either the same level as or below the directory in which your application is installed.
Because assemblies contain information about content, versioning, and dependencies, the applications that use them need can use the using directive for C# or Imports statement for Visual Basic to choose the namespace of the items you want to use. Once an assembly is referenced and imported, all the accessible types, properties, methods, and other members of its namespaces are available to your application as if their code were part of your source file.
Note
Most assemblies from the .NET Class Library are referenced automatically. In some cases, though, a system assembly may not automatically be referenced. In .NET Core, you can add a reference to the NuGet package that contains the assembly either by using NuGet Package Manager in Visual Studio or by adding a <PackageReference> element for the assembly to the *.csproj or *.vbproj project. In .NET Framework, you can add a reference to the assembly by using the Add Reference dialog in Visual Studio or by using the
-reference command line option for the C# or Visual Basic compilers.
In C#, you can also use two versions of the same assembly in a single application. For more information, see extern alias.
Creating an assembly
Compile your application by building it in Visual Studio, by building it from the command line by using .NET Core command-line interface (CLI) tools, or by building .NET Framework assemblies with a command-line compiler. For more information about building assemblies using .NET CLI tools, see .NET Core command-line interface (CLI) tools. For building assemblies with the command-line compilers, see Command-line build with csc.exe for C# and Building from the Command Line for Visual Basic.
Note
To build an assembly in Visual Studio, on the Build menu choose Build.
See also
- .NET assembly file format
- Assemblies in the Common Language Runtime
- Friend Assemblies
- How to: Load and Unload Assemblies (C#)
- How to: Load and Unload Assemblies (Visual Basic)
- How to: Use and Debug Assembly Unloadability in .NET Core
- How to: Determine If a File Is an Assembly (C#)
- How to: Determine If a File Is an Assembly (Visual Basic)
Feedback | https://docs.microsoft.com/en-us/dotnet/standard/assembly/index | CC-MAIN-2019-35 | refinedweb | 661 | 56.15 |
Khaleel Yusuf13,526 Points
Write a function named time_machine that takes an integer and a string of "minutes", "hours", "days", or "years". This d
I need so much help.
import datetime starter = datetime.datetime(2015, 10, 21, 16, 29) # Remember, you can't set "years" on a timedelta! # Consider a year to be 365 days. ## Example # time_machine(5, "minutes") => datetime(2015, 10, 21, 16, 34)
6 Answers
Logan R22,556 Points
Hi!
This challenge took me a second to understand as well when I did it, so no worries.
What it's really saying is that they are going to give you a number and a unit of time. It wants you to add that much time to the
starter variable. So let's say that starter is today and I pass in
5 and
days. It wants you to return the starter date plus 5 days.
So IE:
starter = ... def time_machine(time, units): if units == "days": return datetime.timedelta(days=time) + starter ...... time_machine(5, "days") # Returns the "starter" date + 5 days.
Hopefully this helps you out!
Logan R22,556 Points
You need to look at each unit case ("minutes", "hours", "days", and "years") and return the appropriate time delta for each one. In the example code I posted in the original answer, it already has "days" completed.
Khaleel Yusuf13,526 Points
import datetime starter = datetime.datetime(2015, 10, 21, 16, 29) def time_machine(time, units): if units == "days": return datetime.timedelta(days=time) + starter else if units == "minutes": return datetime.timedelta(minutes=time) + starter else if units == "hours": return datetime.timedelta(hours=time) + starter time_machine(5, "days")
Logan R22,556 Points
So you're pretty close. You still need to add the
years block, the
else if should be
elif, and you don't need to call the
time_machine (5, "days"). It will call it automatically. I just added that as an example for what it would look like to call the function.
You're almost there ;) Just don't forget that there is no
years for timedelta. You need to use days and multiply by 365!
Logan R22,556 Points
Logan R22,556 Points
The dots are just a way to say that there's more code that just isn't shown. | https://teamtreehouse.com/community/write-a-function-named-timemachine-that-takes-an-integer-and-a-string-of-minutes-hours-days-or-years-this-d-3 | CC-MAIN-2018-26 | refinedweb | 374 | 84.68 |
Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How to pull the right columns from a data source
My code so far:
import re
template=My name is [name] and on [date] I have to give [amount] to my friend.
placeholder = re.compile('(\[([a-z]+)\])')
find_placeholder = placeholder.findall(template.text)# get the template
for tgt in tgt_ids: #for each target(i have many),get the name,date,amount
name = self.pool.get(model).browse(cr, uid, tgt).name # the model is res.partner
date = self.pool.get(model).browse(cr, uid, tgt).date
amount = self.pool.get(model).browse(cr, uid, tgt).credit_limit
val = {'val_name': name,
'val_date': date,
'val_amount': amount,
}
message = template.text
for placeholder, key in find_placeholders:
message = message.replace(placeholder, val.get('val_' + key, placeholder))
print message
This is working right now, but if i want to get data from another data source(maybe external), probably the fields will have a different name.
For example - The key `name` might be changed to `first_name` or `date` to `payment_date`.
I want the code to be more flexible and to choose the right field every time. Is there any way to do this? Or do I have to change my code every time I change the source?Any ideas?
About This Community
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now | https://www.odoo.com/forum/help-1/question/how-to-pull-the-right-columns-from-a-data-source-87011 | CC-MAIN-2017-39 | refinedweb | 255 | 60.72 |
I am working on one of my excercises in a terrible book. C by disection by al kelly / ira pohl. For a beginning c programing book it is poorly illustrated with examples. The excercises dont match the stuff taught in the chapters. I know you dont want to here complaining.
To the point. This example wants me to take the example program in the book and add a CLS or clear command at the beginning of the program. ONLY THING IS THERE IS NOTHING ON THE CLEAR COMMAND IN THE BOOK.
can someone give me the command and suggest where to drop it in the program.
Here is the program:
main.c
in get.cin get.cCode:#include "heads_or_tails.h" int main(void) { char ans; int no_of_plays; cls printf("\n" "THE GAME OF HEADS OR TAILS\n" "\n" "Do you want instructions? "); scanf(" %c", &ans); putchar('\n'); if (ans == 'y' || ans == 'Y') prn_instructions(); printf("How many times do you want to play? "); scanf("%d", & no_of_plays); putchar('\n'); play( no_of_plays); return 0; }
in heads_or_tails.hin heads_or_tails.hCode:#include "heads_or_tails.h" int get_call_from_user(void) { int guess; /* 0 = heads, 1 = tails */ do { printf("Call it: "); if (scanf("%d", &guess) != 1) { printf("\nSORRY: Severe input error - bye!\n\n"); exit(1); } if (guess != 0 && guess != 1) { printf("\n%s\n\n", "ERROR: Type 0 for heads, 1 for tails."); } } while (guess != 0 && guess != 1); return guess; }
in play.cin play.cCode:#include <stdio.h> #include <stdlib.h> #define MAXWORD 100 int get_call_from_user(void); void play(int how_many); void prn_final_report(int win, int lose, int how_many); void prn_instructions(void); void report_a_win(int coin); void report_a_loss(int coin); int toss(void);
in prn1.cin prn1.cCode:#include "heads_or_tails.h" void play(int how_many) /* machine tosses, user calls */ { int coin, i, lose = 0, win = 0; for (i = 0; i < how_many; ++i) { coin = toss(); if (get_call_from_user() == coin) { ++win; report_a_win(coin); } else { ++lose; report_a_loss(coin); } } prn_final_report(win, lose, how_many); } int toss(void) { return (rand() % 2); /* 0 = heads, 1 = tails */ }
Code:#include "heads_or_tails.h" void prn_instructions(void) { printf("%s\n", "This is the game of calling heads or tails.\n" "I will flip a coin; you call it. If you\n" "call it correctly, you win; otherwise,\n" "I win.\n" "\n" "As I toss the (simulated) coin, I will\n" "tell you to \"call it.\" To call heads,\n" "type 0; to call tails, type 1.\n" "\n"); } void prn_final_report(int win, int lose, int how_many) { printf("\n%s\n%s%3d\n%s%3d\n%s%3d\n\n", "FINAL REPORT:", " Number of games that you won: ", win, " Number of games that you lost: ", lose, " Total number of games: ", how_many); } | https://cboard.cprogramming.com/c-programming/78877-placing-clear-cls-command-beginning-program-help-needed.html | CC-MAIN-2017-13 | refinedweb | 442 | 75.1 |
Create external content types for SQL Server in SharePoint
Learn how to create an external content type for SQL Server in SharePoint.
Creating an external content type is a pivotal task when you are working with external data. An external content type contains important information about connections, access, methods of operation, columns, filters, and other metadata that is used to retrieve the data from the external data source.
Before you begin
Working with external data requires several prerequisite tasks to enable secure access to the data. The following information can help you plan your next steps. Also, if you have problems trying to work with external data, this information can help you identify the issue. To access external data, you or an administrator must do the following:
Prepare SQL Server A database administrator needs to provide permissions to make sure that that the right people have access to the data and that the data does not end up in the wrong hands. The database administrator must also create a SQL Server account that has db_owner permission. The database administrator might also want to create specific tables, views, queries, column aliases, and so on to limit the results to just what is needed and to help improve performance.
Configure SharePoint services An administrator must activate Business Connectivity Services (BCS) and the Secure Store Service..
Be sure Office 2013 is ready to use To synchronize external data with Office 2013 products, you must use Windows 7 or a later version, and make sure that the Office installation option for Business Connectivity Services (BCS) is enabled (this is the default). This option installs the Business Connectivity Services Client Runtime which does the following: caches and synchronizes with external data, maps business data to external content types, displays the external item picker in Office products, and runs custom solutions inside Office products. You must also have SQL Server Compact 4.0, .NET Framework 4, and WCF Data Services 5.0 for OData V3 on each client computer (If necessary, you are automatically prompted to download the software).
Define general information
Start Microsoft SharePoint Designer 2013.
Click Open Site, and then enter the appropriate site name.
In the Navigation pane, under Site Objects, select External Content Types.
Note
SharePoint Designer 2013 groups external content types by the namespace in the initial window of the External Content Type Designer.
To open the External Content Type Designer, on the ribbon, click External Content Type.
On the New External Content Type page, do the following:
Next to Name, click New external content type, and then enter a unique name for the external content type.
Next to Display Name, enter a different name if you want a more descriptive display name.
Define general and Office behaviors
- In the Office Item Type drop-down list, select one of the following:
Generic List Select this option for any type of list.
Appointment, Contact, Task, or Post Select this option if you are creating a list that behaves like an Outlook Contact, Task, Appointment, or Post item. The Office item type that you select here determines the Outlook behavior that you want to attach to the external content type. For example, a Customer external content type behaves as a native Contact Item in Outlook.
In the Offline Sync for External List check box, make sure Enabled is selected, which is the default.
Note
If you disable this option, then the SharePoint Connect to Outlook command is not available for an external list.
Note
The Farm and Site feature, Offline Synchronization for External Lists, must also be active. This feature is active by default at the Farm level, but not active by default at the site level.
Create a connection to the external data
To specify the SQL Server database for the external content type, click Click here to discover external data sources and define operations.
Click Add Connection, select SQL Server in the External Data Source Type Selection dialog box, and then click OK.
In the SQL Server Connection dialog box, enter the name of the server, the database name, an optional description, and then click OK.
To choose an authentication mode, select one of the following:
Connect with User's Identity Uses the Pass-through authentication mode.
Connect with Impersonated Windows Identity Uses the WindowsCredentials authentication mode.
Connect with Impersonated Custom Identity Uses the RDBCredentials authentication mode.
In the Secure Store Application ID box, enter the target application ID name created in the Secure Store Service.
Click OK.
SharePoint Designer 2013 validates and tests the connection information. If you see messages, you must resolve them before you continue.
Select a table, view, or routine
In the Data Source Explorer, expand the database to view the tables, views, and routines that it contains.
Select a table, view, or routine.
Define operations
- In the Data Source Explorer, right-click the table, view, or routine, and then select one of the following:
Create All Operations Defines a create item, delete item, read item, read list, and update item operation.
Note
Create All Operations is available only for tables and views. Routines require specific operations.
New Read Item Operation Defines a read item operation.
New Read List Operation Defines a read list operation.
New Update Operation Defines an update item operation.
New Delete Read Defines a delete item operation.
Refresh Refreshes the list of tables, views, and routines in the Data Source Explorer.
- Click Next.
Note
- On views that span multiple tables, make sure that that write operations are supported. Otherwise, Create All Operations or New Update Operation might fail.
- Always define at least a New Read Item Operation and New Read List Operation because SharePoint features, such as external lists, rely on these operations.
- Choose specific operations, instead of Create All Operations, when the table or view does not support certain operations.
Add columns
To specify the columns that you want to display from the table or view, click Next.
In the Parameters Configuration dialog box, by default all columns (known as Data Source Elements) are selected. To remove unnecessary columns, clear the corresponding check boxes.
Note
Unlike a native SharePoint list, you cannot change the column name of an external list. Consider using an SQL column alias to provide a more meaningful name or a shorter name.
To select an identifier field, click and highlight a field (typically a unique-valued field), and then under Properties, click Map to Identifier.
Important
To prevent specific fields from being updated, such as an ID or primary key field, clear the Required check box, but select the Read-Only check box, which is needed to retrieve items so you can update other fields.
Tip
Always carefully read the messages in the Errors and Warnings pane. They provide useful information to confirm your actions or troubleshoot any issues. Periodically click the Errors and Warnings pane and make sure that there are no more errors or warnings.
Map Outlook fields
If your external content type maps to an Outlook item type, you must map one or more fields from your external content type to the Outlook item.
- For the each field, do the following:
Click and highlight the field.
Under Properties, next to Office property, click the down arrow. and then select the appropriate matching field.
Note
You do not need to map all the corresponding fields. However, the fields shown in the following table must be mapped.
Table: Outlook item type mapped to Outlook item field
Unmapped fields, depending on the number, are displayed as extended properties as follows:
Adjoining Appended to the form region at the bottom of an Outlook form's default page (two to five fields).
Separate Added as a new page to an Outlook form (six or more fields).
Set up the external item picker control
The external item picker control allows users to select a field, such as an ID field or a field that has unique values, to conveniently choose an item. This control is available in SharePoint and Office 2013 products. For example, users can use this control to choose an item from an external list of customers and Word 2013 enables this control for use with content controls that are linked to external data columns.It's a good idea to select the specific columns you want to display in the external item picker control because the default operation is to show all the columns, which in most cases, is not necessary.
For each field that you want displayed in the external content item picker, click and highlight the field, and then under Properties, click the Show in Picker check box.
Click Next.
Note
All filters that you define are displayed in the external item picker control. Although you cannot remove specific filters from the external item picker control, you can define a default filter by clicking Is Default in the Filter configuration dialog box when you are creating or modifying the filter.
Define filters
If you do not define a filter, an external list returns all of the data up to the Business Connectivity Services (BCS) throttle limit (by default, 2,000 items) or all the data that is defined in the external content type, if less than the current throttle limit. In addition, the entire processing of the results occurs within the SharePoint product. It's a good idea to define at least one filter. In general, there are two types of filters that you need to be aware:
Data Source Filter When you create an external content type filter, which is known as a Data Source Filter, the filter operation occurs within the SQL Server database. This is important when you are working with lots of data because you can offload processing from SharePoint products to the external database and gain performance improvements. After you create the external list, you can use the Data Source Filter by creating a view that specifies different filter values in the Data Source Filter section of the List View settings page.
SharePoint filter Users can still filter the data by using a SharePoint filter, either the column header filter or by using the Filters section in the List View settings page. In this case, the filter operation occurs within the SharePoint product, not within the SQL Server database.
A good strategy to consider is to create a set of external list views based on specific Data Source Filters that make sure that larger amounts of data are filtered first in the external data source, and then users can further filter and refine the results by using SharePoint filters.
You can create several different types of filters. For each filter that you create, do the following:
Under Properties, next to Data Source Element, select a field.
Under Properties, next to Filter, click Click to Add to display the Filter Configuration dialog box.
Click Add Filter Parameter.
In the New Filter box, enter a filter name.
In the Filter Type box, select a filter type:
Comparisons
A Comparison filter limits what items are returned based on a condition (such as State = "New Jersey") and is converted to an SQL WHERE clause.
In the Filter Type box, select Comparison.
In the Operator box, select an operation.
In the Filter Field box, make sure that the field that you want to compare is selected..
Wildcards
A Wildcard filter limits what items are returned based on a user-entered string value (such as State Contains "New") and is converted to an SQL LIKE clause. Valid SQL Server wildcard characters are \* (asterisk) which means match any number of characters and \_ (underscore) which means match one and only one character.
In the Filter Type box, select Wildcard.
In the Filter Field box, select a field.. It's a good idea to enter an * (asterisk) as the default.
Limit
In most cases, you must define a Limit Filter for Read and Read List operations. If you do not define a **Default Limit** value, no data is retrieved from the external data source. Ensure that the default value that you enter for the limit filter is less than 2,000, because the default Business Connectivity Services (BCS) throttle is 2,000 items. You can increase this limit if it is necessary.
In the Filter Type box, select Limit.
In the Number box, enter a number.
If you want to display a list of possible matches ??n the external item picker control when there is more than one matching item, select Use to create match list in external item picker.
Under Properties, next to Default Value, enter the initial value that you want to filter by, if the user does not enter a value. If you do not enter a value, the external list does not display any items.
Click OK.
Note
The SQL Server database administrator might want to create specific tables, views, indexes, and optimized queries to limit the results to just what is needed and to help improve performance.
Page Number
Use the external content type Page Number to supersede the SharePoint page limit defined in the **List View** page of the external list. Here's the difference:
The external content type Page Number first processes the results within the SQL Server database, and then returns and displays only the number of rows determined by the Page Size value.
The SharePoint page limit returns all the rows up to the Default Value size from the SQL Server database, and then displays the number of rows determined by the SharePoint page limit value in the List View settings page.
Using the external content type Page Number is generally more efficient. In addition, the Order value helps make sure that an accurate display of the results returned.
In the Filter Type box, select Page Number.
In the Page Size box, enter a number.
In the Order box, select a sort direction.
Click OK.
Under Properties, next to Default Value, enter the initial value that you want to filter by, if the user does not enter a value. If you do not enter a value, the external list does not display any items.
If you want to display but not modify a field, click and highlight the field, and then under Properties, select Read-Only.
If you want to make sure that a field always has a value when it's created or modified, click and highlight the field, and then under Properties, select Required.
To provide a descriptive name in the external item picker control of the Data Source Element name, which is derived from the SQL Server column name, click and highlight the field, and then under Properties, in the Display Name box, enter a name.
To define a default value for the filter (which also displays in the Data Source Filter section of the List View settings page), under Filter Parameters, click and highlight the filter, and then in the Default Value box, enter an appropriate value. If you do not enter a value, then when that filter is used for the first time, no items are displayed.
Set the Title field for an external list
On the ribbon, click Summary View.
In the Fields section, under Field Name, select a field.
Important: In general, it's a good idea to make the Title a field that has a unique value. The Title field is used to display list or InfoPath forms. Once you set the Title field, you cannot change it.
On the ribbon, click Set as Title.
Complete the external content type
- On the Quick Access Toolbar, click Save. This stores the external content type definition in the Business Data Connectivity metadata store.
Note
To provide better performance, Business Data Connectivity caches all the objects in the metadata store and updates changes by using a timer job that runs every minute. It might take up to one minute for changes to propagate to all the servers in the farm, but changes are immediate on the server where you make the change.
The external content type is now available for use in SharePoint and Office 2013 products.
See also
Feedback | https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-create-external-content-types-for-sql-server-in-sharepoint?redirectedfrom=MSDN | CC-MAIN-2020-10 | refinedweb | 2,675 | 60.55 |
.
News:1 - 3 of 24
-.
- JavaOne conference coverage 2012 SearchOracle.com | 01 Oct 2012
Conference Coverage - Join TheServerSide.com and SearchOracle.com as we present conference coverage from JavaOne and Oracle OpenWorld.
VIEW ALL News ON Java server faces
Video:1 - 1 of 1
- An Introduction to JSF 2.0 Development Tutorial: Getting started 04 Feb 2011
Video - Want to learn JSF 2.0? Well, this tutorial, a first in a long set, will teach you how to configure a development environment with Tomcat 7, the Mojarra libraries from Sun/Oracle (jsf-impl.jar & jsf-api.jar), and it will then show you how to write,...
VIEW ALL Video ON Java server faces
Reference & Learning:1 - 3 of 38
- this...
-...
VIEW ALL Reference & Learning ON Java server faces
Expert Technical Advice:1 - 3 of 15
- A new HTTP protocol eases server-side development 04 Aug 2015
Tip - The HTTP protocol is finally getting its first major overhaul, bringing a number of improvements to managing the connections between servers and users.
- to define a portlet namespace and context paths using JSTL and JSP 29 Apr 2014
Tip - Learn how to define portlet namespaces and context paths using JSTL and the JSP expression language.
VIEW ALL Expert Technical Advice ON Java server faces | http://www.theserverside.com/resources/Java-server-faces | CC-MAIN-2015-35 | refinedweb | 211 | 56.15 |
diff -r e436fc4313f8 doc/core/howto/trial.xhtml --- a/doc/core/howto/trial.xhtml Wed Mar 28 11:38:49 2007 +0200 +++ b/doc/core/howto/trial.xhtml Wed Mar 28 11:39:33 2007 +0200 @@ -20,13 +20,15 @@ Twisted.
Let's say you want to create a calculation library. Create your project structure with a directory called calculus, a file called base.py (and a __init__.py file too).
Then you write a simple API to your user in base.py. Different strategies -apply here: some write first the tests, others write first the API. We're -not going to worry too much about that.+apply here: some like to write the tests first, others write the API first. +We're not going to worry too much about that.
# -*- test-case-name: calculus.test.test_base -*- @@ -47,11 +49,11 @@ class Calculation(object):
See, we've written the interface, not the code. Now we'll write what we expect the object to do. Create a test directory in the calculus one, with an -__init__.py file, and a test_base.py file. Open test_base.py. +__init__.py file, and a test_base.py file.
-To resume you'll have this structure: +To make a long story short, you'll have this structure:
Now open test_base.py and fill in the following code:+
from calculus.base import Calculation from twisted.trial import unittest @@ -97,7 +101,7 @@ class CalculationTestCase(unittest.TestC
To run the tests, call
trial calculus.test in the command
-line. You hould have the following output:
Running 4 tests. @@ -175,10 +179,14 @@ if you add additionnal log to your tests if you add additionnal log to your tests. -
Now that our tests failm when can actually implement the behaviour -expected:- -+
Writing code to match the tests' expectations+ +
Now that our tests fail whe can actually implement the expected behaviour +in calculus/base.py:+ ++# -*- test-case-name: calculus.test.test_base -*- + class Calculation(object): def add(self, a, b): return a + b @@ -193,7 +201,7 @@ class Calculation(object): return a / b-
Run trial again and hopefully your tests should now pass.+
Run trial again and hopefully your tests should now pass.Running 4 tests. @@ -210,14 +218,16 @@ PASSED (successes=4) PASSED (successes=4)+
Factoring out common test logic+
You may observe that our test file contains a lot of redundant code, which is bad. For this purpose, trial defines a setUp method that is called before each test methods: this allows you to build some objects that will be use in all your tests methods. Also, we'll use a parameterized test method.
Note that the counterpart of setUp is tearDown, which is called after -each tests (either it succeed or failed); it's mainly useful for cleanups -purpose.+each test, wherever it succeeded or failed; it's mainly useful for cleanup +purposes.from calculus.base import Calculation @@ -279,12 +289,12 @@ class CalculationTestCase(unittest.TestC-
The only useful thing here is the+
assertRaisesmethod, -which takes the method to run and its arguments and assert it raises the -given exception.
The only new thing here is the
assertRaisesmethod, +which takes the function or method to run and its arguments and checks that +it raises the given exception.
Surprisingly, there are not so much tests that failed. But we still need -to add some checking.+to add some checking in our Calculation object:# -*- test-case-name: calculus.test.test_base -*- @@ -317,17 +327,22 @@ class Calculation(object):
We just need a little trick because+raises a
int()of a string -raises a
ValueError.
ValueErrorwhen it fails.
Testing a protocol-
For the example, we'll create a custom protocol to make calculus within a +
We'll now create a custom protocol to invoke calculus within a telnet-like session. We'll basically call the command with the arguments and then get the commands.-
We first write the tests, and then explain what it does. Open the file calculus/test/test_remote.py.- -+
Creating and testing the server+ +
First we'll write the tests, and then explain what they do. +Open the file calculus/test/test_remote.py:+ ++from calculus.remote import RemoteCalculationFactory +from twisted.trial import unittest from twisted.test import proto_helpers class RemoteCalculationTestCase(unittest.TestCase): @@ -364,15 +379,18 @@ purpose. This way we can emulate a netwo
This concept is really important for Twisted. Even if there are many tests -inside Twisted that use network, most good tests don't. The problem with -unittests and network is that the network isn't reliable enough to be sure +inside Twisted that use the network, most good tests don't. The problem with +unittests and networking is that the network isn't reliable enough to be sure it'll have a sane behavior all the time. Thus it creates intermittent failures, -which is a pain for continuous integration. +which is a pain for continuous integration. By using a fake transport, we are +able to write 100% reliable tests.
Let's now implement this protocol in calculus/remote.py.+# -*- test-case-name: calculus.test.test_remote -*- + from twisted.protocols import basic from twisted.internet import protocol @@ -410,9 +428,13 @@ what methods you make accessible.
Now if you run the tests, everything should be fine! You can also run a server to test it with a telnet client.+
Creating and testing the client+
Of course you can't let your users with this: we'll now build a client to our server, to be able to use it inside a python program. And it'll serve our next purpose.+ +
We first add the following code at the end of calculus/test/test_remote.py:class ClientCalculationTestCase(unittest.TestCase): @@ -453,11 +475,13 @@ client part, so we instantiate the proto+ +
Also, you can see that we assert that we've gone through the callback -- -
cbusing a variable. It's very important, because sometimes, with -asynchronous code, your tests are passing but because your callbacks are not -called, which is generally a failure condition.
We would have written the+
_testmethod more naturally this way:
cbusing a variable. It's very important, because otherwise, with +asynchronous code, your tests may pass while your callbacks are not called, +which should be a failure condition. + +
Actually, we don't need to do this check explicitly, +since Trial can do it for us if our test methods return the Deferred objects. +Thus we could have written the test logic in the following way:def _test(self, operation, a, b, expected): @@ -469,13 +493,21 @@ called, which is generally a failure con d.addCallback(cb) self.proto.dataReceived("%d\r\n" % (expected,)) return d -- -
In this example, if you remove the- -
dataReceivedcall, your tests will -still succeed! That's because the callback is run synchronously, so returning the Deferred -from the test doesn't help. So in doubt, use the
calledpattern.
We'll now write the corresponding client.+ + def test_add(self): + return self._test('add', 7, 6, 13) + + def test_substract(self): + return self._test('substract', 82, 78, 4) + + def test_multiply(self): + return self._test('multiply', 2, 8, 16) + + def test_divide(self): + return self._test('divide', 14, 3, 4) +
We'll now write the client code at the end of calculus/remote.py:class RemoteCalculationClient(basic.LineReceiver): @@ -510,18 +542,19 @@ class RemoteCalculationClient(basic.Line
The client is really straightforward. We just factor operations, everything else should be obvious.-
Good pratices+
More good pratices
Testing scheduling-
That's one of the tough part of Twisted: having a callLater call hanging +
That's one of the tough parts of Twisted: having a callLater call hanging around and be able to determically test it. There's a convenient object for that in-
twisted.taskcalled
Clock.
The functionnality we'll use to test it is client request timeout: as it +
As an example we'll test the code for client request timeout: since our client uses TCP it can hang for a long time (firewall, connectivity problems, etc...). So generally we need to implement timeouts on the client side. Basically it's -just that we send a request, don't have response and expect a timeout error. +just that we send a request, don't receive a response and expect a timeout error +to be triggered after a certain duration.@@ -593,7 +626,7 @@ processes created in their tests. If it' processes created in their tests. If it's still not obvious, you must try to avoid that like the plague, because it ends up with a lot of problems, one of them being intermittent failures. And intermittent failures are the plague -to every automated tests. +of automated tests.
To actually test that, we'll launch a server with our protocol.@@ -624,7 +657,7 @@ class RemoteRunCalculationTestCase(unitt
stopListeningcall, which is good.
Also, you should be aware that tearDown will called in any case, after success -or failure. So don't expect that every objects you create in the test method are +or failure. So don't expect that every objects you created in the test method are present, because your tests may have failed in the middle.
Resolve a bug | http://twistedmatrix.com/trac/raw-attachment/ticket/2443/tut1.patch | CC-MAIN-2017-04 | refinedweb | 1,513 | 58.69 |
In this tutorial, we'll learn about the problems with styling React applications and how we can solve them using Styletron.
Introduction
I've been using React for quite some time now. In that time, the one thing which I've felt is most difficult while creating React applications is how to style them in a maintainable manner. There are various ways in which we can styles applications:
All of these will generate classes based on how we write the styles for each class.
const Button = styled.button` background: ${(props) => (props.primary ? "palevioletred" : "white")}; color: ${(props) => (props.primary ? "white" : "palevioletred")}; font-size: 1em; margin: 1em; padding: 0.25em 1em; border: 2px solid palevioletred; border-radius: 3px; `; render( <div> <Button>Normal</Button> <Button primary>Primary</Button> </div> );
The above code will generate the following HTML:
<div> <button class="sc-fzXfMz bXoZBN">Normal</button> <button class="sc-fzXfMz fLZIOt">Primary</button> </div>
It will also generate the following buttons:
The generate CSS will be:
.bXoZBN { color: palevioletred; font-size: 1em; background: white; margin: 1em; padding: 0.25em 1em; border-width: 2px; border-style: solid; border-color: palevioletred; border-image: initial; border-radius: 3px; } .fLZIOt { color: white; font-size: 1em; background: palevioletred; margin: 1em; padding: 0.25em 1em; border-width: 2px; border-style: solid; border-color: palevioletred; border-image: initial; border-radius: 3px; }
As we can see here that based on the styles, each component will generate a different class. This is very good when we want to create a component library or we want to create separate styles for everything in our application. The downside is that, as our application grows, the amount of styles also grows. In most cases, these styles are injected inline and are downloaded before the HTML is rendered on the page. Having a large amount of inline-styles will slow down the initial loading of your page. However, once the page is cached, the subsequent page loads will be faster.
What if the CSS-in-JS adapter we're using could generate classes for each style definition and then re-use them across all our components. For example, if our adapter could generate a class like:
.text-white { color: white; }
Then, this could be re-used in our component to generate HTML like:
<div> <button class="text-white bg-orange">Normal</button> <button class="text-white bg-red">Primary</button> </div>
In this case, the amount of styles will be much lesser as the adapter isn't creating new styles for all the components. Instead, it's creating classes for each style definition and re-using them for all our components.
This is exactly what Styletron does.
We can just code like:
import { useStyletron } from "styletron-react"; export default () => { const [css] = useStyletron(); return ( <a href="/getting-started" className={css({ fontSize: "20px", color: "red", })} > Start! </a> ); };
The above code will generate the following HTML:
<html> <head> <style> .foo { font-size: 20px; } .bar { color: red; } </style> </head> <body> <a href="/getting-started" class="foo bar">Start!</a> </body> </html>
It will also generate the following link:
Features of Styletron
Styletron has a host of features like:
- Defining our own Media Queries And Pseudo Classes
- Using CSS Selectors
- Using our own Fonts
- Using Keyframes
- Vendor Prefixes are added by Styletron
- Theming
- Testing
- Debugging
Usages
We can use Styletron with React. It already has examples for using with the following:
Conclusion
In this article, we've learnt about Styletron and how it can help us reduce the amount of styles that we ship with our application. I hope that this article helps you in your future projects. | https://nirmalyaghosh.com/articles/understand-component-oriented-styling-styletron | CC-MAIN-2022-21 | refinedweb | 596 | 53.51 |
Hackvent 2020 - leet(ish).
HV20.20
Challenge
On the twelfth day of Christmas my true love sent to me… twelve rabbits a-rebeling, eleven ships a-sailing, ten (twentyfourpointone) pieces a-puzzling, and the rest is history.
There is also a hint:
You should definitely give Bread’s famous easy perfect fresh rosemary yeast black pepper bread a try this Christmas!
Solution
HTML Page
Starting with the image,
binwalk shows embedded files within it, including an HTML page:
$ binwalk bfd96926-dd11-4e07-a05a-f6b807570b5a.png DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 PNG image, 1632 x 1011, 8-bit/color RGBA, non-interlaced 41 0x29 HTML document header 6152 0x1808 Base64 standard index table 6970 0x1B3A HTML document footer 7021 0x1B6D Zlib compressed data, default compression
Looking at the file in a text editor, there’s HTML tags including a block of JavaScript not too far from the top:
Click for full size image
I spent some time trying to cut the HTML page out of this file and get it to work, but it turns out the entire file is a polyglot, functioning as both an image or an HTML page. After making a copy with the
.html extension, it opens in Firefox and shows the picture. Clicking in the picture causes some whitespace to appear on top of the image (pushing it down the page) and a text area to appear under it, empty.
JavaScript Analysis
View-Source doesn’t seem to work on the page, but looking in the dev console, the script is there:
JSNice is a good way to clean up and make readable the script. There’s a
SHA1 function, which I tested in the console and does perform an actual SHA1-hash, and a
B64 function which does seem to do legit base64 encoding.
The
download function is interesting:
function download(uri, id) { /** @type {!Element} */ var a = document.createElement("a"); a.setAttribute("href", "data:application/octet-stream;base64," + id); a.setAttribute("target", "_blank"); a.setAttribute("download", uri); /** @type {string} */ a.style.display = "none"; pic.appendChild(a); a.click(); pic.removeChild(a); }
It creates a link on the page, clicks it, and then removes it. There’s also script a the bottom that runs the
dID function on page load.
window.onload = function() { /** @type {function(): undefined} */ px.onclick = dID; };
The
dID function
function dID() { /** @type {!Element} */ cvs = document.createElement("canvas"); /** @type {string} */ cvs.crossOrigin = px.crossOrigin = "Anonymous"; px.parentNode.insertBefore(cvs, px); cvs.width = px.width; /** @type {string} */ log.style.width = px.width + "px"; cvs.height = px.height; /** @type {string} */ log.style.height = "15em"; /** @type {string} */ log.style.visibility = "visible"; var passwd = SHA1(window.location.search.substr(1).split("p=")[1]).toUpperCase(); /** @type {string} */ log.value = "TESTING: " + passwd + "\n"; if (passwd == "60DB15C4E452C71C5670119E7889351242A83505") { log.value += "Success\nBit Layer=" + bL + "\nPixel grid=" + gr + "x" + gr + "\nEncoding Density=1 bit per " + gr * gr + " pixels\n"; /** @type {!Array} */ var channelOptions = ["Red", "Green", "Blue", "All"]; ...[snip drawing / decoding]... var length = parseInt(bTS(params.join(""))); g(length); log.value += "Total pixels decoded=" + b + "\n"; log.value += "Decoded data length=" + length + " bytes.\n"; pix.data = pdt; ctx.putImageData(pix, 0, 0); var downloadId = B64(bTS(params.join(""))); /** @type {string} */ var url = "11.py"; log.value += "Packaging " + url + " for download\n"; log.value += "Safari and IE users, save the Base64 data and decode it manually please,Chrome/edge users CORS, move to firefox.\n"; log.value += 'BASE64 data="' + downloadId + '"\n'; download(, and , downloadId); } else { log.value += "failed.\n"; } }
This function checks for a password to see if its SHA1 hash matches a static value, and then does a bunch of decoding and drawing, and eventually calls the
download function.
The SHA1 is 60DB15C4E452C71C5670119E7889351242A83505, which crackstation will break as “bunnyrabbitsrule4real”.
passwd is set here:
var passwd = SHA1(window.location.search.substr(1).split("p=")[1]).toUpperCase();
That’s getting the url, splitting on
p=, and returning the right half. I’ll add
?p=bunnyrabbitsrule4real to the end of the url, and now when I click on a rabbit, there’s a popup asking me to open or save
11.py:
There’s also some dots added above the bunnies:
Click for full size image
And that textarea has status in it:
Click for full size image
The status text is:
TESTING: 60DB15C4E452C71C5670119E7889351242A83505 Success Bit Layer=1 Pixel grid=2x2 Encoding Density=1 bit per 4 pixels Encoding Channel=All Image Resolution=1632x1011 Total pixels decoded=7352 Decoded data length=913 bytes. Packaging 11.py for download Safari and IE users, save the Base64 data and decode it manually please,Chrome/edge users CORS, move to firefox. BASE64 data="aW1wb3J0IHN5cwppID0gYnl0ZWFycmF5KG9wZW4oc3lzLmFyZ3ZbMV0sICdyYicpLnJlYWQoKS5zcGxpdChzeXMuYXJndlsyXS5lbmNvZGUoJ3V0Zi04JykgKyBiIlxuIilbLTFdKQpqID0gYnl0ZWFycmF5KGIiUmFiYml0cyBhcmUgc21hbGwgbWFtbWFscyBpbiB0aGUgZmFtaWx5IExlcG9yaWRhZSBvZiB0aGUgb3JkZXIgTGFnb21vcnBoYSAoYWxvbmcgd2l0aCB0aGUgaGFyZSBhbmQgdGhlIHBpa2EpLiBPcnljdG9sYWd1cyBjdW5pY3VsdXMgaW5jbHVkZXMgdGhlIEV1cm9wZWFuIHJhYmJpdCBzcGVjaWVzIGFuZCBpdHMgZGVzY2VuZGFudHMsIHRoZSB3b3JsZCdzIDMwNSBicmVlZHNbMV0gb2YgZG9tZXN0aWMgcmFiYml0LiBTeWx2aWxhZ3VzIGluY2x1ZGVzIDEzIHdpbGQgcmFiYml0IHNwZWNpZXMsIGFtb25nIHRoZW0gdGhlIHNldmVuIHR5cGVzIG9mIGNvdHRvbnRhaWwuIFRoZSBFdXJvcGVhbiByYWJiaXQsIHdoaWNoIGhhcyBiZWVuIGludHJvZHVjZWQgb24gZXZlcnkgY29udGluZW50IGV4Y2VwdCBBbnRhcmN0aWNhLCBpcyBmYW1pbGlhciB0aHJvdWdob3V0IHRoZSB3b3JsZCBhcyBhIHdpbGQgcHJleSBhbmltYWwgYW5kIGFzIGEgZG9tZXN0aWNhdGVkIGZvcm0gb2YgbGl2ZXN0b2NrIGFuZCBwZXQuIFdpdGggaXRzIHdpZGVzcHJlYWQgZWZmZWN0IG9uIGVjb2xvZ2llcyBhbmQgY3VsdHVyZXMsIHRoZSByYWJiaXQgKG9yIGJ1bm55KSBpcywgaW4gbWFueSBhcmVhcyBvZiB0aGUgd29ybGQsIGEgcGFydCBvZiBkYWlseSBsaWZlLWFzIGZvb2QsIGNsb3RoaW5nLCBhIGNvbXBhbmlvbiwgYW5kIGEgc291cmNlIG9mIGFydGlzdGljIGluc3BpcmF0aW9uLiIpCm9wZW4oJzExLjd6JywgJ3diJykud3JpdGUoYnl0ZWFycmF5KFtpW19dIF4galtfJWxlbihqKV0gZm9yIF8gaW4gcmFuZ2UobGVuKGkpKV0pKQA"
The data base64-decodes to the same Python file that is offered as a download.
Python Script
The Python script is simple, taking two arguments. The first is a file to open. The second is a string. It will open and read the file, and split it based on the second input string plus a newline, and take the last result.
It will then xor that result byte by byte with some text in the file, and write the result to
11.7z.
import sys i = bytearray(open(sys.argv[1], 'rb').read().split(sys.argv[2].encode('utf-8') + b"\n")[-1]) j = bytearray(b"Rabbits a source of artistic inspiration.") open('11.7z', 'wb').write(bytearray([i[_] ^ j[_%len(j)] for _ in range(len(i))]))
It’s fair to guess that the file is the original image file, but I need a string to give as the second arg. There’s two ways to find it.
First, this is where the hint recipe comes into play. It’s in the Chef esoteric programming language. Running it in this online interpreter produced a message box:
The other way to find the key is just to look for strings that end in a newline that might make a good key. This command returned a list of strings that all end in newline with between eight and fifteen printable characters proceeding it:
$ strings bfd96926-dd11-4e07-a05a-f6b807570b5a.png | grep -oP '\w{8,15}$' | less
Looking through the list, “breadbread” is in there.
Running the Python script with these inputs creates
11.7z, and it is in fact a a 7-zip archive:
$ python3 11.py bfd96926-dd11-4e07-a05a-f6b807570b5a.png breadbread $ file 11.7z 11.7z: 7-zip archive data, version 0.4
Docker Image
Extracting this archive with
7z x 11.7z produces a
.tar archive,
11.tar. Extracting that with
tar xvf 11.tar produces a handful of files:
./1c63adeddbefb62258429939a0247538742b10dfd7d95cdc55c5ab76428ec974/json ./1c63adeddbefb62258429939a0247538742b10dfd7d95cdc55c5ab76428ec974/layer.tar ./1c63adeddbefb62258429939a0247538742b10dfd7d95cdc55c5ab76428ec974/VERSION ./1d66b052bd26bb9725d5c15a5915bed7300e690facb51465f2d0e62c7d644649.json ./7184b9ccb527dcaef747979066432e891b7487867de2bb96790a01b87a1cc50e/json ./7184b9ccb527dcaef747979066432e891b7487867de2bb96790a01b87a1cc50e/layer.tar ./7184b9ccb527dcaef747979066432e891b7487867de2bb96790a01b87a1cc50e/VERSION ./ab2b751e14409f169383b5802e61764fb4114839874ff342586ffa4f968de0c1/json ./ab2b751e14409f169383b5802e61764fb4114839874ff342586ffa4f968de0c1/layer.tar ./ab2b751e14409f169383b5802e61764fb4114839874ff342586ffa4f968de0c1/VERSION ./bc7f356b13fa5818f568082beeb3bfc0f0fe9f9424163a7642bfdc12ba5ba82b/json ./bc7f356b13fa5818f568082beeb3bfc0f0fe9f9424163a7642bfdc12ba5ba82b/layer.tar ./bc7f356b13fa5818f568082beeb3bfc0f0fe9f9424163a7642bfdc12ba5ba82b/VERSION ./bfd96926-dd11-4e07-a05a-f6b807570b5a.png ./e0f45634ac647ef43d22d4ea46fce543fc1d56ed338c72c712a6bc4ddb96fd46/json ./e0f45634ac647ef43d22d4ea46fce543fc1d56ed338c72c712a6bc4ddb96fd46/layer.tar ./e0f45634ac647ef43d22d4ea46fce543fc1d56ed338c72c712a6bc4ddb96fd46/VERSION ./manifest.json ./repositories
Some googling with these terms will show this is a file related to Docker, specifically the output of the docker save command. The
manifest.json describes the config (
1d66b052bd26bb9725d5c15a5915bed7300e690facb51465f2d0e62c7d644649.json) and points to all the layers. I’ll come back to this config later.
I can load this
.tar directly into Docker:
# service docker start # make sure the Docker daemon is running # docker image load --input 11.tar ace0eda3e3be: Loading layer [==================================================>] 5.843MB/5.843MB f9a8379022de: Loading layer [==================================================>] 5.838MB/5.838MB 1c50319140b2: Loading layer [==================================================>] 12.29kB/12.29kB 5f70bf18a086: Loading layer [==================================================>] 1.024kB/1.024kB 56553910173d: Loading layer [==================================================>] 6.078MB/6.078MB Loaded image: 12stepsofchristmas:11 root@kali# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 12stepsofchristmas 11 1d66b052bd26 12 days ago 17.3MB
It now shows up in my list of local images:
# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE 12stepsofchristmas 11 1d66b052bd26 2 weeks ago 17.3MB
To get a shell, I’ll run the image with
-it:
# docker run -it 12stepsofchristmas:11 sh ~ $ id uid=1000(bread) gid=1000(bread)
There’s a single directory in
/home/bread, and bread can’t get into it or change it:
~ $ ls flimflam ~ $ cd flimflam/ sh: cd: can't cd to flimflam/: Permission denied ~ $ ls -l total 4 d--------- 2 root bread 4096 Dec 8 03:41 flimflam ~ $ chmod 777 flimflam/ chmod: flimflam/: Operation not permitted
I can just exit the container and enter again as root:
# docker run -u root -it 12stepsofchristmas:11 sh /home/bread # cd flimflam/ /home/bread/flimflam #
Assemble Image
The
flimflam directory contains 241 files, each containing 24,400 bytes (except the last one is smaller) of hex data:
/home/bread/flimflam # ls flomaa flomam flomay flombk flombw flomci flomcu flomdg flomds flomee flomeq flomfc flomfo flomga flomgm flomgy flomhk flomhw flomii flomiu flomjg flomab floman flomaz flombl flombx flomcj flomcv flomdh flomdt flomef flomer flomfd flomfp flomgb flomgn flomgz flomhl flomhx flomij flomiv flomac flomao flomba flombm flomby flomck flomcw flomdi flomdu flomeg flomes flomfe flomfq flomgc flomgo flomha flomhm flomhy flomik flomiw flomad flomap flombb flombn flombz flomcl flomcx flomdj flomdv flomeh flomet flomff flomfr flomgd flomgp flomhb flomhn flomhz flomil flomix flomae flomaq flombc flombo flomca flomcm flomcy flomdk flomdw flomei flomeu flomfg flomfs flomge flomgq flomhc flomho flomia flomim flomiy flomaf flomar flombd flombp flomcb flomcn flomcz flomdl flomdx flomej flomev flomfh flomft flomgf flomgr flomhd flomhp flomib flomin flomiz flomag flomas flombe flombq flomcc flomco flomda flomdm flomdy flomek flomew flomfi flomfu flomgg flomgs flomhe flomhq flomic flomio flomja flomah flomat flombf flombr flomcd flomcp flomdb flomdn flomdz flomel flomex flomfj flomfv flomgh flomgt flomhf flomhr flomid flomip flomjb flomai flomau flombg flombs flomce flomcq flomdc flomdo flomea flomem flomey flomfk flomfw flomgi flomgu flomhg flomhs flomie flomiq flomjc flomaj flomav flombh flombt flomcf flomcr flomdd flomdp flomeb flomen flomez flomfl flomfx flomgj flomgv flomhh flomht flomif flomir flomjd flomak flomaw flombi flombu flomcg flomcs flomde flomdq flomec flomeo flomfa flomfm flomfy flomgk flomgw flomhi flomhu flomig flomis flomje flomal flomax flombj flombv flomch flomct flomdf flomdr flomed flomep flomfb flomfn flomfz flomgl flomgx flomhj flomhv flomih flomit flomjf /home/bread/flimflam # head flomaa ffd8ffe000104a46494600010100000100010000ffdb0043000101010101 010101010101010102020302020202020403030203050405050504040405 0607060505070604040609060708080808080506090a09080a07080808ff db0043010101010202020402020408050405080808080808080808080808 080808080808080808080808080808080808080808080808080808080808 0808080808080808ffc000110808dc0fc003012200021101031101ffc400 1f0000010501010101010100000000000000000102030405060708090a0b ffc400b5100002010303020403050504040000017d010203000411051221 31410613516107227114328191a1082342b1c11552d1f02433627282090a 161718191a25262728292a3435363738393a434445464748494a53545556
This container doesn’t have
xxd with the
-r option, so I decided to exfil all the files out. First I created an archive:
/home/bread # tar -czf ff.tar.gz flimflam/ /home/bread # ls ff.tar.gz flimflam
Now just copy it out:
# docker cp 26e0b063e937:/home/bread/ff.tar.gz . # tar zxf ff.tar.gz
At this point I could go back to the config file from the container image, but I managed to guess the next step without that. I used
cat to dump all the files into
xxd -r -p to convert from hex to binary, and the resulting file was an image:
# cat * | xxd -r -p > flimflam.jpg # file flimflam.jpg flimflam.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 4032x2268, components 3
More bunnies!
StegHide
At this point, I need to look at how this image was created. In the docker tarball, there’s a json config file (I’ll
cat it into
jq . to pretty print it):
{ "architecture": "amd64", "config": { "User": "bread", "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh", "-c", "tail -f /dev/null" ], "WorkingDir": "/home/bread/", "ArgsEscaped": true, "OnBuild": null }, "created": "2020-12-08T14:41:59.119577934+11:00", "history": [ { "created": "2020-10-22T02:19:24.33416307Z", "created_by": "/bin/sh -c #(nop) ADD file:f17f65714f703db9012f00e5ec98d0b2541ff6147c2633f7ab9ba659d0c507f4 in / " }, { "created": "2020-10-22T02:19:24.499382102Z", "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", "empty_layer": true }, { "created": "2020-12-08T14:41:33.015297112+11:00", "created_by": "RUN /bin/sh -c apk update && apk add --update-cache --repository --allow-untrusted steghide xxd # buildkit", "comment": "buildkit.dockerfile.v0" }, { "created": "2020-12-08T14:41:33.4777984+11:00", "created_by": "RUN /bin/sh -c adduser --disabled-password --gecos '' bread # buildkit", "comment": "buildkit.dockerfile.v0" }, { "created": "2020-12-08T14:41:33.487504964+11:00", "created_by": "WORKDIR /home/bread/", "comment": "buildkit.dockerfile.v0" }, { "created": "2020-12-08T14:41:59.119577934+11:00", ", "comment": "buildkit.dockerfile.v0" }, { "created": "2020-12-08T14:41:59.119577934+11:00", "created_by": "USER bread", "comment": "buildkit.dockerfile.v0", "empty_layer": true }, { "created": "2020-12-08T14:41:59.119577934+11:00", "created_by": "CMD [\"/bin/sh\" \"-c\" \"tail -f /dev/null\"]", "comment": "buildkit.dockerfile.v0", "empty_layer": true } ], "os": "linux", "rootfs": { "type": "layers", "diff_ids": [ "sha256:ace0eda3e3be35a979cec764a3321b4c7d0b9e4bb3094d20d3ff6782961a8d54", "sha256:f9a8379022de9f439ace90e2104d99b33559d08c2e21255914d27fdc0051e0af", "sha256:1c50319140b222d353c0d165923ddc72c017da86dc8f56fa77826c53eba9c20d", "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", "sha256:56553910173dbbe9836893f8e0a081a58208ad47385b66fbefad69caa5e687e1" ] } }
One of the layers was created by the following command:
"
Right away I can see it’s using
steghide to embed something in an image, and then using
xxd to hex encode it and
split to break it into parts. Then it deletes things. I’ll clean up the escapes by removing the first layer of
"" and adding new lines between the commands:
Given that I’ve recovered the image, what’s left is the
steghide. I’ll need to be careful as I break out the command syntax here, as there’s a trick in it, but the syntax highlighting above actually makes it really clear. The password for the steg is
bunnies12.jpg\" -ef /tmp/t/hidden.png -p \"SecretPassword. I can paste it in when prompted, or add back some escapes and enter it at the command line:
# steghide extract -sf flimflam.jpg -xf hidden.png Enter passphrase: wrote extracted data to "hidden.png". # steghide extract -sf flimflam.jpg -xf hidden.jpg -p "bunnies12.jpg\\\" -ef /tmp/t/hidden.png -p \\\"SecretPassword" the file "hidden.png" does already exist. overwrite ? (y/n) y wrote extracted data to "hidden.png".
This image has a QRCode:
Scanning that or uploading to zxing.org gives the flag.
Flag:
HV20{My_pr3c10u5_my_r363x!!!,_7hr0w_17_1n70_7h3_X1._-_64l4dr13l}
HV20.21
Challenge.
There’s a link to start an instance of the webserver.
Solution
Enumeration
Visiting the url to both https and
/cat/. The site is an ASCII cat with an upload form:
The response headers don’t give anything away as far as the server type:
HTTP/1.1 200 OK Accept-Ranges: bytes Content-Length: 100 Content-Type: text/html Date: Mon, 21 Dec 2020 23:48:49 GMT Etag: W/"100-1605869035000" Last-Modified: Fri, 20 Nov 2020 10:43:55 GMT Connection: close
On uploading files to the server, the cat will report back about them:
If the upload is too big, the site rejects it:
Things That Didn’t Work
Given the challenge didn’t suggest the VPN (so reverse shell not needed) and gives the file location, I had a few ideas of things to go after.
I checked to see if the server was PHP by trying to visit
index.phpin the
/cat/directory, but it just returned 404 with a redirect to
/cat/. Given the file upload, I tried a PHP webshell anyway, but visiting the url just returned the PHP code, no execution.
Given the information about the content of the file, I thought perhaps the
filecommand was being used on it. I tried some command injections by changing the file name to things like “a.php; id”, but the file name seemed to just be that filename, no injection.
The page reports that the uploaded files are saved to
/usr/local/uploads, which also seems to be served from
/cat/files/. I tried a lot of things that might allow me to read outside of that directory, but anything in the GET request to get files like that seemed to return 400 Bad Request. I was able to upload files to anywhere on the system that this user could write by changing the form header like so:
-----------------------------128130095113367998791276393785 Content-Disposition: form-data; name="file"; filename="/tmp/kitten-large.png" Content-Type: image/png
It then shows up as saved to this location, and but it’s not in my list of files to access:
CVE-2020-9484
When I treid to check if
index.php would load that the root, the page crashed differently:
The server is running Apache Tomcat (fits the cat theme), and the version is 9.0.34. Googling that version of Tomcat led to CVE-2020-9484, an exploit I used against a HTB machine recently. This post gives a really nice writeup, but the short version is that if I can upload a file and then reference the relative path to that file in a cookie, I can get Tomcat to deserialize that file, which is a way to gain code execution.
To build a payload, I’ll use yososerial to generate a serialized Java payload. You have to find a payload type (there are many to try) and pick a command to run. A successful RCE will crash the current thread, so no output is returned. Given that, I’ll have the exploit copy the flag file into the
/usr/local/uploads/ directory. I’ll try different payloads until one works (I’ve had the most luck with the
CommonCollections series):
$ java -jar /opt/ysoserial/ysoserial-master-SNAPSHOT.jar CommonsCollections2 'cp /usr/bin/catnip.txt /usr/local/uploads/0xdf.txt' > catnip.session
On uploading that, the cat reports to be threatened:
I’ll turn on Burp Proxy with Intercept on, and refresh that main page. I’ll edit the cookie value and send it on:
The page crashes:
But on going back to the main page,
0xdf.txt is now listed in the files:
Downloading the file gives the flag:
$ curl -L HV20{!D3s3ri4liz4t10n_rulz!}
Flag:
HV20{!D3s3ri4liz4t10n_rulz!}
HV20.22
Challenge
A new apprentice Elf heard about “Configuration as Code”. When he had to solve the problem to protected a secret he came up with this “very sophisticated padlock”.
There’s a zip archive containing an ELF binary.
Solution
Running It
Running the binary prompts for a pin, and then prints a string that looks kind of flag-like but isn’t a flag:
$ ./padawanlock PIN (6 digits): 000000 Unlocked secret is: {WE_HAVE_NO_CHOICE,_GENERAL_CALRISSIAN!_OUR_CRUISERS_CANT_REPEL_FIREPOWER_OF_THAT_MAGNITUDE!} $ ./padawanlock PIN (6 digits): 013370 Unlocked secret is: LE_IS_ME_GOING_BACK_DER!}
Given that there are 1,000,000 possible inputs, it’ll take too long to try them all.
Static Analysis
Opening the file in Ghidra, there aren’t too many functions. A strings search identifies the function at 0x111e0, which I’ll call
main:
void main(void) { char *__nptr; int int_input; printf(s_PIN_(6_digits):_01326008); __nptr = gets(&DAT_013261be); __nptr[6] = '\0'; int_input = atoi(__nptr); (*(FUN_0001124b + int_input * 0x14))(); early_exit(); printf(s_Unlocked_secret_is:_01326019); printf(&flag); return; }
For the most part, this is quite simple. It prints the message asking for a six digit pin, reads that with
gets, adds a null to the end to ensure it’s only six digits, converts the string to an int. The next two lines are interesting, and I’ll come back to them. Then it prints the message about the unlocked secret, and the global
flag string, and returns.
What’s odd is that first it calls the address at 0x1124b + input * 0x14. That means there are a million different blocks of code that can be jumped into, each 20 bytes apart. The other odd thing is the function I’ve labeled
early_exit, which calls
exit to end the program. Since I’ve watched the program successfully print, it either must jump there from within the million code blocks, or it must print out the same thing elsewhere.
Jump Code
Looking at the code jumped to with PIN 000000, it’s pretty simple:
LAB_0001124b -- pin 000000 XREF[1]: main:00011215(*) 0001124b b9 7c 2a MOV ECX,0x1502a7c 50 01 LAB_00011250 XREF[1]: 00011254(j) 00011250 49 DEC ECX 00011251 83 f9 00 CMP ECX,0x0 00011254 75 fa JNZ LAB_00011250 00011256 c6 03 7b MOV byte ptr [EBX],'{' 00011259 43 INC EBX 0001125a e9 14 de JMP LAB_00aef073 ad 00 LAB_0001125f -- pin 000001 0001125f b9 a8 14 MOV ECX,0x15014a8 50 01 LAB_00011264 XREF[1]: 00011268(j) 00011264 49 DEC ECX 00011265 83 f9 00 CMP ECX,0x0 00011268 75 fa JNZ LAB_00011264 0001126a c6 03 46 MOV byte ptr [EBX],0x46 0001126d 43 INC EBX 0001126e e9 58 3e JMP LAB_008d50cb 8c 00
It sets ECX to some large number, then enters a loop that decrements ECX, breaking when ECX is 0. This is just a loop to waste some time / computer cycles. Then it moves the character
{ into the address as EBX, increments EBX, and jumps to some other address. What’s interesting is that this block is exectly 0x14 = 20 bytes long, and immediately following this block is another of the same form.
The character here is
{, which is the first character in the string that came out when I ran the program and entered 000000. Following the jump the next block is the same, just with a
W character:
LAB_00aef073 -- pin 569730 XREF[1]: 0001125a(j) 00aef073 b9 1a 0c MOV ECX,0x1500c1a 50 01 LAB_00aef078 XREF[1]: 00aef07c(j) 00aef078 49 DEC ECX 00aef079 83 f9 00 CMP ECX,0x0 00aef07c 75 fa JNZ LAB_00aef078 00aef07e c6 03 57 MOV byte ptr [EBX],'W' 00aef081 43 INC EBX 00aef082 e9 9c b2 JMP LAB_00a1a323 f2 ff
In fact, if pin 569730 is entered, it prints the same output as pin 000000 without the first character:
$ ./padawanlock PIN (6 digits): 000000 Unlocked secret is: {WE_HAVE_NO_CHOICE,_GENERAL_CALRISSIAN!_OUR_CRUISERS_CANT_REPEL_FIREPOWER_OF_THAT_MAGNITUDE!} $ ./padawanlock PIN (6 digits): 569730 Unlocked secret is: WE_HAVE_NO_CHOICE,_GENERAL_CALRISSIAN!_OUR_CRUISERS_CANT_REPEL_FIREPOWER_OF_THAT_MAGNITUDE!}
It’s clear the program is building the string based on the starting block identified by the pin. Following this for a while, eventually it ends up with a jump to 0x11226:
LAB_0038318b XREF[1]: 011c3e9e(j) 0038318b b9 65 01 MOV ECX,0x1500165 50 01 LAB_00383190 XREF[1]: 00383194(j) 00383190 49 DEC ECX 00383191 83 f9 00 CMP ECX,0x0 00383194 75 fa JNZ LAB_00383190 00383196 c6 03 7d MOV byte ptr [EBX],'}' 00383199 43 INC EBX 0038319a e9 87 e0 JMP LAB_00011226 c8 ff
This is just back into
main, to the line that loads the static “Unlocked secret is:” string to pass to
printf.
Each pin starts execution into this block of code, where it jumps around collecting characters and wasting time before ending with the print.
Solver
Given this known understanding of the file, a Python script can read in the binary file, focus on the 20 * 1000000 bytes of code blocks, and jump through them collecting characters.
I’ll read in the file, and isolate the block of code:
with open('padawanlock', 'rb') as f: binary = f.read() start = 4683 block = binary[start:start+(1000000*20)]
Next, I’ll write a function that recursively builds the string. I takes a starting block and will find the character at that offset (13 bytes into the block), and then return that character + the function called with the offset of the jump. The jump is a relative jump, so that address is relative to the next instruction, which would be the start of the next block, or the start of the current block plus 20.
I’ll use
lru_cache so that any time the same block is passed in, it can immediately return the result without re-running all the recursive calls.
@lru_cache(None) def get_string(start): if start < 0: return '' c = chr(block[start + 13]) if ord(c) > 127: import pdb;pdb.set_trace() rest = start + 20 + struct.unpack("<i", block[16+start:20+start])[0] return c + get_string(rest)
When the program tries to jump into the code above the first block (
start < 0), it returns nothing as that’s the end of the string.
Now I can just loop over all million pins and look for a flag that starts with
HC20{:
for i in range(1000000): res = get_string(i*20) if res.startswith('HV20{'): print(f'pin: {i:06d} {res}') break
All of this comes together and returns the flag in about three seconds:
$ time python3 solve.py pin: 451235 HV20{C0NF1GUR4T10N_AS_C0D3_N0T_D0N3_R1GHT} real 0m2.755s user 0m2.580s sys 0m0.130s
If I comment out the
lru_cache, it takes ten times as long:
# time python3 solve.py pin: 451235 HV20{C0NF1GUR4T10N_AS_C0D3_N0T_D0N3_R1GHT} real 0m31.685s user 0m31.614s sys 0m0.021s
Flag:
HV20{C0NF1GUR4T10N_AS_C0D3_N0T_D0N3_R1GHT}
The full code follows:
#!/usr/bin/env python3 import struct from functools import lru_cache # @lru_cache(None) def get_string(start): if start < 0: return "" c = chr(block[start + 13]) if ord(c) > 127: import pdb pdb.set_trace() rest = start + 20 + struct.unpack("<i", block[16 + start : 20 + start])[0] return c + get_string(rest) with open("padawanlock", "rb") as f: binary = f.read() start = 4683 block = binary[start : start + (1000000 * 20)] for i in range(1000000): res = get_string(i * 20) if res.startswith("HV20{"): print(f"pin: {i:06d} {res}") break
HV20.23
Challenge?
The downloaded file contains a
.rar archive.
Solution
Recover Pin
The
.rar archive contains an iOS backup. There’s a bunch of 40-hex character named file that are different encrypted bits, as well as several other files. Given that I want to recover the pin, I followed this article. itunes_backup2hashcat will generate a hash from the
Manifest.plist file:
$ /opt/itunes_backup2hashcat/itunes_backup2hashcat.pl 5e8dfbc7f9f29a7645d66ef70b6f2d3f5dad8583/Manifest.plist **
I’ll save that hash in
Manifest.hash. The format matches hashcat mode 14700. Since I know the password is eight digits, and the first is “2”, I can either make a wordlist, or use masks in Hashcat. On originally solving, I just made a wordlist:
$ for i in $(seq 20000000 30000000); do echo $i; done > nums
But a better way to do this is to give
-a 3 to specify using masks as follows:
$ hashcat -a 3 -m 14700 ./Manifest.hash 2?d?d?d?d?d?d?d ...[snip]... **:20201225
That mask uses
?d to represent an unknown digit. It finds a pin I probably could have guessed,
20201225.
Access Files
To access the files in the backup, I used a free trial of FonePaw. On running it, there are some troll flags (and a hidden flag, see below), but what’s important is two contacts, M and N, each of which have a “notes” section that contains a very large integer:
Given the category of this challenge is crypto, and those two letters meaning when it comes to RSA, seems like there’s an RSA problem to solve here.
RSA Manually
N is the public key in RSA, so I’ll need to factor it. factordb is a good place to check, and it does have this one factored. Now I have p, q, n, and the message. I can assume the default e, 65537. That means the private key, d, is the mod inverse of e and the product of p-1 and q-1. In Python 3.8 and later, this can be done in one line:
>>> pow(e, -1, (p-1)*(q-1)) 76980419378954446000209544312551541433862075603599424409197520797260187470901
With d, I can decrypt the message:
>>> (pow(m,d,p*q)).to_bytes(27, 'big').decode() 'HV20{s0rry_n0_gam3_to_play}'
Flag:
HV20{s0rry_n0_gam3_to_play}
RsaCtfTool
RsaCtfTool can do all of that math starting with n, e, and m through the plaintext message:
python3 /opt/RsaCtfTool/RsaCtfTool.py -n 77534090655128210476812812639070684519317429042401383232913500313570136429769 -e 65537 --uncipher 6344440980251505214334711510534398387022222632429506422215055328147354699502 --attack factordb private argument is not set, the private key will not be displayed, even if recovered. [*] Testing key /tmp/tmpnjopalj8. [*] Performing factordb attack on /tmp/tmpnjopalj8. Results for /tmp/tmpnjopalj8: Unciphered data : HEX : 0x0000000000485632307b73307272795f6e305f67616d335f746f5f706c61797d INT (big endian) : 29757593747455483525592829184976151422656862335100602522242480509 INT (little endian) : 56753566960650598288217394598913266125073984765818621753275514254169309446144 STR : b'\x00\x00\x00\x00\x00HV20{s0rry_n0_gam3_to_play}'
I included the attack type of factordb, but it will do a bunch of other things and eventually get to that same conclusion (and fun for much longer) without that flag. Then it decrypts the message and prints the flag.
HV20.H3
Challenge
I don’t know
Solution
In the previous challenge FonePaw showed not only the two contacts M and N, but a third contact with no name:
That contact contains only a homepage, but on inspection, the url doesn’t look like a valid url:
It does look like base64, which decodes to the hidden flag:
$ echo SFYyMHtpVHVuM3NfYmFja3VwX2YwcmVuc2l4X0ZUV30= | base64 -d HV20{iTun3s_backup_f0rensix_FTW}
HV20.24
Challenge
In order to prevent the leakage of any flags, Santa decided to instruct his elves to implement a secure data storage, which encrypts all entered data before storing it to disk.
According to the paradigm Always implement your own crypto the elves designed a custom hash function for storing user passwords as well as a custom stream cipher, which is used to encrypt the stored data.?
The given zip archive containing a Bash script, an ELF executable, an empty folder, and a packet capture:
$ unzip -l 66aeb596-2ba0-4d07-a8de-3eb27eedb791.zip Archive: 66aeb596-2ba0-4d07-a8de-3eb27eedb791.zip Length Date Time Name --------- ---------- ----- ---- 78 2020-10-29 08:25 server.sh 17832 2020-10-29 08:14 data_storage 0 2020-10-29 08:32 data/ 3620 2020-12-16 03:10 attack.pcapng --------- ------- 21530 4 files $ file server.sh data_storage attack.pcapng server.sh: Bourne-Again shell script, ASCII text executable data_storage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4f732bdcc708dd6885deaf71d1971f8e81cc4f55, for GNU/Linux 3.2.0, not stripped attack.pcapng: pcapng capture file - version 1.0
Solution
Overview
The PCAP shows an attack on this hosted binary, and I’ll dig into that in detail.
The Bash script runs
socat in such a way that the ELF binary is served over TCP port 5555.
#!/bin/bash socat TCP4-LISTEN:5555,reuseaddr,fork EXEC:./data_storage,stderr;
The program is a data storage application. It will ask for a username, and then either prompt to create a password for a new user, or ask for a password for a returning user. The user can store data, retrieve data, and delete that data.
$ ./data_storage welcome to santa's secure data storage! please login with existing credentials or enter new username ... username> 0xdf creating user '0xdf' ... please set your password (max-length: 19) password> 0xdf welcome 0xdf! [0] show data [1] enter data [2] delete data [3] quit choice> 0 no data found! [0] show data [1] enter data [2] delete data [3] quit choice> 1 data> this is test data [0] show data [1] enter data [2] delete data [3] quit choice> 0 your secret data: this is test data [0] show data [1] enter data [2] delete data [3] quit choice> 3 good bye!
After that session, two files were created in
data/:
$ ls data/ 0xdf_data.txt 0xdf_pwd.txt
No matter what is entered, the
[username]_pwd.txt file is 16 bytes:
$ xxd data/0xdf_pwd.txt 00000000: 2674 8f0c a033 df36 a7fa 3396 2579 368f &t...3.6..3.%y6.
The
[username]_data.txt file is the same length as the input data:
$ xxd data/0xdf_data.txt 00000000: 2a29 0bc2 5af2 45d1 8d48 e737 5fbd 991b *)..Z.E..H.7_... 00000010: 2f51 /Q
This matches with the information provided in the challenge assuming the hashing algorithm is being applied to the password and the stream cipher is being applied to the data, as a hashing algorithm would produce a fixed length output, and the stream cipher would produce output the same length as the input.
Static RE
Because the binary is not stripped, opening it in Ghidra presents helpful function names:
The
main function calls
login_username,
login_password, and
show_menu:
undefined8 main(void) { setvbuf(stdin,(char *)0x0,2,0); setvbuf(stdout,(char *)0x0,2,0); setvbuf(stderr,(char *)0x0,2,0); login_username(); login_password(); show_menu(); return 0; }
show_menu prints the menu, processes the input, and then calls the appropriate function:
void show_menu(void) { char input_str [10]; char user_data_file [44]; int input_int; snprintf(user_data_file,0x28,"data/%s_data.txt",username); while( true ) { while( true ) { while( true ) { while( true ) { puts("[0] show data"); puts("[1] enter data"); puts("[2] delete data"); puts("[3] quit"); printf("choice> "); fgets(input_str,1000,stdin); input_int = atoi(input_str); if (input_int != 0) break; show_data(user_data_file); } if (input_int != 1) break; enter_data(user_data_file); } if (input_int != 2) break; delete_data(user_data_file); } if (input_int == 3) break; puts("unknown choice!"); } puts("good bye!"); return; }
Right away I see the buffer overflow where it calls
fgets to read up to 1000 bytes of menu choice into a 10 byte buffer. To reach the return, the result of
atoi on the input string will have to be 3, but that just means that any string starting with
3[non-digit] will work.
Functions like
show_data work as expected, trying to read the data from the
_data.txt file and passing the contents to
decrypt:
void show_data(char *user_data_file) { int iVar1; FILE *fd; size_t *outlen; size_t in_R8; EVP_PKEY_CTX buffer [104]; FILE *fd_copy; iVar1 = access(user_data_file,0); if (iVar1 == -1) { puts("no data found!"); } else { memset(buffer,0,100); fd = fopen(user_data_file,"r"); fd_copy = fd; fread(buffer,1,100,fd); fclose(fd_copy); decrypt(buffer,pwd_hash); printf("your secret data:\n%s\n",buffer); } return; }
Interestingly, the
decrypt function also takes a global variable,
pwd_hash, which is set in the
login_password function via the
calc_hash function.
decrypt loops over the input files, calling
keystream_get_char, xoring the result with the current byte, and then breaking if the resulting plaintext is null.
int decrypt(uchar *buffer,uchar *pwhash) { long kchar; uint i; i = 0; while( true ) { kchar = keystream_get_char(i,(long)pwhash); buffer[(int)i] = (byte)kchar ^ buffer[(int)i]; if (buffer[(int)i] == 0) break; i = i + 1; } return 0; }
Recreate Hash Function
The custom hashing function is not complicated:
void calc_hash(long password,ulong password_len,void *buffer) { char chr; ulong buf1 [4]; int i; ulong buf2 [4]; buf1[0] = 0x68736168; buf1[1] = 0xdeadbeef; buf1[2] = 0x65726f6d; buf1[3] = 0xc00ffeee; buf2[3] = 0x68736168; buf2[2] = 0xdeadbeef; buf2[1] = 0x65726f6d; buf2[0] = 0xc00ffeee; i = 0; while ((ulong)(long)i < password_len) { chr = *(char *)(password + i); buf1[1] = buf2[3] ^ (long)(int)(chr * i & 0xffU ^ (int)chr | ((int)chr * (i + 0x31) & 0xffU ^ (int)chr) << 0x18 | ((int)chr * (i + 0x42) & 0xffU ^ (int)chr) << 0x10 | ((int)chr * (i + 0xef) & 0xffU ^ (int)chr) << 8); buf1[2] = buf2[2] ^ (long)(int)(chr * i & 0x5aU ^ (int)chr | ((int)chr * (i + 0xc0) & 0xffU ^ (int)chr) << 0x18 | ((int)chr * (i + 0x11) & 0xffU ^ (int)chr) << 0x10 | ((int)chr * (i + 0xde) & 0xffU ^ (int)chr) << 8); buf1[3] = buf2[1] ^ (long)(int)(chr * i & 0x22U ^ (int)chr | ((int)chr * (i + 0xe3) & 0xffU ^ (int)chr) << 0x18 | ((int)chr * (i + 0xde) & 0xffU ^ (int)chr) << 0x10 | ((int)chr * (i + 0xd) & 0xffU ^ (int)chr) << 8); buf1[0] = buf2[0] ^ (long)(int)(chr * i & 0xefU ^ (int)chr | ((int)chr * (i + 0x52) & 0xffU ^ (int)chr) << 0x18 | ((int)chr * (i + 0x24) & 0xffU ^ (int)chr) << 0x10 | ((int)chr * (i + 0x33) & 0xffU ^ (int)chr) << 8); i = i + 1; buf2[0] = buf1[0]; buf2[1] = buf1[3]; buf2[2] = buf1[2]; buf2[3] = buf1[1]; } *(ulong *)buffer = buf1[0]; *(ulong *)((long)buffer + 4) = buf1[1]; *(ulong *)((long)buffer + 8) = buf1[2]; *(ulong *)((long)buffer + 0xc) = buf1[3] return; }
It initializes four four-byte words to static values, and then loops over each character of the input xoring each byte by some variation on the input byte. Then it shuffles the four words around, and repeats. I can recreate this in Python relatively easily:
def gen_hash(s): buf1 = [0x68736168, 0xdeadbeef, 0x65726f6d, 0xc00ffeee] buf2 = [0xc00ffeee, 0x65726f6d, 0xdeadbeef, 0x68736168] for i in range(len(s)): c = ord(s[i]) buf1[1] = buf2[3] ^ (((i * c) & 0xff) ^ c | ((((i + 0x31) * c) & 0xff) ^ c) << 0x18 | ((((i + 0x42) * c) & 0xff) ^ c) << 0x10 | ((((i + 0xef) * c) & 0xff) ^ c) << 0x8) buf1[2] = buf2[2] ^ (((i * c) & 0x5a) ^ c | ((((i + 0xc0) * c) & 0xff) ^ c) << 0x18 | ((((i + 0x11) * c) & 0xff) ^ c) << 0x10 | ((((i + 0xde) * c) & 0xff) ^ c) << 0x8) buf1[3] = buf2[1] ^ (((i * c) & 0x22) ^ c | ((((i + 0xe3) * c) & 0xff) ^ c) << 0x18 | ((((i + 0xde) * c) & 0xff) ^ c) << 0x10 | ((((i + 0xd) * c) & 0xff) ^ c) << 0x8) buf1[0] = buf2[0] ^ (((i * c) & 0xef) ^ c | ((((i + 0x52) * c) & 0xff) ^ c) << 0x18 | ((((i + 0x24) * c) & 0xff) ^ c) << 0x10 | ((((i + 0x33) * c) & 0xff) ^ c) << 0x8) buf2 = [buf1[0], buf1[3], buf1[2], buf1[1]] return struct.pack('<IIII', *buf1)
When recreating this kind of bit-wise operation in Python from C, it’s important to make sure that the bit boundaries are followed. For example, a one byte char in C with the value 0x44 shifted left by two bits would return 0x10, where as Python would return 0x110. C cares very much about the size of the element holding the value, whereas Python is more forgiving. It’s ok here because in each case, the code will use
& 0xff to get just one byte, and then shift that into place.
With this complete, I can test by hashing “0xdf” and validating that the result matches what is stored in the
data directory.
root@kali# python3 -i hash.py >>> with open('data/0xdf_pwd.txt', 'rb') as f: ... hash_0xdf = f.read() ... >>> gen_hash('0xdf') b'&t\x8f\x0c\xa03\xdf6\xa7\xfa3\x96%y6\x8f' >>> hash_0xdf b'&t\x8f\x0c\xa03\xdf6\xa7\xfa3\x96%y6\x8f' >>> gen_hash('0xdf') == hash_0xdf True
Recreate Keystream
Ghidra totally simplifies this function in a way that I did not believe at first. It suggests that the keystream by at position i is calculated by taking the ith byte of the hash (mod 16, so it just loops to the beginning). That byte mod 10 is used to grab a byte from a static byte string,
key, which is xored by the hash byte and i to make the key byte.
long keystream_get_char(uint i,long pwhash) { char hash_byte; uint zero; char key [10]; key._0_8_ = 0x563412c0efbeadde; key._8_2_ = 0x9a78; zero = (uint)((int)i >> 0x1f) >> 0x1c; hash_byte = *(char *)(pwhash + (int)((i + zero & 0xf) - zero)); # get byte (i mod 16) from hash return (long)(int)((int)key[(ulong)(long)hash_byte % 10] ^ (int)hash_byte ^ i); }
There’s a bit of weirdness that could come into play for i really big, but I’ll ignore that. Not believing this disassembly, I actually went thought the hassel of making the Python equivalent of the assembly that looks like:
00401a90 55 PUSH RBP 00401a91 48 89 e5 MOV RBP,RSP 00401a94 89 7d dc MOV dword ptr [RBP + local_2c],EDI 00401a97 48 89 75 d0 MOV qword ptr [RBP + local_38],RSI 00401a9b 48 b8 de MOV RAX,0x563412c0efbeadde ad be ef c0 12 34 56 00401aa5 48 89 45 e6 MOV qword ptr [RBP + key[0]],RAX 00401aa9 66 c7 45 MOV word ptr [RBP + key[8]],0x9a78 ee 78 9a 00401aaf 8b 45 dc MOV EAX,dword ptr [RBP + local_2c] 00401ab2 99 CDQ 00401ab3 c1 ea 1c SHR EDX,0x1c 00401ab6 01 d0 ADD EAX,EDX 00401ab8 83 e0 0f AND EAX,0xf 00401abb 29 d0 SUB EAX,EDX 00401abd 48 63 d0 MOVSXD RDX,EAX 00401ac0 48 8b 45 d0 MOV RAX,qword ptr [RBP + local_38] 00401ac4 48 01 d0 ADD RAX,RDX 00401ac7 0f b6 00 MOVZX EAX,byte ptr [RAX] 00401aca 88 45 ff MOV byte ptr [RBP + pwhash_byte],AL 00401acd 0f be 45 ff MOVSX EAX,byte ptr [RBP + pwhash_byte] 00401ad1 33 45 dc XOR EAX,dword ptr [RBP + local_2c] 00401ad4 89 c6 MOV ESI,EAX 00401ad6 48 0f be MOVSX RCX,byte ptr [RBP + pwhash_byte] 4d ff 00401adb 48 ba cd MOV RDX,-0x3333333333333333 cc cc cc cc cc cc cc 00401ae5 48 89 c8 MOV RAX,RCX 00401ae8 48 f7 e2 MUL RDX 00401aeb 48 c1 ea 03 SHR RDX,0x3 00401aef 48 89 d0 MOV RAX,RDX 00401af2 48 c1 e0 02 SHL RAX,0x2 00401af6 48 01 d0 ADD RAX,RDX 00401af9 48 01 c0 ADD RAX,RAX 00401afc 48 29 c1 SUB RCX,RAX 00401aff 48 89 ca MOV RDX,RCX 00401b02 0f b6 44 MOVZX EAX,byte ptr [RBP + RDX*0x1 + -0x1a] 15 e6 00401b07 0f be c0 MOVSX EAX,AL 00401b0a 31 f0 XOR EAX,ESI 00401b0c 48 98 CDQE 00401b0e 48 89 45 f0 MOV qword ptr [RBP + local_18],RAX 00401b12 48 8b 45 f0 MOV RAX,qword ptr [RBP + local_18] 00401b16 5d POP RBP 00401b17 c3 RET
There’s some tricks in there multipling by -0x3333333333333333, shifting, etc that end up just be the mod 10 Ghidra identified. So the function can be:
def gen_key_byte(i, bhash): key = b'\xde\xad\xbe\xef\xc0\x12\x34\x56\x78\x9a' hb = bhash[i % 0x10] hbxi = hb ^ i if hbxi > 127: hbxi |= 0xffffff00 hbsx = hb | 0xffffffffffffff00 if hb > 127 else hb prod = 0xcccccccccccccccd * hbsx rdx = 10 * (prod >> 67) idx = hbsx - rdx from_key = key[idx] return (hbxi ^ from_key) & 0xff
But it can also just be:
def gen_key_byte(i, bhash): key = b'\xde\xad\xbe\xef\xc0\x12\x34\x56\x78\x9a' return key[bhash[i % 0x10] % 10] ^ bhash[i % 0x10] ^ i
Attack
Looking at
attack.pcapng, all but one of the packets are a single TCP stream from 192.168.0.42 to the the server at 192.168.0.1 on port 5555 (which matches
server.sh):
Immediately after, there’s a single UDP port 53 packet, which Wireshark thinks is DNS, but doesn’t seem like valid DNS (at least not in the query):
The attacker entered a long buffer at the
choice> prompt, which would be exploiting the buffer overflow noted earlier. Looking at the stream as hex, I’ll grab all the bytes sent.
Debug
To debug this, I’ll write a short Python script that exploits the same way as in the PCAP:
#!/usr/bin/env python3 from pwn import * p = process('./data_storage') p.readuntil('username> ') p.sendline('evil0r') p.readuntil('password> ') p.sendline('lovebug1') input('Attach gdb and hit enter to continue') payload = '3 ' + 'A'*64 + "\x10\x41\x40\x00\x00\x00\x00\x00\x68\x74\x78\x74\x00\x48\xbf\x74\x61\x5f\x64\x61\x74\x61\x2e\x57\x48\xbf\x64\x61\x74\x61\x2f\x73\x61\x6e\x57\x48\x89\xe7\x48\x31\xf6\x48\x31\xd2\xb8\x02\x00\x00\x00\x0f\x05\x48\x89\xc7\x48\xba\x00\x00\x01\x00\x01\x00\x00\x00\x52\x6a\x00\x6a\x00\x6a\x00\x6a\x00\x48\x89\xe6\x48\xba\x01\x00\x00\x00\x00\x00\x00\x20\x52\x48\xba\x00\x00\x00\x13\x37\x01\x00\x00\x52\xba\x20\x00\x00\x00\xb8\x00\x00\x00\x00\x0f\x05\x48\x31\xc9\x81\x34\x0e\xef\xbe\xad\xde\x48\x83\xc1\x04\x48\x83\xf9\x20\x75\xef\xbf\x02\x00\x00\x00\xbe\x02\x00\x00\x00\x48\x31\xd2\xb8\x29\x00\x00\x00\x0f\x05\x48\x89\xc7\x48\x89\xe6\x48\x83\xc6\x03\xba\x32\x00\x00\x00\x41\xba\x00\x00\x00\x00\x6a\x00\x49\xb8\x02\x00\x00\x35\xc0\xa8\x00\x2a\x41\x50\x49\x89\xe0\x41\xb9\x10\x00\x00\x00\xb8\x2c\x00\x00\x00\x0f\x05\xbf\x00\x00\x00\x00\xb8\x3c\x00\x00\x00\x0f\x05\x0a" p.send(payload) p.interactive()
I can run this, then in a different window run
gdb -p $(pidof data_storage) to attach to it and debug it.
The attack overwrites the return address with 0x404110, which is the global address of
pwhash. The trick here is that the hash of “lovebug1”, the password given, starts with 0xff 0xe4:
>>> gen_hash('lovebug1') b'\xff\xe4\xb2\x8bi\x9f(@\xee!\xe5\x1f<#\xed\x0f'
0xffe4 is the instruction for JMP RSP, which will be the rest of the payload above. Trying to run this in a debugger will fail because the memory segment containing 0x404110 is not marked executable:
gdb-peda$ vmmap Start End Perm Name 0x00400000 0x00401000 r--p /media/sf_CTFs/hackvent2020/day24/data_storage 0x00401000 0x00402000 r-xp /media/sf_CTFs/hackvent2020/day24/data_storage 0x00402000 0x00403000 r--p /media/sf_CTFs/hackvent2020/day24/data_storage 0x00403000 0x00404000 r--p /media/sf_CTFs/hackvent2020/day24/data_storage 0x00404000 0x00405000 rw-p /media/sf_CTFs/hackvent2020/day24/data_storage 0x00007ffff7de9000 0x00007ffff7e0e000 r--p /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7e0e000 0x00007ffff7f59000 r-xp /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7f59000 0x00007ffff7fa3000 r--p /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7fa3000 0x00007ffff7fa4000 ---p /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7fa4000 0x00007ffff7fa7000 r--p /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7fa7000 0x00007ffff7faa000 rw-p /usr/lib/x86_64-linux-gnu/libc-2.31.so 0x00007ffff7faa000 0x00007ffff7fb0000 rw-p mapped 0x00007ffff7fcc000 0x00007ffff7fd0000 r--p [vvar] 0x00007ffff7fd0000 0x00007ffff7fd2000 r-xp [vdso] 0x00007ffff7fd2000 0x00007ffff7fd3000 r--p /usr/lib/x86_64-linux-gnu/ld-2.31.so 0x00007ffff7fd3000 0x00007ffff7ff3000 r-xp /usr/lib/x86_64-linux-gnu/ld-2.31.so 0x00007ffff7ff3000 0x00007ffff7ffb000 r--p /usr/lib/x86_64-linux-gnu/ld-2.31.so 0x00007ffff7ffc000 0x00007ffff7ffd000 r--p /usr/lib/x86_64-linux-gnu/ld-2.31.so 0x00007ffff7ffd000 0x00007ffff7ffe000 rw-p /usr/lib/x86_64-linux-gnu/ld-2.31.so 0x00007ffff7ffe000 0x00007ffff7fff000 rw-p mapped 0x00007ffffffde000 0x00007ffffffff000 rwxp [stack]
I can just run to that point and then
set $rip=[next address on the stack] and debug through that. I can also just dump the instructions using
x/50i [address on stack]. First, it builds the string
data/santa_data.txt and calls
open:
0x7ffe9540a6b0: push 0x747874 # txt 0x7ffe9540a6b5: movabs rdi,0x2e617461645f6174 # ta_data. 0x7ffe9540a6bf: push rdi 0x7ffe9540a6c0: movabs rdi,0x6e61732f61746164 # data/san 0x7ffe9540a6ca: push rdi 0x7ffe9540a6cb: mov rdi,rsp 0x7ffe9540a6ce: xor rsi,rsi 0x7ffe9540a6d1: xor rdx,rdx 0x7ffe9540a6d4: mov eax,0x2 0x7ffe9540a6d9: syscall # open('data/santa_data.txt', 0, 0)
Next it reads 32 bytes from that file:
0x7ffe9540a6db: mov rdi,rax # fd in rdi 0x7ffe9540a6de: movabs rdx,0x100010000 0x7ffe9540a6e8: push rdx 0x7ffe9540a6e9: push 0x0 0x7ffe9540a6eb: push 0x0 0x7ffe9540a6ed: push 0x0 0x7ffe9540a6ef: push 0x0 0x7ffe9540a6f1: mov rsi,rsp 0x7ffe9540a6f4: movabs rdx,0x2000000000000001 0x7ffe9540a6fe: push rdx 0x7ffe9540a6ff: movabs rdx,0x0000013713000000 0x7ffe9540a709: push rdx 0x7ffe9540a70a: mov edx,0x20 0x7ffe9540a70f: mov eax,0x0 0x7ffe9540a714: syscall # read(fd, RSP, 0x20)
The read in data is then xored by 0xdeadbeef:
0x7ffe9540a716: xor rcx,rcx 0x7ffe9540a719: xor DWORD PTR [rsi+rcx*1],0xdeadbeef 0x7ffe9540a720: add rcx,0x4 0x7ffe9540a724: cmp rcx,0x20 0x7ffe9540a728: jne 0x7ffe9540a719
It then opens a UDP socket and calls
sendto sending 50 bytes to 192.168.0.42 on port 53, and then exits:
0x7ffe9540a72a: mov edi,0x2 0x7ffe9540a72f: mov esi,0x2 0x7ffe9540a734: xor rdx,rdx 0x7ffe9540a737: mov eax,0x29 0x7ffe9540a73c: syscall # socket(AF_INET = IP, SOCK_DGRAM = 2, 0) 0x7ffe9540a73e: mov rdi,rax # rdi = sockfd 0x7ffe9540a741: mov rsi,rsp 0x7ffe9540a744: add rsi,0x3 0x7ffe9540a748: mov edx,0x32 0x7ffe9540a74d: mov r10d,0x0 0x7ffe9540a753: push 0x0 0x7ffe9540a755: movabs r8,0x2a00a8c035000002 # C0A8002A = 192.168.0.42, 0035 = 53 0x7ffe9540a75f: push r8 0x7ffe9540a761: mov r8,rsp 0x7ffe9540a764: mov r9d,0x10 0x7ffe9540a76a: mov eax,0x2c 0x7ffe9540a76f: syscall # sendto(sockfd, buf = rsp, size = 0x32, flags=0, sockaddr in r8, addrlen = 0x10) 0x7ffe9540a771: mov edi,0x0 0x7ffe9540a776: mov eax,0x3c # exit(0) 0x7ffe9540a77b: syscall
It’s important to note that the buffer pointed to in the
sendto syscall is RSP, which now has more stuff on top of the stack before the xored buffer, specifically 13 bytes that make up a fake DNS header, so that the exfilled data becomes the query. Santa’s data encrypted and then xored by 0xdeadbeef starts at the 0xe5 at offset 0x37 in this dump from Wireshark:
I grabbed that data and copied it into a Python terminal. I can remove the xor with the following:
>>> ''.join([f'{x^y:02x}' for x,y in zip(cycle(b'\xef\xbe\xad\xde'), binascii.unhexlify(udpd)[13:45])]) '0a114843de120e14cea06ea749cd8e8035080d53c16d1a6884eb28a0278a8fa4'
Now I have the encrypted version of Santa’s data.
Crack Santa’s Password
I can now brute force over rockyou.txt trying each password by generating the hash, decrypting the data, and seeing if it starts with ‘HV20{‘.
santa_data = binascii.unhexlify("0a114843de120e14cea06ea749cd8e8035080d53c16d1a6884eb28a0278a8fa4") with open('/usr/share/wordlists/rockyou.txt', 'r') as f: #with open('./test', 'r') as f: for p in f: try: ph = gen_hash(p.strip()) res = decrypt(santa_data, ph) if res.startswith("HV20"): print(res) print(p) break except: pass #import pdb; pdb.set_trace()
Because
rockyou.txt actually has some non-ascii characters in it, I’ll run in a
try block to catch errors and continue.
It takes about 12 seconds time find the password and the flag:
$ time python3 hash.py HV20{0h_n0es_fl4g_g0t_l34k3d!1} xmasrocks real 0m12.019s user 0m11.938s sys 0m0.025s
Flag:
HV20{0h_n0es_fl4g_g0t_l34k3d!1} | https://0xdf.gitlab.io/hackvent2020/leet | CC-MAIN-2022-40 | refinedweb | 7,985 | 61.06 |
XDR_CREATE(3N) XDR_CREATE(3N)
NAME
xdr_destroy, xdrmem_create, xdrrec_create, xdrstdio_create - library
routines for external data representation stream creation
DESCRIPTION.
Routines
The XDR, CLIENT, and SVCXPRT data structures are defined in the RPC/XDR
Library Definitions of the
#include <<rpc/xdr.h>>
void xdr_destroy(xdrs)
XDR *xdrs;
Invoke the destroy routine associated with the XDR stream, xdrs.
Destruction usually involves freeing private data structures
associated with the stream. Using xdrs after invoking
xdr_destroy() is undefined.
void xdrmem_create(xdrs, addr, size, op)
XDR *xdrs;
char *addr;
u_int size;
enum xdr_op op;
This routine initializes the XDR stream object pointed to by
xdrs. The stream's data is written to, or read from, a chunk of
memory at location addr whose length is no more than size bytes
long. size should be a multiple of 4. The op determines the
direction of the XDR stream (either XDR_ENCODE, XDR_DECODE, or
XDR_FREE).
void xdrrec_create(xdrs, sendsz, recvsz, handle, readit, writeit)
XDR *xdrs;
u_int sendsz, recvsz;
char *handle;
int (*readit) (), (*writeit) ();
This routine initializes the XDR stream object pointed to by
xdrs. The stream's data is written to a buffer of size sendsz;
a value of zero indicates the system should use a suitable
default. The stream's data is read from a buffer of size recvsz;
it too can be set to a suitable default by passing a zero value.
When a stream's output buffer is full, writeit is called. Simi-
larly, when a stream's input buffer is empty, readit is called.
The behavior of these two routines is similar to read(2V) and
write(2V), except that handle is passed to the former routines
as the first parameter. Note: The XDR stream's op field must be
set by the caller. sendsz and recvsz should be multiples of 4.
Warning: This XDR stream implements an intermediate record
stream. Therefore there are additional bytes in the stream to
provide record boundary information.
void xdrstdio_create(xdrs, filep, op)
XDR *xdrs;
FILE *filep;
enum xdr_op op;
This routine initializes the XDR stream object pointed to by
xdrs. The XDR stream data is written to, or read from, the
Standard I/O stream filep. The parameter op determines the
direction of the XDR stream (either XDR_ENCODE, XDR_DECODE, or
XDR_FREE).
Warning: The destroy routine associated with such XDR streams
calls fflush() on the file stream, but never fclose(3V).
SEE ALSO
read(2V), write(2V), fclose(3V), xdr(3N), xdr_admin(3N), xdr_com-
plex(3N), xdr_simple(3N)
20 January 1990 XDR_CREATE(3N) | http://modman.unixdev.net/?sektion=3&page=xdrstdio_create&manpath=SunOS-4.1.3 | CC-MAIN-2017-30 | refinedweb | 414 | 63.59 |
Could it be true? No need to ever use R again? Well, that's how it looks to me. Scikit-learn is a Python module for machine learning which seems to replicate almost all of the multivariate analysis modules I used to use in R. Thanks to Nikolas Fechner at the RDKit UGM for tuning me into this.
Let's see it in action for a simple example that uses SVM to classify irises (not the eyeball type). First, the R:
library(e1071) library(MASS) data(iris)
And now the Python:
from sklearn import svm, datasets from sklearn.metrics import confusion_matrix iris = datasets.load_iris() mysvm = svm.SVC().fit(iris.data, iris.target) mysvm_pred = mysvm.predict(iris.data) print confusion_matrix(mysvm_pred, iris.target) # [[50 0 0] # [ 0 48 2] # [ 0 0 50]]This library is quite new, but there seems to be quite a bit of momentum in the data processing space right now in Python. See also Statsmodels and Pandas. These videos from PyData 2012 give an overview of some of these projects.
2 comments:
Great post Noel, but I don't think I'm ready to walk away from R just yet ... Although I'm a huge fan of Python and have been using scikit-learn and pandas, there are a few reasons to maintain my allegiance to R
R is a fantastic tool for interactive data analysis. There are so many great tools for slicing and dicing data, and packages like plyr give R capabilities that I can't find anywhere else. It's possible that all of this can be done with pandas, and I just need to get better at it.
There is incredible breadth in what's available in R. Over the last few years, R has become the standard for academic statistics and machine learning. When I go looking for an implementation of a new method, I can usually find an R package.
R has excellent plotting capabilities, especially with the addition of lattice and ggplot. I haven't found any other package that gives me the power and control over plots that I get with R.
I agree that R can be syntactically strange and that things are not implemented in a consistent fashion. After 10 years of using R, my brain is sufficiently warped that I'm starting to get the hang of it.
I don't disagree with any of this, but I have always found the process of using R frustrating. Unfortunately, R seemed to be so well established that I had despaired of ever being able to dispense with it. | http://baoilleach.blogspot.com/2012/10/learn-scikit-and-never-use-r-again.html | CC-MAIN-2017-17 | refinedweb | 431 | 73.27 |
go to bug id or search bugs for
Description:
------------
json_encode()-ing an integer when it is represented as floating point number results in a change of type when json_decode() decodes the output.
Examples of such floating point numbers are: -123.0, -1.0, 0.0, 1.0, 123.0
Reproduce code:
---------------
<?php
function jsonRoundTrip($f) {
$e = json_encode($f);
$d = json_decode($e);
var_dump($f, $e, $d);
echo "\n";
}
jsonRoundTrip(12.3); // This is a float
jsonRoundTrip(12); // This is an integer
jsonRoundTrip(12.0); // This is an integer represented as a float
jsonRoundTrip(0.0); // This is an integer represented as a float
?>
Expected result:
----------------
float(12.3)
string(4) "12.3"
float(12.3)
int(12)
string(2) "12"
int(12)
float(12)
string(4) "12.0"
float(12)
float(0)
string(3) "0.0"
float(0)
Actual result:
--------------
float(12.3)
string(4) "12.3"
float(12.3)
int(12)
string(2) "12"
int(12)
float(12)
string(2) "12"
int(12)
float(0)
string(1) "0"
int(0)
Add a Patch
Add a Pull Request
There's is just "number" type in JSON for numbers. And as such, this is working just like it should and PHP tries it's best at guessing what type the numbers might be.
Take a look at the format for "number" at and observe the form for a "int frac". This clearly indicates that there is support for representing a floating point number, even integer floats.
The json_encode() function clearly supports encoding of floating point numbers. json_decode() is capable of deserialising "12.0" as a integer floating point number.
If you encode a floating point number, then one should expect to decode a floating point number.
If json_encode()/json_decode() is to be used as a serious and reliable data exchange format, then there should be no loss or conversion of primitive type information.
Please re-consider.
Yes, IF you were passing fractional part. But you're not. See the output of var_dump($f) in your results..
And there lines the problem - there is no way to express the fractional part if json_encode() does not even deal with it in the first place.
An integer and an integer represented as a floating point number are not the same thing because they have different types, as follows:
<?php
$a = 12;
var_dump($a); //int(12)
$b = 12.0; // This has a fractional part, hence it is a floating point number and not an integer
var_dump($b); //float(12)
var_dump($a === $b); //bool(false)
?>
Numerically they have the same value, but we all know this to be true:
<?php
var_dump($a == $b); //bool(true)
?>
There is always a fractional part of any integer when it is represented as a floating point number. It is implied and can, simply, be expressed by appending a ".0" to the integer part. There is nothing in the JSON encoding rules on which disallows this (see "int frac" form for specifics).
Decoding a valid and legitimate encoding of an integer when it is represented as a floating point number gives the correct PHP floating point type:
<?php
var_dump(json_decode("12.0")); //float(12)
?>
Decoding an integer-encoded stream also gives the correct PHP integer type:
<?php
var_dump(json_decode("12")); //int(12)
?>
I fail to see how my bug report is bogus when json_encode() is unable to produce a perfectly valid and legitimate encoding yet json_decode() is capable of doing the right thing.
Surely, the json_encode() implementation must be identifying the data type being encoded, presumably it is using equivalents for is_object() and is_array(). Why not use equivalents for is_int() or is_float() as well?
A reliable data interchange format should not purport to do any type-casting from the primitive types it was provided for encoding. ie: If you encode a float then you should expect to decode a float. As far as I am concerned json_encode() is un-reliable and fails to encode my float, which I have confirmed in my results.
I humbly ask that you reconsider your position.
This is still an issue, specifically when JSON encoding for talking to APIs that
don't allow mixed type arrays.
For instance, json_encode(array(1.2, 2.3)) properly encodes to "[1.2, 2.3]"
But, json_encode(array(1.0, 2.3)) encodes to "[1, 2.3]" which fails if the
receiving end does not allow mixed-type arrays.
Any chance on this ever being fixed?
PHP Version: 5.3.10
The problem is still present in version 5.4.6.
var_dump says this values is float, but after applying json_encode and json_decode
the value gets to be an int.
For the jsoncpp library there is a difference between int and float and that
difference is acknowledged by the floating point.
The problem is still present in version 5.5.10.
I opened a PR to resolve it.
I think it would be nice looking into how others handle this issue.
Here is a comparision for the various json modules for python:
"Python floating point numbers (float) should be representable as JSON. JSON represents numbers with decimal fractions, and optional base-10 exponents. A floating-point number with a zero a fractional part, such as 1.0, could reasonably be converted to the JSON number 1 as well as 1.0; however no implementations choose to drop the fractional part."
the json ruby gem also seems to keep the fraction:
#!/usr/bin/ruby
require 'json'
require 'pp'
pp JSON.parse(JSON.generate([1.0]))
outputs
[1.0]
I would be curious if there are other widely used json encoder implementations which are dropping the fraction for the integer numbers.
I think that keeping the fraction all times for floats wouldn't hurt anybody, but it could be useful for some people, and from my quick test this seems to be the common behavior, so I think we should follow it too.
I tested the lib jansson (C) and it also keeps the fraction.
json_t *array, *value;
value = json_real(1.0);
array = json_array();
json_array_insert(array, 0, value);
printf("%s\n", json_dumps(array, 0));
Outputs: [1.0]
I also tested go-lang and it gives integer value:
import "encoding/json"
fltB, _ := json.Marshal(1.0)
fmt.Println(string(fltB))
Output: 1
Javascript returns integer as well:
JSON.stringify(1.0)
Output: 1
Kevin Israel suggested on my pull request to create another flag to json_encode (see). What do you guys think? I can add it to the PR.
Automatic comment on behalf of jrbasso@gmail.com
Revision:;a=commit;h=ac7cfad3b54b04b7ff2d0e4bfd26e8b61d233613
Log: Fixed bug #50224 where float without decimals were converted to integer
Can any of the involved persons please explain in their own words why it was deemed necessary to introduce yet another flag for this? What is so dangerous about appending a .0 to a float? | https://bugs.php.net/bug.php?id=50224 | CC-MAIN-2021-04 | refinedweb | 1,136 | 67.35 |
Hi, so I'm trying to get the highest palindromic number from the results of a 3digit multiplied by 3 digit result. Aka 1*1 - 999*999, or any combination of those numbers.
I think there's some weird undefined behaviour going on, because I swear that I saw 2 different results from the same run. The problem is, it's giving a 7 digit result (And it's not a palindromic number). 999*999 is a 6 digit number, therefore it's impossible for the result to be a 7 digit number... So something really strange is going on, and I can't see what's wrong. Here's the code:
Cheers.Cheers.Code:
#include <iostream>
#include <string>
using namespace std;
int main() {
char * string = new char[30];
int highest = 0;
int temp = 0;
for (int x = 0; x < 1000; x++)
for (int y = 0; y < 1000; y++) {
itoa(x * y, string, 10);
if ( ((int)string[0] == (int)string[5]) && ((int)string[1] == (int)string[4]) )
if ((int)string[2] == (int)string[3])
temp = (int)string;
if (highest < temp)
highest = temp;
}
cout << highest << endl;
} | http://cboard.cprogramming.com/cplusplus-programming/107505-undefined-behaviour-palindromic-number-finder-printable-thread.html | CC-MAIN-2014-23 | refinedweb | 185 | 76.96 |
L A W R E NC E
JOURNAL-WORLD ®
75 CENTS
-/.$!9 s -!2#( s
LJWorld.com
No. 2 seed KU to face Detroit in 1st round Find brackets and complete NCAA Tournament news inside and online at KUsports.com Seeded second in the Midwest region of the 68-team NCAA Tournament, Kansas will play a first-round game Friday against No. 15 seed University of Detroit Mercy in the CenturyLink Center in
Omaha. Tipoff is scheduled for 8:57 p.m., and the game will be televised on truTV. Kansas would need to win Friday and again Sunday to advance to the Sweet 16 play in the Edward Jones Dome in
“I don’t think that Detroit is an easy firstround game,” KU coach Bill Self said Sunday.
St. Louis, where an Elite Eight matchup with No. 1 seed North Carolina looms as a possibility. Before advancing that far, Kansas must win three Please see KU, page 5A
‘The bigger the show, the better’
Panel: Health reform is still evolving By Karrey Britt kbritt@ljworld.com
Kevin Anderson/Special to the Journal-World
THE CROWD WATCHES A BOUT BETWEEN "SHOWTIME" BRADLEY CHARLES and "Rock ‘n’ Roll" Mike Sydal during a recent Saturday night Metro Pro Wrestling match at Turner Recreation Center in Kansas City, Kan.
Pro wrestlers act out Good vs. Bad melodrama weekly at a ring near you By Shaun Hittle sdhittle@ljworld.com
ONLINE: See the video at LJWorld.com
KANSAS CITY, KAN. — Backstage, a group of costumeclad Spar-
MATT RIVIERA dons golden boots during his fights.
row,.
JIMMY ROCKWELL, left, gets tossed into the ropes by his opponent during a recent Saturday night Metro Pro Wrestling match at Turner Recreation Center in Kansas City, Kan. WRESTLER TREVOR MURDOCH gets a warning from the referee during a recent match.
‘Showtime’ The first kick to the groin won’t be launched until a good half-hour after the show begins. First, two wrestlers strut to the ring amid a chorus of Please see WRESTLING, page 2A Nichols incentives. “The misconception is that it’s a government takeover, but it’s not. It’s about transforming a system that’s not working,” he said. “It’s a moral thing and a cost thing.”
Doctor shortage After. Please see HEALTH, page 2A
INSIDE
Dry, warmer Classified Comics Deaths Dilbert
High: 75
Low: 42
Today’s forecast, page 10A
6B-10B 9A 2A 10A
Events listings Horoscope Movies Opinion
10A, 2B Puzzles 9B Sports 4A Television 8A
COMING TUESDAY
9B 1B-5B We’ll check in with 3A, 2B, 9B an Environmental Protection Agency official who will be in town to talk about reJoin us at Facebook.com/LJWorld and Twitter.com/LJWorld cent agency actions.
Vol.154/No.72 36 pages
Energy smart: The Journal-World makes the most of renewable resources.
2A
|
Monday, March 12, 2012
.
DEATHS JOHN LAWRENCE GLINKA Private Memorial services for John (Johnny) Lawrence Glinka, 62, Lawrence, are pending and will be announced by Warren-McElwain Mor-
tuary. He died Saturday, March 10, 2012 at Lawrence Memorial Hospital. Condolences may be sent to. com.
ESTEL MARIE FYNE Services for Estel Marie Fyne, 86, Fort Scott, will be at 11 a.m. Thursday at the Cheney Witt Chapel in Fort Scott. Mrs. Fyne, formerly of
Lawrence, died Saturday, March 10, 2012, at Mercy Hospital. Online condolences may be made at cheneywitt.com.
FRANCES PETERSON Frances Peterson, age 94 of Cedar Hill, Texas, passed away March 10, 2012. She was born June 8, 1917 in Mansfield, TX. Frances married John Peterson, May 17, 1952 in Washington D.C. Frances worked a number of years for the U.S. Treasury Dept. and retired in 1974 and moved to a rural home in Douglas County, Kansas, that same year. In 1992 they moved to the city of Lawrence, Kansas & Millie Bailey; one brother, William “Bill” Bailey; one sister, Marie Peterson Vincent; and her husband John, Sept. 22, 2009. She is survived by her brother, David Bailey of Cedar Hill, TX; sister-in-law, Justine Kloepper of Medford, Oregon; and many nieces and nephews. Funeral Services will be 2:00 pm Tuesday, March 13, 2012 at Jaynes Memorial Chapel in Duncanville, TX. A Memorial Service in Lawrence, KS will be announced at a later date. Frances will be interred in the Pioneer Cemetery in Lawrence, Kansas. Please sign this guestbook at obituaries.ljworld. com.
Health anyone.”
CONTINUED FROM PAGE 1A
“Lower your expectations,” he said. “The ability to get in and receive the high quality health care that you’ve come to enjoy will be compromised by this law,” he said. “We do not have the provider system set up to handle that new bulk of folks who Change delivery system insurance through a new Marci Nielsen, executive marketplace called an exdirector of the Patient Cen- change. The cost of the tered Primary Care Col- insurance plan will be tied laborative in Washington, to income. D.C., and former executive “It’s designed to be afdirector of the Kanfordable,” he said. sas Health Policy Au“Having said that, I thority, said there are can’t guarantee it’s provisions in the Afgoing to feel affordfordable Care Act to able when it comes address the physician time for you to pay shortage. She said what you have to HEALTH one way is to focus pay.” on a patient-centered medMeyer added that he ical home where pharma- also worries there will not cists, therapists, nurses and be enough doctors who mental health professionals will take the new insurare engaged in providing ance plan or Medicaid. He care — not just doctors. said there aren’t enough “What we’ve got to do is doctors accepting Medicchange the way we deliver aid now. services,” she said. Nielsen said safety net Nielsen said the Af- clinics like Health Care fordable Care Act has be- Access and Heartland come more controversial Community Health Censince it was passed. “It’s ter will continue to play a incredibly complicated role in providing care. She and continues to be con- said the Affordable Care troversial for reasons that Act added $11 billion for are more political than of such centers. substance,” she said. Among the other panelShe said a number of ists were Jamie Simpson, groups supported the bill former disability program when it was passed and coordinator for the Kancontinue to support it — sas Department of Health nurses, pharmacists, hos- and Environment; Dapitals and doctors. For the vid Johnson, CEO of Bert first time in 100 years, she Nash Community Mental said the American Medi- Health Center; and Dr. cal Association supported Donald Hatton, of Reed national health reform. Medical Group and a regent for the American Single-payer system? College of Physicians. During a question-andNichols concluded by enanswer session, someone couraging everyone to parasked why we couldn’t go ticipate in health reform. “If to a single-payer system you sit back and watch this like other countries. Nich- being done to you. I promise ols said he had a better you, you will not like it,” he shot of making the Kan- said. “If you want to make sas University basketball this better, tell the truth and team. He said the problem use your faith to keep the is no one trusts the gov- conversation going.” ernment. — Health reporter Karrey Britt can be Ironically, Nielsen reached at 832-7190. added, people like the
-"83&/$&t"3&"
Wrestling CONTINUED FROM PAGE 1Afirst,tag tag-team duo known as the “Hooligans.” Potbell
L AWRENCE J OURNAL -W ORLD handshake, fearing another beating. But McDowell is sinljworld.com cere and convinces Cutter so. 609 N.H. (offices) • 645 N.H. (News Center) Lawrence, KS 66044 At his age, McDowell (785) 843-1000 • (800) 578-8748 reluctantly acknowledges that he’ll probably never see the big stage of profesEDITORS sional wrestling; he’ll be Dennis Anderson, managing editor stuck in old high school 832-7194, danderson@ljworld.com gyms fighting pint-sized Caroline Trowbridge, community editor opponents. 832-7154, ctrowbridge@ljworld.com “Probably, but it doesn’t Ann Gardner, editorial page editor matter,” he says. 832-7153, agardner@ljworld.com Part theater, part athletTom Keegan, sports editor ics, McDowell can’t get 832-7147, tkeegan@ljworld.com enough. “You’re in that ring, OTHER CONTACTS you’ve got everybody in Chris Bell, circulation manager the palm of your hand,” 832-7137, cbell@ljworld.com he says. “It’s kind of like a Classified advertising: 832-2222flying5 work week grind — for themselves and the fans. “I’m dressed up like Wolverine right now,” Reynolds says. “I’m going to fight two rough dudes. It’s going to be great.” — Reporter Shaun Hittle can be reached at 832-7173. Follow him at Twitter.com/shaunhittle.151 Health:.......................................................832-7190 Transportation: ...................................832-6352 Photo reprints: ......................................832-7141.’S POWERBALL 5 14 17 20 41 (5) FRIDAY’S MEGA MILLIONS 9 10 27 36 42 (11) SATURDAY’S HOT LOTTO SIZZLER 11 17 18 27 39 (13) SATURDAY’S SUPER KANSAS CASH 5 8 9 20 23 (2) SUNDAY’S KANSAS 2BY2 Red: 6 10; White: 14 15 SUNDAY’S KANSAS PICK 3 0 1 9
Did you participate in the Kansas caucuses? !"Yes !"No Weekend poll: Who’s your favorite professional wrestler from the ‘80s and ‘90s? I’m not a professional wresting fan, 32%; Stone Cold Steve Austin, 17%; Macho Man Randy Savage, 13%; Other, 10%; Hulk Hogan, 10%; Nature Boy Ric Flair, 8%; The Ultimate Warrior, 4%; The Honky Tonk Man, 2%; Hacksaw Jim Duggan, 0%; Brutus the Barber Beefcake, 0%.
Your loved one never leaves our care. Your only locally owned crematory.
& Crematory
Our family fami y serving servi g your y ur family since 1920
6th & Indiana • 843-5111
LAWRENCE&STATE
LAWRENCE JOURNAL-WORLD ! LJWorld.com/local ! Monday, March 12, 2012 ! 3A
BRIEFLY Mother, 3 children die in western Kansas fire
2012 queen of the green crowned
SC.
Pell Grant use surges at JUCOs GARDEN CITY — A study of Kansas community colleges shows the number of students receiving federal financial aid jumped dramatically as the nation struggled to recover from the recession. Called “Powered By Pell: A Grassroots Perspective,” the study focuses on the flow of federal student aid across 17 of the state’s 19 community colleges. It found that from fall 2008 to fall 2010, the number of Pell Grants spiked by 75 percent, with 8,862 new grant awards. Simultaneously, Pell Grant dollars allocated to students at the Kansas institutions soared from approximately $20.5 million to about $40.4 million. The only two community colleges not to participate are in Pratt and Kansas City, Kan. The study found nearly half of the college credits earned by Kansas community college students are funded, at least in part, by Pell Grants.
QUOTE OF THE WEEK
“Quiet family homes have become weekend party palaces.”
John Young/Journal-World Photo.
St. Patrick’s Day group honors parade veteran By Chris Hong chong@ljworld.com
About the parade Begins at 1 p.m. Saturday at South Park, 11th and Massachusetts streets. Continues north on Massachusetts through downtown. Ends at the Flamingo Club, 501 N. Ninth St.
friends to be candidates on behalf of charities. Akers said it is a major time commitment but one that is a lot of fun. “It’s all for the kids; it’s worth it,” Akers said. Terry Bowen, a fifthyear committee member, said the coronation was the final preparation for the parade. Then again, she said, all the events are kind of a preparation.
2012 charities ! The Lawrence Police Blue Santa Program !"Headquarters Counseling Center !"Just Food !"tiny-k Early Intervention !"Homegrown Lawrence !"Theatre Lawrence’s Youth Education Program
Please see QUEEN, page 4A
— Arly Allen with the Centennial Neighborhood Association, to the Senate Federal and State Affairs Committee in testimony on Senate Bill 400, which would help the city of Lawrence enforce its ordinance regulating how many unrelated people can live in a single-family home.
House to debate major tax bill Debate is scheduled for today on a sweeping change in Kansas tax policy that is being pushed by House Republican leaders. The proposal would reduce state income tax rates, eliminate taxes on nonwage business income and limit growth in state budget revenue to no more than 2 percent per year. It would also decrease the Earned Income Tax Credit and increase the standard deduction for heads of household. House Republican leaders say the proposal will spur economic development. Please see CAPITOL, page 4A
Local TV LISTINGS now on… Listings for
CABLE, BROADCAST & SATELLITE! MONDAY Prime Time KNO DTV DISH 7 PM
7:30
MOVIES
8 PM
8:30
KIDS
9 PM
BEST BETS
9:30
SPORTS
March 12, 2012 10 PM 10:30 11 PM 11:30
Network Channels
Law & Order: SVU Law & Order: SVU KCTV5 News at 9 (N) Inside Ed. Browns Browns Payne FOX 4 at 9 PM (N) News News TMZ (N) Seinfeld House h Alcatraz (N) h How I Met Broke Girl Two Men Mike News Late Show Letterman The Insider Hawaii Five-0 h Antiques Roadshow Rick Steves’ Hidden Europe Downton Abbey-Behind the Drama The Voice Deciding which vocalists will advance. Smash “Chemistry” (N) News Tonight Show w/Leno Late Night The Bachelor Ben makes his choice. (N) The Bachelor (N) News Two Men Big Bang Nightline Antiques Roadshow “Honolulu, HI” The B-52s With the Wild Crowd BBC World Business Charlie Rose (N) The Bachelor Ben makes his choice. (N) The Bachelor (N) News Nightline Jimmy Kimmel Live (N) How I Met Broke Girl Two Men Mike News Late Show Letterman Late Hawaii Five-0 h The Voice Deciding which vocalists will advance. Smash “Chemistry” (N) News Tonight Show w/Leno Late Night ThisMinute ThisMinute Operation Smile ’Til Death ’Til Death King King Family Guy South Park America’s Next Model Hart of Dixie h News Ent The Office The Office 30 Rock Chris Cold Case Cold Case “Soul” Criminal Minds Criminal Minds Criminal Minds
Cable Channels KNO6 6 WGN-A 16 THIS TV 19 CITY 25 USD497 26 ESPN 33 ESPN2 34 FSM 36 NBCSN
Turnpike River City 6 News Kitchen The Drive River City 6 News Home Turnpike Movie Loft Scrubs ’Til Death 307 239 Funniest Home Videos Funniest Home Videos WGN News at Nine (N) 30 Rock Scrubs ››‡ Just the Ticket (1999) Andy Garcia. ››› Silverado (1985, Western) Kevin Kline, Scott Glenn. City Bulletin Board, Commission Meetings City Bulletin Board, Commission Meetings School Board Information School Board Information 206 140 dNBA Basketball New York Knicks at Chicago Bulls. (N) dNBA Basketball Boston Celtics at Los Angeles Clippers. (N) fMLS Soccer Philadelphia Union at Portland Timbers. (N) SportsCenter (N) 209 144 Bracketology h kHigh School Hockey dHigh School Basketball dHigh School Bas672 NHL Live kNHL Hockey Anaheim Ducks at Colorado Avalanche. NHL Live Poker After Dark 603 151 NHL 36 Greta Van Susteren The O’Reilly Factor Hannity h 360 205 The O’Reilly Factor (N) Hannity (N) h Gold Lxry Bm. 355 208 60 Minutes on CNBC Gold (N) Lxry Bm. Nuclear Meltdown Closer “Star Turn” Rizzoli & Isles h CSI: NY Murder victims. 245 138 The Mentalist NCIS “Endgame” 242 105 NCIS “Faith” h WWE Monday Night RAW (N) (Live) h Psych h Intervention “Sean” (N) Intervention h 265 118 Hoarders h Hoarders (N) h Hoarders h 246 204 World’s Dumbest... Lizard Lick Lizard Lick Lizard Lick Lizard Lick Worked Worked World’s Dumbest... 254 130 ›››‡ Braveheart (1995) Mel Gibson. A Scottish rebel rallies his countrymen against England. ›››‡ Braveheart The Office The Office 247 139 Family Guy Family Guy Family Guy Family Guy Family Guy Family Guy Conan h Happens Bethenny Ever After Love 237 129 Bethenny Ever After Bethenny Ever After (N) Love Broker (N) King The King of Queens 304 106 Home Imp. Home Imp. Raymond Raymond Raymond Raymond King Pawn Stars Pawn Stars American Pickers Pawn Stars Pawn Stars 269 120 Pawn Stars Pawn Stars American Pickers Being Human (N) Lost Girl “Fae Day” (N) Being Human h Lost Girl “Fae Day” 244 122 Being Human h 248 136 ››‡ Twilight (2008) h Kristen Stewart, Robert Pattinson. Premiere. ››‡ Twilight (2008) h Kristen Stewart. Sunny Sunny Sunny Daily Show Colbert South Park South Park 249 107 South Park South Park Sunny Khloe Khloe Ice-Coco Ice-Coco Chelsea E! News Chelsea 236 114 Fashion Police Ron White’s Celebrity 327 166 Them Idiots Whirled Tour h Them Idiots Whirled Tour h 329 124 ››‡ Poetic Justice (1993) Janet Jackson. ›› Not Easily Broken (2009) Morris Chestnut. Wendy Williams Show T.I.-Tiny Basketball Wives T.I.-Tiny Stevie TV 335 162 Basketball Wives (N) T.I.-Tiny Basketball Wives Bizarre Foods America 277 215 Bizarre Foods America Bizarre Foods America Bizarre Foods/Zimmern No Reservation The Real Skinny (N) My 600-Lb. Life h 280 183 My 600-Lb. Life h My 600-Lb. Life h My 600-Lb. Life h 252 108 ››‡ Untraceable (2008) h Diane Lane. ››› Panic Room (2002) h Jodie Foster. ››‡ Untraceable Lovewrecked (2006) 253 109 Lovewrecked (2006) h Amanda Bynes. ›› My Life in Ruins (2009) Nia Vardalos. Diners Diners Diners Diners Diners Diners Diners 231 110 Heat See. Heat See. Diners House House Hunters My House First Place House House 229 112 Love It or List It (N) House 299 170 Friends Friends Friends Friends Friends Friends Friends Friends Friends Friends Mr. Young Phineas Phineas I’m in Band Suite Life Zeke Suite/Deck 292 174 Kickin’ It Lab Rats Zeke Phineas Wizards Wizards Wizards 290 172 Austin Jump In! (2007) h Corbin Bleu. Shake It Austin King of Hill King of Hill Amer. Dad Amer. Dad Family Guy Family Guy Chicken Boondocks 296 176 Regular MAD American Chopper Sons of Guns h 278 182 American Chopper American Chopper Sons of Guns h Pretty Little Liars Prince Prince 311 180 Pretty Little Liars (N) Secret-Teen The 700 Club h Navajo Cops (N) Secret Service Files Wild Justice h 276 186 Secret Service Files Wild Justice h Frasier Frasier Frasier Gold Girls Gold Girls 312 185 Little House on Prairie Little House on Prairie Frasier 282 184 Gator Boys h Finding Bigfoot h Rattlesnake Republic Gator Boys h Finding Bigfoot h Creating J. Franklin Duplantis Praise the Lord (Live). J. Osteen MannaFest 372 260 Behind World Over Live Vaticano Women of Daily Mass: Our Lady 370 261 The Journey Home (N) Genesis Rosary Meet the Press IYC IYC To Not Fade Away Meet the Press IYC IYC Capital News Today 351 211 Commun Tonight From Washington 350 210 Politics & Public Policy Today Stolen 285 192 Disappeared h Disappeared (N) h Stolen Disappeared h Disappeared h Weaponology The Terror Matrix (N) Navy SEALs Weaponology 287 195 Navy SEALs 279 189 Remembering Whitney: The Oprah Interview Oprah’s Next Chapter Remembering Whitney: The Oprah Interview 362 214 Ice Pilots Ice Pilots Ice Pilots Ice Pilots Weather Center Live Ice Pilots Ice Pilots Ice Pilots Ice Pilots General Hospital Young & Restless Days of our Lives General Hospital 262 253 Days of our Lives 256 132 ››› A Kind of Loving (1962) Alan Bates. ›››› The L-Shaped Room (1963) Leslie Caron. Loneliness-Runner Too Short ›‡ Your Highness (2011) 501 300 Real Time/Bill Maher Game Change (2012) Julianne Moore. Sexy 515 310 ›› Life as We Know It (2010) Katherine Heigl. ››› Face/Off (1997, Action) h John Travolta. Californ. Shameless (iTV) h 545 318 Homeland (iTV) h Californ. Lies Shameless (iTV) h Lies 535 340 ››› The War of the Roses (1989) ›› Death at a Funeral (2010) ›‡ Money Train (1995) Spartacus: Vengeance ››‡ Takers (2010) Matt Dillon. Spartacus: Vengeance 527 350 ›› Priest (2011)
For complete listings, go to
4A
|
Monday, March 12, 2012
Capitol CONTINUED FROM PAGE 3A
But revenue estimates show that the plan would hike tax rates for the lowest income earners in Kansas. And the GOP plan has also been criticized for delaying fund transfers to the highway program. Democrats and some Republicans have also said the 2 percent cap on budget growth is unrealistic because of increasing funding needs after years of budget cuts that were made during the recession.
-"83&/$&t803-%
. The measure would be limited to providing scholarships to students from low-income families who attend school in a group of 18 school districts that have a large number of at-risk students.
Senior exemption removal advances
A Senate committee has approved legislation that would remove the hunting and fishing license exemptions for people 65 and older. The Kansas Department of Wildlife, Parks and Tourism says it needs to generate some revenue to take care of upkeep at the parks. Voucher-type bill Under the proposal, seniors would have two to receive vote options. They could buy A bill that would set up a lifetime combination a type of voucher system senior hunting and fishing for private and parochial license, which is proposed schools will probably be to be $40. The second voted on this week in the option would allow seniors House to purchase an annual Education hunting, fishing or combinaBudget tion license at half-price. Committee. Currently, that would be $9 State Rep. each for a hunting or fishing Clay Aurand, license, or $18 for a combiR-Courtland, nation license. said his What’s next: measure, ! 11 a.m. today — FiHouse Bill Aurand 2767, would nal action in House on give parents House Bill 2353, allowing concealed carry in public more choices in finding buildings. Post-secondary schools that best fit the schools, hospitals and educational needs of their nursing homes are exempt children. from the measure. It was supported in !" 3:30 p.m. today — committee by Bob Voboril, Hearing before House superintendent of Catholic Education Budget ComSchools for the Diocese of mittee on House Bill 2773, Wichita. authorizing expenditure “Tax dollars already follow children to religious day of unencumbered balances held by school districts; care centers, religious prereducing local option schools, religious colleges, religious hospitals, religious budget authority, Room 159-South, Capitol. charitable organizations !" 10 a.m. Tuesday — and religious nursing homes, following a principle Kansas State Board of Education monthly meeting, that assistance is given to those who need it most, not 120 SE 10th. !" 1:30 p.m. Wednesday according to whether the — Kansas Board of Reinstitution is owned by the gents monthly meeting, government,” Voboril said. The measure is opposed Curtis State Office Buildby the ACLU of Kansas and ing, Suite 520. !" 9 a.m. Thursday — Western Missouri, the KanKansas Board of Regents sas Association of School monthly meeting, CurBoards and Americans United for the Separation of tis State Office Building, Suite 520. Church and State. !" 1:30 p.m. Thursday “You are asking taxpay— Informational hearing ers to subsidize religious schools,” said Vickie Sandell on death penalty before House Corrections and Stangl of the Great Plains Juvenile Justice Comchapter of Americans mittee, Room 144-South, United for Separation of Capitol. Church and State. !" 1:30 p.m. Thursday — The bill would give Hearing on Senate Resolutaxpayers a 90 percent tax credit for contributions tion 1831, requesting Gov. Sam Brownback delay the made to an organization that would provide scholar- implementation of Kanships for students to attend Care, Room 546-South, private or parochial schools. Capitol.
HOW TO HELP
Group seeks child care helpers for meetings Staff Reports
Agency: Kansas Children’s Service League Contact: Jery Marquez, 785-431-6228 or jmarquez @kcsl.org The Helping Hands Support Group, facilitated through Kansas Children’s Service League, or on the third Friday of each month, from 6 p.m. to 7:30 p.m., at 360 Degree Church, 3200 Clinton Parkway. All volunteers will be screened through KCSL, which will include a background check. Their second meeting is this Friday, so volunteers are needed ASAP; please contact Jery Marquez at 785-431-6228 or jmarquez@kcsl.org.
Immediate needs !.” The next meeting is Thursday. Contact Stacey Hunter-Schwartz at 785-841-0333 or Bonnie Uffman at 785- 856-0057 for more details. !"Lawrence Community Shelter is in need of a volunteer who can help with light data entry five to 10 hours per week. Previous experience with Micro-
soft Excel and the ability to decipher handwritten notes will be extremely helpful in providing LCS with support. Volunteers working on data entry will not have any contact with LCS guests, training and support will be provided by office staff, and the hours are flexible. For more details, please contact Loring Henderson at 785-832-8864 or director @lawrenceshelter.org. !" Grassland Heritage Foundation is looking for volunteers who can help them with their first scheduled burn at Snyder Prairie near Mayetta, just north of Topeka. The burn is scheduled for Saturday morning, weather permitting. Volunteers will help with a variety of tasks needed to control the burn and should be able to walk long distances with no problem. Additionally, all volunteers must be at least 18 years old and shouldn’t plan to come if they have any respiratory issues that could be aggravated by the smoke. For more information on location and time, please contact Kim Bellemere at grassland heritage@gmail.com. !" KVC Behavioral HealthCare is seeking volunteers to provide child care once a month at its support group for Douglas County foster parents. KVC nurtures a network of foster-parent support groups throughout its northeast Kansas service area. The support groups meet two hours a month. Volunteers are needed to help care for the foster parents’ children, and most meetings are quite large, so a group of volunteers is needed in order to provide ample supervision and care. This would be a great volunteer opportunity for a high school or college student group, church youth group or a local civic group. Volunteers must be 16 or older and should contact Jessica Doll at 913-4998100, ext. 8316, or jdoll@ kvc.org for more details.
in Kearney, Neb., sponsored promoted to assistant vice by the Nebraska Society president/bank manager of Fire Service Instructors at First State Bank & Trust, and Central Community 3901 W. Sixth St. RichardCollege-Lexington. !"Jennifer Groene and son, who has a bachelor’s degree from Kansas Univer- Vicki Hull, both licensed clinical marriage and family sity, is a 2011 graduate of therapists, Lawrence, reLeadership Lawrence. She cently attended the Kansas joined First State Bank & Association for Marriage Trust in 2004. !"Sharri Lynn Black, and Family Therapy spring a licensed master social clinical conference. !"Frank Norman, presiworker, has joined Shane M. dent and senior ecologist Jones & Associates. Black recently left Adopt USKIDS. of Norman Ecological Consulting, rural Lawrence, Black, who has more than 30 years’ experience in the presented “Managing Your area of adoption and foster Prairie Remnant” March care, will provide individual, 3 in Hiawatha. The talk was sponsored by Grimm couple, family and group Gardens of Hiawatha and counseling. !"Dave Bales Vacuum, Prairie Place Designs of Sewing and Lamp Sales & Sabetha. !"Lawrence Presbyterian Repair has moved to 935 Iowa. The company has been Manor is sponsoring a semiin business for 37 years. nar for seniors on preparing !"Nate Jamison, Lawthem and their homes for a move. The event, presented rence, attended the Les Lukert Winter Conference. !"U.S. Bancorp Investments Inc. has hired Dru Hull as a financial adviser working in the company’s offices at 900 Mass. He formerly was a financial adviser with Edward Jones. !.
U.S. sergeant kills 16 in Afghan villages
Queen CONTINUED FROM PAGE 3A are some of the worst atrocities committed by U.S. forces during the Afghan War. According to U.S. and Afghan officials, Sunday’s attack began around 3 a.m. in two villages in Panjwai district.
– Reporter Chris Hong may be reached at 832-6354. Follow him at Twitter.com/ChrisMHong.
We install the BEST... And Repair the REST!
— For more volunteer opportunities, contact Shannon Reid at the United Way’s Roger Hill Volunteer Center, at 785-865-5030 or volunteer@rhvc.org, or go to volunteerdouglascounty.org.
AROUND & ABOUT IN LOCAL BUSINESS ! Megan Richardson was
L AWRENCE J OURNAL -W ORLD
CALL 843-5670
In business since 1984 offering a wide variety of plumbing services, including: Service & Repair • Water Heaters Remodeling • And much more!
2329 Iowa Street | Lawrence 785-832-0501
Spring Break Activities • Open Gym • Gameday Fit Club • Spring Football Challenge • Middle School Dance Sign Up!
940 E. 28th St. Lawrence Phone: 856-3212
Old Fashioned Service Industry Leading Equipment Since 1969!
Presentations starting at 10:00am Meet the most fuel-efficient tractor in the world.
Learn about 2nd Generation ‘e3 (SCR) and CVT Transmissions Presented by an AGCO product specialist.
How to Sample Hay Presented by: Bill Wood, Douglas County Extension
Saturday, March 17th • 8 a.m. -1 p.m. Discounted Parts 5 to 10% BBQ Lunch 11 a.m. - 12:30 p.m.
During March and April you can accrue your AGCO parts purchases towards FREE AGCO branded apparel.
SHUCK IMPLEMENT
AGRICULTURE • LIGHT INDUSTRIAL • COMMERCIAL LAWN EQUIPMENT
LOCALLY OWNED & OPERATED • JUST 2 MILES NORTH OF I-70 ON HWY 24/59
1924 E 1450 Road, Lawrence, KS 66044
785-843-8093
Shuck Implement
59 to Lawrence
70
LAWRENCE
L AWRENCE J OURNAL -W ORLD
SOUND OFF
Monday, March 12, 2012
KU
| 5A
seen them play a couple public in Omaha, schedof times, but I know their uled from 5:10 p.m. to Christina A. Glauner, 38, coach well, and of course, 5:50 p.m. Thursday in Will the cranberry LAW ENFORCEMENT REPORT Lawrence, and Jonathan D. we recruited their best the CenturyLink Center, There were no incidents Glauner, 38, Lawrence. CONTINUED FROM PAGE 1A recipes from the the same building where player.” Zachary D. Langford, Lawrence Public reported Sunday. Kansas will have one KU’s 2008 national-title 30, Lawrence, and Cristina Library’s contest Fernandez Alvarez, 27, games. If Kansas (27-6) practice open to the run started. be made available to the DOUGLAS COUNTY Madrid. defeats Detroit (22-13), it public? Stephen T. Hasiotis, 49, DISTRICT COURT plays again Sunday against N.Y. TIMES CROSSWORD SOLUTION FOR MARCH 11 Lawrence, and Carol E. MARRIAGE LICENSES ISSUED Hasiotis, 50, Lawrence. the winner of Friday’s St. The recipes from I L L C A P R I M G M Cory Richard Schmidt, Mary’s/Purdue match- B E S A M E Marisol Foley Cortez, 32, the contest, held in 28, Lawrence, and Anja C U E O L O R D A R O D Lawrence, and Miguel Garza, up at a time that won’t A P O L L O conjunction with Quisbrock, 27, Lawrence. 33, Lawrence. S I P P I N G O N A G L A S S O F W I N E be determined until after Travis Lee Bowlin, 24, an upcoming appearance the first-round games are E T H S I N K L O S T A S S I N by NPR correspondent Lawrence, and Rachel Marie BANKRUPTCIES played. Bowlin, 34, Lawrence. H O I M A L I Y A N K B B S S Q S Susan Stamberg, are availDouglas County residents Michael Charles Smith, The winner of that I M S T I L L C R A Z Y A B O U T Y O U or businesses filing for bankable on the Lawrence Pub- 56, Lawrence, and Imogene ruptcy protection recently in game will take on one T E T R A D S E K E L A N C O M E lic Library Foundation’s Louise Mendell, 69, more opponent, which U.S. Bankruptcy Court in the website at ljw.bz/ykmL0x. Lawrence. A T E O S O S F O I O S District of Kansas, according will prevail from the field Blake Allen Pilkington, 37, “An Evening with Susan I C A N T L I V E W I T H O U T Y O U to court records: of Georgetown, a No. 3 Stamberg” is set for 7 p.m. Lawrence, and Dana Rene • Gregory Lee Osterhaus, T O C K S A I D M I X A N N E A R seed, Belmont, San Diego 35, Lawrence. 4918 Stoneback Drive , Tuesday at the Lied Cen- Barr, Jared Dean Randel, 25, W H I S T H O U S E M A I D T S A R S State and North Carolina Lawrence. ter, 1600 Stewart Drive. Lawrence, and Kelsey Marie H M O A I R T R O P E S S A State — before the North O I L • Matthew Preston Miller, Wilson, 20, Lawrence. 2500 W. Sixth St, Apt. 420, Carolina scenario would D O Y O U R E A L L Y M E A N T H A T Richard Trinidad Lawrence. SOUND OFF be possible. A M B U S O A D S B O O Garcia, 32, Lawrence, and • Mark Patrick McMillin, For now, Kansas coach Molly Bridget Altman, 32, H A S B E E N S R O S O L A R I A 619 Whitfield St., Lot 20C, If you have a question, call Lawrence. Bill Self is focused on Lecompton. I S T H A T T H E W I N E T A L K I N G Ryan Lucas McPhail, 32, 832-7297 or send email to finding a way to limit the • Victor M Rivas, 4414 R L S O N E A L O E D U T Y P A R Lawrence, and Freda Trena impact of Detroit’s McAdam Ave, Lawrence. soundoff@ljworld.com. Neal, 28, Lawrence. E L I E L S C A R O W N I P S E • David P Vande Vooren, Donald’s All-American Michael Paul Ciavarino, 31, 2440 Ohio, Lawrence. guard, Ray McCallum Jr., I T S M E T A L K I N G T O T H E W I N E New Castle, Pa., and Catie • Victoria Rose Danielle A L I E N I T O I M O N I T Anne Wilson, 27, Wellsville. the son of Detroit’s coach, N O T I Kimmel, 206 E. 18th St., Randy Dean Cobb, 56, Ray McCallum Sr., who is P S T P A D R E N O D S U N G T O Lawrence. Lawrence, and Rosavilla PUMP PATROL in his fifth year as the Ti• Michael Lee Alexander, Cuyo Daisog, 38, Lawrence. 3812 Pinnacle Circle, tans’ coach. SUNDAY CROSSWORD SOLUTION FOR MARCH 11 James Robert Ward, 35, The JournalLawrence. Once on the recruitLawrence, and Lisa Marie World found gas • Dennis Raymond Wilson, Van Dine, 34, Lawrence. ing wish list of Self and LAWRENCE 206 E. 18th St., Lawrence. prices as low as Scot Alan Pruyn, 25, coaches from other pe• Frederick Mark Inyard, $3.65 at several Lawrence, and Maria rennial powerhouses, 615 N. Third St, Lawrence. stations. If you Victoria Crowe, 22, • Deborah Sue Marr, 3908 McCallum decided to Lawrence. find a lower price, Overland Circle, Lawrence. play for his father at Decall 832-7154. • Kelly Ray McGlumphry, troit, which earned a bid DIVORCES GRANTED 4500 Overland Drive, Apt by defeating Horizon Robert Gunnar Lundbom, D206, Lawrence. League conference tour42, Lawrence, and Korrie The Journal-World does not Suzzanne Lundbom, 40, nament host and regularprint accounts of all police reports CORRECTIONS Lawrence. season champion Valfiled. The newspaper generally Jennifer Lyn Lee, 32, reports: paraiso, 70-50, in the title The Journal-World’s polLawrence, and Christopher • Burglaries, only with a loss of game. B. Lee, 36, Lawrence. icy is to correct all signifi$1,000 or more, unless there are “I don’t think Detroit is cant errors that are brought unusual circumstances. To proan easy first-round game,” tect victims, we generally don’t HOSPITAL to the editors’ attention, identify them by name. ninth-year Kansas coach usually in this space. If you • The names and circumstanc- Bill Self said. “When you believe we have made such BIRTHS es of people arrested, only after think of a 2 and 15-seed they are charged. Troy and Lisa Morando, an error, call 785-832-7154, game in the past, you cer• Assaults and batteries, only if McLouth, a boy, Sunday. or email news@ljworld. major injuries are reported. tainly don’t see Detroit beIsaac and Grace Willems, com. • Holdups and robberies. Lawrence, a girl, Sunday. ing on that line. I’ve only
ON THE RECORD
LJWORLD.COM/BLOTTER
Q: A:
Lawrence middle school students do well at regional competition of Model U.N..
NOW IS THE TIME FOR BETTER HEARING THIS WEEK ONLY! March 12-16th Take advantage of special pricing on all digital instruments Call to schedule your FREE HEARING TEST!
Be sure to bring a friend or loved one, someone whose voice is familiar to you. At Lawrence Hearing Aid Center, we take your hearing seriously— Our hearing tests are always free! AND our patients receive FREE Check-ups, Always! Come join us for Coffee and Doughnuts in the morning and Iced Tea and other Goodies in the afternoon every day this week.
Kim Henderson, H.I.S.
MAX FALKENSTIEN I am enjoying my improved hearing aids which I got at Lawrence Hearing Aid Center. The sound quality is more clear and telephone conversation is enhanced without any whistling. Come see the good folks at Lawrence Hearing Aid Center.
Locally owned & operated Valuable Coupons
Custom ITC (In-The-Canal)
Can correct up to 35/40 dB loss Class A linear/analog
Was $1200.00
Interest-free financing W.A.C.
599
$
(785) 749-1885 4106 W. 6th, Ste. E (Just West of HyVee)
Now you see it...
Custom ITE (In-The-Ear)
Can correct up to 35/40 dB loss Class A linear/analog
Was $800.00
Now you don’t...
399
$
(785) 242-7100 1302 S. Main, Ste. 23 (Across from Ransom Memorial)
GO HAWKS! Full-line vending services for Kansas since 1947
841-8329
2012 Introductory Offers!* Family Golf Membership
Only $199/mo. Family Social Membership
We’ve Got Lawrence Covered!
Apartments, Townhomes, Duplexes, and Houses. Locations near campus & around Lawrence.
Only $99/mo. Golf, Pool, Tennis & Clubhouse All in One Location! No Contracts to Sign.
9 LOCATIONS
785-843-4300
*Additional cost for initiation fee and monthly food minimum.
www2.ljworld.com/marketplace/businesses/cherry-hill-properties/ 400 Country Club Terrace | 785-218-5412
Now Open! Second Round
Third Round
Regional Semifinals
(1) Kentucky
Regional Finals
(16) First Round Winner
(8) Iowa State
Call 785-856-7862 4931 West 6th Street Lawrence, KS
(9) UConn
Louisville, KY March 15 & 17
(5) Wichita State
CHAMPIONS
(12) VCU
Portland, OR March 15 & 17
(4) Indiana
SOUTH
(13) New Mexico St.
Atlanta, GA Regional March 23 & 25
(6) UNLV (11) Colorado Albuquerque, NM March 15 & 17
(3) Baylor
New Orle Monday
(14) S. Dakota St. (7) Notre Dame (10) Xavier Greensboro, NC March 16 & 18
(2) Duke (15) Lehigh
SEMIFINALS
New Orleans, LA Saturday, March 31
(1) Michigan St. (16) LIU Brooklyn (8) Memphis
NATIO CHAM
Columbus, OH March 16 & 18
(9) St. Louis (5) New Mexico (12) Long Beach St.
Complete Care for your Lawn • Chemical Applications • Lawn Renovations • Mowing & Trimming • Snow Removal 785.841.8133
Portland, OR March 15 & 17
(4) Louisville
WEST
(13) Davidson
Phoenix, AZ Regional March 22 & 24
(6) Murray St. (11) Colorado St. Louisville, KY March 15 & 17
(3) Marquette (14) First Round Winner
GO HAWKS!
First R Dayton, OH M
(7) Florida (10) Virginia
Good Luck hawks!
SOUTH
Omaha, NE March 16 & 18
(2) Missouri
WEST
Mar. 13
(15) Norfolk St.
Miss. Valley St. Western Kentucky
Mar. 13
(16)
BYU Iona
from
(785) 749-7337 4821 W. 6th St. Lawrence, KS 66049
“Our customers can expect their cars to last longer, have fewer breakdowns and have a higher resale value. When you add up the factors, it just makes sense to take your car to Gateway Auto Service.”
841-5700
gatewayautoservice.net
534 Gateway Drive, Lawrence, Kansas
GOOD LUCK
‘HAWKS!
2329 Iowa Street Lawrence, Kansas 785-832-0501
Carpet gone to the dogs? Call us before or after your next party to remove the toughest spots & odors. We pay attention to every detail & your satisfaction is guaranteed.
We also clean tile & grout
785-841-8666
®
Any 2 Rooms Cleaned
68
$
Valid in Douglas County or Shawnee County. Expires 4/30/12 Lawrence | 785-749-0462 Since 1982
(14)
Go ‘Hawks!
a name you can trust — a deal you can’t beat
John Kirby Insurance
LAIRD NOLLER AUTOMOTIVE
Good Luck in the tournament! Call Today!
785-842-0094
Jayhawk Guttering A Division of Nieder Contracting, Inc. FREE ESTIMATES
Regional Finals
Offers Service & Quality as Rare as This.
doing business in Lawrence for
years
“BY THE RIVER” (NORMAN MAPP)
“WILT THE STILT” CHAMBERLAIN G-627
5200 Bob Billings Parkway • Lawrence , KS • 785-842-6702
Regional Semifinals
Third Round
23rd 23 d & Al Alabama b • Lawrence L • 843-3500 • 1-800-281-1105
2829 Iowa • Lawrence 838-2327
Second Round Syracuse (1) NC Asheville (16)
Pittsburgh, PA March 15 & 17
Kansas St. (8) Southern Mississippi (9) Vanderbilt (5)
SHIP GAME
eans, LA y, April 2
EAST
Boston, MA Regional March 22 & 24
Albuquerque, NM March 15 & 17
Harvard (12) Wisconsin (4) Montana (13) Cincinnati (6) Texas (11)
Nashville, TN March 16 & 18
¡ Vive La Hawks!
¡Game Day Special!
Florida St. (3) St. Bonaventure (14) Gonzaga (7)
Pittsburgh, PA March 15 & 17
All Day When KU Plays
Ohio St. (2)
Taco Special
Loyola (MD) (15)
SEMIFINALS
New Orleans, LA Saturday, March 31
ONAL MPION
West Virginia (10)
North Carolina (1) Greensboro, NC March 16 & 18
99¢ each
Crispy or Soft Shell. No Limit. Coupon Exp. 4/14/12.
First Round Winner (16) Creighton (8) Alabama (9)
Lawrence 2706 Iowa Ste. F 785-331-3607
Temple (5) First Round Winner (12)
MIDWEST St Louis, MO Regional March 23 & 25
Nashville, TN March 16 & 18
Michigan (4) San Diego St. (6)
Columbus, OH March 16 & 18
Georgetown (3)
Lamar
(16)
Vermont
St. Mary’s (7)
MIDWEST Mar. 14
California South Florida
(12)
Formerly
NC State (11)
Round March 13 & 14 Mar. 14
Oskaloosa 92 & 59 Hwy 785-863-2261
Ohio (13)
Belmont (14)
MIDWEST
New location April 1st
Purdue (10) Omaha, NE March 16 & 18
Kansas (2)
We Have Grown So Much, We Changed Our Name.
Detroit (15)
Good Luck Hawks! Behind epot! Office D
D&D Tire, Inc. Mobile phones • Tablets •iPods • Game Systems (785) 424-5960 •
10th & Vermont 785-843-0191
Mon. - Fri. 8:00 am - 5:30 pm Sat 8:00 am - 12:00 pm
OPINION
LAWRENCE JOURNAL-WORLD !"LJWorld.com !"Monday, March 12, 2012
8A
EDITORIALS
Meth battle State lawmakers should look again at making a drug essential to methamphetamine production even harder to buy.
Acontainingincome customers. Those are legitimate concerns, but according to officials in southeast Kansas, they pale by comparison to the social and economic toll meth takes on cashstrapped communities. They point to Oregon, one of only two states that has made pseudoephedrine prescriptiononly.
Pressure tactics could work in Iran WASHINGTON —. President Obama’s pledge of escalating economic, political and other pressure on Iran goes to that regime’s weak link. For the mullahs’ greatest vulnerability is their
David Ignatius
davidignatius@washpost.com
“
Now that the squeeze on Iran has begun, there’s a potential risk if it stops too quickly, leaving a damaged but still potent Iran seething for vengeance.”
PUBLIC FORUM
Family planning To the editor: When Craig Tucker writes in his March 4 letter that every Catholic he knows practices birth control, was he referring to natural family planning or the use of contraceptive devices? Clarification would have been good. I would hope sincere, practicing Catholics would not have chosen the latter. Donna M. Krische, Lawrence
Another option To? E. Kent Hayes, Lawrence
Children are publicly embarrassed by this. We silence children as they develop a tendency to not ask questions when this information is fed to them in public classrooms. There is a positive solution. Parents frequently are perceived as “not intelligent” by young people, especially during their teenage years, only later to find out that their parents were smarter than they thought when they were younger. Public schools listened to teenagers, perhaps ignoring parents’ better judgment. It is only later that we’re finding out that parents may have been correct about their children from the start. Parents don’t need public classrooms presenting information about anatomy and sexual development to their young children. It seems parents have been perceived as not capable of handling this sensitive information with their children. Schools balked on a golden opportunity to involve parents in their children’s education. Involving parents would be the natural solution. It has been a lament that parents are not involved in their children’s education. If schools (and now social welfare agencies) were concerned that parents become more involved in the lives of their children, we’ve missed a golden opportunity. Instead of presenting this sensitive information to a classroom of young children, perhaps parents would meet for helpful advice on talking with their children about sexual development. Next thing you’re going to tell me is that parents would never meet together in a pubTo the editor: lic room to talk about sexual I recently stated it is inapdevelopment and such sensipropriate to present young tive information. children information about anatomy and sexual developJulie Steward, ment in public classrooms. Lawrence tive mandate as an attack on religious freedom, particularly the Catholic Church. Nonsense. His position conveniently ignores several salient facts: Studies have shown that no less than 98 percent of Catholics have used contraception. Like most employers, the archdiocese pays a portion of the health insurance coverage for employees; the employee pays the rest. Is it fair to say that contraception care is paid for by the employee who uses it (and has a co-pay) and not the church? At least 26 states already have laws that require insurance companies to provide coverage for contraception, including such dark red states as Georgia, Texas and Virginia. Georgia’s law is among several that do not allow for an employer or employee to opt out of paying for the coverage for religious or moral reasons. The Georgia law was passed over 20 years ago by a Republican legislature and signed by a Republican governor. Catholic institutions in the state have been adhering to the law without a peep. Is it fair to say that the outrage now is a political ploy? And finally, my favorite, insurance plans universally pay for Viagra. Men can play, but women can’t? It is clear this latest tempest in a teapot is just another political attack meant to rally the troops of the conservatives against the president’s administration. Doug Burger, Lawrence
A political ploy Involve parents To the editor: I wish to respond to Scott Burkhart’s letter of March 7. Mr. Burkhart gives voice to the latest culture war salvo of the Republican Party, decrying the proposed contracep-
Iran has begun, there’s a potential risk if it stops too quickly, leaving a damaged but still potent Iran seething for vengeance. That early termination could happen through a quick U.N. ceasefire. — David Ignatius is a columnist for Washington Post Writers Group.
OLD HOME TOWN
25
Girl Scouts from Lawrence and Perry had gathered at South Park on a YEARS recent afternoon AGO to celebrate the IN 1987 75th anniversary of the organization. A balloon release had been part of the festivities. Kansas University basketball fans were gathering in Atlanta for the first-round NCAA tournament game against the University of Houston. Meanwhile, up on campus, KU’s University Council had voted that student-athletes would continue to be able to enroll before other students so that they could fit their class schedules around practice times.
100
From the Lawrence Daily Journal-World for March 12, 1912: YEARS “The Union PacifAGO ic is again without IN 1912.” — non-exclusive.
L AWRENCE J OURNAL -WORLD NON SEQUITUR
HI AND LOIS
BEETLE BAILEY
GARFIELD
PEARLS BEFORE SWINE
SHERMAN’S LAGOON
WILEY
PLUGGERS
COMICS FAMILY CIRCUS
GARY BROOKINS
GREG BROWNE/CHANCE WALKER
MORT, GREG & BRIAN WALKER
JIM DAVIS
STEPHAN PASTIS
PICKLES
BORN LOSER
PEANUTS
SHOE
HAGAR THE HORRIBLE
DOONESBURY
| .
Monday, Thur March 12, 2012 9A OFF THE MARK MARK PARISI
BRIAN CRANE
CHIP SANSOM/ART SANSOM
CHARLES M. SCHULZ
JEFF MACNELLY
J.P. TOOMEY ZITS
BLONDIE
BIL KEANE
DEAN YOUNG/JOHN MARSHALL
CHRIS BROWNE
GARRY TRUDEAU
MUTTS
BABY BLUES
GET FUZZY
JERRY SCOTT & JIM BORGMAN
PATRICK MCDONNELL
JERRY SCOTT/RICK KIRKMAN
DARBY CONLEY
|
10A
TODAY
WEATHER
.
Monday, March 12, 2012
TUESDAY
WEDNESDAY
DATEBOOK
FRIDAY
THURSDAY
12 TODAY
Partly sunny and warmer
Mostly sunny and very warm
Mostly cloudy, a shower possible
Very warm with partial sunshine
A thunderstorm possible
High 75° Low 42° POP: 5%
High 78° Low 55° POP: 5%
High 81° Low 54° POP: 30%
High 79° Low 53° POP: 25%
High 77° Low 52° POP: 30%
Wind SW 8-16 mph
Wind SSE 7-14 mph
Wind SSW 12-25 mph
Wind SSW 8-16 mph
Wind S 12-25 mph
POP: Probability of Precipitation
McCook 78/35
Kearney 73/40
Oberlin 76/36
Clarinda 72/41
Lincoln 71/40
Grand Island 72/42
Beatrice 70/42
Concordia 75/44
Women’s Entrepreneur Group, 9 a.m., Lawrence Public Library, 707 Vt. Town Hall Forum with EPA Administrator Lisa Jackson, 2 p.m., Spooner Hall, 1340 Jayhawk Blvd. Lawrence Board of Education meeting, 7 p.m., school district headquarters, 110 McDonald Drive. Eudora City Council meeting, 7 p.m., Eudora City Hall, 4 E. Seventh St. Faculty Recital Series: Margaret Marco, oboe, 7:30 p.m., Swarthout Recital Hall, Murphy Hall, 1530 Naismith Drive. Dollar Bowling, 9:30 p.m., Royal Crest Lanes, 933 Iowa.
Centerville 70/44
St. Joseph 74/42 Chillicothe 72/45
Sabetha 71/44
Kansas City Marshall Manhattan 73/49 73/46 Goodland Salina 78/38 Oakley Kansas City Topeka 73/34 78/43 73/39 76/42 Lawrence 74/48 Sedalia 75/42 Emporia Great Bend 74/49 76/45 74/41 Nevada Dodge City Chanute 74/48 74/39 Hutchinson 75/48 Garden City 79/40 74/37 Springfield Wichita Pratt Liberal Coffeyville Joplin 76/51 75/43 75/42 73/36 76/52 77/48 Hays Russell 74/39 75/42
13 TUESDAY
Shown is today’s weather. Temperatures are today’s highs and tonight’s lows.
51°/45° 54°/30° 86° in 1916 -7° in 1998
Precipitation in inches 24 hours through 8 p.m. yest. Month to date Normal month to date Year to date Normal year to date
0.42 0.85 0.78 3.93 3.17
NATIONAL FORECAST
SUN & MOON Sunrise Sunset Moonrise Moonset Last
Today Tue. 7:36 a.m. 7:35 a.m. 7:25 p.m. 7:26 p.m. none 12:57 a.m. 10:03 a.m. 10:53 a.m.
New
First
Full
Seattle 46/35 Minneapolis 58/36
Billings 57/39 San Francisco 59/51
Denver 71/37
Los Angeles 64/52
Mar 14 Mar 22 Mar 30
Apr 6
LAKE LEVELS
As of 7 a.m. Sunday Lake
Clinton Perry Pomona
Level (ft)
874.34 891.10 974.07
Discharge (cfs)
7 100
Shown are today’s noon positions of weather systems and precipitation. Temperature bands are highs for today. 88 74 s 54 39 pc 50 44 r 74 61 pc 95 79 t 48 28 s 52 38 r 54 42 c 81 68 t 77 58 s 43 30 c 56 43 pc 59 36 s 62 59 r 64 49 pc 41 25 sn 61 43 s 70 40 s 74 47 t 54 36 s 35 29 sn 84 59 s 52 35 s 61 43 pc 88 76 t 63 46 s 41 25 s 88 77 t 52 42 c 77 61 sh 52 39 pc 58 48 r 45 37 r 52 43 r 43 32 c 42 28 r
Hi 88 52 46 80 97 55 52 55 78 74 49 57 65 66 64 50 63 71 76 50 35 84 52 62 90 64 43 86 50 81 52 65 43 54 45 52
Tue. Lo W 75 s 40 c 41 sh 57 pc 79 pc 36 s 39 c 42 pc 62 s 52 s 24 c 43 pc 37 s 64 r 45 s 28 pc 43 pc 38 s 48 sh 37 r 24 sn 54 s 31 s 44 s 74 t 43 s 27 s 77 t 28 pc 61 pc 37 pc 39 pc 41 sh 43 c 32 c 42 s
New York 67/51
Chicago 68/44
Washington 68/51
Kansas City 74/48 Atlanta 68/55
El Paso 70/43
Houston 80/66 Miami 80/68
Fronts Cold
Forecasts and graphics provided by AccuWeather, Inc. ©2012
Detroit 61/46
Precipitation
Warm Stationary Showers T-storms
Rain
Flurries
Snow
Ice
-10s -0s 0s 10s 20s 30s 40s 50s 60s 70s 80s 90s 100s 110s National Summary: Warm weather will linger across the East today while rain moves into the Great Lakes. Thunderstorms will rumble from the Ohio Valley to the Gulf Coast. The Pacific Northwest will remain stormy. Today Tue. Today Tue. Cities Hi Lo W Hi Lo W Cities Hi Lo W Hi Lo W Memphis 77 62 t 79 63 pc Albuquerque 63 39 s 66 41 s 80 68 pc 80 68 pc Anchorage 22 12 s 27 18 pc Miami 63 41 t 60 46 s Atlanta 68 55 c 74 58 pc Milwaukee 58 36 r 63 48 s Austin 81 60 pc 78 64 pc Minneapolis 72 60 t 78 58 pc Baltimore 68 50 s 76 48 pc Nashville New Orleans 79 64 t 78 63 t Birmingham 72 61 c 77 60 t 67 51 s 70 50 pc Boise 56 45 c 64 44 sh New York 69 43 pc 75 49 s Boston 64 45 s 66 48 pc Omaha 80 60 s 82 60 s Buffalo 58 47 r 62 37 pc Orlando Philadelphia 68 50 s 73 51 pc Cheyenne 61 34 pc 65 37 s Phoenix 79 54 s 81 54 s Chicago 68 44 pc 65 50 s 62 52 r 71 44 pc Cincinnati 65 57 t 73 52 pc Pittsburgh Cleveland 61 49 r 62 43 pc Portland, ME 55 37 s 58 39 c Dallas 82 62 s 78 62 pc Portland, OR 53 38 r 47 39 sh Reno 57 40 c 61 43 c Denver 71 37 s 73 40 s Richmond 70 51 pc 77 53 pc Des Moines 67 46 pc 73 52 s 61 50 c 62 52 r Detroit 61 46 r 67 43 pc Sacramento St. Louis 78 54 pc 76 58 s El Paso 70 43 s 76 47 s Fairbanks 2 -19 s 7 -16 pc Salt Lake City 61 37 pc 65 41 pc 60 52 r 63 54 pc Honolulu 80 68 sh 81 65 pc San Diego Houston 80 66 pc 78 66 pc San Francisco 59 51 c 61 50 r 46 35 r 43 31 sh Indianapolis 69 55 t 71 56 pc Seattle Spokane 43 35 sn 44 28 sh Kansas City 74 48 pc 79 58 s 79 47 s 79 48 s Las Vegas 72 52 pc 72 54 pc Tucson 82 51 pc 81 60 s Little Rock 78 57 pc 81 59 pc Tulsa 68 51 s 77 54 pc Los Angeles 64 52 r 66 53 pc Wash., DC National extremes yesterday for the 48 contiguous states High: Punta Gorda, FL 87° Low: West Yellowstone, MT -3°
WEATHER HISTORY The famed “Blizzard of 1888” peaked on March 12. The mammoth storm dumped over 4 feet of snow on parts of New England.
WEATHER TRIVIA™
Q:
What was the greatest reported snowfall from the Blizzard of 1888?
58 inches at Saratoga, N.Y.
Temperature High/low Normal high/low today Record high today Record low today
REGIONAL CITIES
Today Tue. Today Tue. Cities Hi Lo W Hi Lo W Cities Hi Lo W Hi Lo W Independence 77 48 pc 82 58 s Atchison 74 42 pc 79 55 s Fort Riley 78 40 s 81 52 s Belton 72 49 pc 76 58 s Olathe 72 48 pc 76 57 s Burlington 76 46 pc 81 56 s Osage Beach 78 47 pc 80 56 s Coffeyville 77 48 pc 82 58 s Osage City 75 44 pc 81 56 s Concordia 75 44 s 74 49 s Ottawa 74 45 pc 78 56 s Dodge City 74 39 s 80 44 s Wichita 75 43 s 79 55 s Holton 76 42 pc 80 56 s Weather (W): s-sunny, pc-partly cloudy, c-cloudy, sh-showers, t-thunderstorms, r-rain, sf-snow flurries, sn-snow, i-ice.
A:
LAWRENCE ALMANAC
Through 8 p.m. Sunday.
L AWRENCE J OURNAL -W ORLD
FRIENDS & NEIGHBORS
Red Dog’s Dog Days winter workout, 6 a.m., Allen Fieldhouse, enter through the south doors and meet on the southeast corner of the second floor. Intro to Microsoft Word, 10 a.m., Lawrence Public Library, 707 Vt. Advocacy 101: What Can Nonprofits Do?, 11:45 a.m., Lawrence Public Library, 707 Vt. Dole Institute Study Group: “Presidential Play-By-Play” with Dole Fellow Tom King, 4 p.m., Dole Institute of Politics, 2350 Petefish Drive. Big Brothers Big Sisters of Douglas County, 5:15 p.m., 536 Fireside Court, Suite B. Information meeting for prospective volunteers. For more information, call 843-7359.. Choosing Investments Wisely and Practicing Good Habits, 7 p.m., Lawrence Public Library, 707 Vt. An Evening With Susan Stamberg, NPR correspondent, 7-8:30 p.m., Lied Center, 1600 Stewart Drive. Herbs study group, 7 p.m., Unitarian Fellowship, 1263 N. 1100 Road. Visiting Artist Series: Jim Gourlay, tuba, 7:30 p.m., Swarthout Recital Hall, Murphy Hall, 1530 Naismith Drive. Tuesday Concert presents Daryl Nickel, 7:30 p.m., Lawrence Arts Center, 940 N.H. Free swing dancing lessons, 9 p.m.-midnight, 746 Mass. Tuesday Night Karaoke, 9 p.m., Wayne & Larry’s Sports Bar & Grill, 933 Iowa.
THIS WEEK’S BEST BETS Spend an evening with NPR correspondent Susan Stamberg on Tuesday at the Lied Center. Celebrate your inner math nerd on Pi Day, 3/14, with a gala at Theatre Lawrence on Wednesday. The annual Lawrence Arts Center art auction exhibit opens Friday, and end the week celebrating St. Patrick’s Day with the parade downtown and plenty of other activities. Oh yes, March Madness begins in earnest this week with the opening of the NCAA Tournament! cal Campus Ministries, 1204 Oread Ave. Big Brothers Big Sisters of Douglas County, noon, 536 Fireside Court, Suite B. Information meeting for prospective volunteers. For more information, call 843-7359. Dole Institute Study Group: “Put Your Money Where Your Vote Is” with Dole Fellows Elizabeth Conatser and Lisa Spies, 4 p.m., Dole Institute of Politics, 2350 Petefish Drive. Country Jam hosted by Good Ole Boys, 6-8:30 p.m., Cutter’s Smokehouse, 218 E. 20th St., Eudora. Douglas County Commission meeting, 6:35 p.m., Douglas County Courthouse, 1100 Mass. Pi Day Festival hosted by Alferd Packer Memorial String Band, 7 p.m., Theatre Lawrence, 1501 N.H. SFJAZZ Collective, 7:30 p.m., Lied Center, 1600 Stewart Drive. “Religion for Atheists,” 7:30 p.m., The Commons, Spooner Hall, 1340 Jayhawk Blvd. Conroy’s Trivia, 7:30 p.m., Conroy’s Pub, 3115 W. Sixth St. Free salsa lessons, 8:30-9:30 p.m., Taste Lounge, 804 W. 24th St. Pride Night, 9 p.m., Wilde’s Chateau, 2412 Iowa. Dollar Bowling, 9:30 p.m., Royal Crest Lanes, 933 Iowa.
Series: A Military History of the Cold War, 3 p.m., Dole Institute of Politics, 2350 Petefish Drive. Theology on Tap, discussion of a selected religion topic, 5:30 p.m. to 7 p.m., Henry’s, 11 E. Eighth St. Sons of the Union Veterans, 6:30 p.m., Watkins Community Museum of History, 1047 Mass. Free English as a Second Language class, 7-8 p.m., Plymouth Congregational Church, 925 Vt. Affordable community Spanish class, 7-8 p.m., Plymouth Congregational Church, 925 Vt. Junkyard Jazz Band, 7 p.m., American Legion, 3408 W. Sixth St. Galactic, Corey Glover, Corey Henry, Orgone, 7 p.m., Liberty Hall, 644 Mass. Poker Night, 8 p.m., Applebee’s, 2520 Iowa. Team trivia, 9 p.m., Johnny’s West, 721 Wakarusa Drive.
16 FRIDAY
School’s Out, Theatre’s In: Flash Rally, for grades 6 and up, 9 a.m.-4 p.m., Theatre Lawrence, 1501 N.H. KU School of Music presents Imani Winds “Informance,” 9-10:30 a.m., Swarthout Recital Hall, Murphy Hall, 1530 Naismith Drive. Ecumenical Lenten Taize Service, 6 p.m., Trinity Episcopal Church, 1011 Vt. Opening: Lawrence Arts Center Benefit Art Auction Exhibit, featured artist Hong Chun Zhang, 7 p.m., Lawrence Arts Center, 940 N.H. Free Community Yoga Class, 7:30-8:45 p.m., Breathe Holistic Life Center, 1407 Mass. Hit or Miss, 8 p.m., Cutter’s Smokehouse & Catering, 218 E. 20th, Eudora.
17 SATURDAY
Red Dog’s Dog Days, 7:30 a.m., parking lot behind Kizer-Cummings Jewelry, Ninth and Vermont streets. Lawrence St. Patrick’s Day Parade, 1 p.m., downtown. English Country Dance, 1-4 p.m., Unitarian Fellowship of Lawrence, 1263 North 1100 Road. Ragtime Piano Rehearsal / Jam Session, Red Dog’s Dog Days 2-4 p.m., Watkins Community Museum of History, winter workout, 6 a.m., 1047 Mass. Allen Fieldhouse, enter Americana Music through the south doors and meet on the southeast Academy Saturday Jam, corner of the second floor. 3 p.m., Americana Music Academy, 1419 Mass. School’s Out, TheSuper Smash Bros. atre’s In: Flash Rally, for grades 6 and up, 9 a.m.-4 Brawl Tournament, 3 p.m., Lawrence Public p.m., Theatre Lawrence, Library, 707 Vt. 1501 N.H. Intro to Microsoft Outlaw Jake and the Word, 10 a.m., Lawrence Chain Gang, after the St. Public Library, 707 Vt. Patrick’s Day Parade, 4 “Thinking Outside the p.m., 913 N. Second St. Video Jerry, 5 p.m., Box” presentation by Slow Ride Roadhouse, Imani Winds, 10 a.m., Swarthout Recital Hall, 1350 N. Third St. Murphy Hall, 1530 NaiBRC Sounds St. smith Drive. Patty’s Day Show, 7 p.m., “Living Architecture: A Ingredient, 947 Mass. 940 Live: Hospital Conversation with Alain Ships with Heartscape de Botton,” 10-11:30 a.m., Woodruff Auditorium, Landbreak, 7:30 p.m., Lawrence Arts Center, 940 Kansas Union, 1301 JayN.H. hawk Blvd. Community Contra Adzel master class Dance, 7:30 p.m., Woodopen to public, clarinet lawn School, 508 Elm St. duo of Imani Winds, 1 University-Community p.m., Murphy Hall Room Jeff Furst Irish Music, 7 Forum, “The Privacy 118, 1530 Naismith Drive. p.m., Cutter’s Smokehouse, Paradox,” noon, Ecumeni218 E. 20th, Eudora. The Leavenworth
15 THURSDAY
14 WEDNESDAY
DILBERT, Cooper and Kristi Keefer along with preschool director Jennifer Allen.
LAWRENCE ORIGINALS Fresh batch of great restaurant deals available TODAY!
Save
30%
This Print advertisement is not redeemable for advertised deal. Get your deals voucher online at Lawrencedeals.com
by Scott Adams
TOURNAMENT MAYHEM • PAGE 4B OPPOSITE ENDS
Vanderbilt’s Kevin Stallings, left, was the upsetter, while Carolina’s Roy Williams, right, the upsettee Sunday.
SPORTS
B
LAWRENCE JOURNAL-WORLD !"LJWorld.com/sports !"Monday, March 12, 2012
It takes two KANSAS BASKETBALL
Tom Keegan tkeegan@ljworld.com
Uh-oh, Sully: Detroit it isleaguename-cellphone
Nick Krug/Journal-World Photo
KANSAS GUARD TYSHAWN TAYLOR, RIGHT, SMILES AS TEAMMATE CONNER TEAHAN RESPONDS TO A QUESTION about superstitions during a news conference following the NCAA selection show. The Jayhawks, who claimed the No. 2 seed in the Midwest Regional, will face 15-seed Detroit on Friday in Omaha, Neb.
Kansas draws Detroit in Omaha, Neb. By Gary Bedore gbedore@ljworld.com
Kansas University basketball coach Bill Self on Sunday told his players to not expect a No. 1 seed in the 2012 NCAA Tournament. “We blew that by not performing better in Kansas City,” Self said of his prebarbecue dinner message to the Jayhawks (27-6). follow-
ing
GOIN’ DANCIN’
Who: No. 2 Kansas (27-6) vs. No. 15 Detroit (22-13) When: 8:57 p.m. Friday Where: Omaha, Neb. TV: truTV (cable ch. Please see KANSAS, page 3B 48, 248)
Top Titan familiar with KU ————
Jayhawks among big-name schools that wooed McCallum By Matt Tait mtait@ljworld.com
Throughout the years, very few opposing coaches who faced Kansas University in the NCAA Tournament have gotten the kind of look at KU’s program that University of Detroit Mercy coach Ray McCallum received a little more than two years ago. McCallum, now in his fourth season at Detroit, which will face KU at 8:57 p.m. Friday in a secondround NCAA Tournament game in Omaha, Neb., found himself locked in a unique recruiting battle for one of the top guards in the country. On one side were perennial powers such as Kansas,
Florida and UCLA. On the other was McCallum and his rebuilding Horizon League program. The object of their affection was a young man named Ray McCallum Jr., the Detroit head coach’s son, and because of that, McCallum operated as part-father and part-recruiter throughout his son’s final year of high school. Some nights that meant in-home visits and quaint conversations with big-time head coaches like Bill Self, Billy Donovan and Ben Howland. Other nights, that meant trying to knock the stars out of his son’s eyes while selling the hometown Titans. “He had a visit out there that he’ll never forget,” said McCallum by telephone, re-
calling his son’s recruiting trip to KU. “He actually mentioned that the other day. He went out for (Late Night), and they got their (2008) national championship rings that night, and I know that made a big-time impression on him.” As the recruitment unfolded and the other schools began to fill their rosters, the 6-foot-2 McDonald’s AllAmerican began to warm to the idea of playing for his father. “He wanted to look at the very best programs, and I know he was flattered that KU looked at him,” McCallum said. “I think it was important that he go through
Joe Raymond/AP Photo
DETROIT GUARD RAY MCCALLUM DRIVES AGAINST VALPARAISO in their game Tuesday in South Bend, Ind. McCallum was recruited by Kansas University, the team Detroit will face in the NCAA Please see DETROIT, page 3B Tournament on Friday.
Kansas women will learn fate tonight WOMEN TAKE STAGE
By Matt Tait mtait@ljworld.com
It seems clear that the cases for and against Kansas What: NCAA University’s women’s baswomen’s ketball team being included selection in the NCAA Tournament show field are pretty equal. When: 6 “I think we’ve shown that tonight if you look at the talent and depth of this league, get us TV: ESPN (cable chan- all out of here and put us in Please see KEEGAN, page 3B nels 33, 233) the tournament and we’ll all
win,” KU coach Bonnie Henrickson said. “If you put us in the NCAA Tournament, we’ll all win games. There’s no doubt about that.” The Jayhawks, who lost to No. 3 seed Texas A&M in the quarterfinals of the Big 12 tournament on Thursday in Kansas City, Mo., finished the regular season in sixth place in the 10-team Big 12. KU, Texas and Oklahoma State each piled up 8-10
league records, but the Jayhawks won the tiebreaker because they beat UT and OSU three of the four times they played them. “We earned a sixth seed,” she said. “It wasn’t a coin flip. In the tiebreaker, we won the pool.” The principle strengths of KU’s argument go like this: five league road wins, a quality victory at Oklahoma on the final day of the regular
season and a sixth-place finish in the conference. The argument against Kansas is made up of: a 4-10 record to close the season, late home losses to Missouri and Oklahoma State and no Carolyn Davis, who was injured in mid-February and watched her team go 2-6 without her. All of the debate and waiting will come to a close tonight, when the women’s bracket is revealed at 6 p.m.
Sports 2
2B | LAWRENCE JOURNAL-WORLD | MONDAY, MARCH 12, 2012
COMING TUESDAY s -ORE ON +5 IN THE .#!! MENS BASKETBALL TOURNAMENT s .#!! WOMENS BASKETBALL TOURNAMENT SELECTIONS
47/ $!9 30/243 #!,%.$!2
(!3+%,, TODAY • Softball vs. Crowley’s Ridge College, 2 p.m. TUESDAY • Softball vs. Sterling College, 2 p.m.
Stewart’s gamble pays in Vegas LAS VEGAS (AP) —. “We had to wait 365 days for a shot at it again,� Stewart said. “I
might not have been so mad on the airplane had I known I was going to win a year later.�.
“It’s been a long time since I’ve seen a car that fast,� said Biffle, who finished third. “On the restarts, I’ve just never seen a car driving off like that.�
COMMENTARY
Momentum overrated in NCAAs By Chris Dufresne Los Angeles Times
Here’s to the big-time basketball teams that geared up for runs to this year’s NCAA championship by spitting up bits but not seeds. Congratulations to Final Four favorites Kentucky, Kansas, North Carolina, Duke and Syracuse for bowing out with finalweekend defeats for the greater good of bluegrass, rock-chalk, tobacco-road and lake-effect snow. Thank goodness the NCAA selection committee, at least in the cases of Kentucky and Syracuse, had already made up its collective mind. Kentucky coach John Calipari couldn’t have been more pleased with his team’s odorous Sunday performance against Vanderbilt in the Southeastern Conference tournament finals. Calipari happily handed Vanderbilt its first SEC title since 1951 and shed not one tear over his team losing its first game since Dec. 10. Kentucky, despite failing to score a basket in the final eight minutes of the SEC finals, still earned the top overall NCAA seeding. There has to be something wrong with this, right? Not in college basketball, actually, where the regular season is also known as the long, pregnant pause. Calipari thought too much winning was starting to push his team over swagger’s edge to valley floor of arrogance. Washington wasted its precious time winning the regularseason Pac-12 title and not making the NCAA tournament, while Western Kentucky lost all year in the Sun Belt but secured the league’s automatic bid in the conference tournament. Long Beach State went out and played, arguably, the toughest nonconference schedule in the history of college basketball, yet probably had to win the same Big West tournament UC Irvine (12-20) came two victories from winning. You almost had to wonder what Michigan State was thinking as it closed out Ohio State on Sunday to win the Big Ten Conference tournament. What NCAA team wants to go into the tournament with momentum? Tom Izzo’s Spartans must have got all gooey and sentimental reminiscing about 2000, the year they rode a Big Ten tournament win all the way to the NCAA championship. OK, actually, Michigan State and Ohio State were probably playing for the last top seeding. “We debated it all the way through the game,� Jeff Hathaway, the chair of this year’s NCAA selection committee, told CBS. Sunday’s bracket release was an annual reminder that the NCAA Tournament is the most fabulous three-week love-fest in sports but should never be confused with a playoff. The tournament should come with a disclaimer: “Much more fun than it is fair.�
was his sixth win in the past 13 Sprint Cup races and first on the 1.5-mile tri-oval not far from the bright lights of the The Strip. “We almost got too good a restart because I got such a good run on Brad, I almost got there too quick,� Stewart said..
GOLF RIO GRANDE, PUERTO RICO —.
Net
Cable
NCAA selection
6 p.m. ESPN 33, 233
Pro Basketball
Time
Net
Cable
New York v. Chicago 7 p.m. ESPN 33, 233 Boston v. L.A. Clippers 9:30p.m. ESPN 33, 233 Baseball
Time
Florida v. Boston Arizona v. Cleveland
12:30p.m. ESPN 33, 233 4 p.m. MLB 155,242
Soccer
Time
Net
Net
Cable
Cable
Arsenal v. Newcastle 2:55p.m. ESPN2 34, 234 Portland v. Philadelphia 8:30p.m. ESPN2 34, 234
Time
Net
NCAA: MVSU v. W. Ky. 5:30 p.m. TruTV NIT: Miss. St. v. UMass 6 p.m. ESPN2 NIT: Dayton v. Iowa 6:30 p.m. ESPN NIT: Tenn. v. Savannah St. 7 p.m. ESPNU NCAA: BYU v. Iona 8 p.m. TruTV NIT: N’western v. Akron 8 p.m. ESPN2 NIT: Oregon v. LSU 8:30p.m. ESPN NIT: Wash. v. Tex-Arling. 9 p.m. ESPNU NIT: Stanford v. Cle. St. 10 p.m. ESPN2 Baseball
Time
Cable 48, 248 34, 234 33, 233 35, 235 48, 248 34, 234 33, 233 35, 235 34, 234
Net
Cable
St. Louis v. N.Y. Mets noon Boston v. N.Y. Yankees 6 p.m.
MLB MLB
155,242 155,242
Pro Hockey
Net
Cable
Time
Carolina v. N.Y. Rangers 6:30 p.m. NBCSN 38, 238 College Baseball
Time
Net
Cable
Tenn. Tech v. Tenn.
6 p.m.
FCSA
144
College Softball
Time
Net
Texas v. Hawaii
11 p.m. FCSP
Soccer
Time
Net
Bayern Munich v. Basel 2:30p.m. FSN
Cable 146 Cable 36, 236
,!4%34 ,).% Lynne Sladky/AP Photo
JUSTIN ROSE CELEBRATES ON THE 18TH GREEN during the final round of the Cadillac Championship. Rose fired a 2-under 70 on Sunday at Doral, Fla., and won by one stroke over Bubba Watson.
NFL
Moss to work out for 49ers SAN FRANCISCO —’t. The 35-year-old Moss, who worked out last Tuesday with the New Orleans Saints, played for New England, Minnesota and Tennessee in a rocky 2010 season.
Hosmer homers in Royals’ loss to A’s PHOENIX (AP) —’s 10-8 victory over the Kansas City Royals on Sunday. “I thought he had some decent at-bats,� Oakland manager Bob Melvin said. “He didn’t have the results he had yesterday, but I think we can give him a break. We were probably all expecting him to get three more hits and hit a couple home runs, but he looks good up there. They threw him some good pitches.�’s, who signed him to a four-year, $36-million deal earlier this month. Cespedes, who was the designated hitter on Sunday, is scheduled to play next on Tuesday, when he’ll be back in center field. Kansas City’s Eric Hosmer drove in four runs, including two on his first homer of the spring.
Women’s basketball Time
College Basketball
Rose wins at Doral; injury shelves Woods
McNeill wins in Puerto Rico
TODAY
TUESDAY
| SPORTS WRAP |
DORAL, FLA. —’t enough, Tiger Woods muddied his Masters future when he left after 11 holes because of soreness in his left Achilles tendon, wincing badly on his final shot — at 16-under 272 for his 10th victory worldwide, moving him back into the top 10 of a world ranking that remains loaded with Europeans. Former Kansas University golfer Gary Woodland closed with a 72 and finished at 5-under 283, 11 strokes back.
30/243 /. 46
“It kind of gets the monkey off Athletics 10, Royals 8 your back a little bit,� Hosmer Kansas City ab r h bi Oakland ab r h bi cf 2 1 1 0 J.Weeks 2b 4 0 2 1 said. “It’s a good feeling getting L.Cain Maier ph-cf 2 0 2 3 Rosales 2b 1 1 0 0 that swing and building off it for Y.Betancourt 2b 4 1 2 0 Crisp cf 4 0 1 1 I.Falu 2b 0 0 0 0 Taylor rf 1 0 0 0 the rest of spring training.� Hosmer 1b 3 1 2 4 Cespedes dh 3 0 0 0 C.Robinson 1b 2 0 0 0 Fiorentino ph 0 1 0 0 Hosmer, who hadn’t homered dh 3 0 0 0 J.Gomes lf 3 2 1 0 in his first 17 spring training at- Butler M.Ramirez ph 1 0 0 0 Sogard ss 2 0 1 3 pr-dh 0 0 0 0 Donaldson 3b 5 0 2 0 bats, hit it off left-hander Tommy Golson Francoeur rf 3 0 0 0 S.Smith rf 3 1 1 1 Milone. Last year Hosmer hit .237 W.Myers rf 2 0 1 0 Moss lf 1 0 1 0 3b 3 0 0 0 Recker c 4 1 2 0 with only one of his 19 homers Moustakas Kouzmanoff 3b 2 0 0 0 D.Norris c 0 0 0 0 B.Pena c 3 1 1 0 Ka’aihue 1b 3 1 1 2 against left-handed pitchers. C.Clark c 0 1 0 0 C.Hunter pr 0 1 0 0 “This was a guy who keeps you D.Robinson lf 1 1 0 0 Carter 1b 0 0 0 0 lf 1 1 1 0 Pennington ss 2 2 1 0 off balance and changes speeds a Lough A.Escobar ss 3 1 1 1 G.Green cf 1 0 0 0 lot, so I was just focusing on taking T.Abreu ss 1 0 0 0 Totals 36 8 11 8 Totals 37 10 13 8 that ball to left-center,� said Hos- Kansas City 002 023 010— 8 001 510 03x—10 mer, who lifted his average to .316. Oakland E-Kouzmanoff (1). DP-Oakland 1. LOB“It was a changeup, and I stayed Kansas City 7, Oakland 7. 2B-Y.Betancourt (2), Hosmer (2), B.Pena (2), J.Weeks (2), on it.� (2), Sogard (3), Pennington (2). Milone, a leading candidate for J.Gomes 3B-Maier (1), S.Smith (1). HR-Hosmer (1), one of the three vacant spots in Ka’aihue (1). SB-L.Cain (1), D.Robinson (1), (1). S-Lough. the rotation, gave up just those C.Hunter (1). CS-Maier IP H R ER BB SO two runs in 3 2/3 innings. He’s al- Kansas City 3 2 1 1 0 1 lowed three earned runs in 8 2/3 B.Chen Montgomery 2/3 3 5 5 2 0 Adcock 1/3 4 1 1 0 0 innings this spring. Hottovy 1 1 0 0 0 1 “I feel good,� he said. “Since the Bueno 1 0 0 0 0 0 K.Herrera 1 2 0 0 0 first bullpen session, I’ve really Bl.Wood L,1-1 BS,1-1 1 1 3 0 2 22 had the command that I want. I’ve Oakland Milone 3 2/3 4 2 2 0 1 thrown strikes and kept the ball Norberto 1/3 0 0 0 0 0 R.Cook 1 1 2 2 2 1 low. I’ve felt more in season form Godfrey BS,1-1 2 5 4 4 1 0 now than in previous years. Usu- P.Figueroa W,1-0 1 1 0 0 0 0 De Los Santos S,1-1 1 0 0 0 2 2 ally it comes a little later.� WP-Montgomery, R.Cook, De Los Santos Royals starter Bruce Chen 2. Umpires-Home, Jim Wolf; First, Tim bounced back for a rough first McClelland; Second, Dale Scott; Third, Mike start to give up one run in three Everitt. A-4,840 (7,881). innings.
NBA Favorite .............Points (O/U) .......... Underdog a-NEW JERSEY ........No Line (XXX) .............. Milwaukee b-CHICAGO ...............No Line (XXX) ................ New York NEW ORLEANS ............ 6 1/2 (184).................... Charlotte SAN ANTONIO ............13 1/2 (205).............. Washington UTAH ..............................7 1/2 (191) ......................... Detroit PHOENIX ....................... 3 1/2 (198).................. Minnesota LA CLIPPERS ............... 5 1/2 (185)......................... Boston a-New Jersey guard D. Williams is doubtful. b-Chicago forward L. Deng is questionable. NHL Favorite ...................Goals................ Underdog Buffalo ................................1/2-1........................... Montreal COLORADO .....................Even-1/2 ...................... Anaheim San Jose ........................Even-1/2 .................. EDMONTON PHOENIX ..........................Pick’em ....................... Nashville ARENA FOOTBALL Favorite .............Points (O/U) .......... Underdog Week 1 GEORGIA ...........................5 (103) ...................... Cleveland SPOKANE ..........................7 (108) ................................. Iowa Home Team in CAPS (c) 2012 Tribune Media Services, Inc.
4(% 15/4% h4HE #OLTS CUTTING 0EYTON FEELS LIKE THE .ORTH 0OLE KICKING OUT 3ANTAv — Tennis player Andy Roddick, on the Indianapolis Colts’ releasing quarterback Peyton Manning
4/$!9 ). 30/243 1966 — Chicago’s Bobby Hull scores his 51st goal to become the first NHL player to score more than 50 goals in a season. 1970 — Austin Carr scores 52 points to lead Notre Dame in a 112-82 win over Kentucky in the regional semifinals of the NCAA men’s tournament. Dan Issel of Kentucky scores 44 points. 1985 — Larry Bird scores 60 points, including Boston’s last 16, to set a Celtics record and lead them to a 126-115 victory over Atlanta. Bird hit 22 of 36 field goals and 15 of 16 free throws en route to breaking Kevin McHale’s team record of 56 points established nine days before. 1994 — The Arkansas men’s track and field team wins its 11th straight NCAA Indoor Championship with a meet-record 94 points. The 54-point victory margin is the biggest in the meet’s 30-year history. 2002 — Siena (17-18) with an 81-77 victory over Alcorn State in the play-in game, becomes first team in 47 years to win an NCAA men’s basketball tournament game with a losing record. 2003 — Damian Costantino’s NCAA-record hitting streak ends at 60 games, one day after he broke Robin Ventura’s 16-year-old mark. Costantino, an outfielder for Division III Salve Regina of Newport, R.I., fails to get a hit in the first game of a doubleheader against BaldwinWallace. It’s the first time he finishes a game hitless since March 25, 2001.
ONLINE: LJWORLD.COM
THE PLACE FOR ALL THINGS JAYHAWK
REPORTING SCORES?
&ACEBOOKCOM,*7ORLD s 4WITTERCOM,*7ORLD
/. 4(% 7%": All the latest on Kansas University athletics
Call 832-6367, email sportsdesk@ljworld.com or fax 843-4512
LOCAL
L AWRENCE J OURNAL -W ORLD
HAPPY, CLAPPY
Monday, March 12, 2012
| 3B
Detroit CONTINUED FROM PAGE 1B
Jeff Jacobsen/KU Athletics Photo
JAYHAWKS, FROM LEFT, THOMAS ROBINSON, TYSHAWN TAYLOR, Jamari Traylor and Travis Releford clap after learning they had been awarded a No. 2 seed in the Midwest Region on Sunday at KU.
Kansas CONTINUED FROM PAGE 1B
for first- and secondround excited,, for-
merly.”
the process and visit with the very best schools that were interested in him. Once Kansas made their decision that they were set on their guards, I think the decision was easy. I really got to know the (Kansas) coaches through that recruiting process, and they do things right. Firstclass all the way. And it was good to be able to go through that with him.” It was even better to land him, because, in the two years since, McCallum Jr., has led the team in points, assists and steals and gone on to become a two-time all-Horizon League selection. He was named Newcomer of the Year following the 2010-11 season and a first-team selection this season, which he and his teammates capped by winning the Horizon League tournament last week. “He wanted to go to a place that he could play and make an impact and do what he’s accomplished here, and that’s led us to a conference championship and lead us to the NCAA Tournament,” McCallum said. “After our championship game, he said, ‘Hey, we did it. This is what we came here to do, and we did it.’” With phase one of the dream scenario now behind them, the father-son duo will shift its focus to the task of taking on the secondseeded Jayhawks (27-6). Although the process of putting together a game plan for Kansas had just begun, McCallum said he knew plenty about the Jayhawks long before learning his 15thseeded Titans (22-13) would face them Friday. “That’s the thing — every chance we get, we want to watch a Kansas play,” he said. “They’ve got good players, they’re well coached, and they’re fun to watch. They have the player of the year and another who may be a top-three team All-American. We have to contend with that, and we’re gonna have our hands full because they don’t need a play to make a play.” McCallum is certain of two things Friday. The first? McCallum believes his team will show up. “You look at our numbers, you look at the way we finished the (Horizon League) tournament and how competitive we’ve been against high-major teams … I expect for us to lace ’em up tight and go out and compete,” he said. The second? Win or lose Friday, McCallum said the 2011-12 season would go down as one he won’t forget.
Dawn Madura/AP Photo
COLORADO STATE’S DORIAN GREEN, RIGHT, AND PIERCE HORNUNG REACT to their draw to play Murray State in the NCAA Tournament during a news conference Sunday in Fort Collins, Colo.
LHS grad Green relishes berth By Matt Tait mtait@ljworld.com
For.”
Keegan
Robinson will be for the tourney opener. Holman took care of that Sunday night. “Robinson?” Holman CONTINUED FROM PAGE 1B said to the Detroit News. “I can handle Robinson. attend to personal matHe has to handle me.” ters. The school newspaSo much trash will spill out of the players’ mouths per, The Varsity News, in this one, extra ballboys then broke a story in will be needed to sweep which a frat boy said Holman broke his nose in the floor during every timeout. two places and chipped Nobody scares Thomas two of his teeth at a fraternity party. Those zany, Robinson. That’s not the point here. The point is, zany frat parties. Detroit’s not your average Without Holman, Detroit started the season No. 15 seed. The Titans 4-6. The Titans head into are playing so well now they crushed Horizon Kansas will face MU at the tournament on a 10-1 League regular-season 6 p.m. Friday, 2 p.m. Sat- run. Holman plays so champ and postseason urday at noon Sunday in much football when he tourney host Valparaiso plays basketball that he Columbia, Mo. tends toward foul trouble. by 20 points, the same team they lost to twice That explains why he Kansas 130 003 0 — 7 9 1 North Florida 000 002 1 — 3 7 5 with Holman in the averages just 23 minutes W — Kristin Martinez, 5-0. L — Kayla lineup. And that would be a game, time enough to Goff, 2-4. HR — Maggie Hull, KU. the same Horizon League average 10.8 points and KU highlights — Martinez CG, 3 R, that Butler represented 1 ER, 7 K, 1 BB; Hull 1-for-3, 2 R, 3 RBI; 6.9 rebounds. Ashley Newman 2-for-4, 3 R; Rosie Hull twice in the NCAA TourOh well, at least no2-for-4; Mariah Montgomery 1-for-4, nament title game the body has to worry about 2 RBIs. past two seasons. how motivated Thomas
Jayhawk softball runs streak to 20 JACK.
Memberships starting at $175.00/month.
BRIEFLY a good team tournament. Katy had an outstanding final round and really led the way for us. Audrey and RIO VERDE, ARIZ. — Katy Nadia also had a solid tourNugent tied the tournament nament as well.” single-round record with Akron’s Kristen Hill won a 3-under 68 and placed the individual title with 219. second overall, and Kansas Nugent shot 76-76University’s women’s golf 68—220. team won the Rio Verde KU’s other results: Invitational on Sunday. Audrey Yowell, tied for KU came from six strokes sixth, 224; Nadia Luttner, behind to win the team title tied for 18th, 229; Thanutwith 900. Runner-up Mistra Boonraksasat, tied souri State shot 903. for 21st, 230; and Meghan “The team got off to a Potee, tied for 33rd, 234. great start this morning and they played steady for the entire round which was Kansas tennis falls key,” coach Erin O’Neil to Oklahoma State said. “We had three players Freshman Maria Belen finish in the top 25, and that Ludueña claimed Kansas usually leads to us having
Nugent paces KU to golf victory
University’s only singles victory in a 6-1 Big 12 tennis loss to Oklahoma State on Sunday at the Jayhawk Tennis Center. Ludueña beat OSU’s Meghan Blevins, 4-6, 6-3 (11-9) at No. 3 singles. KU’s Monica Pezzotti and Dylan Windom also won at No. 1 doubles, but Oklahoma State won the other two matches to win the doubles point. Kansas fell to 7-4 overall, 0-2 in the Big 12. OSU moved to 8-3 and 2-1. The Jayhawks will travel next weekend to Las Vegas for three nonconference matches, starting with Houston on Saturday.
KU rowing rolls over Creighton OKLAHOMA CITY — Kansas University’s rowing team swept Creighton in the final four races Sunday at the Oklahoma Invite. KU won five of six races Sunday and 11 victories for the weekend. Earlier, the Jayhawks placed sixth of eight teams in the bracket portion of the regatta. KU beat Oklahoma in the second varsity eight race Friday and Kansas State in the varsity four and second varsity eight races Saturday. Oklahoma won the bracket-based event with 72 points.
No Initiation fee when you transfer from another club. Limited Number available.
and only The best 36 hole golf complex within 125 miles!
v
J-W Staff Reports
Make Alvamar your Staycation spot this year.
785.842.7767 or visit us online at
4B
|
Monday, March 12, 2012
COLLEGE BASKETBALL
.
L AWRENCE J OURNAL -W ORLD
Seeds set for Madness The Associated Press
K
Michael Conroy/AP Photo
MICHIGAN STATE CENTER ADREIAN PAYNE, LEFT, AND FORWARD DRAYMOND GREEN WATCH the NCAA Tournament selection show Sunday in Indianapolis.all this tournament can be. Last year, 4,000-student Butler finished as national runner-up for the second straight season, while VCU, of the Colonial Athletic Conference, went from one of the last teams in the newly expanded, 68-team draw, all the way to the Final Four. Who might this year’s VCU be? It’s the question being asked across the country, as those $10 and $20-apop brackets start getting
inked in at spring training sites, corporate board rooms and everywhere else across America. The tournament starts Tuesday with first-round games and gets into full swing Thursday and Friday,. Kentucky, the No. 1 overall seed, was placed in the South region and potentially could play six games without having to leave the Southeast. Kentucky will open in Louisville against the winner of a first-round game between Mississippi Valley State and Western Kentucky, but it gets
TOP 25 ROUNDUP
Kentucky, UNC fall in tournament finals
tougher from there. A possible second-round opponent is UConn,.
North Carolina (29-5) nearly came all the way Vanderbilt 71, back from a 16-point defiNo. 1 Kentucky 64 cit in the first half. P.J. NEW ORLEANS — Jeffery Hairston missed a tying Taylor scored 18 points three at the buzzer. and Vanderbilt rallied ST. (24-9) to beat Kentucky in the FLORIDA Gibson 2-3 0-0 4, James 4-5 1-2 9, Southeastern Conference Loucks 4-8 0-0 10, Dulkys 4-11 4-4 16, tournament champion- Snaer 7-13 0-0 18, White 4-6 1-2 9, 0-0 0-0 0, Miller 4-6 1-2 10, ship game Sunday, end- Peterson Whisnant 0-0 0-0 0, Kreft 4-4 1-1 9. ing the Wildcats’ 24-game Totals 33-56 8-11 85. NORTH CAROLINA (29-5) winning streak. Barnes 9-18 4-4 23, McAdoo 2-10 0-0 4, John Jenkins and Festus Zeller 7-12 5-6 19, Marshall 6-13 2-2 15, Ezeli both had 17 points Bullock 1-9 5-6 7, White 0-0 0-0 0, Hubert 0-0 0, Hairston 3-9 4-4 13, Watts 0-0 for Vanderbilt (24-10), 0-0 1-2 1. Totals 28-71 21-24 82. which last won the SEC Halftime-Florida St. 49-40. 3-Point Goals-Florida St. 11-22 (Snaer 4-5, tournament in 1951. Dulkys 4-9, Loucks 2-4, Miller 1-3, White Kentucky (32-2) didn’t 0-1), North Carolina 5-20 (Hairston score a field goal over the 3-7, Marshall 1-4, Barnes 1-4, Bullock Fouled Out-None. Reboundsfinal 8:04 and shot just 0-5). Florida St. 30 (James, Loucks 6), North 35.9 percent from the field Carolina 39 (Zeller 12). Assists-Florida St. 21 (Loucks 13), North Carolina 12 (23 of 64). 9). Total Fouls-Florida St. 19, Darius Miller scored 16 (Marshall North Carolina 14. A-19,520. points for Kentucky while Terrence Jones and AnNo. 8 Michigan St. 68, thony Davis both added No. 7 Ohio St. 64 12. INDIANAPOLIS — Brandon Wood scored a seaVANDERBILT (24-10) Goulbourne 3-5 0-2 6, Taylor 6-13 4-8 son-high 21 points to lead 18, Ezeli 5-9 7-10 17, Tinsley 2-6 0-0 5, Jenkins 3-12 8-9 17, Johnson 2-4 2-3 6, Michigan State in the Big Parker 0-1 0-0 0, Tchiengang 1-1 0-0 2, Ten tournament champiOdom 0-0 0-0 0. Totals 22-51 21-32 71. onship game. KENTUCKY (32-2) Draymond Green, who Jones 5-11 1-3 12, Davis 4-9 4-8 12, Miller 7-17 0-0 16, Lamb 2-11 6-6 11, had 12 points and nine reTeague 0-7 0-0 0, Beckham 0-0 0-0 0, Kidd-Gilchrist 2-4 1-2 5, Vargas 0-1 0-0 bounds in the final, was 0, Wiltjer 3-4 0-0 8. Totals 23-64 12-19 64. named the most outstandHalftime-Tied 37-37. 3-Point GoalsVanderbilt 6-18 (Jenkins 3-10, Taylor ing player of the tourna2-4, Tinsley 1-3, Johnson 0-1), Kentucky ment. The Spartans (27-7) 6-28 (Wiltjer 2-3, Miller 2-9, Jones 1-3, Lamb 1-7, Kidd-Gilchrist 0-1, Teague claimed their first tourna0-2, Davis 0-3). Fouled Out-Ezeli, ment title since 2000 in a Kidd-Gilchrist. Rebounds-Vanderbilt dramatic game that fea40 (Taylor 11), Kentucky 37 (Jones 11). Assists-Vanderbilt 8 (Tinsley 4), tured 16 lead changes. The Associated Press
Kentucky 12 (Teague 6). Total FoulsVanderbilt 16, Kentucky 22. TechnicalVanderbilt Coach. A-18,114.
No. 17 Florida St. 85, No. 4 North Carolina 82 ATLANTA — Tournament MVP Michael Snaer scored 18 points and Florida State used a barrage of three-pointers to win the ACC tournament championship for the first time since joining the conference in 1991. Florida State (24-9) beat the Tar Heels by 33 points during the regular season.
ZB@U<1E
I@<0@U<1E
16 MG9U )21+12-
1# BYU )2*+,-
16 I: ?@0ABCDE )1*+1,-
1# ./01 )2*+2-
.+$/-0/""&()(ZKB: 6+'7"428()(ZKB: 1'&&2-#+'+()(F75: !"#$%$&'%$&()(ZKB: *+"$,#$-()(F75:
16 G@7P/0A )23+11-
12 9: F4/75<1 )20+13-
Sweet 16
Second Round Third Round Sweet 16
M17CK 22+23
M17CK 22+23
M17CK 12+1,
M17CK 1*+16 1 9E71CBU@ )31+216 UN3 AUK@R544@ )2#+8-
, ./J1 9A: )22+10-
Elite Eight
Elite Eight
, ?10U1U 9A: )21+10-
8 U3/00 )20+13-
M17CK 2#+2*
M17CK 2#+2*
8 9/: M5UU: )2*+,-
* I5CK5A1 9A: )22+*-
* G10<@7X54A )2#+10-
12 G3U )2,+6-
12 Y17R17< )26+#-
Final Four
# .0<5101 )2*+,-
M17CK 31
13 N@J M@M: 9A: )26+86 UNNG )26+,-
# I5UC/0U50 )2#+813 M/0A101 )2*+6-
EA9Z
9OUZY
6 350C5001A5 )2#+10-
11 3/4/71</ )23+11-
11 Z@M1U )20+13-
3 B1E4/7 )22+2-
3 F4/75<1 9A: )2#+8-
1# 9: D1D/A1 9A: )22+2-
1# 9A: B/01R: )20+11-
National Championship
2 N/A7@ D1P@ )22+1110 Q1R5@7 )21+12-
2 [/0\1S1 )2*+610 I: G57S5051 )18+13-
AT754 2
2 DBD@ )22+6-
2 OK5/ 9A: )22+21* N/E/41 )MD- )2#+,-
1 M5CK5S10 9A: )22+2-
1 N: 317/4501 )28+*-
16 N.U B7//D4E0 )2*+,-
16 N1P17HG@7P/0A
, M@PTK5U )26+,-
, 37@5SKA/0 )2,+*-
8 9A: N/B5U )2*+2-
8 A41X1P1 )21+11-
* N@J M@M5C/ )22+6-
* Z@PT4@ )2#+2-
12 N/0S B@1CK 9A: )2*+,-
12 314:H9: F4/75<1
# N/B5UR544@ )26+8-
# M5CK5S10 )2#+8-
13 D1R5<U/0 )2*+2-
13 OK5/ )22+2-
IE9Z
M.DIE9Z
6 910 D5@S/ 9A: )26+211 N:3: 9A1A@ )22+12-
3 M17VB@AA@ )2*+2-
3 [@/7S@A/J0 )23+,-
1# BYUH./01
1# B@4P/0A )22+2-
2 F4/75<1 )23+10-
2 9150A M17E^U )22+*-
10 G57S5051 )22+8-
10 _B7<B@ )21+12-
2 M5UU/B75 )30+#-
2 ?10U1U )22+6-
1* N/76/4D 9A: )2*+8-
1* D@A7/5A )22+13-
3,454()(F75:
11 3/4/: 9A: )20+11-
*+"$,#$-()(F75:
6 MB771E 9A: )30+1-
:4-50/""&()(F75:
1* N@K5SK )26+2-
1'&&2-#+'+()(F75:
6+'7"428()(ZKB:
12 31456/7051 )2#+8-
6/77-#$'95()(ZKB:
.+$/-0/""&()(ZKB:
16 N1P17 )23+11-
:4-50/""&()(F75:
3,454()(F75:
16 MG9UHI: ?@0ABCDE
M17CK 13+1# Dayton, Ohio
6/77-#$'95()(ZKB: !"#$%$&'%$&()(ZKB:
1 ?@0ABCDE )32+2-
Third Round M17CK 12+1,
First Round
Men’s Division I Basketball Championship
Second Round M17CK 1*+16
OHIO ST. (27-7) Sullinger 7-19 3-5 18, Thomas 4-12 2-2 11, Scott 2-2 0-0 4, Craft 5-9 0-1 10, Thompson 0-0 0-0 0, Williams 0-0 0-0 0, Ravenel 0-1 0-0 0, Smith, Jr. 3-8 2-2 10, Buford 4-12 3-5 11. Totals 25-63 10-15 64. MICHIGAN ST. (27-7) Kearney 2-2 0-0 4, Payne 3-3 0-0 6, Appling 2-8 0-1 4, Thornton 2-4 2-4 8, Trice 1-3 0-0 3, Green 4-15 2-2 12, Nix 4-5 2-3 10, Wood 8-14 1-4 21. Totals 26-54 7-14 68. Halftime-Michigan St. 34-32. 3-Point Goals-Ohio St. 4-17 (Smith, Jr. 2-4, Sullinger 1-2, Thomas 1-6, Craft 0-1, Buford 0-4), Michigan St. 9-21 (Wood 4-8, Green 2-3, Thornton 2-4, Trice 1-2, Appling 0-4). Fouled Out-None. Rebounds-Ohio St. 43 (Sullinger 9), Michigan St. 30 (Green 9). Assists-Ohio St. 6 (Craft 4), Michigan St. 16 (Appling 5). Total Fouls-Ohio St. 17, Michigan St. 14. Technical-Michigan St. Bench. A-17,125.
SPORTS
L AWRENCE J OURNAL -W ORLD
NBA
SCOREBOARD NIT College Men
Sunday’s Scores Atlantic 10 Conference Championship St. Bonaventure 67, Xavier 56 Atlantic Coast Conference Championship Florida St. 85, North Carolina 82 Big Ten Conference Championship Michigan St. 68, Ohio St. 64 Southeastern Conference Championship Vanderbilt 71, Kentucky 64 Western Athletic Conference Championship New Mexico St. 82, Louisiana Tech 57
College Women
Sunday’s Scores Big South Conference Liberty 81, High Point 73 Colonial Athletic Association Championship Delaware 59, Drexel 43 Horizon League Championship Green Bay 66, Detroit 53 Missouri Valley Conference Championship Creighton 53, Drake 38 Northeast Conference Championship Sacred Heart 58, Monmouth (NJ) 48 Pts Pvs 1. Kentucky (30) 32-2 774 1 2. Syracuse 31-2 730 2 3. Missouri (1) 30-4 715 5 4. Michigan State 27-7 660 8 5. North Carolina 29-5 652 4 6. Kansas 27-6 586 3 7. Ohio State 27-7 578 7 8. Duke 27-6 557 6 9. Murray State 30-1 502 10 10. Baylor 27-7 481 11 11. Marquette 25-7 452 9 12. Florida State 24-9 442 17 13. Wisconsin 24-9 348 12 14. Michigan 24-9 319 13 15. Georgetown 23-8 307 14 16. Saint Mary’s 27-5 268 18 17. Indiana 25-8 252 15 18. Louisville 26-9 245 — 19. Wichita State 27-5 231 16 20. Creighton 28-5 199 22 21. Florida 23-10 189 19 22. New Mexico 27-6 125 — 23. San Diego State 26-7 99 21 24. Vanderbilt 24-10 94 — 25. UNLV 26-8 79.
NCAA Men
FIRST ROUND At UD Arena Dayton, Ohio Tuesday, March 13 MVSU (21-12) vs. Western Kentucky (15-18), 5:40 p.m. BYU (25-8) vs. Iona (25-7), 30 minutes following Wednesday, March 14 Lamar (23-11) vs. Vermont (23-11), 5:40 p.m. California (24-9) vs. South Florida (2013), 30 minutes following EAST REGIONAL Second Round Thursday, March 15 At The CONSOL Energy Center Pittsburgh Kansas State (21-10) vs. Southern Mississippi (25-8), 11:40 a.m. Syracuse (31-2) vs. UNC Asheville (24-9), 30 minutes following Gonzaga (25-6) vs. West Virginia (1913), 6:20 p.m. Ohio State (27-7) vs. Loyola (Md.) (248), 30 minutes following At The Pit Albuquerque, N.M. Wisconsin (24-9) vs. Montana (25-6), 1:10 p.m. Vanderbilt (24-10) vs. Harvard (26-4), 30 minutes following Friday, March 16 At Bridgestone Arena Nashville, Tenn. Cincinnati (24-10) vs. Texas (20-13), 11:15 a.m. Florida State (24-9) vs. St. Bonaventure (20-11), 30 minutes following SOUTH REGIONAL Second Round Thursday, March 15 At The KFC Yum! Center Louisville, Ky. Kentucky (32-2) vs. MVSU-Western Kentucky winner, 5:50 p.m. Iowa State (22-10) vs. UConn (20-13), 30 minutes following At The Pit Albuquerque, N.M. Baylor (27-7) vs. South Dakota State (27-7), 6:27 p.m. UNLV (26-8) vs. Colorado (23-11), 30 minutes following At The Rose Garden Portland, Ore. Wichita State (27-5) vs. VCU (28-6), 6:15 p.m. Indiana (25-8) vs. New Mexico State (26-9), 30 minutes following Friday, March 16 At Greensboro Coliseum Greensboro, N.C. Duke (27-6) vs. Lehigh (26-7), 6:15 p.m. Notre Dame (22-11) vs. Xavier (21-12), 30 minutes following MIDWEST REGIONAL Second Round Friday, March 16 At Greensboro Coliseum Greensboro, N.C. Creighton (28-5) vs. Alabama (21-11), 12:40 p.m. North Carolina (29-5) vs. LamarVermont winner, 30 minutes following At Nationwide Arena Columbus, Ohio San Diego State (26-7) vs. N.C. State (22-12), 11:40 a.m. Georgetown (23-8) vs. Belmont (277), 30 minutes following At Bridgestone Arena Nashville, Tenn. Michigan (24-9) vs. Ohio (27-7), 6:20 p.m. Temple (24-7) vs. California-South Florida winner, 30 minutes following At CenturyLink Center Omaha, Neb. Saint Mary’s (Calif.) (27-5) vs. Purdue (21-12), 6:27 p.m. Kansas (27-6) vs. Detroit (22-13), 30 minutes following WEST REGIONAL Second Round Thursday, March 15 At The KFC Yum! Center Louisville, Ky. Murray State (30-1) vs. Colorado State (20-11), 11:15 a.m. Marquette (25-7) vs. BYU-Iona winner, 30 minutes following At The Rose Garden Portland, Ore. Louisville (26-9) vs. Davidson (25-7), 12:40 p.m. New Mexico (27-6) vs. Long Beach State (25-8), 30 minutes following Friday, March 16 At Nationwide Arena Columbus, Ohio Memphis (26-8) vs. Saint Louis (25-7), 5:50 p.m. Michigan State (27-7) vs. LIU (25-8), 30 minutes following At CenturyLink Center Omaha, Neb. Florida (23-10) vs. Virginia (22-9), 1:10 p.m. Missouri (30-4) vs. Norfolk State (259), 30 minutes following
First Round Tuesday, March 13 UMass (21-10) at Mississippi State (21-11), 6 p.m. Stony Brook (22-9) at Seton Hall (2012), 6:15 p.m. Dayton (20-12) at Iowa (17-16), 6:30 p.m. Savannah State (21-11) at Tennessee (18-14), 7 p.m. Akron (22-11) at Northwestern (1813), 8 p.m. Marshall (21-13) at Middle Tennessee (25-6), 8:15 p.m. LSU (18-14) at Oregon (22-9), 8:30 p.m. Texas-Arlington (24-8) at Washington (21-10), 9 p.m. Cleveland State (22-10) at Stanford (21-11), 10 p.m. Wednesday, March 14 Minnesota (19-14) at La Salle (21-12), 6 p.m. UCF (22-10) at Drexell (27-6), 6:15 p.m. Northern Iowa (19-13) at Saint Joseph’s (20-13), 6:15 p.m. Valparaiso (22-11) at Miami (19-12), 6:30 p.m. Bucknell (24-9) at Arizona (23-11), 8 p.m. Nevada (26-6) at Oral Roberts (27-6), 8:15 p.m. Illinois State (20-13) at Mississippi (20-13), 8:30 p.m.
BNP Paribas Open
Sunday At The Indian Wells Tennis Garden Indian Wells, Calif. Purse: Men: $5.55 million (Masters 1000); $5.44 million (Premier) Surface: Hard-Outdoor Singles Men Second Round Juan Martin Del Porto (9), Argentina, def. Marinko Matosevic, Australia, 7-5, 6-2. Nikolay Davydenko, Russia, def. Bjorn Phau, Germany, 7-5, 6-2. Marcel Granollers (26), Spain, def. Tommy Haas, Germany, 6-3, 2-6, 6-3. Denis Istomin, Uzbekistan, def. Juan Ignacio Chela (31), Argentina, 7-6 (5), 6-7 (7), 7-5. Fernando Verdasco (19), Spain, def. Ryan Sweeting, United States, 6-2, 6-2. Rafael Nadal (2), Spain, def. Leonardo Mayer, Argentina, 6-1, 6-3. Marcos Baghdatis, Cyprus, def. Feliciano Lopez (15), Spain, 6-3, 6-4. Thomaz Bellucci, Brazil, def. Jurgen Melzer (20), Austria, 6-3, 6-3. Janko Tipsarevic (10), Serbia, def. Gilles Muller, Luxembourg, 6-4, 6-2. David Ferrer (5), Spain, def. Grigor Dimitrov, Bulgaria, 6-2, 6-2. Jo-Wilfried Tsonga (6), France, def. Michael Llodra, France, 4-1, retired. Radek Stepanek (28), Czech Republic, def. Xavier Malisse, Belgium, 6-2, 6-1. Women Third Round Julia Goerges (14), Germany, def. Anabel Medina Garrigues (24), Spain, 6-3, 6-4. Li Na (8), China, def. Zheng Jie (31), China, 6-1, 6-3. Victoria Azarenka (1), Belarus, def. Svetlana Kuznetsova (25), Russia, 6-1, 6-2. Angelique Kerber (18), Germany, def. Vania King, United States, walkover.
Cadillac Championship
Sunday At TPC Blue Monster at Doral Doral, Fla. Purse: $8.5 million Yardage: 7,334; Par: 72 Final Round Justin Rose 69-64-69-70—272 Bubba Watson 70-62-67-74—273 Rory McIlroy 73-69-65-67—274 Peter Hanson 70-65-69-71—275 Charl Schwartzel 68-69-70-68—275 Luke Donald 70-68-69-69—276 John Senden 76-67-68-65—276 Keegan Bradley 69-67-66-75—277 Matt Kuchar 72-67-66-72—277 Steve Stricker 69-70-69-69—277 Bo Van Pelt 73-65-70-69—277 Aaron Baddeley 69-74-68-67—278 Graeme McDowell 75-67-67-70—279 Francesco Molinari 75-68-71-65—279 Adam Scott 66-68-74-71—279 Johnson Wagner 70-69-67-73—279 Charles Howell III 70-67-71-72—280 Zach Johnson 70-68-67-75—280 Nick Watney 71-73-69-67—280 Greg Chalmers 71-70-68-72—281 Jason Day 73-67-70-71—281 Robert Karlsson 75-68-70-68—281 Martin Kaymer 73-64-70-74—281 Thomas Bjorn 68-68-75-71—282 Marcus Fraser 76-68-69-69—282 Martin Laird 72-73-66-71—282 Hunter Mahan 71-72-66-73—282 Robert Rock 75-70-68-69—282 Jason Dufner 66-72-73-72—283 Bill Haas 74-70-70-69—283 Anders Hansen 70-72-69-72—283 Garth Mulroy 73-71-69-70—283 Lee Westwood 76-67-68-72—283 Gary Woodland 71-70-70-72—283 Jonathan Byrd 72-70-70-72—284 K.J. Choi 74-67-70-73—284 Nicolas Colsaerts 73-70-70-71—284 Branden Grace 78-72-64-70—284 Dustin Johnson 75-68-73-68—284 Juvic Pagunsan 69-71-72-72—284 Chez Reavie 78-68-67-71—284 Webb Simpson 75-66-66-77—284 Darren Clarke 74-74-68-69—285 Phil Mickelson 72-71-71-71—285 Rickie Fowler 74-70-72-70—286 Retief Goosen 74-71-71-70—286 Miguel A. Jimenez 69-71-73-73—286 Brandt Snedeker 75-69-70-72—286 Mark Wilson 72-70-72-72—286 Hennie Otto 73-66-71-77—287 Paul Casey 76-71-68-73—288 Ben Crane 73-71-73-71—288 K.T. Kim 74-72-70-72—288 Kyle Stanley 69-69-76-74—288 Tiger Woods 72-67-68-WD
Kobalt Tools 400
Sunday At Las Vegas Motor Speedway Las Vegas, Nev. Lap length: 1.5 miles (Start position in parentheses) 1. (7) Tony Stewart, Chevrolet, 267 laps, 141.7 rating, 48 points. 2. (6) Jimmie Johnson, Chevrolet, 267, 115.4, 43. 3. (9) Greg Biffle, Ford, 267, 121.8, 42. 4. (18) Ryan Newman, Chevrolet, 267, 99, 40. 5. (21) Carl Edwards, Ford, 267, 98, 39. 6. (5) Clint Bowyer, Toyota, 267, 93.6, 39. 7. (26) Paul Menard, Chevrolet, 267, 92.2, 37. 8. (19) Jamie McMurray, Chevrolet, 267, 94.8, 36. 9. (25) Trevor Bayne, Ford, 267, 78.5, 0. 10. (4) Dale Earnhardt Jr., Chevrolet, 267, 113.1, 35. 11. (3) Kevin Harvick, Chevrolet, 267, 107.7, 34. 12. (16) Jeff Gordon, Chevrolet, 267, 78.7, 33. 13. (15) Marcos Ambrose, Ford, 267, 75.5, 31. 14. (22) Jeff Burton, Chevrolet, 267, 71.9, 30. 15. (28) Regan Smith, Chevrolet, 267, 69.8, 29. 16. (8) Joey Logano, Toyota, 267, 76.4, 28. 17. (10) Martin Truex Jr., Toyota, 267, 95.7, 27. 18. (13) Mark Martin, Toyota, 267, 74.5, 26. 19. (1) Kasey Kahne, Chevrolet, 267, 94.3, 25. 20. (17) Denny Hamlin, Toyota, 267, 63.2, 24. 21. (35) David Ragan, Ford, 267, 55.1, 24. 22. (11) Matt Kenseth, Ford, 267, 110.4, 23. 23. (2) Kyle Busch, Toyota, 266, 74.1, 21. 24. (27) Aric Almirola, Ford, 266, 59.7, 20.
25. (29) Juan Pablo Montoya, Chevrolet, 264, 51.8, 19. 26. (24) Bobby Labonte, Toyota, 264, 56.6, 18. 27. (32) Casey Mears, Ford, 264, 42, 17. 28. (43) David Stremme, Toyota, 263, 45.4, 16. 29. (38) Dave Blaney, Chevrolet, 263, 44.7, 15. 30. (41) Ken Schrader, Ford, 263, 37.7, 14. 31. (31) David Reutimann, Chevrolet, 261, 51, 13. 32. (20) Brad Keselowski, Dodge, 259, 72.6, 13. 33. (34) David Gilliland, Ford, 258, 34.9, 11. 34. (23) Brendan Gaughan, Chevrolet, 252, 32.2, 10. 35. (12) Kurt Busch, Chevrolet, accident, 251, 69.2, 9. 36. (30) Landon Cassill, Toyota, engine, 240, 47.8, 8. 37. (14) A J Allmendinger, Dodge, 238, 66.4, 8. 38. (39) Michael McDowell, Ford, rear gear, 147, 35, 6. 39. (37) Travis Kvapil, Toyota, engine, 123, 40.1, 5. 40. (33) Josh Wise, Ford, brakes, 64, 32, 4. 41. (40) Joe Nemechek, Toyota, vibration, 44, 27.4, 0. 42. (42) Timmy Hill, Ford, accident, 42, 27.3, 2. 43. (36) J.J. Yeley, Toyota, engine, 39, 31.9, 1.
Spring Training
Sunday’s Games N.Y. Yankees (ss) 3, Philadelphia (ss) 0 Tampa Bay 4, Pittsburgh 3 Philadelphia (ss) 4, Detroit (ss) 4, tie, 10 innings Toronto (ss) vs. Atlanta (ss) at Kissimmee, Fla., ccd., Rain Detroit (ss) vs. Houston at Kissimmee, Fla., ccd., Rain Boston 6, Baltimore 1 Minnesota 5, N.Y. Yankees (ss) 1 Toronto (ss) 9, Atlanta (ss) 5 Washington vs. St. Louis at Jupiter, Fla., ccd., Rain Miami 4, N.Y. Mets 2, 5 innings L.A. Dodgers 5, Chicago Cubs 0 L.A. Angels (ss) 17, Cleveland (ss) 2 Oakland 10, Kansas City 8 Milwaukee 5, Colorado (ss) 4 Arizona 8, San Diego 7 Texas 6, Cleveland (ss) 1 San Francisco 7, Seattle 5 Cincinnati 5, L.A. Angels (ss) 4 Colorado (ss) 5, Chicago White Sox 2 Today’s Games Atlanta vs. St. Louis (ss) at Jupiter, Fla., noon St. Louis (ss) vs. Washington at Viera, Fla., noon Baltimore vs. Toronto at Dunedin, Fla., noon N.Y. Mets vs. Detroit at Lakeland, Fla., noon Philadelphia vs. Pittsburgh at Bradenton, Fla., noon Minnesota vs. Tampa Bay at Port Charlotte, Fla., noon Miami vs. Boston at Fort Myers, Fla., 12:35 p.m. Texas vs. Seattle at Peoria, Ariz., 3 p.m. Arizona vs. Cleveland at Goodyear, Ariz., 3 p.m. San Francisco vs. Kansas City at Surprise, Ariz., 3 p.m. L.A. Dodgers vs. L.A. Angels at Tempe, Ariz., 3 p.m. Oakland vs. Chicago White Sox at Glendale, Ariz., 3 p.m. Cincinnati vs. Chicago Cubs at Mesa, Ariz., 3 p.m. San Diego vs. Colorado at Scottsdale, Ariz., 3:10 p.m. Houston vs. N.Y. Yankees at Tampa, Fla., 6:05 p.m.
NHL
EASTERN CONFERENCE Atlantic Division GP W L OT Pts GF GA N.Y. Rangers 68 43 18 7 93 188 148 Pittsburgh 68 42 21 5 89 219 173 Philadelphia 68 39 22 7 85 220 197 New Jersey 69 40 24 5 85 195 179 N.Y. Islanders 69 28 31 10 66 160 206 Northeast Division GP W L OT Pts GF GA Boston 68 40 25 3 83 222 164 Ottawa 70 36 25 9 81 216 206 Buffalo 69 32 29 8 72 171 194 Toronto 69 30 31 8 68 200 212 Montreal 69 27 32 10 64 183 193 Southeast Division GP W L OT Pts GF GA Florida 68 32 23 13 77 166 191 Washington 69 35 28 6 76 184 193 Winnipeg 69 32 29 8 72 181 195 Tampa Bay 68 31 30 7 69 191 233 Carolina 69 26 28 15 67 181 207 WESTERN CONFERENCE Central Division GP W L OT Pts GF GA St. Louis 70 45 18 7 97 183 135 Detroit 69 44 22 3 91 217 162 Nashville 68 40 21 7 87 195 175 Chicago 70 37 25 8 82 209 206 Columbus 69 22 40 7 51 161 223 Northwest Division GP W L OT Pts GF GA Vancouver 69 42 19 8 92 215 172 Calgary 69 32 25 12 76 173 191 Colorado 70 36 30 4 76 183 187 Minnesota 69 29 30 10 68 150 193 Edmonton 68 26 35 7 59 180 206 Pacific Division GP W L OT Pts GF GA Dallas 69 38 26 5 81 185 183 Phoenix 69 34 25 10 78 178 173 Los Angeles 69 32 25 12 76 154 152 San Jose 67 33 25 9 75 184 173 Anaheim 69 29 30 10 68 171 193 Sunday’s Games Today’s Games Montreal at Buffalo, 6 p.m. Anaheim at Colorado, 8 p.m. San Jose at Edmonton, 8:30 p.m. Nashville at Phoenix, 9 p.m.
BASEBALL American League BALTIMORE ORIOLES-Optioned INF Ryan Adams and INF Josh Bell to Norfolk (IL) and RHP Dylan Bundy to Delmarva (SAL). Assigned OF Xavier Avery, OF LJ Hoes, C Michael Ohlman, C Brian Ward and RHP Steve Johnson to their minor league camp. National League CHICAGO CUBS-Agreed to terms with LHP Gerardo Concepcion on a five-year contract. HOCKEY National Hockey League COLUMBUS BLUE JACKETS-Activated RW Jared Boll from injured reserve. Assigned RW Maksim Mayorov to Springfield (AHL). DETROIT RED WINGS-Reassigned F Gustav Nyquist and G Jordan Pearce to Grand Rapids (AHL). COLLEGE TULSA-Fired men’s basketball coach Doug Wojcik.
MLS
Saturday’s Games Vancouver 2, Montreal 0 Colorado 2, Columbus 0 Sporting Kansas City 1, D.C. United 0 Real Salt Lake 3, Los Angeles 1 San Jose 1, New England 0 Sunday’s Games FC Dallas 2, New York 1 Houston 1, Chivas USA 0 Tonight’s Game Philadelphia at Portland, 8:30 p.m.
Monday, March 12, 2012
| 5B
Roundup
The Associated Press
Lakers 97, Celtics 94 LOS ANGELES — Kobe Bryant scored 10 of his 26 points in the fourth quarter and hit a go-ahead jumper with 41.7 seconds to play, leading the Los Angeles Lakers to a victory over the Boston Celtics on Sunday. Andrew Bynum had 20 points and 14 rebounds for the Lakers, who rallied from a five-point deficit in the final 21⁄2 minutes. The All-Star center hit a short hook shot over Kevin Garnett with 15.5 seconds left, and Boston couldn’t get a good look at a tying threepointer. The Lakers scored the final eight points. Rajon Rondo had 24 points and 10 assists for the Celtics..A. Lakers 8-16 (World Peace 3-5, Bryant 3-6, Goudelock 1-1, Fisher 1-2, Blake 0-2). Fouled Out-None. Rebounds-Boston 40 (Garnett 11), L.A. Lakers 50 (Bynum 14). Assists-Boston 33 (Rondo 10), L.A. Lakers 25 (Bryant 7). Total Fouls-Boston 21, L.A. Lakers 16. Technicals-Pierce, Bryant, World Peace, L.A. Lakers defensive three second. A-18,997 (18,997).
STANDINGS EASTERN CONFERENCE Atlantic Division W L Pct GB Philadelphia 25 17 .595 — Boston 21 19 .525 3 New York 18 23 .439 6½ New Jersey 14 28 .333 11 Toronto 13 28 .317 11½ Southeast Division W L Pct GB Miami 31 9 .775 — Orlando 27 15 .643 5 Atlanta 24 17 .585 7½ Washington 9 30 .231 21½ Charlotte 5 34 .128 25½ Central Division W L Pct GB Chicago 34 9 .791 — Indiana 23 16 .590 9 Milwaukee 17 24 .415 16 Cleveland 16 23 .410 16 Detroit 15 26 .366 18 WESTERN CONFERENCE Southwest Division W L Pct GB San Antonio 26 13 .667 — Memphis 24 16 .600 2½ Dallas 23 20 .535 5 Houston 22 20 .524 5½ New Orleans 10 31 .244 17 Northwest Division W L Pct GB Oklahoma City 32 9 .780 — Denver 23 19 .548 9½ Minnesota 21 21 .500 11½ Portland 20 21 .488 12 Utah 19 21 .475 12½ Pacific Division W L Pct GB L.A. Lakers 25 16 .610 — L.A. Clippers 23 16 .590 1 Phoenix 19 21 .475 5½ Golden State 17 21 .447 6½ Sacramento 14 27 .341 11 Sunday’s Games Today’s Games Milwaukee at New Jersey, 6:30 p.m. New York at Chicago, 7 p.m. Charlotte at New Orleans, 7 p.m. Washington at San Antonio, 7:30 p.m. Detroit at Utah, 8 p.m. Minnesota at Phoenix, 9 p.m. Boston at L.A. Clippers, 9:30 p.m.
How former Jayhawks fared
76ers 106, Knicks 94 Darrell Arthur, Memphis NEW YORK — Lou Wilinactive (out for season) liams scored 12 of his 28 points in a dazzling Drew Gooden, Milwaukee third-quarter flurry, Evan Turner had 24 points and Pts: 21. FGs: 7-11. FTs: 7-9. 15 rebounds, and the PhilKirk Hinrich, Atlanta adelphia 76ers handed the New York Knicks their Pts: 12. FGs: 5-10. FTs: 0-0. fifth straight loss. Marcus Morris, Houston Williams tossed in a long jumper to beat the did not play (coach’s decision) halftime buzzer, then had Paul Pierce, Boston a dozen points in the final 3:28 of the third quarter, Pts: 13. FGs: 4-14. FTs: 4-4. when the 76ers seized control for their third Brandon Rush, Golden State Pts: 5. FGs: 2-3. FTs: 0-0. straight victory.-Philadelphia 5-9 (Williams 3-5, Iguodala 2-3, Holiday 0-1), New York 7-17 (Davis 2-2, Novak 2-3, Fields 1-1, Smith 1-4, Anthony 1-4, Lin 0-3). Fouled Out-Holiday. ReboundsPhiladelphia 48 (Turner 15), New York 48 (Chandler 12). Assists-Philadelphia 18 (Iguodala 8), New York 16 (Lin 7). Total Fouls-Philadelphia 21, New York 19. Technicals-Turner, Stoudemire. A-19,763 (19,763).
Cavaliers 118, Rockets 107 CLEVELAND — Antawn Jamison scored 28 points and rookie Kyrie Irving came through again in the fourth quarter, leading the Cleveland Cavaliers over the Houston Rockets. Cleveland, which recorded a season high in points, had six players in double figures. Luis Scola scored a season-high 30 points to lead Houston. While Jamison led the way by going 8-for-16 from the field, Irving again took over down the stretch. He scored 16 of his 21 points in the final 4:14. Irving orchestrated a decisive run in the final three minutes when Cleveland snapped Oklahoma City’s 14-game home winning streak Friday night.ouston 8-17 (Dragic 4-5, Budinger 2-3, Lee 1-2, Parsons 1-3, Flynn 0-1, Martin 0-3), Cleveland 11-20 (Jamison 4-7, Sessions 2-2, Casspi 2-3, Parker 1-1, Irving 1-3, Gibson 1-4). Fouled Out-None. Rebounds-Houston 45 (Dalembert 10), Cleveland 53 (Irving 6). Assists-Houston 25 (Dragic 8), Cleveland 25 (Sessions 7). Total FoulsHouston 25, Cleveland 21. TechnicalsFlynn, Houston defensive three second. A-17,662 (20,562).
Josh Selby, Memphis did not play (coach’s decision)
Bucks 105, Raptors 99 TORONTO — Ersan Ilyasova had 31 points and 12 rebounds, Drew Gooden added 21 points and the short-handed Milwaukee Bucks won their sixth straight over the Toronto Raptors. Mike Dunleavy scored 19 points, including the go-ahead three-pointer in the fourth quarter, as the Bucks survived a final period that included seven lead changes.waukeeMilwaukee 42 (Ilyasova 12), Toronto 52 (Davis 10). Assists-Milwaukee 26 (Dunleavy, Jennings 6), Toronto 23 (Bayless 6). Total Fouls-Milwaukee 18, Toronto 30. A-17,316 (19,800).
Magic 107, Pacers 94 ORLANDO, FLA. —. Paul George led the Pacers with 22 points, Tyler Hansbrough added 19 and Danny Granger 18.None. Rebounds-Indiana 42 (George 8), Orlando 52 (Howard 13). AssistsIndiana 15 (Collison 4), Orlando 22 (Redick 9). Total Fouls-Indiana 25, Orlando 14. Technicals-Hansbrough, Howard. A-18,846 (18,500).
Grizzlies 94, Nuggets 91 DENVER — O.J. Mayo scored 22 points, including a critical three-pointer in the closing seconds and the Memphis Grizzlies hung on to beat the Denver Nuggets to sweep the three-game regularseason. MEMPHIS (94) Gay 3-13 1-3 7, Speights 4-10 0-2 8, Gasol 2-7 3-3 7, Conley 5-8 2-2 13, Allen 4-5 2-3 10, Mayo 9-14 1-2 22, Cunningham 4-6 4-4 12, Pondexter 4-7 0-0 9, Haddadi 2-3 2-4 6, Young 0-0 0-0 0. Totals 37-73 15-23 94. DENVER (91) Gallinari 0-5 0-0 0, Faried 3-6 2-4 8, Nene 4-13 7-8 15, Lawson 2-4 0-0 5, Afflalo 4-7 1-1 10, Harrington 5-12 3-4 15, Andersen 2-6 3-4 7, Brewer 6-13 3-5 15, Miller 5-12 4-4 14, Hamilton 1-1 0-0 2. Totals 32-79 23-30 91. Memphis 23 27 23 21—94 Denver 25 28 17 21—91 3-Point Goals-Memphis 5-15 (Mayo 3-8, Conley 1-2, Pondexter 1-3, Gay 0-2), Denver 4-9 (Harrington 2-4, Afflalo 1-1, Lawson 1-2, Gallinari 0-1, Brewer 0-1). Fouled Out-None. ReboundsMemphis 39 (Speights 9), Denver 59 (Nene, Andersen 9). Assists-Memphis 23 (Mayo 8), Denver 22 (Miller 7). Total Fouls-Memphis 22, Denver 19. Technicals-Speights. A-17,737 (19,155).
Hawks 106, Kings 99 SACRAMENTO, CALIF. —. ATLANTA (106) J.Johnson 5-13 9-9 21, Smith 13-23 1-6 28, Pachulia 4-6 2-2 10, Teague 7-11 1-3 16, Hinrich 5-10 0-0 12, Williams 5-11 2-3 12, Pargo 1-3 0-0 2, Radmanovic 2-5 0-0 5, Dampier 0-0 0-0 0. Totals 42-82 15-23 106. SACRAMENTO (99) Evans 4-14 0-0 8, Thompson 2-5 0-0 4, Cousins 10-17 8-10 28, Thomas 2-7 2-2 8, Thornton 4-11 2-2 12, Fredette 5-9 0-0 12, Garcia 2-4 0-0 5, Greene 2-4 0-0 4, Salmons 5-8 1-3 14, Hayes 2-3 0-0 4. Totals 38-82 13-17 99. Atlanta 23 28 29 26 — 106 Sacramento 24 28 22 25 — 99 3-Point Goals-Atlanta 7-21 (J.Johnson 2-4, Hinrich 2-5, Teague 1-1, Radmanovic 1-2, Smith 1-5, Pargo 0-1, Williams 0-3), Sacramento 10-29 (Salmons 3-4, Thomas 2-4, Fredette 2-5, Thornton 2-7, Garcia 1-3, Cousins 0-1, Greene 0-2, Evans 0-3). Fouled Out-Pachulia, Cousins. ReboundsAtlanta 54 (Pachulia 13), Sacramento 42 (Cousins 12). Assists-Atlanta 23 (Teague 7), Sacramento 19 (Evans 7). Total Fouls-Atlanta 16, Sacramento 21. A-13,976 (17,317).
Warriors 97, Clippers 93 victory. Blake Griffin had 27 points and 12 rebounds for the Clippers, who missed 16 of 35 free throws. GOLDEN STATE (97) D.Wright 7-10 2-3 20, Lee 7-12 4-4 18, Udoh 7-10 0-0 14, Curry 0-3 0-0 0, Ellis 7-16 7-8 21, McGuire 1-1 0-0 2, Biedrins 0-0 0-0 0, Rush 2-3 0-0 5, Thompson 3-9 3-4 11, Robinson 2-6 1-2 6, Jenkins 0-0 0-0 0. Totals 36-70 17-21 97. L.A. CLIPPERS (93) Butler 0-6 1-2 1, Griffin 10-19 7-15 27, Jordan 1-2 2-4 4, Paul 10-18 3-6 23, Foye 5-11 3-4 16, Williams 1-8 0-0 3, Simmons 2-6 0-0 6, Evans 4-5 3-4 11, Bledsoe 1-4 0-0 2. Totals 34-79 19-35 93. Golden State 28 27 23 19—97 L.A. Clippers 16 26 22 29—93 3-Point Goals-Golden State 8-15 (D.Wright 4-7, Thompson 2-3, Rush 1-1, Robinson 1-3, Curry 0-1), L.A. Clippers 6-19 (Foye 3-6, Simmons 2-3, Williams 1-4, Griffin 0-1, Butler 0-1, Paul 0-4). Fouled Out-None. Rebounds-Golden State 43 (Lee 10), L.A. Clippers 56 (Evans, Griffin 12). Assists-Golden State 22 (Ellis 11), L.A. Clippers 21 (Paul 5). Total Fouls-Golden State 26, L.A. Clippers 20. Technicals-L.A. Clippers Bench. A-19,183 (19,060).
Monday, March 12, 2012
B
"/
Announcements North Lawrence Improvement Association Meeting - Monday Mar. 12 - 7PM at Peace Mennonite Church, 615 Lincoln. Guest speakers: Aimee Polson and Justina Gonzalez of Community Garden Program of Lawrence. Also discuss North Mass project behind Johnny’s and Chili Supper attendance. All Welcome! 785-842-7232
Education & Training Lead Teacher for full day Kindergarten Program. Full time position starting late May. Requires Elem. Ed. degree and relevant classroom teaching experience. Great work environment. Contact Hilltop Child Development Center, 1605 Irving Hill Road, 785-864-4940 or ppisani@ku.edu for application information. EOE
General 10 HARD WORKERS NEEDED NOW! Immediate Full Time Openings! 40 Hours a Week Guaranteed! Weekly Pay! 785-841-0755
Health Care CSL Plasma
CSL Plasma is now hiring LPNs and Paramedics for our Full Time Medical Staff Associate position. Duties include donor suitability examinations, management of donor reactions, and donor & staff immunizations. Current license and CPR certification required. CSL Plasma offers a fast paced, fun working environment with great benefits including no overnight shifts! Interested applicants please apply online at cslplasma.com.
Great Career Opportunities CSL Plasma has immediate openings for: Center Medical Director
Found Item FOUND Ipod Nano, case, buds & wrist watch on road, Lone Star area on 3/5/12. Call to identify 785-766-0551
AdministrativeProfessional
Found Pet/Animal FOUND dog, Sweet, white part pit bull, dark patch on right eye. Female? 80lbs.? Call 785-542-2329 to further identify. FOUND, Female calico-like cat Sunday. Really sweet cat. I’m guessing 7 to 9 months old. Found near high school area in Bonner 913-915-7304
Auction Calendar PUBLIC AUCTION Sun., Mar. 18, 10 am Knights of Columbus Club 2206 East 23rd Street Lawrence, KS D & L Auctions 785-766-5630
ESTATE AUCTION Sun., Mar. 18th - 9:00AM 2110 Harper, Bldgs. 1 & 2 Lawrence, KS DONALD & SHARON MITCHELL ESTATE Elston Auction Company Mark Elston 785-218-7851
Administrative Associate Senior
for KU College Office of Graduate Affairs. Three years office / clerical / administrative support experience required. Application deadline: March 20, 2012 For full position details and requirements and to apply visit: Search for position 00208622 EO/AA
AdvertisingMarketing Marketing Coordinator
ESTATE AUCTION Sun., Mar. 24th - 10AM 13586 South Adams Carbondale, KS CHARLES & LILA SHEPARD ESTATE Elston Auction Company Mark Elston 785-218-7851
DAYCARE AUCTION Sat., Mar. 17 - 10 AM 1st Baptist Church, Elliot Hall 410 S Hickory, Ottawa, KS GRIFFIN AUCTIONS Ottawa, KS 785-242-7891
GUN & ANTIQUE AUCTION Sun., Mar. 18 - 10 AM Franklin Co. Fairgrounds 17th & Elm, Ottawa, KS GRIFFIN AUCTIONS Ottawa, KS 785-242-7891
RETIREMENT FARM AUCTION Sat., Mar. 24, 2012, 10 AM 1509 N 1100 Road Lawrence, KS LEARY BROTHERS Flory Auction Service 785-979-2183
for Stephens Real Estate Responsibilities of this full time position include but are not limited to: • Coordination of weekly ad placement • Manage social media platform • Updating website content • Coordination of overall marketing allocations • General admin duties Strong interpersonal skills required. We offer competitive salary with benefits. To apply submit cover letter, resume, and references to: patmccandless @stephensre.com 785-841-4500
Automotive Automotive Service Manager
wanted for an immediate opening at Parks Motors of Augusta Kansas for the Chrysler, Dodge, Jeep and Ram dealership. Excellent base plus performance bonus with a leading dealership in the Wichita market (six figure potential for the right candidate). ADP system. Qualified candidates call John at 316-775-6365 or email resume to: john@parksmotors.com
Childcare
Education Enrolling Now for HVAC/R! Classes Starting Soon at Bryan College Call Today!
1-800-306-5170 om Accredited by ACICS
For useful consumer information, please visit us at. com/disclosure
Instruction and Tutoring Tutor, KS Certified Teacher M.Ed. accepting all ages, email kkb6214@gmail.com
Now Hiring for ECE center. Must be program director qualified for over 100 children. 785-856-6002 amy@googolsoflearning.com Seeking prof. & dependable assistant teacher who can make a long term commitment to our high quality preschool. Contact ksmontessori@yahoo.com
DriversTransportation
Route Carrier
New newspaper route available in between Lawrence & LeCompton. 7 days/week. Must be a reliable, dependable person & vehicle a must! Make $1500/mo. Must have valid driver’s license & insurance. Call 785-832-7249
CUSTODIAL GROUP LEADER Tues thru Sat 11 PM - 7:30 AM $11.25 - $12.58 Job description at: Applications available: Human Resources Office 3rd Floor, Kansas Union 1301 Jayhawk Boulevard EOE Lawrence, KS
DISTRIBUTION TEAM LEADER Team Leaders are responsible for handling the processing and bundling of newsprint products from the press to distributors; troubleshoot machinery; and assist with supervising and providing training to team members. Candidates must be available to work between the hours of 7 p.m. and 5 a.m. daily. We offer an excellent benefits package including health insurance, 401k, tuition reimbursement, paid time off, employee discounts, opportunities for career advancement and more! Background check, pre-employment drug screen, and physical lift assessment required. EOE
Full Time
Indoor/outdoor positions available. $400-600/wk For interview call 785-856-0355
NEEDED NOW 18-25 Full Time
CSR/appointment Setters $1,600 mo. +bonuses. Must start immediately. For interview call 785-856-1243
RN/LPN/CNA Warehouse and Delivery heavy lifting is required. $12 per hour. To apply call 785-331-2031 after 10:30AM
Health Care ComfortCare Homes of Baldwin City seeks Certified Medication Aides. Assist residents with ADLs, housekeeping, food preparation, activities and medications. Care is provided for residents with Parkinson’s, Alzheimer’s and other dementias. For application contact us at scottschultz@comfortcare baldwin.com DENTAL ASSISTANT EXPERIENCED Asst. needed for busy general practice. Benefits include 4 day week, health ins., 401K, health club mem. Call Dr Keith Jones off. at 785-841-0233
Sales-Marketing
We are looking for a Plasma Center Physician (4-6 hours per week) for our Lawrence plasma collection center. This position is a great fit for a MD or DO seeking to have a reduced and flexible work schedule OR supplement hours to a current practice. These consulting positions give you the perfect opportunity to oversee the Nurses/Medical Staff Associates within the center. You’ll review and sign Medical Staff Associate (RNs, LPNs/LVNs) notebooks weekly, approve or defer continued donations, review test results, conduct confidential interviews with donors to obtain information and train new Medical Staff Associates. Requirements: • MD or DO degree • Current CPR certification • Current, active medical license (no malpractice insurance needed) 2nd year medical residents are welcome to apply. To apply, visit our on-line application system at: KMC seeking MA/LPN for Derm Clinic in Lawrence. Mon. - Fri. Days. Previous out-patient clinic experience preferred. Free health, dental & life insurance provided. Resumes to: keakins@kmcpa.com FAX: 785-233-4669 PHONE: 785-295-0929
Student Health Services at the University of Kansas Lawrence campus has an immediate opening for a Medical Technologist. This position is for a full time, limited term, unclassified, benefits eligible technologist to work in a dynamic ambulatory student health center. Requires a bachelor’s degree from an accredited college or university in Clinical Laboratory Science or Medical Technology; or bachelor’s in a related field from an accredited college or university and completion of an approved Medical Technologist program; ASCP, or equivalent registry.For more information, a complete position description, and to apply, visit and search for position 00206991. Application deadline is 3/20/2012. EO/AA employer.
Mental Health Therapist
Elizabeth Layton Center has full-time opening for a master or doctorate level Kansas licensed mental health professional to work primarily with youth and families providing individual and family therapy services in the office and family home. Position is based in Ottawa, Kansas. Some evening hours & on-call required. Position open until filled. Submit interest & resume ELC - PO Box 677 Ottawa, Kansas 66067 kgladman@laytoncenter.org EOE
Hotel-Restaurant
Outside Sales Reps If you enjoy talking with people, working flex ible hours, and directly determining how much money you earn, then the Knology Direct Sales Representative role may be the ideal job for you! We offer a base salary with a generous commission plan (Earn up to $60K Per Year) along with a comprehensive benefits pack age that includes discounted Cable TV, Group Insur ance, 401k, Paid Time Off, And more! To find out more about this career opportunity go to to apply send resume to christina.phelps@knology. com EOE, Drug Free Work place
Schools-Instruction Para Educators
The East Central Kansas Cooperative in Education is accepting applications for full-time paraeducator positions in the Baldwin and Eudora School Districts. Salary range $8.80 $11.30, depending on education. Applications may be completed online at: or call 785-594-2737 if additional information EOE is needed.
Social Services COF Training Services, Inc. a 44 year old not-for-profit organization that provides services to people with developmental disabilities in Coffey, Osage, Franklin counties, is seeking a REGISTERED NURSE to provide and coordinate nursing and medical services to the people we serve in our three county area. COF provides competitive wages and excellent benefits. Please submit a cover letter and resume with names and contact information of three references by March 26, 2012, to the attention of: Executive Director, PO Box 459, Ottawa, KS 66067
Entry level Quality Control position in the food industry. Seeking organized individual with an aptitude in science. Apply in person. 1992 E 1400 Rd, Lawrence, KS 785-841-6016.
HALLMARK 100 Temporary Hand Work Positions 2nd shift -4:00pm to 12:30am 3rd shift - 12:00am to 8:30am $9.25/hr - 2nd shift $9.50/hr - 3rd shift *Incentive Plan to earn more $$$ based upon attendance* *Opportunity to work overtime*
Requirements • Ability to multi-task and sit for 8 hours • High level of hand dexterity •Ability to focus and work repetitively • Excellent Attendance and Punctuality a must • Relevant experience and references required
1 & 2BRs start at $400/mo. * Near campus, bus stop * Laundries on site * Near stores, restaurants * Water & trash paid 4BR duplex - start at $795 —————————————————— Get Coupon* for $25 OFF
EACH MONTH’S RENT
*Sign lease by Mar. 31, 2012 AND College Students
Apartments Unfurnished
2BR — 1305 Kentucky, in 4-plex. CA, DW. No pets. $450/mo.
GET 10% DISCOUNT
2BR — 934 Illinois, In 4-plex, 1st floor, DW. $490/month. No pets. Call 785-841-5797
785-843-1116
Parkway Terrace
—————————————————— CALL TODAY (Mon. - Fri.)
2340 Murphy Drive 1 & 2BR Apts., $450 - $500.
Applecroft Apts. Campus Location
Studio, 1 & 2 Bedrooms Gas, Water & Trash Paid
785-843-8220
chasecourt@sunflower.com
Now & For Fall.
Clean and roomy with on-site laundry.
Call TODAY for GREAT Deals! 785-841-1155
RENT SPECIAL!
2BR starting at $580 W/D included. Pool
The Woods of Old West Lawrence 785-841-4935 2-4BR, 1310 Kentucky. Near KU. $595 - $1,200/mo. $200 $400 Deposit. 785-842-7644
BRAND NEW One Month FREE Tuckaway at Frontier 542 Frontier, Lawrence 1BR, 1.5 bath 2BR, 2.5 baths Rent Includes All Utilities. Plus Cable, Internet, Fitness & Pool. Garages Available Elevators to all floors
Reserve YOURS for Spring/Fall
Call Today 785-856-8900
Canyon Court Apts
LEASING FOR FALL! Luxury 1, 2 & 3 BR 700 Comet Ln. 785-832-8805
ASHBURY TOWNHOMES
Near K-10, W/D hookups & fenced courtyard. 2BRs Avail., 1 with garage
MOVE IN SPECIALS
Call NOW 785-842-1322
Chase Court Apts.
Apartments, Houses & Duplexes. 785-842-7644
1 & 2 Bedrooms
Great Locations! Great Prices! 1, 2 & 3 Bedrooms
Call for SPECIALS
785-838-3377, 785-841-3339
Campus Location, W/D Pool, Gym & Small Pet OK
785-843-8220
HIGHPOINTE APTS
Fall & Immediate Avail.
Sunrise Place Sunrise Village
Apartments & Townhomes 2, 3 & 4BRs
Now Leasing for 2012!
Call for Specials! 2 Bedrooms near KU. Pool, microwave, DW, and laundry facilities 837 MICHIGAN 3 & 4 Bedrooms FREE wireless internet, DW, W/D, pool, on KU bus route. Some with garages. 660 GATEWAY COURT
Call 785-841-8400
Studio, 1, 2 & 3 BRs
Fast, Reliable Maintenance On-site Management Close to KU, 3 Bus Stops
Bob Billings & Crestline
785-842-4200
Rentals Avail. Now!
1BR - $600, 2BR - $700, 3BR - $800 Small pets allowed. On bus route, reserved parking, pool, playground, total electric, and washer, dryer & DW in every unit.
YOUR PLACE, YOUR SPACE Spring Into Action
Start at $495 One Bedroom/studio style Pool - Fitness Center -On-Site Laundry - Water & Trash Pd.
785.856.7788
——————————————————————————— -
——————————————————————————— -
Also, Check out our Luxury Apartments & Town Homes!
——————————————————————————— -
EOH
3BR — 1131 Tennessee, 1st floor, 1 bath. Avail. now. No pets. $650/mo. 785-841-5797
CAMPUS LOCATIONS! 1, 2, 3 BRs
Briarstone Apts.
1010 Emery * 785-749-7744
1 - 4 BRs
Garages - Pool - Fitness Center • Ironwood Court Apts. • Park West Gardens Apts • Park West Town Homes • Homes at Monterey Bluffs and Green Tree Call for more details 785.840.9467
PARKWAY COMMONS 1, 2 & 3 Bedrooms
Now Leasing for Fall 2012! W/D, Pool, Small Pet OK! pwc@sunflower.com 785-842-3280 2BR — 1017 Illinois. 2 story, 1 bath, CA, DW. $500/mo. No pets. Call 785-841-5797
Westgate
4641 W. 6th, Lawrence behind Blockbuster
785-842-9199
LAUREL GLEN APTS
Call 785-838-9559
Available Spring 2012
PERFECT for Serious Students and/or GREAT for Families.
Take advantage of our rent specials while they last! 2 & 3BR units, all elect., water/trash pd. Sm. dog and students welcome! Income restrictions apply
PARKWAY COMMONS SPECIAL!!! 3BR, 2 Bath - Just $795
For Immediate Move In! pwc@sunflower.com 785-842-3280
DOWNTOWN LOFT
Studio Apartments 600 sq. ft., $675/mo. 825 sq. ft., $855/mo. No pets allowed Call Today 785-841-6565
advanco@sunflower.com -
Studios & 1BRs for Aug. 1. 1/2 block to KU. $400-$525. GAS/ WATER PAID. 785-842-7644 2BR — 2400 Alabama, 2nd floor, 1 bath, AC, DW, laundry on-site. $490/mo. No pets. Call 785-841-5797
3-4BR, 1028 Ohio. Lovely home great for family, near Studios — 2400 Alabama, all KU/downtown. Low utils. elect., plenty of parking, AC, Has study, appls., parking. laundry. $390, water/cable paid. No pets. 785-841-5797 $1,305/mo. 785-979-6830
Regents Court
Furnished 3 & 4BRs Washer/dryer included 19th & Mass., on bus route
Ask about 2-person Special! 785-842-4455
Sunrise Terrace — 10th & Arkansas, so close to KU! 2BR w/study or 3rd BR, 2 full bath, CA, DW, laundry, some with W/D, lots of parking. $550 - $750/mo. No pets. 785-841-5797
Must pass a drug screen and background check For immediate consideration, apply at eapp.adecco.com Select Lawrence 66044 Must use Internet Explorer
100 E. 9th Street Lawrence, KS 66044 785-842-1515 EOE Laborers and Truck Driver needed for day and night positions. Local company looking for laborers. No Skills required but forklift experience a plus. Please apply in person. 1992 E 1400 Rd, Lawrence, KS 785-841-6016. environment as well as competitive salaries and excellent benefits. We are seeking experienced professionals with skills and qualifications in the following area: Job # 12-0011 – Technician, Corrosion – Tonganoxie, KS For more information on this position regarding complete job description and details for applying, please visit Working Locations: Tonganoxie, KS Website: Deadline: March 16, 2012 How to apply:
Apartments Unfurnished
Mowing Crew help wanted. Must have expe- 1BR — 810 E. 14th, 1 story, rience, reliable transporta- CA, W/D hookup, DW, $430/ mo., 1 pet ok. 785-841-5797 tion. 785.749.1141
Part-Time
Crossgate Casita’s
WorldClassNEK.com
2411 Cedarwood Ave. Beautiful & Spacious
chasecourt@sunflower.com
DESOTO PIZZA HUT Drivers, Cooks, Waitstaff wanted. Apply at the DeSoto Pizza Hut located at 34080 Commerce Drive or call 913-585-1265
Landscaping & Lawn
Apartments Unfurnished
Cedarwood Apts
WarehouseProduction
KU Medical Technologist
Apartments Unfurnished
SHIPPING CLERK: Attention New 1BR - $540/mo. Open to detail, strength to carry Mon.-Sat. Noon-4pm, 2451 heavy boxes, own trans- Crossgate Dr. 785-760-7899 portation required. 15 hours per week, $8.00 per hour. Send cover letter and 1BR — 740 Massachusetts, resume to EEI, P.O. Box above Wa Restaurant, big 1304, Lawrence, Kansas, windows, 1 bath, CA. $750/ mo. No pets. 785-841-5797 66044.
If you have qualifications we need, want a job that uses your existing skills and encourages you to develop new ones, provides varied work challenges, and allows you to work with a great group of people, this position might be a perfect fit. Please forward your resume, which should provide evidence of how you meet each minimum requirement mentioned and any preferences listed, to: SSCGP HR Department, Job Postings, PO Box 20010, Owensboro, KY 42304 or e-mail your resume to jobs@sscgp.com. You must include the Job# identified above or your resume will not be considered.
NO PHONE CALLS PLEASE SSCGP is AN EQUAL OPPORTUNITY EMPLOYER We thank all applicants for their interest, but we will only respond to those candidates selected for interviews.
Duplexes 2BR, handicap accessible, wheel chair ramps, W/D. In 4-plex on quiet st. $560/mo. Available now 785-218-1413 Apartments, Houses & Duplexes. 785-842-7644
Office Space Office Space Available
at 5040 Bob Billings Pkwy.
785-841-4785
Retail & Commercial Space 2859 Four Wheel Drive
Townhomes Use Tax Refund to Invest in a Co-op
1, 2, & 3BR townhomes in Cooperative. Units start)
Studio/office, Wi-Fi avail., private bathroom, 697 sq.ft. 785-842-5227 for more info Prime Commercial Property on Wanamaker Road, close to 29th Street in SW Topeka, KS. Approx. 3,000 sq. ft. Call 785-271-6060
PARKWAY 4000
Move-In Specials! • 2BRs available now • 2 Bath, W/D hookups • 2 Car garage w/opener • New kitchen appliances • Maintenance free 785-749-2555/785-766-2722 2 Bedrooms $550-$800/mo.. $685/mo. 785-842-5227 HAWTHORN TOWNHOMES 2 & 3 Bedroom Townhomes Now leasing for Fall 2012! Pet under 60lbs OK! pwc@sunflower.com 785-842-3280
LUXURY LIVING AT AFFORDABLE PRICES
RANCH WAY TOWNHOMES on Clinton Pkwy.
Acreage-Lots
Wooden Kitchen Table w/ Chairs, Heavy 41in. square fancy table chairs. $75 for table, $25 for each chair. good condition. Please call 785-550-4142
Owner Carry Call Joe 785-633-5466 McGREW REAL ESTATE 785-843-2055 5 Acres 10 minutes south Quality home in area. Call Mike Flory (785) 843-4798
Cars-Imports
Nissan 2011 Versa Don’t buy new! Save thousands with these great commuter cars! 2 to choose from starting at $13,400 stk#12767 Dale Willey 785-843-5200
Buick 2005 Century V6, 20-30MPG, Auto, FWD, Cloth, CD, Cruise, Wow 65K, $7500 View pictures at 785.856.0280 845 Iowa St. Lawrence, KS 66049
Nissan 2010 Versa 1.8 S 30K, Brilliant Silver etallic, Swear By Your Car, Not At It! 785-841-0102
Table, Great for train or slotcar track. $100. Extra to delivered. 402-216-7366 Lights, Alzak Metalite recessed lights. Set of 3. Worked fine when removed during remodel. $30/offer. 785 979 2312.
Machinery-Tools
Ladder, 20 ft Extension Lad2 Room unfinished cabin w/ der for $50. Please call loft, on lg. lot in Lake Shore 785-841-1239. Estates, Lake Perry. Repo, assume owner financing Miscellaneous with no down payment. $257 monthly. 785-554-9663 BBQ, The very best Weber Charcoal BBQ. Used twice 3 - 6 acres, includes pond, we went to Gas. Excellent On Hwy. 40 near Big condition. They are selling Springs. Owner will trade for $172, asking $75. and/or finance with no Please call 785-550-4142 down payment. From $171 per month. 785-554-9663 Church bench, 4 ft., painted Douglas County 10 - 50 acres, hilltop, wooded - Lecompton. Shawnee 6 acres in exclusive area 8 ac./sm. bldg. Forbes Field Osage County 7 - 80 acres 10 min. South of Topeka, farm Income
Cars-Imports
white, $30. GE refrigerator - 20.6 cu. ft., $125, excellent condition. TV tristero w/ drawers in bottom - $100. 2 fisher speakers. - $20. Call 785-830-9048
Dog House, Top Paw two piece plastic dog house. Good condition. 29” long x24” wide x 17” high. $50 cash only. 785-843-7980 Fish tank w/stand, Floval 305 Filteration. Lots of extras food, floval medium and water tester w//5 tests. Will deliver for $20. extra fee $100. Ron 402-216-7366
Fishtank w/stand, 20 gallon tank, with light bulb, 6 acres w/3 Martin Bldgs., 2 filter, and all accessories. lg. barns, silo,smokehouse, $100. 785-764-3643 with utils. Near Big Springs Garage Door Opener, 1/3 /Hwy 40. 785-554-9663 HP motor. Remote, single McGREW REAL ESTATE car delivered, $75. 785-843-2055 785-832-2266 320 Acres SW of Lawrence. Divided into 4 parcels. Has Need for St. Patrick’s Day older home and out-bldgs. Parade? Long-stemmed Mike Flory (785) 843-4798 clay tobacco pipe. $20. 785-843-1378 after 6PM. Sony Portable DVD Player, with remote and charger, like New, $100. 785-764-3643
Half Off Deposit
Gage Management 785-842-7644
Chevrolet 2007 HHR 63K, Dark Blue Call Now! 785-841-0102
Chrysler 2010 300 Touring Inferno Red, 36K Enjoy a “Fear Free” Car Buying Experience at 785-841-0102
.
GMC 2009 Acadia SLT, sunroof, abs, remote start, alloy wheels, On Star, Bose sound, very nice! Stk#490711 only $26,499. Dale Willey 785-843-5200
Honda 2009 Accord EX 52K, Alabaster Silver Love Your Car! Apply On-Line At 785-841-0102
Dale Willey Automotive 2840 Iowa Street (785) 843-5200
Nissan 2008 350Z Nismo, 6sp, one owner, very sharp! You have got to see this one, come on in for a test drive! Stk#564932 . Dale Willey 785-843-5200
Call for Details
625 Folks Rd • 785-832-8200
Houses
STEEL BUILDINGS -Save TV-Video Thousands on 2011 Closeouts!! Limited availability, TV, Magnavox 20” bedroom 20x30, 30x40, others. Save color TV delivered. Excel$$$, buy now for spring. lent, $85. 785-832-2266 Discounted shipping. Display savings also! Call 866-352-0469
1st Class, Pet Friendly Houses & Apts.
Computer-Camera
HAWTHORN HOUSES
Android Pad, 7 inch Android pad, (Tablet) iT comes with various Apps $98 Call 785-843-1425 785-842-1069
2 & 3 Bedroom Houses
Care-ServicesSupplies
Batteries & two rechargers, (one is charger Training Classes - Lawrence CG-580) for Canon 50D. Jayhawk Kennel Club, 6 Used 2 Canon batteries wks. $70. Enroll online, or call and 6 generic batteries. Call 785-842-5856 deadline 3/22. 3BR, 1 bath, 1 car garage w/ $50 cash only. opener, range, refrig., W/D 785-843-7980. hookups. $795/mo. Deposit Digital Pianos! & Refs. Call 785-749-3840 Hundreds of sounds, rhythms & features. 3BR, 1603 Lindenwood Lane. Record directly to CD! 1 bath, carport. $700/mo. piano4u.com 800-950-3774 Available April 1. Contact Heritage Realty 785-841-1412 Now leasing for Fall 2012! Pet under 60lbs OK! pwc@sunflower.com 785-842-3280
1628 W. 19th Terrace
Avail. NOW. 4BR + study, 2 car garage, fenced yard. finished bsmt. $1,600/mo.
785-841-4785
4BR, 2 bath, lg. farm house at 16810 110th, Oskaloosa. DR, lg. LR, office. $750/mo., $750 deposit. 785-393-0260
Furniture Cherry, oak, mahogany, pecan, ebony, walnut… we have a piano that will match your décor! 800-950-3774 piano4u.com
785-841-4785 garberprop.com
Apartments, Houses & Duplexes. 785-842-7644
Near Stadium/Downtown Premium Rental
Updated 3BR, 2 bath with eat-in kitchen, stainless appls., W/D, deck, & lawn care. More properties are available. $525 - $550/BR. For Aug. 1st 816-686-8868
Pontiac 2009 Torrent AWD, V6, alloy wheels, roof rack, ABS, very sporty, stk#194281 only $15,841. Dale Willey 785-843-5200
Livestock
Livestock Sale: 1st Annual Angus Bull & Female Sale. Wed., Mar. 21, 2012 6:30PM. Overbrook Livestock Commission Co., Overbrook, KS. May-Way Farms, Woodbury Farms. For more info visit: 785-979-2183, 785-214-0560
Brand New
Single Family Homes 4 & 5 BRs - Avail. Now 2,400 -3 ,300 sq. ft. $1,800 - $2,200 month Garber Property Mgmt.
Pontiac 2007 Grand Prix GXP, V8, local trade, leather, sunroof, remote start, Monsoon sound, XM, On Star, very nice! Stk#537472 only $16,755. Dale Willey 785-843-5200
Saturn 2008 Outlook XR leather heated memory seats, remote start, alloy wheels, 22 mpg with room for 7, GM certified and more. Stk#10044 only $22,850. Dale Willey 785-843-5200
Sport Utility-4x4
Chevrolet 2009 Cobalt LT, FWD, 4cyl, great commuter car! Alloy wheels, power equipment, great gas mileage! Stk#397901 only $10,774 Dale Willey 785-843-5200
.
Saturn 2008 Astra XR 49K, Arctic White Want Something Special? 785-841-0102
Honda 2010 Accord EXL, one owner local trade, sunroof, leather heated seats, alloy wheels, very nice! Stk#306421 only $19,326. Dale Willey 785-843-5200
Chevrolet 2008 Equinox AWD V6 LT, very hard to find, alloy wheels, On Star, GM Certified! Two years of maintenance included! Stk#18192 only $19,415. Dale Willey 785-843-5200. Nissan 2001 Altima Limited Edition. Super clean car in silver with gray clean cloth. Automatic, four door with great gas mileage, all for under $5400.
Volkswagen 2008 Rabbit 48K, 4 Door, Silver Apply On-Line
Chevy 2007 Equinox AWD LS, V6, alloy wheels, steering wheel controls, On Star, cruise control, power equipment and affordable. Only $14,855. stk#10266 Dale Willey 785-843-5200
Jeep 2005 Liberty Sport 4WD, 67K, White CALL NOW!!! 785-841-0102
KANSAS
Jack for Junkers TRADE-IN WORTH Ford 2008 Escape XLT 4cyl, fwd, ABS, traction control, cd changer, alloy wheels, power equipment, great gas mileage, stk#564292 only $15,776. Dale Willey 785-843-5200
Kia 2010 Sportage LX Black Cherry, 49K Lifetime Engine Warranty? Yes!!! 785-841-0102
$4500.00 NEXT 7 DAYS
•••
Here is what you need to know!
“Kansas Jack for Junkers”
Scion 2008 xD 41K, Barcelona Red Apply On-Line At 785-841-0102
Scion 2009 XD, 35K Silver, 4 Door Hatch-back, 785-841-0102
Volvo 2007 S-60 2.5T, leather, sunroof, alloy wheels, power equipment, stk#12542 only $17,441. Dale Willey 785-843-5200
Ford 2001 Explorer Sport, LOW miles, excellent condition. Leather, Moonroof, 4x4. Nice tires on alloy wheels. Excellent student car! See website for photos. Rueschhoff Automobiles rueschhoffautos.com 2441 W. 6th St. 785-856-6100 24/7
Jeep 2008 Commander 70K, Black Lifetime Engine Warranty! 785-841-0102
Are You Listening?
Volvo 2003 S80 T6, FWD, Twin Turbo V6, 1owner, Leather, Moon, 17” Alloy, 101K, $9500 View pictures at 785.856.0280 845 Iowa St. Lawrence, KS 66049
Chevrolet 2006 Trailblazer 74K, White 4X4, Call Today! 785-841-0102
Ford 2009 Escape XLT 52K, Dark Blue Grey See Us Today! Apply On-Line At 785-841-0102 785-841-0102
KIPP’S TREASURES
LUXURY TOWNHOMES
Subaru 2008 Outback AWD 2.5I, V6, power equipment, cruise control, alloy wheels, very sharp! Stk#18412 only $19,877. Dale Willey 785-843-5200
Cadillac 2005 SRX 76K, White Diamond See Us Today! Apply On-Line At 785-841-0102
Toyota 2006 Camry LE 65k, Dark Grey Metallic From Lawrence’s Favorite On-line Dealership!
Dodge 2007 Magnum Stone White, 57K. Love Your Car! 785-841-0102
Buick 2008 Enclave CXL, fwd, room for seven, premium wheels, remote start, sunroof, leather heated seats, navigation, Bose sound and much more, stk#494541 only $24,995. Dale Willey 785-843-5200
Rueschhoff Automobiles rueschhoffautos.com 2441 W. 6th St. 785-856-6100 24/7
Speakers, Set of 4 Valcom Paging ceiling surround sound speakers. All Antiques worked when removed 3BR, 1.5 bath, N. Michigan St. during remodel. Ivory. Toyota 2009 Camry LE, (Woodcreek). Hardwood welcome. Ford 2007 Mustang GT, very dependable, power floors, deck, bsmt. $775. Glasses, Set of 12 Frosted Offers Glasses with “Antique Au- 785-979-2312. equipment and much 61,000 miles, auto., red 785-841-5454, 785-760-1874 tos” Design for $100. Excelmore, stk#681121 only with black stripe, $17,000. Teacher’s Toolbox, Books, 660-238-9988. lent condition. $16,436. 2BR, in a 4-plex. New carBig Books, games, Manipu785-841-1239. Dale Willey 785-843-5200 pet, vinyl, cabinets, counlatives $20. 785-393-1992 tertop. W/D is included. Glasses, Set of 8 Kansas Honda 2008 Accord LX $575/mo. 785-865-2505 Centennial frosted glasses Music-Stereo sedan, 4cyl, great gas Toyota 2001 Camry LE. in excellent condition for mileage, ABS, power Very nice clean sedan for $70. Call Sandy at 25” Keyboard Kawai equipment, front wheel AVAIL. Now age. Burgundy with clean 785-841-1239. MS710, 576 variations plus drive, stk#197361 only 3BR, 2 bath, major appls., gray cloth. Four cylinder Ford 2008 Taurus Limited recorder, $95. 785-832-2266 $14,755. FP, 2 car. 785-865-2505 automatic for great gas AWD one owner, only 14k Dale Willey 785-843-5200 economy. Hard to find nice miles, leather heated Casio Keyboard, 36” used Camrys. This is one. 3BR Townhomes Avail. seats, alloy wheels, CTK530, 64 Rhythms plus 423B E 4th Street See website for photos. steering wheel controls, tones, $98. 785-832-2266 Adam Ave. Rueschhoff Automobiles Tonganoxie, KS 66086 home link, very nice! 2 bath, 2 car, 1,700 sq. ft., rueschhoffautos.com 913-704-5037 Stk#343681 only $17,869. Grand pianos from $3288 some with fenced yards, 2441 W. 6th St. Antiques, Collectibles, Dale Willey 785-843-5200 Honda 2007 Fit Sport $995/mo. Pets okay with for your new home! 785-856-6100 24/7 Glass, Furniture, Treasures 64K, Nighthawk Black paid pet deposit. Mid-America Piano Call Today! Manhattan 800-950-3774 Ford 2003 Taurus SE. Nice Baby & Children 785-841-0102 reliable, economical Tau785-841-4785 Items rus at a great price. Small Toyota 2008 Corolla S Jump start your child’s 2003 I35. Pearl V6 and clean inside. See Infiniti 38K, Silver Streak future! white with tan leather and Adjustable In-line Ad website for photos. This One’s Got A 5 The Piano increases moonroof, very popular Skates, In good condition, Rueschhoff Automobiles Speed!!! concentration, coordination combination. Essentially child sizes 10 to 13, easy to rueschhoffautos.com & is a lifelong gift. same car as a Maxima, but adjust, $5. Please call 2441 W. 6th St. 785-841-0102 piano4u.com 800-950-3774 fancier. Very nice sedan 785-749-7984. 785-856-6100 24 4/7 w/famous Nissan V6, and Rug, Children’s 3 by 4 foot automatic. A great buy! NEW TOWNHOMES Oak Yamaha Console Piano play rug. Hardly used. Col- Great Condition! $3900 OBO See website for photos. AT IRONWOOD ors very bright. Provides Rueschhoff Automobiles Call 785-537-3774 for more * 4BR, 2LR, 2-Car Garage lots of entertainment. See Toyota 2008 Yaris rueschhoffautos.com details. * Kitchen Appls., W/D photo image online $10. 79K, Meteorite Gray 2441 W. 6th St. * Daylight/Walkout Bsmt. Call 785-843-0333 Great Selection 785-856-6100 24/ /7 * Granite Countertops Of 2 Doors AND 4 Doors! Rug, Children’s 3 by 4 foot Jaguar 2007 X-Type All Apply On-Line at Showings By Appointment play rug. Hardly used. ColWheel Drive. Local car, ex ors very bright. Provides tremely clean and well 785-841-0102 lawrence.com lots of entertainment. See equipped. Cream leather Call 785-842-1524 photo image online $10. interior with heated seats. Call 785-843-0333 Traded in on newer Jaguar. 3BR, 2 bath, 2 car, FP, NW Beautiful Dark Chili Red, No pets. Available Now. like new condition. Great Ford 2002 Thunderbird Volkswagen 2008 Jetta Bicycles-Mopeds $900/mo. Call 785-865-6064 price! See website for pholocal trade, very sharp, 60K, Platinum Grey tos. only 25k miles, alloy Full Power, Off-Lease, Bike Saddle, Brooks Pro. Rueschhoff Automobiles wheels, cd changer, Call TODAY! (1970 leather, excellent) Apartments, Houses & rueschhoffautos.com power equipment, $75. 785-843-1378 after Duplexes. 785-842-7644 2441 W. 6th St. stk#56689B1 only 785-841-0102 6PM. 785-856-6100 24/7 7 $20,850. Dale Willey 785-843-5200 Kia 2008 Spectra EX. ONE Building Materials Over 10 Steinway Grands PARKWAY 6000 owner, NO accident, very Models A, B, M, O, S clean four door automatic. CALL FOR SPECIALS! Architectural Salvage, Verticals available too! Volkswagen 2009 Still has factory warranty! • 3 Bedroom, 2 bath 1930’s clear glass door Mid-America Piano New Beetle 32 MPG highway and side • 2 car garage w/opener knobs. $10/pair. piano4u.com 800-950-3774 42K, Candy White, airbags. Lot of car for un• W/D hookups 785-843-1378 after 6PM. Now More Than Ever, der $10k. See website for • Maintenance free Apply On-Line At photos. (3) 2 Baldwin Architectural Salvage, Art Pianos, 785-832-0555, 785-766-2722 Rueschhoff Automobiles Deco door escutchons, kite Acrosonics and 1 Winter 785-841-0102 rueschhoffautos.com Co. Spinet, $475-575 Price shape, chromed brass, 25 2441 W. 6th St. Saddlebrook & for $100. 785-843-1378 after includes tuning & delivery. 785-856-6100 2 4/7 785-832-9906 Overland Pointe 6PM.
GREAT Move In Specials
MONDAY, MARCH 12, 2012 /B Crossovers
.
Farms-Acreage
3BR, 2 bath, $820-$840 2BR, 1 bath, $760/mo.
Crossovers
Vintage hideabed sofa $75: Green, brown & yellow plaid. Used very little never slept on. Some damage from cat claws, fix w/ arm covers included 785-842-5528
Clipper 4 dog crate, Excellent condition. 27 (long) x 20 (high) x 19 (wide). $50 cash only. 785-843-7980
Mobile Homes
Cars-Domestic
Recliner. Almost new leather electric recliner. Paid $1,000, asking only $300. 785-865-0747
Household Misc.
OWNER WILL FINANCE 3BR, 2 bath, CH/CA, appls., shed, clean, move in ready! Lawrence 816-830-2152 2BR, 2 bath, fireplace, CA, W/D hookups, 2 car with opener. Easy access to I-70. Includes paid cable. Pets under 20 lbs. allowed Call 785-842-2575
Furniture
We are now your Chevrolet dealer, call us for your service or sales needs! Dale Willey Automotive
We believe everyone deserves a nicer, newer car and no one should have to drive a car they hate!! “Dealer For the People”
1527 W. 6th St.
785-841-0102
We buy cars, trucks and suvs for all Import Brands. Call David 785-838-2327
Cars-Domestic Listen to your favorite artists perform in your home with a player piano. Ask about adding one to your current piano. 785-537-3774 Mattresses, Two Twin extra long box spring mattresses; never used, use for seperate beds or for a King Size mattress. Asking $25 each, please call 785-550-4142
Chevrolet 1979 Caprice, 137K, mint condition, new tires, New AC compressor, No rust, always garaged. Call 785-255-4579
Chevrolet 2007 Cobalt Victory Red, 84K Clean, Local Trade-In Apply On-Line At 785-841-0102
WE BUY CARS Top dollar for top late model vehicles. Drive in, see Danny or Jeff and get your big bucks today! 2840 Iowa St. Lawrence. Dale Willey 785-843-5200
T"# S#&#'()*+
Premium selected automobiles Specializing in Imports 785-856-0280 “We can locate any vehicle you are looking for.”
GM CERTIFIED is not like any other dealer backed warranty. Don’t let the other dealers tell you any different. Dale Willey Automotive is the only dealer in Lawrence that GM Certifies their cars and trucks. Come see the difference! Call for details. 785-843-5200 ask for Allen
2829 Iowa St.
!B #$%DAY, #AR,- 12, 2012
BUSINESS Auctioneers
Carpets & Rugs
BILL FAIR AND COMPANY AUCTIONEERS SINCE 1970 800-887-6929
Automotive Services Auto Maintenance and Repair
Concrete
Foundation Repair
CONCRETE INC. Your local concrete repair specialists Sidewalks, Patios, Driveways
Quality work at a fair price!
ADVANCED SYSTEMS Basement & foundation repair Your hometown company Over three decades 785-841-0145 mybasementiscracked.com
Decorative & Regular Drives, Walks & Patios Custom Jayhawk Engraving Jayhawk Concrete 785-979-5261
CONCRETE INC Your local foundation repair specialist! Waterproofing, Basement, & Crack Repair
1-888-326-2799 Toll Free
IT’S BACK!
FREE CARPET INSTALLATION
One room or your whole house.
IT’S FREE! All the latest styles and most popular colors!
Driveways, Parking Lots, Paving Repair, Sidewalks, Garage Floors, Foundation Repair 785-843-2700 Owen 24/7
Many IN STOCK for Fastest Service!
0% Easy Payments*.
785-842-8665
Limited Time Only!
Jennings’ Floor Trader
3000 Iowa - 785-841-3838 Pre-Shop online at “local store” tab
*Details in Store. Facebook too!
Thicker line? Bolder heading? Color background or Logo? Ask how to get these features in your ad TODAY!! Buying Junk & Repairable Vehicles. Cash Paid. Free Tow. U-Call, We-Haul! Call 785-633-7556
Dale and Ron’s Auto Service
Family Owned & Operated for 37 Years Domestic & Foreign Expert Service 630 Connecticut St
785-842-2108
Catering Oakley Creek Catering - Full Service Caterer Specializing in smoked meats & barbeque
- Corporate Events, Private Parties, Weddings-
On-Site Cooking Available Family Owned & Operated
785-887-6936
Cell Phone Service & Repair WIRELESS RESTORE
CELL PHONE REPAIR Buy * Sell * Repair * Smart Phones Tablets Gaming Systems 2201 W 25th St.
785-424-5960
lawrencemarketplace.com/ wirelessrestore
Staining & Engraving Existing Concrete Custom Decorative Patterns Patios, Basements, Garage Floors, Driveways 785-393-1109
Decks & Fences Looking for Something Creative? Call Billy Construction Decks, Fences, Etc. Insured. (785) 838-9791
Guttering Services
DECK BUILDER
Over 25 yrs. exp. Licensed & Insured Decks, deck covers, pergolas, screened porches, & all types of repairs Call 913-209-4055 for Free estimates or go to prodeckanddesign.com
Quality work at a fair price!
1-888-326-2799 Toll Free
Concrete, Block & Limestone Wall Repair, Waterproofing Drainage Solutions Sump Pumps, Driveways. 785-843-2700 Owen 24/7
FOUNDATION REPAIR
Across The Bridge In North Lawrence 903 N 2nd St | 785-842-2922 lawrencemarketplace.com/ battery
Harris Auto Repair
Domestics and Imports Brake repair Engine repair AC repair / service Custom exhaust systems Shock & Struts Transmissions Tire sales / repairs
For Everything Electrical Committed to Excellence Since 1972 Full Service Electrical Contractor
Get Lynn on the line! 785-843-LYNN lynncommunications
Employment Services
Cleaning
Serving individuals, farmers & business owners 785-331-3607
LawrenceMarketplace.com/ kansasinsurance
Roger, Kevin or Sarajane
785-843-2244. com/scotttemperature
Landscaping
1210 Lakeview Court, Innovative Planting Design Construction & Installation. com/lml
Fast Quality Service
785-550-5610
For all your Heating, Air Conditioning and Plumbing needs
Plan Now For Next Year • Custom Pools, Spas & Water Features • Design & Installation • Pool Maintenance (785) 843-9119
Serving the Douglas & Franklin county areas
General Services
midwestcustompools.com
785-594-3357
Green Grass Lawn Care Mowing, Yard Clean-up, Tree Trimming, Snow Removal. Insured all jobs considered 785-312-0813/785-893-1509
Home Repair Services Interior/Exterior Carpentry, Vinyl siding, Roofing, Tearoff/reroof. 35 yrs. exp. Free est. 913-636-1881
Call to schedule a ride: 843-5576 or 888-824-7277 Monday - Friday 7:30 am - 3:30 pm We ask for $2.00 each way.
JC PRO-MOWERS 785-248-4178 (TEXT TOO) RESEEDING $150 S/H MULCH, MOW & MORE AERATION & FERTILIZE $60. (Seniors Discount)
JASON TANKING CONSTRUCTION New Construction Framing, Remodels, Additions, Decks Fully Ins. & Lic. 785.760.4066 place.com/jtconstruction
Funded in part by KDOT Public Transit Program
Tires for anything Batteries Brakes Oil Changes Fair and Friendly Customer Service is our trademark 2720 Oregon St. 785-843-3222 Find great offers at
Lawrencemarketplace.com/ kstire
Tires, Alignment, Brakes, A/C, Suspension Repair Financing Available 785-841-6050 1828 Mass. St lawrencemarketplace.com/ performancetire
Westside 66 & Car Wash
Full Service Gas Station 100% Ethanol-Free Gasoline Auto Repair Shop - Automatic Car Washes Starting At Just $3 2815 W 6th St | 785-843-1878. com/westside66
Carpet Cleaning
Janitorial Services Business-Commercial-Industrial Housecleaning Carpet Cleaning Tile & Grout Cleaning The “Greener Cleaner” Locallly Owned Since 1983 Free Estimates
785-842-6264
LawrenceMarketplace.com/ bpi
Mowing...like Clockwork! Honest & Dependable Mow~Trim~Sweep~Hedges Steve 785-393-9152 Lawrence Only
Int. & Ext. Remodeling All Home Repairs Mark Koontz
ROCK-SOD-SOIL-MULCH
Bus. 913-269-0284
Eco-Friendly Cleaning
Five yrs. exp. References, Bonded & Insured Res., Com., Moveouts 785-840-5467
785-842-3311
For Promotions & More Info:. com/kansas_carpet_care
Give your sweetie the gift of cleaning.
Gift Certificates Avail. Family owned and operated since 1992
Sue Bee’s Cleaning 785-841-2268
Housecleaner
Spring Cleanup
Full Remodels & Odd Jobs, Interior/Exterior Painting, Installation & Repair of: Temporary or Contract Staffing Evaluation Hire, Direct Hire Professional Search Onsite Services (785) 749-7550 1000 S Iowa, Lawrence KS lawrencemarketplace.com/ express
Marty Goodwin 785-979-1379
Decks Drywall Siding Gutters Privacy Fencing Doors Trim
Medical-HealthTherapy
Inside - Out Painting Service Complete interior & exterior painting Siding replacement
785-766-2785
Mobile Enviro-Wash LTD
inside-out-paint@yahoo.com Free Estimates Fully Insured Lawrencemarketplace.com/ inside-out-paint
785-842-3030 Free Quote
Int/Ext/Specialty Painting Siding, Wood Rot & Decks Kate, 785-423-4464
Water, Fire & Smoke Damage Restoration • Odor Removal • Carpet Cleaning • Air Duct Cleaning •
One Company Is All You Need and One Phone Call Is All You Need To Make (785) 842-0351
Interior/Exterior Painting
Quality Work Over 20 yrs. exp.
Call Lyndsey 913-422-7002
Retirement Community Professional Painters Home, Interior, Exterior Painting, Lead Paint Removal Serving Northeast Kansas 785-691-6050 ce.com/primecoat
Drury Place
Live More Pay Less Worry-free life at an affordable price
1510 St. Andrews
785-841-6845
Lawrencemarketplace.com/ druryplace
Riffel Painting Co. 913-585-1846 Specializing in new homes & Residential interior and exterior repaints Power Washing Deck staining Sheet Rock Repair Quality work and products since 1985
Roofing
785-865-0600
Complete Roofing Services Professional Staff Quality Workmanship. com/lawrenceroofing Supplying all your Painting needs. Serving Lawrence and surrounding areas for over 25 years.
Complete Roofing
Locally owned & operated.
Tearoffs, Reroofs, Redecks * Storm Damage * Leaks * Roof Inspections
Free estimates/Insured.
Pet Services
We’re There for You!
785-749-4391
Lawrencemarketplace.com/ksrroofing
Prompt Superior Service Residential * Commercial Tear Off * Reroofs
Free Estimates
Insurance Work Welcome
I COME TO YOU!
785-764-9582
Dependable & Reliable pet sitting, feeding, walks, overnights, and more! References! Insured! 785-550-9289
Lawrencemarketplace.com/ mclaughlinroofing
Insured 20 yrs. experience
Breathe Holistic Life Center
Events/ Entertainment
NOT Your ordinary bicycle store!
Eagles Lodge
Guttering Services
Banquet Hall available for wedding receptions, birthday parties, corporate meetings & seminars. For more info. visit place.com/stevesplace
Renovations Kitchen/Bath Remodels House Additions & Decks Quality Work Affordable Prices
785-843-2174
Retired Carpenter, Deck Repairs, Home Repairs, Interior Wall Repair & Painting, Doors, Wood Rot, Powerwash 785-766-5285
All Your Banking Needs Your Local Lawrence Bank
.
` U W c ` X Y Y B 3 c Z b ] g g Y b Vig]
Haul Free: Salvageable items. Minimum charge: other moving/hauling jobs. Also Maintenance/Cleaning for home/business, inside/out plumbing / electrical & more. 785-841-6254
mmdownstic@hotmail.com Lawrencemarketplace.com/tic
Financial
Stress Free for you and your pet.
Call Calli 785-766-8420
Salon & Spa
• Hair styling /Coloring • Soft Curl Perms • Nails & Eye Lashes 785-856-9020 2400 Franklin Rd., Suite E LawrenceMarketplace. com/ruffends
Travel Services Lawrence First Class Transportation
Moving-Hauling
(785) 550-1565
1388 N 1293 Rd, Lawrence
Professional Service with a Tender Touch
Yoga is more than getting on the mat. Live Passionately Yoga Nutrition Classes Relaxation Retreats 1407 Massachusetts 785-218-0174 lawrencemarketplace.com/ breathe
REMODELING & HANDYMAN SERVICES
• Baths • Kitchens • Rec Rooms • Tile • Windows •Doors •Trim •Wood Rot Since 1974 GARY 785-856-2440 785-925-0803 gwbrown52@sunflower.com Licensed & Insured
Re-Roofs: All Types Roofing Repairs Siding & Windows FREE Estimates (785) 749-0462
Plumbing
913-488-7320
Computer/Internet Computer Running Slow? Viruses/Malware? Troubleshooting? Lessons? Computer Questions, Advise? We Can Help — 785-979-0838
PineLandscapeCenter.com Find us on Facebook Pine Landscape Center 785-843-6949
Snow Removal Driveways & Sidewalks
Honest & Dependable Free estimate, References Call Linda 785-691-7999 Specializing in Carpet, Tile & Upholstery cleaning. Carpet repairs & stretching, Odor Decontamination, Spot Dying & 24 hr Water extraction. 785-840-4266
• Unsightly black streaks of mold & dirt on your roof? • Mold or Mildew on your house? • Is winter salt intrusion causing your concrete to flake?
1783 E 1500 Rd, Lawrence
Apply at eapp.adecco.com Or Call (785) 842-1515 BETTER WORK BETTER LIFE lawrencemarketplace.com/ adecco
Steve’s Place
Kansas Carpet Care, Inc.
Your locally owned and operated carpet and upholstery cleaning company since 1993! • 24 Hour Emergency Water Damage Services Available By Appointment Only
Office* Clerical* Accounting Light Industrial* Technical Finance* Legal
Banquet Room Available for Corporate Parties, Wedding Receptions, Fundraisers Bingo Every Friday Night 1803 W 6th St. (785) 843-9690 place.com/Eagles_Lodge
albeil@aol.com
Reliable, experienced, affordable For estimates Connor at 785.979.7390
K’s Tire
Sales and Service
Al 785-331-6994
Mowing My Way Through College
No Job Too Big or Small
Even if you don’t have a disability and you live outside the Lawrence City limits, we can help.
Repairs and Services
Lawn, Garden & Nursery
Home Improvements
We provide door-to-door transportation as well as many additional services to residents of Douglas County living with disabilities.
Lawrencemarketplace.com/ keysofjoy
Low Maintenance Landscape, Inc.
Commercial &Residential 24 hour Service
Accessible and General Public Transportation
Hilltop Child Development Center, 1605 Irving Hill Road Lawrence, Kansas 785-864-4940 hilltop@ku.edu twitter.com/HilltopCDC Serving Lawrence since 1972.
Auto-Home- BusinessLife- Health Dennis J. Donnelly Insurance Inc. 913-268-5000 11211 Johnson Dr. insuranceinckc.com
Free Estimates on replacement equipment! Ask us about Energy Star equipment & how to save on your utility bills.
785-856-GOLD(4653) Jewelry, coins, silver, watches. Earn money with broken & Unwanted jewelry
12th & Haskell Recycle Center, Inc. No Monthly Fee Always been FREE! Cash for all Metals 1146 Haskell Ave, Lawrence 785-865-3730. com/recyclecenter
Learn to play 30-50 songs in the first year with Simply Music! Keys of Joy 785-331-8369 Karla’s Konservatory 785-865-4151
A. B. Painting & Repair
Air Conditioning/ & Heating/Sales & Srvs.
• Garage Doors • Openers • Service • Installation
PIANO LESSONS
Int/ext. Drywall, Tile, Siding, Wood rot, & Decks 30 plus yrs. Refs. Free Est.
Wagner’s 785-749-1696
• Garage Doors • Openers • Service • Installation Call 785-842-5203 or visit us at Lawrencemarketplace.com /freestategaragedoors
Recycling Services
Painting. com/rivercityhvac
Garage Doors
Music Lessons
Heating & Cooling
“Your Comfort Is Our Business.” Installation & Service Residential & Commercial (785) 841-2665
Mudjacking, Waterproofing. We specialize in Basement Repair & Pressure Grouting. Level & Straighten Walls & Bracing on wall. BBB . Free Estimates Since 1962 place.com/patchen
For All Your Battery Needs
• Color & Design • Space Planning • Furniture Layouts • Trade Discounts • Project Management 785-766-9281 originsinteriordesign.com
Insurance
602 E 9th St | 785-843-4522
Full service preschool & licensed childcare center for children ages 1-12. Open year-round, Monday- Friday, from 7 am to 6 pm
“where simple ideas become inspiring realities”
JAYHAWK GUTTERING
jayhawkguttering.com
785-841-3088
Motors - Pumps Complete Water Systems
Origins Interior Design
785-842-0094
Electrical
Electric & Industrial Supply Pump & Well Drilling Service
Instruction and Tutoring
Seamless aluminum guttering. Many colors to choose from. Install, repair, screen, clean-out. Locally owned. Insured. Free estimates.
Stacked Deck
• Decks • Gazebos • Framing • Siding • Fences • Additions • Remodel • Weatherproofing & Staining Insured, 20 yrs. experience. 785-550-5592
Child Care Provided. com/dalerons
Call 866-823-8220 to advertise.
. RETIRED MASTER PLUMBER & Handyman needs small work. Bill Morgan 816-523-5703
WorldClass NEK.com 9jYfmg]b[`Y @UkfYbWYVig]bYgg %$$`cWU` D\cbYbiaVYfg <cifgAUdg KYVg]hYg7cidcbg FUh]b[gfYj]Ykg
WorldClassNEK.com
785-841-5466
Lawrencemarkeptlace. com/firstclass
Tree/Stump Removal
STARVING ARTISTS MOVING
15yr. locally owned and operated company. Professionally trained staff. We move everything from fossils to office and household goods. Call for a free estimate. 785-749-5073. com/starvingartist
Limos Corporate Cars Drivers available 24/7
Fredy’s Tree Service
Taking Care of Lawrence’s Plumbing Needs for over 35 Years (785) 841-2112 lawrencemarketplace.com /kastl
cutdown• trimmed• topped Licensed & Insured. 14 yrs experience. 913-441-8641 913-244-7718
Recycling Services
Vacuum Service & Repair
Lonnie’s Recycling Inc. Buyers of aluminum cans, all type metals & junk vehicles. Mon.-Fri. 8-5, Sat. 8-4, 501 Maple, Lawrence. 785-841-4855 lawrencemarketplace.com/ lonnies"
quivery effect 56 Demand
Dear involve-
Annie’s Mailbox
Marcy Sugar and Kathy Mitchell anniesmailbox@comcast.net
ment. Dear W.C.: Keeping quiet about abuse is never a good idea. Duke may not have abused any children in the intervening years, but it
‘Bachelor’ appeal wilts. I am struck by the fact that audiences turn out year after year to watch something so contrived — a show that sets out to find true love, yet has never resulted in a single walk down the aisle. I believe “The Bachelorette” has one wedding ring to its credit. If eHarmony had such a lousy track record, it would be bankrupt by now. Perhaps the most interesting thing about “The Bachelor” this season is how many people have stopped watching it and started following “The Voice” (7 p.m., NBC) instead. Last Monday, NBC’s musical competition had more than twice as many total viewers as “The Bachelor” and nearly three times as many viewers aged 18 to 49. ABC may be finally running out of roses. The recap show “The Bachelor: After the Final Rose” (9 p.m., ABC) pre-empts “Castle” tonight. — Jokes about the prospect of “smell-o-vision” have been around at least since the invention of television. And every so often we’re reminded why it’s a good thing that they’ve never perfected this technology. Like tonight, when “Hoarders” (8 p.m., A&E) visits folks named Constance and Jeri Jo. One of them likes to keep chickens and rotten eggs in the house — long past their expiration date. ‘‘Hoarders” may fascinate some, but the show exploits mentally ill people for entertainment. Many of those who appear on “Hoarders” do so at the encouragement of family members. Again, we’re told that it’s an intervention — not to be confused with an “Intervention” (9 p.m., A&E). But does anybody really think that putting mentally disturbed people on TV is a compassionate approach to their problems?
Tonight’s other highlights
A pillar of the community harbors dark secrets on “House” (7 p.m., Fox).
An innocent man returns on “Alcatraz” (8 p.m., Fox).
Ivy’s voice quavers at all the wrong moments on “Smash” (9 p.m., NBC).
BIRTHDAYS Playwright Edward Albee is 84. Former Atlanta Mayor Andrew Young is 80. Actress Barbara Feldon is 79. Singer Al Jarreau is 72. Actress-singer Liza Minnelli is 66. Former Massachusetts Gov. Mitt Romney is 65. Singer-songwriter James Taylor is 64. Author Carl Hiaasen is 59. Singer Marlon Jackson (The Jackson Five) is 55. Actor Courtney B. Vance is 52. Actor Titus Welliver is 51. Former MLB All-Star Darryl Strawberry is 50. Actress Julia Campbell is 49.. Dear Annie: How can I get my husband to stop cursing? We have been married for a year. When we were dating, I never heard him curse once. ‘‘Jim” says he loves me more than anything and that I have made his whole life better. Even though he knows how much I hate the bad language, he never apologizes when he curses and makes no effort to control his mouth. He swears whenever he gets
GIVE ME A HAND By Lester Hamm
3/12 Dear Lady:. But these methods are most effective when he cooperates.
ize just that, it is misunderstood or misrepresented. Tap into your inner strength. Tonight: Where people are. Aquarius (Jan. 20-Feb. 18) You feel as if you must jump through hoops to achieve your immediate goals. Tune into your sensitivity when dealing with others. Tonight: A must appearance. Pisces (Feb. 19-March 20) Detach from a confusing situation without blaming anyone. With some distance and a lot of discussion, you will understand more. Tonight: Let your mind wander.
© 2012 Universal Uclick
!"#$%& ' !%)*+ ,-' -.,- /0
UNIVERSAL CROSSWORD
Universal Crossword Edited by Timothy E. Parker March 12, 2012
ACROSS 1 Bit of elbow encouragement 5 Material at a yard sale? 11 1 or 11, in twenty-one 14 “I changed my mind” on a computer JACQUELINE BIGAR’S STARS jacquelinebigar.com 15 Fermi or Caruso For Monday, March 12: Virgo (Aug. 23-Sept. 22) 16 Bird’s horn? This year emphasizes commu Communication could be 17 Constantly nication. When you sense that an off. Whether you sense a haze sur19 “Gimme a ___” interaction might be off, detach and rounding someone’s words and/or an 20 Chunk of look at what the other person might outright misunderstanding depends really mean. If you are attached, learn on the people involved. Try to confirm 21 lawn Adopt, as a not to take everything your partner your appointments. Tonight: Hang out cause says personally. If you are single, oth- with easygoing friends. 23 Poe’s middle name ers find you very attractive; however, Libra (Sept. 23-Oct. 22) Tenth mo. getting a relationship to go beyond Money is essential to living, 26 28 “Do not dating could be challenging. yet you might find a problem conopen ’til ___” The Stars Show the Kind of Day cerning your finances. This problem 29 Cosmetic 31 Bad looks You’ll Have: 5-Dynamic; 4-Positive; could involve a partner. Tonight: 33 “Warm” or 3-Average; 2-So-so; 1-Difficult Balance your checkbook. “cold” ending Aries (March 21-April 19) Scorpio (Oct. 23-Nov. 21) 34 “Survivor” You might need to reveal You might want to be genre 36 Show dismore in a conversation than you more aware of your expectations. agreement, normally do. It is your objective to A partner or friend could disappoint in a way help someone understand a deciyou in the near future without in41 Misses on sion. Tonight: Continue discussions. tending to. Perhaps you set the bar the moors Taurus (April 20-May 20) too high. Tonight: Not everything 42 ___ Grande 44 Forever and Defer to others and open has to be serious. ever up. Confusion weaves its path. Slow Sagittarius (Nov. 22-Dec. 21) 47 Launder with down, and don’t make quick as You might decide to say chemicals sumptions or decisions for the next little, as you pull back and do some 50 Animal’s resting place few weeks. Tonight: Have a longimportant thinking. Others, from 51 ___ Moines, overdue chat. bosses to partners, seem to be Gemini (May 21-June 20) unusually flaky or difficult. Tonight: 52 Iowa Fine-twisted Your ruler, Mercury, starts Nap, then decide what feels right. thread its backward dance, signaling that it is Capricorn (Dec. 22-Jan. 19) 53 Singer’s quivery effect time to slow down and approach life You know what you want, 56 Demand with more awareness. The wise twin but somehow, even if you verbal-
will not make commitments during this time. Tonight: Racing around. Cancer (June 21-July 22) Just when you thought your timing was perfect to talk to a boss, parent or other authority figure, you discover otherwise. This person could be acting a bit off. Tonight: Leave problems behind. Leo (July 23-Aug. 22) If your personal and/or domestic life is not as you would like it to be, your professional or public life could be affected. Be careful. Tonight: Close to home.
3/11
23 Had a course 24 Bad outcome for the home team 25 Prefix meaning “stone” 26 Black-andwhite treats 27 Poison pill contents 30 Bit of hair 31 “Badlands” star Spacek 32 Degree in mathematics? 35 More bad looks 37 Bank vault installation 38 Surname in cosmetics 39 “Iliad” warrior 40 “Don’t touch that ___!” 43 Number of even primes 44 Knot-tying sites
payment 57 Be green around the gills 58 Handyman’s storage unit 64 X-ray dose unit 65 Hostile attack 66 A stone’s throw away from 67 Barnyard abode 68 Big name in private planes 69 “Spare me the ___ details” DOWN 1 “Aye!” sayer 2 Abbr. for Jesse Jackson 3 “To Autumn,” e.g. 4 ___ fin (shark feature) 5 Repel (with “off”) 6 So-so link? 7 Sis counterpart 8 Beam fastener 9 Boardwalk coolers 10 Business name abbr. 11 Take as a given 12 “Julius ___” (Shakespeare tragedy) 13 Glut 18 “... in ___-horse open sleigh” 22 Aster relative
45 Wild West Show prop 46 Easy to handle 48 Collection of members 49 Fur, in a mukluk 51 Elevator entryways 54 Ending for “psych” 55 ___ Star State (Texas’ nickname) 56 “Anti-art” movement 59 “Alamos” or “Angeles” preceder 60 A finished movie is in one 61 “The one” played by Keanu 62 “... silk purse out of a sow’s ___” 63 “Give it a shot!”
PREVIOUS PUZZLE ANSWER
3/11
© 2012 Universal Uclick
THAT SCRAMBLED WORD GAME
by David L. Hoyt and Jeff Knurek
Unscramble these four Jumbles, one letter to each square, to form four ordinary words.
IDOVA TREELT DROIHR
Find us on Facebook
Keeping silent about abuse never good
open sleigh 22 Aster relative
Now arrange the circled letters to form the surprise answer, as suggested by the above cartoon.
Answer: Saturday’s
(Answers tomorrow) Jumbles: ABIDE SPELL HOURLY TONGUE Answer: When the birthing class instructor told a joke, he got this — BELLY LAUGHS
BECKER ON BRIDGE
10B MONDAY, MARCH 12, 2012 Sport Utility-4x4 Truck-Pickups Jeep 1989 Wrangler Sahara $1999 automatic 68493 miles 4x4 runs great 316-285-9346
Subaru 2006 Forester 2.5 XT, Leather, Moon, Cruise, HomeLink, Heated Seats, 6Disc, 88K, $15,900 View pictures at 785.856.0280 845 Iowa St. Lawrence, KS 66049
Toyota 2004 4Runner SR5 60K, Natural White Don’t Miss This One! Apply On-Line At 785-841-0102
Dodge 2001 Ram 2500 3/4 Ton Quadcab Diesel Blue, body in good condition, 5th wheel trailer hookup, interior in fair condition, but missing radio and dash is cracked. 200,571 miles. Starts right up. PW, PDL, PS, keyless, sliding rear window, bedliner, needs tires and alignment. Call Zak at 785-865-1046 for more information. Taking bids until 4/6, will sell to highest bidder.
Ford 2009 Escape Limited 4cyl, FWD, hard to find! Sunroof, leather heated seats, power equipment, alloy wheels, low miles! Stk#10933A only $19,767.
Truck-Pickups Ford 2006 F-150 STX, 58K Black Lifetime Engine Warranty! 785-841-0102
Truck-Pickups Toyota 2006 Tundra, 68K, Access Cab. You Have the Right to a Fair and Easy Credit Approval Process! 785-841-0102
Vans-Buses
Buick 2007 Terraza CXL these have got to be one of the nicest mini-vans that you will ever look at. $11,822 Dale Willey 785-843-5200
Dodge 2008 Caravan CV 31K, Bright White Does Your Business Need A Clean Cargo Van? Apply On-Line At 785-841-0102
Kia 2008 Sedona 7 Passenger, 31k, Blue Apply Today, Drive Tonight! 785-841-0102
Saturn 2009 Vue 38K, Hybrid, Black Don’t Miss This One! 785-841-0102
Lawrence the above-entitled case. The sale is to be made without appraisement and subject to the redemption period as provided by law, and further subject to the approval of the Court. For more information, visit.
Subaru 2006 Outback 2.5L Wagon, AWD, Leather, Moon, Htd. Seats, Alloy, CD, 75k, $15,900. View pictures at 785.856.0280 845 Iowa St. Lawrence, KS 66049
GMC 2006 Sierra SLT crew cab, diesel, one owner, loaded. This won’t last long!! Stk#383811 only $26,841. Dale Willey 785-843-5200
KANSAS
Jack for Junkers TRADE-IN WORTH
$4500.00 NEXT 7 DAYS
•••
Here is what you need to know!
“Kansas Jack for Junkers”
Dodge 2010 Caliber SXT 4cyl, FWD, power equipment, and very affordable! Stk#17731 only $13,444 Dale Willey 785-843-5200
We believe everyone deserves a nicer, newer car and no one should have to drive a car they hate!! “Dealer For the People”
1527 W. 6th St.
785-841-0102
Dodge 2009 Dakota Quad Cab With Topper!!! 72K, Big Horn Edition Apply On-Line 785-841-0102
Dodge 2010 Ram 2500 Bright White, 50K Lifetime Engine Warranty?Yes!!! 785-841-0102
LOW! LOW! LOW! INTEREST RATES ON ALL USED VEHICLES AVAILABLE ONLY AT DALE WILLEY AUTOMOTIVE! Toyota 2009 Tacoma, access cab. SR5, 2WD, 4cyl. auto., CarFax Clean. Warranty, Loaded! $18,000. 785-628-8726
We buy all Domestic cars, trucks and suvs. Call Jeremy 785-843-3500 23rd & Alabama
to satisfy the judgment in the above-entitled case. The sale is to be made without appraisement and subject to the redemption period as provided by law, and further subject to the approval of the Court. For more information, visit. Kenneth (134117) ________
.
Toyota 2009 Sienna XLE, one owner local trade, alloy wheels, CD changer, power equipment, quad seating, power sliding doors, stk#471541 only $26,544. Dale Willey 785-843-5200
Auto Parts
NOTICE OF SALE
Under and by virtue of an Order of Sale issued to me by the Clerk of the District Court of Douglas County, Kansas, the undersigned Sheriff of Douglas County, Kansas, will offer for sale at public auction and sell to Kenneth McGovern, Sheriff the highest bidder for cash Douglas County, Kansas in hand, at the Lower Level of the Judicial and Law EnPrepared By: forcement Center of the South & Associates, P.C. Courthouse at Lawrence, Kristen G. Stroehmann Douglas County, Kansas, on (KS # 10551) April 5, 2012, at 10:00 AM, 6363 College Blvd., Suite 100 the following real estate: Overland Park, KS 66211 (913)663-7600 Lot 116, Block 34, in that (913)663-7899 (Fax) part of the City of Lawrence Attorneys For Plaintiff known as West Lawrence, (101170) Douglas County, Kansas, ________ commonly known as 422 Arkansas Street, Lawrence, (First published in the Law- KS 66044 (the “Property”) rence Daily Journal-World to satisfy the judgment in March 12, 2012) the above-entitled case. IN THE DISTRICT COURT OF The sale is to be made DOUGLAS COUNTY, KANSAS without appraisement and subject to the redemption CIVIL DEPARTMENT period as provided by law, Bank of America, N.A., suc- and further subject to the cessor by merger to BAC approval of the Court. For information, visit Home Loans Servicing, LP more fka Countrywide Home. Loans Servicing, LP Kenneth McGovern, Sheriff Plaintiff, Douglas County, Kansas vs. Brian P Schuler and Prepared By: Melissia M Schuler, et al. South & Associates, P.C. Defendants. Kristen G. Stroehmann (KS # 10551) Case No. 11CV508 6363 College Blvd., Suite 100 Court Number: 1 Overland Park, KS 66211 (913)663-7600 Pursuant to K.S.A. (913)663-7899 (Fax) Chapter 60 Attorneys For Plaintiff (137431) NOTICE OF SALE ________ Under and by virtue of an (First published in the LawOrder of Sale issued to me rence Daily Journal-World by the Clerk of the District February 27, 2012) Court of Douglas County, Kansas, the undersigned IN THE DISTRICT COURT OF Sheriff of Douglas County, DOUGLAS COUNTY, KANSAS Kansas, will offer for sale at public auction and sell to In the Matter of the the highest bidder for cash Estate of in hand, at the Lower Level Nancy Newlin Ashton, of the Judicial and Law Endeceased. forcement Center of the Courthouse at Lawrence, Case No. 2011 PR 133 Douglas County, Kansas, on April 5, 2012, at 10:00 AM, (Proceedings Pursuant to the following real estate: K.S.A. Chapter 59) Lot Ten (10) in Hunter’s Ridge, an addition to the City of Eudora, Douglas County, Kansas, commonly known as 10 Stevens Drive, Eudora, KS 66025 (the “Property”)
Ford 2010 F150 XLT 4wd, crew cab, one owner, SYNC radio, alloy wheels, steering wheel controls, tow package, bed mat, stk#191211 only $26,888 Dale Willey 785-843-5200
Lawrence
(First published in the Lawrence Daily Journal-World March 12, 2012) IN THE DISTRICT COURT OF DOUGLAS COUNTY, KANSAS CIVIL DEPARTMENT Bank of America, N.A., successor by merger to BAC Home Loans Servicing, LP fka Countrywide Home Loans Servicing, LP Plaintiff, vs. Richard Lang and Dianna Lang, et al. Defendants.
NOTICE OF HEARING THE STATE OF KANSAS TO ALL PERSONS CONCERNED: You are hereby notified that on February 23, 2012, a Petition was filed in this Court by Judith Ashton, an heir of Nancy Newlin Ashton, deceased, requesting the admission to probate of the Will of Nancy Newlin Ashton dated August 16, 1988, the First Codicil to Last Will of Nancy Newlin Ashton dated October 27, 1993, the Second Codicil to Last Will of Nancy Newlin Ashton dated January 15, 1998, and the Third Codicil to Will of Nancy Newlin Ashton dated March 7, 2003, which were filed with the Court on August 16, 2011, for the purpose of preserving the same for record;, that Stewart H. Ashton be appointed as executor, without bond; and that Stewart H. Ashton be granted Letters Testamentary.
Lawrence
Lawrence
9:00 a.m. in the Court at Douglas County, Kansas. If you fail to plead, judgment and decree will be entered in due course upon the petition.
you fail to plead, judgment and decree will be entered in due course upon the Petition.
Respectfully submitted, BEAM-WARD, KRUSE, WILSON WRIGHT & FLETES, L.L.C. /s/ Charles T. Schimmel Charles T. Schimmel, KS #18357 8695 College Blvd., Suite 200 Overland Park, Kansas 66210 (913) 339-6888 (913) 339-9653 facsimile ATTORNEY FOR PETITIONERS ________ (First published in the Lawrence Daily Journal-World February 27, 2012) IN THE DISTRICT COURT OF DOUGLAS COUNTY, KANSAS CIVIL DEPARTMENT Leader One Financial Corporation Plaintiff, vs. John D. Hadl a/k/a John David Hadl; Tamara Helmar; Tamela L. Hadl a/k/a Tamela Lynn Hadl; Darrell Helmar; Robert Wilson Co., Inc; John Doe (Tenant/Occupant); Mary Doe (Tenant/Occupant); Unknown Spouse, if any, of John Hadl; Unknown Spouse, if any, of Tamara Helmar; Unknown spouse, if any, of Tamela Hadl ; Ted Doe (Tenant/Occupant); Alice Doe (Tenant/Occupant); J. Robert Wilson, Jr.; Unknown Spouse, if any, of Darrell Helmar, Defendants. Case No. 12CV72 You are required to file described real estate: your written defenses to the petition on or before Beginning at a point 1229.00 March 22, 2012, at 10:00 feet East of the Northwest A.M. in the District Court, corner of the Northeast Lawrence, Douglas County, Quarter of Section 3, TownKansas, at which time and ship 13 South, Range 20 place the cause will be East of the 6th P.M.; thence heard. Should you fail to South 01’25’00 West 348.48 file your written defenses, feet; thence East 250.00 judgment and decree will feet; thence North 01’25’00 be entered in due course East 348.48 feet; thence upon the petition. West 250.00 feet to the
point of beginning, in DougJudith Ashton las County, Kansas, comPetitioner monly known as 1771 & 1773 North 1500 Road, LawProtect Your Vehicle PREPARED BY: rence, KS 66046 (the with an Extended Case No. 11CV647 “Property”) Service Contract from BARBER EMERSON, L.C. Court Number: 1 Dale Willey Automotive. Linda Kroll Gutierrez and all those defendants Call Allen or Tony at #09571 Pursuant to K.S.A. who have not otherwise 785-843-5200 1211 Massachusetts Street Chapter 60 been served are required to P.O. Box 667 plead to the Petition on or Lawrence, Kansas NOTICE OF SALE before the 9th day of April, Autos Wanted 66044-0667 2012, in the District Court of Under and by virtue of an (785) 843-6600 Douglas County,Kansas. If Order of Sale issued to me (785) 843-8405 (fax) by the Clerk of the District E-mail: Court of Douglas County, lgutierrez@barberemerson.com Kansas, the undersigned ATTORNEYS FOR Sheriff of Douglas County, PETITIONER ________ Kansas, will offer for sale at What’s GM Certified? public auction and sell to (First published in the Law2yrs of free regular the highest bidder for cash rence Daily Journal-World maintenance in hand, at the Lower Level March 5, 2012) 172 Pt. Inspection of the Judicial and Law En12 Mo./12,000 Mi. forcement Center of the Bumper-to-Bumper IN THE 7TH JUDICIAL Courthouse at Lawrence, Warranty DISTRICT Douglas County, Kansas, on 100,000 mi./5-yr. DISTRICT COURT OF April 5, 2012, at 10:00 AM, DOUGLAS COUNTY, KANSAS limited the following real estate: Powertrain warranty, no deduct. IN THE MATTER OF THE Commencing at the South24-hr. Roadside PETITION OF: west corner of Section 31, Assistance Caroline Mae Underwood Township Fourteen South Courtesy To Change Her Name to: (T14S), Range Eighteen East transportation. Chris Caroline Mae (R18E) of the 6th P.M., Nationwide coverage Underwood thence South 89° 22’ 38” backed By East, 1084.83 feet for the General Motors. Case No. 12CV123 point of beginning, said Dale Willey Div. No. 1 point being on the South 785-843-5200 line of the Southwest Quar PURSUANT TO KS.A. ter (SW/4); thence North 1° CHAPTER 60 38’ 08” West 630.86 feet; thence South 80° 11’ 06” NOTICE OF HEARINGEast 237.97 feet; thence PUBLICATION South 75° 17’ 35” East 108.36 feet; thence South THE STATE OF KANSAS TO 67° 37’ 22” East 298.07 feet; ALL WHO ARE OR MAY BE thence South 0° 37’ 22” CONCERNED: West 184.00 feet; thence You are hereby notified South 89° 22’ 38” East that Caroline Mae Under216.00 feet; thence South 0° wood filed a Petition in the Lawrence 37’ 22” West 271.52 feet, above court on the 27th day (First published in the Law- said point being on the of February, 2012, requestrence Daily Journal-World South line of the Southwest ing a judgment and order Quarter (SW/4); thence changing her name from March 12, 2012) North 89° 22’ 38” West Caroline Mae Underwood to IN THE DISTRICT COURT OF 808.00 feet to the point of Chris Caroline Mae Underin Douglas wood. DOUGLAS COUNTY, KANSAS beginning, County, Kansas, commonly The Petition will be heard in CIVIL DEPARTMENT known as 230 N 300th Road, Douglas County District Overbrook, KS 66524 (the Court, Law Enforcement Bank of America, NA, sucBuilding, Lawrence, Kansas, cessor by merger to Coun- “Property”) on the 27th day of April, trywide Bank, FSB to satisfy the judgment in 2012, at 11:00 am. Plaintiff, the above-entitled case. If you have any objection to vs. The sale is to be made the requested name Melinda K. Fridy, et al. without appraisement and change, you are required to Defendants. subject to the redemption file a responsive pleading period as provided by law, on or before April 18, 2012, Case No. 09CV409 and further subject to the in this court or appear at Court Number: 5 approval of the Court. For the hearing and object to more information, visit the requested name Pursuant to K.S.A.. change. If you fail to act, Chapter 60 judgment and order will be Kenneth McGovern, Sheriff entered upon the Petition NOTICE OF SALE Douglas County, Kansas as requested by Petitioner. Under and by virtue of an Prepared By: /s/ Caroline Mae Order of Sale issued to me Underwood by the Clerk of the District South & Associates, P.C. Kristen G. Stroehmann Petitioner, Pro Se Court of Douglas County, (KS # 10551) ________ Kansas, the undersigned Sheriff of Douglas County, 6363 College Blvd., Suite 100 (First published in the LawKansas, will offer for sale at Overland Park, KS 66211 rence Daily Journal-World public auction and sell to (913)663-7600 March 12, 2012) (913)663-7899 (Fax) the highest bidder for cash Attorneys For Plaintiff in hand, at the Lower Level IN THE DISTRICT COURT OF of the Judicial and Law En- (136736) DOUGLAS COUNTY, KANSAS ________ forcement Center of the CIVIL COURT DIVISION Courthouse at Lawrence, (First published in the LawDouglas County, Kansas, on rence Daily Journal-World In the Matter of the April 5, 2012, at 10:00 AM, March 12, 2012) Application of the following real estate: HELEN REESE GRABILL IN THE DISTRICT COURT OF Lot 7, in Block 2, in Parkway DOUGLAS COUNTY, KANSAS Case No. 2012CV57 West, an addition to the CIVIL DEPARTMENT City of Lawrence, as shown NOTICE by the recorded plat Bank of America, N.A., sucthereof, in Douglas County, cessor by merger to BAC The State of Kansas to all Kansas. LESS AND EXCEPT Home Loans Servicing, LP other persons who are or an undivided one-half of all fka Countrywide Home may be concerned: oil, gas and other minerals Loans Servicing, LP and mineral rights in, upon Plaintiff, You are hereby notified and under said real estate vs. that a petition has been reserved unto the Federal Stephen J Orozco, Jr. and filed in the District Court of Land Bank of Wichita, Jennifer M Orozco, et al. Douglas County, Kansas by Wichita, Kansas, in deed reDefendants. Helen Reese Grabill for corded May 14, 1946, in judgment and decree Book 156, Page 163, comCase No. 11CV703 changing her birth name of monly known as 4824 W. Court Number: 1 Helen Reese Grabill to 24th Street, Lawrence, KS Helen Reese Edwards. You 66047 (the “Property”) Pursuant to K.S.A. are hereby required to Chapter 60 plead to the petition on or to satisfy the judgment in before March 30, 2012, at
Lawrence
subject property is located at 1012 Branchwood Drive. Submitted by Joy Rhea with Paul Werner Architects for Terry R. and Rebecca S. NOTICE Spriggs, the property ownPursuant to the Fair Debt ers of record. Collection Practices Act, 15 U.S.C. §1692c(b), no infor- B-3-5-12: A request for a mation concerning the col- variance as provided in lection of this debt may be Section 20-1309 of the Land given without the prior con- Development Code of the sent of the consumer given City of Lawrence, Kansas, directly to the debt collec- 2011 edition. The request tor or the express permis- seeks relief from the resion of a court of compe- quirement that off-street tent jurisdiction. The debt parking areas be set back a collector is attempting to minimum of 25 feet from a collect a debt and any in- street right-of-way in any formation obtained will be residential zoning district used for that purpose. per Section 20-908 of the Development Code. The Prepared By: variance is prompted by South & Associates, P.C. proposed parking lot imKristen G. Stroehmann provements for the Kappa (KS # 10551) Delta Sorority located at 6363 College Blvd., Suite 100 1602 High Drive. Submitted Overland Park, KS 66211 by Darron Ammann with (913)663-7600 Bartlett & West, Inc. for (913)663-7899 (Fax) Zeta Epsilon House CorpoAttorneys For Plaintiff ration, the property owner (119399) of record. ________ B-3-6-12: A request for a variance as provided in (Published in the Lawrence Section 20-1309 of the Land Daily Journal-World March Development Code of the City of Lawrence, Kansas, 12, 2012) 2011 edition. The request is NOTICE TO THE PUBLIC for a variance to allow a wood screen fence to be The Lawrence Board of constructed in a code reZoning Appeals will hold a stricted area on a corner public hearing on Thursday, lot having its rear yard April 5, 2012, at 6:30 p.m., in abutting the side yard of adjoining property. the Commission Meeting the 20-602(e)(6)(ix)(b) Room, first floor of City Hall Section at Sixth and Massachusetts in the Development Code is Street, Lawrence. The fol- the governing provision in lowing items will be con- this case. It does not allow a fence, wall or hedge to be sidered at that time: located in an area on the B-1-2-12: Consider an ap- property measured 25 feet peal filed by Bradley R. from the common property Finkeldei with Stevens & line, and from the exterior Brand, L.L.P., on behalf of side lot line a distance his client Robert B. equal to ½ the front Killough, owner of 12th & setback for the adjoining The subject Haskell Recycling Center, property. 1146 Haskell Avenue. The property is located at 103 appeal challenges an ad- Providence Road. Submitministrative determination ted by Patrick R. and Kathie made by the City of Law- S. Nichols, the property rence Director of Planning owners of record. and Development Services outlined in a letter dated B-3-7-12: A request for a January 13, 2012, that the variance as provided in lawful nonconforming use Section 20-1309 of the Land of the land has expanded Development Code in the and that the use of the Code of the City of Lawproperty is an Open Use of rence, Kansas, 2011 edition. The request is from the Land not permitted pursuant to Section 20-1502(b) provisions in Article 12, and Section 20-1502(d) of Section 20-1204(b) of the the City Code. The reasons City Code as it pertains to cited by the appellants for development in the RegulaThe varifiling this appeal are con- tory Floodway. tained in a letter from Mr. ance request is related to improvements Finkeldei, dated January 30, electrical that are necessary to the 2012. new North Powerhouse. B-3-3-12: A request for vari- The property is generally ances as provided in Sec- described as being east of tion 20-1309 of the Land De- the Massachusetts Street velopment Code of the City Bridge on the south side of of Lawrence, Kansas, 2011 the Kansas River just east edition. The request in- of the Bowersock Dam. volves variances from Submitted by The Bowoff-street parking require- ersock Mills & Power Comments for a neighborhood pany, plant owner and opreligious institution seek- erator. ing to locate in a developed residential property several The legal description for blocks east of the Univer- the property in the appeal sity of Kansas Campus. and the case files for the The applicant is seeking re- public hearing items are lief from the standards set available in the Planning forth in Article 9 of the De- Office for review during velopment Code that ad- regular office hours, 8-5, dress the required amount Monday - Friday. of parking spaces and parking area setback from If you have any questions these items, a street right-of-way. The regarding requested property is lo- please contact the Planning cated at 1645 Kentucky Department at 832-3159. Street. Submitted by Chad Donohoe with Grace Evan- Scott McCullough gelical Presbyterian Director of Planning and Church, contract purchaser Development Services ________ from David D. Wagner, the property owner of record. B-3-4-12: A request for a variance as provided in Section 20-1309 of the Land Development Code of the City of Lawrence, Kansas, 2011 edition. The request is for a variance to reduce the 5 feet interior side yard building setback from an interior lot line required in Section 20-601(b) of the City Code to a minimum of 2.84 feet from the interior lot line measured at the front of the new garage addition. The variance is requested to correct the building’s encroachment into the side setback. The
(Published in the Lawrence Daily Journal-World March 12, 2012) The personal property of the following tenants, including misc. items, will be disposed of March 19, 2012: Apartment C-26 Isaiah Fitzwater; Apartment A-4 Walter Warren, Jr.; Apartment J-114 Racheal Deo & Stephen Morgan; Apartment A-4 Tishekia Beasley & Damien Gibson. Malls Olde English 785-843-5552 _______
7 5 CE N TS
L J W OR L D.C OM
. "3$) t
INSIDE
4
DELICIOUS/NUTRITIOUS This month is known to some as March Mustard Madness, and we’re joining in.
Don’t get stuck at home — there’s plenty to do without taking a long trip
MORE
SPRING BREAK DAYCATIONS Remnant Rehab Display your jewelry when you’re not wearing it. Page 2
As I See Fit Turn the tasks you’re already doing into a workout. Page 11
PAGE 8
Lawrence Laundry As temperatures warm up, find out what’s in for spring. Page 12
Vol.154/No.72 36 pages
Energy smart: The JournalWorld makes the most of renewable resources.
2}
M ONDAY , M A R C H 1 2 , 2 0 1 2
{ Contact Us } 609 N.H. (offices) 645 N.H. (News Center) Lawrence, KS 66044 (785) 843-1000 Suggestions? Email go@ljworld.com, or use the feedback form on our website, LJWorld.com/site/feedback. Dennis Anderson, managing editor, 832-7194, danderson@ljworld.com Katie Bean, Go! editor, 832-6361, kbean@ljworld.com Chris Bell, circulation manager, 832-7137, cbell@ljworld.com
ON THE COVER: Go noseto-nose with a polar bear at the Kansas City Zoo. Photo courtesy of Kansas City Convention and Visitors Bureau
Project puts jewelry on display Remnant T. I found a pack of three shadow boxes at Michael’s. With a layer of batting, fabric and a couple of pins, I was able to make a set to display some of my favorite pieces.
REHAB
SUPPLIES cotton fabric, pressed low loft roll batting (not the kind for stuffing pillows) scissors shadow box spray adhesive or glue tape or hot glue pins INSTRUCTIONS 1. Open the shadow box. Cut a piece of fabric the size of the back piece plus 1/2inch overhang on each side. Then cut one layer of batting to fit on the inside of the back piece, about 1/2 inch smaller on each side.
KATIE BEAN Katie Bean/Journal-World Photo
2. Glue the batting to the inside of the back piece using spray adhesive or regular glue. If using spray adhesive, you’ll probably want to put down some kind of drop cloth. I used a cut-open plastic bag. Make sure to center the batting. 3. Glue the fabric to the batting — spray adhesive works especially well for this because it doesn’t seep through the fabric. Center the fabric so there is overhang on each side and pull it taut. 4. Clip the corners to reduce bulk, then tape or glue the fabric overhang to the
Jewelry display case back of the back piece. Don’t cover up the hanger — trim the fabric if needed. 5. Stick two pins into fabric and batting near the top and hang a necklace from them. You could also display bracelets, rings, earrings or brooches. Once your display is finished, put the back on the frame, hang and admire. — Go! editor Katie Bean can be reached at 832-6361. Follow her at Twitter.com/LJW_Go.
Love of reading starts early and can be encouraged BY FAMILY FEATURES
F. fac-
tor way.
MON D AY, MAR CH 12, 2012
OFFBEAT OCCUPATIONS:
Not the average 9-to-5
{
3
LOVE OF DRAWING DRIVES TATTOO ARTIST BY CHANSI LONG
M
ost of us draw when we’re children. But most of us quit while we’re still young. Not so for Carrie Smith, 35, known at BDC Tattoos as Scary Carrie. Smith is a professional tattoo artist, and she has been drawing since she could grip a pencil. One of her first pieces of artwork hangs from the wall in her private room at BDC Tattoos, 938 Mass. The features are slightly distorted, but you can tell what it is: ET, scrawled by 5-yearold hands and colored in with markers. Smith had just seen the movie in the theater, and she wanted her mom, who wasn’t able to come, to know what ET looked like. This desire to capture and recreate an image of significant and permeaning in order — Carrie Smith sonal to share it with someone else would become a defining theme in Smith’s life. Smith grew up in Coffeyville, a town she says had little to offer in terms of entertainment. So Smith kept her hands busy with colored pencils and markers, sketching in class and drawing at home since she can remember. When she was 13, she started driving her dad to Tulsa for a string of regular doctors appointments. Before they’d head home, her dad would want to stop at a Harley-Davidson shop (he drove a Harley), and Smith would never argue: while her dad talked and looked around, Smith filled her arms with tattoo magazines. “I read them from cover to cover, so I could soak up everything I possibly could from them,” she says. “There was no Internet back then, so that’s how you learned.” By age 15, Smith was begging a local tattoo artist to apprentice her. The man operated a shop out of his home, and in truth, he was not a very good artist, Smith says. But she was young and enamored by the idea of being able to draw for a living.
“There’s no room for error. It’s serious. They’re going to see this for the rest of their life, and it better be good.”
Richard Gwin/Journal-World Photo
“SCARY” CARRIE SMITH, a tattoo artist in Lawrence, works on a client March 1 at BDC Tattoos, 938 Mass. The tattoo is a seascape design that will take weeks to finish. And it wasn’t just that. Being a tattoo artist meant that she would be able to craft her own images for permanent placement on something everyone looked at: the human body. And so every day for years, she tramped over to her friend’s house and begged him to apprentice her. As a display of her sincerity, Smith let the man give her a large tattoo of a picture she had drawn in high school. He didn’t improve upon the picture, or even, Smith says, draw it as well as the original.
PLAY PIANO NOW!
But her friend viewed it as a mark of devotion. If she was willing to get a tattoo that large she must be serious about the craft. He made a call. A few weeks later, she was on her way to the Florida Keys for an apprenticeship. The apprenticeship was not the sort that would be allowed today. There were no regulations at the time, no mandated standards or oversight. She studied under a crusty, mean old biker who spat and snapped and snarled, the vein in his sweaty forehead bulging whenever he was in a rage. If someone puked, she would grab a sponge. If something needed cleaned or fetched or lifted, she was the one to do it. “It’s rough, but that’s the nature of the business,” she says. “It’s how it’s supposed to be. If I had an apprentice, I would treat them like crap.” After apprenticing for only a month, Smith went to a shop in Kansas City where she worked for three years. Because her apprenticeship was so short, she tried to tackle smaller work until she developed more confidence. A tattoo artist is not granted the same margin of error that other professions might receive. A sick day or bad day for a tattoo artist might mean a marred or a disfigured body part for someone else. “There’s no room for error. It’s serious,” she says. “They’re going to see this for the rest of their life, and it better be good.” Smith has spent her 16-year career at a string of different shops, several of them in Kansas City. Smith has been at BDC Tattoos for about six years. The shop lets her make her own schedule and set up her own appointments. If she wants a vacation day, she walks over to the calendar hanging from her wall and makes a squiggly line through the day she needs off. No waiting for approval. At BDC, Smith works on one client a day, four days a week. On Saturdays, she does walk-ins from noon to 8 p.m. “Usually when I unlock the door, my entire day piles in at once,” she says. “That day could be two big tattoos or 15 tiny ones. You never know what that day will hold.” BDC gives Smith her own private room, and enough freedom to keep her happy — for the moment. “It could all change tomorrow,” she says. “As of right now, I’m happy. The second I become unhappy I’ll leave.”
Lawrence’s Home Town Swim Team
Can piano lessons be fun? y Music, because Yes, with Simply nt: Simply Music is differen Our students get playing immeediately. Our students learn 30 to 50 songs in their firsst year. Our students haave more fun than they ever expected!
45 years of Coaching Experience & Swimming Tradition in Lawrence. Be a Part of Lawrence Tradition & Swimming Excellence. Swim with Lawrence Aquahawks.
Learn more at a FREE Introductory Session this week! Keys of Joy! Studio 785-331-8369
“The sound of Olivia playing is a constant in our house.” Amy and daughter Olivia, Lawrence
Always accepting new members Call Coach Zach - 785-393-7966 or zach@aquahawks.org
4
}
M O N D A Y , M A RC H 1 2 , 2 0 1 2
Make it with mustard Delicious/ NUTRITIOUS
SARAH HENNING & MEGAN STUKE
Condiment need not be relegated to sandwiches
T
his month, we’re mad for mustard.
Delicious
It’s here, friends! It’s here! March! Some people wait all year for the holiday season or their birthdays or New Year’s Eve, but me? I wait for March. March — the month of spring, St. Patrick’s Day, basketball madness and mustard month at Free State Brewing Co. A trifecta of fun and festiveness! On the third day of March (and disappointed I didn’t make it on the first), I ran to Free State Brewing Co., 636 Mass., for my first round of mustard tasting of the month. You know about this, right? Every March, Free State brings hundreds of mustards to their display case and to the tables of their patrons for sampling. At the end of the month, two lucky Lawrencians go home with the mustard. All of those glorious bottles of fabulous flavors of mustard. I sampled sweet mustards, hot mustards, a bloody mary mustard and a mustard that — I kid you not — tasted like a chili dog. It was a chili dog! In a mustard bottle! Be still my mustard-loving heart. So, in honor of mustard month and all the upcoming basketball viewing (and the color green), I decided to make a buffalo wing alternative — one made specially for the beautiful month of March. And lo, the wasabi mustard wing was born. I have long been a fan of wasabi mustard. I mean, wasabi and mustard, my two favorite condiments, together in one delicious sauce. Yes, please. Frankly, I probably could have just painted the wings in wasabi mustard and thrown them on the grill to good results, but I wanted some more flavor, something more special for my most magical month of the year.
John Young/Journal-World Photos
DELICIOUS: Megan’s wasabi mustard drumsticks with dipping sauce have more substance than chicken wings but still pack a lot of flavor. Because I’m eeking over the “nutritious” camp more and more every day, I looked for a way to make my wings a little less fattening but still full of flavor. So I eliminated the fryer and opted for the oven, though the grill would also be a great choice. I skipped butter and mayo and instead used my new go-to sauce base: Greek yogurt. And it was amazing. I used full drumsticks instead of the typical small wings because I wanted to be able to remove the skin and still have something left to eat. The beauty of actual wings is that there is a lot of skin surface area — excellent for frying. But it’s not so excellent if you are trying to shed a pound or two, so the drumstick makes a great alternative. It’s affordable, healthy and a great palette for all manner of flavors.
Cover and marinate for a couple of hours. Bake at 325 degrees for 30 minutes, then turn the heat up (or the broiler on) and cook another 5 minutes to brown the tops. For the dipping sauce, use the reserved liquid and add another tablespoon of soy sauce and a tablespoon or two of water to thin it. Serve!
WASABI MUSTARD DRUMSTICKS WITH DIPPING SAUCE
When I was a little girl, one of my favorite “sandwiches” was this: yellow mustard and iceberg lettuce on wheat bread. Yes, seriously. The fact my parents let me get away with that is absolutely amazing — there’s like no nutritional value at all. But you know what there is? LOTS of taste. All thanks to the mustard. The bread and the lettuce? Vehicles for said mustard. Back then I wouldn’t touch any mustard but yellow with a 10-foot pole. These days, my taste buds are a bit more sophisticated, and I’ve come to greatly appreciate the nose-tingling mustards of Europe. I’ll seriously try pretty much any mustard, from dark
12 chicken legs, skin removed (or not, depending on your preference) 2 cups nonfat Greek yogurt 3/4 cups prepared wasabi mustard 1/2 cups soy sauce 1 teaspoon sesame oil 1 tablespoon powdered ginger (if you use fresh, use less) Stir this together and pour 3/4 of it over the chicken in a glass baking dish.
We had this with some oven-baked homestyle french fries and some roasted vegetables. It’s bar food, only better. Happy March, everyone. Play hard, play safe, play to win. Go Jayhawks!
NUTRITIOUS
MON D AY, MAR CH 12, 2012
{
5
Cupcake ATM dangerous for dieters BEVER. Customers think the vending machines are a sweet idea.
NUTRITIOUS: Sarah’s simply Dijon-licious vinaigrette adds pizazz to a salad of baby spring greens, red onions, dried cranberries, roasted beets and chickpeas. and beer-laden, to peppery near-orange to creamy and tinged with horseradish. Even the bizzarro neo-mustards of modern foodie-ism call my name: the chipotle mustards, wasabi mustards and ginger mustards. Yeah, pretty much any mustard any time is MINE. But, as far as everyday cooking is concerned, there’s one mustard I can’t do without: good ol’ Dijon. It’s perfect when spread on a crusty baguette and topped with slices of creamy avocado or whisked into a sauce or dressing. Honestly, it’s probably the most versatile condiment I buy regularly. And buy it I do — we probably go through a big jar of it once a month. I think the only storebought condiment we go through faster is peanut butter (and for that, I blame my toddler’s love of spooning it on apple slices). Suffice it to say I had a hard time picking a single way to enjoy mustard when Megan and I discussed capitalizing on March’s mustard madness.
So I went basic. Dijon adds a great kick to homemade salad dressing. Mix it with oil and vinegar and watch it make your salad extra special. I like to enjoy this simple dressing over mixed baby spring greens, topped with roasted balsamic beets — for a how-to, check out my favorite way to do beets and other roasted veggies on my Lawrence. com blog here — — plus crunchy slices of red onion, chickpeas and sweet dried cranberries. SIMPLY DIJON-LICIOUS VINAIGRETTE 2 tablespoons red wine or balsamic vinegar 1 tablespoon lemon juice 1 tablespoon Dijon mustard 1/4 cup olive oil 1/2 teaspoon salt Pepper, to taste Whisk the ingredients well and serve.
Damian Dovarganes/AP Photo
A NEW 24-HOUR CUPCAKE “ATM,” an automatic machine that will be continuously restocked to dispense fresh cupcakes, is tested March 5 at Sprinkles Cupcakes in Beverly Hills, Calif. The ATM-like machine features a touchscreen and a robotic arm that pulls the right cupcake from a wall of single-serving boxes inside the store. .
6}
M O N D A Y , M A R C H 1 2 , 2 01 2
LAWRENCE ELEMENTARY SCHOOL LUNCHES MONDAY Cheese quesadilla Yogurt and fruit parfait PBJ Chef salad Spanish rice Apples
TUESDAY BBQ pork sandwich Turkey sandwich PBJ Chef salad Mixed fruit Scalloped potatoes
WEDNESDAY Corndog Cheese and crackers PBJ Chef salad Steamed broccoli Pineapple
THURSDAY Soft taco Ham and cheese sandwich PBJ Chef salad Refried beans Mandarin oranges
FRIDAY
Pizza Roast beef sandwich PBJ Chef salad Green beans Grapes
Teen worries mom is bipolar Dear.”
Double TAKE DR. WES CRENSHAW AND MIRANDA DAVIS. — Dr. Wes Crenshaw is board certified in family and couples psychology (ABPP) and author of the books “Dear Dr. Wes: Real Life Advice for Teens” and “Real Life Advice for Parents of Teens.” Miranda Davis is a Free State High School senior. Send your confidential 200-word question on adolescence and parenting to ask@dr-wes.com. Double Take opinions and advice are not a substitute for psychological services.
Creating a naturally beautiful smile designed specifically for you. Call for a consultation! #
1
Ranked Invisalign Provider in Lawrence.
Our office will match most offers!
Making Lawrence Families Smile for Over 15 Years
Complimentary Orthodontic Evaluations 4828 Quail Crest Place • 785-832-1844 •
MON D AY, MAR CH 12, 2012
Mushrooms grown as packing material
{
7
BY MICHAEL HILL, ASSOCIATED PRESS
G
REEN ISLAND,
N.Y. —.
Mike Groll/AP Photo
GAVIN MCINTYRE, LEFT, AND EBEN BAYER, cofounders of Ecovative Design, pose with some of their ecofriendly packaging materials made with mushrooms at their company in Green Island, N.Y..
NATURAL FOODS & PURE SAVINGS
Get Healthy Natural Foods For Less at CHECKERS
23rd & Louisiana
Your Local City Market! Locally owned & operated since 1987
Healthy • Natural • Fresh
8
}
M O N D A Y , M A RC H 1 2 , 2 0 1 2
SPRING BREAK DAYCATIONS You don’t have to go far for a trip that will entertain the kids BY NANCY PISTORIUS
I. Fear not. Although these leaner economic times may mean you won’t be jetting off to a Magic Kingdom where it’s almost mandatory to wear mouse ears, you can find plenty of magical spring break experiences right in your own backyard. TALK TO THE ANIMALS Nature-loving kids and their parents are in luck, as there’s a terrific place in this area to get “up close and personal” with flora and fauna. The 2,002-acre Kansas City Zoo (open daily 9:30 a.m. to 4 p.m.) is located inside valleys and rolling hills in Kansas City, Mo.’s Swope Park, and contains more than 1,000 animals. You can hop with kangaroos in the Australia section, marvel at tigers in the Asia section, and ride high above the African Plains on the African Sky Safari (weather permitting), crossing approximately 1,500 feet at 35 feet above the ground. (Your toes will dangle just above cheetahs, lions, giraffes and rhinos.) The action is nonstop in the Tropics, an indoor rainforest, where otters swim underfoot in the lush tropical setting. Twin Golden Lion Tamarins, born Jan. 18, are now on exhibit there. Aww … cuteness overload. Special kid zone areas of the zoo include the Discovery Barn and Peek-a-Boo Tree, where kids can climb and play like monkeys. STOP AND SMELL THE ROSES Powell Gardens’ slogan is “Road Trip for your Soul,” and after just a few minutes in this peaceful and serene
Photos courtesy of Kansas City Convention and Visitors Bureau
THE COLLEGE BASKETBALL EXPERIENCE, ABOVE, is a great place to get your game on. It can be found at the Sprint Center in Kansas City. STARE WIDE-EYED AT A TIGER, AT LEFT, and he might stare right back at the Kansas City Zoo.
setting, you’ll begin to feel yourself unwind. This 915-acre nature center is located in Kingsville, Mo., about 30 miles east of Kansas City on U.S. Highway 50.
Wine Specials Every Day - Mix & Match
15% off cases
Featuring 6,000 varieties of plants and using 225,000 plants a year in seasonal displays, there’s always something special to see, year-round. On Sunday afternoon, your family can join Horticulture Director Alan Branhagen for the “Singing Frogs and Early Blooms Hike,” exploring a 3.25-mile nature trail as spring begins to emerge. (Call 816-697-2600, extension 209 to make reservations.) Fortify yourself for the hike by indulging in fresh, local and seasonal fare at Cafe Thyme.
We stand behind our work, and we care!
7.5% off 1/2 cases George & Tonya Waters’
Clean, friendly store; worth the drive! SW corner of Clinton Parkway & Wakarusa in Miller Mart 785-331-2322
842-8665 2858 Four Wheel Drive
MON D AY, MAR CH 12, 2012
Your own children’s favorites might be the Auto Center where they can change oil and rotate tires, the Art Pavilion where they can paint on the walls (and not get scolded for it) and the Real Tool Workshop, where children and adults work together using real saws, hammers, vices and building materials. Who knows, maybe you’ll create a unique family heirloom! With the opening of the International Dream Rocket project, March daily programming includes activities centered around space, rockets and dreams. The Center’s 15,708-square-foot building is nestled within four wooded areas of Gage Park, off 10th Street. While in the area, you and your kids can also enjoy the Topeka Zoo, the mini-train and the old-fashioned carousel.
A BUDDING PICASSO concentrates on his masterpiece at the Kansas Children’s Discovery Center in Topeka. CALLING ALL SPACE CADETS! The Kansas Children’s Discovery Center in Topeka is now enrolling students for the “Space Academy: Master the Force” spring break camp, March 19-23. Cadets will investigate space travel, create cities of the future, design light sabers and master the ways of a Jedi Knight. Each day of the camp offers new hands-on challenges that prepare kids for a final space mission and showdown with Imperial Forces. To register, email camps@kansas discovery.org. But you don’t have to be a camper to enjoy the Discovery Center. Open from 10 a.m. to 5 p.m. Monday through Saturday during area schools’ spring break and 1 p.m. to 5 p.m. Sunday, the center’s exhibit floor creates a unique experience for the whole family. Kids can explore nine different interactive areas emphasizing science, art, building/engineering, careers and the “real world.”
9
on the street
NOTHING BUT NET
Photo courtesy of Kansas Children’s Discovery Center
{
Young Jayhawk fans who just can’t get enough hoops during March Madness will think they’re in heaven when they first lay eyes on the College Basketball Experience, located in Kansas City’s Sprint Center, directly across from the Power & Light District. At the CBE, you can easily “get off the bench and get in the game!” The National Collegiate Basketball Hall of Fame occupies approximately one-third of the CBE (with historical exhibits giving recognition to great coaches, players and teams), but it’s the other two-thirds of the place that captivate most basketball fans, as they work up a sweat touring (and participating) in the high-energy, highly interactive venue. Casual and hardcore fans of any age can totally immerse themselves in the game of basketball. Dedicated hoopsters can take part in three-point shooting, dunking, dribbling and passing drills. Hands-on exhibits throughout the facility place visitors in electrifying game simulations, from sinking the game winning shot (à la “Mario’s Miracle”) to announcing the play-by-play action from the ESPNU broadcast desk. (The ESPN Sports Center is part of the College Basketball Experience.) With exhibits titled “Beat the Clock,” “Call the Highlights,” “Clean the Glass,” “Get in the Zone,” “Make the Pass,” “Shoot from Downtown” and “Step Up to the Line,” the whole place is like a slam dunk for diehard basketball addicts. The CBE is open to the public Wednesday-Saturday from 10 a.m. to 6 p.m. and from 11 a.m. to 6 p.m. Sunday. — Daytripper columnist Nancy Pistorius can be reached at go@ljworld.com.
What are you doing for spring break?
“Finishing writing my dissertation.” John Thompson, doctoral student, Lawrence
“Going to a spiritual retreat.” Kendra Thompson, youth minister, Lawrence
“Going to Chicago for my mom’s 50th birthday.” Elsie Thurman, assistant director, Hilltop Child Care, Lawrence
LE-ap into 48 Months of special financing!* B 830LE Ed[j^_d]oekYWdYekdjed m^[dj^[h[ije\j^[W\j[hdeed^Wib[joekZemd$
merrymaids.com *48 MONTHS special financing valid February 29-March 19, 2012 on BERNINA productss totaling tottaling ling $6,000 $6 0000 $6,00 or more. No interest until February 2016 on purchases of $6,000 or more on BERNINA proudcts with your BERNINA Credit Card made between February 29-March19, 2012. Fixed monthly payments required. Regular account terms (including minimum monthly payments) apply after the promotion ends.
2449 Iowa Street • Lawrence • 785-842-1595
$80 off
$20 off your first 4 cleanings New customers only. Not valid with other offers. Valid only at this location. Cash value 1/1000th of one cent. Offer good through / / 4/9/2012.
2201 W. 25th St. Suite D
785-842-2410
10 }
M O N D A Y , M A RC H 1 2 , 2 0 1 2
The only thing we have to fear … OAmerican
Everyday
LIFE JUDITH ROITMAN would send fewer people to jail? That, in partial consequence, we lock up increasing numbers of nonviolent people who are unlucky enough to get caught breaking laws that are, in fact, widely violated
BOOK REVIEW ‘Adventures of Beanboy’ pleases superhero fans BY ZACH YARBROUGH
I
n “The Adventures of Beanboy” by Tonganoxie author Lisa Harkrader, a seventh-grader named Tucker MacBean enters a comic book contest that has a college scholarship as the prize. Tucker is obsessed with comics and superheroes; so are his brother, Beecher, and best friend, Owen. Tucker and Beecher’s mother works all day and goes to school at night. As a result, Tucker and Beecher never see her. Tucker believes that if she could get a scholarship, she could quit her day job and they would get to see her more. So Tucker decides to enter the contest to create a sidekick for his favorite comic book company. If he wins, his sidekick will also appear in all of the future issues of his favorite comic, H2o. But after Tucker does a reread of the contest rules, he discovers that the prize is nontransferable, meaning that
ONLINE: Read more about “The Adventures of Beanboy” at Lawrence.com. his mother would have to enter the contest to get the scholarship. So to solve this dilemma, Tucker contemplates entering the contest in his mother’s name. Tucker not only wants to help his mom, but also a less fortunate classmate. Through some soul-searching and acts of kindness, Tucker finds he has a “superhero heart.” In this book, you will find a story about a quest to keep a family together and a fight to help the less fortunate. It is easy to follow, and I recommend it to all readers, but especially those that are interested in superheroes. — Zach Yarbrough is a sixth-grader at Lexington Trails Middle School in De Soto.
with no serious repercussions to society, instead of letting these folks do something useful with their lives? Who goes to jail? According to U.S. Department of Justice figures, in 2010, 51 percent of federal prisoners were in for drug offenses and 35 percent for “publicorder”? — Judith Roitman can be reached at go@ljworld.com.
Recognize when you’re stressed BY FAMILY FEATURES
I man-
age.
MON D AY, MAR CH 12, 2012
{
11
MAKING IT COUNT WITH FUNCTIONAL FITNESS
S
pring
As I See
FIT JENNIFER OSBORN
Functional Fitness can mean several things, but to me it means simply paying special attention to your everyday routine, paying close attention to the ways that you physically move and then making a conscious effort to integrate your fitness routine into your everyday one. partici-
pate. inex-
stay ahead of
pensive,. —Jennifer Osborn can be reached at go@ljworld.com.
SEVERE HER WEAoT rld.com with LJW
SIGN UP FOR EMAIL/TEXT ALERTS: Severe weather Forecasts/current conditions Breaking news >>> ljworld.com/alerts
12}
M O N D A Y , M A R C H 1 2 , 2 01 2
Lawrence LAUNDRY ALI EDWARDS
}
Indeed, there’s something romantic about springtime. Grass grows green, daffodils sprout up and the air feels a little less crisp, a little more forgiving.
SPRING TRENDS E
veryone. Postures suddenly straighten, eyes lighten, cheeks gather a hint of color and legs swiftly shed their pant-cocoons. Indeed, there’s something romantic about springtime. Grass grows green, daffodils sprout up and the air feels a little less crisp, a little more forgiving. And the best part of all? Women suddenly feel more feminine. Spring is a time for us to embrace our bodies, to dress them in florals, pastels, lace and eye-catching prints. No longer will I feel compelled to wear my favorite winter ensemble of black boots, black jeans and a black sweater. Instead, I’ll put on a flowy skirt and become fascinated with the idea of outdoor entertaining. Ladies, whether you’re a pastel-and-lace type of woman, or you’re like me and prefer wearing a mish-mash of bold prints, spring 2012 has something great in store for your wardrobe.
Because of my fair complexion, I’ve never been so brave to adorn myself in nude or pastel colors. If I don’t find the perfect tint, the muted colors wash out my skin. However, Pamela Brown, a hairstylist at Lou & Co and New York Fashion Week assistant, noted that fair-skinned beauties can wear beige-tinted nudes and pastels to guard against making light skin look even lighter. Darkerskinned women can wear pink or cream-colored bases.
The Pantone Color Institute prophesized Tangerine Tango to be the color for 2012, and they were spot on. During New York Fashion Week, models cascaded down the runways clad in bright oranges. This spring, we’ll be seeing pastels color-blocked with brights and neons. While I’m not much a solid-color wearer, this spring fashion trend could be my jam. PRINTS
LACE Nothing makes a woman feel more feminine than a touch of lace. I’m not too much of a designer label snob, but Alexander McQueen’s spring line features some lace pieces that are simply exquisite (and I never use the word exquisite). After designing the muted satin and lace dress for William and Kate’s royal wedding, how could the folks at Alexander McQueen introduce any fabric other than lace for their spring line?
MIDWEST DRIVING SCHOOL “Drive to Arrive Alive”
PASTEL COLOR-BLOCKING WITH BRIGHTS
NUDES AND PASTELS
There are prints, and then there are PRINTS — big, bold, obnoxious prints that only people starving for attention (me) wear. This is by far my favorite trend of spring, and it’s about time it got here. This hodgepodge, pattern medley fits perfectly with my No. 1 fashion philosophy of “keep putting on more clothes until the outfit looks complete.” — Ali Edwards can be reached at go@ljworld.com. AP File Photos
Since 1974
Prr Professional P Service With A Tender Touch
• Ages 14 & Up • Both Male & Female Instructors Available
Lowe st Price in Ka s nsas!
d Truste Most te omple C d n a g! Trainin Find out more at OR Call 785-841-7749
We come to you. Stress Free! For you & your dog.
Free Bandan a for Every Service!
CALL CALLI at
785-766-8420
MON D AY, MAR CH 12, 2012
Driveway becomes science lab Are you READY?
River City Jules
M
y
{
13
Just In: Ready Blushes & Bronzers (8 new shades) ess) & The Marvelous Moxie Lipgloss (8 new sh shades) hades)) Only available at Eccentricity!
JULIE DUNLAP. — Julie Dunlap can be reached at go@ljworld.com.
716 Massachusetts | 830-9100
Get everything you need with Lawrence GiveBack! With everything from fine dining and auto repair to banking and books, the 70+ locally-owned merchants in the Lawrence GiveBack program invite you to keep jobs and tax dollars in Lawrence and help local charities continue to serve us. And now, GiveBack’s gone MOBILE: use your mobile phone instead of the card at many local GiveBack merchants!
Save money, help local charities & sustain our Lawrence economy! Find out more at lawrencegiveback.com
Visiting Nurses, Lawrence Public Library and Douglas County Senior Center present…
SkillBuilders Spring 2012 Session Visiting Nurses All of your homecare needs under one roof: Home Health • Rehabilitation • Hospice • Private Duty
843-3738 •
Thursdays, March 8th-May 17th from 10:00am-11:45am at Lawrence Public Library for Widows, Widowers or anyone experiencing significant life changes.
Thursday, March 15th Estate and Legal Matters with Cheryl Denton-Attorney with Petefish, Immel, Heeb & Hird, LLP
14 }
M O N D A Y , M A RC H 1 2 , 2 0 1 2
Fix-It Chick
Putting fresh names on community health. LINDA COTTIN
FOOD & NUTRITION “Harvests don’t end with cool weather”
AGING WELL “Aerobics may cut risk of dementia”
KIDDOS “A liquid lunch (or breakfast) your kids will love (even the picky ones!)”
TRAUMA & RECOVERY “Crisis center lauds Facebook move to prevent suicide”
For nearly two years, wellcommons.com has been a source for Douglas County community health news, information and collaboration.
HEALTHY BODY & MIND “Holiday beverages pack a caloric wallop.”
UN(DER)INSURED “Uninsured residents camp out all night to receive free dental care”
Recently, we’ve updated the names of our six major news categories to make it easier for you to find the information you’re looking for and the stories you may be interested in. At WellCommons, we’re committed to supporting the pursuit of health and well-being for all residents of Douglas County. We invite you to take a healthy stroll around the new WellCommons today.
Give exposed wood a fresh start by removing stains
B
lack proj-
“Best Community Service”
Sponsored By
ect..
For a quick room makeover, look to lighting solutions Ever wonder how designers make the rooms you see in magazines look so good? From fresh and airy to intimate and cozy, lighting sets the tone of a room.
with a dimmer. The light source is concealed, and with dimming capabilities you can change the lighting of the room for various activities from reading to movie-watching.
So if you want a room makeover, use these tips from the lighting pros at Sylvania to brighten things up.
Wall sconces and floor lamps are
Dining Room 2011 WINNER Editor and Publisher
}
Oxalic acid, commonly referred to as wood bleach, will lighten tannin stains without affecting the natural color of the wood.
good sources of task lighting. Bedrooms
Use a low-wattage energy-effi-
When installing light over the din-
cient bulb to brighten up the closet.
ing room table, be careful not to create shadows on your guest’s faces.
Provide light for reading by
Living Room
For general lighting, use fixtures
choosing swing-arm or flexible bedside lamps. — Family Features
MON D AY, MAR CH 12, 2012
1&51045
)t*t%t"t5t0
5IJTXFFLTQV[[MF
{
15
Keep your aging cat feeling young BY FAMILY FEATURES
%
id you know that cats are considered senior citizens at the age of 11? But getting older doesn’t mean that they have to lose their spark. Wendy Diamond, “Animal Fair” editor-inchief and national television pet lifestyle contributor, has some great tips for making your favorite feline’s twilight years golden ones. KEEP FELINE MINDS ACTIVE
See answer next Monday!
-BTUXFFLTTPMVUJPO
Aging commonly impacts cognitive function. Older cats may become bored or disinterested in activity, so it’s imperative to keep their minds active and engaged in order to stave off the trappings of old age, like senility or depression. Incorporating exploration and problem-solving into your cat’s daily routine will keep your cat’s intellect as sharp as their claws. ADJUST THE NUTRITIONAL PLAN Older cats have delicate digestive systems, and their ability to extract nutrition from their food begins to diminish. Pet parents need to make sure that the food that their aging feline consumes is composed of quality ingredients bursting with nutrition. VISIT YOUR VET
This may seem like obvious advice, but frequent trips to the veterinarian’s office can Special to the Journal-World keep your cat feeling young and vibrant. Many people attribute behavioral changes TARA SITS STILL as a statue. Sharon Hughes submitted the photo. in older cats exclusively to the aging proGot a picture for Pet Post? Bring in or mail a Pet Post photo and some cess; while some elderly cats will naturally information about your pet to the Journal-World, 645 N.H., Lawrence, slow down, this isn’t always the case. Always KS 66044 or email it to go@ljworld.com. consult a medical professional when your cat acts odd and never assume that new, altered or strange behavior is something that a pet parent can turn a blind eye toward. By staying on top of your cat’s health, you are infinitely more likely to catch a potential as when you go to the bank or the grocery is much easier when the discussion is concrete problem before your cat has the worst of it. store — to help children understand com- rather than abstract.” plex concepts in kid-friendly terms. A complementary approach is to intro- INCREASE AGILITY “If children are included in family financial duce children to games that teach basic discussions, such as planning for a fun vacation money lessons. One example is the game Consider how you can rearrange your or purchasing a high-cost toy, then parents can “The Great Piggy Bank Adventure” at home to suit your cat’s needs. Place ramps begin to place daily spending decisions in a GreatPiggyBankAdventure.com. T. Rowe leading to your cat’s favorite places and context their child will understand,” says Stu- Price collaborated with Walt Disney Parks treat your cat to a daily massage to stimulate art Ritter, CFP, a family financial expert with and Resorts Online to produce this free healthy musculature without putting too T. Rowe Price, and father of three. “Teaching online board game, which conveys basic much pressure on their paws. This approach children to set savings goals and make deci- financial concepts in a way that is fun and to feline fitness will leave your cat agile and sions about money that align with those goals easy for kids to understand. amiable; plus, it makes for quality time.
Teach kids money lessons in everyday settings BY FAMILY FEATURES
F
rom
16 }
M O N D A Y , M A RC H 1 2 , 2 0 1 2
Published on Mar 12, 2012
Daily Newspaper | https://issuu.com/lawrencejournal-world/docs/ljw03-12-12 | CC-MAIN-2017-51 | refinedweb | 41,164 | 74.39 |
Lingua::EN::Numericalize - Replaces English descriptions of numbers with numerals
use Lingua::EN::Numericalize; print str2nbr("one thousand maniacs"); $_ = "six hundred three-score and six"; str2nbr(); print; $Lingua::EN::Numericalize::UK = 1; print str2nbr("one billion"); # 1,000,000,000,000
This module interpolates English descriptions of numbers in a given string with their numeric counterparts. It supports both ordinal and cardinal numbers, negative numbers, and very large numbers.
The module exports a single function into the caller's namespace as follows:
This function receives an optional string (using $_ if none is passed) and converts all English text that describes a number into its numeric equivalent. When called in a void context, the function sets $_ to the new value.
The module's behaviour is affected by the following variables:
This variable may be set to indicate that the UK meaning of
billion should be used. By default, this module uses the American meaning of this word :( Please note that all the related larger numbers e.g. trillion, quadrillion, etc. assume the chosen behaviour as well.
If set to true, the module outputs on standard error messages useful for debugging.
Scores are supported, e.g. "three score and six", so are dozens, baker's dozens and grosses.
Cardinal numbers become ordinal i.e. second => 2, 13th => 13.
Various mispellings are understood, as are plurals, "illions" (e.g. million, billion, etc.), and "illiards" (e.g. milliard, billiard, etc.) in addition to suffixes e.g. 1k => 1000, 2M, 3B. Extended hundreds are also supported e.g. twelve hundred = one thousand two hundred = 1200.
While it handles googol correctly, googolplex is too large to fit in perl's standard scalar type, and "inf" will be returned.
no words hereproduces
no word hereand
hell hath no furyto
hell ha no fury.
runnin'=>
r9- yikes!
Any suggestions are welcome.
Erick Calder <ecalder@cpan.org>
This module was inspired by Joey Hess' Words2Nums but is a complete rewrite with an entirely different internal approach. It differs from his module in that it is smart enough to ignore strings it doesn't recognise, thus preempting the impossible requirement that the user first parse the string. As an example, a string like
One Thousand Maniacs would fail if passed to Words2Nums (since it contains
Maniacs) and doing a split and passing each individual piece would yield
1 1000 maniacs instead of the desired
1000 maniacs..
$Id: Numericalize.pm,v 1.52 2003/02/17 23:51:40 ekkis Exp $ | http://search.cpan.org/dist/Lingua-EN-Numericalize/Numericalize.pm | CC-MAIN-2016-50 | refinedweb | 413 | 58.69 |
#include <MAnimCurveClipboard.h>
The clipboard is a list of MAnimCurveClipboardItems (i.e. an MAnimCurveClipboardItemArray). All of the data stored on a clipboard remains static; that is, it will persist as long as the application remains running.
The items on the clipboard must be ordered. In the case where the clipboard info represents animation of a hierarchy, the order in which items appear in the clipboard is reliant on a depth-first-iteration from the root or the hierarchy. This ordering, is essential to properly match up hierarchies of objects
As an example, consider that animation from the following hierarchy is placed into the clipboard. Slanted Dag Objects are animated.
In this example, the object labelled "C" has translate{X,Y,Z} animated, while all the others only have one animated attribute (excluding objects B and F, which have no animated attributes).
Using notation where A(r,c,a) represents the animCurve driving object "A", which is at row "r" in its subhierarchy, has "c" children, and "a" animated attributes these items would appear in the clipboard in this order (i.e. depth-first with each object's attributes explicitly indexed before continuing down the hierarchy):
A(0,3,0) , B(1,1,0) , C(2,1,0) , C(2,1,1) , C(2,1,2) , D(3,0,0) , E(1,0,0) , F(1,2,0) , G(2,0,0) , H(2,0,0)
For example C(2,1,2) would mean that the object C resides on the second level of the subhierarchy and has one child. The last "2" is simply used as an index to count the number of animated attributes on this object.
Multiple objects can be represented on the clipboard in this manner. In the example above, if we had a separate second object with no children, "J", it would appear at the end of the array as J(0,0,0).
Note that although B and F contain no animation data themselves, they must still be placed on the clipboard as placeholders to preserve the hierarchy information. A placeholder object is defined by a NULL value for the MAnimCurveClipboardItem's animCurve.
There is a special clipboard that remains static. It can be accessed by MAnimCurveClipboard::theAPIClipboard().
Default Constructor.
Class Destructor.
Returns the static API clipboard.
Replaces the contents of the clipboard
Sets the contents of the clipboard.
The leading offset information is not preserved if this method is used. For example, if the keys on the animCurve you wish to cut fall within the range of 10 to 20 frames, and a startTime of 3 is specified, the leading offset of 7 frames is not preserved.
Sets the contents of the clipboard.
The start and end arguments are used to preserve offset information. For example, if the keys on the animCurve you wish to cut fall within the range of 10 to 20 frames, and a startTime of 3 is specified, the offset of 7 frames is preserved.
The arguments startTime and endTime are used to specify the range for animCurves of type kAnimCurveT*, while startUnitlessInput and endUnitlessInput are used to specify the range for animCurves of type kAnimCurveU*.
If the values of the MTime and float arguments are reversed (i.e. startTime > endTime or startUnitlessInput > endUnitlessInput ) then the range to be placed on the clipboard will be determined by the first and last key on the animCurves (i.e. leading offset information will not be preserved).
The start and end values must also bound the animation (i.e. the first and last key respectively), otherwise this method will fail. If there is no animation on any of the items being placed on the clipboard, the range is ignored.
This method empties the clipboard.
Determines if the clipboard is empty.
Returns the contents of the clipboard.
Returns the start time of the clipboard.
Returns the end time of the clipboard.
Returns the start unitless input of the clipboard.
Returns the end unitless input of the clipboard. | http://download.autodesk.com/us/maya/2011help/API/class_m_anim_curve_clipboard.html | CC-MAIN-2019-13 | refinedweb | 663 | 54.73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.