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
Help:Searching The quickest way to find information in the Gentoo Wiki is to look it up directly. Visible in the top right of the screen is a "Search" text box with two buttons beside it labeled "Go" and "Search". Enter search keywords in the Search text box. Clicking: - Go - (or pressing Enter on keyboard) will automatically travel to the article, if it exists. - Search - Here is how the search works: - The article content is searched in its raw (wikitext) form - i.e., it searches the text that appears in the edit box when "Edit" has been clicked, not the rendered page. This means that content coming from an included template will not be picked up, but the target of piped links will be. - When enclosing a phrase in quotes, the search looks for each word individually. E.g., entering "Larry loves Gentoo" it will return pages that contain "Larry" and "loves" and "Gentoo". - The search is not case-sensitive, so "Gentoo", "gentoo" and "GENTOO" all give the same result. Restricting the search If the "Search" button is clicked without entering any search term to the text box, a "Special:Search" page will be displayed providing extra search options. This page is also available from any search results list. It may be useful to restrict a search to pages within a particular namespaces e.g., only search within the User pages. Check the namespaces require for the search before running the query. By default only the namespaces specified in the preferences will be searched. Logged-in users can change their preferences to specify the namespaces they want to search by default. This can be done by selecting and deselecting boxes in the "Search" section of user preferences. See also - Search documentation page on Wikipedia
https://wiki.gentoo.org/wiki/Help:Searching
CC-MAIN-2020-29
refinedweb
294
73.07
Details - Type: Bug - Status: Closed - Priority: Major - Resolution: Fixed - Affects Version/s: 1.7.0 - Fix Version/s: 1.7.2, 1.8-beta-1 - Component/s: None - Labels:None - Environment:Linux, Mac - Testcase included: - Number of attachments : Description When the clibuilder creates a command line option whose longOpt ends with character "s", such as "seconds", the parser can't get the parameter, it is null. Here's a simple groovy script that demonstrates the problem. Note that the long option ending with an 's' gets enabled when the non-s option is given. $> ./cli.groovy -s options.s evaluates to true options.seconds evaluates to false options.e evaluates to false options.second evaluates to false $> ./cli.groovy -e options.s evaluates to false options.seconds evaluates to true options.e evaluates to true options.second evaluates to true def cli = new CliBuilder() cli.s longOpt:'seconds', 'a long arg that ends with an "s"' cli.e longOpt:'second', 'a long arg that does not end with an "s"' def options = cli.parse( args ) if( null == options ) { return } if( args.length == 0 || options.h ) { cli.usage() } println "options.s evaluates to " + (options.s as boolean) println "options.seconds evaluates to " + (options.seconds as boolean) println "options.e evaluates to " + (options.e as boolean) println "options.second evaluates to " + (options.second as boolean) Activity A while back when commons cli looked stalled, I wrote a version of CliBuilder for a different underlying engine. In that, I looked for non-plural forms and only took the 's' off for those cases. It seemed to work well. Perhaps it could be backed ported for our commons cli version. I think that will be an improvement - that options.seconds will become plural of options.second only if option "second" is defined, otherwise, it will try to use it as "seconds" itself. It won't help where both singular and plural options ("second" and "seconds") are defined, as in this JIRA's case, but is an improvement over current behavior nonetheless. Roshan, thanks for the reply. If I use the short option name: "options.s", I still don't get anything. Effectively, it stops people from adding "s" to the end of any long option name, plus, there is no clear documentation on this. For instance, I was trying to use a parameter like "number_of_seconds", if I can't add "s" to the longOpt, I have to change the name to "number_of_second" which sounds weird. Also, I took me quite some time to find the trick of trailing "s", since there was no warning or error in runtime. I searched documentation and couldn't find any thing about this trick. So from a user point of view, this does make people's life more difficult, especially if they are unaware of this trick. We'll improve the behavior now (as Paul has suggested) as well as update the documentation to talk about this plural trick. After the change, it will allow you to have an option like "number_of_seconds" (unless you also have happen to have "number_of_second" because then it will have a conflict with the plural feature again) Fixed, as discussed here. Here is the test that code goes through after the fix: def cli = new CliBuilder () cli.s ( longOpt : 'number_of_seconds', 'a long arg that ends with an "s"' ) def options = cli.parse (['-s']) assert options.hasOption ( 's' ) assert options.hasOption ( 'number_of_seconds' ) assert options.s assert options.number_of_seconds Thanks for the hint, Paul. I don't think that is a bug (may be a documentation issue, but I haven't checked it out yet). The longOpt(s) is there to support getting multiple option values. Say, if you have an option (short name = D, long name = define) that lets you pass multiple values with it, you can retrieve them as getOptionValues('D') or options.defines (plural form, that internally maps to getOptionValues('D')) - so it removes last 's', takes the option long name as 'define' and then invokes the getOptionValues() to get all associated values.
http://jira.codehaus.org/browse/GROOVY-4066?focusedCommentId=210832&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
CC-MAIN-2013-20
refinedweb
671
68.97
Android.Content.ClipData.Item Class Description of a single item in a ClippedData. See Also: ClipData+Item Syntax [Android.Runtime.Register("android/content/ClipData$Item", DoNotGenerateAcw=true)] public class ClipData.Item : Object public class ClipData.Item : Object Remarks Description of a single item in a ClippedData. - Text: a basic string of text. This is actually a CharSequence, so it can be formatted text supported by corresponding Android built-in style spans. (Custom application spans are not supported and will be stripped when transporting through the clipboard.) - Intent: an arbitrary Intent object. A typical use is the shortcut to create when pasting a clipped item on to the home screen. - Uri: a URI reference. This may be any URI (such as an http: URI representing a bookmark), however it is often a content: URI. Using content provider references as clips like this allows an application to share complex or large clips through the standard content provider facilities. The types than an individual item can currently contain are: Requirements Namespace: Android.Content Assembly: Mono.Android (in Mono.Android.dll) Assembly Versions: 0.0.0.0 Since: Added in API level 11 Assembly: Mono.Android (in Mono.Android.dll) Assembly Versions: 0.0.0.0 Since: Added in API level 11 The members of Android.Content.ClipData.Item are listed below.
https://developer.xamarin.com/api/type/Android.Content.ClipData+Item/
CC-MAIN-2019-13
refinedweb
218
54.39
TVZ Mechatronics Team Zagreb University of Applied Sciences, Professional Study in Mechatronics Writing your own mbed library Table of Contents Creating a HC-SR04 class¶ Although there are already a few classes available, begin to build your own class for ultrasonic distance measurement. This is a suitable way of learning to develop your own classes and libraries. First take a look at the revision 0 of the program above. The main.cpp file contains the following parts, which combined together perform the distance measurement: - 2 microcontroller pins ( p5and p7), - 3 main objects ( echo, triggerand timer), - 2 functions ( startTimer()and stopTimer()), - configuration of the rising and falling edges for the echoobject at the beggining of the main.cppfile, - part of the code for starting the measurement and calculation of the distance. Now we are trying to integrate these observations into the class. The class contains its declaration and implementation parts. We will first write the declaration part of the class. Declaration part of the class¶ First we declare a class named HC-SR04. In the public part of the class declaration we declare a constructor. From the above observations we know that we will instatiate our HC-SR04 objects with 2 pins, so our constructor needs to receive two PinName values, e.g. echoPin and triggerPin. Document the meaning of these two values by using the @param markup. Next, we integrate our 3 objects into the private part of the class declaration, to protect them from changing outside the class in an unwanted way. Note that you can not initialize the objects or variables at the declaration part of the class, i.e. you cannot assign a pin to the echo and trigger objects at this point. We will do that later in the constructor implementation. Next, we add our 2 functions to the class declaration. We must decide if the functions will be public or private. In this case, the users of our class don't need to use these functions explicitly, so they can be declared as private. When coppying the functions headers, also copy the initial comments. They will later serve for the purpose of class documentation. Next, the configuration of the rising and falling edges for the echo object, as well as all other configurations, will be implemented later in the constructor init() function. So for now, just add the declaration of init() function in the private part of the class declaration. Finally, add the declarations of functions for starting the measurement and calculating and returning the distance. Figure out which one should be private and which one should be public. Add the distance variable in the private part of the class declaration. The declaration of the class should now look something like this: can now move to the class implementation. Implementation part of the class¶ We are implementing the constructor first. As we mentioned in the declaration part of the class, all initializiations must be performed in the constructor. The pin assigment is mandatory here and it is carried out by using the : operator after the constructor header (line 1 from the code below). All other initializations are carried out in the init() function, which is called immediately in line 2 of the code: HCSR04::HCSR04(PinName echoPin, PinName triggerPin) : echo(echoPin), trigger(triggerPin) { init(); } Why is it a good idea to call another function, like init(), instead of writing the initialization code directly in the constructor? We can later decide to have two or more constructors with some other options. If we would write the initialization code directly in the constructor, then we would have to copy-paste it in every constructor, which is not very practical thing to do. Now let's see the implementation of the init() function: void HCSR04::init() { /** configure the rising edge to start the timer */ echo.rise(this, &HCSR04::startTimer); /** configure the falling edge to stop the timer */ echo.fall(this, &HCSR04::stopTimer); distance = -1; // initial distance } We now have a this pointer with configuration of the rising and falling edges on the echo pin. The reason for this is that the class member functions are stored in a separate place in memory than objects. When an object calls the function, it must pass its own address to that function, so that the function knows on which object it will perform its tasks. The address of the object is stored in the this pointer. Another thing to notice is that the distance variable is initialized to an unrealistic value of -1. This value serves the programmer to recognize that measurements have not yet been made or that another event has occured. It is a good programming practice to initialize every variable in the constructor. The remaining implementations are fairly easy to transfer from the main.cpp file of the revision 0 of the program. The revision 1 of the program contains the class declaration and implementation, as well as the main() function with instantiated object and measurement example. Separating into files¶ The next logical step is separating the class declaration, implementation and main() function into files. Create two new files in your program folder. Name them HCSR04.h (for declaration part of the class) and HCSR04.cpp (implementation part). Then create a new library named HCSR04 and move the created two files in the library. Then cut and paste the appropriate code from the main.cpp in the library files and try to compile the program. Obviously, we need to add some information to the compiler, so it knows where to look for our code. Let's first look at our current main.cpp file. main.cpp /** Revision 2: Separating the class declaration, implementation and main() function into files. */ #include "mbed.h" Serial pc(USBTX, USBRX); // communication with terminal int main() { HCSR04 sensor(p5, p7); // instantiate the sensor object while(1) { /** Print the result in cm to the terminal with 1 decimal place * (number 5 after % means that total of 5 digits will be reserved * for printing the number, including the dot and one decimal place). */ pc.printf("Distance: %5.1f cm\r", sensor.getDistance_cm()); wait_ms(1000-25); } } The compile time error is caused in the line 8, because the comiler doesn't know about the existence of the class HCSR04. We explicitly need to tell the compiler to include it. So, on the line 4 simply add: Add to line 4 of main.cpp #include "HCSR04.h" The HCSR04.h is ok as it is, but at this point we want to add some description of the class for auto-generating documentation. We usually add some sample code with basic usage of the class (like our main.cpp file), because other users will probably import the library into their own programs. The HCSR04.h file should look something like this: HCSR04.h /** A distance measurement class using ultrasonic sensor HC-SR04. * * Example of use: * @code * #include "mbed.h" * #include "HCSR04.h" * * Serial pc(USBTX, USBRX); // communication with terminal * * int main() { * HCSR04 sensor(p5, p7); // instantiate the sensor object * while(1) { * pc.printf("Distance: %5.1f cm\r", sensor.getDistance_cm()); * wait_ms(975); // print the result every 1 second * } * } * @endcode */ still cannot compile our program, because implementation file of the class does not contain the member function prototypes or simply class declaration, as well as the prototypes of functions from mbed.h library. This is also easily solved by adding the #include statements at the beggining of the HCSR04.cpp file: HCSR04.cpp #include "mbed.h" #include "HCSR04.h" HCSR04::HCSR04(PinName echoPin, PinName triggerPin) : echo(echoPin), trigger(triggerPin) { init(); } void HCSR04::init() { /** configure the rising edge to start the timer */ echo.rise(this, &HCSR04::startTimer); /** configure the falling edge to stop the timer */ echo.fall(this, &HCSR04::stopTimer); distance = -1; // initial distance } void HCSR04::startTimer() { timer.start(); // start the timer } void HCSR04::stopTimer() { timer.stop(); // stop the timer } void HCSR04::startMeasurement() { /** Start the measurement by sending the 10us trigger pulse. */ trigger = 1; wait_us(10); trigger = 0; /** Wait for the sensor to finish measurement (generate rise and fall interrupts). * Minimum wait time is determined by maximum measurement distance of 400 cm. * t_min = 400 * 58 = 23200 us = 23.2 ms */ wait_ms(25); /** calculate the distance in cm */ distance = timer.read() * 1e6 / 58; timer.reset(); // reset the timer to 0 after storing the distance } float HCSR04::getDistance_cm() { startMeasurement(); return distance; } Our code can now be compiled without errors or warnings. One last thing to do is to add so called define guards in the declaration part of the class, to prevent multiple inclusion of our library in some other program. The complete program and developed library is published as revision 2 of our program. Note that a library is now separated from our initial program and can be modified without changing our main program. Or we can start a new program and import this library. Import libraryHCSR04 A distance measurement class using ultrasonic sensor HC-SR04. At this point of library development, we have the initial revision of the library and 2 small revisions related to the documentation. So switch to revision 2 of the library and have a look at the auto-generated documentation. Everything should be clear enough. If we are satisfied with the current state of the library and its documentation, we can begin with testing the sensor and use it in some real application. Improving the library¶ While testing the library with the HC-SR04 ultrasonic sensor, we notice some strange readings when the measurement range is below 4 cm and above 400 cm. These values should be set as sensor limit values, and should be interpreted as <4 cm and >400 cm. Try to implement these limitations into our class. The possible solution is given in the revision 3 of the library. Next, add a member function which enables the user to set these limits within the manufacturer declared range of 2 cm and 400 cm. Adjust the default settings of the class to be in this manufacturer declared range. In addittion, enable the user to get the distance in the units of milimeters, and to get the minimum and maximum distance set by the user. The possible solution is given in the revision 5 of the library, and the example of usage is shown in the revision 3 of the program. Try to notice the classic example of a bug in the member function setRanges() and implement the function correctly. Usage of the library with filtering¶ Revision 5 of the program shows the usage of the library with basic filtering using PT1 filter with a time constant of 2 seconds. The measuring results of longer distances (>100 cm) are now more stable, but when the distance suddenly changes, filtered results need about 10 seconds to stabilize the measurement (approximately 5 time constants). Such delay must be taken into account when designing a control system with this sensor and filter. Congratulations! You have completed all the exercises in the An example of writing your own mbed library topic. Return to TVZ Mechatronics Team Homepage.
https://os.mbed.com/teams/TVZ-Mechatronics-Team/wiki/Writing-your-own-mbed-library
CC-MAIN-2021-31
refinedweb
1,837
55.64
I love Python, and the Data Analysis library pandas in particular. It's a fantastic library for working with tabular data, contains connectors for many common data formats out of the box, has an excellent performance profile (as it sits on top of NumPy), and has many many common data operations built in. As a data analyst, I use pandas every day, for most of the day. Sometimes I think of ways I could make more use out of it, for example this gist for getting results from Neo4J into a DataFrame. Sometimes, like today, I think about how I could misuse it for a purely procrastinatory purpose. Want to learn Python? This week our Python Fundamentals course is free inside Mapt. It's an accessible introduction that's comprehensive enough to give you the confidence you need to explore Python further. Click here, log in, and go straight to it! FizzBuzz FizzBuzz is a popular, simple test of a programmer's knowledge and ability, often employed in job interviews to test a candidate's programming/problem solving ability. The basic problem is usually stated is so much discussion of FizzBuzz on the internet, that it almost seems pointless to discuss it anymore. Regardless of your opinion of it as a tool to test programmer knowledge/ability, it is certainly an interesting, if somewhat basic challenge, and is still approached (with varying degrees of irreverence) to this day. The Challenge Partially inspired by Joel Grus' tongue in cheek article above, and partially out of pure interest, I recently started to ponder how one might go about implementing a FizzBuzz solution using pandas. The intention would be to rely on as few non-pandas operations as possible, whilst still producing legible code. First of all, here's a fairly standard vanilla Python solution to the problem: def fizzbuzz(x): '''returns the fizzbuzz output for an integer x''' output = '' if x % 3 == 0: output += 'Fizz' if x % 5 ==0: output += 'Buzz' if (x % 3) > 0 and (x % 5) > 0: output += str(x) return output for i in range(1,101): print fizzbuzz(i) Now, the most simple way to apply this with pandas would be to just use the apply function on a series of integers: import pandas as pd pd.Series(range(1,100)).apply(fizzbuzz) which is simple, terse and readable, but the logic is still being done outside of pandas. What I'm really after is a way to express that fizzbuzz logic entirely with pandas operations. My first crack at this is displayed below. #create a DataFrame containing all the values we need, all the integers, #and a series of Fizzes and Buzzes we can hack together to make our output values = pd.DataFrame( { 'n':range(1,101), 'fizz':'Fizz', 'buzz':'Buzz' } ) #get columns for each of the seperate output types fizzes = values[values['n'] % 3 == 0]['fizz'] buzzes = values[values['n'] % 5 == 0]['buzz'] ints = values[(values['n'] % 3 > 0) & (values['n'] % 5 > 0)].n.apply(str) #put the columns together as one dataframe again outputs = pd.concat([fizzes,buzzes,ints], axis=1) #for each row, concatenate the non-null values together outputs.apply(lambda x: x[~pd.isnull(x)].str.cat(),axis=1) First, we're taking advantage of pandas' quite clever constructor functions to create a DataFrame with all the values we need. Secondly, we use pandas' expressive filtering syntax to create three separate columns containing ONLY the values we need. The third part is to concatenate these columns together to give us one more dataframe containing only the values we need. This takes advantage of pandas' powerful and extensive indexing capabilities, which returns us a dataframe with a nice contiguous index, and all our values in order. Finally, we use apply again to turn each row into a single string. When you supply axis = 1 to the apply method, it feeds each row to your operation in the form of a Series, which makes it easier to work with the row in question. I was fairly happy with this as a first pass. All the logic for deciding what to print is done with pandas operations, and the flow is fairly clear. It's still pretty long though. Yes it could be condensed down to two (very long and ugly) lines of code, but it still doesn't feel like an 'optimal' solution to this (very silly) problem. We can condense this logic down further, and reach one-liner-nirvana by making even more impractical use of pandas' DataFrame constructor: pd.DataFrame( { 'f':pd.Series('Fizz',index=filter(lambda x: x% 3 == 0, range(1,100))), 'b':pd.Series('Buzz',index=filter(lambda x: x% 5 == 0, range(1,100))), 'n':pd.Series( filter(lambda x: x%3>0 and x%5>0,range(1,100)), index=filter(lambda x: x%3>0 and x%5>0,range(1,100)) ).apply(str) } ).apply( lambda x: x[~pd.isnull(x)].str.cat(), axis=1 ) This really feels like progress. The flow is essentially the same as before, but now we construct the Fizz, Buzz and output Series within the DataFrame constructor. This makes the code more succinct, and also serves the crucial purpose of saving some precious bytes of memory, reducing the evident strain on my 16GB, i5 work PC. We can still do better however. You'll note that the above solution contains a filter() function for the fizzbuzz logic, which is a step backwards (within this already backwards problem), Also, the FizzBuzz lines actually say BuzzFizz, which is very annoying and not actually fixable. Version 0.18 of pandas introduced some really neat changes including an expanded set of arithmetic operations for Timedeltas. Another neat little addition was the addition of the ability to filter Series objects using a callable condition. You can also supply an 'other' argument to return when the conditions aren't met. This allows us to bring that filter logic back into pandas, and create our best/worst solution yet: pd.concat( [ pd.Series('Fizz', index=range(1, 100)).where(lambda x: x.index % 3 ==0, other=''), pd.Series('Buzz', index=range(1, 100)).where(lambda x: x.index % 5 ==0, other=''), pd.Series(range(1,100),index=range(1,100)).where(lambda x:(x % 5 > 0) & (x % 3 > 0), '').apply(str), ], axis=1 ).apply(lambda x: x.str.cat(), axis=1) Ok, Ok, I admit it, I've gone too far. I looked at this daft code, and realised my quest for pandas based purity had driven me to creating this abomination. But hey, I learnt a bit about my favorite library in the process, so what's the harm? If I relax my condition for pandas purity slightly, this can be coaxed into something almost readable: pd.concat( [ pd.Series('Fizz', range(0, 100, 3)), pd.Series('Buzz', range(0, 100, 5)), pd.Series(range(100)).where(lambda x:(x % 5 > 0) & (x % 3 > 0), '').apply(str), ], axis=1 ).apply(lambda x: x.str.cat(), axis=1)[1:] And that's where I decided to stop. It's not going to get any better/worse than that, and besides, I have actual work to do. It's been an entertaining bit of work, and I'm satisfied this solution is about as small as I'm going to get within the ridiculous constraints I set myself. Also, I can hear the ardent code golfers screaming at me that NONE of my pandas solutions are valid, because they all print an index column as well as the fizzbuzz values. I don't think there is a way of overcoming this purely in pandas, so you'll have to settle for just wrapping any of them with '\n'.join(...) Performance So, we have several methods for fizzbuzzing with pandas. The next obvious question is about scalability and performance. What if you're interviewing to be a Big Data Engineer at Google, and they ask you for the fastest, most scalable, general fizzbuzz solution in your arsenal? Let's take our functions above for a test drive. We'll encapsulate each as a function, then see how they scale as we ask for ever larger ranges. I'm using a quick and dirty method of timing this as I don't actually care that much. def fizzbuzz(x): '''returns the fizzbuzz output for an integer x''' output = '' if x % 3 == 0: output += 'Fizz' if x % 5 ==0: output += 'Buzz' if (x % 3) > 0 and (x % 5) > 0: output += str(x) return output #our vanilla solution def fb_vanilla(rng): return map(fizzbuzz, range(1, rng+1)) #our trivial pandas solution def fb_pandas_vanilla(rng): return pd.Series(range(1, rng+1)).apply(fizzbuzz) #I'm going to skip the first big pandas solution, this is pretty much identical #our second pandas solution, down to one line def fb_pandas_long(rng): return pd.DataFrame( { 'f':pd.Series('Fizz',index=filter(lambda x: x% 3 == 0, range(1,rng+1))), 'b':pd.Series('Buzz',index=filter(lambda x: x% 5 == 0, range(1,rng+1))), 'n':pd.Series( filter(lambda x: x%3>0 and x%5>0,range(1,rng+1)), index=filter(lambda x: x%3>0 and x%5>0,range(1,rng+1)) ).apply(str) } ).apply( lambda x: x[~pd.isnull(x)].str.cat(), axis=1 ) #our more succinct, pandas only solution. def fb_pandas_shorter(rng): return pd.concat( [ pd.Series('Fizz', index=range(1, rng+1)).where(lambda x: x.index % 3 ==0, other=''), pd.Series('Buzz', index=range(1, 100)).where(lambda x: x.index % 5 ==0, other=''), pd.Series(range(1,rng+1),index=range(1,rng+1)).where(lambda x:(x % 5 > 0) & (x % 3 > 0), '').apply(str), ], axis=1 ).apply(lambda x: x.str.cat(), axis=1) #our shortest solution, relying on some non-pandas stuff def fb_pandas_shortest(rng): return pd.concat( [ pd.Series('Fizz', range(0, rng+1, 3)), pd.Series('Buzz', range(0, rng+1, 5)), pd.Series(range(rng+1)).where(lambda x:(x % 5 > 0) & (x % 3 > 0), '').apply(str), ], axis=1 ).apply(lambda x: x.str.cat(), axis=1)[1:] #Let's do some testing! functions = [ fb_vanilla, fb_pandas_vanilla, fb_pandas_long, fb_pandas_shorter, fb_pandas_shortest ] times = {x.__name__:[] for x in functions} tests = range(1,1000,100) from time import time for i in tests: for x in functions: t1 = time() _ = x(i) t2 = time() times[x.__name__].append(t2-t1) results = pd.DataFrame(times, index = tests) Well, so far so terrible. The first, longest solution actually scales O(n), which I find hilarious for some reason. The rest of my attempts fare a little better, but nothing compares to the vanilla python solution, which doesn't even show up on this chart, because it completes in <1ms. Let's discard that long solution, and try an even more strenuous test, up to 100,000. That seems pretty conclusive. Get me Google on the phone, I have solved this problem. When should this be used? NEVER. Like, seriously, those results are beyond terrible. I was expecting the pandas solutions to fall down compared to the vanilla python solutions, but this is ridiculous. If you're asked to implement fizzbuzz in your next interview, the only possible reason you would have for using any of these is because you're a flippant contrarian like me. Having said that, it's important to note that I still love pandas, and don't blame these results on the fantastic devs there. This is thoroughly not what the library is designed for, and I'm only doing this to test my own fluency with the tool. Overall I think I acheived my goal with this. I made myself chuckle a few times, and I learnt a few things about pandas in the process. If you have any suggestions for optimisations to this code, reach out in the comments or on Twitter. Equally, if you have any thoughts on why specifically these pandas functions are SOOO much slower than the vanilla solution, I'd be interested to hear them.
https://www.packtpub.com/books/content/fizzbuzz-only-pandas-how-not-pass-job-interview
CC-MAIN-2017-13
refinedweb
2,009
65.01
Family Law Family Law Questions? Ask a Family Lawyer Online. Join the 9 million people who found a smarter way to get Expert help Recent Mediated Divorce questions Hi, I went through a mediated divorce, March 3 2016, since then my ex husband hasn't kept to an of the agreed upon support, or property settlement s, he started a Land Surveyors company during our 32 year marriage, he is supposed to be paying $1500 a month, alimony in gross, until he pays $380,000 ,he constantly threatens me, and even been in a drunken standoff with the police, and wasn't charged . My attorney has now quit because of fear of him, now I am forced to start over trying to get a contempt hearing, I have been waiting since, late June and still don't have a court date, what can I do to try and get justice, he seems to get away with everything, he has many DUI S laughs at me, because he gets away with not paying, he had a mistress spent $200,000 on lavish vacations for the both of them, that's why I divorced him, it just seems I try and fight for justice but just can't get it. Read more Juris Doctorate I signed a mediated divorce settlement last week. In it; "either parent may apply for a passport on behalf of the child. Both parents shall be entitled to travel internationally with the child with consent of the other parent. Consent for international travel shall not be unreasonably withheld by either parent." "Both parents shall be permanently enjoined from permanently removing the child from this Texas jurisdiction"1. Due to the souring relationship between the U.S. and the Phillipines lately, Is it "(unreasonable)" to deny travel with the child at this time, until relations between our countries get better?2. Her home is in the southern island of Mindinao, also the home of the Abu sayaf muslim extremist group, who kidnaps and executes foreigners. Is it also "(unreasonable)" to deny her international travel with the child to this region because of this terrorism threat/risk?3. Is it possible to insert a bond requirement of $20k before her traveling with the child, since she will be getting 60k out of our retirement account upon dissolution of our marriage?4.What is the legal interpretation of (unreasonable)?5. If I refuse to allow her international travel after this agreement if finalized, what are her options? Attorney My name is***** (husband). My wife has expressed interest in filing for a mediated divorce at a pace and selection of attorney that will be dependent entirely on her timeline.In the meantime, I need to move out of my temporary residence and purchase a home (PROPERTY C in attachment) and at the same time benefit from very low interest rates (expected to climb next year).I'm seeking your advice on establishing a legal mechanism for establishing ownership that will be free of loopholes and will be 100% bulletproof to meet my primary objective. Meeting my secondary objective would be a "nice to have".Details are in the attached Word document.Thanks, James(###) ###-#### Doctoral Degree My wife and I are in the midst of a mediated divorce in Mass. My wife has earned and will continue to earn substantially more than me, and over the next four years will take 100% responsibility for college expenses for two children (one entering her senior year, and the other his freshman year.We have three 529 plans that will cover some of those expenses: one for each child, funded by my wife via payroll deductions, and one funded by my parents in our second child's name. The remainder, ~$196K(!) are to be paid out of her future earnings.We agree that this substantial financial burden should be factored in to the settlement (I will be the beneficiary of both alimony the division of marital assets, most of which are in her 401K. The question is: what is a fair way to calculate that adjustment -- e.g., 100% of that $196K? 50% of it? Or some other proportion?Many thanks.We have agreed that this huge financial obligation should recognized via a reduction in the ultimate Litigation Attorney I am 61 years old and my divorce was finalized on 12/11 2014. i live in trenton, new jersey, mercer county.the divorce was a mediated divorce and I willingly gave everything to my ex-wife. I took nothing but my personal effects from the marriage.I made one demand and that was to have 12 months to have access to the family photo albums and tapes to make copies for me.the agreement states that I must give 2 weeks notice to pick up the albums (2 at a time), I have 2 weeks to copy them, and then return them, at which time I will receive 2 more, etc.the first 2 albums pick up, return, etc., went fine, as did the next 2. however, with this most recent pick up, return (returned to my ex-wife on sunday, may 17, 2014) and she texted me and said that two photos were out of order and "the deal is off", "no more albums".I know that the photos were placed back in the exact spot that they were taken and that this is an excuse made by my ex-wife to prevent me from access. I had returned the first 4 albums without issue (although I would receive texts from my ex-wife that were terrible and hateful), but I kept going.I know that I am within my rights to have access to these albums. I do not have an attorney but I want to file a complaint with the appropriate NJ office to make my ex-wife comply. Please also know that I did make three requests to my ex-wife's attorney to please talk with her but I he has not done anything.can you please direct me to the right office in New Jersey, Mercer County to file a complaint about her breaching this agreement and that her lawyer is doing nothing about it? I need specific contact information for this office so I may contact them. thank youBob Voorhees I am retired and collecting social security benefits,as is my wife.During divorce negotiations (mediated divorce)would my spouse be entitled to any portion of my social security income,as with pension,IRA,etc.? Hello My name is XXXXX XXXXX I am in desperate need of help. I have been married to my Pakistani husband for 15 years and we have to children. I am a citizen by birth and he became one after two years in the country. I have just learned in the last week that during my husband's visit to Pakistan almost 9 years ago he got married. This while I was 8 months pregnant with our second child. He and his Pakistani wife also have two children After yeas of cruelty and indifference he now feels that since everything out we should reconcile and make our marriage work. He lives in the downstairs of our home and have been physically separated for the past 6 years due to his drinking and cruel behavior. Now he feels that since he is no longer drinking and has "come clean" I should "make things work". NEVER have I wanted to run as far and fast as I do now. . Unfortunately, because I am being treated for physical problems {car accident years ago} I depend on him financially and tells me I will suffer financially if I divorce him. We have a modest home {which I want} and a pizza/deli. Please, Please advise...I'm so in shock by all of this my head I spinning. I was poorly represented in mediation divorce, our mediator did a very poor job and left the door open for me to get taken to the cleaners during the QDRO mediation part of divorce. Several verbal agreements were made during divorce mediation and attorney said it would be handle with a MSA and during QDRO. Well after divorce final ex fired mediator got differant attorney and is now and as taken me to the cleaners. The more I research the more I find out how bad the mediator was. Can I anul mediation final divorce and take all back to court, ex fired mediator knowing that she could not be taken to court to testify on verbal agreements made during mediation and what ex wife agreed to and then went against when taking my retirement. I am in california is it possible to retry divorce and start from scratch to get fairness. Hi, My wife (of 23 years) are currently going thru a mediated divorce in CT. Since our mediator, although an attorney, can cannot actually represent either of us --- I want to confirm some points re: alimony. According to the mediator, the alimony calculation goes something like take the higher wage earners salary, minus the lower wage earners salary, divide by 2 to arrive at the yearly alimony payment. The alimony duration is about half of the total years married -- 11.5 for us --- or until she is remarried/co-habitating. I'd like to confirm if that above calulation sounds accurate and based on the fact I'm 58 yrs old, is there any consideration for shortening the alimony duration, say until I.
http://www.justanswer.com/topics-mediated-divorce/
CC-MAIN-2017-04
refinedweb
1,585
59.23
[NOTE: I am not responsible to what this does to you or your computer] 100% made by me !! Let's begin! Lets start with the import statements! Ok, now for class name you put it your as your title, but i'm making mine VadersProg.Ok, now for class name you put it your as your title, but i'm making mine VadersProg.import java.util.Scanner.*; // including Java's util scanner... import java.net.*; // including Java's network API... Hope this helped!Hope this helped!public class VadersProg { static Scanner scanner = new Scanner(System.in); static Host; public static void main(String[] args) { System.out.println("Vaders Ip look up, Enter a web address: "); do { host = scanner.nextLine(); try { InetAddress[] addresses = InetAddress.getAllByName(host) // gets host's name for (InetAddress ip : addresses) System.out.println(ip.toString()); } catch (UnknownHostException e) { System.out.println("not a host or invalid or unknown"); } } while (again()); } private static boolean again(); { System.out.println(); String d while (true) { System.out.println("again?" + "yes or no"); d = scanner.nextLine(); if(s.equalsIgnoreCase("no")) return false; else if (s.equalsIgnoreCase("yes")); return true; // returns to menu
http://www.javaprogrammingforums.com/java-networking-tutorials/30128-how-look-up-host-ip.html
CC-MAIN-2015-27
refinedweb
190
55
This. This article is intended to illustrate how to call Oracle stored procedures and functions from Microsoft.NET through the Microsoft.NET Oracle provider and its object model residing in the namespace System.Data.OracleClient. I will cover several possible scenarios with advanced examples. Let's begin with definitions. A procedure is a module that performs one or more actions. A function is a module that returns a value and unlike procedures a call to a function can exist only as part of an executable such as an element in an expression or the value assigned as default in a declaration of a variable. The first example illustrates how to call an Oracle procedure passing input parameters and retrieving value by output parameters. For all the examples, we're going to use the default database ORCL which comes with the Oracle database installation. The following code in Listing 1 shows how to create a procedure named count_emp_by_dept which receives as its input parameter the department number and sends as its output parameter the number of employees in this department. The following code in Listing 3 shows how to create a function named get_count_emp_by_dept which receives as its input parameter the department number and returns the number of employees in this department. It's very similar to the former procedure in the previous section. Listing 3: Creating an Oracle function. Now let's see in the Listing 4 the application code which calls the function. As you can see, we need to define a return parameter to get the returned value. The other part of the code is similar for calling a procedure. You can use the REF CURSOR data type to work with Oracle result set. To retrieve the result set, you must define a REF CURSOR output parameter in a procedure or a function to pass the cursor back to your application. Now we're going to define a procedure which opens and sends a cursor variable to our application. Let's define the package and procedure header as shown in Listing 5. And now the package definition as shown in Listing 6. Now let's see in Listing 7 the application code calling the procedure inside the package. See the name syntax for calling the procedure contained within a package [package_name].[procedure_name]. In order to get a cursor, you need to define a cursor parameter with the ParameterDirection set up to Output and finally call the ExecuteReader method in the OracleCommand instance. If the procedure returns more than one cursor, the DataReader object accesses them by calling the NextResult method to advance the next cursor. Let's see the following example. Listing 8 shows how to create the package header. The package body is shown in Listing 9. Let's see the application code in Listing 10. Listing 10: The application code. The final example shows how to fill and update a DataSet object through a DataAdapter object. The first thing to do is create four CRUD procedure to the emp table. Listing 11 shows how to create the package header. Now let's define the package body as shown in Listing 12 And finally, let's see the application code in Listing 13. As you can see, to fill the data table, we need to define the CRUD (create, read, update, delete) operations through the OracleCommand and associate it to the DataAdapter. I fill the data table, and print out a message with the number of employees so far, and then add a new row representing one employee entity. Listing 12: The application code. In this article I explained in an extensive way how to access Oracle procedures and functions using Microsoft.NET. I tried to cover all the possible scenario of one .NET application consuming the data provided by stored procedures in Oracle databases. View All
https://www.c-sharpcorner.com/article/calling-oracle-stored-procedures-from-microsoft-net/
CC-MAIN-2020-10
refinedweb
640
55.64
Photoshop EXpress Mem Patch [Win/Mac] [Updated] Photoshop EXpress Crack + Download [Win/Mac] (2022) Photoshop is built in the same toolbox as Illustrator, Dreamweaver, and other programs from Adobe. You can use them simultaneously or separately. In addition, the latest version of Photoshop (CS6) also includes layer-based Photoshop Elements, which allows you to create raster images using your computer’s graphics software. Figure 1-1 shows a split screen view of Photoshop CS6 on a Mac. Illustrator Illustrator is Adobe’s other professional-level illustrator program, which is often used for print designs and packaging designs. It’s also an important tool for graphic designers. Illustrator can be used to create raster art, create vector art, and use many other different tools. Figure 1-1: Photoshop CS6 on a Mac computer. Preparing Your Photoshop Document It can be very frustrating at first to open up Photoshop or any other image editing program for the first time because the process is so daunting. We suggest that you spend a little time preparing your files before you begin. Follow these three steps to prepare your file for editing: 1. Create a new document. You can create a new document for any image editing task. Choose File⇒New from the menu to start the process. Alternatively, you can open the standard Photoshop file format and import your image (see the next two steps). If you’re using any advanced software, create a new document in that program before switching to Photoshop. You need to save the location of that file, so make sure you have the option set to save the file to your hard drive. 2. Resize your image. See the next two sections for tips on resizing your files in the different versions of Photoshop. 3. Choose a color scheme. Choose a color scheme to work with and give your images a style. When choosing color schemes, follow these three steps: • Choose an RGB color scheme for Photoshop CS6. Because Photoshop can handle the three-color RGB file format, and because it’s the most useful format to designers and illustrators, you should set up your image colors using the RGB color model. • Choose a CMYK color scheme for Photoshop Elements. Photoshop Elements is optimized for printing, and its CMYK color model requires a larger color palette than does RGB. • Select a grayscale or monochrome color scheme for Photoshop. Photoshop EXpress Crack + Activation Key [Win/Mac] [Latest] Adobe Photoshop is a bit expensive but you can download the trial version for 30 days and test it before you buy it. It is a much more advanced software than Photoshop Elements, but Elements has some cool features. Before you start using Adobe Photoshop or Photoshop Elements, here are four tips for a better experience: Use a quality monitor Save an image as high resolution Limit the image editing process to one hour Change settings to high performance Adobe Photoshop Buy the software Before you use Photoshop or Photoshop Elements, you should buy a copy to ensure that your software works properly. The product pages on Amazon can be tricky to navigate, but here’s a link for Adobe Photoshop. You can also buy a copy directly from Adobe. Download software When you purchase a licence, you will usually get a link to download the software. Download Adobe Photoshop from Adobe: Download Photoshop Elements from Adobe: Download Adobe Photoshop from Adobe: Download Photoshop Elements from Adobe: Download the latest software from the Adobe download website. There are a lot of free and paid websites for students, professionals and hobbyists that offer Photoshop software downloads. You can download and install Photoshop free of charge. However, free software is usually not supported, it will stop working if you update your operating system. Buying a full version of Photoshop Get a full version of Photoshop or Photoshop Elements and use it to edit a photo, design a web page or edit a painting. The software is very easy to use for beginners. If you need to learn how to use the software, you can read this tutorial. You can buy a licence at a shop or from the Adobe website. Buying Adobe Photoshop Creative Cloud An Adobe Photoshop Creative Cloud is a subscription based service. You can buy a software upgrade or a subscription on the website. The subscription costs around £10 a month and gives you a free upgrade after 30 days. When you buy a subscription, the first time you use the software after the subscription start, you will have to activate the software using a payment method. You will receive an email from Adobe with a “product key” in the email. You must click on “register” to create an account and input the product key. Online services from Adobe Create, Publish, Publish online services for websites and online publishing with a681f4349e Photoshop EXpress Patch With Serial Key [Win/Mac] [Latest] Magic backstops Romo in Game 4 win for Cowboys Published 11:34 am, Thursday, May 10, 2013 ARLINGTON, Texas — Josh McCown had a go-ahead touchdown pass thrown to a wide-open Calvin Johnson. Matt Stafford had a touchdown pass picked off in the end zone. But the Dallas Cowboys needed a special play from Nick Folk, and they got it from him on Monday night in the best game of this postseason. Folk’s 57-yard field goal bounced off the left upright on a wide open the middle of the field, and Dallas built a 27-0 lead in the first half of its win that evened this NFC Divisional Playoff series at 2-2. Dallas also forced two Matt Stafford interceptions, highlighted by the one by Morris Claiborne that gave the Cowboys possession at the Detroit 35. “We had a close call on the last play, and I think it’s just our confidence with winning,” Cowboys wide receiver Miles Austin said. “We felt like we were going to win this game.” Romo threw for four touchdowns, with two of them going to Dez Bryant. DeMarco Murray and Felix Jones added scores, and the Cowboys showed their playoff mettle once again, rolling to a 51-34 win over the Lions. Coach Jason Garrett was asked what it was about this team that’s allowed them to be so consistent over the course of the season, particularly in wins. “I think it’s just the toughness that we have,” he said. “We play the same way the whole time and the approach is the same. As long as we keep that alive, we’re going to keep finding ways to get it done.” The Cowboys had a better first half than Detroit, outscoring the Lions 8-0 and forcing four turnovers. The Cowboys also did a better job of staying out of the rush, with Detroit averaging 4.4 yards per play. Detroit gained just 113 total yards in the half — 68 by Stafford and 45 by the defense. The Lions couldn’t get the ball even down the field, and when they did, they were frequently forced to settle for field goals. Detroit had just seven net passing yards in the first 30 minutes. The Cowboys also played the turnover battle closer than they had all year. “We had some moments of miscues,” Garrett said. “But we were able to minimize it in the game.” Romo had What’s New in the Photoshop.netflix.spinnaker.clouddriver.kubernetes.caching import com.fasterxml.jackson.core.JsonProcessingException import com.fasterxml.jackson.databind.ObjectMapper import com.netflix.spinnaker.clouddriver.kubernetes.description.KubernetesCluster import com.netflix.spinnaker.clouddriver.kubernetes.description.KubernetesVaultDescription import com.netflix.spinnaker.clouddriver.kubernetes.config.KubernetesAccessTokenProvider import com.netflix.spinnaker.clouddriver.kubernetes.config.KubernetesListVersionsResponse import com.netflix.spinnaker.clouddriver.kubernetes.description.KubernetesVaultDescription.VaultProvider import com.netflix.spinnaker.clouddriver.kubernetes.description.KubernetesVaultDescription.VaultProvider.VaultCredentials import com.netflix.spinnaker.clouddriver.kubernetes.provider.KubernetesProvider import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation.OperationType import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation.OperationType.RESTORE_BACKUP import com. System Requirements: Supported OS: Windows 10, Windows 7 Processor: Intel Core 2 Duo 2.0GHz or equivalent Memory: 1 GB RAM Graphics: Radeon HD 4650 or equivalent DirectX: Version 9.0c Network: Broadband Internet connection Storage: 250 MB available space Sound Card: DirectX compatible sound card with latest drivers Other requirements: CD/DVD Burner How to Install: 1. Run the game setup and follow the prompts. 2. After that, install the
https://www.kendamahouse.com/photoshop-express-mem-patch-win-mac-updated/
CC-MAIN-2022-40
refinedweb
1,407
56.35
THE PROBLEM Create a 4X3 integer array and fill it, column by column, with the odd numbers starting with 1. In a separate, one dimensional array, store the average of each column of the 4X3 array. Output the 4X3 array (as a 4X3 array) and output the average of each column underneath each column. Label .. Category : average I am a C++ noob and this is the problem i am trying to accomplish. Go easy on me im new to this and don’t know everything lol. Create a 2-D double array with 5 rows and 4 columns. Each row should hold a student’s three test grades (make them up) and has a place .. I recently got an assignment that tasks me to create a class which contains private variables and member functions/void functions. Classes have just been introduced to me and my teacher gave me an assignment that I don’t really understand. The issue I’m having is that the average and letter grade aren’t correctly being outputted as .. am trying to develop a code that accepts input numbers from user then they would press enter and the numbers input the average will be found. My issue is line 14 which says error: primary-expression before ‘)’ token #include <iostream> using namespace std; int main() { int num, sum, count; float average; sum=0; count=0; .. When I use float as a variable, all results related to it are equal to zero after compiling. Source: Windows Que.. I have 27000 csv files and I want to calculate the average of each column and write in last row also code that automatically iterate through 27000 files and tell me according to any column which have minimum average. I calculate average from this code but no idea how can I go through each file. .. So I need to find the average of x amount of students’ grades (its a loop). It will keep adding until you enter -1. I got the average correct but to find the largest value is where the problem is at. It always prints out a garbage value instead of the largest value out of .. I need to write a program in C++ that asks for an amount of numbers and prints the sum and average of the entered numbers. The user must enter 0 at the end of the speech series. The program should also print the second largest AND the largest number. The program must be made up .. In excel, I have a column of about 30,000 entries. I want to take that column and create a new one where the first entry will be the average of the first 4 entries in the original column. The 2 entry in the new column will be the average of the next 4 entries of .. Recent Comments
https://windowsquestions.com/category/average/
CC-MAIN-2021-21
refinedweb
473
71.04
Caching is the process of storing data in a temporary storage area called cache. When you return to a page you've recently visited, the browser can get those files from the cache rather than the original server. This saves your time, and network from the burden of additional traffic. Client applications interacting with GraphQL are responsible for caching data at their end. One possible pattern for this is reserving a field, like id, to be a globally unique identifier. InMemoryCache is a normalized data store commonly used in GraphQL client applications without use of other library like Redux. The sample code to use InMemoryCache with ApolloClient is given below − import {ApolloClient, HttpLink, InMemoryCache} from 'apollo-boost' const cache = new InMemoryCache(); const client = new ApolloClient({ link: new HttpLink(), cache }); The InMemoryCache constructor takes an optional config object with properties to customize your cache. We will create a single page application in ReactJS with two tabs – one for the home tab and another for students. The students tab will load data from a GraphQL server API. The application will query for students data when the user navigates from the home tab to the students tab. The resulting data will be cached by the application. We will also query the server time using getTime field to verify if the page is cached. If data is returned from the cache, the page will display the time of very first request sent to the server. If the data is a result of a fresh request made to the sever, it will always show the latest time from server. Following are the steps for setting up the server − Create a folder cache-server-app. Change your directory to cache-server-app from the terminal. Follow steps 3 to 5 explained in the Environment Setup chapter. Add schema.graphql file in the project folder cache-server-app and add the following code − type Query { students:[Student] getTime:String } type Student { id:ID! firstName:String lastName:String fullName:String } Create a file resolvers.js in the project folder, and add the following code − const db = require('./db') const Query = { students:() => db.students.list(), getTime:() => { const today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); return `${h}:${m}:${s}`; } } module.exports = {Query} Create a server.js file. Refer step 8 in the Environment Setup Chapter. Execute the command npm start in the terminal. The server will be up and running on 9000 port. Here, we will use GraphiQL as a client to test the application. Open browser and enter the URL. Type the following query in the editor − { getTime students { id firstName } } The sample response shows the students names and the server time. { "data": { "getTime": "22:18:42", "students": [ { "id": "S1001", "firstName": "Mohtashim" }, { "id": "S1002", "firstName": "Kannan" }, { "id": "S1003", "firstName": "Kiran" } ] } } Open a new terminal for client. The server terminal should be kept running before executing the client application. React application will be running on port number 3000 and server application on port number 9000. In the client terminal, type the following command − npx create-react-app hello-world-client This will install everything needed for a typical react application. The npx utility and create-react-app tools create a project with name hello-world-client. Once the installation is completed, open the project in VSCode. Install router modules for react using following command – npm install react-router-dom. Change the current folder path in the terminal to hello-world-client. Type npm start to launch the project. This will run a development server at port 3000 and will automatically open the browser and load the index page. This is shown in the screenshot given below − To install an Apollo Client, open a new terminal and be in current project folder path. Type the following command − npm install apollo-boost graphql This will download the graphql libraries for client side and also the Apollo Boost package. We can cross verify this by typing npm view apollo-boost dependencies. This will have many dependencies as shown below − { 'apollo-cache': '^1.1.15', 'apollo-cache-inmemory': '^1.2.8', 'apollo-client': '^2.4.0', 'apollo-link': '^1.0.6', 'apollo-link-error': '^1.0.3', 'apollo-link-http': '^1.3.1', 'apollo-link-state': '^0.4.0', 'graphql-tag': '^2.4.2' } We can clearly see that apollo-client library is installed. For a simple react application, you only need to keep the index.js in src folder and index.html in public folder; all other files that are auto generated can be removed. The directory structure is given below − hello-world-client / -->node_modules -->public index.html -->src index.js students.js -->package.json Add an additional file students.js which will contain Students Component. Student details are fetched through the Student Component. In the App Component, we are using a HashRouter. Following is the index.js in react application − import React, {Component} from 'react'; import ReactDOM from 'react-dom'; import {HashRouter, Route, Link} from 'react-router-dom' //components import Students from './students' class App extends Component { render() { return( <div><h1>Home !!</h1> <h2>Welcome to React Application !! </h2> </div> ) } } function getTime() { var d = new Date(); return d.getHours()+":"+d.getMinutes()+":"+d.getSeconds() } const routes = <HashRouter> <div> <h4>Time from react app:{getTime()}</h4> <header> <h1> <Link to="/">Home</Link> <Link to = "/students">Students</Link> </h1> </header> <Route exact path = "/students" component = {Students}></Route> <Route exact path = "/" component = {App}></Route> </div> </HashRouter> ReactDOM.render(routes, document.querySelector("#root")) In Students Component, we will use the following two approaches to load data − Fetch API (loadStudents_noCache) − This will trigger a new request everytime the clicks the student tab. Apollo Client (loadWithApolloclient) − This will fetch data from the cache. Add a function loadWithApolloclient which queries for students and time from server. This function will enable caching. Here we use a gql function to parse the query. async loadWithApolloclient() { const query = gql`{ getTime students { id firstName } }`; const {data} = await client.query({query}) return data; } The Fetch API is a simple interface for fetching resources. Fetch makes it easier to make web requests and handle responses than with the older XMLHttpRequest. Following method shows loading data directly using fetch api − async loadStudents_noCache() { const response = await fetch('', { method:'POST', headers:{'content-type':'application/json'}, body:JSON.stringify({query:`{ getTime students { id firstName } }`}) }) const rsponseBody = await response.json(); return rsponseBody.data; } In the constructor of StudentsComponent, call the loadWithApolloClient method. The complete Student.js file is below − import React, {Component} from 'react'; import { Link} from 'react-router-dom' //Apollo Client import {ApolloClient, HttpLink, InMemoryCache} from 'apollo-boost' import gql from 'graphql-tag' const client = new ApolloClient({ link: new HttpLink({uri:``}), cache:new InMemoryCache() }) class Students extends Component { constructor(props) { super(props); this.state = { students:[{id:1,firstName:'test'}], serverTime:'' } this.loadWithApolloclient().then(data => { this.setState({ students:data.students, serverTime:data.getTime }) }) } async loadStudents_noCache() { const response = await fetch('', { method:'POST', headers:{'content-type':'application/json'}, body:JSON.stringify({query:`{ getTime students { id firstName } }`}) }) const rsponseBody = await response.json(); return rsponseBody.data; } async loadWithApolloclient() { console.log("inside apollo client function") const query = gql`{ getTime students { id firstName } }`; const {data} = await client.query({query}) return data; } render() { return( <div> <h3>Time from GraphQL server :{this.state.serverTime}</h3> <p>Following Students Found </p> <div> <ul> { this.state.students.map(s => { return( <li key = {s.id}> {s.firstName} </li> ) }) } </ul> </div> </div> ) } } export default Students You can test the react application by switching from home tab to students tab. Once the students tab is loaded with data from server. It will cache the data. You can test it by switching from home to students tab multiple times. The output will be as shown below − If you have loaded the students page first by typing the URL,, you can see that the load time for react app and GraphQL would be approximately same. After that if you switch to home view and return to the GraphQL server, the time will not change. This shows the data is cached. If you change the load method to loadStudents_noCache in the constructor of StudentComponent, the output will not cache the data. This shows the difference between caching and non-caching. this.loadStudents_noCache().then(data => { this.setState({ students:data.students, serverTime:data.getTime }) }) From the above output, it is clear that if you switch back and forth between the tabs, the time from graphql server will always be the latest which means the data is not cached.
https://www.tutorialspoint.com/graphql/graphql_caching.htm
CC-MAIN-2020-05
refinedweb
1,407
50.73
Inlines external CSS into HTML elements. Project description inlinestyler is an easy way to locally inline CSS into an HTML email message. Styling HTML email is a black art. CSS works, but only when it’s been placed inline on the individual elements (and event then, not always) - which makes development frustrating, and iteration slow. The general solution is to use an inlining service, which takes a message with the CSS placed externally, and rewrites it so that all CSS is applied to the individual elements. The most widely used of these services - and as far as I can tell, the one that powers CampaignMonitor - is Premailer. It’s a great service, and the guys behind it put a lot of work into keeping it up to date with the most recent discoveries in what works and what doesn’t. inlinestyler takes (most) of the functionality of Premailer, and makes it available locally, accessible without having call a remote service. To see what inline-styler can do, check out this demo. Caveat Emptor This project is relatively unmaintained. I will continue to do simple bugfixes (and patches with tests are welcome), but I won’t be adding features or making new CSS attributes work. If this doesn’t do what you need, check out the premailer project. History Dave Cranwell wrote the original inline-styler single-app Django project. inlinestyler is a refactor of that project into a free-standing package usable outside of Django. Requirements inlinestyler requires the following packages in order to run: - cssutils - lxml It also requires a css_complaiance.csv file, which indicates the compatibility of various email clients with certain CSS features. This is included with the package, but can be updated manually from Campaign Monitor’s spreadsheet. Usage from inlinestyler.utils import inline_css message_inline_css = inline_css(message_external_css) message_external_css must be a string containing the message to be inlined, with the CSS presented in the HTML as one of: - an absolute link <link rel="stylesheet" href="" /> - a <style> block in the <head>, without the use of @import. The code will also calculate an estimate for how compatible your message is with various clients (using the css_compliance.csv file), but this number isn’t yet exposed. Contributions All development happens at github:. To get yourself started: - Clone this repo somewhere - make init to install the right dependencies - make test to run the test suite Contributions are always more than welcome. If you see something missing, add it in and send me a pull request. NOTE: Ubuntu 12.04 (and some other distros) include libxslt version 1.1.26, which changes the now-empty <head> tag to <head/> - which isn’t valid HTML 5. To see which version of libxslt was used to build your libxml, examine the output of make init and look for the line that looks like Using build configuration of libxslt 1.1.XX; if that says 26, some test failures are expected (at which point, you can rely on TravisCI to run your tests for you). You could also install your own version of libxslt from source, but you’re probably going to have a bad time. License This distribution is licensed under the New BSD License. Please see the LICENSE file for a full copy of the license text. As far as I can tell, Dave Cranwell released the underlying inline-styler project into the public domain: I’m […] releasing it to the public after many requests for the source. Project details Release history Release notifications | RSS feed Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/inlinestyler/
CC-MAIN-2022-05
refinedweb
606
63.19
00001 //-*-c++-*- 00002 #ifndef INCLUDED_Profiler_h_ 00003 #define INCLUDED_Profiler_h_ 00004 00005 #include "TimeET.h" 00006 #include <string> 00007 00008 //! put this at the beginning of any function for which you wish to collect profiling information 00009 /*! Uses a variable named _PROFSECTION_id to store a static ID number - don't redefine or modify that... 00010 * @param NAME the name of this section for reporting 00011 * @param PROF the actual profiler to use 00012 */ 00013 #ifndef PROFSECTION 00014 #define PROFSECTION(NAME,PROF) \ 00015 static unsigned int _PROFSECTION_id=(PROF).getNewID(NAME);\ 00016 Profiler::Timer _PROFSECTION_timer(_PROFSECTION_id,&(PROF).prof); 00017 #endif 00018 00019 //! Manages a hierarchy of timers for profiling time spent in code, gives microsecond resolution 00020 /*! Doesn't use any pointers so it's safe to put this in shared memory regions.\n 00021 * That's handy so one process can collate all the profiling information across processes 00022 * to give a summary report to the user.\n 00023 * 00024 * Example usage: 00025 * - Use a static variable to hold an id number for the code section (doesn't necessarily have to be static, but is faster that way) 00026 * - Create a Profiler::Timer object - its construction marks the 'start' time, and its destructor marks the 'stop' time. 00027 * 00028 * @code 00029 * ProfilerOfSize<2> prof; //A global manager for all the sections 00030 * 00031 * void f() { 00032 * static unsigned int id=prof.getNewID("f"); // <== Get the ID number 00033 * Profiler::Timer timer(id,&prof.prof); // <== start the timer 00034 * //... 00035 * if(rand()>RAND_MAX/2) 00036 * return; // destruction of timer occurs automatically! 00037 * //... 00038 * } // if we didn't hit the return, timer will otherwise destruct here! 00039 * @endcode 00040 * 00041 * However, there's a macro that makes this a one liner: 00042 * 00043 * @code 00044 * void g() { 00045 * PROFSECTION("g",prof); // <== Most of the time, this is all you need 00046 * //... // (unless you're doing something fancy like conditional timers) 00047 * f(); // will note f's time as g's child time, as well as g's own time 00048 * //... 00049 * } 00050 * @endcode 00051 * 00052 * The idea is similar to that used by MMAccessor. If you want to profile a section at smaller 00053 * resolution than a function, you can use tricks shown in MMAccessor's documentation to limit 00054 * the timer's scope. 00055 * 00056 * For convenience, there are three global profilers predefined: #mainProfiler, #motionProfiler, 00057 * and #soundProfiler. These are what are polled by the ProfilerCheckControl -- if you instantiate 00058 * a new profiler, you will have to call its report() function yourself to get the results. (If it's simply 00059 * a matter of running out of sections in mainProfiler, increase the template parameter at the end 00060 * of Profiler.h) Keep in mind however, that these global profilers are pointers, and need to be 00061 * dereferenced to use with the macro, e.g. <code>PROFSECTION("g2",*mainProfiler)</code> 00062 * 00063 * Here were the constraints I set for myself: 00064 * - Processes can read each other's Profilers - so must be able to live in shared memory\n 00065 * This is so one process can generate a report on performance of the entire system at once 00066 * - Flexible memory footprint\n 00067 * MainObject will probably have a lot of subsections. MotionObject won't. Since SectionInfo 00068 * takes some significant memory space, we don't want to force MotionObject to needlessly make 00069 * a lot of them. 00070 * - Flexible usage - can have a single generic global, as well as creating multiple 00071 * - Fast - don't want to kill performance of profiled sections, or throw off reported results 00072 * 00073 * Consessions made: 00074 * - Sections are not dynamically allocated 00075 * - Sections within a Profiler are mutually exclusive (otherwise curSection won't be reliable) 00076 * - Results don't try to take affects of pre-emptive multitasking into account. 00077 * 00078 * Global readability is first priority since generating reports is the primary usage, thus 00079 * we have to be able to handle being in shared memory space. This means no virtual functions and 00080 * no pointer storage. Unfortunately, this makes the second constraint rather difficult.\n 00081 * Run-time dynamic allocation is right out. But the number of sections is set at compile time 00082 * anyway, so it should be OK to set this at compile time, using a template parameter.\n 00083 * That gets us 99% of the way there, but it can be burdensome to use this since the template 00084 * means there's no consistant type for all profilers - you can't have a generic Profiler type 00085 * if it's templated - you would have to know the size of the profiler you're referring to.\n 00086 * That kind of brings in the third constraint... Instead of accepting a single global, I 00087 * decided to make a general base (Profiler) and then a templated subclass to hold the bulk data 00088 * section. This has the nice side affect of not having to specify the bulk of the code in the 00089 * header, but has the downside that accessing the info stored in the subclass from the super class 00090 * is very much a hack. If you think you can get around this, good luck! 00091 * 00092 * @note This could be made much prettier if we didn't care about the virtual function-shared 00093 * memory problems... sigh 00094 */ 00095 class Profiler { 00096 public: 00097 //! constructor, but you don't want to construct one of these! Use ProfilerOfSize<x> instead! 00098 Profiler(unsigned int mx); 00099 00100 //! maximum length of names of timers 00101 static const unsigned int MaxSectionNameLen=75; 00102 //! number of slots in the histograms 00103 static const unsigned int HistSize=32; 00104 //! the upper bound (exclusive) of the histograms, in milliseconds. 00105 static const unsigned int HistTime=10*1000; 00106 //! affects how linearly the buckets are distributed - 1 means linear, >1 causes higher resolution for short times 00107 static const float HistCurve; 00108 00109 00110 //! holds all the information needed for book keeping for each timer 00111 struct SectionInfo { 00112 SectionInfo(); //!< constructor 00113 void reset(); //!< resets profiling information 00114 char name[MaxSectionNameLen]; //!< the name of this timer 00115 TimeET totalTime; //!< the total time spent in this section 00116 TimeET lastTime; //!< time of last call, used to calculate #totalInterval, which gives idea of rate of calls 00117 TimeET totalInterval; //!< the total time spent between calls (not time between end of one and start of next, is time between start of one and start of next) 00118 TimeET childTime; //!< the total time spent in child sections 00119 float execExpAvg; //!< exponential average of execution time 00120 float interExpAvg; //!< exponential average of inter-call time 00121 unsigned int execHist[HistSize]; //!< histogram of execution times, uses logarithmic size bins (so high res for quick functions, low res for longer functions) 00122 unsigned int interHist[HistSize]; //!< histogram of inter-call time, uses logarithmic size bins (so high res for quick functions, low res for longer functions) 00123 unsigned int calls; //!< number of calls to this section 00124 }; 00125 00126 //! Measures the time that this class exists, reports result to a profiler 00127 /*! Don't bother trying to use this as a quick timer - just use TimeET directly. 00128 * But there are functions to get the elapsed time and such if you insist. */ 00129 class Timer { 00130 //! Profiler will need to read out some data that no one else should be depending on 00131 friend class Profiler; 00132 public: 00133 Timer() : _prof(NULL), _id(-1U), _parent(-1U), _t() {} //!< constructor - starts timer, but you can restart it... 00134 Timer(unsigned int id, Profiler* prof); //!< constructor - starts the timer, sets current timer in @a prof 00135 Timer(const Timer& t) : _prof(t._prof), _id(t._id), _parent(t._parent),_t(t._t) { } //!< copy constructor, not that you should need it, does same as default 00136 Timer& operator=(const Timer& t) { _prof=t._prof; _id=t._id; _parent=t._parent; _t=t._t; return *this; } //!< not that you should need it, does same as default 00137 ~Timer(); //!< destructor - stops the timer, reports results 00138 void setID(unsigned int id, Profiler* prof); //!< sets the ID and profiler, also starts timer 00139 void start() { _t.Set(); } //!< starts timer (or resets it) 00140 const TimeET& startTime() { return _t; } //!< returns time of start 00141 TimeET elapsed() { return _t.Age(); } //!< returns time since start 00142 protected: 00143 Profiler* _prof; //!< the profiler this should report to 00144 unsigned int _id; //!< the id number for this code section (See example in beginning of class documentation for how these are assigned) 00145 unsigned int _parent; //!< the id number of the timer this timer is under 00146 TimeET _t; //!< the time this timer was created 00147 }; 00148 00149 //! call this to get a new ID number 00150 unsigned int getNewID(const char* name); 00151 00152 //! called during process init (before any profiled sections) 00153 static void initBuckets(); 00154 00155 //! returns the bucket boundaries 00156 float* getBuckets() { return buckets; } 00157 00158 //! outputs profiling information 00159 std::string report(); 00160 00161 //! resets profiling information 00162 void reset(); 00163 00164 unsigned int curSection; //!< the current timer 00165 TimeET startTime; //!< time of beginning profiling 00166 float gamma; //!< gamma to use with exponential averages (1 to freeze, 0 to set to last) 00167 const unsigned int maxSections; //!< so we can read the size of the infos array back again at runtime 00168 unsigned int sectionsUsed; //!< the number of timer IDs which have been assigned 00169 00170 //! gets the actual storage area of the SectionInfo's 00171 inline SectionInfo* getInfos() { return (SectionInfo*)((char*)this+infosOffset); } 00172 00173 protected: 00174 //! Only the Timer's should be calling setCurrent() and finished() upon the Timer's construction and destruction 00175 friend class Timer; 00176 //! called automatically by Timer() - sets the current timer 00177 void setCurrent(Timer& tr); 00178 //! called automatically by ~Timer() - notes the specified timer as finished (doesn't check if the timer is actually the current one - don't screw up!) 00179 void finished(Timer& tr); 00180 00181 //! returns which bucket a time should go in, does a binary search over buckets (unless someone things a log() call would be faster...) 00182 unsigned int getBucket(float t) { 00183 unsigned int l=0; //inclusive 00184 unsigned int h=HistSize-1; //inclusive 00185 unsigned int c=(h+l)/2; //current bucket 00186 while(l!=h) { 00187 // std::cout << this << ' ' << t << '\t' << l << ' ' << c << ' ' << h <<std::endl; 00188 if(t>buckets[c]) 00189 l=c+1; 00190 else 00191 h=c; 00192 c=(h+l)/2; 00193 } 00194 return h; 00195 } 00196 00197 static float buckets[HistSize]; //!< holds boundaries for each bucket 00198 00199 static unsigned int infosOffset; //!< NASTY HACK - this is how we get around using virtual functions 00200 00201 //! Automatically causes initialization of the histogram buckets when the first Profiler is instantiated 00202 class AutoInit { 00203 public: 00204 AutoInit(); //!< constructor, adds to #refcount and #totalcount, causes initalization if was 0 00205 ~AutoInit(); //!< destructor, decrements #refcount, does teardown if it hits 0 00206 protected: 00207 static unsigned int refcount; //!< the number of profilers in existance 00208 static unsigned int totalcount; //!< the number of profilers which have been created 00209 } autoInit; 00210 }; 00211 00212 //! templated subclass allows compile-time flexibility of how much memory to use. 00213 template<unsigned int MaxSections> 00214 class ProfilerOfSize { 00215 public: 00216 ProfilerOfSize() : prof(MaxSections) {} //!< constructor 00217 00218 //! call this to get a new ID number 00219 unsigned int getNewID(const char* name) { return prof.getNewID(name); } 00220 00221 //! outputs profiling information 00222 std::string report() { return prof.report(); } 00223 00224 Profiler prof; //!< the profiler that does the work, must immediately preceed #infos! 00225 Profiler::SectionInfo infos[MaxSections]; //!< the actual profiling information storage 00226 }; 00227 00228 // feel free to ignore these or add your own as well -- these are the ones that framework-included code will use 00229 typedef ProfilerOfSize<20> mainProfiler_t; //!< defines type for code profiling information for MainObject; use this instead of the templated type so you don't rely on a particular size 00230 typedef ProfilerOfSize<6> motionProfiler_t; //!< defines type for code profiling information for MotionObject; use this instead of the templated type so you don't rely on a particular size 00231 typedef ProfilerOfSize<6> soundProfiler_t; //!< defines type for code profiling information for SoundPlay; use this instead of the templated type so you don't rely on a particular size 00232 extern mainProfiler_t * mainProfiler; //!< holds code profiling information for MainObject 00233 extern motionProfiler_t * motionProfiler; //!< holds code profiling information for MotoObject 00234 extern soundProfiler_t * soundProfiler; //!< holds code profiling information for SoundPlay 00235 00236 /*! @file 00237 * @brief Describes Profiler, which managers a hierarchy of timers for profiling time spent in code 00238 * @author ejt (Creator) 00239 */ 00240 00241 #endif
http://tekkotsu.org/dox/Profiler_8h_source.html
CC-MAIN-2019-43
refinedweb
2,093
55.34
hi, This might be really obvious to someone, but this is doing my head in, however I am a noob so any help would be appreciated. this is my routes.rb file: map.resources :comments map.resources :posts map.connect :logs I have two controllers, one is called Posts (which I generated using a scaffold) and the other is called logs-- I just created a controller for this. logs controller: def index @logs = (Post.all) end def show @log = Post.find(params[:id]) end Now my problem is this: index.html in logs folder: <%= link_to 'read more...', log%> I want this to link to link to log/:id (e.g. logs/1) when they click on the first post, however it keeps going to posts/:id (e.g. posts/1) Sorry about the long question, I’m trying to give as much information as possible, any help would be appreciated. Cheers
https://www.ruby-forum.com/t/long-arsd-problem/172266
CC-MAIN-2021-25
refinedweb
151
77.84
Hi Rhino I want to extract with points the locations of the “Min radius” and “Max radius” on [Max Range] showed in the CurvatureAnalysis window. Is it possible? Hi Rhino I want to extract with points the locations of the “Min radius” and “Max radius” on [Max Range] showed in the CurvatureAnalysis window. Is it possible? Be aware that the Max radius option in CurvatureAnalysis does not work properly for areas where the Guassian curvature is negative, also known as warped, saddle-like and anticlastic surfaces. I reported it in this thread Command Error: CurvatureAnalysis - Max Radius which is for the V6 WIP but the same problem occurs in V5. Hi Knead - here’s a quick Python import Rhino import rhinoscriptsyntax as rs import scriptcontext as sc def test(): id = rs.GetObject( filter=8, preselect=True) if not id:return pt = rs.GetPointOnSurface(id) par = rs.SurfaceClosestPoint(id, pt) geo = sc.doc.Objects.Find(id).Geometry.Surfaces[0] x = geo. CurvatureAt(par[0], par[1]) max = x.Kappa(0) min= x.Kappa(1) print "Maximum curvature = " + str(max) +"\n" +"Minimum curvature = " + str(min) rs.AddTextDot(str(max) + "\n" + str(min), pt) if __name__ == "__main__": test() -Pascal Because there is a bug in the current Rhino build, the result is not correct. That is why, I’m going to calculate the curvature manually (to get accurate results). Thus, I want to find that *** the locations *** of the “Max radius” and the “Min radius” calculated when [ Max Range ] is pressed.
https://discourse.mcneel.com/t/extract-min-radius-and-max-radius/41591
CC-MAIN-2018-51
refinedweb
248
50.02
#include <assert.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> #include "nvim/api/extmark.h" #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/arabic.h" #include "nvim/ascii.h" #include "nvim/buffer.h" #include "nvim/charset.h" #include "nvim/cursor.h" #include "nvim/cursor_shape.h" #include "nvim/decoration.h" #include "nvim/diff.h" #include "nvim/edit.h" #include "nvim/eval.h" #include "nvim/ex_cmds.h" #include "nvim/ex_cmds2.h" #include "nvim/ex_getln.h" #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/highlight.h" #include "nvim/indent.h" #include "nvim/lib/kvec.h" #include "nvim/log.h" #include "nvim/lua/executor.h" #include "nvim/main.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/menu.h" #include "nvim/message.h" #include "nvim/misc1.h" #include "nvim/move.h" #include "nvim/normal.h" #include "nvim/option.h" #include "nvim/os/time.h" #include "nvim/os_unix.h" #include "nvim/path.h" #include "nvim/plines.h" #include "nvim/popupmnu.h" #include "nvim/quickfix.h" #include "nvim/regexp.h" #include "nvim/screen.h" #include "nvim/search.h" #include "nvim/sign.h" #include "nvim/spell.h" #include "nvim/state.h" #include "nvim/strings.h" #include "nvim/syntax.h" #include "nvim/terminal.h" #include "nvim/ui.h" #include "nvim/ui_compositor.h" #include "nvim/undo.h" #include "nvim/version.h" #include "nvim/vim.h" #include "nvim/window.h" Check if there should be a delay. Used before clearing or redrawing the screen or the command line. Check if the new Nvim application "shell" dimensions are valid. Correct it if it's too small or way too big. Clear tab_page_click_defs table Get the value to show for the language mappings, active 'keymap'. assign a handle to the grid. The grid need not be allocated. clear a line in the grid starting at "off" until "width" characters are cleared. delete lines on the screen and move lines up. 'end' is the line after the scrolled part. Normally it is Rows. When scrolling region used 'off' is the offset from the top for the region. 'row' and 'end' are relative to the start of the region. Fill the grid from 'start_row' to 'end_row', from 'start_col' to 'end_col' with character 'c1' in first column followed by 'c2' in the other columns. Use attributes 'attr'. Correct a position on the screen, if it's the right half of a double-wide char move it to the left half. Returns the corrected column. get a single character directly from grid.chars into "bytes[]". Also return its attribute in *attrp; 'row', 'col' and 'end' are relative to the start of the region. insert lines on the screen and move the existing lines down 'line_count' is the number of lines to be inserted. 'end' is the line after the scrolled part. Normally it is Rows. 'col' is the column from with we start inserting. Return true if the character at "row"/"col" on the screen is the left side of a double-width character. Caller must make sure "row" and "col" are not invalid! output a single character directly to the grid put string '*text' on the window grid at position 'row' and 'col', with attributes 'attr', and update chars[] and attrs[]. Note: only outputs within one row, message is truncated at grid boundary! Note: if grid, row and/or col is invalid, nothing is done. like grid_puts(), but output "text[len]". When "len" is -1 output up to a NUL. End a group of grid_puts_len calls and send the screen buffer to the UI layer. Start a group of grid_puts_len calls that builds a single grid line. Must be matched with a grid_puts_line_flush call before moving to another line. Redraw a window later, with update_screen(type). Set must_redraw only if not already set to a higher value. e.g. if must_redraw is CLEAR, type NOT_VALID will do nothing. Determine if dedicated window grid should be used or the default_grid If UI did not request multigrid support, draw all windows on the default_grid. NB: this function can only been used with window grids in a context where win_grid_alloc already has been called! If the default_grid is used, adjust window relative positions to global screen positions. Doesn't allow reinit, so must only be called by free_all_mem! Set dimensions of the Nvim application "shell". Resize the screen to Rows and Columns. Allocate default_grid.chars[] and other grid arrays. There may be some time between setting Rows and Columns and (re)allocating default_grid arrays. This happens when starting up and when (manually) changing the shell size. Always use default_grid.Rows and default_grid.Columns to access items in default_grid.chars[]. Use Rows and Columns for positioning text etc. where the final size of the shell is needed. Show current status info in ruler and various other places Marks all status lines of the specified buffer for redraw. Marks all status lines of the current buffer for redraw. Only call if (wp->w_vsep_width != 0). Delete mode message. Used when ESC is typed which is expected to end Insert mode (but Insert mode didn't end yet!). Caller should check "mode_displayed". Redraw the parts of the screen that is marked for redraw. Most code shouldn't call this directly, rather use redraw_later() and and redraw_all_later() to mark parts of the screen as needing a redraw. Whether cursorline is drawn in a special way If true, both old and new cursorline will need to be redrawn when moving cursor within windows. TODO(bfredl): VIsual_active shouldn't be needed, but is used to fix a glitch caused by scrolling. (Re)allocates a window grid if size changed while in ext_multigrid mode. Updates size, offsets and handle for the grid regardless. If "doclear" is true, don't try to copy from the old grid rather clear the resized grid. Show wildchar matches in the status line. Show at least the "match" item. We start at item 'first_match' in the list and show all matches that fit. If inversion is possible we use it. Else '=' characters are used. Scroll 'line_count' lines at 'row' in window 'wp'. Positive ‘line_count’ means scrolling down, so that more space is available at 'row'. Negative line_count implies deleting lines at row. Returns width of the signcolumn that should be used for the whole window
https://neovim.io/doc/dev/screen_8c.html
CC-MAIN-2021-49
refinedweb
1,065
73.03
Here's a C program to convert the given number (1 to 10) to characters with output and proper explanation. This program makes use of C's Switch Case and Break statements. # include <stdio.h> # include <conio.h> void main() { int n ; clrscr() ; printf("Enter a number <1 to 10> : ") ; scanf("%d", &n) ; switch(n) { case 1 : printf("\nONE") ; break ; case 2 : printf("\nTWO") ; break ; case 3 : printf("\nTHREE") ; break ; case 4 : printf("\nFOUR") ; break ; case 5 : printf("\nFIVE") ; break ; case 6 : printf("\nSIX") ; break ; case 7 : printf("\nSEVEN") ; break ; case 8 : printf("\nEIGHT") ; break ; case 9 : printf("\nNINE") ; break ; case 10 : printf("\nTEN") ; break ; default : printf("\nInvalid Input.") ; } getch() ; } Output of above program is Enter a number <1 to 10> : 1 ONE Explanation of above program The program first asks user to enter a number between 1 to 10. When user enters a number the program take that value and passes it to the switch-case statement. Here the program picks a case based on the value that user entered before and executes that particular case. If no case matches the users request, default case will be executed. Suggestion: If you notice you'll see that inside each case there is a break statement. Now what is the need to use break statement inside each case? Read it here - Why use break statement inside switch case. Suppose user entered 1this value is passed to the switch case statement and the case that matches the value that's passed is executed. In this case, CASE 1 will be executed printing the text "ONE" and then execution of switch case is stopped using a break statement. When user enters a value that doesn't match any case then the default case is executed.
http://cprogramming.language-tutorial.com/2012/01/convert-numbers-to-characters-in-c-c.html
CC-MAIN-2021-10
refinedweb
292
68.81
Welcome to another module of numpy. In our previous module, we had got insights on numpy in python. But the task becomes difficult while dealing with files or CSV files in python as there are a humongous amount of data in a file. To make this task easier, we will have to deal with the numpy module in python. If you have not studied numpy, then I would recommend studying my previous tutorial to understand numpy. Introduction One of the difficult tasks is when working with data and loading data properly. The most common way the data is formatted is CSV. You might wonder if there is a direct way to import the contents of a CSV file into a record array much in the way that we do in R programming? Why CSV file format is used? CSV is a plain-text file that makes it easier for data manipulation and is easier to import onto a spreadsheet or database. For example, You might want to export the data of certain statistics to a CSV file and then import it to the spreadsheet for further data analysis. It makes users working experience very easy programmatically in python. Python supports a text file or string manipulation with CSV files directly. Ways to load CSV file in python There are many ways to load a CSV file in python. The three common approaches in Python are the following: – - Load CSV using numpy. - Using Standard Library function. - Load CSV using pandas. - Using PySpark. Out of all the three today, we will discuss only how to read a CSV file using numpy. Moving ahead, let’s see how Python natively uses CSV. Reading of a CSV file with numpy in python As mentioned earlier, numpy is used by data scientists and machine learning engineers extensively because they have to work with a lot with the data that are generally stored in CSV files. Somehow numpy in python makes it a lot easier for the data scientist to work with CSV files. The two ways to read a CSV file using numpy in python are:- - Without using any library. - numpy.loadtxt() function - Using numpy.genfromtxt() function - Using the CSV module. - Use a Pandas dataframe. - Using PySpark. 1.Without using any built-in library Sounds unreal, right! But with the help of python, we can achieve anything. There is a built-in function provided by python called ‘open’ through which we can read any CSV file. The open built-in function copies everything that is there is a CSV file in string format. Let us go to the syntax part to get it more clear. Syntax:- open('File_name') Parameter All we need to do is pass the file name as a parameter in the open built in function. Return value It returns the content of the file in string format. Let’s do some coding. file_data = open('sample.csv') for row in file_data: print(row) OUTPUT:- 2. Using numpy.loadtxt() function It is used to load text file data in python. numpy.loadtxt( ) is similar to the function numpy.genfromtxt( ) when no data is missing. Syntax: numpy.loadtxt(fname) The default data type(dtype) parameter for numpy.loadtxt( ) is float. import numpy as np data = np.loadtxt("sample.csv", dtype=int) print(data)# Text file data converted to integer data type OUTPUT:- [[1. 2. 3.] [4. 5. 6.]] Explanation of the code - Imported numpy library having alias name as np. - Loading the CSV file and converting the file data into integer data type by using dtype. - Print the data variable to get the desired output. 3. Using numpy.genfromtxt() function The genfromtxt() function is used quite frequently to load data from text files in python. We can read data from CSV files using this function and store it into a numpy array. This function has many arguments available, making it a lot easier to load the data in the desired format. We can specify the delimiter, deal with missing values, delete specified characters, and specify the datatype of data using the different arguments of this function. Lets do some code to get the concept more clear. Syntax: numpy.genfromtxt(fname) Parameter The parameter is usually the CSV file name that you want to read. Other than that, we can specify delimiter, names, etc. The other optional parameters are the following: Return Value It returns ndarray. from numpy import genfromtxt data = genfromtxt('sample.csv', delimiter=',', skip_header = 1) print(data) OUTPUT: [[1. 2. 3.] [4. 5. 6.]] Explanation of the code - From the package, numpy imported genfromtxt. - Stored the data into the variable data that will return the ndarray bypassing the file name, delimiter, and skip_header as the parameter. - Print the variable to get the output. 4. Using CSV module in python The CSV the module is used to read and write data to CSV files more efficiently in Python. This method will read the data from a CSV file using this module and store it into a list. Then it will further proceed to convert this list to a numpy array in python. The code below will explain this. import csv import numpy as np with open('sample.csv', 'r') as f: data = list(csv.reader(f, delimiter=";")) data = np.array(data) print(data) OUTPUT:- [[1. 2. 3.] [4. 5. 6.]] Explanation of the code - Imported the CSV module. - Imported numpy as we want to use the numpy.array feature in python. - Loading the file sample.csv in reading mode as we have mention ‘r.’ - After separating the value using a delimiter, we store the data into an array form using numpy.array - Print the data to get the desired output. 5. Use a Pandas dataframe in python We can use a dataframe of pandas to read CSV data into an array in python. We can do this by using the value() function. For this, we will have to read the dataframe and then convert it into a numpy array by using the value() function from the pandas’ library. from pandas import read_csv df = read_csv('sample.csv') data = df.values print(data) OUTPUT:- [[1 2 3] [4 5 6]] To show some of the power of pandas CSV capabilities, I’ve created a slightly more complicated file to read, called hrdataset.csv. It contains data on company employees: hrdataset CSV file import pandas dataframe = pandas.read_csv('hrdataset.csv') print(dataFrame) OUTPUT:- Name Hire Date Salary Sick Days Left 0 Graham Bell 03/15/19 50000.0 10 1 John Cleese 06/01/18 65000.0 8 2 Kimmi Chandel 05/12/20 45000.0 10 3 Terry Jones 11/01/13 70000.0 3 4 Terry Gilliam 08/12/20 48000.0 7 5 Michael Palin 05/23/20 66000.0 8 6. Using PySpark in Python Reading and writing data in Spark in python is an important task. More often than not, it is the outset for any form of Big data processing. For example, there are different ways to read a CSV file using pyspark in python if you want to know the core syntax for reading data before moving on to the specifics. Syntax:- spark.format("...").option(“key”, “value”).schema(…).load() Parameters DataFrameReader is the foundation for reading data in Spark, it can be accessed via spark.read attribute. - format — specifies the file format as in CSV, JSON, parquet, or TSV. The default is parquet. - option — a set of key-value configurations. It specifies how to read data. - schema — It is an optional one that is used to specify if you would like to infer the schema from the database. 3 ways to read a CSV file using PySpark in python. - df = spark.read.format(“CSV”).option(“header”, “True”).load(filepath). 2. df = spark.read.format(“CSV”).option(“inferSchema”, “True”).load(filepath). 3. df = spark.read.format(“CSV”).schema(csvSchema).load(filepath). Lets do some coding to understand. diamonds = spark.read.format("csv") .option("header", "true") .option("inferSchema", "true") .load("/databricks-datasets/Rdatasets/data-001/csv/ggplot2/diamonds.csv") OUTPUT:- Conclusion This article has covered the different ways to read data from a CSV file using the numpy module. This brings us to the end of our article, “How to read CSV File in Python using numpy.” I hope you are clear with all the concepts related to CSV, how to read, and the different parameters used. If you understand the basics of reading CSV files, you won’t ever be caught flat-footed when dealing with importing data. Make sure you practice as much as possible and gain more experience. Got a question for us? Please mention it in the comments section of this “6 ways to read CSV File with numpy in Python” article, and we will get back to you as soon as possible. FAQs - How do I skip the first line of a CSV file in python? Ans:- Use csv.reader() and next() if you are not using any library. Lets code to understand. Let us consider the following sample.csv file to understand. sample.csv fruit,count apple,1 banana,2 file = open('sample.csv') csv_reader = csv.reader(file) next(csv_reader) for row in csv_reader: print(row) OUTPUT:- ['apple', '1'] ['banana', '2'] As you can see the first line which had fruit, count is eliminated. 2. How do I count the number of rows in a csv file? Ans:- Use len() and list() on a csv reader to count the number of lines. lets go to this sample.csv data 1,2,3 4,5,6 7,8,9 file_data = open("sample.csv") reader = csv.reader(file_data) Count_lines= len(list(reader)) print(Count_lines) OUTPUT:- 3 As you can see from the sample.csv file that there were three rows that got displayed with the help of the len() function.
https://www.pythonpool.com/numpy-read-csv/
CC-MAIN-2021-43
refinedweb
1,631
67.35
In this Pydon't we explore what Boolean short-circuiting for the and and or operators is, and how to use this functionality to write more expressive code. Follow me on Twitter, where I write about Python, APL, and maths. (If you are new here and have no idea what a Pydon't is, you may want to read the Pydon't Manifesto.) In this Pydon't we will take a closer look at how and and or really work and at a couple of really neat things you can do because of the way they are defined. In particular, we will look at andand orreturn values from their operands, and not necessarily Trueor False; andand orextends to alland any; and For this Pydon't, I will assume you are familiar with what “Truthy” and “Falsy” values are in Python. If you are not familiar with this concept, or if you would like just a quick reminder of how this works, go ahead and read the “Truthy, Falsy, and bool” Pydon't. You can now get your copy of the ebook “Pydon'ts – Write beautiful Python code” on Gumroad to help support the series of “Pydon't” articles 💪. andand oroperators If we take a look at the docs, here is how or is defined: “ x or yreturns yif xis false, otherwise it returns x.” Equivalently, but written with an if expression, (x or y) == (y if not x else x) This may not seem like it is worth spending a thought on, but already right at this point we can see something very interesting: even though we look at the truthy or falsy value of x, what we return are the values associated with x/ y, and not a Boolean value. For example, look at the program below and think about what it outputs: if 3 or 5: print("Yeah.") else: print("Nope.") If you thought it should print “Yeah.”, you are right! Notice how 3 or 5 was the condition of the if statement and it evaluated to True, which is why the statement under if got executed. Now, look at the program below and think about what it outputs: print(3 or 5) What do you think it outputs? If you think the output should be True, you are wrong! The program above outputs 3: >>> 3 or 5 3 Let's go back to something I just said: “Notice how 3 or 5was the condition of the ifstatement and it evaluated to True, which is why the statement under ifgot executed.” The wording of this statement is wrong, but the error in it is fairly subtle. If you spotted it before I pointed it out, give yourself a pat in the back, you deserve it. So, what did I say wrong? 3 or 5 does not evaluate to True! It evaluates to 3, which is truthy and therefore tells the if to execute its statements. Returning True or a truthy value is something significantly different. A similar thing happens with and. As per the docs, and can be defined as follows: “ x and yreturns xif xis false, otherwise it returns y.” We can also rewrite this as (x and y) == (x if not x else y) Take your time to explore this for a bit, just like we explored x or y above. You might be asking why this distinction is relevant. It is mostly relevant because of the following property: and and or only evaluate the right operand if the left operand is not enough to determine the result of the operation. This is what short-circuiting is: not evaluating the whole expression (stopping short of evaluating it) if we already have enough information to determine the final outcome. This short-circuiting feature, together with the fact that the boolean operators and and or return the values of the operands and not necessarily a Boolean, means we can do some really neat things with them. or False or y or evaluates to True if any of its operands is truthy. If the left operand to or is False (or falsy, for that matter) then the or operator has to look to its right operand in order to determine the final result. Therefore, we know that an expression like val = False or y will have the value of y in it, and in an if statement or in a while loop, it will evaluate the body of the construct only if y is truthy: >>> y = 5 # truthy value. >>> if False or y: ... print("Got in!") ... else: ... print("Didn't get in...") ... Got in! >>> y = [] # falsy value. >>> if False or y: ... print("Got in 2!") ... else: ... print("Didn't get in 2...") ... Didn't get in 2... Let this sit with you: if the left operand to or is False or falsy, then we need to look at the right operand to determine the value of the or. True or y On the other hand, if the left operand to or is True, we do not need to take a look at y because we already know the final result is going to be True. Let us create a simple function that returns its argument unchanged but that produces a side-effect of printing something to the screen: def p(arg): print(f"Inside `p` with arg={arg}") return arg Now we can use p to take a look at the things that Python evaluates when trying to determine the value of x or y: >>> p(False) or p(3) Inside `p` with arg=False Inside `p` with arg=3 3 >>> p(True) or p(3) Inside `p` with arg=True True Notice that, in the second example, p only did one print because it never reached the p(3). orexpressions Now we tie everything together. If the left operand to or is False or falsy, we know that or has to look at its right operand and will, therefore, return the value of its right operand after evaluating it. On the other hand, if the left operand is True or truthy, or will return the value of the left operand without even evaluating the right operand. and We now do a similar survey, but for and. False and y and gives True if both its operands are True. Therefore, if we have an expression like val = False and y do we need to know what y is in order to figure out what val is? No, we do not, because regardless of whether y is True or False, val is always False: >>> False and True False >>> False and False False If we take the False and y expressions from this example and compare them with the if expression we wrote earlier, which was (x and y) == (x if not x else y) we see that, in this case, x was substituted by False, and, therefore, we have (False and y) == (False if not False else y) Now, the condition inside that if expression reads not False which we know evaluates to True, meaning that the if expression never returns y. If we consider any left operand that can be False or falsy, we see that and will never look at the right operand: >>> p([]) and True # [] is falsy Inside `p` with arg=[] [] >>> p(0) and 3242 # 0 is falsy Inside `p` with arg=0 0 >>> p({}) and 242 # {} is falsy Inside `p` with arg={} {} >>> p(0) and p(0) # both are falsy, but only the left matters Inside `p` with arg=0 0 True and y Now, I invite you to take a moment to work through the same reasoning, but with expressions of the form True and y. In doing so, you should figure out that the result of such an expression is always the value of y, because the left operand being True, or any other truthy value, doesn't give and enough information. andexpressions Now we tie everything together. If the left operand to and is False or falsy, we know the expression returns the value of the left operand regardless of the right operand, and therefore we do not even evaluate the right operand. On the other hand, if the left operand to and is True, then and will evaluate the right operand and return its value. Instead of memorising rules about what sides get evaluated when, just remember that both and and or will evaluate as many operands as needed to determine the overall Boolean result, and will then return the value of the last side that they evaluated. As an immediate conclusion, the left operand is always evaluated, as you might imagine. If you understand that, then it is just a matter of you knowing how and and or work from the Boolean perspective. alland any The built-in functions all and any also short-circuit, as they are simple extensions of the behaviours provided by and and or, respectively. all wants to make sure that all the values of its argument are truthy, so as soon as it finds a falsy value, it knows it's game over. That's why the docs say all is equivalent to the following code: def all(it): for elem in it: if not elem: return False return True Similarly, any is going to do its best to look for some value that is truthy. Therefore, as soon as it finds one, any knows it has achieved its purpose and does not need to evaluate the other values. Can you write an implementation of any that is similar to the above implementation of all and that also short-circuits? A previous Pydon't has shown you that comparison operators can be chained arbitrarily, and those are almost equivalent to a series of comparisons separated with and, except that the subexpressions are only evaluated once, to prevent wasting resources. Therefore, because we are also using an and in the background, chained comparisons can also short-circuit: # 1 > 2 is False, so there's no need to look at p(2) < p(3) >>> p(1) > p(2) < p(3) Inside `p` with arg=1 Inside `p` with arg=2 False Now that we have taken a look at how all of these things work, we will see how to put them to good use in actual code. One of the most basic usages of short-circuiting is to save time. When you have a while loop or an if statement with multiple statements, you may want to include the faster expressions before the slower ones, as that might save you some time if the result of the first expression ends up short-circuiting. Consider this example that should help me get my point across: imagine you are writing a function that creates a helper .txt file but only if it is a .txt file and if it does not exist yet. With this preamble, your function needs to do two things: .txt; What do you feel is faster? Checking if the file ends in .txt or looking for it in the whole filesystem? I would guess checking for the .txt ending is simpler, so that's the expression I would put first in the code: import pathlib def create_txt_file(filename): path = pathlib.Path(filename) if filename.suffix == ".txt" and not path.exists(): # Create the file but leave it empty. with path.open(): pass This means that, whenever filename does not respect the .txt format, the function can exist right away and doesn't even need to bother the operating system with asking if the file exists or not. Now let me show you a real example of an if statement that uses short-circuiting in this way, saving some time. For this, let us take a look at a function from the base64 module, that we take from the Python Standard Library: #'+/')) if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s): # <-- raise binascii.Error('Non-base64 digit found') return binascii.a2b_base64(s) This b64decode function takes a string (or a bytes-like object) that is assumed to be in base 64 and decodes it. Here is a quick demo of that: >>> import base64 >>> s = b"Base 64 encoding and decoding." >>> enc = base64.b64encode(s) >>> enc b'QmFzZSA2NCBlbmNvZGluZyBhbmQgZGVjb2Rpbmcu' >>> base64.b64decode(enc) b'Base 64 encoding and decoding.' Now, look at the if statement that I marked with a comment: if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s): pass validate is an argument to b64decode that tells the function if we should validate the string that we want to decode or not, and then the re.fullmatch() function call does that validation, ensuring that the string to decode only contains valid base 64 characters. In case we want to validate the string and the validation fails, we enter the if statement and raise an error. Notice how we first check if the user wants to validate the string and only then we run the regular expression match. We would obtain the exact same result if we changed the order of the operands to and, but we would be spending much more time than needed. To show that, let us try both cases! Let's build a string with 1001 characters, where only the last one is invalid. Let us compare how much time it takes to run the boolean expression with the regex validation before and after the Boolean validate. import timeit # Code that sets up the variables we need to evaluate the expression that we # DO NOT want to be taken into account for the timing. setup = """ import re s = b"a"*1000 + b"*" validate = False """ # with short-circuiting: 0.01561140s on my machine. print(timeit.timeit("validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s)", setup)) # without short-circuiting: 27.4744187s on my machine. print(timeit.timeit("not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s) and validate", setup)) Notice that short-circuiting speeds up these comparisons by a factor of ~1750. The timeit module is great and I recommend you take a peek at its docs. Here, we use it to run that Boolean expression repeatedly (one million times, to be more specific). Of course we could try longer or shorter strings, we could try strings that pass the validation and we could also try strings that fail the validation at an earlier stage, but this is just a small example that shows how short-circuiting can be helpful. ifstatements Short-circuiting can, and should, be used to keep if statements as flat as possible. A typical usage pattern is when we want to do some validation if certain conditions are met. Keeping the previous b64decode example in mind, that previous if statement could've been written like so: # Modified'+/')) # Do we want to validate the string? if validate: # <-- # Is the string valid? if not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s): # <-- raise binascii.Error('Non-base64 digit found') return binascii.a2b_base64(s) Now we took the actual validation and nested it, so that we have two separate checks: one tests if we need to do validation and the other one does the actual validation. What is the problem with this? From a fundamentalist's point of view, you are clearly going against the Zen of Python, that says “Flat is better than nested.” But from a practical point of view, you are also increasing the vertical space that your function takes up by having a ridiculous if statement hang there. What if you have multiple conditions that you need to check for? Will you have a nested if statement for each one of those? This is exactly what short-circuiting is useful for! Only running the second part of a Boolean expression if it is relevant! Another typical usage pattern shows up when you have something you need to check, for example you need to check if a variable names is a list containing strings or you need to check if a given argument term is smaller than zero. It may happen that, in that context, it is not a good idea to do those checks immediately: namesmight not be a list or might be empty; or termmight be of a different type and, therefore, might be incomparable to zero. Here is a concrete example of what I mean: # From Lib/asynchat in Python 3.9.2 def set_terminator(self, term): """Set the input delimiter. Can be a fixed string of any length, an integer, or None. """ if isinstance(term, str) and self.use_encoding: term = bytes(term, self.encoding) elif isinstance(term, int) and term < 0: raise ValueError('the number of received bytes must be positive') self.terminator = term This is a helper function from within the asynchat module. We don't need to know what is happening outside of this function to understand the role that short-circuiting has in the elif statement. If the term variable is smaller than 0, then we want to raise a ValueError to complain, but the previous if statement shows that term might also be a string. If term is a string, then comparing it with 0 raises another ValueError, so what we do is start by checking a necessary precondition to term < 0: term < 0 only makes sense if term is an integer, so we start by evaluating isinstance(term, int) and only then running the comparison. Let me show you another example from the enum module: # From Lib/enum.py in Python 3.9.2 def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, start=1): """ Convenience method to create a new Enum class. """ # [cut for brevity] # special processing needed for names? if isinstance(names, str): names = names.replace(',', ' ').split() if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): original_names, names = names, [] last_values = [] for count, name in enumerate(original_names): value = first_enum._generate_next_value_(name, start, count, last_values[:]) last_values.append(value) names.append((name, value)) # [cut for brevity] The longer if statement contains three expressions separated by ands, and the first two expressions are there to make sure that the final one, isinstance(names[0], str) makes sense. You can read along the statement and thing about what it means if execution reaches that point: if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): #^ lets start checking this `if` statement. if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): # ^ # we only need to take a look at the right-hand side of this `and` if `names` # is either a tuple or a list. if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): # ^ # at this point, I've checked if `names` is a list or a tuple and I have # checked if it is truthy or falsy (i.e., checked if it is empty or not). # I only need to look at the right-hand side of this `and` if `names` # is NOT empty. if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): # ^ # If I'm evaluating this expression, it is because `names` is either a # list or a tuple AND it is not empty, therefore I can index safely into it # with `names[0]`. This flat if statement is much better than the completely nested version: if isinstance(names, (tuple, list)): if names: if isinstance(names[0], str): pass Of course, you might need the nested version if, at different points, you might need to do different things depending on what happens. For example, suppose you want to raise an error if the list/tuple is empty. In that case, you would need the nested version: if isinstance(names, (tuple, list)): if names: if isinstance(names[0], str): pass else: raise ValueError("Empty names :(") Can you understand why this if statement I just wrote is different from the two following alternatives? # Can I put `and names` together with the first check? if isinstance(names, (tuple, list)) and names: if isinstance(names[0], str): pass else: raise ValueError("Empty names..? :(") # What if I put it together with the second `isinstance` check? if instance(names, (tuple, list)): if names and isinstance(names[0], str): pass else: raise ValueError("Empty names..? :(") If this is a silly exercise for you, sorry about that! I just want you to be aware of the fact that when you have many Boolean conditions, you need to be careful when checking specific configurations of what is True and what is False. If you've been skimming this article, just pay attention to this section right here. This, right here, is my favourite use of short-circuiting. Short-circuiting with the Boolean operator or can be used to assign default values to variables. How does this work? This uses or and its short-circuiting functionality to assign a default value to a variable if the current value is falsy. Here is an example: greet = input("Type your name >> ") or "there" print(f"Hello, {greet}!") Try running this example and press Enter without typing anything. If you do that, input returns an empty string "", which is falsy. Therefore, the operator or sees the falsy value on its left and needs to evaluate the right operand to determine the final value of the expression. Because it evaluates the right operand, it is the right value that is returned, and "there" is assigned to greet. Now that we've seen how this mechanism to assign default values works, let us take a look at a couple of usage examples from the Python Standard Library. We start with a simple example from the collections module, specifically from the implementation of the ChainMap object: # From Lib/collections/__init__.py in Python 3.9.2 class ChainMap(_collections_abc.MutableMapping): ''' A ChainMap groups multiple dicts (or other mappings) together [docstring cut for brevity] ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map This ChainMap object allows you to combine multiple mappings (for example, dictionaries) into a single mapping that combines all the keys and values. >>> import collections >>> a = {"A": 1} >>> b = {"B": 2, "A": 3} >>> cm = collections.ChainMap(a, b) >>> cm["A"] 1 >>> cm["B"] 2 The assignment that we see in the source code ensures that self.maps is a list of, at least, one empty mapping. If we give no mapping at all to ChainMap, then list(maps) evaluates to [], which is falsy, and forces the or to look at its right operand, returning [{}]: this produces a list with a single dictionary that has nothing inside. I'll share another example with you, now. This example might look like the same as the one above, but there is a nice subtlety here. First, the code: # From Lib/cgitb.py in Python 3.9.2 class Hook: """A hook to replace sys.excepthook that shows tracebacks in HTML.""" def __init__(self, display=1, logdir=None, context=5, file=None, format="html"): self.display = display # send tracebacks to browser if true self.logdir = logdir # log tracebacks to files if not None self.context = context # number of source code lines per frame self.file = file or sys.stdout # place to send the output self.format = format This code comes from the cgitb module and defines sys.stdout to be the default value for the self.file variable. The definition of the __init__ function has file=None as a keyword argument also with a default value of None, so why don't we just write file=sys.stdout in the first place? The problem is that sys.stdout can be a mutable object, and therefore, using file=sys.stdout as a keyword argument with a default value is not going to work as you expect. This is easier to demonstrate with a list as the default argument, although the principle is the same: >>> def append(val, l=[]): ... l.append(val) ... print(l) ... >>> append(3, [1, 2]) [1, 2, 3] >>> append(5) [5] >>> append(5) [5, 5] >>> append(5) [5, 5, 5] Notice the three consecutive calls append(5). We would expect the three calls to behave the same way, but because a list is a mutable object, the three consecutive calls to append add the values to the default value itself, that started out as an empty list but keeps growing. I'll write about mutability in more detail in future Pydon'ts, so be sure to subscribe to not miss that future Pydon't. As the final usage example of short-circuiting, I'll share something really neat with you. If you use assignment expressions and the walrus operator := together with generator expressions, we can use the fact that all and any also short-circuit in order to look for “witnesses” in a sequence of elements. If we have a predicate function predicate (a function that returns a Boolean value) and if we have a sequence of values, items, we could use any(predicate(item) for item in items) to check if any element(s) in items satisfy the predicate function. If we modify that to be any(predicate(witness := item) for item in items) Then, in case any item satisfies the predicate function, witness will hold its value! For example, if items contains many integers, how do we figure out if there are any odd numbers in there and how do we print the first one? items = [14, 16, 18, 20, 35, 41, 100] any_found = False for item in items: any_found = item % 2 if any_found: print(f"Found odd number {item}.") break # Prints 'Found odd number 35.' This is one alternative. What other alternatives can you come up with? Now, compare all those with the following: items = [14, 16, 18, 20, 35, 41, 100] is_odd = lambda x: x % 2 if any(is_odd(witness := item) for item in items): print(f"Found odd number {witness}.") # Prints 'Found odd number 35.' Isn't this neat? Here's the main takeaway of this Pydon't, for you, on a silver platter: “Be mindful when you order the left and right operands to the andand orexpressions, so that you can make the most out of short-circuiting.” This Pydon't showed you that: andand orreturn the value of one of its operands, and not necessarily a Boolean value; andonly evaluates the right operand if the left operand is truthy; oronly evaluates the right operand if the left operand is falsy; alland anyalso short-circuit; andoperator; ifstatements can, sometimes, be flattened and simplified if we use short-circuiting with the correct ordering of the conditions; :=, can be used to find a witness value with respect to a predicate function. If you liked this Pydon't be sure to leave a reaction below and share this with your friends and fellow Pythonistas. Also, don't forget to subscribe to the newsletter so you don't miss a single Pydon't! I hope you learned something new! If you did, consider following the footsteps of the readers who bought me a slice of pizza 🍕. Your small contribution helps me produce this content for free and without spamming you with annoying ads. all, [last accessed 26-05-2021]; any, [last accessed 26-05-2021]; base64, [last accessed 01-06-2021]; asynchat, [last accessed 01-06-2021]; enum, [last accessed 01-06-2021]; collections.ChainMap, [last accessed 01-06-2021]; cgitb, [last accessed 01-06-2021];
https://mathspp.com/blog/pydonts/boolean-short-circuiting
CC-MAIN-2021-39
refinedweb
4,586
68.91
Hi, I modified the Plugin "Array" a little so that you get an array of unique random numbers. You can also set a startvalue for the randomnumbers via the Properties panel. _________________ [Update 2] v 1.<font color="red">1</font> [Add] Action "set size" Number Plugin Random Array (1.1) - demo,capx,plugin [Update1] HowtTo - Plugin Random Array Plugin Scramble Cards Example <font size="1">Plugin randomArray - old version </font> All suggestions are welcome. <img src="smileys/smiley1.gif" border="0" align="middle"> Thanks ! Exactly what I needed for one of my project. You're welcome. I've updated the plugin and made two examples. Have fun. Joe7 Just to point a quick problem : you seems to have changed the namespace or something between the two iterations. I made a project with the first version you posted, and we trying to reopen it with the new version, I have a text box saying that there's a name problem with the plugin. I opened the project XML file, and saw that the first version was declared as something like : <object-type <plugin id="rL" name="Random Array" /> </object-type> <object-type <plugin id="rL" name="Random Array" /> </object-type> and the new version declares something like : <object-type <plugin id="rA" name="Random Array" /> </object-type> <plugin id="rA" name="Random Array" /> Just editing the change inside the XML doesn't allows Construct to load the project. I reverted back to the old version for the moment, and when I have the time, I'm going to copy/paste in a new project, with the new version, but it's a little problem for the moment... Hello Pode, yes, i've changed nearly all in the new version and the versions are incompatible - they have a different datastructure for saving values. <img src="smileys/smiley2.gif" border="0" align="middle" /> 1) The new version uses an array with only one dimension - width. 2) The old version is based on the Array-Plugin (you have a 3d-array but random array-Plugin uses only the first dimension). => But you can use both versions together, when you need it - ie to port your project to use the new plugin version or to stick with one project at the old version. <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="" border="0" /> <img src="" border="0" /> Joe7 Okay ! I didin't think of that solution. It's a bit dirty, but quick. Thanks ;) very powerful...tnx Joe Joe - yet another plugin of yours that I've found extremely useful! I was just wondering if there was a way to dynamically set the size of the array. Thanks a ton TNewhook tnewhook: Nope. Isn't implemented, it's a very simple plugin. Possible with "normal" arrays? [Edit] @tnewhook: Random array has a "New size" action. <img src="smileys/smiley2.gif" border="0" align="middle" /> Wow, Joe! Thanks a ton! I did figure out how to do it with normal arrays, though. Hi Joe7, Do you know of any issues with RandomArray and the browser object. I use your plugin in two of my games, and when I add the browser object, the game does function properly. Have you heard of any issues? Thanks, Dave it seems like the PlugIn is working not correct in my case. I generate an array from 1 to 60. So I have 60 levels I want to be in a random order. I use a counter (it starts from 1) and call the RandomArray.At(Counter-1) entry to access the first number in the list. After a level is completed I add 1 to the counter and the game takes again RandomArray.At(Counter-1). This is the next random placed number on the list from RandomArray and the next level. I do generate a logfile and it works besides one problem. RandomArray seems to skip one number and generates it twice at the end. So for example from 1 to 5 it generates: 3,5,2,4,4 One is skipped and 4 is twice at the end of the array. I could not find any reason for this and would like to ask whether someone had similar issues? Thanks Joe7, would like to incorporate this for randomly moving some sprites around the screen to generate random levels, thanks. Develop games in your browser. Powerful, performant & highly capable. Joe I have 3 Randoms Arrays. I would like to multiply the a RandomArray1 x RandomArray2. And put the startValue on the RandomArray3. I would like to set the StartValue to this: RandomArray2.At(loopindex)*RandomArray3.At(loopindex) How can I do that????? I know this is old, but what would be nice for me is to have it have a function called scramble, but with parameters. So set a min, max, points of precision and an offset. So lets say I wanted unique multiples of 30, between 1 and 4390. The array would be nothing but unique multiples of 30. 30, 60, 90, 120, etc. If I leave points of precision 0, it will be whole numbers. If I pick an offset, it will automatically ignore PoP for easier use.
https://www.construct.net/forum/extending-construct-2/addons-29/plugin-randomarray-41101
CC-MAIN-2018-34
refinedweb
865
66.13
To specify EclipseLink MOXy as the JAXB provider you need to put a jaxb.properties file in one of the packages for your domain classes, that is passed in to bootstrap the JAXBContext. Java Model Our Java model will consist of the following two classes that reference each other. This is important because when you bootstrap a JAXBContext on a class, the classes that it references are also processed. I have also put these classes in separate packages so that we can examine the impact of where you put the jaxb.properties file. example.foo.Foo package example.foo; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import example.bar.Bar; @XmlAccessorType(XmlAccessType.FIELD) public class Foo { private Bar bar; } example.bar.Bar package example.bar; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import example.foo.Foo; @XmlAccessorType(XmlAccessType.FIELD) public class Bar { private Foo foo; } example/foo/jaxb.properties To specify that the MOXy implementation of JAXB should be used we will put a jaxb.properties file with the following entry in the same package as the Foo class. javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory Demo Code Since the Foo and Bar classes reference each other, ultimately the JAXBContext will contain metadata about both of them, but based on how we create the JAXBContext the provider can be different. In order for the jaxb.properties file to be processed it must be in the same package as at least one of the domain classes specified when bootstrapping the JAXBContext. package example; import javax.xml.bind.JAXBContext; import example.foo.Foo; import example.bar.Bar; public class Demo { public static void main(String[] args) throws Exception{ System.out.println(JAXBContext.newInstance(Foo.class).getClass()); System.out.println(JAXBContext.newInstance(Bar.class).getClass()); System.out.println(JAXBContext.newInstance(Foo.class, Bar.class).getClass()); } } Running the above code will produce: class org.eclipse.persistence.jaxb.JAXBContext class com.sun.xml.bind.v2.runtime.JAXBContextImpl class org.eclipse.persistence.jaxb.JAXBContext You will notice that when we bootstrapped the JAXBContext on the Bar class we did not MOXy as our JAXB provider. This is because none of the classes we passed to create the JAXBContext were from a package that contained a jaxb.properties file. This is the intended behaviour, and something to be aware of when specifying a JAXB provider. Further Reading Once you are able to configure EclipseLink MOXy as your JAXB provider you can take advantage of its many extensions: - Extending JAXB - Representing Metadata as XML - XPath Based Mapping - Geocode Example - Map to Element based on an Attribute Value with EclipseLink JAXB (MOXy) - JPA Entities to XML - Bidirectional Relationships - CDATA, CDATA Run, Run Data Run - @XmlTransformation - Going Beyond XmlAdapter Hi Blaise, If i already have my model classes inside a jar file, where should i put the jaxb.properties? Thanks Hi Frederick, If you can't modify the jar with the model classes, then you could create a second jar that contained that package with the jaxb.properties file. -Blaise Hi Blaise, I want to know just by using jaxb jar and xmlseealso annotation (specifying my subclasses), can i achieve polymorphism while marshalling & unmarshalling ??. For the other alternatives you had suggested in past, 1.I can't go for Jee6 reference impln (the one you mentioned in your answer raised at stackoverflow). 2.I may require to go through some approval to use elcipse your link moxy impln. Thats why i want to know, possibility of polymorphism using jaxb jar & xmlseealso annotation. ? - ragav K Hi Rajav, All JAXB implementations support polymorphism, as you've pointed out I've covered different styles in previous posts: - JAXB and Inheritance - Using the xsi:type Attribute - JAXB and Inheritance - Using Substitution Groups - Ignoring Inheritance with @XmlTransient And even some EclipseLink JAXB (MOXy) specific extensions: - JAXB and Inheritance - MOXy Extension @XmlDescriminatorNode/@XmlDescrimintatorValue The @XmlSeeAlso annotation is really just a convenience mechanism for having the subclasses included when the JAXBContext is created without having to specify them directly when creating the JAXBContext. What issue are you hitting? Are you using the JAXB implementation included in Java SE 6? -Blaise I'm using Eclipse Indigo with EclipseLink (both the JPA and MOXy for the JAXB provider). I have an EAR project with a Utility project containing all the beans. I am getting an error "Project is missing a jaxb.properties file specifying the EclipseLink JAXB context factory". My jaxb.properties file is clearly there. Any ideas? Hi Keith, Where do you have your jaxb.properties file? It needs to be in the same package as the domain classes you are creating the JAXBContext on. In the following post I outline what a sample WAR might look like: - Creating a RESTful Web Service - Part 4/5 Is Eclipse Indigo giving you the error/waring, "Project is missing a jaxb.properties file specifying the EclipseLink JAXB context factory"? -Blaise thanks for the demo codes. I appreciate the great help it brought to me. I would just like to ask again keith's question, where do you have your jaxb.properties?... I just get the right answer. I visit the link keith posted but it just made me confused. Can you answer it,\. Thanks for the great tips! I am so pleased with your help. Finally my looping error in xml vanished with the jaxb.properties file. Never thought that I am not already using the moxy implementation. Just wanted to say Thank You! "You will notice that when we bootstrapped the JAXBContext on the Bar class we did not MOXy as our JAXB provider." Is this going to be a problem during marshalling/unmarshalling process? What is the solution to this? Do we have to create the jaxb.properties in each of the packages? As long as the jaxb.properties file is in the same package as one of the classes used to bootstrap the JAXBContext you are fine. I have updated the post to make it more clear. -Blaise Thank You a lot! This article helped me a lot! You are the best!! Thanks for this example!!!
http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html?showComment=1314166397403
CC-MAIN-2017-51
refinedweb
1,022
50.23
28 March 2011 23:04 [Source: ICIS news] SAN ANTONIO, ?xml:namespace> “You would need to build two world-scale plants every year and a world-scale plant is 700,000–800,000 tonnes, so you need 1.5m tonnes a year of glycol and nothing is coming. That’s scary,” MEGlobal vice president for commercial operations Frank Hanraets said on the sidelines of the International Petrochemical Conference (IPC). Global demand is expected to continue growing at around 7%, while demand from The tight MEG supply in the world market will likely last three to five years since producers are constrained from building new plants, he said. "We are looking at all options [to expand]. It's a matter of where you can find the feedstock," Hanraets said. MEGlobal currently produces more than 1m tonnes/year of MEG at its three production plants in Hosted by the National Petrochemical & Refiners Association (NPRA), the IPC continues through Tuesday. For more on monoethylene glycol
http://www.icis.com/Articles/2011/03/28/9447773/npra-11-world-needs-1.5m-tonne-annual-meg-capacity-rise.html
CC-MAIN-2014-42
refinedweb
162
62.88
Mimicking External Actions With EasyMock It will happen sometimes that a unit test will need to do some work that an external source might normally do. One easy-to-see example of this is an ID that gets generated by a database when an entity is persisted. It may be the case that the software will assume success, but it could (nay, should) also be the case that some validation or use of the identifier is done after the persistence, and this can be tricky when mocking these interactions. Let’s take a really simple and dumb annotated Entity object. @Entity @Table(name="pojo") public class POJO { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Long id; @Column public String something; } When used, we would expect the database to populate our id column when we saved the object for the first time. Simple, easy. Let’s make a simple DAO definition to save such an object. public interface POJODAO { public POJO saveOrUpdate(final POJO pojo); } We’ll leave the implementation of this up to the specific application, but now we know we have a way to save (or update) our POJO. Let’s make a trivial class that will do exactly this. public class POJOWork { public POJODAO pojoDao = null; public void makeAndSavePOJO() { final POJO pojo = new POJO(); pojo.something = Long.toHexString(System.currentTimeMillis()); pojoDao.saveOrUpdate(pojo); if (pojo.id == null) { throw new RuntimeException("POJO Save Failed!"); } } } Here we’ve got a pretty useless method that creates and saves one of our objects, assigning some goofy data to its member. Of course, in your code, this would be more useful. After the save is complete, the ID field is used. Here, for a trivial and probably very undesireable validation, the ID field is checked for null, which it shouldn’t be after a successful save, and will throw an Exception if the field is null. Again, of course, in your code something more useful would be done. In good test-driven (or test-defended) development, we want to have a test that verifies our method does what we expect it to. There are a few obstacles in our method that we run into when we’re writing our test, the least of which is that the object we need to mock is local to the member. Here’s a quick method that works around this, ensures that the DB interaction is mocked, and passes our simple method without hitting that Exception. import static org.easymock.EasyMock.*; import static org.junit.Assert.assertNotNull; import org.easymock.IAnswer; import org.junit.Test; public class POJOWorkTest { @Test public void makeAndSavePOJOSuccess(){ final POJOWork pojoWork = new POJOWork(); pojoWork.pojoDao = createMock(POJODAO.class); expect(pojoWork.pojoDao.saveOrUpdate(isA(POJO.class))).andAnswer(new IAnswer<POJO>() { @Override public POJO answer() throws Throwable { final POJO pojo = (POJO)getCurrentArguments()[0]; assertNotNull(pojo.something); pojo.id = 0l; return pojo; } }); replay(pojoWork.pojoDao); pojoWork.makeAndSavePOJO(); verify(pojoWork.pojoDao); } } Digesting the test bit by bit, we start out making our object. We then assign its DAO to a mock implementation. We know that we’re going to call the method, so we set up an expectation. Since we don’t have either an equals() method or other means by which to compare the object passed to our expectation, we simply accept one of its kind with the isA() EasyMock matcher. If EasyMock accepts our match (which it will), it then invokes our IAnswer, calling the answer() method. In our answer() method, we grab the parameter (which we know from the matcher will be the right type and exist). We can do some validation here that helps us overcome other lack of access to the object; in our case, we just confirm that our POJO.somethign has a value. Happy that our object is prepared for the DB, we play its part and assign the id field a value. Since our test simply makes sure it’s not null, we just give it a number. Should we have needed to, we could have put more thought into this, of course. Then, because our interface says we return our POJO, we do so from our answer() method. With our peparation complete, the test tells EasyMock to start waiting for calls, we call the method, it runs, calling our prepared EasyMock method and running as if it were in a real execution flow, and finally we validate with EasyMock that our expectations were met. Running this test gives us total green-bar happiness. Sure, that’s the easy one; a method with a return value. What happens if we don’t return anything, or what is returned has nothing to do with our object? Let’s change our interface a little to just save and not return our object. public interface POJODAO { public void saveOrUpdate(final POJO pojo); } With that little change, our POJOWork code is still valid, as it was not making use of the returned value, but we can no longer use the easy expect().andAnswer() or expect().andReturn() EasyMock methods. import static org.easymock.EasyMock.*; import static org.junit.Assert.assertNotNull; import org.easymock.IArgumentMatcher; import org.junit.Test; class POJOMatcher implements IArgumentMatcher { @Override public void appendTo(StringBuffer arg0) { } @Override public boolean matches(Object arg0) { final POJO pojo = (POJO) arg0; assertNotNull(pojo.something); pojo.id = 0l; return true; } } public class POJOWorkTest { private POJO isPOJO() { reportMatcher(new POJOMatcher()); return new POJO(); } @Test public void makeAndSavePOJOSuccess() { final POJOWork pojoWork = new POJOWork(); pojoWork.pojoDao = createMock(POJODAO.class); pojoWork.pojoDao.saveOrUpdate(isPOJO()); expectLastCall(); replay(pojoWork.pojoDao); pojoWork.makeAndSavePOJO(); verify(pojoWork.pojoDao); } } That’s a bit more work, and it’s not nearly as elegant or flexible. Let’s go over this bit-by-bit, too. The new class, POJOMatcher, makes use of the EasyMock.IArgumentMatcher interface to allow EasyMock to send an object for comparison. The matches() method will be used to determine if that’s the right deal after all. Since we’ve really got nothing to compare to, we do our validation in the matches() method just like in the answer() method before, and when it passes we set the id. The argument passed to the matcher is the one created in our test method, so it will have an id when the method continues from the mocked save attempt. Our test class has a new isPOJO() method, which kind of binds the IArgumentMatcher to our POJO type. While we do have to return an instance of our class, unless we want to use it to validate the information in the POJOMatcher.matches() method, it can be empty (as it is). had we wanted to, we could have made the isPOJO() more intelligent, perhaps taking a POJO as a parameter for comparison, and returning that after setting up the ReportMatcher. In our test method, we changed the preparation a little bit. Since the method doesn’t return a value any more, we can’t pass it to EasyMock.expect(), and then can’t use the expect().andAnswer() or expect().andReturn() methods, which is how we got wrapped up in ReportMatcher and IArgumentMatcher anyway. “Calling” the method and then telling EasyMock we expect the last call using the expectLastCall() will satisfy the replay and verify and let the mock do its job. When the call is run in the middle, our matcher will be called, comparing, ignoring our isPOJO()-provided POJO, and verifying the POJO actually passed in our implementation in the POJOMatcher.matches() method, and successfully setting the id. Now, in both cases, we can validate the information contained in a local object when passing through a mocked method, and can also meet our initial goal of affecting the passed object as the real object is expected to have affected it.
https://objectpartners.com/2010/08/19/mimicking-external-actions-with-easymock/
CC-MAIN-2020-40
refinedweb
1,283
55.44
Download source code for 3 ways to do WCF instance management (Per call, Per session and Single) Introduction:-• WCF client makes a request to WCF service object.• WCF service object is instantiated.• WCF service instance serves the request and sends the response to the WCF client.Following is the pictorial representation of how WCF request and response work. Following are different ways by which you would like to create WCF instances:-• You would like to create new WCF service instance on every WCF client method call.• Only one WCF service instance should be created for every WCF client session.• Only one global WCF service instance should be created for all WCF clients.To meet the above scenarios WCF has provided 3 ways by which you can control WCF service instances:-• Per Call• Per session• Single instance When we configure WCF service as per call, new service instances are created for every method call you make via WCF proxy client. Below image shows the same in a pictorial format:-• WCF client makes first method call (method call 1).• New WCF service instance is created on the server for this method call.• WCF service serves the request and sends response and the WCF instance is destroyed and given to garbage collector for clean up.• ‘InstanceContextMode’ value in the ‘ServiceBehavior’ attribute as shown below. This attribute we need to specify on the ‘Service’ class. In the below code snippet we have specified ‘intCounter’ as a class level variable as shown below and the class counter is incremented by one when method ‘Increment’ is called. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Percall)] public class Service : IService { private int intCounter; public int Increment() { intCounter++ return intCounter; } } At the client we have consumed the WCF client and we have called ‘Increment’ method twice. ServiceReference1.ServiceClient obj = new ServiceReference1.ServiceClient(); MessageBox.Show(obj.Increment().ToString()); MessageBox.Show(obj.Increment().ToString()); Even though we have called the ‘Increment’ method twice we get value ‘1’..• Client creates the proxy of WCF service and makes method calls.• One WCF service instance is created which serves the method response.• Client makes one more method call in the same session.• The same WCF service instance serves the method call.• When client finishes his activity the WCF instance is destroyed and served to garbage collector for clean up. To configure service as per session we need to configure ‘ServiceBehavior’ attribute with ‘PerSession’ value in the ‘InstanceContextMode’ object. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class Service : IService { private int intCounter; public int Increment() { intCounter++ return intCounter; }} At the client side when we run the below client code. You should see the value as ‘2’ ‘Single’ instance mode. Below is a simple pictorial notation of how single instance mode will operate:-• WCF client 1 requests a method call on WCF service.• WCF service instance is created and the request is served. WCF service instance is not destroyed the service instance is persisted to server other requests.• Now let’s say some other WCF client i.e. client 2 requests a method call.• ‘InstanceContextMode’ as ‘Single’. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] public class Service : IService { } If you call the WCF from different client you will see the counter keep incrementing. The counter has become a global variable. • You want a stateless services• Your service hold intensive resources like connection object and huge memory objects.• Scalability is a prime requirement. You would like to have scale out architecture.• Your WCF functions are called in a single threaded model. • You want to maintain states between WCF calls.• You want ok with a Scale up architecture.• Light resource references • You want share global data through your WCF service.• Scalability is not a concern. MSDN link for WCF instances Do not miss this post which covers end to end about WCF sessions Great blog by Rick rain on WCF instancing You can download source code for this tutorial from Top of this article. Latest Articles Latest Articles from Questpond Login to post response
https://www.dotnetfunda.com/articles/show/912/3-ways-to-do-wcf-instance-management-per-call-per-session-and-single
CC-MAIN-2020-34
refinedweb
658
56.45
This article applies to ASP.NET 2.0. Background This article originated from a customer question on the ASP.NET site. What they are trying to achieve is running multiple sites under a single actual ASP.NET application. This can be useful to avoid the overhead of having a different appdomain per site. So the general idea is to have a single application, and to use sub-directories to represent the site. Let’s call them ‘pseudo-sites’ as they are really just directories from the point of view of ASP.NET. For example, the app could have this structure: MyApp PseudoSites Site1 page.aspx uc.ascx Site2 Site2’s files… Such pseudo-sites will necessarily have a number of limitations: e.g. they won’t be able to each have their own bin, App_Code, and other top level directories, since these can only exist at the top level of a real ASP.NET application. In spite of these limitations, the structure can be useful for apps that don’t needs to have those directories. The issue we’re trying to solve: how to make path resolution work The main issue that this article deals with is the fact that path resolution will by default not work correctly when using such a structure. e.g. suppose /MyApp/PseudoSites/Site1/page.aspx has: Recall that ‘~’ means "the root of the app". Clearly "~/uc.ascx" means to refer to uc.ascx in the same pseudo-site as page.aspx. But ASP.NET will not see it that way, as the real root of the app is just "/MyApp". Instead, this will resolve to "/MyApp/uc.ascx", which is not where the file is. One obvious solution is to use relative paths instead of app relative paths. e.g. here you could write src="uc.ascx" mce_src="uc.ascx" and it would work fine. This is a fine thing to do in some cases, but in many other cases, you are much better off using app relative paths, as you are then free to move files around without having to worry about the relative locations always staying the same. So the question is: how can we make app relative paths (as well as absolute path, e.g. "/Site1/page.aspx") work correctly in the pseudo-site environment? VirtualPathProvider to the rescue ASP.NET 2.0 introduces the ability to hook deep into the way it deals with files via something called a VirtualPathProvider. Implementing a full VirtualPathProvider is somewhat involved, and is usually done to serve files out of an alternate store, like a database. Doing this is beyond the scope of this article (though I’d like to write more about it if there is interest!), and we will look at only one VirtualPathProvider method: CombineVirtualPaths. This method is called whenever the parser needs to resolve paths, which is exactly what we need to solve our problem! The code below shows a sample implementation of CombineVirtualPaths. You will need to adapt it to your situation but it demonstrates the principle. To try this code, simply put it somewhere in the App_Code directory (of your real app, not pseudo app!). Note: AppInitialize is a special method that gets called automatically at startup when it is found somewhere is App_Code. You could alternatively register the VirtualPathProvider from global.asax (in Application_OnStart) or an HttpModule. using System.Web; using System.Web.Util; using System.Web.Hosting; public classSimpleVPP : VirtualPathProvider { public static void AppInitialize() { HostingEnvironment.RegisterVirtualPathProvider(new SimpleVPP()); } public override string CombineVirtualPaths(string basePath, string relativePath) {public override string CombineVirtualPaths(string basePath, string relativePath) { // If the path is relative, let normal processing happen// If the path is relative, let normal processing happen if (!VirtualPathUtility.IsAbsolute(relativePath)) return base.CombineVirtualPaths(basePath, relativePath); // Determine the pseudo site from the request. To demonstrate, we just get it from the // query string, but it could come from other places, like the http host header string site = HttpContext.Current.Request.QueryString["site"]; // If we couldn’t, default to normal processing// If we couldn’t, default to normal processing if (site == null) return base.CombineVirtualPaths(basePath, relativePath); // Make it app relative (i.e. ~/…)// Make it app relative (i.e. ~/…) relativePath = VirtualPathUtility.ToAppRelative(relativePath); // Remap the virtual path to be inside the correct pseudo site// Remap the virtual path to be inside the correct pseudo site return "~/PseudoSites/" + site + relativePath.Substring(1); } } That’s basically it! With this code, the situation described above will be able to run, since your code is driving the path resolution. Basically, you get to give whatever meaning you want to ‘~’. A couple more notes about this: - The name of the parameter ‘relativePath’ in CombineVirtualPaths is misleading, since this is actually called for all paths, not just relative. And of course, if that were not the case, our solution wouldn’t work! - To test the example above, you would need to request something like, because that’s what the sample CombineVirtualPaths expects. In a real world app, you would probably not use that. Note on using a VirtualPathProvider with a precompiled site As some of you found, if your site if precompiled, your VPP is not used. I wish we had made this scenario work, but I guess it fell through due to scheduling. We basically ended up artificially disabling the scenario because we didn’t have time to test it properly. Someone posted a workaround using private reflection. It is definitely a hack (and may break in later versions, though that’s not likely), and I can’t guarantee that it works well in all scenario, but if it can unblock you, give it a try. Hi David, great post. I have a question; Can the VirtualPathProvider handle any type of file, or just the ones mapped in IIS to the Asp.Net runtime? That’s very interesting topic for me,particularly database driven part as you understand;-) But I would like to know more about parser hooks in general-how INamingContainer control can get pre parsed content of itself for example?I mean if we have <c runat="server">….<%if(){%>…<%}%>…</c> I want to get raw text inside <c/>,before(or after) it will be processed by parser-control graph is not very useful in some cases. Great post,keep it coming! David, I really enjoy this feature a lot. I’m using the VirtualPathProvider with the file system, but in a slightly dffferent way. What I’m doing is creating structured content in Xml files and using the VirtualPathProvider for on-the-fly page declarative page composition. It works really we so far from a technical perspective, but I haven’t had much chance to measure actual preformance. The best side effect is that the VPP allows for meaningful url names for dynamic files instead of using querystring variables – though this feature can be abused – and that inturn allows much better use of url authorization, and so on. There are a lot of really good wins here. A couple of things to note: 1) Using a VirtualPathProvider and a default document doesn’t work well in IIS 6 as it would require a default.aspx stub. Will this be resolved in IIS 7? 2) Calling Precompile.axd does not perform compilation on providers added to the site. Is this by design? (Seems like the right idea.) 3) Will IIS 7 have support for WinFs stores? David, thanks for an excellent post, very valuable. Would a VPP be appropriate for someone considering an image management system — i.e. store the images (.tiff) in a db instead on on a file store? Can you suggest some resources for learning more? Thanks! Thank you, David, for looking into the problem that I described on the ASP.NET forums. The VirtualPathProvider does indeed allow me to override the way in which tilde-based paths are resolved in page directives, such as this: <%@ Register TagPrefix="Test" TagName="ChildControl" Src="~/child.ascx" %> The VirtualPathProvider does not, however, affect the way in which tilde-based paths are resolved for dynamically loaded user controls, such as this: MyPlaceHolder.Controls.Add(LoadControl("~/child.ascx")); To have the LoadControl method resolve tilde-based paths in the same way as Register directives requires that the page code-behind forcibly override this method: public new Control LoadControl(string relativePath) { string newPath = relativePath; string site = this.Request.QueryString["site"]; if (String.IsNullOrEmpty(site) == false) { newPath = VirtualPathUtility.ToAppRelative(newPath); newPath = relativePath.Substring(1); newPath = "~/PeeudoSites/" + site + newPath; } return base.LoadControl(newPath); } With the combination of a VirtualPathProvider and an updated base page class, an ASP.NET application can allow pseudo-sites (child sites) to work as though they were full sites. Great stuff! Thanks, David! Erling, the VPP only handles files that are handled by ASP.NET, since it is a part of the ASP.NET runtime. Note that you can star map all requests for a given application to go to ASP.NET: in the IIS configuration, add an entry in the Wildcard application maps pointing to aspnet_isapi.dll (full path). Hi Lynn, I’m not much of an expert on IIS7, so I’ll let others answer #1 and #3. You might be able to get around #1 by mapping all request to ASP.NET (see my previous comment), and then use RewritePath to map the directory request to the default document yourself. #2: note that precompile.axd no longer exists in the released product (we removed it because of security concerns). You can still do the equivalent from the command line using aspnet_compiler.exe. But to answer your question, precompilation does not work with VirtualPathProviders. I think it could have been made to work in theory, but there were some non-trivial issues, and scheduling made us decide not to support it Hi Mark, Yes, I think a VPP could work for your image store. Mostly, it will work well if you want your URL to look like they use a ‘regular’ directory structure instead of being based on quesry string params. There may not be much in term of resources right now, though I’m hoping to write a more complete VPP sample at some point. Hi Alister, Glad that this solution is working for you! You bring up a very good point about it not working for the LoadControl() case. Frankly, I think that this case should have been made to go through VPP.CombineVirtualPaths as well, but for whatever reason, we didn’t do this (you could say it’s a bug). Your workaround will work, as long as LoadControl is called directly on your derived class (since LoadControl is not virtual). Also, you may need a similar override in a UserControl base class (since LoadControl lives on TemplateControl). Kind of a pain, but it least it gets you going! David, thanks for the heads up on the precompile.axd removal.I haven’t gotten to the RTM yet. The idea of using it to retrieve pages from a database is very interesting and might work for a project that I’m discussing right now. If we were to retrieve the pages directly from the db, one question I would have is about compilation and performance. 1) Will the page be compiled the first time it is retrieved from the DB or would it be recompiled every time? 2) When the page is compiling will other users of other pages also have to wait while the page compiles or will they be able to continue working with their pages while the newly retrieved pages compile. 3) Could the code-behind also be retrieved from the DB or just the ASPX page? Alex, 1. Compiled pages are cached, and not recompiled unless your VPP indicates they are out of date. 2. Generally, ASP.NET only allows one compilation to happen at a time. However, other requests that don’t require compilation won’t be blocked. 3. Yes, the VPP applies to both the page and its code file. Quick question: Could you just set the virtual directory as "Application" in IIS? This way, you do not need any coding for "~/". David, Thanks loads for the post. I’m looking forward to utilize CombinePath approach for my following case: 1. Multiple Virtual WebSites, with different domains are pointing to same application. Through a HttpModule, I map to corresponding folders of websites based on their host. This allows me to simplify: a. >> to >> b. >> to >> Above works absolutely fine with Context.RewritePath, functionally. Problem I’m facing is to base my Urls correctly to Theme resources, with respect to default.aspx which is in root (as in Url). Where does basing, w.r.t. Theme resources happen? How can make ../../App_Themes/Red/Style.css to /App_Themes/Red/Style.css w.r.t. /Default.aspx (virtual), which is actually inside domain folder? Any help shall be greatly useful. Thanks. — Sharad Jun, Yes, you could certainly do this, but the premise here is that we want to be "running multiple sites under a single actual ASP.NET application". Why? Because it is much lighter weight than having multiple applications, so it can potentially scale to a very large number of apps. David Sharad, Maybe one approach that would work is to star map all requests to ASP.NET in IIS, in order to have them all go through your HttpModule. From there you could then fix up the paths? David David, This is exactly what I needed. Thanks, and excellent work! So, in ASP.NET 2.0 we have this niftty feature that noone really understands called the Virtual Path… Hi, This is a great feature for content management. I’ve got it working with my cms database to load content, but how do I exclude the directory containing the cms admin system itself? Something like this loads fine from the db. This page doesn’t exist in the database so is a 404. I need to somehow exclude /cms/ and all its children from the VPP so they can be served normally. Any pointers would be greatly appreciated! Cheers, Ed Hi Ed, You should be able to exclude content by simply forwarding the calls to don’t want to handle to ‘Previous’. e.g. if you get a call to GetDirectory for your cms dir, just return Previous.GetDirectory(virtualDir). David Hi David, That doesn’t seem to be working. I haven’t changed the GetDirectory method from Scott Guthrie’s original example which returns Previous.GetDirectory(virtualDir) if the db access layer’s file record data is null. Any thoughts on how I could debug this would be great. Cheers, Ed Hi, found the problem. In the code sample I downloaded the FileExists and DirectoryExists methods were returning false when the file record data was null. These need to be changed to: return Previous.FileExists(virtualPath); and return Previous.DirectoryExists(virtualDir); Cheers, Ed that’s just what i want! great! Sprite Builder – combine separate images into one sprite. I have been looking for an article showing how to implement the VirtualPathProvider to pull Micorsoft Office Documents from a database. From what I have found so far, it is a little more involved. Any advice you could offer on this topic would be great. I’m trying to do something different, but this seems like it might be the solution. Could I use VPP to let me share an "images" directory between two web apps? I.e., wwwroot/ app1/ app2/ images/ Where the "images/" part of the path gets dynamically rewritten to an absolute filesystem path (wwwroot/images) instead of an app-rooted path (appN/images)? Or is there an easier way to do this? Jesse, maybe an easier way to do this is to use NTFS junctions to make a single directory appear in multiple places. e.g. start by looking at this tools: Thanks, David! That’s *exactly* what I needed. Except that my problem’s on a shared server, where I can’t shell out to exe’s. But I found a C# wrapper for the DFS API’s: Hopefully, this will do the trick. ASP.Net 2.0&nbsp;is bundled with some great technology, especially what is available through the&nbsp;provider… Yo Guys, I have found a way to register my VirtualPathProvider with the precompile option… It’s really easy with only 9 lines of code. Why do I need this functionnality? Becoz I’m working in a bank that need to share its masterpage and that compels us to precompile and create a single assembly (aspnet_merge) with versioning for all our websites… So, what is my secret ? Very easy. The answer is DynamicMethod. I call a Microsoft internal method to register my VirtualPathProvider. Nevertheless, there are limitations. For exemple, i suppose it does not work for all situation (since Microsoft doesn’t want us to precompile). Moreover, I am now dependent of the CLR version and implementation (Microsoft can still change its code without my permission 😀 ) May the code be with you… Recently one of the engineers on my team (Amitkumar Sharma) got this issue reported by the customer where
https://blogs.msdn.microsoft.com/davidebb/2005/11/27/overriding-asp-net-combine-behavior-using-a-virtualpathprovider/
CC-MAIN-2017-09
refinedweb
2,850
65.52
Sergey has posted a Control he wrote and has some interesting thoughts on ViewState and ControlState. I agree to 100% - I think a lot of Dev's out there don't know of their addiction. Sometimes it happens that a form is processing and you need to make sure that the users don't panic and run away before it finishes. A splash screen with a "Loading..." indicator can help to calm down frightened users and make life easier for technical support staff. Back in the days of classic ASP (VBScript) which used a linear programming approach we had to start by setting the response buffer to true: <% Response.Buffer = True %> This line does nothing but instructing the server NOT to send anything back to the client until the page has been finished processing. An exception can be forced by calling the flush command: Response.Flush(); } }... The property ImageUrl just gives public access to the private field m_ImageUrl. Having (again) the client side developer in mind we provide the XML comments summary, value and remarks and additionally set the description attribute, which allows Visual Studio to display details in the properties window. Delegates and events are one of the most powerful tools that come with .NET Framework and we can use them to let the client developer attach his/her custom long running operation as custom event handler code. Even more then one method can be attached so that all together are the “one long running task” that is processed while the graphic is displayed. Separated nicely from the infrastructure code (the control we are currently writing). Here is our event code:); } The OnProcess method triggers the event and invokes the attached custom long running operations. Now that the ability is given that custom code can be executed using the event/delegate we need to actually raise the event and before that ensure that the response buffer is set to true and the graphic is send to the client. The load event of out control does this job for us. ///); "); After OnProcess is called we call Flush like we did in classic ASP and send the piece of client side script to the client that will hide the div-layer containing the graphic indicating the user that something is happening. On the client side the control can now be used as follows in the *.aspx-Page: <%@: using System; using System.Web.UI.Design; public class WaitScreenDesigner : ControlDesigner. IWebApplication webApp = (IWebApplication)Component.Site.GetService( typeof(IWebApplication)); The next step is to find the image as project item of our web project. The IWebApplication interface provides the method GetProjectItemFromUrl, which fits our needs.:
http://www.lennybacon.com/CategoryView,category,Article.aspx
crawl-001
refinedweb
441
61.97
Download presentation Presentation is loading. Please wait. Published bySienna Dunlap Modified about 1 year ago 1 1 Introduction to Recursion and Recursive Algorithms CS2110 2 2 Different Views of Recursion Recursive Definition: n! = n * (n-1)! (non-math examples are common too) Recursive Procedure: a procedure that calls itself. Recursive Data Structure: a data structure that contains a pointer to an instance of itself: public class ListNode { Object nodeItem; ListNode next, previous; … } 3 3 Recursion in Algorithms Recursion is a technique that is useful –for defining relationships, and –for designing algorithms that implement those relationships. Recursion is a natural way to express many algorithms. For recursive data-structures, recursive algorithms are a natural choice 4 4 What Is Recursion? A Definition Is Recursive If It Is Defined In Terms Of Itself –We use them in grammar school e.g. what is a noun phrase? a noun an adjective followed by a noun phrase –Descendants the person’s children all the children’s descendants 5 5 What Is Recursion? Think self-referential definition A definition is recursive if it is defined in terms of itself –Exponentiation - x raised to the y power if y is 0, then 1 otherwise it’s x * (x raised to the y-1 power) 6 6 Other recursive definitions in mathematics Factorial: n! = n (n-1)! and 0! = 1! = 1 Fibonacci numbers: F(0) = F(1) = 1 F(n) = F(n-1) + F(n-2) for n > 1 Note base case –Definition can’t be completely self-referential –Must eventually come down to something that’s solved “directly” 7 7 I know the steps needed to write a simple recursive method in Java 1.Strongly Agree 2.Agree 3.Disagree 4.Strongly Disagree 8 8 Recursive Factorial public static int factorial (int n) { if (n == 1) return 1; else return n * factorial(n-1); } Exercise: trace execution (show method calls) for n=5 9 9 Why Do Recursive Methods Work? Activation Records on the Run-time Stack are the key: Each time you call a function (any function) you get a new activation record. Each activation record contains a copy of all local variables and parameters for that invocation. The activation record remains on the stack until the function returns, then it is destroyed. Try yourself: use your IDE’s debugger and put a breakpoint in the recursive algorithm Look at the call-stack. 10 10 Broken Recursive Factorial public static int Brokenfactorial(int n){ int x = Brokenfactorial(n-1); if (n == 1) return 1; else return n * x; } What’s wrong here? Trace calls “by hand” –BrFact(2) -> BrFact(1) -> BrFact(0) -> BrFact(-1) -> BrFact(-2) -> … –Problem: we do the recursive call first before checking for the base case –Never stops! Like an infinite loop! 11 11 Recursive Design Recursive methods/functions require: 1) One or more (non-recursive) base cases that will cause the recursion to end. if (n == 1) return 1; 2) One or more recursive cases that operate on smaller problems and get you closer to the base case. return n * factorial(n-1); Note: The base case(s) should always be checked before the recursive call. 12 12 Rules for Recursive Algorithms Base case - must have a way to end the recursion Recursive call - must change at least one of the parameters and make progress towards the base case –exponentiation (x,y) base: if y is 0 then return 1 recursive: else return (multiply x times exponentiation(x,y-1)) 13 13 How to Think/Design with Recursion Many people have a hard time writing recursive algorithms The key: focus only at the current “stage” of the recursion –Handle the base case, then… –Decide what recursive-calls need to be made Assume they work (as if by magic) –Determine how to use these calls’ results 14 14 Example: List Processing Is an item in a list? First, get a reference current to the first node –(Base case) If current is null, return false –(Base case #2) If the first item equals the target, return true –(Recursive case – might be on the remainder of the list) current = current.next return result of recursive call on new current 15 15 Next: Trees and Grammars Lab on binary tree data structures Maybe: HW5 on grammars Lecture Later: Recursion vs. iteration –Which to choose? –Does it matter? Maybe Later: recursion as an design strategy 16 16 Next: Time Complexity and Recursion Recursion vs. iteration –Which to choose? –Does it matter? Later: recursion as an design strategy 17 17 Recursion vs. Iteration Interesting fact: Any recursive algorithm can be re-written as an iterative algorithm (loops) Not all programming languages support recursion: COBOL, early FORTRAN. Some programming languages rely on recursion heavily: LISP, Prolog, Scheme. 18 18 To Recurse or Not To Recurse? Recursive solutions often seem elegant Sometimes recursion is an efficient design strategy But sometimes it’s definitely not –Important! we can define recursively and implement non-recursively –Many recursive algorithms can be re-written non- recursively Use an explicit stack Remove tail-recursion (compilers often do this for you) 19 19 To Recurse or Not to Recurse? Sorting –Selection sort vs. mergesort – which to choose? Factorial –Could just write a loop. –Any advantage to the recursive version? Binary search –We’ll see two versions. Which to choose? Fibonacci –Let’s consider Fibonacci carefully… 20 20 Recursive Fibonacci method This is elegant code, no? long fib(int n) { if ( n == 0 ) return 1; if ( n == 1 ) return 1; return fib(n-1) + fib(n-2); } Let’s start to trace it for fib(6) 21 21 Trace of fib(5) For fib(5), we call fib(4) and fib(3) –For fib(4), we call fib(3) and fib(2) For fib(3), we call fib(2) and fib(1) –For fib(2), we call fib(1) and fib(0). Base cases! –fib(1). Base case! For fib(2), we call fib(1) and fib(0). Base cases! –For fib(3), we call fib(2) and fib(1) For fib(2), we call fib(1) and fib(0). Base cases! fib(1). Base case! 22 22 Fibonacci: recursion is a bad choice Note that subproblems (like fib(2) ) repeat, and solved again and again –We don’t remember that we’ve solved one of our subproblems before –For this problem, better to store partial solutions instead of recalculating values repeatedly –Turns out to have exponential time- complexity! 23 23 Non-recursive Fibonacci Two bottom-up iterative solutions: –Create an array of size n, and fill with values starting from 1 and going up to n –Or, have a loop from small values going up, but only remember two previous Fibonacci values use them to compute the next one (See next slide) 24 24 Iterative Fibonacci long fib(int n) { if ( n < 2 ) return 1; long answer; long prevFib=1, prev2Fib=1; // fib(0) & fib(1) for (int k = 2; k <= n; ++k) { answer = prevFib + prev2Fib; prev2Fib = prevFib; prevFib = answer; } return answer; } 25 25 Next: Putting Recursion to Work Divide and Conquer design strategy –Its form –Examples: Binary Search Merge Sort –Time complexity issues 26 26 Divide and Conquer It is often easier to solve several small instances of a problem than one large one. –divide the problem into smaller instances of the same problem –solve (conquer) the smaller instances recursively –combine the solutions to obtain the solution for original input –Must be able to solve one or more small inputs directly This is an algorithm design strategy –Computer scientists learn many more of these 27 27 General Strategy for Div. & Conq. Solve (an input I) n = size(I) if (n <= smallsize) solution = directlySolve(I); else divide I into I 1, …, I k. for each i in {1, …, k} S i = solve(I i ); solution = combine(S 1, …, S k ); return solution; 28 28 Why Divide and Conquer? Sometimes it’s the simplest approach Divide and Conquer is often more efficient than “obvious” approaches –E.g. BinarySearch vs. Sequential Search –E.g. Mergesort, Quicksort vs. SelectionSort But, not necessarily efficient –Might be the same or worse than another approach We must analyze each algorithm's time complexity Note: divide and conquer may or may not be implemented recursively 29 29 Top-Down Strategy Divide and Conquer algorithms illustrate a top-down strategy –Given a large problem, identify and break into smaller subproblems –Solve those, and combine results Most recursive algorithms work this way The alternative? Bottom-up –Identify and solve smallest subproblems first –Combine to get larger solutions until solve entire problem 30 30 Binary Search of a Sorted Array Strategy –Find the midpoint of the array –Is target equal to the item at midpoint? –If smaller, look in the first half –If larger, look in second half firstmidlast 31 31 Binary Search (non-recursive) int binSearch ( array[], target) { int first = 0; int last = array.length-1; while ( first <= last ) { mid = (first + last) / 2; if ( target == array[mid] ) return mid; // found it else if ( target < array[mid] ) // must be in 1 st half last = mid -1; else // must be in 2 nd half first = mid + 1 } return -1; // only got here if not found above } 32 32 Binary Search (recursive) int binSearch ( array[], first, last, target) { if ( first <= last ) { mid = (first + last) / 2; if ( target == array[mid] ) // found it! return mid; else if ( target < array[mid] ) // must be in 1 st half return binSearch( array, first, mid-1, target); else // must be in 2 nd half return binSearch(array, mid+1, last, target); } return -1; } No loop! Recursive calls takes its place –But don’t think about that if it confuses you! Base cases checked first? (Why? Zero items? One item?) 33 33 Mergesort is Classic Divide & Conquer 34 34 Algorithm: Mergesort Specification: –Input: Array E and indexes first, and Last, such that the elements E[i] are defined for first <= i <= last. –Output: E[first], …, E[last] is sorted rearrangement of the same elements Algorithm: void mergeSort(Element[] E, int first, int last){ if (first < last) { int mid = (first+last)/2; mergeSort(E, first, mid); mergeSort(E, mid+1, last); merge(E, first, mid, last); // merge 2 sorted halves } 35 35 Exercise: Trace Mergesort Execution Can you trace MergeSort() on this list? A = {8, 3, 2, 9, 7, 1, 5, 4}; 36 36 Efficiency of Mergesort Wait for CS2150 and CS4102 to study efficiency of this and other recursive algorithms But… –It is more efficient that other sorts like Selection Sort, Bubble Sort, Insertion Sort –It’s O(n lg n) which is the same order-class as the most efficient sorts (also quicksort and heapsort) The point is that the D&C approach matters here, and a recursive definition and implementation is a “win” 37 37 Merging Sorted Sequences Problem: –Given two sequences A and B sorted in non- decreasing order, merge them to create one sorted sequence C –Input size: C has n items, and A and B have n/2 Strategy: –Determine the first item in C: it should be the smaller of the first item in A and the first in B. –Suppose it is the first item of A. Copy that to C. –Then continue merging B with “rest of A” (without the item copied to C). Repeat! 38 38 Algorithm: Merge merge(A, B, C) if (A is empty) append what’s left in B to C else if (B is empty) append what’s left in A to C else if (first item in A <= first item in B) append first item in A to C merge (rest of A, B, C) else // first item in B is smaller append first item in B to C merge (A, rest of B, C) return 39 39 Summary of Recursion Concepts Recursion is a natural way to solve many problems –Sometimes it’s a clever way to solve a problem that is not clearly recursive Sometimes recursion produces an efficient solution (e.g. mergesort) –Sometimes it doesn’t (e.g. fibonacci) To use recursion or not is a design decision for your “toolbox” 40 40 Recursion: Design and Implementation “The Rules” –Identify one or more base (simple) cases that can be solved without recursion In your code, handle these first!!! –Determine what recursive call(s) are needed for which subproblems –Also, how to use results to solve the larger problem –Hint: At this step, don’t think about how recursive calls process smaller inputs! Just assume they work! 41 41 Exercise: Find Max and Min Given a list of elements, find both the maximum element and the minimum element Obvious solution: –Consider first element to be max –Consider first element to be min –Scan linearly from 2nd to last, and update if something larger then max or if something smaller than min Class exercise: –Write a recursive function that solves this using divide and conquer. Prototype: void maxmin (list, first, last, max, min); Base case(s)? Subproblems? How to combine results? 42 42 What’s Next? Recursive Data Structures –Binary trees Representation Recursive algorithms –Binary Search Trees Binary Trees with constraints Parallel Programming using Threads Similar presentations © 2016 SlidePlayer.com Inc.
http://slideplayer.com/slide/2811626/
CC-MAIN-2016-50
refinedweb
2,192
53.34
This tutorial needs KDE Frameworks 5 / Plasma 5=:- These are the "glue" between your class and plasma, without it, nothing will start. import QtQuick 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents PlasmaComponents.Label { text: "Hello world in Plasma Guidelines_and_HOWTOs/CMake. Since this plasmoid contains no native (compiled) code you can directly try and execute it using XXX (!! FixMe !!). To Install, Test and Remove your new plasmoid. The Plasma Package Manager. You can install your plasmoid, You can test your Plasmoid without installing it with the plasmoidviewer tool: plasmoidviewer --applet package The --applet parameter takes again the path (full or relative) to the directory containing the metadata.desktop file of your Plasm.
https://techbase.kde.org/Development/Tutorials/Plasma2/QML2/GettingStarted
CC-MAIN-2017-43
refinedweb
115
52.15
R Notes Page Contents References \ Reads - R Language Definition. - The Art Of R Programming. - Producing Simple Graphs with R, by Frank McCown Some Basic Command Line Misc Stuff Getting Help To get help on a function you can use the following... ?func-name ## Display help for function with this exact name help.search("func name") ## Search all help for function like this args("func name") ## gets args for this exact function Typing a function name without the ending curley brackets displays the code for the function. Working Directory Functions will generally read or write to your working directory (unless you use absolute paths) Use getwd() to display your current working directory and setwd("...") to set your current working directory. dir("...") will list a directory. Source R code from console Use source("..filename.."). Basic Flow Control If-then-else If-the-else as standard... if(...) { } else if { } else { } You can also assign from an if into a variable... > x <- if(FALSE) { cos(22) } else { sin(22) } > x [1] -0.008851309 > x <- if(TRUE) { cos(22) } else { sin(22) } > x [1] -0.9999608 For loops For each value in a range... for(i in 1:10) { ... } To generate an index for each member of a vector... for(i in seq_along(x)) { ...x[i]... } For each item in a list... for(item in x) { ... } While loops count <- 0 while(count < 10) { count <- count + 1 } Infinite loops repeat { // infinite loop } Skip loop iteration or exit loop The standard break statement, and to continue use Functions The basics... In R, functions are first class objects which means that they can be passed as args to other functions. Functions can also be nested. First class means that functions can be operated on like any other R object. I.e., ...this means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures... (Wikipedia article "First class functions"). Function arguments evaluated lazily, which means that they are only evaluated as they are needed/used. Functions are declared as follows and return whatever the last statement evaluates to... five <- function() { + 1 + 4 + } > five() [1] 5 Like many scripting langauges, function parameters can be declared too, and with default parameters > threshold <- function(x, n=5) { + x[x > n] = n + x + } > threshold(1:10, 2) [1] 1 2 2 2 2 2 2 2 2 2 Also like many other languages, functions can accept a variable number of arguments, using the C-like syntax of three consequitive dots, or "ellipsis". For more information read this r-bloggers article. The '...' argument indicates variable number of arguments. You can pass the list using '...' to other functions as well. Note that arguments after '...' must be named explicitly and cannot be partially matched. > test <- function(...) { + arguments <- list(...) + arguments + } > test(1,2, a=3) [[1]] [1] 1 [[2]] [1] 2 $a [1] 3 If you want to get a lit of the formal arguments a function expects, use the formals(functionName) function, which returns a list of all formal argumentss of the function with name "functionName" Scoping Best read the R manual scope section. To bind a value to a symbol, R searches though series of environments. An environment is a collection of symbol, value pairs. To find out what is in a function's environment use the ls(funcName) function. Each environment has a parent and a number of children. A function plus an environment is a closure. From the command line R will... - Search global environment (user's workspace) for the symbol name, - Search the namespaces of each package on the search list (order matters). You can print search list using the search()function. R has seperate namespaces for objects and functions so functions and objects can have the same name without a name-collision occuring. Scoping rules determine how a value is associated with a free variable in a function. R uses lexical scoping, also known as static scoping. In lexical or static scoping the value associated with a variable is determined by its lexical position (i.e, where in the text/code structure with respect to nesting levels, functions etc the variable is), which means that ... this matching only requires analysis of the static program text. This is the opposite of dynamic scoping wherethe value is determined by the run time context. Another way of saying this is that in lexical scoping the value of a variable in a function is looked up in the environment in which the function was defined. With dynamic scoping, a variable is looked up in the environment from which the function was called (sometimes refered to as the calling environment). Free variables are those that are not formal arguments and are not local variables defined inside the function body. R will search for free vars in the current environment and then recursively up into the environment's parents until global environment is reached. Then R will search the search() list. A free variable in a function can be read and written to and will refer to some variable outside of the function's scope. The trouble is that free variables automatically become (are considered as) local variables if they are assigned to. So, consider this little rubbish example: > b <- 10 > a <- function() { + print(b) + } > a() [1] 10 Here b is a free variable in the function a() because it is not declared as a parameter and it is not local. But wait a minute... if we assigned a value to b rather than just read it, it would become a local variable. There would be two b's. One in the function's environment and one in the global environment and the one in the function's environment would be modified! This is why the <<- operator is needed!... > a <- function() { + b <<- 100000 + } > a() > b [1] 1e+05 The <<- operator can be used to assign a value to an object in an environment that is different from the current environment. This operator looks back in enclosing environments for an environment that contains the symbol. If the global or top-level environment is reached without finding the symbol then that variable is created and assigned there. See this SO thread, I found it very useful. Vectors, Sequences And Lists Vectors can only contain elements of the same type. When mixing objects coercion occurs so all vector elements are of the same type. Sequences are just vectors of numerics with monotonically increasing values. Lists are vectors that can contain elements of different classes. Indices start from 1. If you index beyond the limits of a list or vector you will get NAs. Creation Some easy ways to create 'em... Vectors vector(type, value) For example, " vector("numeric", 10)" creates a vector of 10 numerics all initialised to zero. as.vector(obj) Coerces obj into a vector. This will remove the names attribute. c(item1, item2, item3, ...) The default form creates a vector by concatenating all the items passed into c() together. All arguments are coerced to a common type. rep(item, times = x) This will create a vector consisting of the item repeated x times. For example... > rep(123, times=5) [1] 123 123 123 123 123 rep(list-of-items, times = x) This will create a flattened list of list-of-items repeated x times. For example... > rep(c(1,2,3), times=5) [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 In other words it is as if we keep appending each list to a "mother" list like this: [[1 2 3] ... [1 2 3]] and then flatten the list so that it becomes [1 2 3 ... 1 2 3]. Note that this flattening is recursive so that lists of lists are entirely flattened. For example... > rep(c(c(1,2), c(2,3)), times=5) [1] 1 2 2 3 1 2 2 3 1 2 2 3 1 2 2 3 1 2 2 3 rep(list-of-items, each = x) Like the above except that instead of pasting many copies of the lists together, we first recursively flatten the list and then repeat the first value x times, then the second value x, then the third and so on... > rep(c(1,2,3), each=5) [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 ## Or equivalently ## rep(1:3, each=5) Sequences x:y This generates a sequence of numbers from x to y inclusive in increments of 1. seq_len(len) Generates a sequence from 1 to len. Useful in for loops... > seq_len(10) [1] 1 2 3 4 5 6 7 8 9 10 > for (i in seq_len(10)) { + # Is a loop of 10 iterations, with i values as above + } seq(x, y, by=[0-9]+) This is a generalisation of the above. It generates a sequence of numbers from x to y inclusive with a step of [0-9]+. Note that the inclusivity of the final value depends on the step value. For example... > seq(1,5,by=3) [1] 1 4 seq(x,y,length=[0-9]+) As above but we don't care about the increment but want x to y inclusive such that length of the generated sequence is [0-9]+. Note that x and y are always included. For example... > seq(1,5,length=9) [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 seq(along.with=obj) or seq_along(obj) The above are equivalent. I think you'd normally see seq_along() rather than the longer form. This function enumerates the object passed in. For example... > s <- rnorm(10) ## Generate a vector of 10 random nums > seq_along(s) [1] 1 2 3 4 5 6 7 8 9 10 Lists Remember that lists are like vectors that can contain elements of different classes. list() Use to create a list or even a list of lists. For example, " list(1, "string", TRUE)" creates a list of 3 lists, where each list has one member. Subsetting \ Indexing Always useful to read is the R Language Definition for Indexing. This is especiall useful to understand the difference between the [[]] and [] indexing operations. A vector is subset using square brackets (like in most scripting languages) and uses a very similar notation. Indices start from 1. If you index beyond the limits of a vector you will get NAs. Slices One thing to note is that unlike in Python's NumPy, slices are not views into an array. In the following example, taking a slice of vector a and modifying it does effect the original a. > x = vector("numeric", 5) > x[1:4] = 33 > x [1] 33 33 33 33 0 > a = x[1:4] > a [1] 33 33 33 33 > a[1] = 22 > a [1] 22 33 33 33 > x [1] 33 33 33 33 0 Boolean Indexing eg. y<- x[!is.na(x)] Fancy Indexing Can also fancy-index vectors: x[c(1,3,5)] ## gets first, third and fith element x[-c(2,10)] ## gives us all elements of x EXCEPT for the 2nd and 10 elements! # ^ # Note the minus sign here! Named Indexing You can assign names to each index of a vector (or list) and then index it using that name instead of position. For example: > x = vector("numeric", 2) > x [1] 0 0 > ## By default vector has no names > names(x) NULL > ## Note how the vector is now displayed in a tabular fashion > names(x) = c("john", "jack") > x john jack 0 0 > ## You can get the first member using its name > x["john"] john 0 > ## Or can get the first member using its position > x[1] john 0 With lists things get a little more interesting. You can give the elements of a list names, just as we did above for vectors, but when we do we can use the $ operator to access named list$member.name. > q = list(1, 1.2, "james", TRUE) > names(q) = c("a", "b", "c", "d") > q$a ## Now we can refer to the member using its name [1] 1 > q$b ## Now we can refer to the member using its name [1] 1.2 Single Item Or List: [[ vs [, or double brackets vs single brackets... For lists, use [[ to select any single element. [ returns a list of the selected elements: > x <- list(1,c(2,3)) > x [[1]] ## This is list element 1 [1] 1 ## List element 1 is a numeric vector of size 1 [[2]] ## This is list element 2 [1] 2 3 ## List element 2 is a numeric vector of size 2 > > x[1] ## Returns a list containing the selected numerics [[1]] [1] 1 > class(x[1]) ## Single '[' returned a list [1] "list" > > x[[1]] ## Returns the actual element [1] 1 > class(x[[1]]) [1] "numeric" The other significant difference is that double brackets only let you select a single item, whereas, as you have seen, the single bracket lets you select multiple items. Note that with vectors there is only a very subtle difference using the indexing operations [[]] and []. If we use a single index then in both cases an atomic type will be returned. However, using [[]] will strip the names. > # Use the single braces [...] > x["james"] james 0 > class(x["james"]) [1] "numeric" > x["james"] + 1 # NOTE: The names() have been preserved james 1 > > Use the double braces [[...]] > class(x[["james"]]) [1] "numeric" > x[["james"]] + 1 # NOTE: The names() have been DROPPED [1] 1 Test For Membership To see if a value is in a list or vector use %in% or match(). > v <- c('a','b','c','e') ## %in% returns a boolean > 'b' %in% v [1] TRUE ## match() returns the first location of 'b', in this case: 2 > match('b',v) [1] 2 One advantage that %in% has over match() is that, because it returns a list of booleans, it can be used with functions such as all() or any(). For example... > all(c('b', 'e') %in% v) [1] TRUE Other Common Operations length(seq_obj) dim()attribute. identical() paste(list, collapse=str) Collapses the list into a single string in which the elements are separated by the string specified by str. The elements in the list will be coerced into a string using as.string() if required. For example... > paste(c(1,2,3,4,5), collapse = "") [1] "12345" You can, in fact, paste multiple lists into a string, the first element from each list first, then the second and so on. For example... >paste(1:3, c("X", "Y", "Z"), 4:7, collapse="") [1] "1 X 42 Y 53 Z 61 X 7" Matrices Intro Matrices are like 2D vectors. All elements must be of the same type. They have an extra dimensions attribute called dim which gives the matrix shape as a tuple (num rows, num cols). For example... > # Creates a matrix initialised with NA values. > m <- matrix(nrow = 2, ncol = 3) > attributes(m) $dim [1] 2 3 Use dim() to get the dimensions of a matrix. Vectors do not have a dim attribute... only matricies and data frames. Use length() for a vector. Constructing There are several ways to construct a matrix... By default hey are constructed column-wise: Fill the first column, then second, and so on. This can be useful when your data is presented as a flat vector where every group of n items is a list of observations for one single variable. For example, lets say that we have a vector that records the test scores for 2 students across 4 exams. The vector could be a flattened version of [[80, 81, 82, 83], [50, 51, 52, 53]], where each inner vector is the test scores for a student in 4 seperate exams. The flattened version we have would be [80, 81, 82, 83, 50, 51, 52, 53]. The first student has done very well, scoring in the 80's. The second student has only scored in the 50s (just for the sake of making distinguishing students easy). We want a matrix where columns represent a student and each row the score for a particular test. I.e, we want a matrix where the first colum had the values 80, 81, 82, 83 and the second column had the values 50, 51, 52, 53. To read the vector into a matrix, column-wise, we would do the following. > data = c(80, 81, 82, 83, 50, 51, 52, 53) > data [1] 80 81 82 83 50 51 52 53 > matrix(data, nrow=4, ncol=2) [,1] [,2] [1,] 80 50 [2,] 81 51 [3,] 82 52 [4,] 83 53 The above shows how we have given a shape to our flat vector of data. Now we have students in the matrix columns and tests as the rows. It is also possible to fill the matrix row-wise: Fill the first row, then the second, and so on. Imagine our flat vector from above was actually presented in a different way. The consecutive values are now organised per test so that the vector, unflattened, would look like this: [[80, 50], [81, 51], [82, 52], [83, 53]]. We still want our matrix layout to be a column for each student and the rows to be the tests. What we need to do is fill by row, as follows: > data = c(80, 50, 81, 51, 82, 52, 83, 53) > m <- matrix(data, nrow=4, ncol=2, byrow=TRUE) > m [,1] [,2] [1,] 80 50 [2,] 81 51 [3,] 82 52 [4,] 83 53 Another way to accomplish exactly the same thing as we have done above is to simply apply the dim attribute to our vector. Note however that doing it this we way are restricted to fill-by-column! > data <- c(80, 81, 82, 83, 50, 51, 52, 53) > data [1] 80 81 82 83 50 51 52 53 > dim(data) = c(4, 2) > data [,1] [,2] [1,] 80 50 [2,] 81 51 [3,] 82 52 [4,] 83 53 Matrix Subsetting Use matrix[rowIdxs, colIdxs]. If either index ommited (must still include the comma) then all of that index is returned. The defualt for single matrix element is to return it as a vector. To stop this use drop=FALSE. Same issue for subsetting a single row or column. x <- matrix... x[1,2] ##< returns vector x[1,2, ##< drop=FALSE] returns a 1x1 matrix Getting Matrix Info To get the shape of a matrix, as we have seen, we can use dim() which returns a tuple (num rows, num cols). To get just the number of rows use nrow(). To get just the number of columns use ncol. Combining Matricies Use cbind() or rbind(). Maths With Matricies "Normal " Uses Broadcasting: It's Not Matrix Multiplication! Much like most other vectorised languages like Yorick or Python's NumPy, R supports broadcasting. This means we can do things like multiply a matrix (or indeed a vector) by a scalar and the result is the multiplication applied element-wise: > data <- c(80, 81, 82, 83, 50, 51, 52, 53) > data * 10 [,1] [,2] [1,] 800 500 [2,] 810 510 [3,] 820 520 [4,] 830 530 You can also multiply a matrix by a vector and the broadcasting will will work in the same element-wise fashion down the columns of the vector. The vector you are multiplying doesn't even have to have the same length as the column. As long as the column length is a multiple of the vectgor, R will continually "reuse" the vector: # Here the vector has the same length as the matrix column. > data * c(10,1,100,1000) [,1] [,2] [1,] 800 500 [2,] 81 51 [3,] 8200 5200 [4,] 83000 53000 # The vector is shorer than the column length, so R reuses the vector # essentally multiplying by c(10, 1, 10, 1)... > data * c(10,1) [,1] [,2] [1,] 800 500 [2,] 81 51 [3,] 820 520 [4,] 83 53 We can also multiply a matrix by another matrix. But beware, the standard multiply symbol, *, does NOT do matrix multiplication as we see here: > m < rep(10, 8) > dim(m) = c(4,2) > m [,1] [,2] [1,] 10 10 [2,] 10 10 [3,] 10 10 [4,] 10 10 > data * m [,1] [,2] [1,] 800 500 [2,] 810 510 [3,] 820 520 [4,] 830 530 Propper Matrix Multiplication!To do an actual matrix multiplication in R you must use the %*%operator. Factors What are they? Factors represent catagorical data. This is data that can only be one of a set of values. For, example, the sex of a test subject can only be male or female. They're kinda like a C enum type where each category has an associated integer value that is unique to that category's label. A factor has "levels". Each level is just one of the enum labels. So, for example, if we had a list of participant genders and converted it to a factor variable we would see the following: > x <- factor(c("male", "male", "female", "male", "female", "female")) > x [1] male male female male female female Levels: female male We see that x is a list of gender labels, but has only 2 "levels", namely "male" and "female". We can count the number of occurences of each level using the table() function as follows: > table(x) x female male 3 3 You can set the order of levels in a factor as well. Sometimes this is useful when plotting. You can also reorder factors if you need to. > x <- factor(c("male", "male", "female", "male", "female", "female"), levels=c("male", "female")) > x [1] male male female male female female Levels: male female ## ^^ ## Note, how compared to prev example, the order of the levels is changed Creating Factor Variables ## Create from a list of strings > x <- factor(c("male", "male", "female", "male", "female", "female")) > x [1] male male female male female female Levels: female male ## Assign levels to lists > factor(c(TRUE, FALSE, TRUE), labels=c("label1", "label2")) [1] label2 label1 label2 Levels: label1 label2 ## Generate Factor Levels Using gl(num-levels, num-reps, ...) > gl(2, 5) [1] 1 1 1 1 1 2 2 2 2 2 Levels: 1 2 > gl(2, 5, labels=c("jeh", "tech")) [1] jeh jeh jeh jeh jeh tech tech tech tech tech Levels: jeh tech Ordered factors Ordered factors are factors but with an inherent ordering or rank: used for ordinal data. From the R help files: Ordered factors differ from factors only in their class, but methods and the model-fitting functions treat the two classes quite differently. What it is saying is that these functions will operate on and present the data in the order that is specified by the ordered factor. For example, let's create a dummy little factor set: > ordered(1:5) [1] 1 2 3 4 5 Levels: 1 < 2 < 3 < 4 < 5 # NOTICE THE "<" characters: # These show the ordering of the factor. The same effect can be produced using factor(1:5, ordered=TRUE). Interactions The "interaction" of two or more factors is basically their cartesian product. Use the interaction() function to create these interations. Missing Values Sadly most data sets contain a lot of missing data. In R missing values are generally represented by NA or NaN. Whilst both can represent missing data there are some subtle differences: NA is a constant which is a missing value indicator. NA values can have a class (i.e., be integer, char etc). NA is not the same as NaN. > is.na(NA) [1] TRUE > is.nan(NA) [1] FALSE NA Note that comparing against NA, e.g, vector_var == NA will just give you a vector of NAs not booleans! This is because NA is not really a value, but just a placeholder for a quantity that is not available. This also means that something like x[!is.na(x) & x > 0] != x[x > 0] because if x contains NAs x[x > 0] will return a list containing the NAs as well as those values greater than zero. This is because NA is not a value, but rather a placeholder for an unknown quantity and the expression NA > 0 evaluates to NA. NaN NaN means "Not a Number" NaN are also NA but do not have a class: > is.na(NA) > is.na(NaN) [1] TRUE > is.nan(NaN) [1] TRUE Tabular Data: Data Frames The trouble with a matrix is that all the data must be of the same type and most of the time one will be dealing with tables of results where the columns have very different types. Data frames to the rescue. The are like tables where each column can have its own type. On a technical level, a data frame is a list, with the components of that list being equal-length vectors [2]. Create A Data Frame A Dataframe can be created manually using the data.frame constructor although normally they are created by reading in data from a data source such as a file (for instance, read.table() or read.csv()). By default strings are converted to factors. This can behaviour can be changed using stringsAsFactors=FALSE. Manual Creation To create a dataframe manually use the data.frame constructor. Pass in many lists, all of the same length but possibly different types, each of which will become a column in the table with the given name. The table columns will be created in the order specified in the constructor arguments... > x <- data.frame(jeh = c("j", "e", "h"), tech = c(1,2,3)) > x jeh tech 1 j 1 2 e 2 3 h 3 One thing that is interesting to note is that the values in column "jeh" have been cooerced into factors, which is apparent if you use str(x) as shown in the next section. To override this default behaviour you can set stringsAsFactors = FALSE int he constructor. As mentioned, a data fram is a list of lists-of-equal-length. You can revert from a dataframe back to a list of lists using as.list(df). It will convert the datafame to a list of named vectors... > as.list(x) $jeh [1] j e h Levels: e h j $tech [1] 1 2 3 Reading In Tabular Data One thing to note: For large datasets estimate amount of RAM needed to store dataset before reading it in. The reason being that R will read your entire dataset into RAM. It does not support (at least without special packages) dataframes that can reside on disk. Use object.size(df) to get the size of a dataframe in memory. For pretty-print the results use print(object.size(df), units="Mb"). read.table(file, header, sep, colClasses, nrows, comment.char, skip, stringsAsFactors) ## header - is the first line a header or just start of data ## sep - column delimeter ## colClasses - vector of classes to say what class of each col is Not required but specifying this can increase speed of operation. data <- read.table("filename.txt") ## will auto figure out column classes, sep etc etc, auto skips ## lines with comment symbol etc etc. read.csv is identical to read.table except default seperator is comma (,) Information Above Your Data Frame ncol(df) gives number of columns. nrow(df) gives number of rows. names(df) gives names of each column. colnames(df) to retrieve or set column names. rownames(df) to retrieve or set row names. head(df, n=...) tail(df, n=...) summary(df) gives some info for every variable. For example, looking at the dummy table created above gives: > summary(x) jeh tech e:1 Min. :1.0 h:1 1st Qu.:1.5 j:1 Median :2.0 Mean :2.0 3rd Qu.:2.5 Max. :3.0 str(df) compactly displays the internal structure of an R object. > str(x) 'data.frame': 3 obs. of 2 variables: $ jeh : Factor w/ 3 levels "e","h","j": 3 1 2 $ tech: num 1 2 3 quantile(df$col, na.rm=T/F) looks at quantiles. Can pass probs=c(1,2,3) for different percentiles. table(df$col) to make a table summarising the column by grouping occurences. Can pass two variables to make it 2D table. as.list(df) will convert the datafame to a list of named vectors. To get a list of column types use the following: > coltypes <- as.character(lapply(x, class)) > coltypes [1] "factor" "numeric" ... or equivalently ... coltypes <- sapply(x, class) Indexing Your Data Frame As previosly said, ... a data frame is a list, with the components of that list being equal-length vectors [2]. I.e., each column is a list. Therefore the list-accessing operators will work here: Subsetting Columns > x <- data.frame(jeh = c("j", "e", "h"), tech = c(1,2,3)) > ## Get a single column using numeric index > ## Because x is a list of lists the [[...]] operator returns a list > x[[1]] [1] j e h > ## Get a single column using its name > ## This will also return a list > x$jeh [1] j e h > ## Get a single column as a dataframe > ## Because the single '[' returns a list of the contents it essentially > ## returns a list of lists which R is clever enough to know as a data > ## frame > x[1] jeh 1 j 2 e 3 h > ## Because x is a list we can use all list indexing ops like > ## fancy indexing > x[c(1,2)] jeh tech 1 j 1 2 e 2 3 h 3 > ## Or boolean indexing > x[c(FALSE, TRUE)] tech 1 1 2 2 3 3 > ## Or use ranges > x[1:2] jeh tech 1 j 1 2 e 2 3 h 3 Note that in the above examples for fancy and boolean indexing we had to enclose the indexers with c(...). This has to be done, otherwise R will think you are trying to index multi-dimensions! Subsetting Rows To subset the rows of a dataframe use a 2D index of the form [row, col]. Each index specifier can be any of the list indexers like ranges, fancy indices, boolean arrays etc. For example, x[condition1 & condition2,] (note the trailing comma) would only select certain rows and all columns. To get indices of selected elements rather than boolean arrays, use which(). It also auto removes all NAs. Subset returns a list or dataframe... When the subset returns a portion of one single column the result returned is generally a list: > x[1:2, 1] [1] j e Levels: e h j It might be your want it returned as a dataframe. If so specify drop=FALSE as a kind-of 3rd dimension... > x[1:2, 1, drop=FALSE] jeh 1 j 2 e Check for and filter out missing values You can find missing values using the following methods... > ### Using is.na() > sum(is.na(df$col)) ## == 0 when no NAs > any(is.na(df$col)) ## == FALSE when no NAs > all(colSums(is.na(df)) == 0) ## == FALSE when no NAs for entire df You can also use is.na() to filter out NAs in a list or dataframe column: > bad <- is.na(a_list) a_list[!bad] But, to filter out all dataframe rows where any column has an NA value, use the following... > ## Rows where NO column has an NA - complete.cases() > y <- rbind(x, c(NA, 4)) > y jeh tech 1 j 1 2 e 2 3 h 3 4 NA 4 ## << Note the NA here > good <- complete.cases(y) y[good,] jeh tech 1 j 1 2 e 2 3 h 3 Splitting a data frame The function split() divides the data in a list or vector into groups identified by a factor. Given that a Data Frame is just a list of lists, we can use split() to divide up the table into many sub-tables (like "groups"). Often this is the first stage in a split-apply-combine problem. A really noddy example... f = factor(rep(c("A", "B", "C"), each=3)) > f [1] A A A B B B C C C Levels: A B C > x = data.frame(a = 1:9, b = f) > x a b 1 1 A 2 2 A 3 3 A 4 4 B 5 5 B 6 6 B 7 7 C 8 8 C 9 9 C > split(x, x$c) $A a b 1 1 A 2 2 A 3 3 A $B a b 4 4 B 5 5 B 6 6 B $C a b 7 7 C 8 8 C 9 9 C The rather crummy example above shows how split() has essentially divided up the data frame into groups defined by the column 'b'. To reduce typing a little and increase the readability, when the data frame and column names are long you can use with() to replace "split(df, df$col)" with "with(df, split(col))". Be careful when thinking of split() as doing a group-by, however, because it is not doing this... it is doing a more naive split of the data as we can observe if we modify the call to split() in the above example: > split(x, factor(c("X", "Y", "Z"))) $X a b 1 1 A 4 4 B 7 7 C $Y a b 2 2 A 5 5 B 8 8 C $Z a b 3 3 A 6 6 B 9 9 C We can see this visually in the following diagram which demonstrates how split is working and also how it will recycle the factor by which it is using to split on... So, as you can see, it is not really a grouping operating. It is really just flinging each ith row into a bucket with the name of the corresponding ith factor variable, and if there are not enough factor variables then they are recycled. That is why it is only acting like a group-by when we pass in a data frame and a row of the data frame as the factor to split on. Okay, great, but what's the use in this. Well usually we would, instead of splitting a data frame in its entirity, we would split a column we are interesting in calculating some statistics over based on a grouping re another column. In the above example, we might want to find the mean of the column "a" for each of the groups "A", "B" and "C". We would use the following: > with(x, lapply(split(a, c), mean)) $A [1] 2 $B [1] 5 $C [1] 8 The rest of the notes Find some training data at.. DATA FRAMES ----------- x[row, col] with indices or actual names or slices or boolean conditions eg x[condition1 & condition2,] -- select only certain rows which() returns indices and doesnt return the NAs sort(x$colname, decreasing=TRUE/FALSE, na.last=TRUE) x[order(x$colname1, x$colname2, ...),] - order rows so column(s) in order plyr package for ordering arrange(dataframe, colname) -asc order arrange(dataframe, desc(colname)) - same with decreasing order add row/col ----------- df$new_col <- ... vector or use cbind() command - column bind or library(plyr) mutate(df, newvar=...) - adds new col and returns new datafame copy. TODO: Cross tabs (xtabs) TEXTUAL FORMATS --------------- dump() and dput() saves metadata like column class. still textual so readable but meta data included textual data works better in version control software but not space efficient y <-data.frame(...) dput(y) prints to screen dput(y, "filename.R") saves to file y2 <- dget("filename.R") loads DF back into Y2 Looks like little bit like object pickling in Python dget() can only be used on a SINGLE R object. dump() can be used on multiple objects, which can then be read back using a single source() command eg. x <- ... y <- ... dump(c("x", "y"), file="...") // pass NAMES of objects in rm(x, y) source("...") // restores x and y CONNECTIONS TO THE OUTSIDE WORLD -------------------------------- file gzfile (gzip) bzfile (bzip2) url (webpage) above function open connectsion to a file or a web page con <-file("foo.txt", "r") data <- read.csv(con) close(con) same as data <- read.csv("foo.txt") con <- url("http://....") x <- readLines(con) // x will be a character vector holding page source DATES & TIMES -------------- Dates - Date class Stored internally as days since 1-1-1970 Times - POSIXct or POSIXlt class Stored internallay as seconds since 1-1-1970 POSIXct just a large integer POSIXlt is a list storing day, week, day of year, month, etc etc Convert strings to dates using as.Date() x <- as.Date("1970-01-02") unclass(x) == 1 Generic functions: weekdays() - Give day of the week months() - Gives month name quarters() - Gives "Q1", "Q2" ... x <- Sys.time() p <- as.POSIXlt(x) p$sec == ..seconds.. strptime() converts dates to an object eg datestring <- c("January 10, 2013, 10:30") x <- strptime(datestring, "%B %d, %Y %H:%M") x will be a POSIXlt object ?strptime for help on function Normal +,-,<,> etc work on dates The operators keep track of leap years, leap seconds, daylight savings and timezones for us automatically :) LOOP FUNCTIONS -------------- All implement the Split-Apply-Combine strategy: SPLIT into smaller pieces, APPLY a function to each piece, COMBINE the results. lapply() - loop over list and eval func for each element. looping done in C split() - splits objects into sub-pieces lappy(list, function_name, ) returns result for every object in the list as a list in the same order. 'function_name' is applies to each element of the list and the return value used for that element in the new list. The arguments will be passed to your function_name(). lappply() generally uses ANONYMOUS FUNCTIONS. lapply(x, function(params){...}) sapply() - simplifies result of lapply(). Each list might go to vector if every element has length one. If cant figure out the simplification a list is returned. apply(X, margin, fun,...) margin is an int vector indicating which margins should be retained fun is func to be applied passed to 'fun' the margin refers to the DIMENSION number being used. For a matrix 1 is rows 2 is columns. So. apply(x,2,mean) would apply mean() to columns of matrix. For row/col sums/means use more highly optimized functions for SPEED rowSums = apply(x,1,sum) colSums = apply(x,2,sum) can keep two dims using appy(x, c(1,2,...), ) for multi dim arrays or use rowMeans(..., dim=x) mapply(fun, , MoreArge=NULL, SIMPLIFY=TRUE, USE.NAMES=TRUE) Applies a func in parallel over a set of different arguments. Eg two lists where element x in list_1 is param of 'fun' and element x in list_2 is second param. this is what mapply helps you do. Use to VECTORIZE FUNCTIONS that normally act on scalars. tapply(x, index, fun, ...) - apply a function over subsets of a vector. index is a factor or a list of factors which identifies which group each element of the numeric vector is in. e.g. x <- c(rnorm(10), runif(10), rnorm(10,1)) f <- gl(3,10) // creates a factor variable, each one repeated 10 times == 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 levels: 1 2 3 tapply(x, f, mean) 1 2 3 0.114 0.516 1.246 if you dont simply the result you get back a list You can subset a matrix to do the equivalent of an SQL GROUP BY: with(df, tapply(col1, col2, mean)) This will group by col1 and take the mean of col2 using that grouping. split(x, f, drop = false, ) like tapply() it splits x into groups where f identified which group each element of x is in. common to split() something then apply a function over the groups: lapply(splot(x,f), mean) for example split() can be used on complex data structures like dataframes. e.g. s <- split(dataframe, dataframe$col_name) lapply(s, function(x) snip ) tip: use sapply(... na.rm=TRUE) To split on more than one level, combine factors using interaction(): x <- rnorm(10) f1 <-gl(2,5) # 1 1 1 1 1 2 2 2 2 2, levels 1 2 f2 <-gl(5,2) # 1 1 2 2 3 3 4 4 5 5, levels 1 2 3 4 5 interaction(f1,f2) #10 levels 1.1 2.1 1.2 2.2 1.3 2.3 1.4 .. 2.5 > f1 <-gl(2,5) # 1 1 1 1 1 2 2 2 2 2, levels 1 2 > f1 [1] 1 1 1 1 1 2 2 2 2 2 Levels: 1 2 > f2 <-gl(5,2) > f2 [1] 1 1 2 2 3 3 4 4 5 5 Levels: 1 2 3 4 5 > interaction(f1,f2) 1 1 1 1 1 2 2 2 2 2 . . . . . . . . . . 1 1 2 2 3 3 4 4 5 5 | | \/ [1] 1.1 1.1 1.2 1.2 1.3 2.3 2.4 2.4 2.5 2.5 Levels: 1.1 2.1 1.2 2.2 1.3 2.3 1.4 2.4 1.5 2.5 NOTE: Although it says there are all those levels it appears it uses the returned array, not the levels themselves which is why it returns missing values for some levels so it has all the levels but not all are used. split(x, list(f1,f2), drop=TRUE) $'1.1' [1] 2.0781323 0.7863726 $'1.2' [1] -0.7285167 0.1410324 $'1.3' [1] 0.643741 $'2.3' [1] -0.7616546 $'2.4' [1] -0.4612373 -0.6063274 $'2.5' [1] 0.0106792 -0.5811911 split(drop = TRUE) to drop empty levels Some useful functions ---------------------- range() returns the minimum an maximum of its argument unqiue() returns vector with all duplicates removed grep, grepl, regexpr, gregexpr and regexec search for matches to argument pattern within each element of a character vector DEBUGGING --------- Return something invisibly: return the value but dont print it use invisible(x). 5 basic functions traceback() prints function call stack debug() flags function for debug mode which lets you step through eg debug(func) func() Then drops into browser "n" to step through to next instruction browser() suspends execution wherever it is called and puts func into debug mode trace() allos insert debugging code into function at specific places recover() allows modification of the error behabiour so you can browse the function call stack options(error = recover) R Profiling ----------- Figure out why things are taking time and suggest strategies for fixing. Systematic way to examine how much time is being spent in various parts of your program. system.time() ------------- Takes R expression (can be in curley braces) an returns time taken to do the expression in seconds. Returns proc_time user time - CPU time elapsed time - "wall clock" time There are multi-threaded BLAS libaries (ATLAS, ACML, MKL) Parallel package for parallel processing "user time" is the CPU time charged for the execution of user instructions of the calling process. The "system time" is the CPU time charged for execution by the system on behalf of the calling process.Rprof() -------- R must be compiled with profiler support. Rprof() starts the profiler DO NOT USE system.time() with Rprof() summaryRprof() to summarise Rprof() output by.total - divide time spent in each function by total time by.self - divide time spend in each function minus time spent in functions above by total time. Rprof() tacks FUNCTION CALL STACK at regularly sampled intervals Generate (pseudo) random numbers --------------------------------- - rnorn() random normal with mean and stddev - dnorm() evaluates standard normal prob density funct at point or vector of points - pnorm() eval cumulative distribution function for normal distribution - rpois() generate random Poisson with a given rate - rbinom() uses binomial distribution d for density r for random number gen p for cummulative distribution q for quantile function Important: use set.seed(<seed>) this resets the sequence that will occur. Random sampling ---------------- THe sample() function draws randomly from a specified set of (scalar) objects allowing you to sample from arbitrary distributions. set.seed(...) sample(1:10, 4) # without sample replacement sample(1:10, 4, replace=TRUE) # with sample replacement # (so can get repeats) READ DATA FROM WEB (HTTPS) ------------------------- library(RCurl) url <- "" data <- getURL(url, ssl.verifypeer=0L, followlocation=1L) writeLines(data,'temp.csv') get binary data using getBinaryURL(...) and the following: tf <- tempfile() writeBin(con=tf, content) READ DATA FROM EXCEL -------------------- library("xlsx") dat <- read.xlsx(fname, startRow=18, endRow=23, colIndex=7:15) XML into R --------------- library(XML) doc <- xmlTreeParse(url, useInternal=TRUE) there is also htmlTreeParse for HTML files! rootNode <- xmlRoot(doc) xmlName(rootNode) xmlName() - element name (w/w.o. namespace prefix) xmlNamespace() xmlAttrs() - all attributes xmlGetAttr() - particular value xmlValue() - get text content. xmlChildren(), node[[ i ]], node [[ "el-name" ]] xmlSApply() xmlNamespaceDefinitions() xmlSApply(node, function-to-apply) - recursive by default or xpathSApply(node, xpath-expression, function-to-apply) XPath language /node - top-level node //node - node at any level node[@attr-name] - node that has an attribute named "attr-name" node[@attr-name='xxx'] - node that has attribute named attr-name with value 'xxx' node/@x - value of attribute x in node with such attr. FAST TABLES IN R ----------------- data.table Is a child of data.frame but is much FASTER. Has a different syntax Create in exactly same way is data.frame tables() - all data.tables in memory Subsetting with only one index subsets with ROWS Subsetting columns very different. EXPRESSIONS Uses expressions: satements between curley brackets {} e.g. dt[, new_col := {some expressions...} LISTS Or use a list of functions to apply to columns: e.g. dt[, list(mean(x), sum(z))] ADD NEW COL (very efficiently) with := syntax dt[,w:=col-name] Adds inplace Data tables copied BY REFERENCE so be careful of aliases! Create copied explicitly using copy() function Grouping using 'by=' syntax. Special variable .N to count group eg. dt[, .N, by=...] Keys for fast indexing. joins, merges, subsetting, grouping e.g. setkey(dt, col-name) Apparently even faster is MYSQL ----- dbCon <- dbConnect(MYSQL(), user="...", host="...", db="...") allTabls <- dbListTables(dbCon) result <- dbGetQuery(dbCon, "SQL QUERY STRING") dbListFields(dbCon, "TABLE NAME") - lists field names in table dbReadTable(dbCon, "TABLE NAME") - reads the ENTIRE table (caution - size!!) To select a subset: query <- dbSendQuery(dbCon, "SQL STR") - doesn't get the data x <- fetch(query, n=number-of-rows) - this gets the data dbClearResult(query) - must be done after a query! dbDisconnect(dbCon) - must be closed!!!! see on.exit() function for safety HDF5 ---- source("") biocLite("rhdf5") library(hdf5) f = h5createFile("...") g = h5createGroup("file-name", "group-name") h5ls("file-name") - dump out file info Write data: A = matrix(1:10, nr=5, nc=2) h5write(A, "filename", "group/path/to/var/spec") will automatically write meta data for you too attr(A, "somejunk") <- "a value" See bioconductor notes FROM WEB -------- con = url("...") htmlCode = readLines(con) close(con) htmlCode is just the raw code as one blob. Alternative use htmlTreeParse() and xpathSApply() etc creating new variables ======================= create sequence ---------------- s1 <- seq(min-val, max-val, by=incr-value) s1 <- seq(min-val, max-val, length=) - has length values s1 <- seq(along = x) vector of indices for x create binary vars -------------------- x <- ifelse(df$col <op> cond, TRUE, FALSE) create categories ----------------- apply to quantative variables x <- cut(df$col, breaks=....) The breaks specifies the boundaries for the groups eg cut(df$col1, breaks=quantile(df$col2)) or use library(Hmisc) cut2(df$col, g=4) - shortcut for quantiles reshape data ============== USE THE reshape2 library library(reshape2) tidy data 1. every variable its own col 2. every observation its own row 3. each table/file to store data about only one kind of observation melt a dataframe ----------------- melt(df, id=c(...), measure.vars=c(...)) create a new df. variables in id list are repeated for each variable in measure.vars so that rather than being wide the df becomes thin with a row for each variable with ids acting like the index or identifier. Thus is there are 2 items in measure.vars there will be 2 occurances of the identifiers in id list. cast data frame ---------------- using dcast() to summarise a dataset - - - - - - - - - - - - - - - - - - - dcast(df, col-to-group-by ~ col-to-summarise) will take col-to-group-by and produce a row for each unique value in that set. then it groups by those values and applies, by default, a count to see how many instance of col-to-summarise belong to that group. if you dont want to count, you can apply any aggregation operation dcast(df, col-to-group-by ~ col-to-summarise, mean) split-apply-combine problems ------------------------------ Notes on this article: Further note by Hadley Wickham list_by_group <- with(df, split(col-to-count, col-to-group-by)) aggr_by_group <- sapply(list_by_group, aggregation-function) e.g. aggregation-function could be mean() This can be summarised in one command in these different ways: 1. with(df, tapply(col-to-count, col-to-group, agrregate-function)) The tapply() function does an inherent group by operation for you 2. with(df, by(col-to-count, col-to-group, agrregate-function)) 3. aggregate(col-to-count ~ col-to-group, df, agrregate-function) dplyr package =============== library(dplyr) Basic verbs used by package: select - returns a subset of columns of df filter - extract subset of rows arrange - reorder rows rename - rename a column mutate - add new variables or columns. transform existing group_by - pipeline - use %>% to pipe output to next func. then funcs won't need the df argument, they get it from the pipeline join - faster but less fully featured than merge(). this can only merge on common names, you can spec the cols! join_all - join multple df's. Takes list as argument summarise - Format generally: new_df<- dplyr-func(df, what-to-do-with-df) select ------ Can use column names in ranges rather than just indices select(df, col-name1:col-name2) - select all columns in this range select(df, (-col-name1:col-name2)) - select all columns EXCEPT those in this range filter ------- filter(df, col <op> cond) arrange ------- df <- arrange(df, col-name) - order dataset by this column, asc order df <- arrange(df, desc(col-name)) - order dataset by this column, desc order rename ------ df <- rename(df, col-name-new=col-name-old, ...) - renames those cols, leaves others as is mutate ------ transform existing vars or create new ones df <- mutate(df, new.col=....) - adds a new column eg df <- mutate(df, new.col=old.col - mean(old.col)) - adds a new column group_by --------- grouped_df <- group_by(df, colname) summarise(grouped_df, label1=func(col-name), ....) merging data ============= By default merges by columns with common name. Use by.x, by.y to tell it which cols by.x is the first df by.y is the secon df use "all=TRUE" for an outer join merge(df_x, df_y, by.x=, by.y=, all=) can also use join in plyr package Misc ---- remove the original data frame from your workspace with rm("variable-name") packageVersion("package name") to get the package version Manipulating Data with dplyr ---------------------------- FIRST, you must load the data into a 'data frame table' data_df_tbl < tbl_df(data_df) dplyr supplies five 'verbs' that cover most fundamental data manipulation tasks: select(), filter(), arrange(), mutate(), and summarize(). dplyr also doesn't print all teh data. to see it all use View() (best done in R Studio) select(data_df_tbl, colname1, colname2,...) works on COLUMNS returns a new df_tbl with only the cols named in the order specified given this ordering, select can then allow us to use the range operator ":" with column names rather than indices. e.g. select(data_df_tbl, colname4:colname6) the order can be reversed as in colname6:colname4 too. to specify column to dump rather than keep use a minus "-". eg. select(data_df_tbl, -colname1) gives all columns except colname1 eg. select(data_df_tbl, -(colname1:cn3)) gives all columns except those in the range specified note the range must be enclosed in brackets to negate the entire range (rather than just the start element) Special select functions (from helpfile): -. filter(data_df_tbl, boolean-vector-selecting-rows, boolean-vector... ) works on ROWS (the bool vectors are ANDed. To OR use "|" not "," ) eg. to select rows where a column value is not NA use: filter(data_df_tbl, !is.na(col-name)) arrange() orders the ROWS of a dataset according to a particular variable. eg to order ascending arrange(data_df_tbl, colname) eg to order descending arrange(data_df_tbl, desc(colname)) Can arrange based on multiple variables, sort my left most first, then next continuing right. mutate() Creates a new variable based on the value of one or more variables already in a dataset. eg. mutate(data_df_tbl, col_new = someFunc(col_existing)) Can also use values created in col_new's to the left, in col_new's to the right eg. mutate(data_df_tbl, col_new = someFunc(col_existing), col_new2 = col_new * 0.25) summarize() collapses the dataset to a single row, especially when data is grouped eg summarise(data_df_tbl, some-summary=func(col-name)) most useful with the group_by() verb group_by() When using summarize() on a table that has been group_by()'ed it will return the summary functions for EACH group rather than just one value :) merge() By default merges by columns with common name. Use by.x, by.y to tell it which cols by.x is the first df by.y is the secon df use "all=TRUE" for an outer join merge(df_x, df_y, by.x="col1", by.y="col2", all=) ^ Note col names are in quotes otherwise you get Error in fix.by(by.x, x) : object 'col1' not found Some special functions: - n() The number of observations in the current group. (ie. num rows) This function is implemented special for each data source and can only be used from within summarise, mutate and filter. - n_distinct() Efficiently count the number of unique values in a vector Faster and more concise equivalent of length(unique(x)) quantiles ---------- | We need to know the value of 'count' that splits the data into the top 1% and bottom 99% of packages based on total downloads. In statistics, this is called the | 0.99, or 99%, sample quantile. Use quantile(pack_sum$count, probs = 0.99) to determine this number. > quantile(pack_sum$count, probs = 0.99) tidying data with tydr ----------------------- library(tidyr) gather() Use gather() when you notice that you have columns that are not variables Looking at the example from the help file > # From > stocks < data.frame( + time = as.Date('2009-01-01') + 0:9, + X = rnorm(10, 0, 1), + Y = rnorm(10, 0, 2), + Z = rnorm(10, 0, 4) + ) > head(stocks) time X Y Z 1 2009-01-01 0.3269115 0.7445885 6.257515 2 2009-01-02 -1.5729436 -3.3722382 2.050222 3 2009-01-03 -0.5257739 -1.2664309 -5.498621 4 2009-01-04 -1.4181633 -0.2352554 2.338179 5 2009-01-05 -0.6081603 -2.1707088 2.099759 6 2009-01-06 0.8347829 2.5455941 9.737100 > x = gather(stocks, stock, price, -time) > head(x) time stock price 1 2009-01-01 X 0.3269115 2 2009-01-02 X -1.5729436 3 2009-01-03 X -0.5257739 4 2009-01-04 X -1.4181633 5 2009-01-05 X -0.6081603 6 2009-01-06 X 0.8347829 What have we done here? In our original data set we had 3 columns. Each represented the price of a stock. We want to have one column for the stock type and one column for the price of that stock. Why do we want this? This is one of the principles of "tidy data". (see). Really what we are discussing is type-of-stock and price-of-stock at a time. Therefore there are 3 variables and each column should be a variable. As it stands the dataset columns represent the type-of-stock variable split over many columns. This isn't always a bad thing, as the article discusses, but it can be tidied to just have the variables as columns: time, stock and price. This is called "melting" the dataset. So... gather(stocks, stock, price, -time) The data argument, stocks, is the name of the original dataset. The key/value arguments, stock and price, give the column names for our new tidy dataset. Stock is the key, because it specifies all the column names, X, Y, and Z are to be collected under this new variable... they become like keys in a DB table. The value argument is the values of these columns that will be matched to the key. -time excludes time from the melt, because it is already a variable separate() separate one column into multiple columns spread() Spread a key-value pair across multiple columns. extract_numeric() Easy way to just get the numbers out of a string. eg if you have a numerical identified with a common textual prefix. STANDARD FILE DOWNLOAD STUFF ---------------------------- if(!file.exists(your-dir-name)) { dir.create(your-dir-name) } url < "https://....." download.file(url, destfile=your-file-name, method="curl") data < read.csv(your-file-name) On windows, however, I seem to need to do this library(Rcurl) if(!file.exists(your-dir-name)) { dir.create(your-dir-name) } url < "https://....." writeLines(getURL(url, ssl.verifypeer=0L, followlocation=1L), your-file-name) data < read.csv(your-file-name) EDITING TEXT VARIABLES ---------------------- tolower() - returns all lowercase toupper() - returns all uppercase strsplit(string, seperator). Remember to escape a character you need double backslash. eg. "\\." sub(str-to-search-for, replacement-str, string) - replace first instance only gsub() - replace all instances grep(regexp, str, value=T/F) - returns indices grepl() - returns boolean mask vector library(stringr) nchar(str) - number of chacacters substr(str, start-index, end-index). Indices from 1 and are inclusive paste(str1, str2, sep=" ") str_trim() - trim off spaces at start or end. Names of variables * All lower case when possible * Descriptive as possible * Not duplicated * Not have underscores, dots or whitespace Working with dates ------------------- date() - returns string od date and time Sys.Date() - returns a Date object. Can reformat using format() Date objects can be subtracted, added etc format(Sys.Date(), "format-string") where format-string is like a prinf expression with these special placeholders %d = day as number (0-31) %a = abbreviated week day name %A = full week day name %m = month number (two digits) %b = abbreviated month %B = unabbreviated month %y = 2 digit year %Y = 4 digit year as.Date(char-vector, format-string) turns character vectors into dates weekdays(date-obj) returns the week day as a string months(date-obj) returns the logn month name as a string julian(date-obj) returns number of days since epoch (1st Jan 1970) library(lubridate) Easy date manipulation Instead of as.Date(..., "format") you can use... ymd(...) which will search for year, month, day in *all* feasible formats mdy(...) will search for month, day, year in *all* feasible formats ymd_hms(...) date and time and so on... The functions also accept the timezone using the tz argument to the functions. wday(..., label=TRUE) == weekdays() in lubridate data resources --------------- - united nations- uk office for national statistics - european data on EU - usa gov <--- look here - uk data site - help on usa surverys Plotting in R ==================================================================== boxplot(df$col, col="blue", breaks=100) breaks is the number of bars (or buckets) hist(df$col, col="green") rug(df$col) - puts a "rug" under the histogram abline(h=num) - draw a horizontal line abline(v=num, col="red", lwd=2) - draw a vertical line lwd is line width barplot() base plotting system - the oldest start with blank canvas and add things to it one by one plot(x,y) or hist(x) launches the graphics device plot() is generic... it can behave diff depending on the data passed to it. ?par for base graphipcs system parameters eg with(df, plot(col1, col2)) key plotting parms pch - the polotting symbol a number representing a symbol types. try example(points) on the command line lty - the line type lwd - line width as integer multuple col - colour xlab - the label for x axis ylab - the label for y axis legend par() used for GLOBAL graphics parameters: las - orientation of axis labels on plot bg - background coloour mar - margine size margine 1 is the bottom, then rotate CW for 2, 3, 4 oma - outer margin size mfrow - # plots per row, col (filled row wise) mfcol - # plots per row, col (filled col wise) base plotting functions plot() - scatter plot lines() - adds lines to a plot points() adds points to a plot text() add text labels to plot at specific x,y corrds title - add annotations to x, y axis labels, title, subtitle etc mtext - add arbirary text to margins axis - add axis ticks/labels multiple base plots: par(mfrow = c(rows, vols)) with(your-dataframe, { plot(some data in first plot) plot(plot some data in second plot) }) To setup plot without plotting anothing plot(x,y type="n") ^^^^ make a plot except for the data Then you can plot the data sets one by one. Launch screen device quartz() on mac windows() on windows x11() on linux ?Devices for list of devices available eg for pdf pdf(file = "...") ...plotting.... dev.off() ## Close the graphics device! Vector formats: pdf svg wim.metafile postscript Not so great with many individual points (file size) Resize well. Bitmaps: png. jpeg. lossy compression tiff. lossless compression Generally dont resize well good for many many points. Many devices -------------- Can only plot to the *active* device dev.cur() 0 returns graphics device num >=2 dev.set(<int>) change the active device dev.copy dev.copy2pdf - copy active plot to new plot E.g: ...plot... dev.copy(png, file = "filename.png") dev.off() hierachical clustering ======================= - what is close/ - how do we group things - How do we visualise the grouping - How do we interpret the grouping Agglomerative approach: - Find closest two things - requires knowing what "closest" means - continuous - euclidean sqrt( (x1-x2)^2 + (y1-y2)^2) - extends to hi D probs - Continuous - correlation similarity - Manhatten - total(x) + total(y) - Put them together - a "merge" - How do we merge? - What represents the new location - "average linkage" - ave of x and y coords - center of grav. - "complete linkage" - take furtherst two points of clusters as dist. - Repeat - A tree results shoing the ordering of how things were grouped. To simulate a simple 2D dataset:) distxy <- dist(df) # cacls dist between all different rows/cols combos in df. hCllust <- hclust(distxy) plot(hCllust) heatmap() for looking at matrix data - does a hierachical cluster of rows and cols of the matrix rows are like observations cols are like sets of observations organises the rows and columns of the table to visualise groups or blocks within the table k-means clustering =================== K-means is NOT deterministic. If you run multiple times but resulst vary to much the alg might not be stable w.r.t to your data! It is a partitioning approach - Define #groups you would - Get "centroids" for each cluster - Assigned to closests centroid - Recalc centroids and iterate) kmeansObj <- kmeans(df, centers = 3) par(mar = rep(0.2, 4)) plot(x, y, col = kmeansObj$cluster, pch=19, cex=2) points(kmeansObj$centers, col = 1:3, pch=3, cex=3, lwd=3) Lattice plotting system ========================= - Good for high density plots - package(lattice) - xyplot - scatter plots - bwplot - box plots - histogram - stripplot - dotplot - splom - scatter plot matrix. like pairs() in base plot - levelplot - image data - Everything (i.e. entire plot) is done in a single function call - lattice functions return calls called "trellis". this must be printed to the device to dislplay it on. Auto-prints for desktop display xyplot xplot(y ~ x | , data) y is the y data x is the x data condition vars (optional). they are factor variables and conditioning on them creates n graphs for each level of the condition var data is the dataframe eg library(datasets) library(lattice) airqual <- transform(airquality, Month=factor(Month)) xyplot(Ozone ~ Wind | Month, data = airqual, layoutc=c(5,1)) panel functions Each panel represents a subset of the data defined by the conditioning variable supplied xyplot(y ~ x | f, panel = function(x,y, ...) { panel.xyplot(x, y, ...) panel.abline(h=median(y), lty=2) }) By giving the panel function we specify how each panel is to be drawn. Each panel in this case does an xyplot, but also does a horizonal line at the data median. Note: data for each panel is different we're just saying what is to be done with the data on each panel. panel.lmline() for least regression line ggplot plotting system ======================= Grammar of Graphics by Leland Wilkinson Built on the grid graphics system. qplot() -------- Works like the plot() function of the base system data must always come from a dataframe factors are used to indicate *subsets* of the data eg qplot(x, y, data=dataframe) where x and y are column names in dataframe to highlight subgroups use qplot(x,y,data=df, color=z) where z is another column inthe dataframe to add smoother do qplot(x,y,data=df, geom=c("point", "smooth")) to do histogram qplot(x, data=df, fill=z) here fill is like color qplot(x, data=df, geom="density") for a desity smooth of hist to do panels you use facets qplot(x,y, data=df, facets=.~z) or qplot(x,y, data=df, facets=z~.) it is rows~cols and the "dot" means wildcard ggplot() --------- Plots built up in layers - plot data - overlay summary - add regressions etc Basic ggplot: g <- ggplot(dataframe, aes(x, y[, color=z])) ^^^ the aesthetics (cols to be plotted) So far there are no layers on the plot - nothing to specify how to draw the plot So we need to add this to the plot... p <- g + geom_point() ## adds "how to draw" information print(p) ## display (or use autoprinting) or use geom_line() Add a smoother g + geom_point() + geom_smooth(method="...") Add a facet grid g + geom_point + facet_grid(. ~ z) + .... ^^^^^^ works the same as qplot To annotate the plots use xlab(), ylab(), labs(), ggtitle() eg labs(title="...", x="...", y="...") theme() theme_gray(), theme_bw() some standard appearances Aesthetics options - color=... - size=... - alpha=.. The smoother. - size= - linetype= - method=.. - se=... Note: ylim() will FILTER the data to filter out things outside limits. To keep outliers use coord_cartesian(ylim=()) Categorise on continuos ver: To categorize continuous variables use CUT() function! Can use quantile() function to get some reasonable cut points
https://jehtech.com/R.html
CC-MAIN-2021-25
refinedweb
11,058
62.07
Library for working with Valve Pak files VPK is Valve’s file format for storing game assets. Pythonic access to VPK files and their contents together with a cli tool. Tested and works on python2.6, python2.7, python3.2+, pypy and pypy3. Install You can grab the latest release from or via pip pip install vpk Quick start The VPK instance is iterable in the standard ways and produces paths to files import vpk pak1 = vpk.open("/d/Steam/steamapps/common/dota 2 beta/dota/pak01_dir.vpk") for filepath in pak1: print filepath Reading a specifc file is done by passing the file path to get_file() method, which returns a VPKFile instance, which acts as a regular file instance. Writting is not possible. pakfile = pak1.get_file("scripts/emoticons.txt") pakfile = pak1["scripts/emoticons.txt"] print pakfile.read().decode('utf-16le') ------------------------------------------------- "emoticons" { // An ID of zero is invalid "1" { "image_name" "wink.png" "ms_per_frame" "100" ... Saving a file is just as easy. pakfile.save("./emoticons.txt") The module supports creating basic VPKs. Multi archive paks are not yet supported. newpak = vpk.new("./some/directory") newpak.save("file.vpk") pak = newpak.save_and_open("file.vpk") CLI tool A command line utility is also included usage: vpk [-h] [--version] [-l] [-la] [-x OUT_LOCATION] [-nd] [-t] [-c DIR] [-f WILDCARD | -re REGEX | -name WILDCARD] file Manage Valve Pak files optional arguments: -h, --help show this help message and exit --version show program's version number and exit Main: file Input VPK file -l, --list List file paths -la List file paths, crc, size -x OUT_LOCATION, --extract OUT_LOCATION Exctract files to directory -nd, --no-directories Don't create directries during extraction -t, --test Verify contents -c DIR, --create DIR Create VPK file from directory Filters: -f WILDCARD, --filter WILDCARD Wildcard filter for file paths -re REGEX, --regex REGEX Regular expression filter for file paths -name WILDCARD Filename wildcard filter Download Files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/vpk/
CC-MAIN-2017-47
refinedweb
334
54.93
I want to copy files securely from one computer to another, the other computer however isn't trusted and I don't have direct access to it other then giving the owner of the computer instructions. In addition to that this is a one-time only situation, so any cumbersome setup should be avoided. What would be the easiest and most portable way to do it? What I have in mind would be a program with the following workflow: The host with the files issues a hypothetical command to make the files available, protected with a password: file-offer -p PASSWORD file1 file2 file3 directory The other issuse a hypothetical command with the password to receive a file (a GUI to select files would be welcome as well): file-receive -p PASSWORD file2 The closest thing I have right now is this hack, which works but isn't very comfortable and would give Windows users some trouble: tar cf - [files]... | gpg -c --passphrase PASSWORD | nc -l -p 6666 nc host1 6666 | gpg --passphrase PASSWORD | tar xf - [files]... Some more notes: cp files /var/www/ GnuPG encryption! $ gpg -e mysecretfile You did not specify a user ID. (you may use "-r") Current recipients: Enter the user ID. End with an empty line: ben Current recipients: 2048g/52FFA1E 2009-01-02 "Bob McBlah <bob.mcblah@example.com>" Enter the user ID. End with an empty line: $ ls *.gpg mysecretfile.gpg The file mysecretfile.gpg is now encrypted, in a way such that only the person (Bob McBlah) can decrypt the file (asymmetric or public-key crypto). mysecretfile.gpg The file can safely be sent using any medium capable of sending a file (netcat, email, FTP, dropbox, mediafire.com etc etc), with practically no risk of interception. If you use the -a "ASCII armour" flag, the encrypted file (which would be named mysecretfile.asc) is plain ASCII text, which can be sent in any medium that can send ASCII text, so answers to any other "how can I send an x MB file" question would applicable.. -a mysecretfile.asc For a solution to your specific problem, perhaps a simple Python script could be written using the BaseHTTPServer module: import sys from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer thefile = None class MyHandler(BaseHTTPRequestHandler): def do_GET(self): global thefile try: if self.path == "/": f = open(thefile) self.send_response(200) self.send_header('Content-type', 'application/x-gpg') self.send_header('Content-disposition', 'filename="%s"' % thefile.replace("\"", "")) self.end_headers() self.wfile.write(f.read()) f.close() else: self.send_error(404, 'File not found: %s' % self.path) except IOError: self.send_error(404,'File Not Found: %s' % self.path) def main(): global thefile if len(sys.argv) == 2: thefile = sys.argv[1] else: print "Usage: %s [path to served file]" % sys.argv[0] sys.exit(1) try: server = HTTPServer(('', 8080), MyHandler()) print 'Started server on port 8080' server.serve_forever() except KeyboardInterrupt: print 'Keyboard abort, shutting down server' server.socket.close() if __name__ == '__main__': main() Save it as servefile.py and run as python servefile.py /path/to/my/file.gpg servefile.py python servefile.py /path/to/my/file.gpg The above code is not exactly great, but should be fine for one-off transfers. Is handing off a USB drive feasible? It might be too cumbersome, but it would solve the issue of connecting to a non-trusted computer. Also, it wouldn't be too difficult for users of any OS to pull the needed files with minimal instruction. If both computers are hooked up to the internet, maybe something like DropBox would be acceptable. If you're looking for a lightweight webserver this page at Wikipedia might help. SSH can use public / private key authentication. This allows you to give the "untrusted" computer your public key. And then you keep your private key secret and password protected and then you can login to the other machine. You can then scp the files as long as the user you ssh in has the appropriate permissions. And because you are using SSH all of the files are encrypted in transit. You could also set up a free account on Inbox.com. One of their services (besides email) is file storage up to 5 GB (also free). Just create an account that both of you can share, upload your files, and let the other person download them. Afterwards, forget about the account, change the password and keep it, or do whatever you want with it. By posting your answer, you agree to the privacy policy and terms of service. asked 4 years ago viewed 533 times active
http://superuser.com/questions/42089/how-to-copy-files-to-an-untrusted-computer/42097
CC-MAIN-2014-23
refinedweb
764
66.03
The Serial Peripheral Interface (SPI) Bus is a four wire master/slave full duplex synchronous bus. You can hook up multiple slave devices by utilizing chip select lines. The bus is composed of two data pins, one clock pin, and one chip select pin: It is not uncommon to use the bus with just one master and one slave, but it is certainly possible to use it as a real bus with many devices hanging off of it. The Blackfin processor typically has about 7 SPI chip selects. Please refer to the HRM for your processor variant to see exactly what resources are available. Each slave may operate at different clock frequencies as well as different clock polarities and clock phases with respect to the data. The permutations of polarities and phases are referred to as SPI modes. Below you can see the relationship between modes and the polarity/phase of the clock. For the Blackfin specific timing information, please see the diagrams in the next section. The figure below provides a block diagram of the SPI. The interface is essentially a shift register that serially transmits and receives data bits, one bit at a time at the SCLK rate, to and from other SPI devices. SPI data is transmitted and received at the same time through the use of a shift register. When an SPI transfer occurs, data is simultaneously transmitted (shifted serially out of the shift register) as new data is received (shifted serially into the other end of the same shift register). The SCLK synchronizes the shifting and sampling of the data on the two serial data pins. There are a few aspects to the Linux SPI framework. First, you need to declare the resources that a device will be utilizing in your system (the clock settings, the chip select the device uses, etc…). This is done on a per-board basis so that individual boards can easily customize things without munging up drivers. Then you need to write the driver which will take care of actually managing the device. You want to place this information in your board file. Here we will refer to the BF537 Stamp board linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c. The board setup code should take care of automatically calling the spi_register_board_info function so that your resources are registered at boot. This is the typical method of registering resources. Note that while it is possible to encode all of the resources in a module and do dynamic resource registration on the fly during runtime, we will not cover that functionality here. First we define the Blackfin SPI controller resources: #include <asm/bfin5xx_spi.h> ... static struct bfin5xx_spi_chip ad5304_chip_info = { .ctl_reg = 0x4, /* Blackfin-specific fields in SPI_CTL MMR; default = 0 */ .enable_dma = 0, /* Use DMA to transfer to the device; default = 0 */ .bits_per_word = 16, /* How many bits per word to transfer at a time (8 or 16); default = 8 */ .cs_chg_udelay = 0, /* How long to delay when changing the chip select between words; default = 0 */ }; Only use the ctl_reg member to enable features that the generic SPI framework does not expose as options. For example, if you want to set CPOL or CPHA, use the mode member and the SPI_MODE_# settings in the common framework, but if you need to set Send Zero option, you should set the ctl_reg field. Then we define the SPI framework resources: #include <linux/spi/spi.h> ... static struct spi_board_info bfin_spi_board_info[] __initdata = { ... { .modalias = "ad5304_spi", .max_speed_hz = 12500000, .bus_num = 1, .chip_select = 2, .platform_data = NULL, .controller_data = &ad5304_chip_info, .mode = SPI_MODE_1, }, ... }; The max_speed_hz field represents the max SPI clock speed in Hz. To make use of this feature, set chip_select = 0 and add a proper cs_gpio to your controller_data. Note that the device will be named as e.g. spidev0.0 . Add or modify the two structs according to the hints below. static struct bfin5xx_spi_chip ... .cs_gpio = GPIO_P###, static struct spi_board_info ... .chip_select = 0, To make use of this feature, set chip_select = MAX_CTRL_CS + a proper GPIO number. static struct spi_board_info ... .chip_select = GPIO_PFXX + MAX_CTRL_CS, /* GPIO controlled SSEL */ With the Blackfin on-chip SPI peripheral, there is some logic tied to the CPHA bit whether the Slave Select Line is controlled by hardware (CPHA=0) or controlled by software (CPHA=1). However, the Linux SPI bus driver assumes that the Slave Select being asserted during the entire SPI transfer. In most cases you can utilize SPI mode 3 instead of mode 0 to workaround this behavior. If your SPI slave device in question requires SPI mode 0 or 2 timing, you can utilize the GPIO controlled SPI Slave Select option instead. You can even use the same pin whose peripheral mode is a SSEL, but use it as a GPIO instead. Device Drivers ---> [*] SPI support ---> <*> SPI controller driver for ADI Blackfin5xx /* choose this for bf5xx soc */ <*> SPI controller driver for ADI Blackfin6xx /* choose this for bf60x soc */ <*> User mode SPI device driver support /* user space spi driver */ The steps a SPI chip driver generally takes include: Here you just want to announce to the kernel you are making your driver available. In your init/exit functions, you only want to handle things that need to be done on a per-driver level, not on a per-chip level. Remember that since we are using SPI here, you can have more than one chip device on the SPI bus using the same driver! #include <linux/spi/spi.h> ... static struct spi_driver ad5304_spi_driver = { .driver = { .name = "ad5304_spi", .bus = &spi_bus_type, .owner = THIS_MODULE, }, .probe = ad5304_spi_probe, .remove = __devexit_p(ad5304_spi_remove), }; ... static int __init ad5304_spi_init(void) { return spi_register_driver(&ad5304_spi_driver); } static void __exit ad5304_spi_exit(void) { spi_unregister_driver(&ad5304_spi_driver); } module_init(ad5304_spi_init); module_exit(ad5304_spi_exit); In your probe/remove functions you want to take care of any resource allocation/setup that is needed for each chip. Often times, this may involve setting up a per-device spinlock. static int __devinit ad5304_spi_probe(struct spi_device *spi) { struct ad5304_data *data; data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; spin_lock_init(&data->lock); dev_set_drvdata(&spi->dev, data); return 0; } static int __devexit ad5304_spi_remove(struct spi_device *spi) { struct ad5304_data *data = dev_get_drvdata(&spi->dev); kfree(data); return 0; } Now for the open ended part. To access your device, you'll use a suite of functions. Here we'll cover some of the common ones. int some_func(..., struct spi_device *spi, ...) { ... /* Write out 5 bytes from a buffer and sleep until done */ u8 buf[10] = { 0, 1, 2, 3, 4 }; int ret = spi_write(spi, buf, 5); ... /* Read in 4 bytes to a buffer and sleep until done */ u8 buf[10]; int ret = spi_read(spi, buf, 4); ... } For many simple SPI devices, all management can be done directly from userspace using the spidev device driver introduced in Linux-2.6.22. The normal kernel vs userspace design decisions hold true here. Just like the custom SPI kernel driver, you need to declare the SPI device resources in your board file. See the Device Resources section above but for the .modalias field, use spidev. Otherwise, you do not implement anything else in the kernel as the spidev device driver handles all of it. Once you boot up, the device nodes in /dev/ should be automatically created. They will have the form /dev/spidev<bus>.<chipselect>. So if you have a device using chip select 2 on the first SPI bus, the device will be named /dev/spidev0.2. If you want to access the hardware as a simple half-duplex character device, then you can just use the standard open/close/read/write functions. If you need to do full duplex transactions, you will have to utilize the extended API via ioctl() calls. The spidev file in the kernel documentation covers this. A simple test application can be found here: file: Documentation/spi/spidev_test.c scm failed with exit code 1: file does not exist in git For the latest and greatest SPI framework information, please read the following files in the kernel source: The images/information used here were acquired from various sources including Blackfin HRMs and Wikipedia articles. Complete Table of Contents/Topics
http://docs.blackfin.uclinux.org/doku.php?id=spi
CC-MAIN-2015-32
refinedweb
1,336
62.38
Hi@all; I think I don't need to write explanation about my code because it is very easy. Can anyone tell me when I run my prog. why the prog. gives me correct answer only once and after that doesn't give the correct answers for others? I know what is wrong but I don't know how to correct it? How can I divide each element in my array to 100 and print them? ThanksThanksCode:#include <iostream> using namespace std; int main() { int array[2]; for (int i=0; i<2; i++) cin >>array[i]; for (int j=0; j<2; j++) cout <<array[j]/100<<endl; return 0; }
http://cboard.cprogramming.com/cplusplus-programming/61466-little-help-int-array-looping.html
CC-MAIN-2014-10
refinedweb
111
82.75
- If variables need to be substituted now: button $b -command [list $b configure -background red] button $b -command "[list $b configure -background red] ; [list puts \ "pressed $b"]" - If variables need to be substituted later: button $b -command { set aa $some_global_var } - If there is a mixture: button $b -command [list some_function $b] ;# recommended solution - If you really want to avoid to create new functions and want an inline solution, there are some possibilities: button $b -command [string map [list %W [list $b]] { set aa $some_global_var %W configure -background red }]or: set cmd { set aa $some_global_var %W configure -background red } button $b -command [string map [list %W [list $b]] $cmd]it is the same but different disposition.There are other solutions that become easily complex and error prone: button $b -command " set aa \$some_global_var $b configure -background red "DGP Actually, your last three examples are all buggy. They will all fail if the value of $b contains white space. Avoid Quoting Hell. Stick with the helper proc.ramsan The two examples with string map should be OK now.RJM One can also use the subst command to properly create a command string. Of course, the subst command does not handle variables with white spaces correctly as list does, but this can be corrected by using "-quoting around the variable. This is possible since the WHOLE command is not quoted with "s. Contrary to list, subst allows multiple line command strings without backslashing, and the -nocommand option helps leaving nested commands untouched (which list does not do). Regarding string map: I personally find this ugly.The example from above is correspondingly modified. I also added a nested command here, which may be typical. For this purpose I wrote bind instead of button. bind $b <3> [subst -nocommand { set aa \$some_global_var focus [winfo parent %W] "$b" configure -background red }]DGP Of course, the remaing safety problems with the example above arise when $b contains one of the characters " or [ or $. KBK much prefers avoiding Quoting Hell with an auxiliary proc: proc handle_b3 { w } { set ::aa $::some_global_var; # I reproduce your example, but I'd # use namespace-specific vars here focus [winfo parent $w] $w configure -background red } bind $b <3> [list [namespace code handle_b3] %W]If you're planning to reuse a family of bindings, it's also wise to place them on a [bindtag] other than the widget name. That way, when you create a widget that uses the bindings, you need just the one line of code that adds the tag to the widget's bindtags. All of these solutions with subst, string map, and the like appear horribly unmaintainable. Moreover, as DGP points out, most of the examples on this page have bugs.RJM - Strictly said: the latter example does no longer touch the original page theme (immediate and late substitution). My example was prone to ambiguous interpretation. I could have been written %W instead of "$b". It was my intention to explore immediate variable substitution extending ramsan's example. Transferred to KBK's proc preferenced example, he would need two arguments: one to transfer %w and one to transfer a variable's value to document immediate and late substitution in one example. I still prefer it to define bindings up to about 5 lines inline, especially when more than one %-substitution is involved. A proc may not always appear close together with the bind definition in your source text, which lowers readability. Finally, each proc invocation takes considerable time related to simple commands (I know, it isn't interesting in most cases, since bindings are typically user related events).rdt The complaint about the proc not being close to the binding, reminds me that, since procs are in the global (disregarding namespace) namespace even if defined within another proc, what about just defining the proc for the command on the line immediately following the binding??Overviewing quoting topics one must still conclude that newbies in Tcl matters would tend to refuse using Tcl after reading this page. For newbies, Quoting Hell shows even more dramatically how experienced Tcl'ers are incomplete in their assumptions.CL doesn't follow. It's OK with me for you to "just defin[e] the proc for the command on the line immediately following the binding." I generally don't. I don't mind if you do. Also, I like the "Quoting Hell" page, because it properly begins with an emphasis on the simplicity of Tcl's syntax.RJM: Syntax IS simple indeed, but the term "Quoting Hell" says quite much about difficulties in correctly understanding certain code. The radical simplicity of the interpreter makes code sometimes look complex. For the proliferation of Tcl this is a serious problem, since today other scripting languages (however not as flexible as Tcl) partially provide a clearer syntax, especially Lua, which - to my opinion - will have a bright future. EB: To solve variable substitution problem, as KBK and DGP said, use a proc to avoid quoting hell. But if the proc is uniquely used, then lambda is a good solution: bind $b <3> [list [lambda {w} { set ::aa $::some_global_var focus [winfo parent $w] $w configure -background red }] $b]
http://wiki.tcl.tk/9330
CC-MAIN-2017-04
refinedweb
859
50.36
! A few days after Phil Haack described how to implement a null-checking aspect with PostSharp 2, it’s a good time to introduce a new feature of the refreshed PostSharp 3 CTP: validation of parameters, field, and properties. First, you need to have PostSharp 3 CTP (3.0.5) installed. To add a contract to to a parameter, just position the caret to the parameter name and select the relevant smart tag: After you click on the action, PostSharp will download and install the relevant NuGet packages to your project, and add a [Required] custom attribute to the parameter. The same works for fields and properties. It could not be easier. Of course, you can also introduce contracts without the user interface by installing the package PostSharp.Toolkit.Domain and adding the custom attribute yourself. public void Foo( [Required] string bar ) (Make sure to allow pre-releases if you install the package manually.) The following contracts are available in the PostSharp.Toolkit.Contracts namespace, depending on the type of the field, property or parameter: Unlike previous validation aspects based on OnMethodBoundaryAspect, the new aspects result in compact and fast code, with almost no overhead compared to hand-written code. Yet, they are based on an abstraction that you can extend to develop your own contracts: ILocationValidationAspect<T> is a new aspect primitive designed specifically for the task. It works transparently for fields, properties, and parameters. If you want to create your own contract, you can derive a class from System.Attribute, or preferably PostSharp.Extensibility,MulticastAttribute (which supports inheritance, see below), and ILocationValidationAspect<T>, where T is the type of values to be validated, as many times as necessary. Note that the aspect does not know any standard type conversion (other than down-casting, which is not a conversion), so you will need a lot of these Ts, for instance for int, int?, long, long?, and so on if you want to target numbers. If you apply a contract to a parameter of an interface, abstract or virtual method, any the contract will be implemented in any derived method, for instance: interface IFoo { void Bar( [Required] string fooBar ); } class Foo : IFoo { public void Bar( string fooBar ) { // PostSharp will inject the [Required] contract at the top of this method body. } } Note that inheritance is a feature of MulticastAttribute and not just contracts, so you can use it with just any aspect. I already mentioned that the aspect does not support any type conversion, which could be annoying if you need to develop contracts that work on numbers. Also note that the aspect is not yet able to validate output argument and return values. It is purely a precondition checker. Finally, note that all contracts are opt-in. There is no “not-null by default”. It would be fairly easy to develop such a policy using an assembly-level IAspectProvider, but currently you have to do it yourself. PostSharp 3 introduces a new aspect primitive that is optimized to validate fields, properties, and parameters with high run-time efficiency. The PostSharp Domain Toolkit contains a set of standard contracts that you can add to your code easily – just using the smart tags in Visual Studio. -gael
http://www.postsharp.net/blog/2013/01/default
CC-MAIN-2017-13
refinedweb
535
52.09
In the last blog post we have seen how to write models for project. In this blog post we are going learn about usage of templates in django views. Before start writing the view read the django request life cycle for better understanding. Url dispatcher passes the request to the view. View is responsible for the processing of the request. As we know django follows the MVT architecture. M - model V - view T - template - Model's allow us to connect with the databases for information. - View takes the advantage of django models to get the information from the database[using queries] and processes it. We write business logic in views. We process the data in views and passes it to the template for showing processed data to the user. - Template takes the processed data from the view and represent the data in a required formats like html, xml, json, etc. We have discussed the theory part. Let's start the coding. from django.conf.urls import url, include urlpatterns = [ .... url(r'^', include('library.urls')), .... ]This is the root urls file of our application. 'include' will add the app(library) urls. Based on the regular expression pattern users request will be served. library/urls.py from django.conf.urls import url from library import views urlpatterns = [ url(r'^$', views.home, name="home"), ]library/views.py from django.shortcuts import render def home(request): return render(request, 'home.html', {'say_hello': 'Hello World'})templates/home.html <!DOCTYPE html> <html> <head> <title> Library Management </title> </head> <body> <h1> {{ say_hello }}</h1> </body> </html>We have imported 'views' module from the library app and mapped it to url. Whenever we request the url in the browser it will the passed to the function home. If we observe library/views.py we have imported the render from the django shortcuts module. render takes request, template name(path from template directories) and context data(the dictionary) and renders the template with context data and returns the http response. Browser receives the response and displays it to the user. {{ say_hello }} replaces with Hello World. Context is a dictionary with keys and values. say_hello is a key in the context so it will replaced by it's value. It's just like string formatting in python.
http://django-easy-tutorial.blogspot.in/2017/03/django-usage-of-template-and-view.html
CC-MAIN-2017-26
refinedweb
376
69.38
For there is enough of them in the code. You do need to annotate your code to get the benefits. IntelliJ IDEA 10 can do it for you. Just run Analyze | Infer Nullity… and choose a scope where you want annotations to be inferred. IntelliJ IDEA uses many rules to analyze nullity and make a decision. Here are just 2 examples: 1) The IDE detects parameters that are used without checking for null: and presumes that they are @NotNull: 2) Variables that are checked for null are assumed as @Nullable, etc. As a result you can benefit from static code analysis without paying an entrance fee. Looks like the second screenshot should include “@Nullable” for the bar() instead of @NotNull? This is a great feature! Is there any chance you could support the equivalent annotations defined in JSR-305 (in the javax.annotations namespace), rather than requiring the annotations in the org.jetbrains.annotations namespace? This would allow better integration with third-party tools like FindBugs, and I think organisations are happier to have ‘import javax.annotations’ in their code than ‘import org.jetbrains.annotations’, especially for dev-teams which use a mixture of IDEs. I do agree with Jon. It really is a brillaient feature, but being on an eclipse project, i won’t import a vendor-specific annotation all over the place even though i really lové intellij… +1 for this. We are not using this IDEA feature because of the jetbrains imports. If the javax.annotations would be supported, we would use it. @KIR nope, @Nullable would produce NPE (null.substring(0)) Another +1. It should be very easy for IDEA to support javax.annotations instead of JetBrains specific annotations. I understand that JSR-305 is not final and all, but this is just a compile time dependency, and a possible impact from future changes in those annotations is pretty small. +1 Forcing users to depend on a jetbrains jar (and include it in their maven repository, etc) does not work in practice. Please, vote for Thank you yes. Strongly agreed that Intellij should refrain adding such features that require proprietary library. @Anna: please take into account that there are several similar issues when you evaluate the popularity of this feature: Just counting votes on IDEA-19564 might not be accurate. +1 to allowing support for the javax.annotation.Nullable version. Is there a way to use class level defaults for this? I’d like for everything to be @NotNull by default unless specified to be @Nullable. Would it be possible to enable to infer nullity for libraires used in a project? Would help a lot when using some libraries with sources. Could you please patch code and throw IllegalArgument / AssertionErrors for javax.validation.constraints.NotNull as it done for jetbrains NotNull?
https://blog.jetbrains.com/idea/2010/12/auto-infer-nullablenotnull-annotations/
CC-MAIN-2019-47
refinedweb
465
58.69
Provided by: libtiff-dev_4.0.10+git191003-1_amd64 NAME TIFFWriteRawStrip - write a strip of raw data to an open TIFF file SYNOPSIS #include <tiffio.h> tsize_t TIFFWriteRawStrip(TIFF *tif, tstrip_t strip, tdata_t buf, tsize_t size) DESCRIPTION Append size bytes of raw data to the specified strip. NOTES The strip number must be valid according to the current settings of the ImageLength and RowsPerStrip tags. An image may be dynamically grown by increasing the value of ImageLength prior to each call to TIFFWriteRawStrip. RETURN VALUES -1 is returned if an error occurred. Otherwise, the value of size is returned. DIAGNOSTICS All error messages are directed to the TIFFError(3TIFF) routine. %s: File not open for writing. The file was opened for reading, not writing. Can not write scanlines to a tiled image. The image is assumed to be organized in tiles because the TileWidth strip arrays". There was not enough space for the arrays that hold strip offsets and byte counts. %s: Strip %d out of range, max %d. The specified strip is not a valid strip according to the currently specified image dimensions. SEE ALSO TIFFOpen(3TIFF), TIFFWriteEncodedStrip(3TIFF), TIFFWriteScanline(3TIFF), libtiff(3TIFF) Libtiff library home page:
http://manpages.ubuntu.com/manpages/eoan/man3/TIFFWriteRawStrip.3tiff.html
CC-MAIN-2019-43
refinedweb
197
68.16
Always lovely food, made from an experience chef! Fresh food with a twist. Garden is really pretty and beautiful to relax. Always lovely food, made from an experience chef! Fresh food with a twist. Garden is really pretty and beautiful to relax. Really. Do You want to enjoy your evening and have extremely good food with superb friendliness. Then this is the place. The full crew breaths welcome, professionalism and joy for the job and the customer. I simply do not know where the combination of professionalism...More I did visit this restaurant several times and as always, it's good food and the service is also very nice. I did have a problem with the timing however. When you are stuck to your table for 5 hours to eat a 5 cours menu...More Eating at De Fakkels is not just eating: it's an evening-filling culinair experience. Flavours are exploding in the mouth and the service is the best I have ever experienced. Enjoyed lobster lunch at restaurant. Seldom have tasted lobster so tender, and accompanied with combinations of vegies and fruit. One and a half baby lobster, all out of their shell, pro person , served in three courses. Selected chateau rully premier cru . Desert and...More We had an amazing evening here. The food was very good and the staff very friendly. You really get what you pay for and it is worth it. De Fakkels is nr 1 in Sint-Truiden if you are looking for the highest rating in the Gault Millau. Should have a Michelin star. Business dinner for 10. Service was warm, professional, exceptional considering the many business dinners we have had in all of Europe. We were served the same hors'devours(sp), entree and main course and each of us had the same review - "excellent". Definitely one of the...More Great reception when you arrive. Excellent food with creativity in mind. Can recommend this restaurant wholeheartedly if price is not directly any issue. Very fine and creative cuisine. The staff is friendly and donw to earth, so you feel at home! One negative point: maybe the interior (especially the salon) needs a bit of refreshing! But overall a place to return (which we have done several times) if...More
https://www.tripadvisor.com/Restaurant_Review-g641781-d741265-Reviews-De_Fakkels-Sint_Truiden_Limburg_Province.html
CC-MAIN-2018-51
refinedweb
379
69.28
Naming things well is an important part of writing maintainable software, and renaming things once their names have become established in a code base can be tedious work. This is true as well for the names of an application database schema, where a schema change usually requires a database migration script. That’s why you should take some time beforehand to set up a naming convention. Many applications use object-relational mappers (ORM), which have a default naming convention to map class and property names to table and column names. But if you’re not using an ORM, you should set up conventions as well. Here are some tips: - Be consistent. For example, choose either only plural or singular for table names, e.g. “books” or “book”, and stick to it. Many sources recommend singular for table names. - On abbreviations: Some database systems like Oracle have a character limit for names. The limit for Oracle database table names is 30 characters, which means abbreviations are almost inevitable. If you introduce abbreviations be consistent and document them in a glossary, for example in the project Wiki. - Separate word boundaries with underscores and form a hierarchy like “namespace_entity_subentity”, e.g. “blog_post_author”. This way you can sort the tables by name and have them grouped by topic. - Avoid unnecessary type markers. A table is still a table if you don’t prefix it with “tbl_”, and adding a “_s” postfix to a column of type string doesn’t really add useful information that couldn’t be seen in the schema browser of any database tool. This is similar to Hungarian notation, which has fallen out of use in today’s software development. If you still want to mark special database objects, for example materialised views, then you should prefer a postfix, e.g. “_mv”, over a prefix, because a prefix would mess up the lexicographic hierarchy established by the previous tip. And the final advice: Document your conventions so that other team members are aware of them and make them mandatory.
https://schneide.blog/2019/05/21/database-table-naming-conventions/
CC-MAIN-2020-29
refinedweb
338
54.83
Writing unit tests We will start by showing how to create a simple unit test with doctest syntax. There is nothing Zope- or Plone-specific about this test. This type of test is ideal for methods and classes that perform some kind of well-defined operation on primitives or simple objects. The doctest syntax is well-suited for explaining the inputs and outputs. Since the tests are relatively few and/or descriptive, keeping the tests, documentation and code close together makes sense. Tests are usually found in a tests/ sub-package. In the example.tests package, we have created a file called tests/test_simple_doctest.py. This sets up a test suite to run doctests in the doc strings in the module example.tests.context. Let's look at the test setup first: """This is the setup for a doctest where the actual test examples are held in docstrings in a module. Here, we are not using anything Zope-specific at all. We could of course use the Zope 3 Component Architecture in the setup if we wanted. For that, take a look at test_zope3_doctest.py. However, we *do* use the zope.testing package, which provides improved version of Python's standard DocTestSuite, DocFileSuite and so on. If you don't want this dependency, just use doctest.DocTestSuite. """ import unittest import zope.testing import example.tests.context def setUp(test): """We can use this to set up anything that needs to be available for each test. It is run before each test, i.e. for each docstring that contains doctests. Look at the Python unittest and doctest module documentation to learn more about how to prepare state and pass it into various tests. """ def tearDown(test): """This is the companion to setUp - it can be used to clean up the test environment after each test. """ def test_suite(): return unittest.TestSuite(( # Here, we tell the test runner to execute the tests in the given # module. The setUp and tearDown methods can be used to perform # test-specific setup and tear-down. zope.testing.doctest.DocTestSuite(example.tests.context, setUp=setUp, # setUp and tearDown are optional! tearDown=tearDown), )) There are a lot of comments here, and we show how to use setUp() and tearDown() methods for additional initialisation and clean-up, if necessary. The test runner will call the test_suite() method and expect a TestSuite object back. If desired, we could have put multiple test suites referring to multiple modules into the TestSuite that is being returned. Here is the actual code under test, in context.py: from zope.interface import implements from example.tests.interfaces import IContext class Context(object): """An object used for testing. We will register an adapter from this interface to IUpperCaser in the test setup. Here's how you use it. First, import the class. >>> from example.tests.context import Context Then in-stan-ti-ate it (with me so far?): >>> my_context = Context() Okay, here's the tricky bit ... now we need to set the title: >>> my_context.title = u"Some string!" Phew ... did that work? >>> my_context.title u'Some string!' Yeah! """ implements(IContext) def __init__(self, title=u""): self.title = title Here is how we may run the tests from a buildout: ./bin/instance test -s example.tests -t context Running unit tests: Running: .... Ran 4 tests with 0 failures and 0 errors in 0.071 seconds.
http://plone.org/documentation/kb/testing/writing-unit-tests
crawl-003
refinedweb
559
69.38
Ok I think I ended up with an overly complicated title for this series once again… This is the next part in the ongoing Swift with SpriteKit tutorial series. In the previous part we hooked up a very simple physics simulation. First starting with basic gravity then with a collision off the edge of the screen. In this part we are going to look at some slightly more complicated collision scenarios. This tutorial section is going to be a bit more code heavy than before. In this first code example, we are going to have two physics guided balls on the screen. This example will show how to “do something” when two objects collide. Let’s hope right in: import SpriteKit class GameScene: SKScene, SKPhysicsContactDelegate { override func didMoveToView(view: SKView) { // Define the bitmasks identifying various physics objects let sphereObject : UInt32 = 0x01; let worldObject : UInt32 = 0x02; //Create a ball shape var path = CGPathCreateMutable(); CGPathAddArc(path, nil, 0, 0, 45, 0, M_PI*2, true); CGPathCloseSubpath(path); // Create one ball var shapeNode = SKShapeNode(); shapeNode.path = path; shapeNode.lineWidth = 2.0; shapeNode.position = CGPoint(x:self.view.frame.width/2,y:self.view.frame.height); // Set the ball's physical properties shapeNode.physicsBody = SKPhysicsBody(circleOfRadius: shapeNode.frame.width/2); shapeNode.physicsBody.dynamic = true; shapeNode.physicsBody.mass = 5; shapeNode.physicsBody.friction = 0.2; shapeNode.physicsBody.restitution = 1; shapeNode.physicsBody.collisionBitMask = sphereObject | worldObject; shapeNode.physicsBody.categoryBitMask = sphereObject; shapeNode.physicsBody.contactTestBitMask = sphereObject; // Now create another ball var shapeNode2 = SKShapeNode(); shapeNode2.path = path; shapeNode2.position = CGPoint(x:self.view.frame.width/2,y:self.view.frame.height/2); shapeNode2.physicsBody = SKPhysicsBody(circleOfRadius: shapeNode.frame.width/2); shapeNode2.physicsBody.dynamic = true; shapeNode2.physicsBody.mass = 5; shapeNode2.physicsBody.friction = 0.2; shapeNode2.physicsBody.restitution = 1; shapeNode2.physicsBody.collisionBitMask = sphereObject | worldObject; shapeNode2.physicsBody.categoryBitMask = sphereObject; shapeNode2.physicsBody.contactTestBitMask = sphereObject; // Now make the edges of the screen a physics object as well scene.physicsBody = SKPhysicsBody(edgeLoopFromRect: view.frame); scene.physicsBody.contactTestBitMask = worldObject; scene.physicsBody.categoryBitMask = worldObject; // Make gravity "fall" at 1 unit per second along the y-axis self.physicsWorld.gravity.dy = -1; self.addChild(shapeNode); self.addChild(shapeNode2); // We implement SKPhysicsContactDelegate to get called back when a contact occurs // Register ourself as the delegate self.physicsWorld.contactDelegate = self; } // This function is called on contact between physics objects func didBeginContact(contact:SKPhysicsContact){ let node1:SKNode = contact.bodyA.node; let node2:SKNode = contact.bodyB.node; // Node 1 is the object the hit another object // Randomly apply a force of 0 - 1000 on both x and y axis node1.physicsBody.applyImpulse(CGVector( CGFloat(arc4random() % 1000), CGFloat(arc4random() % 1000))); // Node 2 is the other object, the one being hit node2.physicsBody.applyImpulse(CGVector( } And when you run it: A lot of the code is very similar to our previous example, so I will only focus on what’s new. The first thing you may notice is our class now implements SKPhysicsContactDelegate. This provides a function, didBeginContact() that will be called when a contact occurs. In this example, didBeginContact will only be called when a contact occurs between spheres, and not the edge of the screen. I will explain why shortly. The only other major change in this code is for each PhysicsObject in the scene, we now define a couple values, collisionBitMask, categoryBitmask and contactTestBitMask. Earlier in the code you may have noticed: let sphereObject : UInt32 = 0x01; This is where we define our two bitmasks. Bitmasking may be a somewhat new concept to you. Basically its a way of packing multiple values into a single variable. Lets use a simple 8 byte char as an example. In memory, in terms of bits, a char is composed of 8 bits that can be either on or off. Like this for example: 10011001 So using a single byte of memory, we are able to store 8 individual on/off values. 1 representing on, while 0 represents off. Of course in variables we don’t generally deal with values in binary form, but instead we often use hexadecimal. The value above, 10011001 as binary translates to 153 decimal or 0x99 in hex. Now lets look at our defined values. We are essentially saying 0001 is a sphereObject 0010 is a worldObject. Now using bitwise math you can do some neat stuff. For example, using a bitwise AND, you can make an object out of both: let worldSphere = sphereObject & worldObject; // result 0011 This allows you to pack multiple on/off values into a single variable. Now a full discussion on bitwise math is way beyond the scope of this tutorial, you can read more about it here. But the basics above should get you through this code example. Basically in SpriteKit physics you define the “type” of an object using categoryBitmask. So in this example we set the categoryBitmask of each of our spheres to sphereObject, and the world frame to worldObject. Next you tell each object what it interacts with, like we did here: shapeNode2.physicsBody.collisionBitMask = sphereObject | worldObject; shapeNode2.physicsBody.categoryBitMask = sphereObject; shapeNode2.physicsBody.contactTestBitMask = sphereObject; What we are saying here is this node will collide with sphereObjects OR worldObjects, but it is a sphereObject and will only contact with other sphereObjects. Therefore, our contact delegate will only be called when two spheres contact, while nothing will happen when a sphere contacts the side of the screen. As you notice from the balls bouncing off the side, the collision still occur. By default, each collision and contact bit mask is set to 0xFFFFFF, which basically sets all possible bits to on, meaning everything contacts and collides with everything else. The delegate function called each time a collision occurs between sphere objects is pretty straight forward: func didBeginContact(contact:SKPhysicsContact){ Basically for each node involved in the collision we apply a random impulse ( think push ) in a random direction between 0 and 1000 in both the x and y axis. Speaking of applying force, let’s take a quick look at another example: var shapeNode:SKShapeNode; init(size:CGSize) { shapeNode = SKShapeNode(); // this time we dont want gravity mucking things up shapeNode.physicsBody.affectedByGravity = false; super.init(size:size); // Position the ball top center of the view shapeNode.position = CGPoint(x:view.frame.width/2,y:view.frame.height); override func keyUp(theEvent: NSEvent!) { switch theEvent.keyCode{ case126: // up arrow shapeNode.physicsBody.applyImpulse(CGVector(0,1000)); case125: // down arrow shapeNode.physicsBody.applyImpulse(CGVector(0,-1000)); case123: // left arrow shapeNode.physicsBody.applyForce(CGVector(-1000,0)); case124: // right arrow shapeNode.physicsBody.applyForce(CGVector(1000,0)); case49: // spacebar shapeNode.physicsBody.velocity = CGVector(0,0); shapeNode.position = CGPoint(x: self.view.frame.width/2,y:self.view.frame.height/2); default: return; } This sample is pretty straight forward, thus no animated gif. If the user presses up or down, an implies is applied along that direction. If the user presses left or right, a force is applied instead. While if the user hits the spacebar, the sphere’s velocity is set to nothing and it is manually moved to the centre of the screen. One thing you might notice is implies moves a great deal more than force. This is because force is expected to be applied per frame. Think of it like driving a car. An impulse is like i loaded your car into a gigantic slingshot and propelled you along at a blistering speed. Force on the other hand is much more akin to you driving the car yourself. If you take your foot of the gas, you rapidly decelerate. If on the other hand you keep your foot down ( apply the same amount of force each frame ), you will move along consistently at the same speed. As you see from the above example, you can also manipulate velocity and position directly. Generally though this mucks with the physics simulation something severe, so generally isn’t recommended if alternatives exist. Sil. Now we are going to look at using Physics in our Spritekit based game. If you’ve worked with a physics engine before, a lot of this is going to feel very familiar. One of the key differences from many other engines is SpriteKit handles updating the graphics as well as the physics. It’s a fairly involved process, so I am going to split this across multiple posts. The first one is going to be short and sweet. We are going to configure the physics of a sphere, a SKShapeNode. It is simply going to exist and let gravity take it’s course. Code time: class GameScene: SKScene { view.scene!.anchorPoint = CGPoint(x: 0.5,y: 0.5) CGPathAddArc(path, nil, 0, view.bounds.height/2, 45, 0, M_PI*2, true); shapeNode.physicsBody = SKPhysicsBody(circleOfRadius: 45.0); And once run: Well, that was simple enough, let’s take a quick run through the code. We start off by creating an SKShapeNode. This shape node is defined by a CGPath. You can think of a CGPath as a set of drawing instructions. In this case it consists of a single arc that draws a circle. Once our path is created we set it to be our shapeNodes path. We set the lineWidth to 2 to make it a bit more visible. Next we define the physicsBody. Every SKNode has a SKPhysicsBody. The SKPhysicsBody is the nodes’ representation in the physics engine. When defining a physics body you pick the shape that most matches your underlying shape. In this case it’s a no brainer to use a circle. There are constructors available for rectangles, polygons, edges, etc. Of all the options however, the circle is the least processing intensive. So if you need just a rough physical representation, prefer the more simple types ( circle, then rectangle ) and leave the more complex types until required. The key thing here is the dynamic property. This is what tells SpriteKit to include your SKNode in the physics calculation. If this isn’t set, nothing is going to happen! Finally we set the gravity value dy to -1. This means gravity moves by a delta of -1 unit per second on the y axis. Notice the concept of “unit” here, it is very import. When dealing with SpriteKit ( and many other Physics engines ), a unit is completely arbitrary. So you may ask “1 what?”. The answer is, 1 whatever… just be consistent about it. In your code you could choose 1 to be a millimetre, an inch, a foot, a lightyear. A lot of it comes down to the type of game you are working on. One thing to keep in mind here though, massive ranges in value are not a good thing… so don’t mix units. For example, trying to represent something in millimetres and kilometres in the same simulation is a sure recipe for disaster! Now let’s give our ball something to collide with… that being the edge of the window. While we are at it, let’s add a bit of bounce to our step: //Create the ball shapeNode.physicsBody.mass = 1; And run this: Not, the jerkiness you see isn’t from the physics, but instead the animated gif. Getting that to encode to a reasonable size was oddly a bit of a battle. The key difference here is first of all, we set the edges of the screen as a physics object for our ball to collide against. A key thing to remember with SpriteKit, every thing is a SKNode, even the scene itself! Next we set a couple key physics properties for our ball, mass, friction and restitution. Mass is the weight of the object… going back to the age old question, what falls faster… a ton of feathers, or a ton of bricks? Friction is how two surfaces react to each other, generally used when simulating “sliding” and is fairly irrelevant in this example. Restitution is the key value. For lack of a better explanation, restitution is the bounciness of the objet. Lower value, less bounce, higher value, higher bounce. A value higher than 1 will result in an object actually gaining momentum after a collision ( aka, going higher UP then it fell from before bouncing ). Next up we will work on actual collisions. Programming 2D
http://www.gamefromscratch.com/2014/07/default.aspx
CC-MAIN-2017-43
refinedweb
2,021
58.58
This article is an excerpt from “Natural Language Processing and Computational Linguistics” published by Packt. Arguably the most important application of machine learning in text analysis, the Word2Vec algorithm is both a fascinating and very useful tool. As the name suggests, it creates a vector representation of words based on the corpus we are using. But the magic of Word2Vec is how it manages to capture the semantic representation of words in a vector. The papers Efficient Estimation of Word Representations in Vector Space [1] [Mikolov et al. 2013], Distributed Representations of Words and Phrases and their Composit... [2] [Mikolov et al. 2013], and Linguistic Regularities in Continuous Space Word Representations [3] [Mikolov et al. 2013] lay the foundations for Word2Vec and describe their uses. We've mentioned that these word vectors help represent the semantics of words - what exactly does this mean? Well for starters, it means we could use vector reasoning for these words - one of the most famous examples is from Mikolov's paper, where we see that if we use the word vectors and perform (here, we use V(word) to represent the vector representation of the word) V(King) – V(Man) + V(Woman), the resulting vector is closest to V(Queen). It is easy to see why this is remarkable - our intuitive understanding of these words is reflected in the learned vector representations of the words! This gives us the ability to add more of a punch in our text analysis pipelines - having an intuitive semantic representation of vectors (and by extension, documents - but we'll get to that later) will come in handy more than once. Finding word-pair relationships is one such interesting use - if we define a relationship between two words such as France: Paris, using the appropriate vector difference we can identify other similar relationships - Italy : Rome, Japan : Tokyo are two such examples which are found using Word2Vec. We can continue to play with these vectors like any other vectors - by adding two vectors, we can attempt to get what we would consider the addition of two words. For example, V(Vietnam) + V(Capital) is closest to the vector representation of V(Hanoi). How exactly does this technique result in such an understanding of words? Word2Vec works by understanding context - in particular, what of words tend to appear in certain words? We choose a sliding window size and based on this window size attempt to identify the conditional probability of observing the output word based on the surrounding words. For example, if the sentence is The personal nature of text data always adds an extra bit of motivation, and it also likely means we are aware of the nature of the data, and what kind of results to expect., and our target word is the word in bold, motivation, we try and figure out what the odds of finding the word motivation if the context is always adds an extra bit of on the left side of the window and and it also likely means on the right. Of course, this is just an illustrative example - the exact training procedure requires us to choose a window size and the number of dimensions among other details. There are two main methods to perform Word2Vec training, which are the Continuous Bag of Words model (CBOW) and the Skip Gram model. The underlying architecture of these models is described in the original research paper, but both of these methods involve in understanding the context which we talked about before. The papers written by Mikolov et al. provide further details of the training process, and since the code is public, it means we actually know what's going on under the hood! This blog post [4] (Word2Vec Tutorial - The Skip-Gram Model) by Chris McCormick explains some of the mathematical intuition behind the skip-gram word2vec model, and this post [5] (The amazing power of word vectors) by Adrian Colyer talks about the some of the things we can do with word2vec. The links are useful if you wish to dig a little deeper into the mathematical details of Word2Vec. This resources page [6] contains theory and code resources for Word2Vec and is also useful in case you wish to look up the original material or other implementation details. While Word2Vec remains the most popular word vector implementation, this is not the first time it has been attempted, and certainly not the last either - we will discuss some of the other word embeddings techniques in the last section of this chapter. Right now, let's jump into using these word vectors ourselves. Gensim comes to our assistance again and is arguably the most reliable open source implementation of the algorithm, and we will explore how to use it. While the original C code [7] released by Google does an impressive job, gensims' implementation is a case where an open source implementation is more efficient than the original. The gensim implementation was coded up back in 2013 around the time the original algorithm was released - this blog post by Radim Řehůřek [8] chronicles some of the thoughts and problems encountered in implementing the same for gensim, and is worth reading if you would like to know the process of coding word2vec in python. The interactive web tutorial [9] involving word2vec is quite fun and illustrates some of the examples of word2vec we previously talked about. It is worth looking at if you're interested in running gensim word2vec code online and can also serve as a quick tutorial of using word2vec in gensim. We will now get into actually training our own Word2Vec model. The first step, like all the other gensim models we used, involved importing the appropriate model. from gensim.models import word2vec At this point, it is important to go through the documentation for the word2vec class, as well as the KeyedVector class, which we will both use a lot. From the documentation page, we list the parameters for the word2vec.Word2Vec class. We won't be using or exploring all of these parameters in our examples, but they're still important to have an idea of - fine-tuning your model would heavily rely on this. When training our model, we can use our own corpus or more generic ones - since we wish to not train on a particular topic or domain, we will use the Text8 corpus [10] which contains textual data extracted from Wikipedia. Be sure to download the data first - we do this by finding the link text8.zip under the Experimental Procedure section. We will be more or less following the Jupyter notebook attached at the end of this chapter, which can also be found at the following link [11]. sentences = word2vec.Text8Corpus('text8') model = word2vec.Word2Vec(sentences, size=200, hs=1) Our model will use hierarchical softmax for training and will have 200 features. This means it has a hierarchical output and uses the softmax function in its final layers. The softmax function is a generalization of the logistic function that squashes a K-dimensional vector z of arbitrary real values to a K-dimensional vector of real values, where each entry is in the range (0, 1), and all the entries add up to 1. We don't need to understand the mathematical foundation at this point, but if interested, links 1-3 go into more details about this. Printing our model tells us this: print(model) -> Word2Vec(vocab=71290, size=200, alpha=0.025) Now that we have our trained model, let's give the famous King - Man + Woman example a try: model.wv.most_similar(positive=['woman', 'king'], negative=['man'], topn=1)[0] Here, we are adding king and woman (they are positive parameters), and subtracting man (it is a negative parameter), and choosing only the first value in the tuple. -> (u'queen') And voila! As we expected, Queen is the closest word vector when we search for the word most similar to Woman and King, but far away from man. Note that since this is a probabilistic training process, there is a slight chance you might get a different word - but still relevant to the context of the words. For example, words like throne or empire might come up. We can also use the most_similar_cosmul method - the gensim documentation [12] describes this as being slightly different to the traditional similarity function by instead using an implementation described by Omer Levy and Yoav Goldberg in their paper [13] Linguistic Regularities in Sparse and Explicit Word Representations. Positive words still contribute positively towards the similarity, negative words negatively, but with less susceptibility to one large distance dominating the calculation. For example: model.wv.most_similar_cosmul(positive=['woman', 'king'], negative=['man']) -> [(u'queen', 0.8473771810531616), (u'matilda', 0.8126628994941711), (u'throne', 0.8048466444015503), (u'prince', 0.8044915795326233), (u'empress', 0.803791880607605), (u'consort', 0.8026778697967529), (u'dowager', 0.7984940409660339), (u'princess', 0.7976254224777222), (u'heir', 0.7949869632720947), (u'monarch', 0.7940317392349243)] If we wish to look up the vector representation of a word, all we need to do is: model.wv['computer'] model.save("text8_model") We won't display the output here, but we can expect to see a 200-dimension array, which is what we specified as our size. If we wish to save our model to disk and re-use it again, we can do this using the save and load functionalities. This is particularly useful - we can save and re-train models, or further train on models adapted to a certain domain. model.save("text8_model") model = word2vec.Word2Vec.load("text8_model") The magic of gensim remains in the fact that it doesn't just give us the ability to train a model - like we have been seeing so far, it's API means we don't have to worry much about the mathematical workings but can focus on using the full potential of these word vectors. Let us check out some other nifty functionalities the word2vec model offers: Using word vectors, we can identify which word in a list is the farthest away from the other words. Gensim implements this functionality with the doesnt_match method, which we illustrate: model.wv.doesnt_match("breakfast cereal dinner lunch".split()) -> 'cereal' As expected, the one word which didn't match the others on the list is picked out - here, it is cereal. We can also use the model to understand how similar or different words are in a corpus - model.wv.similarity('woman', 'man') -> 0.6416034158543054 model.wv.similarity('woman', 'cereal') -> 0.04408454181286298 model.wv.distance('man', 'woman') -> 0.35839658414569464 The results are quite self-explanatory in this case, and as expected, the words woman and cereal are not similar. Here, distance is merely 1 - similarity. We can continue training our Word2Vec model using the train method - just remember to explicitly pass an epochs argument, as this is a suggested way to avoid common mistakes around the model's ability to do multiple training passes itself. This Gensim notebook tutorial [14] walks one through how to perform online training with word2vec. Briefly, it requires performing the following tasks - building a new vocabulary and then running the train function again. Once we're done training our model, it is recommended to start only using the model's keyed vectors. You might have noticed so far that we've been using the keyed vectors (which is simply a Gensim class to store vectors) to perform most of our tasks - model.wv represents this. To free up some RAM space, we can run: word_vectors = model.wv del model We can now perform all the tasks we did before using the word vectors. Keep in mind this is not just for Word2Vec but all word embeddings. To evaluate how well our model has done, we can test it on data-sets which are loaded when we install gensim. model.wv.evaluate_word_pairs(os.path.join(module_path, 'test_data','wordsim353.tsv')) -> ((0.6230957719715976, 3.90029813472169e-39), SpearmanrResult(correlation=0.645315618985209, pvalue=1.0038208415351643e-42), 0.56657223796034) Here, to make sure we find our file, we have to specify the module path - this is the path for the gensim/test folder, which is where the files exist. We can also test our model on finding word pairs and relationships by running the following code. model.wv.accuracy(os.path.join(module_path, 'test_data', 'questions-words.txt')) In our examples so far, we used a model which we trained ourselves - this can be quite a time-consuming exercise sometimes, and it is handy to know how to load pre-trained vector models. Gensim allows for an easy interface to load the original Google News trained word2vec model (you can download this file from link [9]), for example. from gensim.models import KeyedVectors # load the google word2vec model filename = 'GoogleNews-vectors-negative300.bin' model = KeyedVectors.load_word2vec_format(filename, binary=True) Our model now uses a 300-dimension word vector model, and we can run all the previous code examples we ran before, again - the results won't be too different, but we can expect a more sophisticated model. Gensim also allows similar interfaces to download models using other word embeddings - we'll go over this in the last section. We're now equipped to train models, load models, and use these word embeddings to conduct experiments! You have just read an excerpt from Packt's book Natural Language Processing and Computational Linguistics, authored by Bhargav Srinivasa-Desikan. If you want to know how to use natural language processing, and computational linguistics algorithms, to make inferences and gain insights about data you have, this is the book for you. Views: 2190 Comment © 2019 Data Science Central ® Badges | Report an Issue | Privacy Policy | Terms of Service You need to be a member of Data Science Central to add comments! Join Data Science Central
https://www.datasciencecentral.com/profiles/blogs/the-word2vec-algorithm
CC-MAIN-2019-47
refinedweb
2,298
51.68
Bugzilla Status UpdateMax Kanat-Alexander and The Bugzilla Team Sunday, October 15, 2006 Introduction and Updates Well, we have a whole bunch of releases out today, all the way from 2.18.6 to 2.23.3. - 2.18.6 and 2.20.3 are primarily security fix releases. - 2.22.1 is our first bug-fix release for the 2.22 series, containing many useful fixes. We recommend everybody upgrade to 2.22.1 as soon as possible. - 2.23.3 is one of our most important development releases ever, containing the two "holy grails" of Bugzilla development, custom fields and mod_perl support. (Of course, the release is only a development snapshot, so don't use it in production! It hasn't received the same level of QA as the other releases!) Bugzilla development has been extremely active lately, and we're happy that we're receiving so many contributions. As usual, though, we need more reviewers! To become a reviewer, you first have to be a consistent contributor, and then we have to trust your judgement. You can see more details at the List of Reviewers.. About Our Latest Development Release (2.23.3) This tops 2.23.2 as one of our most feature-packed development releases ever. However, it is not strongly QA-tested, so use it at your own risk! We don't recommend using it in a production environment. We know there are bugs in it. Here's a listing of some of the major improvements and changes since 2.23.2: - Custom Resolutions: You can now customize the list of resolutions for bugs. - Shared Queries: You can share saved queries with a group of users. - Custom Fields: Administrators can add plain-text and drop-down custom fields to Bugzilla. Note that you can search these fields using the Boolean Charts at the bottom of the search page. - mod_perl: Bugzilla can now run under mod_perl. See lower in this Status Update for more details. - XML-RPC: This version of Bugzilla has the beginnings of an XML-RPC interface. Note that the XML-RPC API is not yet stable, and may change before the release of Bugzilla 3.0. However, any documented function is likely to stay the same in the actual release as it is now. - Skins: Bugzilla is now skinnable. See the documentation for details. - You can now specify a Default CC for a component. - You can now disable Bugzilla's sending of email to a particular user, in the administrative interface. - There's a parameter for administrators to put an announcement at the top of all Bugzilla pages. - You can make a bug ASSIGNED when you file it, now. - If you aren't allowed to change a field on a bug, it will look like plain text instead of a form element. - All of Bugzilla's emails are now in templates. - Some of the messages printed out during installation can now be localized. - If you are using Firefox 2 or Internet Explorer 7, you can install a Search Plugin that will let you search Bugzilla bugs. Also, the following changes may interest developers or customizers of Bugzilla: - When you build the documentation, the Bugzilla POD documentation will be available as docs/html/api/ in your installation. The POD describes all of the internal functions of Bugzilla. It's very useful for customizers and developers of Bugzilla. It also explains how a few scripts work, like checksetup.pl, and that information is useful to all administrators of Bugzilla. - checksetup.pl has been completely reorganized into modules in the Bugzilla::Install namespace. It also has POD now, so you can do perldoc checksetup.pl to see all kinds of useful information about it. - Bugzilla::Object now has many more abilities, including the ability to create and update objects in the database. - You may notice a huge cleanup in post_bug.cgi and the creation of Bugzilla::Bug->create. - localconfig variables are now accessed through Bugzilla->localconfig. - UserInGroup has been removed. You should use Bugzilla->user->in_group instead. mod_perl Support Bugzilla now can be run under mod_perl. This allows for pages to load much faster (up to six times faster) than they did previously. However, it uses up much more memory than Bugzilla did previously. So if you're going to use it, make sure that you have enough memory available, around 1.5GB. We'd really like some testing of Bugzilla under mod_perl! We know that some things don't work under mod_perl yet. You can see that at the tracking bug and its dependency list. For more details, see the documentation. The Road to Bugzilla 3.0 Bugzilla development freezes two weeks after today, meaning that no new enhancements will be accepted--we'll focus on fixing bugs. We then hope to have Bugzilla 3.0rc1 out by the end of the year, and the final Bugzilla 3.0 by early 2007. To see our current plans, you can watch the Bugzilla Calendar. It reflects only our current plans--it may change at any time..1 (or 3.0, when it comes out) at their earliest convenience..
https://www.bugzilla.org/status/2006-10-15.html
CC-MAIN-2021-10
refinedweb
853
68.87
* Interfaces - 6 questions madhu v pe Ranch Hand Joined: Apr 21, 2007 Posts: 100 posted Apr 28, 2007 21:04:00 0 Hi, below questions are from examulator mock exam site and some from other sites which I didnot remember 6 questions on topic Interfaces my answers were followed by 6th question. I am having doubts specified along with answers. you can compare with your answers and give reason why my answer is wrong?(if it is wrong) and please clarify my doubts. Interfaces Q1.Which of the following is correct? Select the two. Q2.Which. Q3) Given the following code, which of the options if inserted on the line } } 1) super().output(100); 2) new Wfowl().output(i); 3) class test implements Liz{} 4) System.out.println(sDescription); 5) new Wfowl(); 6) getDescription(); Q4) Given the following code, which of the following options if inserted after the comment //here will allow the code to compile without error? interface Remote{ public void test(); } public class Moodle{ public static void main(String argv[]){ Moodle m = new Moodle(); } public void go(){ //here } } 1) Remote r = new Remote(){ public void test(){} }; 2) Remote remote = new Remote(); 3) test(); 4) this.main(); Q5) Which of the following can legally be inserted into an interface? 1) public static String getPostCode(); 2) public abstract String getName(); 3) private String getAverageHousePrice(); 4) public void setPostCode(String s) { System.out.print(s); } 6) Which of the following is the correct syntax for suggesting that the JVM performs garbage collection? Select 1 option 1)System.free(); 2)System.setGarbageCollection(); 3)System.out.gc(); 4)System.gc(); My Answers 1) C 2)B C 3) 2,3,4,5,6 4)1my doubt is with option 2- class Moodle is not using implements Remote, can't we create an object of Remote and just leave without implementing test ? 5) 1 6)4 I knew the Garbage collection is there in SCJP1.5 but, the questions will be such deeper? should we know the System class methods for exam?. I haven't seen in any books I read. Thanks megha joshi Ranch Hand Joined: Feb 20, 2007 Posts: 206 posted Apr 28, 2007 21:10:00 0 Please check the topic Topic: Can we have inner interfaces ...!? for answers... I agree. Here's the link: subject: Interfaces - 6 questions Similar Threads Calling instance method without instance Marcus exam queries Can we have inner interfaces ...!? Marcus Exam queries(posting again) Que on using super() All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/262705/java-programmer-SCJP/certification/Interfaces-questions
CC-MAIN-2014-15
refinedweb
429
62.88
calloc - a memory allocator #include <stdlib.h> void *calloc(size_t nelem, size_t elsize); both nelem and elsize non-zero, calloc() shall return a pointer to the allocated space. If either nelem or elsize is 0, then either a null pointer or a unique pointer value that can be successfully passed to free() shall be returned. Otherwise, it shall return a null pointer [CX] and set errno to indicate the error.and set errno to indicate the error. The calloc() function shall fail if: - [ENOMEM] - [CX] Insufficient memory is available.Insufficient memory is available. None. There is now no requirement for the implementation to support the inclusion of <malloc.h>. None. None. free, malloc, realloc XBD <stdlib.h> First released in Issue 1. Derived from Issue 1 of the SVID. Extensions beyond the ISO C standard are marked. The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification: - The setting of errno and the [ENOMEM] error condition are mandatory if an insufficient memory condition occurs. return to top of pagereturn to top of page
http://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html
CC-MAIN-2014-35
refinedweb
178
59.09
In this article I describe the usage of the FileSystemWatcher object provided by VS 2008 (note: This object is same as the one in VS 2005), using C#. The application created here can be used to monitor any file or directory on your system. The generated change list contains notifications for creation, deletion, update or renaming of the file/directory content. FileSystemWatcher The FileSystemWatcher object provided by .Net is a useful way to monitor a file system. Its definition is contained in the System.IO namespace. This object contains fields to mark which file or directory is to be monitored. Additionally the FileSystemWatcher object allows you to monitor a certain type of files in a directory using wildcards (eg. *.txt). System.IO new m_Watcher = new System.IO.FileSystemWatcher(); m_Watcher.Path = txtFile.Text + "\\"; m_Watcher.Filter = strFilter; The value formats of strFilter and their meanings are as follows: *.* - Watch all files in the Path*.ext - Watch files with the extension extname.ext - Watch a particular file name.ext Note that the file name.ext may not exist when the watcher begins watching. But as the file is created/moved to the Path directory, the watcher starts watching the file thereon. strFilter The following line does exactly that using various flags, each one describing a certain type of attribute of the file system. m_Watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; We can also tell the watcher to watch for changes to the sub-folders of the directory we specify in the Path by doing the following. m_Watcher.IncludeSubdirectories = true; This is done by assigning different event handlers to different activities. In the present application we have used the same event handler for creation, change and deletion. This is done because we just need to log these changes the same way, and the change name is fetched from the argument in the event handler. m_Watcher.Changed += new FileSystemEventHandler(OnChanged); m_Watcher.Created += new FileSystemEventHandler(OnChanged); m_Watcher.Deleted += new FileSystemEventHandler(OnChanged); m_Watcher.Renamed += new RenamedEventHandler(OnRenamed); Note that Renamed activity has a different handler. This is because it has a different signature for its event handler. The signatures of both the handlers are as follows. void OnChanged(object sender, FileSystemEventArgs e) void OnRenamed(object sender, RenamedEventArgs e) The change type in both cases can be fetched from the e argument as e.ChangeType e e.ChangeType This is done by enabling the watcher to raise events. This is done by the following line. m_Watcher.EnableRaisingEvents = true; Once this is done, the watcher keeps watching the assigned file/files or folders and appropriate events will be raised for their respective activities. Once the FileSystemWatcher is set to watch a file or folder, it will keep monitoring it till the end of the application. Setting the m_Watcher value to null will not stop it from monitoring. To stop the watcher while the application is still running, we need to stop it from raising events. This is done as follows. m_Watcher null m_Watcher.EnableRaisingEvents = false; The current version of this application does not work for networked drives or folders shared over the network. I will post the code with this functionality in due time. Version 1.0.0.0 uploaded on 05/31/2008 Version 1.0.0.1 uploaded on 06/01.
http://www.codeproject.com/Articles/26528/C-Application-to-Watch-a-File-or-Directory-using-F
CC-MAIN-2014-52
refinedweb
547
58.99
GenJerDan wrote:BofA wanted to charge me $30 on an ACH transfer of $50. Got back in my car, drove the 30 miles to the other bank and justed handed them the money. GenJerDan wrote:Morons. _Josh_ wrote:That's insane! My bank sms me a code which I then enter to perform an external transfer. I hope everything gets sorted out in time. AspDotNetDev wrote:Are any of you learning something completely useless for your job? _Maxxx_ wrote:I'm learning Objective-C / cocos2d programming so I can write games for the iThingies AspDotNetDev wrote:Somebody stop me before I'm too far gone (or is it already too late )! public class Naerling : Lazy<Person>{ public void DoWork(){ throw new NotImplementedException(); } } MatthysDT AspDotNetDev wrote:I'm even considering buying a MacBook Pro delete this; AspDotNetDev wrote:I'm even considering buying a MacBook Pro in the next couple months. General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
http://www.codeproject.com/Lounge.aspx?msg=4384843
CC-MAIN-2015-06
refinedweb
179
53.81
Introduction To JSON Data in Python In this article, you will learn to parse, read and write JSON in python JSON means JavaScript Object Notation. JSON was inspired by a subset of the JavaScript programming language dealing with object literal syntax.JSON easy for both humans and machines to create and understand. It is a syntax for storing and transfer the data between a server and a web application in JSON format.JSON is text, written with JavaScript object notation. A JSON text is done through a quoted-string which contains the value in key-value mapping within{ }. Nature of JSON Data in Python Look Like: Just show the sample of the JSON script. JSON is a very basic script to read every one. { "name": "Fireblaze Technologies", "age": 3, "parentCompany":"Fireblaze AI School", "courses":["Python for Data Science","Data Science Master Program","Master in NLP"], "book":{ "name":"The Monk Who Sold Ferrari", "auther":"", "genre":"Life Motivation", "best seller":"True" } } As you can see the sample JSON code, supports primitives types, like strings and numbers, as well as list and objects. Python Support JSON For JSON work in python, you can use the python module. import json Read JSON file You can use json.load() used for reading a file containing a JSON object. # JSON file f = open ('data.json', "r") # Reading from file data = json.loads(f.read()) Parse JSON in Python The JSON module makes it easy to parse JSON string and files containing the JSON object. Here, I used the open() function to read the JSON file. Python Convert to JSON string Convert a dictionary to a string using json.dumps() method. import json person_dict = {'name': 'Robert', 'age': 4, 'children': None } person_json = json.dumps(person_dict) # Output: {"name": "Bob", "age": 12, "children": null} print(person_json) {"age": 4, "name": "Robert", "children": null} You can convert many more python objects to JSON String such as, List, dict, tuple, string, float, int, True, False, NaN. Writing JSON to a File: To write a JOSN file in python, just use json.dump() method. import json person_dict = {"name": "julia", "languages": ["English", "Hindi"], "married": False, "age": 28 } with open('sample.txt', 'w') as json_file: json.dump(person_dict, json_file) Conclusion Above JSON file, we have opened a file name sample.txt in writing mode by using ‘w’. If the file does not exist, it will be created. With the help json.dump() transform sample_dict to a JSON string.
https://www.fireblazeaischool.in/blogs/json-data-in-python/
CC-MAIN-2021-04
refinedweb
402
74.29
Are you sure? This action might not be possible to undo. Are you sure you want to continue? CIETY 770 Eastern Parkway Brooklyn, New York 11213 Copyright O 1998 by J. Immanuel Schochet Published by Kehot Publication Society 770 Eastern Parkway / Brooklyn, New York 11213 . . (718) 774-4000 / FAX (718) 774-2718 e-mail: kehot@chabad.org Orders Department: 291 Kingston Avenue / Brooklyn, New York 11213 (718) 778-0226 / FAX (71 8) 778-4148 All rights resewed, including the right to reproduce this bookor portions thereof, in any form, without prior permission, in writin& from the publisher. Library of Congress Cataloging-in-Publication Data Tsava'at ha-%vash. English. The testament of Rabbi Israel Baal Shem Tov and rules of upright conduct : consisting of instructions . . . heard from the holy mouth of. . . Israel Baal Shem Tov . . . : and to those were added rules of upright conduct from the man of God . . . Dov Ber of the community of Mezhirech. Includes bibliographical references and index. ISBN 0-8266-0399-8 (hard : alk.paper) 1. Ba'al Shem Tov, ca 1700-1760-Will. 2. Wills, Ethical. 3. Hasidism. I. Ba'al Shem Tov, ca.1700-1760. 11. DovBaer, of Mezhirech, d. 1772. 111. Title. BJ1286.W6T7213 1998 296.3'C.c21 98-12351 CIP Printed in the United Sfatex !$America TESTAMENT OF RABBI ISRAEL BAAL SHEM TOV AND RULES OF UPRIGHT CONDUCT CONSISTING OF INSTRUCTIONS, RULES OF PROPER CONDUCT, GREAT AND WONDROUS COUNSELS FOR THE SERVICE OF THE CREATORRE, LATING TO TORAH, PRAYER AND OTHER TRAITS, HEARD FROM THE HOLY MOUTH OF THE MAN OF GOD, THE HOLY LIGHT, OUR MASTER RABBI ISRAEL BAAL SHEM TOV, HIS MEMORY B FOR A BLESSING, FOR THE LIFE OF THE WORLD TO COME; AND TO THESE WERE ADDED RUIES OF UPRIGHT CONDUCT FROM THE MAN OF GOD, THE HOLY LIGHT, OUR MASTER RABBI DOVBER OF THE COMMUNOIF~ M EZHIRECH [Text of the original title-page] Foreword ....................................................................... ...........i.x Introduction I The Literary Origin of Tzava'at Harivash ........................ xi I1 Basic Concepts in Tzava'at Harivash . . Deveikut ................................................................... .....m. il ... Prayer ......................................................................... m.. ill Torah-Study ............................................................... xx Mitzvot ........................................................................ ...x. xi . . Joy ............................................................................ ...m.. i Religious Ethics in Daily Life .....................................x xiv Sublimation of Alien Thoughts and Yeridah Tzorech Aliyah ...................................................m i I11 Target of Opposition to Chassidism ....................... xxxvii Tzava'at Harivash .............................................................. .......... 1 Glossary ....................................................................... ..........1. 47 Bibliography ................................................................... .......1. 55 Index of Quotations ............................................................ ..1. 61 Index of Subjects. ............................................................. ......1 67 Appendix ....................................................................... ........1. 81 A fifth edition. appearing in various studies or anthologies of the Baal Shem Tov's teachings. I acceded to many requests and translated Tzava'at Harivash into English. This. I published a new edition of Tzava'at Harivash with source-references. Menachem M. 60 and 61. cross-references. 5 and 6. A number of teachings in this work had been translated before. R. 82 and 83. 17 to 19. These include. with corrections and further additions. and other supplements. 7 and 8. Israel Baal Shem Tov (18 Elul 5458-6 Sivan 5520). 1." the text's general usage of third person was changed (in most cases) to second person. 26 and 27. at the behest of the Lubavitcher Rebbe. This English rendition follows my original Hebrew edition in the division of the text into separate se~tionsA. brief commentaries. . 13 and 14. In view of the present observance of the 300th anniversary of the birth of R.' each with further additions. for which the translator must assume full responsibility. and has already gone through four printings. Also. Careful review of the material convinced me that these combinations are more appropriate than my original division. is presently in prin t and will appear shortly. and 126 and 127. Schneerson YI~V. Even so. The only divergence is in joining sections 2 and 3. however. is the first translation of the complete text. It is most gratifying that this has become the standard edition. in line with the nature of the contents as instructions for "proper conduct and practices.In 1975. I added to each segment brief comments and explanations. 2.78 and 79.~n y translation is of itself an interpretation. the renowned R. . 11 Nissan. This will surely hasten the promise made to the Baa1 Shem Tov of bringing about the Messianic redemption when "the earth shall be full with the knowledge of God as the waters cover the sea" (Isaiah ll:9) "and they shall teach no more every man his neighbor and every man his brother saying. .. Immanuel Schochet Toronto. Ont. 5758 3. Abraham Gershon of Kitov. Indeed. from scholar to simpleton. In view of the numerous references to Maaid Devarav Leya'akov the appendix offers a comparative table of the principal editions currently in use. the mystical tradition of Judaism. and the impact of its publication. 'Know God. the Baal Shem Tov records in a famous letter addressed to his brother in-law. the inner dimension of the Torah. that it was revealed to him that the Messianic redemption will follow when his teachings "will become renowned and will be revealed throughout the world. Chassidism made it possible that everyone. externally)' . be able to taste from the Tree of Life of pnimiyut haTorah. for then the kelipot (aspects of evil) will perish and it will be a time of propitiousness and deliverance.FOREWORD where it was felt to be necessary or helpful. from the least of them unto the greatest of them" (Jeremiah 3 1 :33). J. citations of earlier sources that elucidate the contents or indicate authoritative roots for the ideas stated. the central themes that appear in it." Thus it is our prayerful hope that this work be not only a worthy noting of the present anniversary.' for they shall all know Me.' An extensive introduction discusses the literary origin of Tzava'af Han'vmh. but also be conducive in brinpng the inspiration of the Baal Shem Tov and Chassidism to an ever-widening audience. . and 'your wellsprings will be dispersed chutzah (abroad. which incorporates R. YalakovYossef of Polnoy's Toldot Ya'akov Yossef (1780). all of its contents can be found in anthologies of the Mamd's teachings. and a few additional sections in Maggid Devarav Leya'akov. and 141-143. It was preceded only by R. Menachem Mendel of Vitebsk (first published in 1911). third edition 1792). the Maggid of Mezhirech. . also known as Likkutei Amarim (1781. and sect. 113 is a duplication of sect. In fact. 62. seventy-four appear in Likkutim Yekarim. forty-three appear in the Likkutei Amrim attributed to R. and three (and with some 1. 125. Actually there are only 141 sections: sect. It is identical in form and style to Maggid Devarav Leya'akov and Likkutim Yekarim. Dov Ber of Mezhirech's Maggid Devarav Leya'akov. Note also that sect. 2. 123. thirty-three in Or Torah (first published in 1804). 42. second edition with supplements 1784. and sect. and R. Sections 102. Dov Ber. Tzava'at Harivash is an anthology of teachings and instructions attributed to the Baal Shem Tov and his successor. and Likkutim Yekarim. 51. 35 is a variation o n 42. Ben Porat Yo& (1781) and Tzafnat Pane'ach (1782).INTRODUCTION I THEL ITERAROYR IGINOF TZAVA'ANTA RNAsH Tzava'at Harivash is one of the earliest Chassidic texts to be published. 57 is a duplication of sect. To a great extent it is identical to these also in content: the major part of our text appeared already in Likkutim Yekarim. Its first edition appeared in 1792 or 1793 (no date is mentioned). R. 97 is essentially a brief version of sect. though some of these were published later: all but six' of its 1432 sections appear in Or Ha'emet (first published in 1899). Meshulam Feivish of Zborez' Yosher Diwei Emet (1792). variations another five) in Maggid Devarav Leya'akov. 75. our Master Rabbi Dov Ber of the community of Mezhirech. 31. 1. for the life of the world-to-come.5 3. Some appear also in Kitvei Kodesh (1884) and in Shemu'ah Tovah (1938). 106. 101. his memory is for a blessing. 96. because it would create the assumption that everything up to there is from the Baal Shem Tov. This appears rather untenable. 10. 101-b. nineteen sayings appear with the name of the Baal Shem Tov. rules of proper conduct." In the text itself. 47. 109. 5. 120 and 124. our Master Rabbi Israel Baal Shem Tov. 69 and 73. to the exclusion of the rest. Sect.. 100. Rabbi Isaiah. heard from the holy mouth of the Man of God. 76. Sect.. Some have suggested that the heading preceding this section may be meant for all the sections from there on. The original title-page reads as follows: "Book ofthe Testament $Rabbi Israel Baal Shem and Hanhagot Yesharot (rules of upright conduct)--that was found in the valise of . To these were added Hnnhgot Yesharot from the Man of God. 91-93. the Holy Light. when in fact both parts are of the same nature . 4. These duplications beg consideration to determine the origin of Tzava'at Harivash. 41. 17-19. Head of the Rabbinic Court and Head of the Academy of the holy community of Yanow-which consists of tzava'ot (instructions). Sect. great and wondrous counsels for the service of the Creator relating to Torah and prayer and other traits. 64-65.3 In other early sources we find attributions to the Baal Shem Tov for another five teaching^. the Holy Light.^ Explicit attribution to the Maggid appears in our text only once . see my notes on these sections in the Hebrew edition. ' Magqid Devarav Lqa'akov was edited by R. M. R. Levi Yitzchak of Berdichev."'o Kitvei Kodesh was printed from manuscripts owned by R. another disciple of the Maggid. p. R. app ear in Torat Hamaggid Mtmezhirech.. 10. compiled . the title-page of which reads: "Likkutei Amrim of the saintly rabbi. 27 sections of Tzava'af Harivash appear there as well. It is also not known who compiled Likkutim Yekarim6 and Or Torah. Israel of Kozienice.. the rabbi of the holy community of the capital Nikolsburg. the famous Holy Light. from manuscripts written by other^.. 9. Its contents are identical to a manuscript that was in the possession of R. Haberman's bibliographical list in Sefer Habesht. but the number and type of its variations and additions necessitate a separate study of its origin. as was also Shemu'ah Tovah? Likkutei Amarim (Vitebsk) was printed from a manuscript found among the possessions of R. and 2 pages of its contents. 46ff. it is indeed most likely that Likkutim Yekarim was published from his manuscripts. Darkei Yesharim-Hanhagot Yesharot. Meshulam Feivish of Zborez because he mentions manuscripts of the Maggid in his possession and his own Yosher Divrei Emet was incorporated in Likkutim Yekarim.. Jerusalem IW. by his disciple . See the publisher's foreword. Photostats of this manuscript's title-page. Menachem Mendel of Vitebsk and erroneously attributed to him by the publishers. the Maggid of the holy community of Mezhirech. 8.) is not included in our list. Yeshayah of Donavitz. See the publishers' forewords to these works. Shemuel Shmelka of Nikolsburg. attributed to R. see A. Shelomoh of Lutzk. As stated below.. See below the quotation from the introduction to Maggid Devarav Leyn'akov. 7. Menachem Mendel of Premishlan [Przemysl] (first published around 1800. Indeed. .It is not known who compiled Tzava'at Harivash. Some suspect that it is R. [7-91. and verified by. Its title-page mentions merely that this work was published from manuscripts in the possession of. Dov Ber . a disciple and relative of the Maggd. our Master R. pp. but not necessarily by him. 1' 6.. 11. Shmelka.^ Or Ha'emet was printed from a manuscript of R. This raises some questions about its literary origin. 14. (Only half of sect. Shelomoh of Lutzk. Some appear partially. in another. and edited by Sect. 15-16. A closer study of the sources. or more elaborately. note 12. there are significant omissions in some of its versions. Sect. Most duplications are generally identical. he came into possession of "a number of manuscripts written by various people. (Only part of sect. as noted above. Magqid Devarav Leya'akov.INTRODUCTION All these works contain teachings that appear in the others. or in brief versions. R. Magid Devarav Leya'akov. The first in the series of publications of the Maggid's teachings is. provides the answer." and ten that I found only in Or Ha'ernet. 76. Ze'ev Wolf of Greater Horodna in Lithuania..) 102 and 123. confusion and omissions that would require total re-writing which. Tzava'at Harivash is the only one of these anthologies that does not contain anything original. has a brief passage with similarity to sect.) 15. and completely. 101-b was printed in Tza~ta'aHt arivash. but otherwise there are but minor variations. anything that 1s not found in the others. Fortunately. 143 was printed in Tzava'at Harivash. i. 97. sect. Sect. Sect. in one text. 123 and most likely is taken from the same discourse. Generally they were full of errors. and especially copied from the handwriting of R. Its editor. 51 (duplicated in sect. he complains. would have been very difficult for him. 99-101a-b and 115. It is noteworthy that it contains two sections that I found only in Likkutim Yekarim.I4 Moreover. however. . including one15 that leaves its rendition incomplete. great 141 and 143. 58. 143. arbitrary anthologes without any order or system and (at least some) copied from one another. however.lz two that I found only in Or Torah. 113). as noted above. relates in his detailed introduction that a number of manuscripts of the Mawd's teachings circulated in his time.e. 41 (p. The differences between them (additional materials. and all his references can be found in Likkutim Yekarim. delightful discourses that I still remember. Yeshayah of Donovitz (Or Torah). Shelomoh published these manuscripts unaltered as the book Maaid Devarav Leya'akov. R.l7 It is safe to assume that the publisher of Likkutim Yekarim used his manuscript(s) to publish that work. ch." R. Shemu'el Shmelka of Nikolsburg (Likkutei Amarim-MS). ch . R. Written in 5777. R. 17 (p. 142b). Shelomoh of Lutzk The identical contents clearly indicate that all of these must have had a singular source. 19 (p. 15 (pp. R. 117b and 118a). 42 (p. Shemu'ah Tovah). ch. R. Meshulam Feivish of Zborez (Likkutim Yekarim). 56 (p. Thus we find a series of manuscripts containing identical writings in the hands of R. Levi Yitzchak of Berdichev (Or Ha'emet. 110a) and ch. Shelomoh of Lutzk (Maggid Devarav Leya'akov). 118b)..him. . R. 1 (p. Menachem Mendel of Vitebsk (Likkutei Amarim)." He mentions these manuscripts several times. Meshulam Feivish of Zborez writes in the introduction to Yosher Diwei Emeti6 (which was incorporated in Likkutim Yekarim) that he merited to attend to the Maggid and later on (after the Maggid's passing) obtained "sacred writings of his holy words. but it was impossible for me to rewrite them and to arrange them in orderly fashion. Israel of Kozinice (Kitvei Kodesh). See there ch. R. aside of the anonymous manuscripts mentioned by R. textual variations and so forth) can be accounted for by some having more or less complete manu16. as noted by the author there. 134a). 14 (p . as appears also from the fact that his Yosher Divrei Emet was incorporated therein. omissions. I found [in them] . and R. 117a) 17. Yeshayah of Yanov (Tzava'at Harivash).. Ze'ev Wolf of Horodna and R. ch. 120a). ch. 134a) and ch. his "Safrut Hahanhagof Hachasridit. and of related interest. Schneur Zalman of Liadi. published in 1772 (thus during the life-time of the Maggid). and the many hands of copyists until the respective manuscript came into the hands of the rabbis. These omissions are of two kinds: a)there is much more material in the other works that fits the theme of Tzava'at Harivash and would surely have been included if available to the editor." Kiryat S+r. He verifies the absolute authenticity of our book's contents." Zion 464. was left incomplete. 19. The manuscripts used by the anonymous editor were not the best. pp. 38). clearly indicates that the author had a manuscript containing section sect. Its editor selected passages that would form a manual for religious ethics. The wording in the criticism against the Chassidic emphasis on joy and condemnation of melancholy that appeared in Zemir Aritzim Vechorbot Tzurim (ed.scripts. They were obviously defective. and he did not decree anything before his passing. 52. pp.' and [the compil18. Jerusalem 1981. as mentioned above. in the life-time of the Maggid. 187-210. and circulated widely to the point of reaching also the hands of the adversaries of Chassidism. a principal disciple of the Maggid. Jerusal em 1977. See also Z. [Its contents] are but collections of his pure sayings that were gathered 'gleanings upon gleanings. R. 198-305. This analysis of the origin of Tzava'at Harivash19 is supported by the testimony of an authoritative contemporary. These manuscripts were already written and copied. vol.18 Tzdva'at Harivash differs from all these other works in one important respect: it is not simply a copy of one or more of these manuscripts. but an edited selection of teachings with one theme. 46 in Tzava'at Harivash. but also comments that "it is not at all [the Baal Shem Tov's] last will. as indicated in the title-page. Wilensky. . Gries. as appears from significant omissions in our text which otherwise make no sense at all. p. and b)section 143. "Arichat Tzava'at Harivash. 23." a Talmudic expression (Ta'anit 6b). of blessed memory. 21. Deveikut The central theme in Tzava'at Harivash.81. Tanya. See sect.. 3. 25. 22. sect. See below. . but also to man's mundane engagements in the daily life. It is an all-comprehensive principle. is the ultimate of Chassidism's religious values: deveikut. for the Baal Shem Tov. note 27. and later copyists omitted some parts (and perhaps added others from different manuscripts) until some late copy or copies came into the hands of our editor from which he made his selection that comprises our text. would deliver his Torahdiscourses in Yiddish.ers] were unable to phrase it exactly. 29-30. 101 and 136. It implies constant communion with God. "zO "Gleanings upon gleanings. that relates not only to prayerz1 and Torah-study=.30. and not in the sacred tongue (Hebrew).84. not surprisingly. attachment or cleaving unto God. 138a-b and 141a. . pp. means that our editor's manuscript had passed through various stages: copies were made from the original manuscript(s) of an anthology of the Baal Shem Tov and the Maggid's teachings. Igeret Hakoderh.23 Its pursuit enables man to achieve the level of equanimity by means of which he transcends worldly thoughts and con20. See sect. a vivid and overwhelming consciousness of the Omnipresent as the sole true reality. then. can and must engage in this form of communion with God. without distinction. S. In addition to the cited references see also sect. It is also universal. and cf. Sect. 12.31. Sha'ar Hatefilah. 80." i. 4 (p.) and sect. though Torah-study is in principle superior to worship. and the primary bimr (refinement and correction of the world that leads to the Messianic redemption). 41. 155aff. 82. relating to the common folks no less than to the saint and scholar.~za~v a'at Harivarh is then replete with emphasis on the significance of prayer and guidance for proper prayer and worship: 24. Kuntres Acharon. The predominance of this theme is readily understood in view of the Chassidic emphasis on prayer. 7. ch. the period of ikvot Meshichah ("on the heels of Mashiach. that it is a recurring theme throughout our text. Isaac Luria.25 Prayer The most frequently mentioned concept in Tzava'at Harivash is prayer. Eitz Chayim 39:l-2 and 47 :6. is expressly through prayer. For prayer is the most direct and most common occasion for deveikut. 27. 162a). 111 and 135. Moreover. It is the subject of over 40 sections. Every individual. Peri Eitz Chayim. 63. 10. and see below. Religious Ethics in Daily Life.. ruled: in the present era. See sect. 8 (p. .38-39. sect.V. the supreme authority of Jewlsh mysticism.26 Thus we are told that the Baal Shem Tov merited his unique attainment of spiritual perfection and his revelations of supernal matters by virtue of his prayers with great kavanah (devotion).e. 25. and not by virtue of his extensive study of the Talmud and the ~o d i f i e r sT.cernsZ4 Little wonder. See Tanya. the period just prior to the Messianic redemption) the primary service of God. R. 26. Sect. one is to attain the level of deveikut. Sect. 84.58-59.75 and 108. and through.34 Proper kavanah is possible only with personal exertion. 4. 60-61 and 72. 120. bodily movements (swaying).Prayer is union with the Shechinah. 37.30 Thus one must pray with all one's strength31 to the extent that the words themselves become alight?2 and it should be with joy33 and hithhavut (fervor. Sect. 37. 61 and 143.42 One is not to be discouraged when it seems difficult to concentrate 28. 41.58-59.68 and 104-105. 62.28 In. 40.35 Initially this may necessitate to pray out loud. though. 19 and 61. 38. Sect. Sect. 118. Sect. to stimulate leavanah26 The ideal prayer.38 This will also avoid beingperturbed by alien thoughts in prayer. 75. 34. is inaudible and immobile." The attainment of the proper state requires gradual stages of ascent. 33-35. Sect. 107-108. Sect.97 and 123. but to serve God and fulfill His Will. 32. 30. 35. Sect. and reading from the prayer-book. Sect. Sect.57-59. . Sect. 32.35. 42. 105. to spur man to greater effort on concentration and devotion. Sect.41 Special effort must be made at the very beginning and that at least part of the prayer is in proper fashion. 39.61. 68.67-70. 123 and 136. ecstasy). 33.39 Unavoidable disturbances from without are Providential.68 and 104-105. 62 and 97. 40. 31.29 a deveikut that will then extend beyond the prayers into the daily activities. 32-33.37.58.3' The focus in prayer is not to be on personal gains. prayer. 36. 73.40.42. Sect. 33. 29. the prayer that is altogether from within. Sect. 54 and 119. entreat God for His assistance and you will Torah-Study The emphasis on deveikut and prayer is not to belittle the significance and central role of Torah-study. 113 and 119. It furbishes the and is the essential antidote to the temptations of the yetzer hara (inclination to evi1). 58. 51 and 113." the Torah is God's "garment. Sect. Sect.48 Thus it must be done with joy." 47 Torah-study. See also the notes on sect." Nonetheless. ." which also offers the benefit of reducing alien thoughts. Sect. Sect.^^ and (c)the time spent on Torah-study is certainly not inferior to the states when conscious deveikut is precluded. Sect. 33-34. relates man directly with God. 45. Sect. Sect. 111. 29. 49. 30. 117. 48. 44. Sect. 46.properly: strengthen yourself and make every effort to overcome the barriers. as when 43. 29. 50. Sect. 51. awe and love. 38.(~b)~b y virtue of proper Torah-study one will be duly attached to god lines^. 29-30.46 "God and the Torah are entirely one. therefore. one must study because (a)failure to do so leads to cessation of de~eikut. 30. 51. 53. this means that one cannot simultaneously concentrate on the ultimate goal of deveikut.60-61 and 72. 47. Sect. Sect. Sect.T~o' be sure.45 It must be pursued with all one's strength and energy.50 When studying one must concentrate on the subjectmatter. 52. 51 and 113. to understand it pr~perly. Torah-study is all-important. 54. Sect. Sect. 121.84.43-44.5~ In this context one is not to limit the curriculum to theoretical studies of the Talmud and its commentaries.94-95. 56. 59. Sect. "for the sake of Heaven.46-47. but also include works of religious ethics that further fear of Heaven@-and to study these every day61-as well as the codes of law in order to know the proper observance of the law. 63." i. Sect. whether these be material or ~piritual.sleeping or the mind "falls. 60. Sect. 62. in the four cubits of Halachah. when studying Torah one must be aware that it is God's Torah. 54. failure to study Torah is a principal cause of all spiritual harms and defects. prayer and the other mitzvot must always be observed with the appropriate devotions.62 One must be very careful with the fulfillment of the mitzvot (religious obligations). Sect. 29. 55 and 126. 58. 1."58 Thus every so often one ought to interrupt the study to remind himself thereof and to attach himself unto G0d. Torah-study.. 11. Sect. Sect.73. 2-3. the lack of ideal intent can never be an excuse for not carrying out any of these obligation^. They must be devoid of any ulterior motives. 29. 64.116 and 127.^ There is an objec-. to serve God and to carry out His Will. 117.122-123. .101. 61. 119. 55.~3 Even so."55 Indeed.56 Even so. as it were. lishmuh (for their own sake as Divine precepts). 57. Sect. Sect.e. thus "before Whom you are learningn57 and that God Himself is "concentrated.20. 117. Sect. 66." The underlying principle of obedience to do God's Will assures observance of all mitzvot. Ibid. 69. is a dominant theme in Tzava'at Harivash: Sadness is a repugnant character-trait.17 and 122 68. 'The need of penitence. 46. Ibid. Sect.68 and that the mitzvot be done with alacrity and Chassidism is known for its emphasis on joy and a happy frame of mind. This. 126.t~ i~s very important that not a single day pass by without performing at least one mitzvah. 72. Sect.65 thus do as many mitzvot as you can and eventually you will perform them in proper fashion. too. without distinction whether they are major or minor. Sect. 55. Sect.73 Man must be disturbed and upset by wrong-doing and defects. 1 and 17. . 1.tive validity and value in the very act of a mitzvah. for all are equally Divine precepts that must be observed caref~l lyI. 20 and 116. and its categorical rejection of sadness and melancholy. however. 71. 70. Sect. Sect. 44 and 46. must be in context 65.7O a barrier to the service of It is a typical objective of the yetzer hra who pretends to seek man's religious self-improvement by harping on one's real or imagned shortcomings and failures in order to generate a sense of worthlessness and hopelessness?z Thus one must be extremely cautious to recognize this ruse of the yetzer hra and not fall into his trap. 67. 73. 78 One must be happy at all time^. generally spealung.~2 Even so. 56.80 with prayel-8' and Torah-~tudy. 74 with care that it be without ulterior motives. 15. 110 and 128. This implies a joyful pursuit of the service of prayer and the observance of the miavot. 82. 75. 44 and 46. 76. Sea. . Sect. 56 and 78-79. Sect. 83. Sect. 43 and 77. 84. 107-108.of correcting these deficiencies and enhancing attachment to God and observance of Torah and mitzvot.'^ especially when serving God. 45 and 107.83 Love and fear of God must go hand in hand. 81. the constant joy must be tempered by an accompanying awe and fear of God. 77. Sect. Self-improvement and self-correction may even necessitate fasting and selfmortification. or when beseeching God in momentary occasions of dire distress). Sect. Sect.76 True teshuvah (return to God) and authentic worship focus on God and not oneself. Sect. 51 and 119.44-46 and 137. 80." Thus weeping is bad. fasting and self-affliction should be avoided because they cause feelings of sadness and depression. unless it is an expression of joy (or in the context of terhuvah at the appropriate times. Sect. 79. lest the one turn into carelessness and the other into depression. 78. 44-45. 110." 74.75 notwithstanding the fact that. Sect. Sect. Sect. Sect. in context of the Divine service.INTRODUCTION Religious Ethics in Daily Life Senrice of God is not limited to rituals like Torah. i. 100. Your proper use of these items. It is only a means toward an end.. for illness of the body weakens the One must eat. 91. Sect. 80. becomes a direct cause of spiritual gain and achie~ement?~ One must be careful. redeems and elevates these sparks.% The materiality of the body is an obstructing barrier to the soul87 and its mundane desires must be disregarded and despised. Indeed.@ Thus "know and acknowledge God in all your ways. Sect. not to be drawn after the mundane. 86. however. 3. 88. 106. to be strengthened for the Divine servi~e. Thus do not eat or drink excessively. 88 At the same time.~ Moreover. the soul cannot function on earth without the body. 89. Thus one must safeguard physical health.127 and 141. God is to be served in all possible ways. The fact that physical objects come your way is a Providential indication that their sparks relate to your soul. 90. thus actualizing the intended purpose of the items?' Thus matter itself is sublimated to holiness. though. Sect. all physical entities contain holy sparks which are the very vitality sustaining them. matter and physical reality. . 6 and 9." even in your mundane engagements. in all involvements with the physical reality of man. Sect. drink and sleep to maintain health. mitzvot and prayer. Sect. and not an end in itself.e. but only to the ex85. Sect. 31. 87. 5 and 22. chomer. 92. 94.109. 10E~q uanimity and spiritual growth require selfnegation. on the spiritual reality.% Likewise. knowledge and foretho~ght.84 and 127. 5. 84. 5 and 121. and for pride or other evil character-traits to arise. 101.93 Indulgence leads to spiritual downfall. 121 and 131. Sect.99 In this scheme there is no room for sanctimonious selfsatisfa~ tion. all personal transactions must be conducted with da'at. They are like momentary departures from your true home with the mind set on returning as soon as possible?' The ideal attitude is one of equanimity: total indifference to personal delight or pleasure. Sect. Sect. 2. Sect. Sect. gener93. 1o1 Sincere humility. Sect. implicit belief in Divine providence. 97. self-deprecation. 99. 52. Sect. Sect. and total submission to God. 102. 53. Sect. 96. Sect. . 103. 95. 100. the root of all evil.98 This is achieved by constant attachment to God. and to other peoples' praise or blame. 101. and see also sea. Sect. 10. 12 and 77. 98. 98. but only as temporary digressions.% Man's thought must always be focused on God. 114. 2 and 10.lo3 Self-esteem and arrogance is a most serious offense.~E5v en the intent viewing of the mundane desensitizes and brings crudity upon oneself.IM When preoccupied with the service of God there is simply no time to think of self. Involvements with the mundane may be neccessary. is the very sign of the true servant of God. 49. 6.tent of maintaining your health. 94. Sect." but that rendition is too restrictive.lm In Tzava'at Harivash. 106. Their intrusion is especially disturbing when it occurs during prayer or other religious practices.'" This applies especially to the self-satisfaction from spiritual activities and assumed achievements. 105. corresponding to the Divine attributes known by their Kabbalistic term as the Sefirot: 1) love of something. marked by attraction. thus we used the literal meaning throughout. and separates man from God. The concept of machshavah zara is a frequent theme in Tzava'at Harivash. marked by repulsion. as well as in other early Chassidic works. whether it be sinful per se or not. For others. we find another approach: Man's feelings or emotive traits consist of seven categories.124 and 131. diversion of attention that would result in the immediate dismissal of the inappropriate thoughts. and also manifesting itself in terms of hndness. however. The literal meaning of this term is "alien thought.122. 62. does require further elaboration: Sublimation of Alien Thoughts and Yeridah Tzorech Aliyah A." One more subject. and also manifesting 104. . 74. notes 127-128. 2) fear of something. lustful or sinful thought. Sect.lo5 These are some of the central themes in this work. the reader is directed to the index.ates alien thoughts. See below. however. It includes any thought or feeling that is inappropriate to the occasion. especially for the extensive treatments of "thought" and "speech." It is often translated as "evil. 92 and 97. If this should happen. Man is often beset by such thoughts or feelings. the general advice is hessech huda'at. dependent on the others. the source of all beauty on high. 3 )recognition of an inherent quality of status. has a good side and a bad side. manifesting itself in praise or admiration. 4) the trait to endure. prevail or conquer. Ibid. and a pale reflection of. and there is the fall to "bad love" (illicit love.)lo7 These seven traits are analogous to the Sefirot because the). of the Divine attributes. Sublimation would then mean to trace the bad thought to its good source and transform it into a good thought. rather than active. Its category. such as beauty or some achievement. and so forth. 5) the trait of acknowledgment. would one pursue the mere reflection when he can have the allinclusive source? The inappropriate love of. however. (The seventh difyers from the others in that it is more passive. and attraction to107. on the other hand. are altogether holy and good. and there is the fall to "bad admiration" as in pride and self-esteem. worldly counter-parts. 108. The human traits. or hatred). and 7) the trait of governance in the sense of applying the other traits.lm The concept of the "sublimation of alien thoughts or feelings" is based on this contrariety. in Divinity. For ultimately all things are rooted in the Divine. are a reflection. Sect. and rooted therein. are like man himselE they can be holy and good or manifest themselves as the very opposite. . mundane beauty is rooted in. Thus there is a "good love" and a "good fear. then. The Sefirot. however. 6) the trait of bonding. of establishing a relationship. There is the "good admiration" of the holy and sublime. or of a restraining splendor. or love of sins) and to "bad fear" (inappropriate fear. The alien thought is bad. as it were. Why." relating to that which ought to be loved or feared.itself in terms of severity or strictness. For example. 89. too. Sect.90 and 124.in an ascent to a level transcending one's original status. by rejecting them. and in the process elevate man himself as well: there was a momentary descent to the depth of the alien thoug-h t. Sect. a'e&hmn.It0 This concept has nothing to do with the Sabbatean heresy of engaging in forbidden activities to "elevate" the forbidden and impure. The rejection of evil releases the sparks. the evil and forbidden. thus is to be traced to the ultimate source of love and attraction in holiness and transformed into a love and pursuit of the holy.87.p . both attributed to the Baal Shem Tov: Ben Porat Yorsef. Those sparks. [A proper understanding of the Chassidic concept of sublimating "alien thoughts and feeling" requires consideration of two crucial explanations. thus deprives evil of its source of vitality. Va'ayechi. Sect. Sect. infuses them with greater vitality. On the contrary: any prohibited contact with.e. and that is how evil is subdued and removed. The same applies to all other categories of thought and feeling.90. something mundane. or use of. p.22. something that is transient and illusory."' All the best intentions in using them in ways that violate Torahlaw will not consecrate or elevate them. can be released and redeemed only by relating to those objects as prescribed by the Torah. 85b). contain holy sparks that enable them to exist. It requires Divine assis109. . 64. 9. and Me'or E i ~ y i mV. i.jw That is how the alien thoughts are elevated and sublimated to become holy. 120 and 127. There is a real danger that engaging in sublimation may be counter-productive and lead astray..101-b. but they do so with the warning that it is hazardous. 85a (and see there also p. forbidden objects. 112. culminating. thus empowers and enhances the forces of evil and imp~rity. however. 14.INTRODUCTION ward. 62b-c. 110. 87.'~~ Chassidic works present the principle of sublimating alien thoughts.] 111. To be sure. or engagement in illicit activities. "subduingn with total divestment of self or any personal attachment. These initial steps are earmarked by a profound sense of dread. and the wise will be silent!" R. All others must put their efforts into praying more intensely.e. 29c). Toldor Ya'akov Yorrpf. Addenda. sect. After explaining the principle of sublimating evil and alien thoughts in context of Divine Providence. 160. and see the re also par. 118. 115. 629a). 13. 163 and 302.tance as a safeguard. the "sweetening" of the forbidden thoughts (i. and havdalah. suggesting that this is an esoteric teaching that is not meant for the average person lest it be abused. see there. Ben Poraf Yossef. that the person is overcome by a gripping fear of God. The Baal Shem Tov states that the sublimation of alien or extraneous thoughts requires huchna'ah. Cf: Shabbat 153b. 228. sect. one praying with hitlahavut. huvdalah and hamtakah. Sect. 15 and 16 (p. 87. a separation from any linkwith the realm of evil. Eikev: I (p. who recorded these teachings of his master. Toldot Ya'akov Yossef.. he notes: "Sometimes. In oneU6 he adds the verse "It is the glory of God to conceal the matter" (Proverbs 25:2). 729b-d). 28. 277.l15 In at least two other instances we find that the Baal Shem Tov adds cautionary qualifications to this principle.. All this is cited in k2fer Shem Tov.114 These qualifications are reiterated more emphatically in other texts. end of Lech Lech (p. is to engage in sublimation. how113. Sect. 140. Note also Maggid Devarav Leya'akov. Eikev: I11 (p. 632a).e. Toldot Ya'akov Yosef. Harntakah. 116. t17. 731b). i.117 In the other118 he adds the conclusion: "To dwell on this at length involves danger. their complete separation from the kelipot. Yaakov Yossef of Polnoy.1'3 Only the enthused person. can follow only after an initial huchna'ah. sect. their sublimation to holiness). 25 (p. the Baal Shem Tov. par. . and Or Torah. 114. is more explicit. then see to bring it near and sublimate it. Magid Devarav Leya'akov. You may ask. for 'if one comes to slay you. love."li9 R. but in truth he is removed. 50c. relates only to a tzadik who is to elevate them to their spiritual source.' (Song 2:7. If the means to correct and elevate the alien thought will arise in your mind immediately as it comes to you. 98. One must never introduce them on his own: "If one will say. cited in Ke&r Shem Tov. they entered the mind beyond the person's control. 'how will I know which thought must be repelled. sect. too. sect. and Or Torah. or b)they are rooted in the cosmic "breaking of the vessels. sect.ever. relates the principle of sublimation to the premise of Divine Providence. cited (partially) in Keter Shem Tov. 213." 119. sect. the Mamd of Mezhirech and successor of the Baal Shem Tov. Ben Porat Yon4 Toldol. 207. p. however. . He thinks that he is close. which now offer an opportunity to be corrected. the means to correct it will not arise immediately in the mind. 120. It is then permissible to repel that thought. 'I shall intentionally meditate to bring about [an alien thought ofj love so that [I may] elevate it. [this] thought must be repelled. sect. he is distanced from God. also in Likkutim Yekarim. If.' of him it is said 'That you awaken not. In one lengthy discussion1z0h e traces the occurrence of alien thoughts to one of two sources: a)they may be a reflection of the person's evil deeds in the past." independent of the individual. however. of blessed memory said of this that 'he who wilfully excites himself shall be under the ban' (Nidah 13b). and which is to be brought near and elevated?' [The answer is:] Man must consider [the following]. In either case. 115 (which has significant variants). 39. however. until it please. that is. it may be assumed that [the alien thought] came about to disturb man in his prayer and to confuse his thought. 3:5) Our sages. forestall [by slaying him]' (Sanhedrin 72a). The latter. Dov Ber. nor stir up. lit. as in the case of an alien thought in the midst of prayer. 231. and Maimonides. continuously ascending from level to level with deveikut and hitlahuvut to the point of their thoughts being attached to a level that transcends all worldly matters. however. sect. par. 277. analogous to Elijah on Mount Carmel: he brought offerings there in spite of the prohibition of sacrificing on bamot (altars outside the Holy Temple in Jerusalem). . Cf Maaid Devarav Leya'akou.This distinction appears again in the Maggid's interpretation of "Ikvotecha (Your footsteps. see Rashi there)." i. Hikhot Yessodei Hatorah 9:3.122 The Maggid identifies those to whom the principle applies. as opposed to all others. It is crucial. They merit Divine assistance In purifying even their physical and material aspects. They are pious people immersed in Torah-study. sect. 122. Sometimes.. You 121. This. they are without intent. Or Torah. 'That is the meaning of "ikvotecha were not known. 175. and attached to. This means that in the case of sublimation there was a time when that thing had to be elevated. 228. sect. and Or Torah. however. Alien thoughts occur to them in their prayers or studies (when they are immersed in. Yeuamot 90b. See Sije.e. though. these can ascend. l21 because he had to elevate the whole generation that worshipped idolatry. 'the mark of your heels') were not known" (Psalms 77:20): eikev (heel) refers to the lowest levels. The term sha'ah is an expression of "let them not pay attention to false words" (Exodus 5:9. Of these people he says: 'You are not like the other people whose alien thoughts come to them from their own thought that is not purified from physical matters. that one do not think the alien thought intentionally. Shoflim. is an aspect of hora'at sha'ah (a temporary decision or dispensation). holiness) in order that they may be sublimated to that holiness. then it is most certain that he knows 123. Surely you understand this on your own. sect. when you are beset by an alien thought you can elevate it to h0liness. cited (partially) in Ket er Shem Tov. and 94dJ)."'2~ The Maggid's disciples spell out these warnings in most explicit terms. 28 (p. ch. and Lo Ta'aseh 41. 124. Vqigash.. Menachem Mendel of Vitebsk. Meshulam Feivish of Zborez writes: "This should be your rule. .who walk in my statutes. R. to whom [an alien thought] occurs of his own making. 207.3:4-5. 13b-c. ed. R. as is well known. Dov Ber. 6-8. Tzvi Elimelech of Dinov cites this passage repea tedly in his Derech Pikudecha (Hakdamah VII. base self-glorification. For if one is attached to materialism and desires.. and there are but few who can compare themselves to him and act as he did.e.3:5. Pen' Ha'aretr. sect. They see there that he writes in a number of places. for those things were meant only for tzadikim to whom alien thoughts do not occur of their own making but those of others. and willingly derives pleasure from them. and likewise with evil fear. 118.. par. This derivation can be applied only by one who is stripped of materialism. he is not to take notice of them but immediately avert his mind from them. Tanya. have become disclosed to various people. Likkutim Yekarim. Or 'Torah. But he. Lo Ta'aseh 35. in [the study ofj Torah or in devout prayer. of blessed memory. from the aspect of evil in his heart . Lemberg 1921. R.. 123. sect. how can he elevate it when he himself is bound [there]. See also R. but the writings of that holy man. i.. Schneur Zalman of Liadi writes: "If there occur to [man] lustful imaginings or other alien thoughts at the time of worship. 86c. sense of triumph etc. down below! "124 R. 35a). pp. He should not be a fool and engage in the elevation of the traits of the alien thought. even minutely. that from the evil love that occurs in man he can attach himself to the love of the Creator. nothing of the love of the Creator."'~~ 125.. and will thereby be bestirred to a greater love of the Creator and fear of Him. 126. He must push off and lull [that thought].. nor of the fear and glorification of [God] etc. 128. of blessed memory. then evil thoughts will never occur to him. never to blemish by speech or act . note 120). imaginings will occur to him on account of his own evil: they are altogether evil and will not be corrected.. But he who is not guarded in his spirit and soul. . and ch.. he is counseled to extract the precious from the vile .d. David Shelomoh Eibeshitzlz6q uotes at length this principle as taught by the Baal Shem Tov and reconciles it with the seemingly contradictory ruling of Maimonides127 and the Shulchan Aruch'28 which ordains immediate dismissal of evil thoughts and directing the mind to words of Torah: "Both are true. as stated by the Baal Shem Tov. Man must examine himself. Heaven forbid.. ch. he will fall into a deep pit if he will not watch himself very much.. . Heaven forbid for him to dwell on these thoughts even for a moment... on Genesis 21:l-2 (ed. i. Wolf of Tsherni-Ostrow (a leading disciple of the Maggid) and R. n.. 18. If he guards himself very carefully not to blemish the aspects within his control. sect. The thought that will yet come to him [in spite of himself] occurs for the sake of correction. and author of Levushei Serad (a prominent commentary on Shulchn Aruch) and the classic Ami Nachal. Only he who is divested of materialism and none the less it happens occasionally that an evil love or an evil fear awakens in his heart . See there also the sequel (based on the sources cited above. 240.. with his words and deeds. i. 39c). Hilchot Issurei Bi'ah 21:19.. Yosher Divrei Emet. Meshulam Feivish of Zborez. Warsaw. 17 (p. 118b). 127. 129."125 R. Arvei Nachal.. cited (partially) in Keter Shem Tov. thus it is not to be repelled.e. Vayeira. as stated by Maimonides and the Shulchan Ar~ch.e. p. Disciple of R. Even Ha'ezer 23:3. Ma& Devarav Leya'akov.. however. So. sect. He should not be afraid [that this means] that he is removed from [God]. Zohar I:237b 132. however. Maggid Devarav Leya'akov. sect. deveikut in general and his status in particular. 'For a tzadik falls seven times and rises up again' (Proverbs 24:16): his very fall is but for the 'rising. which is called a descent. the tzadik falls only for the sake of ascending. 10 and 235.' (ibid.' as it is written. thus lowering themselves from their level in order that they may ascend. into the depths [of the sea]. .' the waves of the sea: 'those who go down to the sea' (Psalms 107:23). for God is present even in those deeds. 248.). and inconsistent wlth. be130.' i. that [as he re-ascends] he will raise additional sparks along with himself. He appears to engage in idle talk and inconsequential actions like the average person: "The tzadik will sometimes fall from his level. this principle is cited in the more delicate context of the tzadik's "fall" to levels.." This concept relates to the principle of sublimating alien thoughts: "'Many waters cannot extinguish the love. 131. but this descent is for the sake of an ascent. situations or behavior that seems removed from. sect.B. The selfsame distinction applies also to the concept of "Yeridah Tzorech Aliyah--descent for the sake of an ascent. 336. is not a real 'fall."13? "The tzadik. Or Torah. This. who is in a continuous state of deveikut. This is the meaning of 'he crouched and lay down like a lion' (Numbers 24:9)."l30 More often. they have seen the deeds of God.' (Song 8:7) Alien thoughts are referred to as 'many waters. and cf: there als o sect. too. to raise sparks along with himself. 'they do [their] work in many waters. 177.e. sometimes experiences a cessation of the deveikut. . as it is said'"' that a lion goes down (crouches) only to seize prey [that he smells from afar]. ) that this relates to various levels and aspects. 113. but is afraid that he will be unable to ascend from the pit. 64 and 96. so that matter is transformed into form. and when he went to the land of the Philistines. See sect. Toldol Ya'akov Yost$ Vayeira:I (p. as Nachmanides comments (ad loc. prior to de . sect. The descent is for the sake of an ascent."l36 133. from now on I can enter [the pit]. cited (in amended wording) in Keter Shem Tov. 427. lest he remain there. What did he do? He tied a rope above the p~ts.' So. 59a-b). as the Baal Shem Tov said that there are many who remained [below]. 90 and 396. and Or Torah. 134. "135 There is a clear emphasis in practically all references to this principle that it applies only to the tzadik. 'As I made this bond. This is the meaning of 'That man do [the mitzvot] and live by them' (Leviticus 18:5).a ying. thus found it necessary to voice caution and qualifications: "The ultimate intent in man being created with matter and form is to refine the matter. he [first] attached himself to the faith. illust rating the point with a parable that appears in Zohar 1:112b: "When Abraham descended to Egypt. with Abraham: when he wanted to go down to Egypt. The Baal Shem Tov and the Maggid were fully conscious of these. 488. however. too. One aspect is that after ascending on high one descends again in order to elevate the lower levels. sect. Every descent. the spiritually accomplished person who is firmly fastened to Above to assure that he will ascend again after the "fall. Heaven forbid. sect. 136.cause this may possibly happen to him in order to attain a level that is yet higher and excelling. Note carefully Likkutim Yekarim. the being distanced is for the sake of coming This concept appears in our text as It should be quite obvious that it is filled with serious implications. Or Torah. 135. [This is comparable] to a person who wants to descend into a deep pit. sect. requires caution to re-ascend. 137. One is not to be.. and if he were to do so he will fall and not rise. blessed be His Name. I [God HimselfJ.Moreover. cited above (re note 133). of Shemot." or "sometimes falls. Mechilfa on Exodus 12:12 and 12:29. it is not an intentional fall or descent. I. and not a seraph. and Degel Machaneh Ephrayim. and not an angel. "138: Egypt was a place of impurity to the scending there.e. but just happens by Divine Providence. like those licentious ones who say that man must make himself descend to the lowest level and then ascend from there. A number of people left the faith on account of such!"' "It follows that man must be continuously attached unto [God].e. Heaven forbid. In other words..)i. cited in the Haggadah for Pesach. But it is beyond human ability." indicates passivity..' (ibid. the consistent expression of "when he falls.. . i. "These matters are too lengthy to be explained. with reference to "'I shall go through Egypt' (Exodus 12:12)-i. Thus it is explained in the Zohar (I:117a). The very same qualifications relating to the sublimation of alien thoughts apply equally to the general principle of yeridah tzorech aliyah.' exclusively for the sake of God without any ulterior motives). and then he descended there. This must not happen [among the people of] Israel. 'and I will smite . yeridah tzorech aliyah.e. 138. Cf: the Baal Shem Togs warning. he must quickly restore himself to the higher level. If he should fall from his level.." Cf: also the similar passage in Zohar I:81b. he first tied the bond of the faith to be strengthened by it. Heaven forbid. The Maggid spells this out in sharp and unequivocal terms: "In all matters one is to serve God continuously [in a mode of] avodat gevohah ('for the sake of Above. cited and explained in our context in Tddot Ya'akov Yo& NassolXVII. as in the case of alien thoughts that are to be elevated. beg. and nothing can interpose before Him. 202. i. Their criticisms against Chassidic teachings refer specifically to Tzava'at Harivash and they had public burnings of the book140 Two reasons may account for singling out this work: 1) Tzava'at Harivash is a very small book It may even be called a pamphlet. p. 'and you shall not be below' (ibid. because most of its teachings appeared already in those earlier books. and the brevity of its individual teachings. I. pp. Thus one cannot ascribe to it special significance. on the lower level. but was printed later than the works of the Mawd and R.e. The light of the Holy One.252.. [9]). 140. Nonetheless. The first editions consisted of 48 small pages (including the title-page). Likkutei Amarim-MS. the smallness of the book as a whole. 182. i. penetrates everything. to serve God on the level of 'above' (the high level). on the level of 'below7i. Ya'akov Yossef of Polnoy. Moreover. however. as stated Tzava'at Harivash is one of the early publications of Chassidism.. however.). This. Likkutei Amarim-Vitebsk.e. vol. Heaven forbid.e. allowing for wide distribution. approximately 3 by 5 inches. "Thus You shall be only above' (Deuteronomy 28:23). blessed is He. Jerusalem 1970. 25bE.. is not in the power of man. . p. Chidim UMitnugdim (a study of the controversy between them in the years 1772-1815). Wilensky. make it a very read139.267 and 289.point that that if an angel had gone there he would have [become and] remained defiled. 201. it became a primary target in the attacks by the opponents to Chassidism. of R. See M. Thus it must have been quite inexpensive. Shmelka of Nikolsburg L14 (facsimile of this passage appears in Torat Hamaggid Mimezhirech. 38. See also Shever Poshim. Petersburg (see below. 143. p. 306. 2) Tzava'at Harivash is a specialized anthology of Chassidic teachings. note 161) and published in Kerem Chabad El.'" More specifically. 44-46 furthers illicit frivolity. See the bibliographical list appended to my Hebrew edition of Tzava'at Harivash. sect. p. that it gained great popularity: there were at least seven editions between 1792 and 1797!141 This must surely have concerned the Mitnagdim (adversaries to Chassidism) and aroused their ire. 145. then. 142. and 4 ZernirAritzim Vechorbot Tzurim. Thus it became the logical choice to be a prime target for those who opposed Chassidism. Sefer Viku'ach. Chassidim Umitnagdim. Kfar Chabad 1992 (henceforward abbreviated as KC). Our text can then be seen as an easily identifiable manifesto of Chassidism.able text for friend and foe alike. the founders and leaders of the Chassidic movement and Chassidic philosophy. p. and from the documents recently discovered in the archives of the prosecutor-general in S. pp. p. Israel Baal Shem is . "instructions and rules of proper conduct. Little wonder. 300 and 307f: 144. Zemir Aritzim. Depositions of Avigdor Chaimovitch (henceforward: Avigdor). 135. Ibid. 212. It addresses the masses no less than the scholars. 45 (as well as 141.. It is a manual for the religious life and observance of the chassid. 212: "In the books of R.~~~ (b) The segment of sect. p. The adversaries' accusations against the teachings in Tzava'at Harivash are as follows:142 (a) Sect. 41 is a denigration of Torah and Torah-st~dy. 2498 Note also Zrmir Aritzim. It consists of pericopes that present explicit guidance. Wilensky. p. unlike the earlier texts that were much bulkier and much more intricate. 44 errs in dismissing depression and in calling thoughts leading to depression sect." taught by the Baal Shem Tov and the Maggid. The synopsis following is culled from the writings of the adversaries that were published in M. Ibid. 108: to say that in prayer one becomes unified with God is unfounded "worthless illusion^. 38. p. aside of the fact that erotic metaphors are common to all Kabbalistic writings. 87: i. 312. 154. p. 298 and 312. in stating that one is to love and fear God alone.15' (g) Sect. iii. 273. Sefer Viku'ach. To say that one need not fear anything but God is absurd and contradicts Scripture. 96).'49 (e) Sect. Avigdor. 74 is a denigration of Torah-study and the normative religious lifestyle. 214. p. 82. 147. pp.sect. 1601: 150. in relating the Divine glory to creatures. suggests anti-nomianism. p. p. pp. 153. some of the very same terms that the adversaries objected to are used by the Gaon of V11na in his commentaries on the Zohar! See KC. To say that everything happening to man is by Divine Providence is to justify all wrongdoing and to exempt all wrong-doers from punishment. It is noteworthy that. 127 errs i. if that had been the sole content of his books. 83.'54 (j) Sect."'^^ (h) Sect. and in KC. 310f: 151. Shewr Poshim.146a nd sect. 107) errs in dismissing weeping in prayer. to identify speech written that it is forbidden to bring depression upon oneself. p.. To say that a Divine life-force is vested in all beings. Sefer Viku'ach. ZemirArittim Vechorbot Tzurim. Zemir Arifzim. 120 is blasphemous for stating that the Shechinah is vested in all human beings. p. ZemirAritzim. and in KC." 146.. Cf. and in KC. 306 and 309. 68 is crude imagery leading to licentiousness. 46 suggests anti-nomiani~m. p.153 (i) Sect. pp. 10Y and 108. Sefw Viku'ach. dealing with yeridah tzorech aliyah. Ibid. In truth. in stating that there is a Divine emanation in all beings. and iv. 249f. 149. [they] would already deserve to be cast unto fire to be condemned to burning. ii. 83. p. p. 248f. 152. Sefer Viku'ach. iii. p. . 64 (as well as sect.(~c)~ S~e ct. pp. is blasphemy. 248 and 274. and in KC.'" (d) Sect. including animals. and 273. 148. ii. 306. pp. Avigdor.19 (f) Sect. 83. 109 furthers licentiousness and anti-nomianism by suggesting the indulgence of all desires. p. pp. This statement thus proves that "they are of the cult of Shabbatai Tzvi. 246J and 274.with the vital force of God inherent in man is a blasphemous attribution of man's lies and evil speech to God." iii. 83. p. 14%. p. p." KC." because it assumes that the Messiah has come already.I57 though without a specific reference. Avigdor. ii. 137: i. 82. Schneur Zalman for his response.. and in KC. there is an implicit attack on the concept of sublimation of alien thoughts. Eight of the references cited above appear in the slanderous accusations before the Czarist regime by Avigdor Chaimovitch of Pinsk against R. Mundshein. "Kinat HaMitnagdim Leminhagei Ashkenaz. 157. To say that one must always be "merry and joyous" is wrong. Thus "one cannot establish this lund of trust in God. Ibid. and the second one was to be given by them to R.U. There are notable differences between the two: Avigdor is much more careful with the 155. 143 explains a notable difference between that text and the Ashkenazy one.I55 (k) Sect. 244f and 246. p. because rejoicing is restricted to the celebration of the festivals in the Holy Temple. 158. p. See also Y. S. and in KC. 308.158 The over-all criticism by the Mitnagdim of the Chassidic adoption of the Lurianic-Sefardi liturgyt59 also touches upon Tzaoa'at Harivash. Avigdor submitted two depositions: the first was addressed to the authorities. Shewr Poshim. for sect. To believe that "the kindness of God dwells upon man and embraces him" contradicts Scripture which relates that Jacob was afraid in spite of the Divine promise to be with him everywhere (Genesis 28:15). See above. 151ff . pp. Sefer Viku'ach. To say that "man sees God and God sees man" is a blasphemous ascription of corporeality to Not surprisingly. 156. 159. Schneur Zalman of Liadi. Sublimation of Alien Thouglits. and is not allowed even in prayer. implicitly answers also most of the criticisms against sect. sect.I6O R.criticisms in the second deposition. analyzing the relevant principles in great detail. Even so.'~~ 160. This is a common feature in many of the early writings of the Mitnagdim. p. vol. 87 in the court-~ase. Schneur Zalman exposes these distortions. p. 161. p. and brought about his acquittal and liberation from imprisonment. R. there is a consistent thread of misquotation and distortion running through both. p. vol. Mundshein. Schneur Zalman's submissions appear now also in Igrot Kodesh-Admur Hazaken. 25 (pp. 39-62 and 140. vol. except for the first two charges. 120 was again submitted to R. Tanya. 273J). Schneur Zalman's responses only the last two were known and published (ibid. They include also Avigdor's original Hebrew deposition (the second one). 158J Sefer Viku'ach is a notable exception to this. Schneur Zalma n's letter to the Chassidim in Vilna. Of R. and a Russian translation of all. and offers clear and convincing explanations which vindicated Tzava'at Harivash and the Chassidic philosophy. Igeret Hakodesh.. Recent research discovered the files of this case in the archives of the prosecutor-general in Petersburg. 11. omitting many of his alleged refutations. He must have realized that they were blatantly absurd. Igmt KodeshAdmur Hazaken. Schneur Zalman. pp. Schneur Zalman and signed by him. 138a-142a). All but the first two were known and published (Wilensky. All this has now been published in Kerem Chabad IV:I. in Hebrew translation where necessary. I. 200). written in 1797. 88 (also in Wilensky.161 The criticism of sect.. thus easily dismissed. see Y. These include these last two answers in the original Hebrew handwriting of R. as well as the Russian translation of all his answers. I. . including photostats of the originals. Avigdor's second deposition has 19 accusations against Chassidism and R." ibid. vol. His elaborate response. Schneur Zalman in a private (and apparently friendly and respectful) communication from Mitnagdim. 162. Cf: also R. p. "SilufDivrei Chassidur. 87 and 127. 277). I . It overlaps in many respects with his lengthy response on sect. TZAVA'AT HARIVASH THE T E S T ~ N T OF RABBI ISRAEL BAAL SHEM Tov . whether it be a "minor" or "major" mitzvah."2 It is essential not to forget the matters [of Torah and Mitzvot] . Do not allow a single day to pass without performing a mitzvah. On the importance of studying musrar. lb)." He did not leave a "last will* in writing or in words. 2. The wording is reminiscent of the Biblical phrase "[But take heed and watch yourself greatly lest] you forget the matters [that your eyes saw. see also below. a light or illumina tion of its own that is effected by the performance of a mitzvah. and perhaps alludes to it.e.. no. blessed be He." i. 3. It does not appear at all in Kekr Shem Tov (p. reading: "It is essential not to forget to study musrar every day. R. 117." Our rendition. and so forth. To perform many mifzvot on one day cannot make up for the lost opportunity . Bachya Ibn Pakuda's Chovot Hakvovot. sect. peace be upon him Be complete in the worship [of God]. Eliahu de Vidas' Reishit Chochmah. The sentence is not very clear. 4. . 2. This is not the Baal Shem Tov's testament in the sense of "last will. Israel Baal Shem. whether much or little. and no less so the pervasive musrar found in the Zohar.5 This is 1. with the bracketed words. The emphasis is on daily acts. follows the interpretation in Be'urim Befzaua'at Hariuash. R.' It is essential to study mussa14 every day. Avodah tamah is a Talmudic expression (Yoma 24a) denoting a form of service that is complete in itself without any further action required for its completion. Strive continuously to cleave to good traits and upright practices.. This would refer to texts like R.1 Testament1 ofR. Tzava'ah here means "instruction . Works of moral guidance and inspiration. Every single day is an important entity on its own. [that it be] a "complete service. Thus it requires something concrete to show for itself. 198) it is combined with the next sentence. In Likkutim Yekarim (no.. 5. instructions and guidelines taught by the Baal Shem Tov for the ideal religious conduct. lsaiah Horowitz's Shemi Lurhot Habent. .]" (Deuteronomy 4:9-lo). CJ below. 6." (Likkutim Yekarim. Sanhedrin 106b). 2. that man's heart should seek the Merciful . ch.indicated in "Be zahir (careful." See also below. SJm'ar Yichrd Hama'aseh. Bachya ibn Pakuda (Chovot Halevovot. Whatever may happen. For [with this perspective] the yetzer hara is entirely removed from you. and if it is proper in His eyes. 2-3 "Shiviti-I have set God before me at all times. equal.. too.. sect. and so. sect. Our proof-text . the belief that every detail is controlled by Divine Providence. 91. Cy Zohar 1:129a and 224a on thc significance of each indjvidual day. it. for "The Merciful seeks the heart" (Zohar II:162b. The notion of equanimity i s a fundamental principle in the pursuit of authentic religiosity and piety.6 of another day. see there. it is all the same to you. R. say that "it comes from [God]. whether people praise or shame you." (Daniel 12:3). sect. no. 84. 6. This applies likewise to any food: it is all the same to you whether you eat delicacies or other things."2 Your motives 1. with anything else. "The Merciful seeks the heart. . 93 and 127. . 122. 10. blessed be He. Shiviti is related to the root-word shaveh. Equanimity follows logically from a profound sense of hashgachah peratit. 17[a]. 106) To the seeker of God there is no difference between "majorn and "minor" mitzvot: both are commands of God and effect refinement and illumination of the soul." (Psalms 16: 8) Shiviti is an expression of hishtavut (equanimity):' no matter what happens. 5) calls it the "ultimate of the most precious levels among the rungs of the pious. This implies that the soul will shine and glow from a "minor" mitzvah even as it does from a "major" one. Note: this paragraph has an explanatory sequel below. For [the word] zahir is an expression of "They that are wlse yaz'hiru (shall shine). scrupulous) with a 'minor' mitzvah as with a 'major' one" (Auot 2:l). . Do not be disturbed by this. 4.. and your thoughts shall be established. sometimes in one manner and sometimes in another. sect.94 and 123. . 22. The realization of hhgachahperatit.e. note 2. Nonetheless. and as for yourself nothing makes any difference. for the realization of the ultimate perfection of the spiritual reality underlying physical reality: "God has made everything for His own purpose. in order that you serve Him in that alternate way. i. An important rule: "Commit your deeds to God." (Proverbs 16:4) Cf: below. This means the following: Sometimes one may walk and talk to others and is then unable to study [Torah]. This [sense of equanimity] is a very high level. thus reads: "Shiviti--everything is equal to me [because I realize that] God is before me at all times. because everything is "required [for Above].e. blessed be He. you must realize that whatever happens is from [God]. See below.4 So also when on the road."' God wishes to be served in all possible ways..are altogether for the sake of Heaven. serve God with all your might. i. For God wishes to be served in all possible ways. 2.' 1. Yichdim (unifications) is the Kabbalistic concept of effecting harmony in the totality of creation by "connecting" (unifjring) things to their spiritual roots.75." See below. see above. 3. thus unable to pray and study as usual. sect. lit. "for the need of Above. That is why it happened that you had to go on a journey or talk to people." (Proverbs 16:3) That is. sect. 11 and 73. sect. Tzorechgewha. Also." This is the mystical term indicat ing that everything in creation is to be for the Divine intent. 4. you must serve [God] in other ways. you must attach yourself to God and effect yichudim (unifications). Our sages. thus said that "sight leads to remembering and to desire. Think that you belong to the Supernal World and all the people dwelling in this world should not be important to you. of blessed memory. In turn. to gaze at the tzitzit (ritual fringes on certain garments.See to it that you request from God always to visit upon you that which God knows to be for your benefit. sect. 'lh view something good or holy has positive effects.. Hikht De'of 3:2 and ch. therefore." (Commentary of Rashi on Numbers 1539) See also below. 69). lead to wrongful actions in their pursuit: "The eyes see and the heart covets. the slght of it made it desirable.2 For it is quite possible that what IS good in your own eyes is really bad for you. 84 5-6 Attach your thought to Above. sect. 4. For example. and the body commits the sin. Cf: below.' Do not eat or drink excess~ vely. 1. positively or negatively. 2. 8 and 24.. and $ sect. as opposed to the mundane. 3. Thus commlt unto God everything. but only to the extent of maintaining your health? Never look intently at mundane matters. . nor pay any attention to them. sect. will be attached to spirituality (see below. as opposed to that which appears to be so to the human mind. as it is written "you will see it and remember all the commandments of God and do themn (ibid."' and ~t is written of the Tree of Knowledge that it is "desirable to the sight and good for eat~ng"(G enesis 2:9). a11 your concerns and needs. i. verse 39). so that you may be separated from the physical. See Maimonides. the focus of your thought should always be on the supernal spirituality . to gaze at the physical and mundane will arouse desires related to it and. and below. I. Thus you yourself. Intent viewing of the mundane brings crudity upon oneself. sect. 50 and 90. too. sect.e. 121.e. Man is affected by what he sees. 2. ordained in Numbers 15:38#) will lead to observance of mifzvot. 2. Cf: above. that the body is evil per 5e. (Shechinah is always referred to in feminine gender. 5-6. sect. Thus it is not equivalent to the serpent but only to the "slun of the serpent.. The phrase is from Tikunei Zohar 21:48b. As man attaches himself to God through mitzvot and communion. its external aspect. because he is broken-hearted." i. . The physical body seeks physical pleasure that defiles and leads astray. it takes precedence to all prayers of the world.e. when praying. Say constantly in your mind: "When will I merit that the light of the Shechinah abide with me?"3 1.. allowing man's freedom of choice to do good or evil (see ibid. It is the outer garment to the soul. and will be recei ved favorably before the Holy King. and it is written. "Which is the most excellent of all [prayers]? It is the prayer of the poor. his prayer ascends. a person should make himself poor. As such it is an a dmixture of good and evil. 'God is near to the broken-hearted' (Psalms 34:19). for their love or hatred means nothing... Be indifferent to others loving you or hating you. allowing the soul to function in this world with the performance of mitzvot. When a person. the Divine "spark" and lifeforce (vitality) in all creatures.. do not pay any attention to the desires of your filthy body which is a "leprous thing from the shn of the snake.-The term Shechinuh signifies the Divine immanen ce and presence throughout the world. will always make his will as that of a pauper. 67:98a) The Zohar (III:195a) states that one's will is to be like that of a pauper. Thus. Likewise. note 1.For the whole of this world is but like a granule in relation to the Supernal World."4 4." 2. the light of the Shechinah becomes ever more manifest to him. even as the original serpent enticed Adam and Eve... Your thought should always be secluded with the Shechinab: thinking only of your continuous love for Her that She may be attached to you.) 3. This does not mean. See above. however.' Thus consider yourself like a pauper and always speak with soft and beseeching words like a pauper. even In thought. remove them from your mind. (CJ Shenei Luchot Haberii. sect. ed. to utilize it for matters of holiness. note 8). p. sect. 43. . as explained below.. "rejoicing in the suffering" (Shabbat 88b)..e. may He be blessed. Bet David (cur. 5-6."~ 1. and thus you will subdue them? Do not be depressed at all from not having mundane desires.) 3.When beset by mundane desires.e. See Berachot 5a: "Man should always incite the yetzer tou (good impulse in man) against the yetzer hra (evil impulse in man) [i. "Siira achara-the other side." as oppo sed to the "side of holiness.. Rashi]. ke1ipot)-husk@). shell(s)" (analogous to the crude husk that encompasses the edible fruit) is the mystical term for the realm or forces of evil and impurity. as it is said in the Zohar (1:lOOb): "'A pure heart' (Psalms 24:4) is the one that will not let his will and heart be drawn after the sitra a~hara. See above. Scorn the desire to the point of it becoming hated and despised by you. 4. i. On the contrary.e. to wage battle against the yetrer hara. When you are not drawn after your desire. 79). and 4 sect. and scorn it." To do so." It accords with the Baal Shem Tov's interpretation of "Who is strong? He who conquers (subdues) his [evil] impulse" (Auot 4:l): the yefzer hra is not to be destroyed but conquered. rejoice exceedingly for meriting to subdue your passion for the sake of the Creator's glory. to harnes s its energy for good. In turn. as it is written 'Tremble (incite) and sin not (or: and you will not sin)' (Psalms 4:5). also ibid." i." Sinful thoughts and acts vitalize and strengthen the sitra uchra (see below. Our sages said of this. helps subdue the personal yetzer hra and the power of evil (that is concentrated in worldly pleasures) in general . overcoming and subduing such thoughts and temptations subdues and weakens the kelip~t (see below. 36b. 16b. Note the term "subdues. "Kelipah (pl. you subdue the kelipot3 very much.' Incite the yetzer tov against the yetzer hara and your desire. 87 and 90. p. sect. the "side of evil and impurity. 2. 94). All these arepeniyo t (sing. self-negation (see below. sect. peniyah). and "Let all your deeds be for the sake of Heaven" (Avot 2:12). This excludes the expectation of any son of reward (material or spiritual). 2. let alone a sense of self-satisfaction.55. sect.77 and 92). True service of God implies total disregard of self. In mystical writings deveikut signifies intimate communion with God. 52-53).Equanimity is an important principle. cleaving. will not leave any spare time to think of those [other] matters3 1. have in mind to give gratification to your Creator. 47). being constantly busy with attaching yourself on high to [God]. Whatever you do. sect. 2-3). Orach Chayim:231. . ulterior motives of ego-centricity that must be shunned (see below. the concept of "service for the sake of Above" (see sect. This [perspective] is brought about by constant deveikut (attachment) unto the Creator. see below. Le. 15. as explained in Shlchan Aruch. It is a dominant theme in Chassidic teachings in general. 52. 2. See above.' This means that it should be all the same to you whether you are regarded as devoid of knowledge or learned in the whole Torah. unto God. sect.' Even the expectation of personal delight from your service [of God] is [an ulterior motive] for one's own con~erns.42.2 Preoccupation with this deveikut. This is the principle of "Acknowledge Him in all your ways" (Proverbs 36. and do not think--even a littleof your own needs. sect. blessed be He. 3. the pursuit of spiritual attainments (4 below. See below. 2.~ 1.. sect. blessed is He. to the point of bitul ha yesh. Deveikut-attachment. and in our text in particular. as it is written "I am a worm and no man. each in its own way. sect. 11. 48. therefore. What makes you superior to a worm? The worm serves the Creator with all its mind and strength!2 Man. the worm and all other small creatures are considered as equals in the world. blessed be He. God gave a mind to the other just as He gave a m~ndto you. and certainly [no better] than [other] people. is no reason for self-satisfaction or arrogance: he can do so only by virtue of the special abilities given to him by God. [Recite them] with . [Heaven forbid. As each creature serves God according to its own abilities. You are like any other creature. Cf: below. See above. 3. When tempted to commit a sin. sect. All created things praise and worship God. 2. Bear in mind that you." (Psalms 22:7) If God had not given you intelligence you would not be able to worship Him but like a worm. That man can and will do more than others. note 2. See there especially the preamble (cited in Yalkut Shimoni on Psalms 150) how King David was rebuked by a frog who demonstrated that its service of God excels that of King David.] recite the [Biblical] verses pertaining to that sin. Thus you are no better than a worm. all are proportio nally equal. For all were created and have but the abillty given to them by the blessed Creat~r.Do not think that by worshipping with deveikutl you are greater than another. is a worm and maggot.~ Always keep this matter in mind. -1. created for the sake of His worship. too. as described in the Midrmh Perek Shirah. netzach. As they were morally corrupt. there was no need to expel them. and [the temptation] will leave you. (If the sin has already been committed it will correct this in conjunction with teshuvah. 2. recite with all might. beginning of sect.h~us it will depart from you. they were to be expelled from there (Deuteronomy 7:1J and 20:16f). in general. Thus just as there are the attributes (Sefirot) of holiness. and so forth. will negate the temptation. love of. therefore. and attraction to. sect.. Our text refers to "six nations. is merely like a "filter" for . (CJ below. to be afraid of that which one should not fear. sect. and this will remove the temptation.) Seven nations inhabited the Land of Israel before the Jewish people came there after the exodus. Reciting the specific verses that relate to the subject of the sinful temptation. is the antidote to the yetzer hara. In terms of man. we find that mostly only six are named. for example. and 4 Maggid Devarav Leya'akov. According to tradition. and self-negation or avoidance of that which is forbidden). In our context. in the manner prescribed here. note 3). so there are the attribu tes of impurity (Zohar III:4lb and 70a). the Girgash ite fled the land before the Israelites entered and. with fear and love [of God]. Heaven forbid. 87. 87. e. sovereignty) of the realm of impurity. pursuit of the good. yessod and makchut) of sitra achara (as opposed to the midot of the realm of holiness). or negation of another human as expressed in anger and hatred. omitting the Girgashite. see Maggid Devarav Leya'akov. see below. must be conquered and expelled. In our context. 1. t$ret. 110 and 147. Thus reciting their names "with fear and love of God" leads to an awareness that sinful desires derive from evil. sect. is of no concern: makhut. temptation of any sinful trait or emotion in man is rooted in them. Torah. sect. All aspects in the realm of holiness and purity have corresponding counterpar ts in the realm of evil and impurity (see below.' When tempted by an evil trait. therefore. 223). the mundane or the forbidden. Their corresponding "evil" traits would be. there are the "good" traits ofchessed andgeuurah (manifested in love andfeor of God. the Girgashite. with fear and love [of God]. 139. [the names of] the six nations-the Canaanite e t ~T. the impulse and tempta tion to sin (see below. gevurah. the last of the seven attributes.g. 138).their intonations and punctuation." In the Torah. too. In Kabbalistic terminology they correspond to the seven midot (emotive attributes of the ten Sefirnt--rhesed. sect. hod. signifying the attribute of maldurt (kingship. For example. First and foremost be careful that every motion in the Divine service be without ulterior motives. channel aH your love to God alone and concentrate all your efforts in that direction.87. Heaven forbid. 4. attach yourself strongly to his words to become united with the preacher..Connect that trait unto the Holy One. See above. i. . 22.e. sect.90. Sinful thoughts or desires are overcome in one of two ways: (i) Driving them away by diversion of thought.4 the compound of the first six. Heaven forbid. especially note 2. overpower your yetzer [bra] and transform that trait into a chariot for God." the seve nth is dispelled of itself. Ulterior motives may be the first ste p of spiritual decline. 11. if tempted by sinful love. Others may be led yet further astray by it. 120 and 127).3 When you hear someone preach with fear and love [of God]. disregarding them altogether and filling your mind with positive thoughts. When [tempted] by anger. His words will then become thoughts in your mind and [the sinfLl thought] will leave you. thus must not even attempt it. sect. This is a frequent theme in carly Chassidic teachings of which this paragraph is a typical example (and see also below. who can find it out?" (Ecclesiastes 7:24) There 1s then no alternative but to 1. and filling your mind with. (ii) Elevation or sublimation of the evil thought or desire to goodness. 3. thus as the earlier six are "corrected. 101. which is an expression of sinful "fear" and derives from the attribute of gevurah. blessed be He. from the earliest onwards. positive thoughts of holiness will of itself dispel the negative thoughts.' This requires profound wisdom "exceedingly deep. This last paragraph is another way to rid yourself of sinful thoughts: concen trating on. Chassidic texts. caution emphatic~llyt hat the second method is a hazardous technique that should be employed only by those who have reached spiritual perfection. especially when required to do so." Note there also. . encourage emphatically frequent immersions in context of the Divine service..110 and end of 137)." 3. Immersion in a mikwh (ritual pool or equivalent) is mandated by the Torah for removal of impurity. even for a moment. prayer and sacred matters. The Baal Shem Tov said (Kefer Shem Tou. and to concentrate in the mikveh on the appropriate kavanot (devotions) for mikveh. A statement nearly identical to the present one appears as a sequel in the parallel-version of sect.retain constant awareness of this principle. Kabbalistic and Chassidic texts offer a number of special kauanot for the immersions. ought to have at least the proper intent towards that end (e. In Halachah. They did and do so even in the most difticult conditions. Continuous use of the mikveh is much better than fasting.2 For the "three-fold cord that is not broken quickly" (Ecclesiastes 4:12): remove yourself from depression and let your heart rejoice in G0d. as on Yom Kppur) before the morning-prayers.107. for the sake of purity or feshuuah). 178 (which appears also in the Maggid's Or Torah. 17-1 9 below) in Likkutim Yekarim. This is another fundamental principle of Chassidism.Yitro. that the Baal Shem Tov "merited a11 his illumination and levels by virtue of his frequent immersions. It is common practice among Chassidim to immerse daily (except when precluded to do so by law. Yoreh De'ah 198:48 and 201:5). 44-46. 164) that proper immersion is effective even without any kauamh (4 Chulin 31a. therefore. sect. It serves also for those who are pure to attain higher levels of spiritual purity required by Torah-law. this applies only to the basic purification for chulin (ordinary. 205-d). sect. aside of the additional immersions before the onset of every Shabbat or festival . you must also be scrupulous with [ritual] immersion.56. unconsecrated matters).j 2. and Shulchan Aruch. Addenda. note 19. but not for something that is consecrated. however. often repeated at length in this text (see below. 198: "One is to immerse as much as possible. therefore.. for it is a matter that is flawed by distraction. . sect. such as in rivers or lakes in the winter. See at length Sefer Baal Shem Tou. Secondly. Do not divert your mind from it.g. sect. Mystics. Immersion for greater purification for matters of Torah. sect. and to meditate in the mikveh on the appropriate meditations. 1 above (and sect. should be said before sunrise. i.2 The difference between before sunrise and after sunrise is as great as the distance from east to west. sect. these ("who stand. Thus it became a special tlme for Israel. to mourn and lament ~ t esx lle and to pray for the redemp t~ on (Rosh on Berachot. for prior [to sunrise] one can still negate [all judgment^]. That part of the day is an especially auspicious time. rejoicing like a war1.It is necessary to make it known that one should regularly [rise] at midnight. most of the prayer.' At the very least be scrupulous to recite the [morningjprayer before sunrise.). never allowed a midnight to pass asleep.. worthy to bless Him (see Memchot 110a. This applies especialty to midnight which is an especially auspicious time of Divine grace and favor (Yevamot 72a). 26-28 and 83). ibid. King David. This is the ideal time for the morning-prayer (Berachot 29b). Shu[chan Aruch. the mldnlght vigl with a specla1 order of prayers followed by the study of Torah In general. ad lor. as stated in Mechilta and Zohar. et passim).. and "vatikintho se who are strong (in piety. in the nights") are the true servants of God. "[The sun is] like a groom coming forth from his bridal chamber. Thus "Bless God. both in summer and winter. . therefore." (Berachot 3b) With the destruction of the Bet Harnikdash (the Holy Temple in Jerusalem). That is.e.. midnight became the time that God Himself mourns that catastrophe and the subsequent exile of Israel (Berachot. Orach Chayrm. and Zohar 1:136a). as he said (Psalms 119:62) "At midnight I arise to give thanks. 3. sect 1) Thls 1s known as trkun chatzot. 9b). Tamid 32b. and selected passags from Talmud and Zohar m panlcular The mystics are very emphatic on the practice of study and prayer at night.^ This is indicated in [the verse]. and it is a recurring theme in our text as well (see below. up to the reading of the Shema. too. all you servanls 4 God who stand in the Hofrse of God in the n&htsn (Psalms 134:l). 2. those who love the performance of the commandments) would complete (the reading of the Shema) with sunrise" (ibid. The night is a propitious time for Torah-study (see Chgigah 12b. blessed is He.. an intercesso r. This means that the soul will shine and glow from a "minor" mitzvah even as it does from a "majorn one. an intercessor. the Holy One. he is saved.. stands before the Holy One. 1. was very particular with this. . . . When anyone performs good deeds. see there notes 56. Acharei:47a) See also Avot 4:ll: "He who does even a single mitzvah gains himself an advocate. for it is of great import. as our sages said.rior. and says: 'I am from so-and-so who did me. one among a thousand .I This is a very significant matter. "Even if 999 [accusers] argue for his guilt. Do not allow a single day to pass without performing a mitzvah. whether it be a "minor" or "major" mitzvah. for then you know that you achieved something that day: you created an angel. Likewise. do not read chamota (its heat) but chimato (his wrath).'" (Shabbat 32a) . i. He is gracious to him. for "The Merciful requires the heart" (Zohar 11: 162b. blessed is He." (Job 33:23)3 1.. each mitzvah he did ascends on high.? and "if there be for him an angel." (Zohar Chadash. the commandments. 'If there be with him an angel. a. provides him with an angel for every word of Torah that he listens to. blessed is He. Sanhedrin 106b) . scrupulous) with a 'minor' mitzvah [as with a 'major' one]" (Avot 2:l): the word zahir is an idiom of "They that are wise yaz'hiru (shall shine). "Be zahir (careful.. then provides that person with an angel that will help him." 3. Thus do not regard this matter lightly. Up to here is a repetition of the third paragraph in sect. may his memory be for blessing. 2. and one [advocate] argues in his favor. This means that once the sun has already risen over the earth there is no more hiding from the judgments which come from the angels ofwrath. to the point that when he did not have a quorum he would pray on his own." (Daniel 12:3).e. as it is said. and he who commits a single sin acquires an accuser.' The Holy One. The Baal Shem. and nothing is hidden from charnuto (its heat)" (Psalms 196-7). " (Shabbat 118b)' 4. 6. It is the remedy [to attain] "he will know no evil. when you undertake the instruction stated. blessed is He: every single day. This is alluded in the fact that the lette rs of the word Shabbat are the same as of "tushev-you turn back. 118. no. one needs perform kindness with God.This is indicated [in the verse] "rhmer mitzvalz (he who guards the mitzvah will know no evil" (Ecclesiastes 8:5). This is the implication of the word shomer. protects man from sin. you must stand on guard from morning to evening for the opportunity to perform a mitzvah that may come your way. To be mindful of mitzvot.. Addenda. b. signifies teshuvah on its highest level. precluding nocturnal emissions which are referred to as ''e~il. In the days of Enosh. 7. and Reishit Claorhmah. with all its details and nuances. "The kindness of God is kol hayom ("all day long". "to call in the name of God became profaned" (Genesis 4:26). you return. Guard the Shabbat properly." i. Sha'ar Ha'ahavah. his generation introduced idolatry (see Maimonides. 5. Hikhof Avodah Zara.e."~ [This general principle] is indicated [in the verse]. ch. the grandson of Adam and Eve."See also Keter Shem Tov. as in "his father shamr (guarded. therefore. To mind God's will by observing His commandments is regarded as "performing kindness with God" (see Zohar 1II:281a. This is indicated in [the verse] "Tashev enosh-You turn man back until he is crushed" (Psalms 90:3): tashev is the same letters as Shabbat: and enosh alludes to "[he is forgiven] even if he served idolatry like the generation of Enosh. or: "every day") (Psalms 523). effects atonement. The Kabbalah teaches that all realms ascend to their spiritual source on the S h h t : they return (teshuvah) to their source to be absorbed in higher sancti ty (Eitz Chayim 40:5 and 8. That is. 8). and 50:6). in both the letter and the spirit of the law. and to heed their performance. awaited and looked forward to) the matter" (Genesis 37:ll). and its proper observance. ch. Shabbat. that is. 1) Proper observance of . that is. whether they relate to the body or the You may find it impossible to pray without alien thought. blessed be He.. Heaven forbid. 'Whosoever reads the Shema . This is indicated [in the saying].. This applies especially to the first two verses ("Hear."). those that cause harm keep away from him." and "Blessed is the Name. to do so without any alien thought. and other parallel sources. because you have been renewed and became a different person that is capable to beget. The Shema must be read with kavanah (concentration on the meaning of the text) and awe. With proper recital of the Shema. 0 Israel . demonstrates teshuvah. begetting . corresponding to the 248 limbs of the body. . Israel Baal Shem Tov. recited twice daily. which effects forgiveness even for the grave sin of idolatry. Arharei. 17-19 appe ar (with slight variations) as one segment under the heading of "Tzava'ah (Testament) of R. 198. sect. Tanchuma..8 To do so is something inestimably great. (Shukhan Anrch. Zohr Chadash. sect.I0 the Shabbat. each word effects protection and healing for the limb to which it corresponds." (Berachot 5a) "Those that cause harm" refers to all harms in the world. 8. Orarh Chayim. 60 and 63) 9. 10.. Kedorhim: 6. the duty of the Shema has not been fulfilled and it must be read again. however. At the very least be careful with the reading of the Shema. Zohar 1:lOla. analogous to the attribute of the Holy One. nonetheless. In Likkutim Yekarim. 48a. The Shema has 248 words (including the three concluding words repeated aloud by the cantor). train yourself to commence [reading the Shema] without alien thoughts. a return to God. for if these were said without kavanah. Rise from your sleep with alacrity. sect.c." 20 Embrace the trait of zerizut (alacrity) very much. . Thus it is one of the advanced levels on the ladder of spiritual perfection (rf: Avodah Zara 20b and its parallel passages). The techelet signifies the Heavenly Throne of Judgment. analogous to the Almighty "begetting" (bringing about) all the worlds (rf: Tikunei Zohar 69:104a and 105b).. indolence.3 1. and you shall not stray after your heart and after your eyes .. 21 When donning the talit1 one is to see the "blue thread. the &itzit in general) is a reminder of God and will prevent man from sinning (Menachot 43b. A four-cornered garment with tzitzit (special fringes) attached to each corne r (Numbers 15:37$.) The significance of the techelet is that its color reflects the color of the sea . thus "you . The significance of the hiit is "accepting upon yourself the yoke of the Heavenly Kingdom in the act of spreading the talit over your head" (Zohar III:120b). Consciousness of this ability should cause one to rise and act with alacrity. which is similar to that of the sky which. Deuteronomy 22:12). in the realm of impurity.' Whatever you do should be done with alacrity. commonly called "prayershawl. note 1). thus nowadays we are unable to observe that detail of the precept of &itzit. in the present observance.worlds. he is able to cause new effects in all realms by means of his worship of God with Torah and mitzvot. on the other hand. The mystics note that laziness. 5-6. and prevents man from worshipping God (rf: below. sect. When man rises from sleeping he is like a new being. With the renewed energy. in turn. 116). 'This is regarded as "begetting" new things. Thus "you shall see it and remember all the commandments of God and do them. 3. is analogous to that of the Divine Throne of Glory. as it is written "They are new every morning" (Lamentations 3:23)." (Numbers 1539) To see the "blue thread" (or. a thread colo red blue (or turquoise) with a dye extracted from an aquatic creature called chilazon. indicates a desire of the soul and heart to act for the love of God." 2. sect. is rooted in ev11. 2. It is evidence of disinterest. and 6 above. (The identity of this creature is no longer known."Z This means that awe come upon him. Zeriztct (alacrity). The fringes on all four corners are to contain apetil techelel.. for you can serve God with everything2 1. . as it is written." (Psalms 4:5)2 1. sect. 11:139a and 152a-b. blessed be He. blessed be He. 13-14. 2-3 (especially note 3) and 11. note 1." with the good remaining for the Divine service. sect. Everything in this world has a spiritual root Above. agitated and trembling from the fear of the Creator. 9. remember the love of God. 2-3. and above. . 4. "Be agitated and do not sin. See above. with regard to raising and sublimating all thoughts. Hilchot fi'ot 3:3.) 3.shall see it and remember all the commandments of God" because of the awe or fear it instills (ibid. Thus one must trace everything to its Divine root and apply it in that context to the service of God.2 Even when going to the privy have in mind "I am separating the bad from the good. 2. 2. See above. note 1. and see also ibid. remember the Holy One. sect. sect. Cf: above. blessed be He. .' Thus you will not come to sin. when going to sleep think that your mental faculties go to the Holy One. See Maimonides. [reflect in your hearts on your beds]. Whatever you see. 178b). as this is elaborated in various sources. 20. note 4. and will be strengthened for the Divine serv1. Before falling asleep lie in dread and fear. III:175a). sect. one should be agitated (tremble) in fear of God (Zohar III:113b). and with [an aspect ofj fear remember the fear of God. It is a time of serious soul-searching and stock-taking (ibid.' Thus [when seeing an aspect of] love. When retiring for the night. Thls is the concept of yichdim (unifications). (Cf: above.' Likewise. 2 1. See above.rop. sect.Your thought should be [directed] to Above. however. 136. sect. in service to God. The following is an important principle: Remain all day with the thought with which you rose from your bed. sect 4.er. 212. (The Baal Shem Tov explains this in context of the mystical interpretation of the honor due an elder brother. too. cited below. Obviously this relates to a thought that is pure in itself or has been sublim ated to holiness. The frequently cited concept that man's thought is to concentrate on the spiritual reality on h~gh is based on the principle that thought is man's very being. and below. 69). incurs a ban Above. . Heaven forbid. Likewise. Cleave unto Him and trust in Him to attain your desire. sect. If thc thought is pure and holy. This requires. citing Likkutim Yekarim. will be pure and holy.' 1. and no other thought. one must be careful to "sancti@ and purify one's first utterance" every day as one awakens. 90. 2. for it sets the tone for the whole day.) Always be careful to rise at midnight. all subsequent speech and actions. beginn~ngo f sect.) See Keter Shem Tov. thus you are where your thought is (see below.' 1. 16. . Thus it is extremely important that the first thought in the morning. .be p. This is based on Zohar III:23b (and see there also I:207a) . Cf:a bove. sect. 137." (instead of "Remain all day . .") This would accord with the following teaching of the Baal Shem Tov: Speech and action are rooted in man's thought.' He who does not rise. without having being prevented beyond his control. sect. the Supernal World. that one's first thought be attached to holines s. This sentence can be read also: "One remains all day . 27b. 30 below). Sleeping in day-time (except on Shabbat) is generally disapproved of. It offers a succinct declaration of the unique nature of Chassidism and the difference between it and its opponents. pause briefly every hour' to attach yourself unto [God]. especia lly by the mystics. He places Torah-study into context: the ultimate goal of the religious life is deoeikut-attachment to. 29 When you study. as often charged by his adversaries.* Even so. and communion with. 3. and also an hour preparing for each prayer "in order to focus their heart to their Father in Heaven." 2. p. The Baal Shem Tov clearly does not downgrade or belittle Torah-study. the principal purpose of Torah studied) is feshuvah (return to. however. Sleep a few hours during the day so that you will sufice with but little sleep at night. The Halachic proof-text for this principle is in the Talmudic passage relating that "the pious of old" spent an hour on each of the daily three prayers. explained in the next one (and elucidated by the much more elaborate parallel-passage in Likkufei Arnarim-Vitebsk. may He be blessed. as well as by sect. It is a typical Hebrew expression for "every so often. Thus study many [different] lessons [and that will banish your sleepiness].. This paragraph. one may "borrown from day-time to "repay it" in the night. Thus they spent nine hours daily on deueikut without worrying about the over-riding obligation of Torah-study.3 When rising at midnight and overcome by sleepiness." and an additional hour after each prayer to extend the communion with God beyond the prayer itself (Beracbot 30b and 32b). For "the goal ofwisdom (i. you must study? 1. Do not concentrate on a single lesson lest it become onerous for you. Study a number of [diverse] subjects.e.Convert the nights into days. "Every hour" is not necessarily to be taken literally. God. If it is necessary to enable one to study Torah at night. and communion . is no doubt one of the crucial statements in Tzaua'at Harivarh. drive it away by pacing back and forth in the house and chanting hymns with raised voice. As for the "pious of oldn (see above. Isaac Luria that deveikut is sevenfold more etrective for the soul than study. It is practically impossible to do so when simultaneously concentrating on deveikut (4 below. for the reason explained in the next paragraphs. It requires concentratio n on the content of the subject-matter to the point of full understanding and acquiring yedi'at Hatorah (knowledge of Torah). they did not need to spend more time on reviewing etc.") Man thus faces a dilemma: should he pursue meaningful study with its unavoidable interruption of deveikut. Sefer Chareidim. note I). Schneur Zalman of Liadi. writes on the authority of R. 30: 'When studying Torah you must concentrate on the subject-matter. Mitzvat Hateshuvah.In the midst of study it is impossible to cleave unto God.4 Nonetheless one must study because the Torah furbishes the soul and is "a Tree of Life to those who hold fast to it. 4. as it is written. By not studying Torah. 3. Torah-study is not a superficial utterance of words. or focus on deveikut at the expense of study and yedi'at Hatorah? The Baal Shem Tov's answer is an unequivocal "you must study!" 5. 3. and already knew the whole Torah. This follows from the Talmud's statement that by virtue of their saintliness "their Torah was presented. Notwithstanding the primary goal of deveikut." Unl~ke others. Their piety and deveikut did not exempt them from the precept of Torah-study. and an unlearned person cannot be a chassid (a pious person who acts beyond the minimal letter of the law). sect. The precept ofauthentic deveiktrt with "fear and love of God is superior to the precept of Torah-study and takes precedence to it. they spent so much time on prayer and deveikut because they had already studied." (Avot 25) The lack of Torah-knowledge precludes the possibility of authentic deveikut. ~t does not over-ride the oblig ation to study Torah. "A boor cannot be fearful of sin. therefore. as stated in Sefer Chareidim and in Shenei Luctaot Haberi~. God) and good deeds" [Rashi: that it be with teshuvah and good deeds] (Beracbot 17b). however.5 with. your deveikut will cease. the sequel to this scntence. "The beginning of wisdom is fear of God" (Psalms 111:10). to assure that they will not forget what they had learned. but from the normative obligation of continuous Torah-study in accord with . Shulchan Aruch. blessed be He. and R. end of ch. (See the lengthier vers ion in Likkrrtei Amarim-Vitebsk. one loses out on both the basic precept of Torah-knowledge and dewikut. Hilchot Talmud Torah 4:4-5.) Note." (Proverbs 3:18) If you do not study. and by virtue thereof you will be properly attached b Godlinesr. at least one fulfills the precept of talmud Torah (studying Torah).. when in a state of constricted consciousness. as stated above. you . 30: "When studying Torah you must concentrate on the subject-matter. 121. that the failure to study Torah is one of the four primary causes of spiritual corruption). It is a fact of reality that in any case there are times when the active pursuit of deueikul is precluded. In view of the above. sect. the precept of acquiring yedi'at Hatorah (Torah-knowledge)." (Cf: below. When studying Torah. note 7. "you must study!" Moreover. Cf: below. Le.8 the Halachic principle (Berachol lla. 7.7 Nonetheless."6 The time of Torah-study is then certainly not inferior to those conditions. The pursuit of deveikut cannot be an excuse not to study Torah. when the mind is not preoccupied with thoughts of Torah. sect. It is absurd to argue that Torah-study is inferior to those states of being.) Nonetheless. blessed is He. which is the very foundation of the religious life of following God's will and without which there is no authentic dewikut. par. 6) Note the sentence in sect. and the mind will be filled with meaningless (devarim befeilim-idle matters) or even sinful thoughts (6 below. 117. such as when "the mind falls" (i. H i k t Talmud Torah. 121. you must consider at all times attachment to the blessed Creator. and sect. which is part of the service of God and communion with God.Ponder the fact that you cannot cleave [unto God] when sleeping or when your mind "falls. Thus. every so often one must remind oneself that its pursuit is a command of God. 8. When conversing think of nothing but attachment to the Creator.e. when unable to concentrate and focus the mind) or when asleep. however." Thus they continued their studies in the time left to them beyond the nine hours devoted to prayer and deveikut. When studying Torah. ibid. (See at length. one is not in a state of deveikut. 54. unable to concentrate and focus. " 6... sect. Sukah 25a) that "when preoccupied with one mitzvah one is exempt from another mitzvah. it is clear that Torah-study is absolutely essential in the full sense of "Talmud Torah is equivalent to all the commandments. note 4).~ 1. In this context note his interpretatio n of the Midrash that states that God concealed the original light of the first day of creation: the light was hidden in the Torah (see Zohar Chadash. You must always be occupied with Torah. sect. Something may come your way and you do not know whether to pursue it or not. you will be able to determine your course of action from the subject-matter that you learned. If you studied Torah that day. 85a-b. and by virtue thereof you will be properly attached to Godliness.must concentrate on the subject studied. par. however. R.'Just assure that you are continuously attached to God.]' (Psalms 5523). He will inspire your thoughts with [the idea] of what you need to do. 81. however. then things are most likely as it oc . Any disruption of dewikuf at that time may reduce it to idle talk and lead astray. (Degel Machnneh Ephrayim. 11-12) is preceded by the following words: "As you subdue all your thoughts to the Creator. because it is itself the prere quisite for proper deveikut. and by means of it one is able to see things that are not normally perceived. for it 1s "a Tree of Life to those who hold fast to it" (Proverbs 3:18). It is related of the Baal Shem Tov that he would look into sacred texts and then answer those who sought his counsel. however. blessed be He. He will then always provide you with the opportunity to know [how to act] from the Torah [st~died]. You do not lose out on this account. The optional activity of conversing. as it is said.1 I. and a thought comes to you about whatever it may be. 147-9). Ruth. 29. sect. on Genesis 1:4) 2. The version of this section in Likkutim Yekarim (sect. Torah-study requires concentration on the subject-matter (see above. Israel Baal Shem Tov said that when you are attached [in a state of deveikut] to the Creator. When but conversing and relying on the deveikut. 'Cast your burden upon God [and He will sustain you. allows for it to be in context of dewikur. be very careful not to lapse occasionally from the deveikut. below. Cf. blessed be He. Sejer Habahir. 72. ~ 1. 27-28. one relates to God haphazardly. See below. too. a prophet ic spirit). advance in gradual stages.If. then God. and 143. however.) Though unable to pray with deveikut at the outset of prayer. will deal with you in a random way.~ curred in your thought.. sect.) The punishment for relating to Gtd haphazardly is that you will be deprived of this opportunity. When permissible foods. 60. sect. garments or objects come your way. and see there also verses 21. that it is meant for you to elevate them. See below. He will not provide you with the garments and food which contain the sparks related to the source of your soul that are meant for you to corre~t. On the gradual ascent in prayer. This is achieved by using all things for their intended purpose in context of man's service of God. When praying. 38. 109." 3. 116 and 142). recite the words with great kavanah (devotion). God relates to man "measure for measure" (4 below. it is an indication that they contain "holy sparks" related to your soul.2 Commence with composure and in the midst of prayer attach yourself with great deveikut.135. too. 112. Strengthen yourself bit by bit until [God] will help you to pray with intense d e v e i k ~ t . will deal with you haphazardly" (Leviticus 2622-24. Thus you will even be able to recite the words of the prayer expeditiously. 4. 3.3 Moreover. This is a bit of ru'ach hakodesh (holy spirit. (See below . I. See below. Cf: also sect. i. see below. sect. sect. 36. All things in this world contain "holy sparks" that must be elevated to their Divine source. 2. 4.' Do not exhaust all your strength at the beginning of prayer. sect. 58. Thus "if you behave haphazardly with Me. and 40-41). 85 and 86. .e. sect. otherwise it will be [defective]." 2. and end of 75. 51. whether it be Hymns or [words of Torah-]study. however. when you say the word with great bonding. only her l~psm oved and her voice was not heard. all kavanot are involved in the whole word of themselves and by themselves. See below. 1.You must learn and train yourself to pray with a low voice. you are but meditating on those you know. should be said with all your strength. 75: "Every letter contains 'worlds.' Whatever you say. Note below. becoming truly unified in Divinity . 58. Know that every word is a kornah shelemah. 60. Thus it is customary in many places (and especially among certain schools of Chassidism) to pray loudly. sect. 118: 'Wen meditating in prayer on all the kavanot (mystical devotions) known to you. All worlds will then be unified as one and ascend.. for the average person Nonetheless.. To pray out loud stimulates kavanah. "you must learn and tram yourself to pray with a low voice. On an elevated level of communion with God. as it is sald. and even necessary. On the other hand. and to cry out silently. when praying with profound focus and devotion in the gripping consciousness of being literally in the very presence of God." (Psalms 35:10)? An outcry rooted in deveikut is silent. the words flow from the very depth of the heart and soul and are practically silent: "Hannah was spealung from the heart." (I Samuel 1:12) To pray aloud initially is acceptable. For every letter is a complete world." Below..' Thus you must invest it with all your strength.." . "All my bones shall say .. souls and Divinity. sect. even the Hymns [of Praise]. 1. sect. with great intensity (except for the Amidah which should not be audible even to those standing next to you). like missing a limb.' These ascend and become bound up and united with one another. 34-35. with Divinity. a complete structure. The letters then unite and become bound together to form a word. and to cry out silently. Every word of Torah or prayer, therefore, is charged with spiritual forces and signifies the ultimate principle of unity. 35 It is a great kindness of God that man remains alive after praying. In a natural course of events, death would have to result from exhausting all strength [in prayer] because of exerting oneself so much by concentrating on all the great kavanot (mystical devotions).' 1. See below, sect. 42. 36 Sometimes you can pray very quickly, because the love of God burns very strongly in your heart and the words flow from your mouth by themselves.' 1. See above, sect. 32. Cf: Kekr Shem Tov, sect. 217, that in the state of inten se deveikut, the holy spark of the She chi~hin herent in man's soul will sometimes extend itself to the point that words spoken flow from It. It seems that the person is not speaking by himself but that the words flow from his mouth by themselves. 37 When attaching yourself on high in the silent prayer,' you will merit to be raised yet higher during that prayer.2 Our sages thus said, "He who comes to be purified will be helped." (Shabbat 104a) 1. The Amidah, which is to be said in an inaudible voice. 2. Cf: above, sect. 32. 28 TZAVA'AHTA RTVASH By means of that prayer you will then merit to be attached on high with your thought.3 Thus you will attain to the yet greater level of being attached on high even when not engaged in prayer. 3. To be attached with your thought IS to be attached with your very bang, with your soul (4 below, sect. 104). On that level the deveikut remains even when not engaged in prayer. 38 Do not recite many Psalms before prayer so that you will not weaken your body. By exerting your strength before prayer with other things you will not be able to recite with deveikut the main thing, i.e., the mandatory [prayers] of the day-the "Hymns of Praise," the Shema and the Amidah.' Thus say first the main thing with deveikut. Then, if God gives you additional strength, recite2 Psalms and the Song of Songs with deveikut. 1. Some recite Psalms as a preparation for prayer. It helps to focus the mind to the service of prayer: it clears the mind from alien thoughts, and it is conduci ve to deveikut. To spend too much time or effort on the preliminary Psalms, however, can be counter-productive, as the energy expended may be at the expense of that required for the mandatory prayers. Cf: Kefer Shem Too, sect. 120. 2. At the conclusion of the prayers. 39 On Yom Kippur, before ne'ilah (the concluding prayer), recite the machzor (liturgy of the day) with katnut ("smallness;" limited consciousness) so that you will then be able to pray [ne'ilah] with deveikut.' 1. This paragraph is relating the advice of the preceding section to the service of Yom Kippur. When you are on a low level, it is preferable to pray out of a siddur (prayer book). By virtue of seeing the letters you will pray with greater kavanah (devotion).' When attached to the Supernal World, however, it is better to close your eyes, so that the sight [of your eyes] will not distract you from being attached to the Supernal World.2 1. The mystics emphasize that the letters of the Hebrew alphabet are not convent ional symbols for sounds but signify--and are charged with-Divine emanations, lights and creative forces. (Cf:be low, sect. 75.) The very sight of these holy letters, therefore, stimulates kavanah. R. Isaac Luria always prayed out of a siddur (except for the Amidah which he said with closed eyes). 2. In the state of deveikut one does not need the inspiration of seeing the lett ers and, as stated above, sect. 36, the words will flow of themselves. In fact, in that state, anything else (such as reading the words) will distract. The soul told the Rabbi [the Baal Shem Tov]' that he did not merit his revelations of supernal matters because he learned so much Talmud and the codifiers, but because his prayers were always with great kavanah (devotion).Z By virtue thereof he merited to attain a high level. 1. One of the levels of prophetic spirit is the self-revelation of a person's ow n soul as it connects with its supernal source. (This form of m'ach hakodeshholy spirit-is described in R Chaim Vital, Sha'ani Kedushah III:5 and 7.) 2. The Baal Shem Tov was not only a great mystic but also a profound scholar in Talmudic and Halachic studies, as attested by his disciples (many of whom were themselves among the universally acknow!edged Torahscholars and authorities of the time; see the essay by Rabbi S. Y. Zevin in Sefer Habesht, Jerusalem 1960, p. 24ff; and the Introduction to B. Mintz's edition of Shivrhei Habesht, Tel Aviv 1961, p. l9f) His lectures were not limited to mystical subjects. They included regular lessons in Talmud, the Codes and their commentators, and were delivered with great acuity and brilliance. He merited his unique revelations, however, by virtue of his extraordinary kavanah in prayer. Before praying have in mind that you are prepared to dle from the kavanah (intense concentration) while praying. Some concentrate so intensely that it may be natural for them to die after reciting bust] two or three words before God, blessed be He.' Bearing this in mind, say to yourself: "Why would I have any ulterior motive or pride from my prayer when I am prepared to die after two or three w~rds?"~ Indeed, it IS a great kindness of God to gve [man] the strength to complete the prayer and remain alive. 1. The concentration on every word ought to be to the point that thc word is "illuminated and shines" (see below, sect. 75). Bwikut to God is by means of attaching one's thought and inwardness to the spiritual core of the letters of Torah and prayer-the spiritual core of the light of the En Soph that is in the letters, an "attachment of spirit to spirit." (fibr Shem Tov, sect. 44 and 94) Thus when sayinga word, you prolong it extensively and do not want to let go of it (below, sect. 70). There is then an intense communion to the point of "my soul yearns, it expires, for the courtyards of Godn (Psalms 84:3). Thus it may be natural to die (kelot hnefesh---expiration of the soul from its pining for God) after reciting but two or three words from the prayer. 2. Prayer with great deueikut may lead to a sense of self-satisfaction or other ulterior thoughts. The Baal Shem Tov thus cautions to beware, that the prayer be followed by a profound sense of humility. (See Darkei Tzedek, 1:no. 5.) Cf: above, sect. 12. When fasting,' have in mind the f~llowing:~ 1. In line with normative Halachah (Maimonides, Hilchoi De'ot 3:l; Shukhn Aruch, Orah Chayim, sect. 571), Chassidism is opposed to self 4. 76-79. strength. sect." (Cited in Keter Shem Tow. with love and fear. . the subservience of man's natural inclinations to God. and see there also sect. This section thus offers the appropriate meditations when fasting.'Woe to me! I have angered the Supreme IGng on account of my desires and my putrid pride.) Nonetheless. soul. It is much better to use the energy one would expend on fasting for the study of Torah and prayer. Thus I will effect Above that "the slave be subservient to his Master and the maid-servant to her Mi~tress.. my body and fire. the pervasive presence of God as the sole true reality. See below. It emphasizes that man concentrate on positive forms of self-improvement: "It is preferable to serve God in joy without self-mortifications. return to God). t.e. 2. Fasting is not itself teshuvah (repentance. and Addenda: sect. sect. That is why I wish to afflict myself to subdue my desires and pride. but facilitates t he frame of mind required for teshuvah (see below. 'Woe to me! What am I and what is my life? I wish to offer my fat and blood. 3. 16. 178: "The Baal Shem Tov merited all his illuminations and levels by virtue of his constant immersions. fasting is not rejected outright: at times it may be needed for spiritual correction in the context of teshuvah. Frequent [immersions in a] mikveh (ritual pool) is superior to fasting. mortifications such as fasting and other forms of self-afliction. 249.302. in order that I effect His unity: and also to offer myself as an offering before Him.. note 16) 5. God (see below.e. and cf : also sect. for fasting weakens the body from the service of God. Cf: TikuneiZohar 2a. The proper fast is not simply a passive state of "not eating and drinking. because the latter cause feeling of depression" (below. sect. notes 4 and 16)." I t needs be a conscious act with a profound sense of overcoming physical needs and desires in the service of."a~nd fulfill the precept of teshuah. 56. Note also Likkutim Yekarim. and submission to.. as opposed to t he dualism of the erroneous assumption of a dichotomy between the spiritual and the material. to pray with all one's strength and concentration which leads one to spiritual ascent. 1. sect. my spirit. 219. 56).^ I wish to diet myself so that I may serve God truthfully and whole-heartedly. In the metaphortcal terminology of the Kabbalah thts is regarded as a separation between the Shechinah (D~vineIm manence) and Her "spousen. Sin defiles not only the sinner's body and soul but also. strength and w~ll( seezohar Chadmh. mere dust.6 [I want to offer these] to the Creator of all worlds.' in absolute unity: In a mode of kindness and 6. as it were. and His Shechinah. blessed is He"). May I effect Above that all the kelipot be removed from the Shechinah so that She may be purified and uniG with Her 'Spouse.' evil forces) because of my affliction. spirit and soul. by whose word all worlds came Into being and before whom everything is as nothing-all the more so I. fasting involves overcom~ng the natural des~res for food and drtnk. a maggot and worm. Moreover.' and also to ease that sorrow. I ought to rejoice that He gave us the means to subdue the yetzer hara that is upon us.heart and will before Him. "covers " the Shechtnah wtth the crude husk of evil. Ruth-80a) 7 To sin is to cause sorrow to God. 8. The Shechinah IS thus ''exled" in evil. on both the level of the Divine Immanence and Presence (Shechrnah) and the level of the Divine Transcendence ("The Holy One. preventtng the manifestation of the Dtvine Presence. Fasting diminishes the blood and fat of the body. Thus it is regarded like offering these as a sacrifice on the Divine altar of atonement (Berachot 17a) Moreover. blessed be He. blessed is He (Divine Transcendence). Woe to me! Of what significance is my affliction compared to that sorrow which I caused for so many years! I can but appeal to His great mercies to observe my selfaffliction to ease the sorrow of His Shechinah. "I ought to rejoice so much that I merited to bring [Him] some gratification with my body. and that He remove from us the kelipt ('husks. but more so of soul. Thus it impl~esa sacrtfice of not only the phystcal blood and fat. Acts of virtue (Torah and mitzvot). "I wish to afflict myself because I caused sorrow to the Holy One. I cannot but appeal to His great mercies to augment my strength to offer many sacrifices before Him. the Holy One. and specifi . yet His providence is upon them to endow them with [supernal] effluence and their vitality. 10. In His kindness He has helped me many times. however. for He put it in my heart to afflict myself. heart and liver.e.9 "I trust in Him. blessed is He. ch. sect. for He created all worlds by His word to come into being from nothingness. he offers "nourishment"-the blood and fat that are diminished in him. and other such enticements.compassion. and it transfers it to the heart which then transfers it to the brain.. "frees* the Shechinah from that exile and reunites Her with Her "spouse. Thus surely He can provide me with strength. In the human. Everything came into being. too. is in reverse: the aspect of "brain" (the Spfirah of Chochmah) transfer s to the aspect of "heartn (the Sejirot ofZe'eirAnpin." whence it ascends to the supernal "heart" and then to the supernal "brain. My self-affliction will thus effect union from Above to below.10 All is as naught before Him. 1)." Thus I appeal but to His great luridness. Chessed to Yessod). and this day." The "arousal from below" by man thus initiates a reciprocal "arousal from Above" in the normative order of Divine emanation and effluence. He will help me. Zohar I11:153a notes that the Holy One. from the mind to the heart and from the heart to the liver. the liver is the first to absorb nourishment. 11. When man fasts. The order of Divine effluence. saving me from the yetzer h r a so that it will not prevent me from my self-affliction by arguing that I am weak and that my mind is withering. 78-79. See below. and in His kindness set His providence upon myself as well. and that He pour His emuence upon me as ~e11. i. and his will-to the supernal "liver. and continues existing. . by means of the ten utterances ofthe six days of creation (as recorded in Genesis. and cally the correction of sin (teshuvah)." 9. and the "heart" to the "liver" (the Spfirah of Mafchut) from which it is diffuse d to the lower levels. manifests Himself and His effluence by way of three principal channels which are metaphorically analogous to man's vital organs of the brain. . [the fast] is not even an affliction on my part. Moreover. 'The greater the person. This interpretation of Psalms 37:3 (to rely on God to help you fulfill the mitzvot) is identical to that of Nachmanides (Ha'emunah Vehabiwhon. one is allowed to trust [in God for the ability] to do Mitzvot. for everything emanates from Him. "I am not afraid of any weakness on account of the hst. 'I am going the way of all the earth' and I will not deviate. He will surely sustain me. "Furthermore. sect. but more so to "sanctify yourself by that which is permitted to you. the greater is his yetzer hra' (Sukah 52a). S. note 1. I can trust in [God]: 'Trust in God and do good' (Psalms 37:3).' (Isaiah 40:31) Indeed. I4 and 'They that hope in God shall renew strength. To be holy means not only to separate from all that is forbidden. Our sages said. On my own I would be altogether unable to afflict myself. See below." and I trust in His kindness that He will augment my strength so that I may serve Him in truth.I2 "Thus I submit myself unto Him who created all worlds by means of His word. ch. as it is said. Bitarhon). 138. 'God supports him upon the bed of illness' (Psalms 41:4). I wish to fulfill 'you shall be holy.e.' (Leviticus 20:7). Bachaya (IC?d Hakemarh. man has but by Divine grace.save me from anything that would prevent me [from my good intentions]. 'the Shechinah sustains the sick. i.' (Shzbbat 12b) Thus. 14.U. for many people become ill [without fasting]. in His luridness. 1) and R." self-restraint in permissible things (see Nachmanides on Leviticus 19:2). But as I do not devlate. it is a good omen for one to die while engaged 12. "Moreover.. and that He will help me so that people will not know of my deeds. 13. even to endure all mortifications and disgraces for the sake of His unity. blessed be He. Even the strength and energy needed for the fast. with teshuvah. that they turned from their evil way' (Jonah 3:10). but if you trust in the Creator's 15. without actual speech.I6 Do not feel proud. Sometimes the mouth feels dry and has a bitter taste." 16. Cf: below. Change your place every so often. . 77. 'God saw their deeds. Nathan 252: "It is a good omen for one to die whilst engaged with a mifzvah. Study Torah in your mind. for he who takes pride in his fasting "will be delivered to dogs. as we find that it is not said of the people of Ninveh that God saw their sackcloth and fasting. CJ Avot deR.15 Without [this teshuvah] I may possibly have to be reincarnated because of sin and for having failed to worship properly with love and fear. the whole world is forgiven. [In the days of fasting follow this procedure:] At the outset sleep in the first three nights-though not too much-in order to strengthen your mental faculties. the essence of which is to turn from one's evil ways and return to God (see Maimonides. walk around a bit and then lie down briefly. sect. for surely you effected something very great. but. in order to ease your pain. Hilchot Ta'anit 5:l). C' Ta'anit 16a: "Neither sackcloth nor fastings are effective. [it is said] 'Do not worry about the troubles of tomorrow' (Yevamot 63b)." (Yoma 86b) Thus rejoice in the pain of the fast for offering up yourself [to sanctify God's Name]. 17." (Tikunei Zohur 18: 33b)" Even "if but a single individual repents. but only tesh uvah and good deeds." Fasts serve the purpose to stir the heart to kshuvah." *** The essence of teshuvah is to turn back from one's evil ways. to ease your pain. and the yetzer [hara] makes it seem to you that your head aches and that it is unbearable for you. Also. You must understand this trickery.' my Creator will be more gratified if I do not pay attention to the stringency that you pointed out [to me] to make me depressed in His worship. because of your depression. and have in mind that the Shechinah sustains you even as She sustains others that are ill.I8 Have in mind that your fast 1s to bring gratification unto the Creator. and below.2 Though I ignore the stringency you mentioned. scct 47 . See below. and then God will help you. and there is no pain at a11. His intent is that you should feel depressed as a result thereof. for your intent is but to keep me from His service. blessed be He. blessed is He. and say to the yetzer hara: "I will not pay attention to the stringency you referred to. 18. because I do not pay attention to it only so that I will not be kept 1 See below.lndness your vigor will be strengthened. the Creator will not hold it against me. Even if there really was a degree of sin. sect 46. sect. "In fact. 11. and that you accept the pain upon yourself in order to ease the pain of the Shechinah. Worshlp with joy. and thus be kept from serving the Creator. I will serve Him with joy! For it is a basic rule that I do not think the Divine service to be for my own sake but to bring gratification to God. may He be blessed. note 2 2 See above. You speak falsely. 78-79 Sometimes the yetzer h r a deceives you by telling you that you committed a grave sin when there was really no sin at all or [at worst you violated] a mere stringency. sect. you must put aside all other thoughts. Think of God and not yourself! "Turn away from evil and do good.. Thus it must be avoided altogether. To read it that way. and the quote cited below. (see Sha'arei Kedushah I: 2 and 5. For how can I negate His service. but it is really counterproductive. note 2). Thus "turn away from (real or imagined) evil. sect. The Baal Shem Tov does not belittle sin or the remorse it requires. It was often cited by the opponents to Chassidism as "proof' of anti-nomianism. Chaim Vital (the principal disciple of R. one must pursue it with alacrity and joy. "Behold. Shabbat Teshuvah) In fact. atrvut (depression.e. 33b. "and do good. p. and the authoritative scribe of his teaching). 46) he cautions against the psychological effects of obsessive remorse that leads to depression. blessed be He: avoid depression as much as possible. Isaac Luria. 111: 4. sect. melancholy) is a nasty. Cj below. sect. There is a specific time for everything. As already stated by R. is a total distortio n. for these are but the device of the yetzer hara to prevent you from your present obligation.. such as thoughts of self-reproach for past misdeeds or personal worthlessness. Remorse for sin is necessary." (Psalms 34:15) R Dov Ber of Mezhirech." i. (Or Hame'ir. disciple and successor of the Baal Shem Tov. God rides on a light av (cloud)": God dwells with that person who regards any sin he committed to be av (thick.3 3. But this mikvah of ieshuvah must be separated from the observance of the other mitzvot. carry out your obli gations in proper manner with joy and eagerness. coarse) even if it is essentially a light transgression. It is part of leshvah. interpreted: When it comes to Torah-study and service of God. however.from His service. setting aside all other matters. blessed be He. When the obligation or opportunity of mikvol comes about. 398) Here (and below. even for a moment!" This is a major principle in the service of the Creator. (Keter Skm Tw." i. sect. To be depressed by one's spiritual deficiencies or downfall may seem laudable. This whole section (and the similar one below. He interprets Isaiah 19:1. 107. 11: 4. and in particular the concern about one's spiritual status. Sha'ar Ru'ach Hakodesh. forget now these thoughts. 46) requires elaboration. harmful and objectionable character-trait that is a hindrance to the service of God. 45 and 107.e. this principle is an established premise of much earlier author+ ties: "A person must never think to himself 'I am a sinner and committed . thus of what avail is it for me to perform mitzuot?' On the contrary: if he has committed many sins. 15 and 44. I'erek Hamitzvot. sect 107. as it is written "Serve God with joy. note 2). It follows an earlier ruling by R. Chibur Hateshrrvuh 1:ch. he must be joyful at the time of Divine service. The Baal Shem Tov's teaching here. Mitzvat Hateshuvah. Hilchot Lulav 8:15. The good kind 1s brought about by the yet+er fov and ascends on high. See above. should he eat more garlic so that his breath should go on smelling?" (Shabbat 31a) In other words. 46. 394j. he should countermand that with the performance of mitmot. as it is written. if you have committed bundles (chabiiot) upon bundles of transgressions. and below. is very good .. sect. Israel ibn Al-Nakawa. Menoral Hama'or. Thus it is stated in Vayikra Rabba [21:5]: 'For with tachbulot (wise advice) you shall wage your war' (Proverbs 24:6). your God.' Weeping that results from happiness. Menachem Me'iri. 2 Zohar Chadash (Ruth:80a) notes that there 1s a good lund of tears and n bad Iund of tears. we do not say to a wicked person. and see also R.' (Deuteronomy 28:47) This applies to every service of God. however. "Be still more wicked and abstain from mitzvot. p." (Sefer Chreidim. countermand them by bundles upon bundles of mitzvot. sect. ch. come before Him with joyous song" (Psalms 100:2). T h ~~sn cludesw hen a person In d~stresss heds tears In prayer. 107. Hilchot Trfdah 156). "If onc has eaten garlic so that his breath smells. thus offers guidance that preserves and strengthens Halachic observance. 'Because you did not serve God. and below. More so ~t rncludes tears of remorse In context of teshuvah. i. and as ruled categorically by Maimonidcs in his Code. 12) This accords with the Talmudic proverb. Eleazar Azkari: "Though a person may be depressed on account of his sins.e. 4) Weeping is very bad because man must serve [God] with joy. Abundant joy in the performance of all mittvot is itself mandated by Halachah. sect.many transgressions." (R. wh~chln dlcate the sincerity of ult~matete shuvah (see . placln g h ~ tsru st In God and seelang HIS mercy and compassion to remove the angush (see below. and how much more so then to the service of prayer which is called 'the service of the heart' (Ta'anit 2a). with joy and gladness of the heart." This principle is applied on the practical level ofJewish law (see Maimonides.z 1. As for the chumrot that are stated explicitly in Shuhhan Amch. this applies only to extra stringencies that man undertakes on his own. including all its details. Chaim Ibn Atar notes that weeping (beyond the "good" types referred to above) may be the symptom of resignation. i.e. sect. or the ecstatic state of deveikut. For the Torah in its totality. it is better not to be overly stringent . Tears of anger and frustration. R. Thus bevond the moment of distress.] do not be overly punctilious in all you do. Another kind of positive (and commendable) weeping is the one mentioned here.). note 2. [As you set out to serve God. "Even so. Thus it is said in a general way: 'Even what a conscien . However. This section offers a general principle on its own. 12). Akiva's eyes when hearing the mystical meanings of the Song of Songs (Zohar I:98b). 107. or the appropriate times for prayers of penitence. signifying a lack of faith in God (Or Hachayim. but gains clarification when read in context of the sequence of sections 44-46. unlike the earlier ones whose mind was very powerful. one's service of God must be with joy. the one that results from overwhelming joy. thus we are unable to follow properly all chumrot (stringencies of the law). are not received by God (Zohar Chadash. ad [or. one must observe these wen if it appears in his mind that to do so will negate the deveikut. or in prayers for evil to come upon another. [That includes] even the precautionary laws [that are Rabbinic]. one must be very careful in this matter and weigh actual practice on the scales of the mind: if the stringency will cause a negation of dewikut between himself and the Creator. as when tears flowed from R.Zohar Chadmh. ch.). precautionary measures and subtleties. Note carefully the qualifying admonition of the Maggid of Mezhirech: "Our minds are not as powerful as those of the earlier [generations]. Moreover. [Preoccu pation with these would cause] a cessation of dewikut because of our weak mind.. was given to us solely to become attached to His great Name by means of the deeds we do. Sha'ar Ho'ahuvah. See below. He is surely wrong [in that assumption]. For true faith and trust in God must of itself lead to joy and gladness (Reishit Chorhmah.' [To do so] is but a contrivance of the yetzer 1. ad loc. Numbers 11:18). Other kinds of weeping are at least suspect. from the [time of the] Faithful Shepherd (Moses) up to [and including] the Shulchan Amch. ' In that case do not pay attention to the yetzer hara who seeks to prevent you from performing that mitzvah. Thus strengthen yourself to rejoice in the Creator. they voided Your Torah. because of a variety of obstacles. are entrrely one' (see below. Pe'ah 2. because you fully repented and resolved never to repeat your folly. even for a matter of transgression. "searches the hearts and minds" (Psalms 7:10).. 44. for that would be very base. and the notes there 3 See the rnterpretatlon of thls verse In Berachot 63a. He knows that you wish to do the best but were unable to do so. see Megrlnh 19b and Vqtkra Rabba 22 I). is an immense obstacle to the service of the Creator. but then rejoice in the Creator. Depression. do not be overly depressed lest this stop your worship. p. and h ~Ssh emonah Perakim. I e. Note there also the refe rence to "In all your ways acknowledge Him" (Proverbs 3:6). ch. blessed be He. do not feel depressed. blessed be He. [Heaven forbid]. sect. and see on this Maimon~des' Mlshnah-Commentary on Berachot 9.5.[hara] to make you apprehensive that you may not have fulfilled your obligation. blessed be He. 29a-b) 2. blessed be He. Respond to the yettious student w~llin novate In the future [was sa~da lready to Moses at SInal]' (Yerushalmi. Bear in mind that the Creator. One must be careful." (Psalms 3 19:126) This ~mpliesth at the performance of a mitzvah may sometimes entail an intimation of sin. see there. Heaven forbld.4. in turn. assoclatlng any personal delight. and 'the Torah and the Holy One. Do feel saddened by the sin [and feel ashamed before the Creator.2 It is written. Even if you are certain that you did not fulfill some obligation. blessed be He. though. On these first three paragraphs see also above. sect 54. and beg him to remove your evil]. blessed 1s He. in order to make you feel depressed. end of ch 5 . Even if you did commrt a sin. "There is a tlme to act for God. as stated by the saint. 1-4). the author of Chovot Halevo vot (Sha'ar Ytchud Hama'aseh. from the manuscript of R. note 1). that rt is done exclus~velylt shmah (for its own sake) without. Menachem Mendel of Vltebsk." (Lckkuter Amarim. " Each. The emphasis of our text is a condemnation of ulterior motives: a selfserving pursuit of "the level of R. and b) you will lose what you had already! (fiter Shem Tov.? 1. Elsewhere the Baal Shem Tov adds a warning: in trying to attain that level you are over-reaching your own level and capacity.' When serving God. sect. CJ Moreh Nevuchim L34. "Many did like R. naively emulating others to attain something that is beyond you. For a) you will not obtain what you seek. sect. and the parallel-passages in Told01 Yaakov Yosscef. Shimon bar Yochai. but they were not successful.. is counterproductive. To do so. however. Le. That is why they did not succeed. You cannot simply follow your impulse with all the best of intentions in context of what is stated here. citing Ben Porat Yorcef. you must carefully determine in your mind whether or not to perform that r n i t z ~ a h ! ~ All that I have written5 are important principles "more desirable than much fine gold. . blessed be He.) 2. The wording ("I have written") indicates that this last paragraph is an addit ion by the editor of the manuscript. 5. for the author did not record his teachings. Forewor d. and not the attainment of [high] levels. Shimon bar Yochain will not succeed.zer [ h r a ] : "My sole intent with that mitzvah is but to bring gratification to the Creator. 11. 4. 4. item is an important principle. Shimon bar Yochai." With the help of God the yetzer h r a will then depart from you. Mikeitzl and Metzora:l. The decision to proceed in such circumstances requires careful consideration. See above. Nonetheless. blessed be He." (Berachot 35b) This means that they wanted to subject themselves to many self-mortifications in order to attain the level of R. this is a very serious matter. have in mind nothing but to bring gratification to the Creator. even if they contain sacred texts (see R. even when spealung to them. Sefer Chassidim. Do not gaze at the face of people whose thoughts are not continuously attached to the Creator.5.' 1.' 13 1 "The practlce of the rrghteous 1s to suffer Insult and not to msult. 'I am greater than my fellow. for that gaze will blemish your soul. s. sect. whether it be with regard to prayer or other matters. Another important principle: When people ridicule you about your worship. This is an extension of the Talmudrc admonition not to gaze at the face of a wicked person (Megilah 28a) In the same context one should not use books written by wicked people. based on Shabbat 88b. See R. sect. to hear themselves rev~led wrthout answerrng."' (OtTot deR. do not be arrogant. 12.) 2 Haughtrness leads to forgett~ngy our Creator. Maggid Devarav Leya'akov. See above." (Marmondes. "One is not to say [in his heart]. blessed be He. Hikhot De'ot 2 3. 3. 52). Cham V~talS. Thus it is said .v. blessed be He.2 Our sages said that "man's silence leads him to humility.' Do not reply even in a positive way. ha'arer Kedushah 11.48 When you see that your worship excels that of another. 249. Akiva. so that you will not be drawn into quarrels or into haughtiness which causes one to forget the Creator. see Sohh 5a). R. your God" (Deuteronomy 814. Judah Hachassid. Dov Ber of Mezhirech. sect. as rt 1s written 'Your heart becomes haughty and you will forget God. . Dalet)' 1. do not respond. ? 2. one's whole being should be involved. I. preoccupations with the yetzer hara .. sect. See above. blessed be He. sect. idle or distracting thoughts. Intensive and joyful Torah-study helps to overcome these. and note 3 there). that for Torah-study to be effective and retained one must clearly utter the words with the mouth. All rnitzvot must be performed with joy (see above. 24). .^ 1. 10. 5 1 Torah-study must be with intensity' and great joy. but if not it will not be secure. Cf: Eruvin 54a. 119." 2. for "if it is 'ordered' in your 248 limbs it will be secure. This whole section follows upon the principle that one is affected by what one sees. 51.e. ch." (Avot deR. See above. especially when gazingwith intent." (Maimonides. foolish preoccupations.' 1. note 3..2 This will diminish alien thought^. as it is said.e. unchaste preoccupations. with all your strength and energy. . and note 1 there. to love pride or other character-traits that are evil. "Alien thoughtsn relates to any kind of sinful. those whose thoughts are attached to the Creator. "He who takes to heart the words of Torah will have negated for himself many mental preoccupations. This applies even more so to Torah-study. sect. i. 20) "Our sages thus declared that man should direct his mind and thoughts to the words of Torah and enlarge his understanding with wisdom. there is no opportunity to be arrogant. sect. ch. 44. 3.. and sect. as explained below. for unchaste thoughts prevail only in a heart devoid of wisdom. 52 When one serves God every moment. based on Kidushin 30b and Midrash Mb&i. Moreover. Hikht Issurei Bi'ah 22:21. Nathan. you ought to gaze at them and thus accrue holiness to your soul. preoccupations with idle things. 5-6. .As for fit people however. as the Gemara (Sotah 21b) interprets the verse Wisdom shall be found from 'nothing. "The Holy One. 2. blessed is He and He and His Name are one" (tbid. Words of Torah remain only with him who makes himself as one who is nothing. make every effort to do so.'" (Job 28: 12)' This means that you are to regard yourself as if you are not in this world: thus "what is there to gain from people esteeming YOU?"^ 1. thus you must give serious consideration [to this matter] at all times. blessed IS He." as it were. I. 5-6 and 10. The Baal Shem Tov continuously emphasizes the need for observing mitzvot with kavanah (proper intent). is He. 54 When studying Torah bear in mind In whose presence you learn. sect.e. 3.' 1. are entirely one. sect. with love and fear of God. . blessed. blessed IS He" (II. Do not allow the yetzer hara to dissuade you by saying that to do so may lead you to pride. sect. 62.. material reality and pursuits mean nothing to you: you are indifferent to them and you concentrate solely on the spiritual. See below. as it is written. that God is "concentrated.' 1. "the Torah 1s l~terailyt he Name of the Holy One. See below. blessed be He. 90b) 2. 29-30.Regard yourself as nothing. sect 119. In the Torah." as the Zohar states. "The Torah and the Holy One. and the Torah 1s but the Holy One.'" 2. CJ above. See above. 'Wisdom shall be found from nothing. with deueikut.6Oa). and the notes there When desirous to perform a mitzvah. 1s called Torah.' It may happen that in your study you may be removed from the Creator. You make sure to do it anyway . sect.' Nonetheless.. 126. and the Holy One. sect. strengthen yourself to the best of your ability. 74 and 117. sect. .2 No doubt but that ultimately you will act literally lishmah (for [the mitzvah's] own sake) without any sense of pride. will help you to act without ulterior motives. Cf: also below. Note carefully the more detailed restatement of this section. The yener hra is intent to prevent man from his religious obligations and spiritual involv ements by proposing misleading arguments of hypocrisy.Nonetheless. we have a clear refutation of the accusations of antinomianism by the opponents of the Baal Shem Tov and Chassidism. "You must strengthen yourself to the best of your abilityn to observe the mitzvot in ideal fashion. even when thinking that eventually it will be done properly. push it away with vigor and enthusiasm. below. Underlying this teaching is the principle that one must beware of the wiles of the yefzer hra. sect. and the Baal Shem Tov's teaching in filer Shem Tov. Thus one is to ignore these arguments and to do as many m i m t and good deeds as one can. In other words. do not refrain from performing the mitzvah but battle the negative thoughts that would prevent you from it. unworthiness. blessed is He. 3. and the notes there). and so forth (see below. be very careful: if a sense of pride arises in you in the midst of fulfilling [the mitzvah]. It is an established principle that he who seeks sincerely to be purified wil l be helped by God to achieve his goal (Shabbat 104a). It does not simply try to seduce man to do outright evil. for "out of shelo lishmah (doing it "not for its own saken) comes lishmah (doing "for its own saken).(Pesachim 50b) Do as many Mitzvot as you can. All that has been said above is not an excuse to simply go through the motion s of the mifzvot mechanically. though. Here. Oftentimes it will appear as a "pious sa~nt"d emanding optimum spiritualit y and belittling religious behavior that is not up to that par. Thus he states that one is to do them even if the ideal consciousness is as yet lacking (just as we saw earlier. sect. 91. 393. he recognizes an objective validity to the very act of a mitzvah. that he demanded Torah-study even when presently deficient of the sense of deveikut). again. 29-30. 2.3 You must. 4. even if they may not yet be on the ideal level of lishmah (for its own sake). as by rote. 4. say to yourself: "Why would I have any ulterior motive or pride from my prayer when I am prepared to die after two or three words?" Indeed. 4.? [In this context bear in mind that] there are many things about which some need be very scrupulous and accept upon themselves various stringencies.' 1. 4). because of the state of their soul. sect.56 If you feel a desire to fast. ch. Hilrhot De'ot. . Normative Halachah forbids arbitrary self-affliction. Bearing this in mind. See above. sect. Before praying have in mind that you are prepared to die from the kavanah (concentration) during the prayer.~ 1.' Indeed.~o netheless. 42. 55. This section is a duplication of above. Shukhan Aruch Harat). and Choshen Mishpat. 3. note 1. Hilchot Nizkei Haguf: par. Orach Chayim 1551. 571. it is a great kindness of God to g~ve me the strength to complete the prayer and remain alive. because the latter cause feelings of depressi~nN. and his Shemonah Perakim. 43. and the notes there. sect. while others need not be that s~rupulous. see there. See Maimonides. See above. and note 3 below. Orach Chayim. Some people concentrate so intensely that it may be natural for them to die after reciting bust] two or three words before God. 2. be careful not to negate that desire. sect. without self-mortifications. It is allowed (within certain limits) in context of teshuuah or other forms of spiritual selfcorrectio n (see commentators on Shulckan Artrch. blessed be He. you know that it is preferable to serve God in joy. 2. it may be assumed that you know of yourself that you need to fast because you did not yet correct your soul properly. ch. Do so even if this may happen several times with that same level. a vessel. sect. dqnot be discouraged by your "fall. Cf: above. the kelipot ("husks. do not be discouraged by the obstacle. See below. The word per se is like the body. blessed be He. 33. 32. Again. and then contemplate on its meaning and significance. 4." forces of evil) will not let him. Another way is . blessed be His Name.. Kaudnah can be induced by physical activity of the body. One way is to pray (initially) with raised voice (see above. note 1). "The righteous lives by his faith. with perfect faith. with all your strength. In the gradual ascent.e. At first say the "body" of the word. 72 and 86. See the parable below. the proper thought and concentration when reciting the word. 5. Cf: Gter Shem Tov." (Genesis 3:24) When a person wishes to attach his thoughts to the supernal worlds. that "the whole earth is full of His glory" (Isaiah 6:3)2--and this is when you are in the Supernal World. first recite each word. to the Creator. 84 and 137. sect. Nonetheless. 2. in spite of the obstacle." (Habakuk 2:4)3 Even if you may have fallen from your level in that prayer. infuses it with its soul. sect. I. recite the words with lesser kavanah (concentration) to the best of your ability. Man's kavanah. 17 and 284. in order that the power of the soul shine forth in Thus it is said in the Zohar (III:166b and 168a) that a 1. Thus it is written. sect. Keep trying as hard as you can and eventually you will succeed. and then invest it with its At first you must bestir yourself with your body." but gradually work your way up again. sect.58 There is "a flaming sword that revolves to guard the path to the Tree of Life.' Strengthen yourself in believing. you must force yourself with all your strength many times in one and the same prayer and attach yourself to the Creator. 3. and then strengthen yourself to return to your level. Thus you will enter the supernal worlds. The Talmud (Berochot 32b) states that prayer requlres vigor or exertion. So. 33.e ct.~ .C hrdirshei Aggadot. sect. you must guard yourself against any movements. blessed be He. the kelipor and alien thoughts which come to prevent him from having his mind on his prayer. therefore. See above." (Kear Shem TOUs. so that your deveikut (attachment) will not cease. sect. I e . sect. observers will surely not laugh at hinl and his motions. and see below.wooden beam that will not burn should be splintered and it will become aflame. 2 "At the begnnlng (of the Amrdah. R Davld . too. 33. In the state of deueikut. ad loc. one should not mock him when he tries to save himself from the 'evil waters'-i. to the Creator.. 68). 60-61 It is impossible to pray with kaoatzah (devotion) without exertion. even with the body.' 1. sect. sect.. and gesticulates in the water to extricate himself from the waters that sweep him away. 215) 6. open my 11ps and my mouth shall declare Your prase' (Psalms 51. that one must always strengthen hunself. Conscious movements. Afterward you will be able to worship with the mind alone. 58.' You must entreat God for help and assi~tance. "when a person is drowning in a river.1. swaying to and fro during prayer (Shukhn Ari~hO.17) " (Berachot 4b) The reason 1s to entreat God for help and assistance to be able to pray properly (see R Samuel Edel~s. without any movements of the body. Nonetheless. 59 and 104-105. 226).e. Kerer Shern Tov. rach Chayirn 48:l. wrth all hn energy. the essential prayer) one has to say 'God. and below. Sometimes. sect. notes 5-6.6 p~ ~~ bodily movements. and below. when you are attached to the Supernal World. See above. Ideally one should reach a stage of deueikut in which the prayers arc recited in an undertone and immobile in the consciousness of standing before God (see above. would be disruptive and counter-productrve to deveikut. sect. physlcal reality 1s transcended. 104-105. 240 and 279. 5. Ha'emunah Vehabitachon.]. all worldly desireslet alone evil character-traits-are despised in one's heart and eyes. 146. note 3). 400. you feel weak and the deveikut is lost. who is for me? [And if I am for myself. what can you do? Pray to the best of your ability with lesser kavanah until the end ofAleinu [i. 199.) As sated earlier.-The Baal Shem Tov defines this: no longer to sense the feelings of the body and this world. and God will indeed help him (above.e ct. cited in Keler Shem Tov.e. 55. the concluding p~ayer]. Cf: Zohar I:243b: "[R. Your thoughts are but on the supernal worlds. sect. unaware of your existence in this world. Cf: also Maggid Devarav Lep'akov.~ Abudraham. or he is in distress and unable to recount the praises of his Master?' [R. Shulchan Amch. sect. and note 14 there). and $ Nachmanides. Shemonei Esrei. Orach Chayim 98:l. sect. I will certainly have no fear of alien thoughts. Abudraham. For when I am divested of this world. and see there also sect. in the end. on the spiritual reality underlying everything. and are totally meaningless in view of one's longing for the Creator.'" 62 "If I am not for myself. sect. Yosse] answered him: 'He may not be able to concentrate his heart and mind. 'When I reach the level that I am altogether unaware whether I am in this world or not.' That is to say.239 and 284.Consider that it is to your benefit when God helps you to have complete kavanah for half or most of your prayer.. 3. alien thoughts 1. (fikr Shem KJVs. what am I?. and you vest your mind and soul into these thoughts. s. ch. Chizkiyah asked:] What of a person whose heart is troubled and he wishes to pray." (Avot 1:14) When praying one must be like divested from physical reality. If. but why should the order of his Master's praises be diminished? He is to recount the praises of his Master in spite of his inability to concentrate.) . 43. and then pray. one may place his trust in God to enable him to do mitzvot (above.v.. sect. when I regard myself as something substantial and real In this world. sect. See.2 At times. and of what value is my service before God? For then alien thoughts will disturb me and I am as nothing in thls world. When you want to seclude yourself [with God]. .' a companion should be with you. as he reduced himself to naught. though.e."= This is the meaning of "who is for me?. each one secluding himself on his own with the Creator... 2. "that no other person be there. you can practice solitude even in a house full of pe~ple. as also the thoughts of another." i.4 2. The principal purpose of man's creation in this world is service [of God]. for even the chirping of birds can interfere. he is unassaila ble by alien thoughts or negative forces. This is the meaning of "what am I?.~ 1. sect. 3. Keler Shem Tov. that hitbodedut (meditation in seclusion) is an effectiv e way to attain deveikut. that the pursuit of deveikut beyond the periods of prayer is better in total seclusion. sect." 3.3 but I am unable to perform His service because alien thoughts disturb me. Two people should be in the room. See below. beiow. 82.will not approach me. 216.. In the state of self-negation (4 above. Kidushill 82a 4. In the state ofdeveikut one is oblivious to all surroundings. See also the shorter version of this section.e. Moreover. what alien thought will come to me? But "If I am for myself. It is dangerous to do so alone. then 1 am really as of no value at all." i." i. when attached [to God]. 53) he is indifferent to worldl y concerns and desires.e. blessed be He. 97. of what significance am I. is for the sake of an "ascent. and Egypt signifies the kelipot ("husks. At other times this fall may be caused by the environment.. and promising him every manner of blessing. He caused a famine in the land which forced Abraham to descend to Egypt. however. So. The "descent". because God knows that you need this. note 1. thus motiva te him to make a greater effort to regain his loss and attain yet higher levels." forces of evil)4 1. These two reading converge in the Baal Shem Tov's interpretation of this verse with a parable of a father teaching his child to walk: every time the child takes two or three steps toward the father. Others (Targum. Thus "He will guide us to death." Still others (see Ibn Ezra) read the one word almut to be derived from helem. reduction in rank is tantamount to death (Tanchuma. Zohar III:135b: "The term death applies to anyone who was lowered from the earlier level he had"). Lerh: 5. i. "He will guide us a1 muth (lit. This will surely cause him to be disturbed. God tested Abraham: right after telling him to move to the Holy Land. quoted by Rashi).e. in order that he bestir himself to greater ascents.." i. Rimzei Rosh Hashanah. "And Abram descended to Egypt" (Genesis 12:lO) and "Abram ascended from Egypt" (Genesis 13:1)? Abram signifies the soul (Zohar I:122b). He does not realize that he has not yet reached his full potential. . Degradation. a concealment of God.e. 237. concealment. to reach a higher level." (Psalms 48:15)2 It is also written.Sometimes one may fall from his level on his own. to death). Vayech i: 2. whether or not he would question the original command and promises (Tamhma.) read al-mu& as one word which means "youth. 2. 3.. (Kpdushat Levi on Exodus 3: 11. too. to redu ction in rank. 67. By attaining spiritual levels one may feel content with that achievement." i. the father distances himself in order to make the child walk further. in order that we make an effort to ascend higher. more extensively in Turei Zahau.' Thus it is written. God is the "hiding God" (Isaiah 45:15) in order that one come yet closer to Him.e.) There is then a "falln for man. Thus he will "fall" to a lower level. and briefly in Keler Shem Tov. See below. sect. Rashi etc. childhood.. sect. This ordeal was a test of Abraham's faith. 31. Tiklrnim:llBc) You must perform your deeds in a concealed manner.' Otherwise. 132).2 Your [good] intention of lishmah (for its own sake) may thus 1. his soul and all his possessions.A test (nisuyon) is meant to ekvate the person: "&mot-in order to test you" (Exodus 20:17). This section cautions.When the soul is saved from that 'evil officer' .' that is. I f : Zohr I:140a. and is indifferent to being recognized or esteemed by others for his good deeds (see below.). The best intentions. " (Zohr Chadash. "What is the meaning of 'Abram ascended from Egypt'?. 99 etc. the lung of the oppressors that distress the souls. Cf: Keter Shem Tov. ." returning enriched both spiritually and materially. 95.. quoted by Rashi. therefore. sect.g. sect. and already discussed earlier at length by Maimonides (Shemonah Perakim. 2. 4. what is written of the masters of the soul? 'Abram ascended from Egypt'! He is raised beyond them. the demons . though. and below.. thus "Abram ascended from Egypt. wili prove counter-productive. scrupulous commitment to Halachah. 9. if you act openly like [the rest ofl the world. by acting in the unrefined manner of the masses before attaining a high level. 27 and 151. The concealed form of worship is a sign of sincerity... the 'king of Egypt. ch.. sect. you may be drawn to become like [the rest of] the world. the destructive angels. 122)..e. It shows that man thinks but of God alone. The Baal Shem Tov thus cautions that you must first prove yourselfwith normative religious behavior. This is a continuously repea ted principle in Sefer Hachinitch (e. i. that before being able to choose this path you must first assure that you have reached a high level of thorough training and commitment to act properly. 16. 4). 40. i t .. and only inwardly seek to be pious. A person is influenced by his deeds and actions. may condition a person to become like them. before trying to become a "secret" or "hidden" saint. with great strength-he. sect. Bachodesh: ch. so that people will not note your piety. To pretend to be a simpleton. But before you reach a high level you must act openly. to elevate and magnify you (Mechilta. Abraham did not waver in his faith. . The state of fear or awe is attained by contemplating God's majesty. "'Fear of God is the beginning of wisdom . or reverence. for surely without entering that gate one will never gain access to the Supreme King.) There is. as in the presently stated condition. sect.' for it is the gate to enter before God. with ulterior motives). His great and wondrous works and creations. and below." (Pesachim 50h." When you wish to pray. and then you will be able to enter the supernal worlds.e. of God. Hilchot Yessodei Habrah 2:l-2 and 4:12) This contemplation is a prerequisite to prayer when one must be aware "before whom you standn (Berachot 28b). that it is done] shelo Eishmah (not for its own sake)? 3.. ." Contemplate His greatness and exaltedness. also the danger. (Maimonides. "to think of the exaltedness of God and the lowliness of mann (Shulchan Aruch. and 6 Shbbat 31b) 3. first bring yourself to a state of awe. It goes through stages of ebb and flow. that "out of doing it lishmah one may come to act shelo Ikhmah. Fear. though. "One should always occupy oneself with Torah and mitzvot though it is yet shelo lirhmah (not for its own sake. 2.' (Psalms 111:10). "ratzo veshov-running (ad . without any ulterior motives)." (Zohar 1:7b.2 Say in your heart: "To whom do I wish to attach myself? To the One who created all worlds by His word. . sect. for out of shelo lishmah one will [eventually] come [to doing it] lishmah (for its own sake.result in [the very opposite thereof." limited or restricted consciousness):' he does not enter 1. see above. Orach Chayim 98:l). 'This is the gate to God' (Psalms 118:20).' 1. 55. i. gives them existence and sustains them. and realizing one's own insignificance. 126. Man's consciousness cannot always concentrate on the ideal level of sublime deveikut. . Sometimes a person worships in a state of katnut ("smallness. . sect. ~ tess sence or soul is kauanah. as it were. See also below. they are in principle unavoid able: it is impossible to remain in a constant state of ideal dewikut. too. are merely the body of prayer. sect. 121). 111. as explained here. Prayer is zivug (coupling) with the Shechinah. 137. Thus we see that if there remains a single spark among coals it can be blown up to become a great flame. sect. 69. so. Nonetheless. here are "C~lls"( descents) from the state ofgadlut ("greatness. The words of prayer must be articuldted (Berachot 31a." (Likkutin~Y ekarim." expanded consciousness) to katntrt that may come about by one's own doing or as part of the natural phases through which the soul passes. 217) The aforementioned consciousness of Divine omnipresence is itself a degree of dewikut. and that he is close to [God]. sect. sect. however . this does not mean that deveikut itself has to cease altogether: there is an ebb and flow from one stage to another. is directed to [the fact that] "the whole earth is full of His glory" (Isaiah 6:3). In fact. or (b) as a "descent for the purpose o f subsequent ascent" (see above. the mental ~nvolvement and concentration (see above. 3. sect. "Even when you 'fall' from your level. The words. By virtue of that kamut you can come togadlut. however. albeit on the level ofkafnul. These are not necessarily failures: they may happen (a)in order that the soul "regenerate" itself.' Just as there IS motion at the beginning of coupling. remain attached to the Creator albeit with a small thought..-See below. At the same time. however. His thought. 64). Even in the state of katnut one can easily remain conscious of the omniprcsen ce of God. sect. one must 1. 2. he does so with great deveik~t. though worshipping on a level of katnut. Zohar III. because that deveikut would then turn into something common and natural and would not be appreciated-for "continuous delight ceases to be delight" (see below.294b).* In that state he is like a child whose mind is but slight and not yet developed. further on. 171. Ketrr Shrn Tov. thus also one's own closeness to God at all times.~ vancing to absorption in spirituality) and returning (recoiling to mundane reality)" (Ezekiel 1~14)T. and Keler Shrn Tov.the supernal worlds at all. 58) Prayer is . sect. 3. sect. however. you can attain great bestirment. note 42. 2. sect. Keter Shem Tov.e. sect. therefore. 67. Thus you can ascend from katnut togadlut.'" (Maimonides. the Shechinah. Thereafter one can stand still. 2. For you think to yourself: "Why do I move myself? Presumably it is because the Shechinah surely stands before me. and Zohar II1:247b). Prayer thus expresses the soul's longing for Divinity ("My soul thirsts for You. that is where he is himself. You may be in a state of katnut ("smallness. you will then think of the Supernal World. 58-59. and absorption in. 1. See above.. without motion.2 As a result of your swaying. rf. Man himself. sect. is where his thoughts are.move (sway) at the beginning of prayer. 104-105. therefore. as Solomon expressed it allegorically (Song 2:s) 'I am sick with love. rapture). (This oft-cited concept of the Baal Shem Tov appears also in a modified version: "Wherever the person's will and thought are." restricted consciousness) with great attachment to the Shechinah." fiter Shem Tov. you would not have thought of it at all. prayer is "zivug with the Shechinah" (see Zohar II:200b and 216b." the depth of man's heart and soul seeking union with. its ultimate root and source. 16 and 362).) . Man is identical with his thought (Tikunei Zohar 21:63a.' If. Hikhot Teshuvah 10:3) In the metaphorical terminology of the Kabbalah. and below." Psalms 63:3).. sect. attached to the Shechinah with great deveikut.2 For a person is where his thought Thus if you had not been in that upper world. you will instantaneously be in the upper worlds." This will effect in you a state of great hitlahavut (enthusiasm. "deep calling unto deep. See above. "being bonded to the love of God. Addenda. continuously enraptured by it like the love-sick whose mind is never free from hi passion. i. 38. my flesh longs for You. sect. leads to unity with their inherent Divinity: a state of deveikut. sect. See Keter Shem Tov.' 1. the evil mind and alien thoughts opposed to holine ss. The Baal Shem Tov interprets dimilich as an idiom of the root-word damam (to keep silent). my beloved (it is better to stop praying until that impediment is removed). 7). This is the meaning of "[My love. 71 If you have an alien thought when praying. The lights of the letters are 'chambers' of God into which He draws His emanations. 64. dimitich (I compare you)] to a horse in the chariot of Pharaoh." forces of evil) is riding on [your] utterances. 5:20b and 47:84b): they are the "vehicle" subservient to. . . the rider (the soul. Pharaoh signifies kelipah. ibid.e.. place your whole thought into the power of the words you articulate until you perceive how the [Divine] lights in the words become enkindled from one another. Note Maggid Devarav Leya'akov. therefore. attachment and cleaving unto God that one does not want to let go of. for thought rides upon the [words ofj speech. 46-47 ($ Kerer Shem Tov. taking him to places he is unable to reach on his own (see Maggid Devarav Leya'akov. rides upon them.Deveikut means that when saying a word you prolong that word extensively. then "my love. and guided by." (Song 1:9) Words are referred to as horses. i t . alien thoughts ride it). 284): "When praying. Heaven forbid. draw it out. By virtue of deveikut you do not want to let go of that word and. then dimiri chI silence you. 44 and 192. sect. man's thoughts and mind). Cf: above. sect. note 4. dimitich": it is better to be ~ilent. The words and letters of the Torah and prayers are compared to "horses" (Tikunei Zohar 8a.. kelipah ("husk. therefore. 2. Addenda." The concentration on the words.~ 1. The proof-text thus reads: if the "horse" (the words of prayer) is in the chariot of Pharaoh (i. the allen thought. thus generating various lights. 3.' When Pharaoh. sect. sect.5 4. See above. 1. when [you feel that you are] unable to pray. as is well known. s. Strengthen yourself all the more1 and the awe [of God] will come upon you ever more. [they enter] the heart of Above. uttered with k a v a ~ ahn d fervo r. Sha'ar 13. Thus fortif. ofwhich the Zohar states that "he who exhales. Those who are wise recognize him by hls mannerisms. . his innermost vitality. (p. Those who are less wise recognize the king by noting the place with extraordinary guarding: surely that is the place of the lung. Breath comes from exhaling.. Sob)."4 i. from his inwardness. lev tov. Sometimes. You must know that there is additional guarding all around the King. do not believe that you are definitely unable to pray that day. see there. 5. The King is there. Words that ascend are those which are fonned by the "exhalation" rooted in the very core of man's heart. 58 and 60-61. 2.On the other hand.3 Thus it is when you are unable to pray with kavanah. great strength and additional kavanah. Awe of God is a prerequisite for proper prayer (above.v..e. You will then be able to pray with exceeding kavanah. sect." i. i.. so that you will be able to come close and pray before God. 86. exhales from within himself.e. sect. "words that come from the heart enter the heart. Sha'ar Ha'otiot. cited in Shenei Luchot Haberit.2 This is comparable to a king who sets out to wage war and disguises himself. 66).e. Tam). but you are unable to approach Him because of the special protection surrounding Him. A popular proverb stated in Sefer Hayashar (attributed to R. by means of the breath. l yourself with awe. 3. This parable is cited again below. and the numerous parallel passages). do so for the sake of the "heaviness in the Head. Emphasis on personal desires.c. Rosh Harhanah 16b. that appears frequently in Talmud and Midrash (Sanhedrin 46a. i. therefore. The Shechinah is referred to as "Head" (seeZohar III:187a). thus draws attention to his sins and failures (see Berachol 32b. essentially based on Isaiah 63:9 and Psalnls 91:15. Nonetheless. 5. reflect. By implication. applies to the Whole as well. Koved rosh... may be counterproductive: it causes a celestial "auditn of the supplicant's record. Sgie on Numbers 10:35. 4. an analogous condition Above." For whatever you lack. sufrering is sensed by the soul (the "limb" of the Shechi . [as ~t For man is a "part of God from on high. Midrash Tehilim 20:l. Tiktrnei Zohar 3b). He who does not pray dally for sustenance 1s of little falth (Zohar II:62a-b) . To beseech God for our constant needs IS an expression of our bel~efin God and Divine Providence."4 Any deficiency in a part. "heaviness of the head.2 If you wish to pray.e. this concept must be placed in the wider context of ultimate reality where events and conditions on earth reflect spiritual "events and conditions.) 3.e. an acknowledgment of Divine sovereignty and our continuous dependence on God for everything we have and require. This is the anthropomorphic concept of Divine pathos.' 1. in it s literal meaning of "heaviness of the head.. Deficiencies and suffering on earth. soul-less) body does not feel pain or sense any needs. I. and the Whole senses the deficiency of the part. Job 31:2. it is not the ideal prayer. expecting that God will grant these desires as compensation due for praying. Mechilla on Exodus 1241 and 17:15. therefore. in the Shechinah. then.73 "One should not rise to pray but with koved rosh (lit." would thus refer to the afflicitive heaviness of the Shechinah." humility). as it were. let alone pre sumptuous "calculation on prayer" (iyun @/ah). Every soul is a spark or "limb" of the Shechinah (Zohr III:17a and 231b). 2." (Beracht 30b) This means: do not pray for that which you lack1 for then your prayer will not be acceptable.. The lifeless (i. The Shechinah is the very root and source of all souls (Zohr I:25a." This section explains this wider context and its implications. and the commentaries ad lor. the sufferings the Shechinah shares with man. that same deficiency is in the Skechinah. the Sltechinah). therefore. If the pain or deficiency IS sensed by the part. Nonetheless. he has ceased to be wise. and see also Maggid Deuarau Leya'akou. Likkutim) Even so. the other (Tikunei Zohar 6:Za) refers to those who pray for their personal or material needs as "arrogant dogs. note 1) states that one must pray daily for personal needs. Selah' (Psalms 3:9).. God examin es the heart and knows the truth. sect. by the indi vidual extension of the Shechinah." (Likkutim Yekarim.6 This is the meaning of "but mitoch koved rosh (because of the 'heaviness in the Head'). 53. pray for all and any needs. should be for the deficiency in the Whole." nah). barking hau hau-give us food"! The Baal Shem Tov explains: One may. if for no other reason but the acknowledgment and consciousness of Divine sovereignty and every thing's total and continuous dependence on God." (Psalms 36:4-5) ." by the Shechinah per se. indeed must.) In this context the Baal Shem Tov resolves two contradictory passages: one (cited above. for "as his prayer is answered and 'Salvation is [wrought] unto God (i. Better to be honest and pray for yourself than the falsehood of pretending concern for the Shechinah! (Keter Shem Tov. sect. Prayer on behalf of the Shechinah (the 'Wholen) of itself covers the problems or needs of man (the part of the 'Whole"). not the body. to do good. 6. the Baal Shem Tov cautions: "The worker of deceit shall not dwell in My house. never pretend to pray for the sake of the Shechinah. (Degel Machaneh Ephrayim. sect. 123.e.Your prayer." (Psalms 101:7) Thus when overcome by the anguish of personal needs and unable to rise above this. he who tells lies has no place before My eyes. it is sensed also by the 'Whole. 395) "The words of his mouth are evil and deceit. one is not to lose perspective: do not get carried away by transien t details instead of concentrating on the whole.' this brings about also the conclusion of that verse that Your blessing is upon Your people. there is no remedy. and how to worship Him. blessed be He."' The second one is blinded by the yetzer hara and imagines himself to be altogether righteous. He is unaware of the essential form of worship that is required for proper [Torah]-study and prayer. thus how can he return with teshuvah? Thus when the yetzer hara seduces man to cornnut a sin. For the second one.' 1. however. 78 and 114. 2. and to perform a commandment lishmah (for its own sake). to entice man. Their sense of self-righteousness thus preclude s them from teshuvah. however. He is righteous in his own eyes. as well as the perfect faith that is required for constant attachment unto Him. He may study Torah continuously. sect. who might not succumb to blatant sin. Torah-scholars. "he knows his Master yet purposely sets out to rebel against him. beggng God to show him "the way where light dwells" (Job 38:19). 117. A Midrashic expression for one who brazenly acts wickedly (Sijia. 55. pray and afflict himself. blessed be He. blessed be He. and also appears as such to people. The yetzer hara disguises himself as yetzer tow. The first is altogether wicked. he will make it appear to hlm as though he has performed a mitzvah so that he will never repent. sect. his effort is all for naught. and the notes there. See bclow. Cf: above. as an advocate for good. His greatness. sect. cited by Rashi on Genesis 10:9). Bechukotay. Simple people he leads to blatant sins. because he lacks attachment [deveikut] to the Creator.There are two types of [wicked] people. The difference between these [two] is as follows: The altogether wicked one can be cured from his affliction: when he is bestirred by the sense of teshuvah and returns to God with all his heart. Keter Shem Tow. In truth. . he leads to sanctimoniousness by urging them to study Torah and perform mitzwot in an inappropriate way. His eyes are bedaubed from seeing the Creator. He approaches each one on his own level. and a review of.. note 2. his spiritual record and status (Berachot 32b and Rosh Hashanah 16b). . sect. for a similar interpretation of our proof-text. "recalls his sins* by drawing celestial attention to. . said: "Make a light for the teivah (ark) [and finish it to (the width of) an amah (cubit) on high .e. Israel Baal Shem [Tov].6 That is. Every letter harbors Or Ein Sof (a light of the Infinite)." 2. as stated above. Teivah also means "word. the words of the yetzer hara. to do good. sect.) 75 R.. Every word is a "complete structure" (above.' All this is the enticement of the yetzer hara. 118). sect. 4. Thus "he4 has ceased to be wise. He does not realize that this only recalls his sins. souls and Divinity. which is its individual aspect of Shechinah (Divine Indwelling). sect. he prays to God to heal his illness by virtue of the Torah and Mitzvot he had performed. 34). "he devises evil on his bed" (Psalms 36:5)."2 These ascend and become bound up and united with one another. 5.This is alluded in the verse "The words of his mouth3 are evil and deceit": the yetzer hara deceives a person by malung it seem to him that his transgression is a mitzvah. 3. 124. for another emphasis on the pitfalls of self-righteousness. l. sect." i. 6. The verse following immediately upon our proof-text. 1. See als o below." (Genesis 616) This means that the teivah (word)' should shine. The victim of the yetzer hara. [This will be understood by the following:] Every letter contains "worlds.5 More serious yet. [the yetzer hara] deceives him further as follows: when he falls [ill and is] bedridden. 73. 117. every letter a "compl ete world" (below. he has left off from ever repenting. . (Cfa:b ove. Quite clearly this will not be to his benefit. Man's expectation that God grant his wishes as compensation due for his merits.I. See below. peace be upon him.e. 7. " the second one to the aspect of "Souls. by the Baa1 Shem Tov's grandson and disciple R. compounding the Worlds of Beri'ah. (b)the second level of Divine concealment which is referred to as the World of Atzilrrt. it is cited also.e." is. 1. the intermediary facultjcs). 175. The letters then unite and become bound together to form a word [teivah]. sect. p. to make it possible for the or to be contained in the keli. sect." R." the Divine lights). note 1. however. Sha'ar XDL See filer Shem Tov. R. [This is the Baal Shem Tov's terminology for what R.). Yefzirah andhiyah. in Degel Machaneh Ephrayim.^ All worlds will then be unified as one and ascend. must include his soul in each of these aspect^. as the (relatively) finite keli is to contain the infinite or. and this effects immeasurably great joy and delight. there is need for an int ermediary to bring them together.] .with Divinity. Mosheh Zaccuto that these are (a)the first "world" (level) of Divine concealment which is referred to as Adam Kadrnon.." See Degel Machaneh Ephrayim.1 3. relates the three levels in the ark to the individual Worlds of Beri'ah. 5. in current editions. second and third [stories]" (ibid. The bottom floor refers to the aspect of "Worlds. blessed is He. needs a keli (vessel) to contain it. Chaim Vita l. 276. Isaac Luria refers to as "oror (lights)-rritzofrim (sparks)-keilim (vessels). Mosheh Chaim Ephraim of Sydilkov." i. [Shenei Luchot Haberit. See there the commentary of R. and Elokut ("Divinity. sect. Man. and (c)the third level of ever-increasing concealment. souls and Divin[for "The Holy One. 42. 6.. Parshat No'ach (p. neshatnol ("souls. No'ach.] has three worlds [in which He is concealed]'"Zohr III:159a 7). Yelzirah and Arsiyah. This whole paragraph appears also (nearly verbatim) in the Baal Shem Tov's famous letter to his brother-in-law. This intermediary is referred to as neshamah (soul). p. 9dJ). Thus each letter compounds olamot ("worlds. Addenda." and the third (upper) one to the "Divine Lights. with elaboration. therefore. No'ach. Moreover. The or (light). see Keter Shem Tov. becoming truly unified in Divinity.4 This is the meaning of "[make it with] bottom. Abraham Gershon of Kitov. the "vessels"). 4. Eitz Chayim. lb. referring to "worlds. See above. 8. a case of "he that murmurs separates the Master [of the universe] . because it is the Shechinah [Herselfj. the aspect of Divine transcendence) and the Shechinah (the aspect of Divine immanence).With every word you must hear what you say. 43. sect." The Kabbalistic term ima (mother) is synonymous with Shechimh.. It causes a separation between the "Master of the Universe" (the Holy One. level or category. 1. that it emerges with brightnesss and to bring gratification to your Maker. [See above. Human speech is a manifestation of the soul. Zohur III:3la." who speaks.9 Without faith. that you make a light for the word. as the Shechinah is referred to as "true faithfulnessn (Isaiah 25:l. Benishif:lOd). This requires great faith. Heaven forbid. The Kabbalah. which Targum Onkebs and Targum Yehonathan translate: "ru'ach memalala-a speaking spirit* (see Rashi and Nachmanides on this verse).e.. 9. note 4). it is. you make it shine brightly (as stat ed above. by uttering it in proper manner. two levels of the Divine manifestation that is called Shechinah: (a)imah ila'ah. which corresponds to the Sefirah ofMalchut. General reference to Shechinah. 73. and 6 Zohar Chadash.e. you must be conscious with true faith of the presence of. blessed is He. i. therefore.' provided that [the word] has a "light. see Zohar I:22a and III:16b). which in the sphere of the Sefimt corresponds to Binah."" 7. raise the prayer) to imah. When that soul was infused into the body of the original human.: a living being)" (Genesis 2:7). thus rooted in the Shechinah. the supernal "mother" (supernal Shechinah).] 11. 10. "man became a nefesh chayah (lit. sect. the Shechinah. notes 7-8.. "Finish it (i. The term "world(s)" in Kabbalistic and Chassidic thought does not refer to geographic areas but to a spiritual realm. Man's soul is a spark or "limb" of the Shechinah (see above.e." (Proverbs 1 6:28)1° [The concluding phrase] "finish it to an amah (cubit) on high" means "to imah (the 'mother'). however. in the first paragraph). and relations hip with.. The Shechinah. is referred to as the "World of Speech" (see Zohar 1II:228b and 23k. the "World of Speech.e. speaks of imah on two levels. the lower "mother" (lower Shechinah)." i. . and (b)imah tata'ah. 1. Tikunei Zohar 2b and 5a.e. on the concepts of the unity and separation between the aspects of Divine transcendence and Divine immanence.. open my lips . (R. thus the "lower Shechinah". The brightness there is very great. Joseph Gikatilla." relates to imah tata'ah. ["Prayer is speech. Thus. in any case." As the prayer is infused with true devotion (kavanah) a ascends on high to the "supernal recess" (the Sefirah Bimh.] The same prayer concludes with the verse "May the words of my mouth and the meditations of my heart be to ratzon (find favor) before You. open my lips and nry mouth will declare Your praise" (Psalms 51:17). That is.e. Ratzon signifies the highest S$rah (Gter)."'Z and especially in terms of 'World of Speech. "Meritorious is the mouth that by prayer provides a resting-place for the Shechinah. 'We raise the World of Speech to the World of Thought. The principal prayer (the Amidah) starts with the verse "A-D-N-P (My Lord). . analogous to the sun which we are unable to gaze at because of ILS intense brightness." (Maaid Devarav Leya'akov. indeed are unable to) see it ascend to the higher realm" which. whence they ascend further on their own.. The term A-D-N-Y signifies the lowest Sefirah (Malrhut). .." Tikunei Zohar 2b. sect. just as one is not able to look at the sun." 12.. one does not see it ascend to the higher realm. cited in Keter Shem Too. 160. the Sefir ah of Malchur. God. Tikunim." (Psalms 19:15). Sha'arei Oruh. The speech of prayer. 101d) This is the ultimate conclusion of prayer. it is the Shechinah. The mystery of speech is 'A-D-N-Y. When praying we raise the words of the prayer from Malchut (the World of Speech) to B i d (the World of Thought). sect. as it is said 'you makc the mother lie down (rest) between the lips' (Psalms 68:14. is beyond our grasp. 400. This is the meaning of "finish it on high. to make the 'supernal mother' rest between them.. end of Sha'ar 11) Thus "you do not (need not. it is A-D-N-Y. IS on the level of the "lower Shechinah." (Zohar Chadash. the "supernal mother" or "supernal Shechinah") "whence issue all blessings and all freedom to sustain everything" (Zohar 1:229a). the World of Speech. interpreting the word im (if) to read eim (mother-ee Tik~rneZi ohar 18:34a). and see also Zohar III:228b. "finish it to the imah.) . . on high.. therefore.Alternatively one can interpret as follows: Once the word has left your mouth there is no need to mind it any more. i. the moment you separate yourself from your deveikut (attachment. Shulchan Aruch. i. or worship of God)..e.. body and mind. and this is tantamount to idolatry. 33-34 and 60-61.One can achieve this by "Come into the teivah. the way of God." .e. Israel Baal Shem [Tov] : "For My thoughts are not your thoughts.." (Deuteronomy 11: 16)2 Nonetheless... 228. you are worshipping idolatry.e.e.1 2.. 1. it is as if you serve 'other gods." (Isaiah 55%) This means: the moment you separate yourself from God. neither are your ways My ways.e. [A teaching] of R. even in all your personal and physical pursuits and engagements (Maimonides.I3 13. (Me'or Einayim. I. by concentrating on the words of prayer with your whole being. the moment "you turn astrayn-"you serve other gods. CJ: above. [R.. then) your ways are not My ways (i. to forget the obligation of "Acknowledge Him in all your ways" (Proverbs 3:6)-i. I.' God is the sole true reality . with all of your body and strength. This is the meaning of "you turn astray and you serve [other gods] .' There is no middle ground. sect. you with all your familyn (Genesis 7:1).e. To ignore this principle.e. they are not hound to God. Shemot)] The Baal Shem Tov thus reads our proof-text: 'When your thoughts are not My thoughts (i. it is accounted to 1. Hilchot De'ot 3:3. sect." (Cf: Maggid Devarav Leya'akov. bond) with God. everything is continuously dependent on God for its very existence. Orach Chayim: 231)-is like denying this principle and setting up an authority or power independent of God. Menachem Nachum of Czernobyl notes that the Baal Shem Tov would frequently cite this interpretation of Deuteronomy 11:16. the Talmud states (Makot 23b) that "he who refrains from committing a transgression. sect 43."' 3.' Rather think to yourself: "Of what esteem are my deeds compared to the service of the angels whose service of God is constant? I am but a 'putrld drop'2 and my end is unto dust!" 1 See above. Indeed. again. and at the end of the last day your harbored an ultenor mottve ." the s~deop posed to holmess) 2 Auot3. Then. note 2 "for then 'your ways are not My ways'"). btrl My ways": when you overcome the temptation to commit a transgression. even the slightest. and that the fasting will greatly purify you. on the proper medttat~ons when fast~ng Ultertor mottves. sect 188. sect. thus "not [following] your ways. Do not say in your heart that you are doing something great by afflicting yourself that much.e.him as if had performed a mitzvah. let alone a sense of self-sattsfactton In thlnlung to have attamed sp~rttualh etghts and perfection. "If you fasted from one Shabbat to the next.. The last sentence may be a summary of the general principle stated in the first paragraph (as rendered above. you have lost all the good stored for you from your fast and your effort was for naught. it may relate specifically to the second paragraph by interpreting it "and not your ways.1 78-79 In the middle of the week' the yetzer hara will sometimes over-power you. are the very antt-thests of D~vinew orshtp (see above. from one Shabbat to the next . do not harbor ulterior thoughts. 196) The parallel-passage of thts section tn Ltkkutrm Yekanm. sect 11-12). 77 When you fast." 'This is the meaning of ''your ways are not My ways." it is accounted to you as if you had performed a mitzvah (i. even if it be from one Shabbat until the next. it is "My ways. by making it seem to you that your fasting is 1.")." (Magtd Deuarau Leya'akov. When fasting a whole week. thus adds here "Thls fast goes to the srtra achara" (the "other side. sect. See above. 43. but as you over-power him. This does not imply that you should have in mind the attainment of a higher level. 9. the side of evil) is subdued for the sake of His service. If you are wise and over-power the yetzer [hara].very difficult for you. 3. 47). See above. Beseech the mercies of the Creator. 77. Rather. and which prompted you to undertake the fast. sect. blessed is He. Thus it is said in the Zohar (II:128b and 184a). at the conclusion of the fast. sect. text relating to note 11. for that would be counter-productive (as stated above.4 The yetzer hara is sometimes allowed to cause you great pain. blessed be He. This . that you no longer sense the great pain you felt at the time. the yetrer hara does not want you to acquire the purifi cation for which you felt a need in context of teshuvah (return and attachment to God). and 4 sect. the sitra achara is very much subdued.? Understand that the yetzer [hara] is envious of you. 43. Sometimes you need to gaze in different directions in order to attach your thought to the Creator. and saying that you are unable to bear it. you will effect something great on high. This happens to test you whether you will persist and over-power the yetzer hara. sect." The yetzer [hara] greatly desires to prevent you from fasting. "The glory of the Holy One. you will note] afterwards. [If you do so. is increased when that sitra achara (other side. lest you attain a [higher] leveL3 That is why he instigates so much against you. See above. 4. 5. to strengthen your eyes so that they will not be affected adversely by your fasting5 2. blessed be He. blessed be He. the principle of "Acknowledge Him in all your ways" (Proverbs 3%. 11.' 1. the mystical meanings of the Torah. and in that state of attachment pray for some need of your household. The principle that hithdedut is conducive to dewikut is stated already in Reishit Chochmah. CJ above. An important principle: Attach yourself to the Creator.' ~1. ch . sect. and 76. however. sect.' by writing "secrets of the Torah. This will acclimate you to the reverse: you will be able to invoke deveikrct during times of mundane involvements. Thus you must work your way into it. 3 and 10. C' above.is necessitated by the materiality of the body which is an obstructing barrier to the soul. 140. One merits deveikut by hitbodedut (seclusion) from people. ibid. note 1.. This would then apply especially to razei Torah. Do so in order to train yourself to have your thought attached to the Creator. see above. Sha'ar Ha'ahavah. sect. The advice given here is to train yourself into that frame of mind by gradually introducing mundane involvements during the "safe* times of deveikut. 4 and 10). note 2. The materiality of the body can be overcome by diffusing it. sect. below. to become accustomed to a state of deveikut at that time. which are called nishmata de'orayta (the soul of the . even when you are involved in actions or speech relating to material matters. is a precarious and hazardous task. The ideal service of God is not by separating yourself from the world and physical reality. On the contrary: the latter must be sublimated to holiness. 63. Profound deliberation in Torah leads to dewiktrt (Reishit Chochmah. the last paragraph of sect 58. 2."? and by performing the yi1. ch. or do or say something though there is no need for that act or speech. CJ below. 94). This. blessed be He. Gazing in dlffer ent directions will break the body's concentration on any of its physical pursuits. The mystics are very emphatic on the special virtue in joining the night to the day (in the morning) with Torah and prayer (see R." (Maimonides. Shenei Luchot Haberit (cited by M a p Avraham. The concealed aspect (soul) of the Torah connects with the concealed aspect (soul) of man. 5. your service must be singularly [devoted] to Him. . Sha'ar Hakauamt." This is an important principle. Man must always have but a singular thought in the service of the Creator.' Thus it is written. that is. Isaac Luria offer the meditat ions to effect yichudim. 4. . too. sect.. Moreh Nevuchim III:12) . blessed be He. Orach Chayim 1:l) states that this applies also to joining the day to the night (in the evening). note 4. but they sought manifold contrivances. be scrupulous in rising at midnighe and to join the day and the night [with Torah and ~rayer]. ch. and ibid. 7:29). of blessed memory? When performing yichudirn. Cf: Maimonides. "God made it that they will fear Him" (Ecclesiastes 3:24) and "[God has made man upright.e.~ Torah. See above. ch. Zohar 111:152a. Sijia (Shemini) states: "Remove the yetzer hara from your heart . As [God] is singular in the world. Torah-study at night is especially conducive to deveikut (Reishit Chochmah. the thought of devoting himself to the service of God. your manifold thoughts cause you to be confused.. 16 and 26-27. Hikhot Shemitah Veyovel13: 13. meditate on God's greatness to the best of your ability. Isaac Luria. Derushei Halailah. sect. Reishit Chochmah. 4. ch. 10). and binds it to the "concealed aspect of the Holy One.' and these contrivances bring the evils upon him. so. blessed is Hen (see Zohar IlI:73a). 17). I. ibid. Chaim Vital. 3. See above. 2.] but they sought out manifold contrivances" (ibid.2 1. Sha'ar Hakedushah. Also. 3. 79b and 1I:SSb). The teachings of R.chudim (acts of unification) known from R. "'God has made man upright. Everything that comes about through the thoughts of man with various devices. Keler Shem Tor. you know that a is best for you when things did not happen as you ~ i s h e d . i.2d." (Maggid Devuruu Leya'ukov. blessed be He. Midrash Hane'elam.Have in mind that everything in the world is filled with the Creator. Without the Divirie cffusion and vitality. and out of which all the others follow (Zohar I:15a-b. sect . is the meaning of 'the whole earth is filled with His glory' (Isaiah 6:3).) 4. Bereisltit is a comprehensive utterance which compounds all the others. it can be said that "the Creator is in every motion. respectively. In that sense. and it is impossible to make any motion or (utter) any speech without the ability conferred by thc Creator. The Talmud comments: The phrase "He said" appears only nine times in the account of the creation? The term Bereirhit (In the Beginning. of His Self-contraction: and everything came into being by means of a single utterance.e. the very first word of the Torah) is also an utterance (thus to be added to the other nine). the World of the Angels or the World of the Throne. sect. 5. See above. indeed. For all are within the vacated space of His constricted light. then. whether it be the World of the Spheres. sect. Zohar Chadash. (Rosh Hashanah 32a) Moreover. Yetzirah and Beri'ah. This. See also below. 38.' Why.3 Thus ~t should make no difference to you whether your aim was achieved as you wished or not. sect. then. even the most trivial thing happening in the world. 16b. 200).. blessed be He. 30a and 31b. blessed be He. 6. sect. should you be drawn after anything desirable in those worlds when all is but a single utterance of [God]? It is better to attach yourself beyond the 3. 2 and 4. As everything comes from the Creator. 54. The concept of tzirntzt~rn. ~ Bear in mind that everything. sect.-The world was created with ten utterances (Awt 5:l). The Worlds ofhsiyah. it is all by His providence.s all is as naught before Him.. 137. man is unable to make any motion (Likkutim Yekarim. Keter Shem Tov.) . 7. 273. of the Divine "Self-contraction" that conce aled the infinite light to make it possible for finite being to exist without becoming nullified by the intensity of the infinite light of God. always think of the Supernal World. to the Creator. with a complete love that is greater than that for anything else in the world. blessed be He. i. to [God]. cited in Or Hachamah on Zohar I1:lOa." for all the worlds are destined to de~truction. above. for every good thing in this world is rooted in Him. . Cf: below." Your thought should always be attached to the Supernal World. 11. Think [to yourself]: "I always wish to bring gratification unto [God]. sect." (Leviticus 21:12)11 When you have to speak at length about mundane matters. for there is your primary abode with the Creator. Sanhedrin 97a.~ Thus always bear in mind to attach yourself to the Creator. to that which is primary. Be as one who leaves his house for the outside with the intent to return right away. blessed be He.~ This is what the Zohr (II:134b) means by stating: "happy are the righteous who know to fm their will upon the Supernal IGng. The mystics generally agree that this is not meant in the lite ral sense. "he shall not leave the Sanctuary..e. Le. 9. Bet David. See above. sect. even when you speak of mundane matters. 24. than becoming attached to something that is s~bordinate.90 and 101-b. and Shenei Luchot Haberit. Cf. 12. "he shall not leave his holy status" (Sanhedrin 19a). too. Teshuwt Harashba I:9. and to serve Him constantly. 87. think to yourself that you are descending from the Supernal World to below.l0 This is alluded in the meaning of the verse. thinlung throughout his departure "when can I return horne?"l2 So. and not upon this world and its vain desires. blessed be He. 8.) 10.worlds.. sect. See also the extensive discussions in Moreh Nevuchim II:28-29. 76. (R. but refers to the destruction of all negative aspects and the universe being renewed on a sublime level of purity. Chaim Vital. like a person on a journey with h ~ sm ind and desire set to return home with the greatest haste. He will grant you your wish. sect. they. as stated above.blessed be He. . The prayers of the Shabbat are especially beloved on high. 69. When your thought is focused on the Supernal World. you never leave it. but not on weekdays. You may not be able to speak before [the IGng]. but on the Shabbat it shall be opened. "The righteous . sect. see Zohar I:75b). for He is exceedingly merciful to you. (See Zohar II:135$ and III:243a). Kad Hakemach. sect. ." (R. prayer needs much more effort. 2. Even as a stranger yearns to return to his birthplace. 86. Bachya. Thus repel all the guards until you come before the King. nor be worthy to come into His presence. . therefore. 3. consider this world insignificant." (I Kngs 2:2) i.e. .I4 13. sect. long to return to their root and origin.U. that without the IQng it is bad for you. The "other side" (impurity) is set aside. This refers to the parable cited above. 72. and their dwelling h ere is but temporary . too. S. with [proper] faith. A person like that 1s not a faithful servant2 You must realize.. shall be shut during the six working days. ger) Do not say. . . Nonetheless. and there is a manifestation of radiant Godliness. to think that you will pray with kavanah on Shabbat after neglectin g this duty all week long. for. Sltabbat is an especially auspicious holy day." (Ezekiel 46:l. On weekdays. 131. "The gate of the inner court . "I will pray on Shabbat with kavanah (concentration). David thus said to his son Solomon: "I am going the way of all the earth. 14."l For you are not to be like servants of the lung who apply themselves to their work in the presence of the hng but will not do it conscientiously in his absence. .I3 and immediately restore your thought to the original attachment. and below. 1. as explained below. Moreover. will simply not work. you are where your thought is. 72 and 86). This paragraph is based on Zohar II:245b. but otherwise I will not force myself to pray. for the King is here but He is hidden from you. Those who are familiar with the king recognize him by his mannerisms. because you are judged in every chamber whether you are worthy to enter. Those who are not familiar with the king note that people guard a certain place more [than others]. sect. see there. as you lacked kauanah or did not pray with hifhhavut (see the Baal Shem Tov's teaching in Magid Deuarau Leya'akov. 72. When you pray with hitlahavut. and Keter Shem Tou. 207). if you are unable to pray. So. 64. too. such 1. 58. An alien thought may be cast into your mind by Divine Providence. This is. 287). consider the nature of the [alien] t h o~g h ti:f ~it relates to evil love. Bear in mind that in prayer you proceed from chamber to chamber. When an alien thought comes [to your mind] you are expelled. sect. a hazardous task which requires a degree of sp~ritualp erfection (see above. 89. which of itself means expulsion from the chamber. See also below. This section basically repeats the theme of sect. fervor): start to pray intensely. sect. and the notes there) in order that you sublimate that thought (see firer Shem Tov.' 1. sect. 84. sect. thus it may be assumed that the king must be there. Thus strengthen yourself so much more. The alien thought may be cast into your mind in context of "a descent for the sake of an ascent" (see above. Thus it should bestir you to strengthen yourself. . though.86 Do not say: "I will pray when I am able to do so with hitlahavut (ardor. 2.' Thus if you are not praying with hitlahavut (ardor. fervor)." On the contrary! It is comparable to a lung who changes his garments when waging battle. it means that the King is guarded from being manifest to you. 3. sect. to pray intensely (6 above. 4. C$ Berekhit Rabba 3. ' it was morning' refers to the deeds of the righteous. Just as these attributes are to be found in the realm of Divinity and holiness. 5. the mid01 are reflect ed In corresponding soul-faculties. and likewise with nitzu'ach (endurance.. i. Gevuruh. 90. "[good] glorification" of glorifying God and "bad [glorification]" of self-glorification. The "seven days of creation" sign~fy the lower seven Sefirot.as sensuous lust. and so forth) 6. Thus you can undertake this task only when you pray with hitlahavut. The numbering of the days of creatlon (Genes~s1 ) is introduced w~t hth e phrase "It was evening and rt was morning.7 The [seven types of thought] are then "love of God" and "love of sin. In two parallel categories: the seven emotive attributes of man's Divine soul relate strictly to holiness (Chessed-love of God. 120 and 127) explains the sublimation of all possible categories of alien thoughts. 13-14. sect. sect. i t . thanksgiving." 7. See above.r~ev is an expression of ta'aruvot (mixture).. the midot (attributes) of Chersed. note 2). they are to bc found In the realm of impurity and evil (see abovc. In man. T$ret.E"a~c h [of these] has an erev (evening) and a boker (m~rning)E. Ceuuruh-fear of material objects. Everything in creation contains sparks of the Sefrrot. too. so. either of th c Sefirof of holiness or of the Sefirot of impurity. sect. . 13. 101 . hodayah (acknowledgment. and boker is an expression of bikur (visit). Netzach. Hod.8: "'It was evening' refers to the deeds of the wlcked. yessodot (founda~ons) sect. They correspond to the "seven days of creat i~n. note 3). thus to the realm of that which is not holy or even evil (Chessed-love of material objects or sin. Gevurah-fear or awe of God." There are only seven types of thought.e. i. 22.e. victory). praise). Y e d and Malchut. bring it to ~ t s[u ltimate] source which IS the love of God. and so forth). The sequel of this section (as also below." "fear of God" and "bad fear" such as hatred. and the seven emotive attributes of man's animal soul which relate to his physical reality and pursuit s. having an alien thought. or its consequence s like anger." . visiting God. Ishmael thus signifies chessed of kelipah and Esau gevurah of kelipah (see Zohar III:124a and 246b). sect.e. i." i." 8. There is also Isaac.e. Heaven forbid. and sins in general. gives vitality to Ishmael and the nine [aspects] that go with him. and submission to evil or impurity on the bad side. The author does not mention here the attribute of rnalchut (kingship. Isaac--Gevurah. par. and likewise with all the others. note 2). sect. Aaron... 39. There are altogether ten St$rot: the upper three (filer." therefore. The Holy One. and the seven midof. The attribute of yesod signifies bonding. or. 90). it was wavering to and fro. then said that Abraham-i. murder. Joseph and David) the other four respectively (Zohar III:301b-302a). . on the immanent level. the attribute of love"-will come forth into the world. Chsed thus compounds Chochtnah of Chessed. Binah and Da'af). ch.^ With every bad thought one gives vitality. 12. to the "seven nations. sect. Da'at of Chesred. Chersed of Chexsed. blessed is He.e. Chochmah and Binah. Binah of Chessed. and Berachah. 11. are not just failures on the pan of man..e. joining together . Tikunei Zoha r 15:30b). A thought of "bad fear. Evil thoughts. i. Ishmael and Esau are the dross of Abraham and Isaac respectively (Sije. 139.i. (Tikunei Zohar 47:84a and 69:116b) 10." and [correspondingly] Esau [the attribute of] "bad fear. Pesrkia Rabaty. See above. Ha'azinu. 13-14. Each of these subdivides into ten levels of inter-relationships with the other Sefirot. and so forth. note 5. 9.. See below. Jacob-Tijret). [the attribute of] "bad love. Chochmah. The Patriarchs signify the first three attributes of holiness (AbrahamChesed."'z A thought of "bad love. and later saints (Moses. 212. the attribute of "[good] fear. sovereignt y). They have a cosmic effect of strengthening (infusing vitality into) the seven attributes of the realm of kelipah (see also below. par.e. It would relate to accepting the sovereignty of God on the good side. But there will also be the issue of Ishmael."1° Midrash Hane'elam (Zohar I:86b) thus states: m e n God created] the world.. 343. The "seven nation s" of the early inhabitants of the Holy Land signify these seven attributes of the realm of impurity (see above. the sense of bonding8 Each of these [seven] is compounded of ten aspect^]. . 47). 15. a woman. selfnegation). 14. 90. when you see or eat something that gves you pleasure. Negative Jlessed.Is Your whole being. Thus take heed not to crudify that delight. . i. thus bringing the thought to the attribute of ayin (naught).: over) God" (Isaiah 58:14). Thus if you happen to think of a "bad love. you forsake the incidental and insignificant and pursue the primary and essential.e. which is a term for the highest refirah of Keter. for example. and it is . 18. In other words. therefore.. as. See above. and "then you will find pleasure a1 (lit. sect. beyond [the level of the Divine] Name [Havayah. the level of ayin (naught. but in Kabbalistic terminology taken literally: 'from ayin-naught'. of which it is written '[I raise my eyes over the mountains] me'ayin (from whence.'I6 how much more should I love God!"17 Likewise. sect. the place from whence those above and below derive. think that it is but a part of the World of Love. should be directed to that 13. 16. See Zohar I1:83a: "It docs not say 'im (with) Havayah. Vitality from the realm of thought that originates in holiness. In the supernal realm of ayin all breaches can be corrected."13 say to yourself: 'What have I done? I have taken a part of the World of Thoughti4 and brought it to a place of filth!" This will effect that you be subdued and come to the [level] of dust. The realization of wrong-doing leads to subduing and negating the ego ("I am as dust and ashesn-Genesis 18:27).therefore. as it were. and below. i t . Also. the Tetragrammaton].' but 'a1 (over) Havay ah'. sect. for thought is made up of letters which in their origin are sparks of the Shechinah (see Maggid Devarav Leya'akov. 84. sect.'s Then you will come to the World of Love by reminding yourself: "If I love this object. when you hear words of jest which cause you to be mirthful. the ultimate sphere of the World of Delight) will come my help' (Psalms 121:1). Avot 3:l 17. 98 and 232). gives vitality to Esau and the nine [aspects] that go with him. and all sparks ascend to holiness (see Maggid Detwrav Lq~a'akov. who is but a 'putrid drop. and they desire that place. think that it is but a part of the World of Delight. Heaven forbid. Negativegevurah. Zohar 11 1 b. Ta'anit 20b. yet be in the World of Delight.21 When people praise you. for every [form ofl splendor is emitted from there and from it emanate all those crowns (i. The longing and delight of the righteous is to contemplate that splendor.. will bring delight unto God in all worlds.e. Yoreh De'ah 116:s)." The Tetragrammaton signifies Ze'eir Anpin. blessed be He. how much more should I fear [God] The same applies to glorification. 19. is vested in that being [enabling it to exist]. The pleasure that you caused yourself. in Kabbalistic terminology generally signifying the realm of Keter) and they brought him near before Him' (Daniel 7:13). thus think of God. The attribute of T$ret. shame-before God. when you see something of which you are afraid. 21. or you sense pride in the midst of prayer. written 'and reached unto Atik Yomaya (the Ancient of Days.. One is to consider that the present-uninfendedconfronta tion of danger is by Divine Providence (6 below. the compound of the midot from Chessed to Yessod. for it is Halachically forb idden to expose oneself to danger and to rely on miracles (Pesachim 64b. This does not mean that one is to ignore danger.lg say to yourself: ''Why should I be afraid of this? It is but a human like myself-let alone if it is but an animal or beast! As the awesome God. 120). bring yourself to a sense of awe-i. sect." therefore. Likewise. 20.pleasure in context of it being part of the World of Delight. or people exalt you for your concentrated study. he should utilize that opportunity to consider the ultimate source of fear and generate within himself the fear of God. Hikhot Rotze'ach Ushirat Hanefesh 11:4$. Thus you may sit and eat here. Maimonides. . therefore. is to ascend beyond the midof to their very source. To ascend "above Havayah. even while using the Divinely endowed gift of intelligence to observe the Divine precept to save himself. The Baal Shem Tov deals with sublimation: when something mundane arouses fear in man. Sefirof).e. Shukhan Amch. Thus one must avoid danger and make every effort to escape it. The attribute of Hod. 33. The attribute of Netznch 23. the Shechtmh. 75. w~l l generate a sense of fear 'When thlnlung before prayer about what you w~lsla y. 75. 24. because the 'World of Speech" is the 'World of Fear. "'Fear of God' IS the Shechrnah. the Sefrah of Malchul (ibd . you will be overcome by fear. thereforc. (Darker Tzedek I:20) See also Maggid Devarav Jkya'akov. sect 313 ) . When cons~derrng that the World of Speech."2 Thus. but rt 1s rooted In Brmh. 77a. The Baal Shem Tov taught The Shechrnah 1s 111 exlle because all words of speech derrve from Her and ought to be for the servlce of the Creator but. The attribute of Yessod. sect 75. See above. the holy Malchuf" (Tzkuner Z d ~3r3. The Shechrmh 1s the World of Speech (above. and mtnd~ngth rs when spealung. Zohar Ill 269b). and before whom you are spealung." In Malchut (wh~cht. 1s called the "lower Gevurah". sect. fervor). you w11 be afrard of the words themselves .e. 1. also hid 7b).h erefore.23 and also with "bonding."z4 i. How can you not be overcome by fear and shame when you know that you bestrr the Shechtnah" (Maggid Devarav Leya'akov. note 11) The attr~buteo ffear relates to Gevurah (above. Realrz~ngth e ~dent~ty of Shechinah and speech. when spealung with a sense of love and awe [of God]. Addenda. I e. sect. note 10.In context of nitzu'ach. by our many slns.' Normally you ought to be overcome by fear when spealung. sect 87). You should show compassion for the Shechinah when spealung in a way that removes the words from God. to be bound up with God alone. 22. these words are used for materra1 matters." Do the same with the aspect of hodayah.. sect 78. note 7). fear and shame w1l1 surely come upon you. Idle talk and falsehoods.z2 overcome that trait or have your understanding lead you to a sense of "Divine victory. and when continuing that way you will reach a level of immense hitlahavut (ardor.. crted m Keter Shem Tov. the "supernal Shechrnah" (see sect. indeed. note 11) Thus it 1s reflected In the "lower Shechrmh. . 2. speaks through you. legitimate) person but the inner reality is evil. 87. 1 (and see also Nedarim 20b) that some are regarded like mamzerim though legally they are not. [as the mother so is her daughter]. the alien thought reflects its origin in the illegitimate union of holiness and evil. too. man's thought. sound and speech correspond to male and female. 3.. 148: "The Holy One. sect. too. the offspring reflects its origin.] the words spoken are letters of holiness.89 When beset by an alien thought. which is the very soul of his speech. sect.e. It would seem preferable to emend this sentence as in the version of Maggid Devarav Leya'akov." which implies premature death). says: "Why did you come into the teivah (word) when I am not in it?!"5 1. [In our context. In our context. A mamzer is the offspring of a union between a man and woman whose marriage would be a capital offense or incur the Heavenly penalty of karet ("excision. one begotten with the alien thought of someone external. sect. For with holy speech coined to] thoughts of something else you beget a mamzer."3 Thought has a male and a female aspect. I$ Massechet Kallah ch. The status of the mamzer reflects th e transgression of his parents. 2. 4. See Zohar III:228a-b. See above. such as incest and adultery. One of these is mamzer temurah. So. I. Cf: Likkutim Yekarim.e. that as your thought is wandering among other matters. 5. So. blessed is He.' Return to the palace with great embarrassment and exceeding humility. was not in the word. as explained in the next paragraph. i. ." That is. says: 'Why is it that I came and there is no man' (Isaiah 50:2) in the word.. the Holy One. feel extremely ashamed because you have been expelled from the Kng's palace. 131. blessed is He.4 The utterance of words of holiness while harboring an alien thought is like a mamzer whose external fonn is as that of a kosher (fit. Bear in mind also. To harbor an alien thought is a [grave] sin tantamount to begetting a mamzer: as it is said (Ketuvot 103a) "ewe follows ewe. but the thought [behind them] is evil. it draws vitality from the major branch. Chaim Vital. How much more so. itro. 'Do not turn to the idols and do not makc for yourselves molten gods.]" (Psalms 17: 14) Avoid gazing at material things that are attractive. avoid gazing at the beauty of women to indulge your desire. the younger brother draws v~tality from the older one. . Sha'ar Hamitzvo~Y. of blessed memory.5 Thus it follows that when first infusing strength 1. thus explained [the ruling] that "Honor your father. The quote cited above. Heaven forbid. [they leave their yeter (abundance.~. impregnating it. your child will be rooted in the power [of the keli~ot]R. sect." (Zohar III:84a." (Exodus 20:12) includes [the obligation to honor] your elder brother (Ketuvot 103a): The older brother is llke the major branch of a tree. i. Vayeira. 4. As another branch grows from that major branch. Bachya on Leviticus 1Y:2).2 Thus you will add strength to kelipah ("husk. "Whoever gazes at thc beauty of a woman by day will have [lustful] thoughts at night. if you do so before giving birth to a child. Cf: Nedarim 20a. 2." the forces or realm of evil).e. Aoadah Zara 20a-b. See above.' that is why it is written. . and if he brings that thought upon himself he will violate the prohibition of 'do not make for yourself molten gods' (Leviticus 19:4). R. to nocturnal sin.'You fill their belly with tzefuncha (that which is hidden with you) . coritinues that the children one begets under the influence of those thoughts "are called 'molten gods. For that type of loolung is self-worship. 87 (and note 10 there). Moreover. Isaac Luria. 4 R. which is like worshipping idolatry. too. that which you tzofeh (observe) for your sake. So.' [Moreover."' 5. note 1. .. such as the beauty of a woman. By loohng for self-indulgence you add power to [kelipah]. remainder) to their babes. note 1.' This is the meaning of tzefunchu. and above. 3. Likkulei Torah.] that thought leads. something additional. sect. sect. This principle is stated already above. Why. 120 a nd 127. See also below. ." Thus when seeing things. therefore. which is a Divine portion from Above [for the vitality of all physical things is a Divine portion from Above]. 8. bear in mind that the taste and sweetness of the food derives from the vitalizing force and sweetness of Above. The principal strength is [given] into [the forces of evil]. 87. beyond your control. Think to yourselE "Whence came beauty and form to this vessel? Its material substance is clearly worthless.into kelipah and then begetting a child. See Nidah 31a: a person's beauty comes from God. too. and that is its vitality. For inorganic matter. The vital force of everything is a spark of the Shechinah.' It gives her the quality of beauty and redness. are the spiritual and vital reality of the vessel. conduct yourself as follows: If you suddenly happen to see a beautiful woman: think to yourself: 'Whence is her beauty? If she were dead she would no longer look this way."g It is likewise when observing other physical objects. Zohar 1:llb 9. such as a vessel. is in the Divine force. sect. See next note. should I be drawn after a mere part! I am better off in attaching myself to 'the root and core of all worlds's where all forms of beauty are to be found. That is. however. 7. The root of beauty. 109. and the child is like yitron.1° Likewise when eating. an d below. thus where does her [beauty] come from? Per force it must be said to come from the Divine force diffused within her. then. This is the meaning of "they left their yitron to their babes. Its beauty and form. that child will be like the smaller branch. has a vital force as evident from the fact that it has 6. 10. l4 Thus it is written of all prophets that "I speak to him in a dream" (Numbers 12:6). 13. This is effective for negating [improper] thought. you are loolung at them with your mind." Berachot 57b. Chaim Vital. See Tanya. and it is not done for self-indulgence but related to the En Sof. but when your thought dwells on the spiritual reality vested in the physical. dust. "Dream is a sixtieth part of prophecy.i3 For [the term] chalom (dream) is an expression of "periods of chalirn" (Rosh Hashamh 28a).existence and durability. that is why he does not see the vital force inherent in physical matters. See Or Hachamah on Zohar 183a. Eik Chayirn 393. you will merit to see in your dreams the vital force of that physical object. 14. that the Divine vitality from Above is to be found everywhere. Your sight (empirical perception) during the day is but of the physical. This may bring one to levels of prophecy. In daytime man's vital force is weak because he is bound up with his [physical] body.e. Cf: Maimonides. however. "Even inorganic matter-i. thus it is strong and allows one to perceive the vital force itself. sound. When viewing things this way. blessed is He. Sha'ar Hayichud. animals and humans.12 Thus by following the above procedure all day long.li It follows. Zohar I:183a. See Zohar 1:147a. (R. At night. the vital force extends beyond the body. It is an established principle that what you think during the day affects the thoughts you have when sleeping and dreaming. ch.) 12. 1-2. stones and so forth--of necessity possess es a spiritual life-force." as do also all vegetation. then in your dream you will see the bare spirituality divested from its [external] garment.. See Berachot 55b. then. except for Moses. . 11. Hilchot Yersodei Hatorah 7:1. which means strong. and Moreh Nevrrchim 11:36. ' and He is vested in that matter.e. See Hilchot Yeuodei Hatorah 7:2 and 6. lla and 289b (and in several places in Tikunei Zohar). The wise one's mind is focused on the rosh-the "head" or true reality." "Image" alludes to the fonn. i... peace be upon him. [I will be sated with Your image when awake] . in the "head" of the object. the Divine Immanence." (Psalms. the spirituality and vital force--of everything. 73. in context of the Zohar's concept of "Reisha decho2 reishin-the Head of all heads. Why [did he merit this]? Because "I will be sated with Your image when awake. Moreh Nevuchim I:3 17. as opposed to the external appe arance.) 18. that rosh refers to the Shechinah. and of "You are exalted as rosh (head) over all" (I Chronicles 29:11)." This is the meaning of "The wise one's eyes are in his (alternatively: its) rosh (head)" (Ecclesiastes 2:14). the Divine emanations that constitute the essence. its form and vital force-are 'from You.e. its spirituality and vital force. It sig nifies the supreme Sefirah of Keter. verse 16) Echezeh is an expression of "chizayon laylah" (a vision at night. sect. that is.I6 Thus."18 15. note 3.15 [King] David thus said: "Echezeh (I will see) Your face in righteousness. from whence derive all other "heads" (i. ibid. Zohar III:lOb. who was able to perceive the vital force of physical matter even when awake.our teacher. beginning) of Your word is truth" (Psalms 119: 160)." This is also the meaning of "The rosh (head. (See above. 16. [thus implying a vision ofJ 'Your face" itself at night. "when noting something physical. . Job 33:15). the spirituality and vital force. I will not look just at its matter but will also consider that its image-i..e. of everything). arrogance." (For a definition of this amount see Maimonides' commentary on Amt 4:4. and in Ch assidism in particular (see below.' as our sages said (Sotah 5a) that a Torahscholar ought to have "one eighth of an eight's [of However. is a cardinal sin in religious ethics in general.Sometimes you must exhibit pride towards others for the glory of the Creator.57. sect. and for a mystical definition sec R. like everyone else. sect. thus leads to service of God and the performance of mitzvot. he must also remember what he represents and conduct himself accordingly (see Maimonides.42-43. even the slightest thought of it. one must remove oneself to the furthest extreme . This symbolic amount is chosen because it represents the content of the smallest instrument for measuring in Halachah (Tossajt.55. For himself he must be humble. Hilchot De'ot 1:45 and 2:3) a minimal sense of pride. 9. saying to yourself: "In truth I am very base. 68 and 393). A Torah-scholar represents the honor of Torah. Every thought is a 1. Rosh Hashanah 13a. sect. Generally one should choose a middle path (the "golden mean"). ch.~~ 1. LC. At the same time.) 3. rule 6). In that context he must exhibit (externally+ Maimonides. 12. even as negative humility is repellent to these (see Kefer Shem Tov. 2. s. It is pride in God and Torah. sect. and my proud demeanor is but for the glory of the Creator. Kav Hayashar. and 4: Hilchot Talmud Torah 610 and 12). Cj above." (I1 Chronicles 166) That pride is not detrimental to the ideal of humility .. 65. Pride. there is a "good pride. chsar) . but aids and increases it (Chovot Halevovot.' Any ulterior motive derives from pride.. thus why would I want honor?"' -~ . 124 and 131. Hilchot De'ot. is a very grave matter. ch. and below. Sha'ar Hakeniyah. 6. "one eight of an eight's. 102). blessed be He. Nonetheless. 122. For myself I do not need any pride. 114. As for pride and anger. for 'I am a worm and not a man' (Psalms 22:7).-. 5. ch. however. 'I'zvi Hirsh Kaidanovcr." of which it is said "his heart was elevated (proud) 111 thc ways of' God. be very careful to consider at the time your own baseness. 48. 92 Pride. v. however. and see there also ch. "Every letter is a complete world" (below. Yoma 56t$). it is not a mater of self-esteem.complete s t r~cturep. declares of anyone with arrogance. 34). 75). sect.~i t h pride. and "every word is a complete structure" (above. 49). On the other hand. sea. therefore. (Kekr Shem Tou. however. sect. first attach yourself mentally to the Creator. 3. blessed is He. Tzafnt Pane'ach. i. note 1).e. The soul of the other." (Proverbs 16:5)9 away from them.' as it is said. it is said. then." defiles. the Baal Shem Tov teaches that "Pride purifies the defiled. therefore. sect. 91. is . Of the proud and arrogant. containing "worlds. 118)." as it is written "Every one who is proud in heart is an abomination to God.." (Solah 5a) The Baal Shem Tov taught that this passage proves that pride is worse than blatant sin: Of all forms of sin and impurity it is said 'Who dwells with them amid their impurity" (Leviticus 16:16. souls and Divinity" (above. 93 When spealung to people. incl uding the spiritual realms. 'I and he cannot both dwell in the world. and I$ above. "I and he cannot both dwell in the world. 76d).] one causes a serious blemish Above and "repels the feet of the Shechinah. Yitro. note 14). but exclusively for the glory of God. These two traits are tantanlount to idolatry (Hikhl De'ot 2:3." (Cited by R. 393) 2. the seemingly pure who fulfills his obligations is defiled by his pride. the Shechinah remains among them despite their spiritual contamination. Ya'akov Yossef of Polnoy. by the self-satisfaction and self-esteem in his service of God. 87. for thought is composed of letters and words (see above. sect. blessed be He. The positive pride discussed in the preceding section does not contradict this principle: it is not personalized. sect. p. that is. it affects the totality of reality. As a complete or self-contained structure. and defiles the pure": A false sense of humility. 'I can not bear him who is with haughty eyes and proud heart' (Psalms 101:5). too. "The Holy One. It is overcome (you are purified) by the pride of "his heart was proud in the ways of God" (see above. thinking to yourself "I am not fit to approach God. In that sense. because it prevents you from pursuing your obligation s. sect. This applies to thought as well. as last . the Skc/tirtah) and effects the emanation of additional vitality (ibid." (Proverbs 3x5) This is an important principle: Da'eihu is an expression of "joining together. too . Cj Keter Shem Tov.e. whether he will praise or reproach me. without ulterior motives (such as self-glorification). Da'eih can be divided into two parts: da (know. Your words are attached to Above. 2. and hei-vav (the last two letters of the word). establis hes a relationship with the listener. for the life of the world to come. sect.). even in your physical involve1."' i. The letter hei. for what difference does his praise or reproach make to me [i. with prior attachment of your thought (the soul of speech) to on high. 103). may the memory of the righteous be for blessing. Moreover. sect. the Divine vitality of these words is infused in the listeners.e. sect.] 1. 75. thus "I am not speaking to my fellow.e. bestirs the "supernal speech" (i. sect. only when spoken for the sake of Heaven. 113 and 253. The root-word of da'eih is yada (to know). sect. in our context: join together ). Tikunei Zohar 69:99a). Speech is rooted in the Shechinah.[then] bound up with the Creator. See below.: knowHim). "In all your ways da'eihu (acknowledge-lit. By addressing your words to others. and become a channel for Divine emanation. 103. For every person lives but by virtue of the [Divine] emanation infused into all creatures. 99. joining the hei to the vav? in all your dealings.. cod speech" ascends on high.. which signifies attachment and union (as in Genesis 41. blessed be He. wherc this principle is applied in particular to the context of rebuking others: the speaker's prior attachment to on high. therefore.' Bear in mind that your words are but spoken before the Creator.. and their souls. Thinking of yourself while speaking will disrupt the bond and the flow ofvitality. note 7). 2."2 All this is from the Baal Shem Tov. become bound to the Creator. to bring gratification unto Him. to the common root of all souls. As sparks of the Shechinah. the 'World of Speech" (see above. the words of speech reflect the vitality of man (see below. See below. There. 2. The physical or mundane engagement itself will thus be sublimated to holiness and spiritualiw. notes 7-8). 122-123. represented by the term the "Holy One. and His Shechinah" (see above. your study of Torah. sect. on the prin ciple of avodah tzorechgemhah (service for the sake of Above). blessed is He.' letter of the Tetragrammaton. without any ulterior motives that involve the ego.ments. however. The beginning of our proof-text ("In all your ways") signifies all your deali ngs. all your physical or mundane engagements (Hikhol De'ot 3:3. even if it be for spiritual attainments. 43. blessed is He. 231). See also above. the Shechinah (the ultimate life-force that enables man to act). or the compound of the six Sefirot Chewd to Yessod (in Kabbalistic terminology referred to as Ze'eir Anpin-'Minor Visage'). This section essentially repeats the theme of the preceding one. sect.? 1.' Not even the slightest intent should be for your own sake. and below. for advice how to go about in attaining this goal. 73 and 84. Orach Chayim. Thus: "In all your waysn join the act (signified by the hei) to the vav. signifies the Sefirah of T$ret. 95 [Another important principle:] Your service must be but for the sake of Above. Here the emphasis is on preserving the purity of the Divine service: your prayer. sect. your mitzvot. as second-last lette r of the Tetragrammaton. Shukhan Aruch. This is then clearly a great (all-comprehensive) principle. sect. without any other intent. 3. 81. The vau. signifies the Sefirah of Makhr.'" (Berachof 63a) Note above." Da'eihrr thus means to effect the "unity of the Holy One. 11. must all be for the sake of God. the focus is on the sublimation of the physical. but [altogether] for the sake of Heaven. as already stated in the Talmud: "What short text is there upon which all the essential principles of the Torah depend? 'In all your ways acknowledge Him. 3. . he will elevate all his idle words [or deedsl. that whlch was orignally defic~enct an subsequently bc rect~fieda nd elevated by proper Intent . thus they become Intermmgled. externally he 1s not engaged In the service of God 3 HIS temporary descent to katrzrrt 4." In other words. sect. however... embers]. . gachelet is defined to relate to omemot. Israel Baal Shem: "Beware of their gachelet (glowing coal) lest you be burnt . why then qua116 it [in the conclusion as] 'tfiery coals"? If again." (Avot 2:10) This is difficult to understand: if the unqualified termgachelet implies burning [coals. descends and hovers In the lowest firmament. remalnlng there until that person wall do teshuuah If he returns properly to his Master and offers another prayer properly. and sometimes may even go idle. all their words are like fierygachlot (coals). i. dimmed (dying coals). thus said: A perfect tzadik (sa~nt)m ay sometunes fall from his level and worship God in a mode of katnut (constricted consciousness):' he does not pray with great kavanah (intention). After all. as that good prayer ascends-the overseeing [angel] makes the Improper prayer arise to meet up with the good prayer. you are but a simple person who is totally unaware of the mystery 1 See above.4 You. . and sometimes going idle. who observed him. . why would you need to be careful "lest you be burnt" asgachelet simply refers to omemot? [The Baal Shem Tov]. may very well think to himself that he can act likewise. ascend together and enter before the Holy fing. of blessed memory. Cf Zohar II:245b: "The improper prayer a expelled. 67 and 69 on thc concept of kafttut 2 1 e.e.96 Citing R. how much more so he hlmself! The teacher [of our Mishnah] thus cautions: "Do not compare yourself to the Torah-scholar and tzadik! For when the tzadik will awaken from his 'sleep'' and again prays and studies as he used to. ~f the saintly and pious can do so.2 Another person seeing the tzadik in that state of not praying or studying with great kavanah. fiery coals. however.5 -5. 97 "If I am not for myself. Ofthand the implication is as follows: "If I am here. then. too. but remain on their level (see Keter Shem Tov. but i f I am not here. all is here" (Sukah 53a). can be interpreted in like manner. His burning sparks can restore the great flame (see above... "But when I am for myself. everyone is here.e. 2. 356. This is the meaning of "If I am not for myself'--i. who is here?" Thus: "If I"-<go and self-awareness-"am . 67.2 1. you must be divested of physical realiiy. This cannot be said. 113). sect. what am I?]" (Avot 1:14) When you pray. "I concealed (treasured) Your word in my heart so that I will not sin against Youn (Psalms 119: 11). 65. 77 and 366) He retains the ember. of one who is not a tzadik: if he engages in idle talk or deeds. and Likkutim Yekarim. (filer Shem Tov. even in his state of katnut.' The saying "When I am here. see there. he may not only be unable to sublimate these. The fzadik is always attached to Godliness.e. as stated above.. even when that fire is dimmed and not apparent. for even their idle talk is like fiery coals. I am not afraid of alien thoughts. compare yourself to him!" This is the meaning of "beware of their glowing coals": Even when [tzadikim] have fallen from their level and are like "dimmed coals" for uttering idle words or involved with idle deeds. note 3) that will sublimate everything of his temporary fall. what am I?. To him applies. sect." i. Up to here is a brief version of sect.e." i. when I am thus divested-then "who is for me?. who is for me? [But when I am for myself. sect. beware! Do not apply a lesson from them [for yourself]. and cf: also Maggid Devarav Leya'akov. How dare you.of Divine worship. in my state of self-awareness there are many alien thoughts. sect. 62. sect. however. the ahen thoughts-"IS here. sect. whlch rs followed by the text of our sect. soul) of his animal. sect. sect 237. everyone"-I c . ~l r enth oughts wrll not approach me Note.e . Wlth attachment (deveikut) to Godliness. 94. see above. 4 Thrs seems to be an extended rnterpretatton of ylphros as a notankon (an acrostlc abbreviat~on) forpames-rosh (leader-head) The more elaborate verslon of this teachrng In Maggrd Devarav Leya'akov. blessed be He. 97 as a sequel 98 "Every prudent man acts w~th da'at (knowledge." as the root-words of both are essentially the same." but "if 1 dm not heren-1. The reading there is: "he is parush from the world and continuously studres Torah. saint) yode'a (knows) the tzefesh (desire.here. 99) 2 The principle of "Acknowledge Hrm In all your ways. lit. but he stud~es and prays without deveiktrt to the Creator. the state of selfneg atron. sect 94. renders the more lrkely (and srmpler) intcrpretat~on of readrng ytphros as "beconl~ng parush-abstemious (from worldly involvements). sect 431. [but the fool yiphros (spreads out) [his] folly.' even his [personal] transaction^. He who acts without devetklrt. forethought). though." (Proverbs 12:lO) This means ." (Proverbs 13:16) This means that the wise man does everything with da'at." See above. ~f I am drvested of ego and physrcal awareness.^ The fool: however.. [Thus for him] 'rt IS folly "' 99 "The tzadik (righteous. 1. then "who is here"--1 c. 3. the lnterpretatron rn Or Torah. note 1 (and below. dorng so only for self-esteem and to be called rabbi. even when succeeding in becoming a communal leader or head: it is but folly. p."3 1. By a slight change of vocalization. 91. sect.. Dov Ber of Mezhirech. This is again a variation on the theme of sect."3 1. 29. Israel Baal Shem: "Yisas'char chamor garem-Issachar is a large-boned donkey. the Preacher ofthe Holy Community of Mezhirecht [a] In the act of coition you must regard yourself as naught. note 109). earning)' that garam (is c a ~ s e d )by~ chomer (physical matter). 94. A variation on the theme stated above. It. sect. 94. 3.2 This is the meaning of "Rabba drove away the flies" (Nidah 17a). 1.that he joins even that nefeshl to the service of the Creator." (Genesis 49:14) This verse indicates that "yesh-sachar (there is reward. and rf. R. (See R. 98 and 99.) 3. Shevilei Emunah. This interpretation appears already in Nidah 31a and Zohr I:157b (with an explanation in Bereishit Rabba 99:lO. Addenda. his involvements with the physical and mundane. sect. ch." Zohar 1:158a. i. Gevurot Hashem. The name Yisax'char can be divided into the two words "Yesh sachar-there is a reward (or earning).) 2.. VI. the nefesh of his animal soul. cited in Shenei Luchot Haberit. Judah Loewe. 77b. Sukah. disciple and successor of the Baal Shem Tov. he did not consider himself even as a fly. 94 and 98. note 1. 2. Citing R. garem is read garam. it.? For the word yode'a is an expression of 'tjoining together. Sublimation of physical matter and reality causes great gain and reward. This is a a frequent reading in mystical writings (see R. Cf: Keter Shem Tov. great spiritua l effects. Meir ibn Aldabi. Chamor is read as chomer.. Torah Shelemah on Exodus 4:20.e. . 101 In the name ofthe Rabbi. See above. and one is not to love anything but God and His commandments. It excludes an objectified love of the wife that is contingent on self-serving consideration. Hilchot Ishut 15:19). 40a. Zohar Chadash. as he is not to love anything but God and His commandments..j Regard it like someone traveling 2.4 Do not muse on 11er. 94-95 and 98-100) applles here no less than wt h any other phys~cale ngagements (see Ma~mon~deHs. 7b. When a craftsman hits the rock with a hammer. Orach Chytm:231. As he and she are but tools. for this cannot be except by the cohabitation of male and female. All of (man's) limbs are but tools: he needs to eat but cannot do so without his toois. to hit the rock. for if it had been the latter. (the hammer) would be independent of the craftsman. Shdar Hakedrrshah. sect. however. Cohabitation is necessary to preserve the species (lit. Thus-] love your wife just like your tefillin (phylacteries) which you care for only for the sake of observing the command of God. the bracketed passage.tl chot De'ot 3 2 and 5 4-5. Bereislzit Ila-b. Maimonides. The preamble. "'Sanctify yourselves and be holy' (Leviticus 11:44). ch.: the generation). He is not to eat to indulge his desire. Menachem Mendel ofvitebsk). p. Thus things happen according to the infusion of the primordial mind into the tools. this happens because of his desire. 16).[b] [3 Regard yourself as no more than a tool. this teaches that a per son must sanctify himself during cohabitation. such as self-gratification (6 Avot 5:16)." (Zohar Chadash. is. 4. 3. "t he sages ordained that a man is to honor his wife more than his own self and love her as himself' (Yevamot 62b. and Likkrrtei Amarim (manuscript of R. Reishit Chochmah. p. Shulchan Aruch. After all.25) Thc mystical writings are very emphatic on the sanctification of this act (see especially Zohar I:112a and III:80a and 81b. one should not cohabit to indulge desire. This does not mean to excludc the basic or ideal sense of love. and not because of the hammer's desire. The sensual aspect of . and Even Ha'erer. does not appear in Trava'at Harivas h but in the version of Or Ha'emet. Bereishit Ila) The pr~nc~polef self-negatlon ("regard yourself as naught") and acting for the sake of Hedven (see abovc. i. putrid and repugnant. The beauty sown by the [physical] father derives from the Supernal Father.. Man's principal affairs to serve God and fulfill his function on earth.'Z the 'World of Love.to a market. The Sefirah of Chochmah (Zohar III:290af). This paragraph deals with the sublimation of thought. 6. See Yevamot 62bJ 9. he would not be obsessed about the horse which is merely his "tool" for transportation 7. in detail. the "Supernal Fathern (Zohar II:175b and III:118b). Do not keep thinlung of her in context of self-gratification. When you see a beautiful womanm think to yourself that the white substance is from the seed of the father and the red substance is from the seed of the mother. The personal benefits from the spouse are but incidental to the spiritual benefits effected by marriage. spurn her [being a sexual object]." 14. 13. which placed next to food would render that food loathsome. 14 and 22.e.. and he cannot do so without a horse.) 5. 1 1 . 8. for the service of God."l3 while the seed of the mother derives from the Supernal Mother. 10. therefore. as well as sect. . above.e. (Note that Zohar 1II:Sla-b draws an analogy between k1.14 the 'World of Fear. sect. The Sefirah of B i ~ (hZo har I I I : 2w) . Love is identified with the Sefirah of Chesred (Tikunei Zohar 6a and lob). the husband and wife are but "tools" to achieve that end.flin and the union of husband and wife. 87 and 90. come to love the horse?6 Is there anything more foolish than that? Likewise."15 This is the beauty [of the cohabitation is only a necessary means towards a higher end. Nidah 31a 12. just as kjllin are the "tools" to fulfill the command of God. Would he. I.ll turbid blood. This subject has alrea dy been dealt with. Thus Chochmh is the ultimate "World of Love. in this world a man needs a urlfe for the service of the Creator7 in order to merit the World-toCome. In that context.8 Could anything be more foolish than to forsake his affairs9 to muse on her? Rather. b ut Chessed is rooted in Chochmh. The consciousness of the Divine. 20." who has 365 sinews alluding to the 365 prohibitions [in the T~r a h ] . 18. Thus he is attached with everything to katnut (constricted conscio~sness)I. note 21. 16. To be in the grips of physical pleasure means attachment to the physical. sect. Thus Bimh is the ultimate "World of Fear.t~ i~s far better to attach himself to the Holy One.21 Man most likely derives pleasure from his eating and other things. no nian would build a house. For it accounts for the formation of man." (Bereishit Rabba 9:7. blessed is He. is (at least) weakened and restricte d. which. By analyzing the pleasures. as stated above. in turn. therefore. all sins will be repugnant in your eyes. 17. and sublimating them to thcir spiritual sources. See below." Cf: above. but Gev~trah is rooted in Bimh.) 22. 21. 88. blessed is He. 23. brings about the formation of man. [for] all forms of pleasure derive from that [seminal] drop. Fear is identified with the Sefirah of Gevurah (Tikunei Zohar lob).woman]. "Were it not for the evil desire.''' R. the "Supernal Mother" (Zohar II:175b and III:118b). Zohar I:170b 19.] negates [the violation ofj the 365 prohibitions. Israel Baal Shem. By rendering that sinI6 repugnant in your eyes. and see Zohar 1:61a. Thus it is better to attach yourself to the love and fear of the Creator. thus said: There is a great desire for this sin20 because it accounts for the formation of man. peace be upon him. ['S~p urning lust. therefore. See note 16. The control and sublimation of the ultimate root of all violations enablcs man to avoid these. . take a wife a nd beget children.23 15. The pursuit of pleasure leads to cohabitation. The sin of indulging sensual self-gratification. whether it be perceived as good or bad. however. each signi@ing one of the Divine attributes. [you are to] "Acknowledge Him in all your waysn (Proverbs 3:6).s thus I must continuously increase [my] merit^. consider that it is surely to atone your sin? On the other hand. he is using up the merits he has accumulated. I.2 Thus if. Tanchuma. signifies the Divine attribute of mercy. something bad happens to you. [signi@ ing] the attribute of mercy. Zohar 1II:65a) 2. compassion. God is referred to by a variety of names. acknowledge the presence and workings of God in everything that happens to you. Lech:lO. Elokim signifies the attribute of Divine judgment. the tzadik should worry about good things happening to him. . because "the righteous are rewarded in the world to come." . Heaven forbid. He assumes that when good things come his way. See Shabbal 32a. and Rashi on Genesis 32: 11. because they may be at the expense of his merits4 This is the meaning of "Havayah shall be for me Elokim": Havayah."Havayah (GOD) shall be for me Elokim (God). 4. Cf: the interpretation of our proof-text in Zohar I:151a: "Even the mercy 1 shall regard to myself as judgment. See Berachot 5a. may in fact be [for me] the attribute of judgment indicated by [the Name] E1okim. 5. Cf: Berachot 54a: "Man must bless God for bad things just as he blesses Him for good thing. The Almighty does not withhold the merited rewards of any creature (Baba Kamma 38b).e. the wicked are rewarded in this world" (Ta'anit lla). whether it is something good or bad." 3. is to worry that the good things happening to him imply compensation in this world for his merits. so that I will serve [God] continuously.^ 1. This would be a negative sign of Divine judgment. The Tetragrammaton (conventionally rendered Havayah to avoid pronouncing this ineffable name). The tzadik. 6.. . The tzadik does not take it for granted that he deserves the Divine benevolen ce." (Genesis 28:21)l That is. (Sgw on Deuteronomy 3:24. 75. Likkuai Torah." Kpter Shem Tov. 2.' 'Thus when a person utters "good speech. sect. 88 and 93.Speech is the vitality of the human. If. Sometimes one is to serve God just with the soul. Cf: also above. it derives from his soul .e. Gev.i. Likewise. 58. on Deuteronomy 8:l-3) See also above. when they speak bad [words]. 'When a person speaks. it produces a sound that ascends on high and bestirs the holinesses (i. however. the Sefirol) of the Supernal Ktng and they crown his head. When [people] speak good [words] and attach thought to that speech.2. That is why why we are enjo ined not to engage in idle talk because it causes one to lose part of his soul." (R.' 1.n thought. keeping the body static so that it will not become ill from using it extensively. This is indicated by the vernacular expression "er hot oysgeredthe has spoken [it] out.. sect. the vital force has departed from him and will not ascend. he has exhausted thc vitality." This. 105. That breath is part of his vitality . and sect. x. a person speaks something that is bad. Heaven forbid. Le."' 1. in turn. notes 56. . When man emits a holy word from his mouth." that speech ascends on high and stirs the Supernal "Speech. 3. sect. 59. for good or for bad (Zohar II:47b). and the notes there. Chaim Vital. they join the World of Speech to the World of Thought and effect good. Thus it is likely that his total vitality may cease from him altogether. . they effect evil. a word of Torah. . 1II:lOSa). . note 7. effects that further vitality emanates to him from on high. See above. and below. 273 (and see my notes therc). and therc is joy above and below (ibid. . blessed be He. sect. breath comes out of his mouth.. The word coming from the mouth of man ascends and bestirs an arousal from Above. and that vitality comes from [God]. and great hitiahvut (fervor. "for it is impossible to understand the subjects ofwisdom and to meditate upon them when he is ill or one of his limbs is aching" (Maimonides. 1. too. Hikht De'ot 3:3 and 4. 3. See above. It proceeds faster. sect. that the welfare of the soul can only be achieved after obtaining the welfare of the body. Addenda.Sometimes one can recite the prayers with love and fear. than prayer that is externally visible in the 1imbsPKelipah ("husk". Israel Baal Shem: When the body ails. Physical infirmity (including the weakness incurred by fasting) undermines the powers of the mental faculties. 58-59. . with immense and great love [of God]. sect. Citing R. 65 and 68. Thus you must guard the health ofyour body very carefully? Up to here [is this quote]. sect. 3.' and one is unable to pray properly2 even when clear of sins. See Keter Shem Tov. because it is altogether inward.68 and 104 2. 226. with greater deveikut to God.1. force of evil) cannot attach itself to this [ideal] prayer.2 This is the best lund of worship. is weakened.65. I. CJ the admonition of the Maggid of Mezhirech: "A small hole in the body causes a big hole in the soul. 191) 2. and 4 Moreh Nevuchim 3:27. See above.' p e n strongly attached to God] one can serve Him with the soul [alone]. burning enthusiasm)." (Ma& Devarav Leya'akov. without moving at all. Hikht De'of 3:3 and 4:l). the soul. so that to another it may appear that he is saying the words without any deveikut (attachment to God). sect. R. for ['before Him'] all is joy (Chagigah 5a) . 16. That prayer will then enter before the Holy King.'' (Peri Eitz Chayim. however. sect. end of ch. 2). Thus those appointed over the gates break down all detours and locks and take in those tears.v. blessed be He. in turn. or the prayers of the midnight-vigil (see above. s.. however. To be sure. ch. than prayer in sadness and with ~eeping." (Zohar II:165a) Likewise. Tears are caused by sorrow and sadness. sect.~ A parable for this would be the case of-a pauper petitioning and beseeching a king with great weeping: he will receive but 1 "One is not to pray In a state of sadness but with joy" (Berachot 31a). 44-45 "'Rejovc before Him' (Psalms 68:4). [One is to pray] but like a servant attending to his master with great joy. however. for otherwise the soul does not have the capacity to receive the supernal illumination that is drawn into him by means of his prayer. and the service of God in general. weeping is appropriate in prayers related to teshuvah--e. "The root of prayer is the heart's rejoicing In God" (Sefer Charridtm. sect. for 'before Him' there is no sadness at all. 12). Sha'ar Olam Ha'aniyah. but with great joy. Sadness is appropriate only with the recital of confession and when remen~beringo ne's sins. Isaac Luria thus rules: "It is prohibited to pray before God in a state of sadness. one ir not to consider any sadness-not even concern about sin. note 1). With all other praycrs. confession of sin and asking for forgiveness (see above.Prayer with great joy1 is certamly much more acceptable before [God].h us unable to rejolcc in h ~ hse art. This is a very important matter. it is good that one be humble when praying. All other prayers. 40) The act of prayer implies faith and trust in God which.g.2). note 2). .< one has committed. Sha'ar Hakorbamt. sect 18). ~t was taught (Baba Metzi'a 59a) that all gates have been closed. imply (and of themselves must lead to) joy and gladness of the heart (see Reishit Chorhmah. Bet Haknesset. 1 (in ed. Thus it 1s wrltten 'Serve God with joy' (Psalms 100. This matter is beyond estimation [of its value]. for one IS not to show sadness [In His scrv~ce] What about one who IS troubled and In d~stresst. Naggid IJmetzaveh. must be with joy. 2. See above. p. Koretz. 45. and because of h a d~stresss ee ks compassion from the Supcrnal l n g ? Is he to refrain from prayer altogether to avo~de nterlng w~ t ha ny sadness? Surely. ch. Sha'ar Ho'ahavah. and it is proper to be careful with it. but the gates of tears have not been closed. have in mind that God is vested in the letters. with [God]. thus it is only proper that I do so joyfully. 2.' This means: We do not know what a person thinks unless he speaks. the supernal one.e.. With a minister. then. that speech is a garment for thought. therefore. . with all your ~trengthb. 75. If it is in a state of sadness. It follows. closeness and attachment to God. I. and the upper world gives to it in accordance to its condition: if it is with radiating countenance. and the Holy One. therefore. you are united. they will be radiant to it in kind from on high. As your strength is in the letter[~].' 3." (Zohar II:184a. 4.) When praying.~ec ause that will effect unity with [God]: blessed be He.. it is given judgment in kind.little. who joyfully recounts the king's praises before him and in that context also submits his request.58 and 75. blessed be He. sect. dwells in the letter[s].88 and 103. 3. 75.' for the joy of man draws forth another joy. and see there also end of 218a. to yourself: "I am preparing a garment for such a great King.* Say. 107. sect. "The world below is always in a state of receiving. . The thought is vested in speech."3 Utter the words. See above. sect. Thus it is written 'Serve God with joy. blessed be He. however. 34. 5." (Yoma 39a) Why so? .6 1. sect. 6. Cf: above. the king will give him a very large gift as befits the minister's stature. "The Torah is concerned about the money of Israel. See above. then. See above. On the other hand. Chaim Vital. as explained further on. The pervasive principle that every thing contains holy sparks which man must redeem and restore to their source. thus said: [when] people eat and sit with others and use others.j those "sparks. 2. 3. 141. and it contains holy "sparks" ( n i t z o t z~f )th~a t relate to the very root of your soul. Eikrv.. the cncrgy or benefit generated by them is used for good purposes. sect. God takes it away from you and gives it to someone else because its remaining "sparks" relate to that other per~on.' The object could not exist without that spiritual component. to serve God. as explained abovc.e. I heard that this is the reason why a particular thing is loved by some people and disliked by others who love something else. must be concerned about his objects and everything 1. Eikev. Israel Baal Shem. 5. sect. See abovc. even if you did so for your bodily needs: you rectil." They are rectified by virtue of you using the strength added to your body by the garment. therefore. Thus it may happen that when you complete the rectification of all those "sparks" in that object which relate to the root of your soul. food or other things. 4. sometimes a person is deprived of that opportunity. kosher food) and. .~ R.3 When using some thing or eating food. eat. or make use of anything. Likkrrtei Torah. Sha'ar Hamikvot. When something comes your way it is by Divine Providence and grace.It is an important principle that when you wear. peace be upon him. garments or utensils. 90. sect. 3 1.. as a punishment.g. you derive benefit from the vital force inherent in that object. l. and idenr. and notes 9-10 there. therefore. is explained at length in K. it means that they are dealing with the "sparks" in those things. See below. A person. the natural or innate likes and dislikcs of a person relating to certai n edibles. Provided that you do so in legitimate manner (e. You are given the opportunity to fulfill your mission on earth to redeem the sparks that are nieant to be elevated by you. and also sect. 15). sect.2 It is inappropriate to feel anguished in considering how to serve God: but always be joyful. however. For fear on its own leads to gloom and dejection. "the foundation of all wisdom and the 'gate to God"' (see above. See above. This coexistence is unique. 44 and 46. Nonetheless. I. 3. For even then you must still serve [God]: and there is no spare time to consider how and what." (Deuteronomy 11:22) How can you attach yourself to [God] when He is a . sect. they do not contradict one another but can go together hand in hand (see Yalkut Shimoni. to show concern for the holy "sparks. 107). sect. and to become attached unto Him. sect. sect.-On the themes of this section see also Keter Shem Tov. See also below. 66.e. It is possible only in the service of God (Keter Shem Tov. It is a prerequisite to the service of God. because of the "sparks" they contain. These are "two friends that do not separate [from each other]. on compounding love and fear in the service of God. sect. Fear and joy related to one thing are two contrary feelings. I. This concern parallels the concept of concern or compassion for the Shechinah . 4. "Fear of Godn is one of the 613 precepts of the Torah (Deuteronomy 613). 623. 2-3. . 128). your prime concern at all times must be to act and serve God.. Psalms. 88. sect. it must coexist simultaneously with joy ("Serve God in joy.. 128.e. joy on its own leads to carelessness and frivolity (see below. or doing so suficiently. sect."h 6. and cf: also end of sect. and to do so with joy. sect. 6 S$e on Deuteronomy 6:5). See above." see above.e. the anguish from worrying whether you are doing the right thing. By the same token. explained above. 44 (especially note 3) and 46. 111 ". 349. Zohar III:56a). i. sect. In the service o f God.. 2."' Fear without joy is melancholy.he has. 194. This wony leads to a sense of worthlessness and dejection. 1. . You are to serve God with [both] fear and joy. which is the unavoidable effect of true faith and trust in God. See above. It is analogous to the concept of "rafzo ueshou-running and returning. think but of the 1." I That is: Worship of God with hitlahavut (fervor.e. blessed be He. impossible to be in that state continuously. This paragraph is a compound of two statements in . n3 The Gemara thus queries: ''After all. thus ascending and descending."devouring fire" (Deuteronomy 4:24)? It means. so you be merclful. as you reach the supernal level you must w~thdrawb." blessed be He. 108. ecause ~t1 s imposs~ ble to endure the ~ntensicy of the supernal light (see Maggrd Deuarau Leya'akou." How. though. Thus even when speaking to people. too. then. but when doing so later on. sect. This is an oft-cited aphorism of the Baal Shem Tov. . the flame increases and the fire itself comes down. So. 67. and Shabbat 133b (also Sotalz 14a) 2 I e . for it is but "reaching and not reaching" (Zohar 1:16b). He is 'a devouring fire'?" This relates to hitlahavut which ceases from you . whlch appear also as separate statements In the Talmud-Ketiruot Illb. "attach yourself to His attributes: as He 1s merciful. ~t is with hitlahavut: it is "reaching and not reaching." to the "letters.$$re on Deuteronomy 11:22. sect 166. Cj: Moreh Neut~chB 3:24." discussed above. I. 4." for "continuous pleasure is no pleasure. ~t 1s "reachlng and not reaching. [always] moving."4 It is possible to continuously keep thinhng of the letters of the Torah. is it possible to become attached to Him. note 1. burning enthusiasm) implies total deveikut (attachment) to [God]. to His "garments.L like fire: by blowing at fire at the beginning [of kindling it] you extinguish it. sect. and the Torah IS His "garment. It is.. 201 and 225). blessed be He? The answer 1s: "attach yourself to His midot (attributes). 3. 2. The implication is as follows: It cannot be that the Holy One. . . note 3. so that His thought may encompass matter. Thus one must pray for Divine assistance to retain the proper perspective . are from the twenty-two letters of the T ~ r a h .) "As He is rachum (merciful). 1. you retain a degree of dewikut even in the state of "not reaching. should show mercy to turbid matter. 31." when the hithhavut has ceased. note 6. Thus when considering the Divine source of speech. too. for how can the thoughts of the Most Refined encompass turbid mater? He can show mercy to us only when constricting Himself. vests Himself in His "garment" and. ~ 5." (Shabbat 133b) [The word] rachum has the same letters as chomer (matter). sect. sect. 140. sect. 75). (Note. The concept of tzimtzum.2 This is the meaning of "As He is merciful . 84." See above. blessed is He. blessed be He.[letters] of the words. Divinity (see above. and also shows mercy unto him. and contain. [so you be merciful]. sect." and this is how one effects mercy. 107. blessed is He. for they. though. See below. . note 3. These letters originate in. The principle of reciprocity of God relating to man "measure for measure. that mundane speech involves the danger of being led astray by it. and below. 142. he effects that the Holy One. All words are rooted in the 22 letters of the alphabet. as it were. see above. constricts Himself. sect. sect.' How does such tzimtzum (constriction) come about? When man is merciful. 373). whether the speech relates to matters of holiness or to the mundane (see Keter Shem Tov. " (Proverbs 12:9) The sole sign for the [true] service of the Creator is when you know of yourself that you are lightly esteemed in your own eyes. If. sect..' For then you are on a [spiritual] level. This will diminish alien thought[s] . the rivers may overcome the ice and flow over it.e. I. after the waters of the river passed over it. 51 114 "Better is he who is lightly esteemed and a servant [to himself] than one who is honored but lacks bread. Likewise. 53. 2..I 1. A parable from ice: If there is thick ice which later becomes thin. thus "a servant unto Him.U.e. [for the latter] "lacks bread. and not firm. This interpretation of the term "bread" appears in R. Cf: above. S.' it follows that the ice was not strong to begin with. when we see that one serves [God] some tlmes but not at others. but [the ice] remains firm. we see that the ice is thin." i. This is a duplication of sect. [That is better than] "the one who is honored" in his own eyes.113 Torah-study must be forceful and with great joy. . lechem. [the Divine] effulgence? 1. it is certain that he has not yet served prop1. however. I'ardess Rimonim 23:ll. Mosheh Cordovero." blessed be He. Yet he must run very fast. 126." (Psalms 85:14) In terms of ethical admonition. (R . Though he will yet perform the mitzvah thereafter. because he is filled with fear and trembling. creates the soul of the angel. sect. and see Keter Shem Too.erly. blessed is He. kavanah (intent). In context of the parablc: "Many waters (of the mundane entanglements) cannot extinguish the love. you will pursue it continuously . sect. and rivers cannot wash it away. 284. This causes him very great suffering." Psalms 34:9). Every meritorious act creates a "good angel.~ 2.. and its body is created by the act of the mitzvah." (Song 8:7) "Righteousness will go before him and will set his footsteps on the path. Thought. His punishment after death will be "measure for measure": various texts state that [after death] one is made to cross a river by a very narrow ford. the Holy One. sends an angel to hinder him. but stop midway to speak to others. Eifz Chayim 40:3.e. I The angel. For the thought (resolve) at home to go and perform the mitzvah. For if he had served once properly. because speedy crossing is of the essence. this means the following: Some people set out to perform a mitzvah. note 2. 58.) See above. had been subjected to suffering. I. This angel is the one created by that mitzvah [mentioned above] . sect.2 Thus just as the creation of his body was delayed by the person stopping to speak with 1. . 17. he would be doing so continuo~sly. however. like praying and so forth. sect. Chaim Vital. and below." and every sin creates a "bad angel. Now in the midst of the way and crossing. it is accounted to him as a sin for not having done so with alacrity." See above. is the soul to its effects in speech or action. note 4. once you have tasted the beauty and delight of the proper service ("Taste and see that God is good. 2. He knows that you would not listen to that.4 Thus "it will set his footsteps on the path.e. "your righteousness shall go before you" (Isaiah 58:8)." and he will not be hindered when crossing the river.' until he will say to him 'Go and serve idols. ."' This means: The yetzer hara will surely not entice you not to study Torah at all. the yetzer hara achieves his end by gradual enticement which is not recognized by the victim as going astray.others. then. This section is a variation (with different wording but essentially the same idea) on the interpretation of our proof-text above. ch. of the yetzer hara. Every mitzvah or meritorious deed one performs in this world precedes him and walks before him in the world to come. "Such are the wiles of the yetzer hara: to-day he says to [man] 'Do this. too. 2. he has ceased to be wise. as stated above. therefore. "he has ceased to be wise. to do good. people will not esteem you and you will not be called a s~holar. 34. 74. This initial sin provides the yetzer hara with an opening to entan gle man further. came to h~nderh im in the midst of his crossing so that he will be unable to run. These are ulterior motiws that one is not to have when studying Torah (see Nedarim 62b)." (Psalms 36:4) That is. Eliezer.3When going to perform a mitzvah.. to do good." (Shabbat 105b) In other words. sect." in the plain sense. is the meaning of "Righteousness goes before him.' to morrow he tells him 'Do that. one must see to do so with alacrity. See above. 20.) 4. because of "The words of his mouth." i. as it is said.' and he goes and serves [them]. For all Mitzvot go before a person after his death. 3. "The words of his mouth are evil and deceit. Pirkei deR. This. note 2. 3.2 For if you do not study at all. this angel now. sect.~ 1. and not with laziness. (Auodah Zara 5a. see there. Shemuel Shmelka of Nikolsburg. to teshuvah and good deeds (Berarhof 17a). 119). sect. and below. Menachem Nachum of Czernobyl. for the study of Gemara with iyun breaks asunder the kelipot. The last three sentences-[which appear also in nearly identical wording (with additional requirements) in the Hanhagot Yesharot of the Maggid's senior disciple. 1 (published in Torai Hamapgid. 26a. sect. Sha'ar Hamitzvot. sect. sect. Study Gemara (Talmud) with iyun (intensive. 18a.^ or Shlchan Aruch (the code of Jewish law) from which you would know the law properly. One is to be as studious as possible and observe 'this book of the Torah shall not depart from your mouth' (Joshua 1:8). Thus "one must bc very careful not to neglect Torahstudy. of R. CJ: also Darkri Tzedek V: p. Sha'ar Hanhagat Halimud. Peri Eitz Chayim. Menachern Mendel of Vitebsk. Va'etchanan. but only of the kind that is not lishmah (for its own sake as a Divine precept) and divorced from the religious goal of dewikrrt. 7. quoting the Maggid. to correct what one has blemished. 6. 1. See Keler Shem Tov. ms.The yeker hara thus entices you not to study whatever would bring you to fear of Heaven: such as works of mussar (devotional subject^). Study Mishnah every day. causing delight unto God even when one arrives at mistaken conclusions (Or Torah. sect.~ 4. Talmud-study and pilpul (dialectic discussions of Talmudic subjects) that is lishmah is "kishtrfei kalah--the bridal adornments" of the Shechinah (Zohar Chadarh. ibid.) .. Study TorahNevi'im-KPttrvim (the Books of the Bible) every day until becoming familiar with them. p.. 423. 88). p. on the Baal Shem Tov's insistence on study of Shlchan Aruch. 397. 5. but it must be lishmah. sect. and see also idem. See above. attachment to God (6 above. preceding his Me'or Einayim. deliberate study). 1).6 He entices you to study constantly nothing but the Talmud with all the comrnentarie~. that intensive Talmud-study to the point of discovering new insights (chidushi 'Torah) purifies man's thought for the service of God. Thus making you ignore the admonition that Torah-study is to be the gate leading to the court of fear of Heaven (Shabbat 31b). 1I:ch. Shir:64a). Magqid Devarav Leya'akov. Brooklyn NY 19751-are based on the principles stated in R. Chaim Vital." (Likkut ei Amarim-teachings and instructions of the Maggid of Mezhirechfrom the manuscript of R. This is not a critique of traditional Talmud-study. 29 and 54. on the Baal Shem Tov's insistence on daily study of such works. R. because every letter causes a stirring Above. On the contents of this section see above.This. 5. and the notes there. and other Rabbinic authorities that preccded Chassidism. when you say the word with great hitkashrut (bonding).. fear of Heaven.e. i. burning enthusiasm). 6)." i. see to pray with great hitkashrut and hitlahvut (fervor. renders: "nothing but pilpirlim (dialectic discussions of Talmudic subjects) that are inauthentic. for surely you then bring about great effects in the supernal worlds. therefore." He prevents man from occupying himself also with that land of study that will have a good effect upon him. Derec h Chayim. ch. 30d).' 1. Netiv Hatorah. ch. 56. The parallel-version of our section in Likkutim Yekarim. It appears not only in the much earlier Shenei LuchDt Haberit but was voiced already earlier by R. Judah Loewe of Prague (see his T+ret Yisrael.75 and 108. p. is the mean~ng of "he ceases. ch. 34. sect. sect. the yetzer hara seeks to make man cease "to be wise. For every letter is a complete world.e. You must. then. Thus when you say the word with great hitkashrut. you are but meditating on those you know. 237. . This critique of the sophistry of "inauthentic pil pul" is riot unique to Chassidism. On the other hand. all kavanot are included in the whole word of themselves and by themselves. to do good. as explained in the sacred Shenei Luchot Haberit" (see there Massechet Shevtr'ot. surely you bestir those supernal worlds and thereby achieve great effects. When meditating in prayer on all the kavanot (mystical dcvotions) known to you. Netivot Olam.. "all slaves" refers to the "enslaved" sparks of holiness in everything. . yovel signifies Binah: Bimh is the World of Freedom (see Zohar I:124b and 11:183a). Cf: above. and. and the notes there). . In context of the exposition following. 54. 90. 51. . every thing came about by the emanation from the Holy One. sect. Heaven forbid. See also above.e. sect. fear and love. he 1. through His attributes of love and fear..When studying Torah have in mind the saying in the Gemara (Berachot 8a)' that "The Holy One. 120 I heard from R. blessed is He." Say to yourself that He. The two Divine attributes of love and fear are reflected in their mundane counterparts. sect. 2. vested in the material. 108. which mufatic mutandir relates no less to the letters o f the Torah. 2. is in exile. which.e. has nothing in the world but the four cubits of Halachah. blessed is He. 78). constricted Himself and dwells here.' This means: As known..' 1. i. when raised to Binah (the Supernal Shechinah) are freed: in Binah they are corrected and freed (see Maggid Devarav Leya'akov. See above. all slaves) shall return to his family. e ach of you (i. thus it is appropriate to study with joy. "You shall sanctify the fiftieth year and proclaim freedom throughout the land for all its inhabitants. The love. Israel Baal Shem. however.2 When man considers that this love is a "garment" unto [God]. peace be upon him: Why is it called 'World of Freedom"? Because even a slave entering there becomes a free man. sect. as in women or food. it shall be yovel (a Jubilee Year) for you . in the love and fear man has towards objects in physical reality (see above. blessed be He. sect. blessed be He." (Leviticus 25:lO) In the Kab balistic scheme of the Sefirot. e. note 20. 87. and below. 9. When afraid of a h e a t h e ~orf [a weapon like] a sword-he should say to himself: m y should I be afraid of a human like myselt? Surely the Creator. by using his attributes of love and fear (which ultimately originate in the Divine) for the physical and mundane. He ought to feel ashamed and disgraced. blessed be He. say: 'Why did God bring him here to speak while I pray? All this must be by hahgachah peratit (Divine Providence relating to all particulars). he "exiles.e.has divested Him. I. when you hear someone spealng while you pray. prayer' es3." as it were. 5.. the unavoidable disturbance is itself by Divine Providence in order tha t I overcome it. See above. sect.. Speech is identified with the Shechin~hT.e. is vested in that human. sect. blessed be He!"' It is likewise with glorification. then. I. and say to himself: "If I love this which is but a love that fell with the 'breaking [of the vessel^]'^ and is vested in a 'putrid drop. See above. thus how much more should I be afraid of Him. See above. Also. 4. note 7. which accounts for the diffusion of holy sparks throughout creation. sect. 8. must I strengthen myself in the 'service. . 87 and 90. "a descent for the sake of an ascent" (see above. I.e.) he ought to tremble with great anxiety as he remembers his evil deeds. and all the other [attributesl. sect. the sparks of Divinity they contain. in man (see Avot 3:l). blessed be He!"6 The same applies to fear. 6. i. The Kabbalistic metaphor of "sl?evirar hakeilim-the breaking of the vessels" of the Divine attributes in the process of creation. 127.~h e ~he chk ahth us is vested in the mouth of that person in order that I strengthen myself for the service [of God]? How much... 75.'S how much more should I love Him. 64). 7. and 88. sect. from His garment. blessed be He. then.) The reply appears in Tanya. by occultation and concealment of the original light and vitality: it is an exceedingly minute portion of light and vitality. thus it is but appropriate for you to act with alacrity." Hahra'ah. i. this is possible only because the Shechinah is vested in his mouth. No thing can exist without this investment of vitality. ch. This relates strictly to the realm of holiness. The object of the indwelling merges into the light of God and its reality is completely dissolved in Him."1° It follows. 23. as it were. sect. animal. and 4 ibid. "investment of the Shechinah." implies no more than a flow of light and vitality from the Shechinah by way of kimtuzm.e. blaming it on the incorrect translation into Hebrew of the Baal Shem Tw'sY~ddish (the language in which he taught). vegetable or inorganic matter (though. See Tanya. in that person. notwithstanding the fact that this is stated clearly in the Kabbalah in general. There is a significant difference between the expressions of "dwells in" and "is vested in. that this does not appear to be the opponents' major objection: it seems that they question the basic principle of the Shechinah being vested in every thing. . whether it be human. 10.." Rabbi Schneur Zalman of Liadi was confronted with that complaint and wrote a lengthy reply demonstrating the orthodoxy of this principle. Isaac Luria in particular. Igerei Hakodesh. obviously. Halbashah. Igeref Hakodesh. the amount or degree of the concealed light differs from one object to another). and in the teachings of R. Ostensibly they were disturbed by the original text of Tzava'a~H arivah which states "the Shechinah diuells in the mouth of that person. This reference to a gentile aroused the ire of the opponents to Chassidism." implies a revelation of Divinity. 35 and 48. They regarded it blasphemous to suggest that when a gentile's speech disrupts prayer." (He adds. The light of God does not abide nor manifest itself in any thing whose reality is not completely nullified in Him. He concedes that the term "dwells" is inappropriate. and should be emended to "is vested in. that the Shechinah is. just sufficient to supply the recipient with the necessary "lifefo rcen that allows the recipient to exist ex nihilo and to be in a state of finitude and limitation.pecially if that man speaking is a gentile or a minor.. inclu ding the kelipot. however. sect. "indwelling of the Shahinah. 25. 71. 122.e." (Baba Kam 2a)' Shor (ox) is an expression of "ashurenu-I shall look at him" (Numbers 23:9 and 24:17). See below. below. 16. the mav'eh (consumption). This self-indulgence desensitizes man's spiritual nature and leads astray (Sqre. sect. 29. rage (see above.121 "There are four principal categories of damage: the shor (ox).~ Bor (pit) is an expression of "s'dei boor-an empty (fallow) field. sect. c0nflagration.2. above. See above. 4. sect. On the physical level of torts this relates to one's animals consuming anothe r's foodstuffs. as. On the spiritual level it refers to the cardinal sin of anger." It refers to one who eats every thing4 "Fire" refers to anger.j .."(Baba Metzi'a 104a) It refers to one who does not study but walks around idle.3 Mav'eh denotes "Tooth. 5 and 50. on Deuteronomy 11:15. an expression of looking and gazing. the bor (pit). e. 2. and the fire.W.g. 124 and 138). Here we are taught how they relate no less to the spiritual level. And be as . that is not ploughed and sown. These legal categories of damage relate to torts on the physical level. See above. sect. It refers to the [kind ofj sight that is harmful to pe~ple. 131 5. sect. or by reading them as idioms of similar root-words (a common device in Midrashic and Chassidic writings. i. On the spiritual level it refers to indulging the animal soul's desires for food and drink.-~ 1. and Rashi. On the physical level of torts this relates to one person's kindling of fire causing damage to another.. 1. 3. sect. Berachot 32b). and the notes there. 92. and the notes there. 122 "Rabbi said: Which is the right way that a man yavor (should choose) for himself? matever is g1oriEying to the doer himself and brings him glorification from man. note 1). This is done by implicit extension of the terms. 65. sect." is taken to mean "because (i. that you do not pay attention to) the reward. too. and below. as the opinions of others do not matter to him. .. however. Thus he acts in secret.]" (Avot 2:1) This means: 'Which is the right way" refers to "which character-traits must be avoided?" For [the word] yavor is an expression of [boor. relating strictly to God. I.87 and 114. 121.. 3.55. without [an1.careful with a 'minor' mitzvah as with a 'major' one. he must refrain from all such thoughts ("that a man should clear himsel f of')." for then "you do not know the reward given for the Mitz~ot. In our context. he has "emptied" himself of self-glorification (self-satisfaction) and the desire to be glorified by others.Y"~o u will act solely to bring gratification to the Creator. [and this leads you] to a sense of self-glorification. sect." . 11. for you do not know the reward given for Mitzvot. . note 1. See above.." So.e. The phrase "and be as careful .e. 4. with no one knowing about it2 If. 1." See above. I. and also sect. sect. The sentence thus reads: "Which is the right way of what man is to empty (clear) himself of?" 2. ." If you act in this manner. the Mishnah is not to be read as two separate admonitions. 55 and 64. It does not mean to refrain from performing his religious duties. .] "emptiness. you think to yourself that you serve God. for the very reason that) you do not know (i. . you must refrain from all [such thoughts] ." i." The implication is to perform a mitzvah in secret. even if it be not yet in the "right way.15. sect. let alone [when anticipating that] "it brings him glorification from man." is taken to mean "and then you will be as careful . . .. 126.. .e.e. the "right way" is to act without any ulterior motives.e. you will be "as careful with a 'minor' mitzvah as with a 'major' one."1 Thus he continues.e.. blessed be He. Cf: above. doing the mitzvah in order to be praised by othersthat they shall say that your are a God-fearing person. the phrase "for you do not know . 'matever is glorifjring for the doer himself. but both are equally commands of God w~ t hal l that this ~mpliesS. 53: You must consider that you are but like a tool. . thus you will not observe the 'minor' one. pursuit of self-glorification. when uttered with kavanah (proper intent). the lower Shechirzah ). Sce above. note 1). sect. the "supernal Shechinah") is reflected in human thought. and one for the beinunim (intermediate)." (Rosh Hashanalz 16b) Tzadikim gemuriwt are those whose speech is altogether in matters of holiness.. to unite the speech with the 'World of Thought.major" mttzvah and a "mmor" one.I. 2. 75.e. will cause you to consider whether a rnilzvah is [merely] 'minor'. ee ~bovcs.e ct 1 and 17 123 "Three books are opened on Rosh Hashanah: [one for the thoroughly wicked. Man must effect the yichud (unification) of these two by infusing his proper speech (words of prayer and Torah) with proper thought (kavanah).ticipation 00 any compensation of reward that may cause selfglorification.."l For one must believe that with every prayer and word of Torah. one for the tzadikim gemurim (perfectly righteous). The 'World of Speech (Malchut. On the other hand. Note Magid Devarav Leya'akov. especially notes 11-12." 5 rhrs is obvrously unacceptable There are legal differences bctwecn a '. Those whose sole intent is to effect that supernal y i h d are the perfectly righteous . Your thought and speech are extensions of the [supernal] worlds (see above. for [only] a 'major' mitzvah will bring you glory. As the "World of Thought" (Binah. the supernal Shechinah) extends the requested effusions to the 'World of Speechn (Malchtct.the 'World of Speech" with the 'World of Thought. prayer and Torah. the "lower Shechinah) is reflected in human speech. Thus the 'World of Speech" (i."2You may not be granted that which -I. you surely unift. this effects also the literal fulfillment of the prayer on the mundane . sect. the Shechinah) beseeches the 'World of Thought" for the spiritual aspects of the prayer's content. The 'World of Thought" (Binah. and see there also sect." effects the same on high. Thus man must beware never to assume that his prayers are of no avail.' h~mility)"w~:h en one prays with kavanah. blessed is He. the Holy One. 81. see there. he should not think of self-glorification on account of praying with great kavanah. that the prayer will then be answered 4. in terms of the universe as a whole. sect. blessed is He. sect.. therefore. i. 176 and 214. except that] this is concealed from the petitioner . This happens if his sole intent is but to join the World of Speech' to the World of Thought. sect. 73. This Talmudic statement is explained above. 80) All prayers are effective in the upper worlds.) "When man attaches himself to the words [of speech]. which is a brief version of this section. is glorified in the 'World of Speech. (aid.4 These people. This is the meaning of our sages' saying (Berachot 30b) that "One should not rise to pray but with koved rosh ('heaviness of the head. Their effect is according to what omniscient God determines to be for the best interests of man and the world. however. sect 73. Thus he must be careful not to cease from the deveikut (attachment [to God]). 58. note 2. notwithstanding what was said above. grant them the level. they intercede on his behalf. The beinunim (intermediate) are those who in prayer have in mind also that the Holy One. In fact. ." they are tzadikimgemurim. 142). whose sole intent is to unify the World of Speech" with the 'World of Thought." This brings glorification into all worlds. sect. 138 and 145.you requested in your prayer? Nonetheless.'" (Maggid Devarau Leya'akoo." (Keter Shem Tou. It may be asked. that at times the fulfillment of the request is not perceived.) 3. .e. I. [A stirring (initiative) from below.e." unifying the 'World of Speech" with the 'World of Thought. and sometimes in other parts of the universe. (CJ above. one is answered for what has been requested. Zohar I:77b and 86b. [the prayer has been answered. the "stirring from below. II:3lb elpassim (and see below. sect.. effects a reciprocal stirring from Above .. and also upon [the one who prays]. .] "One must believe that as soon as the prayer has been uttered.) 5. . the judgment of thc intermediate is suspended until Yom Kippur. to free them for the service [of God].h). 7. 58) 9. . but when they do so not for self-~ndulgence. [The phrase] "three books" denotes [forms of] ~peech. too. They "remain suspended6 from Rosh Hashanah until Yorn &ppurV (Ro-qh Hashanah 16b).e. th~s. blessed be He. unlike the perfectly righteous." (Exodus 1 :1-2) R. the 'World of Thought" which is referred to as Yom &ppur. Tikunim 93b).e. their kavanah (intent): if their intent in requesting mundane needs is for the sake of Heaven.. but for the sake of Heaven.' This means. for the life of the world to come. Thought' and every thought ascends. grant them then [personal] w~shs. Shimon. Reuben. they. the 'World of Thought. who arc inscribed for life immediately on Rosh Hashanah." i. .I. and the commentaries thereon.b ut also that the Holy One. his memory is for a blessing." See also Zohzr 11:185a and 1II:IOObJ 8. sect.g For the World of Speech" and the 'World of Thought" are unified by virtue of their kavatzah. thus speech. blessed 1s He. shall be inscribed for life. The intermediate worry also about their own needs on earth. "These are the shemot (names) of the children of lsrael [coming to Mitzrayim (Egypt) . The beintrnim's s e ~ i c ies not as great as that of the perfectly righteous whose concern is exclusively tzorech gevohah (for the purely spiritual effects on hig.t and suspended unt~lY om Kippur~m. 1s mentonous and acceptable. . Yom Kippur is identified with Binah (Zohar Cludash." (Maggid Deuarav Leya'akov. and they are rnscr~bed for life "The intern~edratew.request of their mundane needs. too. Israel Baal Shem. hose Intent rs [not only] to un~fy. Thus their thought.f or then there 1s a man~festat~oonf the 'World of . [interpreted] the verses "They . will be effective. too. i. the suspension remains until [the examination ofJ the "thought.e.~ 6. See Sefer Yekirak 1:1.. The term sefrr (book) is an idiom of siper (relate. I. communicate).. Levi . it will not ascend on high. What caused this? The fact that he turned his deed into a nevel (lyre). are turned into selfs e ~ nmgu sical instruments. 3. . this refers to the spiritual Jerusalem. 5.e.. but as one playing the lyre." i." which denotes the kelipot. as of Torah or prayer and so forth. an idiomatic interpretation of nivlai avadecha: the deeds in the Divine service (of those who ostensibly are 'Your servants"). I. .": What caused the gaiut and the shima1. or some perfection. I. he does so not with fear and love.. that is. by the performance of a mitzvah.c. The term Yerushalayim is a compound ofyirah (fear) and shalem (whole.e. Moreover. pride and arrogance.4 This causes.' When performing a [good] deed. This is the meaning of "nivlat avadecha as food for the birds of the sky . to the beasts of the earth. by de scending to the kelipot it will strengthen them as well (see above. into self-elevation.turned Jerusalem into heaps (of rubble)." In the same vein one can interpret [our text] "These are the shemot (names) .. .e. but descend to the kelipot. [the flesh of Your devoted ones to the beasts of the earth]" (Psalms 79:l-2): Galut (exile) came about in this world by our many sins because "they turned Yerushalayim (Jerusalem) into heaps (of rubble). . I."' That is. when a person attained some fear [of God]. into a large.. As the seq uel explains. This is the meaning of "they turned [Yerushalayim]"-their yirah-shaiem (perfect fear)2--"into heaps. he turns it into a nevel (lyre) and harp. Bereishit Rabba 56:10. 4. this leads him to a sense of pride. the destruction ofJerusalem is not the effect but the cause. "as food for the birds of the sky. 2.. they have given the nivlat (the corpse) of avadecha (Your servants) as food to the birds of the sky. sect.e.5 Thus it is written. perfect ). . Midrash Tehilim 76:3. high pile. I. 87). Thus it signifies the aspects of fear of God and perfection in the service of God. his avodah (service of God) to move-Heaven forbid-to the kelipot (forces of evil) . " (Psalms 92:13) There are two types of tzadikim (righteous people). sect. and it is only fit that God. See also above. The name Levi is rooted in the word lavah (to join.e. and both are perfectly righteous.e." 6.." Keter Shem Tov. Moreover. they have a counter-part in kelipah.e. 31 and 403 (see there). when performing a deed he says to himself "re'u (see) the difference between me and other p e ~ p l ef." (Genesis 29:34) 11.. Genesis 2932. note 10. Esau). The name Shimon is rooted in the word shama (to hear): "God heard." i. Bereishit Kabba 16:4."'o as alluded in [the names] Shjmon [and Levi]. sect.e. but it app lies to every galut as this is a generic term for every exile (ibid.. note 4. grow tall like a cedar in Lebanon. this (and the subsequent interpretations) are taken in the negative sense. Beraclwt 7b. ap~alment )o~f the "coming to Mitzrayim (Egypt). I. sect. straits)." i. yishma (hear) my voice9 and yilaveh (attach Himself) to me." (Berachot 7b) Here. 1. 13. The difference between them is as follows: . to attach): "My husband will become attached to me. note 2). reading shemor as an idiom of shamah (desolation.. In our context this relates specifically to the galut of Egypt. appalmcnt). readingMitzrayim as an idiom of mei~rar (distress.mon (desolation. and likewise with the other names. 9.). Thus "just as the names of the tribes appear in holiness. "A righteous person will flour~sh like a date-palm." (Genesis 29:33) 10. too. into the meitzar (straits)' of thegalut? The answer is: "Reuben.. Leah.e. The name Reuben is rooted in the word ra'ah (to see). his mother. 64. Everything in holiness has a counterpart in impurity (see abovc. may He be blessed. 7. 8. though.o~r I perform my service [of God] perfectly. had in mind: "Re'u-ben--see the difference between my [first-born] son and the son of my mother-in-law (i. so. see below. is perfectly righteom3 1. and not for others. the tzadik becomes the cause of teshuvah of the wicked. this second type of tzadik is called ba'al teshuvah..487 and 489. thus said that "the perfect tzadikim cannot stand in the place where the ba'alei teshuvah (penitent) stand." (Berachot 34b) That is. bringing others back to goodness so that tzadikim may multiply and be fruitful in the world. of blessed memory. he "brings out the precious from the vile" (Jeremiah 15:19). He is a tzadik. 3. which produces fruits: "he will flourish like a date-palm. See Zohar I1:128b: "The worthy person must pursue the wicked to remove from him the filth [of sin] and to subdue the sitra achara. ch. That is. He is the one who is compared to a cedar of which our sages. said that it does not bear fruits. he causes goodness to flourish and multiply in the world.' For he restores others to goodness.One is in a continuous state of deveikut (attachment) to God and performs the service incumbent upon him. of blessed memory. he is the proprietor and master of teshuvah. sect. and this exaltation is greater than all oth . This interpretation of the term ba'al teshuvah in the literal sense of "maste r (in Kabbalistic context: 'husband') of teshuvah. sect. i. Bet Elokim. Sha'ar Hateshuvah. He is concerned but about himself. Our sages. 15. This is a praisewor thy act effecting an exaltation of the Holy One. (Ta'anit 25b) For he is a tzadik just to himself and does not produce fruits. i. No'ach. "turned many away from iniquity7' (Malachi 2:6). more than from any other praiseworthy act.) In this context. and effected teshuvah in the world. and the Mamd's Or Torah.. just for himself." that is. 270.e. he does not make his righteousness affect others. 486. see Keter Shem Tov.e.2 though the latter. (This concept of the tzadik as ba'al hshuvah is discussed at length in R. His reward is doubled and redoubled far beyond that of the first type of tzadik. too. 2.. and Aggndot. blessed is He. however. The second type of tzadik is compared to a date-palm. to "grow tall" and enhance his reward. sect." appears in Zohar II:106b. Mosheh de Tirani. " (see the sequel there and on the next page). Thus first of all submit to your obligti ons and do the mitzvah. CJ the differentiations between Noah. and the inwardness of the vessel is produced by the intent.e. is an important principle: When you think of performing a mitzvah. blessed be 1. . as known. (Scc above. 106a and 254b. The performance of a mitzvah has an objective validity on its own. sect. Come and see: whoever takes the hand of the wicked and induces llirn to forsake his evil way.2 After this choice you must see to it that "your mouth and heart harmonizeW4 to believe with absolute faith. 2. sect. note 1. "Out of [acting] shelo Eishmah (not for its own sake) [one comes (to act) lishmah (for its own sake)]. while the kawanah (the person's proper intent) is its soul (cf: above. to make an effort to harmonize (lit. sect. Up to here is a brief restatement of the principle stated above. 55. I. sect. too. 4. For. and also in Devarim Rabba 11:3. I.. without any ulterior thought. do not refrain from doing it for [fear of-a sense of] pride or whatever ulterior motive related to it. 131 and 389). This.. cautioning that the wicked must be restored to goodness with empathy and kindness..' First of all must be the [good. The emphasis on kauanah and deveikrrt is never meant to over-ride the Halachic obligations. that "the whole earth is full of His glory" (Isaiah 6:3) and that everything is possessed of His vital force. 55." (Pesachim 50b)' The very act of a good deed already effects on high a good vessel. even if the proper intent is as yet lacking: the action on its own is like the "body" of the mitzvah (or its effects). 113 and 251 (and scc there also sect.crs. proper] choice. 47. 58 and 116). choosing to act. to perform the mitzvah. 3.c. sect. arid 4 also Keter Shem Tot). Abraham and Moses iri Zohar I:67b.. "make as one") your thought and intcnt with the act of performing a Divine precept. Note the Baal Shem Tov's interpreta tion of this passage in Kefer Shem Tow.) 3. rises with three ascents unlike any other person. 7. everything derives from Him. For at the time of the 'breaking [of the vesselsJ'8 something fell from all the attributes. with all the attributes. [all of] the inorganic. as already discussed above. See above. and humans. blessed be He. will of itself lead to the proper attitude and intent. should I be afraid of a single spark of His which is [vested] in that bad thing? It is better to attach myself to the 'great fear'! The same applies to love. Gevurah. sect. . 84. sect.87. See below. See above. 14. The fear. sect. and all creatures. and of the fact that everything exists but by virtue of it. who put the [aspects ofj fear and love even in bad things. 119. See above. See above. 11. Divine vitality. 6. blessed be He. the vegetative. Thus you are not permitted to love. . 120. 87). fear and all the other attributes-even the bad things in the world6-all come from Him.188 and 396.22. 70.106. blessed be He. it is the vital force within you. 101 and 120. sect. Why. glorie. Corresponding to the attributes of Chesred. which de5. sect. and so. such as wild beasts. 9. Cf: above. sect. you ought to consider: "Whence is this present fear or love? After all. T&et and Netzach (see above. sect. .He. to extract the spark [of holiness] from there and raise it to its root? For this is the ultimate desire of our soul. is from Him.. note 4. the good and the bad . fear. therefore." See also ibid. 8. 120. blessed be He. then.5 Thus every form of love. and likewise with all the other attributes.-The consciousness of Divine omnipresence. 26: "The Shechinah compounds all worlds. Whenever you are afraid of something. for the bad is but a base for the good. 58. 130. too.90. Rather. Cf: Kpter Shem Too. to raise [the fallings of] the 'brealung [of the vessels]''0 to their ~ource. 10. 90 and 119. or love it. sect. sect. or make prevail7 anything beyond Him."~' The same applies to your speech: do not think that it is you who speaks. animals. sect. note 4. This is again the principle of sublimating man's emotive attributes or trait s to holiness. sect. LC. blessed be He. 12. 16.12 This [attitude] compounds also the [notion of] equanimity. 42 (with greater elaboration in the Maggid's Or Torah. sect. sect. he will be afraid to appr0ach. however. See above. sect. for all derives from Him." Likkutim Yekarim. sect.. The one who has a sense of fear. with everything else. sect. and see there also sect. and Magid Devarav Lqa'akov.l 1. for "continuous pleasure is no pleas ure" (see above. and Maggid Devarav Lqa'akov. sect. will carefully watch to act properly. it would no longer be appreciated. Cf: above. See above. however. sect. 103 and 120.* By virtue of fear joined to [the love]. Cf: above. sect. See Keter Shem Tov. 118). he would lose the sense of reverence. for familiarity breeds contempt. And so. sect. the love would be so impressed upon him that it would become his very nature. 111). "He who acts with love [only] .rives from the Creator. Vayechi. 2 and 10. will sometimes not sense to act scrupulously . too. . The reason why [both] love and fear [are necessary]: If man had only love of God. 349.I3 because the faculty of speech is the same in another as it is with you. your Intent should be to extract the vitality [from the food] to elevate it to Above through the service of the Creator. 3. 109. . 59). explaining how the seemingly contrary feelings of love and fear can be .Ih 12.! Moreover.15 Your intent in everything should be to effect that you attach yourself to Above. blessed is He. he would be accustomed to being continuously with God. 15. end of sect.. 14. 7 and 203.14 Likewise when eatlng. 115. I. See above. 2. 88. 2-3. blessed be He. that speaks through you and raises the speech to its source.e. 13. except that it is the 1. 67. and.joined in the service of God. his mind is not complete. The [states of] katnut and gadlut relate likewise to prayer and every mitzvah performed by man. One might wonder: In context of the creation. Evil cannot be a real entity on its own. By the same token one cannot say that there is real evil. sect. for that would imply the heresy of dualism. Yet we do experience evil on earth." too." expanded consciousness): When a person sits and studies Torah. is good. independent of (and opposed to) goodness and holiness. sect. the Torah itself states "I have placed before you.69 and 96. he is in a state of katnut." and at the conclusion thereof (Genesis 1:31)] "and behold it was very good.] the "evil. I have placed before you life and the good. death and the evil. See above. however. when he studies with discernment and hitlahavut (fervor. it is written. for example. and death and the evil.' 1. as said." In the Book of Deuteronomy. On the other hand. and does so without discernment. because he is attached to the supernal levels. and below. albeit created by God: God is the very essence of pure goodness. 110 with regards to compound ing fear and joy. 135 and 137." (Deuteronomy 30:15) Where did the evil come from? One cannot interpret this in line with our speaking of real evil. thus only good can come from Him. 129 To understand what is katnut ("smallness. sect.' [In actuality.. See also above. enthusiasm) he is on the level ofgadlut." What then is that which we call evil? ." constricted consciousness) and what is gadlut ("greatness. "See. the Torah states several times ["it was good. a process of devolution brought about crude matter and the lowest entities to be found on earth. is. however. All that God created is good. "seat") for good" (see above." though mile'eil (fronr above) it is really good. therefore. They lend themselves to our context: milera (from below) is interpreted as an expression of ra (evil). See also b elow. and through her the prince became worthy of his rewards and an intensified love from his father. but are synonymous with the terms in that passage. The reference appears to be to Zohr 1:49b which discusses how things below are rooted in the spiritual categories of above: the yetzer hara has a spiritual source.lowest level of absolute good. The things the Torah calls evil are truly evil relative to ourselves. The terms mile'eil and milera do not actually appear there. In their origin (and their intended purpose). it is rooted in goodness above.) That which we call evil. but he rejected her allurements. The source and core of all beings. and constitute that which we call evil. Without the Divine spark inherent in all beings. 126-127. sect. a "base (lit. "from below" it is "evil. sect. "death and the evil"). this brought great joy to the king and he rewarded his son with precious gifts and honors. they are really good.2 This is alluded in the Zohar's reference to "mile'eil umile'ra-from above and from below."' 2. Thus even those things that are forbidden and condemned by the Torah. . the good is altogether concealed and invisible. To test his son's obedience and devotion. in effect. This principle is explained in terms of a popular parable in the Zohar l1:163a: A king provided his son with the best education and instructions to lead an exemplary moral life. Now. In essence. it is good. however. in terms of its origin (and purpose). 3. who was instrumental in bringing all that glory to the prince? None other but the temptress! Thus she is to be praised on all counts: she fulfilled the king's orders. is pure spirituality. note 6). Needless to say. absolute good.. arc rooted in Divine goodness. 138. but it itself becomes manifest in evil below. they could not exist. and all we see is but the truly evil shell. however . he h~red a beautiful and clever woman and ordercd her to seduce the prince That woman used every blandishment to tempt the prince. note 7. They came about to enable man's selfrealization by proving him with the options of frec choice ("life and the good" vs. 132. As it descends to its mundane manifestation. ((3 also below. sect. By means of tzimtzum (Divine Selfcontraction). that is. Thus when effecting good, the evil, too, becomes good.4 But when sinning, Heaven forbid, it becomes real evil.5 Take, for example, a broom for sweeping the house: in context of clearing the house it has some good quality. It [may be] a low level, but it is still good. But when it is used to hit a child doing some wrong, the broom becomes truly evil when hitting the child.6 4. See above, note 2. 5. The kelipo~ (i.e., the realm of evil) exist only by virtue of the Divine will . They are sustained by sparks of holiness deeply embedded within them, albeit in limited measure that is just sufficient for their intended purpose. When man sins, however, he infuses additional vitality and energy into the kelipor (see above, sect. 9) which empowers them to go beyond tempting man, to try and "conquer and prevail with full force." Thus it becomes real evil. 6. The broomper se is morally neutral. In essence it is mere potentiality: when used for good, its potential for good is realized and confers goodness upon itself. When used for evil, its potential for evil is realized and confers evil upon itself. 131 "All the days of the poor are bad." (Proverbs 15:15) Our sages said, "No one is poor except for him who lacks knowledge." (Nedarim 41a) In this context, [our text] means the following: "All the days of the poorm-in knowledge-"are bad," because his prayer and Torah-study are not considered at all before [God], blessed be He. For surely they are devoid of fear and love, thus they do not ascend on high.' But the question is raised : "There are the Sabbaths and festivals?" (Ketuvot 110b)2 That is, surely in these days there is 1. Torah studied without fear and love does not ascend on high. (Tikunei Zohar 10:25b) This applies to prayer as well; see above, sect. 87. 2. I.e., how can you say that "all the days of the poor are bad" when there are the Sabbaths and festivals when even the poor are provided with good food? a "stirring from Above" unto man, and he will certainly pray on these with devotion?3 The answer is : "A change of diet [is the beginning of bowel-disease]." (Ibid.) That is, though he does pray now with devotion, and regards himself as praying with devotion, this leads him to pride arid a sense of greatness, imagining himself to have ascended now to a sublime level! Thus even now [his days] are bad. For "a change of diet is the beginning of bowel-disease;" that is, "the yetzer Cmra is provoked only by eating and drinhng" (Zohar 1:llOa) and that is what led him to pride. And a word to the wise is sufficient. 3. Just as there is a beneficial change on Sabbaths and festivals in terms of physical food, so, too, it is in terms of "spiritual food": on the Sabbaths and festivals there is a manifestation of holiness, "the Shechinah never departs from Israel on the Sabbaths and festivals" (Zohar III:179b; and see there also I:75b: "On the Sabbath.. all [the kelkot] are removed and have no dominion.. and the world is in joy and is sustained from [holiness].") See also above, sect. 85. 4. I.e., the special condition of the Sabbaths and festivals will lead him to a sense of self-satisfaction, and the error of imagining that he need not improve. God must be served every day. (See above, sect. 85.) The service restricted to Sabbaths and festivals, albeit elevated, thus proves counterproduc tive. Cf: above, sect. 74. An interpretation of the verse in Psalms [which reads]: "I will thank God with all my heart, I will relate all Your wondrous works." (Psalms 9:2) The plain sense of this verse requires careful consideration. Granted that the phrase "I will thank God with all my heart" is well and good. The verse's conclusion, however, "I will relate all Your wondrous works," presents a difficulty. Is it not written (Psalms 106:2) "Who can express the mighty acts of God, make all of His praise to be heard?!" Thus how could he say "I will relate all ofyour wondrous works?" TZAVA'AHTA RNASH 127 This can be explained in context of the Zohur's comment [on the verse (Genesis 22:1)] "And God nissah (tested) et Avraham (lit. "the Abraham;" Abraham)," that it should have said "nissah hlvraham-tested Abraham" [without the particle et]. (Zohar 119b) This will be understood in view of the wellknown premise that chessed (love; kindness) is the attribute of Abraham, as it is said, "chessed unto Abraham." (Micah 7:20)l Our Sages, of blessed memory, said (Chulin 91b) that there are angels who recite hymns only once every seven years, and according to some only once every fifty years. Their recitals are brief: some say [but the single word] kadosh (ho1y);Z some say "baruch-blessed bey's. (Ibid.) Some [angels] say one verse, as it is said of certain angels that each of them recites one verse from the psalm "Thank God, for He is good." (Psalms 136);4 and so forth. Any one of Israel, however, is allowed to speak and laud at any time and occasion, and to prolong this with every kind of laudations, songs and praise^.^ This will be understood with the parable of a king, all of whose servants and ministers came to recite hymns before him and to laud him. Now each one is allotted a certain time and limit for his laudation, corresponding to the individual's rank and importance. Moreover, all this happens [only] when the king is favorably inclined. If, however, the king is in an angry mood, Heaven forbid, they are afraid to laud him at all, as it is said, "How can you laud the King at a time of wrath?" (Kinot for the Ninth of Av) When apprehensive because of doubt whether the king is angry, Heaven forbid, or lest he become 1. See above, sect. 87, note 11. 2. I.e., of the verse "Holy, holy, holy is God." (Isaiah 6:3) 3. Ezekiel 3:12 4. See Siddur R. Isaac Luria, ed. R. Shabtai of Rashkov, s.v. Shacharit LeShabba t (p. 70b), listing the respective angels reciting each verse. 5. See Chulin 91b. angry for whatever reason, they would be as brief as possible and immediately leave his presence. On the other hand, when the king's beloved and loving son enters to laud (his father], he is not concerned about all that. For even if the king is angry, seeing his beloved son enter effects joy and delight in the father. Now, we said that anger departs with the advent ofjoy and love. To be sure, this is only natural. Nonetheless, we must understand why this is so. It can be explained [as follows]: When love and joy prevail, they cause the anger and wrath to ascend to their source above where they are "sweetened;" for, as known, "dinim (judgments; severe decrees) can be sweetened only at their root."" This, then, is the meaning of the verse "And Elokim (God) nissah et Avrahm": Elokim, which denotes dinim,' nissah-was made to a s ~ e n di;t~. , they departed all the way to above and 6. A basic Kabbalistic premise; see R. Chaim Vital, Eitz Chayim 13:l; and Mikdas h Melech on Zohar 1:151a. In the human or earthly experience of dinim, they are "bad": they are manifest in suffering. Thcy originate in the Divine attribute of Cevurah, which itself is rooted in the Sefirah of Binah. The Divine attributes, however, are altogether good. Thc root and source of dinim, therefore, is good, and their ultimate purpose is for good as well, except that they devolve to their mundane manifestation and perception as something bad or evil. (See above, sect 130 ) The consciousness of then true nature, rcallz~ngt hen Inherent goodness ("Whatever the Merc~fuld oes IS for good"-Berachot Wb) thus traces the evrl below to rts goodness above, and this effccts a "sweetening of the ~udgmentI n ~ t sso urce" the evil is annulled and ~ t sin tended goodness becomes manifest. See firer Shem Tov, sect. 33. 7. See above, sect. 102, note I . 8. The word nissah, generally translated "tested," also means "clevated; raised" (as in Isaiah 30:17, 4922 and 62:lO; see Mechilta and Lekach Tov on Exodus 20:17, cited by Rashi ad loc.). These two meanings converge in the fact that every test is for the purpose of elevation. Thus in our context, too, both meaning are given to "God nissah Abraham"--see Bereishit Rabba, ch. 55, and Zohar I:140a. he is his father and lung.. indicates that [His] love for me. [so is the heart of man to man]. "And Leah said. too. Why? [Because ofj "et Av~aharn. ) . Leah assumed that her share would be three of the twelve sons of Jacob. As she gave birth to a fourth son.I0 Let us return to the above parable. Bereishit Rabba 7:4." 9. aside of the fact that I am dutybound to offer praise and laudation [unto God] because of the filial obligation to a father." 10. the dinim (signified by Elokim) were made to ascend and become sweeten ed." that is. blessed be He. We said that the son lauds without restriction. (Tamhum. For the offering of thanks applies whenever one is granted some additional privilege from Above. this. by virtue of the love and chessed (kindness) signified by Abraham who is compared to the King's son. with (by virtue of) the attribute of Ckssed (signified by "Abraham"). thus obligating him to offer thanks and to praise exceedingly.were sweetened. unlike any other minister and marshal." That is to say. the love for [God]. she expressed special gratitude. "with Abraham. is firmly inserted in His heart. This time let me [gratefully] praise [God]." (Genesis 29:35)11 Our text may then possibly read as follows: "I will thank God with all my heart. thus more than her share. is itself reason to praise his father. For a son is obligated to praise his father to no end and limit for two reasons.e. the king. especially as he has no reason to be apprehensive [as stated above]. Moreover.e. as it is said with the birth of Judah." (Proverbs 27:19) For this very reason He permitted me to "relate all Your wondrous works. I will thank Him also because "God is in all my heart. for "as water (reflects) face to face."t~ha t is. in turn. Vayeitze:9. 11. the very fact that he. was granted permission to laud beyond any limit. First of all. is firmly inserted in my heart.. I. cited by Rashi ad loc. I. blessed be He. silence is much more preferable. 105.e." The parallel version of our text in Hanhagot Yesharot adds (in brackets) that this applies only to one who has attained an exalted level of spirituality. shall be accounted as if it would be all of His wondrous works. For all others it is preferable that they engage in words of Torah. 2. but at that very time he is actually in solitude with the Creator. and join oneself unto Him.~ Sometimes one can be lying in bed. Cf: above." because there is no limit and end to them.. and 1 Kings 1:21. sect. For in silence one can think of the greatness of [God]. CJ Likkutim Yekarim. . . 3. See Rashi on Genesis 31:39. more so than the joining by means of ~peech. For I am obligated to relate His praise beyond limit because of the two reasons cited above. sect." That is.. CJ above. Judges 20:16. Thus whatever "I will relate." 1.' Even when speaking with others words of the wisdom of the Torah." The hindrance [of ~nability] is not on my part: it is simply impossible to complete the prase of the Master of the Universe and to relate "all Your wondrous works. blessed be He. This meaning for cheit appears in Genesis 31:39." this is [resolved by the phrase] "I shall relate. 190: "'Silence is a fence for wisdom' (Avo1 3:13) because in silence one is able to become attached to the World of Thought which is [the Sejrah] of Clwchmah (Wisdom). 133 'Whoever engages in excessive talk brings on cheit (sin). 65. the little one 1s able to relate." i. and to others it appears that he is sleeping. the little that I am able to [gratefully] praise and relate should be accounted as ~f I related "all Your wondrous works." (Avot 1:17) [The term cheit] denotes deficiency. sect. blessed be He.As for [the difficulty from the verse] 'Who can express [the mighty acts of God]. sect.' You will have to descend several times during the day. 4. even as one looks upon another person. in order to rest a little from your thought2 At times you can serve only with katnut (restricted consciousness3). then the Creator.[The ability] to always see the Creator. sect.' 1. For the concept of katnut see above. This shall be in your mind constantly. with the mental eye. sect. blessed be He. sect. Cf: above. 137.-The parallel version of our text in Likkutim Yekarim. sect. blessed be He.4 1. sect. 136 and 143. See below. below. with a pure. is looking upon you just as another person does. 209 (and Kekr Shem Tov. [You can do so] by thinhng that . to below. and then you will be able to ascend to Above. sect. 67. 69." At first attach yourself properly unto the Creator. 32 and 69. blessed be He. 137. 2. sect. especially note 1. Bear in mind that when you are continuously with pure and clear thought. Cf: above. and 4 below. blessed be He. is loolung upon you just as another person does. clear and lucid thought. and will not be able to ascend on high. 169. See above. 136 Some times you are able to attach yourself to Above even when you are not praying. 129. sect. below. 232) reads: "Bear in mind that the Creator. 3. and Keter Shem Tov. too. is a high level [of attainment]. and 4 Kefer Shem Tov. sect. 281. too. sect. sect. .. 67. 137 and 14. Who is En Scf(1nfinite). sect. you will have the strength to ascend beyond all the Firmaments and Thrones.3 This is a service [of God] on the level of katnut (smallness. and then strengthen yourself to ascend even higher. blessed be He. Thus it is only proper for you to trust in Him alone.~n d to speak there in that realm. the Ofanim and the Se~aphirna. but you stand on the small dot that is the earth.2 By virtue of spealung below with fear and love. and you serve with [fear and] love below. 67." Cf: below. 4. 2. beyond the Worlds of hiyalt.' He is "ultimate fineness.2 Think that you look at the Shechinah which is at your side just as you look at physical objects. blessed be He. 3. See above. 2. 1. See above. constricted consciousness). sect.you are beyond the dome of the firmament.' Some times you are unable to ascend to Above even during prayer. sect." He is the Master of all actions in the world." Some times you are able to discern that there are yet many spheres [over you]. See above. sect. and He can effect whatever [you] may desire. 24. It. sect. blessed be He. sect. He effected a 1. 134. Yetzirah and Atzilut which correspond to the categories of "the Firmamcnts and Thrones. See abovc. Sce abovc.7. The whole universe is as naught in relation to the Creator. 84. 3. 69. the Ofonim and the Seraphim. Bear in mind about the Creator that "the whole earth is full of His glory" (Isaiah 63) and His Shechinah is constantly at your side. For man is where his thought is. scc above. and attaching yourself to the Creator. blessed be He. His holy mountain. his Torah . sect. in whom I shall be glorified" (Isaiah 49:3): God derives much glory. You look at the Creator. sect. See above. are rooted all the good things and the judgments in the world. Always be joyfuL8 Think and believe with perfect faith that the Shechinah is at your side and watches over you. See above. 15. i. looks at The Creator. 10. See above. blessed be He. 134. seeing God from afar. sect. can do anything He desires. He can destroy all the worlds in a single instant and create them in a single instant. "Israel. 129.7 This is perfect worship. but you are still unable to ascend to the supernal worlds.e. 136.10 Thus "I trust only in Him. 9. blessed be He.44-46. See above. 84. blessed be He.. See above. for His effluence and vitality is in all things. This is the meaning of "God appeared to me from afar" (Jeremiah 31:2).5 You may understand this intellectually. and fear Him alone. end of sect. In Him. when you serve [God] on the level of gadfut (greatness." (Psalms 48:2) This may be interpreted in context of the verse. 8. 107 and 110. See above.y~o u strengthen yourself with great force and ascend in thought. sect. sect.tzimtzum (Self-constriction). blessed be He. the Seraphim and the Thrones. 6. 7. and the Creator. delight and pleasure from the tzadik's deeds. 138 "God is great and much praised. 130. penetrating all firmaments in one swoop and ascending higher than the angels." 5. the Ofanim. If He wills it. expanded conscio~sness). "clearing" within Himself a space in which to create the worlds. On the other hand. in the City of our God. God in His kindness rewards him as if he had done it on his own. for his great affection for him. state: "[The Holy One. It follows. Nonetheless. 'The father. 55. Thus you gave us the strength to overcome the yetzer hara and to 'sweeten' it by means of the Torah. tcr "reward man in accordance with his deeds" implies well-dcserved compensation. and I created the Torah as its tavlin ("spices. says to Israel: 'My children. God. then. in calling us 'children of the Omnipresent' (Avot 3: IB).' This manifests the fierce love. and the additional affection that was made known to us. In effect. sect. 110. 191-193. Nonetheless. [The boy] had no understanding at all of the legal ruling [on which he was to be tested] because of its great profundity and subtlety. and end of 354. visited by a guest who came to examine him. though it is only by Divine grace that man has the ability and opportunity to do good.and prayer. thus not something gratuitous! However. What did the father do? He provided him with an opening to that ruling. for you reward man in accordance with his deeds" (Psalms 62:13)": "Kindness" irnplies gratuitous grace. as if we had done it by the might of our own hands. and rf: ibid."' (Kidushin 30b) This is to say: 'Your love and affection for us is very great! You created the yetzer hara and You created the Torah. God accounts it to mail as if he had accomplished it on his own. This resolves the apparent contradiction in the verse 'You. of blessed memory. man should not gct any credit for these. have kindness. All we accomplished is from You and from Your power." It is like a child dearly loved by his father. sect. Keter Shem Tov. blessed is He. All of man's ach~evenlentsa rc possible only by vlnue of God prov~ditigh rm with the possibility and energy to do them. then.) . so that he would be able 1. and You take pride in us. (Likkufim Yekarinr.] I have created the yeker hra. sect. you take great delight in it. even as spices are used in coohng. Our sages. that everything is from You." antidote). showing him a way to follow. could not bear his beloved son's anguish at being confounded and unable to understand. trusting in his father. i. his yetzer [hara] is greater than the other's. offering objections and resolving them." (Baba Bathra 16a)* The moral is clearly understood.. our 2. I. and resolves all difficulties.4 as in "He took away the eilei (mighty) of the land. [The son] started to recite the ruling and the visitor asked him several questions. 130. our sages. Moreover. and that this causes delight unto God. and prevails over. [The father knows that the son's] achievement was wholly due to himself. raising a number of difficulties." (Megilah 18a) Eil denotes strength and might. Thus he prevails over the boy with additional questions.e. raising numerous new and complex difficulties. For when [Satan. See Zohr III:132a." (Avot 4:1) In the time to come. 3. with a clear and brilliant mind. blessed is He.. Our Sages. of blessed memory. He just about informed him of the full content of the ruling. note 2. however.to discuss it properly. the yetzer hara] sees that the tzadik subdues him." and [the tzadik] subdues. The son. se ct. His father is joyful. said: "Satan acted for the sake of Heaven. he wants to enhance it further. of blessed memory. This is the meaning of their saying that "he who is greater than another. he strengthens himself against [the tzadik] every day. his yetzer [hara]. Nonetheless. called Jacob Eil. bestirs himself on his own to be wise. Now the guest came to ask [the son] about the ruling and to test him in front of his father. CJ Sukah 52b." (Ezekiel 17:13) This is the meaning of "He called him Eil. he serves the purpose of testing man. delighted and proud seeing this. ." because the tzadik is referred to as "the mighty who subdues his yetzer [hara]. as the visitor notes the father's pleasure.e." (Sukah 52a) Also. He answered appropriately. he has great pleasure [from it]. 4. as in the parable cited above. thus said that "the Holy One. [he could not overcome (the yetzer hra). this is stated more explicitly: "'Israel in whom I shall be glorified' refers to the Izadikim. still has pleasure and pride. blessed be He. sect.5 Thus it is written: "As now. wrought?.' what do you do. Eil. What has Eil wrought?"' (Numbers 23:23) It is known that "Israel" is a term for the tzndik. of blessed memory said: "If the Holy One.]" (Sukah 52b) Nonetheless. it is said [to Jacob and to] Israel. to the tzadik. 250." just as one inquires after the well-being of another in terms of 'You. blessed be He.G (thus reading be'ir Elokein~ as "by virtue of the stirring] by our God. 5. blessed be He. say. manifest and made famous to all. He.sages. saying to him "What has Ei1 wrought?" That is." it. In the time to come. the yetzer hra "will seem to the righteous to look like a tall mountain" (Sukah 52a). to Israel. See the reference to Isaiah 493 at the beginning of this section. it is said . the tzadik is asked. of blessed memory. For all the greatness and glory that He. and how are you?" The sequence of the text thus reads as follows: "God is great and much praised. In Maggid Devarav Leya'akov. blessed is He. and the might of the righteous in subduing so tall a mountain will be recognized. would not help [man]." 6. and gives us a great reward. "What have you. This interpretation for the word ir is found already in Targrim Yehotlathan o n Numbers 2127. awakening). comes about by means of their good deeds and their cleveikt~l in God. it is incumbent upon us to magnify and praise Him for all the good He bestows upon us. This is alluded in the verse "As now. . . perhaps all will refer to the tzadikiwi with the name Eil. rewarding us as if we had done everything on our own.?' For He: is the one who bestirs us and gives us the strength to serve Him and to prevail.. as our Sages. derives from our worship is altogether "be'ir Elokeintr (in the City of our God)": be'ir is an expression of Izit'orerut (stirring. 'soandso." That is. for His glory. . "9 7.e. Likkutim Yekarim. Job 31:2.. as it were." (Psalms 97:s) A verse thereafter states: "Mountains will sing together. The Patriarchs are the Chariot described in Ezekiel's vision (Ezekiel 1) which is." (Bereishit Rabba 475)' Now we need to understand how the Patriarchs can be the Chariot. 139 It is written: "The mountains will melt like wax before God. 260. 35. related to the Divine soul in man. 133 and 260. the true service is something that has to come by virtue of our own stirring. to take the initiative on his own in order to deserve what comes his wa y. In this paragraph it is read in terms of the admonition that our service of God must be by means of our own "stirring of the 'part' of our God within us. See Keter Shem Tov. I. 9.In fact. said that "'Mountains' refers to the Fathers (Patriarchs). i. sect. and Jacob signifies the attribute of t@ret (beauty). 1." i. which is the attribute of chessed.' We are "a part of God from on high.e. of our Divine soul and yetzer fov. Isaac signifies the attribute of fear.*8 thus [our service should be] be'ir (by the stirring) of our yetzer [htov]. It is well-known that Abraham signifies the attribute of love." (Shemot Rabba 15:4) They said also that "The Fathers (Patriarchs) are truly the Chariot. Be'ir Ebkeinu is thus given two interpretations: In the preceding paragraph i t is read in terms of our ability to serve God and overcome the yetzer hara "by virtue of the stirring by our God" from Above. of blessed memory." (Psalms 983) How can both verses be affirmed? This may be explained as follows: It is well-known that our sages. . the portion of Divinity within us-"Elokeinu-our God. the "bearer of God": by their total submission to the Divine Will they became the vehicle and channel for Divinity on earth. 8. One is not to rely on gratuitous gifts (which the Talmud refers to as "bread of shame") or the merits of another.e. sect. however... . 11-12. bashful.. 7. par. referred to as "the Fathers of Imp~rity. The attribute of Chesed. Zohar I:160a. 13. sect. sect. 8. For example. he who loves5 another has compassion6 for him. Tikunei Zohar 34:69a). See above."~ The difference between the two [domains] is as follows: In the realm of holiness the three attributes compound one another. 87. The realm of holiness thus is called "reshut lqach idthe domain of the singularly one" (Zohur 1II:244a.which harmonizes [love and fearj. and see above. Cf: Likkutim Yekarim. See above. The attribute of Ceuurah. and the performance of kindness is the attribute of Abraham. the three attributes are separate: "all the workers of iniquity shall be scaltered" (Psalms 2. 129 and 280. 87 and 124.e. however. for he who is afraid of another is bashful before him." (Yevamot 79a) These [characteristics] are the three attributes of the Patriarchs in ascending order: compassion is the attribute of Jacob. he will be bashful7 before him. bashfulness is the attribute of Isaac. The three thus compound one another and are as one.. Zohar II1:301b-302a. i. everything in the realm of holiness has a corresponding opposite in the realm of the profane and evil. sect. I. The attribute of T$ret. and if at times he is unable to provide the other's desire. Sefer Habahir. and they perform acts of hndness. sect. "God made one thing opposite the other.e. 6. note 2. 5." (Ecclesiastes 7:14)3 These three attributes exist then likewise in the realm of impurity. for holiness is earmarked by absolute unity.s In the realm of impurity. said that "Israelites have three characteristics: they are compassionate. 3. 4. chased. See Zohur 111:70a and 83a.2 Our sages. of blessed memory. . and shows compassion for yet another thing. .] . Cf: Zohr I:126a and II1:208a. are called "workers of iniquity" because they lead to iniquity itself." implying that there is no unity even among the "workers" [that effect] iniquity. It is "reshuthurabim-the domain of the many" (ibid." (Psalms 27: 11) It is known that derech refers to a trodden road and orach refers to an untrodden road."'T~h at is why the word "together" is not mentioned here.92:10).' On the latter one may sometimes stray and walk towards a place of danger. as stated above. however. speaks of the mountains that are the holy Fathers: they are an absolute unity.9 [There] one loves-with the alien love--one thing. The evil traits in a person. The second verse." as opposed to "the doers of iniquity." The verse "[All the workers of iniquity] shall be scattered" alludes to the above. i. The realm of impurity is earmarked by separation. 9. 10. With a trodden road. and that is why it says "all the workers of iniquity shall be scattered.)." It speaks of the "Mountains of Irnp~rity. ." for they are separate and there is no unity among them. This is the meaning of the verse "The mountains will melt like wax. "God. however.e. but is afraid of another thing. there is no cause for straying. teach me Your derech (way). but only separation. These two aspects relate to man as well: 1. because there is no unity among them. See Zohur II:215a and III:88a. [and lead me on the orach (path) of uprightness . The "alien traits" are not united and joined together. actual sin. thus "Mountains will sing together. divisiveness and pluralism. Heaven forbid. Thus it says also "the workers of iniquity.. 203. It refers to one who sometimes converses with others. He speaks. it is easy for man to stray in that way.j For this reason one must pray and petition [God]. For without the help of [God]. which is called orach. and Likkutim Yekarim. "Lead me on the orach [of uprightness]" on which I may stray.. There is also another road that is not trodden. Heaven forbid. i. sect. blessed be He. blessed be He. 'Thesc are letters (with implicit holiness) and 1 shall sublimate them to their source.' Heaven forbid saying such.140 TZAVA'AHTA RNASM Man has a trodden way to serve the Creator. sect.. they involve danger. sect. for he may stray from the proper path and start to speak also idle talk as the masses d0. love of God or fear of God. but it is forbidden to set out and speak it. Thus one must girdle his loins with prayer not to stumble into transgression. and so forth. He will surely not stray from it if he follows it continuously. he is a person who knows how to raise words so that they ascend to holiness. teach me Your derech": teach me so that I may know the trodden road. See MagidDeuarau Leya'akov. for then I can walk it on my own. . . to engage in these lund of conversations is surely permissible. sect." That is. 1 pray that 'You lead 2. 3. Maggid Deuarau Lep'akou." . He converses on nothing beyond essential matters. "God. as known from a number of people. and see ther e also sect. is the meaning of the verse.e. he speaks of things that effect moral guidance. for there is a prohibition against idle talk (see Yoma 19b). 98 and 175. This refers to one who separates himself from everything [mundane] and occupies himself day and night with nothing but Torah [and Mitzvot]. Nonetheless. blessed be He. This. then. 98: "The enthused person is able to sublima te simple talk (that is not of Torah or prayer) when hearing it .2 Now. 366 and 373. One is not to say. that He help him when desiring to walk on this path. This concept is discussed in Keter Shent Tou. 50 and 75. "for the sake of Heaven. though. Alternatively. 2. R. even in a sin he commit^. will straighten them and put into your heart [to know] how to do it lishmah." (Proverbs 3:6) This means: With regard to all trodden roads. the irregular paths. even wood and stones. anger. Likkutei Torah on Proverbs 36: '"In all your ways'--i. sect. Keler Shem Tov. pleasurable activities) for the sake of Heaven. love and fear. because per force man enjoys them and seeks their pleasure. (Maimonides.. Eikev. Sha'ar Hamitzvol. Chaim Vital.me" with the aid. 'and He will straighten your paths (orath). See above. This interpretation parallels the one in R. and so forth. Then "Hen--i. blessed be He-"will straighten your paths (orach)": He will straighten for you even the untrodden roads. . sect. I may stray on it. man must himself know very well how to go and conduct himself thereon. help and support enabling me to go with uprightness and not crooked. He..4 4.e. idem. Though it is difficult to engage in (mundane. This is also alluded in the verse. as mentioned above. 120. blessed be He. Man commits sins because of his desire for the pleasure derived therefrom..' that it be lkhmah (doing them for their own sake).e." This is an important rule: Everything in the universe contains holy sparks.e. sect. hate. Eitz Chayim 39:3.' There are sparks from the "breaking [of the vessel^]"^ even in all of man's deeds. 3. [God]. This desire is rooted in man's appetitive faculty which causes him to desire or loathe something and from which arise the activities of attraction and repuls ion or avoidance. 90.' i. Nothing is devoid of these sparks. See above.^ What are the sparks in 1. a s in 'crooked paths' (Judges 5:6). One is capable of this knowledge and conduct. "Know Him in all your ways [and He will straighten your paths (orach)]. Chaim Vital. and aid and help you so that you will not stray. note 4. Heaven forbid. in the paved road which refers to the commandments-'know Him. 53 and 194. For without Your help. to be raised and elevated to on high. He bears and elevates the sin to on high. it. There is a form of terhuvah beyond repentance. 1) Virtue and vice. 377. (See Keter Shem Tov. One is unable to do teshuvah. and see there also sect. et passim). however. is not evil.) 4.) are rooted in the seven attributes of the Sefirot (see above. 17. that is. A spark of holiness is then embedded in all actions. i. Shemonah Perakim. ."' 1 T h ~ sIS the princlplc of there bang a rec~procalr elatlonshlp between man's conduct (In thought.e." (Avot 2:l) This may be interpreted as follows: "Know that everything Above is all from you. sect. This is also the meaning of "my sin is too great to be borne" (Genesis 4:13)." (Maggid Devarav Leya'akov. ch.. fear etc. note 6). The appetitive faculty. It leads to good deeds just as it may lead to sin.. 87). and 4 above. t hus in holiness.) This allows for the possibility of feshrrr~ah. if there was no prior sin. one elevates the sparks in it to the Supernal World. Thc various traits that it causes (love. Thus it follows that teshuvah is concealed within sin. sect. forgives. for "he who says 'I will sin and then do teshtrt~ah' is not given the opportunity to do tesluivah" (Yoma 85b). sect. 2. 142 "Know what is above you (lit. speech or deed) below and the effluences or man~festations that come from Above [analomus to the concept of "In the measure with which man measures.a sin? Teshuvah (repentance. sect. 217)-Obviously this does not suggest that one should sin in order to be able to observe the precept of teshuvah. sect. and his commentary on Avot 2:12). 152 and 377. even in sins-though the sin itself is altogether evil.. therefore.: from you). originate there (ibid. of correcting the sin. return unto God)!4 When doing teshuvah for the sin. ~t IS meted out to him" (Sotah 8b). khtrvah is a commandment." of returning to the higher spiritual levels from which the soul originated ($ above. 82. 82. ch. Thus it is written. the observance of Torah and mitzuot and their violations. called "teshuvah ila'ah-the supreme leshrrvah. which applies to the faultless tzadik as well. (See Keter Shem Tov. "Nosei (He bears. lit.: "He lifts up") sin" (Exodus 34:7. one of the 613 precepts [of the Torah]. "Teshrrvah is concealed within sin. sect. Pesukei DeZimrah to [the World ofj Yetzirah. R. attributing this interpretation to a Midrash. cf: Shenei Ltrchot Haberit. ch. sect. Sha'ar Halefilah. Sha'ar Hagadol. note 41. by man. The Baal Shem Tov thus interpreted "God is your shade. sect. We recite Hodu' between Korbanot (the recitation of the Sacrifices) and Pesukei DeZimrah (the Verses of Praise). 2. therefore. the Mawd's Or Torah. sect. In the Sefardic rite (adopted by R. 145 and 230. so does God relate to man in accordance to his actions. 29. (the reading of the Shema and its blessings) to [the World ofJ Be~i'ah. Isaac Luria. which has the connotation of a wheel. Addenda." (Psalms 1215): As man's shadow copies his every movement. 60. Thus 1. . For the angels in that [world] desire and "roll" to become joined to on high. this chapter is recited before the Pesukei DeZimra (the initial section of the formal morningprayers). and ibid.3 The esoteric meaning of their names is as follows: [The angels] in [the World ofj Asiyah are called Ofanim. sect. as opposed to saying it within the Pesukei DeZimrah.. 3. and Yotzer Or.) The supernal realms are affected. effects a corresponding reaction from on high. the Chayot and the Seraphim.T~h is is the esoteric meaning of the Ofanim. 19. Man's action below. 264 and 300. (Keter Shem Too. 1 and 6-7. 22a. for the following reason: It is well-known that the [segment of] Korbanot relates to [the World ofJ Asiyah. p. These three classes of angels are of the Worlds ofhiyah. Yetzirah and Beri'ah respectively. Addenda. 123. Chaim Vital. See above. 112.sect. Peri Eitz Chayim. A chapter compounding verses of praise to God from I Chronicles 16 and various Psalms. Magid Devarav Leyahkov. Keter Shem Tov. no. as it were. and followed by the Baal Shem Tov and the Chassidk movement).. they also signify the category of nefesh (soul)$ a term denoting addition and increa~eb.~~'Haat rivarh. however. They derive their life-force from a higher source. 31. In Aramaic.~ec ause they desire for themselves the increase of additional effluence and vitality. was somehow omitted in the printed editions of Tzur. acquiring additional chayut 4. Nalharz. he is purified by means of [the recital of] the Korbanot. That is why Hodu was instituted before. The soul-category of nefejh (which is of the World of Atiyah-Tikunei Zohr 22:68b. The angels of the p o r l d oE] Yetzirah are of a higher rank. Before he can attain great hitiahawl. from here to the end of this section.t (of thc root-word push) means an increasc and expansion." [7 The angels of the p o r l d ofJ Beri'ah are of still higher rank. he starts with lesser hitlahavut. As stated in the Zohar (III:120b). sect. For there is more hitlahavut (burning enthusiasm) in those verses than in Korbanot. etpasim. an Ofan who desires and rolls to be joined unto God. How does [he do so]? By means of the I'esukei DeZimrah. k:3. Hilchot Yessodei Hatorah 2:7). Man is a microcosm which reflects the macrocosm. That is why they are called Seraphim (the "Burning one^"). Thus he is able to be in great hitlahavut when he gets to the Pesukei DeZimra. It is inserted here from Likkutim Yekarim. Z o h r IIl:33b and 257b. That is why they are called Chayot (the "Living Ones"). Avot deR. The different names of the angels relate to their specific ranks (Maimonides. 8. Thus he is in the principle of [the World of] Aslyah. the word nefe. he is without any fear [of God]. Tikunei Zohr 6:23a). Yitro:34h) relates to the Ofanirn (Zohar II:94b. because it is but selected verses which are not really Pesukei DeZimra. 7.^ Man is a miniature universe? When rising from his bed in the morning. Tanhuma. 6. Zohar Chadash. 85. ch. They inflame themselves even more to be joined to on high. as in Targum Onkelos on Genesis 1:22 and Exodus 1:7. . 5. The bracketed part. vitality) because the hitlahaout is the vitality. and 4 above. . With Yotzer Or he will have yet more hitlahaout and attain the level of the Sera~hirn. 259. sect.~] 9. that in prayer one is t o advance in gradual stages. 32. sect. See Keter Shem Tov.(life-force. GLOSSARY . " high. are fully explained in my Mystical Concepts in Chassidism. ~eri'ah*-"porld of] Creation.. ~s s i~a h * . Breaking of the vessels-see below. Avodah trorech gevohah-"service (or worship) for the Supernal 'need' or intent. as ordained in the Torah. marked with an asterisk. ~tzilut*--"[world of] Emanation."wo r lodf ] Action. "standing" as it is a prayer that is to be recited in a standing position). Bitul hayesh-negation of self." the service of God that focuses exclusively on the Divine intent without any mundane or personal considerations. Complex terms. and on its lowest level including the physical universe. the second in the four 'Worlds" or realms in the creative process. and also identified as the level of the Divine Throne. abode of supreme angels and souls. also referred to as Shemoneh Esreh ("eighteen" benedictions).Amidah-(lit. ." lowest of the four 'Worlds" or realms in the creative process. signifying all-embracing * The glossary is restricted to very brief definitions. thus closest to actual Divinity. Shevirat hakeilim Deveikut-"attachment (or cleaving) [unto God]".est of the four Worlds" or realms in the creative process. the state of negating or nullifying ego and all personal considerations in the consciousness of' all-comprehensive Godliness. Deuteronomy 11:22. the main section of all obligatory prayers recited daily. Hitlahavut-"burning enthusiasm. Gadlut-"greatness". Hislrtavut-"equanimity". Hymns of Praise--see Pesukei deZimra Katnut-"smallness".consciousness of. . Hitbodedut-"seclusion" from the world and people to meditate on. the ecstatic frame of mind in the service and worship of God. thus proper intent in. meditative and ecstatic. Kavanah-"direction [of the mind]". and commune with." and (in Chassidism) referring to the Divine Providence governing every particular entity in the universe. discussions and rulings. opposite of katnut. as opposed to Gadlut (see there). in Chassidic terminology the sublime level of expanded consciousness and apprehension in the service and worship of God. signi+ing strict or rigorous judgments decreed against humans or the world. and concentration on. see there. Hashgachahperatit-lit. fervor". especially in prayer and the observance of Mitzvot. and communion with. Gemara-The major part of the Talmud which consists of the Talmudic traditions. God. * Dinim -"judgments". the state of constricted or restricted (limited) consciousness in the service and worship of God. one's action. "individual supervision. the concept of total indifference to all mundane occurrences in context of the consciousness of allencompassing reality of God. based mainly on the Mishnah. in all human (mundane) engagements just as in worship and other religious involvements. the Divine. meditating on the "mystical devotions" that relate to the words of prayer (especially the Divine Names) and to the observance of each mitzvah. but assuming a much wider meaning in mystical context. The teachings of R.e. kclipot)*-"shell(s)". Kelipah (pl. attributes". Opposite of shelo lishmah. Mitzvot)-"commandment(s)".. Mikveh-pool for ritual immersion effecting purification from ritual or spiritual defilement. Machshavah zara (pl. Isaac Luria (especially Peri Eitz Chayim and Sha'ar Hakavanot) offer these kavanot. see there. and (b) the corresponding dispositions or charactertraits in the human psyche. Mussar-"instruction for proper behavior". gevurah-rigor or strict justice. i. Mitzvah (pl. Biblical or Rabbinic precepts. (a) The seven "lower" Sefirot or "emotive attributes" of God (chesred-kindness or love. In our context this relates to medieval works . the Kabbalistic term signifying the realms or entities that are evil and impure. machshavot zarot)-"alien thought(s)". any thought extraneous to one's involvement with prayer or worship. and so forth). which include all that is forbidden by the Torah. every Jew's religious obligations. doing something strictly for its own sake as demanded or desired by God. works of mussar offer guidance and inspiration for religous ethics and devotional instructions. Lishmah-"for its own sake". t$ret-beauty or compassion. whether it be a sinful or forbidden thought or simply one inappropriate to the occasion. without any ulterior motives of personal benefit (such as self-aggrandizement or expectation of some reward). ~idot*--"traits. and-in colloquial use-referring to good deeds in general.GLOSSARY 151 Kavanot-plural of Kavanah. Bachya ibn Pakuda's Chovot Halevovot. Shechinah-"Indwelling".) Nitrotz (pl. Israel Salanter. the Divine Presence or Immanence in creation. (This is not to be confused with the modern Mussar-movement founded in the 19th century by R. and the later writings. Chochmah and Bimh (and in other schemes Chochmah. as distinguished from the Divine Transcendence (usually represented by the term Hahdosh baruch Hu-the . with a mystical slant. evil or forbidden things are nullified when their sparks are extricated by relating to them as prescribed ("passive correction" by abstention or discardment). peniyot)-"ulterior motive(s)" of personal gain or satisfaction. It is man's task to "correct"-"free" or extricate-these sparks by relating to every thing in its Divinely intended context: good or permissible things become sublimated to holiness by using them properly ("active correction").such as R. Peniyah (pl. These sparks "fell" or descended from Above with the shevirat hukeilim. Binah and Da'at). nitzotzim or nitrotrot)*-"spark(s)". thus first praising God before submitting our personal petitions. Pesukei Dezimrah-"verses of praise". such as Reishit Chochmah and Shenei Luchot Haberit. Jewish rnysticism teaches that every entity (good or evil) contains "holy sparks" of Divinity which constitute the very vitality or sustaining force of each. Se$rah (pl. ~e$rot)*-term denoting the ten Divine attributes or emanations through which God manifests Himself in both the creation and sustenance of all beings. These include the seven Midot (see above) and the higher Sefirot of Keter. a collection of Biblical hymns and psalms recited daily at the beginning of the morning-prayers. in the universe. Joseph Karo. Teshuvah-"return" to God. term for prayer-book Sitra acharaf-"the other side". Shulchan Aruch-title of the standard code of Jewish law. Tikun chatrot-"order of midnight-service". "order". which are to be recited every day and every night. the act of repentance from all sins of omission or commission. thus applying to the nonsinner (the tzadik) no less than to the sinner. as opposed to the side of holiness. but also containing an order of Torah-study. and Numbers 15:37-41.GLOSSARY 153 Holy One. Shcma-"Hear". 11:13-21. midnight-vigil focused on mourning the destruction of the Holy Temple in Jerusalem and the exile of the Jewish people. a central concept in Kabbalistic cosmogony which accounts for the multiplicity. Shelo lishmah-"not for its own sake". which manifests itself in the omission of the proper kavanah or intent. This term is in feminine gender. In the wider sense. Godliness. the first word and title of the Biblical passages of Deuteronomy 6:4-9. the opposite of lishmah (see there). returning to God in the sense of a continuously progressive advance to Godliness. or opposed to. and the presence of evil. a general term for evil. . by scattering the "sparks" from the fragmentation of the "vessels" throughout creation. Sidur-lit. compiled by R. blessed is He). or-in the crudest sense-in the commission of being guided by ulterior motives. while the transcendent aspect is in male gender. compounding anything that is separated from. Shevirat hakeilim*-"breaking of the vessels". In the narrow sense. but in Chassidic context referring more specifically to extra-ordinary saints. Yetrer hatov-"good impulse". Yichudim-"unifications". * Tzimtzum -"contraction. concealment".g. abode of a lower class of angels than those in Beri'ah. ~etzirah*-"[~orld of] Formation". rooted in the physical nature and "animal soul" of man. World-when this term appears qualified in our text (e. the third of the four "worlds" or realms in the creative process. . the human inclination or impulse to sin by omission or commission. the human inclination or impulse to do good.g. that makes it possible for finite and material substances to come about. Zerizut-"alacrity"... performing obligations with alacrity and zeal. avodah tzorechgevohah. Beri'ah. rooted in the spiritual nature (Divine soul) of man. the four 'Worlds" ofAtzilut." or 'World of Thought") it refers to the relevant spiritual realm or level. the Kabbalistic concept of the contraction and concealment of the consuming intensity of the Divine "light" through a series of stages (e. in the general sense any righteous (pious) person. Yetrer hara-"evil impulse". Yetzirah and Assiyah). acts effecting unifications in the spiritual realms by meditating on the relevant kavanot (see there). Tzorechgevohah-see above. 'World of Atzilut. Ze'eyr anpin*-"small image (or visage)". Kabbalistic term for the compound of the first six midot (chessed to yessod).Tradik (pl. tradikim)-"the righteous". central to Kabbalistic cosmogony. BIBLIOGRAPHY . Aaron of Apt. Anthology of teachings of the Baal Shem Tov compiled by R. Kehot. J. ed.] BEN PORAT YOSSEF. Brooklyn NY 1987 . Mosheh Chayim Ephrayim of Sudylkov. Works ARVEI NACHAL. Tzvi Elimelech of Dinov. Jerusalem 1964 KETER SHEM TOV. see DARKEI YESHARIM IGROT KODESH-ADMUR HAZAKEN. Schochet. 2 vol. New York 1954 BE'URIM BETZAVA'AT HARIVASH.. I. Przemysl 1890. R. Lemberg 1921 HANHAGOT YESHAROT. Menachem Mendel of Prezemishlan (Przemysl). Jerusalem 1963 DERECH PIKUDECHA. Schneerson of Lubavitch. 4th edition. Warsaw 1913 DEGEL MACHANEH EPHRAYIM.A. R. David Shelomoh Eibeshitz. attributed to R. Menachem M. Ya'akov Yossef of Polnoy. Levi Yitzchak of Berdichev. Schneur Zalman of Liadi.d. Warsaw [n. R. R. R. Letters by R. ed.. 2nd ed. Brooklyn NY 1980-1993 KEDUSHAT LEV. Chassidic. R. Kehot: Brooklyn NY 1985 DARKEI YESHARIM. with title HANHAGOT YESHAROT. Brooklyn NY 1954 YOSHER DIVREI EMET. the Maggid of Mezhirech. 3rd edition. Anthology of teachings of the Maggid of Mezhirech. ed. see there. Brooklyn NY 1980 ME'OR EINAYIM. Y. Menachem Nachum of Czernobyl. attributed to R. Anthology of teachings of the Maggid of Mezhirech. R. Ze'ev Wolf of Zhitomir. R. Anthology of teachings of the Maggid of Mezhirech. Ya'akov Yossef of Polnoy. Brooklyn NY 1965 TOLDOT YA'AKOV YOSSEF. . Tel Aviv 1969 TZAFNAT PANE'ACH. Kehot. included in LIKKUTIM YEKARIM. Klapholtz. Yeshivat Toldot Aharon: Jerusalem 1974 MAGGID DEVARAV LEYA'AKOV. Kehot. Ya'akov Yossef of Polnoy. Schneur Zalman of Liadi. ed. Menachem Mendel of Vitebsk. Yechiel Michel of Zloczov. R. Anthology of teachings of the Maggid of Mezhirech. 3rd edition. Brooklyn NY 1962 LIKKUTIM YEMIM. Anthology of teachings of the Baal Shem Tov.LIKKUTEI AMARIM. R. Brooklyn NY 1980 TANYA. and (four of) R. Lemberg 1850 OR TORAH. R. ed. Brooklyn NY 1960 OR HAME'IR. Jerusalem 1960 TORAT HAMAGGID MIMEZHIRECH. Brooklyn NY 1975 OR HIEMET. London 1960 EITZ CHAYIM. R. R. ed. Warsaw 1891. ed. Judah Loewe.Shabtay of Rashkov. R. Ya'akov Chaim Tzemach. Jerusalem 1963 SIDDUR HA'ARI. in KITVEI RAMBAN. Jerusalem 1980 REISHIT CHOCHMAH. Eleazar Azkari. Mosheh Nachmanides. [Israel] 1975 HA'EMUNAH VEHABITACHON. R. Israel ibn Al-Nakawa. Jerusalem 1976 DERECH CHAYIM. R.1 OR HACHAMAH. n. Menachem Me'iri. R. New York NY 1969 .BIBLIOGRAPHY B. R. Jerusalem 1963 KAD HAKEMACH. Jerusalem 1957 SHENEI LUCHOT HABERIT. New York 1960 MENORAT HAMA'OR. Margolius. Warsaw 1831 CHAREIDIM. R. n. Abraham Brandwein. New York 1929-32 NAGGID UMETZAVEH. R. Jerusalem 1958 CHIBUR I-IATESHWAH. [Israel. Amsterdam 1708 SEFER CHASSIDIM.d. Isaiah Horowitz. R. R. R. Judah Loewe. R. Warsaw. ed. [Israel. Mosheh ofTorani. Chaim Vital. Bachya ben Asher. R.d. R. Other Sources BEIT ELOKIM. Przemysl1896 PEN EITZ CHAYIM. Chaim Vital. ed. Elijah de Vidas. R. Chavel. ed.1 TIFERET YISRAEL. R. Abraham Azulay. INDEX OF BIBLICAL AND RABBINIC QUOTATIONS IN TEXT . INDEX OF BIBLICAALN D RABBINIC QUOTATIONINS TEXT* BIBLE Genesis Numbers ch . 1 ................................ 130 12:6 ............................... ... 90 3:6 ...................................... 5 21:23 ............................. ..1 38 3:24 .................................. 58 Deuteronomy 4: 13 ................................. 141 4:22 ............................... .. 111 6:16 .................................. 75 11:16 ............................... . 76 7:l .................................... 75 11:22 .............................. .1 11 12:lO ................................ 64 30:15 ...............................1 30 13:l .................................. 64 I Kings 22: 1 ................................. 132 2:2 ............................... 43, 84 28:21 ............................... 120 Isaiah 29:35 ............................... 132 6:3 .......................5 8, 67, 13 7 37:11 ................................ 17 25: 1 ................................ .. 75 49:14 ............................... 100 49:3 ................................. 1 38 50:2 .................................. 89 Exodus 553 .................................. 76 1:1 ................................... 124 58:14 .............................. .. 87 1:2 ................................... 124 Jeremiah 20:12 ................................ 90 23:24 ................................ 8 4 34:7 ................................. 141 31:2 ................................ . 137 Leviticus Ezekiel 21:12 ................................ 84 17: 13 ............................... 1 38 All references are to the sections in our text . For example. "Genesis 3.6 ... 5 " means that this verse is cited in section 5 . 16 4 TZAVA'AHTA RNASH Michah 98:8 ................................. 139 7:20 ................................. 132 106:2 ............................... 132 Habakuk 119:126 ............................ 46 2:4 .................................... 58 119:160 ............................ 90 Psalms Proverbs 4:5 .................................... 23 3:6 ..................... 94. 102. 1 40 8:5 .................................... 17 3:18 ............................. 2 9, 30 9:2 ................................... 132 12:9 ............................... .. 114 16:8 ....................................2 12:lO 99 17:14 ................................ 90 13:16 ................................ 98 17:15 ................................ 90 15:15 ............................... 131 19:6 .................................. 16 16:3 ................................ .... 4 19:7 .................................. 16 16:5 ................................ .. 92 22:7 ............................. 12, 91 16:28 ................................ 75 24:4 ....................................9 27:19 ............................... 132 27:11 ............................... 140 Job 35:lO ................................. 33 28:12 ............................... . 53 36:4 ........................... 74, 117 33:15 ................................ 90 36:s .................................. 74 33:23 ............................... . 17 41:4 .................................. 43 Song 482 ................................. 138 1:9 .................................. .. 71 48:15 ................................ 64 Ecclesiastes 52:3 .................................. 17 214 ................................. . 90 55:23 .................................. 4 7:14 ................................ . 139 79:1 ................................. 124 7:29 ................................ .. 84 792 ................................. 124 8:5 .................................. .. 17 8514 ............................... 116 Daniel 90:3 ..................................1 8 123. ..............................1. .7 92: 10 ...............................1 39 I Chronicles 92:13 ............................... 125 29: 11 ............................... . 90 97:s ................................1. 39 TALMUD Berachot 8a ..................................... 119 5a 19 30b .......................... ..73, 123 ~ - . INDEX OF BIBLICALA ND RABBINIC QUOTATIOINN STE XT 165 34b .................................. 125 l1Ob ................................ 131 35b ................................... 47 l l l b ............................. ... 111 43b ................................... 92 Nedarim 55b ................................... 90 41a ................................. ..1 31 Shabbat Sotah 12a .................................... 43 5a ................................. ..... 91 88b ..................................... 9 21b ................................ ... 53 104a ............................. 37. 79 Kidushin 118b ................................. 18 3ob .................................1 . 38 133b ........................ 111. 112 Baba Kamma Pesachim 2a ..................................... 121 50b ........................... .55. 126 Baba Bathra Yoma 16a ................................... 138 39a ................................... 109 Sanhedrin 86b ................................... 43 106b ............................... 1. 1 Sukah Makot 52a ................................... 138 23b ................................ ... 76 52b .................................. 138 Avot Rosh Hashanah 1:14 .............................6 2. 97 16b .................................. 123 1:17 ................................ . 133 Ta'anit 2:l ................. 1. 17. 122. 142 25b .................................. 125 2:lO ................................ .. 96 Megilah 3:14 ................................. 138 18a ................................... 138 4.1 ................................ ... 138 Yevamot Menachot 21a ................................... 138 43b ................................ ..... 5 63b ................................... 43 Chulin 79a ................................... 139 91b ................................ ..1. 32 Ketuvot Nidah 63a .................................... 89 17a ................................ .l Ol a 103a .................................. 90 MIDRASHIM Sifra Sifre . . Shem~nt.. ......................... 84 Va'etchanan ....................1 02 Bereishit Rabba II:128b ........................... 78 47:6 ................................ 139 II:134b ........................... 84 Shemot Rabba 15:4 ................................. 139 Tanchuma Pekudei:3 ........................ 143 Oti'ot deR . Akiva Dalet ................................ 48 Zohar I:221a ............................... 75 I:49b ................................ 130 I:86b ................................. 87 I:100b ................................. 9 I:IIOa .............................. 131 I:119b .............................. 132 I:140a .............................. 132 I:187a 58 III:lOb .............................. 90 III:16b .............................. 75 III:120b ........................... 143 III:159a ............................ '75 111:195a .............................. 7 III:230a ............................ 75 III:281b ......................... 1 . 17 Tikunei Zohar 10:25b ............................. 131 13:27b .............................. 90 18:33b ............................ 43b 21:48b ................................ 6 Zohar Chadash Lech:26a 64 INDEX OF SUBJECTS . .............. 87. .......... 132 prime cause of spiritual harm .. 139 of impurity ............ 143 created by Mitzvot . obstruction to soul .. 61..... 72.......... in prayer .. Self-esteem.. 120............ ..............136 see Yeridah Tzorech Aliyah Assistance Divine a.......... 71 negation of a......... 89 analogous to begetting rnamzer ......... 138.... 50 Body b.... 11 1. 101 Beinunim ......... 80 b. Sanctimoniousness Ascent 37...... 87 see Self-negation Ba'al teshuvah master of teshvah .......... . 97 identified with Pharaoh ... 71......... ............. 112......... 51......... ..62.............. .... 89 caused by self-esteem........ 113 shame from a.. 97. 169 ..... 139 aspect of soul ..43...... 132..........90..... 55.. 87......... 16..... 116 Alien thoughts a........... 139 see Character-traits Ayin ascent to level of naught.......... 125 Beauty source of b... 20.. 84 Abraham aspect of kindness and love .....I21 Arrogance see Pride............... 140 Attributes of holiness .. .... 89 subduing a.......... 19.I23 Bitul hayesh see Self-negation Blemish ....... 87.. ..... ................. ........ 106 All references are to the sections in our text..... 83..... 64 Absorption ......... 79. 17..... 116 Anger overcome by joy and love .......................................... 62............ 60...... "skin of the snake" ...... 132........................................ 75 Alacrity ..... 87 sublimation of a. 6 health of body affects soul ........Abode man's true abode in upper world ......135...................... 90 Angels .... ............. ..... in part affects the whole ..... 64 Concentration see Kavamh Consciousness c..service of God wlth b.. . 84 Da'at bonding and deveikut ....94............. in Shechinah .. Sadness ......... 104... 131.I43 Choice.... 46 see Teshuvah Coupling attitude to c ............. ............ 105 see Soul Breaking of the vessels see Shevirat hakeilim Brother honoring older brother ................. .. katnut Contemplation....... "workers of iniquity" ....... .. 88 human c.... of Divine Presence .. .... 43........... Day(s) day and night .. with Shechinah ... and soul ... 1 Chatzot see Midnight Chayot ................................. 122 pursuit of good c.66.................. 73 d... 90 Character-traits evil c.............. .. 98................. 14...... 139 evil c.... 98............ 99 conduct with d....... 73 Depression see Melancholy............................. 127 Commandments see Mitzvah-Mitzvot Compassion c. .. ...... 101 prayer is c..................... elicits Divine c.................. 137 restricted c. .... for Shechinah . 58.......................... 90 Mitzvot every day .................................. 83..... .......... 112 Concealment c............................. precluded by continuous worship . 97. 82 Contrariness of holy and impure ... 1 weekdays and Shabbat.... 52 negation of evil c... . 68 Creation ... 129 expanded c......... ................. Freedom of c.............. 85 Deception see Yetzer hara Deficiency d................ of actions .... 139 Contrition ....I29 seegadlut............... ..... mundane d..... .. 101 remedy to negate d... cause of d... 56 for Mitzvot ...... 55 Desires.Descent see Fall........ Yeridah Tzorech Aliya'ah Desire for fasting................ .... 13-14 ....... 5.............. .... 63...... 62.... ...... of thought . ... . .... 29.. 96 f... . 101....... 121 incite yetzer hara .. 6... in speech ......... ..5.5. . . .... .... . 105 initially below. 6.. . 10 leads to ru'ach hakodesh. 10.. ..... 80 d. ....... 59. ............ 97 Dov-Ber of Mezhirech.. ... ..... subdues the kelipot ...... ... . . ...84. 58........ .........137 Elevation see Sublimation Elokim attribute ofjudgment . 135 leads to equanimity ... and Torah-study .. .. ... of tzadik . .. ..scorning d. 39. .. .... .....30. 61... .... . .. 53 Esau . 30...... ..... 136 d.. 10. 67..... 11 I facilitates pure service of soul ... ..38. R 5 Dreams .. . . .... ..... 3 1 Devotion see Kavanah Devotions see Kavanot Din . ... ..58.. ........ .. in prayer .. 32.. .... . ... Kelipot Faith ........ . 82 d. .... 64.......69. to letters of Torah ............. 1 23 attainment of d... 9 Deveikut 3............ ... . .93.......... ............. . .. ... 137 Fall f. ... .... . ...... .... 102 Enthusiasm see Hitlahavut Enticements see Yetzer hara Equanimity ..... ..... . 87 Evil see Good and Evil. 90 Eating and drinking excessive e .... ..30 d.... ... from one's leve1..... 29.... 56 . ..... ...... .. beyond time of prayer ..... 75. .. .I31 proper intent with e.... .. ... 90 Egypt see Mitzrayim Ein Sof. ... ........ . ...dinim see Judgments Divestment from mundane . ....... . ....... 37 d. . . ... 58...... 12..... . ... . 127 generated by deveikut ..91..... 127... . ..I27 spiritual root of tastiness... then Above ....... . 81 d. .. 40.... . 84.... 5... .. ... 96 see Yeridah Tzorech Aliyah Fasting corrects soul ... ... 84. . . .. . .... .. inseparable .. 43.. ...21.. 78... 11 0 f. . . ... .... 56 proper thoughts when f..... 136 . .79 teshuvah is essence o f f .necessity of both . . .. ..... ... . . 43 ulterior motives for f....... 128 . . and love of God . .. .. 79 Fear of God . and joy... . ... .. .. . 77 yetzer hara opposes f..... 23 f. ...indulge desire for f.. . . ..43.. 131. .. . gateway to God ................ 66 results from contemplation ....................................... 66 safeguards reverence ..... ,128 Fool ..................................... 98 Forgetfulness caused by quarrels and pride ....................................... 49 caution not to forget .......... 1 Gadlut gadlut and katnut .............. 129 state ofyadlut ...................1 37 Galuf cause of g. ....................... 124 Gazing (Histaklut) effects of g. ....................... 50 g. at mundane things ............................... 90, 121 g. at people ....................... 50 g. for self-gratification. .... 90 g. forsake of deveikut ........ 80 God gazes at man ... 134, 137 see Perception Good and evil ........... 103, 130 Gradualism in worship ............................ 32, 65, 143 Haphazardness. ................ 3 1 Happiness see Joy Harm primary causes of spiritual harm ............................. 121 Hashgachah peratit ..................... .2-3, 4, 84, 120 Havayah denotes mercy ................ 102 Health physical health affects soul ...................................... 106 Heedfulness h. with "minor" Mitzvot ............................1 , 17, 122 Hitlahavut 55, 68, 86, 87, 105, 11 1, 118 Holiness generated by gazing at people with deveikut ............ 50 see Attributes Humility ........... 12, 49, 77, 91 mark of true worship ..... 114 Idolatry diversion from God tantamount to i. .................... 76 self-indulgence tantamount to i . ................................ 90 Illuminations of the Baal Shem Tov .......................... 41 Immersion in mikveh ....... 15 Important principles and rules 4, 10, 16, 17, 19,25,44,46, 49, 81, 84, 90, 94, 95, 109, 126,141 Intent see Kavamh Isaac aspect of fear .............8 7, 139 Israel term for tzadik ................ 138 INDEX OF SUBJECTS 17'3 Israelites can praise God at all times ............................. 132 Israel Baal Shem Tov. R 1. 10. [17-191. [41]. 75.76. 93. 96. 100. 101. 106. 109. 120. 124 Jacob aspect of tijeret ................. 139 Jerusalem see Yerushalayim Joy .................. 9. 15. 43. 46. 56 constant joyfulness .110. 137 generated by yichudim ...... 75 j . and fear inseparable ..... 110 prayer with j ........... 107. 108 service of God with j . .44. 45 sweetens judgments ....... 132 Torah-study with j .......... 51 Judah see Yehudah Judgments .................... 16. 87 man's j . after death ......... 116 sweetening ofj ............... 132 fitnut k . andgadlut .................... 129 service in state of k . ............ 67. 69. 96. 101. 135 Kavanah ................... 40. 60. 72 k . is soul-aspect ...... 116. 126 Kavanot k . for donning talit ........... 21 k . for eating. ....................1 27 k . for fasting ................ 43. 77 k . for mikveh ..................... 15 k . for prayer .............. 73. 118 k . for sleeping ............. 22. 23 k for Torah-study ........... 119 k . for voidance ................. 22 Kelipot .......... 9. 58. 71. 90. 124 Kindness acts of k . towards God ..... 17 Divine k . that one survives prayer ................. 35. 42. 57 Letters (of the aleph-bet) attachment to 1 . of Torah ...................................... 111 contain 'Worlds. Souls. Di. . vinity" ............................ 75 every letter a complete world ............................1 18 God vested in 1 . of speech ...................................... 108 seeing 1 . of prayers ........... 40 Levels attainment of spiritual levels 37.40.41.58. 64. 65.78. 96 pursuit of spiritual levels ....................................... 4:7 Levi .................................... 124 Love evil love ............................ 87 God's love for Israel ....... 138 holy 1 ................................ 87 1 . of God .............. 36. 84. 132 I . and fear of God ... 131. 136 - necessity of both .......... 128 I . of the mundane ........... 103 Luria. R Isaac .............. 82. 90 .44.......... . Kavanot................. mer~torlou... 17.... 2-3.. 112 . 17.............. Service of God ulterior m.... 42. 90..... 117 Names............ ....... 124.. 64 Mitzvah ... 100 Melancholy ..110 see Sadness Midnight to rise at m. 129 observance of as many m...... 47....................... 132 Negation n............. "for the sake of God" .83 Mikveh see Immersion Mitrrayim aspect ofgalut ....73............ 138 Names of Tribes .. 55.... 77............. 116 act of m.... bodily movements Motives proper m.. 26... 127 ulterior m....... 15....... good in itself ..... 95... 116 heedfulness with "minor" m............. 124.. 11. .......127 see also Kavanah................. 122 katnut andgadlut with every m.............. 55 observance of m... 92 removal of ulterior m... ...................s....... 122......... 123......138 Matter m..... as possible ...................... . creates angel ... .... of Torah-study primary cause of spiritual harm 121 ..Mitrvot act of m............94... 90 Motions see Prayer... every day . 57 Mussar study of m. prompted by self-esteem . 1.................. 47. 17 pursue desire of m ..... 124 aspect of kelipot .46.. . 90..... 84. 102.............. 116 Moses ...................115.. Divine N.. and form .............. 226..................... .. 90 see Self-negation Neglect n....... 1..... .............. 16... 1...... ...Machshavah zara see Alien thoughts Mark of true service 114. 28... 95....... of desires ..... 55 precede man after death... 17.... .. ............... ..... to day by Torah and prayer ...... 109...... to day .96........ 127... .... .................... 109.... 83 Nitxotzin elevation of n........................ 141 n....... 90 joining n.......... ...... 27 emergence of vital force at n. inherent in every thing ......Night converting n... 141 ............................... 129............................... 37..............86..4 ........ in holiness and impurity .. 107.. on weekdays and Shabbat . 86 p .....6 0........... preceded by sense of fear .... is union with Shechinah .................... 131 Prayer alien thoughts in p .................................... 73 p ........ for the sake of the Shechinah ........ 39 innate attributes of Israel . ............... ............ 58 p .................. ..... 84..... Isaac. 84............... with eyes closed . 101.71.....134.2 7...................... 68.. Jacob Pauper to regard oneself as p ......................... 138 Patriarchs aspects of p ................ 137 Parables 72. 97 ascent in p . 109 Ofanim ................... 143 Omnipresence of God awareness of o .... 85........ 67.............. 32.... always effective .. 19. 137 Pilpulim inauthentic p ........ 7 Perception of God . 139 see Abraham......... 106 with hithhavut ........ ....84 requires proper health ..... even when unable to concentrate properly .. 72 "falln during p ... 87............. 16 p ...1. 105......... 115.... 62..6 8 p ....... .....132........... 40 reliance on God's judgment .................... at sunrise ............. 118 with intensity .................. related to individual souls ..... 72.... 104.... 105 deveikut in p .............. in knowledge ... 111.......... 66 p .... 123 p . 40 reading from Sidur.....................8 5. 31. 117 Poverty p .............. 123 p ........................ 58..62............................. 97 effort to pray with kavanah .. are Providential ................................ 139 chariot ......... 61..... 32.....130......... 120 divestment from physicality .n ........... preceded by sense of humility .. 131 p ........ 143 bodily movements in p .... 58 disturbances in p . 59........ 73.. 85.. ..35. 108 with kavanah 32..123.. 33... wlth joy . 131 with low voice ....... ...72......126.. 33 Prayerbook see Sidur Pride (Arrogance) . 108 ..122. 34.. 61. 35.......123..... 60. 58.......41..124. 131 .....57. 107...34... 14...42. ......... 48............................... 116......... 56 enticed by yetzer hara ....... 17 r.... Selfesteem... 62... ...... from fasting ... 43 s... 3... to avoid spiritual harm..... 55..........constant worship precludes p .... 142 Remedies r......... 116 see Reciprocity Revelations merited by the Baal Shem Tov . 82................. to negate evil charactertraits ....... 15 prayer in state of s ......... 44.....1 2........... ............................. 63.......... 90 Providence see Haslgachah peratit Psalms recital of P ...... 42.. .......... 55...... 74.. 57.................... 107 repugnant trait ... causes depression .... 31......... 91 Prophecy .. 14 r. from service of God .....48 s.. 44 must be avoided . 43 see Sanctimoniousness.. 133 Self-amiction s.......... 8...... with ulterior motives ..... leads to forget Creator 49 self-esteem from one's service ........ 87 self-esteem from fasting.... 46 Sanctimoniousness see Pride (Arrogance).... Self-righteous Seclusion... 52 p...... 55.... 57..... 48..... 74 Self-satisfaction see Self-esteem.............. 97. 56 s...... cause forgetting God . 49 Reciprocity . 46 caused by self-affliction .. 47 see Fasting Self-esteem (Pride) ..... Selfrighteous ........... 122 see Pride (Arrogance). 38 Quarrels q................. 42.................. 41 Reuben ....... 132....124 Sadness (Depression) barrier to service of God .. 87 s......... blemishes . Self-esteem Pride........... ...... 101 Self-righteous worse than wicked ......... to negate sinful desires 13 Retribution.. 112. 57... Sanctimoniousness Self-negation ........... 92 p.. Positive p............... from performance of Mitzvot .. ........ precludes evil ......... 52 ... and "child" ............. 132 true s................ from God tantamount to idolatry ...... 76 Seraphim ................................. ......Separation s....... ...... 85.................I43 Sewant of God levels of s. 115 Sewice of God continuous s... ....... ....... 130.. 114 on weekdays and Shabbat .... ...... 131 observance of S .... 67..................... 101 s ... 40 Sight all perceptions to be linked to God .... 68........... 143 praying from S ..............122..... mistaken for virtue ... 96 mark of proper s ... ...33 holy sparks hidden in s .................... 2............ 94... 22 in state of katnut . 47 tlves in all possible ways .... 40 see Gazing...... ........ 45....... Shimon bar Yochai..... 115..... see Mo. 18 Divine service on S .. 137 personal effort ...... 69 supports man ... 43 World of Speech ........ 18 Shame sense of s ... 131 perfect s .. Shimon....127. 127.... 89 Shechinah always with man ...... 134 effects of s . when overcome by alien thoughts in prayer ............... over speech . 1....... In face of insults ......... 104........ from alien thoughts . 69...... 84................. 75..... 23....... 5...... 137 compassion for S ...8..................... 44............... 44....2....... 121.... 141 negation of sinful desires 13 repugnance of s ......................... 58................... 5.... 49 s .....levels of S .47...... 49 s.. 120............... 105 Shabbat aspect of teshuvah ....... 138 with animal soul ......46................... 114...... 110 with sou1 ..... 16.... 124 11.. 73 deveikut with S ........ 117 Sidur order of morning-prayers ........ .......85....................... 1..123........ 22..for the sake of Heaven .... 88 "deficienciesn in S ..... 56 ........ 141 Shulchan Aruch essential to study S .. 123 Shema reading of S ... 44.... 133 leads to humility . 99 with joy ......... 73....... 43..... R 95............... 138 marked by humility ............................. '74 Sleeping .... Perception Silence advantage of s ... 88.. with joy and fear .. 19 Shevirat hukeilim .........3. '71 Sin ... ................ 1 2 6 ..... 27 Slothfulness ............. 22.............. 20 avoidance of sleepiness .....................arising at midnight .......... 22 arising from s ........ in day-time ... 23 s . 28 proper intent for s .......... with alacrity ... ........1 03............ 103 garment of the soul ................ 140 s ................... 127.. 87 significance of first t ................... is holy spark inherent in sin ................... 109... 58......... 105 Soul.............. 141 wicked can always do t .... 81 evil s .... 58.................. 17 related to specific sparks in the mundane ....... of speech ......... ... 96..... 31.......... 87............. 21 Teshuvah essence of fasting ............ 68 Stringencies of the law ....Soul Sublimation descent and ascent of s .................. 29 illuminates through Mitzvol ..... 102 Talit .... 109 see Vitality Stirring of self by bodily motions ..................... 18 t ...... joined to Divine service ...... 64 s .. 104. .......1 20 s ............. 71 deveikut in s ................ 30.......... 108 good s ... .......... . 127 s ................... 43 Shabbat is aspect of t. 8 sever1 kinds of t. 103 related to Shechinah........ removes vitality ........ 89 seclusion oft .. 141 s.... inherent in every thing ... 99 Sparks see Nitzutzim Speech aspect of "horses" ................ 87 male and female aspects of t ....... 127 see World of Speech Spirituality s .......... 74 Tetragrammaton see f-lavayah Thought(s) consideration of t...... with Shechinah ............22........ 90 Suffering effects atonement ................. 87...... 90 evil t ....... animal s .... 56 traits ............... of sparks 96........... ...... 1.................. elicits goodness ............................... of thoughts .. 44.......................... 136 vitality of man ... upon . strengthens forces of evil ... 4. of feelings and characterfurbished by Torah-study .. 46........ 109 worship with soul ................. with love and fear of God .. 101..... 120............. 92 t ................ is soul (inner reality) of every thing .... 25 sublimation of t. 84......... in service of G .. 126 ... . 116 ........ 90 t .......... . 69 t . arlsing .8 7... is reality of man ................ is a complete structure .. 104 t . .. primary cause of spiritual harm ...... 34.......... essential . 112...... and deveikut . 43 u............................ of subjects that promote fear of Heaven .... 54 T....... 113 with joy ............. ofworld of Speech with World of Thought .. 31 t....... 74 t........ for the sake of Heaven Ulterior motives see Motives Unification u.. 113.......................... ........ 29 T............... 96 uniqueness oft.........l25 concerned to increase merits . .. 119 with joy. 139 Universe . 102 conquered his yetzer hura ............................. 121 T....... of soul by fasting . 5. 109 t.. during deveikut ... Kavanah Tikun t.......... 50 referred to as E-1 ............... 117 with intensity ..... 123 "fall" oft............ 56 see Sublimation Torah antidote to yetzer hara ...... blessed is He .. ............ 138 devoid of ulterior motives . 51....30.. 138 concerned about others..... 138 garment of God .... .. 84...................................................................... 96 gazing at t. fear and love ............. . 33................. 138 self-concerned t... 96 unites Worlds of Speech and Thought .. of holy sparks ........ 123 Unifications see Yichudim Unity and separation . of Shechinah and the Holy One.. to become attached on high ........ 137 Tzorech gevoha h see Service of God.........29. 6.....'s level of katnut ... 24..... . 29 T............... 125 self-imagined t .. 31 see Torah-study Torah-study neglect of T...... 51.t.1 23 Tzimtzum ... 58 see Alien thoughts.....I11 guide for human actions... 119 Tzadik causes supernal delight............ enhances personal holiness . furbishes the soul . ......... .... of man .45. 107 Wicked better than selfrighteous .....6... ....... in every thing90.... 74 Wise person .. 84 Vitality.... as naught ......90. 109..127 v. 98 ... 127 Weeping good and bad w....u... ..l03... Vital force speech is v.... ................ .. 34 extending each word ........ 75 w . must be made to shine ... 78 y ................Words of Torah and Prayer each word a complete structure ........... 82 Yom Ke pur ..................... 3............46............. 132 Yeridah Tzorech Aliyah .... 117 promotes depression .......... 34............... ................. 9............. 118 Worlds Supernal World true abode of man ........ 124 Yetzer hara deceptions and enticements of y .... 74... 88 see Shechinah World of Thought ........................... 138 tries to prevent fasting ....................... Yetzirah and Beri'ah .... 123 Worlds ofhsiyah... 12 Worship see Prayer...................... incited by food and drink .. 75.. 135 Yerushalayim ........... 44 subduement of y ..................................... Service of God Yehudah ...39.. 44.. 55............ 231 Yetzer tov .... 9 Yichudim ....... 84 World of Freedom .... 79...4 ...1 20 World of Speech ..... 78....................... 43.......6.1 43 Worms analogy between man and w . ................ 123 ................ 78 Torah is antidote toy .... 70 w ............ 12 serve God ..... to be uttered with intensity ...................................................................... 22....... APPENDIX . ) . Schatz-Uffenheimer somehow skipped nos. Dov Ber of Mezhirech's Ma& Devarav Laya'akov: 1) ed. SchatzUffenheimer (Jerusalem). 11 and 136 in its numbering. The following table offers the equivalent numbering in the other editions. Toldot Aharon (Jerusalem). All references in this work are to ed. Kehot.There are currently three principal editions of R. (Note that ed. Kehot (New York). and 3) ed. The major difference between them is the editors' division (thus numbering) of the contents. 2) ed. p nr* *t5 anxn Npwtn ntn .5~ptn)*S ~ N.or5w t t ~ .s*N** 3mn onmi .5 m n~ l n *mn *nn* >D*t Nt**S3 12 Stt2*lN )an524 .n nn*a rt .awn*a tt.ao n ~ a ~ 5nlp lnjrn* pnr* 5 t * *N~J SYWDn a nJn 5't~Vno n ~ n.
https://www.scribd.com/document/129676035/Tzava-at-HaRivash-The-Testament-of-Rabbi-Israel-Baal-Shem-Tov
CC-MAIN-2018-13
refinedweb
66,682
78.75
Let’s be honest. A lot of JavaScript code sucks. Change’s power is nuclear JavaScript provides lots of tools and options, which is good! The bitter truth, however, is that it imposes almost no limitations on the developer. Giving JavaScript to somebody inexperienced is akin to giving a box of matches to a 2-year old child along with a can of gasoline… The power of JavaScript is nuclear— it can be used to supply cities with electricity or it can be used to destroy. Building something that works with JavaScript is easy. Building software that is both reliable and maintainableis not. Code Reliability When building a dam, engineers first and foremost concern themselves with reliability. Building a dam without any planning or safety measures in place is dangerous. The same applies to building bridges, airplanes, cars… you name it. None of the fancy features matter if a car is unsafe and unreliable — not the horsepower, the loudness of the exhaust, or even the type of leather used in the interior. Similarly, the goal of every software developer is to write reliable software. Nothing else matters if the code is buggy and unreliable. And what is the best way to write code that is reliable? Simplicity. Simplicity is the opposite of complexity. Therefore, our first and foremost responsibility as software developers should be to reduce code complexity. What sets an experienced developer apart from an inexperienced one is whether or not one can write reliable software. And yes, being reliable also includes maintainable — only maintainable codebase can be reliable. This entire piece focuses on writing code that is reliable. Although I’m a strong believer in Functional Programming, I’m not going to preach anything. Instead, I’m going to take a few useful concepts from Functional Programming and demonstrate how they can be applied in JavaScript. Do we really need software reliability? That’s up to you to decide. Some people would argue that software should only be good enough for customers to keep using it. I tend to disagree. In fact, I’m a strong believer that nothing else matters if the software is unreliable and unmaintainable. Who would buy an unreliable car, that would break and accelerate randomly? How many people would be using a phone that would be losing its connectivity a few times a day, and restart randomly? Probably not too many. Software isn’t that much different. There’s Not Enough RAM How do we develop reliable software? We have to consider the amount of available RAM. As any developer knows, we should design our programs to be memory-efficient, and never consume all of the available RAM. If this happens, then memory swapping will start taking place — anything that does not fit into RAM will be stored on the hard-drive, and the performance of all of the programs running will start degrading. How does this relate to writing reliable software? The human brain has its own version of RAM, called working memory. Yes, our brain is the most powerful machine in the known universe, but it comes with its own set of limitations — we can only hold about five pieces of information in our working memory at any given time. This directly translates to programming — simple code consumes less mental resources, makes us more efficient, and results in more reliable software. This article along with some of the available JavaScript tooling will help you achieve that! A Note to Beginners In this article, I will be making heavy use of ES6 features. Make sure that you’re familiar with ES6 before reading. As a brief refresher: // --------------------------------------------- // lambda (fat arrow) anonymous functions // --------------------------------------------- const doStuff = (a, b, c) => {...} // same as: function doStuff(a, b, c) { ... } // --------------------------------------------- // object destructuring // --------------------------------------------- const doStuff = ({a, b, c}) => { console.log(a); } // same as: const doStuff = (params) => { const {a, b, c} = params; console.log(a); } // same as: const doStuff = (params) => { console.log(params.a); } // --------------------------------------------- // array destructuring // --------------------------------------------- const [a, b] = [1, 2]; // same as: const array = [1, 2]; const a = array[0]; const b = array[1]; Tooling One of the greatest strengths of JavaScript is the available tooling. No other programming language can boast access to such a large ecosystem of tools and libraries. I also probably won’t surprise anyone by saying that we should be making use of such tooling, ESLint in particular. ESLint is a tool for static code analysis. It is the most important tool that allows us to find potential issues within the codebase and ensure high quality of the codebase. The best part is that linting is a fully automated process and can be used to prevent the low-quality code from making its way into the codebase. Many people barely make use of ESLint — they simply enable a pre-built config, like eslint-config-airbnb, and think that they’re done. That’s a plausible approach, but unfortunately, it barely scratches the surface of what ESLint has to offer. JavaScript is a language with no limitations. Inadequate linting setup can have far-reaching consequences. Yes, being familiar with all of the features of a language can be useful. However, a skilled developer is also someone who knows what features notto use. JavaScript is an old language, it comes with plenty of baggage and it attempts to do it all. It is important to be able to tell the good parts from the bad ones. ESLint Configuration If you want to follow along and make use of some of the suggestions from this article, then you can set ESLint up as follows. I would recommend becoming familiar with the suggestions one-by-one and including the ESLint rules into your project one-by-one as well. Configure them initially as warn, and once you’re comfortable, you can convert some of the rules into error. In the root directory of your project run: npm i -D eslint npm i -D eslint-plugin-fp Then create a .eslintrc.yml file within the root directory of your project: env: es6: true plugins: fp rules: # rules will go in here If you’re using an IDE like VSCode, make sure to set up an ESLint plugin. You can also run ESLint manually from the command line: npx eslint . The Importance of Refactoring Refactoring is the process of reducing the complexity of the existing code. When properly applied, it becomes the best weapon we have against the dreaded monster of technical debt. Without continuous refactoring, the technical debt will keep accumulating, which in turn will make the developers slower and more frustrated. Technical debt is one of the main reasons for developer burn-out. Refactoring boils down to the process of cleaning up the existing code while making sure that the code still functions correctly. Refactoring is considered to be good practice in software development and it should be a normal part of the development process in any healthy organization. As a word of caution, before undertaking any refactoring, it is best to have the code covered with automated tests. It is easy to inadvertently break the existing functionality and having a comprehensive test suite in place is a great way to limit any potential issues. The Biggest Source of Complexity I know this might sound weird, but the code itself is the biggest source of complexity. In fact, no code is the best way to write secure and reliable software. Frankly, this is not always possible, therefore the second best thing is to reduce the amount of code. Less code means less complexity, as easy as that! Less code also implies a smaller surface area for the bugs to attach to. There’s even a saying that junior developers write code, while senior developers delete code. Couldn’t agree more. Long files Let’s admit it, humans are lazy. Laziness is a short-term survival strategy wired into our brains. It helps us preserve energy by avoiding things that are not critical to our survival. Some of us are a little lazy and not very disciplined. People keep putting more and more code into the same single file… If there’s no limit on the length of a file, then such files tend to keep growing infinitely. In my experience, files with over 200 lines of code become too much for the human brain to comprehend and become hard to maintain. Long files also are a symptom of a bigger problem — the code probably is doing too much, which violates the Single Responsibility Principle. How can this be addressed? Easy! Simply break down large files into smaller more granular modules. Suggested ESLint configuration: rules: max-lines: - warn - 200 Long functions Another major source of complexity is long and complex functions. Such functions are hard to reason about. They typically have too many responsibilities and are hard to test. Let’s consider the following express.js code snippet for updating a blog entry: router.put('/api/blog/posts/:id', (req, res) => { if (!req.body.title) { return res.status(400).json({ error: 'title is required', }); } if (!req.body.text) { return res.status(400).json({ error: 'text is required', }); } const postId = parseInt(req.params.id); let blogPost; let postIndex; blogPosts.forEach((post, i) => { if (post.id === postId) { blogPost = post; postIndex = i; } }); if (!blogPost) { return res.status(404).json({ error: 'post not found', }); } const updatedBlogPost = { id: postId, title: req.body.title, text: req.body.text }; blogPosts.splice(postIndex, 1, updatedBlogPost); return res.json({ updatedBlogPost, }); }); The function body is 38 lines long and it does several things: parses post id, finds an existing blog post, validates the user input, returns validation errors in case of invalid input, updates the collection of posts, and returns the updated blog posts. Clearly, it can be refactored into a few smaller functions. The resulting route handler could then look something like this: router.put("/api/blog/posts/:id", (req, res) => { const { error: validationError } = validateInput(req.body); if (validationError) return errorResponse(res, validationError, 400); const { blogPost } = findBlogPost(blogPosts, req.params.id); const { error: postError } = validateBlogPost(blogPost); if (postError) return errorResponse(res, postError, 404); const updatedBlogPost = buildUpdatedBlogPost(req.body); updateBlogPosts(blogPosts, updatedBlogPost); return res.json({updatedBlogPost}); }); Suggested ESLint configuration: rules: max-lines-per-function: - warn - 20 Complex functions Complex functions go hand-in-hand with long functions — longer functions are always more complex than shorter functions. What makes functions complex? Multiple things, but the ones that are easy to fix are nested callbacks and high cyclomatic complexity. Nested callbacks often result in callback hell. It can be easily mitigated by promisifying the callbacks and then making use of async-await. Here’s an example of a function with deeply nested callbacks: fs.readdir(source, function (err, files) { if (err) { console.error('Error finding files: ' + err) } else { files.forEach(function (filename, fileIndex) { gm(source + filename).size(function (err, values) { if (err) { console.error('Error identifying file size: ' + err) } else { aspect = (values.width / values.height) widths.forEach(function (width, widthIndex) { height = Math.round(width / aspect) this.resize(width, height).write(dest + 'w' + width + '_' + filename, function(err) { if (err) console.error('Error writing file: ' + err) }) }.bind(this)) } }) }) } }) Cyclomatic complexity Another major source of function complexity is cyclomatic complexity. In a nutshell, it refers to the number of statements (logic) in any given function. Think if statements, loops, and switch statements. Such functions are hard to reason about and their use should be limited. Here’s an example: if (conditionA) { if (conditionB) { while (conditionC) { if (conditionD && conditionE || conditionF) { ... } } } } Suggested ESLint configuration: rules: complexity: - warn - 5 max-nested-callbacks: - warn - 2 max-depth: - warn - 3 What is the other important way to reduce the amount of code, and along with it, the complexity? Declarative code, but more on that later. Mutable State What is state? Simply put, state is any temporary data stored in memory. Think variables or fields within objects. State by itself is quite harmless. Mutable state though is one of the biggest sources of complexity in software. Especially when coupled with object-orientation (more on this later). Limitations of the human brain Why is mutable state such a big problem? As I have said earlier, the human brain is the most powerful machine in the known universe. However, our brains are really bad at working with state since we can only hold about five and I will certainly drop all of them. Coding is the same, I became much more productive and my code became much more reliable once I dropped the mutable state. The problems with mutable state Let’s see in practice how mutability can make our code problematic: const increasePrice = (item, increaseBy) => { // never ever do this item.price += increaseBy; return item; }; const oldItem = { price: 10 }; const newItem = increasePrice(oldItem, 3); // prints newItem.price 13 console.log('newItem.price', newItem.price); // prints oldItem.price 13 // unexpected? console.log('oldItem.price', oldItem.price); The bug is very subtle, but by mutating the function arguments we’ve accidentally modified the price of the original item. It was supposed to remain 10, but in reality, the value has changed to 13! How do we avoid such issues? By constructing and returning a new object instead (immutability): const increasePrice = (item, increaseBy) => ({ ...item, price: item.price + increaseBy }); const oldItem = { price: 10 }; const newItem = increasePrice(oldItem, 3); // prints newItem.price 13 console.log('newItem.price', newItem.price); // prints oldItem.price 10 // as expected! console.log('oldItem.price', oldItem.price); Keep in mind that copying by using the ES6 spread … operator makes a shallow copy, not a deep copy — it won’t copy any of the nested properties. E.g. if the item above had something like item.seller.id , the seller of the new item would still refer to the old item, which is undesirable. Other more robust alternatives for working with immutable state in JavaScript include immutable.js and Ramda lenses. I’ll cover those options in another article. Suggested ESLint configuration: rules: fp/no-mutation: warn no-param-reassign: warn Don’t push your arrays The same problems are also inherent in array mutation using methods like push : const a = ['apple', 'orange']; const b = a; a.push('microsoft') // ['apple', 'orange', 'microsoft'] console.log(a); // ['apple', 'orange', 'microsoft'] // unexpected? console.log(b); I think you might have expected the array b to stay the same? This error could have been easily avoided had we created a new array instead of calling push . Such issues can easily be prevented by constructing new arrays instead: const newArray = [...a, 'microsoft']; Non-determinism Non-determinism is a fancy term that simply describes the inability of programs to produce the same output, given the same input. If this doesn’t sound good to you, it is because it is not any good. You might be thinking that 2+2==4 , but this is not always the case with non-deterministic programs. Two plus two mostly is equal to four, but sometimes it might become equal to three, five, and maybe even 1004. While mutable state itself is not inherently non-deterministic, it makes the code prone to non-determinism (as demonstrated above). It is ironic that non-determinism is universally considered to be undesirable in programming, yet the most popular programming paradigms (OOP and imperative) are especially prone to non-determinism. Immutability If mutability is not always the best option, then what are the alternatives? Immutability, of course! Making use of immutability is a very good practice and nowadays is encouraged by many. Yes, some might disagree, and say that mutable state is great (Rust fans?). I can say one thing for certain — mutability doesn’t make a codebase more reliable. I won’t go too deep into immutability in this article. It is a big topic, and I will probably later dedicate an entire article to immutability. Suggested ESLint configuration: rules: fp/no-mutating-assign: warn fp/no-mutating-methods: warn fp/no-mutation: warn Avoiding the Let Keyword Yes, var should never be used in JavaScript to declare variables, I will not surprise anyone by saying that. However, you will probably be surprised to learn that the let keyword should be avoided as well. Variables declared with let can be reassigned, which makes reasoning about the code harder. Many of the bad practices that we’ve covered so far in this article run into the limitations of the human RAM (working memory), and using the letkeyword is no exception. When programming with the let keyword, we have to keep in mind all of the side effects and potential edge cases. Inadvertently, we might assign an incorrect value to the variable, and waste time debugging. This is especially applicable to unit testing. Having shared mutable state in-between multiple tests is a recipe for disaster, given that most test runners run the tests in parallel. What are the alternatives to the let keyword? The const keyword, of course! Although it doesn’t guarantee immutability, it makes the code easier to reason about by disallowing reassignments. And honestly, you don’t really need let — in most cases, the code that reassigns values to variables can be extracted into a separate function. Let’s look at an example: let discount; if (isLoggedIn) { if (cartTotal > 100 && !isFriday) { discount = 30; } else if (!isValuedCustomer) { discount = 20; } else { discount = 10; } } else { discount = 0; } And the same example extracted into a function: const getDiscount = ({isLoggedIn, cartTotal, isValuedCustomer}) => { if (!isLoggedIn) { return 0; } if (cartTotal > 100 && !isFriday()) { return 30; } if (!isValuedCustomer) { return 20; } return 10; } Being unable to make use of re-assignment using the let keyword might sound difficult at first, but it will make your code less complex and more readable. I haven’t used the let keyword in a very long time and have never missed it. Getting into the habit of programming without the let keyword has a nice side effect of making you more disciplined. It will force you to break down your code into smaller more manageable functions. This, in turn, will make your functions more focused, will enforce better separation of concerns, and will also make the codebase much more readable and maintainable. Suggested ESLint configuration: rules: fp/no-let: warn Object-Oriented Programming “Java is the most distressing thing to happen to computing since MS-DOS.” Object-Oriented Programming is a popular programming paradigm used for code organization. This section discusses the limitations of mainstream OOP as used in Java, C#, JavaScript, TypeScript, and other OOP languages. I’m not criticizing proper OOP (e.g. SmallTalk). This section is completely optional, and if you think that using OOP is a must when developing software, then feel free to skip this section. Thanks. Good programmers vs bad programmers Good programmers write good code and keep pressing buttons on the keyboard like crazy. Whether you like it or not, you will be working with bad programmers, some who will be really, really bad. And, unfortunately, OOP does not have enough constraints in place that would prevent bad programmers from doing too much damage. Why was OOP invented in the first place? It was intended to help with the organization of procedural codebases. The irony is that OOP was supposed to reduce complexity, however, the tools that it offers, only seem to be increasing it. OOP non-determinism OOP code is prone to non-determinism — it heavily relies on mutable state. Functional programming guarantees that we will always get the same output, given the same input. OOP cannot guarantee much, which makes reasoning about the code even harder. As I said earlier, in non-deterministic programs the output of 2+2 or calculator.Add(2, 2) mostly is equal to four, but sometimes it might become equal to three, five, and maybe even 1004. The dependencies of the Calculator object might change the result of the computation in subtle, but profound ways. Such issues become even more apparent when concurrency is involved. Shared mutable state Mutable state is hard. Unfortunately, OOP further exacerbates the problem by sharing that mutable state by reference (rather than by value). This means that pretty much anything can change the state of a given object. The developer has to keep in mind the state of every object that the current object interacts with. This quickly hits the limitations of the human brain since we can hold only about five items of information in our working memory at any given time. Reasoning about such a complex graph of mutable objects is an impossible task for the human brain. It uses up precious and limited cognitive resources, and will inevitably result in a multitude of defects. Yes, sharing references to mutable objects is a tradeoff that was made in order to increase efficiency and might have mattered a few decades ago. The hardware has advanced tremendously, and we should now worry more about developer efficiency, not code efficiency. Even then, with modern tooling, immutability, barely has any impact on performance. OOP preaches that global state is the root of all evil. However, the irony is that OOP programs are mostly one large blob of global state (since everything is mutable and is shared by reference). The Law of Demeter is not very useful — shared mutable state is still shared mutable state, no matter how you access or mutate that state. It simply sweeps the problem under the rug. Domain-Driven Design? That’s a useful design methodology, it helps a bit with the complexity. However, it still does nothing to address the fundamental issue of non-determinism. Signal-to-noise ratio Many people in the past have been concerned with the complexity introduced by the non-determinism of OOP programs. They’ve come up with a multitude of design patterns in an attempt to address such issues. Unfortunately, this only further sweeps the fundamental problem under the rug and introduces even more unwarranted complexity. As I said earlier, the code itself is the biggest source of complexity, less code is always better than more code. OOP programs typically carry around a large amount of boilerplate code, and “band-aids” in the form of design patterns, which adversely affect the signal-to-noise ratio. This means that the code becomes more verbose, and seeing the original intent of the program becomes even more difficult. This has the unfortunate consequence of making the codebase significantly more complex, which, in turn, makes the codebase less reliable. I’m not going to dive too deep into the drawbacks of using Object-Oriented Programming in this article. Even though there probably are millions of people who swear by it, I’m a strong believer that modern OOP is one of the biggest sources of complexity in software. Yes, there are successful projects built with OOP, however, this doesn’t mean that such projects do not suffer from unwarranted complexity. OOP in JavaScript is especially a bad idea since the language lacks things like static type checking, generics, and interfaces. The this keyword in JavaScript is rather unreliable. The complexity of OOP surely is a nice exercise for the brain. However, if our goal is to write reliable software, then we should strive to reduce complexity, which ideally means avoiding OOP. If you’re interested in learning more, make sure to check out my other article Object-Oriented Programming — The Trillion Dollar Disaster. This Keyword The behavior of the this keyword is consistently inconsistent. It is finicky and can mean completely different things in different contexts. Its behavior even depends on who has called a given function. Using this keyword oftentimes results in subtle and weird bugs that can be hard to debug. Yes, it can be a fun interview question to ask job candidates, but the knowledge of the this keyword doesn’t really tell anything. Only that the candidate has spent a few hours studying the most common JavaScript interview questions. What would I answer if I was given a tricky piece of code using the thiskeyword? As a Canadian, I’d say — “I’m sorry… I don’t know”. Real-world code should not be error-prone. It should be readable, not tricky. this is an obvious language design flaw, and should not be used. Suggested ESLint configuration: rules: fp/no-this: warn Declarative Code Declarative code is a popular term nowadays, but what does it really mean? Is it any good? Let’s find out. If you’ve been programming for some time, then most likely you’ve been making use of the imperative style of programming, which describes a set of steps to achieve the desired result. Declarative style, on the other hand, describes the desired outcome, not the specific instructions. Some examples of commonly used declarative languages are SQL and HTML. And even JSX in React! We don’t tell a database how to fetch our data by specifying the exact steps. We use SQL to describe what to fetch instead: SELECT * FROM Users WHERE Country='USA'; This roughly can be represented in imperative JavaScript: let user = null; for (const u of users) { if (u.country === 'USA') { user = u; break; } } Or in declarative JavaScript, using the experimental pipeline operator: import { filter, first } from 'lodash/fp'; const filterByCountry = country => filter( user => user.country === country ); const user = users |> filterByCountry('USA') |> first; What approach would you prefer? To me, the second one seems cleaner and more readable. Prefer expressions over statements Expressions should be preferred over statements if our goal is to write declarative code. Expressions always return a value, whereas statements are used to perform actions, and do not return any results. This is also called “side effects” in functional programming. By the way, state mutation that was discussed earlier is also a side effect. What are some of the commonly used statements? Think if , return , switch , for , while . Let’s look at a simple example: const calculateStuff = input => { if (input.x) { return superCalculator(input.x); } return dumbCalculator(input.y); }; This can easily be rewritten as a ternary expression (which is declarative): const calculateStuff = input => { return input.x ? superCalculator(input.x) : dumbCalculator(input.y); }; And if the return statement is the only thing within a lambda function, then JavaScript allows us to get rid of the lambda statement as well: const calculateStuff = input => input.x ? superCalculator(input.x) : dumbCalculator(input.y); The function body was reduced from six lines of code to one single line of code. Declarative code superpowers! What are some of the other drawbacks of using statements? They cause side effects and mutations, which are prone to non-determinism. This makes the code less readable and less reliable. Statements are unsafe to reorder since they rely on the order that they were used in. Statements (including loops) are hard to parallelize since they mutate state outside of their scope. Working with statements implies additional mental overhead due to increased complexity. Expressions, on the other hand, can be safely reordered, cause no side effects, are easy to parallelize. Declarative programming takes effort Declarative programming is not something that can be learned overnight. Especially given that the majority of people have mainly been taught imperative programming. Declarative programming takes discipline and learning to think in a whole new way. How do you learn declarative programming? A good first step is to learn to program without mutable state — not using the let keyword and not mutating the state. I can say one thing for certain, if you give declarative programming a try, you will be amazed how elegant your code will become. Suggested ESLint configuration: rules: fp/no-let: warn fp/no-loops: warn fp/no-mutating-assign: warn fp/no-mutating-methods: warn fp/no-mutation: warn fp/no-delete: warn Avoid Passing Multiple Parameters to Functions JavaScript is not a statically typed language, and there’s no way to guarantee that the function is being invoked with the correct and expected parameters. ES6 brings many great features to the table, including destructuring objects, which can also be used for function arguments. Do you find the following code snippet intuitive? Are you able to tell right off the bat what the parameters are? I can’t! const total = computeShoppingCartTotal(itemList, 10.0, 'USD'); How about the following example? const computeShoppingCartTotal = ({ itemList, discount, currency }) => {...}; const total = computeShoppingCartTotal({ itemList, discount: 10.0, currency: 'USD' }); I’d say that the latter is much more readable than the former. This is especially applicable to function calls made from a different module. Making use of an argument object also has the benefit of making the order of arguments irrelevant. Suggested ESLint configuration: rules: max-params: - warn - 2 Prefer Returning Objects From Functions How much does the following code snippet tell you about the signature of the function? What does it return? Does it return the user object, the user id, the status of the operation? It is hard to tell without understanding the surrounding context. const result = saveUser(...); Returning an object from a function makes the developer’s intention very clear and the code becomes significantly more readable: const { user, status } = saveUser(...); ... const saveUser = user => { ... return { user: savedUser, status: "ok" }; }; Controlling Execution Flow with Exceptions How do you like seeing internal 500 server errors when you’ve entered an invalid input in a form? What about working with APIs that don’t give any details, and throw 500 errors left and right instead? I’m sure that all of us have encountered such issues, and the experience likely was far from pleasant. Although we’re taught to throw exceptions when something unexpected happens, this is not the best way to handle errors. Let’s see why. Exceptions break type safety Exceptions break type safety, even in statically typed languages. According to its signature, the function fetchUser(id: number): User is supposed to return a user. Nothing in the function signature says that an exception will be thrown if the user cannot be found. If an exception is expected, then a more appropriate function signature would be: fetchUser(...): User|throws UserNotFoundError . Of course, such syntax is invalid, no matter the language. Reasoning about programs that throw exceptions becomes hard — one may never know whether or not a function will throw an exception. Yes, we could wrap every single function call in a try/catch block, but that seems unpractical, and would significantly hinder code readability. Exceptions break function composition Exceptions make it virtually impossible to utilize function composition. In the following example, the server is going to return a 500 internal server error if one of the blog posts cannot be found. const fetchBlogPost = id => { const post = api.fetch(`/api/post/${id}`); if (!post) throw new Error(`Post with id ${id} not found`); return post; }; const html = postIds |> map(fetchBlogPost) |> renderHTMLTemplate; What if one of the posts was deleted, but the user is still trying to access the post due to some obscure bug? This will significantly degrade the user experience. Tuples as an alternative way of error handling Without going too deep into functional programming, a simple way to handle errors is to return a tuple containing the result and an error instead of throwing an exception. Yes, JavaScript has no support for tuples, but they can easily be emulated using a two-value array in the form of [error, result]. By the way, this also is the default method of error handling in Go: const fetchBlogPost = id => { const post = api.fetch(`/api/post/${id}`); return post // null for error if post was found ? [null, post] // null for result if post was not found : [`Post with id ${id} not found`, null]; }; const blogPosts = postIds |> map(fetchBlogPost); const errors = blogPosts |> filter(([err]) => !!err) // keep only items with errors |> map(([err]) => err); // destructure the tuple and return the error const html = blogPosts |> filter(([err]) => !err) // keep only items with no errors |> map(([_, result]) => result) // destructure the tuple and return the result |> renderHTML; Exceptions are fine, sometimes Exceptions still have their place within the codebase. As a rule of thumb, you should ask yourself one question — do I want the program to crash? Any exception thrown has the potential to bring down the entire process. Even if we think that we’ve carefully considered all of the potential edge cases, still, the exceptions are unsafe and will cause the program to crash sometime in the future. Throw exceptions only if you really intend the program to crash, for example, because of a developer error, or a failed database connection. Exceptions are called exceptions for a reason. They should only be used when something exceptional has happened, and the program has no other choice but crash. Throwing and catching exceptions is not a very good way to control execution flow. We should only resort to throwing exceptions when an unrecoverable error has happened. Invalid user input, for example, is not one of them. Let it crash — Avoid catching exceptions This brings us to the ultimate rule of error handling — avoid catching exceptions. That’s right — we’re allowed to throw errors if we intend the program to crash, but we should never catch such errors. In fact, this is the approach recommended by functional languages like Haskell and Elixir. The only exception to the rule is the consumption of third-party APIs. Even then, it is best to make use of a helper function wrapping the function to return a [error, result] tuple instead. For this purpose, you can make use of tools like saferr. I’ll cover such wrappers in more detail in the next section on partial function application. Ask yourself — who is responsible for the error? If this is the user, then the error should be handled gracefully. We want to show the user a nice message, instead of presenting them with a 500 internal server error. Unfortunately, there’s no no-try-catch ESLint rule. Its closest neighbor is the no-throw rule. Make sure that you throw errors responsibly, in exceptional circumstances, when you expect the program to crash. Suggested ESLint configuration: rules: fp/no-throw: warn Partial Function Application Partial function application is probably one of the best code sharing mechanisms ever invented. It blows OOP Dependency Injection out of the water. You can inject dependencies into your code without resorting to all of the typical OOP boilerplate. The following example wraps the Axios library that is notorious for throwing exceptions (instead of returning the failed response). Working with such libraries is unnecessarily hard, especially when using async/await. In the following example, we’re making use of currying and partial function application to make an unsafe function safe. // Wrapping axios to safely call the api without throwing exceptions const safeApiCall = ({ url, method }) => data => axios({ url, method, data }) .then( result => ([null, result]) ) .catch( error => ([error, null]) ); // Partially applying the generic function above to work with the users api const createUser = safeApiCall({ url: '/api/users', method: 'post' }); // Safely calling the api without worrying about exceptions. const [error, user] = await createUser({ email: 'ilya@suzdalnitski.com', password: 'Password' }); Note, that the safeApiCall function is written as func = (params) => (data) => {...} . This is a common technique in functional programming called currying, and it always goes hand-in-hand with partial function application. This means that the func function when called with params , returns another function that actually performs the job. In other words, the function is partially applied with params . It can also be written as: const func = (params) => ( (data) => {...} ); Note that the dependencies ( params ) are passed as the first parameter and the actual data is passed as the second parameter. To make things easier, you can make use of the saferr npm package, which also works with promises, and async/await: import saferr from "saferr"; import axios from "axios"; const safeGet = saferr(axios.get); const testAsync = async url => { const [err, result] = await safeGet(url); if (err) { console.error(err.message); return; } console.log(result.data.results[0].email); }; // prints: zdenka.dieckmann@example.com testAsync(""); // prints: Network Error testAsync(""); A Few Tiny Tricks Here are a few tiny, but handy tricks. They don’t necessarily make the code more reliable but can make our life a little easier. Some are widely known, others are not. A little type safety Yes, JavaScript is not a statically typed language. However, we can make use of a small little trick to make our code more robust by marking our function arguments as required. The following code will throw an error whenever the required value was not passed in. Please note that it won’t work for nulls, but is still a great guard against undefined values. const req = name => { throw new Error(`The value ${name} is required.`); }; const doStuff = ( stuff = req('stuff') ) => { ... } Short-circuit conditionals and evaluation Short-circuit conditionals are widely known and are useful for accessing values within nested objects. const getUserCity = user => user && user.address && user.address.city; const user = { address: { city: "San Francisco" } }; // Returns "San Francisco" getUserCity(user); // Both return undefined getUserCity({}); getUserCity(); Short-circuit evaluation is useful for providing an alternative value if a value is falsey: const userCity = getUserCity(user) || "Detroit"; Bang bang!! Negating a value twice is a great way to convert any value to boolean. Be aware though that any falsey value will be converted to false and this might not always be something that you want. This should never be used for numbers since 0 will also be converted to false . const shouldShowTooltip = text => !!text; // returns true shouldShowTooltip('JavaScript rocks'); // all return false shouldShowTooltip(''); shouldShowTooltip(null); shouldShowTooltip(); Debugging with in-place logging We can make use of short-circuiting and the fact that the result of console.log is falsey to debug functional code, even including React components: const add = (a, b) => console.log('add', a, b) || (a + b); const User = ({email, name}) => ( <> <Email value={console.log('email', email) || email} /> <Name value={console.log('name', name) || name} /> </> ); What’s Next? Do you really need code reliability? That’s up to you to decide. Does your organization equate developer productivity with the number of completed JIRA stories? Are you working in a feature factory that values nothing else but the number of features delivered? Hopefully not, but if they do, then you might consider looking for a better place to work at… It might be overwhelming if you attempt to apply everything from this article all at once. Have the article bookmarked, and keep coming back to it once in a while. Every time, take away one single thing that you will deliberately focus on. And enable the associated ESLint rules to help you on your journey. Source: medium
https://learningactors.com/heres-how-not-to-suck-at-javascript/
CC-MAIN-2020-10
refinedweb
6,398
56.86
Source hg-review / bundled / flask / docs / quickstart.rst Quickstart Eager to get started? This page gives a good introduction in how to get started with Flask. This assumes you already have Flask installed. If you do not, head over to the :ref:`installation` section. A Minimal Application A minimal Flask application looks something like Head over to, you should see your hello world greeting. So what did that code do? - First we imported the :class:`~flask.Flask` class. An instance of this class will be our WSGI application. The first argument is the name of the application's module. If you are using a single module (like here) you should use __name__ because depending on if it's started as application or imported as module the name will be different ('__main__' versus the actual import name). For more information on that, have a look at the :class:`~flask.Flask` documentation. - Next we create an instance of it. We pass it the name of the module / package. This is needed so that Flask knows where it should look for templates, static files and so on. - Then we use the :meth:`~flask.Flask.route` decorator to tell Flask what URL should trigger our function. - The function then has a name which is also used to generate URLs to that particular function, and returns the message we want to display in the user's browser. - Finally we use the :meth:`~flask.Flask.run` function to run the local server with our application. The if __name__ == '__main__': makes sure the server only runs if the script is executed directly from the Python interpreter and not used as imported module. To stop the server, hit control-C. :meth:`~flask.Flask.run` method to look like this: app.run(host='0.0.0.0') This tells your operating system to listen on a public IP. Debug Mode The :meth:`~flask.Flask.run` method is nice to start a local development server, but you would have to restart it manually after each change you do to code. That is not very nice and Flask can do better. If you enable the debug support the server will reload itself on code changes and also provide you with a helpful debugger if things go wrong. There are two ways to enable debugging. Either set that flag on the application object: app.debug = True app.run() Or pass it to run: app.run(debug=True) Both will have exactly the same effect. Attention Even though the interactive debugger does not work in forking environments (which makes it nearly impossible to use on production servers), it still allows the execution of arbitrary code. That makes it a major security risk and therefore it must never be used on production machines. Screenshot of the debugger in action: Routing he will like the page and come back next time. As you have seen above, the :meth:`~flask.Flask To add variable parts to a URL you can mark these special sections as <variable_name>. Such a part is then passed as keyword argument to your function. Optionally a converter can be specified by specifying a rule with <converter:variable_name>. Here are some nice examples: @app.route('/user/<username>') def show_user_profile(username): # show the user profile for that user pass @app.route('/post/<int:post_id>') def show_post(post_id): # show the post with the given id, the id is an integer pass The following converters exist: Unique URLs / Redirection Behaviour Flask's URL rules are based on Werkzeug's routing module. The idea behind that module is to ensure nice looking and also unique URLs based on behaviour Apache and earlier servers coined. Take these two rules: @app.route('/projects/') def projects(): pass @app.route('/about') def about(): pass They look rather similar, the difference is the trailing slash in the URL definition. In the first case, the canonical URL for the projects endpoint has a trailing slash. It's similar to a folder in that sense. Accessing it without a trailing slash will cause Flask to redirect to the canonical URL with the trailing slash. However in the second case the URL is defined without a slash so it behaves similar to a file and accessing the URL with a trailing slash will be a 404 error. Why is this? This allows relative URLs to continue working if users access the page when they forget a trailing slash. This behaviour is also consistent with how Apache and other servers work. Also, the URLs will stay unique which helps search engines not indexing the same page twice. URL Building If it can match URLs, can it also generate them? Of course it can. To build a URL to a specific function you can use the :func:`~flask.url_for` function. It accepts the name of the function as first argument and a number of keyword arguments, each corresponding to the variable part of the URL rule. Unknown variable parts are appended to the URL as query parameter. :meth:`~flask.Flask.test_request_context` method explained below. It basically tells Flask to think we are handling a request even though we are not, we are in an interactive Python shell. Have a look at the explanation below. :ref:`context-locals`). Why would you want to build URLs instead of hardcoding them in your templates? There are three good reasons for this: - reversing is often more descriptive than hardcoding the URLs. Also and more importantly you can change URLs in one go without having to change the URLs all over the place. - URL building will handle escaping of special characters and Unicode data transparently for you, you don't have to deal with that. - If your application is placed outside the URL root (so say in /myapplication instead of /), :func:`~flask.url_for` will handle that properly for you. HTTP Methods HTTP (the protocol web applications are speaking) knows different methods to access URLs. By default a route only answers to GET requests, but that can be changed by providing the methods argument to the :meth:`~flask.Flask like the HTTP RFC (the document describing the HTTP protocol) demands, so you can completely ignore that part of the HTTP specification. Likewise as of Flask 0.6, OPTIONS is implemented for you as well automatically. You have no idea what an HTTP method is? Worry not, here is a quick introduction to HTTP methods and why they matter: The HTTP method (also often called "the verb") tells the server what the clients request are usually transmitting data to the server. - PUT - Similar to POST but the server might trigger the store procedure multiple times by overwriting the old values more than once. Now you might be asking why is this useful, but there are some good reasons to do it this way. Consider that the connection gets lost during transmission: in this situation a system between the browser and the server might receive the request safely a second time without breaking things. With POST that system use it. Static Files Dynamic web applications need static files as well. to that part of the URL, use the special 'static' URL name: url_for('static', filename='style.css') The file has to be stored on the filesystem as static/style.css. Rendering Templates :func:`~flask.render_template` method. All you have to do is, :ref:`templating` section of the documentation or the official Jinja2 Template Documentation for more information. Here is an example template: <!doctype html> <title>Hello from Flask</title> {% if name %} <h1>Hello {{ name }}!</h1> {% else %} <h1>Hello World!</h1> {% endif %} Inside templates you also have access to the :class:`~flask.request`, :class:`~flask.session` and :class:`~flask.g` [1] objects as well as the :func:`~flask.get_flashed_messages` function. Templates are especially useful if inheritance is used. If you want to know how that works, head over to the :ref: (because for example it came from a module that converts wiki markup to HTML) you can mark it as safe by using the :class:`~jinja2.Markup` class or by using the |safe filter in the template. Head over to the Jinja 2 documentation for more examples. Here is a basic introduction to how the :class:`~jinja2.Markup` class works: >>> from flask import Markup >>> Markup('<strong>Hello %s!</strong>') % '<blink>hacker</blink>' Markup(u'<strong>Hello <blink>hacker</blink>!</strong>') >>> Markup.escape('<blink>hacker</blink>') Markup(u'<blink>hacker</blink>') >>> Markup('<em>Marked up</em> » HTML').striptags() u'Marked up \xbb HTML' Accessing Request Data For web applications it's crucial to react to the data a client sent to the server. In Flask this information is provided by the global :class:`~flask.request` object. If you have some experience with Python you might be wondering how that object can be global and how Flask manages to still be threadsafe. The answer are context locals: Context Locals webserver decides to spawn a new thread (or something else, the underlying object is capable of dealing with other concurrency systems than threads as well). When Flask starts its internal request handling it figures out that the current thread is the active context and binds the current application and the WSGI environments to that context (thread). It does that in an intelligent way that one application can invoke another application without breaking. So what does this mean to you? Basically you can completely ignore that this is the case unless you are doing something like unittesting. You will notice that code that depends on a request object will suddenly break because there is no request object. The solution is creating a request object yourself and binding it to the context. The easiest solution for unittesting is by using the :meth:`~flask.Flask :meth:`~flask.Flask.request_context` method: from flask import request with app.request_context(environ): assert request.method == 'POST' The Request Object The request object is documented in the API section and we will not cover it here in detail (see :class:`~flask.request`). Here is a broad overview of some of the most common operations. First of all you have to import it from the flask module: from flask import request The current request method is available by using the :attr:`~flask.request.method` attribute. To access form data (data transmitted in a POST or PUT request) you can use the :attr:`~flask.request.form` attribute. Here is a full example of the two attributes mentioned above: What happens if the key does not exist in the form attribute? In that case a special :exc:`KeyError` is raised. You can catch it like a standard :exc:`KeyError` but if you don't do that, a HTTP 400 Bad Request error page is shown instead. So for many situations you don't have to deal with that problem. To access parameters submitted in the URL (?key=value) you can use the :attr:`~flask.request.args` attribute: searchword = request.args.get('q', '') :class:`~flask.request` documentation. File Uploads :attr:`~flask.request.files` attribute on the request object. Each uploaded file is stored in that dictionary. It behaves just like a standard Python :class:`file` object, but it also has a :meth:`~werkzeug.FileStorage :attr:`~werkzeug.FileStorage.filename` attribute. However please keep in mind that this value can be forged so never ever trust that value. If you want to use the filename of the client to store the file on the server, pass it through the :func:`~werkzeug :ref:`uploading-files` pattern. Redirects and Errors To redirect a user to somewhere else you can use the :func:`~flask.redirect` function. To abort a request early with an error code use the :func:`~flask.abort` function. Here an example how this works: from flask import abort, redirect, url_for @app.route('/') def index(): return redirect(url_for('login')) @app.route('/login') def login(): abort(401) this_is_never_executed() This is a rather pointless example because a user will be redirected from the index to a page he cannot access (401 means access denied) but it shows how that works. By default a black and white error page is shown for each error code. If you want to customize the error page, you can use the :meth:`~flask.Flask.errorhandler` decorator: from flask import render_template @app.errorhandler(404) def page_not_found(error): return render_template('page_not_found.html'), 404 Note the 404 after the :func:`~flask.render_template` call. This tells Flask that the status code of that page should be 404 which means not found. By default 200 is assumed which translates to: all went well. Sessions Besides the request object there is also a second object called :class:`~flask.session` that he knows <p><input type=text name=username> <p><input type=submit value=Login> </form> ''' @app.route('/logout') def logout(): # remove the username from the session if its there session.pop('username', None) return redirect(url_for('index')) # set the secret key. keep this really secret: app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' The here mentioned :func:`~flask.escape` does escaping for you if you are not using the template engine (like in this example). How to generate good secret keys The problem with random is that it's hard to judge what random is.. Message Flashing Good applications and user interfaces are all about feedback. If the user does not get enough feedback he will probably end up hating the application. Flask provides a really simple way to give feedback to a user with the flashing system. The flashing system basically makes it possible to record a message at the end of a request and access it next request and only next request. This is usually combined with a layout template that does this. To flash a message use the :func:`~flask.flash` method, to get hold of the messages you can use :func:`~flask.get_flashed_messages` which is also available in the templates. Check out the :ref:`message-flashing-pattern` for a full example. Logging tempering :attr:`~flask.Flask.logger` is a standard logging :class:`~logging.Logger`, so head over to the official logging documentation for more information. Hooking in WSGI Middlewares)
https://bitbucket.org/sjl/hg-review/src/fa1f7726b08b/bundled/flask/docs/quickstart.rst
CC-MAIN-2016-07
refinedweb
2,337
66.74
Syntax: #include <cstdio> int printf( const char *format, ... ); may also specify the minimum field width in an int variable if instead of a number you put the * sign: int width = 12; int age = 100; printf("%*d", width, age); You can also include a precision modifier, in the form of a .N where N is some number, before the format command: %012.4d The precision modifier has different meanings depending on the format command being used: As with field width specifier, you may use an int variable to specify the precision modifier by using the * sign: const char* msg = "Hello printf"; int string_size = strlen (msg); printf("msg: %.*s", string_size, msg);. Related Topics: fprintf, puts, scanf, sprintf
http://www.cppreference.com/wiki/c/io/printf
crawl-002
refinedweb
115
60.95
Hi All, Can you please guide me on how to restore the .cbk file from the 2015 Cache version into the 2017 version or any other versions of Cache or IRIS software? I have a new instance on my server. It's an entirely new server. I have a .cbk backup file. I want to restore the backup file into a new namespace which one I will create on my new server. When I am trying on ^DBREST utility, I am getting "This is not a Cache Backup File" this error. Please advise on this. It's a bit urgent. Thanks, Arun Kumar.
https://community.intersystems.com/tags/worldwide-response-center-wrc
CC-MAIN-2020-50
refinedweb
103
87.52
"Getting a drive's serial number under Windows": there is no GlobalDosAlloc() or anything near, (GlobalAlloc cant do the job) and MK_FP as they think in dos.h not there? so if you can get it work, let me know. I also think that this should not be that involved, I thing I saw a function to read the disk volume serial no, but I am not sure. Any way let me know if you can work it. PSS ID Number: Q69223 Article last modified on 01-24-1995 5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50 MS-DOS | WINDOWS -------------------------- The information in this article applies to: - The C Run-time (CRT) included with: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -------------------------- SUMMARY ======= Beginning with MS-DOS version 4.0, a semi-random 32-bit binary identification number (ID) is assigned to each disk that MS-DOS formats. The volume serial number (or ID) is stored at offset 27H to 2AH in the boot sector of each disk. NOTE: code compiled with Visual C++ version 1.5 may yield the following message from Windows NT: An applicaion has attempted to directly access the hard disk, which cannot be supported. This may cause the application to function incorrectly. It provides Terminate and Ignore buttons. If the user is logged on with Administrative privileges, this will succeed for a FAT partition, else it fails for a FAT partition. It always fails for an NTFS partition. After clicking Terminate or Ignore the program returns with the error that has been coded (error on int 25). MORE INFORMATION ================ The following program illustrates how to retrieve this information: /************************* /* */ /* This program reads the volume serial number (or ID) from */ /* the boot sector of a specified disk. The DOS interrupt 25 */ /* Absolute Disk Read is used to read in the boot sector. */ /* */ /* Note: The volume ID is only implemented from MS-DOS 4.0 */ /* and later. */ /* */ /* The output consists of the OEM name and version of the */ /* disk-formatting program (stored at offset 03H to 0AH in the */ /* boot sector), the disk volume label, and the disk-volume */ /* serial number. */ /* */ /************************* #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dos.h> #include <conio.h> char bootsector[1024]; char volume[12]; char ver[9]; char block[10]; void main(void) { int ax, _far *p, drive; struct find_t fileinfo; char filename[13], _far *myvar, _far *q; union REGS inregs, outregs; struct SREGS segregs; printf("Enter drive number (0=A,1=B,2=C, ...): "); drive = getche() - '0'; /************************* /* Parameter block for int 25H */ /* Bytes Description */ /* ------- ----------- */ /* 00H-03H 32-bit sector number */ /* 04H-05H Number of sectors to read */ /* 06H-07H Offset of buffer */ /* 08H-09H Segment of buffer */ /************************* block[0] = block[1] = block[2] = block[3] = 0; block[4] = 1; block[5] = 0; myvar = bootsector; p = (int *)&block[6]; *p = FP_OFF(myvar); p = (int *)&block[8]; *p = FP_SEG(myvar); q = block; inregs.h.al = (char)drive; inregs.x.cx = -1; inregs.x.bx = FP_OFF(q); segregs.ds = FP_SEG(q); ax = int86x(0x25, &inregs, &outregs, &segregs); /*** Error routine ***/ if (outregs.x.cflag) { printf("\n\nerror on int 25\n"); printf("this is AX:%04X", ax); exit(-1); } /*** Output ***/ printf("\n\nDrive %c\n-------\n\n", drive +'A'); strncpy(ver, &bootsector[3], 8); printf("OEM name and version: %s\n", ver); /* Use _dos_findfirst for the volume label */ filename[0] = (char)(drive + 'A'); filename[1] = '\0'; strcat(filename, ":\\*.*"); if(!_dos_findfirst(filenam printf("Volume name : %s\n", fileinfo.name); /* Before printing serial number, check if version >= 4.x */ if ((ver[6] == '.') && (ver[5] >= '4') && (ver[5] <= '9')) printf("Serial number : %02X%02X-%02X%02X\n\n", (unsigned char) bootsector[0x2a], (unsigned char) bootsector[0x29], (unsigned char) bootsector[0x28], (unsigned char) bootsector[0x27]); } Additional reference words: kbinf 5.10 6.00 6.00a 6.00ax 7.00 1.00 1.50 KBCategory: kbprg KBSubcategory: CRTIss ========================== Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions. and it says we can use GeVolumeInformation() API to get disk volume information, if you can try this and see if you get the same serial no of the disk, please let me know asap. thanks. the serial no. it is given (randomly !) when the disk is formatted. if not so please let me know. thanks
https://www.experts-exchange.com/questions/10036632/3-5-'-floppy-disk-serial-number.html
CC-MAIN-2018-17
refinedweb
746
66.74
Either Scala. val throwsSomeStuff: Int => Double = ??? val throwsOtherThings: Double => String = ??? val moreThrowing: String => List[Char] = ??? val magic = throwsSomeStuff.andThen(throwsOtherThings).andThen(moreThrowing) Assume we happily throw exceptions in our code. Looking at the types, any of those functions can throw any number of exceptions, we don’t know. When we compose, exceptions from any of the constituent functions can be thrown. Moreover, they may throw the same kind of exception (e.g. IllegalArgumentException) and thus it gets tricky tracking exactly where that exception came from. How then do we communicate an error? By making it explicit in the data type we return. Either Either vs Validated In general, Validated is used to accumulate errors, while Either is used to short-circuit a computation upon the first error. For more information, see the Validated vs Either section of the Validated documentation. Syntax In Scala 2.10.x and 2.11.x, Either is unbiased. That is, usual combinators like flatMap and map are missing from it. Instead, you call .right or .left to get a RightProjection or LeftProjection (respectively) which does have the combinators. The direction of the projection indicates the direction of bias. For instance, calling map on a RightProjection acts on the Right of an Either. val e1: Either[String, Int] = Right(5) // e1: Either[String,Int] = Right(5) e1.right.map(_ + 1) // res0: scala.util.Either[String,Int] = Right(6) val e2: Either[String, Int] = Left("hello") // e2: Either[String,Int] = Left(hello) e2.right.map(_ + 1) // res1: scala.util.Either[String,Int] = Left(hello) Note the return types are themselves back to Either, so if we want to make more calls to flatMap or map then we again must call right or left. However, the convention is almost always to right-bias Either. Indeed in Scala 2.12.x Either is right-biased by default. More often than not we want to just bias towards one side and call it a day - by convention, the right side is most often chosen. In Scala 2.12.x this convention is implemented in the standard library. Since Cats builds on 2.10.x and 2.11.x, the gaps have been filled via syntax enrichments available under cats.syntax.either._ or cats.implicits._. import cats.implicits._ // import cats.implicits._ val right: Either[String, Int] = Right(5) // right: Either[String,Int] = Right(5) right.map(_ + 1) // res2: scala.util.Either[String,Int] = Right(6) val left: Either[String, Int] = Left("hello") // left: Either[String,Int] = Left(hello) left.map(_ + 1) // res3: scala.util.Either[String,Int] = Left(hello) For the rest of this tutorial we will assume the syntax enrichment is in scope giving us right-biased Either and a bunch of other useful combinators (both on Either and the companion object). Because Either is right-biased, it is possible to define a Monad instance for it. Since we only ever want the computation to continue in the case of Right, we fix the left type parameter and leave the right one free. Note: the example below assumes usage of the kind-projector compiler plugin and will not compile if it is not being used in a project. import cats.Monad implicit def eitherMonad[Err]: Monad[Either[Err, ?]] = new Monad[Either[Err, ?]] { def flatMap[A, B](fa: Either[Err, A])(f: A => Either[Err, B]): Either[Err, B] = fa.flatMap(f) def pure[A](x: A): Either[Err, A] = Either.right(x) @annotation.tailrec def tailRecM[A, B](a: A)(f: A => Either[Err, Either[A, B]]): Either[Err, B] = f(a) match { case Right(Right(b)) => Either.right(b) case Right(Left(a)) => tailRecM(a)(f) case l@Left(_) => l.rightCast[B] // Cast the right type parameter to avoid allocation } } Example usage: Round 1 As a running example, we will have a series of functions that will parse a string into an integer, take the reciprocal, and then turn the reciprocal into a string. In exception-throwing code, we would have something like this: object ExceptionStyle { def parse(s: String): Int = if (s.matches("-?[0-9]+")) s.toInt else throw new NumberFormatException(s"${s} is not a valid integer.") def reciprocal(i: Int): Double = if (i == 0) throw new IllegalArgumentException("Cannot take reciprocal of 0.") else 1.0 / i def stringify(d: Double): String = d.toString } Instead, let’s make the fact that some of our functions can fail explicit in the return type. object EitherStyle { def parse(s: String): Either[Exception, Int] = if (s.matches("-?[0-9]+")) Either.right(s.toInt) else Either.left(new NumberFormatException(s"${s} is not a valid integer.")) def reciprocal(i: Int): Either[Exception, Double] = if (i == 0) Either.left(new IllegalArgumentException("Cannot take reciprocal of 0.")) else Either.right(1.0 / i) def stringify(d: Double): String = d.toString } Now, using combinators like flatMap and map, we can compose our functions together. import EitherStyle._ def magic(s: String): Either[Exception, String] = parse(s).flatMap(reciprocal).map(stringify) With the composite function that we actually care about, we can pass in strings and then pattern match on the exception. Because Either is a sealed type (often referred to as an algebraic data type, or ADT), the compiler will complain if we do not check both the Left and Right case. magic("123") match { case Left(_: NumberFormatException) => println("not a number!") case Left(_: IllegalArgumentException) => println("can't take reciprocal of 0!") case Left(_) => println("got unknown exception") case Right(s) => println(s"Got reciprocal: ${s}") } // Got reciprocal: 0.008130081300813009 Not bad - if we leave out any of those clauses the compiler will yell at us, as it should. However, note the Left(_) clause - the compiler will complain if we leave that out because it knows that given the type Either[Exception, String], there can be inhabitants of Left that are not NumberFormatException or IllegalArgumentException. However, we “know” by inspection of the source that those will be the only exceptions thrown, so it seems strange to have to account for other exceptions. This implies that there is still room to improve. Example usage: Round 2 Instead of using exceptions as our error value, let’s instead enumerate explicitly the things that can go wrong in our program. object EitherStyle { sealed abstract class Error final case class NotANumber(string: String) extends Error final case object NoZeroReciprocal extends Error def parse(s: String): Either[Error, Int] = if (s.matches("-?[0-9]+")) Either.right(s.toInt) else Either.left(NotANumber(s)) def reciprocal(i: Int): Either[Error, Double] = if (i == 0) Either.left(NoZeroReciprocal) else Either.right(1.0 / i) def stringify(d: Double): String = d.toString def magic(s: String): Either[Error, String] = parse(s).flatMap(reciprocal).map(stringify) } For our little module, we enumerate any and all errors that can occur. Then, instead of using exception classes as error values, we use one of the enumerated cases. Now when we pattern match, we get much nicer matching. Moreover, since Error is sealed, no outside code can add additional subtypes which we might fail to handle. import EitherStyle._ // import EitherStyle._ magic("123") match { case Left(NotANumber(_)) => println("not a number!") case Left(NoZeroReciprocal) => println("can't take reciprocal of 0!") case Right(s) => println(s"Got reciprocal: ${s}") } // Got reciprocal: 0.008130081300813009 Either in the small, Either in the large Once you start using Either for all your error-handling, you may quickly run into an issue where you need to call into two separate modules which give back separate kinds of errors. sealed abstract class DatabaseError trait DatabaseValue object Database { def databaseThings(): Either[DatabaseError, DatabaseValue] = ??? } sealed abstract class ServiceError trait ServiceValue object Service { def serviceThings(v: DatabaseValue): Either[ServiceError, ServiceValue] = ??? } Let’s say we have an application that wants to do database things, and then take database values and do service things. Glancing at the types, it looks like flatMap will do it. def doApp = Database.databaseThings().flatMap(Service.serviceThings) This line will compile and work as expected, no matter if you’re on 2.12 or an earlier version of Scala. The flatMap we get here (either provided by Cats’s Either syntax for Scala 2.10 and 2.11, or, in Scala 2.12, a method on Either) has this signature: def flatMap[AA >: A, Y](f: (B) => Either[AA, Y]): Either[AA, Y] This flatMap is different from the ones you’ll find on List or Option, for example, in that it has two type parameters, with the extra AA parameter allowing us to flatMap into an Either with a different type on the left side. This behavior is consistent with the covariance of Either, and in some cases it can be convenient, but it also makes it easy to run into nasty variance issues - such as Object being inferred as the type of the left side, as it is in this case. Solution 1: Application-wide errors We may then be tempted to make our entire application share an error data type. sealed abstract class AppError final case object DatabaseError1 extends AppError final case object DatabaseError2 extends AppError final case object ServiceError1 extends AppError final case object ServiceError2 extends AppError trait DatabaseValue object Database { def databaseThings(): Either[AppError, DatabaseValue] = ??? } object Service { def serviceThings(v: DatabaseValue): Either[AppError, ServiceValue] = ??? } def doApp = Database.databaseThings().flatMap(Service.serviceThings) This certainly works, or at least it compiles. But consider the case where another module wants to just use Database, and gets an Either[AppError, DatabaseValue] back. Should it want to inspect the errors, it must inspect all the AppError cases, even though it was only intended for Database to use DatabaseError1 or DatabaseError2. Solution 2: ADTs all the way down Instead of lumping all our errors into one big ADT, we can instead keep them local to each module, and have an application-wide error ADT that wraps each error ADT we need. sealed abstract class DatabaseError trait DatabaseValue object Database { def databaseThings(): Either[DatabaseError, DatabaseValue] = ??? } sealed abstract class ServiceError trait ServiceValue object Service { def serviceThings(v: DatabaseValue): Either[ServiceError, ServiceValue] = ??? } sealed abstract class AppError object AppError { final case class Database(error: DatabaseError) extends AppError final case class Service(error: ServiceError) extends AppError } Now in our outer application, we can wrap/lift each module-specific error into AppError and then call our combinators as usual. Either provides a convenient method to assist with this, called Either.leftMap - it can be thought of as the same as map, but for the Left side. def doApp: Either[AppError, ServiceValue] = Database.databaseThings().leftMap[AppError](AppError.Database). flatMap(dv => Service.serviceThings(dv).leftMap(AppError.Service)) Hurrah! Each module only cares about its own errors as it should be, and more composite modules have their own error ADT that encapsulates each constituent module’s error ADT. Doing this also allows us to take action on entire classes of errors instead of having to pattern match on each individual one. def awesome = doApp match { case Left(AppError.Database(_)) => "something in the database went wrong" case Left(AppError.Service(_)) => "something in the service went wrong" case Right(_) => "everything is alright!" } Working with exception-y code There will inevitably come a time when your nice Either code will have to interact with exception-throwing code. Handling such situations is easy enough. val either: Either[NumberFormatException, Int] = try { Either.right("abc".toInt) } catch { case nfe: NumberFormatException => Either.left(nfe) } // either: Either[NumberFormatException,Int] = Left(java.lang.NumberFormatException: For input string: "abc") However, this can get tedious quickly. Either has a catchOnly method on its companion object (via syntax enrichment) that allows you to pass it a function, along with the type of exception you want to catch, and does the above for you. val either: Either[NumberFormatException, Int] = Either.catchOnly[NumberFormatException]("abc".toInt) // either: Either[NumberFormatException,Int] = Left(java.lang.NumberFormatException: For input string: "abc") If you want to catch all (non-fatal) throwables, you can use catchNonFatal. val either: Either[Throwable, Int] = Either.catchNonFatal("abc".toInt) // either: Either[Throwable,Int] = Left(java.lang.NumberFormatException: For input string: "abc")
https://typelevel.org/cats/datatypes/either.html
CC-MAIN-2019-13
refinedweb
2,014
50.02
Red Hat Bugzilla – Bug 998465 Review Request: perl-true - Automatically return a true value when a file is required Last modified: 2013-08-30 18:59:16 EDT Spec URL: SRPM URL: Description: Perl's require built" behavior so that it need not be written explicitly. It can be used directly, but it is intended to be invoked from the import method of a Modern::Perl-style module that enables modern Perl features and conveniences and cleans up legacy Perl warts. Fedora Account System Username: pghmcfc Package Review ============== Key: [x] = Pass [!] = Fail [-] = Not applicable [?] = Not evaluated ===== MUST items ===== Generic: [ ]:: perl-true-0.18-2.fc21.x86_64.rpm perl-true-debuginfo-0.18-2.fc21.x86_64.rpm perl-true-0.18-2.fc21.src.rpm perl-true.x86_64: W: spelling-error %description -l en_US sequitur -> requiter perl-true.src: W: spelling-error %description -l en_US sequitur -> requiter 3 packages and 0 specfiles checked; 0 errors, 2 warnings. Rpmlint ok $ rpm -qp --provides ../results/perl-true-0.18-2.fc21.x86_64.rpm | sort | uniq -c 1 perl(true) = 0.18 1 perl(true::VERSION) = 0.18 1 perl-true = 0.18-2.fc21 1 perl-true(x86-64) = 0.18-2.fc21 Provides ok $ rpm -qp --requires ../results/perl-true-0.18-2.fc21.x86_64.rpm | sort | uniq -c 1 libc.so.6()(64bit) 1 libc.so.6(GLIBC_2.2.5)(64bit) 1 libperl.so.5.18()(64bit) 1 perl(:MODULE_COMPAT_5.18.1) 1 perl(B::Hooks::OP::Annotation) 1 perl(B::Hooks::OP::Check) 1 perl(Devel::StackTrace) 1 perl(XSLoader) 1 perl(strict) 1 perl(true)) Requires ok MD5-sum check ------------- : CHECKSUM(SHA256) this package : ff3d041eb2a522ec6194d7a3888325e8a3ef2238ab51452f0b547696be0b4594 CHECKSUM(SHA256) upstream package : ff3d041eb2a522ec6194d7a3888325e8a3ef2238ab51452f0b547696be0b4594 Package is good. Approved New Package SCM Request ======================= Package Name: perl-true Short Description: Automatically return a true value when a file is required Owners: pghmcfc Branches: F-19 F-20 InitialCC: perl-sig Thanks for the review Jitka. Git done (by process-git-requests). perl-true-0.18-2.fc19 has been submitted as an update for Fedora 19. perl-true-0.18-2.fc19 has been pushed to the Fedora 19 testing repository. perl-true-0.18-2.fc19 has been pushed to the Fedora 19 stable repository.
https://bugzilla.redhat.com/show_bug.cgi?id=998465
CC-MAIN-2018-26
refinedweb
371
51.95
On Friday 10 September 2010 11:29:56, Ryan Prichard wrote: > Hi, > > I see a stack overflow with this code, but I don't understand why. Neither do I, really, but ghc is being too clever for its own good - or not clever enough. > > I looked at the Core output with ghc-core, with or without > optimizations, and I see a $wlgo recursive function that doesn't appear > to end in a tail call. Without optimisations, I see a nice tail-recursive lgo inside foldl'2, pretty much what one would like to see. With optimisations, you get a specialised worker $wlgo: Rec { Main.$wlgo :: [GHC.Types.Int] -> (##) GblId [Arity 1 NoCafRefs Str: DmdType S] Main.$wlgo = \ (w_sms :: [GHC.Types.Int]) -> case case w_sms of _ { [] -> GHC.Unit.(); : x_adq xs_adr -> case x_adq of _ { GHC.Types.I# _ -> case Main.$wlgo xs_adr of _ { (# #) -> GHC.Unit.() } } } of _ { () -> GHC.Prim.(##) } end Rec } and it's here that ghc shows the wrong amount of cleverness. What have we? At the types () and [Int], with f = flip seq, the step in lgo unfolds to lgo z (x:xs) ~> let z' = f z x in lgo z' xs ~> case f z x of z'@() -> lgo z' xs ~> case (case x of { I# _ -> z }) of z'@() -> lgo z' xs Now flip seq returns its first argument unless its second argument is _|_ and () has only one non-bottom value, so the ()-argument of lgo can be eliminated (here, the initial ()-argument is known to be (), in general the wrapper checks for _|_ before entering the worker), giving wlgo :: [Int] -> () wlgo [] = () wlgo (x:xs) = case (case x of { I# _ -> () }) of () -> wlgo xs It would be nice if the compiler rewrote the last equation to wlgo (x:xs) -> case x of { I# _ -> wlgo xs } , but apparently it can't. Still, that's pretty good code. Now comes the misplaced cleverness. Working with unboxed types is better (faster) than working with boxed types, so let's use unboxed types, giving $wlgo the type [Int] -> (##) (unboxed 0-tuple). But it wasn't clever enough to directly return (# #) in the case of an empty list - that would've allowed the core to be \ (w_sms :: [GHC.Types.Int]) -> case w_sms of _ { [] -> GHC.Prim.(##) : x_adq xs_adr -> case x_adq of _ { GHC.Types.I# _ -> Main.$wlgo xs_adr } } and all would've been fine and dandy. So it chose [] -> GHC.Unit.() and that forced the second branch to also have that type, hence you can't have a tail call there but have to box the result of the recursive call (only to unbox it again). So you get superfluous boxing, unboxing, reboxing in addition to a stack- eating recursion. But you've hit a rare case here, if you use foldl'2 (flip seq) at a type with more than one non-bottom value, the first argument of lgo is not eliminated and you don't get the boxing-unboxing dance, instead you get a nice tail-recursion, even if foldl'2 is used only once and not exported. Why GHC does that for (), beats me. >. Perhaps ? > > 2. Instead of using the __GLASGOW_HASKELL__ version of foldl', use the > other version: > > foldl' f a [] = a > foldl' f a (x:xs) = let a' = f a x in a' `seq` foldl' f a' xs But that needs to pass also the function, which is generally slower than having it as a static argument. 3. {-# NOINLINE foldl'2 #-} But that's not so good for performance in general. Option 1 gives the best Core, but it changes behaviour, with that, foldl' (\_ _ -> 1) undefined [0] = 1 foldl'2 (\_ _ -> 1) undefined [0] = _|_ To retain the behaviour of foldl', foldl'2 f z0 xs0 = case xs0 of [] -> z0 (x:xs) -> lgo (f z0 x) xs where lgo !z [] = z lgo z (y:ys) = lgo (f z y) y. That's probably a different matter, foldl' evaluates the accumulation parameter only to weak head normal form, if it's not of simple type, it can still contain thunks that will overflow the stack when demanded. > > I might have fixed my original stack overflow problem. I was applying > sum to a large list of integers, and sum is lazy. For [Int] and [Integer], sum is specialised, so when compiled with optimisations, ghc should use a strict version for those types. > I don't think I have > any real code anymore that overflows the stack, but I'm uncomfortable > because I don't know why my test case doesn't work. > > Is the foldl' call in my test case allowed to have linear stack usage? I don't think the language definition treats that, so technically it's allowed then. But it shouldn't happen. > > Thanks, > -Ryan
http://www.haskell.org/pipermail/beginners/2010-September/005293.html
CC-MAIN-2014-42
refinedweb
798
69.82
Hi all! I'm prototyping a new language with Haskell. Here's the overview - The Feather Programming Language is a 'language-oriented' programming language. It is intended to expose a blend of imperative, functional, object-oriented, and language-oriented programming paradigms in one simple, machine-efficient and general purpose language. It is a static language with a Hindley-Milner type-inferencing algorithm, but has optional dynamic resolution using H-M inferencing as well (perhaps using staged compilation as referenced in the post later in this thread). The 'language orientation' paradigm is what makes the optional dynamic binding so important. Run-time semantics-wise, it's quite similar with Common Lisp and Scheme. Feather has two syntaxes - sexp and mexp, with the latter being used by default and being translated to sexp for macro processing. Sexp syntax is available only in the symbolic context (mentioned later). Macro processing is what makes the direct translation to sexp so important. ---- Syntaxes - Here's the sexp syntax. It is sensitive only to newline whitespace - // {method {double x {}} ' {multiply x 2}}} {define {method {factorial n {}} {if {lessEqual n 1} 1 {multiply n {factorial {minus n 1}}}}}} {define {method {fibinocciFast n {}} {if {less n 2} n {fibinocciUp n 2 1 0}}}} {define {method {fibinocciUp max {count x y}} {if {equal max count} {add x y} {fibinocciUp max {add count 1} {add x y} x}}}} {define {function {selectExample {} {x y}} {select x 0 -> {add x 1} 1 -> {add x y} otherwise -> {time x y}}}} {quote 1} // get rid of this since ` is available in sexp? {instantiate Person "Jim"} {instantiate List `{1 2 3}} {instantiate AssociationList `{{a 3} {b 6}}} {instantiate Vector `{1 2 3}} {instantiate Tuple `{1 2 3}} {instantiate HashSet `{1 2 3}} {instantiate HashDictionary `{{a 3} {b 6}}} {add -5 {multiply 4 2}} {multiply 5 {add 4 2}} {add 5 {abs {multiply 4 2}}} {add 1 {add v1 {cross v2 v3}}} {char c} // character literal "string" // string literal {list} unit {cons 1 {list 2}} {lambda {add _ 5}} {equal x 5} {assign x 5} {equal {cons x ys} {1 2}} {assign {cons x ys} {1 2}} {generateRange x y} {listComprehension {{x <- someList} {y <- {generateRange 1 5}} {odd y} {multiply x y}}} {filter {lambda {odd _}} {map {lambda {add _ 1}} {list {3 4 5 6}}}} {norm {cross {v1 v2}}} {conditional x {consequentAlternate y z}} {lamda {multiply _ {add _ 5}}} {lamda x {multiply x {add x 5}}} {lamda {x y} {multiply x {add x y}}} {bitOr x 0xff} {bitAnd x 0xdd} {bitShiftRight x 1} {asDestructure x {List Int}} {dynamicExpression {add 1 1}} {staticExpression {add 1 1}} {lazyExpression {add 1 1}} {strictExpression {add 1 1}} {parallelExpression ...} {memoizedExpression {multiple n m} {message jim {jump 5}} {message {jim sue} {walk 10}} {power n 2} {compose f g} Here's the meta syntax that maps one-to-one sexp syntax. It is column-sensitive as well as newline-sensitive. The column sensitivity is what makes the command: syntax work without need a special end-scope operator. Meta syntax is transformed to sexp syntax before macro processing. This code is the mexp mirror of the sexp code above, and you can deduce the mapping mechanics yourself - //: x.double() ' x * 2 // normally non-side-effecting, parameter-less methods should be getter properties instead define: n.factorial() if: n <= 1 1 n * (n - 1).factorial() define: n.fibinocciFast() if: n < 2 n n.fibinocciUp(2, 1, 0) define: max.fibinocciUp(count, x, y) if: max = count x + y max.fibinocciUp(count + 1, x + y, x) define: selectExample(x, y) select: x 0 -> x + 1 1 -> x + y otherwise -> x * y `1 Person("Jim") // Person.constructor(String) gets the ctor with a String parameter $[1, 2, 3] // $ introduces a single character special symbol or multi-character alpha string symbol. Reserved for language designer. NOTE: List is a monad, btw. $c[[a, 3] [b, 6]] // $a reserved for arrays if the language gets them $v[1, 2, 3] $t[1, 2, 3] $s[1, 2, 3] $d[[a, 3] [b, 6]] 4 * 2 + -5 // -5 and - 5 have different meaning due to white space (4 + 2) * 5 // fn (x) and fn(x) have different meaning due to white space (4 * 2).abs + 5 // abs is a property (more on this later) v2.cross(v3) + v1 $:c "string" $[] unit 1 :: $[2] \_ + 5 x = 5 x := 5 x :: ys = z // equality x :: ys := z // pattern match assignment x..y $(x <- someList, y <- 1..5, y.odd, x * y) // also implements pattern match binding for discrimination like Haskell $[3, 4, 5, 6].map(\_ + 1).filter(\_.odd) v1.cross(v2).norm x ?? y !! z // the ?? !! operators do not use distfixity or special-case evaluation. instead, the !! operator produce a lazy expression pair that the ?? operator then destructures and uses one of its members depending on its result. \_ * _ + 5 // preferred when individual lambda parameters are not used multiple times x ~> x * x + 5 // lambda with one parameter, x [x, y] ~> x * x + y // lambda with two parameters, x and y x .' 0xff // bit operators start with '.' to reserve the C-style symbols for other operators. No characters in a hex literal can be capitalized (including the 'x' separator) x .& 0xdd x .>> 1 List Int >> x // like for naming a pattern in a pattern match expression $dynamic 1 + 1 $static 1 + 1 $lazy 1 + 1 // use lazy evaluation for a pure expression $strict 1 + 1 // use strict evaluation $parallel ... // parallelize a pure expression $memoized n * m // memoize a pure expression jim <' jump(5) // agent message [jim, sue] <' walk(10) // message to multiple agents n ^ 2 f & g ---- Note that the translation from mexp to sexp is purely syntactic, but some semantic checking must take place after the transformation using a map from the sexp back to the mexp. An example of semantic check that must be done is that the method.call(syntax) is used on method calls or method signatures only (and only said syntax is used). ---- All symbol resolution in the lexical scope of 'static' will be resolved statically (that is, when the code is compiled). All resolution in the 'dynamic' scope will be resolved dynamically (that is, when the code is executed). The default scope when none is specified is 'static'. Static typing is not only intended for safety, but also forcing as many possible program decisions to compile time where possible in order to achieve maximum run-time efficiency. static:> define: n.fibinocciFast() if: n < 2 n n.fibinocciUp(2, 1, 0) dynamic:> define: max.fibinocciUp(count, x, y) if: max = count x + y max.fibinocciUp(count + 1, x + y, x) ---- This is an overview of the definition commands - {listed in order of likely implementation} define: x -> 10.0 // define x as a Float of value 10. binding is scoped. A define of the same symbol never changes the underlying symbol, but shadows it instead. define: fn(x) ' expression // define a function define: c.md(x) ' expression // define a method. A single context variable is required define: co: x y; ' expression // define a command like the let and if commands define: x bi y p a ' expression // define a binary operator like + and - with p precedence with a associativity. Precedence is part of a binop's type, and should probably be some sort of fractional number define: le x ' expression // define a left operator define: x ri ' expression // define a right operator... not sure how this would be used :) define: c.prop ' get x ' set x := value // define property lambda... // create a lambda. Callable as a function only methlambda... // create a methlambda. like lambda, but used to pass methods. callable as a method only comlambda... // create a comlambda. like lambda, but used to pass commands. callable as a command only bilambda... // create a bilambda. like lambda, but used to pass binops. callable as a binop only leflambda... // create a leflambda. like lambda, but used to pass leftops. callable as a leftop only rilambda... // create a rilambda. like lambda, but used to pass rightops. callable as a rightop only proplambda... // create a proplambda. callable as a property only let: x -> 7 ' expression // define a value over an expression. values cannot be set. let: x -> var 7 ' expression // define a variable over an expression. variables can be set let: [x -> 7, y -> var 5] ' expression // define multiple items over an expression. sequential like lisp let* macro: y -> 5 // macro expands to expression macro... // define a scheme-style hygienic macro. Invoked like a function. macro... // like a macro, but invoked like a method macro... // like a macro, but invoked like a command macro... // like a macro, but invoked like a binop macro... // like a macro, but invoked like a leftop macro... // like a macro, but invoked like a rightop macro... // like a macro, but invoked like a property [functional types] synonym... // like Haskell type derivative... // like Haskell newtype typeConstructor... // like Haskell data typeClass... // like Haskell class typeInstance... // like Haskell instance [object system - could be done after the prototype] class... // class like in CLOS, but without the generality of a MOP. Ideally implemented as a library. [agent system - could be done after the prototype] agent... // agents are like arbitrarily parallelizable objects lazy x // marks a parameter (here x) as lazy-evaluated. This is a nice, simple substitute for some macros. A leftop. ---- Error handling - Uses a system similar to scheme's Condition system. ---- Literal numbers are Int by default - 5(u)b // (U)Byte - 8-bit 5(u)s // (U)Short - 16-bit 5(u) // (U)Int - 32-bit 5(u)i2 // (U)Int2 - 64-bit 5(u)i3 // (U)Int3 - 128-bit 5.0 // Float - 32-bit 5f2 // Float2 - 64-bit 5f3 // Float3 - 128-bit 5n // Similar to Scheme numbers - no specific size. Does not implicitly mix with the strictly-sized numbers in any way. This can probably be implemented after the prototype. 5(u)m // (U)Macint – Machine-size integer ---- The Universal type - All primitives, data types, and the base object type have an instantiation of the type class Universal which has the following properties - x.shown // printable string x.bytes // serializable bytes x.type This allows you to put a number, a string, and an object into a single, well-typed List of Universal. ---- Function type arrows – Function type arrows can use the same arrows as used elsewhere because types are always interpreted in a different context that normal expressions. -> - Describes a function of inferred, unspecified, or dependent purity => - Describes a pure function :> - Describes an impure function ---- Type signatures of a function called 'double' from x to x where x is a Number - double @ x.method() => x '> Number x double @ command: x; => x '> Number x double @ leftop x => x '> Number x double @ x rightop => x '> Number x double @ x.property => x '> Number x // all generalize to... double @ x => x '> Number x // as well as... x => x '> Number x ---- Here is the type of map: map @ r a.method(a -> b) -> r b '> Functor r NOTE: since Vector is not a Functor, it must be converted to a List before being used with map, possibly with a simple list property. ---- Miscellanea - Some code examples... define: selectExample(x, y) select: x 0 -> x + 1 1 -> x + y otherwise -> x * y // switch is like select, but requires hash and = type class instantiation, and is constant-time define: switchExample(x, y) switch: x 0 -> x + 1 1 -> x + y otherwise -> x * y define: chooseExample(x, y) choose: x = 0 -> x + 1 y = 1 -> x + y otherwise -> x * y // a function with a match command as the first expression can be compiled to one function for each statically-determinable match case and have the caller bound to the right one at compile time define: matchExample(m, n) match: m // a pattern expression (EG - x :: xs) does not have access to outside variables, like m or n. otherwise it could accidentally pull globals or the like x :: xs -> x // where m is x :: xs, x $t[x, x, ?] -> x // where m is $t[x, x, ?], x 5 -> m // where m equals 5, m otherwise -> n // n define: multiMatchExample(m, n) match: [m, n] [x :: xs -> x, x] -> n // where m is x :: xs and n equals x, n otherwise -> 0 define: matchChainExample(m, n) match: m x :: xs -> x = 5 -> n // where m is x :: xs and x equals 5, n otherwise -> 0 // for step comprehension like lisp progn define: stepsExample() steps: // not redundant since function definitions do NOT have implicit steps "Hi, ".print() "I am ".print() "Daisy!\n".print() // for applicative comprehension define: apsExample(x, y) aps: lift(add) $[2, 3, 4] lift(4) // shorhand for applicative comprehension ${lift(add), $[2, 3, 4], lift(4)} // for monad comprehension define: doExample(x, y) do: x <- f(0) y <- g(1) lift($t[x, y]) // QUESTION: can list comprehensions be shorthand for do syntax? meta: expressions // specifies the enclosed expressions may not use '{' or '}' sexp symbols. Prevents the two syntaxes from being used together unnecessarily. Functions may only be called with the x.y(z) notation and commands can only be called with the x: y notation (and so on for the operators). symbolic: expressions // specifies the expressions may not use (, ), [, ], ',', :, etc. or infix operators. pretty: expressions // disallows arbitrary white spacing / formatting so that all code looks roughly the same no matter the author. ` is quote, ' is unquote, and $' is dollarQuote (like lisp at-quote). ...rest // the rest parameters with name rest import:> // very similar to Haskell's import, but much simpler and less error prone Module.thing // qualifies thing with module name. If . is ambiguous, we could use Module/thing instead. /// <Summary>Documentation comments are done almost exactly the same as in C#, except you can aim a comment from one place to a program element in another using a <Target> tag.</Summary> RULE: all expressions should be readable from left to right and top to bottom (with some exceptions like f & g). RULE: you can run any pure code at compile-time (define: for example is pure as it can never side-effect since it shadows). RULE: there are 3 types of function purity – pure, impure, and dependent. Only higher order functions can be dependent. A dependent function resolves to pure or impure depending on how it is invoked. If one or more of its incoming functors is impure, it becomes impure. Otherwise, its purity depends on whether it calls other impure functions. RULE: immutability always cascades down with recursive structures. You cannot have an immutable variable that is bound to a mutable list or an immutable list of mutable lists. RULE: All module, type, typeClass, class, and type / data constructor names start with an uppercase letter. This makes pattern matching much easier to use. RULE: Feather is a single namespace language with lexical scoping. No special symbol affixation is needed to pass a function - just mention it by name. RULE: nearly all functions must come from a module to be used, including operators on primitive types. This allows DSLs to avoid exposing operations that are not useful. RULE: the only time you need to qualify a name with the module is when it collides with another imported name. RULE: each implementation of Feather must have a self-compatible binary representation of all its objects. This allows entire object trees to be burned to disk (or ROM) and be reified directly back into memory to avoid the need for a serialization process, reflection-based or otherwise. RULE: operator precedence and associativity is the same as in C, but the flawed associativety of .& and .' will be fixed up. RULE: since this author despises noise in code, the compiler will warn about superfluous parenthesis / brackets, and give an error in pretty mode. Same for tabbed out // with no matching tabbed out // on adjacent lines. RULE: Like python and its recommended 'pythonic' style philosophy, there is a similar recommended philosophy in Feather. In Feather, there is always a single best way to do any one thing, and it should be obvious. This won't always be achievable, but is a good language goal. ---- So, anyways, that's the design so far. I ultimately hope I can get C-style programmers to consider using it. If anyone see any big holes in it or has any feedback, please discuss it here. ---- Another immediate question I have as a language implementer is, how do most language implementers fund their projects? I will be developing this language slowly over time, but I'd like to find some way to move it forward faster. Are there any companies out there that are interested in this type of project? If this language makes as much sense as I think it does, it might be timed just right to serve the growing interest in efficient, object-oriented, functional and 'language oriented' programming. Thread Closed This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.
https://channel9.msdn.com/Forums/Coffeehouse/Prototyping-New-Language-With-Haskell
CC-MAIN-2015-18
refinedweb
2,831
55.54
Post your Comment PHP Merge Array PHP Merge Array How to merge array's in PHP php merge files php merge files Split and merge files in PHP Classes array_merge null - PHP array_merge null i am using the array_merge and getting the unusual null error...any help merge two war files merge two war files how to merge two war files using maven merge two war files merge two war files How to merge two war files using maven??? is there any command Hibernate Merge In this section, you will learn about merge( ) method of Hibernate. Also the Difference between merge( ) and update( ) methods array_merge null - PHP array_merge null i am using the array_merge and getting the unusual null error...any help? Hi Friend, Please visit the following links: Merge databases in SQL SErver 2005 Merge databases in SQL SErver 2005 Please help me to merge databases in SQL server 2005 Merge XYLine and XYArea Charts Merge XYLine and XYArea Charts I wonder how to merge two charts and display on one frame. I have managed to create 'bell-curve'(Normal distribution) through JFreeChart with XYLine. However, I would like some part to be 'shaded merge sorting in arrays - Java Beginners merge sorting in arrays Write a program to insert string or characters to an array and apply merge sorting on this array Hi Friend, Please visit the following link: Merge Sort String Array in Java Merge Sort String Array in Java Hello, I am trying to implement a merge sort algorithm that sorts an array of Strings. I have seen numerous examples of merge-sorting integers but i can not understand how to this with String Struts2.2.1 merge Tag Example openJPA - Why merge is doing an insert openJPA - Why merge is doing an insert Why merge on the parent class is doing an insert instead of update? Also, if I try to persist a child, it tries to insert in the parent. The primary key already exists in the parent. Any PHP Array Merge In php two or more arrays can be added into a single array It is done by the use of array_merge() function Example of PHP Array Merge Function <?php $array1=array(1,2,3); $array2=array(4,5,6); $array3=array_merge array_merge function in php - PHP array_merge function in php What is the best use of array_merge function in php? Hi Friend, Please visit the following links: http How to merge two word document using java How to merge two word document using java how to merge two word document using java Java Merge Array Java Merge Array You all are aware of Arrays, their structure, declaration... with an example. In the given code, we have created a method 'merge()' where we have... to the method merge(int []...arr) indicates that you can merge number of arrays Mysql Merge Mysql Merge Mysql Merge Statement is used to merge the two sql statement using... queries. Understand with Example The Tutorial covers you an example in 'Mysql Mysql Merge Mysql Merge Mysql Merge Statement is used to merge the two sql statement using UNION clause.... Understand with Example The Tutorial covers you an example in 'Mysql Merge merge tables in sql using union merge tables in sql using union How to create a new table in database by merging two tables using union function in SQL? REATE TABLE new_table SELECT * FROM table1 UNION SELECT * FROM table2;   Java arraylist merge is joined in to the list1. Example Java Arraylist Merge import Merge Tag (Control Tags) Example Merge Tag (Control Tags) Example In this section, we are going to describe the merge tag. The merge tag is a generic tag that is used to merge iterators. The successive call to the merge Merge Sort In Java Merge Sort in Java  ... to sort integer values of an array using merge sort. In merge sorting.... Then merge both parts and sort it. Then again merge the next part and sort it. Do PHP Array Merge Recursive PHP Array Merge Recursive The PHP array_merge_recursive() function is same as the array_merge() function. It creates an array by appending each input array to the previous array. The main Difference between array_merge() and array_merge PHP Array Merge PHP Array Merge In many situations we have to merge two or more than two arrays, we need to use array_merge() function. This function merges or append... of array_merge() is: General Format array array_merge(array PHP GD Merge Image Post your Comment
http://www.roseindia.net/discussion/27029-Mysql-Merge.html
CC-MAIN-2015-11
refinedweb
746
66.07
For this example I'm designing a phone book that can have a person or a business. The person has a title, first name, last name, and a phone number. The business has a business name and a phone number. I created an abstract class with abstract method getName (This may sound really simplistic to you guys but bear with me!) public abstract class PhoneBook { private String phone; public boolean setPhone(String p) //final { boolean flag = false; if(p.length()!= 10) { flag = false; } for (int i = 0; i < p.length(); i++) { if(Character.isDigit(p.charAt(i))) { phone = p; flag = true; } } return flag; } public abstract String getName(); } My two subclasses are Person and Business. The person's getName method concatenates the title, f name, l name. In the main I created a PhoneBook array (abstract array) that can hold both a person or a business. I'm having difficulties with the output...how do I access getPhone (in the abstract class) to output it? This is the main (I'm currently only working on the person part) import javax.swing.*; public class PhoneBookEntries { public static final int MAX = 100; public static void main(String[] args) { PhoneBook[] phone = new PhoneBook[MAX]; int selection; int i = 0; do{ selection = Integer.parseInt(JOptionPane.showInputDialog("Would you like to add a\n1.person\n2.business\nto the phone book?")); switch(selection) { case 1: phone[i]= fillPerson(); break; case 2: phone[i] = fillBusiness(); break; } }while(i < MAX && JOptionPane.showConfirmDialog(null, "Add another entry to phone book?")==JOptionPane.YES_OPTION); [b]//output String output; output = phone[i].getName(); //how do i include the phone number? JOptionPane.showMessageDialog(null, output);[/b] } private static PhoneBook fillPerson() { Person someone = new Person(); someone.setTitle(JOptionPane.showInputDialog("Enter your title\n(Mr., Mrs., Ms., or Dr.)")); someone.setFName(JOptionPane.showInputDialog("Enter the first name of the person: ")); someone.setLName(JOptionPane.showInputDialog("Enter the last name of the person: ")); while(!someone.setPhone(JOptionPane.showInputDialog("Enter your 10 digit phone number: "))) JOptionPane.showMessageDialog(null, "Error. Please enter only 10 numerical values\n(examle: 7034567890"); return someone; } private static void fillBusiness() { } } getName I can easily access because I have PhoneBook[]. I was thinking I need a toString in Person to mush everything together (the while name and the phone number) but then in the main I can't access that toString because I don't have a Person instantiated? Sorry if this is confusing...I'm just typing out my (poor) train of thought...
http://www.dreamincode.net/forums/topic/276629-abstract-classes-and-outputs/
CC-MAIN-2017-34
refinedweb
409
51.04
01 July 2008 18:33 [Source: ICIS news] HOUSTON (ICIS news)--The ICIS Petrochemical Index (IPEX) soared to 349.84 in July, up 6.9% from the June reading of 327.32, as surging oil lifted values across global chemical markets. The July jump marks nine consecutive monthly increases, and was the biggest in percentage terms since an 11.5% jump in August 2004. It also echoes the steep spike in the two-month period in September and October of 2005, when the IPEX rose a combined 11.2% in the wake of hurricanes Katrina and Rita in the US Gulf. The steady upward march of crude oil, which has taken benchmark prices above $140/bbl for the first time, has yanked feedstock costs higher for chemical producers. In response to squeezed margins, producers have attempted to push through massive price hikes that have collided head-on with weakening economic conditions in the ?xml:namespace> The resulting forced reduction in operating rates and outright closure of some plants has exacerbated the upward push on prices by reducing supply. The global average prices of all 12 of the IPEX components rose in July, led by a 14.8% jump in butadiene. That was propelled by a spectacular 26.6% hike in Asian values, reflecting higher crude oil and naphtha costs as well as tightness in supply of feedstock crude C4. Styrene was another notable gainer, rising 7.2% globally as European values jumped 9.3% amid reduced operating capacity. Published at the beginning of each month, the IPEX provides an independent indicator of average change in world petrochemical prices. Dating back to January 1993, historical ICIS prices for a basket of essential petrochemical grades in the The IPEX product basket comprises ethylene, propylene, benzene, toluene, paraxylene, styrene, methanol, butadiene, PVC, polyethylene (PE), polypropylene (PP), and polystyrene (PS).
http://www.icis.com/Articles/2008/07/01/9136920/july-icis-ipex-index-up-6.9-as-feedstocks-soar.html
CC-MAIN-2015-18
refinedweb
306
56.66
I am trying to implement the online algorithm of this paper, which is on video classification. This work moves 1/8 of channel feature maps from each image, into the next image, after each convolution operation. The image of the operation has been attached here - While trying to implement the same, I have succeeded in extracting out the first 1/8 channel feature maps, but I don’t know how to add them to the succeeding image. My code has been attached below - import cv2 import gym import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torch.autograd as autograd import torch.nn.functional as F N = 1 # Batch Size T = 5 # Time Steps. This means that there are 5 frames in the video C = 3 # RGB Channels H = 144 # Height W = 144 # Width foo = torch.randn(N*T, C, H, W) print("Shape of foo = ", foo.shape) #torch.Size([5, 3, 144, 144]) class Net(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 8, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10) def forward(self, x): x = F.relu(self.conv1(x)) print("Shape of x = ", x.shape) # torch.Size([5, 8, 140, 140]) shape_extract = x[:, :1,:,:] print("Shape of extract = ", shape_extract.shape) # torch.Size([5, 1, 140, 140]) # 1/8 of the channels have been extracted out from above. But how do I transfer these channel features to the next image? return x net = Net() output = net(foo)
https://discuss.pytorch.org/t/how-to-move-feature-maps-across-images-using-slicing/130383
CC-MAIN-2022-33
refinedweb
283
70.19
David S. Miller wrote: [var = (var << 1) >> 1; ]> > So on Sparc there would be two options:> > 1) sethi %hi(0x80000000), %reg1> andn %ato, %reg1, %result> > 2) sll %ato, 1, %reg1> srl %reg1, 1, %resultDavid, I agree with you on the efficiency issues. The thing is code "costs"more in the maintenance phase than in the writing phase. So, making itreadable is important.If you write:#if 1/* Clearing bit 31 is faster on some architectures if you do it this way. At least it isn't slower. */#define CLEAR_BIT_31(var) var = (var << 1) >> 1#else/* But if you want to benchmark it, here is the classical implementation */#define CLEAR_BIT_31(var) var &= 0x7fffffff#endif var = CLEAR_BIT_31(var);everybody knows what you are doing without having to ask you.... Roger.-- ** R.E.Wolff@BitWizard.nl ** ** +31-15-2137555 ***-- BitWizard writes Linux device drivers for any device you may have! --* "I didn't say it was your fault. I said I was going to blame it on you."-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.rutgers.eduPlease read the FAQ at
http://lkml.org/lkml/2000/1/18/78
CC-MAIN-2016-07
refinedweb
190
72.97
Cache A reference to the Cache at the index specified. Returns the Cache at the given position in the cache list. using System.IO; using UnityEngine; public class Example : MonoBehaviour { void GetCacheAtExample() { Directory.CreateDirectory("Cache1"); Directory.CreateDirectory("Cache2"); Directory.CreateDirectory("Cache3"); Caching.AddCache("Cache1"); //Placed in cache list at position 1 Caching.AddCache("Cache2"); //Placed in cache list at position 2 Caching.AddCache("Cache3"); //Placed in cache list at position 3 Cache c0 = Caching.GetCacheAt(0); //The default cache Cache c1 = Caching.GetCacheAt(1); Cache c2 = Caching.GetCacheAt(2); Cache c3 = Caching.GetCacheAt(3); string path0 = c0.path; //The default cache string path1 = c1.path; string path2 = c2.path; string path3 = c3.path; } } Did you find this page useful? Please give it a rating:
https://docs.unity3d.com/2018.2/Documentation/ScriptReference/Caching.GetCacheAt.html
CC-MAIN-2020-10
refinedweb
124
56.32
Created on 2016-06-09 17:14 by ncoghlan, last changed 2016-09-20 21:57 by vstinner. This issue is now closed. This proposal competes directly with #27250, #27266, and #27279 as possible long term solutions to the Linux/systemd os.urandom deadlock bug described in #26839 Rather than adding new APIs, or making os.urandom potentially blocking on Linux (as it was in 3.5.0 and 3.5.1), it instead proposes that os.urandom immediately raise BlockingIOError if the kernel entropy pool has not yet been initialised. This behaviour will mean that users attempting to gather strong entropy too early in the Linux boot process will fail rather than block, so affected scripts and programs can readily fall back to reading from /dev/urandom or using the random module APIs if they don't need cryptographically strong random data. Scripts that do need cryptographically strong random data can either poll os.urandom until it succeeds, or else fail explicitly and let their caller resolve the problem. This proposal is reasonable to me and solves any problems I have with the default behavior of os.urandom. Quoting: The key advantage the BlockingIOError model offers is that it's trivial to build a blocking version as a busy loop around the non-blocking version: def urandom_wait_for_entropy(num_bytes): while True: try: return os.urandom(num_bytes) except BlockingIOError: pass And if you ignore the problem and just call os.urandom(), you'll almost certainly be fine unless you're working with Linux boot scripts or embedded ARM devices (in which case, this point will be minor compared to the other arcana you're dealing with). This idea is the PEP 522 which was superseded by the PEP 524 (accepted in Python 3.6) which proposed to make os.urandom() blocking.
https://bugs.python.org/issue27282
CC-MAIN-2021-21
refinedweb
300
55.34
Important: Please read the Qt Code of Conduct - Problem with disassembler and SIGILL signal Hi there , I'm coming here for some help since I saw that my programm is stopping in the middle of it's execution . Then I saw a SIGILL error just when I start my application . I was thinking that I could find where my problem is but I can't because it's openning the disassembler only and not my cpp or header file. How can I translate the disassembler language to find where is my corruption error ? thanks by advance. BTW I'm in debug mode. HI and welcome Did you compile the app as debug? Yes i'm in debug mode @Amaury So app should be compiled in debug mode and hence have debug information? You are seeing assembly as source is not there. That is often due to debugging a released version. To verify your debugger is working set a break point in your source and see it stop. well when I'm using abreak point in my main.cpp I see my app stopping when clicking on the play buton with the bug ( i'm on QT creator). I also see that my app is in debug and not in release mode. Yes it's popping on the break point and not showing me the disassembler again. So it sounds like where ever it crashes its not in your code and it shows assem as it have no source ? I don't know it sound like this yes , but it crashes at the starting point of my app, just showing my first window and then crashing. But when I just run my app it's starting normally and then crashing after a couple of minutes without any explications . That's why I need to debug, but if the problem is something out of the app I don't know how to deal with it. Hi Dont you have idea in where in the app it could be ? Or what action or processing that is going on when crashing. When it crash, did the call stack showed more info on where it was? "Viewing Call Stack Trace" Alright after setting a break point as you recommended I was using F10 to check if there's some code that was walling the SIGILL signal , I think I found where my problem is . That's my main :(); return a.exec(); All of this is running nice except when I'm trying to run (with F11 or f10 key ) the return a.exec() which giving the SIGILL signal Ps : I set the breakpoint first on w.show and then on the line bfore the return function. Hi I dont like the look of a.installTranslator(&qtTranslator); Since you give it address of a local variable. So if it thinks it owns the translator ( as expects a pointer) then it will be double deleted by "a" and by running out of scope. (after .exe()) Could you try to new it and see if it still crashes? update: Hmm Docs dont say it owns it. I have to say that I found this piece of code and just add it to my program since I had some pop-ups written in english ( I'm french). So is something like this that you mean by new it ? : QTranslator *qtTranslator = new QTranslator; qtTranslator.load( "qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath) ); a.installTranslator(&qtTranslator); return a.exec(); because I can't even copile like this ... hi yes except now its pointer, u must get rid of & a.installTranslator(qtTranslator); That's compiling but when I'm debugging it's still crashing at the same point ... SIGILL is very unusual, it often means the binary is corrupt (it's the illegal instruction signal). What compiler are you using? As for @mrjj's suggestion, you can still create on the stack, but do unregister the translator before returning from main(), e.g.: int main() { // ... QTranslator qtTranslator; qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&qtTranslator); int retcode = a.exec(); a.removeTranslator(&qtTranslator); return retcode; } I am using Gdb as debugger and Gcc as a compiler , I forget to precise that I was on a raspberry Pi 3. I would try your way and come back again. @Amaury Hi Ok. it was not the translator it seems. Do you have global object or anything else that might run out of scope and be deleted twice? You should try putting break point in mainwindow destructor and see if it gets to that part. I have a .h and .cpp named global Where I put 2 global variables as extern. Maybe it's the problem I'm Setting a point break on the Main window and sending you my global.h and global .cpp Global.h #ifndef GLOBAL_H #define GLOBAL_H #include <QString> QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE extern QString OnlinePath; extern int Var; #endif // GLOBAL_H Global.cpp `#include "global.h" #include <QString> QString OnlinePath= ""; int Var = 0; `` Are you sure that this compiler produces binaries for that particular instruction set? Look up the compatibility of your gcc version with the instruction set of that particular Pi. Hmm dont seems like it as just a Qstring. Its more if you have a widget and assign parent. Then both scope and parent might delete it and it might crash. Dont the call stack give hint what it was doing ? @kshegunov Sorry I didn't understand anything I'm not really used with the debuggers. @mrjj Hum I am associating widgets to a parent when using a QStackWidget for example I got my main window with some widgets in it. It the main ui of my application. I am adding some widgets in a QStackedWidget on the MainWindow and calling them by using their names . MainWindow MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //this->setWindowFlags(Qt::FramelessWindowHint); ui->setupUi(this); this->move(this->x(),this->y()); AccueilWindow = new Accueil(this,"AccueilWindow"); ui->stackedWidget->addWidget(AccueilWindow); ui->stackedWidget->setCurrentWidget(AccueilWindow); connect(this,SIGNAL(changeInterface(QString)),this,SLOT(changeOnglet(QString))); } void MainWindow::changeOnglet(QString name) { qDebug()<<name; if ((name == AccueilWindow->objectName())&&AccueilWindow) { ui->stackedWidget->setCurrentWidget(AccueilWindow); hide_full_ui(); show_ui(); return; } else if ((name == AlarmesWindow->objectName())&&AlarmesWindow) { ui->stackedWidget->setCurrentWidget(AlarmesWindow); show_ui(); return; } } Mainwindow.h private: Ui::MainWindow *ui; Accueil *AccueilWindow; Alarmes *AlarmesWindow; The alarm.cpp Alarmes::Alarmes(QWidget *parent,QString AlarmesWindow) : QWidget(parent), Alrm_ui(new Ui::Alarmes) { Alrm_ui->setupUi(this); this->setObjectName(AlarmesWindow); connect(this,SIGNAL(changeInterface(QString)),qobject_cast<MainWindow *>(parent),SLOT(changeOnglet(QString))); } alarm.h namespace Ui { class Alarmes; } class Alarmes : public QWidget { Q_OBJECT public: explicit Alarmes(QWidget *parent ,QString AlarmesWindow); virtual ~Alarmes(); Hi Nothing springs to eye. Seems you let the Qt system handle it. If you create a default Widgets project and run it on the pi. Does that also crash at close? If i delete the whole Qtranslator thing it seems that's not ceashing anymore , there just a message saying starting the debug and debug ended. I assume that's ok ... I didn't tried to let some other programm running to see if there's something but I didn't found any problems on an other application . Edit : It seems that other programs have no problem .. And I don't have any more troubles if my main.cpp is like :(); // a.removeTranslator(&qtTranslator); return a.exec(); } Ok Im not sure what to conclude from that :) But seems to be related to it anyway then. Yes I'm really not sure about it that's really pointing on this but don't know what's wrong ... I think I'm going to create some buttons that are written in my language instead of using the Qt popup default buttons. Thanks for help I'm closing this subject and put it as solved . See you in a close future I think ^^ Edit Seems to be the return a.exec() that is bugged don't know why ^^ @Amaury said in Problem with disassembler and SIGILL signal: Edit Seems to be the return a.exec() that is bugged don't know why ^^ For QApplication it has setting that says When last window closed, exit the event loop ( exec() ) and die. see app.setQuitOnLastWindowClosed(true); This is in effect sort of the same as app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); So if some sort of instruction that gets called when deconstructing then it will show exec() as the the point of crash. - SGaist Lifetime Qt Champion last edited by Hi, Out of curiosity, why are you removing the translator before starting the event loop ? Doing it like that raises the following question: why set a translator in the first place ? @SGaist I am removing the translator because it looked like that was this function that send the SIGILL signal . After all it seems that it doesn't changed anything, but I do need it , just that I can translate my pop-ups in a different way. @mrjj I'm going to look those potential solutions and post here if I get the answer. @Amaury It'd be helpful if you also extract the assembly (a few lines) from the point of the crash, where you get the SIGILL. Those are the first 15 lines of the disassembler where I get my Sigill signal : it happens on line 6 0x6f6a2dd4 00 00 00 00 andeq r0, r0, r0 0x6f6a2dd8 00 00 00 00 andeq r0, r0, r0 0x6f6a2ddc 00 00 00 00 andeq r0, r0, r0 0x6f6a2de0 fe e1 6e f2 vorr q15, q15, q15 0x6f6a2de4 1e ff 2f e1 bx lr 0x6f6a2de8 1d 0f 19 ee mrc 15, 0, r0, cr9, cr13, {0} 0x6f6a2dec 1e ff 2f e1 bx lr 0x6f6a2df0 9f 2f 90 e1 ldrex r2, [r0] 0x6f6a2df4 01 30 82 e0 add r3, r2, r1 0x6f6a2df8 93 2f 80 e1 strex r2, r3, [r0] 0x6f6a2dfc 00 00 52 e3 cmp r2, #0 0x6f6a2e00 fa ff ff 1a bne 0x6f6a2df0 0x6f6a2e04 03 00 a0 e1 mov r0, r3 0x6f6a2e08 1e ff 2f e1 bx lr Function: OPENSSL_cleanse Hi there , after a day of research I finnaly didn't found what's the real problem . I read that the return a.exec() Will execute only when a signal is send to it ( when nothing is shown). I maybe found a track that leads to my destructors , I have some sql request and QUrl posts in my program , ido I need to delete them in the destructor , would that cause a problem if the program is executed during a long time ? Everything is compiling fine and my program is running well but after a period of time it's crashing. Finally I was thinking about the SIGILL signal ,when I F10 or F11 on this it's running this part of the program but if it's closing everything on the app would it be normal to have this signal ? don't know if I was clear ... Hi SIGILL is not normal. From normal program errors you do not get this in any easy way. So the big question is. Can you can get SIGILL from a normal GUI program or only when using your full code? It might be some sort of corruption but impossible to guess at :) I didn't tried that but it works with another program I don't have any SIGILL error ... the problem with this is that I have something like 18 pages and 500 lines by pages on average. So that said to find out where the problem is do I have to check each lines of my program ? :/ @Amaury Well if ONLY this program does it. Its not compiler. But you should be really clear about it. Else you can waste tons of time. So yes, if it is program error in your code. You will need to find the actual line/the bug. You can try but its takes time to use and understand. Thanks for the support , I need to debug my program before I continue so I prefer to waste little time to understand and use the program. I can't try to debug the code line per line it would take too long and it should be everywhere . At least when I'm done with it I finally have to find a solution to start my app on boot but for now if it crashes all the time it's not really usefull. @Amaury Well u should look for array copy. dangling pointers. old char * types and stuff like that. To get SIGILL from program bug , you must corrupt something in the code segment. Easy way is to use dangling pointer. So maybe you can guess at functions where it might happen. @mrjj Well right now you're talking to me in japanese ^^ I'm going to have a look on that didn't had time yesterday , I think I can be helped for one thing or two :) I'll come back if my problem is solve or not. Oh :) sorry. What i mean is SIGILL means "what the hell is that instruction" from the cpu. This can happen if compiler setting is slightly off for target. OR you can also have it happen if you write over the end of an array or use a pointer that is not set. Like MyClass *c1; /// dangling pointer c1->somfunc() Then when CPU tries to run the func it sees some random garbage at that location and might say SIGILL. Alright that's clearer ^^ So if I need to create a dangling pointer where do I need to declare it ? into the class itself ?
https://forum.qt.io/topic/74409/problem-with-disassembler-and-sigill-signal
CC-MAIN-2021-43
refinedweb
2,273
72.56
Recent: Archives: Playing audio clips in applets is quite simple and involves the following steps: Here's how the code for these steps looks: import java.applet.*; AudioClip ac = getAudioClip(getCodeBase(), soundFile); ac.play(); //play once ac.stop(); //stop playing ac.loop(); //play continuously It would seem logical to use this same code to play audio clips in a Java application. Unfortunately, if you do that you will get errors from the compiler. Why? Because the AudioClip object and the getAudioClip() method are part of the java.applet package -- and are not part of applications. The good news is we can dive down and make things work ourselves. The trick to solving this problem is to use some undocumented features that are provided by Sun in its JDK. Taking a peek inside the classes.zip file from the Sun JDK (using any of the various zipfile utilities), we find not only the standard Java packages such as java.applet but also sun.audio. (These are in the directory sun/audio.) The sun.audio package contains everything we need to be able to play audio clips! Here's the code: import sun.audio.*; //import the sun.audio package import java.io.*; //** add this into your application code as appropriate // Open an input stream to the audio file. InputStream in = new FileInputStream(Filename); // Create an AudioStream object from the input stream. AudioStream as = new AudioStream(in); // Use the static class member "player" from class AudioPlayer to play // clip. AudioPlayer.player.start(as); // Similarly, to stop the audio. AudioPlayer.player.stop(as); To use a URL as the audio stream source, substitute the following for the input stream and audio stream setup: AudioStream as = new AudioStream (url.openStream()); Playing the audio stream continuously adds a bit more complexity: // Create audio stream as discussed previously. // Create AudioData source. AudioData data = as.getData(); // Create ContinuousAudioDataStream. ContinuousAudioDataStream cas = new ContinuousAudioDataStream (data); // Play audio. AudioPlayer.player.play (cas); // Similarly, to stop the audio. AudioPlayer.player.stop (cas); And there you have it. Remember, this technique uses undocumented features; there are no guarantees that it will work with anything but the current Sun JDK. JavaBy Anonymous on June 3, 2009, 5:08 pmDOES NOT WORK! Reply | Read entire comment Excuse me, but works this in RCPs too ?By Anonymous on March 17, 2009, 10:45 amExcuse me, but works this in RCPs too ? Reply | Read entire comment continuous streamBy Anonymous on March 12, 2009, 2:46 amthanks sooooo much!! i really needed this code. The code above for continuous playing has an error that it calls for play() instead of start(). Also there were... Reply | Read entire comment audio in application worksBy Anonymous on November 12, 2008, 2:03 amthanks!!! i have been looking for this because everyone just post about audio in applet this is great. Only the continous audio doesn't work it says that the method... Reply | Read entire comment View all comments
http://www.javaworld.com/javaworld/javatips/jw-javatip24.html
crawl-002
refinedweb
488
60.51
January 17, 2007 The Permanent Income Hypothesis by Henry To Dear Subscribers, It is said that the majority of New Year's Resolutions are not kept - which is not a surprise - as human nature tends to lack discipline and the patience/endurance to break out old, bad habits. I have been guilty of this all too often, especially when it comes to trading the stock and financial markets. That being said, I am going to commit myself this year to write commentaries that are more succinct (but which does not leave out any substance), as I know our subscribers are always pressed for time. Many of you in the past have written asking us to devote more of our commentaries to individual stock picks or even manage a portfolio in real-time. I have partially responded to these requests by bringing in Rick Konrad from Value Discipline - a former institutional portfolio manager for over 25 years and a brilliant analyst on many things besides the financial markets. Along with our other regular guest commentator Bill Rempel, Rick has brought and will bring many more individual stock ideas for you to consider, along with a reasonable voice should this author ever get out of line! In addition, one of my friends and I will be starting up an investment management partnership later this year. It is mainly going to be an equity long-only fund - with various hedges in place should the general market or selective industries get too out of line. I will be mostly responsible for the qualitative analysis, while my partner will be responsible for the quantitative and the forensic accounting analysis (the comparative advantage law works best when you have more than one person running a company or an investment partnership!). Once our investment management business is fully in place, I will definitely have more individual stock ideas for you. That being said, I do not intend to run a real-time investment portfolio on this website anytime soon. My "specialty" has always been macro analysis - and I do not want to take away a significant chunk of my time away from macro analysis in order to run an investment portfolio. I want our macro analysis to be one of the best out there - as many investors and traders have come to rely on us to time their stock market (and other financial instruments) purchases. Macro analysis and global money flows are also my first love. More importantly - and this may come as a surprise to some readers - I do not believe having a portfolio of stocks on our website will benefit our subscribers to any significant extent - as buying individual stocks only work if you have the knowledge, confidence, and patience for your purchases. Buying based on a mere recommendation (even from Warren Buffett or Peter Lynch) will not work - as you will not have the conviction to hold them for the long-term. And believe me, you will lose your conviction at the precise moment that you need them. According to Morningstar, the total annualized return for the Legg Mason Value Trust Fund (run by the great manager, Bill Miller) was 12.14% as of December 31, 2006. And yet, the investors return (what actual retail investors reaped from the fund) was a mere 9.30% annualized, as many investors timed themselves out of gains and chased performance. Having a portfolio of stocks on our site will only work as long as subscribers know about each individual stock as well as we do or better yet, do their own independent analysis. And while some subscribers will inevitably do that - based on past experience - most will not. However, we will continue to give you stock ideas on companies that we think deserve more research. From thereon, everything else will be up to you. Before we continue with your commentary, let us do an update on the two most recent signals in our DJIA Timing System: 1st signal entered: 50% long position on September 7th at 11,385, giving us a gain of 1,171.08 points. 2nd signal entered: Additional 50% long position on September 25th at 11,505 giving us a gain of 1,051.08 points. As of Sunday afternoon on January 14, last week, market is still vulnerable to some kind of correction - given that earnings season is going to ramp up this week. That said, expectations are relatively low this quarter, so corporations may continue to surprise on the upside. However, such a correction is definitely overdue, as bullish sentiment has turned higher in recent weeks (even though the market was in a consolidation phase) and as the market has not experienced a significant correction in over five months. Speaking of corrections, there is a good chance that both the correction in crude oil and natural gas has already ended late last week. Make no mistake, however, I still believe the pricing environment for energy and commodities in general will be tough this year - but for now, we have probably found a short-term bottom. Over the longer-run, however - as I have illustrated in last weekend's commentary - I still believe that U.S. equities in general will be one of the best performers in 2007. And even though I believe that both energy and commodity prices in general will struggle this year, I continue to be a secular energy bull - as long as there is no breakthrough in battery or solar energy in the next few years. As many of you may know - Milton Friedman - who passed away last year at the age of 94 late last year, left behind many legacies. One of them is his theory of "permanent income hypothesis" - which essentially states that consumers based their future consumption patterns on long-term income expectations, as opposed to current income. Why is this important? One of our premises for the continuation of the bull market in the United States and for the economy to reaccelerate early this year is our belief that the U.S. consumer is not close to being tapped out. The perma-bears would claim that much of the "mortgage equity withdrawal" over the last few years went directly into consumption - but as I have discussed many times before, a significant chunk of the MEW actually went towards paying off (higher-yielding) debt, not consumption. Another chunk of it went towards home improvements or starting businesses - both activities that could be classified as investments or capital spending (which is good for future economic growth). The reduction in higher-yielding consumer debt is directly reflected in the consumer credit growth numbers over the last few years, as shown in the following chart: Look - the U.S. consumer is not that stupid. Quite often, they may not be looking at the right places, but if they turn on the TV or open the newspapers and see all this talk about the "U.S. housing bubble," then (according to Friedman's Theory of Permanent Income Hypothesis) they will appropriately plan their current spending patterns assuming the rise in home prices will not extend indefinitely into the future. In other words, all this talk about the U.S. housing bubble over the last 12 to 18 months (and how this would bring about a consumer-induced recession) actually helped prevent one - as many U.S. consumers had already planned (by cutting back their spending or paying down debt earlier in the process) for such a recession in advance. So Henry, what happened in 2001? How did that recession come about? The recession in 2001 was in fact preceded by a significant decline in capital spending - and in fact, the U.S. consumer never really retrenched (although they did suffer a significant slowdown). Many U.S. large caps had no cash - and many companies that did have cash had to suffer huge write-offs because their customers had no means to pay or had no cash or credit to buy any more equipment. In short, many U.S. companies stopped investing - not only because they did not have the means but also because there was such a huge overcapacity in the technology sector. Today, the situation has been reversed - as U.S. corporations are sitting on huge amount of cash and as businesses and consumers start to demand better wireless and fiber optics technology. To a certain extent, the slowdown in consumer spending in 2001 was partly due to the mistaken belief that the rise in stock prices in the late 1990s was permanent. The March 2000 to September 2001 decline in stock prices shattered that belief - leaving a huge negative impact on U.S. consumer spending. Today, the bursting of the U.S. housing bubble had no similar effect, as many U.S. consumers never believed that the rise in housing prices were permanent - thus retrenching in advance. Milton Friedman saw this nearly 50 years ago. On the other hand, many economists today are still surprised by the resiliency of U.S. consumer spending. It is time to change your expectations, folks. Based on my assertion that U.S. consumers are still not tapped out, and based on many of my commentaries over the last few months, I believe that 2007 will be a decent year for the U.S. stock market. Sure, margin debt is now at a high not seen since March 2000, but as we have discussed before, the amount of margin debt outstanding has historically tend to make new highs in each successive cyclical bull market - even during the secular bear market of 1966 to 1974. Moreover, as exemplified by the Barnes Index and the fact that S&P 500 earnings have been increasing at a quicker pace than the S&P 500, valuations are still relatively decent. And finally, the U.S. stock market is not even close to exhaustion, given that U.S. retail investors have been shunning domestic equities for the last 12 months - and given the following chart (this is the first time we are showing this) showing the ratio between U.S. money market assets (both retail and institutional) and the market capitalization of the S&P 500: I got the idea of constructing the above chart from Ned Davis Research - who had constructed a similar chart for a Barron's article a few months ago (his assertion was that we are also not close to a significant top in the stock market). Make no mistake: The ratio between money market fund assets and the market cap of the S&P 500 is probably not a great timing indicator - but what it does show is the amount of "cushion" that we have in order to insure against a significant market decline. While this indicator is telling us that we are closer to the end of the bull market than the beginning of one, it is also telling us that we are not close to exhaustion just yet. Based on historical experience, this author will not be too concerned until this ratio hits a reading of 15% or below. Assuming that the amount of money market funds remains the same going forward, the market cap of the S&P 500 has to rise a further 13% before we see such a ratio. Based on the above study, we will remain. »
http://www.safehaven.com/article-6720.htm
crawl-001
refinedweb
1,889
56.29
recently had to debug a problem for my current client which was exceptionally weird and I was able to utilize WinDbg to help get to the bottom of the problem relatively quickly. Basically the application in question is an asp.net application that takes a custom object and puts in in an MSMQ message (which currently uses the default binary serializer). The class in question is marked with the Serializable attribute, has a couple of primitive members (e.g., ints, strings) and a couple of NameValueCollections. One of the NameValueCollections is assigned directly from the HttpRequest.Headers NameValueCollection like this: myObject.Headers = request.Headers; One day we started getting this error: System.Runtime.Serialization.SerializationException: Type 'System.Web.HttpHeaderCollection' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable. This made absolutely no sense since, like my class, the NameValueCollection class was also marked with the Serializable attribute. Not only that, but where was the System.Web.HttpHeaderCollection coming from? So since I was already debugging, I took a memory dump of the asp.net process from the command line like this: cscript.exe adplus.vbs -hang -p 1808 -quiet -o c:\temp The "1808" was simply the PID of my w3wp.exe process and I output the dump to the c:\temp directory. I then launched WinDbg and opened the crash dump that was produced in the previous step. First, you have to run (the sos extensions is what allows WinDbg to understand .NET 2.0): .loadby sos mscorwks So the first thing I wanted to see was all the types in memory and their corresponding method tables so I ran: !dumpheap -stat A snippet of the results: 00000642802ae6c0 5 320 MyNamespace.Foo (just using Foo here for the class name. The real output included the fully qualified namespace with correct object name). The 00000642802ae6c0 is the method table for my Foo object. The 5 shows that we currently have 5 of my Foo objects loaded into memory. The 320 is the total size (320/5 tells me each of my objects is taking up 64 bytes). Now I can narrow in on my issues a little bit. This shows me all 5 of the memory addresses for my Foo objects: 0:000> !dumpheap -mt 00000642802ae6c0 ------------------------------ Heap 0 Address MT Size total 0 objects ------------------------------ Heap 1 Address MT Size 00000000c0012e18 00000642802ae6c0 64 total 1 objects ------------------------------ Heap 2 Address MT Size 000000010053b830 00000642802ae6c0 64 total 1 objects ------------------------------ Heap 3 Address MT Size 0000000140235c60 00000642802ae6c0 64 0000000140430fd8 00000642802ae6c0 64 00000001405275d0 00000642802ae6c0 64 total 3 objects ------------------------------ total 5 objects Statistics: MT Count TotalSize Class Name 00000642802ae6c0 5 320 MyNamespace.Foo Total 5 objects So now I'm going to pick one of these five objects and drill down further. I'll pick the one highlighted in blue that resides at 00000001405275d0: 0:000> !do 00000001405275d0 Name: MyNamespace.Foo MethodTable: 00000642802ae6c0 EEClass: 00000642802baf08 Size: 64(0x40) bytes (C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\e22c2559\92c7e946\assembly\dl3\fed41db4\000e24c3_21cac701\MyAssemblyName.DLL) Fields: MT Field Offset Type VT Attr Value Name 0000000000000000 4000028 8 0 instance 0000000140527610 requests 0000064274e85620 4000029 10 ...meValueCollection 0 instance 0000000140528d60 headers 0000064274e85620 400002a 18 ...meValueCollection 0 instance 0000000140527838 extraRequestData 0000000000000000 400002b 20 0 instance 0000000140527a38 userStateData 000006427881edc8 400002c 28 System.String 0 instance 0000000000000000 endOfLineData 0000064278825318 400002d 30 System.Boolean 0 instance 0 isOptOut So I know the "headers" member is the one I want for focus on so I inspect that next: 0:000> !do 0000000140528d60 Name: System.Web.HttpHeaderCollection MethodTable: 00000642bcefad78 EEClass: 00000642bcf3be38 Size: 120(0x78) bytes (C:\WINDOWS\assembly\GAC_64\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll) Fields: MT Field Offset Type VT Attr Value Name 0000064278825318 4001165 44 System.Boolean 0 instance 1 _readOnly 00000642788426f0 4001166 8 ...ections.ArrayList 0 instance 0000000140528f78 _entriesArray 000006427881f650 4001167 10 ...IEqualityComparer 0 instance 00000000ffffc148 _keyComparer 00000642788448c8 4001168 18 ...ections.Hashtable 0 instance 0000000140529000 _entriesTable 0000064274e82360 4001169 20 ...e+NameObjectEntry 0 instance 0000000000000000 _nullKeyEntry 0000064274e9e7e8 400116a 28 ...se+KeysCollection 0 instance 00000001405481c0 _keys 0000064278857210 400116b 30 ...SerializationInfo 0 instance 0000000000000000 _serializationInfo 000006427882b338 400116c 40 System.Int32 0 instance 10 _version 000006427881d280 400116d 38 System.Object 0 instance 000000014054ad48 _syncRoot 000006427881f748 400116e a70 ...em.StringComparer 0 shared static defaultComparer >> Domain:Value 0000000000136900:NotInit 0000000000177700:00000000ffffc110 << 00000642788d8ba8 4001179 48 System.Object[] 0 instance 0000000000000000 _all 00000642788d8ba8 400117a 50 System.Object[] 0 instance 0000000140548160 _allKeys 00000642bceef310 400101b 58 ...m.Web.HttpRequest 0 instance 00000001405265f0 _request 00000642bceef7b8 400101c 60 ....Web.HttpResponse 0 instance 0000000000000000 _response 00000642bcf3ad30 400101d 68 ...IIS7WorkerRequest 0 instance 0000000000000000 _wr And NOW we see something extremely interesting. The headers member was supposed to be a NameValueCollection so why is my !do showing it to be an HttpHeaderCollection and what is this HttpHeaderCollection anyway and how is this System.Web DLL even compiling? So at this point, it's time for us to crack open trusty old Reflector and find its class definition: internal class HttpHeaderCollection : HttpValueCollection So this is an internal class to the System.Web DLL but it's being returned for a NameValueCollection property. Also notice that it is NOT marked with the [Serializable] attribute (which was our problem to begin with). It inherits from the HttpValueCollection (which is yet another internal class) and the HttpValueCollection (while it DOES have the Serializable attribute) inherits from the NameValueCollection object and THAT is how the code is compiling because of course this is a perfectly legal use of polymorphism. So...in the end, all of these classes are marked with the Serializable attribute except for the HttpHeadersCollection (which I believe to have been an oversight on Microsoft's part) which is causing our serialization problems and we cannot control the internal code of System.Web. The fix ends up being pretty trivial - just iterate the NameValueCollection and adds the string primitives so that all serialization is happy. But the real moral of the story is that this is a good real world example that shows how to debug an issue that, at first glance, seems impossible. Using WinDbg like this is a very repeatable process that can help you get to the bottom of memory issues (and others) quite fast.
http://geekswithblogs.net/michelotti/archive/2007/08.aspx
CC-MAIN-2015-35
refinedweb
1,036
57.37
Schul-Cloud Content API Project description This repository contains - a server to test scrapers against - tests to test the server The package works under Python 2 and 3. Installation Using pip, you can install all dependencies like this: pip install schul_cloud_ressources_server_tests When you are done, you can import the package. import schul_cloud_ressources_server_tests Usage This section describes how to use the server and the tests. Server You can find the API definition. The server serves according to the API. It verifies the input and output for correctness. To start the server, run python -m schul_cloud_ressources_ressources_server_tests.tests --url= is the default url. Steps for Implementation If you want to implement your server you can follow the TDD steps to implement one test after the other. python -m schul_cloud_ressources_server_tests.tests -m step1 python -m schul_cloud_ressources_server_tests.tests -m step2 python -m schul_cloud_ressources_server_tests.tests -m step3 ... - step1 runs the first test - step2 runs the first and the second test - step3 runs the first, second and third test - … You can run a single test with python -m schul_cloud_ressources_server_tests.tests -m step3only Test Authentication The test server supports api key authentication and basic authentication. If you test authentication over the internet. Use https to protect the secrets. Thus, an example test call to your api could look like this: python -m schul_cloud_ressources_server_tests.tests \ --url= \ --noauth=false --basic=username:password If you have an api key, you can test that the server works. python -m schul_cloud_ressources_ressources. Use the server in pytest You can use the sever in Python tests. There are fixtures available that start and stop the server. from schul_cloud_ressources_server_tests.tests.fixtures import * def test_pytest(ressources_server): """pytest using the server""" The following attributes are available: - ressources_server.url The url of the server. - ressources_server.api A schul_cloud_ressources_api_v1.RessourcesApi object connected to the server. - ressources_server.get_ressources() A function to return a list of ressources on the server. For more information, see the module schul_cloud_ressources_server_tests.tests.fixtures. You can add support for more test frameworks. TODO - generate a docker container for the server - generate a docker container for the tests - document how to embed the tests and the server in - a crawler - travis build script of arbitrary language - create example crawler with tests Project details Release history Release notifications | RSS feed Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/schul-cloud-ressources-server-tests/
CC-MAIN-2021-39
refinedweb
392
67.76
The FizzBuzz problem that appeared in yesterday's drill. As a model answer, def fizz_buzz num = 1 while num <= 100 do if num % 15 == 0 puts "FizzBuzz" elsif num % 3 == 0 puts "Fizz" elsif num % 5 == 0 puts "Buzz" else puts num end num = num + 1 end end fizz_buzz That was the correct answer, When I used rubocop, def fizz_buzz num = 1 while num <= 100 if (num % 15).zero? puts 'FizzBuzz' elsif (num % 3).zero? puts 'Fizz' elsif (num % 5).zero? puts 'Buzz' else puts num end num += 1 end end fizz_buzz In the form of Enclose the formula in () and judge "whether or not the value is 0", Another description (accidentally) using the zero? method was made. As for rubocop, I think it would be nice to have a clean and tidy description as much as possible. Recommended Posts
https://linuxtut.com/en/8beed7c97be29400e74c/
CC-MAIN-2022-40
refinedweb
140
77.16
Opened 6 years ago Last modified 3 years ago #21883 new defect EllipticCurveIsogeny raising a value error that an isogeny doesn't exist while it most certainly does! Description sage: E = EllipticCurve_from_j(0) sage: E Elliptic Curve defined by y^2 + y = x^3 over Rational Field sage: phi = E.isogenies_prime_degree(3)[1] sage: phi Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 7 over Rational Field sage: EllipticCurveIsogeny(E,None,codomain=phi.codomain(),degree=3) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-58-7c6e8f3f3fa6> in <module>() ----> 1 EllipticCurveIsogeny(E,None,codomain=phi.codomain(),degree=Integer(3)) /Applications/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.pyc in __init__(self, E, kernel, codomain, degree, model, check) 1008 old_codomain = codomain 1009 -> 1010 (pre_isom, post_isom, E, codomain, kernel) = compute_sequence_of_maps(E, codomain, degree) 1011 1012 self.__init_algebraic_structs(E) /Applications/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.pyc in compute_sequence_of_maps(E1, E2, ell) 4003 (E1pr, E2pr, pre_isom, post_isom) = compute_intermediate_curves(E1, E2) 4004 -> 4005 ker_poly = compute_isogeny_kernel_polynomial(E1pr, E2pr, ell) 4006 4007 return (pre_isom, post_isom, E1pr, E2pr, ker_poly) /Applications/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.pyc in compute_isogeny_kernel_polynomial(E1, E2, ell, algorithm) 3831 x^3 + x 3832 """ -> 3833 return split_kernel_polynomial(compute_isogeny_starks(E1, E2, ell)) 3834 3835 def compute_intermediate_curves(E1, E2): /Applications/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.pyc in compute_isogeny_starks(E1, E2, ell) 3735 if (n == ell+1 or T == 0): 3736 if (T == 0 or T.valuation()<2): -> 3737 raise ValueError("The two curves are not linked by a cyclic normalized isogeny of degree %s" % ell) 3738 break 3739 ValueError: The two curves are not linked by a cyclic normalized isogeny of degree 3 The above might seem like a silly example, since I am asking for an object I already know. But it is the underlying problem of why: sage: phi.dual() ... ValueError: The two curves are not linked by a cyclic normalized isogeny of degree 3 is also broken. Change History (4) comment:1 Changed 6 years ago by comment:2 Changed 3 years ago by - It does not make sense to talk about a normalised model here, unless by "model" you mean "Weierstrass equation and a choice of invariant differential" (which you probably do. Isogenies can be normalised, while means that the pull-back of a standard differential on the codomain is the standard differential on the domain (in general it is a scalar multiple of it, nonzero for separable isogenies). - For any isogeny of phi degree d from E1 to E2 it makes sense to ask if it is normalised (in the example, phi.is_normalised() does return True) and more generally what the scaling factor is (phi.formal()[1] -- which should have a method to get more easily). Since this phi *is* normalised this is just a plain Bug. The sentence "Actually, ..." is extremely misleading. Sage absolutely does implement the computation of isogenies via finding appropriate factors of the division polynomial. I spent a long time (and supervised part of a PhD thesis) showing how to do this -- picking an appropriate subset of the factors of the division polynomial is not trivial. But is is also *very slow* which is why the rest of the aforementioned thesis which is all implemented in Sage -- has been here for years now -- does this for all isogenies of prime degree p such that X_0^+(p) has genus 0. Sage's isogeny capabilities are in my opinion very good. It is the only software in which one can compute isogenies as easily, or compute complete isogeny classes over arbitrary number fields -- there are hundreds (or more) lines devoted to this in several files. I implemented all that because I needed it in my own work (e.g. to compute the full isogeny classes for all the elliptic curves in the LMFDB, which are defined over number fields of degree up to 6). If other people need different capabilities, for example implementations which work better over large finite fields, they are welcome to implement them. But the fact that not everything of this type has been implemented does *not* imply that "Sage is severely lacking generic [algorithms]". I strongly dispute that statement, even without "severely". Constructing isogenies given only domain and codomain and degree is something which is important for elliptic curves over finite fields because of elliptic curve cryptography, but much less so over number fields. So someone else can implement it. Now I will put on my to-do list to actually fix the bug which leads to the reported behaviour. comment:3 Changed 3 years ago by Hi John. I'm sorry if you got offended by my comment. It's 3 years old, I did not know about your code for grouping factors of the division polynomial back then (if it was already in Sage at the time). I realize now that my diagnosis was misguided: indeed, phi.dual() seems to be correctly computing normalized models, so I'm not sure what's causing this failure. If you find the root cause of the bug, I'll be happy to review the fix. Constructing isogenies given only domain and codomain and degree is something which is important for elliptic curves over finite fields because of elliptic curve cryptography, but much less so over number fields. So someone else can implement it. I haven't really had any time to do "maths" developement in Sage in the past 3 years, but I hope things to change soon... I'll open a separate ticket for my suggestion of falling back to the generic code when the models are not normalized. comment:4 Changed 3 years ago by No worries -- I just did not want the misleading impression to go uncorrected. The code I mentioned went in soon after Kimi's thesis was finished in 2013. Weird. I thought this used to work, but now I am having a very hard time finding an example that does. I managed to compute this one (a multiplication endomorphism): but many similar examples fail. Note that "normalized" is very important here: Given two isogenous elliptic curves, Sage only knows how to compute an isogeny between them if the models are normalized (isogeny sends invariant differential of codomain onto invariant differential of domain). Actually, I think the best algorithm to compute non-normalized isogenies between elliptic curves in characteristic 0 is still factoring the division polynomial, which Sage does not implement. There are better algorithms for finite fields (Couveignes, Lercier-Sirvent), but they are a pain to implement. Note that you can do better if your goal is to compute the dual: choose enough points (about 2 times deg φ), for each of them compute φ(P) and [deg φ]P, and deduce φ by interpolation. Sadly, Sage has many specialized algorithms for isogenies, but is severly lacking generic ones.
https://trac.sagemath.org/ticket/21883
CC-MAIN-2022-27
refinedweb
1,168
50.67
91Re: [json] JSON as a function parameter Expand Messages - Aug 20, 2005 > [Advantages]I use this method in my PHP work pretty often, especially when > . Cleaner calling code > . Flexible calling API > . Somewhat cleaner callee code from visually implied namespace > (j.arg1) > . Tightened API calls: > . . obj.myMethod = function Obj_myMethod(j){// (singleton) > . . . . if(!isJSON(j)){debugErr("j must be a JSON")} > . . } > . JSON variable can be easily passed around > > [Disadvantages] > . Overall size of the calling code is a little larger > . Hit on interpreter performance to parse json > . Null value parameter assertions require additional code consuming GET or POST vars, or instantiating objects which have a mix of required and optional arguments. Some languages have explicit support for this sort of use, such as Python: def f(**kwargs): print kwargs['msg'] # prints "hello world" f(msg='hello world') Ronny is right - there is no JSON parsing overhead in what you're doing, because you are passing plain old javascript object literals. Core_JavaScript_1.5_Guide:Literals#Object_Literals ------------------------------------------------------ michal migurski- contact info, blog, and pgp key: sf/ca - << Previous post in topic Next post in topic >>
https://groups.yahoo.com/neo/groups/json/conversations/messages/91
CC-MAIN-2015-11
refinedweb
179
50.33
RMI is used when we have to invoke methods from distance on remote objects (these objects are located on other systems). RMI is very limited (is the single thing which is able to do it) and it give us a platform-independent understanding. When we start to use RMI, the programming of streams and sockets disappear. By having the objects remotely stored somewhere, the access to them becomes very transparent for the programmer. I would like to mention from start that the article is for those (students and not only) who wish to understand the basic principles of accessing objects remotley. The examples from here are based on original examples from [1]. In order to use a remote object, we have to gain a reference for that object. The methods that will be used for that object are invoked in the same way as the local objects. RMI is using byte streams in order to transfer data and method calling (invocations). This process is done automatically by the RMI infrastructure. What we have stated above is a simplification of what actually is happening. The server component will control all the objects by registering them using a naming service. After this process is realized, this interface will be accessed by client programs. The interface is composed from the signatures of the methods specific to the object for which the server will make available publicly. By using the same naming service, the client will obtain a reference to the interface, called stub. In the stub, which is local placeholder, the remote object is stored. On the server system, which is remotely, there is a skeleton. In the moment when the client will invoke a method specific to the remote object, it will appear to the client like being invoked directly on the object. In reality, there is a method that is equivalent is called in the stub. The stub will forward the calling and all the parameters to the skeleton that is placed on the remote server. The parameters that can be used are some primitive’s types which implements Serializable interface. The process of serializing these types of parameters, is known as marshalling [3]. Next, the skeleton from the server will convert the stream as a method call with the give parameters. The parameters are de-serialized and the process is known as unmarshalling [3]. In the end, the skeleton will invoke the method (which is implemented on the server). The phases that we have described above are depicted in the Figure 1. The figure shows a very simplified way of what actually is done at network level. Two more layers are implied at each end of the transmission, transport layer and remote reference layer. In order to gain more knowledge regarding the network layers, go here [2] and here [3]. Starting with J2SE 1.2, the skeleton was totally removed and the servers components are communicate with the reference layer. The foundation and the main phases (principles) remain the same and Figure 1 depict a very useful representation of how the things are done. Figure 1. Invoking methods for a remote object [1] What is happening if we have a method that return a value? The process depicted above is reversed, and the returned value is serialized on the server (by whom? by the skeleton) and de-serialized on the client (by whom? by stub). In order to use RMI in programming, we have to add the following packages: After doing the including of the packages, we have to follow some basic steps. The list of the steps is described in the followings. 3.1. Creating the interface; 3.2. Developing a class which implements the interface from 3.1; 3.3. Develop the server component (process); 3.4. Develop the client component (process). Before starting the implementation of the steps, let’s describe a simple application as an example on which we will apply the steps described above. The first example of application consists in a simple displaying of a greeting message to a client that is using the interface, registered with the naming service in order to invoke the method implementation associated on the server. In a real application, we will have more methods to be invoked, methods that are implemented to some class (this will be shown in a next example). For the above example, let’s start to implement the specific steps. 3.1. Create the interface The interface will always: The interface will look like in Figure 2 and code listening 1. For everything to go perfectly, please, keep the files as they are shown in pictures. Later you will understand why. width="576" height="273" data-src="/KB/java/884158/extracted-png-image2.png" class="lazyload" data-sizes="auto" data-> Figure 2. The interface Listnening 1 - Structure of the interface import java.rmi.*; public interface IHello extends Remote { public String getGreetingMessage() throws RemoteException; } 3.2. Developing a class which implements the interface from 3.1 (Figure 2) The class that will implements the interface, should: The class that will implements IHello will look like in Figure 3 and code listening 2. The keyword @Override shows us that the method getGreetingMessage() is overridden. width="566" height="280" data-src="/KB/java/884158/extracted-png-image3.png" class="lazyload" data-sizes="auto" data-> Figure 3. Implementing the IHello (see step 3.1) interface Listening 2 - Implementation of the IHello interface import java.rmi.*; import java.rmi.server.*; public class HelloImplementation extends UnicastRemoteObject implements IHello { public HelloImplementation() throws RemoteException { //There is no action need in this moment. } @Override public String getGreetingMessage() throws RemoteException { return ("Hello there, student."); } } 3.3. Develop the server component (process) The task of the server component is to create object(s) from the class that we have implemented above. The next step is to register them with the help of a naming service, called registry. The registration process is done with a rebind() method of class Naming (this class is from java.rmi package) and it has two argument: Next we will provide the code (Figure 4 and code listening 3) for the server component. The server contains one single method, main. In order to catch the different types of exception, the method main throws Exception. width="575" height="279" data-src="/KB/java/884158/extracted-png-image4.png" class="lazyload" data-sizes="auto" data-> Figure 4. The server Listening 3 - Implementation of the server import java.rmi.*; public class HelloServerComponent { private static final String host = "localhost"; public static void main(String[] args) throws Exception { //** Step 1 //** Declare a reference for the object that will be implemented HelloImplementation temp = new HelloImplementation(); //** Step 2 //** Declare a string variable for holding the URL of the object's name String rmiObjectName = "rmi://" + host + "/Hello"; //Step 3 //Binding the object reference to the object name. Naming.rebind(rmiObjectName, temp); //Step 4 //Tell to the user that the process is completed. System.out.println("Binding complete...\n"); } } The method will set a connection between the name of the object and his reference. The clients will have the possibility to use the remote object’s name in order to retrieve a specific reference of that object using the registry. The URL string indicates the name of the remote object that is stored on a host machine. In order to keep it simple, we will use localhost (the default value that RMI is assuming). The default port of RMI is 1099 and it can be changed if you wish. 3.4. Develop the client component (process) The client goal is to obtain a reference for the remote object through the registry. In order to accomplish this, we use the lookup method which can be found in Naming class. The lookup method receive as a parameter the URL that the server generated when binding the object reference to the object’s name in the registry. The lookup method returns a Remote reference. This reference need to be typecast into a Hello reference (and not a HelloImplementation reference!). After the Hello reference is obtained, it can be used to invoke (call) the method that we have made it available in the interface. The code is listed below, in Figure 5 and code listening 4. width="624" height="345" data-src="/KB/java/884158/extracted-png-image5.png" class="lazyload" data-sizes="auto" data-> Figure 5. The client Listening 4 - Client Implementation import java.rmi.*; public class HelloClientComponent { private static final String host = "localhost"; public static void main(String[] args) { try { //We obtain a reference to the object from the registry and next, //it will be typecasted into the most appropiate type. IHello greeting_message = (IHello) Naming.lookup("rmi://" + host + "/Hello"); //Next, we will use the above reference to invoke the remote //object method. System.out.println("Message received: " + greeting_message.getGreetingMessage()); } catch (ConnectException conEx) { System.out.println("Unable to connect to server!"); System.exit(1); } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } } } In order to run the application, we need to compile all the four files. This is done from the Command Prompt window using javac command. First, we have to navigate to the path where we have the files, in my case it will be on E:\Proiecte\Java\RMI\src (see Figure 6). In case that you have created your files with NetBeans (which I recommend for the beginning to do like this), the files are stored in src folder. width="592" height="354" data-src="/KB/java/884158/extracted-png-image6.png" class="lazyload" data-sizes="auto" data-> Figure 6. The location of the files Next, we will compile the files (use the same order as I give you) using javac command as it follows: When you try to compile one of the file and if you receive the message from Figure 7, then you have two options: first, you can copy all the files in your Java folder (path in my case is C:\Program Files\Java\jdk1.8.0_40\bin) or second, you can add it as an environment variable (see the annexes of the article to see how to proceed). width="490" height="248" data-src="/KB/java/884158/extracted-png-image7.png" class="lazyload" data-sizes="auto" data-> Figure 7. Command javac not found Step 1 - After you have configured your javac command to the environment variables, let’s start to compile all the files. If everything is going OK, your command prompt should look like in Figure 8. width="401" height="210" data-src="/KB/java/884158/extracted-png-image8.png" class="lazyload" data-sizes="auto" data-> Figure 8. Compiling the files Step 2 - Next, execute the rmic command for HelloImplementation (see Figure 9). Read the message after the command has been executed. width="441" height="226" data-src="/KB/java/884158/extracted-png-image9.png" class="lazyload" data-sizes="auto" data-> Figure 9. Running rmi command Step 3 – Run rmiregistry command (see Figure 10). You will not receive any message, just a blinking pointer on the next line of your window and the title of the window is changed. width="468" height="212" data-src="/KB/java/884158/extracted-png-image10.png" class="lazyload" data-sizes="auto" data-> Figure 10. Running rmiregistry command Step 4 – Open a new command prompt, and run java HelloServerComponent (see Figure 11). Is OK, if you receive the message Binding complete…. width="466" height="236" data-src="/KB/java/884158/extracted-png-image11.png" class="lazyload" data-sizes="auto" data-> Figure 11. Running HelloServerComponent Step 5 – Open a new command prompt, and run java HelloServerComponent. If everything goes perfect, you should receive the following message (see Figure 12): Message received: Hello there, student. width="486" height="246" data-src="/KB/java/884158/extracted-png-image12.png" class="lazyload" data-sizes="auto" data-> Figure 12. Running HelloClientComponent In this moment, we have covered all the basic steps that we need in order to set RMI client-server application. 5.1. Add javac as environment variable In order to add javac as environment variable, follow the next steps: Figure 13. Access environment variable Figure 14 System Properties for adding environment variables After you have decided where you want to place your path, select the variable Path, and press Edit (Figure 15). Figure 15. Choosing the desired type of variable Figure 16. Setting the path Figure 18. Path checking [1] Jan Graba, An Introduction to Java Networking Programming, 2013, Springer Publishing House, ISBN: 978-1-4471-5253-8. [2] Internet Protocol Suite (TCP), [3] System Architecture, 08.03.2015: Release of the first article version 09.03.2015: Code listening for files has been added. The archive with the files of the project has been.
https://codeproject.freetls.fastly.net/Articles/884158/Remote-Method-Invocation-RMI
CC-MAIN-2021-31
refinedweb
2,113
57.06
...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards Now let's expose a C++ class to Python. Consider a C++ class/struct that we want to expose to Python: struct World { void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; We can expose this to Python by writing a corresponding Boost.Python C++ Wrapper: #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE(hello) { class_<World>("World") .def("greet", &World::greet) .def("set", &World::set) ; } Here, we wrote a C++ class wrapper that exposes the member functions greet and set. Now, after building our module as a shared library, we may use our class World in Python. Here's a sample Python session: >>> import hello >>> planet = hello.World() >>> planet.set('howdy') >>> planet.greet() 'howdy' Our previous example didn't have any explicit constructors. Since World is declared as a plain struct, it has an implicit default constructor. Boost.Python exposes the default constructor by default, which is why we were able to write >>> planet = hello.World() We may wish to wrap a class with a non-default constructor. Let us build on our previous example: struct World { World(std::string msg): msg(msg) {} // added constructor void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; This time World has no default constructor; our previous wrapping code would fail to compile when the library tried to expose it. We have to tell class_<World> about the constructor we want to expose instead. #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE(hello) { class_<World>("World", init<std::string>()) .def("greet", &World::greet) .def("set", &World::set) ; } init<std::string>() exposes the constructor taking in a std::string (in Python, constructors are spelled " "__init__""). We can expose additional constructors by passing more init<...>s to the def() member function. Say for example we have another World constructor taking in two doubles: class_<World>("World", init<std::string>()) .def(init<double, double>()) .def("greet", &World::greet) .def("set", &World::set) ; On the other hand, if we do not wish to expose any constructors at all, we may use no_init instead: class_<Abstract>("Abstract", no_init) This actually adds an __init__ method which always raises a Python RuntimeError exception. Data members may also be exposed to Python so that they can be accessed as attributes of the corresponding Python class. Each data member that we wish to be exposed may be regarded as read-only or read-write. Consider this class Var: struct Var { Var(std::string name) : name(name), value() {} std::string const name; float value; }; Our C++ Var class and its data members can be exposed to Python: class_<Var>("Var", init<std::string>()) .def_readonly("name", &Var::name) .def_readwrite("value", &Var::value); Then, in Python, assuming we have placed our Var class inside the namespace hello as we did before: >>> x = hello.Var('pi') >>> x.value = 3.14 >>> print x.name, 'is around', x.value pi is around 3.14 Note that name is exposed as read-only while value is exposed as read-write. >>> x.name = 'e' # can't change name Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: can't set attribute In C++, classes with public data members are usually frowned upon. Well designed classes that take advantage of encapsulation hide the class' data members. The only way to access the class' data is through access (getter/setter) functions. Access functions expose class properties. Here's an example: struct Num { Num(); float get() const; void set(float value); ... }; However, in Python attribute access is fine; it doesn't neccessarily break encapsulation to let users handle attributes directly, because the attributes can just be a different syntax for a method call. Wrapping our Num class using Boost.Python: class_<Num>("Num") .add_property("rovalue", &Num::get) .add_property("value", &Num::get, &Num::set); And at last, in Python: >>> x = Num() >>> x.value = 3.14 >>> x.value, x.rovalue (3.14, 3.14) >>> x.rovalue = 2.17 # error! Take note that the class property rovalue is exposed as read-only since the rovalue setter member function is not passed in: .add_property("rovalue", &Num::get) In the previous examples, we dealt with classes that are not polymorphic. This is not often the case. Much of the time, we will be wrapping polymorphic classes and class hierarchies related by inheritance. We will often have to write Boost.Python wrappers for classes that are derived from abstract base classes. Consider this trivial inheritance structure: struct Base { virtual ~Base(); }; struct Derived : Base {}; And a set of C++ functions operating on Base and Derived object instances: void b(Base*); void d(Derived*); Base* factory() { return new Derived; } We've seen how we can wrap the base class Base: class_<Base>("Base") /*...*/ ; Now we can inform Boost.Python of the inheritance relationship between Derived and its base class Base. Thus: class_<Derived, bases<Base> >("Derived") /*...*/ ; Doing so, we get some things for free: Derivedobjects which have been passed to Python via a pointer or reference to Basecan be passed where a pointer or reference to Derivedis expected. Now, we will expose the C++ free functions b and d and factory: def("b", b); def("d", d); def("factory", factory); Note that free function factory is being used to generate new instances of class Derived. In such cases, we use return_value_policy<manage_new_object> to instruct Python to adopt the pointer to Base and hold the instance in a new Python Base object until the the Python object is destroyed. We will see more of Boost.Python call policies later. // Tell Python to take ownership of factory's result def("factory", factory, return_value_policy<manage_new_object>()); In this section, we will learn how to make functions behave polymorphically through virtual functions. Continuing our example, let us add a virtual function to our Base class: struct Base { virtual ~Base() {} virtual int f() = 0; }; One of the goals of Boost.Python is to be minimally intrusive on an existing C++ design. In principle, it should be possible to expose the interface for a 3rd party library without changing it. It is not ideal to add anything to our class Base. Yet, when you have a virtual function that's going to be overridden in Python and called polymorphically from C++, we'll need to add some scaffoldings to make things work properly. What we'll do is write a class wrapper that derives from Base that will unintrusively hook into the virtual functions so that a Python override may be called: struct BaseWrap : Base, wrapper<Base> { int f() { return this->get_override("f")(); } }; Notice too that in addition to inheriting from Base, we also multiply- inherited wrapper<Base> (See Wrapper). The wrapper template makes the job of wrapping classes that are meant to overridden in Python, easier. BaseWrap's overridden virtual member function f in effect calls the corresponding method of the Python object through get_override. Finally, exposing Base: class_<BaseWrap, boost::noncopyable>("Base") .def("f", pure_virtual(&Base::f)) ; pure_virtual signals Boost.Python that the function f is a pure virtual function. We've seen in the previous section how classes with pure virtual functions are wrapped using Boost.Python's class wrapper facilities. If we wish to wrap non-pure-virtual functions instead, the mechanism is a bit different. Recall that in the previous section, we wrapped a class with a pure virtual function that we then implemented in C++, or Python classes derived from it. Our base class: struct Base { virtual int f() = 0; }; had a pure virtual function f. If, however, its member function f was not declared as pure virtual: struct Base { virtual ~Base() {} virtual int f() { return 0; } }; We wrap it this way: struct BaseWrap : Base, wrapper<Base> { int f() { if (override f = this->get_override("f")) return f(); // *note* return Base::f(); } int default_f() { return this->Base::f(); } }; Notice how we implemented BaseWrap::f. Now, we have to check if there is an override for f. If none, then we call Base::f(). Finally, exposing: class_<BaseWrap, boost::noncopyable>("Base") .def("f", &Base::f, &BaseWrap::default_f) ; Take note that we expose both &Base::f and &BaseWrap::default_f. Boost.Python needs to keep track of 1) the dispatch function f and 2) the forwarding function to its default implementation default_f. There's a special def function for this purpose. In Python, the results would be as expected: >>> base = Base() >>> class Derived(Base): ... def f(self): ... return 42 ... >>> derived = Derived() Calling base.f(): >>> base.f() 0 Calling derived.f(): >>> derived.f() 42 C is well known for the abundance of operators. C++ extends this to the extremes by allowing operator overloading. Boost.Python takes advantage of this and makes it easy to wrap C++ operator-powered classes. Consider a file position class FilePos and a set of operators that take on FilePos instances: class FilePos { /*...*/ }; FilePos operator+(FilePos, int); FilePos operator+(int, FilePos); int operator-(FilePos, FilePos); FilePos operator-(FilePos, int); FilePos& operator+=(FilePos&, int); FilePos& operator-=(FilePos&, int); bool operator<(FilePos, FilePos); The class and the various operators can be mapped to Python rather easily and intuitively: class_<FilePos>("FilePos") .def(self + int()) // __add__ .def(int() + self) // __radd__ .def(self - self) // __sub__ .def(self - int()) // __sub__ .def(self += int()) // __iadd__ .def(self -= other<int>()) .def(self < self); // __lt__ The code snippet above is very clear and needs almost no explanation at all. It is virtually the same as the operators' signatures. Just take note that self refers to FilePos object. Also, not every class T that you might need to interact with in an operator expression is (cheaply) default-constructible. You can use other<T>() in place of an actual T instance when writing "self expressions". Python has a few more Special Methods. Boost.Python supports all of the standard special method names supported by real Python class instances. A similar set of intuitive interfaces can also be used to wrap C++ functions that correspond to these Python special functions. Example: class Rational { public: operator double() const; }; Rational pow(Rational, Rational); Rational abs(Rational); ostream& operator<<(ostream&,Rational); class_<Rational>("Rational") .def(float_(self)) // __float__ .def(pow(self, other<Rational>)) // __pow__ .def(abs(self)) // __abs__ .def(str(self)) // __str__ ; Need we say more?
http://www.boost.org/doc/libs/1_49_0/libs/python/doc/tutorial/doc/html/python/exposing.html
CC-MAIN-2018-13
refinedweb
1,720
56.15
(13) Matthew Cochran(6) Mike Gold(5) Sushila Patel(5) Bechir Bejaoui(4) Tin Lam(3) Amr Monjid(3) Jon Person(3) TimothyA Vanover(2) Catalini Tomescu(2) S.R.Ramadurai, K.Sreenivasan(2) Rick Malek(2) Tony Tromp(2) Christopher Duncan(2) Ashish Singhal(2) Erika Ehrli(2) Erika Ehrli Cabral(2) John Charles Olamendy(2) Ashish Banerjee(1) Rahul Sharma(1) Narayana Surapaneni(1) Rajesh VS(1) Manisha Mehta(1) Shripad Kulkarni(1) Doug Doedens(1) Dan Fontanesi(1) Hemant Kathuria(1) Sudhakar Jalli(1) Ramaprasad Upadhyaya(1) John Hudai Godel(1) Rama G(1) K S Ganesh(1) Paul Coldrey(1) klaus_salchner (1) harikishan.jayaraj (1) jeffrey 0(1) Sajana Palanagama(1) Suparba Panda(1) Rustem Sabitov(1) Brijraj Singh(1) Ezhilan Muniswaran(1) Saurabh (1) Yildirim Kocdag(1) schola (1) Shafiq Ahmed(1) Jaish Mathews(1) Udit Bhanu Singh(1) Pradeep Tiwari(1) Dipal Choksi(1) Rahul Saxena(1) Munir Shaikh(1) Vivekanand Kilaparthi(1) Scott Lysle(1) prathi Atluri(1) Bhaskar Gollapudi(1) Kalyan Bandarupalli(1) Resources No resource found Get a database table properties Jan 22, 2001. Get a table properties such as column names, types etc using DataColumn and DataTable. Implementing Delegates in C# : Part 2 Feb 13, 2001. This is second part of Timothy's Delegates in C# series... Line Numbering Utility in C# and Java May 08, 2001. This is the first of the series of programs I wish to write to help myself get a handle on C#. What & Why : Properties :: Part 2 Jul 09, 2001. In the part 1 of this series, I discussed about the get method of the properties, with the help of which you can make your variable so that nobody can modify the value of the variable.. Sorting, Searching and some other useful programs Sep 07, 2001. Here are the some useful programs including many search algorithms, sort, palindrome, fibonacci... Network Programming in C# - Part 2 Nov 12, 2001. This is the second part of the series of articles about the network programming with C#. N-Tier Development with Microsoft .NET : Part III Feb 25, 2002. The last installment in this series detailed more on the middle tier – business – façade and how to create a Web Service Export Proxy to have a physically separated middle tier.. Multithreading Part I: Multithreading and Multitasking Apr 08, 2002. In this and a series of articles that would follow, we would learn about threads and how to write multi-threaded programs in. Editable ListView in C# Jul 01, 2002. Based on the similar technique used my previous article, the Editable Listbox, we can edit columns and rows of a ListView control.. DataGrid. Pro Developer Series : Creating Your Dream Project Oct 22, 2002. The problem with most programmers is that they've lived a rather monochromatic life. Pro Developer Series: Improving Your Career In Any Economy Nov 20, 2002. Like many other areas of business, the tech industry has weathered the occasional slump over the past few decades. ADO.NET, COBOL and Stored Procedure Dec 13, 2002. A stored procedure is basically a series of SQL statements that reside on the database. The procedure could create a new table, retrieve data from one or more tables, update one or more tables or perform many other tasks. Persist ListView Settings with Serialization Dec 13, 2002. In this article, I'll show you how to persist the column order and width settings by using Serialization, binary serialization to be more specific. And you won't believe how easy it is. How to Add a Counter Column to the DataGrid? May 08, 2003. This article explains how to add functionality to add a counter column to the DataGrid.. Change Color of a Column Based on Column Values May 15, 2003. In this article we'll see how to change the color of column based on the column value. Deleting a DataGrid Data Based on a Column Value Jul 24, 2003. In this article we'll see how to delete the records of a DataGrid based on a column value in the database table... Generating Combo Box in DataGrid Columns Jan 09, 2004. DataGrid programming in .NET is real fun. And that too if you’re trying to get it programmed in a Windows Forms world its double the work. You got to write a whole lot of code for a simple extensibility of the existing features of datagrid. One good example is having a combobox in one of the columns of the datagrid.. Constructing a DataTable using C# Feb 17, 2004... New Features in C# 2.0 : Part 1 Mar 08, 2004. In a two part series I will explain new features introduces in C# language version 2.0. In this article I will talk about generics. The Matrix Class and Transformations Apr 01, 2004. Matrices play a vital role in the transformation process. In GDI+, the Matrix class represents a 3×2 matrix that contains x, y, and w values in the first, second, and third columns, respectively.. Revise-Generating ComboBox in a DataGrid Column Jun 10, 2004. This article and attached source code shows how to add a ComboBox column to a DataGrid control. Evolving Numeric Series using Genetic Algorithms in C# Jul 27, 2004. If you ever browsed around the book store, you'll notice these puzzle books or IQ test books and some of the books contain questions asking you to complete a series of numbers. An in-depth look at WMI and Instrumentation: Part II Sep 18, 2004. In this second part of the series, you will learn how to work with WMI classes and class instances, and then demonstrates the wealth of information available through the Win32 and IIS WMI providers.. How to Insert a Date Into DateTime Column Using ADO.NET & C# Feb 04, 2005. In this article, we will show how to insert a date into a date column using ADO.NET and C#. Floating-Point in .NET Part I: Concepts and Formats Apr 18, 2005. The first in a three part series, this article introduces the basic concepts of floating-point arithmetic: number formats, accuracy and precision, and round-off error.. OOPS Concepts and .NET Part 1: Classes, Objects, and Structures Jun 22, 2005. The following article kicks off a three-part article series that will present definitions and samples for different Object-Oriented Programming. OOPS Concepts And .NET Part 2: Inheritance, Abstraction And Polymorphism Jun 22, 2005. The following article is the second of a three-part article series that presents definitions and samples for different Object-Oriented Programming (OOP) concepts and its implementation in .NET. Globalization and Localization in .NET: Part I Oct 01, 2005. In this first part of this two parts series, we will get started with globalization and localization in .NET. How To Get All Database Tables and TableColumns in Oracle Nov 08, 2005. In this article, I will show how can I fetch all tables and corresponding columns from an Oracle database using C# and Oracle .NET Data Provider. Presenting Child Data along with Parent Row in Data Grid Nov 10, 2005. This article explains how we can bind the parent and child data to a Data Grid with minimum code effort using the Repeater control.. New Features of Visual Studio 2005 Editor Nov 16, 2005. In my previous articles, I discussed various new features introduced in Visual Studio 2005. This article is another addition to the same series. In this article, I discuss some new features of Visual Studio 2005 editor. Wrapper Patterns in C#: Part I Feb II: The Proxy Pattern Feb III: The Decorator Pattern Feb# rabbit hole and see how it is all possible with some wrapper patterns: Proxy, Decorator, and Adapter. Wrapper Patterns in C#, Part IV: The Adapter Pattern Feb 16, 2006. In this series of four articles, we will travel down the C# rabbit hole and see how it is all possible with some wrapper patterns: Proxy, Decorator, and Adapter. Generics in C# 2.0 Apr 17, 2006. This articles comes in series with my last article - <a href= class=normal>Limitations in ArrayLists</a>. In this article, I specifically talk about Generics and how they improve upon arraylists and how they solve the issues posed by ArrayLists.. Tip: How to format a column value of a Report programmatically? Jul 21, 2006. In one of my reports, I had to change the format of a column programmatically depending on the value of the column. Tip: How to Print a CheckBox for a Boolean Column in Crystal Reports? Jul 21, 2006. Crystal Reports does not provide a CheckBox conrol. This small tip shows how to create a CheckBox for a boolean column in Crystal Reports.#.. Using Expression Property to create Columns with Dynamic Values Oct 09, 2006. This article shows how to create columns with dynamic values using expression property.. Tip related to sub containers and SqlDataSource Dec 06, 2006. This article provides some tips when working With Master page or SqlDataSource insert function In VS 2005... Implement Sorting in Reports using Report Viewer May 10, 2007. This article shows how to implement sorting on columns in a report using Report Viewer. Get the Sum of a particular column values in a DataGrid Jun 12, 2007. This article shows how we can get the total of a particular column of a DataGrid.. Distributed Transaction Coordinator/Control in asp.net (DTC) Jul 31, 2007. A transaction is a series of work perform as a single unit of work consistency and reliability of the system, can be achieved by binding a set of related operations together in a transaction. Here I will be discussing how we can run distributed application in a application. Introduction to Biztalk Server Sep 24, 2007. This article is the first one part of a series of articles intended to illustrate the principles and applications of Microsoft Biztalk Server. Retrieving Middle Rows from a Table Oct 16, 2007. This article helps in retrieving middle rows of a particular table irrespective of its columns and data types. View database structure using C# Jan 16, 2008. This article describes an easy approach for examining all of the tables, views, and columns in a database. Functional Programming with C#: Dynamic List Generation Jan 27, 2008. This article covers how to use functions as the basis for generating lists given some initial seed values. This technique is useful for constructing different types of numeric series, calculating growth and decay, and also useful for searching algorithms. Host a combo box column within a DataGridView control Feb 26, 2008. In this article I willl show how to host a data grid view combo box column within a data grid view control. Dispaly a Picture in Grid Cell Feb 29, 2008. This article helps to load picture in Grid Cell. Getting Started With F# Mar 22, 2008. This is the first in a series of articles discussing the F# programming language. I cover how to get your dev environment set up to develop with this awesome NET Framework language Generics in C# - Part I Mar 28, 2008. In Part I of this series you will see the importance of generics, you will learn how to use generic types which in the System.Collections.Generic namespace and you will also learn how to create generic methods. The Second Pillar of Object-Oriented Programming - Inheritance May 22, 2008. In this part of the object-oriented programming series I will introduce the second pillar of object oriented programming (inheritance); you will see how to use inheritance to create classes based on existing classes... Writing Your Own GPS Applications: Part II Aug 19, 2008.. Writing GIS and Mapping Software for .NET Aug 20, 2008. In part three of the series, the authors of the "GIS.NET" mapping component for .NET explain how to write a geographic mapping engine which can display geographic coordinates. Source code is provided which can pan and zoom a sample geographic object (the state of Nebraska) in C# and VB.NET. Multithreading in C# Sep 27, 2008. This article discusses how to write multithreading applications in C#. Part I of this series will discuss the basics of threads in .NET. C# IDE Tips & Tricks: Part I Nov 10, 2008. C# developers have been spending most of their day activities with Visual Studio IDE. The article is a part I of this series that talks about some useful IDE tips and tricks for developers. About Column.
http://www.c-sharpcorner.com/tags/Column-Series
CC-MAIN-2016-36
refinedweb
2,078
65.62
"A good workman is known by his tools" - Blogs on the WCF Tooling I2. Update the App.config file by removing the relevant ServiceModel sections - OPTIONAL3. If you generate a WCF VB proxy that contains a DataContract type using svcutil.exe, calling a method that returns the type will always incorrectly return an uninitialized type. This works correctly for C#. John Stallo, a peer of mine, spent some time investigating this issue. Here's the resolution: The problem is a namespace mismatch issue that involves the /Rootnamespace compiler switch (on by default in VB projects). The important line of code that svcutil generates with this switch is an explicit namespace argument for DataContractAttribute. (This information is usually pulled from the service’s WSDL – the namespace below is the default one that’s generated if a namespace isn’t explicitly specified on the data contract on the server side): System.Runtime.Serialization.DataContractAttribute([Namespace]:="")> _ Partial Public Class DataContract1 Apparently svcutil.exe doesn’t generate the explicit namespace argument by default. So when the generated proxy is added to a VB project, the Data Contract type now falls under the VB project’s root namespace (e.g. ConsoleApplication1.DataContract1). Without the explicit namespace argument, WCF has trouble finding the Data Contract type at runtime because the project’s root namespace throws a spanner in the works, which is why you then end up with uninitialized fields. This doesn’t repro with C# because C# projects don’t have an implied root namespace. Workaround: Run svcutil with the following switch: /namespace:*,MyNamespace …where “MyNamespace” is the namespace of your choosing that you want the proxy to be generated in. Note that this will not be an issue with the Service Reference feature that will be available in the Feburary CTP of Visual Studio Orcas. Cheers, The issue with the MapPoint service is that it uses digest authentication, but the WSDL itself does not contain any policy stating this. Therefore, when you generate proxy class and config to consume the Service, it will fail until you add the appropriate configuration and client credentials. If I have time, I'll add another post with the updated WSDL. To get it working you need to do the following: <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> to <security mode="TransportCredentialOnly"> <transport clientCredentialType="Digest" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> Note: In order to use the MapPoint service (i.e. get a user name and password) you will need to register here: One of the demos a peer of mine gave (Johnathan) included creating a .NET form with a Web reference that, using the interop toolkit (just released), could be called from a VB6 app. This is a great scenario because it enables those with a VB6 legacy code base to use some of the cool features in .NET without having to rewrite their VB6 applciations. While I thought that was cool, I wanted to see if the same was possible with WCF in .NET 3.0. As you probably know, the benefit of WCF services is that it highly configurable unlike ASMX in .NET 2.0. The biggest issue in VB 6, however, is to figure out where to add that configuration. The solution is to name the configuration myapp.exe.config and place it right next to the executable, which is simple enough if you publish the VB6 app. What about if you want to debug it from the VB6 IDE? In this case, name the configuration vb6.exe.config and place it right next to the vb6.exe in the VB98 directory. Actual Steps: What's really cool is that you get great intellisense on the InteropForm from VB6! Let me know if you have any issues. As my new role in the VB team, I've been tasked to look at WCF Data bindings and determine our story for Orcas and beyond from a tooling standpoint. As a part of the VB team, we are particularly interested in enabling the N-Teir RAD data story in the Orcas timeframe. What I've been giving thought into is the right user model for our WCF Data binding story and the various approaches that users create the forms. From data I have seen, my perspective is that several people start from the actions that they want to perform. When they see an Amazon API, they want their data grouped under their operations and not a flat list of data they could use in their forms, as their mental model is that of adding functionality to their form. For example, I want this to be the "Add Item to Cart" form. Or I want to add the "Remove Item from Cart" functionality to this form. Another key concept is the idea of data services. Where you are thinking of the data (like DataTables) first and then the operations for that data, which are very SQL-like (or CRUD-like) in nature. For example, a user wants to add an Order and OrderDetails table to his form and be able to update/delete items as required. In this case, when the user drags and drops a datatable, he wants it to automatically hook up the Form_Load and SaveButton_Click handlers by generating the appropriate code. This is so that the behavior for datasets across n-tiers is the same as it would be across 1 tier. Therefore, there are many ways of using the Data Sources window to design a client form using a WCF Service data source, just as they are many ways to design a service (). How would you like to use the data sources window to design your client form? Have I missed a scenario that you consider important? My time at VSTS - Arch has been very important to me. I have learnt a lot shipping VS2005 and working on Orcas planning. I have had the opportunity to work with great people and made great friends. I have also been really impressed with the leadership that the team has shown.! Kitty interned last summer and this paper was a result of a lot of hard work that he put in: Jack Greenfield sent an email around that described the architect from the perspective of the patterns an architect uses: The basic working methods of the architects are covered by a limited set of very generic patterns:- Viewpoint hopping, looking at the problem and (potential) solutions from many points of view, see section 4.2.- Decomposition, breaking up a large problem in smaller problems, introducing interfaces and the need for integration, see section 4.3. - Quantification, building up understanding by quantification, from order of magnitude numbers to specifications with acceptable confidence level, see section 4.4.- Decision making when lots of data is missing, see section 4.5.- Modeling, as means of communication, documentation, analysis, simulation, decision making and verification, see section 4.6.- Asking Why, What, How, When, Where questions, see section 4.7.- Problem solving approach, see section 4.8. This was taken from the book at:. I still remember conversations over lunch about how Pedro did not want to be a dev lead/manager, having done it before. How his real passion was development. Therefore, I was taken a back when I saw the announcement so I ran over to Pedro's office to confirm. Evidently, they made him an offer he couldn't refuse. Let's hope that the dev manager (Dave Sauntry) did not resort to methods that involve horse carcass. :) Not to worry, Pedro will continue to actively develop the DSL tools. Congrats Ped, and hurting... Doing a 720 down the mountain has a completely different connotation for me. As I read Zillow's web page, which is one of the most hyped startups in Seattle, I came across the About my house... page for each of the executives. I thought it was a great idea so, in true form, I ripped it off and came up with my own version for my office room.... It was sooo hard to find this link and I knew what I was looking for, so I thought I'd post it here for the benefit of others. The 'official' data contract/service versioning story is here: I know that this may not satisfy a lot of people both internally and externally, but it is a simple story that just happens to be the POR for versioning in the V1 timeframe frame for WCF. From a tooling perspective, I think that we should at least make this story easier until there is a better one to tell. Why I Hate Frameworks: Internally, I feel that these are the kind of discussions that we have every day. If, for example, we talk about adding a tool window, we usually also start talking about an extensible method for extending the designer to allow users to add their specific tool window should they not like ours. Then it somehow turns into a discussion about coming up with a way to easily snap in any window, not necessarily just a tool window, and provide a way to customize the window to be a tool window. And on and on... In a nutshell, when we talk about designing a feature we start talking about extensibility so that anyone can also add a similar or related feature. With that discussion, we often have to talk about the level of extensibility that we want to support. It's no longer as simple as just adding the feature. So the discussion similar to the factory factory factory mentioned in the blog is something that takes place very commonly. My personal feelings is that there may be a need for a factory, factory, factory given the context. There is, after all, a great need for DSL tools. Users, however, should not have to deal at that level if they don't have to. If they want a hammer, give them the hammer! Most people don't care about the factory it was built in... Senior.
http://blogs.msdn.com/a_pasha/
crawl-002
refinedweb
1,683
61.67
Find Questions & Answers Can't find what you're looking for? Visit the Questions & Answers page! Hi I'm new on PI mapping, and I have some requirement to do the below: If "code" node equal "fix values" return all table columns ( multiple nodes) if "code" node not equal "fix values" return (sub of table columns) * In Second condition, I have option to replace fix values with a predefined value "000". My attempts as below: code >fix values > equalsS > Not > If > extra... constant "000" > equalsS > constant "000" > then Once I have tried to display queue for the first part, I got " cannot cast "000" to Boolean " I used "equalsS" since all fixed values are not numeric values. Can you please assist me how I can resolve the error message, and what is the best way to insert all or sub of table columns? Thank you
https://answers.sap.com/questions/414782/fix-value-with-if-statement.html
CC-MAIN-2018-30
refinedweb
145
72.8
Dino Esposito Wintellect August 2003 Applies to: Microsoft® ASP.NET Summary: Learn about the eventing model built around ASP.NET Web pages and the various stages that a Web page experiences on its way to HTML. The ASP.NET HTTP run time governs the pipeline of objects that transform the requested URL into a living instance of a page class first, and into plain HTML text next. Discover the events that characterize the lifecycle of a page and how control and page authors can intervene to alter the standard behavior. (6 printed pages) Introduction The Real Page Class The Page Lifecycle Stages of Execution Summary Each request for a Microsoft® ASP.NET page that hits Microsoft® Internet Information Services (IIS) is handed over to the ASP.NET HTTP pipeline. The HTTP pipeline is a chain of managed objects that sequentially process the request and make the transition from a URL to plain HTML text happen. The entry point of the HTTP pipeline is the HttpRuntime class. The ASP.NET infrastructure creates one instance of this class per each AppDomain hosted within the worker process (remember that the worker process maintains one distinct AppDomain per each ASP.NET application currently running). The HttpRuntime class picks up an HttpApplication object from an internal pool and sets it to work on the request. The main task accomplished by the HTTP application manager is finding out the class that will actually handle the request. When the request is for an .aspx resource, the handler is a page handler—namely, an instance of a class that inherits from Page. The association between types of resources and types of handlers is stored in the configuration file of the application. More exactly, the default set of mappings is defined in the <httpHandlers> section of the machine.config file. However, the application can customize the list of its own HTTP handlers in the local web.config file. The line below illustrates the code that defines the HTTP handler for .aspx resources. <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/> An extension can be associated with a handler class, or more in general, with a handler factory class. In all cases, the HttpApplication object in charge for the request gets an object that implements the IHttpHandler interface. If the association resource/class is resolved in terms of a HTTP handler, then the returned class will implement the interface directly. If the resource is bound to a handler factory, an extra step is necessary. A handler factory class implements the IHttpHandlerFactory interface whose GetHandler method will return an IHttpHandler-based object. How can the HTTP run time close the circle and process the page request? The IHttpHandler interface features the ProcessRequest method. By calling this method on the object that represents the requested page, the ASP.NET infrastructure starts the process that will generate the output for the browser. The type of the HTTP handler for a particular page depends on the URL. The first time the URL is invoked, a new class is composed and dynamically compiled to an assembly. The source code of the class is the outcome of a parsing process that examines the .aspx sources. The class is defined as part of the namespace ASP and is given a name that mimics the original URL. For example, if the URL endpoint is page.aspx, the name of the class is ASP.Page_aspx. The class name, though, can be programmatically controlled by setting the ClassName attribute in the @Page directive. The base class for the HTTP handler is Page. This class defines the minimum set of methods and properties shared by all page handlers. The Page class implements the IHttpHandler interface. Under a couple of circumstances, the base class for the actual handler is not Page but a different class. This happens, for example, if code-behind is used. Code-behind is a development technique that insulates the code necessary to a page into a separate C# or Microsoft Visual Basic® .NET class. The code of a page is the set of event handlers and helper methods that actually create the behavior of the page. This code can be defined inline using the <script runat=server> tag or placed in an external class—the code-behind class. A code-behind class is a class that inherits from Page and specializes it with extra methods. When specified, the code-behind class is used as the base class for the HTTP handler. The other situation in which the HTTP handler is not based on Page is when the configuration file of the application contains a redefinition for the PageBaseType attribute in the <pages> section. <pages PageBaseType="Classes.MyPage, mypage" /> The PageBaseType attribute indicates the type and the assembly that contains the base class for page handlers. Derived from Page, this class can automatically endow handlers with a custom and extended set of methods and properties. Once the HTTP page handler class is fully identified, the ASP.NET run time calls the handler's ProcessRequest method to process the request. Normally, there is no need to change the implementation of the method as it is provided by the Page class. This implementation begins by calling the method FrameworkInitialize, which builds the controls tree for the page. The method is a protected and virtual member of the TemplateControl class—the class from which Page itself derives. Any dynamically generated handler for an .aspx resource overrides FrameworkInitialize. In this method, the whole control tree for the page is built. Next, ProcessRequest makes the page transit various phases: initialization, loading of view state information and postback data, loading of the page's user code and execution of postback server-side events. After that, the page enters in rendering mode: the updated view state is collected; the HTML code is generated and then sent to the output console. Finally, the page is unloaded and the request is considered completely served. During the various phases, the page fires a few events that Web controls and user-defined code can intercept and handle. Some of these events are specific for embedded controls and subsequently can't be handled at the level of the .aspx code. A page that wants to handle a certain event should explicitly register an appropriate handler. However, for backward compatibility with the earlier Visual Basic programming style, ASP.NET also supports a form of implicit event hooking. By default, the page tries to match special method names with events; if a match is found, the method is considered a handler for the event. ASP.NET provides special recognition of six method names. They are Page_Init, Page_Load, Page_DataBind, Page_PreRender, and Page_Unload. These methods are treated as handlers for the corresponding events exposed by the Page class. The HTTP run time will automatically bind these methods to page events saving developers from having to write the necessary glue code. For example, the method named Page_Load is wired to the page's Load event as if the following code was written. this.Load += new EventHandler(this.Page_Load); The automatic recognition of special names is a behavior under the control of the AutoEventWireup attribute of the @Page directive. If the attribute is set to false, any applications that wish to handle an event need to connect explicitly to the page event. Pages that don't use automatic event wire-up will get a slight performance boost by not having to do the extra work of matching names and events. You should note that all Microsoft Visual Studio® .NET projects are created with the AutoEventWireup attribute disabled. However, the default setting for the attribute is true, meaning that methods such as Page_Load are recognized and bound to the associated event. The execution of a page consists of a sequence of stages listed in the following table and is characterized by application-level events and/or protected, overridable methods. Table 1. Key events in the life of an ASP.NET page Some of the stages listed above are not visible at the page level and affect only authors of server controls and developers who happen to create a class derived from Page. Init, Load, PreRender, Unload, plus all postback events defined by embedded controls are the only signals of life that a page sends to the external world. The first stage in the page lifecycle is the initialization. This stage is characterized by the Init event, which fires to the application after the page's control tree has been successfully created. In other words, when the Init event arrives, all the controls statically declared in the .aspx source file have been instantiated and hold their default values. Controls can hook up the Init event to initialize any settings that will be needed during the lifetime of the incoming Web request. For example, at this time controls can load external template files or set up the handler for the events. You should notice that no view state information is available for use yet. Immediately after initialization, the page framework loads the view state for the page. The view state is a collection of name/value pairs, where controls and the page itself store any information that must be persistent across Web requests. The view state represents the call context of the page. Typically, it contains the state of the controls the last time the page was processed on the server. The view state is empty the first time the page is requested in the session. By default, the view state is stored in a hidden field silently added to the page. The name of this field is __VIEWSTATE. By overriding the LoadViewState method—a protected overridable method on the Control class—component developers can control how the view state is restored and how its contents are mapped to the internal state. Methods like LoadPageStateFromPersistenceMedium and its counterpart SavePageStateToPersistenceMedium can be used to load and save the view state to an alternative storage medium—for example, Session, databases, or a server-side file. Unlike LoadViewState, the aforementioned methods are available only in classes derived from Page. Once the view state has been restored, the controls in the page tree are in the same state they were the last time the page was rendered to the browser. The next step consists of updating their state to incorporate client-side changes. The postback data-processing stage gives controls a chance to update their state so that it accurately reflects the state of the corresponding HTML element on the client. For example, a server TextBox control has its HTML counterpart in an <input type=text> element. In the postback data stage, the TextBox control will retrieve the current value of <input> tag and use it to refresh its internal state. Each control is responsible for extracting values from posted data and updating some of its properties. The TextBox control will update its Text property whereas the CheckBox control will refresh its Checked property. The match between a server control and a HTML element is found on the ID of both. At the end of the postback data processing stage, all controls in the page reflect the previous state updated with changes entered on the client. At this point, the Load event is fired to the page. There might be controls in the page that need to accomplish certain tasks if a sensitive property is modified across two different requests. For example, if the text of a textbox control is modified on the client, the control fires the TextChanged event. Each control can take the decision to fire an appropriate event if one or more of its properties are modified with the values coming from the client. Controls for which these changes are critical implement the IPostBackDataHandler interface, whose LoadPostData method is invoked immediately after the Load event. By coding the LoadPostData method, a control verifies if any critical change has occurred since last request and fires its own change event. The key event in the lifecycle of a page is when it is called to execute the server-side code associated with an event triggered on the client. When the user clicks a button, the page posts back. The collection of posted values contains the ID of the button that started the whole operation. If the control is known to implement the IPostBackEventHandler interface (buttons and link buttons will do), the page framework calls the RaisePostBackEvent method. What this method does depends on the type of the control. With regard to buttons and link buttons, the method looks up for a Click event handler and runs the associated delegate. After handling the postback event, the page prepares for rendering. This stage is signaled by the PreRender event. This is a good time for controls to perform any last minute update operations that need to take place immediately before the view state is saved and the output rendered. The next state is SaveViewState, in which all controls and the page itself are invited to flush the contents of their own ViewState collection. The resultant view state is then serialized, hashed, Base64 encoded, and associated with the __VIEWSTATE hidden field. The rendering mechanism of individual controls can be altered by overriding the Render method. The method takes an HTML writer object and uses it to accumulate all HTML text to be generated for the control. The default implementation of the Render method for the Page class consists of a recursive call to all constituent controls. For each control the page calls the Render method and caches the HTML output. The final sign of life of a page is the Unload event that arrives just before the page object is dismissed. In this event you should release any critical resource you might have (for example, files, graphical objects, database connections). Finally, after this event the browser receives the HTTP response packet and displays the page. The ASP.NET page object model is particularly innovative because of the eventing mechanism. A Web page is composed of controls that both produce a rich HTML-based user interface and interact with the user through events. Setting up an eventing model in the context of Web applications is challenging. It's amazing to see that client-side generated events are resolved with server-side code, and the output of this is visible as the same HTML page, only properly modified. To make sense of this model it is important to understand the various stages in the page lifecycle and how the page object is instantiated and used by the HTTP run time. Dino Esposito is a trainer and consultant based in Rome, Italy. A.
http://msdn.microsoft.com/en-us/library/aa479007.aspx
crawl-002
refinedweb
2,435
62.58
1563597135 Pointers can be a complicated concept in programming languages. C and C++ are known for having pointers, but what about Python? It does! Let’s explore some exciting things about pointers in Python. Table Of Contents What are Pointers? Pointers in Python? Objects 3.1. Immutable Objects 3.2. Mutable Objects Pythons’ Object Model 4.1. C Variables 4.2. Python Names Faking Pointers in Python 5.1. Using Mutable Objects Pointers with ctypes Pointers are variables which store the address of other variables. It’s a data type which stores the address of other data types. If you are familiar with C or C++, then you are familiar with what pointers are? Whenever we create a variable or an object in a programming language, it’s stored in a particular CPU address. Whenever we output the data, it pulls from that address. Pointers are used to store the addresses and for memory management. But, at times pointers can crash our programs. Let’s get into the details. Python doesn’t have any pointers concept. Why doesn’t Python speak about pointers? The reason is unknown. Maybe because of the difficulty level of pointers which is against the Zen of Python. Python focuses on its simplicity instead of speed. We can implement pointers in Python with the help of other objects. We have to first understand some concepts in Python before diving into the pointers. Let’s first see what objects are? And types in it. Everything in Python is an object. If you are new to Python, run the following programs as proof for the above statement. ## int print(f'int:- {isinstance(int, object)}') ## str print(f'str:- {isinstance(str, object)}') ## bool print(f'bool:- {isinstance(False, object)}') ## list print(f'list:- {isinstance(list(), object)}') ## function def sample(): pass print(f'function:- {isinstance(sample, object)}') int:- True str:- True bool:- True list:- True function:- True As you see, everything in Python is an object. Each object in Python consists of three parts. It deals with the memory in the CPU. It represents the number of Python variables referring to a memory location. It refers to the kind of object like int, float, string, etc…, It’s the actual value of an object stored in the memory. Objects are of two types Immutable and Mutable. Knowing about these objects will clear the first step of our pointers. Let’s first see the immutable and mutable. We can’t change the immutable objects once we create them. Most of the commonly used data types in Python are immutable. Let’s see what that means. We can test whether an object is immutable or mutable by using id() and is. int is an immutable object. Let’s see with an example. a = 7 id(a) 1744268544 We have assigned 7 to the a. We can’t modify the value of x in 1744268544 memory. If we try to change it, it will create a new object. Let’s see by adding one to the a. a += 1 id(a) 1744268576 The address of a is changed. That means the object we created first, is now referring to the new address. b = a b is a True When we assign a to b, Python doesn’t create a new object. It merely made reference of b to a value. It saves memory. We can change the mutable objects even after creation. Python doesn’t create new objects when we modify a mutable object. Let’s see with some examples. ## list is a mutable object nums = [1, 2, 3, 4, 5] print("---------Before Modifying------------") print(id(nums)) print() ## modifying element nums[0] += 1 print("-----------After Modifying Element-------------") print(id(nums)) print() ## appending an element nums.append(6) print("-----------After Appending Element-------------") print(id(nums)) ---------Before Modifying------------ 2197288429320 -----------After Modifying Element------------- 2197288429320 -----------After Appending Element------------- 2197288429320 Even after performing some operations on the list, the address doesn’t change. Because the list is a mutable object. The same thing occurs when we perform other mutable objects like set or dict. Now you know the difference between immutable and mutable objects. This makes the upcoming concepts easy to understand. Python variables are different from C. First, we will learn how variables work in C for better understanding of pointers. C variables memory management is entirely different from Python. Let’s see how to define a variable in C and the steps it goes through when executed. // C syntax not Python int a = 918 Execution steps of the above statement. If we illustrate the memory, it may look like the following. Here, a has a memory location of 0x531. If we update the value of a. The address location of a doesn’t change. a = 849 If we see the location of a didn’t change in C programming language, the variable is not just a name for the value. It’s a memory location itself. So, we are overwriting the value of a memory location directly. It’s completely different from Python. If we want to assign a to another variable, then C creates a new memory location, unlike Python. The following code assigns a to a new variable b. int b = a Notice that the address of b has changed. It’s because the C creates a new memory location for every variable we create. C creates a new memory location for b and copies the values of a and assigns them to b. This how C variables work. Now, let’s move on to find out how Python variables work. Generally, variables in the Python are called names. ## code in python a = 918 The above code will undergo the following steps during execution. In memory, a may look like the following. a reference memory location illustration a refers to the above PyObject in the memory. It’s completely different from C variables. a is not a memory location as it was in C variables. a = 98 The above statement undergoes the following steps during execution. In memory a refers to the new PyObject. So, the old PyObject refer count will be 0. New PyObject a refers to the immediate below PyObject Old PyObject The old PyObject reference count is 0. Because the variable a refers to the new PyObject. What happens when we assign a to a new variable b? Let’s see… b = a Python doesn’t create a new PyObject for the variable b. Python makes the reference count of a’s PyObject to two. Those two variables are a and b. a and b refers the same PyObject To see whether a and b referred to the same memory location or not, run the following code. a is b True is returns True both variables refer to the same PyObject. If we modify the value of b Python creates a new PyObject for b because integers are immutable in Python. Now, you are familiar with the Pythons’ object model. Developers of Python didn’t include pointers in Python. But still, we can stimulate the pointers in Python using different methods. Let’s write a small function in C, which takes a pointer as an argument and increments the value of variables present in that memory location. // C code void increment(int *p) { *p += 1; } The increment function takes a pointer and increments the value of the pointer referring variable. Let’s write the main function. // C code main function void main() { int a = 759; printf("%d\n", a); increment(&a); // & operator used to extract the adress of the variable printf("%d\n", a); } // Output 759 769 Now, we are going to implement the same behavior in Python using mutable objects. Let’s see… We can replicate the above program using mutable objects in Python. Let’s see how we can do this. ## function def increment(p): p[0] += 1 if __name__ == "__main__": a = [759] increment(a) print(a[0]) 760 We have achieved the same result without changing the memory location of the variable. The function increment takes a list and increments the first element. That’s it. We have achieved the same because lists are mutable. If we try to pass a tuple as an argument to the increment function, we will get an error. if __name__ == "__main__": a = (759,) increment(a) print(a[0]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-32-c3bce5df94da> in <module>() 1 if __name__ == "__main__": 2 a = (759,) ----> 3 increment(a) 4 print(a[0]) <ipython-input-30-042f4c577fd9> in increment(p) 1 ## function 2 def increment(p): ----> 3 p[0] += 1 4 5 if __name__ == "__main__": TypeError: 'tuple' object does not support item assignment These are not real pointers like C. All we did was replicate the behavior of pointers in Python. Using ctypes module, we can create real pointers in Python. First, we will compile a .c file containing functions which use pointers and store it. Let’s write the following function into a .c file void increment(int *p) { *p += 1; } Let’s assume the file name is increment.c and run the following commands. $ gcc -c -Wall -Werror -fpic increment.c $ gcc -shared -o libinc.so increment.o The first command compiles increment.c into an object called increment.o. The second takes the object file and produces libinc.so to work with ctypes. import ctypes ## make sure the libinc.so present in the same directory as this program lib = ctypes.CDLL("./libinc.so") lib.increment ## output <_FuncPtr object at 0x7f46bf6e0750> The ctypes.CDLL returns a shared object called libinc.so. We define increment() function in the libinc.so shared object. If we want to pass a pointer to the functions we define in a shared object, then we have to specify it using the ctypes. inc = lib.increment ## defining the argtypes inc.argtypes = [ctypes.POINTER(ctypes.c_int)] Now, if we try to call the function using a different type, we will get an error. inc(5) ## output Traceback (most recent call last): File "<stdin>", line 1, in <module> ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_int instance instead of int We got an error saying that the function wants a pointer. ctypes has a way to pass the C to the functions. a = ctypes.c_int(5) a is a C variable. ctypes has a method called byref() which allows you to pass the variable reference. inc(ctypes.byref(a)) a ## output c_int(6) Now, we have an incremented value in the a. Now, you have a better understanding of Pythons’ objects and pointers. Pointers are not present in Python. But, we implemented the same behavior with mutable objects. The Pointer we implemented with ctypes are real C pointers.
https://morioh.com/p/095c00a10d95
CC-MAIN-2021-49
refinedweb
1,780
68.26
schwarz - Home tag:germanforblack.com,2008:mephisto/ Mephisto Noh-Varr 2008-01-18T11:14:23Z ben tag:germanforblack.com,2008-01-14:25 2008-01-14T14:39:00Z 2008-01-18T11:14:23Z OpenURI and MemCached sitting in a tree <p>The <em>ultimate</em> frankenstein-like experiment of harnessing OpenURI and MemCached has been completed!</p> <p>For a number of projects that used openuri, I needed a way to reduce hits on remote services or rest apis, or even speed up the experience on the client end.</p> <h3>Getting it</h3> <p><code></p> <pre> sudo gem install openuri_memcached </pre> <p></code></p> <h3>The beast is alive! (Usage, for those not on late hours right now)</h3> <p>Use exactly the same as you would openuri, only.. enable it.</p> <p><code></p> <pre> require 'openuri_memcached' OpenURI::Cache.enable! open("").read # Slow as a wet week </pre> <p></code></p> <p>Quit your app (leave memcached running) and run the same example, it should now happen in less then … some time that is really fast.</p> <h3>Small print options</h3> <p>To get started run your memcached server</p> <p><code> $ memcached -d </code></p> <p>The default address that this gem will terminate against is localhost:11211, you can change this using:</p> <p><code>OpenURI::Cache.host = ['serverone.com:11211', 'servertwo:11211']</code></p> <p>The cache defaults to 15 minutes, however this can be changed using:</p> <p><code>OpenURI::Cache.expiry = 60 * 10 # Ten long minutes</code></p> <p>Let me know if you have any issues with it, or if you have any use for it!</p> <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-12-06:17 2007-12-06T22:24:00Z 2007-12-31T05:22:10Z A ruby Kuler parser <p>I wrote <a href="">this little diddy</a> a couple of weeks ago; Since then it has sat on my desktop as a constant reminder of the little time I have to do anything with the snippets of crap that I write on a regular basis.</p> <p>Due to this very reason, its probably better on the web for anyone who was interested in grabbing colours from <a href="">Kuler</a>, Adobe labs' user submitted colour... thing.</p> <h3>Usage</h3> <pre><code> require 'kuler' include Kuler Kuler::recent => ["0E2F32", "C1E6B7", "006A69", "AAC593", "236555"] </code> </pre> <p>This will give you an Array of recently posted colours' in hex values, other options are <code>Kuler::rating</code> and <code>Kuler::popular</code></p> <p>Having a poke around the Kuler site should show you that no decent API exits, however you can send some query strings to their awfully formatted RSS feed.</p> <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-10-20:15 2007-10-20T22:41:00Z 2008-01-08T23:34:19Z Javascript: Sleep, keypress delays and bashing bad articles <p>Today I read the <a href="">high scalability article</a> aimed to reduce the amount of requests to your server by not sending XMLHttpRequests for every keystroke. </p> <p>It was suggested that a <code>onblur</code> event was used to measure when the user had stopped typing.</p> <p>Will your users expect to have to tab out of a field before something else happens? Will it confuse them if they've started typing in another text area? <strong>Probably.</strong></p> <p>At <a href="">work</a>, I'd whipped up something elegant to handle this very same paradigm for validating or searching user input.</p> <h3>Example</h3> <p>(using jquery to make those events really easy)</p> <pre> <code> $('input.search').keyup(function () { // Lets have a clean version of the search string, you could really do more there though var search_term = new RegExp(this.value.replace(/\\/g, ''), "i"); var search_execution = function () { // Expensive server queries here - buy some real servers guys! (what on earth are you requesting?) }.sleep(175); }); </code> </pre> <p>175 milliseconds delay before the method is executed is a good typing rate. Maybe you want to change this to something that you're more comfortable with though.</p> <p><em>Hold on</em>, last time I checked, <code>sleep()</code> wasn't a part of the standard JavaScript language. Rather than using a simple <code>setTimeout()</code>, I decided that the ajax'd method shouldn't be executed again until it had finished the last time it ran.</p> <h3>The sleep method</h3> <pre> <code> Function.prototype.sleep = function (millisecond_delay) { if(window.sleep_delay != undefined) clearTimeout(window.sleep_delay); var function_object = this; window.sleep_delay = setTimeout(function_object, millisecond_delay); }; </code> </pre> <p>er, yeah.. thats about it. I just really wanted to post the sleep method. I'd written it over a year ago now, but it's still used on a pretty regular basis. I use it for searching conducted in the DOM by hiding elements that don't match a simple regex.</p> <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-10-05:14 2007-10-05T17:06:00Z 2007-10-06T01:16:43Z Grabbing mysql production databases to your local system with rake After reading the comments on <a href="" title="using rake to sync remote databases">Nate Clarke's article</a> I decided it would be a good idea to republish the <strike>stolen</strike> modified script that I found elsewhere (Honestly, I have no idea. If anyone can cite the original author I'll give credit where due) <code> <pre> namespace :db do desc "Sync your local database with a remote one REMOTE=name_of_database LOCAL=your_local_db" task :sync do `ssh domain.com "mysqldump --skip-extended-insert -u db_username -p #{ENV['REMOTE']} | bzip2 " | bzcat | mysql -u root #{ENV['LOCAL'] || "app_development"}` end end </pre> </code> <h3>The rundown</h3> <ul> <li><a href="" title="SCT">We</a> use this almost daily</li> <li>Use RSA keys and you'll only need to auth once (for the database)</li> <li>I'm using --skip-extended-insert because it will write each query on a new line (for larger databases mysql can be known to crack the shits on a default setup when everything is inserted in a massive chunk)</li> <li>Its using bzip to compress it over the wire (sadly, this was the original authors smarts)</li> </ul> <h3>Usage</h3> <code> <pre> rake db:sync REMOTE=my_db_with_lots_of_data </pre> </code> This is great for testing your app with different versions of data (for ridiculous migrations and such <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-09-19:11 2007-09-19T10:45:00Z 2007-12-31T05:36:37Z Extreme expires headers for nginx and mongrel <p><a href="">Like everyone else</a>, I read <a href="">ezra's</a> nginx config and put it straight to use.</p> <p>After recently becoming addicted to <a href="">yslow</a>, tweaking configs day and night (well, it happened once. yslow is great though) I decided to add expires headers to anything that isn't served by rails, your js, css, images etc. </p> <p>Without further ado, my config:</p> <pre> <code> worker_processes 2; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include conf/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx_access.log main; error_log /var/log/nginx_error.log debug; sendfile on; tcp_nopush on; tcp_nodelay off; gzip on; gzip_http_version 1.0; # More is heavier on the CPU gzip_comp_level 5; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; upstream schwarz { server 127.0.0.1:4000; server 127.0.0.1:4001; server 127.0.0.1:4002; } server { listen 80; client_max_body_size 50M; server_name .germanforblack.com; root /var/www/public; access_log /var/log/nginx.vhost.access.log main; location / { proxy_set_header X-Real-IP $remote_addr; # needed for HTTPS proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; proxy_max_temp_file_size 0; if (-f $request_filename) { <strong>expires max;</strong> break; } if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } # Tasty caching if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass; break; } } error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/public; } } } </code> </pre> <p>Note the expires method. You just sped up your app dramatically</p> <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-09-18:10 2007-09-18T13:50:00Z 2007-09-18T13:51:09Z How to use lighttpd to serve a static site for development <p>Write the following into your /etc/lighttpd/lighttpd.conf</p> <pre> <code> server. ben tag:germanforblack.com,2007-08-30:9 2007-08-30T11:52:00Z 2007-09-03T04:02:36Z Modern javascript slides <p>My slides from the Melbourne Ruby User Group, <a href="">“Modern Javascript”</a> are available in PDF. </p> <p><a href=""><img src="" alt="Modern javascript" /></a></p> <p>Unfortunately no audio was recorded and the slides will make little sense without speech over the top. Hopefully a reference of the talk for those who wanted it.</p> <img src="" height="1" width="1"/> ben tag:germanforblack.com,2007-08-19:4 2007-08-19T09:24:00Z 2007-10-04T12:46:11Z Introducing GoogleQuery <p>So, I love Hpricot because it feels like an extension of my hand.</p> <p>So, I love Hpricot because it feels like an extension of my hand.</p> <h2>So, I love Hpricot because it feels like an extension of my hand.</h2> <p>Google (and Yahoo) have awesome human searchable queries like “people in china”.</p> <p>The top most search result will show you the amount of people in china.</p> <p>I quickly decided that this would be useless; however incredible to show my <em>mad-ill flow</em> with css selectors. </p> <p>First, grab the gem from Rubyforge using:</p> <p><code>sudo gem install google_query</code></p> <p>Leap your ass into irb, require the gem and start screwing around</p> <p><em>See how you get spanked by the pound</em></p> <p><code>GoogleQuery::Currency.get 'AUD to GBP'</code></p> <p><code>=> 1 U.S. dollar = 0.490484599 British pounds</code></p> <p><em>Population in Melbourne</em></p> <p><code>GoogleQuery::Population.get 'melbourne'</code></p> <p><code>=> Population: 3,850,000 (Est.) (2nd)</code></p> <p><em>Current time in London</em></p> <p><code>GoogleQuery::Time.get 'london'</code></p> <p><code>=> 2:26 PM on Monday, July 30</code></p> <p><em>On the command line</em></p> <p><code>bens-pb:~ ben$ gpop melbourne</code></p> <p><code>=> Population: 3,850,000 (Est.) (2nd)</code></p> <p><code>bens-pb:~ ben$ gtime london</code></p> <p><code>=> 2:26 PM on Monday, July 30</code></p> <p><em>I couldn’t resist naming it gmoney</em></p> <p><code>bens-pb:~ ben$ gmoney AUD GBP</code></p> <p><code>=> 1 Australian dollar = 0.424269178 British pounds</code></p> <p>There you have it, my first gem <em>ever</em>.</p> <p>Some queries may be broken, this could be due to google changing their search results screen or just no damn results.</p> <img src="" height="1" width="1"/>
http://feeds.feedburner.com/schwarz
crawl-002
refinedweb
1,890
54.52
Creating a Backend for Your iOS App Using Firebase Firebase is a Backend as a Service platform that can help you quickly develop and deploy your application. It provides a myriad of features including Realtime Database, Authentication (with email and password, Facebook, Twitter, GitHub and Google), Cloud Messaging, Storage, Hosting, Remote Config, Test Lab, Crash Reporting, Notification, App Indexing, Dynamic Links, Invites, AdWords and AdMob. In this article, we’ll create a simple To Do app that will show how to save and retrieve data from Firebase, how to authenticate users, set read/write permissions on the data and validate the data on the server. Getting Started To get started, first download the repository that contains the starter project that we’ll use in the tutorial and then head over to Firebase and create an account if you don’t already have one. When you run the downloaded project, you will see a Login view. The Login view has a Register button that takes you to the Sign Up view when tapped; and on this view, there is a Sign Up form as well as a Login button that takes you back to the Login view. To add the Firebase libraries to the project, we’ll use CocoaPods. First make sure that you have CocoaPods installed on your computer. Open Terminal and navigate to the root of the downloaded project with cd Path/To/ToDo\ App (the \ escapes the whitespace in the directory name). Create a Podfile with the following command. pod init Then open the Podfile with: open -a Xcode Podfile Modify the file’s content as shown below. platform :ios, '10.0' target 'ToDo App' do use_frameworks! pod 'Firebase/Auth' pod 'Firebase/Database' end The Firebase library consists of different subspecs. In the above, we include the /Auth subspec which is used for authentication and the /Database subspec that is needed to work with the Firebase realtime database. The /Core subspec is required for your app to work with Firebase, but we don’t have to include it in the Podfile because the subspecs we added depend on it. Therefore, when we run pod install to fetch the project’s dependencies, the /Core library will be fetched as well. Run pod install to fetch the project’s dependencies. After installation is complete, close the Xcode project and open ToDo App.xcworkspace. Next, head over to the Firebase console and click on the Create a New Project button. A dialog window will pop up for you to input the project’s details. Enter a name and country/region for the project. The country/region represents the country/region of your organisation/company. Your selection also sets the appropriate currency for your revenue reporting. After setting a name (I used ToDoApp) and region for the project, click on the Create Project button. A project will be created and its console opened. From the project’s console, click on the Add Firebase to your iOS App option. Then enter your iOS project data in the window that pops up. We’ll leave the App Store ID field blank, but if you are integrating Firebase to an app that is on the App Store, you can find the ID in your app’s URL. In the example below, 123456789 is the App Store ID. Click on the Add App button and a GoogleService-Info.plist file will be downloaded to your machine. Move the file into the root of your Xcode project and add it to all targets. The plist file contains configuration settings that the iOS app needs to communicate with the Firebase servers. It contains such things as the URL to the Firebase project, the API key, e.t.c. In the previous version of Firebase, you had to store these manually in your app’s code, but now the process has been simplified with the use of one file that contains the needed data. If you are using versioning and storing your code in a public repository, you should consider not making the GoogleService-Info.plist publicly accessible. If it’s used beyond its limits, it will stop working and if you are on a paid plan, you wouldn’t want anyone abusing that and running up your costs. On the Firebase console, press Continue to move forward in the project setup. We’ve already done the above steps, so click on Continue. Follow the instructions on the last page of the dialog and add the Firebase initialisation code to your AppDelegate class. This connects to Firebase when the app starts. Add the following import to AppDelegate.swift import Firebase Then add the following to application(_: didFinishLaunchingWithOptions:), before the return statement. FIRApp.configure() On the Firebase console, click on Finish to complete the project setup. Security and Rules Before retrieving and saving data from the Firebase server, we’ll set up authentication and add rules that restrict access to data and validate user input before it’s saved. Authentication The Firebase API enables you to setup email/password, Facebook, Twitter, GitHub, Google and anonymous authentication. In our app, we’ll use email/password authentication. To enable email/password authentication, select Authentication from the left panel of the Firebase console and navigate to the Sign-In Method tab. Enable the Email/Password authentication provider and click on Save. Back in Xcode, modify LoginViewController.swift as shown. import UIKit import FirebaseAuth class LoginViewController: UIViewController { @IBOutlet weak var emailField: UITextField! @IBOutlet weak var passwordField: UITextField! override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if let _ = FIRAuth.auth()?.currentUser { self.signIn() } } @IBAction func didTapSignIn(_ sender: UIButton) { let email = emailField.text let password = passwordField.text FIRAuth.auth()?.signIn(withEmail: email!, password: password!, completion: { (user, error) in guard let _ = user else { if let error = error { if let errCode = FIRAuthErrorCode(rawValue: error._code) { switch errCode { case .errorCodeUserNotFound: self.showAlert("User account not found. Try registering") case .errorCodeWrongPassword: self.showAlert("Incorrect username/password combination") default: self.showAlert("Error: \(error.localizedDescription)") } } return } assertionFailure("user and error are nil") } self.signIn() }) } @IBAction func didRequestPasswordReset(_ sender: UIButton) { let prompt = UIAlertController(title: "To Do App", message: "Email:", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default) { (action) in let userInput = prompt.textFields![0].text if (userInput!.isEmpty) { return } FIRAuth.auth()?.sendPasswordReset(withEmail: userInput!, completion: { (error) in if let error = error { if let errCode = FIRAuthErrorCode(rawValue: error._code) { switch errCode { case .errorCodeUserNotFound: DispatchQueue.main.async { self.showAlert("User account not found. Try registering") } default: DispatchQueue.main.async { self.showAlert("Error: \(error.localizedDescription)") } } } return } else { DispatchQueue.main.async { self.showAlert("You'll receive an email shortly to reset your password.") } } }) } prompt.addTextField(configurationHandler: nil) prompt.addAction(okAction) present(prompt, animated: true, completion: nil) }Login", sender: nil) } } In the above code, we first check whether the user is signed in in viewDidAppear(). FIRAuth.auth()?.currentUser gives the authenticated user (if any). The user is represented by a FIRUser object. If they are signed in, we call signIn() which performs a segue that is already created in the storyboard file. This segue navigates to the ItemsTableViewController which is where our list of items will be shown. didTapSignIn() sends the user’s input to Firebase for authentication. FIRAuth.auth()?.signIn(withEmail: password: completion:) is used to sign in a user using the email and password combination. Each of the authentication providers (e.g. Google, Facebook, Twitter, Github, e.t.c) uses a different method call. When the user is successfully authenticated, signIn() is called, otherwise an error message will be shown to the user. If authentication fails, an NSError object is returned back from the server. It carries an error code that you can use to determine the cause of the error and give the user an appropriate error message. In the above code, we give different error messages when the user enters a non existent account or when they enter the wrong password. For other errors, we show the user a description of the error with error.localizedDescription. In a real app, you might not want to show this to the user. The message returned by error.localizedDescription is best suited for the developer when debugging, but for your users, you should use a better catch-all error message. didRequestPasswordReset() is called when the Forgot Password button is tapped. Here, we create an alert box that the user can use to enter an email address where the Password Reset email will be sent. This is another of the many advantages offered by Firebase. Password reset functionality has already been set up; you don’t have to code it up yourself. If you look at the Firebase control under Authentication > Email templates, you can modify the email message sent to users for Email address verification, Password reset and Email address change. Note that in the code above, the alert is called in the main thread by using DispatchQueue.main.async and not in the background thread that handles the callback function. Any code that updates the app’s UI should be run in the main queue. To test the password reset functionality, you can create a User on the Firebase console under Authentication > Users > Add User. Enter an email and password for the User (use a real email if you want to receive the password reset email). Back in Xcode, run the project. You should be able to enter an email and have the password reset email sent to it. With the Login functionality done, let us now add the Sign Up functionality. Modify SignUpViewController as shown. import UIKit import FirebaseAuth class SignUpViewController: UIViewController { @IBOutlet weak var emailField: UITextField! @IBOutlet weak var passwordField: UITextField! @IBAction func didTapSignUp(_ sender: UIButton) { let email = emailField.text let password = passwordField.text FIRAuth.auth()?.createUser(withEmail: email!, password: password!, completion: { (user, error) in if let error = error { if let errCode = FIRAuthErrorCode(rawValue: error._code) { switch errCode { case .errorCodeInvalidEmail: self.showAlert("Enter a valid email.") case .errorCodeEmailAlreadyInUse: self.showAlert("Email already in use.") default: self.showAlert("Error: \(error.localizedDescription)") } } return } self.signIn() }) } @IBAction func didTapBackToLogin(_ sender: UIButton) { self.dismiss(animated: true, completion: {}) }SignUp", sender: nil) } } In the above code, when the user taps on the Create Account button didTapSignUp() is called. Here, we take the user’s input and call FIRAuth.auth()?.createUser(withEmail: password: completion:) to try and create an account with the entered details. If signup fails, an error message is shown, otherwise signIn() is called which performs a segue to the ItemsTableViewController. This segue had already been created in the storyboard file of the starter project. Run the app. You should be able to create an account and confirm its creation on the Firebase console. If you had previously logged in, and thus can’t get to the Login view, you can reset the simulator with Simulator > Reset Content and Settings. By default, Firebase sets a rule on the accepted length of the password – it must be at least 6 characters long. You can set more rules on this, on the Firebase Console. Shortly, we’ll see how to set up rules. More on this here. Authorization and Data Validation The Firebase Realtime Database provides an. We’ve set up authentication for our project, but we can make users data even more secure by defining some rules for it. By default, Firebase has the following rules viewable by navigating to Database > Rules on the console. { "rules": { ".read": "auth != null", ".write": "auth != null" } } The above security rules require users to be authenticated to read or write any data to the database. Modify the rules as shown and hit Publish. { "rules": { "users": { "$uid": { ".read": "auth != null && auth.uid == $uid", ".write": "auth != null && auth.uid == $uid", "items": { "$item_id": { "title": { ".validate": "newData.isString() && newData.val().length > 0" } } } } } } } In the above, auth != null && auth.uid == $uid has been set on the read and write permissions. With this rule, not only will the user need to be authenticated to read or write any data to the database, but they will also only have access to their own data. Firebase stores data in JSON format. In our database, each user will have an array of to-do items named items. Each item will have a title. In the above, we add some validation that ensures that an item with an empty title won’t be saved. Saving Data With authentication and authorization done, we’ll now see how data can be saved and retrieved to and from Firebase. First create a new file called Item.swift and modify it as shown. This will be the Item model class Each Item will have a title and ref which will hold a FIRDatabaseReference object. A FIRDatabaseReference represents a particular location in your Firebase Database and can be used for reading or writing data to that Firebase Database location. import Foundation import FirebaseDatabase class Item { var ref: FIRDatabaseReference? var title: String? init (snapshot: FIRDataSnapshot) { ref = snapshot.ref let data = snapshot.value as! Dictionary<String, String> title = data["title"]! as String } } Then modify ItemsTableViewController as shown. import UIKit import Firebase class ItemsTableViewController: UITableViewController { var user: FIRUser! var items = [Item]() var ref: FIRDatabaseReference! private var databaseHandle: FIRDatabaseHandle! override func viewDidLoad() { super.viewDidLoad() user = FIRAuth.auth()?.currentUser ref = FIRDatabase.database().reference() startObservingDatabase() } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return items.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) let item = items[indexPath.row] cell.textLabel?.text = item.title return cell } override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { let item = items[indexPath.row] item.ref?.removeValue() } } @IBAction func didTapSignOut(_ sender: UIBarButtonItem) { do { try FIRAuth.auth()?.signOut() performSegue(withIdentifier: "SignOut", sender: nil) } catch let error { assertionFailure("Error signing out: \(error)") } } @IBAction func didTapAddItem(_ sender: UIBarButtonItem) { let prompt = UIAlertController(title: "To Do App", message: "To Do Item", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default) { (action) in let userInput = prompt.textFieldsfor itemSnapShot in snapshot.children { let item = Item(snapshot: itemSnapShot as! FIRDataSnapshot) newItems.append(item) } self.items = newItems self.tableView.reloadData() }) } deinit { ref.child("users/\(self.user.uid)/items").removeObserver(withHandle: databaseHandle) } } In the above, we start off by instantiating some variables in viewDidLoad(). We set user with the value of the logged in user and then set ref with a FIRDatabaseReference object. FIRDatabase.database().reference() gets a FIRDatabaseReference for the root of your Firebase Database. We then call startObservingDatabase(). In startObservingDatabase() we set a listener for any changes to the database. Firebase data is retrieved by attaching an asynchronous listener to a FIRDatabase reference. The listener is triggered once for the initial state of the data and again anytime the data changes. To add an event listener, we use the observeEventType() method to specify an event type and callback block. You can listen for the following types of events: - FIRDataEventTypeValue – Read and listen for changes to the entire contents of a path. - FIRDataEventTypeChildAdded – Retrieve lists of items or listen for additions to a list of items. Suggested use with FIRDataEventTypeChildChangedand FIRDataEventTypeChildRemovedto monitor changes to lists. - FIRDataEventTypeChildChanged – Listen for changes to the items in a list. Use with FIRDataEventTypeChildAddedand FIRDataEventTypeChildRemovedto monitor changes to lists. - FIRDataEventTypeChildRemoved – Listen for items being removed from a list. Use with FIRDataEventTypeChildAddedand FIRDataEventTypeChildChangedto monitor changes to lists. - FIRDataEventTypeChildMoved – Listen for changes to the order of items in an ordered list. FIRDataEventTypeChildMovedevents always follow the FIRDataEventTypeChildChangedevent that caused the item’s order to change (based on your current order-by method). We listen for the FIRDataEventTypeValue event. value of the snapshot returned is nil. Note that the FIRDataEventTypeValue event is fired every time data is changed at the specified database reference, including changes to children. To limit the size of your snapshots, you should attach only at the highest level needed for watching changes. For example, attaching a listener to the root of your database is not recommended. In our code, we attach the listener to /users/{user id}/items which is the path that will hold a user’s items. The listener receives a FIRDataSnapshot that contains the data at the specified location in the database at the time of the event in its value property. If no data exists at the location, the value is nil. From the snapshot, we create Item objects set them to the items array that is used to populate the table view. We then reload the table view to reflect the data change. numberOfSectionsInTableView(), tableView(_: numberOfRowsInSection:) and tableView(_: cellForRowAtIndexPath) are the usual table view functions used to set the table view’s data. The app contains an Add button in its navigation bar, which when tapped, calls didTapAddItem(). Here, we show the user an Alert box that they can use to add an item to the table view. We save the value added by the user to /users/{user id}/items/{item id}/title/. There are four methods for writing data to the Firebase Realtime Database: - setValue – Write or replace data to a defined path, such as users/<user-id>/<username>. - childByAutoId – Add to a list of data. Every time you call childByAutoId, Firebase generates a unique key that can also be used as a unique identifier, such as user-posts/<user-id>/<unique-post-id>. - updateChildValues – Update some of the keys for a defined path without replacing all of the data. - runTransactionBlock – Update complex data that could be corrupted by concurrent updates. The child() function grabs the reference of a particular node if it exists or creates it if it doesn’t exist. We use childByAutoId() to set a unique ID to every item that will be created. We then use setValue() to add the user’s input as the value for item’s title. tableView(_: commitEditingStyle: forRowAtIndexPath:) makes the table view editable. With this, the user will be able to swipe on an item to delete it. We call removeValue() with a reference to the swiped on item. This removes the data at that location in the database. After deleting an item, we don’t have to make any changes to the table view. Remember that we set a listener to any changes made on the ../items/ path on the database, so the callback we set for this will be responsible for updating the table. didTapSignOut() is called when the Sign Out button on the app’s navigation bar is tapped. Here we sign out the user and perform a segue back to the Login screen. Run the app and you should be able to add an item. Any item you add will be added to the table view. Check the Firebase Console, and you will see the added data. To delete an item, swipe on it to reveal a Delete button. That brings us to the end of the tutorial. We’ve seen how to save and retrieve data to and from the Firebase realtime database, and how to set up authentication and data authorization. The data saving we’ve looked at is ideal for simple data types such as NSString, NSNumber, NSArray and NSDictionary. If you want to save files like images or documents to Firebase, then look into Firebase Storage. The tutorial was a quick intro to using Firebase, it was not an exhaustive look into all that Firebase does. For this, be sure to read through the documentation. You can download the completed project here. Remember to add the GoogleService-Info.plist file generated from Firebase to the project. Note You might have noticed some warnings in your project after adding the Firebase libraries, or on running the completed project if you downloaded it. The warning error message states Conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'. This little bug came with the update of Firebase to Swift 3 and the issue has been filed. If you look at the message threads in that last link, the issue has been fixed, but changes won’t be seen in Firebase until the next release. The app still works despite this.
https://www.sitepoint.com/creating-a-firebase-backend-for-ios-app/?utm_source=sitepoint&utm_medium=articletile&utm_campaign=likes&utm_term=mobile
CC-MAIN-2018-26
refinedweb
3,345
58.38
Groovy 2.5.0 adds several methods to make working with Java 8 Streams more Groovy. First of all the methods toList and toSet are added to the Stream class. These methods will convert the stream to a List and Set using the Stream.collect method with Collectors.toList and Collectors.toSet as argument. Furthermore we can convert any array object to a Stream using the stream method that is added to all array objects. In the following example we use the support of converting an array to a Stream and then getting a List and Set from the stream: def sample = ['Groovy', 'Gradle', 'Grails', 'Spock'] as String[] def result = sample.stream() // Use stream() on array objects .filter { s -> s.startsWith('Gr') } .map { s -> s.toUpperCase() } .toList() // toList() added to Stream by Groovy assert result == ['GROOVY', 'GRADLE', 'GRAILS'] def numbers = [1, 2, 3, 1, 4, 2, 5, 6] as int[] def even = numbers.stream() // Use stream() on array objects .filter { n -> n % 2 == 0 } .toSet() // toSet() added to Stream assert even == [2, 4, 6] as Set Written with Groovy 2.5.0.
http://mrhaki.blogspot.com/2018/06/groovy-goodness-java-8-stream.html
CC-MAIN-2018-34
refinedweb
182
85.39
Jul 13, 2010 03:30 AM|LINK I keep trying to add an assembly reference to my website which doesn't show up anywhere in my code. Specifically, I would like to add a reference to System.Xml.Linq.dll to my website. No such reference appears in my web.config file. Also, when I right click on the website in the Solution Explorer window, go to Property Pages, and then click on References in the left-hand column, System.Xml.Linq does not appear. Yet, when I right-click on the website and go to add reference, I ultimately am met with the error: "The website is already referencing the assembly 'System.Xml.Linq'" Also, when I put a using statement at the top of one of my classes in my App_Code folder for the System.Xml.Linq namespace, the Visual Studio IDE does not flag it as an error. Any insight into this strangeness would be very much appreciated. I'd like to put this into production someday, and I'm worried it might not work due to a missing reference. The version I'm currently using is Visual Studio 2010 Professional Edition. Thanks in advance to anyone who has any ideas! Cheers, Andrew assemblies reference All-Star 16558 Points Microsoft Jul 13, 2010 07:04 AM|LINK try restarting the system.. Jul 13, 2010 12:15 PM|LINK Hi Nizam, thanks for the reply. I am unable implement your suggestions, though. When I right-click the solution, there is no option for "Clean". It also doesn't exist on the main menu under "Build". Also, I tried right-clicking the website in the solution explorer, but there was no item for "Bin". There was an item already there for "Add reference", which I tried, but still I was met with the same problem. Cheers, Andrew Jul 13, 2010 03:39 PM|LINK hy i think you have tried all options, Try to create a new project and then try to add same reference, are you still getting same problem if yes then you might want to repair your visual studio from control panel>>Add remove programm other wise there should be some problem with your project, you need to look into project properties, Jul 13, 2010 06:30 PM|LINK Thanks Nizam, that was a good point about trying to recreate the problem in a new website project. After doing so, I noticed the same phenomenon in the new and empty website. I've concluded that I must be missing something concerning how visual studio keeps track of references to assemblies. The reason is that in the "Class View" window [View -> Class View from the main menu], I just found a folder named Project References. This folder does indeed contain a reference to System.Xml.Linq, something which I did not notice earlier. I am still unclear as to why the references in this folder do not show up in the web.config file. But at least I was able to find mention of System.Xml.Linq somewhere in the IDE. Thanks again for all of your replies! Cheers, Andrew Aug 30, 2010 05:45 PM|LINK I am having a similar problem with reportviewer dlls while trying to upgrade from a framework 2.0 site to 3.5; I'm running Windows 7 and VS2010 so I can't use the reportviewer 2005 references...since class viewer is the only place I'm finding the references--what did you do to remove them? ejo Aug 31, 2010 11:19 AM|LINK Ejo, I don't think I ever removed the references from my website. I just wasn't able to understand why the reference was showing up in the Class View but not in my web.config file. For me, the reference to the assembly in question still exists in the Class View of my website... One thing to note is that when I started working on my website, I went to File > New > Website and chose ASP.Net Empty Website from the dialog box. So I don't have a reference to Microsoft.ReportViewer.WebForms.dll in my Class View. I'm not sure what would happen if I chose a different Website type from the dialog box, such as ASP.Net Reports Website... Perhaps this is configured in the solution or project file, somewhere... Hope this helps! Aug 31, 2010 02:32 PM|LINK Thanks for the reply, Andrew. As it happens, I had started out by using the regular asp.net web site, but have since gone and created an empty site as well. At first, I just wholesale copied my files into the empty site and was still unable to add the references--so I thought "ah ha!"--some where burried deep in one or more of those files is where the problem is. I built another new empty web site and added files/folders one at a time adding the references as I went. I got all my necessary files and folders copied and was able to add the references. What I thought peculiar was that the only item that did not get copied was the default Scripts folder that was added when I had created the regular site. In it are 3 default jquery-blahblah.js files...which I did not care to investigate further as this site does not use jquery. So the references are added, but the homework has only just begun. I now get this error: Warning 30 C:\inetpub\wwwroot\WebSite1\Reports\WorkLists\AssetsMoved.aspx: ASP.NET runtime error: Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObject' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Sometimes I don't know what's worse...no google hits on a query, or so many you'll never be able to read through them all. The down side is that there are apparently TONS of folks who have this error. The bright side is that there are apparently TONS of folks who have this error. Maybe when you go to clean up your references this might be helpful. thanks again, ejo 10 replies Last post Nov 20, 2012 09:13 PM by radman38654
http://forums.asp.net/t/1578261.aspx/1?The+website+is+already+referencing+the+assembly
CC-MAIN-2013-20
refinedweb
1,048
73.58
ThiefWatcher, a homemade indoor surveillance system I In this series of articles I will do a bit of DIY to build a video surveillance and alarm system against home thefts, using relatively cheap materials and a program that will notify to your mobile phone in case of detecting intruders and allow you to take photographs of them to be able to immediately notify the police and provide them those photos. Rapid identification of thieves can be crucial for you to recover all our possessions quickly. This time the solution consists of quite many projects. In addition to the desktop application that works as a control center, I have used Xamarin to create a series of projects for the Android, iOS and Windows Phone App clients. I have also created a few projects that implement the different protocols used by the application, to control the cameras, call the mobile phone, detect the presence of intruders or store the photos in the cloud. In this link you can download the source code of the ThiefWatcher solution, written in csharp using Visual Studio 2015. The hardware First, let's look at the hardware that I used to implement the whole mounting. This is the system schema: First, we have a presence detector switch, which will activate when it detects an intruder, it is like any other switch, just connect two cables from the power supply to the input and use its output to activate the device that will notify the event to the software to enter on surveillance mode. The device that I use to activate the system is a simple relay. The switch turns on a 12-volt power supply, which in turn activates the relay. When the relay is activated, it closes a circuit that connects an input of an Arduino board (in my case an Arduino Mega board) with the 5 volt supply of the same board, and it sends a signal through the USB serial port to the computer where it is installed the application that controls the entire system. Once the activation signal is received, the system puts on the video cameras, which will start taking photos and upload them to the cloud or to the medium that you have configured in the system. The system does not work with a continuous video channel, since the upload of images with an ADSL connection to a service in the cloud can be quite slow. On the other hand, it is sufficient to have photographs of the intruders to be able to provide them to the police for identification, and they are more manageable than the videos. As a cloud service I used Dropbox, which is free and very simple to use. The cameras are something else. In my case, I have two cameras, an IP camera with NetWave cgi protocol, which is relatively cheap, and an Axis camera with VAPIX CGI protocol, which is a professional one with very good performance, but with a fairly high price. Both cameras have the ability to take pictures in the dark. The key to the system is that we be immediately informed that someone has entered our home, for which the simplest is to receive a call on the mobile phone. For this I have connected an AT modem to the computer and the telephone line and use AT commands to dial the number or numbers to notify. In addition to all this, in my case I have a UPS (uninterrupted power supply) in anticipation of power outages. There would be also the issue of a cut in the telephone line, which would also leave us without the internet connection, which can only be avoided using a 3G modem, although we would lose the possibility of calling the mobile with the telephone modem and we would have to implement another type of alarm protocol, For example via Skype. The system allows make any combination of protocols, as we will see later. The ThiefWatcher application As for the application that controls all this, ThiefWatcher, there are a series of protocols for each of the tasks in which the system processes are divided, and dependency injection is used to configure each one. These protocols are implemented through an interface, which is defined in the WatcherCommons class library, in the Interfaces namespace. The different protocols defined are the following: - IWatcherCamera: used to communicate with cameras. I have implemented this protocol for two camera types, NetWaveProtocol, for IP cameras that implement the NetWave cgi protocol, and VAPIXProtocol, for cameras that implement the VAPIX cgi protocol. - ITrigger: used to trigger the surveillance system. I have implemented a simple signal through a serial port in the ArduinoSimpleTriggerInterProtocol class library. - IAlarmaChannel: used to notify us that an alarm has occurred. I have implemented two libraries with this type of protocol, one that makes a phone call using an AT modem in the ATModemProtocol class library and the other to send a notification via Skype in the LyncProtocol class library. - IStorageManager: used to send photos and control messages. I have implemented two versions of this protocol, one that uses Dropbox to exchange images and command and response files, DropBoxProtocol, and another that uses Azure blob storage for the same purpose, AzureBlobProtocol. I will comment on all these protocols in the next article in the series. For now, let's see how to configure them in the ThiefWatcher application. One of the windows of the application is the control panel, which you can use to select and configure the protocols you are going to use. The appearance is as follows: At the top of the panel, you can see the alarm configuration. A drop-down allows you to select the protocol. The connection string allows you to define all the parameters required for the configuration. These parameters will depend on the selected protocol. In the following article of the series I will explain the values for the protocols that I have implemented. The start date is used to set the time when the system begins the surveillance process. Before this date / time the system will not send alarms. If you do not select a start date, the system will start monitoring from the moment you activate it. The end date indicates when to stop the system and stop monitoring. If you do not select a date, it will never stop automatically and you will have to stop it manually. We can tell the system to take a certain amount of photographs, separating each one a certain amount of seconds from the next. When the system is activated, the first picture will be taken. The notifications section allows you to select the protocol that you want use to notify a possible problem. In addition to the configuration indicated in the connection string, you can set a default warning message, if the protocol supports this functionality. The Test button allows you to perform a test of the alarm protocol without having to perform a simulation. The storage protocol is the one used for the transmission of images and commands and control responses, in addition to the connection string with the set up parameters, it allows define a relative path to store the data. As for the control buttons, you can perform a simulacrum of the system, in order to test new protocols, for example. The difference between a simulacrum and the real operation of the system is that in a simulacrum the alarm protocol is not taken into account, and the system starts directly in a state similar to that produced after an alarm is triggered, but without taking photographs. The real monitoring mode starts when you press the Start button, and with the Save button you can save the changes to the configuration. To configure a new camera you have to use the File / New Camera... menu option. The program will first ask you to select the type of protocol used by the camera. Then the program will ask for the access data, which consists of the URL to access the camera, the username and password to connect. Then the following window will appear: With the first button, starting from the left, you can change the access data to the camera. The second button will show a dialog box to configure the camera settings. Following you has two buttons to start capturing images and stop it. You have to write an identifier for the camera in the ID text box, and finally you have a button to save the camera settings and another to delete the camera from the configuration. And that's all by now. In the next article we will review the details of the configuration of each of the protocols and the cameras.
http://software-tecnico-libre.es/en/article-by-topic/hardware/video/ip-cameras/thiefwatcher1
CC-MAIN-2018-17
refinedweb
1,454
57
note sundialsvc4 <p> As you know, the <tt>sort</tt>. </p><p> When dealing with date-values, I prefer to use a nice “date/time object” such as [mod://DateTime], which relieves me of <em>all</em> concerns about date/time handling. </p><p> But, when you can’t do that, you <em>can</em> do sorting of months by defining a hashref that gives you numeric equivalents for them. So, your sorting subroutine becomes something like this: <i>(untested)</i> <code> my %month_sort = ( 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, ... etcetera ... ); sub sort_cmp { my ($a, $b) = @_; return ( substr($a, 3, 2) cmp substr($b, 3, 2) ) || ( $month_sort->{substr($a, 0, 3)} <=> $month_sort->{substr($b, 0, 3)} ); } </code> 1041970 1041970
http://www.perlmonks.org/index.pl?displaytype=xml;node_id=1042019
CC-MAIN-2015-40
refinedweb
126
67.08
#include <OSnl2osil.h> Collaboration diagram for OSnl2osil: Definition at line 45 of file OSnl2osil.h. create an OSInstance from the AMPL nl instance representation osinstance is a pointer to the OSInstance object that gets created from the instance represented in MPS format Definition at line 71 of file OSnl2osil.h. og is a pointer to the AMPL data structure holding the objective function coefficients Definition at line 77 of file OSnl2osil.h. asl is a pointer to basic AMPL data structure Definition at line 81 of file OSnl2osil.h. nl is a pointer to the file with the nl instance Definition at line 85 of file OSnl2osil.h. stub is the name of the file with the nl instance Definition at line 89 of file OSnl2osil.h.
http://www.coin-or.org/Doxygen/CoinAll/class_o_snl2osil.html
crawl-003
refinedweb
127
51.18
Have you ever wanted to build a mobile real-time chat application? Previously I demonstrated how to build a real-time chat application using the CEAN web stack using Socket.io. This is essentially part two to that tutorial. We’re going to take a look at what it takes to create a chat application using Socket.io and the mobile web framework Ionic 2. If you haven’t already, I strongly encourage you to read the previous tutorial as we’re going to be recycling many of the code and concepts. For example we’re going to be using Angular because it is what Ionic 2 is built around. Since the previous tutorial was Angular, we have an easier migration from web to mobile. Here are some prerequisites that must be accounted for: To make our lives easy, we’re going to clone the project I created previously from GitHub. Download this project or execute the following from a Terminal (Mac and Linux) or Command Prompt (Windows): git clone The Node.js code is valuable to us for this particular tutorial, not so much the Angular TypeScript code. Don’t forget to install all the Node.js dependencies after you download the project. They can be installed by executing the following: npm install We also need to make one change to the Node.js code. Since I’m going to be running everything from my local computer we’re going to have a few different ports in use. This will create cross origin resource sharing (CORS) issues that we need to correct. In the GitHub project, open the app.js file and add the following above the routes section: app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); Now CORS is accepted in our Node.js locally running server. You will need Couchbase Server for this application because the Node.js project from GitHub uses it. Instructions for configuring can be found in the previous tutorial. We’re now going to create a fresh Ionic 2 Android and iOS project. From the Command Prompt (Windows) or Terminal (Mac and Linux), execute the following: ionic start ionic-web-chat blank --v2 cd ionic-web-chat ionic platform add ios ionic platform add android A few important things to note here. You need to be using the Ionic CLI that supports Ionic 2 applications. You must also be using a Mac if you wish to add and build for the iOS platform. We’re going to spend most of our time in two particular Ionic project files, however, we first need to download the Socket.io client library and include it in our project. Download the latest client release. I’m using version 1.2.0. Copy the socket.io-1.2.0.js file downloaded to your Ionic project’s www/js directory. Next open the www/index.html file and include this line: <script src="js/socket.io-1.2.0.js"></script> It needs to be added before the other scripts. Now we can get to the bulk of our development. Starting with the UI file, open app/pages/home/home.html and change the code to look like the following: <ion-navbar *navbar> <ion-title> Home </ion-title> </ion-navbar> <ion-content <ion-list> <ion-item *{{message}}</ion-item> </ion-list> </ion-content> <ion-footer-bar> <ion-input> <input type="text" [(ngModel)]="chatBox" placeholder="Message..." /> <button (click)="send(chatBox)">Send</button> </ion-input> </ion-footer-bar> There is a lot missing as of right now, but here is the breakdown starting from the bottom. We add an <ion-footer-bar> because it is the easiest way to create a sticky footer in Ionic Framework. We need a sticky footer because we want our chat input box and send button to always remain at the bottom. The input field is tied to the chatBox model which is passed when the button calls the send() function. Both the send() function and chatBox model will be seen again in the logic file. Moving up to our <ion-list> we can see we’re looping through a messages array. Each message will represent something received from Socket.io. It too will be defined in our logic file. Now let’s jump into our logic file. Open your project’s app/pages/home/home.js file and change the code to look like the following: import {Page} from 'ionic/ionic'; import {Http} from "angular2/http"; import {NgZone} from "angular2/core"; @Page({ templateUrl: 'build/pages/home/home.html', }) export class HomePage { constructor(http: Http) { this.messages = []; this.socketHost = ""; this.zone = new NgZone({enableLongStackTrace: false}); http.get(this.socketHost + "/fetch").subscribe((success) => { var data = success.json(); for(var i = 0; i < data.length; i++) { this.messages.push(data[i].message); } }, (error) => { console.log(JSON.stringify(error)); }); this.chatBox = ""; this.socket = io(this.socketHost); this.socket.on("chat_message", (msg) => { this.zone.run(() => { this.messages.push(msg); }); }); } send(message) { if(message && message != "") { this.socket.emit("chat_message", message); } this.chatBox = ""; } } There is a lot going on in the above, but if you read my Socket.io with the CEAN stack tutorial, not much of it is new. Let’s break it down anyways though. import {Http} from "angular2/http"; import {NgZone} from "angular2/core"; Like with the previous tutorial, we’re going to be storing our chat history in a Couchbase Server. Our Node.js application has a single endpoint for fetching all chat messages. This endpoint is consumed over HTTP. The NgZone was included because it helps with checking for changes. When Angular is out of beta, this may no longer be necessary. Now let’s jump into the constructor method. this.socketHost = ""; This is the host of the Node.js Socket.io server. For me, it is running locally, but yours might not be. http.get(this.socketHost + "/fetch").subscribe((success) => { var data = success.json(); for(var i = 0; i < data.length; i++) { this.messages.push(data[i].message); } }, (error) => { console.log(JSON.stringify(error)); }); When the page loads, we immediately consume the fetch endpoint to catch us up with the rest of the group. We wouldn’t want to join and miss out on all the conversations. This is where things become slightly different than the CEAN tutorial: this.socket = io(this.socketHost); this.socket.on("chat_message", (msg) => { this.zone.run(() => { this.messages.push(msg); }); }); When messages are received we push them into the array from within the this.zone.run method. Currently, without this, the messages may not update on the screen. Now let’s see this chat application in action. First we want to start the Node.js and Socket.io server. Using your Command Prompt or Terminal, from within the GitHub project, execute the following: node app.js Remember your Couchbase installation must be running and configured as seen in the previous tutorial, otherwise running may fail. With the server running, you can now build and run for one of the mobile platforms. For iOS you can do the following, provided you’re on a Mac: ionic emulate ios Or for Android you can execute the following: ionic run android This of course needs to be run in a separate Terminal or Command Prompt that is within your Ionic 2 project. Your application will look like the above. We just took our real-time chat application to the next level by allowing a mobile version of it to join in on the fun. Previously we used the Couchbase, Express, Angular, and Node.js (CEAN) stack to create a chat application and this time around we added a mobile version that can not only communicate to other mobile apps, but the web version as well. This project can be downloaded in full on GitHub.
https://www.thepolyglotdeveloper.com/2016/01/creating-a-real-time-chat-application-with-ionic-2-and-socket-io/
CC-MAIN-2018-51
refinedweb
1,309
59.3
With. What is YUI? YUI (short for Yahoo User Interface and pronounced Y-U-I) is an open source JavaScript and CSS library developed primarily by Yahoo.com. YUI includes JavaScript utiltiies, a CSS framework (reset, grid, and fonts), JavaScript widgets and tools to help include and manage your modules. There are currently two supported versions of YUI. YUI 2, which was launched in 2006, contains the lion's share of the YUI widgets. YUI 3 was released in 2009 and has a completely new syntax, greatly improving its ease of use (especially in event handling and DOM traversal). Why YUI? So you may be wondering, why should I even consider learning another JavaScript framework? Every framework has its strengths, so the one you choose will depend on your needs. Here's a couple of things that YUI really has going for it: - An enormous library of widgets, including one of the most feature-complete datatables out there. - Stellar documentation - each component and widget has detailed instructions, examples, and api documentation. - Development Tools - YUI has a number of cool development tools including a profiler, in-browser console, and testing framework. - Flexible event handling with built-in support for touch and gesture events. Ok, now that you've heard a little about YUI, let's start looking at some code! Including the Library YUI allows for a lot of flexibility when it comes to loading the library; let's look at a couple ways you can do it. Method 1: YUI 3 Seed File The seed file is the preferred way for getting YUI on your page. Just include the YUI seed file (only ~6KB), then include the modules you want via JavaScript. Let's look at an example: <script src=""></script> <script> YUI().use('node', 'anim','yui2-calendar', function(Y) { var YAHOO = Y.YUI2; Y.one('#test'); }); </script> YUI.use() will make a request to get the required modules, and will pass you a YUI instance in the callback that has all of the required modules. YUI 2 components can also be included by passing in the module name, prepended by yui2-. If you include a YUI 2 component, then you can access the YUI 2 instance via Y.YUI2. Method 2: YUI 3 Configurator This web based tool allows you to pick the modules you need and allows you to download or link to a minified file with all of those dependencies (this is similar to the jQuery UI tool). It also provides stats as to how the files will affect page loads. Method 3: SimpleYUI SimpleYUI is a recently released tool that simplifies YUI inclusion for those who are used to just including a JavaScript library and having access to everything. Just include the SimpleYUI file and you'll get a global YUI instance mapped to the Y variable with DOM manipulation, AJAX, and UI effects modules available. <script type="text/javaScript" src=""></script> <script> //Y is a global variable set up by the SimpleYUI script. Y.one("#test").addClass("my class"); </script> With SimpleYUI you can still use all of the other YUI modules dynamically by loading them with the YUI.use method. Y.use('dd-drag', function(Y) { // set up drag and drop }); SimpleYUI has the potential to really help YUI adoption because it makes it much more accessible and familiar to programmers coming from libraries like jQuery. DOM Manipulation DOM manipulation is very easy in YUI 3 and the syntax should be fairly familiar if you've used jQuery in the past. YUI provides two methods for getting DOM nodes, via its Node module. - Y.one('selecter') - returns a YUI Node representing a DOM Node. - Y.all('selecter') - returns a YUI NodeList of all matches Here's an example. // Y.one var node = Y.one('#test-div'); // get me the node with the id test-div var node2 = Y.one(document.body); // Y.one also accepts a DOM element Y.one('#my-list').get('id'); // my-list // Y.all var nodes = Y.all('#my-list li'); // all of my-list's list items // chaining var nodes2 = Y.one('#my-list').all('li'); // all of my-list's list items var parent = Y.one('#my-list').get('parentNode'); // returns parent of my-list (as a YUI Node object) YUI also provides a ' test' method to see if an element matches a selector var node = Y.one('#test-div'); // if node has the primary class if(node.test('.primary')) { doSomething(); } YUI also provides get and set methods to manipulate Node attributes, and convenience functions like addClass and removeClass. // get and set Y.one('#test-div').get('id'); Y.one('#test-div').set('innerHTML', 'Test Content'); // addClass, removeClass Y.one('#test-div').addClass('highlighted'); // adds class to one div Y.all('p').removeClass('highlighted'); // removes class from all p elements Events Events are attached using YUI's on method. You can either call this method on a Node or on the YUI instance. For example: // called on YUI instance // myevent|click namespaces this onclick handler to myevent (used for removal later) Y.on("myevent|click", function() { // do something }, "#test p"); // called on NodeList Y.all("#test p").on("myevent|click", function() { // do something }); One interesting feature of YUI is that if you use the method from the first example, the selector does not need to immediately have a match. YUI will continue to poll for a match for up to 15 seconds after the page has finished loading, which means that you don't have to wait for the document to be loaded to use it (you don't have to wrap your event handlers in a document.load function). Also notice that we prepended the event type with an optional string that namespaces the event. You can use this to later detach the event if you so desire. Y.all("#test p").detach("myevent|click"); You can also simulate events... Y.one("#test").simulate("click"); ...and fire custom events. Y.one("#test").fire("myevents:custom_event_one"); YUI 3 also supports touch events which allows you to add support to your JavaScript application for mobile devices. One potential gotcha is that you need to include the "event-touch" module using YUI.on in order for touch events to work. Y.one("#test").on('touchstart', function() { // a touch event started }); AJAX AJAX requests are handled through YUI 3's IO module. An AJAX call is made using the io function, as demonstrated below. Y.io('/url/to/call', { // this is a post method: 'POST', // serialize the form form: { id: "my_form", useDisabled: true }, // ajax lifecycle event handlers on: { complete: function (id, response) { var data = response.responseText; // Response data. } } }); The IO method accepts a URL and a configuration object as parameters. The configuration object is highly configurable, but I've included a couple of the most common options in the above example. - method - what HTTP method to use - form - if this option is specified, the form with the given id will be serialized and passed with the request. - on - this object sets up event handlers for various stages in the request lifecycle. YUI's io module also allows you to send cross domain requests using a Flash based file provided by Yahoo. There are some caveats, however. First, you must have a copy of the YUI flash file on your server to actually make the request, and second, the domain you are accessing must have a cross-domain policy file that grants you access. Y.io('', { method: 'POST', data: 'data=123', // use flash xdr: { use: 'flash', dataType: 'xml' } // ajax lifecycle event handlers on: { complete: function (id, response) { var data = response.responseText; // Response data. } } }); JSONP is also supported, but through the YUI JSONP module, not the IO module. Y.jsonp(someurl, function(response) { // handle jsonp response }); One more module that is quite useful in conjunction with AJAX is the JSON module. This allows you to easily parse AJAX request which return JSON. JSON can be parsed using the JSON.parse method var obj= Y.JSON.parse(response.responseText); Animation YUI 3 contains an animation module that can be used to perform pretty much any kind of animation. The syntax is a good bit different than jQuery's, so let's take a look. Animations occur in a couple of steps in YUI. First, you set up a new animation object that describes your animation, then you run it. // animate a div from no size to a height and width of 100 var animation = new Y.Anim({ node: '#my-div', // selector to the node you want to animate. // values to animate from (optional) from: { height: 0, width: 0 }, // values to animate too to: { height: 100, width: 100 }, duration: 0.5, // set duration easing: Y.Easing.easeOut // set easing }); animation.run(); All of the properties can be changed using .get() and .set() on the animation object, allowing you to change the animation or the DOM elements to animate. Animations also fire events that can be listened too. // animation is a Y.Anim object animation.on('end', function() { // fired after animation finishes }); Taken together, the YUI animation object can be used to create all kinds of animations in you application. Widgets One of the nicest features of YUI is its widgets. YUI 3 currently has a limited set of widgets (tabs, a slider, and an overlay to name a few), but provides a powerful framework for creating your own YUI 3 widgets. YUI 2, on the other hand, has an enormous library of widgets. Here are a few: - DataTable - a complete data table widget with ajax loading and pagination, editable cell support, resizable columns, and progressive enhancement. - ImageCropper - a widget that helps with image cropping. - LayoutManager - widget to make complex layouts via JavaScript. - Calendar - a popup calendar widget. There are many more widgets that you can use, and you can find them all at the YUI 2 developer website . CSS Libraries The last component that we're going to take a quick look at is the YUI CSS libraries. YUI 3 provides four CSS resources. - CSS Reset - basic CSS reset rules. Everyone has their own idea of what a reset file should do, so you may or may not like this one. - CSS Base - these styles build on the Reset styles to provide consistent rendering across all supported browsers. This file provides things like input styles, header sizes, and table styles. - CSS Fonts - normalizes font sizes across all supported files. Once this stylesheet is applied, font-sizes are changed using percentages according to a table YUI provides. The YUI CSS Fonts resource is used by the popular HTML5Boilerplate. - CSS Grids - a CSS grid framework to help with layout. I'm not a fan of grids in general, but if you'd like to learn more, Andrew Burgess has a nice writeup of this one on Nettuts+. Conclusion This was only a quick look at a few of the components and modules that YUI offers. If this article has piqued your interest, I recommend that you head over to the YUI developer documentation and find what else YUI offers. What are your impressions? If you've used YUI in the past, what do you think of it?
http://esolution-inc.com/blog/an-introduction-to-yui--net-16746.html
CC-MAIN-2021-04
refinedweb
1,860
65.01
Prev Java Enum Experts Index Headers Your browser does not support iframes. Re: [Switch()...case]From String to enum From: Lew <lew@lewscanon.com> Newsgroups: comp.lang.java.help Date: Mon, 14 Jan 2008 21:03:54 -0500 Message-ID: <Ic6dnXqTLtgXiRHanZ2dnUVZWhednZ2d@comcast.com> Stefan Ram wrote: One might want to write: switch( args[ 0 ]) { case "alpha": System.out.println( "alpha" ); break; case "gamma": System.out.println( "gamma" ); break; } By which you mean "one might want to" but is not allowed to, right? BTW, you should improve your indentation. I suggest you follow either the Sun convention followed by nearly everybody, or the variant that puts opening braces on their own line, followed by everybody else. If it is known, that ?args[ 0 ]? always is either ?alpha? or ?gamma?: switch( args[ 0 ].charAt( 0 )) { case 'a': System.out.println( "alpha" ); break; case 'g': System.out.println( "gamma" ); break; } One also sometimes can switch on a hash code of the string, or even a perfect hash code. In the "normal" hash code technique (i.e., Object.hashCode()) one would need an if block to distinguish values that hash to the same number. Of course, in both types of hash code one needs to control the hash code value of the String, which means writing a holder class with a custom hashCode() (or perfect version), then abstracting the actual values out to compile-time constants for readability, e.g., 'SET'. Of course, at this point one has virtually re-invented 'enum', so one might as well use enum in the first place. Otherwise, a possible emulation is: class Switch { final java.util.Map<String,Runnable> me; Switch( final Object ... args ) { me = new java.util.HashMap<String,Runnable>(); for( int i = 0; i < args.length; i += 2 ) me.put(( String )args[ i ],( Runnable )args[ i + 1 ]); } void by( final String text ){ me.get( text ).run(); }} public class Main { public static void main( final String[] args ) { new Switch ( "alpha", new Runnable(){ public void run() { System.out.println( "alpha" ); }}, "gamma", new Runnable(){ public void run() { System.out.println( "gamma" ); }}). by( args[ 0 ]); }} That is remarkably hideous. And way overkill. -- Lew)
https://preciseinfo.org/Convert/Articles_Java/Enum_Experts/Java-Enum-Experts-080115040354.html
CC-MAIN-2022-27
refinedweb
354
77.43
NAME listen - listen for connections on a socket SYNOPSIS #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> int listen(int sockfd, int backlog); DESCRIPTION listen() On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS EADDRINUSE Another socket is already listening on the same port. EBADF The argument sockfd is not a valid descriptor. ENOTSOCK The argument sockfd is not a socket. EOPNOTSUPP The socket is not of a type that supports the listen() operation. CONFORMING TO 4.4BSD, POSIX.1-2001. The listen() function call first appeared in 4.2BSD. NOTES To. EXAMPLE See bind(2). SEE ALSO accept(2), bind(2), connect(2), socket(2), socket(7) COLOPHON This page is part of release 3.35 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at.
http://manpages.ubuntu.com/manpages/precise/en/man2/listen.2.html
CC-MAIN-2015-40
refinedweb
146
62.14
Docs | Forums | Lists | Bugs | Planet | Store | GMN | Get Gentoo! Not eligible to see or edit group visibility for this bug. View Bug Activity | Format For Printing | XML | Clone This Bug DevIL does something like the following: typedef void ILvoid; ILvoid some_devil_func(ILvoid); The last ILvoid is illegal as void is only a special case to describe an argumentless function in C. C++'s syntax disallows the use of a typedef here to denote this special case. So every C++ packet that includes any of devil's headers is affected. To fix the problem every (ILvoid) must be replaced with (void) before emerging devil. This could be done with a sed script or a patch which I will add here. Reproducible: Always Steps to Reproduce: 1. use gcc-4.2 2. emerge devil. 3. try to compile with g++: #include <IL/il.h> int main() {} Created an attachment (id=120348) [edit] Changes (ILvoid) to (void) I changed typedef to #define ILvoid void might want to change the homepage to too (unless of course you enjoy hentai links). ;) this patch appears correct. In portage. Thanks for checking it out. works fine for me so I left that as the homepage. Why did this not cause a revision bump? I'm running into this issue with media-libs/devil-1.6.7-r1 installed from 2006-11-20, and it is the latest version available in Portage. I tried to update cegui, but it failed due to the ILvoid issues mentioned above - I'm now using gcc-4.2.0. As more people switch to gcc-4.2.x, there are going to be a lot of compile failures due to this - can the revision be bumped so that this gets picked up in updates, instead of having to break a compile and have the user try to hunt down the issue, and be confused as to why it's not already fixed? -James done *** Bug 208402 has been marked as a duplicate of this bug. ***
http://bugs.gentoo.org/179843
crawl-002
refinedweb
333
72.76
#include <EBIndexSpace.H> If a_ncellMax is set, that is the max width of an internal grid. Otherwise use defaults of (16 in 3D, 64 in 2d) reads in all levels from finest level down defines from one level and then does coarsening Set a flag that indicates the data defining the EB is distributed. This will signal EBISLevel to hand grid generation off to the GeometryService. Function returns previous value of m_distributedData. Call this before define() if this functionality is desired. References m_distributedData. Get the number of vofs over the entire domain. This is blocking as a broadcast and gather are required. return level index of domain. return -1 if a_domain does not correspond to any refinement of EBIS. Referenced by getCoveredGrids(), getFlowIrregGrids(), getOrigin(), irregCells(), and levelGrids(). Referenced by getBox(), getCoveredGrids(), getFlowGrids(), and getIrregGrids().
http://davis.lbl.gov/Manuals/CHOMBO-RELEASE-3.2/classEBIndexSpace.html
CC-MAIN-2017-22
refinedweb
134
50.73
Wouldn't it be nicer if they worked more like Unix pipes, that is, as soon as some data comes out of Node 1 it gets passed onto the next Node and so on. This would have three advantages: (1) you get the first result quicker, (2) you don't use up loads of memory storing all of the intermediate results, (3) you can run things in parallel, e.g. Node 2 could start processing the data from Node 1 immediately, perhaps even on a different computer. Luckily, there is a neat feature in Python called a generator that allows you to create a pipeline that processes data in parallel. Generators are functions that return a sequence of values. However, unlike just returning a list of values, they only calculate and return the next item in the sequence when requested. One reason this is useful is because the sequence of items could be very large, or even infinite in length. (For a more serious introduction, see David Beazley's talk at PyCon'08, which is the inspiration for this blog post.) Let's create a pipeline for processing an SDF file that has three nodes: (1) a filter node that looks for the word "ZINC00" in the title of the molecule, (2) a filter node for Tanimoto similarity to a target molecule, (3) an output node that returns the molecule title. (The full program is presented at the end of this post.) # Pipeline Python!The variable 'results' is a generator, so nothing actually happens until we request the values returned by the generator... pipeline = createpipeline((titlematches, "ZINC00"), (similarto, targetmol, 0.50), (moltotitle,)) # Create an input source dataset = pybel.readfile("sdf", inputfile) # Feed the pipeline results = pipeline(dataset) # Print out each answer as it comesThe titles of the molecules found will appear on the screen one by one as they are found, just like in a Unix pipe. Note how easy it is to combine nodes into a pipeline. for title in results: print title Here's the full program: import re import os import itertools # from cinfony import pybel import pybel def createpipeline(*filters): def pipeline(dataset): piped_data = dataset for filter in filters: piped_data = filter[0](piped_data, *filter[1:]) return piped_data return pipeline def titlematches(mols, patt): p = re.compile(patt) return (mol for mol in mols if p.search(mol.title)) def similarto(mols, target, cutoff=0.7): target_fp = target.calcfp() return (mol for mol in mols if (mol.calcfp() | target_fp) >= cutoff) def moltotitle(mols): return (mol.title for mol in mols) if __name__ == "__main__": inputfile = os.path.join("..", "face-off", "timing", "3_p0.0.sdf") dataset = pybel.readfile("sdf", inputfile) findtargetmol = createpipeline((titlematches, "ZINC00002647"),) targetmol = findtargetmol(dataset).next() # Pipeline Python! pipeline = createpipeline((titlematches, "ZINC00"), (similarto, targetmol, 0.50), (moltotitle,)) # Create an input source dataset = pybel.readfile("sdf", inputfile) # Feed the pipeline results = pipeline(dataset) # Print out each answer as it comes through the pipeline for title in results: print title So, if in future someone tells you that Python generators can be used to make a workflow, don't say "I never node that". Image: Travis S. 7 comments: Noel, I always said "workflow environments" are basically scripting languages. You mention: "A downside of these packages is that the units of the workflow, the nodes, process data sequentially." This is incorrect for the KNIME, and for Taverna2 too; no idea about PP. But both KNIME and T2 pass on molecules, as soon as they come out of the first node, and will not wait until all data is processed. I stand corrected. This was my impression after playing with KNIME and after discussing Taverna with Christoph. What's all the business with the red/green lights then in KNIME? I'll put in an update above. Noel and Egon, what kind of scripting language support do Taverna and KNIME have? Could I create protocols in those environments in Ruby or Python, for example? Doing a quick search found nothing encouraging. I know that KNIME has a Jython node donated by Tripos. Presumably JRuby would be the way to go? Note that, in case you are misled, KNIME is not open source although it's web site says it is. Perhaps others can comment on Taverna... There is no scripting support in Taverna at the moment (except for Beanshell). However, there is nothing to stop someone writing a processor which uses JRuby or Jython etc. Not sure about Perl but you might be able to get away with using the "Execute Command Line app" processor to execute perl with the script? There is also the JDK6 javax.script stuff but Taverna uses JDK5 (we need to support legacy users on eg older Macs) so we can't use that yet. Noel wrote: "after discussing Taverna with Christoph". We even talked about Taverna in a Taverna. Isn't that ironic ... Sorry for being random ... IIRC even Pipeline Pilot passes on molecules (and it's FAST, or at least used to be). The part about PP that I really dug was the ability to take existing scripts (whether they were in Perl, in the CHARMM scripting language or whatever) and converting them into workflows. Would be great if Taverna had the same feature
http://baoilleach.blogspot.com/2008/07/pipeline-python-generate-workflow.html
CC-MAIN-2015-35
refinedweb
871
65.42
enumerate(text.split()) and increasing indexes solution in Speedy category for Words Order by Phil15 def words_order(text: str, words: list) -> bool: # A word that appears twice make this simple. if len(set(words)) != len(words): return False # Look for words indexes with a simple iteration on text words. words = {word: -1 for word in words} # A dict remembers insertion order. for n, text_word in enumerate(text.split()): if text_word in words and words[text_word] == -1: words[text_word] = n # Make sure all words are in the text and indexes are increasing. last = -1 for index in words.values(): if index <= last: return False last = index return True March 6, 2020 Forum Price Global Activity ClassRoom Manager Leaderboard Coding games Python programming for beginners
https://py.checkio.org/mission/words-order/publications/Phil15/python-3/enumeratetextsplit-and-increasing-indexes/share/7bc4b9757d56a5a88dda7531031331a6/
CC-MAIN-2021-49
refinedweb
123
55.24
.6. HDInsight cluster version 3.6 include Storm 1.1.0,) How it works The resources/writer.yaml topology writes random data to an Azure Event Hub. The data is generated by the DeviceSpout component, and is a random device ID and device value. So it's simulating some hardware that emits a string ID and a numeric value. Thee resources/reader.yaml topology reads data from Event Hub (the data written by EventHubWriter,) parses the JSON data, and then logs the deviceId and deviceValue data. The data format in Event Hub is a JSON document with the following format: { "deviceId": "unique identifier", "deviceValue": some value } The reason it's stored in JSON is compatibility - I an Event Hub, see the Create an Event Hubs namespace and event hub. You can get it by installing Bash for Windows 10 or using PSCP. PSCP can be downloaded from the PuTTY download page. This command will copy the file to the home directory of your SSH user on the cluster. Use SCP to copy the dev.properties file to the server: scp dev.properties USERNAME@CLUSTERNAME-ssh.azurehdinsight.net:dev.properties topologies: storm kill reader storm kill writer Project code of conduct This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
https://azure.microsoft.com/en-in/resources/samples/hdinsight-java-storm-eventhub/
CC-MAIN-2017-34
refinedweb
231
57.98
SVG files can be embedded into HTML documents with the <embed> tag, the <object> tag, or the <iframe> tag. Below you should see three different methods on how to embed SVG files into HTML pages. The <embed> tag is supported in all major browsers, and allows scripting. Note: The Adobe SVG Viewer recommends that you use the EMBED tag when embedding SVG in HTML pages! However, if you want to create valid XHTML, you cannot use <embed> - The <embed> tag is not listed in any HTML specification. Syntax: Note: The pluginspage attribute points to an URL for the plugin download. Tip: Internet Explorer supports an additional attribute, wmode="transparent", that let the HTML page background shine through. The <object> tag is an HTML4 standard tag and is supported in all newer browsers. The disadvantage is that it does not allow scripting. Note: If you have installed the latest version of Adobe SVG Viewer, SVG files will not work when using the <object> tag (at least not in Internet Explorer)! Note: The codebase attribute points to an URL for the plugin download. The <iframe> tag works in most browsers. It would be great if we could add SVG elements directly into the HTML code, only by referring to the SVG namespace, like.
http://www.w3schools.com/svg/svg_inhtml.asp
crawl-002
refinedweb
211
71.95
: October 15,351 TV [ WI~ Brave matchup Baker prepares to face Walton In Sports B1 Volume 33 Issue 76 50C A2 NOMC gets new A4 CT scanner IN THIS ISSUE Families honor council members A8 WEDNESDAY, OCTOBER 15, 2008 Philippine Today's Forecast Queen named 86 High 56 Low No action taken on OSTF beer sales request Kyle Wright Crestview News Bulletin Same issue. Same re- sult. The Crestview City Council will take no action on the Old Spanish Trail Festival Society's request for the council to consider revising a city ordinance that forbids sale of alco- holic beverages on city property. Council member Chip Wells' motion to direct staff to prepare possible revisions to the current ordinance failed by a 2-2 vote. Wells and Linda Parker were in favor of considering revisions to the current ordinance. Bob Allen and Charles Baugh were opposed. City Council President Lillie Conyers was unable to attend as she continues to recover from injuries sustained in a summer auto accident. The council earlier this year voted to take tno ac- tion on a similar OSTF re- quest. "My hope is to get this to a public hearing," Wells said before the vote. "Last year we voted to take no action. We owe it to (the OSTF Society) to take a Brian Hughes / Crestview News Bulletin Covenant Hospice's social worker Nanette Borland. Little ladv Brian Hughes Crestview News Bulletin Social workers sometimes have a bad rap. For any num- ber of unpleasant reasons, when one shows up at the door, it often has heart-wrenching re- sults for the family, particularly in child welfare or abuse cases. Not so when Nanette Bor- land, Covenant Hospice's sole social worker, comes knocking. "When a family hears a social worker is coming, they think, why do I need a social worker?" Borland said. "My job is to allay those fears and establish trust, to support them and prepare them for what lies ahead." Indeed, many patients and their families positively beam when the little lady with the big heart comes calling. Most of her patients are fac- ing terminal illnesses. "Families are typically frightened when you start talk- ing about end-of-life issues," Borland said. "I have to educate them in order to let them make decisions. But when it comes down to it, my job is to be an advocate for the patient." Her typical day might in- clude home visits with patients and their caregivers in Laurel Hill and DeFuniak Springs, and then visits to patients at local nursing facilities. Her travels take her throughout northern Okaloosa and Walton counties. "When I walk into a house, I never know what to expect," Borland said. Some families are prepared for their loved ones' end of life, but "there are people who are BLUE JEAN BALL Co. enant Hospice's Blue Jean Ball is Satur.la', at the Crestview Conrnuniir, Center. Read more about the event orn Page A7. in denial," Borland said. "They are in denial from the time I walk in the door until the time their loved one has passed away." Patients are referred to Covenant Hospice by doctors, hospitals, nursing homes and family members. The doctor must first certify the patient has a terminal prognosis before Borland and her team can ac- cept the case. "We're not there to fix the patient," Borland explained. "We're there to help lessen pain and make life more comfort- able." Providing emotional sup- port for the patient, his or her caregiver, family members and friends is an important part of Borland's job. Helping patients commu- nicate with their families and friends is likewise important. Often it is hard to discuss end- of-life wishes, such as funeral arrangements. Sometimes there are things a patient wishes to say to his or her family that Borland can help the ill person articulate. For families and caregivers who are overwhelmed by the many details facing a loved one's end of life, Borland as- sists by connecting them with community resources to get food, care and even housekeep- ing services. She frequently connects families with the VA, Department of Families and Children, and other agencies to assure patients receive benefits for which they are qualified. "People have pride and they won't say, 'Please get me...'" Borland said. "That comes from building a relationship with people and gaining their trust. We can't fix every problem but we try to make it easier to get the care the patient needs." Covenant Hospice's team approach to patient care in- cludes bereavement counseling and chaplain services. "The best part of working at Covenant Hospice is the team approach," Boland said. "We communicate with each other. Often, especially when it is a young patient, it is extremely difficult for the family as well as for me as a mother. It's very hard, but that hospice team makes it easier." Becoming a social worker "wasn't one of those things where you say, that's what I want to be when I grow up," Borland said. But her grandmother was a social worker. Borland would frequently assist her during house calls. When she had to make a career decision, she chose the profession. "It's rewarding for me. It's a job where at the end of the day, I feel I have made a differ- ence in peoples' lives," Borland said. "Patients and caregivers feel I'm doing all the work, but what they don't know is I'm the one who received the bless- ing." The Crestview City Council will take no action on the Old Spanish Trail Festival Sodety 's request for the council to consider revising a city ordinance that forbids sale of alcoholic beverages on city property. look at it and have a docu- ment we can vote on one way or another." Baugh expressed con- cerns about insurance and security costs if beer sales were permitted during the festival. He also shared in- formation from his conver- sations with Niceville and Fort Walton Beach officials concerning the topic. "This (the OSTF) has al- ways been a family event," Baugh said. "Nobody has any ideas besides injecting alcohol sales into this fam- ily event? "The city founders put this ordinance in here for a reason." Former OSTF Society President "Mac" MacKen- dree noted the OSTF had "tossed around ideas like See BEER A7 Two local residents headed to D.C. on Honor Flight Ann Spann Crestview News Bulletin Crestview residents Ev- erett McCrary and Thomas Warnick are scheduled to be among the World War II veterans on the Emerald Coast Honor Flight bound for Washington, D.C. to- day. A total of 104 veterans from across Northwest Florida were selected for the second flight to visit the World War II veterans' memorial. The Emerald Coast Honor Flight is a non- profit organization that honors America's veterans for their sacrifices by pro- viding the one-day free visit to Washington, D.C. Veterans are selected on a first-come, first-served basis, with priority given to WWII veterans and all others with terminal ill- ness. The organization re- ceives both corporate and individual funding, but no government sponsorship. Everett Thomas McCrary Warnick McCrary is a native of Troy, Ala., and a gradu- ate of the University of Alabama. He was drafted into the U.S. Army while attending the university and shipped to Germany, where he was assigned to the 3rd Infantry Division Band. He had played in the Million Dollar Band at the University of Ala- bama. McCrary was dis- charged as a technical ser- geant in January 1947. He and his wife Judith moved to Crestview in 1956. He has served on the board of directors at the First Na- See HONOR A4 1998-2006 ,. Award Winning , Newspaper \ Florida PressAssociation Bller Weekly Newspaper Contest "" TABLE OF CONTENTS WEATHER................. A2 ARTS & ENTERTAINMENT....... A3 EDITORIAL .. ................ A6 SPORTS ..................... B1 BUSINESS................ B5-B6 CLASSIFIEDS ............. B7-B8 FREEDOM 2 NEWSPAPERS* INTERACTIVE ^S;3 2842. Turn your broken & unwanted Gold intoCash! Get top dollar at J E W% ILE R S 866 N Ferdon Blvd. Crestview, FL LAGET-EECIO LWETPRCEGARNTE-( 50 68 36. ____ ~_ _~ ___ ~________1__1_1_______1___111_11___11__ I IC --- ------- -gll---- -- ~I I avigate thne oast z N ews D A2 I cresiview News sulletin LOCAL WEDNESDAY, OCTOBER 15, 2008 + 9 1~IY1~ S q- - q *- e4AmM e as amm Ann Spann/ Crestview News Bulletin The North Okaloosa Medical Center unveiled its new CT scanner this past week. NOMC introduces new CT scanner Special to the News Bulletin Patients and physicians utilizing the Emergency Room at North Okaloosa Medical Center now can access the latest diagnos- tic imaging technology from Philips Medical Sys- tems dedicated to the ER use. The hospital's new CT (computed tomography) scanner produces crisp, detailed images of the body in just seconds. "The .placement of this technology within our Emergency Room dem- onstrates how technology innovations are improv- ing both the speed and ac- curacy of imaging results enabling our physicians to detect and treat our Emergency Room patients with greater accuracy and speed," reported Dr. Dar- ren Cook, Medical Direc- tor of Emergency Depart- ment and Chief of Staff. CT includes technol- ogy that ensures patients receive less radiation, sup- porting North Okaloosa Medical Center's com- mitment to patient safety across the entire spectrum of patient care. A CT scanner com- bines X-rays with com- puter technology to cre- ate detailed images of 'While NOMC has additional CT scanners, the Board of Trustees and our corporate office agree that the location of the new scanner in the Emergency Room greatly enhances the quality of care provided to our patients. " Dr. Michael G. Foley, NOMC's Chief Medical Officer. your internal structures and organs, according to Tammy Clark, Director of Diagnostic Imaging at NOMC. During an emergency situation, time and com- fort are vital to meeting the medical needs of pa- tients. Jeff Claudio, Director of Emergency Depart- ment, said the location of the CT in the Emergency Room meets the National Stroke Standards for po- tential stroke patients. The standards require CT scan upon arrival to the hospi- tal's ER. "The design of this new system is more open and allows patients to see out- side the machine during examinations which helps to reduce claustrophobic effects," he said "The CT scanner lets physicians see an incred- ible level of detail, which translates into earlier di- agnoses of life-threatening issues such as trauma, stroke, and heart or lung disease," added Dr. Mi- chael G. Foley, NOMC's Chief Medical Officer. "While NOMC has ad- ditional CT scanners, the Board of Trustees and our corporate office agree that the location of the new scanner in the Emergency Room greatly enhances the quality of care provid- ed to our patients." Responding to a 10 per- cent growth in the number of Emergency Room vis- its over 2007, additional equipment is vital in tak- ing health care to new lev- els in the Crestview area. The new CT scanner is a part of the $7.5 million of capital injected into North Okaloosa Medical Center during 2008. "We are very pleased to grow the quality and the capabilities of our com- munity hospital to meel the growing needs of oui community," said David S. Sanders, Chief Execu- tive Officer of North Oka- loosa Medical Center. "We will continue to strive tc be the hospital of choice for our community." In addition to the CI scanner in the ER, NOMC will complete installation of a new PET-CT scanned later this month, a new cath lab by year end, and renovation of most ol the interior of the hospi- tal in the first quarter ol 2009. Earlier in the yeai the NOMC completed the renovation of their obstet- rics department and nurs- ery as well as renovation of the ambulatory surgery center. "Speaking for the Board of Trustees, it is our inten- tion that the services ol this hospital enhance the health needs of people ir our community. It will be our endeavor to continue to provide updated and necessary equipment and facilities used for the ben- efit of our patients," re- ported Dr. Pam Meadows Chairperson of the Nortlh Okaloosa Medical Centei Board of Trustees. Copyrighted Material. S Syndicated Content Available from Commercial News Providers 0000 Baker marking Fire Prevention Month Baker Fire District Chair- man Ben Carr provided this update from his department. Baker's fire department holds a 5/8B ISO rating. ' We are an all-volunteer department. We receive no pay. We are insured as re- quired by Florida Statute. We are located at 1375 19th St. in Baker, three blocks north of the traffic light. The Baker Fire District Board of Commissioners is comprised of five mem- I FIRE CHIEF'S STATION bers who are elected by the registered voters of Oka- loosa County Precinct 1, to serve four-year terms. The Commission meets the first Thursday of every month at 7 p.m. These meetings are open to the public. Several Baker firefight- ers took part in the North- west Florida Volunteers Firefighter weekend last month in Niceville and re- ceived valuable hours of training. We also provided our new "Fire Truck" Grill and cooked hamburgers, hot dogs and more for all the students and instruc- tors. Since October is Fire Prevention Month, the de- partment will be visiting with Baker School students this month, providing safety demonstrations and tours of our facilities and equipment. As a reminder, we are always in need of new vol- unteers to join. We provide the training. We just need you. We meet every Thurs- day night at 7 p.m. at our main station. "Fire Chief's Station" ap- pears on Wednesdays and provides updates from the fire departments in north Okaloosa County. Breaking news onlline at. Jr/en14( t ; .- .. .. -. . --. ,. .-- --- -- .- c -.- Jerry orza U,.e 7.resic/nti, 'I7oy" / i' oaf ... Downtown Office 302 N. Wilson Street Crestview, FL 32536 ,850-682-5112 faces of -. OF CRESTVIEW MEMBER FDIC Your Homeiown Bank Since 1956! ur newest "Friendly Face" at First National Bank of Crestview is Vice President, Terry Ford, Mortgage Loan Officer Extraordinaire! Terry, a 21 year banking veteran, also ,cT es as our Community Reinvestment Act Officer. Under her leadership and expertise, Fi, ;t National Bank of Crestview received an "Outstanding" rating in CRA by the Federal RL gulators. She is a graduate of the University of Florida, School of Banking. An expert in consumer credit counseling, Terry also participates in financial education ..r consumers of all ages including affordable housing seminars. Active in the community, TI ry is a past director and a member of the education committee of the Crestview Area C -. .mber of Commerce. She also serves on the Women's Advisory Committee of the North Ok loosa Medical Center and is Treasurer of the Okaloosa Saves Community Coalition, designed to encourage individuals to "build wealth, not debt." Terry and her husband, Jim, are eagerly anticipating the birth of their first grandchild. When asked to comment on First National Bank of Crestview, Terry replied, "One thing that sets us apart from other financial institutions is that we still have one on one contact with our customers. We know them by name and consider them friends. The very best thing is the family atmosphere we have with our coworkers and customers." Main Office 1301 Industrial Drive Crestview, FL 32539 850-682-5111 1 10 Southside Office 2541 S. Hwy 85 Crestview, FL 32539 850-682-3111 CRESTVIEW News Bulletin To report news, for information, subscriptions and advertising, call 682-6524. PRODUCTION GREG ALLEN ....... ONUNE EDITOR AMANDA KOSCHE . GRAPHIC .ARTIST CIRCULATION INFORMATION 682-6524 THE CRESTVIEW NEWS BULLETIN IS PUBLISHED TWICE WEEKLY EACH WEDNESDAY AND SATURDAY BY FLORIDA FREEDOM NEWSPAPERS, INC., AT 295 W. JAMES LEE BLVD., CRESTVIEW, FLORIDA 32536. PERIODICALS POSTAGE PAID AT CRESTVIEW, FLORIDA. POSTMASTER: PLEASE SEND ADDRESS CHANGES TO CRESTVIEW NEWS BULLETIN, 295 W. JAMES LEE BLVD, CRESTVIEW, FLORIDA 32536. ALL MATERIAL HEREIN IS PROPERTY OF THE CRESTVIEW NEWS BULLETIN. S ISkUBSCIPTIONRATEl In County 13 weeks.............................. $9.00 36 weeks............................ $17.00 52 weeks............................ $31.20 Out of County 13 weeks............................ $14.00 36 weeks............................ $22.00 52 weeks............................ $36.20 'lVEIt I NTlHENEWS B L1 o*w. NEWS INFORMATION IF YOU HAVE A CONCERN OR COMMENT ABOUT CRESTVIEW NEWS BULLETIN'S COVERAGE,. ..... ARTS & ENTERTAINMENT EDITOR ANN SPANN ........ PHOTOGRAPHER RANDY DICKSON .... SPORTS EDITOR RENEE BELL ........ TYPESETTING 1 w I v I vv I A WEDNESDAY, OCTOBER 15, 2008 ARTS & ENTERTAINMENT Crestview News Bulletin I A3 Jean Lewis Library Director PROGRAMS Pumpkin Painting is the Family Library Time activity on Oct. 21 from 6 to 8 p.m. Bring your own pumpkin. We suggest you purchase small pie-size pumpkins because they will be easier to paint and handle when wet. Children must be at least 6 years old. .We will meet at the Crestview Commu- nity Center (next to the Library) at 7 p.m. This months' "Crafts From Around the World" program will be held Oct. 27. Children ages 6 and up join us in our travels around the world. We will be stopping this month in Australia, and the craft will be a boomer- ang. Children may start their craft any time after 3 p.m. and finish by 5 p.m. Space is limited so please come in and sign-up be- fore Oct. 27.. Teens 12-18 join us for Nintendo Wii play every Friday afternoon from 2 to 4 p.m. Parents and family members are welcome to hang out and use the library, but the Wii activities will only be available to teens. Come in and try out your driv- ing skills with the "Mario Kart" games. Any ques- tions please ask Ms. Jan- ice. This week in celebra- tion of "Teen Read Week" we are playing Wii every day from 2 to 4 pm. Sign up at the front desk and receive a birth month shape, write the child's name and birth date on it, and we will post it on our Birthday Club board. October's shape is a pumpkin. Chil- dren may come into the library during their birth month, find their name and shape on the board and bring it back to the front desk to receive a prize. The next Story Time is today and Thursday at 10:15 a.m. The theme is "Just Ducky." Children who are at least 3 years old are welcome to partic- ipate in the stories, finger- plays and crafts. The next Lap-Sit is Oct. 28 at 10:15 a.m. The theme will be "Autumn & .Halloween". Don't forget to have the children wear a costume! Lap Sit pro- grams are designed for children under the age of 3 and their caregiver. EARLY VOTING The Library is once again an early voting site. You can cast your vote between the hours of 8:30 a.m. and 4:30 p.m. starting Oct. 20 through Nov. 1. STAFF PICK "Cold Running Creek" Zelda Lockhart (Fic Loc). This book-is full it A"11~ *X *B ll to the brim with untold historical stories that span the years pre- and post-Civil War. The un- forgettable cast of char- acters consists of three generations of women of African American and Native American descent. The first chapter begins with Raven, who is the daughter of Choctaw Na- tive Americans who have escaped the relocation of the tribe from Mississippi to Oklahoma. We are in- troduced to Raven as her father Inki prepares her for the probable attack of the soldiers. He tells her if such an attack hap- pens she is to gather her younger sister and broth- er and run-and hide in the swamp. The members of the ti ibe had decided they %, ould not be relocated and w.'ould ask for the land that was promised to those who wished to stay in NIississippi. When the . soldiers arrived the adult ' members of the tribe went to meet them in hopes , that their wishes were be- in met, but the soldiers Ser,- not there to give aw.a', supplies and land. The) were there to fight. At the end of the fighting Raven is half-alive, and her sister and brother were the only other survi- vors. We follow the three as they find shelter and help in the swamp land of Mississippi. Raven even- tually meets and marries a half-French, half-Choc- taw man and becomes the mistress of LeFlore plan- tation. Raven is unable to have children and raises Lily, a half Black, half Choctaw baby that was born to one of the planta- tion slaves, as her own. Lily is given all the privi- leges of the LeFlore name and is considered heir to LeFlore plantation. Unfor- tunately during the last three years of slavery Lily was captured and sold as a slave. Once freed it took years for her to embrace freedom. Generations later Lily's plight brings understanding and free- dom for her children and ancestors. An extremely moving book. " E-BOOK , Tre.at y0urselfto..this free holiday read:'.'Shor Thomas J. Prestopnik has posted his new, novel on his Web site The nov.el has not been publiBhed in book formni'a of vet He is mnviting'the.public to read it tor frtWitlfi no registration required. The entire book is online. To view "A ChrisLMia Castle" and read a press release about the book, go to. Recommended for Adults and Young Adult readers. Below is the author's brief summary of the book: 'In A Christmas Castle,' eight-year-old Jack Mason glances up at a shooting star on Christ- mas night in 1966, result- ing in a chain of events not revealed for 82 more years. The novella's set- ting is the Harbor View Retirement Home nestled in the middle of New York State in 2048. Jack, now a 90-year- old resident, chats with Gloria Grant, who is 75. While gazing at the rural moonlit landscape above a snowy river valley, Jack mentions how it reminds him of that Christmas night when he saw the shooting star. Gloria's curiosity is piqued by Jack's further remarks and she makes a startling revelation-if Jack had never seen that shooting star as a boy, then she would never have been born. Jack is skeptical since he has known',Gloria for only three nri6lths, and what followsis.an exploration of a life, a family and a childh6od dream." JUST ASK Anr questions' ILst ask ahn staff member Jean, Sandra. Heathet. Anna. Marie, Seigdara, "tise, Traey, Janice, Au- drey and'Sharon. CONTACT US: Internet:- yofcrestview.org/library. htm Phone: 682-4432 Address: 1445 Com- merce Drive, Crestview, FL 32539 (Behind the Crestview Post Office) QUOTE "A good library will- never be too neat, or too dusty, because somebody will always be in it tak- ing books off the shelves and staying up late read- ing them." Lemony Snicket Northwest Florida Ballet season opens Saturday Brian Hughes Crestview News Bulletin Ballet has come a long way from skinny, girls in tutus and musclemen in tights leaping around the stage, Dance today is a com- bination of grace and theatrical dazzle, and the Northwest Florida Bal- let's opening pfoddction, "Dracula," is no excep- tion. Bram Stoker's classic Gothic tale of vampire lust gets a whole new look when the NWFB takes to the stage for their first production of the new season. The ballet's artistic di- rector Todd Eric Allen will perform the title role to the choreography of Win- throp Corey. The produc- tion includes music by both classical and contem- porary composers, includ- ing Liszt, Strauss, Brahms, Kilar, Glass, Barry and Goldenthal. "Dracula" will be per- formed Saturday at 7:30 p.m., and Sunday at 2 p.m. at the Mattie Kelly Fine & Special to the News Bulletin Northwest Florida Ballet artistic director Todd Eric Allen will perform the title role in , "Dracula,"' this Saturday and Sunday. Performing Arts Center on the Northwest Florida State College campus in Niceville. Upcoming produc- tions include "The Nut- cracker" in November, and "Cinderella" in Feb- ruary. For reservations or more information, call the Northwest Florida Ballet at (850) 664-7787, or visit. Ann Spann / Crestview News Bulletin Library speaker discusses ironies of Civil War Dann Wallis speaks with Shalimar resident Kathy Gerth following his First Tuesday Lecture at the Bob Sikes Library in Crestview. Wallis spoke on ironies of the Civil War. He is the author of a novel titled "Burnin Daylight" based on historical facts of the war and is currently working on a second book. CALENAR Holiday Decoration Extravaganza Oct. 21, Holiday Decoration Extravaganza. The GFWC Women's Club of Crestview fourth an- nual Holiday Decoration Extravaganza fundraiser on Oct. 21 at 6 p.m. at the Old Spanish Trail Shrine Club, 971 U.S. Highway 90 West, featuring Crestview native and nationally recognized floral designer Kirby Holt. Light refreshments will be served and finished prod- ucts will be available for purchase. Proceeds from this event support the char- ities of the GFWC Women's Club of Crestview. Tickets are $10 donation and available from any club member, at the door, or by calling 683-9117. Never too rainy for reading! Two-year-old Lilian Fitch of Crestview was prepared for the rainy weather last week when she arrived for a visit at the Bob Sikes Public Library. Ann Spann / Crestview News Bulletin Share the Fun! Music, festivals, art shows, theater, concerts... we want to know about it. Send your entertainment, thing-to-do listings and events to floridafun@link.freedom.com See your event in print in Freedom newspapers across Northwest Florida You'd do anything for your family. Schedule your mammogram today. ; \ / \ / - .^ * ..Z . % ." .-.' '1 , ,AN ff..: mm .-r, u:., iaaerqidt crpei-vu e".,T ........... .......,I ....-...... 0i ,3")~ rii .... I; U r" ..vid [:pcu...i.,I r^. .*i/~. A f r. ,....., ,1' ..' i.,.i A ,. p .> ,,. ..,c. '-;.o e~ rd .t m i -st p rovd y' piv, ,;n a c al ,:.h~ ".r>,,: ri:n ri.v i2 ,, xr Iri I>l ( U)P "' a ke ine A \\vi,:|s.t.,, dl ,llll NORTHH OKALOOSA Ji MEDICAL CENTER : 1 i, lt,. H vou d-h t i e a ih;, ni, a lis: h, ,id t you s s :" n. i-d cijd th the hQl p'tc l m d n radio l, t J it fees. :p h '" ipp:ie i :3 .r '" ! A4 I Crestview News Bulletin LOCAL WEDNESDAY, OCTOBER 15, 2008 , Hayes honored by NWF League of Cities Kyle Wright Crestview News Bulletin Monday's Crestview City Council meeting opened with the North- west Florida League of Cities' presentation of a framed photo in honor of late city council member Sam Hayes. The League has estab- lished a scholarship in Hayes' name. Fort Walton Beach Mayor Mike Anderson, who also serves as the President of the North- west Florida League of Cities, presented the pho- to. Council member Chip Wells accepted on behalf of the city. Hayes' widow, Florence, was recognized during the presentation. "He was not only a pa- triot and a statesman, but also a gentleman," An- derson said. The photo defines ser- vice with these words: "The high road to ser- Kyle Wright / Crestview News Bulletin Fort Walton Beach Mayor Mike Anderson (left) presented this framed photo in honor of late Crestview city council member Sam Hayes. Council member Chip Wells and Hayes' widow, Florence, accepted on behalf of the city. vice is traveled with in- tegrity, compassion and understanding ... people don't know how much we know until they know how much we care." Bush's contributions recognized Special to the News Bulletin Okaloosa County Commissioner Sherry Campbell (right) presented a plaque to the family of the late Brenda Bush during the most recent commissioners' meeting. The plaque reads: "In Honor of Brenda Bush. She lighted the way, Her light is here to stay. Our gratitude is extended for her heartfelt efforts in obtaining a traffic light at the Intersection of Highway 90 and Old Bethel Road, as well as her overall dedication to safety and our community." Special to the News Bulletin Okaloosa County Commissioner Bill Rob- erts has been appointed to the Century Com- mission for a Sustain- able Florida by Gov. Charlie Crist. Roberts' term began Oct. 1 and ends August 21, 2012. "I'm honored that Governor Crist has se- lected me to serve on the Century Commis- sion. I look forward to working with all mem- bers of. the Commis- sion in making recom- mendations as to how we best accommodate population growth, while maintaining our quality of life," stated Roberts. The Century Com- mission for a Sustain- able Florida, estab- lished in 2005, envisions the future of Florida to ensure the ability to meeting the needs of the current population, without compromis- ing future generations. The Commission has 15 members who look at challenges such as growth, an aging popu- lation, education, trans- portation, water sup- ply, natural calamities and economic issues, to name a few, and work to balance and sustain the needs of its citizens now and in the future. How-to seminar offered for independent travelers Special to the Crestview News Bulletin If you've always wanted to see Europe but don't like the idea of being treated like a sheep, herded on and off a bus on a frenzied "If It's Tuesday This Must Be Belgium" package tour, then Europe Bound is just for you. No matter your age or interests, Europe Bound, a how-to travel seminar just for independent travel- ers who eschew the package tour mentality, will show you how easy it is to plan and execute your trip. It also offers tips on getting around the conti- nent once you arrive, such as when you shouldn't tip a waiter. Conducted as a "Prime Time" program at Northwest Florida State College, the seminar is instructed by Crestview News Bulletin/Flor- ida Freedom Newspapers travel writer Brian Hughes. The three-night seminar will cover topics such as: Planning your trip Passport and travel documents Choosing a railpass Selecting and packing the right luggage Money matters Beating jetlag Traveling by train Eating and sleeping within your budget Getting around town Your personal safety while abroad. Europe Bound will be taught over three succes- sive Wednesday evenings from 5 to 7 p.m. begin- ning Oct. 22. The seminar is perfect for anyone who wants to explore Europe on their own, including back- packing college students, retirees with an indepen- dent streak, and families planning a meaningful, enlightening vacation. Advance registration is re- quired. HONOR continued from A1 tional Bank of Crestview since 1970. "I am honored to get to fly on the veterans' flight and have done a lot of reminiscing, since being selected," McCrary said. Warnick entered the U.S. Army in 1942 from his hometown of San Fran- cisco. His military service consisted of 10 years active duty and 10 years reserve. He completed his service at the rank of captain in the U.S. Air Force. "I am honored to be here. In many ways I don't feel worthy of this honor, but in the spirit of the code of the Veterans of Foreign Wars of the United States, I 'Honor the Dead by: Helping the Living,'" said' Warnick. Congratulate these two local veterans by posting a note at- letin.com. Roberts appointed to Century Commission WEDNESDAYOCTOBER 1 8 LOCAL Crestview News Bulletin I A5 t WITH CURRENT REBATES AND DEALER -n----G CASH GIVEN TO YOU, WE CAN SELL -_ YOU A NEW CAR AT THE LOWEST PRICE EVER. PLEASE SEE EXAMPLES BELOW ONLY AT LEE 14K Miles 3.9% FOR 60MO. = $237 08 PONTIAC G6 Automatic SAutomatic 4Cylinder NO 12 900 * 4 Cylinder ' Power Options MSRP $19,300 1NOW16,900 08 BUICK LACROSSE :o "sO' RbUMO.= 6 Pass Seating Alum Whee 12900 K>;:, ' * Heated Seats * Alum Wheels MSRP $26,095 2NO 1,900 08 GMC SIERRA CREW 4WD Heavy Duty Trailering Pwr Locks/Windows Remote Keyless Entry MSRP $32,815 NOW23,900 PLEASE CALL LEE @ 682-2708 OR VISIT WWW. LEECRESTVIEW.COM FOR CURRENT INCENTIVES I 1 :t111 ,1 SLeather * Automatic * Alum Wheels *LOW Miles *4 Cylinder * Automatic * 24K Miles 4.9% FOR 60Mo. = $299 * Leather " Extraclan e15,900 _ Leather IBose I 1 1; NOW$14,900 jNW15,900 SOne Owner * Leather * Clean wwwlecrstvewco wwlecrstvewco wwlecrstvewco --wwlecretvewcoS wwlecretvewco i11; M3,900 Laurel Hill's Hobo Festival The annual Laurel Hill Hobo Festival was held this past Saturday at Gene Clary Park in Laurel Hill -'-9. 'A : Kyle Wright / Crestview News Bulletin Clockwise from above, 1. The Rev. Mike McVay was a good sport as he took a turn in the dunk tank. 2. Rowdy Friends entertained the crowd Saturday morning. 3. Jamie Okkema was one of many who took the opportunity to dunk the Rev. McVay. : 4. Mike Barrett played his guitar at the First Baptist Church of Laurel Hill booth. 5. Members of the Crestview High School dance team performed during the Hobo Festival. 6. Hope Standridge prepares to slide down one of the inflatable rides at the Hobo Festival. 7. Youngsters stand in line to enjoy the rides at the Hobo Festival. *Automalic .1 00 Automatic *ColdAir NO New Tires * Great Value Cold Air :VL OW4,900 * Automatic 03 Chievro' *LMles ll~H^ * Low Miles * New Tires * Wheels ,<' '!'r: .. .. f ~* .J Aa.:i 1 S14F o i I, %/ -- 01 Buick Lesabre I -- I vvcY oW8,9oo I I - A A/ IA--- 1-fl, Opinion & Editorial II I II I Here is a sampling of what people had : to say about recent north Okaloosa Count) news topic. Comments were collected from the crestviewbulletin.com Web site. Topic: Some area residents think ,planned new base exchange should be built closer to the north end of the county. The first thing people need to know is that the Base Exchange, AAFES, is a non-appro- priated funded entity. There is no taxpayer money involved. Funds for new AAFES facilities are generated from within the ex- change system. BX or PX are FIRST for active duty personrmel and their dependents then retirees. The location for the new exchange outside the gate i- most important for the single airmen or soldier living on the base. Do you really think a $60 million project is going to be built on Duke Field, 30 miles away from the vast majority of the active duty personnel and their dependents? Have (those opposed to the proposed site) checked out what AAFES is going to build on Duke Field for the incoming Special Forces? They might want to set up a meeting i vi th the General Manager of AAFES on Eglin to get an updated briefing. Since AAFES is a busi- nes-. they know how ran'y retnees are lo- cated within 100 miles of Eghn I consider myself as an older retiree and I make it to the base once a month for my needs. In the first paragraph of the article it states some military retirees say a shop- ping complex within the shadow of Hurlburt and Eglin is a \ aste of taxpayer money \\hat a waste ot tax paying dollars it would be to build a satellite pharmacy, exchange and small commissary within the Crestvier area for the retirees U'-e the mail pharmacy for your meds if you canit get to base. and shop in the local market for 'our other needs., which is just as cheap as the B\. That way you won't be clogging up the parking lot at the base during lunch when the w orkimg crowd is trymg to use it. 0 I believe the idea i. a waste of taxpayer money. not because of location or anything hke that but because the B\ no longer provides any cost savings to military mern bets'. It hasn t for many\ ears no\ Mo-st items sold at the B\ can be purchased for less or the same price off base. I'm not re- all\ sure what adv antage the B\ create-s fo nulitar) members. now, if any at all Topic: Animal rights rally held outside Cresthiew courthouse in response to new, of kitten killed with sledgehammer. These people need to get a job and a life! There are more important things in lif than a kitten \ou conunent saying that they need to get a life something that these people took away tror a defenseless animal. These people are voicing their frustration with the people that inflict cruelt- to de- fenseless animals, not lu-t this kitten I pet- .ona!ll attended the lallv I am an engineer and I took the da\ off to help their cause. lVinit to hid tOL the Huibbib.'1. Sindl iou thioug-Ilt 0 mi o n/t ot ti0 Okalooa 1 Cou1nty ili eii topic to kb lc':t.'..'crs ,tori: tllictlm.co: o1 ,o-.t llour thou.,,ht_ at ;l'al'L,' cL st" e,,''" u'l'll -m com. Profundity Brian Hughes Here's another trav el Protundih I enjoyed... "Tralel is a 1w'tlLalorLfo"r fr'eetidom. DR. ROSARY HARTEL O'NEILL New Orleans playwright and director 5 PASSING Crestview will SSKyleWright have beer sales Crestview will have sale The real question WHO VOTED FOR WHAT? of alcoholic beverages on ) city-owned property one is, what event or Council members Chip Wells and Linda Parker want to make day. it crystal clear. The real question Organization will The Old Spanish Trail Festival beer sales issue has come what event or before the c..:.uII .. twice in 2008. n is, what event or provide the impetus Both times, council votes resulted in no action on the issuel1, organization will Both times, Wells and Parklr catl their .,:s[ to iurthri.r the iv provide the impetus fr it to happen? discussion on the topic. 9t for it to happen? The language in the proposals is a little confusing an 9(; Crestview's City Coun- 'aye' vote on the first proposal rrneanr ore thing, and 'aye votmt cil will not be taking any on Monday's proposal meant another but Wells and Parker, action on a request for an town Crestview but asked to make it clear they cast their votes to further the dis- r ordinance revision that the school also needed cussion on the topic on both occasions. could allow sale of alco- the city to allow sale of holic beverages on city- alcoholic beverages at owned property under Old Spanish Trail Park pushing for the ordinance beer sales one day. ,. certain circumstances. two days a year. revision because they All we learned Mon-3 The current ordinance If that happened, the see beer sales as the. only day is not enough council forbids any sale of alco- city would have a revised way to keep the festival members deem the Oldr . holic beverages on city alcohol ordinance within alive. Spanish Trail Festival )-, property. a month. If they thought banning worthy of making it hap- Some version of the As it actually hap- alcohol from the entire pen. , proposed ordinance revi- opened, the Old Spanish city would keep the fes- r. sion presented during Trail Festival Society was tival alive, they would Kyle Wright is the News Monday's city council the de facto sponsor of have pushed for that in- Bulletin Editor. Contact (. meeting will pass one the proposal discussed stead. him at 682-6524 or e-mail. day. during Monday's city The memories of the kylew@crestviewbulletin.. Let's say representa- council meeting. festival's better days ap- corn Visit the "Passing v ' tives from Florida A&M A few things to keep parently weren't strong Shots" blog at-.. University came before in mind about the OSTF enough to persuade a ma- viewbulletin.com to see the council. Let's say folks: jority of council members Kyle's ideas on how the ". they announced every- They weren't pushing to risk possible public OSTF can raise money from thing was on schedule for for the ordinance revision heat in order to change people who don't supportI, the proposed pharmacy because they want beer the ordinance, sale of alcoholic beverages,r school to come to down- at the festival. They're Crestview will have on city-owned property. c" Letters to the Editor Dem says Obama lacks experience I am a 69-year-old reg- istered Democrat and I've seen my share of Dems . win the Party's endorse- ment. But I've never seen one with so little experi- ence nominated for the top spot. I can't image what the party elders could have been think- ing when they put Barack Obama up for national . election. Surely they must know that American vot- ers use common sense when we pick our presi- dent. We generally look for solid experience, good leadership and manage- ment expertise. That's why we've sent more gov- ernors than anyone else to the White House being chief executive of a state is good training. I worked for a big corporation before retire- ment and I never did see the Board of Directors promote an entry-level person to CEO in a single step just because he was a smooth talker. We the peo- ple are the nation's Board of Directors and we are being asked to promote an entry-level senator to CEO of the entire country just because he gives a good speech. Sen. Obama has no other proven relevant experience. When we look at his scant professional experience we can find nothing that will prove he is qualified for t executive positi he talks a good but "where's th In these uneasy we need a person tested and expe for the job of CE commander-in-, White House is for on-the-job tr Make an edu vote for McCl Dear Editor: I am a McCai er and I am con that the voters be getting the ii tion they need t educated decisi election. Please following: ECONOMY' McCain does nc government to: our lives, but th not mean all res were removed f banking industi Fannie Mae/FrE The kind of der McCain support allow banking c to use their ATI\ across state line were restriction in place that the man of the SEC have been overs prevent the final saster on Wall S received $126,0( Fannie/Freddie :he chief short time he has been in on. Yes, the Senate. McCain has game, received $22,000 over 10 e beef?" years. Both campaigns times have lobbyists working )n who is on their staff, but Joe rienced Biden's son and brother EO and have been lobbyists for chief. The years. In fact, Hunter no place Biden lobbied Obama for raining. his clients and received $340,000. Hunter Biden Jane Kenny stopped lobbying after his Crestview father was selected as the VP candidate. cated BUDGET The in- dependent organization ain called "Citizens Against Government Waste" in support- tracks our elected officials cerned and found that Obama may not had received almost nforma- $800,000 in earmarks in to make an his short time in the Sen- on in this ate. McCain had ZERO in share the his entire 26 years! They ranked McCain at 100 Y Yes, percent and Obama at 12 ot like the percent! They also ranked regulate each on how they voted iis does on wasteful bills that strictions came before the Senate - rom the Obama at 18 percent and ry or from McCain at 88 percent (a eddie Mac. higher number is better). regulation In May 2004 and Septem- ted was to ber 2004, McCain present- :ustomers ed statements to the Sen- A cards ate urging them to curb 's. There spending before it was is left too late. In January, 2005, e Chair- McCain co-sponsored a should bill, "The Federal Hous- seeing to ing Enterprise Regulatory incial di- Reform Act." McCain 3t. Obama said, "If Congress does 00 from not act, American taxpay- in the ers will continue to be exposed to the enormous' risk that Fannie Mae and Freddie Mac pose to the housing market, the ovj-: all financial system, and,- the economy as a whole." The bill never made it c t of committee and no on4 wanted to do anything.-' Obama did NOTHING!o. (Check the "Congressior, - nal Record".) . McCain's position onr, taxes and health care come from a common sense approach to provide for America's citizens without breaking the rj-, bank. He won't promise,-. you the world, but he will do the best he can for eyr eryone. , DEFENSE I woq4d feel much safer to haveu McCain in charge of our, country's defense and tl e War on Terror. The worW- knows he will not back& . down, but will do whatn . ever is needed to defend. our country. Go online and check . the official government ' records not blog spots - to verify this informd- tion. McCain has crossed the aisle to work with thre Democrats and has gone against his own party ' trying to change the wa, things have always beeni done. Please give him arid Sarah Palin the oppor- )- tunity to make the right changes in WashingtonP ' Mary Brown Freeport r ICNBSTAF Jason Mobley General Manager jasonm@ crestviewbulletin corn r.. '._..c9m A6 WEDNESDAY, .T. 15,2 WEDNESDAY, OCTOBER 15, 2008 LOCAL Crestview News Bulletin I A7 SBlue Jean Ball set for Saturday Special to the News Bulletin Don your favorite den- im outfit for a casually elegant evening to benefit Covenant Hospice. Whether you go west- ern, complete with Wran- glers and ropers, or whether you dress up your denim with diamonds and pearls, the Blue Jean Ball offers you the opportunity to make a difference in just one night in the comfort of your jeans. The event will be held at 6:30 p.m. Saturday at the Crestview Community Center. 5Tickets are $50 and are on sale now at Covenant Hospice offices. SAttendees will enjoy a silent auction, steak dinner and dessert buffet. Clark &W Company will perform throughout the evening. Attendees also will en- joy a special performance by the Northwest Florida State College show choir. Covenant Hospice Branch Manager Pat Ding- egs will take on Crestview Area Chamber of Com- merce Executive Direc- tor Wayne Harris, Crest- view city council member Charles Baugh and Coastal Christian Magazine pub- lisher Jenni Perkins in a "Dancing With the Stars" fundraiser. Corporate sponsorships are available and range fibrom $250 to $5,000. b"Memory tables" also are available. Memory tables are dedicated to deceased friends or fam- BLUE JEAN BALL If you are interested in tickets, sponsorships or donating auction items for the Blue Jean Ball, contact Shelley Canales at 729-1800 or e-mail shelley.canales@cove- nanthospice.org. If you are interested in sponsoring a "Memory Table" contact the Crestview Covenant Hospice office at 682- 3628. ily members and can be decorated with keepsakes and photographs in their memory. One of the tables will be dedicated to Jean Nolan, a Covenant Hospice nurse well-known in the Crest- view area who passed away earlier this year. "It is a nice way to re- member a family member who has passed on," said Shelley Canales of Cov- enant Hospice. "Memory tables" are $650 and includes 10 tick- ets to the event. All proceeds benefit Covenant Hospice's un- funded programs in north Okaloosa and north Wal- ton counties, including bereavement services, children's support pro- grams, chaplain services and indigent patient care. The organization provid- ed more than $1.2 million in care for uninsured or under-insured patients facing a terminal illness. Covenant Hospice accepts patients regardless of abil- ity to pay. BEER continued from Al you wouldn't believe," and that members spent $4,300 of their own money in, recent years to try to keep the festival going. MacKendree told the council the organization had hoped beer sales at the annual event could revive the festival's fortunes. He said the organization c&fuld secure more than $30,000 in sponsorship if sdle of alcoholic beverages during the festival was ap- pioved. Asked if the fes- tival would take place in 2A9 if a revised ordinance was not approved, MacK- endree replied, "I hate to say it, but probably not." Other business .: Other business dis- cussed during the coun- cj's three-hour-plus ineeting Monday: o The council unani- mously approved a $10,000 appropriation for tl}e Economic Develop- nrent Council of Okaloosa County. The council also requested quarterly re- ports from the EDC. EDC representatives rrmade a presentation sum- marizing of their efforts on behalf of the city prior ;t0 the council's vote. The 6E C said it estimates :6aL00 military personnel ad family members will come to Crestview as a result of the Base Realign- ment and Closure law, creating "a lot of needs to be addressed." The council unani- mously passed a consent agenda that included ap- proval of site construction plans for Premier Plaza, a 12,000-square-foot office building planned for the I' ersection of Brett Street, *kdale Avenue and Mc- skill Street. The con- s: t agenda also accepted a id of $45,523.75 from - llard Excavating, Inc., f resurfacing alleyways i the historic downtown blasiness district. The council unani- mously approved second readings of nine amend- ments to the city's com- prehensive plan. The council unani- mously approved an or- dinance authorizing the city to issue bonds for the Freedom Walk devel- opment planned for the north side of the city. The development will provide housing for persons of moderate, middle and low incomes. The council later unanimously approved a resolution approving a September hearing held in connection with the topic. The council unani- mously voted to provide funds for needed insur- ance coverage for the Vet- erans Day Parade in No- vember. Michael Fleming was recognized for 20 years of services with the Public Services Department. Mayor David Cadle reported on his meetings with state and county of- ficials regarding transpor- tation needs. He said the county is pushing strongly for a six- lane State Road 85 up to the Shoal River. "So that will get ev- erybody to the bottleneck quicker," Cadle said. Cadle said he also spoke with a company about the possibility to increasing the mass tran- sit from the north county to Eglin Air Force Base. Herb Henderson spoke from the floor after Cadle and encouraged Crest- view citizens to write to U.S. Rep. Jeff Miller and U.S. Sen. Bill Nelson about the traffic situation. City Attorney Ben Holley informed the council that a summary judgment in the city's liti- gation with National Pipe went in National Pipe's favor. The council unani- mously voted not to pur- sue the matter further. Post your thoughts on city business at- viewbulletin.com. News Bulletin Editor Kyle Wright weighs in with his take on the beer sales issue on Page A6. Much enthusiasm at Bob Sikes Elementary An update from Bob Sikes Elementary Principal Gary Massey The Bob Sikes El- ementary Bullpups are welcoming fall with much enthusiasm. This autumn our Bob Sikes community is celebrating our 50th birthday, stu- dent success in Acceler- ated Reader and an all- around love of learning. Bob Sikes is excited to launch into our next 50 years with a day- time parade for current students and an eve- ning event for former principals, teachers, students and dignitar- ies of Northwest Florida on Oct. 23. During the daytime event the stu- dents and teachers will dress in 1950s attire and parade around the neighborhood to share in the excitement of our milestone. We will be burying a time capsule following the parade. It will include items from each grade level as a reflection of Bob Sikes Elementary today. Our evening event will be filled with dedications FROM THE PRINCIPAL'S OFFICE and testimonials from many with ties to our school. We look forward to bidding heavily on cakes brought by guests to be auctioned off to the highest bidder. Pro- ceeds will be dedicated to improving technol- ogy here at Bob Sikes Elementary. The entire day will be dedicated to celebrating the school and the life of Congress- man Bob Sikes. Our new Acceler- ated Reader incentive program has everyone excited about reading, earning points and earn- ing prizes. Students are given an A.R. point goal aligned with their read- ing level. They receive rewards as they achieve 50 percent, 100 percent, 150 percent, 200 percent and 500 percent of this goal. Rewards include pencils, dragon scales (to be placed on our res- ident A.R. Goal Dragon with the student's name Bob Sikes' Elementary Gary Massey & grade), bracelets, pins, "reading samurai" headbands and t-shirts. It is exciting to see our plain green dragon turn into a magical purple A.R. Dragon as students adorn it with their scales. Each nine- week grading period will allow our dragon to change colors as students achieve higher goals. The faculty and staff of Bob Sikes Elementary are inspired by the efforts of our young readers. Overall, we are wit- nessing a renewed focus on learning here at Bob Sikes Elementary. Vol- unteers are assisting us with the education of our students. Teachers are going above and beyond the call of duty to be sure students are getting the help they need to be successful. Support staff members are working hard to ensure we have an atmosphere of suc- cess. Students are work- ing harder than ever to become successful. No matter what the challenge is. Everyone at Bob Sikes Elementary be- lieves; I CAN & I WILL. "From the Principal's Desk" appears in the News Bulletin on Wednesdays and will provide an update on news from schools in north Okaloosa County. BBB T- Now Accepting VISA ArnII P 6o 8 New Installations Pump Outs Repairs Permit Packages Available Fill Dirt Land Clearing Serving Okaloosa Walton Santa Rosa Counties for more than 30 years! I've been honored to serve my community as a Funeral Director for nearly 40 years, and I e t am truly thankful for the S ; trust and confidence so many families have placed in me. Today, people are choosing to plan ceremonies or tributes that are more reflective of the person and fit the lifestyle of their family. My goal is to provide Chuck Jordan a dignified and fitting FuneralDirector tribute that celebrates the unique life of your loved one. I'm very proud to be part of the Whitehurst-Powell Funeral Home family, where we are dedicated to helping your family. 436 West James Lee Blvd., Crestview, Florida 32536 Phone: (850) 682-3052 Fax: (850) 682-3600 5 90% AS LOW AS 5 APR UP TO 15 YEARS NO CLOSING COSTS FOR A LIMITED TIME Minimum Advance oft'S5,000 and Maximum of S1 50,000 Available in 7 Florida counties For more information, contact our Real Estate Department at ,LENDE (850) 862-0111 extension 1830. Home Equity Fixed Rate of 5.90% Annual P'. o.',-i,, 1. ,-, ,i i- i... Loan to Value of 80% or less and is subject to credit approval. A sample monthly repayment based on $50,000 for 15 years at 5.90% APR is $419.29. The "No Closing Costs" special does not include appraisal fees. his fee may be waived with an acceptable tax assessment. You should consult a tax advisor r.._, ..; ih.. n.. h.I ] of interest on this loan. This offer is available on single-family primary residence or owner occupied condominiums located in Escambia, Santa Rosa, Okaloosa, Walton, Bay, Holmes. and Washington Counties. Membership Required. "kWere Mi /I/wA ,rIs Matter, l!o." EGLIN FEDERAL CREDIT U1IN " --7 Branches: Fort Walton Beach Eglin AFB Hurlburt Field North & South Crestview Mary Esther Bluewater Bay Destin Navarre m, A8 I crestview News su etin LOCAL WEDNESDAY, OCTOBER 15, 2008 Justice Clarence Johnson Justice Clarence Johnson, age 83, resident of Baker, passed away Thursday morning, Octo- ber 9, 2008, in Crestview after a lengthy illness. Mr. Johnson was. born in Baker on May 1, 1925 to the late William Henry Johnson and Violetta Cody Johnson. He was a veteran, serving in the Navy during World War II, and was a retired construction supervisor. wift- Mr. Johnson was also a longtime member of Pyron Chapel Baptist Church in Baker. Survivors include his wife, Ella Bea Johnson, of Baker; son- ifn-law, Lee Everett Sidwell, of Pensacola; three grandchildren, Laura E. Maki and her husband, Andy, Justin Lee Sidwell and his wife, Rachael Ann, and Jonathan Everett Sidwell; and five great- grandchildren. Arrangements are under the direction of Whitehurst-Powell Funeral Home in Crestview. Special to the News Bulletin Mrs. Lilybeth Bilodeau was crowned as Kayumanggi Cultural Society (KCS) Philippine Queen USA 2008 on Sept. 13 'during the KCS Barrio Fiesta and Coronation Ballat the Old Spanish Trail Shriners Building. With Bilodeau (center) are KCS President Ludie E. Nicholas and Crestview Mayor David Cadle. Special to the News Bulletin The Collegiate High School at Northwest Florida State College an- nounces Tawanah Reeves of Crestview was one of its three students named as a National Merit Com- mended Scholar. National Merit Com- mended Scholars are stu- dents recognized for ex- ceptional academic prom- ise demonstrated by their outstanding performance on the qualifying test for the National Merit Schol- arship. Reeves also was recog- nized as an Achievement Scholarship semifinalist. More than 1,600. Black American high,, school seniors have been desig- nated semifinalists in the Profession Examiners APPROVE FORi I FLU SH OTS NO APPOINTMENT NEEDED! Drive-In Flu Shots! We will come to our car! FLU CLINIC Oct. 15, 1-5pm The Prescription Shoppe 536 First Avenue, Crestview, FL 850-682-2008 PENSACOLA 3298 Summit Blvd Ste 33 850-434-6168 M-F 7:30am-5nm MILTON 6107 HWY 90 850-626-3430 M-F 8:00am-4nm CRESTVIEW 102 Alabama St Ste B 850-689-7592 M-F R:00am-1 nm pek ou ppsit rashe lo c fuciis iw r hea th m m 4 FT. WALTON BEACH 11 Racetrack Rd Ste D-1 850-243-2900 M-F 8:00am-4.nm Special to the News Bulletin At left is Tawanah Reeves of Crestview, along with other nationally recognized Collegiate High School students. 45th annual Achievement Scholarship competition. The program is conduct- ed by the National Merit Scholarship Corporation (NMSC). The National Achievement Program was initiated in 1964 to recognize academically promising black students throughout the nation. Reeves now has an op- ~jrj~f~"F- -~/Iwd Claire, Rylee, Heather & Andy Powell Family Owned & Operated by Heather & Andy Powell "Serving Because We Care" 436 West James Lee Blvd. Crestview, FL 682-3052 You'll The NEW Berkshire! Value is always a good buy. AR With hew industry moving to '" the Gulf Coast, Heritage Value 5 "i BEDROOM2 5 1' ,0 is worth more than ever. And MASTER 1 prices are the best in years. ,A ,,, --., . Lock up YOUR Heritage Value. O3 Pick out your home at today's -o 2244 sq ft special prices. MASTERBDRM EDM34 bedrooms Now building in more areas in Alabama, 13'1" x I 2" FOYER 10" 2 baths Mississippi, and Florida. Prices may vary and INING For Only are subject to change. 1""- a -.o1 i S143,300 38 ECONOMICAL WAYS TO LOCK UP VALUE NOW 38 Models 1,106 to 2,472 sq ft 72,900 to s159,900 Heritage Value With Every Heritage Home Special Prices I More of Everything portunity to continue 4in the competition for ap- proximately 800 schol- arships worth over $2.6 million to be awarded next spring. Former governor to recognize local teachers Byrd, King were Excel Award recipients Special to the News Bulletin Two north Okaloosa ed- ucators will be among the honorees later this month when former Gov. Jeb Bush. recognizes the teachers whose students made the greatest academic gains in the state Pamela Byrd, an eighth- grade math teacher at Baker School, and Cyn- thia King, who teaches sixth grade at Richbourg Middle School, are among the 100 Florida educators who will be honored Oct. 24 in Orlando by Bush's Foundation for Florida's Future. The awards are de- signed to pay tribute to teachers whose effective teaching methods resulted in their students moving up dramatically during the 2007-2008 school year. Byrd has taught in Oka- loosa County for eighteen years. She began her ca- reer at Richbourg Mid- dle Scho6l, and for the past five years has been a member of the middle school faculty at Baker. She is being honored for the performance of her students who began last year already proficient in math, but who ended the year with extraordinary gains. King, a teacher for 15 years, began at Walker Elementary School and transferred to Richbourg Middle School in 2003. The Foundation for Florida's Future will recognize her success in helping lower- performing students dra- matically increase their reading ability. Only two other North- west Florida teachers are among the 100 educators chosen for the award. Crestview Cinema 3 Notliew Plaza HWY 85 N. 682-32013 Movie Schedule Starting Friday, October 17, 2008 EAGuLE-El S Fil SAT ................ 4:00 ...6:45PM SUNDAY .......... 1:00.. .4:00 . 6:45PM MON T UR ........... 4:0 . 6:45PM FRIDAY........... . 400... .. .7:00PM SAT SUN ......... 1:00. 4:0 . 700PM MON THUR ............ 4:00 . 7:00PM IEREBLYiilUllACHUltlitH<. .,,) FPG FRIDAY ................4:00 . 7:00PM SAT SUN ......... 1:00... 4:00 . 7:00PM MON THUR ......... 4:00 . 7:00PM| KURSGiEUJ%_NDA Oh, ,, P SATOl,. i18'"... ONLY $2.00.....1:00PM Regular Admission Adult = $7 Senior/child = $50 DAILY MATINEE $500 Crestview's Reeves honored by scholarship corporation JIL%- I % I UOLVI- I I-- I_~~ . ..... ......A P 1-1 L Mhulu~ltrAKI is A I I I Is I CRESTVIEW NEWS BULLETIN Second View B SECTION BUSINESS..............85-46 CLASSIFIEDS........... B7-B8 B3 O Friday football boxscores B4 Community sports photos B5 HOPE House open hosue WEDNESDAY, OCT. 15, 2008 Today Middle School Cross Country Davidson, Richbourg at Northwest Florida College (OWC), 3:45 p.m. Thursday High School Volleyball Crestview at Pine Forest, JV 4 p.m., V5 p.m. Laurel Hill at John Paul II, Varsity DH 2 p.m. 4 p.m. JV Football Crestview at Navarre, 4 p.m. Middle School Football Davidson at Meigs, 6:30 p.m. Ruckel at Richbourg, 6:30 p.m. Friday High School Football Baker at Walton, 7 p.m. Crestview at Mosley, 7 p.m. AMVETS golf The AMVETS Post 35 will be holding a golf tournament at Foxwood Country Club on Oct. 25. Check-in starts at 7 a.m. and play is set to begin at 8 a.m. Cost is $40 per person with cheats that include mul- ligans, throws and use of red tees available for a dollar each. For more information con- tact John Rice at jrice61 @ cox.net Heavy Hitters The Heavy Hitters 12U baseball team will hold tryouts Nov. 15 from 9 a.m.-11 a.m. at the Baker Area Youth Complex. Players who turn 13 before May 1, 2009 are not eligible. For more information call 902-6237 or 496-6235. Semi-pro football The Crestview Thunderbirds, an adult mi- nor league football team, has been formed. The team will be made up of men 18 years and older with various backgrounds. The Crestview Thunderbirds were invited to attended the inaugural year- end meeting of the Premier Football League. Tryouts for 2009 season are scheduled for Saturday,. from 9 to 11 a.m.; Nov. 1 from 3 to 5 p.m.; Nov. 15 from 9 to 11 a.m. and Dec. 13 from 3 to 5 p.m. Tryouts at Old Spanish Trail Park. Wear shorts, shirt, and cleats (if you have them). Contact Coach Taylor at 305-2317 or e-mail coach@crestviewt- hunderbirds.com with any questions. Bulldog Golf The Crestview High School boys and girls golf teams are sponsoring a 3-person scramble Saturday at Adara Country Club with sign-in at 8:30 a.m. followed by a 9 a.m. start. Cost of the tournament is $45 in advance or $50 the day of the tournament. Entry fee includes greens fee, cart, mulligans, throws, closest-to-the-pin prizes and refreshments. Prizes will be awarded to the first, second and third place teams. You can sign up a team or sign up as an individual and be placed with a team. Send entry form and fee to Gene Parish, c/o Crestview High School, 1250 N. Ferdon Blvd., Crestview, FL 32536. You can call to register at the following numbers; Gene Parish (home) 682-9489, Kenny Rogers 689-7177, ext. 1560 or Adara Country Club 689-1111. The field is limited to the first 22 teams to register. Explosive matchup Randy Dickson . ......_ _ _ Crestview News Bulletin BAKER Bob Kellogg shakes his head when he thinks about the Walton offensive juggernaut his Baker football team (4-1) faces Fri- day night. The Braves (4-1) are loaded, starting with Issac Jackson, a multi- talented running back. Jackson leads the area in scoring with 92 points and is second to Baker's own Cameron Domangue in rush- ing with 792 yards. Jackson is just one of many weapons at the disposal of Walton coach Lenny Jankowski. Senior quarterback Tarrell Bram- let has thrown for 814 yards and six touchdowns. Deron Hogans has 23 receptions for 290 yards as the Braves continue to trot out athletes. "It is a big test for us," Kellogg said. "When we played Arnold (Baker's only loss) we knew that was a big challenge for us, and they were physically going to manhan- dle you, which they did. "I think Walton is a finesse team. They have skill all over the place. For us to hem up all their skill is go- ing to be big challenge for us Friday night." Gator defender Dakota Hooper knows the best way to stop Jack- son. "We have to gang tackle him and get 11 men to the ball," Hooper said. Beating Walton isn't as easy as just stopping Jackson. "You know you've got to stop Jackson, and then they throw three or four other guys at you that are just as hard to stop," Kellogg said. "Jackson is the number one guy, but they've got skill everywhere, and I don't know how you take it all away. "If you take one away they'll hurt you with one of the others." Ann Spann / Crestview News Bulletin Baker's Billy Whatmough (22) returned from an injury to score a pair of TDs against Northview this past Friday. FRIDAY'S GAME Baker (4-1) at Walton (4-1) 7 p.m. . Radio: WTJT Last meeting: Walton won 57-12 last season. Fast fact: Walton has outscored Baker 126-26 In the last three meet- ings. Kellogg is trying to develop a similar arsenal around Domangue at Baker. "That's what we hope will hap- pen with us," he said. "If they try to stop Cameron that Marcus (Jones), Kellan (Meeks) or Billy (What- mough) will pick up the slack. "The key to us being success- ful in the second half of the season is being able to spread it out and have those threats. Kellan has his best game two games ago (against South Walton). And then Marcus comes in and has the night he had against Northview (rushing for a See MATCHUP B2 Crestview hopes to bounce back against Mosley Nick Tomecek / Florida Freedom Newspapers Chris Pickett (with ball) tries to escape a Choctaw tackler during the Dawgs' game this past Friday against the Indians. Randy Dickson Crestview News Bulletin The last two games have not been kind to the Crestview football team. Despite outgaining both Pace and Choctaw- hatchee, the Bulldogs ended up on the short end of the scoreboard in both contests. The loss to the Indians was especially discour- aging. Choctaw kicker Dillon Drake kicked the game-winning field goal with eight seconds remaining to hand the Dawgs a 31-28 defeat in the District 2-4A opener for both teams. Things don't get any easier for the Bulldogs (2-3) this Friday as they travel to Bay County to take on Mosley. Kickoff is set for 7 p.m. at Bozeman School on State Road 77, just south of State Road 20. The Dolphins (4-1) FRIDAY'S GAME Crestvie-w (2-3) at o.1osle/y (4-1) 7 p m at Bozeman Radio: W-4Z-WJSB Last meeting: Mosley spoiled the Dawgs' norrecoming 38-31 last ye ar. Fast fact: Both teams nave scored at least 25 points a piece in each o(f te three meetings since 2005. also are coming off a loss, a 31-28 setback against Leon in a District 3-4A game. Mosley's 28 points against the Lions repre- sented its worst offensive showing of the year. The Dolphins are av- eraging more than 45 points a game. "Mosley has a good club, they are 4-1," CHS coach Matt Brunson said. See HOPES B2 Baker in the driver's seat in District 1-2B Randy Dickson Crestview News Bulletin It's a little early to be crowning the Baker football team the District 1-2B champions, but the Gators definitely are in the proverbial driver's seat. Baker improved to 2-0 in district play with a 34- 21 win over Northview this past Friday. The Ga- tors got a little help when South Walton traveled to Vernon and upset the Yellow Jackets. Those results left Baker as the only team in the district without a loss at the midpoint of the district schedule. This week the Gators step up a classification when they travel to De- Funiak Springs to take on Walton. The Braves are probably the second-best team Baker will see dur- ing the regular season, with Arnold being the best. Everything seems to be going right for the Ga- tor with the exception of a couple of injuries, the biggest of which is the loss of linebacker Josh Rose. Even without Rose, the Baker defense continues to come up with enough stops to win games. With an offense that features quarterback Cameron Domangue, who is fifth in the state in all classifications in rushing with 208 yards a game, the Baker defense doesn't need to make a lot of stops to assure the win. The bad news for Gator opponents is Do- mangue is no longer a one-man show. See BAKER B2 BLEACHERS VOLLEYBALL Choctaw 3, Crestview 1 Powered by the hit- ting of Megan Gorey, Choctawhatchee took a 3-1 win over Crestview in District 1-5A volleyball action on Oct. 6. Games scores were 26- 24, 25-17, 18-25, 25-10. Crestview held leads early in the first two games, but Choctaw rallied to win both. Sophomore Alicia Dukes had four of her match- high 15 kills in Game 3 as Crestview kept the match alive. But coming off a five- game win over Catholic on Oct. 5, the Bulldogs finally ran out of gas as the Indians cruised to the win in game four. Crestview: Brittany Zellars 1 ace; Dawn Holderfield 1 block; Erin Koester 4 aces, 2 digs; Anne Hooper 3 blocks; Lauren Estep 3 aces, 3 blocks, 2 kills; Alicia Dukes 1 block, 1 dig, 15 kills; Jacey Sanders 4 aces, 15 assists, 1 block, 1 kill; Sara Hamilton 1 block, 1 kill. Baker 3, Pensacola Christian 0 Baker coasted to a District 1-2A win against Pensacola Christian on Oct. 6, 25-21, 25-17, 25-14. The Gators have won eight of their last nine matches. Baker: Alysaa Horn 7 kills, 2 blocks; Kali Flanders 5 kills, 3 digs; Courtney Fountain 5 kills, 1 ace, 2 digs; Kaitlyn Hunter 12 digs, 3 aces; Lauren Griffith 17 assists, 2 kills, 1 ace, 1 block. Walton 3, Laurel Hill 2 Caiti Stewart had 12 kills to lead Walton to a five-game win in non-district play. The Braves improved to 15-4 with the 25-17, 25-16, 19-25, 23-25, 15-13 win. Laurel Hill was led by 15 kills from Katie Free and nine aces from Amanda King. Laurel Hill: Katie Free 15 kills, 7 aces, 8 digs, 3 assists, 4 blocks; Amanda King 9 aces, 4 kills, 17 digs, 2 blocks; Elizabeth VanWinkle 12 as- sists, 5 digs, 2 aces. Crestview 3, Tate 0 Alicia Dukes smacked 15 kills and had four aces as the Bulldogs (11-7, 3-4) cruised in the District 1-5A match, 25- 20, 28-26, 25-22. Jacey Sanders had 16 assists, Anne Hooper added four kills and four blocks, while Lauren Estep had four kills. Crestview: Alicia Dukes 15 kills, 4 aces; Anna Hooper 4 kills, 4 blocks; Lauren Estep 4 kills, 3 blocks, 1 ace, 3 digs; Jacey Sanders 16 assists, 4 kills. Laurel Hill 3, Central 0 Katie Free registered 13 kills as the Hoboes (15-5, 5-1) notched an easy District 1-A victory, 25-10, 25-16, 25-21. Elizabeth VanWinkle had 10 digs, nine assists and four aces, and Jami Sheets had eight digs and five assists. .Laurel Hill: Katie Free 13 kills, 4 digs, 2 aces, 2 blocks; Jami Sheets 8 digs, 5 assists, 2 aces; Elizabeth VanWinkle 10 digs, 9 assists, 4 aces. BOYS GOLF Choctaw 159, Niceville 168, Crestview 195 Brandon Jowers shot the tournament-low score of 37 on his way to leading Choctaw to a 9-stroke vic- tory Thursday at Heritage Plantation. Crestview: A.J. Locke 43, Mike Taylor 44, Wesley Josey 54 and Brandon Sparkman 54. NVO&vED We are always looking for sports information and news F ED AR E YOUf I UIfrom those involved in our community. ..I...... ARE YOUV OLVED Please direct all sports news, information and results to Sports Editor ArD Randy Dickson at (850) 682-6524 or by e-mail at randyd@crestvivewbulletin.com a ir .. .,-, .: ,.- B2 I Crestview News Bulletin SPORTS WEDNESDAY, OCTOBER 15, 2008 MATCHUP continued from B1 BFo14AdyCampbellNTR82Y93-iU75 career-best 172 yards this past week). You still have to stop Cameron, but you have to stop other people, and that's what will make us a better football team." Jones hopes to build off his big game against the Chiefs, in which he also was Baker's Defensive Player of the Game. "It gives me a lot of con- fidence because that was the best game I've had in my high school career as far as rushing," he said. "I like of- fense better, butbeing Defen- sive Player of the Game (as selected by Baker's coaches) was the icing on the cake. "Walton has a big, fast defense and they run the 3-3 defense that we can't prac- tice. And they will have a lot of momentum because it's their homecoming, but I think we can overcome it." The Gators already have proven themselves by matching their win total from last season, but a win against the Braves could be a signature game. "It was the first time we've beaten Northview in a while, and any time you can beat a rival team it gives you a big boost in confidence," Hooper said. "If we can win this game people will give us a lot more respect." See News Bulletin Sports Editor Randy Dickson and News Bulletin Editor Kyle Wright -make Iheir picks for Friday's games at- viewbulletin.com. Randy is 8-2 in his video predictions. Kyle is 8-1 (he didn't offer a prediction for Baker's opener against Bozeman). Frr, F -- F r , .. 'A A ERA *frrjtrr F r dF [iFr Foxwood MGA Championship 2008 Gross Scores Right 1 T1 Brad Gutnik 69-75-144 T1 Steve Mobley 75-69-144 3. Tom Prier 74-72-146 4. Chris Johnson 76-72-148 5. Cory Mcsween 77-77-154 6. Rance Harrell 78-80-158 7. Cary Gates 77-83-160 8. Brandon Moser 81-80-161 9. Ronald Henderson 83-82- 165 10. Max Carver 85-83--168 11. Wayne Grandstaff 86- 83-169 12. Jay Parham 89-82-171 13. Bobby Elmore 85-87-172 14. Andy Campbell 82-93-175 *Brad Gutnik won a sudden death playoff over Steve Mobley on the third hole for the club championship Flight 2 1. Steve Whiddon 76-74-150 2. Mike Bouchard 78-77-155 3. Buddy Hartzog 78-78-156 4. Skip Mclean 79-80-159 5. Charlie Grosskurth 84- 79-163 6. Terry Thomas 82-84-166 7. Tim Fink 87-81-168 8. Philip Weltin 93-90-183 9. Joe Altieri 93-91-184 10. Sonny Gomez 93-93-186 Flight 3 1. Ron Magruder 89-85-174 T2. Brian Davis 84-91-175 T2. Bruce Turner 87-88-175 T2. Mark Robinson 85-90-175 5. Bob Van Lorynen 88-88- 176 6. Pete Sniezko 81- 96-177 T7. Archie Perez 94-88-182 T7. Larry Fordyce 86-96-182 9. Terry Bays 91-93-184 10. Paul Zapletal 93-92-185 T11. Lavaughn Dorman 100- 92-192 T11. Owen Edwards 96-96- 192 13. Marcus Mikulcik 93-100- 193 14. John Blair 95-109-204 Flight 4 T1. Bill Brumbaugh 91-93-184 T1. George Bonner 92-92-184 T1. Robert Zwirblia 95-89-184 4. Byron Davis 91-100-191 5. Will Bonham 103-89-192 6. Tom Burns 97-104-201 7. Donald Mazerat 104-98-202 8. Tom Cook 104-100-204 9. Randy Taylor 108-97-205 10. Jerry Smyrl 105-102-207 11. Ferrell Sasser 107-101-208 12. John Berenics 105-106- 211 13. Jesse Dennis 107-107- 214 14. Mark Purvis 107-110-217 HOPES continued from B1 "They are like us, they got beat 31-28 (last week) so both teams will be looking to rebound. "They are very athletic in their skill positions - quarterback, running back and receivers, so we will have our hands full de- fending them." Mosley. runs the Wing- T offense that was wide- spread a few years ago, a scheme that has been re- placed by the spread for- mation at many schools. "This will be the only time we see that offense all year, and it's tough to prepare for in one week," Brunson said. "Those guys do a great job with it. "They have a good of- fensive line with great skill. Their running backs play fast, which is some- thing we all try to get our guys to do, but they do play fast." Brunson wasn't neces- sarily talking about great sprinter speed when he described the Dolphins. He meant football speed of hitting a hole quickly or turning the corner on the defense. Crestview linebacker Gabe Goodson looks for- ward to facing a run-ori- ented team. "It's an easier offense for me to read because they like to pull a lot," he said. "I get real good reads when we go against the Wing-T so I like it. "Football is about building on past experi- ence, and I have a lot of experience with the Wing- T (the Bulldogs ran it prior to last year), and I hope I can use it this week." Goodson and his defen- sive mates will be trying to slow down the Mosley offense. Brunson expects for the Bulldog offense to continue to thrive as Jor- dan Glover is coming off a 200-yard rushing per- formance against the In- dians. Brunson credits the guys up front for much of Crestview's recent offen- sive success. "The offensive line has been playing extremely well, and hopefully we can build on the positive things that happened last week and keep moving forward," he said. Crestview quarterback Jason Parker is impressed with what he knows about the Dolphins and thinks it will take a good effort throughout the week of practice to get ready for them. "They are a good team this year, and they've got a lot of players back from last year." he said. "We are going to have to practice hard this week and get better from the loss Friday night against Choctaw. "It was a tough loss be- cause we got more yards than the them, but they beat us by a few points." Parker believes a win over Mosley would be a big boost for when the Bulldogs return to District 2-4A play next week. "It can be a very impor- tant game for us because if we can get a win we will have a lot of momentum going into the Fort Wal- ton Beach next week," he said. Visit our online high school football reference pag- es at. com. BAKER continued from B1 311 North Main Street Crestview, FL 32536 682-6655 Running back Marcus Jones is coming off the best game of his career and has the potential to break a long run at any time. Baker also has a power back in Kel- lan Meeks, who runs over would-be tacklers the same way he runs through ballcarriers from his linebacker spot on defense. Domangue has im- proved his passing, and the return of Billy What- mough from an injury will enhance what the Gators are trying to do on offense even more. Looking ahead to the next few weeks, Baker hosts-Holmes County in a big District 1-2B game Oct. 24 and closes out district play Oct. 31 at Vernon. Gator coach Bob Kel- logg might want to treat South Walton coach Da- vid Barron to dinner after the Seahawks upset the Yellow Jackets at Vernon. South Walton's win assures Baker of no worse than a shootout for a playoff spot if the Gators hold serve against Hol- mes County. The Gator seniors are hungry for more than just a shot at the play- offs. They've set their sights on a district title and seem determined to bring it home. A win , :, C R E S T V I E W ;:. Let us care when you're not there. During these trying times, we would like to offer some relief to all our customers. We are cutting prices on grooming services by 15% until further notice. We also provide climate controlled boarding with indoor and outdoor runs. We ha e openings for ne, clients. P- ,PLEASE CALI_ FOR AN APPOINTMENT 682-0188 6037 Robin Rd., Crestriew, FI Halloween night and that mission will be accom- plished. The District 1-2B race could get interesting in the next few weeks, and it will be interesting to see if the Gators emerge as champions. Don't count Crestview out of the playoff picture yet in District 2-4A. Yes, the Bulldogs suf- fered a heartbreaking loss to Choctawhatchee last week, but Crestview is at home for its final two dis- trict games. The Dawgs will have their hands full with Fort Walton Beach on Oct. 24 before hosting Navarre on Nov. 7 to close out dis- trict play. The Vikings, ranked No. 3 in Class 4A, will be a tough test. Crestview could pull off the upset if Jordan Glover continues to run the way he did against Pace and Choctaw. Even with a loss to the Vikings, the Bulldogs could still make the play- offs if they beat Navarre - provided the Raiders beat the Indians on Oct. 24. If that scenario plays out, Crestview, Choctaw and Navarre would meet in a shootout on Nov. 10 to determine the District 2-4A runner-up. Let the playoff runs begin. Need Eye Glasses to Read? Smart LensessM u'ifioll e('e G s. 71" 71 all tistMIces (close lp. .ar nf if'M beli.eeo) oalfra. mr.es.v laio ihD. ..Darr,,,,,,,Payne. o ... o ,. .. I ( at ___a l * -*l ***ll ^ t.^ ^^ B e lliveciN Location y eliaB5 11 Dr. Crestview Location 0 39 N Ferdon Blvd. MULLIS EYE INSTITUTE Darren Pavne. MD 678-5338 682-5338 Board C, .'h..i 0 0 D.'0 v.,. ,,.' ,& Cataract Specialist NO HIDPEN CHARGES:.It is our office policy that we have the right to refuse to pay, cancel payment or be reimbursed for payment for any other services, examination, or treatment which isferformed as a result of and within 72 hours of resoondina to the advertisement for any f ie. discounted fee or reduced fee service, examination or treatment. I __._.__.._ I -------- -- ------------ ---- --- --- I WEDNESDAY, OCTOBER 15, 2008 SPORTS Crestview News Bulletin IB3 BAKER 34, Baker is NORTHVIEW 21 now the Baker only team Northview 7 0 6 8 21 needed in District Baker 14 7 7 6 34/ four plays 1-2B 1ST QUARTER / to drive 65 without BAKER Billy Whatmough 4 pass from Cameron yards for its a loss in Domangue (David Beck kick) 10:16 first TD and district BAKER Cameron Domangue 20 run (David Beck six plays to play. kick) 6:10 1Sgo 89 yards NORTHVIEW Jay Jackson 74 run (Austin Reid for its kick) 5:51 second 2ND QUARTER score BAKER Billy Whatmough 23 pass from Cameron Domangue (David Beck kick) 2:14 Jay 3RD QUARTER Christian Jackson NORTHVIEW- Jay Jackson 10 run (kick failed) 8:09 Mainor would BAKER Cameron Domangue 6 run (David Beck kick) recovered wo 3:48 recovered finish 3 4TH QUARTER an onside with more NORTHVIEW- Jay Jackson 2 run (Jay Jackson run) 9:12 kick after than 200 BAKER Marcus Jones 7 run (kick failed) 5:18 / the last rushing Gator TD, yards for PLAYER STATISTICS allowing Northview OFFENSE Baker to PASSING Baker, Camreron Domangue 5-11-1-71. run out RUSHING Baker, Cameron Domangue 29-228, the clock Marcus Jones 14-172, Billy Whatmough 6-50, Kellan Meeks 3-17, Dakota Hooper 1-15. RECEIVING Baker, Billy Whatmough 2-27, Tyler Billy Holley 2-26, Cameron Davis 1-18. Whatmough / '<^returned Marcus DEFENSE after Jones' Baker tackles-assists-total (tackles for loss not included missing rushing in total) Kellan Meeks 5-2-7, Dakota Hooper 3-4-7, a pair of total was Marcus Jones 3-3-6, David Beck 5-0-5, Josh Williams games a career 2-3-5, Billy Whatmough 0-5-5, Christian Mainor 0-4-4, with an high Brandon Ates 3-0-3, Blake Bollinger 3-0-3, Tyler Holley i; t.. Brandon Ates also broke up a pair of passes 3-0-3, Tyler Moberly 2-1-3, Cameron Domangue 1-1-2, catch a Preston Nixon 1-0-1, Cameron Davis 0-1-1. pair of TD Fumbles forced -Josh Williamspasses F UimhIlUq rfnvntrUrI IPl-t;hrilOn inM Iinnr DrItnnNiflUnni I UlieIGr IeobUVGIU -- l 1OU lI IVIan IU| I o Uresi on iAUxon TEAM STATISTICS N B FIRST DOWNS 10 24 TOTAL NET YARDS NET YARDS RUSHING NET YARDS PASSING FUMBLES-LOST PENALTIES-YARDS 280 30-259 2-8-0-21 2-1 7-50 Baker piled up 553 season 53-482: bests in 5-11-1-71 rushing 1-0 yards and 4-30 total yards Crestview had won the last three games in the series This was the longest scoring\ run allowed\ by the Dawgs this season Crestview has outgained four of five foes this season; the Dawgs won the only game (West Gad.sden) CHOCTAW 31, CRESTVIEW 28 Blake Crestview 7 7 6 8 28 Ritchie Choctawhatchee 0 14 14 3 31 picked up a 1ST QUARTER rolling snap CRESTVIEW -Jordan Glover 2 run (J.T Arnold kick) and ran 7:262ND QUARTER into the end CRESTVIEW -Jerry Siler 6 run (J.T. Arnold kick) 9:31 zone for the CHOCTAWHATCHEE Phillip Roebuck 55 fumble return TD (Dillon Drake kick) 8:14 CHOCTAWHATCHEE David Weber 1 run (Dillon Drake kick) :24 3RD QUARTER Choctaw CHOCTAWHATCHEE Robby Keefe 35 pass from David drove into Weber (Dillon Drake kick) 5:59 field goal CRESTVIEW B.J. McClure 25 interception return (kick range failed) 1:18 despite a CHOCTAWHATCHEE Freddie Gray 56 run (Dillon penalty on Drake kick) :11 the kickoff 4TH QUARTER ...... CRESTVIEW Blake Ritchie 7 run (Jordan Glover un run)1:27 CHOCTAWHATCHEE Dillon Drake 35 FG :07 PLAYER STATISTICS Jordan OFFENSE Glover's PASSING Crestview, Jason Parker, 2-10-0-29, Blake rushing Ritchie 3-4-0-25. total RUSHING Crestview, Jordan Glover 26-208, Chris included Pickett 9-78, Jerry Siler 10-59, Blake Ritchie 1-6. a 45-yard RECEIVING Crestview, Alien Caldwell 2-25, Jordan run to set Glover 1-19, Chase Boals 1-10. up the DEFENSE tying TD Crestview tackles-assists-total (total does not include late in sacks) Keyshawn Thomas 5-7-12, Gabe Goodson 3-7- the fourth 10, Chris Briley 1-9-10, J.T. Arnold 1-7-8, B.J. McClure quarter in which 3-3-6, Levi Hendrix 2-3 they were Robbins0-5-5, George Sleywe er 2-0-2, Josh Jadin outgained Banach 0-1-1, Mitch Ke Interception- B.J. Mc Opponent's fumbles fori These TEA three Crestview 'FIRST DOWNS Crestview TOTAL NET YARDS fumbles NET YARDS RUSHING led to 14\ NET YARDS PASSING Choctaw\ FUMBLES-LOST points PENALTIES-YARDS -5, Cody Swenbeck Frye 0-4-4, Ben Bab 0-2-2, Jordan Glovi ertis 0-1-1. Clure 1. ced Chris Briley. M STATISTICS CR 15 405 46-351 5-14-0-54 3-3 7-53 1-4-5, Darius ber 2-1-3, Jerry er.-2-2,Drew Freddie Gray (60 yards) and La'Keefe CH Robinson 15 (85 yards) 349 / accounted 35-214 for most of 10-21-1-135 Choctaw's 6-50 offense Baker picks Players of Cameron the Week Domangue Crestview News Bulletin The Baker football coaching staff has announced its Players of the Week from the Gators' win against Northview this past Friday. Cameron Domangue was selected Of- fensive Player of the Week. Domangue ran for 228 yards, threw for 71 more and had a hand in four touchdowns. Marcus Jones was picked as Defensive Player of the Week. Jones who also ran for 172 yards on offense made six tack- les. Christian Mainor was selected Special Teams Player of the Week. Mainor recov- ered an onside kick late in the game that allowed Baker to run out the clock. Marcus Jones Christian Mainor Hammonds fails to qualify at Virginia Special to the News Bulletin PETERSBURG, Va. - Crestview native Tom Hammonds failed to qual- ify with his teams new chassis at the third annual Virginia NHRA Nationals this past weekend. The team had two runs to make it into the 16-car qualifying field for elimi- nations. The No. 20 Race for Achievement .Chevy Cobalt's new chassis did not run as well as expect- ed with an elapsed time of 6.629 seconds (207.24 mph) in the fourth ses- sion and 6.632 seconds (207.59 mph) in the third session, "It is just a new car, a new car deal. We have no notes. We are starting over from scratch with no notes. I think the car is fine. We just have not hit it yet," said Kenny Tom, Team Hammonds crew chief. Tom said the team still has a lot to learn about the new chassis in order to be competitive. He an- ticipates the next steps will be to analyze the data from the race so the crew can make correct de- cisions in order to run at the higher speeds. "I am disappointed we did not qualify," said Hammonds, "and we know our car is capable of a lot more." Find the latest sports scores and news online at. Toys for Ki S- OCrestiew's 10th Anni L "Run for the November 2, S,,,,, ) dIs versary Toys 2008 Crestview Wal-mart Parking Lot (In Crestview on Highway 85 by I-10) Registration 9:30 11:00 a.m. ($10 and a NEW Unwrapped toy.) Food Raffle 50/50 After the ride at the VFW on 90 West of town. Music by Hat Trick Cash Door Prize (So hold on to your registration ticket) /All Motorcycle S Enthusiasts Welcome! Toys and donations accepted at Wal-mart parking lot during registration Distribution of all toys and funds by: Families First Network olde children r.ceie Contact: Ken Henninger at gift certificates. 537-9798 CRATE I.ATEMODELS.. 000 ..... O00.0 M HOBBY..............300.00 STREET STOCK........ S 300.00 SMODIFIEDS...........* 300.00 BOMBERS............ 250.00 4: STINGERS............$ 200.00 SINTAGE. ............ s$ 200.00 All winners Friday Night will be guaranteed at least lace' starting spot on Saturday Nights featuresoand 2nd and 3rd place finishers. Will be guaranteed is provisional on Saturday Night. SRTLJRDF4y gBTH OCT 'Gates Open 3pm Practice 6 Races 7pm CRATE LATEMODELS. HOBBY ............. STREET ............ ..... 4400 . * 5600 J ... $500 .S 500 ... S300 I 920 H33 ,." 01-- ",.. , ; B4 I Crestview News Bulletin SPORTS WEDNESDAY, OCTOBER 15, 2008 + LHS cheerleaders place at Mobile competition Special to the News Bulletin The Laurel Hill School cheerleading squads placed at the GMAC Bowl Cheer 21/Spectronics Cheerleading Competi- tion held Oct. 4 in Mobile, Ala. The varsity team finished in fifth place in its division and received a spirit recog- nition. The junior varsity squad finished sec- ond in its division and received recogni- tion for jumps, sportsmanship and spirit. Varsity cheerleaders Maegan Goodwin, Aimee Mack, Shel- by Williams, Jessica Okkema, Malissa Ko- pacz, Deidre Harrison, Amanda Taylor and Molly Carter. Junior varsity cheerleaders Ashley Hatfield, Samantha Henderson, Hope Standridge, Taylor Harrison and Tabitha Barrow. All area cheer squads are encouraged to sub- mit pht1to_ from their competitions to kylew@ . crestviewbulletin.com. NO-CTO S D i FREBAICPERS NALCHECKS FRE^E OFFICIAL CHECKS & MONEYORDERS FREE INTERNET BANKING WITH uBIL A FREE DEB~fIT CARD HlJ^ ^y^^ BONUS RATE ON CDHSM~^^^^^^ FRE MAL AFE EPSI OXSss^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FRE IMAG STATEMENT^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^*^^^^^^^^H^^^^^^^^M. 0^^ UeFfinestin -EYE CARE B^HnBB~iju^^K~itS0 Darren Payne, MDN * Full-Time Medical Director ot Niceville Office * I ears Experience * A Friendly and Caring Personahb i list 930 N. r B lC ret vie 8 25 115 B a~ijleyD. Ncvle 5-6853 Ann Spann / Crestview News Bulletin Richbourg's Olissa Lee puts the ball over the net during the Roadrunners' victory over the Davidson Panthers. Roadrunners edge Panthers Crestview News Bulletin It couldn't have been any closer. Richbourg defeated Da- vidson 24-26, 25-9, 16-14 in middle school volleyball action Oct. 8 at Richbourg. The Roadrunners con- cluded their season with a 6-3 record, good for fourth place in the Okaloosa County Conference. The Panthers finished 5-4, good for fifth place. Both teams finished in the top half of the conference. See an online photo gallery from the game at- viewbulletin.com. Jasmine Middleton goes to the net for Richbourg. St ton Retiement NWF State College Continuing Education Start your investing journey and move down the road to your financial goals. Topics include: saving vs. investing, risk tolerance, understanding portfolio objectives, importance of balance and diversification, investing "rules of the road", and developing your financial strategy. This two night workshop is being held at the NWF State College centers in Crestview and DeFuniak Springs. For more information please call Continuing Education at 729-6085 or 729-6084. Building a Strong Retirement XPT 3008A, Ref# 63342 Room 306, NWF State College Robert L. F. Sikes Center, Crestview October 21 & 28 5:30 p.m. 7:30 p.m. Registration Fee $20 Building a Strong Retirement XPT 3008A, Ref# 63343 Room 216, NWF State College Chautauqua Center, DeFuniak Springs November 6 & 13 6:00 p.m. 8:00 p.m. Registration Fee $20 / / NORTHWEST FLORIDA STATE COLLEGE 2Um7632 Young Gators take on Andalusia Special to the News Bulletin The Baker Area Youth Assoc- iation football teams had a tough S day this past Saturday against An- dalusia. The 5-6 team fell 36-0. The 7-8 team lost 26-0. The 9-10 team dropped a 20-0 de- cision.- The 11-12 game was the closest contest, but Andalusia prevailed 18- 6. Submit photos of your favorite youth Photos by Cinridy Carroll / cindycarroll71@yahoo.com football team to kylew@crestviewbulle- Bradley Inscore makes a stop for Baker. tin.co'm. --- ~~P~l WEDNESDAY, OCTOBER 15, 2008 BUSINESS Crestview News Bulletin I B5 WAAZ/WJSB, Strickland honored Special to the News Bulletin WAAZ/WJSB AM/FM and announcer Tommy Strickland were honored at the recent annual meeting of the Okaloosa County Farm Bureau Federation. The station and Strick- land were honored for bringing together agricul- ture and the consumer. Gerald Edmondson, Oka- Idosa County Extension Director and ex-officio member of the Okaloosa Federation Board, present- ed the award. e "Tommy Strickland has consistently promoted agriculture and the local growers of fruits and veg- etables," Edmondson said. "He has provided a very valuable service to con- nect the farmer directly to the consumer to prove ide Wholesome nutritious fruits and vegetables." Special to the News Bulletin Okaloosa County Extension Director Gerald Edmondson (left) honors announcer Tommy Strickland. Curves of Crestview Gets 'Physical' with at Girl's Nigt lIn event Special to the News Bulletin Olivia Newton-John will make a special appearance at Curves of Crestview fiom 5 to 8 p.m. Oct. 23.. No, not in person, but on DVD along with Curves founder Diane Heavin and world-renowned breast cancer surgeon Dr. Ernie Bodai in an informal and educational video filmed exclusively for Curves. In addition to Newton- John's video message, Curves of Crestview Girl's Night In will feature a Re- lay For Life fundraiser. The evening will include Food, fun, games, door prizes, spa treatments and so much more. Businesses interested in participating in this event can call Lisa 428-2787. For details contact Bren- nan at 428-2787. HOPE House to hold open house HOPE House to hold open house Kyle Wright Crestview News Bulletin The HOPE House is ready to show the community its new look this week- end. The "runaway shelter" for teens ages 10-17 located at 5127 Eastland St. in Crestview, will hold an open house Friday at 10 a.m. The facility's former screened-in porch now is completely enclosed. Ren- ovations have added a new day room, a new office and a new conference room. "We're still saying we can't believe it," said Cyndy Freshour of HOPE House. The project was completed almost entirely through donations. More than 40 companies and indi- viduals contributed time or services. Jemco Plastering of DeFuniak Springs kicked off the effort by replacing the stucco in the building. "So many have been involved, it would be hard to list them all," said Freshour. HOPE stands for Hope Of Potential Empowerment. The facility is a pro- gram of Lutheran Services Florida. Home Owners Insurance getting you Down? Let us pick you up, with new 0 L iLoiered Rates! PALM INSURANCE 682-6199 _- (C L< 0i P I N C( R I 0 RA T E PF When moments are difficult to express with words, we offer you a way to display them on fitm. Your loved one's smile, the way he or she told a BRACKNEY story- sometimes words cant do these moments justice. For that reason, one of the ways we serve FUNERALSEvICE you is by otfering you a DVD tribute that says 480 E. James Lee Blvd. more than words could ever express. (850) 683-9898 Locally owned and operated 6 ,iBBON CTING CREST VIEW ^ rCE i .- '.fERi -.. Randy Beard / Crestview News Bulletin The Hot Dog Shoppe held its ribbon cutting Sept. 30 at its location at 1308 N. Ferdon Blvd. Wi o n F fi r, -, r, n , [ -',:.D _/U[__'_ "" .4ft; ,sfF~,ff .[o m eThe best trained people in . m aidIs he business. On,. Is I t .ig o a, r .',r . Free Phone Quotes *ouT r, as r.:,lr n-td 4d bw r dg, * Eulid d and m plared e.mploe l, * Quab :er rice ar J V* \ bring otu own ea iprioi.[ and :upplh ' * Bsdakround chccL & dzug cen: c-n 1! ciplosoe Crestvieg 850-89 -2149 Avryainlaaoble Now! Available Now! Sleep Medicine EL aluations Consulatrion, Available at our Crescrie\v Location. Roman Kesler DO, FAASM 4 .. Diplomate American Board of Sleep Medicine Call for your appointment today (850) 689-5496 (850) 243-4456 Sleep Disorder Center 5I E tir Pine Anc. LCai tu-ic, FL 32I39 151 MaN r Etl.er Blvd. Fr. \\'ilton Beach. FL 325to c def b.corn ., ,*-. . ",! . ._ .' _, -* .' i's " A hard dav's \\'ork doesn't have to be so hard. G rand L-10 Serie s M 140 Series RT\ ",- .. ._ ... A Wis ;e Equipment Sales & Service 1147 S. Ferdon Blvd. Crestview, FL 32536 (8501 682-3366 m~i .4 I .. J :, ,- 1 ,-'Y4 : : , ; : .. . "", .' :. . ^ AT.. : f, .. -j A.V4 . I j I , ; 4 1 *' . .. .- ^' :.^.-, --:. . 4 -~ .5,4~ -4- 5- 'I i( bOl',;. i iS i' i .FETY I ^ -...**-' ...'' 7,C;: .^:: ' --I ]- E^''RA^^^^^B-AB^^,^r" FO AfLE k BAmericani jgRf * s j:l BRTSINESS I Crestview News Bul _ WEDNESDAY, OCTOBER 15, 2008 Tax incentives available for geothermal systems Special to the News Bulletin Home and commercial building owners who in- stall geothermal heating and cooling systems are now eligible for federal tax incentives under the Ener- gy Improvement and Ex- tension Act of 2008, passed by Congress on Oct. 3 as part of the economic re- covery package. The Energy Improve- ment and Extension Act offers a one-time tax credit Special to the News Bulletin The Goodwyn, Mills and Cawood, Inc. Crest- view office announces Marc Carpenter has joined the firm as Busi- ness Development Man- ager and that Kody Walk- er, EI, Project Manager, has graduated from the 2008 Leadership Walton program. Carpenter, a U.S. Army veteran, brings more than 13 years experience managing and selling engineering services to a variety of industries in- volving environmental, commercial, industrial, aerospace, and defense projects, gaining exten- sive experience in sourc- ing and attracting techni- cal and engineering tal- ent required for quality design services, project management, and eco- nomic development. He is involved in the Aero- space & Defense Adviso- ry Board, the SBIR/STTR Steering Committee for Florida's Great North- of 30 percent of the total investment for residential ground loop or ground water geothermal heat pump installations, with a maximum credit of $2,000 for a single residence. The legislation also provides a credit of 10 percent of the total investment, with no maximum credit, for com- mercial system installa- tions. To qualify for the tax credit residential systems must meet Energy Star Marc Carpenter Kody Walker west, and Okaloosa County EDC's TeCMEN Association. Carpenter earned a bachelor's de- gree in business adminis- tration from Flagler Col- lege in St. Augustine. According to Chuck Faulkner, PE, Regional Manager of Goodw- yn, Mills and Cawood - Florida operations, "Marc's diverse back- ground adds a unique perspective to our firm that will allow us to con- tinue to provide clients with a high level of ser- vice. His proven ability will help Goodwyn, Mills and Cawood reach a new level of success and en- hance our primary goal requirements, and legisla- tion is retroactive to resi- dential systems installed after Dec. 31, 2007. The tax credit for commercial buildings begins with sys- tems installed after Oct. 3, 2008. Owners can file for the credit by complet- ing the Renewable Energy Credits subsection on their 2008 tax return forms. No proof of purchase is re- quired. However, in case of an audit, owners are encouraged to keep a de- of client satisfaction." Walker graduated from Walton County Vi- sionary Council, 2008 Leadership Walton pro- gram. The annual class consists of 25 emerging leaders who have dem- onstrated commitment to community service, achieved leadership po- sitions in their fields and are likely to be tapped for greater community responsibility. Walker holds a bachelor's de- gree in civil engineering from the University of Alabama. Faulkner remarked, "Kody has worked dili- gently to establish him- self as a leader in Walton County, learning more about his community and developing strategic relationships. Over the last year, Kody has ex- emplified the "whatever- it-takes" attitude that is required in establishing a Goodwyn, Mills and Cawood office in our new Florida panhandle location." IN THE CRESTVIEW MARKET PLACE | p, s s B NEXT DOOR TO WINN DIXIE! Over 1,000 Wines, create your 150 craft, imported a- seecfe imiporfs & domestic beers or micrsbrews S-,yo, CRESTVIEW'S ,,ms LARGEST SELECTION ack OF SPIRITS! PERSONS SREMANAGER & Open til I I PM RESIDENT WNE EER id & Saturday OPEN Monday thru Thursday ......... 9 AM 10 PM Friday & Saturday ............. 9 AM II PM Sunday ................................... I PM 10 PM 1336 N. Ferdon Blvd. 398-8967 FREE TASTING EVERY FRIDAY 4 6 PM tailed invoice of their pur- chase on file. The contrac- tor who sold and installed the product should list the purchase as a "Geothermal Heat Pump" on the invoice and note that the unit "Ex- ceeds requirements of the Energy Star program cur- rently in effect." Geothermal systems tap the free, completely renewable, supply of solar energy stored just a few feet below the Earth's sur- face and use that energy to From staff reports TODAY. NORTH OKALOOSA SPAGHETTI FUND- RAISER: Crestview's Knights of Columbus will hold their second monthly Charity Fund-Raiser Dinner on Saturday from 4:30 to 7:30 pm. The $7 admission includes spaghetti and meatballs, Italian salad, and coffee or tea. There will also be a "chef specialty surprise offering" for $8. To-go dinners are the same prices. The public is invited to support these dinners, which provide funds for the Knights' many contributions to charities. The KofC Hall is located at 701 E. James Lee Blvd, Crestview. CCI HOLIDAY PET PHOTO SHOOT: Canine Companions for Independence will host a Holiday Pet Photo Shoot on Saturday from 9 a.m. to 4 p.m. at the GFWC Woman's Club of Crestview building at 150 Woodlawn Drive behind Woodlawn Baptist Church. Professional photographer Paula Petsen will take photos with holiday backgrounds. All of the $10 sitting fee will be donated to the CCI. Reservations are recommended. Walk-ins will be worked in as time allows. For details, call (850) 621- 7523. NWF BLOOD CENTER DRIVE: A blood drive will be held Sunday by Live Oak Baptist Church at 4565 Live Oak Road in Crestview from 8 a.m. to 1 p.m. Call 862-4216 for details. DMS FUNDRAISER: The Davidson Middle School Cheerleaders will be holding a Multi Family Yard Sale on Saturday at Crestview High School from 7 a.m. to 1 p.m. drive heating and cooling system in both residential and commercial buildings. In addition to utility, state and now federal tax incen- tives that enhance the af- fordability of geothermal systems, this cost-effective, environmentally friendly technology offers a host of benefits. Locally, Gordon Air Conditioning started in- stalling "open loop" geo- thermal systems in 1981 and went to the more en- Limited rental spaces available: one table, $10; three tables, $20. If you have your own tables you can rent a space for $7. Call Flo Fader at 974- 5539 to reserve your table or space, or for more information. VETERANS PARADE SIGNUP ENDS FRIDAY: The Veterans Day Parade will be held on Saturday, Nov. 8 at 2 p.m., with form- up starting at 12:30 p.m. in the vicinity of the First Assembly of God Church on South Main Street. Parade participant registration forms may be acquired by downloading a copy from the City of Crestview's web site ( events), or from the office of the City of Crestview's Administrative Services Department at City Hall, or by calling directly to Fletcher Williams, Jr., the Crestview Veterans Affairs Committee Chairperson, at 689-1895. Details: Fletcher Williams Jr., 689-1895. BREAST CANCER AWARENESS SEMINAR: Oct. 23 at 6 p.m. at Woodlawn Baptist Church, 824 N. Ferdon Blvd. in Crestview. The free event will feature information on mammogram techniques and how they help doctors diagnose, evaluate and treat women who have had breast cancer. A light dinner will be served, and door prizes will be presented. Reservations required; call Jane Lindberg at 689-8446. HEALTH & WELLNESS MEETING SCHEDULE: The Crestview Chamber Health & Wellness Committee will have a meeting each week the entire month of October leading up to the Health Fair. Details: 682-3212. Meetings are at 8 a.m. Tuesday on Oct. 22 and 29 at the chamber office located at 502. S. Main St. EARLY VOTING: will take place from Oct. 20 to Saturday, Nov. 1 at the Crestview library on Commerce Drive. Hours are 8:30 a.m. to 4:30 p.m. "SOCK HOP" FOR SENIOR CITIZENS: Staff members from Emerald Coast Hospice (131 E. Redstone Ave, Crestview) will host a free sock hop dance for Crestview and Goodwyn, Mills and Cawood what's recognizes employees -. COMMUNITY EVENTS VOTE AGAINST THE BIG , TAX INCREASE IF THE NORTH OKALOOSA FIRE DISTRICT CHARTER AMENDMENT = PASSES, YOU'LL PAY THE CURRENT ASSESSMENT PLUS UP TO 3.75 MILS TIMES THE TAXABLE VALUE OF YOUR PROPERTY. IT APPLIES TO HOMES, VACANT LAND, AND COMMERCIAL PROPERTY. EXAMPLE Property Vacant Lot House Commercial Building 2008 Taxable Value $63,338.00 $100,000.00 $310,424.00 2008 NOFD Tax $12.08 $90.57 $603.80 Potential NOFD Tax if Amendment Passes $249.60 $465.57 $1,767.89 JUST VOTE "NO" Pd. Pol, Adv. Paid for by the citizens against more taxes committee, 296 S. Ferdon Blvd, Crestview, Florida 325 6 vironmentally friendly WaterFurnace closed lqop geothermal systems 1996. Gordon Air Condi- tioning has won numer- ous prestigious awards for geothermal heating & cooling, and won the Erder- gy Efficiency Award with APEX every year since t's conception in 1999. For more information about the benefits of a geother- mal heating and cooliig system in our area, visit. . surrounding area senior I citizens at the ROC behind Central Baptist Church on Saturday from 2 to 5 p.m. DECORATING EXTRAVAGANZA: Oct. a 21 at 6p.m. at the Old Spanish Trail Shrine Club,. 971 U.S. Highway 90 West in Crestview. This GFWC Woman's Club holiday * decorating fund-raiser will feature Crestview native w. and nationally recognized floral designer Kirby Holt. Tickets are available for a $10 donation, available from any GFWC member, at the door, or by calling 683-9117, Proceeds support group 5 charities. THE CONSTITUTION: The U.S. Constitution will be explained Oct. 22 at 7 p.m.rr at the Crestview Knights of Columbus Hall, 701 E. James Lee Blvd. 1 Guest speaker Marty rt Lester, president of the ' Okaloosa-Walton County Bar Association, will discuss tl1 document's history, and thl importance of voting. ^ Light refreshments are free of charge. GIRLS NIGHT IN: A t celebration of women and a Relay for Life Event, will be held Oct. 23 from 5 to 8 p.m. in Northview Plaza in Crestview (by Cinema 3). 3 Many activities are iv planned, including music,lq food, door prizes, health a4d wellness. D Wear your tiara, boas, :' glitter, sequins, etc. to be n entered in a special drawing. There's room for more vendors to participate. Cal- 428-2787 for details, or get a form at Curves, 775 N. Ferdon Blvd. Suite C. in Crestview from 7 a.m. to 7 p.m. Monday-Friday, or Saturday from 7 a.m. to noon. Ask for Lisa Brennan. CHRISTMAS BAZAAR: The Knights of Columbus ; Ladies Auxiliary will host i; their annual bazaar on Oct. 25 from 9 a.m. to 3 p.m. at tljie Knights of Columbus Hall I at 701 U.S. Highway 90 East in Crestview. Lunch will be available at a charge of $3.50 for a Filipino plate of pancet, fried rice and egg rolls. A hot dog plate will be available for $1.50. For details, call 689-163k or 689-1208 after 6 p.m. TOYS FOR KIDS: NovJ 2 in the Crestview Wal-Mart parking lot. Registration iss; from 9:30 to 11 a.m. and cc ts $10 and a new, unwrapped toy All motorcycle enthusiasts are welcome to participating the event, a ride from Wal- Mart to the VFW on U.S. Highway 90. Music by Hat Trick, a cash door prize, arkd other activities are planned. JR I r eIw i ., - lltli.; WEDNESDAY, OCTOBER 15, 2008 CLASSIFIED Crestview News Bulletin I B7 0? iS- 'ANNOUNCEMENTS ,MERCHANDISE ----- -.. "-I------ EMPLOYMENT BUSINESS & FINANCIAL I EI 1 w V, ' 3f -II REAL ESTATE AUTO,MARINE,RV4 NOTICE OF SALE NOTICE IS HEREBY GIVEN pursuant to on NNOUNCEMENTS Order or Final Judgment scheduling foreclosure - Legal Advertising sale entered on October - Classified Notices 2, 2008, in this case - Public Notices/ now pending in said Announcements Court, the style of which - Carpools & is indicated above. Rideshare - Adoptions - HappyiAds I will sell to the highest Personals and best bidder for cash -Lost at the front south door, - Found Okaloosa County Court- house, 101 James Lee Boulevard East, Crest- view, Okaloosa County, 1103 . Florida at 11:00 a.m. on the 6th day of Novem- Il # 100413 ber, 2008, the following described as set forth in N THE CIRCUIT said Order or Final Judg- URT OF THE FIRST ment, to-wit: >ICIAL CIRCUIT IN AND FOR COMMENCING AT OKALOOSA THE NORTHWEST )UNTY FLORIDA CORNER OF SEC. 10, CASE NO. T2N, R25 08-CA-3296 OKALOOSA FLOR- IDA; THENCE 89 50' NERSTONE CON- E ALONG THE ACTION AND DE- NORTH LINE OF SAID iPMENT, INC., SECTION 10 A DIS- tiff, TANCE OF 1634.45 FEET; THENCE SOUTH 883.96 FEET TO THE POINT OF BEGINN- N THORNTON- ING; THENCE CON- :E THORNTON. TINUE SOUTH JEREMICHA 100.00 FEET- THENCE CE EAST 612.60 FEET; ndant(s). THENCE N 19 47' 56" W A DISTANCE OF 106.28 FEET; THENCE WEST 576.00 FEET TO SSomet POINT OF BEGINN- ING, BEING LOT 609 Go Fo OF AN UNRECORDED Good For S/D. PROPERTY RUNNING T w EAST GOES TO THE TOmOrTOW CREEK AS IT MEAN- DER. BEG NW COR E1634.45 FT S 883.96 FT TO BEG E 576 FT N125 FT W 385.5 FT THC ALG CURVE 72.29 FT S60 DEG W 159.84 FT TO BEG LOT 610 A/K/A COMMENCING AT THE NORTHWEST L'TE Y CORNER OF SECTION 10 TOWNSHIP 2 SNRTH, RANGE 25 WEST, OKALOOSA TODAYi COUNTY, FLORIDA, THENCE SOUTH 89 11 DEGREES 50 MIN- childd Care Provider has Openings, Mon-Fri, 6:30am-5:30pm Call 689-8540 Harold Gaines Repairs, Remodeling, Additions, Concrete/ Parking Lot Work, Carpentry and Roofing. Lic. #RG 0005399. 850-862-0383 S OVERSTREET'S CLEANING SERVICE Commercial and Su'er Powerful Residential Cleaning. ni- facials with today for our free esti- Immediate results. mate. 850-7 58-6665 Schedule now and recieve free gift. Take a Break & 499-7576 or Call Carefree Services 902-5798 ask for Irina to clean your home. Lic/Ins 850 240-9678 YOGABIDA Certified Bikram Yoga ^ I(Union of Body Mind SSp irit) Instructor; RN Ful/Half/Private/Groups Abs t Calr398-2579 Absolute Concrete ;g Outdoors Tear out & replace. Col- RU IO ored & stamped con- crete. Driveways, Pool iDecks & Patios. Outdoor Airlines Are Hiring - Kitchens & Stucco work. Train for high paying Avi- Lic/Ins 687-7791 action Maintenance Ca- reer. FAA approved pro- American Concrete gram. Financial aid if Driveways, Tear Outs qualified Job placement ;Replacements, Sidewalks assistance. Call Aviation Bobcat Work. Free est. Institute of Maintenance 543-7743 (888)349-5387. SLearn to Operate a LATHAM CONCRETE Crane or Bull Dozer Robert Latham Heavy Equipment Train- Masonry, Contractor- ig. National Certifica- Lic./Ins. Since 1977 tion. Financial & Place- All types of Concrete ment Assistance. Georgia work. House slabs, School of Construction. Driveways, Additions. Use 3000 PSI mix used on code "FLCNH" or call every job. (866)218-2763. Also Bobcat work. -2 Free est. 682-0137 Cell 826-1672 Stamped Concrete Farm Direct Cool Deck & Exposed Centipede, St. Augustine, SAggregate. Slabs, Power Zoysia, Bermuda. -_ wing Remove, Re- We deliver & install. place & Repair Lic./Ins. Call 244-6651 Free est. 305-1258 Suncoast Sod Farms clIIBB UTES EAST ALONG CIVIL ACTION CASE Legal # 100416 THE NORTH LINE OF NO: 2007 CA005621 SAID SECTION 10 A S DIVISION: FILE IN THE CIRCUIT DISTANCE OF NUMBER: COURT OF THE FIRST 1634.45 FEET; F07053656 JUDICIAL CIRCUIT, IN THENCE SOUTH ANDFOR 883.96 FEET TO THE THE BANK OF NEW OKALOOSA POINT OF BEGINN- YORK AS INDENTURED COUNTY FLORIDA ING; THENCE EAST TRUSTEE FOR THE BEN- CASE NO: 576.00 FEET; THENCE EFIT OF THE CWABS, 2008-CP-001103 S NORTH 01 DEGREE INC ASSET-BACKED 49 MINUTES 59 SEC- NOtES SERIES IN RE: ESTATE OF ONDS EAST A DIS- 2007-SEA1, JAMES D. POGUE TANCE OF 125.00 Plaintiff, Deceased. FEET; THENCE WEST - 385.5 FEET TO A vs. NOTICE TO CREDI- POINT ON A CURVE TORS HAVING A RADIUS ROGER R. BRUNSON, et OF 233.10 FEET; al, The administration of the THENCE ALONG SAID Defendant(s). estate of James D. Pogue CURVE 72.29 FEET- deceased, whose date of THENCE SOUTH 66 NOTICE OF RESCHED- death was August 30, DEGREES 00 MIN- ULED FORECLOSURE 2008 File Number UTES WEST A DIS- SALE 2008-CP-001103 S, is TANCE OF 159.84 pending in the Circuit FEET TO THE POINT NOTICE IS HEREBY Court for Okaloosa OF BEGINNING BE- GIVEN pursuant to an County, Florida, Probate ING LOT 610 OF YEL- Order Reschedulin Fore- Division, the address of LOW RIVER VALLEY, closure Sale datedOcto- which is 101 James Lee AN UNRECORDED ber 2, 2008 and entered Boulevard East, Crest- SUBDIVISION. in Case No. view, Florida 32536. 2007-CA-005621 S if The names and ad- TOGETHER WITH A the Circuit Court of the dresses of the personal DOUBLE WIDE MOBILE FIRST Judicial Circuit in representative and the HOME IDENTIFICATION and for OKALOOSA personal representative's NUMBERS: County, Florida wherein attorney are set forth be- GAFLV75A67785CD21 THE BANK OF NEW low. and YORK AS INDENTURED GAFLV75B67785CD21( TRUSTEE FOR THE BEN- All creditors of the dece- 1998 CARRY 76') EFIT OF THE CWABS, dent and other persons INC ASSET-BACKED having claims or de- ORDERED at Okaloosa NOTES SERIES mands against County, Florida this 2 2007-SEA1, is the Plain- decedent's estate on day of October 2008, tiff and ROGER R. whom a copy of this no- BRUNSON; are the De- twice has been served must DON HOWARD fendants, I will sell to the file their claims with this AS Clerk, Circuit Court highest and best bidder court WITHIN THE Okaloosa County, for cash at IN FRONT OF LATER OF 3 MONTHS FLroida CLERK'S FRONT DOOR AFTER THE TIME OF By: Kitty Sims OF SHALIMAR ANNEX THE FIRST PUBLICA- Deputy Clerk at 11:00am, on the 3 TION OF THIS NO- day of November, 2008 TICE OR 30 DAYS AF- JASON R. MOULTON, the following described TER THE TIME OF Es property as set forth in SERVICE OF A COPY 660-A North Ferdon saiFinal Judgment: OF THIS NOTICE ON Boulevard THEM. Crestview, Florida BEGIN AT THE 32536 SOUTHWEST COR- All other creditors of the 850-689-1474 NER OF LOT 52, decedent and other per- Florida Bar No. BLOCK D, sons having claims or de- 0150126 CALHOUN'S SECOND mands against Attorney for Plaintiff REVISION, DESTIN, decedent's estate must FLORIDA, PROCEED file their claims with this 10/08/08 NORTH 50 DEGREES court WITHIN 3 10/15/08 21 MINUTES EAST MONTHS AFTER THE ALONG THE SOUTH DATE OF THE FIRST LINE OF LOT 52 PUBLICATION OF 100.00 FEET, THENCE THIS NOTICE. Legal # 100414 NORTH 39 DEGREES 39. MINUTES WEST ALL CLAIMS NOT IN THE CIRCUIT 120.00 FEET ALONG FILED WITHIN THE COURT OF THE FIRST THE EAST PROPERTY TIME PERIODS SET JUDICIAL CIRCUIT IN LINE, THENCE SOUTH FORTH IN SECTION AND FOR 50 DEGREES 21 MIN- 733.702 OF THE OKALOOSA UTES WEST 100.00 FLORIDA PROBATE COUNTY, FLORIDA FEET PARALLEL TO CODE WILL BE FOR- THE SOUTH LINE OF EVER BARRED. LOT 52, THENCE SOUTH 39 DEGREES NOTWITHSTANDING 39 MINUTES EAST THE TIME PERIODS 120.00 FEET ALONG SET FORTH ABOVE, THE WEST PROPERTY ANY CLAIM FILED LINE TO THE POINT TWO (2) YEARS OR OF BEGINNING. THIS MORE AFTER THE PROPERTY IS FUR- DECEDENT'S DATE OF THEIR DESCRIBED AS DEATH IS BARRED. BEING THE SOUTH- EAST 120.00 FEET OF The date of the first publi- LOT 52 CALHOUN'S cation of this notice is SECON6 REVISION October 15, 2008. AS RECORDED IN PLAT BOOK 2, PAGE GILLIS E. POWELL, JR. 43A OF THE PUBLIC FLORIDA BAR NO. WALKER LAWN RECORDS OF 183427 MAINTENANCE O K A L OO A POWELL POWELL & Mowing, Trimming, COUNTY, FLORIDA. POWELL Pruning, One time or POST OFFICE BOX 277 year round. Licensed A/K/A 314 CALHOUN CRESTVIEW, FLORIDA and insured. 537-4419 AVENUE, DESTIN, FL 32536 References Available 32541 850-682-2757 ATTORNEYS FOR PER- Any person claiming SONAL REPRESENTA- an interest in the TIVE A surplus from the sale, if any other SHARON SUE MOORE MIKE GOLLES than the property 53 PORT DIXIE BOULE- PAINTING owner as of the date VARD Interior, exterior, also of the Lis Pendens SHALIMAR, FLORIDA pressure washing. Li- must file a claim 32579 censed & Insured Free within sixty (60) P E R S O N A L estimates. Ph. 682-5347. days after the sale. REPRESENTATIVE Senior citizen discounts. WITNESS MY HAND 10/15/08 and the seal of this Court 10/22/08 on October 3, 2008. Don W. Howard- LEGAL # 120099 Rescreen windows & Clerk of the Circuit Court IN THE CIRCUIT doors or New Screen By: Beth McDonald COURT OF THE FIRST frames. Also patio Deputy Clerk JUDICIAL CIRCUIT IN rescreening or new AND FOR screen rooms by profes- IMPORTANT OKALOOSA signal call DIY Screen In accordance .with the COUNTY FLORIDA Co. 682-4445 Americans with Disabili- CIVIL ACTION CASE ties Act, persons with dis- NO.:46-2008-CA-00 abilities needing special 4383 DIVISION: FILE accommodation to partic- NO: F08059282 ipate in this proceeding should contact Court Aa- THE BANK OF NEW Fox Trot Tree Serv- ministration at 101 James YORK AS TRUSTEE ice, No job to large or Lee Boulevard East, Crest- FOR THE BENEFIT OF small. Free Estimates, view, FL, 32536-3515: THE CWABS INC. Firewood, oak & pecan telephone number ASSETBACKE6 CER- LIC/INS. Call Paul 850(689-5000, Exten- TIFICATES, SERIES 850-398-7677 sion 7497, prior to the 2007-1, din or Shalimar Plaintiff, OTHR0)651-S497 IMPORTANT vs. In accordance with the OSMIRA FENILLI TMetal Americans with Disabili- TOURELLE A/K/A TNT Metal ties Act, persons with dis- OSMIRA TOURELLE, Building, Inc. abilities needing special et al, R.V. & Boat covers, oa- accommodation to partic- Defendant(s). prices in town Ellin Parkway, Shalimar, TO OSMIRA FENILLI Galvanized Steel F 32579, telephone TOURELLE A/K/A Many sizes/colors number (850)651-,7497, OSMIRA TOURELLE Free delivery & setup. prior to the proceeding. LAST KNOWN AD- Single carport $595 DRsuont ESS: 734 LEGION Double only $695' 10/08/2008 IVESAPT76 DEST FL (850) 983-2294 10/15/2008 32541 6 DESTIN FL (850) 206-4008 _____________ 41_________ 00-8t ASK ABOUT OUR SUPERSOVER RATES! L A -i0oo 1110 1120 1125 S31 1130 1140 1150 1160 1170 Legal Ib COI JUD CO r COR STRU VELO Plaint 'R. JOHN JOYC and PRIN' Bhfer Do r 1 'Cx 10I I[I I CURRENT ADDRESS: of this Court at Florida, jBuildings For Salel UNKNOWN before service on Peti- "Beat Next Substantial In- ANY AND ALL UN- tioner or immediately crease" KNOWN PARTIES thereafter. If you fail 20x30x12 $5100. CLAIMING BY, to do so, a default 25x40x14 $7800. THROUGH UNDERmay be entered PETS & ANIALS 30x50x14 $9,500. AND AGAINST THE against you for the 35x56x16 $12900. HEREIN NAMED IN- relief demanded in 2100-Pets 40x60x16 $16990 DIVIDUAL DEFEND- the petition. 2110 Pets: Free to 50x140x19 46,900. ANT(S) WHO ARE Copies of all court docu- Good Home 60x100x18 $38,700. NOT KNOWN TO BE ments in this case, includ- 2120 Pet Supplies Others: Ends optional DEAD OR ALIVE, ing orders, are available 2130 Farm Animals/ (800)668-5422. WHETHER SAID UN- at the Clerk of the Circuit Supplies KNOWN PARTIES Court's office. You may 2140- Pets/Livestock Metal Roofing. Buy di- MAY CLAIM AN IN- review these documents Wanted rect from manufacturer. TEREST AS SPOUSE, upon request. 2150- Pet Memorials Over 20 colors in stock, HEIRS DEVISEES You must keep the several profiles to choose GRANTEES, OR Clerk of the Circuit from. Quick turnaround. OTHER CLAIMANTS Court's office notified Delivery available. LAST KNOWN AD- of your current ad- 2100 352 498-0778, DRESS: UNKNOWN dress. (You may file 888 393-0335. CURRENT ADDRESS: Notice of Current For Sale: Reg. CKC Chi- UNKNOWN Address, Florida Su- huahua puppies.Lon YOU ARE NOTIFIED that preme Court Ap- and short haired Call fIT!i an action to foreclose a proved Family Law 850-902-7275 mortgage on the follow- Form 12.915.) Future 3220 in property in papers in this aw- Lookin for a Registered A Brand Name Kin Pil- OlLOrSA County, su twill be mailed to Toy oodle for Stud. Ilowtop set. New inlas- Florida: the address on rec- 850-682-8815 tic w/warr. $200. Can LOT 6, LEGION VIL- ord at the Clerk's of- Deliver850-255-3050a LAGE TOWNHOMES fice. Deliver 8502553050 ACCORDING TO MAP WARNING: Rule PROFESSIONAL All Brand New Queen OR PLAT THEREOF AS 12.285 Florida Family Pillowtop Set. In plastic RECORDED IN PLAT Law Rules of Procedure, PET w/warrr. $165.Delivery BOOK 6 PAGE 81, requires certain auto- GROOMING available 850-255-3050 OF THE PUBUC REC- matic disclosure of docu- Certified pet groomer ORDS OF ments and information. in Cresview acc ptin Beautiful O K A L 00 S A Failure to comply can re- new clients. Cal85 Antique 4 iece COUNTY, FLORIDA suit in sanctions, includ- 398-3250 for appt. Bedroom has been filed against ing dismissal or striking _____ bedroom Suite you and you are required of pleadings. Early 20th century, dark to serve a copy of your Dated: 9-30-2008 awond with appivued written defenses, if any o Yorkies For sale hand carved wood de- or before November 12, Don W. Howard 2 females ruffly 3 years cor double size bed. 2008, on Florida Default CLERK OF THE CIRCUIT old, would like to keep $1250. Call (205) Law Group, P.LT-.COURT these sisters together in 602-1923 Plaintiff's attorney, whose By:Tiffany Gardner a loving home. $300 A address is 9119 Corpo- Deputy Clerk for the pair. Please call Bed A 100% all new Full rate Lake Drive, Suite 546-1185 for more de- size mattress set in plastic 300 Tampa, Florida 10/08/2008 tails. w/warranty. $119.00. 33634 and file the origi- 10/15/2008 850-255-3050 nal with this Court either 10/22/2008 before service on 10/29/2008 Plaintiff's attorney or im- mediately thereafter; oth- LEGAL #120095 323 erwise a default will be Baker entered against you for COMMUNITYAC- MULTI-FAMILY MOV- the relief demanded in TION PROGRAM ING & YARD SALE the Complaint or petition. COMMITTEE INC. Rain or Shinel Oct. 18, This notice shall be pub- 1380 NORTH Ii73 7:30Am 11:30Am listed once each week PALAFOX STREET I MERCHANDI 1628 Eunice Lane (of for two consecutive PENSACOLA, FLOR- CANHwy 4 in Milligan be- weeks in the Crestview IDA 32501 3100-Antiques hind Assembly of God News Bulletin. WITNESS 3110-Appliances church) Too much to list, my hand and the seal of Licensed Residential, 3120 Arts & Crafts something for eveyonel this Court on this 1 day General and Building 3130 -Auctions of October, 2008 Contractors interested in 3140 Baby Items Crestview being involved with the 3150 Building Supplies 2nd Huge Gar- Don W. Howard Community Action 3160- Business age/Movina Clerk of the Court Program's Weather- Equipment By: Kitty Sims izaton Program in 3170 Collectibles Sale As Deputy Clerk Okaloosa County for the 3180 Computers Fri. & Sat., 8am-3pm, 14 current fiscal ear ma 3190 Electronics Del Cerro Camino. Judge Florida Default Law ick u ification 3200 -Firewood Charles A. Wade & Mil- Group, P.L. P.O. Box jackets t th Elder Se 3220 Furniture lie. Furniture, glass ware, 2501 Tampa, Florida Offices of 3230- Garage/Yard Sales riding mower, trailer, 33622-5018 Okaloosa Countynorth 3240 Guns golf cart, generators, 33622-5018(north3250 Good Things to Eat nume tools, etc. IMPORTANT c ffic) benn 3260 Health & Fitness IMPORTANT h t October 13, 208. Mi- 3270 Jewelry/Clothing Crestview In accordance with the nority owned firms, and 3280 Machinery/ Garage Sale Americans with Disabili- women's enterprises are Equipment Garage Sale ties Act, persons with dis encouraged to aply. 3290- Medical Equipment Sat. Oct 18th, abilities needing special Completed application 3300 Miscellaneous 7am-11lam, 2414 Cum- accommodation to partic- packets must be returned 3310- Musical Instruments berland Wy, (off Lake Sil- ipate in this proceeding (0 the Elder Services of- 3320 Plants & Shrubs/ ver Rd.) Lots of name should contact Court Ad- fice no later than 12:00 Supplies brand clothes, costumes, ministration at 101 James P.M. on Monday Octo- 3330 Restaurant/Hotel all in 1 stroller, furniture Lee Boulevard East, Crest- ber 20 2008. Please 3340 Sporting Goods and much morel All view, FL, 32536-3515: rint "Attention: Agnes 3350 Tickets (Buy & Sell) priced to selllI telephone number Boering" on the packet Cresiview (8506)89-5000, Exten- envelope. The Elder Ser- T Garage Sale sion 7497, prior to the vices office is located at W Wg ale roceedina. or Shalimar 198 South Wilson Street, 3100 Sat. Oct. 1 8th, 850)651-7497 Crestview, Florida. 8am-1pm, 2917 Cres- All Types of Watch & cent Av.(off Valley Rd.) IMPORTANT 10/08/2008 Clock Repair, grandfa- Lots of new kids cloths, In accordance with the 10/15/2008 others, mantels, cuckoos, toys, other new cloths. Americans with Disabili- we buy antiques, Call Crestview ties Act, persons with dis- 689-1607 GARAGE SALE! abilities needing special At c 7 1 accommodation to partic- 2808ra1[Sat. Oct 18 7am-lpm ipate in this proceeding I 1110 2808 Mohican Way. should contact Court Ad-_Crestview ministration at 1250 N. Donate Your Vehicle C r1sHuge Inside Eglin Parkway, Shalimar, Receive $1000 Grocery Huge Inside Fn', 32579; telephone Coupon United Breast Ron's Appliance & Parts, Yard Sale number (850)651-7497, Cancer Foundation Free appliance repair, appli- 429 N prior to the proceeding. Mammograms, Breast ance parts 213 N. Main Hathaway St Cancer Info Street, call 689-1007. Ha f Twia Hills 10/08/2008 Free After hours 305-8515 Acrkoss from TinHills 10/15/2008 Towing, Tax Deductible, Park. 240-9678 Non-lunners Accepted, Crestview LEGAL # 120100 (888)468-5964. HUGE YARD SALE! LEGAL # 120100 Oct. 17 & 18 7AM-2PM Run your ad State- I 3130 2729 Paddock Cir (Silver ITE IR widely Run your classified Oaks) Antique Furn. IN THE CIRCUIT ad in over 100 Florida abalauction.com Cal- Large & Smarea rug, COURTOFTHE FIRS newspapers reaching houn CTYAltha, FL. 3 Sil floral, crafts, christ- JUDICIAL CIRCUIT, IN over 4 Million readers. BD 3.5 A on White mas items & collectible AND FOR Call this newspaper or Pond. On Line Bidding dolls OKALOOSA (8661742-1373 for more Nowl Live Auction Oct. COUNTY, FLORIDA details or visit: 16 850-510-2501. Crestview CASENO.: AB2387 Indoor Yard 2008-DR-5348-S DI- Sale VISION: FAMILY Auction-Antiques & Col- Sat Oct. 18th, 8am-?, JENNIFER RUTH M. lectibles, Furniture & Es 115 E. 3rd Ave.(blck JENNIFER RUTH M.tates Items. Pesco Auc- from Northwood). PINE, I 30 tions, Wildwood FL. Petitioner/Wife, Pregnant? Considering In-House/Live Online. Crestview and adoption? A married cou- Proxibid.com/pesco. INSIDE YARD SALE! ple, large extended fam- P ic s / I n f a : Oct. 16, 17 & 18, MAI IT IE y see toe dot. Finan PescoAuctions.com 7AM-2PM 397 S. Brett Resonent/Husban call secure. expenses AB2164 AU2959 St. Clothes, what-nots etc. paid. Call Karen & (748-0788 Crestview NOTICE OF ACTION Kevin. ask for .m MULTI-FAMILYYARD FOR DISSOLUTION chelle/adaml. (8001 Major Land Auctions sALE! OF MARRIAGE 790-5260. FL Bar# 27,212+/- Acres in mdi- Oct. 18 7AM-? 603 N. 0150789 ana & Kentucky Man- Pearl (Behind Cresiview rM ario ito Pine 7 ,000, 00+ D Ft. Mano e USawtimber World-class Crestview YOU ARE NOTIFIED that hunting Over 4 miles of NEIGHBORHOOD an action has been filed 1150 Ohio River frontage Pas- YARD SALEI aains yo n -white ture & tillable land. Sold Oct. 18 7-Noon 5843 against you and that you Single white male 70 in 191 Tracts 3 Day Antler Way (O1f Old are required to serve a 5'8 1701bs. Looking for Event: November 6,7,8 Bethel) copy of your written de- a slender white lady Woltz & Schrader Real senses, if any, to it on Ste- 65-72. I am easy going9 Estate Auctions. For Cresiview voen D Miller, PA., and easy to please. Just more information, call SILVER OAKS whose address is 817 S. need a good woman to (800(551-3588 or on SUBDIVISION University Drive, 122, share andl do things to- the web at Y SLS Plantation, Florida either. Please write RLB YARD SALES! 33324 on or before P Boxl876,iCre JamesWoltz Sat. Oct. 18 Off Nov. 11, 2008, an file view FL 32536, or call IN#AU 10600094 Old Bethel Rd mile W. the original with the lerk (850) 689-8038 KY#RP 2042. of Davidson MS B8 I Crestview News Bulletin CLASSIFIED WEDNESDAY, OCTOBER 15, 2008 3230 4130 Crestview Driver: Don't Just Start Yard Sale Your Career Start It Rightl Oct. 18th 7am-1lm Company Sponsored Dixie Electric 295 CDL training in 3 weeks. GoodwinEAve. Must be 21. Have CDL? __________ Tuition reimbursement! Crestview CRST. (866)917-2778. Yard Sale Drivers. Immediate Sat. Oct. 11, 8am-?, 906 Openings. Fast Growing N. Lloyd St. Plus size Specialized Car Haul women s clothes, toys, Div. 21 days out 7 days misc. home. Top Payl Free Co. Benefits. Min. exp 1 yr. Crestview CDL-A req. Min age 23 YARD SALE! no felony. Call John @ Oct. 18, 7AM-Noon, Waqgoners Trucking 166 Cabana Way (912) 571-9668 RidgeCrest Estates)(9Y) ar ed w/mattress baby Drivers: Act Now Sign- & Toddler clothing, On Bonus 35-41 cpm household decor & more. Earn over $1000 weekly Excellent Benefits Crestview Need CDL-A & 3 mos re- YARD SALE! cent OTR Oct. 18, Sat 7AM-12, (877)258-8782 5909 Pineforest Rd. (0f Airport Rd) Need a career??? Be- come a Nationally Certi- TUPPERWARE fied Heatin8/AC Tech. New Catalog, monthly credite3.wk. Nationally Ac special replacement or- creditedprogam. Get 2er. C0all Jackie EPA/OSHA NCCER 682-4305 Certified. Local job place- ment. Financing Availa- ble (877)994- 9904 Post Office Now Hir- 3250 ing Avg Pay $20/hr or $57K/yr Including Fed- Jumbo Green & eral Benefits and OT. boiled peanuts. Holland Placed by adSource, not Farms 1-877-675-6876 affiliated. w/USPS who hires. Call (866)713-4492. Feeling Anxious About NEW IAV The Future? Buy and read Dianetics by L. Ron Hub- Quality Assurance/Safety bard. Price: $20.00. Or- der Now. Free Shipping. Mystery Mystery or Call (813)872-0722. Shoppers --Earn up to $150 per (day. Undercover shop- ers needed to judge re- 0 Fai l and dining estab- 3 0 lishments. Experience not Attend College Online required. Pease call from Home. 'Medical 1-877-664-5368 *Business *Paralegal' Web ID #27821849 *Computers, *Criminal. Justice. Job place ent as-. .. distance. Computer avail- able. Financial Aid if % qualified. Call '. (866)858-2121, J Crestview Elks Lodge Turkey Shoot begins on ....... September 20 9:00 BUSINESS & FINANCIAL am, and each Saturday I I Excellent Prizes. Hw' 5100- Business 90E to Fairchild Rd. F- Opportunities lowSigns. 5110- Money to Lend Needed Babysitter im- mediatey in Crestview - $700. wk must love kids o5100 Call 678-318-3650 $1,000 A Day Possible Now Available! 2008 Returning Phone Calls No Post Office Jobs. Selling, Not MLM $18-$20/Hr. No Experi- ( ( ) 4 7 9 8 0 3 3 ence, Paid Training, Fed. Benefits, Vacations. Call [800)910-9941 Todayl A Groundfloor REF #FL08. Opportunity Maxegen is looking for N W llAV hardxworkinh, dedicat- f IUIi'1* ed individuals that enjoy Network / Marketiny Call (641 715 390& Sew & Save asscode 03591# to Open Fri 10-5, Sat 10-2 find out more about this Lots of 100% Cotton Tr- opportu y If you like cot, Velour Chmbray wIhat you ear go to: etc. Call 682-3443 sit my maxegen.com 1416 ^ 1maxegen@hotmail.com --3340 All Cash Candy Route Do you earn $800 in a ..,=>* T f ~day? 30 Local Machines NEW i l UUN and Candy $9,995. -- 888(629-9968 Franchi imported by B02000033. Call Us: Benbenelli made in Italy We will not be 12 gage rib barrel 3 undersoldl inch chamber, 3 chokes financial Freedom for wood stock. $650. ca you. $1.000/da return- 826-0904 ing phone ca Is. Not MEM. No buying or sell- Pool Table ing products. Legal, Very good condition. moral and ethical. Asking $175. Call 850 682-3535 for more info. biqmoney -(888)276-8596. .' Generate Extra Income in as little as 48 hours - up to $3,500/wk or more. No selling No MLM. Call: S- 800)659-7781 or visit: goodlife I MPLYENT Guaranteed Weekly 4100- Help Wanted Settlement Check. Join 4110- Restaurants/Clubs Wil-Trans Lease Operator 4120- Sales Program. Get the Benefits 4130 Employment of Being a Lease Information Operator without any of F_ the Risk. (66) E 1906-2982. Must be 3 4'100 Own a Recession Proof Business Established ac- Drivers counts with the average owner earning over Drivers needed with $200K a year call 24/7 Class B or better license. (866)622-8892 Code X No phone calls apply in - person at 984 W. James .- - Lee Blvd., Crestview Qr- Education , Now accepting applica- tions for employment at Learning Tree Day School, Inc., 201 Valley Road. Must be at least 18 years of age. Apply in person only. Logistics/Transportation Driver Trainees Needed No CDL? No Problem Earn up to $900wk. Home week- ends w/TMC. Company endorsed CDL Training. 1-866-280-5309 NEW TODA Medical/Health Medical Asst. FT or PT, for internal med- icine practice in Crest- view. Hrs: 8am-7pm Mon-Thurs Exp. pre- ferred. Call 682-6143. Web ID #27831075 TODAY Commercial building re- cently completely remod- eled approx. 3000 sf. $2200. mo on S. Main St. Call 598-0478 or 682-6794 Commercial office space for Lease 828 N. Ferdon 4130--__ alvd. O682-2735 Crestview For lease A Phat JobI Now Hir- Commercial Space 798- ing 18-24 Sharp Enthu- A&B S. Main St. siastic Motivated Guys & 682-2735 Girls Free To Travel USA Representing 150+ Lead- For Lease Main Street in Publications. 2 location. 201 N. Main Weeks Paid Training, St. Call 682-2735 Transportation Provided. Return Trip Guaranteed. For Lease, Newly Re- Call Tina or Jim modeled Commercial (800)642-6147. Space 176-178 5. Indus- ___ trial Drive, 682-2735 Driver Company Driv- ers CDL-A Earn up to 46cpm. Excellent trains for students w/CDL. No NEW TO forced Northeast. Aver- aqe 2,500 to 2,800 Office building approx. miles/week. 1900sf. located on S. (877)740-6262. Main St. $1900. mo call. 598-0478 or 682-6794 6110 [ 6140 |1 6140 6140 7100 7100 aFreRen Crestview- 2BR/1BA Crest mo Free Rent! CsH&A $475. mo + dd AV WHY RENT??? 1933sf 3/2/2 from tew 2b ba Cal8658921ENew Site Built Homes $159,900. Great Room, $57mo/ $50dep, 12 --from the $100's, Low Built on your lot. Other mo lease req. 585-6985 Crestview 3BR/1BA Crestview Rentals: Interest Rat0es homes F rom the l ow $600. mo $400. dd. *4hr 2ba InJch St $950 800- 678-4647 $100s. Great Financing. MNavarr NEW T0oDAY Crestview- 2 br, 1 ba, $600/mo + $600 dep. no pets, newly renovated 398.5757 or 420-1517 Crestview Inn Motel $35d $165 wk, APT $190 Wk. $575 4 wk Call 6824466 Furnished 1 BR for ma- ture person, no smoking or pets. Utilities furnished $550. Call 689-1318 | 6130 | NEW r1"AY I Crestview 3 br, 2.5ba TH- near shopping W/D hkup. $775 mo. Pet neq. Military Disc. 897-0267 6140 3BR/2BA Foreclosurel $12,6001 Only $199/ Mol 5% down 20 years @ 8% apr. Buy, 4/BR $259/Mol For listings (800 366-9783 Ext Century 21 Moulton Realty 682-3849 Rentals: 107 & 121 Swaying Pine, 3br, 2.5ba $850 mo + $600 dd 6117 Magnolia 3br, 2ba $775mo+dd 4758 Balboa 4br, 2ba$10000mo+dd 143 Lonnie Jack 3 br, 2ba $880mo+dd 309 John Kin Rd 3 br, 3 ba, $750+dd 4638 Falcon Way 3 br 2 ba $800mo+dd 5474 Haburn St. 3br 2ba, $900 5219 Griffith Mill Rd 2 br, 1 ba, $475+dd *513 WingSpan Way 3br, 2/2ba $775+dd S125 Mill Pond Cove 4br, 2 1/2 ba, $1000 Coldwell Banker United Realtors 117 Courthouse Terrace, Crestview Fl 32536 (850) 689-i515 or (850) 682-5922-EHO *307 Walnut Ave, Ibr, 1 ba 700sf $425 triplex * 365 Walnut Ave 2br 1ba, 900sf, $500 end unit * 309 Walnut Ave. 2br l ba 900sf, $500 end unit 228 Runnymeade Dr. 2br, 1.5ba 930sf $575 Interior Unit townhouse * 230 Runnymeade Dr 2br 1.5ba 930sf $575 End Unit Townhouse @ 238 Runnymeade Dr. 2br, 1.5ba, 930sf, $575, Interior Unit Townhouse * 130 Patton St 2br, tba 900sf $625 no pets al- lowed * 418 Brown PI 2br 1ba 1066sf $650-S -o 1-10 * 6106 Magnolia Lane - 3br, 1.5ba 1026sf $695- 1 st months rent free * 8146 8th Ave 3br,2ba 1355sf $750- Laurel Hill * 118 Campbell Dr 3br, 2ba 1207sf $795 pets with approval * 152Sawying Pines CT 3br 2.5 ba 309sf - $800 End Unit * 747 Majestic Dr 3br2.Sba 1424sf - $825 1 months free rent - South of 1-10 * 5720 Reinke Dr 3br, 2ba 1253sf $850 pets w/ approval 0 50 Abbey Rd 3br, 2ba 1165sf $850 1 months rent free to military *2904 Orchidcrest Dr. 4br, 2ba, 1600sf, $875 1/2 months free rent * 238 Tiffot Ct 3br,2ba 1620sf $895 1st month's rent free * 4713 Connor Dr 4br, 2be 1748sf. $895 - South of 1-10 free months rent to Military * 324 Lakeview Dr 3br, 2ba 1088sf, $900 A) appliances included * 118 Palmetto Dr. 4br, 2ba 1927sf $900 - Fenced in Backyard * 4815 Summer Creek Cove 4br, 2ba 1794sf $995 privacy fenced backyard S2834 Atoka Trail 4br, 2ba 1953sf. $995 1 months rent free to mili- tary * 507 White Oak Lane $br, 2ba 1850sf $995 - First Months Rent Free * 5121 Whitehurst lane 4br, 2ba 1836sf $1000 - all appliances included * 2140 Hagood Loop 4br 2.5ba 2254sf, $1025 split bedroom floor plan *1235 Gabrielle Dr. 3br 2ba, 1758sf, $1125 large fenced back yard * 248 Limestone Cir 3br,4ba 1866sf $1200- no pets allowed S4180 Big Buck Trail, 4br 2ba, 1823sf, $1215 no pets allowed * 228 Riverchase Blvd 4br,2ba 2555sf. $1300 1 st months rent free * 301 Sunesta CT 4br, ba 2547 sf $1300 100/o military discount or V2 Month s Rent free to Mili- tary * 435 Hatchee Dr 4 br, 2 ba, 2250sf, $1300, all appliances included. *5262 Clint Mason Rd. 3br, 2.5ba 1878sf $1400 pets allowed w/ approval. For further information and to apply online, please visit our website at: 462 Savage St. call A682-3931 3b 2b KD *3/r gEd a'ewnood 5td606 800- 678- 4647 Rick Epperson really LLC NEW TOAYV 850-8657777 616 NEW _-jA MIIV aBfl -- -_ ~ DNfW TB fh Affordable Homes: * 3 br, 1 ba 1264sf fenced yard, like new $118,000 S3 br, 1 ba like new $90,000 / Rick Epperson Realty LLC 850-8 65-7777 Crestview Small 2BR house 197 Hathaway St. NEYW ]uuIr 3br 2ba, brick house $450mo includes all utili- ties/ cable. Call 689-8978 I 6170 ] DAY Bank Ordered: Land NEW Auction 2000+ Proper- NOW T -Aties. Land in 29 States. No Reserves. Multiple Lot 3BR/2BA on 3122 Au- Packs. Min Bids at burn Rd. Large yard, no $1000. Bid Online at: ets $575. mo & LandAuctionBid.com/2 $400.dd call 546-1960 $375.mo call 682-5019 Crestview, 2 br, 1 ba, -CH&A section 8 ap- Crestview roved 740 Dixie Street, 5Crestview 565m0, $500 dd. 2/1 Duplex 683-892or 865-9368 New. carpet / freshly painted, $600 mo, $600resview, FL DD, pets ok with addi- restew, FL tional deposit, 682-7731 Beautiful Mon-Fri Crestview -Home For Rent Crestview Great Neighborhood, 3/1 Duplex close to eve thing, 3/lr Duplex large yard, 2300 sf un- New carpet / freshly furnished 4 BR, 2.5BA painted, $700 mo$700 2 car garae. Call D, pets OK with addi- 850-259-1560. tonal deposit, 682-7731_ Mon-Fri Crestview: Near Anti- och Elementary. S of 1-10 3BR,2BA,2CG $795 ma NEW TrDAY + dp. 850-562-9340 For rent Crestview & Crestview- 3bd 2b Holt area. Several to Crestview- 3a b choose from. Range 3376 Polly Ln. Brick, no 600 $1000 call eare pets, X Large Scott 546-1192 fenced yard $700. mo + __ $700. Dep. 642-2121 FWB- 3br, 2 ba Newer --construction house w/ Crestview- 3br 2ba fenced ard available for 1cg 1100sf. Custom up- lease Oct. 1st. Great lo- Sraded home. W/D inc cation to both bases. r825 mo close to schools Terms negotiable. $1200 shopping. Section 8 mo. Cal1850 699-2189 ap roved. Call 850 642-1612 or 642-1642 Janet Johnson _2----Realty, Inc. Eual Housing NEW TODAY ( 1 0 I REAL ESTATE FOR SALE Crestview 3bd 2 ba Brick home on 2 lots 1500 SF. Lots of upgrades. Valley rd. $172,000. OBO call Mike 836-4675 or Sharon 333-0876. -Just FWB Kenwood Subdivision Beautiful brick 3 br, 2 ba, 2 cg. Located close to bases on quiet half acre corner lot. Built in 1994, kitchen recently updated with stainless steel appliances, corner FP wall brick hearth, vaulted ceilings, fresh paint, security system, updated electronic irri- gation, large screened porch under roof, chain ink back yard perfect for pets. $299,000. Call 50 226-674 FWB Kenwood Subdivision Beautiful brick 3 br, 2 ba, 2 cg. Located close to bases on quiet half acre corner lot. Built in 1994, kitchen recently updated with stainless steel alliances, corner FP w/all brick hearth, vaulted ceilings, fresh paint, security system, updated electronic irri- gation, large screened orch under roof, chain link back yard perfect for ets. $2 000. Call 50 22 66754 Home Auction Venice, FL 18+ Homes Must Be NEW TODAY Crestview 2BR/1BA no pets, Call for info 682-6129 NEW TODAY Crestview- (2) 2 br MH's $450 -550/mo +dd. No pets. 682-8867 leave message Creslview 2 br. 1 ba. $425. mo. $425. DD water & sew- age provided Located on E. Chestnut @ Crestview Mobile Home Park. Call 305-0776 or 398-6246 Crestview- MH, 3brlba $575 $500dd 3 bd2 ba. private lot $595 mo, $5 dd. 217-2756 or 362-9845 Crestview Newly Re- modeled 2br, 1 ba, $450mo. Quiet park. No pets. Military & seniors welcome. 850-585-8192 For rent Crestview & Holt area. Several to choose from. Range $600- $1000. call Scott 546-1192 NEW TODAY Holt & Baker Centrally Located Singlewide MH 3 br 2 ba on a 1 acre private lot in quiet neih- borhood. No pets Re- cently upgraded $550dep $550mo. Also 3bd 2ba Newly remod- eled w/ upgrades on 1/2 acre private ot. $450 mo+ $450dd No pets References re- quired 537-6428 Baker * 5804 Buck Ward Rd - 3 br, 2 ba; $900 * 1112 CountryLiving Rd 3 br, 2 ba; $950 Crestview * 3089 Cosson Circle - 3 br, 2ba; $600 * 602 Henderson St 2 br 1 ba; $625 * 26 Virginia St- 2 br 1.5 Ba; $625 * 190-A Farmer St - 2 br 1 ba $675 * 202 Virginia St - 2 br 1.5 ba; $700 S6618 Sand HillRd- 3 br 1 ba; $725 * 315 Brackin St- 3 br, 1 ba; $725 * 206 Vir inia St * 167Corwin Dr- 2 br, 2.5ba; $750 S592 Opportunity Dr - 3br, 2 ba $795 * 329 John King Rd- 3 br, 2 b $795 * 106 Corwin Dr- 2 br 2.5 b; $800 * 134 Swaying Pine Ct - 3 br, 2.5 ba; $825 0 5682 Reinke Dr- 4 br, 3 ba, $900 S41 Juni per Dr 3 br 2 ba; $995 0 1R46 Pearl St N- 3 br, 2 ba; $1000 * 5442 E Brook Dr - 4br 2 ba; $1200 * 6317 Havenmist Ln - 4br, 2ba $1250 * 2704 ARshey Maria Ct 3 br, 2 ba; $1250 Laurel Hill 0 3650 Okaloo Ln - 6 br 3 ba; $900 NEW TODAY Teel & Waters Real Estate RENTALS 204 Booker St. 500, 2 br, 1 ba S23 Lustan Dr, $1000 4br, 2 ba, 2 cg S of 1-10 * 391 Riverchase Blvd $1150, 4 br, 2 ba, 2 cg, No pets S n139 Stephens Lane, $850 3br 2ba, 1 AC S1524 Log Needle Ct, 1000, 3, o 2, no pets 4- Commercial 290 Main Street $1500 All Properties require a credit check, 1 yr lease, no inside smoking. Pet fees are non- refund ble. Call Debra Frost 682-6156 position Inside Sales & Telemarketing Manufacturer's Rep Automotive Sales jl-as M naiper Marketing Mjirkeiingj M.r,3.,.e, Go to CoastJobsWest.com or call us at 866-374-1549 and use Job Code 39 to complete your job seeker profile Sold! Up to 3BD/3BTH Starting bids as low as $99K Prev Valued up to $482K Low Down/E-Z Fi- nance Free Brochure (800)61 7-01 1 2 REDC. LOOK Individual wants to bu house for investment. Call 651-0987 t.h.r [he rfoll.:'..'irgq p,:, r,,:rli Sales Associate Stock Person 1 .1." r.:h ]-,', l : r Management Go to CoastJobsWest.com or call us at 866-374-1549 and use Job Code 38 to complete your job seeker profile Sinonster A service of the NW Florida Daily News Move-hiRO Crestview- Beautiful brick 3 br, 2 ba, arage, W/D, incl. $875mo + dd. Call 699-3833 Crestview- Countryview 4 br 2 ba built in 2004. ONLY $900mol Call Jenny at Pelican Real Es- tate 315-0972 SMatch posilions Building General I Job Code 51) utildra Profesiornal 0ib Code 401 Construction (Job Code 471 M Iriuliouririg S Job Cod 411 Go to CoastJobsWest.com or call us at 866-374-1549 and use Job Code listed above to complete your job seeker profile 4*.iwa monster ......o .... A service of the crestview News Bulletin EHEV - i llionlster A service of the Crestview News Bulletin wrreg 1 acre on Wilkerson Bluff Rd. $18,000. Firm call 603-0681 NEW lOWAY Crestview- 2.5 acres, 94 Dodge Intrepid AT, asking $48,500 Off Pov- ver clean, runs great erty Creek Road. $200. OBO call 850-375-2351 603-0681 NEW rOAY 1NEW9 rAY HUNTERS 1990 Chevy Corsica 3.1 HUNTERS! en ineA/CCnew front Great land for hunting In aes good tires aski fact, enoy he bounty $906 OBO c year round! Call for the 682-0871 or 902-0987 great land locations,_-. .... some with nice homes, ponds, and lakes! 1 ACRE LOT I 8120 in nice subdivision o. away from the hustle and Jeep Rubicon bustle, yet so convenient.. 2006 6 speed manual, 29K mi, 3 Wooded Acres ext war, CD changer, sat- 5 minutes from town. elite radio, white w/ blk Will make three 1 acre soft top (619) 204-1406 homesites or enjoy a home on all threelny COMMERCIAL I aSo- 3+ acres near hospital. Seller will divide as small - as half acre. Mildred C. Heaton Chrysler Realty, Inc. Family Van 850-689-1334 Price reduced Must 850-582-3806 make room in garage for o85u0-58o-,0 oU wife's new car. Her former car is a 2000 Chrysler Town & Country _,S _, minivan. Top of the line. 7iS1 9 i Leather. Chrome wheels. 1 owner (non-smoker). ***Free Foreclosure List- Garage kept. Only 80K ings*** Over 200,000 miles. $6995. Call properties nationwide. 651-0164 or 699-3444 Low Down Payment. Call Nowl (800(817-5434'. 5 4 3 NC Mountains 2+ ac- also res with great view, very private, Big trees, water- 2005 VTX 1800C falls & large public lake Honda motorcycle for nearby, $49500 call sale. $8500. Call now (866)789'8535. 689-2252 I- For Rent Don't miss your opportunity to live in a Brand New Touchstone Energy Efficient Beautiful Quality Built Single Family Home. Close to Crestview and Eglin AFB. Homes include 3 & 4 bedrooms, 2 baths and 1 & 2 car garage, kitchen (with self-cleaning oven, stove, dishwasher & microwave/hood), patio, central heat and air, carpeting and ceiling fans. Come in and sign a 12 month lease and receive $100 OFF your 1st month's rent. Rent starting at $885.00 per month. Call today (850) 689-2221 Offer expires 10/10/08 James Chessher For friendly service and exceptional deals, stop by and talk with James about the new or used vehicle you've been dreaming of. -- AN AMERIC RmVOILiON SW rd Your Sl/verado Headquarters Locally Owned & Operated CHEVROLET 4150 S. Ferdon Blvd., Crestview 682-2731 Recycle Today I S 7190o Steal My Marshfront Owner sacrificell! Drop dead gorgeous Marshfront. My neighbor paid $389,900. I'ii sell mine for less than the bank repo's. My six fig- ure loss is your gain. $229 900. Call: (888)306-4734 Tennessee Land Rushi 1+acre to 2acre home- sites, wood views. Start- ing at $59,900. Tenn River & Nick-a-Jack view tracts now available Re- tirement guide rates this area #2 is U.S. places to retire. Low cost of living, no impact fee. 3301699-2741 or 866 550-5263, Ask About Mini VacationI (- AUTOMOTIVE, MARIN RECREATIONAL I! Call 515-5004 2 story, 4 br, 2/2 bo, 2150sf home on large separate living & dining rooms, eat-jn kitchen. Lg. whirlpool tub and separate shower in mas- ter bath. Beautiful, quiet waterfront neighborhood. Priced to sell at the re- duced price of $260K.. Call 850 261-0322, or 685-8048 leave msg. Quick Pre-Qual! You can pre-qualify in 15 minutes. Great homes from the $100s on your lot. 800-678-4647 Rent to Own Crestview- No credit, no Problem Owner financed. 3/1. 1540sf $680 mo. (includes taxes & insur- ance) w/ $3000 down. 537-9798 7140 Looking to rent: Pro- fessionaT Retail Man- ager moving to Crest- view area with Nation- ally recognized com- pany seeks small farm or home with Acreage for rent or possible lease option. Must have fenced pasture for 2 horses. Please call 850-544-9173. Leave message. NEW TO9AY Contact Us | Permissions | Preferences | Technical Aspects | Statistics | Internal | Privacy Policy © 2004 - 2010 University of Florida George A. Smathers Libraries.All rights reserved. Acceptable Use, Copyright, and Disclaimer Statement Last updated October 10, 2010 - - mvs
http://ufdc.ufl.edu/UF00028411/00351
CC-MAIN-2017-34
refinedweb
26,062
73.17
- Announcements November GameDev Challenge: Pong! 11/01/17 - This stream auto-updates - Past hour A good way to avoid extermination in RTS? Nypyren replied to Michael Aganier's topic in Game Design and TheoryMost competetive RTSes end in "gg" and one team surrendering rather than playing until every single building is dead. That's the gaming equivalent of this. Whether this happens for an entire match (ala StarCraft) or if there is a higher level 'campaign' or 'war' layer wrapped on top of it doesn't matter. A good way to avoid extermination in RTS? kburkhart84 replied to Michael Aganier's topic in Game Design and TheoryI see a contradiction here. It seems you want to "win" the battle once the enemy has lost 5-10% of the troops, but yet they keep coming back, so you have to fight 10-20 battles to exterminate them........so which one is it. Do you want the win to happen at 5-10%, or do you want to have to exterminate them? In the real world(theoretically), once a good number of troops are lost, the leaders make peace in order to not lose more(although we can leave out the whole guerilla war stuff for this topic). That means that one side won the war. So you don't have to do those other 10-20 battles to exterminate them. Maybe I'm missing something here, but if you are creating the game yourself, then you should be able to make it however you want. If you don't want all those battles, then consider it a victory sooner. If you want 100% extermination sooner, allow more troops into the battle. Rigging and Animating kburkhart84 replied to G-Dot's topic in 2D and 3D ArtI don't use 3dsmax so I'm not sure how to bake constraints. In Blender, it is generally automatic. You set things up and make keyframes, and the constraints help you make the animations. The constraints are just there as you are making keyframes and moving bones around. It may work the same way in 3dsmax. FYI, for your first animation, you may want something simpler. I'm thinking something without pistons. Even a humanoid could be simpler because humanoids are generally only going to require bone rotations(like the human body) to make animations, so you could learn and practice the basics. Then, once you know more, you can get more into using constraints and things like that. - Today Cant find how to do this asm code in c++... h8CplusplusGuru replied to Vortez's topic in For BeginnersIt's a scratch function that should do the assembly but in c++, one way through assignment other through memcpy, and such that the value of r gets changed to f each time. Or I Think that's what's going on! Cant find how to do this asm code in c++... Oberon_Command replied to Vortez's topic in For BeginnersWhat is this function trying to accomplish, exactly? edit: Never mind, read the comment above it. - - - Yesterday WINAPI Mouse movement diff via WinAPI ongamex92 posted a topic in General and Gameplay ProgrammingHi all, I want to obtain the mouse movement win WINAPI. Basically if the cursor is on the left side of the screen and I move the mouse left, I want to sill get a -x value. I know that this was possible with DirectInput, but I cannot find a WinAPI equivalent. Is there any? Sprite based FPS like old Doom, but with HD photographs ferrous replied to Can T's topic in Game Design and TheoryYou can't light a detailed model of a billboard, so you're not going to get "the benefit of all modern computer graphics advancements". Maybe you could fake it with some sort of normal map texture? You also aren't taking into account all the different facings that need to be rendered out, and animated. Which is why most sprites in Doom tend to have so few frames of animation, because it needs to be done per facing. IE Monster walking towards the player, monster walking away from the player, monster walking NE, SE, S, SW, etc -- except 8 cardinal directions is way too few, need at least 16 if not 32 to make look not awful as it turns. The other issue is that highly detailed textures tend to look bad at a distance, that could be mitigated with design choices and maybe custom Mipmaps, not sure. As long as you're okay with it not looking photo realistic, and making a stylistic choice, I think it could be fine. You could try mocking it up in something like Unity or Unreal, for unity it would be a matter of making a plane that always faces the player and sticking a large texture on it. _. What do you think can help stop cheating in PUBG Hodgman replied to Cold.bo's topic in General and Gameplay ProgrammingWhy can't it be? What are you basing that on? It sounds like you're just repeating things that you've heard rather than basing this on development experience? It's currently lagging because they don't have a dedicated server, so you're relying on other players on vastly different connections to share game-state instead of having a single reliable connection to a data centre. If 100 players all simultaneously fire a 600RPM rifle at a target that's 3km away, then after three seconds there will be 3000 projectiles in the air. If the server ticks at 20Hz it needs a ray-tracer capable of 60K rays/s, which isn't much - it would only consume a tiny fraction of the server's CPU budget. If every bullet needs to be seen by every client (e.g. To draw tracers) then this would cause a burst of about 72kbit/s in bandwidth, which is fine for anyone on DSL, and a 7mbit/s burst on the server, which is fine for a machine in a gigabit data centre. None of this impacts latency because that's not how that works... And if not every bullet has visible tracers then these numbers go down drastically. [edit] I quickly googled and apparently PUBG does already run on dedicated servers in data centres? Maybe they still do client side hit detection for some reason though... - - Ville Pakarinen joined the community A good way to avoid extermination in RTS? ferrous replied to Michael Aganier's topic in Game Design and TheoryThat uh, isn't true at all. Especially that last bit, "That army that used to fight you is now your army". It's more like, that army that used to fight you in official battles will now fight a long, grueling guerrilla war against you. It takes a long time to unify people, and standing armies have to remain behind to put down rebellions, etc. Look at the Iraq War and occupation thereof. Or Napoleon's invasion of Egypt. How to Detect if I have touched the correct alphabet Mike2343 replied to sidbhati32's topic in For BeginnersYou can place the code in properly formatted blocks instead of spamming the post by using the <> (code) option. Cant find how to do this asm code in c++... h8CplusplusGuru replied to Vortez's topic in For Beginnersbool SetProcAddress(void* p) { void *r = p; // <--- Used for debugging (if *r change to the value of f in the watch, it mean it work) ULONG func=0; void *f = &func;// std::cout << " f = &func = " << (ULONG)f; /* #ifdef USE_ASM // This work... _asm { push eax push ebx mov eax, f mov ebx, p mov [ebx], eax // <--- put eax at the address pointed by ebx pop ebx pop eax } #endif */ #ifdef USE_INTEGERS ULONG* r1 = (ULONG*)r; ULONG address = (ULONG)f; void* p1 = p; *(ULONG*)p1 = address; //cast on left std::cout << "; " << *r1 << ", " << address << std::endl; #endif #ifdef USE_MEMCPY // this give save as above ULONG* r2 = (ULONG*)r; void* dest = p; void* source = f; memcpy( (void*)(*(ULONG*)dest), source, sizeof(dest) ); #endif std::cout << "*r2= " << *r2 << ", " << (ULONG)source << std::endl; return p1 == (void*)r1 && dest == (void*)r2; } So if this is correct, it turns out you need to do a lot of casting mayhem. - Atwo Studios started following Football Dash now on iOS (1 million downloads) Football Dash now on iOS (1 million downloads) Atwo Studios replied to Brian Paek's topic in Indie ShowcaseHey Brian, Great looking game here, congratulations on getting over 1 million downloads! Did you make this game in unity? or another game engine? Was it just you making this game or did you have a team, if it was just you, very nice job on the game! That's very impressive! - Anthony - - tamikabreedlov joined the community 3D Bouding Box Position problem pristondev replied to pristondev's topic in Graphics and GPU ProgrammingSolved. - thecheeselover started following Low poly terrain and Marching cubes Marching cubes thecheeselover posted a blog entry in 3D, AI, procedural generation and black jackI have had difficulties recently with the Marching Cubes algorithm, mainly because the principal source of information on the subject was kinda vague and incomplete to me. I need a lot of precision to understand something complicated Anyhow, after a lot of struggles, I have been able to code in Java a less hardcoded program than the given source because who doesn't like the cuteness of Java compared to the mean looking C++? Oh and by hardcoding, I mean something like this : cubeindex = 0; if (grid.val[0] < isolevel) cubeindex |= 1; if (grid.val[1] < isolevel) cubeindex |= 2; if (grid.val[2] < isolevel) cubeindex |= 4; if (grid.val[3] < isolevel) cubeindex |= 8; if (grid.val[4] < isolevel) cubeindex |= 16; if (grid.val[5] < isolevel) cubeindex |= 32; if (grid.val[6] < isolevel) cubeindex |= 64; if (grid.val[7] < isolevel) cubeindex |= 128; By no mean I am saying that my code is better or more performant. It's actually ugly. However, I absolutely loathe hardcoding. Here's the result with a scalar field generated using the coherent noise library joise : Low poly terrain thecheeselover posted a blog entry in 3D, AI, procedural generation and black jackRecently I've been tackling with more organic low poly terrains. The default way of creating indices for a 3D geometry is the following (credits) : A way to create simple differences that makes the geometry slightly more complicated and thus more organic is to vertically swap the indices of each adjacent quad. In other words, each adjacent quad to a centered quad is its vertical mirror. Finally, by not sharing the vertices and hence by creating two triangles per quad, this is the result with a coherent noise generator (joise) : It is called flat shading. How to Detect if I have touched the correct alphabet sidbhati32 replied to sidbhati32's topic in For Beginners@Scouting Ninja @Cold.bo @Mike2343 I have progressed a bit with the project - I have randomly generated spheres having different alphabets and predefined words. Presently, I cannot compare the alphabet in the sphere with the alphabets of the word. Let me show you the code For randomly generating different alphabets - using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GenerateRandom : MonoBehaviour { private Text[] Circle; // Use this for initialization void Start () { Circle = GameObject.FindGameObjectWithTag ("Text").GetComponentsInChildren<Text> (); char[] S = "qwertyuiopasdfghjklzxcvbnm".ToCharArray (); for (int i = 0; i < 3; i++) { Circle .text = S [Random.Range (0, 25)].ToString (); } } // Update is called once per frame void Update () { } } For Randomly generating a word - using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RandomWord : MonoBehaviour { string[] Words = { "great", "stage", "peak", "street", "please" }; private Text texter; // Use this for initialization void Start () { texter = GameObject.FindGameObjectWithTag ("Sphere").GetComponent<Text>(); texter.text = Words[Random.Range (0, 4)].ToString(); } // Update is called once per frame void Update () { } } For collision detection and checking the correct alphabet - using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Destroy : MonoBehaviour { private char[] Check; private string Me,You; // Use this for initialization void Start () { Me = GameObject.FindGameObjectWithTag ("Sphere").GetComponent<Text> ().ToString (); } // Update is called once per frame void Update () { } void OnCollisionEnter2D(Collision2D other) { int Length = Me.Length; Check = Me.ToCharArray (); Debug.Log ("Collision"); if(GameObject.FindWithTag ("Background")) { You = other.gameObject.GetComponent<Text> ().ToString (); if(You != null) { for(int i=0 ; i<Length; i++) { if (You == Check .ToString ()) Debug.Log ("Matched"); } } } Destroy (other.gameObject); } } Now I am getting the issue in the picture I have shared. When I double click the error, it redirects me to - You = other.gameObject.GetComponent<Text> ().ToString (); Looking forward to your help Thanks - - Cold.bo started following Feels a bit "confused" on my game development study and GALATIC ERA GALATIC ERA Cold.bo posted a topic in Your AnnouncementsHello, i'd like to introduce a new webgame called Galactic ERA to all of you. Game link This game is a browser based (but we do have APK for those who like to play on mobile.) Online space strategy game. It supports multi language, you can switch at bottom in login screen. This game is free, doesn't like some "free to play" and then give you many in-game buying. This game is like warframe or EVE online, All the items you can buy by cash is obtainable by in-game currency. And payed player doesn't have significant advantage than normal players. (well ,if you like to support the developer, maybe you can buy a monthly card) The background is space age and people start to expand from the Earth. All players starts from planet 1-1 (where is the spawn of all players for now, and have best facilities in the game) with a frigate hull and some basic weapons/defenses. By defeating the enemy in missions you can gain experience and UCP (currency in game), You can see i'm level 22 (at right bottom of my portrait.) The level determines what you can buy from the market (mostly, produce permissions for equipment) and skills unlocked (the skill system is like EVE online, it doesn't use skill point by level but you spend time on skills) Here is the planet view of the game. The game have ship design system. You can arrange weapons and equipment in your ship, and the design will reflect in battle. (e.g. if you put all armor in front, then your ship will be fragile when enemy hit you from side.) The system map of this game, You can conquer the planet and develop it. Every planet has it's own mining values, Some are rich and easy to harvest, and some are poor and harvest slowly. This game has a large system, but it also have a full galaxy for you to explore ! The clan first discover the new system can name it. As the game is developed by Chinese developers, so most the player is Chinese for now. And last but not least, the game has a good view of combat, You can monitor how your ship crash the enemy piece by piece, blow their shield, pierce their armor and explode their energy core. This game is still in Beta, currently all saved progress will be deleted on December 1. And then the game officially start running and keep the progress. Game link Open Source Direct3D 12 Game Engine? Jemme replied to 237cookies's topic in Engines and MiddlewareFor my new "engine" I've decided to create a split between the system and what a traditional engine supplies. By this I mean I have a layer of libs called OSL which contains libs for: maths(vectors, magic etc) graphics(render, render states , render.cpp (dx11, dx12, to etc.)) System (memory, time, thread, config string etc.) So on... This is essentially a small media layer a bit like SDL but more like sfml or xna, from this I can then create games or most importantly create the OSL_Engine which implements scene manager, entity component systems, AI, physics etc. But doesn't have to know about the low level stuff as that's handled separately. The engine can then be used to make a DLL for an editor etc. Be interested in hearing about your approach. Feels a bit "confused" on my game development study Scouting Ninja replied to Cold.bo's topic in For BeginnersThat is what it feels like when you start. You read how to do X and how to do Y, like a parrot talking by just repeating words. It takes a while but you do learn from every attempt. It takes a lot of practice but you get better each time. There is no school that can teach you all about game development, you would be stuck in the school for your whole life. You did the theory and it's now time for the practical, use what you have learned and make your game. - tameraseylerfh joined the community From the Forum – Issue #169 CoronaRob posted a blog entry in Corona Labs BlogWelcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics. Migrating Enterprise Corona has been offering our native builds as part of the core for a while now. There has been considerable modernization of the App template that projects are based upon. Several Enterprise developers are wanting to move forward and this thread covers various ways to move from the legacy Enterprise template to the modern Native template. Pushing objects Trying to add linear impulse to objects should make them move straight, but you can also get your objects to move oddly too. This thread helps “straighten out” that movement. Looping or events? The original poster wanted to know the best way to move objects in a back-and-forth manner. Corona offers several ways to do this and our great development community stepped up in this thread to offer some suggestions. Smoothed Particle Hydrodynamics implementation problem Yarden2JR replied to Yarden2JR's topic in Math and PhysicsI've just tested simulating steam as well (as described by Kelager): Steam inside a sphere What do you guys think is going on (e.g., the problem probably is with the pressure force, or viscosity, or fiding the neightbors, or with collision response, etc). I can post the Fluid class if you guys need it. Thanks! Material for game developing Infinisearch replied to Serox's topic in For BeginnersWouldn't you rather focus on one way of doing things when just starting out? I mean if you don't mind then whatever but focusing on one language to begin with is a good idea. The amount of tutorials and books and material for C# outnumbers what's available for Rust as well. Good luck either way. What is your Game of the Year for 2017 and why? Matthew Birdzell replied to Matthew Birdzell's topic in GDNet LoungeThats a lot haha. A majority of what you say is indeed tough love. That's valid.To me its nitpicky over lots of little design choices the developers probably didn't catch as they built it. You do have good points. However they did work on the game for six years, trying stuff out and writing several stories. Twenty for the main story, in fact. That was stated in an interview with the lead writer on YouTube. Perhaps they also used this first game to experiment with their designs, leaving a sequel for improvements. Thats normally how stuff works. Lots of what you mention can be ironed out and refined. You bring a detailed perspective. Thanks!. I have less to describe in shortcomings in my review I posted a couple weeks ago, over in the blog forum. - cortneymarmonu joined the community Feels a bit "confused" on my game development study Cold.bo posted a topic in For BeginnersI have studied game development in university for 3 years. I still feel very confused about how to develop a game. Yes I do have made some project and get high score in class. But it is far from a game we may see and play every day. So i feel very diffident about what i'm going to do in future. I'm not sure how far i am from an "average" game developer. I feel i learned something so i have more knowledge than those who not studied, but there a much more thing i have no idea about. For example, I do know use some graphic engine like OpenGL, but i'm like an ancient people get a modern machine by chance and studied it for years to know how to open the switch. Is that normal to all others who study game development? Feels what we learned in university is miles away from what we feels like?
https://www.gamedev.net/discover/?view=condensed
CC-MAIN-2017-47
refinedweb
3,476
71.65