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
Last fall, my 10 year old son expressed some interest in learning how to program games. So I, being the CS nerd that I am, was thrilled and immediately went to work trying to find good learning resources to help get him started. Eventually, I settled on a book entitled Hello World! Computer Programming for Kids and Other Beginners (you can read about it here). As the name suggests, this book is geared for kids looking to get started with programming for the first time. Though there are several books out there that purport to do this, I thought there were two things that really set this book apart: - The book is co-authored by the author’s 12 year old son. So, you get the insight of a young developer learning how to program for the first time. In particular, the book contains many sidebars which document specific pain points encountered during the learning process. - It uses Python as its language of choice for teaching introductory programming. Given my natural prejudices when it comes to scripting languages, I was a little skeptical about the selection of Python as a first programming language. What little I had seen of it had given me horrible flashbacks to my days of doing CGI scripting in Perl in the late 1990s. Back then, scripting languages just seemed like controlled chaos: no typed variables, weird and cryptic syntax, and a certain amount of terseness that just went against everything I had ever learned about programming in school. Still, if you look at what the young whippersnappers of this generation are learning in schools, you’ll find that scripting languages like Python are towards the top of the list. So either a whole generation of developers has it wrong (probably), or maybe it’s me that needs to broaden my horizons. So, I decided we’d give it a shot. So what’s all this got to do with ABAP you might ask? Well, during the course of our journey, I discovered some things about scripting languages in general and Python in particular that really got me to thinking about the way we perform day-to-day tasks using traditional enterprise programming languages such as ABAP and Java. So what follows is an opinion piece which documents some of the lessons I learned while coming up to speed with Python. Lesson 1: Dynamic Typing Ain’t That Bad Though I’ve programmed in many languages over the years, Java has always been my first love (sorry ABAP). And it was in Java that I really began to embrace the notion of static typing. If you’re not familiar with this concept, then a brief description is in order. When we talk about types in a programming language, we’re talking about artificial constructs which provide an abstraction on top of some section of memory. For example, the primitive int (integer) type in Java carves out 4 bytes in memory to store a 32-bit signed, two’s complement integer. Similarly, other data types such as float, double, or char in Java or I, F, P, and C in ABAP map an abstract data type onto a series of bits in memory. To the computer, it’s 1’s and 0’s as usual; to us, we have an intuitive construct which can be used to model the data we encounter in the real world. As practitioners of a given language, we normally remain blissfully unaware of such bookkeeping, relying on the runtime environment to take care of the low-level bit-twiddling details. Language designers, on the other hand, care about these details a great deal. In particular, they are interested in defining a scheme for determining when and where to apply a particular abstraction (type). Such mapping schemes can be usually classified into two broad categories: - Static Typing - With static typing, the types of variables must be declared up front at compile time. - If a variable is created without a type, a syntax error will occur and the code won’t compile. - Similarly, if a variable of a given type is statically assigned a value which is outside the boundaries of that type, the compiler will catch that too. Of course, there are limits to what can be checked at compile time. After all, the compiler can’t predict how a poorly written loop might cause overflow in a variable assignment, etc. - In addition to the efficiencies it offers to compiler implementations, static typing is geared towards preventing developers from hanging themselves with type mismatches and the like. - Dynamic Typing - With dynamic typing, a variable is not assigned a type until runtime whenever it is first assigned a value. - This is made possible by VM/interpreter implementations which are designed to allocate just about everything on the fly. - Since there are no compile-time restrictions on type declarations, it is possible that some type mismatch errors won’t be caught until runtime. As you may have guessed, both ABAP and Java employ static typing. So, whenever we define a variable in one of these languages, we must assign it two things: - A name - A specific type For example, if we wanted to define a variable to hold a floating point number in Java, we would need to define it using a syntax like the following: float pi = 3.14159f; With ABAP, we probably end up with a syntax like this: DATA pi TYPE p DECIMALS 5. pi = '3.14159'. Conversely, the equivalent variable declaration in Python looks like this: pi = 3.14159 As you can see, Python does not require a type declaration up front. So what, you say? Well, besides saving several keystrokes (or many if it’s a complex data structure), the dynamic approach is much more flexible in the long run. For example, think about what would happen if at some point we needed to increase the precision of our PI variable. In the ABAP/Java examples, we would probably have to go back and touch up the code to choose a wider data type. With Python, no code changes are required; the interpreter will simply carve out a larger space in memory as needed. In his article, Scripting: Higher-Level Programming for the 21st Century, John Ousterhout puts this into perspective: “…scripting languages are designed for gluing: they assume the existence of a set of powerful components and are intended primarily for connecting components together. System programming languages (e.g. C) are strongly typed to help manage complexity, while scripting languages are typeless to simplify connections between components and provide rapid application development.“ As I progressed further and further with Python, I found that I didn’t really miss the formal type declarations like I thought I would. That’s not to say that I didn’t encounter a runtime error here or there. But the thing is, I encounter those kinds of issues in my day-to-day ABAP work, too. So, at the end of the day, I had to ask myself a fundamental question: what is static typing truly buying me other than a lot more keystrokes? As much as I have been a strong proponent for static typing over the years, this is a question I found difficult to answer with anything other than “because…”. Lesson 2: Internal Tables Could Use a Facelift One of the things I like about Python is its rich set of built-in collection types: lists, tuples, sets, and dictionaries. These collection types are quite feature rich and flexible in their use. Sure, you can accomplish all the same things with internal tables in ABAP, but the Python way of doing things is a whole lot easier. From a usage perspective, we have the option of working with these collections in two different ways: - We can perform operations using the rich set of API methods provided with Python collection types just as we would with collection types in Java or (e.g. those in the java.utilpackage). - Python also allows us to perform certain operations on these objects using built-in operators (e.g. [ ], +, etc.). To put this these advantages into perspective, let’s take a look at a side-by-side comparison between ABAP code and Python code. The other day, I was tasked with enhancing a simple workflow report in ABAP that provides statistics about agents assigned to specific workflow items. As I read through the code, I found the selection logic to be pretty typical of most reports: - First, the report fetched the work item information into an internal table. - Then, for each work item record in the internal table, additional information about the assigned agent (e.g. agent name, duty, etc.) was fetched and aggregated into a report output table. In order to improve performance and avoid the dreaded “ SELECT within a LOOP“, the developer had built a temporary table which contained the super set of agents assigned to the work items. That way, the agent information only had to be selected once as opposed to over and over again within the loop. From an ABAP perspective, the set generation process looked something like this: LOOP AT lt_work_items ASSIGNING <ls_work_item>. READ TABLE lt_agents ASSIGNING <ls_agent> WITH KEY wi_aagent = <ls_work_item>-wi_aagent. IF sy-subrc NE 0. APPEND INITIAL LINE TO lt_agents ASSIGNING <ls_agent>. <ls_agent>-wi_aagent = <ls_work_item>-wi_aagent. ENDIF. ENDLOOP. Though this is pretty simple code, I would draw your attention to the number of lines of code it takes to perform a simple task such as building the LT_AGENTS superset (and we didn’t even include the type definitions, data declarations, and so on). Now, while there are arguably better ways of performing this task in ABAP (the somewhat obscure COLLECT statement comes to mind), this copy idiom is fairly typical of a lot of the ABAP code I see out there. With that in mind, let’s look at the Python way of doing this. Here, if we structure our collection types correctly, we can achieve the same task using a single line of code: #Assuming wi_dict is a dictionary type with key:value pairs of the form #{Work Item:Agent ID}... agent_set = set(wi_dict.values()) In this case, we simply collect the list of agents from the wi_dict dictionary object and then pass it to the set collection’s constructor method. Since the set type automatically filters out duplicates, we can perform the task in one fell swoop. Of course, that’s just one of many operations that is made easier using Python collections. Overall, I found that it was much easier to create custom data structures and perform all manners of operations on them in Python as opposed to ABAP (and Java, too for that matter). This leads into my next lesson learned. Lesson 3: ABAP Would Taste Sweeter with Some Syntactic Sugar The first time I looked at an ABAP program, my initial reaction was how much it looked like COBOL, a language often chastised for its verbosity. 12 years and a case of carpal tunnel syndrome later, things haven’t really changed all that much on this front. Sure, there have been a lot of enhancements to the language, but there are still many trivial tasks that seem to take more lines of code than they should. For example, look at the following piece of sample code written in Python: import os, glob [f for f in glob.glob('*.xml') if os.stat(f).st_size > 6000] This complex expression is called a list comprehension, and can be interpreted as “list the set of XML files in the current working directory that are larger than 6,000 bytes”. In ABAP, we’d have to call a function to retrieve an internal table of files in the target directory, loop through each file, and apply the predicate logic after the fact. They both achieve the same thing, but I can get there quicker with Python. Lesson 4: Less Fluff = Improved Readability As I mentioned earlier, I certainly had my doubts about using Python as a learning language. However, I was surprised at how quickly my son was able to pick it up. After spending just a little time with it, he seemed to have no trouble reading sample code and tweaking it to create simple games. Ultimately, I think this comes down to the fact that Python has so little fluff in it that it’s really easy to zero in on what a particular piece of code is trying to do. Compare this with the 30K line ABAP report which contains 2-3 pages full of nothing more than type/variable declarations. Sometimes less is more, and I think Python and scripting languages in general got this part of language design right. Lesson 5: Everything Works Better if you get the Core Right As I have begun branching out with my Python programming, I started looking at how to perform common IT-related tasks such as XML parsing, Web service calls, string processing, and so on. While working with these APIs, I noticed a common trend in the APIs: no matter the technology, most everything can be achieved using basic Python built-in types. For example, when parsing XML, I don’t have to familiarize myself with 10-20 interfaces (Yes, I’m looking at you iXML). Instead, elements are stored in lists, attributes are stored in dictionaries, and it’s basic Python programming as per usual. I liken this to the Unix OS architecture where everything’s a stream. Once you establish this foundation, everything just seems to flow better. Of course, every new technology is going to present a learning curve, but as long as the core remains the same, it is much easier to come up to speed with all the rest. Conclusions If you’ve made it this far through my ramblings, then you might be wondering what conclusions can be drawn from all this. After all, SAP’s not likely to re-purpose ABAP as a scripting language anytime soon. Still, languages have a way of borrowing features from one another (see ABAP Objects), so maybe it’s possible we’ll see ABAP loosen up a little bit more in the coming years. Also, with the advent of VM implementations such as Jython, it’s possible to mix-and-match languages to solve particular types of problems. On a more personal level, I found it interesting to see how the next generation of developers are being taught to program. Clearly things have changed, and sometimes change is good. Like it or not, a good majority of next generation cloud-based applications are being built using these languages. Indeed, at Google, Python is right up there as a first-class citizen with Java in the enterprise realm. Suffice it to say that the dynamic programming hippies are here to stay, so lock up your daughters and hold your statically-typed variables close at hand. 🙂 Hi James, Very interesting read, and I would agree with all your points. Esp. nr 3 (more syntactic sugar) would be very helpful. ABAP is a nice language, but way too verbose. Regarding point nr 2: nothing stops you from defining these abstract datatypes yourself (confession: so far I’ve been too lazy to do it myself). Thanks for sharing these insights! Fred Agreed. I have created such abstract types myself at different points along the way. It would be nice though if they were just part of the standard NetWeaver offering as opposed to something we as developers have to carry around from project to project using SAPlink, etc. Hi James, I really enjoyed this blog. Thank you for writing it and I too agree with the points you raised. Not a language specific thing I know but I would also like to see the ABAP IDE pick up on some of the capabilities of modern developer tools. I especially would like to see more and better refactoring tools. Whilst the ABAP in Eclipse initiative is a good start it is still not possible to build a complete application without jumping into SAPGUI – and as far as I know there are no refactoring tools available in ABAP in Eclipse yet. Cheers Graham Robbo Thanks, and I definitely agree with the comments on the Eclipse-based tool. I suspect that such features will show up eventually, but it would be great if we didn’t have to hack our own Eclipse plug-ins for the next several years in the meantime. If HANA, cloud, and mobile are indeed the pillars of the next wave of SAP development, then productivity on the developer side is going to be crucial I think. Hi James, Nice comparision and very informative blog. “As you may have guessed, both ABAP and Java employ static typing. So, whenever we define a variable in one of these languages, we must assign it two things:” I might disagree on your point if I understand correctly, You can dynamically decalre data in ABAP and that is what we do when you handle multiple currencies at a time where the decimal place can vary. regards, Raghav Indeed. I was sort of painting in broad strokes here. ABAP, and to a lesser extent, Java, support a number of dynamic programming features (e.g. the CREATE DATA statement in ABAP, etc.). My point was geared more towards the everyday run-of-the-mill programming tasks that don’t employ these more advanced features of the language. Hi James! Thanks for this very interesting article. I’m an ABAP developer and also love Python, I’ve been programming both languages for 5 years. I’ve learned how to use Python in my daily work, programming scripts to make my life as an ABAP developer easy. I believe that, as a developer, we must research, learn how to make your work easier and have a lot of fun at the same time. I think Python is a very good choice to do that. There are a lot of syntactic sugar that we would love to see in ABAP, like in the examples that you show, or simple things like increasing a variable by one like in other programming languages: Python a += 1 Java a++; In ABAP you have to be explicit: v_a = v_a + 1. Or an easy way to assign values to fields of a work area, instead of doing this: wa_test-field1 = ‘test1’. wa_test-field2 = ‘text2’. ……. wa_test-fieldN = ‘textN’. Maybe we could do something easier like: wa_test { field1 = ‘text1’. field2 = ‘text2’. ….. fieldN = ‘textN’. } Regards, Hugo De la cruz
https://blogs.sap.com/2013/01/18/lessons-learned-from-scripting-languages/
CC-MAIN-2017-39
refinedweb
3,099
67.28
README @tiny Detect bots among users in your tinyhttp app. This middlewares is based on isbot. Note that it doesn't differentiate "good" and "bad" bots, it only shows if a request comes from a bot (e.g. crawler) or from a real human. InstallInstall pnpm i @tiny APIAPI botDetector()(req, res) This middleware adds 2 new getters, isBot and botName. isBotis a boolean which shows if the request is made by a bot botNameis a string that shows the bot name in case isBotis true. Both getters are lazy and will not be calculated until needed ExampleExample import { App } from '@tiny import type { Response } from '@tiny import { botDetector } from '@tiny import type { RequestWithBotDetector } from '@tiny new App<any, RequestWithBotDetector, Response>() .use(botDetector()) .use((req, res) => { res.send(req.isBot ? `Bot detected 🤖: ${req.botName}` : 'Hello World!') }) .listen(3000)
https://www.skypack.dev/view/@tinyhttp/bot-detector
CC-MAIN-2022-21
refinedweb
138
58.58
I need help with this program, I don't know what to do. I am not getting the amount of tax. /*This is program that displays the tax due over the amount of taxable income*/ #include <stdio.h> int main() { float income=0, amount_of_tax=0; printf("Please enter the amount of taxable income: "); scanf("%d", &income); fflush(stdin); if (income < 750.00) amount_of_tax = .01 * income; else if (income < 2250.00) amount_of_tax = 7.50 + .02 * income; else if (income < 3750.00) amount_of_tax = 37.50 + .03 * income; else if (income < 5250.00) amount_of_tax = 82.50 + .04 * income; else if (income < 7000.00) amount_of_tax = 142.50 + .05 * income; else amount_of_tax = 230.00 + .06 * income; printf("The amount of tax due is: $%.2f\n", amount_of_tax); return 0; }
https://cboard.cprogramming.com/c-programming/34224-help-if-statement.html
CC-MAIN-2017-09
refinedweb
123
81.39
0 //Make an interactive program that will ask for hourly rate of the employee and the number of hours worked in a day. As DOLE mandates, more than 8 hours of work a day is considered OT (overtime) so the wage will be 1.5 * hourly rate after the 8 hours of work.using loops, compute the weekly wage.Given 6 days of work in a week.Output the gross salary and net salary( gross salary less 12%.)// I dont know how work with the overtime... here's my code.. #include <stdio.h> int main() { int day,hRate,wHours,; int total = 0; int i = 1; float cTax,gross,salary,nSalary,aTotal; float tax = .12; printf("Enter Hourly Rate: "); scanf("%d",&hRate); printf("Enter number of days you've worked: "); scanf("%d",&day); if (i <= day) { while (i <= day) { printf("\nEnter number of hours you worked in Day %d: ",i); scanf("%d",&wHours); salary=wHours*hRate; printf("\nYour salary for day %d is %.2f \n",i,salary); i=i+1; total=total+salary; } } else if ( wHours > 8) { while (i <= day) { printf("\nEnter number of hours you worked in Day %d: ",i); scanf("%d",&wHours); salary=wHours*(hRate*1.5); printf("\nYour salary for day %d is %.2f \n",i,salary); i=i+1; total=total+salary; } } aTotal = total; printf("\nYour weekly gross salary is %.2f", aTotal); cTax =tax*total; printf("\n\n the tax is %.2f",cTax ); gross=aTotal-cTax; printf("\n\n weekly net salary is %.2f", gross); getchar(); getchar(); }
https://www.daniweb.com/programming/software-development/threads/207667/salary-problem-beginner
CC-MAIN-2017-51
refinedweb
250
84.37
Building Squawk on Desktop Hello all, am trying to build squawk , but am facing an error i don't know what does it mean . i followed the instruction provided here in the forum. actually i couldn't fine the line in build.java --------------------------------------------- com.sun.squawk.builder.Builder at line 750 by replacing toolsJarPath = toolsJarURL.getPath().substring(1); by toolsJarPath = toolsJarURL.getPath(); --------------------------------------------- could someone help me with this . here is the error i received when trying to build the squawk --------------------------------------------------------------------------------------------------------- Launcher: Found tools.jar in C:\Java\lib\tools.jar, by popping up a level from jre. Builder.JDK: Looking for JDK in C:\Java, popped up a level from jre Launcher: Found tools.jar in C:\Java\lib\tools.jar, by popping up a level from jre. For vm2c tools.jar=C:\Java\lib\tools.jar [running clean...] Total time: 0s -------------------------------------------------------------------------------------------------------------- Thank you for your reply, well i've tried to download the old version of squawk (tag blue080219) , still have errors i followed the step but it is not working i get another error... -------------------------------------------- Note: src\com\sun\squawk\builder\launcher\Launcher.java uses or overrides a deecated API. Note: Recompile with -Xlint:deprecation for details. src\com\sun\squawk\builder\commands\MakePlatformStubs.java:29: warning: sun.to s.jar.Main is Sun proprietary API and may be removed in a future release import sun.tools.jar.Main; -------------------------------------------------------------------------------------------------------- Hi, I'm still trying to clean up the build directions, but you can look here to see a draft. Ignore any steps crossed out. Note that the error you listed in your first message in this thread doesn't look like an error, but is expected output. Hello, I'm not an expert in Squawk but I've already faced some issues. I also couldn't find that line first, but finally I found it in an old version of squawk (tag blue080219), sure the post is older than the current version. Go ahead with the step indicated in the post of Feb 12, 2008 2:28 AM Building/Running since you get no error at all! Best regards, Leo
https://www.java.net/node/680584
CC-MAIN-2015-40
refinedweb
351
68.57
Logging sink options. More... #include <qpid/log/SinkOptions.h> Logging sink options. Most logging sink options will be platform-specific, even if some are duplicated. The range of platforms to which this code may be ported can't be assumed to all have C++ iostreams or files. Thus, this class is primarily for implementing in a platform-specific way. Definition at line 44 of file SinkOptions.h. Definition at line 47 of file SinkOptions.h. Parses options from argc/argv, environment variables and config file. Note the filename argument can reference an options variable that is updated by argc/argv or environment variable parsing.
http://qpid.apache.org/apis/0.14/cpp/html/a00338.html
CC-MAIN-2013-20
refinedweb
104
60.92
Closed Bug 873012 Opened 10 years ago Closed 9 years ago Horizontal and vertical overlay scrollbars should overlap on 10 .8 Categories (Core :: Layout, defect) Tracking () mozilla24 People (Reporter: mstange, Assigned: areinald.bug) References Details (Whiteboard: [lion-scrollbars=]) Attachments (7 files, 3 obsolete files) In other words, part 3 of bug 636564 should be deactivated on 10.8. Markus, what do you mean by "they should overlap"? It sounds to me like you are talking about the bottom-right invisible square that the scrollbars don't pass. However even on 10.8 that is the proper behavior. See what Chrome does in the screenshot I added. Flags: needinfo?(mstange) Oh, I take it back. :) Looks like Chrome is not demonstrating proper behavior either. Textedit does indeed overlap the scrollbars. I never noticed that before. Flags: needinfo?(mstange) Interesting. Safari however, also doesn't overlap scrollbars. Therefore I am at a lost if we should or should not overlap ours. I would say we shouldn't, to be consistent with Safari, but both are acceptable options. Oh, interesting, I never bothered to check other browsers ;-) I'd say Webkit just hasn't adopted the 10.8 behavior yet, but that's just a guess. The only time when I notice this is when both scrollbars are visible and one is hovered. The 10.8 rectangle hover effect looks ridiculous if the scrollbar stops short of the viewport end. I agree it looks odd. Although having the scrollbars overlap doesn't look terribly pleasing either. I suppose this should be up to UX then... Neither appearance really looks ideal but overlapping is probably what we want since it is more consistent with the rest of the OS. Agreed: a wide gutter stopping short of the edge looks a whole lot worse than overlapping indicators. As a side note in case this gets implemented, Apple's behavior for hovering over the the bottom-right corner is to widen the vertical scrollbar. Whiteboard: [lion-scrollbars=] I'm late to the party, but wanted to add that part 3 of bug 636564 was deliberately landed at the time because it matched what Safari was doing. I figured a follow up bug could answer the question whether or not we should have this behavior. So, thanks for filing this bug! :-) Assignee: nobody → areinald Status: NEW → ASSIGNED Next step is to set this value depending on the OS version. Attachment #752883 - Flags: review?(spohl.mozilla.bugs) Comment on attachment 752883 [details] [diff] [review] If value of useOverlayScrollbars is 2, then overlap H and V scrollbars in the corner Review of attachment 752883 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsGfxScrollFrame.cpp @@ +3733,5 @@ > } > AdjustScrollbarRectForResizer(mOuter, presContext, hRect, hasResizer, false); > } > > + if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 2) { I'd like to know from Steven if we should be using an enum (or similar) here, instead of a hard-coded value of 2. Maybe a comment explaining this would be enough? Attachment #752883 - Flags: review?(spohl.mozilla.bugs) → review?(smichaud) Comment on attachment 752883 [details] [diff] [review] If value of useOverlayScrollbars is 2, then overlap H and V scrollbars in the corner This is incomplete by itself -- currently LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) can't return '2' (only '1' or '0'). So it's not really reviewable by itself. Attachment #752883 - Flags: review?(smichaud) Relying on useOverlayScrollbars : 0 for old style, 1 for overlay not overlap, 2 for overlay and overlap. Attachment #752883 - Attachment is obsolete: true Attachment #752972 - Flags: review?(smichaud) Comment on attachment 752972 [details] [diff] [review] Allow overlay scrollbars to overlap on 10.8 or later Actually I should have r-ed the previous patch, too. On the face of it, we're redefining LookAndFeel::eIntID_UseOverlayScrollbars, which can be used across platforms, to deal with a problem that (as far as I know) only arises on OS X. Let me see if I can come up with a better approach. Attachment #752972 - Flags: review?(smichaud) → review- I really think we should use a separate setting for this -- something like eIntID_AllowOverlayScrollbarOverlap. Windows Metro is (currently) the only other platform that needs to use overlay scrollbars, and as far as we know their horizontal and vertical scrollbars never overlap. So currently we only have this choice (whether or not to allow the overlay scrollbars to overlap) on OS X (and specifically on Mountain Lion). But the question of whether or not to use overlay scrollbars is logically separate from the question of their "style". Currently the only "style" question we ask is whether or not we should allow the scrollbars to overlap. But we may have more "style" options in the future -- in which case we'd change the name of the eIntID_AllowOverlayScrollbarOverlap setting and add more possible values. As per smichaud advice, add a separate selector to hold the desired overlap value. Attachment #752972 - Attachment is obsolete: true Attachment #753408 - Flags: review?(smichaud) Comment on attachment 753408 [details] [diff] [review] Allow overlay scrollbars to overlap on 10.8 or later Looks good to me. Attachment #753408 - Flags: review?(smichaud) → review+ Why did you make the change to nsLookAndFeel::UseOverlayScrollbars()? Personally, I prefer the previous style. I would prefer too if we were to return a bool. But there was an implicit conversion from bool to int when we put the result in aResult, and so I changed the return type of UseOverlayScrollbars(), hence its code too. For returning ints, I'd rather use something like return (a ? b : c) but not sure people like it here.". (In reply to André Reinald from comment #20) > I would prefer too if we were to return a bool. But there was an implicit > conversion from bool to int when we put the result in aResult But then I'd do the explicit conversion when setting aResult, and not in the method. That's what I was going to do for a different system metric once, but I was asked to keep the implicit conversion, see bug 448767 comment 4. (In reply to André Reinald from comment #21) >". I think this was changed in bug 868396. The other reason why I left it as int was the first version of my patch returned 0 1 or 2 to account for the normal / overlay / overlay + overlap looks. Ok, then I'll change back the method result type, and make the explicit conversion when setting aResult with the a ? 1 : 0 Take into account mstange comments. Attachment #753408 - Attachment is obsolete: true Attachment #753482 - Flags: review?(smichaud) Comment on attachment 753482 [details] [diff] [review] Allow overlay scrollbars to overlap on 10.8 or later This also looks good to me. Attachment #753482 - Flags: review?(smichaud) → review+ Thanks! Stephen Horlander agreed with this approach in comment #8. Status: ASSIGNED → RESOLVED Closed: 10 years ago Resolution: --- → FIXED Target Milestone: --- → mozilla24 status-firefox21: --- → unaffected status-firefox22: --- → unaffected status-firefox23: --- → affected status-firefox24: --- → fixed status-firefox-esr17: --- → unaffected I filed issue 878480 before I saw this report. As I understand now, the overlapping is expected. Please feel free to close issue 878480. although the overlapping looks strange ... Comment on attachment 753482 [details] [diff] [review] Allow overlay scrollbars to overlap on 10.8 or later [Approval Request Comment] Bug caused by (feature/regressing bug #): Bug 636564 User impact if declined: Overlay scrollbars wouldn't overlap and wouldn't have a native OSX lion feel. Testing completed (on m-c, etc.): Has been on m-c for several days. I've also confirmed that this is fixed in recent nightlies. Risk to taking this patch (and alternatives if risky): minor String or IDL/UUID changes made by this patch: none Attachment #753482 - Flags: approval-mozilla-aurora? Requesting checkin for aurora. Please provide detail steps to reproduce this. Flags: needinfo?(mstange) STR: 1. Resize browser window until both vertical and horizontal scrollbars are displayed. 2. Scroll to the bottom right corner. Expected: Scrollbars overlap. Flags: needinfo?(mstange) User Agent :Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20130712 Firefox/24.0 Build ID: 20130712004003 (latest Aurora) Tested it using steps provided in comment 35 on MAC 10.8 OS, but I don't see desired result. User Agent :Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0 Build ID: 20130711122148 ( FX 23 B5) Tested it using steps provided in comment 35 on MAC 10.8 OS, but I don't see desired result. Status: RESOLVED → REOPENED Resolution: FIXED → --- :Samvedana, your setup uses the old-style scrollbars. This usually happens for one of two reasons. To rule them out, please verify the following: 1. Make sure that you don't have an external mouse connected to your system. 2. Make sure that under System Preferences > General, you have either "Automatically based on mouse or trackpad" or "When scrolling" selected for "Show scroll bars" Flags: needinfo?(samvedana.gohil) And :Samvedana, since you're verifying other overlay scrollbar-related bugs as well, please make sure that you always verify them with overlay scrollbars enabled (not the old-style scrollbars). User Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0 Build ID: 20130715155216 User Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20130718 Firefox/25.0 Build ID: 20130718030201 User Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20130718 Firefox/24.0 Build ID: 20130718004004 Tested this on latest nightly. I am getting attached (scrollbar)result for all above builds. Is this okay? I am confused with overlay scrollbar. Flags: needinfo?(samvedana.gohil) → needinfo?(mstange) Flags: needinfo?(spohl.mozilla.bugs) Yes, that's the expected behavior. Flags: needinfo?(spohl.mozilla.bugs) Status: REOPENED → RESOLVED Closed: 10 years ago → 9 years ago status-firefox25: --- → verified Resolution: --- → WORKSFORME Status: RESOLVED → VERIFIED Flags: needinfo?(mstange) Resolution: WORKSFORME → FIXED
https://bugzilla.mozilla.org/show_bug.cgi?id=873012
CC-MAIN-2022-40
refinedweb
1,646
59.3
#include <db.h> int DB->join(DB *primary, DBC **curslist, DBC **dbcp, u_int32_t flags); The DB->join() method creates a specialized join cursor for use in performing equality or natural joins on secondary indices. For information on how to organize your data to use this functionality, see Equality join. The DB->join() method is called using the DB handle of the primary database. The join cursor supports only the DBcursor->get() and DBcursor->close() cursor functions: Iterates over the values associated with the keys to which each item in curslist was initialized. Any data value that appears in all items specified by the curslist parameter is then used as a key into the primary, and the key/data pair found in the primary is returned. The flags parameter must be set to 0 or the following value: DB_JOIN_ITEM Do not use the data value found in all the cursors as a lookup key for the primary, but simply return it in the key parameter instead. The data parameter is left unchanged. In addition, the following flag may be set by bitwise inclusively OR'ing it into the flags parameter: DB_READ_UNCOMMITTED Configure a transactional join operation to have degree 1 isolation, reading modified but not yet committed data. Silently ignored if the DB_READ_UNCOMMITTED flag was not specified when the underlying database was opened. DB_RMW Acquire write locks instead of read locks when doing the read, if locking is configured.. Close the returned cursor and release all resources. (Closing the cursors in curslist is the responsibility of the caller.) The DB->join() method returns a non-zero error value on failure and 0 on success. The curslist parameter contains a NULL terminated array of cursors. Each cursor must have been initialized to refer to the key on which the underlying database should be joined. Typically, this initialization is done by a DBcursor- parameter, and a nested iteration over each secondary cursor in the order they are specified in the curslist parameter.. By default, DB->join() does this sort on behalf of its caller. For the returned join cursor to be used in a transaction-protected manner, the cursors listed in curslist must have been created within the context of the same transaction. The flags parameter must be set to 0 or the following value: Do not sort the cursors based on the number of data items to which they refer. If the data are structured so that cursors with many data items also share many common elements, higher performance will result from listing those cursors before cursors with fewer data items; that is, a sort order other than the default. The DB_JOIN_NOSORT flag permits applications to perform join optimization prior to calling the DB->join() method. The DB->join(). If cursor methods other than DBcursor->get() or DBcursor->close() were called; or if an invalid flag value or parameter was specified. Database and Related Methods
http://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbjoin.html
CC-MAIN-2014-35
refinedweb
483
50.87
First I have a site which I did a restore from another server. I have a custom search part on my site which queries the scope for a list of files and their attributes. When I go to a document library or a list I can see that the modified by property is set to the proper value, but when I run a search through my custom search part, modifiedby is returned as 'System.String[]' for every file. If I set the source code to display the 'author' attribute, the value is returned correctly. Any ideas on why this is happening? EDIT: I get 'System.String[] ' returned in the API for the modified by attribute, even when I upload or modify a file on the new server. I Hello, I am making use of two property classes, between them one is type is that of other property array type, it has the following code: Hi, i have problem to insert path file into an array and listview(detail) using open file dialog wit multiselect property, please give me sample to make it? string[] ar = {"1", "1.1", "1.2", "2", "2.3"}; I need to get the closest match from the array or the next number according to the user input. Say for example if the user enters input output 1 1 // exact match 1.3 2 // since 1.3 is not present it should get next match from the arrray 2.1 2.3 // as above comment. Full error Message: Accessing this site requires a client certificate. Specify a client certificate in the crawl rules. I added the Crawl Rule and Content Source for the test site and tried specifying each available client certificates in the rules one by one, but the crawl still fails. WMSvc-SERVERNAME ForeFrontIdentityManager SERVERNAME.xxxx.local *.xxxx.com What kind of certificate does it needs and how to enable it? I know that the *.xxxx.com certificate is used for our SSL. < Hi, everyone. I hope someone will be able to help me about this issue: I am trying to generate WCF client by issuing following command: svcutil testingWsdl.wsdl /ser:XmlSerializer (/ser option has nothing with problem, I've just tried with it also) I am getting following error: Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: The datatype '' is missing. Here is complete WSDL: <?xml version="1.0"?> <definitions xmlns="" xmlns:tns="" xmlns:soap="" xmlns:xsd="" xmlns:wsdl="" xmlns: <import namespace="soap" location=""/> <portType name="SoapInPort"> <operation name="SoapIn"> <documentation>SoapIn</documenta Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
http://www.dotnetspark.com/links/43574-accessing-array-strings-property-from-wcf.aspx
CC-MAIN-2017-04
refinedweb
448
64.91
L76 Module¶ This module implements the Zerynth driver for the Quectel L76 L76(ifc, mode=SERIAL, baud=9600, clock=400000, addr=0x00, reset=None, reset_on=0)¶ Create an instance of the L76 class. Example: from quectel.l76 import l76 ... gnss = l76.L76(SERIAL1) gnss.start() mpl.init() alt = mpl.get_alt() pres = mpl.get_pres() stop()¶ Stop the L76 by using the lowest power consumption mode and terminates the receiver thread. It can be restarted by calling start. pause()¶ Pause the L76 by putting it into standby mode. It can be restarted by calling resume. Refer to the L76 documentation for details here resume()¶ Wake up the L76 from standby mode entered by calling resume. Refer to the L76 documentation for details here.
https://docs.zerynth.com/latest/official/lib.quectel.l76/docs/official_lib.quectel.l76_l76.html
CC-MAIN-2020-24
refinedweb
121
70.09
I'm still doing some cpuid code; but now I want to get the brand string. I've sort of got about half of it... If you have a browser that supports it; search for "/* relevant */" to seek straight to the relevant part of the code Important edit: if I strncpy() it into a data structure or itself, it works :l; so this is probably a problem with something else. cpuid_t do_cpuid(void) { cpuid_t stcpuid; /* Get vendor string: */ { unsigned a[3] = {0}; int eax; asm volatile( "cpuid\n\t" :"=a"(eax), "=b"(a[0]), "=d"(a[1]), "=c"(a[2]) :"a"(CPUID_GET_VENDORSTRING) ); if (eax == 0) { fprintf(stderr, "cpuid not supported on this CPU.\n"); exit(1); } memmove(stcpuid.vstring, a, 12); strncpy(stcpuid.manufacturer, get_manufacturer(stcpuid.vstring), 24); } /* relevant */ /* Get brandstring: */ { unsigned _bstr[12 + 1] = {0}; char bstr[48 + 1] = {0}; asm( "cpuid\n\t" :"=a"(_bstr[0]), "=b"(_bstr[1]), "=c"(_bstr[2]), "=d"(_bstr[3]) :"a"(0x80000002) ); asm( "cpuid\n\t" :"=a"(_bstr[4]), "=b"(_bstr[5]), "=c"(_bstr[6]), "=d"(_bstr[7]) :"a"(0x80000003) ); asm( "cpuid\n\t" :"=a"(_bstr[8]), "=b"(_bstr[9]), "=c"(_bstr[10]), "=d"(_bstr[11]) :"a"(0x80000004) ); /* I decided that the asm above was best to do in 3 seperate calls; it is * clearer this way, I hope. */ memmove(bstr, _bstr, 48 + 1); #if 1 /* What I should be getting: Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz * What I am getting: ItlR oeT) ud P 80 @23Gz * As you can see there are some slight differences. */ int n = 0; for (n = 0; n < 49; n++) { putchar(bstr[n]); ++n; } putchar('\n'); #endif } return stcpuid; } Essentially my problem is that the code above gives me ItlR oeT) ud P 80 @23Gz instead of Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
https://www.daniweb.com/programming/software-development/threads/240796/more-cpuid
CC-MAIN-2018-30
refinedweb
303
64.75
0 Hi everybody, I think this question will be kind of stupid for you ... but I am fighting with since yesterday evening. I have a class Test defined as such in the hpp file (Test.hpp) #include <iostream> #include <vector> using namespace std; class Test { public: Test(); static const int SOMEVALUE = 1200; void testFunction(); private: vector <int> vectorOfValues; }; The file Test.cpp is as such : #include <vector> #include <iostream> #include "Test.hpp" using namespace std; Test::Test() { } void Test::testFunction() { vectorOfValues.push_back(SOMEVALUE); } The main file is very simple : #include <iostream> #include "Test.hpp" using namespace std; int main() { Test t; t.testFunction(); } When trying to compile, the compiler returns the following error : /tmp/ccA63Hmn.o: In function `Test::testFunction()': Test.cpp:(.text+0x45): undefined reference to `Test::SOMEVALUE' collect2: ld returned 1 exit status However, if modify the testFunction function (see below) I don't have this problem, meaning that there is no access problem to my SOMEVALUE constant. void Test::testFunction() { cout << SOMEVALUE << endl; } What do you think of it? I thank you a lot for your help!
https://www.daniweb.com/programming/software-development/threads/305581/undefined-reference-issue
CC-MAIN-2017-09
refinedweb
180
58.79
Walkthrough: Creating and Using a Dynamic Link Library (C++) This step-by-step walkthrough shows how to create a dynamic link library (DLL) for use with a C++ application. Using a library is a great way to reuse code. Rather than re-implementing the same routines in every program that you create, you write them one time and reference them from applications that need the functionality. By putting code in the DLL, you save space in every app that references it, and you can update the DLL without recompiling all of the apps. For more information about DLLs, see DLLs. This walkthrough covers these tasks: Creating a DLL project. Adding a class to the DLL. Creating a console application that uses load-time dynamic linking to reference the DLL. Using the functionality from the class in the application. Running the application. This walkthrough creates a DLL that can only be called from applications that use C++ calling conventions. For information about how to create DLLs for use with other languages, see Calling DLL Functions from Visual Basic Applications. Prerequisites This topic assumes that you understand the fundamentals of the C++ language. To create a new dynamic link library (DLL) project On the menu bar, choose File, New, Project. In the left pane of the New Project dialog box, expand Installed Templates, Visual C++, and then select Win32. In the center pane, select Win32 Console Application. Specify a name for the project—for example, MathFuncsDll—in the Name box. Specify a name for the solution—for example, DynamicLibrary—in the Solution Name box. Choose the OK button. On the Overview page of the Win32 Application Wizard dialog box, choose the Next button. On the Application Settings page, under Application type, select DLL. Choose the Finish button to create the project. To add a class to the dynamic link library To create a header file for a new class, on the menu bar, choose Project, Add New Item. In the Add New Item dialog box, in the left pane, under Visual C++, select Code. In the center pane, select Header File (.h). Specify a name for the header file—for example, MathFuncsDll.h—and then choose the Add button. A blank header file is displayed. Add the following code to the beginning of the header file: // MathFuncsDll.h #ifdef MATHFUNCSDLL_EXPORTS #define MATHFUNCSDLL_API __declspec(dllexport) #else #define MATHFUNCSDLL_API __declspec(dllimport) #endif Add a basic class named MyMathFuncs to do common mathematical operations, such as addition, subtraction, multiplication, and division. The code should resemble this: namespace MathFuncs { // This class is exported from the MathFuncsDll.dll class MyMathFuncs { public: // Returns a + b static MATHFUNCSDLL_API double Add(double a, double b); // Returns a - b static MATHFUNCSDLL_API double Subtract(double a, double b); // Returns a * b static MATHFUNCSDLL_API double Multiply(double a, double b); // Returns a / b // Throws const std::invalid_argument& if b is 0 static MATHFUNCSDLL_API double Divide(double a, double b); }; } When the MATHFUNCSDLL_EXPORTS symbol is defined, the MATHFUNCSDLL_API symbol will set the __declspec(dllexport) modifier in the member function declarations in this code. This modifier enables the function to be exported by the DLL so that it can be used by other applications. When MATHFUNCSDLL_EXPORTS is undefined, MATHFUNCSDLL_API defines the __declspec(dllimport) modifier in the member function declarations. This modifier enables the compiler to optimize the importing of the function from the DLL for use in other applications. By default, MATHFUNCSDLL_EXPORTS is defined when your MathFuncsDll project is built. For more information, see dllexport, dllimport. Note If you are building the DLL project on the command line, use the /D compiler option to define the MATHFUNCSDLL_EXPORTS symbol. In the MathFuncsDll project in Solution Explorer, in the Source Files folder, open MathFuncsDll.cpp. Implement the functionality for MyMathFuncs in the source file. The code should resemble this: // MathFuncsDll.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" invalid_argument("b cannot be zero!"); } return a / b; } } Compile the dynamic link library by choosing Build, Build Solution on the menu bar. Note If you are using an Express edition that does not display a Build menu, on the menu bar, choose Tools, Settings, Expert Settings to enable it, and then choose Build, Build Solution. Note If you are building a project from the command line, use the /LD compiler option to specify that the output file should be a DLL. For more information, see /MD, /MT, /LD (Use Run-Time Library). Use the /EHsc compiler option to enable C++ exception handling. For more information, see /EH (Exception Handling Model). To create an application that references the dynamic link library To create a C++ application that will reference and use the DLL that you just created, on the menu bar, choose File, New, Project. In the left pane, under Visual C++, select Win32. In the center pane, select Win32 Console Application. Specify a name for the project—for example, MyExecRefsDll—in the Name box. Next to Solution, select Add to Solution from the drop-down list. This adds the new project to the same solution that contains the DLL. Choose the OK button. On the Overview page of the Win32 Application Wizard dialog box, choose the Next button. On the Application Settings page of the Win32 Application Wizard, under Application type, select Console application. On the Application Settings page, under Additional options, clear the Precompiled header check box. Choose the Finish button to create the project. To use the functionality from the class library in the console application After you create a new console application, an empty program is created for you. The name for the source file is the same as the name that you chose earlier. In this example, it is named MyExecRefsDll.cpp. To use in your application the math routines that you created in the DLL, you must reference it. To do this, select the MyExecRefsDll project in Solution Explorer, and then on the menu bar select Project, References. In the Property Pages dialog box, expand the Common Properties node, select Framework and References, and then choose the Add New Reference button. For more information about the References dialog box, see Framework and References, Common Properties, <Projectname> Property Pages Dialog Box. The Add Reference dialog box lists the libraries that you can reference. The Projects tab lists the projects in the current solution and any libraries they contain. On the Projects tab, select MathFuncsDll, and then choose the OK button. To reference the header files of the DLL, you must modify the included directories path. To do this, in the Property Pages dialog box, expand the Configuration Properties node, expand the C/C++ node, and then select General. Next to Additional Include Directories, specify the path of the location of the MathFuncsDll.h header file. (You can use a relative path—for example, ..\MathFuncsDll\.) Choose the OK button. You can now use the MyMathFuncs class in this application. Use the following code to replace the contents of MyExecRefsDll.cpp. //; try { cout << "a / 0 = " << MathFuncs::MyMathFuncs::Divide(a, 0) << endl; } catch (const invalid_argument &e) { cout << "Caught exception: " << e.what() << endl; } return 0; } Build the executable by selecting Build, Build Solution on the menu bar. To run the application Make sure that MyExecRefsDll is selected as the default project. In Solution Explorer, select MyExecRefsDll, and then on the menu bar, choose Project, Set As StartUp Project. To run the project, on the menu bar, choose Debug, Start Without Debugging. The output should resemble this: a + b = 106.4 a - b = -91.6 a * b = 732.6 a / b = 0.0747475 Caught exception: b cannot be zero! Next Steps Previous: Creating Reusable Code (C++) | Next: Walkthrough: Creating and Using a Static Library (C++) See Also Tasks Walkthrough: Deploying Your Program (C++) Concepts Other Resources Visual C++ Programming Methodologies
https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ms235636(v=vs.100)
CC-MAIN-2019-04
refinedweb
1,294
57.16
Wix Code gives you a lot of control over your dropdown lists and how they work with your data. You can manually define the list labels (what your visitors see) and their values (the value you save based on their selection) in the Manage Drop Down List panel. But you can also automatically create a dropdown list from a field in your collection. To do this, open the Connect to data panel for your dropdown and go to the Connect a List section. There are a few things to remember when you connect a dropdown list to your data. The collection you use to maintain your dropdown list does not have to be the same collection you use to store your user data. If you connect a dropdown list to your data it overrides the settings in the Manage Drop Down List panel. Also, both the labels and values of each item will be the same, based on your data. They cannot be set independently as you can in the Manage Drop Down List panel. Dear Jeff, when connecting drop down to data set, the drop down shows the exact list in the data set. Sometimes the Data set is repeated and we only want to show the list in drop down without the repeated value e.g data set is city list is New York Washington Alabama California Washington Washington Washington Alabama the drop down will show as above but what we really looking to show is: New York Washington Alabama California Any help with that thank you Hey 3shtar Unfortunately there's no easy way to do what you are asking in the UI. You would have to use a fair bit of code to get that done. Briefly, you would need to query the collection for the field you want to use as your list, remove the duplicates from the results of that query, and then use that list as the dropdown options list. In this scenario you aren't using the feature as I described it above, you are using code to create the same effect. Let me know if you are interested in trying to implement this and if you need help. dear Jeff it would be great if you share the query method of removing duplicates by code, who knows, it might help some who are looking for this. thank you Yes, Jeff that code snippet would be very helpful. It would be even neater if we could filter it based on another column value. So, show only cities and not states based on a separate column that identifies whether a given value is a city or a state. Hey 3shtar and rsuri.1 take a look here for the code 3shtar asked for. rsuri.1, I think this example is very close to what you want to accomplish. You just need to change the "if" to check the value in the other column you referred to, instead of it checking the other dropdown selection. Is there anyway to connect that drop down list with say a picture file? So when a drop down is choosen an image from the database is shown? Just love the power of wix code. Just getting started. Trying to display a list of instructors in the Activities page on the Instructors Name dropdown. It works 100% in the editor But in the live site... Both collections have the same Data type (Text). Can anyone help me? And you have synced the data from sandbox to live? And you have set the permissions on the data collection so everyone can read from it? Thank you Andreas. I checked the permission settings for the Collection I wanted to display in the Dropdown... and there it was.. Permissions for Admin ONLY. I changed it to ANYONE - now it is working!! Thanx again. Hey Scott, You can't do what you asked. Sorry. You can always add it to the Feature Requests. -Jeff Hi Jeff, Thank you so much for all the information you are giving. I have a search and two drop-downs to filter a gallery, search and first drop-down work, but the second one (categoria) doesn't... It doesn't return any results... Would it be possible for you to help me? Thanks in advance! import wixData from "wix-data"; let lastFilterTitle; let lastFilterUbicacion; let lastFilterCategoria; let debounceTimer; export function iTitle_keyPress_1(event, $w) { if (debounceTimer) { clearTimeout(debounceTimer); debounceTimer = undefined; } debounceTimer = setTimeout(() => { filter($w('#iTitle').value, lastFilterUbicacion); }, 200); } function filter(title, ciudad, categoria) { if (lastFilterTitle !== title || lastFilterUbicacion !== ciudad || lastFilterCategoria !== categoria) { let newFilter = wixData.filter(); if (title) newFilter = newFilter.contains('title', title); if (ciudad) newFilter = newFilter.eq('ciudad', ciudad); if (categoria) newFilter = newFilter.eq('categoria', categoria); $w('#dataset1').setFilter(newFilter); lastFilterTitle = title; lastFilterUbicacion = ciudad; lastFilterCategoria = categoria; } } export function iCity_change_1(event, $w) { filter(lastFilterTitle, $w('#iCity').value); } export function dropdown1_change(event, $w) { filter('categoria', $w('#dropdown1').value); } Hey Andres, Please post this to the Q&A forum. Thanks I have implemented a dropdown using a database collection using the selection to filter a subsequent dropdown from another database collection. I'm using this to build a quote request. I want the user to be able to be able to make additional selections from the same drop downs. To make it clear to the user I'd like the dropdowns to revert to their placeholder text. I have not been able to figure out how to make this happen. It will occur when a user presses a button so I have an event handler to put the code in I just can't figure out how to trigger the dropdowns to go back to their placeholder text. (I'd like the user to be able to reuse these dropdowns several times not just twice.) Tried setting the .value = ' '; as seen in sample code in this thread and it fixed my problem! @Jeff (Wix) I have started building a fairly extensive database collection. However, is there a limit on how many entries will show in a drop down. After adding quite a bit to the database, finding that only a portion of the categories are showing up in the drop down menu??? While on topic...if a database is created say in Excel, and you edit and manipulate the order of items, etc. You then import the list to the Wix database, what will the order of items be in the database column in Wix? Could someone please help me.. I am new to wix coding... So I have this list- I want the bottom two 'bathroom fixtures & Staffroom fixtures to expand and collaspe when clicked. So when for example 'Bathroom fixtures is clicked it will show another list -Hooks -Shelves -Soaps dishes etc Hey @Jeff (Wix), I am trying to setup a dynamic page that uses a dropdown menu to go to the different pages, I'm a little more than stuck. I've attached screenshots of what I'm trying to do... The website layout (Excuse the mess, I've decided to redesign the whole website this time around corvid elements) The menu fades out (It doesn't drop down, it is supposed to act as a menu) This is the data it is using: All of the posts I've looked at are older, and link to resources but it is difficult to understand without much explaination (as this is the best way for me to learn what I need to do in order to remember it for next time.) It would be best if it was step by step with reasoning explained to make it as helpful as possible. Sorry for the inconvenience, -Alain Please note that in this forum we do not provide custom coding solutions. If you feel like you're struggling with code and can't make it alone, please visit our WixArena where you can find pro designers and developers to help you build your site. If you would like to try to figure this out yourself, you can look at these examples that demonstrate using Dropdown: Cascading Form Remove Dropdown Duplicates Check Box Dropdown
https://www.wix.com/corvid/forum/wix-tips-and-updates/you-can-create-dropdown-lists-from-your-data
CC-MAIN-2020-10
refinedweb
1,350
72.05
• October 29, 2020 Getting started with Dask and SQL Lots of people talk about “democratizing” data science and machine learning. What could be more democratic — in the sense of widely accessible — than SQL, PyData, and scaling data science to larger datasets and models? Dask is rapidly becoming a go-to technology for scalable computing. Despite a strong and flexible dataframe API, Dask has historically not supported SQL for querying most raw data. In this post, we look at dask-sql, an exciting new open-source library that offers a SQL front-end to Dask. Follow along with this notebook. You can also load it up on Coiled Cloud if you want to access some serious Dask clusters for free with a single click! To do so, log into Coiled Cloud here, navigate to our example notebooks, and launch the dask-sql notebook. In this post, we: - Launch a Dask cluster and use dask-sql to run SQL queries on it! - Perform some basic speed tests, - Use SQL and cached data to turbocharge our analytics, - Investigate SQL built-in helper functions in dask-sql, - Provide an example of fast plotting from big data. Many thanks to Nils Braun, the creator of dask-sql, for his thoughtful and constructive feedback on this post. Launch a Dask cluster and get ready for SQL dask-sql is free + open source and will work with any Dask cluster, so you can run this (with minimal modification) on any environment. One easy way to spin up a cluster on AWS (Azure and GCP coming soon) is with Coiled Cloud. One reason it’s easy is that you don’t need to mess around with Docker and/or Kubernetes! That’s what we’ll do here and feel free to code along. If you haven’t signed up for the Coiled beta, you can do so for free with just a Github or Google ID here. Then we perform our imports and spin up our cluster! import coiled from dask.distributed import Client cluster = coiled.Cluster(n_workers=20) client = Client(cluster) client Next, we’ll install dask-sql . It’s a simple install but may take a minute or two. Analyze data in the cloud At this point, we’re ready to start querying data! Before we run our first SQL query, let’s test things out with a “starter” query on the dataset of interest: this query calculates the average tip amount by passenger count for the 2019 records in the NYC taxicab dataset. Then we’ll try it again in SQL. import dask.dataframe as dd df = dd.read_csv( "s3://nyc-tlc/trip data/yellow_tripdata_2019-*.csv", dtype={ "payment_type": "UInt8", "VendorID": "UInt8", "passenger_count": "UInt8", "RatecodeID": "UInt8", }, storage_options={"anon": True} ) df.groupby("passenger_count").tip_amount.mean().compute() Great! Our cluster and code are running. Now let’s try some SQL with dask-sql! dask-sql uses some code to “automagically” locate the JVM shared library we’ll need, but it doesn’t find the right path here in this cloud-deployed Jupyter container. We’ll give it a hint: As we’ll see later when we take a look under the hood, dask-sql uses a Java library to handle some of the query analysis, so we’ll give it a hint about the JVM path. import os os.environ["JAVA_HOME"] = "/opt/conda/lib/server" dask-sql uses a well-established Java library, Apache Calcite, to parse the SQL and perform some initial work on your query. It’s a good thing because it means that dask-sql isn’t reinventing yet another query parser and optimizer, although it does create a dependency on the JVM. Note that the speed drawback of starting and managing the JVM is only a problem when parsing the query, not when executing it. We’ll soon see that this doesn’t add significant overhead. from dask_sql import Context c = Context() This Context instance will let us run queries … but first we need some data sources. There are a number of ways to define data sources with dask-sql but one of the simplest is to supply a Dask Dataframe as the source. The Dask Dataframe: - is lazy, so it doesn’t retrieve the data until needed, - can discover the data schema, - supports out-of-core access — a fancy way of saying it does not need to actually load the data up into memory (e.g., maybe the data doesn’t fit in memory, or maybe you want that memory for other computations), - knows how to retrieve the data from the underlying source (e.g., “CSV files in S3”). To use the data in our SQL queries, we need to assign an identifier (a name) to it in dask-sql. The following code: - associates the table name taxi with df - creates a query to count the rows in this table - returns a handle to a lazy resultset in the form of a Dask dataframe c.register_dask_table(df, "taxi") result = c.sql('SELECT count(1) FROM taxi') result In almost all cases, running c.sql(…) will not actually run the full query, but just produces a Dask dataframe handle representing the results. (There are a couple of edge cases in the dask-sql docs that do trigger an immediate computation today, but the long term goal is to make as much lazy as possible.) How do we get our actual rowcount out? The same way we evaluate any other small Dask result that we want to retrieve: via .compute() result.compute() Ok, we’ve run our first dask-sql query and gotten results back! Speed test Now let’s revisit the “starter query” — the one that calculates the average tip amount by passenger count. We have two goals here: - Write the same query in Dask/Python and SQL, and see that they work and produce the same results, - Time the execution, to verify that SQL does not add any significant performance overhead - The SQL query gets processed and converted for Dask just once no matter how much data is involved, so it should not add any cost for nontrivial datasets. If you’re trying this out, this is also a great time to view the Dask task stream dashboard, to see the cluster in action. You can do this via the JupyterLab extension or through the Coiled Cloud GUI. %%time df.groupby("passenger_count").tip_amount.mean().compute() %%time c.sql('SELECT avg(tip_amount) FROM taxi GROUP BY passenger_count').compute() You should see the identical output (we saw around 25 seconds for both). Moreover, you should see near-identical wall-clock time. The SQL processing adds 100ms or less and is a constant, one-time cost. SQL + Cached data = turbocharged analytics Let’s see how we can accelerate analytics by caching this dataset in our cluster, and then running SQL queries against that cached data. This isn’t just fast, it’s whole-team-friendly because: - we can expose this dataset to other Dask analysts, incentivizing sharing a “large RAM pool” cluster for analytics over the data, - dask-sql exposes the Presto wire protocol, so folks using Presto compatible clients or visualization tools can access this data with zero programming! First, we’ll ask Dask to cache the table. dfp = df.persist() It may take a few seconds (or a lot more for really big datasets) to get loaded into cluster RAM. We can watch blocks load up in realtime in the Dask Graph dashboard. This shows tasks turn green as they compute and then red as the results are loaded in memory. In this case, each task retrieves a partition of the data from S3. In other situations, we may not want to watch a GUI, but programmatically wait for the data to be loaded. We can do that using distributed.wait(…) : import dask.distributed cached_tasks = dask.distributed.wait(dfp) print(f'cached {len(cached_tasks[0])} results') Next, we’ll give a new table name to this new cached flavor of the dataset (the dfp to which we assigned the result of df.persist above). dfp is a little opaque, so we’ll name this table taxi_cached. c.register_dask_table(dfp, "taxi_cached") As a quick test to see how much faster it is working out of memory, let’s count the rows again. result = c.sql('SELECT count(1) FROM taxi_cached') result.compute() Let’s also try that average tip by passenger count query, this time from cache. %%time c.sql('SELECT avg(tip_amount) FROM taxi_cached GROUP BY passenger_count').comput Not surprisingly, since working from the cached data removes most of the I/O, parsing, and ser/de from the job, it runs a lot faster than before. SQL built-in functions dask-sql also exposes a number of helper functions in SQL — just like traditional relational databases expose helper functions for math, date/time processing, string manipulation, and more. Here’s the floor function running on a static literal value: c.sql('SELECT floor(3.14)').compute() Using floor to discretize (or bin) the trip distances, we can look at a coarse-grained average fare for distance buckets. Our next query looks at rides with distances between 0 and 50, splits ( GROUP BY ) the binned ( floor() ) distance, and then for each of those bins, returns the floor’ed distance, the average fare, and the number of rides. Since we know — based on our query — that the report output will contain just 50 rows and 3 columns, we can safely compute it and get a result locally as a regular Pandas dataframe. If our results were much larger — or an intermediate transformation that we want to use in subsequent operations — we would either write it to persistent storage or keep the result in the cluster. After all, a big dataset will not fit in our local process, where the Dask Client and dask-sql Context objects live (note that the output of a dask-sql query can be feed into dask-sql again — making it possible to get an analog of “VIEWS” in SQL). %%time c.sql(""" SELECT floor(trip_distance) AS dist, avg(fare_amount) as fare, count(1) as t FROM taxi_cached WHERE trip_distance < 50 AND trip_distance >= 0 GROUP BY floor(trip_distance) """).compute() Due to Dask already implementing so many of the computation building blocks, dask-sql is able to cover most of the SQL components – including things such as subqueries, JOINs, and aggregations. Opportunity to contribute If you look at the dask-sql docs, you’ll notice that there aren’t that many helper functions implemented yet. For example, most databases have several date and time processing helper functions, and today dask-sql does not implement all of them. Most databases have several string processing helper functions, and today dask-sql just has one. This is a great opportunity to add valuable functionality and contribute to the library, since implementing many of these functions is just a matter of finding the existing Dask function and hooking it up. There are a ton of functions we might want to add, but each one is small, so it’s a great crowd-sourcing opportunity. You can see the existing implementations by clicking here. One more example: fast plotting from big data Since our results come back fast and as a Pandas DataFrame, we can easily make visualizations. This pattern can help us approach near-real-time interactive data exploration and visualization. If you don’t have matplotlib installed, you can install it with this command: ! conda install -y matplotlib -c conda-forge And now we can run a query and immediately plot a visualization of the result using Pandas plotting syntax! c.sql(""" SELECT floor(trip_distance) AS dist, avg(fare_amount) as fare FROM taxi_cached WHERE trip_distance < 50 AND trip_distance >= 0 GROUP BY floor(trip_distance) """).compute().plot(x='dist', y='fare') A peek under the hood How does the technology fit together? dask-sql relies on the well-established Apache Calcite (), a Java project, to - parse SQL - represent queries as a tree of operators - normalize and optimize queries - Calcite’s optimizer is extensible, so there are numerous “plug points” for adding more capabilities in the future That’s a lot! What’s left? The output from Calcite is a representation of a query as a tree of logical operators. These are things like projections (think of them as abstractions of SELECTs) and filters (abstractions of WHERE ). The next job of dask-sql is to provide plugins that convert from purely abstract operators to logic that expresses that operation in terms of Dask APIs. The results are still logical operators, but a bit more concrete — similar to what you would get if you wrote a Dask dataframe query yourself, so it’s ready to execute on your Dask cluster. At execution time, Dask provides physical implementations of the operations, which vary depending, e.g., on how your data is stored. Creating more opportunities Synergy is a cliche these days. But adding a SQL front-end to Dask enables a ton of new users and new uses cases to share state-of-the-art Python data solutions. For example, analysts and businesspeople who are fluent with SQL but don’t write imperative code can now leverage Dask, PyData, Coiled, and so much more … while collaborating with those who do prefer to code. Custom function support in dask-sql means coders can create simple wrappers around complex flows (e.g., applying a machine learning model to score records) and SQL users can create reports with those functions. Last, with database server capability via Presto (and perhaps soon JDBC, since Calcite includes JDBC support) it becomes possible to take a visualization solution like Tableau and point it at a Dask cluster for visual analytics at scale. Links: - Dask, Coiled and PyData - Dask SQL docs - Dask SQL source - Apache Calcite Lastly, if you like this approach, “feel the need for speed,” and have GPUs available, be sure to check out BlazingSQL, which offers a similar SQL+Dask architecture on top of GPU compute for mind-blowing query speeds. Turbocharge your data science For one-click hosted clusters and faster data science and analytics, try out Coiled Cloud for free today. Whether you’re interested in SQL databases or machine learning, we have plenty of ways for you to get up and running in our examples library.
https://coiled.io/getting-started-with-dask-and-sql/
CC-MAIN-2021-25
refinedweb
2,383
60.35
import "golang.org/x/image/bmp" Package bmp implements a BMP image decoder and encoder. The BMP specification is at. ErrUnsupported means that the input BMP image uses a valid but unsupported feature. Decode reads a BMP image from r and returns it as an image.Image. Limitation: The file must be 8, 24 or 32 bits per pixel. DecodeConfig returns the color model and dimensions of a BMP image without decoding the entire image. Limitation: The file must be 8, 24 or 32 bits per pixel. Encode writes the image m to w in BMP format. Package bmp imports 5 packages (graph) and is imported by 199 packages. Updated 2019-11-06. Refresh now. Tools for package owners.
https://godoc.org/golang.org/x/image/bmp
CC-MAIN-2019-51
refinedweb
119
60.11
SUSE Linux Enterprise Server for Raspberry Pi Raspberry. JumpZero Yeah! Great news John 64-Bits. Go! Peter Jones There is some documentation provided here. Maybe this needs adding to the main post? Robert That’s a great step forward. Now we just need a 4 GB RAM Pi4 ? to come out to make the most of the processor capability.. RoundDuckMan Isn’t there some advantage for the Pi3 anyways, like faster performance and other 64-bit advantages, besides the “you can use more than 4GB RAM” point? Carl Jacobsen Expanding the Pi to 4 GB of RAM isn’t just a matter of slapping on a few more RAM chips – they need to reengineer the SoC that is the heart of the Pi to change that limit – a non-trivial, and very expensive, task (at that point they’ll likely make numerous other improvements). It’ll happen, but don’t hold your breath. Enjoy the Pi 3B we have now. Lynn Fredricks Great news, and why not? Ill have to see if our Valentina Server 64 bit will work on it. Russell Davis I was a longtime SuSE user sounds like I will be a again EverPi Nice! Alan Mc (Irish Framboise) Tada! The great exciting announcements just keep coming, never quite got my system around Suse in the past, now might be time to try so. Good job folks. PeterF I’ve been running SuSE and openSuSE on Intel & AMD H/W since at least version 5.2 (Mar 1998!) and I’ve found it a very stable & productive environment. I’ve only dabbled a little with SLES, but I’m looking forward to getting this Pi version going asap. I’ve downloaded it. Now where’s an empty card… Great news, and thanks! Elfen Finally! Robert Cromer Now all you need is a RP4 that can support multiple disk drives (like SATA/NAS) and has twin NICs, then you would have the “teacher’s” computer. Since you now have PIXE booting, all students could be served for their OSs and a given day’s worth of course work. Better yet, place the above RP4 onto a single/double sided Compute Module board and also design a multiple 4-Core Processor based Compute Module. So you could have the “School’s” computer. Food for thought, Bob Cromer W. H. Heydt SSDs really remove the need for multiple drives unless you want to use RAID to protect against drive failure. Steelystar You forgot the Pi 3 does have two NICs: wired ethernet and WiFi! So PXE/TFTP/DHCP booting can be set for the ethernet port which would be connected to the switch that students’ Pis are plugged into as well. Then teacher continue to use the WiFi for normal activities and internet access, which may be better that way anyways since you don’t want those kids distracted on Facebook, etc. As for disk drives, you just answered your own question, which is a NAS (_NETWORK_ attached storage). In such usage it would probably be better to get a dedicated NAS device, with multiple drive slots for room to grow. Then enable network shares via CIFS/samba or NFS and configure PXE booting to redirect so the Pis mount and get files from there. So even with Pi 3 it is doable with much the same hardware, just a little thought into infrastructure and design. daniel obrien Free trial? Have to buy it? Hmmm. Simon Flood No, you can request a one year self-support subscription at W. H. Heydt Wow… Talk about coming around “full circle”… In 2002, I built a system around two AMD Opteron 240 CPUs and put SuSE 9.2 on it because it was the only 64-bit Linux available. That system has been my “benchmark” for where I’d like to see the Pi get to for use as a server. The Pi3 is actually pretty close. If the “Pi4B” is able to open up the speed for mass storage, I think it’ll be there, or–at least–close enough. Kevin So awesome!! Now I can finally run a familiar and supported server based environment at home on a tiny $35 box. But it seems like the Pi is sneaking its way even more into vertical markets and the corporate realm. I will be checking this out. I wonder which boot method they are using, with u-boot or the binary blob. In any case, SUSE has just thrown down the gauntlet. How will Red Hat and others respond??? Richard This is ace, and thank you to Electron752 who ever you are. :) fabo Up and running. There is some issue with registration and certificate and WLAN, but I play with only few minutes :-) fabo OK. Registration issue is about time settings and root rights. If you skip to register to SuSe with your code from SuSe registration during the installation, you have to register after. You need to set the right time and you have to registrate your installation to SuSe server using the command line using sudo: sudo SUSEConnect –regcode . Graphical tool from menu is missin relevant rights. TC Thanks Fabio. I found my way to sysconfig fine. Missed the time setting. The tip about time was the ticket. MW This presumably will install on the Raspberry Pi 2B new revision with the BCM2837 SoC ?? Simon Flood No, SUSE Linux Enterprise Server (SLES) for Raspberry Pi requireso a 64-bit Pi and the Pi 2B is 32-bit. Currently only the Pi 3 is supported as that’s the only 64-bit Pi currently available. azbest Fyi: There is a v1.2 raspi 2B with 64 bit Jeremy Not so, the new Pi2 (V1.2) has a 64-bit Cortex-a53 processor identical to the Pi3. Alec Clews So do we have any idea if the move to 64bit is worth it? How much bloat does it add to the binaries to use 64 vs 32 bit addressees? Is it slower or faster? I assume that with the move to 64 bit instruction set might be faster….. Remember that currently the Pi can’t have more that 1Gb of memory. Jeremy How much bloat does it add to the binaries to use 64 vs 32 bit addressees? No much that I have seen. All the 64-bit programs I have compiled have a smaller binary than the 32-bit version. As for memory size, it depends on your program. Max Is noticably faster/slower than 32bit? Marco Alvarado I was thinking the same … so I made some tests (very primitive, but they are just to figure how they work): The first case was with some integer based operations. They are comparable. But, in the second case, with float point operations, an openSUSE 64 bit is 4 times faster than a Raspbian 32 bit, both on RPI3 machines. This is very similar to a test I made thousands of years ago with the first Xeon 64 bit processors when comparing 32 vs 64 bit compiled programs. Take into consideration that the test only involved ONE core. As an extra comparison, a Mac with i7 2.3 GHz is 5 times faster than the openSUSE machine. I know this is not a perfect comparison, but I was trying to understand how expensive are the RPI3 machines comparing these results. In this case, the idea is to multiply the quantity of machines, and their price, needed to match the i7 base reference computer (again, forgetting Amdahl rule, cluster management and related stuff). MAC-i7 : 2 seconds ($800) / Base unit RPI3-32 : 43 seconds ($35) / 21.5 times slower ~ $752.5 needed RPI3-64 : 10 seconds ($35) / 5 times slower ~ $175 needed As can be seen, the RPI3 with Raspbian and 32 bit has a very similar final price to match the i7 on pure float point price. However, with 64 bits it is really much cheaper. But the real issue here is that you don’t need 100% of the time the i7 raw power, so to have RPI3 machines has a lot of sense because they help you to refine your investments. Note: The price for the MAC it is because it has 16GB RAM and it is the Quad Core model from 2012 that no longer exist (now they are dual core ones). Although a more “professional” comparison is needed — this is my “primitive” test source code: #include #include #include using namespace std; int main() { double numero = 1000000; time_t tinicial, tfinal; time(&tinicial); for (int a=0; a<100000000; a++) { double numero2 = numero / 3.15; numero2 = sqrt(numero) / sqrt(numero2); } time(&tfinal); cout << tfinal – tinicial << endl; } caperjack the download is only a trial and one has to sign up to get it ,,why Jeremy There is an OpenSUSE version I believe Mike Shock SUSE Linux is my favourite OS for many years already: at work and at home. It’s stable, reliable, convenient and stylish. And it’s really great that “chameleon” can now be used with “Raspberry Pi”! keamas Can I run real sever staff like on the normal SuSe Enterprise Server or is there any limitation of Software which would not run?. I am thinking about an SuSe directory, dhcp, dns server (like Windows AD). Packi FYI any linux computer can run “real” server software such as bind dns or openldap directory software. It is only the appropriate packages that needs to be installed to turn it into a server. Even Raspian can run those functions you mentioned to become your dedicated Windows AD server: yum install openldap dhcpd bind samba winbind Packi Sorry that previous command is for Centos that I am working on at the moment and was on my mind. For Raspian the corresponding packages are: apt-get install slapd isc-dhcp-server bind samba samba-common-bin Lionel Nice to hear. Now, just wait for raspbian on 64b ;) Electron752 Just wanted to let everyone know that you can build your own 64-bit kernel from the downstream tree(or upstream tree). I just reconfirmed that branch rpi-4.8.y from works. Just use the bcmrpi3_defconfig build config and the aarch64 cross compiler. As a warning I’m just a forum user, but I understand that the upstream tree is preferred for 64-bit support at. I don’t use u-boot, but I understand u-boot gives some extra security features and flexibility by implementing EUFI. I understand it’s possible to put grub in the boot process to enable menus. I think it also provides extra security features such as the ability to load the kernel at a random address. Richard Sierakowski Hi Electron752, Thanks for the great work on 64 bit. Hopefully this will speed up the inevitable move to 64 bit Raspbian even though it will be a major burden maintaining 32 and 64 bit versions. Richard jaltek openSUSE images and infos can be found at Winkleink Thank you. I will download from this link Winkleink The need to register with SUSE (just another login) means I’ll give this a skip for now. When Canonical get 64 bit Ubuntu running on the Pi3 then I will try it out. No super urgent need as of today. Still love seeing the advancement and the working being done by multiple Open Source communities to make the Pi even more awesome. Electron752 Just wanted to let you know that I was able to set Ubuntu Xenial LTS server to boot on a RPI 3 in ARM64 mode this morning. It seems to work just fine. Here are the basic steps: 1. Use debootstrap –arch arm64 –foreign pointed at to install from a X86 machine. 2. Copy over the kernel and run debootstrap –second-stage on the RPI 3. 3. Install tasksel using apt. 4. Run tasksel install server. Easy as PI:) It probably wouldn’t get hard to get their graphical installer to work by copying over the RPI linux kernel. fanoush Thank you for your whole 64bit on Pi effort. R One Hi all, Installing it needs a keyboard (user and root passwords must be typed). I didn’t need one for Raspbian (once Raspbian installed, I could ssh to it via the eth0 interface and insert the wlan0 passphrase via my tablet). Could the installation process have those fields preset so that just a mouse is enough to set the whole thing up ? /R One Milliways This may be an interesting interim development, but can anyone can suggest ANY benefit running a 64 bit OS on 1GB memory? It is hard to even imagine any benefit from mapping virtual memory to a SD Card or HDD on USB2? At best code will be slightly larger and marginally slower (due to longer instructions). Richard Please go and learn what 64 bit means in this use case. 64 bit has many facets that depend on CPU arch, ABI used and how default types are defined. Peddling miss information from your own miss understanding is not doing anyone any good. Advice from a grumpy old man with 25+ years coding experience, it is very hard to know what the impact is without working with a system for a while using with ASM and C/C++. I would say the only one who has a good understanding of the details of the port and the implications is Electron752. Jeff Suse was one of the best early distributions. It had a lot of amateur radio support. I will give it a try. Thank you! don isenstadt I downloaded it.. I am typing this comment from suse .. it comes with firefox only .. putting the image on a sd from the mac using the dd command did not work.. wound up changing .raw to .img and using apple pi baker .. that did work .. and took 5 mins. could not configure my wifii on initial config so successfully used eth0 and configured the wifii after running. This makes me really REALLY appreciate pixel and raspian … the are so easy to use and posished compared to this. Lots of things are not there . ie. htop NTP not configured. .Poor display support .. ie. my 40 inch vizeo hdmi tv did not work but my 20 in samsung dvi display via hdmi converter did. It does not seem to run any quicker than raspbian. The boot up is much slower. It was interesting to install it and use it .. I am sure over time it will get better .. Richard A big plus for many of us who actually do intensive research and education work in science and engineering is the free Mathematica that comes with the Raspian distribution. Without the 64 bit free Mathematica, I see little advantage in going 64 bit, other than when one wants to do number crunching. EPTON, if you are listening, PLEASE continue on with developing a 64 bit Raspian and getting a new, 64 bit version of Mathematica that comes with the distribution. The Mathematica is a very expensive program to have to buy or license for a private individual, and dramatically increases the value and usefulness of the Pi and the Raspian distribution. se has No sound Jay My Logitech wireless USB k700 mouse and keyboard combo does not work from my research it seems to be a kernel issues. Have not got past that issue. David Glad to see this thread on the RaspberryPi.org site. Sending this via Firefox running on SUSE on a Pi-3. Had tried kraxel’s 64-bit Fedora 24 over the summer, but various parts of it didn’t work. Got SUSE up and running in and hour or two (long time to dd on my Mac, and it seemed to have failed but hadn’t). So far it feels just like a regular distribution — things just work, for the most part. Some problems on startup, notably getting WiFi configured. But getting an X window from SUSE onto my Mac — haven’t figured that out yet; wants to work but doesn’t. And term window fonts are terribly small, and it’s been a long time since I’ve had to set XResources. I’ve gotten accustomed to setting such properties from the app itself. Can’t see how to do that in SUSE. Coming from Raspbian and Fedora, just another learning curve. But sync’d Firefox with my Mac version and it works fine. SUSE seems *much* faster than kraxel’s 64-bit Fedora 24, both boot and desktop operation. Seems about the same as Raspbian 32-bit. Ran an old FORTRAN chemistry program (double-precision arithmetic) and it ran about the same speed as Raspbian. Looks like the compiler doesn’t use the 64-bit NEON very well. But ARMv8 assembly code really does assemble and run (won’t run on Raspbian, which is running in 32-bit ARMv7 mode). So if you’re interested in learning the ARMv8 architecture (which was my motivation), then this is a quick and easy way to get started. Just costs you a microSD card, a little time, and not much frustration. FRANCIS M DOWN I have now run Suse on an IBM mainframe and the Pi. Wow. I spent about an hour playing with Suse on the Pi, seems to be a very nice port, no real problems. When I get some time I will put some serious Java on it and see how it runs under Tomcat. Exaga Building a working aarch64 (arm64) kernel for the raspberry pi 3 is not rocket science. Anybody can do it. As with all things, you just need the right knowledge. It’s similar to baking a cake. The above guide will show you how. Speedz Installed fine, ran ok, but their reg key activation needs a little work. It refuses the key they gave. Pretty much a waste of time today. Format, and back to 32bit until a 64bit Raspbian or Ubuntu is done up. orca68 I’m a SUSE Linuxer since the advent of SUSE on the market. My university hosted one of the first PD Downloads for SuSE. I’m very happy that I can use my favorite Linux on my newest toy :) Great! Thanks to the SUSE Dev Team Nobody of Import They need to work on it. It *DOESN’T* rate the rep SuSE carries. 1) If, for example, you are using a PiTop (Straight up HDMI monitor, folks) it doesn’t boot up to graphics- it’s trashed on the display, but it boots up clean hooked up to a TV HDMI jack. 2) A standard HID keyboard via a Unifying jack doesn’t work. PERIOD. I couldn’t get past the initial config screens on a TV. FAIL on both counts and counts as a “brown paper bag” release (as in what Linus called at least one Linux release- as in put a brown paper bag over your head and hide in shame…)
https://www.raspberrypi.org/blog/suse-linux-enterprise-server-for-raspberry-pi/
CC-MAIN-2021-10
refinedweb
3,157
73.37
Question: I'm processing a list of thousands of domain names from a DNSBL through dig, creating a CSV of URLs and IPs. This is a very time-consuming process that can take several hours. My server's DNSBL updates every fifteen minutes. Is there a way I can increase throughput in my Python script to keep pace with the server's updates? Edit: the script, as requested. import re import subprocess as sp text = open("domainslist", 'r') text = text.read() text = re.split("\n+", text) file = open('final.csv', 'w') for element in text: try: ip = sp.Popen(["dig", "+short", url], stdout = sp.PIPE) ip = re.split("\n+", ip.stdout.read()) file.write(url + "," + ip[0] + "\n") except: pass Solution:1 Well, it's probably the name resolution that's taking you so long. If you count that out (i.e., if somehow dig returned very quickly), Python should be able to deal with thousands of entries easily. That said, you should try a threaded approach. That would (theoretically) resolve several addresses at the same time, instead of sequentially. You could just as well continue to use dig for that, and it should be trivial to modify my example code below for that, but, to make things interesting (and hopefully more pythonic), let's use an existing module for that: dnspython So, install it with: sudo pip install -f dnspython And then try something like the following: import threading from dns import resolver class Resolver(threading.Thread): def __init__(self, address, result_dict): threading.Thread.__init__(self) self.address = address self.result_dict = result_dict def run(self): try: result = resolver.query(self.address)[0].to_text() self.result_dict[self.address] = result except resolver.NXDOMAIN: pass def main(): infile = open("domainlist", "r") intext = infile.readlines() threads = [] results = {} for address in [address.strip() for address in intext if address.strip()]: resolver_thread = Resolver(address, results) threads.append(resolver_thread) resolver_thread.start() for thread in threads: thread.join() outfile = open('final.csv', 'w') outfile.write("\n".join("%s,%s" % (address, ip) for address, ip in results.iteritems())) outfile.close() if __name__ == '__main__': main() If that proves to start too many threads at the same time, you could try doing it in batches, or using a queue (see for an example) Solution:2 The vast majority of the time here is spent in the external calls to dig, so to improve that speed, you'll need to multithread. This will allow you to run multiple calls to dig at the same time. See for example: Python Subprocess.Popen from a thread . Or, you can use Twisted ( ). EDIT: You're correct, much of that was unnecessary. Solution:3 I'd consider using a pure-Python library to do the DNS queries, rather than delegating to dig, because invoking another process can be relatively time-consuming. (Of course, looking up anything on the internet is also relatively time-consuming, so what gilesc said about multithreading still applies) A Google search for python dns will give you some options to get started with. Solution:4 In order to keep pace with the server updates, one must take less than 15 minutes to execute. Does your script take 15 minutes to run? If it doesn't take 15 minutes, you're done! I would investigate caching and diffs from previous runs in order to increase performance. Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com EmoticonEmoticon
http://www.toontricks.com/2019/05/tutorial-increasing-throughput-in.html
CC-MAIN-2019-22
refinedweb
574
59.4
FlutterUPI Plugin A flutter plugin to invoke UPI apps on the phone for Android and get the transaction information in response. This plugin supports only Android as of now. Getting Started Simply import the plugin import 'package:flutter_upi/flutter_upi.dart'; And then use the initiateTransaction method as shown in the code below. String response = await FlutterUpi.initiateTransaction( app: FlutterUpiApps.PayTM, pa: "receiver@upi", pn: "Receiver Name", tr: "UniqueTransactionId", tn: "This is a transaction Note", am: "5.01", mc: "YourMerchantId", // optional cu: "INR", url: "", ); print(response); The response is a String that contains all the relevant information. Here is how the String looks like. txnId=PTM2008fadf6e7242a4a86d72daef6efa66&responseCode=0&ApprovalRefNo=913338799016&Status=SUCCESS&txnRef=TR1234 Please note that some parameters in the response can be undefined when using different apps. Parsing the Response You can write your own logic to parse the response string or you can use the FlutterUpiResponse class to create a Map out of it. FlutterUpiResponse flutterUpiResponse = FlutterUpiResponse(response); print(flutterUpiResponse.txnId); // prints transaction id print(flutterUpiResponse.txnRef); //prints transaction ref print(flutterUpiResponse.Status); //prints transaction status print(flutterUpiResponse.approvalRefNo); //prints approval reference number print(flutterUpiResponse.responseCode); //prints the response code Supported Apps and Platforms As of now the plugin only supports Android. Since I am not an iOS developer, I have only been able to write the code for Android. If you are interested, feel free to get in touch or create PR if you can do this for iOS as well. The plugins supports three apps as of now which I have tested this plugin with. You can use the predefined constants in the FlutterUpiApps class and pass it to the app named argument in the initiateTransaction method. FlutterUpiApps.BHIMUPI will launch the BHIM UPI App FlutterUpiApps.GooglePay will launch the GooglePay App FlutterUpiApps.PayTM will launch the PayTM App FlutterUpiApps.PhonePe will launch the PhonePe App FlutterUpiApps.MiPay will launch the MiPay App FlutterUpiApps.AmazonPay will launch the AmazonPay App FlutterUpiApps.TrueCallerUPI will launch the TrueCallerUPI App FlutterUpiApps.MyAirtelUPI will launch the MyAirtelUPI App Error Responses The response String can contain any of the following strings as well. app_not_installed : Application not installed. invalid_params : Request parameters are wrong. user_canceled : User canceled the flow. null_response : No data received. You need to write your own code to handle these responses in your app. Check out the example folder for more implementation details.
https://pub.dev/documentation/flutter_upi/latest/
CC-MAIN-2020-45
refinedweb
393
52.66
Core Exception Handling-Error Messages in Program Exception Handling-Error Messages in Program Hi Friend, I am having... with this. Here is the code with the error messages as Follows: import...[]) throws Exception{ This is where I begin to see problems with error messages Core Java Interview Question Page 1 ; Question: How could Java classes direct program messages to the system console, but error messages, say to a file... classes, you have to inherit your class from it and Java does not allow multiple CoreJava Project CoreJava Project Hi Sir, I need a simple project(using core Java, Swings, JDBC) on core Java... If you have please send to my account classes and data abstraction - Java Beginners classes and data abstraction Create a java program for a class named... will be part of another output messages and needs to begin and end with a blank character. Use the following messages: If currencyType is 'd', output the string corejava - Java Beginners corejava pass by value semantics Example of pass by value semantics in Core Java. Hi friend,Java passes parameters to methods using pass... with respect to Java's references to objects and pass by reference calling semantics Classes in Java Classes in Java  ... in Java. The exceptions that occur in the program can be caught using try... of the program. An exception is an event that occurs and interrupts write a java program that implements the following classes: write a java program that implements the following classes: write a java program that implements the following classes: A) are subclasses of the circle class. All these classes should Program - Java Beginners Java Program Hi I have this program I cant figure out. Write a program called DayGui.java that creates a GUI having the following properties: Object- Property- Setting- JFrame Name mainFrame creating java classes creating java classes Create a Java class that can be used to store inventory information about a book. Your class should store the book title... a program that tests your class by creating and using at least two objects of the class Exception Handling-Error Messages in Program Exception Handling-Error Messages in Program Sorry about the first code block: import java.util.*; class GradeException extends Exception{ public GradeException(String s){ System.out.println(s); } } ----jGRASP exec: javac -g C corejava CoreJava creating java classes creating java classes This program uses a class named DrivingLicense... program to ensure that it generates the following output. Alice does NOT have... license /* Class: DLTest.java Description:Test program Java classes Java classes are like a group under which all objects and methods... examples that will help beginners in Java understand the definition of Java classes... of Java classes, object and its methods. Here in order to determine Area Direct Web Remoting Direct Web Remoting Direct Web Remoting is a framework for calling Java methods directly from Javascript code, Like SAJAX, can pass calls from Javascript into Java methods and back Java Classes Java Classes conducted online by Roseindia include an elite panel of some... that if a beginner starts taking a Java classes online here, than he/she at the completion of the program becomes a Java professional and at later stage becomes Exception Classes Exception Classes The hierarchy of exception classes commence from Throwable class which is the base class for an entire family of exception classes, declared in  Java Program - Java Beginners Java Program Hi I have this program I cant figure out. Write a program called DayGui.java that creates a GUI having the following properties..."); JFrame mainFrame=new JFrame("Messages"); mainFrame.setLayout(new FlowLayout Which class is extended by all other classes how to create classes for lift program how to create classes for lift program i would like to know creating classes for lift Java Calculator Program Java Calculator Program Hi, so I need to make a program that "works... Class and need to implement the children classes, which are Number, Product, Sum... two messages: the toString() method which will provide a String representation Database books Page11 of these messages apply only to the mainframe transaction and are important...; The Open ClientConnect and Open ServerConnect Messages and Codes This book describes the messages and codes that are returned by the Open wrapper classes of the primitive wrapper classes in Java are immutable i.e. once assigned a value...wrapper classes Explain wrapper classes and their use? Java Wrapper Class Wrapper class is a wrapper around a primitive data type how to run java program that has several classes under package from usb drive? how to run java program that has several classes under package from usb drive... command line and it works. I copied all java files and class files to flash drive... a1.cis568 under this package I have several classes. main class is A1.java and other list of uninstantiated classes Java list of uninstantiated classes Java list of uninstantiated classes classes in c++ classes in c++ 1- design and implement a class datatype that implement the day of the week in the program.the class datatype should store the day... on this class. Here is the Java code: public class DayType{ final java classes. - Java java program java program You need to keep record of under- graduate, PhD.... Write constructor for all the classes, and override method Get_info() for all the classes. Create a TA class which is derived from PhD_ student and Faculty Collection classes in java is the reason using java collection classes saved/stored the data/content.I don't understand, what is the idea using java collection classes in project. Or the data is stored in both database and java collection classes Tomahawk messages tag Tomahawk messages tag  ... which is also used to show all messages at one place for the components. Two layouts are supported for generated messages, table and list Classes and Objects -oriented programming. Nested Classes: One more advantage of Java... Classes and Objects Objects and classes are the fundamental parts of object-orientated programming technique. A class Nested classes: Examples and tutorials Nested classes: Examples and tutorials Nested classes Here is another advantage of the Java... within another class, such class is called a nested class. Inner classes can Java FontMetrics classes Java FontMetrics classes What is the difference between the Font and FontMetrics classes? The Font class provides mappings to fonts that are used to render text data onto the screen. The Font class maps JSF messages Tag JSF messages Tag This tag is also like message tag which is also used to show all messages... for generated messages, table and list. If layout is not specified then it takes list Member Classes, Inner Nested Classes in java Member Classes Member classes are defined within the body of a class. We can use member classes anywhere within the body of the containing class. We declare member classes classes - Java Beginners Program Program a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes Java Program - Java Beginners Java Program Hi i have this program I can't figure it out. Write a program called InheritanceTest.java to support an inheritance hierarchy... classes. Write a program that instantiates objects of your classes, test all instance Open Source program Open Source program Applications for Open Sound System SLab Direct... on this page are source code and libraries that will enable you to program sound... own risk. Just because a program, book or service is listed here or has a good java program - Java Beginners . Notice 1: You are not allowed to use any of the classes in the Java Class Library...java program ( JUnit Tests) 1. JUnit test (CollectionTest.java) for the classes, verifying the correctness of each method. 2.First implement Advanced Concepts with Classes - JDBC the classes and write a test program to verify that the classes function correctly...Advanced Concepts with Classes Advanced Concepts with Classes... you Employees in a company are divided into the classes Employee, HourlyPaid java web program java web program A stateLess Session Bean program has the following classes: 1 CreateCustomerClient 2 CustomerBean 3 CustomerDeatails 4... program to create table customer , insert values into the table customer program program write a program different between to dates in terms of days in java Summary: Classes, Interfaces Java: Summary: Classes, Interfaces Packages package package-name; Class Definition A class definition prototype: visibility class class-name [extends parent-class] [implements interface-name...] { class-body } nameMeaning Abstract Classes - Java Interview Questions Abstract Classes Why we cann't instantiate a Abstract Classes? Even if an Abstract Class does not have any abstract methods, but declaring the class...:// Thanks (Roseindia Team program program Write a JSP Program, which displays a web page containing... of practical classes of your Batch. When one click on link for getting your profile... for classes schedule another JSP page will open to show the schedule Struts Action Classes Struts Action Classes 1) Is necessary to create an ActionForm to LookupDispatchAction. If not the program will not executed. 2) What is the beauty of Mapping Dispatch Action program program WAP a java program to form 1/2+3/4+5/6+7/8 series Program Program Define an Abstract class DigitalCamera with instance variables like make, model, resolution, etc, and create() to set the details of camera. Use three sub classes for three different makes (eg. Canon, Olympus, Sony program program explanation of program on extending thread class Hi Friend, Please go through the following link: Java Threads Thanks
http://www.roseindia.net/tutorialhelp/comment/32448
CC-MAIN-2014-10
refinedweb
1,603
53.81
The official pCloud Swift SDK for iOS and macOS for integration with the pCloud API. You can find the full documentation here. For instructions on how to migrate to v3 of the SDK, please refer to the release notes of v3.0.0 in the source repository. In order to use this SDK, you have to register your application in the pCloud App Console. Take note of the app key in the main page of your application once you create it. The SDK uses an OAuth 2.0 access token to authorize requests to the pCloud API. You can obtain a token using the SDK's authorization flow. To allow the SDK to do that, find the 'Redirect URIs' section in your application configuration page and add a URI with the following format: pclsdk-w-YOUR_APP_KEY://oauth2redirect where YOUR_APP_KEY is the app key from your app console. You can integrate the SDK into your project using any of the following methods: CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. If you do not already use CocoaPods, you can check out how to get started with it here. First you should install CocoaPods: $ gem install cocoapods Then navigate to your project root and run pod init. This will create a file called Podfile. Open it and add pod 'PCloudSDKSwift' to your target. Your Podfile should look something like this. use_frameworks! target 'YOUR_TARGET_NAME' do pod 'PCloudSDKSwift' end Then run the following command to install the SDK and integrate it into your project: pod install Once the SDK is integrated into your project, you can pull SDK updates using the following command: pod update Carthage is a simple, decentralized dependency manager for Cocoa. If you don't already use Carthage, you can check out how you can install it here. To install the pCloud Swift SDK via Carthage, you need to create a Cartfile in your project (This file lists the frameworks you’d like to use in your project.) with the following contents: github "" Then, run the following command (This will fetch dependencies into a Carthage/Checkouts folder and build each one): carthage update --platform iOS In the Project Navigator in Xcode, select your project, then select your target, then navigate to General > Linked Frameworks and Libraries, and drag and drop PCloudSDKSwift.framework from Carthage/Build/iOS. Then, on your application targets’ Build Phases settings tab, click the + button and choose New Run Script Phase. In the newly-created Run Script section, add the following code to the script body area: /usr/local/bin/carthage copy-frameworks Then navigate to the Input Files section and add the path to the framework: $(SRCROOT)/Carthage/Build/iOS/PCloudSDKSwift.framework carthage update --platform Mac In the Project Navigator in Xcode, select your project, and then navigate to General > Linked Frameworks and Libraries, then drag and drop PCloudSDKSwift.framework from Carthage/Build/Mac. Then, on your application target’s Build Phases settings tab, click the + icon and choose New Copy Files Phase. In the newly-created Copy Files section, click the Destination drop-down menu and select Products Director, then drag and drop PCloudSDKSwift.framework.dSYM from Carthage/Build/Mac. The pCloud SDK can be integrated into your project using the Swift Package Manager. Currently, SPM support has only been added for the iOS platform. To integrate the SDK into your project, you need to specify the repository's URL: For more information, please refer to the official documentation. Once integrated into your project, the SDK needs to authenticate a user in order to make API calls. The SDK has a pre-defined flow for obtaining a user. It attempts to authenticate the user via a ASWebAuthenticationSession if the current OS version allows it. Otherwise it opens a web view inside your app and loads the pCloud authorization page where the user can log in and authorize your app. To use the authorization flow: PCloudinstance In the app delegate: import PCloudSDKSwift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { PCloud.setUp(withAppKey: "YOUR_APP_KEY") } import PCloudSDKSwift func applicationDidFinishLaunching(_ notification: Notification) { PCloud.setUp(withAppKey: "YOUR_APP_KEY") } To start the authorization flow, call PCloud.authorize(with:_:) and provide a view controller and a block to be invoked once authorization completes or is cancelled by the user. The view controller is automatically dismissed before the completion block is called. From your view controller: import PCloudSDKSwift // Inside a UIViewController subclass. func logInButtonTapped(_ sender: UIButton) { PCloud.authorize(with: self) { result in if case .success(_) = result { // You can make calls via the SDK. } } } This will either attempt to authenticate using ASWebAuthenticationSession or will present a view controller with a web view from the view controller passed to the method. import PCloudSDKSwift // Inside an NSViewController subclass. func logInButtonTapped(_ sender: NSButton) { PCloud.authorize(with: self) { result in if case .success(_) = result { // You can make calls via the SDK. } } } This will either attempt to authenticate using ASWebAuthenticationSession or will present a view controller with a web view as a sheet from the view controller passed to the method. Once PCloud.authorize(with:_:) finishes successfully, you can start making API calls via a global PCloudClient instance accessible via PCloud.sharedClient. Furthermore, your access token is stored in the device's keychain, so the next time your app is launched, the shared client instance will be initialized inside the PCloud.setUp(withAppKey:) call. This is a more flexible approach to using the SDK. However, it requires you to do a bit more work. Using this approach also delegates management of the access token to you. You can manually create a PCloudClient instance with an access token. Manually managing the lifetime of this instance might be a lot more convenient for you in certain cases. To request an access token without automatically initializing the shared client instance: OAuth.performAuthorizationFlow(with: anchor, appKey: "YOUR_APP_KEY") { result in if case .success(let user) = result { let client = PCloud.createClient(with: user) // Use the client. } } where anchor would be an instance of UIWindow on iOS or NSWindow on macOS. This method will attempt to authenticate via a ASWebAuthenticationSession, which is the recommended way of authenticating. It requires, however, iOS 13 / macOS 10.15. Another option is to use: OAuth.performAuthorizationFlow(with: view, appKey: "YOUR_APP_KEY") { result in if case .success(let user) = result { let client = PCloud.createClient(with: user) // Use the client. } } where view would be an instance of WebViewControllerPresenterMobile on iOS or WebViewControllerPresenterDesktop on macOS. Once you have an authorized client, you can try some API requests using the SDK. To begin, create a reference to your PCloudClient instance: let client = PCloud.sharedClient // When using the authorization flow The SDK comes with the most common API requests predefined and has exposed them through the PCloudClient instance as methods. Each method returns a non-running task object representing the API request. Once you have obtained a task, you can assign callback blocks to it and start it. Once a task completes it produces a Result value. There are three types of tasks: Performs an RPC request. On success produces the pre-parsed response of the request. On failure, produces a CallError value. import PCloudSDKSwift client.createFolder(named: "Movies", inFolder: Folder.root) .addCompletionBlock { result in // Handle result } .start() Performs an upload. On success produces the metadata of the uploaded file. On failure, produces a CallError value. import PCloudSDKSwift client.upload(fromFileAt: "", toFolder: Folder.root, asFileNamed: "song.mp3") .addProgressBlock { uploaded, total in // Handle progress } .addCompletionBlock { result in // Handle result } .start() Downloads a file. On success, produces the URL of the downloaded file. On failure, produces a NetworkOperationError value. import PCloudSDKSwift let link: FileLink.Metadata client.downloadFile(from: link.address, downloadTag: link.downloadTag, to: { path in // Move the file }) .addCompletionBlock { result in // Handle completion } .addProgressBlock { written, total in // Handle progress } .start() Once started, a task can stop if it succeeds, fails or if it is cancelled. Since tasks are not reusable, once a task stops running in any way, it can no longer be started again. The completion block of a task will only be called if a task fails or succeeds, not when it is cancelled. Also, all of a task's callback blocks are called on the main queue. A task will be retained in memory while it is running, so there is no need to manually keep a reference to it, given that you start the task at the time of creation. Upload and RPC call tasks fail with a CallError. This enum combines the possible errors from the networking layer and the PCloud API layer. One of the possible errors is CallError<T>.methodError(T) and the suberror there will depend on the API method being executed by the task. All API methods are defined in PCloudAPI.swift and each one has an Error enum defined in its namespace. So, for example, if you are executing a ListFolder API method, the task error would be defined as CallError<ListFolder.Error>. Some API methods (e.g. UserInfo) cannot fail with anything else than generic API errors so they will define their error as NullError. Such tasks can never fail with CallError<T>.methodError(T). An example app can be found in the Example_iOS folder. The example app demonstrates how to authenticate a user and how to list a user's files and folders. Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API
https://swiftpack.co/package/pCloud/pcloud-sdk-swift
CC-MAIN-2021-21
refinedweb
1,560
58.58
Building a Better Profanity Detection Library with scikit-learn Why existing libraries are uninspiring and how I built a better one. A few months ago, I needed a way to detect profanity in user-submitted text strings: I ended up building and releasing my own library for this purpose called profanity-check. Of course, before I did that, I looked in the Python Package Index (PyPI) for any existing libraries that could do this for me. The only half decent results for the search query “profanity” were: - profanity (the ideal package name) - better-profanity: “Inspired from package profanity of Ben Friedland, this library is much faster than the original one.” - profanityfilter (has 31 Github stars, which is 30 more than most of the other results have) - profanity-filter (uses Machine Learning, enough said?!) Third-party libraries can sometimes be sketchy, though, so I did my due diligence on these 4 results. profanity, better-profanity, and profanityfilter After a quick dig through the profanity repository, I found a file named wordlist.txt: The entire profanity library is just a wrapper over this list of 32 words! profanity detects profanity simply by looking for one of these words. To my dismay, better-profanity and profanityfilter both took the same approach: better-profanityuses a 140-word wordlist profanityfilteruses a 418-word wordlist This is bad because profanity detection libraries based on wordlists are extremely subjective. For example, better-profanity’s wordlist includes the word “suck.” Are you willing to say that any sentence containing the word “suck” is profane? Furthermore, any hard-coded list of bad words will inevitably be incomplete — do you think profanity’s 32 bad words are the only ones out there? Having already ruled out 3 libraries, I put my hopes on the 4th and final one: profanity-filter. profanity-filter profanity-filter uses Machine Learning! Sweet! Turns out, it’s really slow. Here’s a benchmark I ran in December 2018 comparing (1) profanity-filter, (2) my library profanity-check, and (3) profanity (the one with the list of 32 words): I needed to be able to perform many predictions in real time, and profanity-filter was not even close to being fast enough. But hey, maybe this is a classic tradeoff of accuracy for speed, right? Nope. None of the libraries I’d found on PyPI met my needs, so I built my own. Building profanity-check, Part 1: Data I knew that I wanted profanity-check to base its classifications on data to avoid being subjective (read: to be able to say I used Machine Learning). I put together a combined dataset from two publicly-available sources: - the “Twitter” dataset from t-davidson/hate-speech-and-offensive-language, which contains tweets scraped from Twitter. - the “Wikipedia” dataset from this Kaggle competition published by Alphabet’s Conversation AI team, which contains comments from Wikipedia’s talk page edits. Each of these datasets contains text samples hand-labeled by humans through crowdsourcing sites like Figure Eight. Here’s what my dataset ended up looking like: The Twitter dataset has a column named classthat’s 0 if the tweet contains hate speech, 1 if it contains offensive language, and 2 if it contains neither. I classified any tweet with a classof 2 as “Not Offensive” and all other tweets as “Offensive.” The Wikipedia dataset has several binary columns (e.g. toxicor threat) that represent whether or not that text contains that type of toxicity. I classified any text that contained any of the types of toxicity as “Offensive” and all other texts as “Not Offensive.” Building profanity-check, Part 2: Training Now armed with a cleaned, combined dataset (which you can download here), I was ready to train the model! I’m skipping over how I cleaned the dataset because, honestly, it’s pretty boring— if you’re interested in learning more about preprocessing text datasets check out this article or this post. import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.calibration import CalibratedClassifierCV from sklearn.svm import LinearSVC from sklearn.externals import joblib # Read in data data = pd.read_csv('clean_data.csv') texts = data['text'].astype(str) y = data['is_offensive'] # Vectorize the text vectorizer = CountVectorizer(stop_words='english', min_df=0.0001) X = vectorizer.fit_transform(texts) # Train the model model = LinearSVC(class_weight="balanced", dual=False, tol=1e-2, max_iter=1e5) cclf = CalibratedClassifierCV(base_estimator=model) cclf.fit(X, y) # Save the model joblib.dump(vectorizer, 'vectorizer.joblib') joblib.dump(cclf, 'model.joblib') Two major steps are happening here: (1) vectorization and (2) training. Vectorization: Bag of Words I used scikit-learn’s CountVectorizer class, which basically turns any text string into a vector by counting how many times each given word appears. This is known as a Bag of Words (BOW) representation. For example, if the only words in the English language were the, cat, sat, and hat, a possible vectorization of the sentence the cat sat in the hat might be: The ??? represents any unknown word, which for this sentence is in. Any sentence can be represented in this way as counts of the, cat, sat, hat, and ???! Of course, there are far more words in the English language, so in the code above I use the fit_transform() method, which does 2 things: - Fit: learns a vocabulary by looking at all words that appear in the dataset. - Transform: turns each text string in the dataset into its vector form. Training: Linear SVM The model I decided to use was a Linear Support Vector Machine (SVM), which is implemented by scikit-learn’s LinearSVC class. This post and this tutorial are good introductions if you don’t know what SVMs are. The CalibratedClassifierCV in the code above exists as a wrapper to give me the predict_proba()method, which returns a probability for each class instead of just a classification. You can pretty much just ignore it if that last sentence made no sense to you, though. Here’s one (simplified) way you could think about why the Linear SVM works: during the training process, the model learns which words are “bad” and how “bad” they are because those words appear more often in offensive texts. It’s as if the training process is picking out the “bad” words for me, which is much better than using a wordlist I write myself! A Linear SVM combines the best aspects of the other profanity detection libraries I found: it’s fast enough to run in real-time yet robust enough to handle many different kinds of profanity. Caveats That being said, profanity-check is far from perfect. Let me be clear: take predictions from profanity-check with a grain of salt because it makes mistakes. For example, its not good at picking up less common variants of profanities like “f4ck you” or “you b1tch” because they don’t appear often enough in the training data. You’ll never be able to detect all profanity (people will come up with new ways to evade filters), but profanity-check does a good job at finding most. profanity-check profanity-check is open source and available on PyPI! To use it, simply $ pip install profanity-check How could profanity-check be even better? Feel free to reach out or comment with any thoughts or suggestions! This article was originally posted on Medium.
https://victorzhou.com/blog/better-profanity-detection-with-scikit-learn/
CC-MAIN-2021-17
refinedweb
1,219
53.41
>> In Matplotlib, show the percentage or proportional data where each slice of pie represents a category In this article, we can create a pie chart to show our daily activities, i.e., sleeping, eating, working, and playing. Using plt.pie() method, we can create a pie chart with the given different data sets for different activities. Steps Create a list of days, i.e., [1, 2, 3, 4, 5]. Similarly, make lists for sleeping, eating, playing, and working. There is an activities list that keeps “sleeping”, “eating”, “working” and “playing”. Make a list of colors. Use plt.pie() method to draw the pie chart, where slices, activities, colors as cols, etc. are passed. Set a title for the axes, i.e., “Pie Chart”. To show the figure use plt.show() method. Example import matplotlib.pyplot as plt days = [1, 2, 3, 4, 5] sleeping = [7, 8, 6, 11, 7] eating = [2, 3, 4, 3, 2] working = [7, 8, 7, 2, 2] playing = [8, 5, 7, 8, 13] slices = [7, 2, 3, 13] activities = ['sleeping', 'eating', 'working', 'playing'] cols = ['c', 'm', 'r', 'b'] plt.pie(slices, labels=activities, colors=cols, startangle=90, shadow=True, explode=(0, 0.1, 0, 0), autopct='%1.1f%%') plt.title('Pie Plot') plt.show() Output When we execute the code, it will produce the following output − - Related Questions & Answers - How to find the percentage of each category in an R data frame column? - How to find the percentage of each category in a data.table object column in R? - How to find the count of each category in an R data frame column? - How to find the percentage of zeros in each column of a data frame in R? - How to set a title above each marker which represents a same label in Matplotlib? - Conditional removal of labels in Matplotlib pie chart - How to find the percentage of missing values in each column of an R data frame? - How to plot pie-chart with a single pie highlighted with Python Matplotlib? - How to find the count of each category in a data.table object column in R? - How to extract the closest value to a certain value in each category in an R data frame? - How to plot a nested pie chart in Matplotlib? - How to show the title for the diagram of Seaborn pairplot() or PridGrid()? (Matplotlib) - How to find the percentage of zeros in each column of a matrix in R? - Determine whether the given object represents a scalar data-type in Python - Which color represents prosperity- Green or Purple? Advertisements
https://www.tutorialspoint.com/in-matplotlib-show-the-percentage-or-proportional-data-where-each-slice-of-pie-represents-a-category
CC-MAIN-2022-27
refinedweb
427
66.74
Translating text strings into other languages, called "localization" or "l10n", is a critical part of extending the reach of free software. But it is equally important that those translations make their way upstream, so that the translation work is not duplicated, and that all future versions can benefit. Making all of that easy is the goal of Transifex, which is a platform for doing translations that is integrated with the upstream version control system (VCS). The project recently released Transifex 0.5—a complete rewrite atop the Django web framework—with many new features Transifex came out of work done in the 2007 Google Summer of Code for the Fedora project. Dimitris Glezos worked on a project to create a web interface to ease localization for Fedora. In the year and a half since then, Transifex has grown greatly in capabilities, and is now used as the primary tool for Fedora translations. One of the key aspects, as can be seen in the SoC application is a focus on being upstream friendly. People who are able to translate text into another language—for good or ill, most software is developed with English text—are not necessarily developers, so their knowledge of VCS systems may be small. In addition, they are unlikely to want to have multiple accounts with various projects who might need their services. Transifex abstracts all of the VCS-specific differences away, so that it presents a single view to translators. This allows those folks to concentrate on what they are good at. Transifex interfaces with multiple different VCS systems that a development project might choose to hold its source code. The five major VCS packages used by free software projects: CVS, Subversion, Bazaar, Mercurial, and Git; are all handled seamlessly by Transifex. A translator doesn't have to know—or care—what the project chose, and their translations will be properly propagated into the repository. This stands in contrast to Canonical's Rosetta, which is also a web-based translation tool, but it is tightly integrated with Launchpad. That requires that projects migrate to Launchpad to take advantage of the translations made by Ubuntu users. Many projects are skittish about moving to Launchpad, either due to its required use of Bazaar, or due to the non-free nature (at least as yet) of the Launchpad code. No doubt there are also projects who are happy with their current repository location and are unwilling to move. Because of the centralized nature of Rosetta, translations tend to get trapped there, leading some to declare it a poor choice for doing free software translations. Perhaps when Launchpad opens its code, and support for more VCS systems is added, it may be a more reasonable choice. For now, Transifex seems to have the right workflow for developers as well as translators. The 0.5 release adds a large number of new features to make it even easier to use and to integrate with various projects. The data model has been reworked to allow for arbitrary collections of projects (i.e Fedora 11 or GNOME), with multiple branches for each project. A lot of work has also gone into handling different formats of localization files (such as PO and POT formats), as well as supporting variants of languages for specific countries or regions (e.g. Brazilian Portuguese). For users, most of whom would be translators, 0.5 has added RSS feeds to follow the progress of translations for particular projects. User account management has been collected into its own subsystem, with features like self-service user registration and OpenID support for authentication. In addition, the VCS and localization layers are easily extensible to allow for supporting other varieties of those tools. Transifex 0.5 has the look of a very solid release. Glezos and others from the Transifex team have started a new company, Indifex to produce a hosted version of Transifex (at Transifex.net) that will serve the same purpose as Wordpress.com does for Wordpress blogs. Projects that don't want to host their own Transifex installation can work with Indifex to set up an localization solution for their code. Meanwhile, Indifex employees have been instrumental in the 0.5 rewrite and will be providing more development down the road. Glezos outlined their plans in a blog post in December. Because of its openness, and its concentration on upstream-friendliness, Transifex has an opportunity to transform localization efforts for free software projects. There are a large number of willing translators out there, but projects sometimes have difficulty hooking up with them. Transifex will provide a place for translators and projects to come together. That should result in lots more software available in native languages for many more folks around the world. It should come as little surprise that a panel full of patent lawyers turns out to be supportive of the idea of software patents. Of all the panellists present, only Jason Mendelson was truly hostile to patenting software, and even he stopped short of saying that they should not exist at all. The first speaker, though, was John Duffy, who cited language in a 1952 update to the patent code stating that "a patentable process includes a new use of an old machine." That language, he says, "fits software like a glove." So there is, he says, no basis for any claims that software patents are not allowed by current patent law. Beyond that, he says, the attempts to prevent the patenting of software for many years did a great deal of damage. Keeping the patent office away from software prevented the accumulation of a proper set of prior art, leading to the current situation where a lot of bad patents exist. Software is an engineering field, according to Duffy, and no engineering field has ever been excluded from patent protection. That said, software is unique in that it also benefits from copyright protection. That might justify raising the bar for software patents, but does not argue against their existence. Damien Geradin made the claim that there's no reason for software patents to be different from any other kind of patent. The only reason that there is any fuss about them, he says, is a result of the existence of the open source community; that's where all the opposition to patents comes from. But he showed no sign of understanding why that opposition exists; there is, he says, no real reason why software patents should be denied. Kevin Luo, being a Microsoft attorney, could hardly come out against software patents. He talked at length about the research and development costs at Microsoft, and made a big issue of the prevalence of software in many kinds of devices. According to Mr. Luo, trying to make a distinction between hardware and software really does not make a whole lot of sense. Beyond their basis in legislation, patents should, according to the US constitution, serve to encourage innovation in their field. Do software patents work this way? Here there was more debate, with even the stronger patent supporters being hard put to cite many examples. One example that did come up was the RSA patent, cited by Kevin Luo; without that patent, he says, RSA Security would not have been able to commercialize public key encryption. Whether this technique would not have been invented in the absence of patent protection was not discussed. Mr. Geradin noted that software patents are often used to put small innovators out of business, which seems counter to their stated purpose. But, he says, they can also be useful for those people, giving them a way to monetize their ideas. Without patents, innovators may find themselves with nothing to sell. Jason Haislmaier claimed, instead, that software patents don't really create entrepreneurship; people invent because that is who they are. And he noted that software patents are especially useless for startup companies. It can currently take something like seven years to get a patent; by that time, the company has probably been sold (or gone out of business) and the inventors are long gone. Jason Mendelson, who does a lot of venture capital work, had an even stronger view, using words like "worthless" and "net negative." He claimed that startups are frequently sued for patent infringement for the simple purpose of putting them out of business. In general, even the panellists who were most supportive of the idea of software patents had little good to say about how the patent system works in the US currently. For example, Michael Meurer, co-author of Patent Failure, has no real interest in abolishing software patents, but he argues that they do not work in their current form. Patents are supposed to be a property right, but they currently "perform poorly as property," with software patents being especially bad. That, he says, is why software developers tend to dislike patents, something which distinguishes them from practitioners of almost every other field. Patents are afflicted by vague language and "fuzzy boundaries" that make it impossible to know what has really been patented, so they don't really deliver any rewards to innovators. Mr. Meurer also noted that software currently features in about 25% of all patent applications. That is a higher percentage than was reached by other significant technologies - he cited steam engines and electric motors - at their peak. Mark Lemley talked a bit about the effect of software patents on open source software. Patents are a sort of arms-race game, and releasing code as open source is, in his words, "unilateral disarmament." He talked about defending open source with the "white knight" model - meaning either groups like the Open Invention Network and companies like IBM. He also noted that patents provide great FUD value for those opposed to open source. A related topic, one which came up several times, is "inadvertent infringement." This is what happens when somebody infringes on a patent without even knowing that it exists - independent invention, in other words. John Duffy said that the amount of inadvertent infringement going on serves as a good measure of the health of the patent system in general. In an environment where patents are not given for obvious ideas, inadvertent infringement should be relatively rare. And, in some fields (biotechnology and pharmaceuticals, for example), it tends not to be a problem. [PULL QUOTE: Actual copying of patented technology is only alleged in a tiny fraction of software patent suits. In other words, most litigation stems from inadvertent infringement. END QUOTE] In the software realm, though, inadvertent infringement is a big problem. Mark Lemley asserted a couple of times that actual copying of patented technology is only alleged in a tiny fraction of software patent suits. In other words, most litigation stems from inadvertent infringement. Michael Meurer added that there is a direct correlation between the amount of money a company spends on research and development and the likelihood that it will be sued for patent infringement. In most fields, he notes, piracy (his word) of patents is used as a substitute for research and development, so one would ordinarily see most suits leveled against companies which don't do their own R&D. In software, the companies which are innovating are the ones being sued. The other big problem with the patent system is its use as a way to put competitors out of business. Rather than support innovation, the patent system is actively suppressing it. Patent litigator Natalie Hanlon-Leh noted that it typically costs at least $1 million to litigate a patent case. John Posthumus added that no company with less than about $50 million in annual revenue can afford to fight a patent suit; smaller companies will simply be destroyed by the attempt. Patent lawyers know this, so they employ every trick they know to stretch out patent cases, making them as expensive as possible. Variation between the courts is another issue, leading to the well-known problem of "forum shopping," wherein litigators file their cases in the court which is most likely to give them the result they want. That is why so many patent suits are fought in east Texas. Michael Muerer made the claim that almost every industry in the US would be better off if the patent system were to be abolished; in other words, patents serve as a net drain on the industry. But, being a patent attorney, he does not want to abolish the patent system; instead he would like to see reforms made. His preferred reforms consist mostly of tightening up claim language to get rid of ambiguities and to reduce the scope of claims. He would like to make the process of getting a patent quite a bit more expensive, putting a much larger burden on applicants to prove that they deserve their claims. Mr. Muerer went further and singled out the independent inventor lobby as being the biggest single impediment to patent reform in the US. In particular, their efforts to block a switch from first-to-invent to first-to-file priority (as things are already done in most of the rest of the world) has held things up for years. What the lobby doesn't realize, he says, is that if the patent system works better for "the big guys," they will, in turn, be willing to pay more for patents obtained by the "little guys." This sort of trickle-down patent theory was not echoed by any of the other panelists, though. Part of the problem is that the US patent and trademark office (PTO) is overwhelmed, with a backlog of over 1 million patent applications. So patent applications take forever, and the quality control leaves something to be desired. Some panellists called for funding the PTO at a higher level, but this is unlikely to happen: the number of patent applications has fallen in recent times, and there is a possibility that some application fees will be routed to the general fund to help cover banker bonuses and other equally worthy causes. The PTO is likely to have less money in the near future. And, in any case, does it make sense to put more money into the PTO? Mark Lemley is against that idea, saying that the money would just be wasted. Most patents are never heard from again after issuance; doing anything to improve the quality of those patents is just a waste. Instead, he (along with others) appears to be in favor of the "gold-plated patent" idea. Gold-plated patents are associated with another issue: the fact that, in US courts, patents have an automatic presumption of validity. This presumption makes life much easier for plaintiffs, but, given the quality of many outstanding patents, some people think that the presumption should be revisited and, perhaps, removed. Applicants who think they have an especially strong patent could then apply for the gold-plated variety. These patents would cost a lot more, and they would be scrutinized much more closely before being issued. The idea is that a gold-plated patent really could have a presumption of validity. Others disagree with this idea. Gold-plated patents would really only benefit companies that had the money to pay for them; everybody else would be a second-class citizen. Anybody who was serious about patents would have to get them, though; they would really just be a price hike in disguise. There was much talk of patent reform in Congress - but little optimism. It was noted that this reform has been held up for several years now, with no change in sight. There was disagreement over who to blame (Mark Lemley blames the pharmaceuticals industry), but it doesn't seem to matter. John Duffy noted that the legislative history around intellectual property is "not charming"; he called the idea that patent law could be optimized a "fantasy." Mark Lemley agreed, noting that copyright law now looks a lot like the much-maligned US tax code, with lots of specific industry rules. Trying to adapt slow-moving patent law to a fast-moving industry like software just seems unlikely to work. What Mark suggests, instead, is to reform patent law through the courts. Indeed, he says, that is already happening. Recent rulings have made preliminary injunctions much harder to get, they have raised the bar for obviousness, restricted the scope of business-model patents, and more. Most of the complaints people have had, he says, have already been fixed. John Duffy, instead, would like to "end the patenting monopoly." By this he means the monopoly the PTO has on the issuing of patents. Evidently there are ways to get US-recognized patents from a few overseas patent offices now, and those offices tend to be much faster. He also likes the idea of having private companies doing patent examination; this work would come with penalties for granting patents which are later invalidated. Eventually, he says, we could have a wide range of industry-specific patent offices doing a much better job than we have now.. March 25, 2009 This article was contributed by Nathan Willis The Parrot project released version 1.0 of its dynamic language interpreting virtual machine last week, marking the culmination of seven years of work. Project leader Allison Randal explains that although end users won't see the benefits yet, 1.0 does mean that Parrot is ready for serious work by language implementers. General developers can also begin to get a feel for what working with Parrot is like using popular languages like Ruby, Lua, Python, and, of course, Perl. Parrot originated in 2001 as the planned interpreter for Perl 6, but soon expanded its scope to provide portable compilation and execution for Perl, Python, and any other dynamic language. In the intervening years, the structure of the project solidified — the Parrot team focused on implementing its virtual machine, refining the bytecode format, assembly language, instruction formats, and other core components, while separate teams focused on implementing the various languages, albeit working closely with the core Parrot developers. The primary target for 1.0 was to have a stable platform ready for language implementers to write to, and a robust set of compiler tools suitable for any dynamic language. The 1.4 release, tentatively set for this July, will target general developers, and next January's 2.0 should be ready for production systems. The promise of Parrot is tantalizing: rather than separate runtimes for Perl, Python, Ruby, and every other language, a single virtual machine that can compile each of them down to the same instruction set and run them. That opens the possibility of applications that incorporate code and call libraries written in multiple languages. "A big part of development these days isn't rolling everything from scratch, it's combining existing libraries to build your product or service," Randal said. "Access to multiple languages expands your available resources, without making you learn the syntax of a new language. It's also an advantage for new languages, because they can use the libraries from other existing languages and get a good jump-start." The Parrot VM itself is register-based, which the project says better mirrors the design of underlying CPU hardware and thus permits compilation to more efficient native machine language than the stack-based VMs used for Java and .Net. It provides separate registers for integers, strings, floating-point numbers, and "polymorphic containers" (PMCs; an abstract type allowing language-specific custom use), and performs garbage collection. Parrot can directly execute code in its own native Parrot Bytecode (PBC) format, and uses just-in-time compilation to run programs written in higher-level host languages. In addition to PBC, developers and compilers can also generate two higher-level formats: Parrot Assembly (PASM) and Parrot Intermediate Representation (PIR). A fourth format, Parrot Abstract Syntax Tree (PAST), is designed specifically for compiler output. The differences between them, including the level of detail exposed, is documented at the Parrot web site. Parrot includes a suite of core libraries that implement common data types like arrays, associative arrays, and complex numbers, as well as standard event, I/O, and exception handling. It also features a next-generation regular expression engine called Parser Grammar Engine (PGE). PGE is actually a fully-functional recursive descent parser, which Randal notes makes it a good deal more powerful than a standard regular expression engine, and a bit cleaner and easier to use. The project plans to keep the core of Parrot light, however, and extend its functionality through libraries running on the dynamic languages that Parrot interprets. Keeping the core as small as possible will make Parrot usable on resource-constrained hardware like mobile devices and embedded systems. The "getting started" documentation includes sample code written in PASM and PIR, but it is the high level language support that interests most developers. The project site maintains a list of active efforts to implement languages for the Parrot VM. As of today, there are 46 projects implementing 36 different languages. Three of the most prominent are Rakudo, the implementation of Perl 6 being developed by the Perl community, Cardinal, an implementation of Ruby, and Pynie, an implementation of Python. Among the rest there is serious work pursuing Lua and Lisp variants, as well as work on novelty languages such as Befunge and LOLCODE. Not all are complete, but Randal said development has accelerated in recent months after the 1.0 release date was announced, and she expects production ready releases of the key languages soon. Language implementers come from within the Parrot project and from the language communities themselves. As Randal explained it, "we see it as our responsibility as a project to develop the core of the key language implementations, and to actively reach out to the language communities." 1.0 includes a set of parsing utilities called the Parrot Compiler Tools (PCT) to help implement dynamic languages on the Parrot VM. PCT includes the PGE parser, as well as classes to handle the lexical analyzer and compiler front-end, and to create the driver program that Parrot itself will call to run the compiler. Owing to its Perl heritage, PCT uses a subset of Perl 6 called Not Quite Perl (NQP). Developer documentation for NQP and all of the PCT components is available with Parrot 1.0 as well as on the Parrot Developer Wiki. Parrot packages have been available for many Linux distributions and BSDs for much of its development cycle, but now that it has reached 1.0, Randal expects to see it ship by default in upcoming releases. For now, however, developers and language implementers interested in testing and running Parrot 1.0 can download source code releases from the project's web site or check out a copy from its Subversion repository. Building Parrot requires Perl, a C compiler, and a standard make utility. Parrot has been a long time in coming, but now that 1.0 is out of the gate, the real work can begin, as the major language projects make their own stable releases and developers start to use the Parrot VM as a runtime environment. Although the technical work continues at full pace, Randal said the project is also pushing forward on the education and outreach front, with a book soon to be published through Onyx Neon Press, and Parrot sessions planned for upcoming open source conferences and workshops as well. Page editor: Jonathan Corbet Security It will come as no surprise to long-time readers of this page (or others who have followed embedded device security), but recent reports of the "first Linux botnet" are making the subject of router/modem security more visible to the general public. As we have reported previously, embedded, network-facing devices make tempting targets. It appears that a botnet herder noticed that and is trying to take advantage of Linux-based devices. Perhaps the most surprising part about the attack is the simplicity of the vulnerability it is exploiting. As far as anyone has found "psyb0t", as the botnet is known, just brute forces username/password pairs over telnet, ssh, or http. The earliest research [PDF] of the botnet was from January; at that time it was only known to be exploiting a particular ADSL modem (Netcomm NB5) that, at one time, had non-existent authorization on its WAN-facing administrative web interface. More recently, DroneBL found more infected routers when investigating a distributed denial of service (DDOS) against its servers. The botnet is targeting Linux devices using the mipsel (MIPS little-endian) architecture, which includes many Linux-based home routers. OpenWRT, DD-WRT, and other projects all provide Linux-mipsel firmware for a variety of potentially vulnerable devices. Once the infecting program gets access to the device, it downloads the botnet code and disables access to the device via telnet, ssh, or http. While its method of getting access is simple, the botnet code itself is very capable. It connects to a command and control IRC channel (#mipsel) on a particular host under the control of the botnet herder. Commands on that channel can order the botnet nodes to do various denial of service attacks, scan for vulnerable MySQL and phpMyAdmin sites and subvert them, port scan particular hosts, update the botnet code, and more. The IRC channel has shut down with a message indicating that psyb0t was strictly a research project by someone known as DRS. The message also claimed that no DDOS or phishing was done and that the botnet reached 80,000 nodes. While it may well be that the danger of this particular threat has passed, the more general issue of router, especially home router, security persists. A fully capable, always-on Linux device is a very attractive target for botnet herders or other types of attackers. Trying to put together a botnet of Linux desktops and servers might be a much more difficult task as there is a much wider diversity of distributions and kernel versions, as well as different architectures and configurations. To a great extent, the Linux-based home router landscape is much more homogeneous, as psyb0t has shown. Clearly default and/or weak passwords are a serious problem—not just for Linux-based devices—but it would not be surprising to find that other vulnerabilities (such as authentication bypass) are available on many of these devices. Unlike a simple password change, those kinds of flaws require an update to the router firmware, which, in turn, requires users to know about the problem and understand where to get—and how to apply—the code to fix it. This is certainly a problem we have not seen the last of. New vulnerabilities Directory traversal vulnerability in importxml.pl in Bugzilla before 2.22.5, and 3.x before 3.0.5, when --attach_path is enabled, allows remote attackers to read arbitrary files via an XML file with a .. (dot dot) in the data element. (CVE-2008-4437) Bugzilla 3.2 before 3.2 RC2, 3.0 before 3.0.6, 2.22 before 2.22.6, 2.20 before 2.20.7, and other versions after 2.17.4 allows remote authenticated users to bypass moderation to approve and disapprove quips via a direct request to quips.cgi with the action parameter set to "approve." (CVE-2008-6098) browsers. (CVE-2009-0481) Cross-site request forgery (CSRF) vulnerability in Bugzilla before 3.2 before 3.2.1, 3.3 before 3.3.2, and other versions before 3.2 allows remote attackers to perform bug updating activities as other users via a link or IMG tag to process_bug.cgi. (CVE-2009-0482). (CVE-2009-0483) Cross-site request forgery (CSRF) vulnerability in Bugzilla 3.0 before 3.0.7, 3.2 before 3.2.1, and 3.3 before 3.3.2 allows remote attackers to delete shared or saved searches via a link or IMG tag to buglist.cgi. (CVE-2009-0484) Cross-site request forgery (CSRF) vulnerability in Bugzilla 2.17 to 2.22.7, 3.0 before 3.0.7, 3.2 before 3.2.1, and 3.3 before 3.3.2 allows remote attackers to delete unused flag types via a link or IMG tag to editflagtypes.cgi. (CVE-2009-0485) users. (CVE-2009-0486) From the Drupal advisory: The Node reference and User reference sub-modules, which are part of the Content Construction Kit (CCK) project, lets administrators define node fields that are references to other nodes or to users. When displaying a node edit form, the titles of candidate referenced nodes or names of candidate referenced users are not properly filtered, allowing malicious users to inject arbitrary code on those pages. Such a cross site scripting (XSS) attack may lead to a malicious user gaining full administrative access. Cross-site scripting (XSS) vulnerability in ejabberd before 2.0.4 allows remote attackers to inject arbitrary web script or HTML via unknown vectors related to links and MUC logs. Unspecified vulnerability in the avcodec_close function in libavcodec/utils.c in FFmpeg 0.4.9 before r14787, as used by MPlayer, has unknown impact and attack vectors, related to a free "on random pointers." FFmpeg 0.4.9, as used by MPlayer, allows context-dependent attackers to cause a denial of service (memory consumption) via unknown vectors, aka a "Tcp/udp memory leak.") From the Debian advisory: CVE-2009-0745: Peter Kerwien discovered an issue in the ext4 filesystem that allows local users to cause a denial of service (kernel oops) during a resize operation. CVE-2009-0746: Sami Liedes reported an issue in the ext4 filesystem that allows local users to cause a denial of service (kernel oops) when accessing a specially crafted corrupt filesystem. CVE-2009-0747: David Maciejak reported an issue in the ext4 filesystem that allows local users to cause a denial of service (kernel oops) when mounting a specially crafted corrupt filesystem. CVE-2009-0748: David Maciejak reported an additional issue in the ext4 filesystem that allows local users to cause a denial of service (kernel oops) when mounting a specially crafted corrupt filesystem.) OpenSC stores private data without proper access restrictions. User "b.badrignans" reported this security problem on December 4th, 2008. In June 2007 support form private data objects was added to OpenSC. Only later a severe security bug was found out: while the OpenSC PKCS#11 implementation requires PIN verification to access the data, low level APDU commands or debugging tools like opensc-explorer or opensc-tool can access the private data without any authentication. This was fixed in OpenSC 0.11.7. From the Mandriva advisory: Integer (CVE-2009-0887). From the Red Hat bugzilla: A stack overflow was found in how PostgreSQL handles conversion encoding. This could allow an authenticated user to kill connections to the PostgreSQL server for a small amount of time, which could interrupt transactions by other users/clients. Page editor: Jake Edge Kernel development Brief items As of this writing, merging of changes for 2.6.30 has not yet begun. The 2.6.27.21 and 2.6.28.9 stable kernel updates were released on March 23. Both contain a long list of fixes for bugs in the USB subsystem, i915 graphics driver, device mapper, and sound subsystems (and beyond). Kernel development news In terms of development methodology and tools, in fact i claim that the kernel workflow and style of development can be applied to most user-space software projects with great success. NetworkManager is both the carrot and the stick. If NM just worked around broken stuff and proprietary drivers, it would be a hacktower of doom and we may still be stuck largely in 2006-wireless land. I've been using [ext4] on my laptop since July, and haven't lost significant amounts of data yet. An in-kernel tracing infrastructure for user-space code, utrace, has long been in a kind of pending state; it has shipped in every Fedora kernel since Fedora Core 6, and has done some time in the -mm tree, but it has never gotten into the mainline. That may now be changing, given a recent push for inclusion of the core utrace code. There are some lingering questions about including utrace, at least for 2.6.30, because the patchset doesn't add any in-kernel user of the interface. Utrace grew out of Roland McGrath's work on maintaining the ptrace() system call. That call is used by user-space programs to do things like trace system calls using strace, but it is also used in less obvious ways—to implement user-mode-linux (UML) for example. While ptrace() has generally sufficed, it is, by all accounts, a rather ugly and flawed interface both for kernel hackers to maintain and for developers to use. McGrath described the genesis of utrace in a recent linux-kernel post: Basically, utrace implements a framework for controlling user-space tasks. It provides an interface that can be used by various tracing "engines", implemented as loadable kernel modules, that wish to be notified of events that occur on threads of interest. As might be expected, engines register callback functions for specific events, then attach to whichever thread they wish to trace. The callbacks are made from "safe" places in the kernel, which allows the functions great leeway in the kinds of processing they can do. No locks are held when the callbacks are made, so they can block for a short time (in calls like kmalloc()), but they shouldn't block for long periods. Doing so, risks making the SIGKILL signal from working properly. If the callback needs to wait for I/O or block on some other long-running activity, it should stop the execution of the thread and return, then resume the thread when the operation completes. There are various events that can be watched via utrace: system call entry and exit, fork(), signals being sent to the task, etc. Single-stepping through a task being traced can also be handled via utrace. One of the benefits that utrace provides, which ptrace() lacks, is the ability to have multiple engines tracing the same task. Utrace is well documented in DocBook manual included with the patch. LWN first looked at utrace just over two years ago, but, since then, it has largely disappeared from view. Reimplementing ptrace() using utrace is certainly one of the goals, but the current patches do not do that. But, there is a fundamental disagreement between McGrath and other kernel hackers about whether utrace can be merged without it. The problem is that there is no in-tree user of the new interface, and, as Ted Ts'o put it, "we need to have a user for the kernel interface along with the new kernel interface". The proposed utrace patchset consists of a small patch to clean up some of the tracehook functionality, a large 4000 line patch that implements the utrace core, and another patch that adds an ftrace tracer that is based on utrace event handling. The latter, implemented by SystemTap developer Frank Eigler, would provide an in-tree user of the new utrace code, but received a rather chilly response from Ingo Molnar: "[...] without the ftrace plugin the whole utrace machinery is just something that provides a _ton_ of hooks to something entirely external: SystemTap mainly." Therein lies one of the main concerns expressed about utrace. The utrace-ftrace interface is not seen as a real user of utrace, more of a "big distraction", as Andrew Morton called it. The worry is that adding utrace just makes it easier to keep SystemTap out of the mainline. While the kernel hackers have some serious reservations about the specifics of the SystemTap implementation, they would like to see it head towards the mainline. The fear is that by merging things like utrace, it may enable SystemTap to stay out of the mainline that much longer. Molnar posted his take on the issue, concluding: In addition, Molnar is not pleased that the utrace changes haven't been reviewed by the ftrace developers and were submitted just as the merge window for 2.6.30 is about to open. He believes that McGrath, Eigler, and the other utrace developers should be working with the ftrace team: The ftrace/utrace plugin is the only real connection utrace has to the mainline kernel, so proper review by the tracing folks and cooperation with the tracing folks is very much needed for the whole thing. But McGrath sees things rather differently. From his perspective, utrace has enough usefulness in its own right—not primarily as just a piece of SystemTap—to be considered for the mainline. Several different uses for utrace, in addition to the ptrace() cleanup, were mentioned in the thread: kmview, a kernel module for virtualization; uprobes for DTrace-style user-space probing; changing UML to use utrace directly, rather than ptrace(); and more. Eigler also defended utrace as a standalone feature: Molnar would like to see the "rewrite-ptrace-via-utrace" patch included before merging utrace. That would give the facility a solid in-kernel user, which could be used by other kernel developers to test and debug utrace. But, McGrath is not yet ready to submit that code: In some ways, the association with SystemTap is unfairly coloring the reaction to utrace. Molnar posted an excellent summary of the issues that stop him (and other kernel hackers) from using SystemTap—along with some possible solutions—but utrace and SystemTap aren't equivalent. It may not make sense to merge utrace without a serious in-kernel user of the interface, but most of the rest of the arguments have been about SystemTap, not utrace. As McGrath puts it: It remains to be seen whether utrace will make its way into 2.6.30 or not. Linus Torvalds was unimpressed with utrace dominating Fedora kerneloops.org reports, as relayed by Molnar—though the bug that caused those problems has been long fixed. McGrath sees value in merging utrace before the ptrace() rewrite is ready, while other kernel developers do not. If utrace misses this merge window, it would seem likely that it will return for 2.6.31, along with the rewrite; at that point merging would seem quite likely. This article was contributed by Valerie Aurora (formerly Henson) For each file system, I'll describe its basic architecture, features, and implementation. The discussion of the implementation will focus in particular on whiteouts and directory reading. I'll wrap up with a look at the software engineering aspects of each implementations; e.g., code size and complexity, invasiveness, and burden on file system developers. Before reading this article, you might want to check out Andreas Gruenbacher's just published write-up of the union mount workshop held last November. It's a good summary of the unioning file systems features which are most pressing for distribution developers. From the introduction: "All of the use cases we are interested in basically boil down to the same thing: having an image or filesystem that is used read-only (either because it is not writable, or because writing to the image is not desired), and pretending that this image or filesystem is writable, storing changes somewhere else." A Plan 9 union directory is created like so: bind -a /home/val/bin/ /bin /home/val/bin -a /bin bin/ Without whiteouts or duplicate elimination, readdir() on union directories is trivial to implement. Directory entry offsets from the underlying file system correspond directly to the offset in bytes of the directory entry from the beginning of the directory. A union directory is treated as though the contents of the underlying directories are concatenated together. readdir() Plan 9 implements an alternative to readdir() worth noting, dirread(). dirread() returns structures of type Dir, described in the stat() man page. The important part of the Dir is the Qid member. A Qid is: dirread() Dir Qid So why is this interesting? One of the reasons readdir() is such a pain to implement is that it returns the d_off member of struct dirent, a single off_t (32 bits unless the application is compiled with large file support), to mark the directory entry where an application should continue reading on the next readdir() call. This works fine as long as d_off is a simple byte offset into a flat file of less than 232 bytes and existing directory entries are never moved around - not the case for many modern file systems (XFS, btrfs, ext3 with htree indexes). The 96-bit Qid is a much more useful place marker than the 32 or 64-bit off_t. For a good summary of the issues involved in implementing readdir(), read Theodore Y. Ts'o's excellent post on the topic to the btrfs mailing list. d_off struct dirent off_t From a software engineering standpoint, Plan 9 union directories are heavenly. Without whiteouts, duplicate entry elimination, complicated directory offsets, or merging of namespaces beyond the top-level directory, the implementation is simple and easy to maintain. However, any practical implementation of unioning file systems for Linux (or any other UNIX) would have to solve these problems. For our purposes, Plan 9 union directories serve primarily as inspiration. "-o union" mount mount_unionfs For this article, we use two sources for specific implementation details: the original BSD union mount implementation as described in the 1995 USENIX paper Union mounts in 4.4BSD-Lite [PS], and the FreeBSD 7.1 mount_unionfs man page and source code. Other BSDs may vary. A directory can be union mounted either "below" or "above" an existing directory or union mount, as long as the top branch of a writable union is writable. Two modes of whiteouts are supported: either a whiteout is always created when a directory is removed, or it is only created if another directory entry with that name currently exists in a branch below the writable branch. Three modes for setting the ownership and mode of copied-up files are supported. The simplest is transparent, in which the new file keeps the same owner and mode of the original. The masquerade mode makes copied-up files owned by a particular user and supports a set of mount options for determining the new file mode. The traditional mode sets the owner to the user who ran the union mount command, and sets the mode according to the umask at the time of the union mount. transparent masquerade traditional Whenever a directory is opened, a directory of the same name is created on the top writable layer if it doesn't already exist. From the paper: As a result, a "find /union" will result in copying every directory (but not directory entries pointing to non-directories) to the writable layer. For most file system images, this will use a negligible amount of space (less than, e.g., the space reserved for the root user, or that taken up by unused inodes in an FFS-style file system). "find /union" A file is copied up to the top layer when it is opened with write permission or the file attributes are changed. (Since directories are copied over when they are opened, the containing directory is guaranteed to already exist on the writable layer.) If the file to be copied up has multiple hard links, the other links are ignored and the new file has a link count of one. This may break applications that use hard links and expect modifications through one link name to show up when referenced through a different hard link. Such applications are relatively uncommon, but no one has done a systematic study to see which applications will fail in this situation. Whiteouts are implemented with a special directory entry type, DH_WHT. Whiteout directory entries don't refer to any real inode, but for easy compatibility with existing file system utilities such as fsck, each whiteout directory entry includes a faux inode number, the WINO reserved whiteout inode number. The underlying file system must be modified to support the whiteout directory entry type. New directories that replace a whiteout entry are marked as opaque via a new "opaque" inode attribute so that lookups don't travel through them (again requiring minimal support from the underlying file system). DH_WHT fsck WINO Duplicate directory entries and whiteouts are handled in the userspace readdir() implementation. At opendir() time, the C library reads the directory all at once, removes duplicates, applies whiteouts, and caches the results. opendir() BSD union mounts don't attempt to deal with changes to branches below the writable top branch (although they are permitted). The way rename() is handled is not described. rename() An example from the mount_unionfs man page:. Like BSD union mounts, Linux union mounts implement file system unioning in the VFS layer, with some minor support from underlying file systems for whiteouts and opaque directory tags. Several versions of these patches exist, written and modified by Jan Blunck, Bharata B. Rao, and Miklos Szeredi, among others. One version of this code is merges the top-level directories only, similar to Plan 9 union directories and the BSD -o union mount option. This version of union mounts, which I refer to as union directories, are described in some detail in a recent LWN article by Goldwyn Rodrigues and in Miklos Szeredi's recent post of an updated patch set. For the remainder of this article, we will focus on versions of union mount that merge the full namespace. -o union Linux union mounts are currently under active development. This article describes the version released by Jan Blunck against Linux 2.6.25-mm1, util-linux 2.13, and e2fsprogs 1.40.2. The patch sets, as quilt series, can be downloaded from Jan's ftp site: Kernel patches: Utilities: Utilities: I have created a web page with links to git versions of the above patches and some HOWTO-style documentation at. A union is created by mounting a file system with the MS_UNION flag set. (The MS_BEFORE, MS_AFTER, and MS_REPLACE are defined in the mount code base but not currently used.) If the MS_UNION flag is specified, then the mounted file system must either be read-only or support whiteouts. In this version of union mounts, the union mount flag is specified by the "-o union" option to mount. For example, to create a union of two loopback device file systems, /img/ro and /img/rw, you would run: MS_UNION MS_BEFORE MS_AFTER MS_REPLACE -o union # mount -o loop,ro,union /img/ro /mnt/union/ # mount -o loop,union /img/rw /mnt/union/ struct union_mount struct union_mount { atomic_t u_count; /* reference count */ struct mutex u_mutex; struct list_head u_unions; /* list head for d_unions */ struct hlist_node u_hash; /* list head for searching */ struct hlist_node u_rhash; /* list head for reverse searching */ struct path u_this; /* this is me */ struct path u_next; /* this is what I overlay */ }; Documentation/filesystems/union-mounts.txt Whiteouts and opaque directories are implemented in much the same way as in BSD. The underlying file system must explicitly support whiteouts by defining the .whiteout inode operation for directories (currently, whiteouts are only implemented for ext2, ext3, and tmpfs). The ext2 and ext3 implementations use the whiteout directory entry type, DT_WHT, which has been defined in include/linux/fs.h for years but not used outside of the Coda file system until now. A reserved whiteout inode number, EXT3_WHT_INO, is defined but not yet used; whiteout entries currently allocate a normal inode. A new inode flag, S_OPAQUE, is defined to mark directories as opaque. As in BSD, directories are only marked opaque when they replace a whiteout entry. .whiteout DT_WHT include/linux/fs.h EXT3_WHT_INO S_OPAQUE Files are copied up when the file is opened for writing. If necessary, each directory in the path to the file is copied to the top branch (copy-on-demand of directories). Currently, copy up is only supported for regular files and directories. readdir() is one of the weakest points of the current implementation. It is implemented the same way as BSD union mount readdir(), but in the kernel. The d_off field is set to the offset within the current underlying directory, minus the sizes of the previous directories. Directory entries from directories underneath the top layer must be checked against previous entries for duplicates or whiteouts. As currently implemented, each readdir() (technically, getdents()) system call reads all of the previous directory entries into an in-kernel cache, then compares each entry to be returned with those already in the cache before copying it to the user buffer. The end result is that readdir() is complex, slow, and potentially allocates a great deal of kernel memory. getdents() One solution is to take the BSD approach and do the caching, whiteout, and duplicate processing in userspace. Bharata B. Rao is designing support for union mount readdir() in glibc. (The POSIX standard permits readdir() to be implemented at the libc level if the bare kernel system call does not fulfill all the requirements.) This would move the memory usage into the application and make the cache persistent. Another solution would be to make the in-kernel cache persistent in some way. My suggestion is to take a technique from BSD union mounts and extend it: proactively copy up not just directory entries for directories, but all of the directory entries from lower file systems, process duplicates and whiteouts, make the directory opaque, and write it out to disk. In effect, you are processing the directory entries for whiteouts and duplicates on the first open of the directory, and then writing the resulting "cache" of directory entries to disk. The directory entries pointing to files on the underlying file systems need to signify somehow that they are "fall-through" entries (the opposite of a whiteout - it explicitly requests looking up an object in a lower file system). A side effect of this approach is that whiteouts are no longer needed at all. One problem that needs to be solved with this approach is how to represent directory entries pointing to lower file systems. A number of solutions present themselves: the entry could point to a reserved inode number, the file system could allocate an inode for each entry but mark it with a new S_LOOKOVERTHERE inode attribute, it could create a symlink to a reserved target, etc. This approach would use more space on the overlying file system, but all other approaches require allocating the same space in memory, and generally memory is more dear than disk. S_LOOKOVERTHERE A less pressing issue with the current implementation is that inode numbers are not stable across boot (see the previous unioning file systems article for details on why this is a problem). If "fall-through" directories are implemented by allocating an inode for each directory entry on underlying file systems, then stable inode numbers will be a natural side effect. Another option is to store a persistent inode map somewhere - in a file in the top-level directory, or in an external file system, perhaps. Hard links are handled - or, more accurately, not handled - in the same way as BSD union mounts. Again, it is not clear how many applications depend on modifying a file via one hard-linked path and seeing the changes via another hard-linked path (as opposed to symbolic link). The only method I can come up with to handle this correctly is to keep a persistent cache somewhere on disk of the inodes we have encountered with multiple hard links. Here's an example of how it would work: Say we start a copy up for inode 42 and find that it has a link count of three. We would create an entry for the hard link database that includes the file system id, the inode number, the link count, and the inode number of the new copy on the top level file system. It could be stored in a file in CSV format, or as a symlink in a reserved directory in the root directory (e.g., "/.hardlink_hack/<fs_id>/42", which is a link to "<new_inode_num> 3"), or in a real database. Each time we open an inode on an underlying file system, we look it up in our hard link database; if an entry exists, we decrement the link count and create a hard link to the correct inode on the new file system. When all of the paths are found, the link count drops to one and the entry can be deleted from the database. The nice thing about this approach is that the amount of overhead is bounded and will disappear entirely when all the paths to the relevant inodes have been looked up. However, this still introduces a significant amount of possibly unnecessary complexity; the BSD implementation shows that many applications will happily run with not-quite-POSIXLY-correct hard link behavior. /.hardlink_hack/<fs_id>/42 <new_inode_num> 3 Currently, rename() of directories across branches returns EXDEV, the error for trying to rename a file across different file systems. User space usually handles this transparently (since it already has to handle this case for directories from different file systems) and falls back to copying the contents of the directory over one by one. Implementing recursive rename() of directories across branches in the kernel is not a bright idea for the same reasons as rename across regular file systems; probably returning EXDEV is the best solution. EXDEV From a software engineering point of view, union mounts seem to be a reasonable compromise between features and ease of maintenance. Most of the VFS changes are isolated into fs/union.c, a file of about 1000 lines. About 1/3 of this file is the in-kernel readdir() implementation, which will almost certainly be replaced by something else before any possible merge. The changes to underlying file systems are fairly minimal and only needed for file systems mounted as writable branches. The main obstacle to merging this code is the readdir() implementation. Otherwise, file system maintainers have been noticeably more positive about union mounts than any other unioning implementation. fs/union.c A nice summary of union mounts can be found in Bharata B. Rao's union mount slides for FOSS.IN [PDF]. The first public nftables release came out on March 18. This code has been in the works for a while, though, and the ideas were discussed at the 2008 Netfilter Workshop. So nftables is not quite as new as it might seem. The current iptables code has a lot of protocol awareness built into it. There is, for example, a module dedicated to extracting port numbers from UDP packets which is different from the module concerned with TCP packets. The nftables implementation is entirely different; there is no protocol knowledge built into it at all. Instead, nftables is implemented as a simple virtual machine which interprets code loaded from user space. So nftables has no operation which says anything like "compare the IP destination address to 196.168.0.1"; instead, it would execute code which looks like: payload load 4 offset network header + 16 => reg 1 compare reg 1 192.168.0.1 (Patrick presents the code in mnemonic form, and your editor will do the same; the actual code loaded into the kernel uses opcodes instead). The first line loads four bytes from the packet, located 16 bytes past the beginning of the network reader, into register 1. The second line then compares that register against the given network address. The language can do a lot more than just comparing addresses, of course. There is, for example, a set lookup feature. Consider the following: payload load 4 offset network header + 16 => reg 1 set lookup reg 1 load result in verdict register { "192.168.0.1" : jump chain1, "192.168.0.2" : drop, "192.168.0.3" : jump chain2 } This code will cause packets aimed at 192.168.0.2 to be dropped; for the other two listed addresses, control will be sent to specific rule chains. This set feature allows for multi-branch rules in a way which cannot be done with the current iptables implementation (though the ipset mechanism helps in that regard). The above code also introduces the "verdict register," which records an action to be performed on a packet. In nftables, more than one verdict can be rendered on a packet; it is possible to add a packet to a specific counter, log it, and drop it all in a single chain without the need (as seen in iptables) to repeat tests. There are a number of other capabilities built into the nftables virtual machine. There's a set of operations for communicating with the connection-tracking mechanism, allowing connection information to be used in deciding the fate of specific packets. Other operators deal with various bits of packet metadata known to the networking subsystem; these include the length, the protocol type, security mark information, and more. Operators exist for logging packets and incrementing counters. There's also a full set of comparison operations, of course. Network administrators are unlikely to be impressed by the idea of programming a low-level virtual machine for their future firewalling needs. The good news is that there will be no need for them to do so. Instead, they'll write higher-level rules which will then be compiled into virtual machine code before being loaded into the kernel. The nftables utility does this work, implementing a human-readable language encapsulating most of the needed information about how packets are put together. So, if we look back to the first test described above: The administrator would simply write "ip daddr 192.168.0.1" and let nftables turn that into the above code. A full (if simple) rule looks something like this: rule add ip filter output ip daddr 192.168.0.1 counter This rule will count packets sent to 192.168.0.1. The new nftables API is based on netlink, naturally. Unlike the current iptables API, it has the ability to modify individual rules without the need to reload the entire configuration. There is also a decompilation facility built into nftables that allows the recreation of human-readable rules from the current in-kernel configuration. [PULL QUOTE: This could be a disruptive and expensive transition; the kernel development community will want to see some very good reasons for inflicting this pain on its users. END QUOTE] All told, it looks like a nicely-designed packet filtering mechanism, but the merging of nftables is likely to be controversial. The iptables mechanism works well, and is widely used; replacing it with code which breaks the user-space API and breaks all existing iptables configurations is guaranteed to raise some eyebrows. This could be a disruptive and expensive transition, even if, as seems necessary, the developers commit to maintaining both iptables and nftables in the mainline for an extended period of time. The kernel development community will want to see some very good reasons for inflicting this pain on its users. There are some good reasons, but one should start by noting that it should be possible to create a tool which reads current iptables configurations and converts them to the nftables language - or even directly to kernel virtual machine code. Patrick seems to expect to create such a tool One Of These Days, but it does not exist at this time. Some of the reasons for replacing iptables have already been hinted at above. The protocol knowledge built into the iptables code has turned out to be a problem over time; there is a lot of duplicated code doing the same thing (extracting port numbers, say) for different protocols. Even worse, the capabilities and syntax tend to vary from one protocol to the next. By moving all of that knowledge out to user space, nftables greatly simplifies the in-kernel code and allows for much more consistent treatment of all protocols. There are a lot of optimization possibilities built into the new system. Some expensive operations (incrementing counters, for example) can be skipped unless the user really needs them. Features like set lookups and range mapping can collapse a whole set of iptables rules into a single nftables operation. Since filtering rules are now compiled, there is also potential for the compiler to optimize the rules further. Traditional firewall configurations tend to perform the same tests repeatedly; a smart nftables compiler could eliminate much of that duplicated work. Unsurprisingly, this optimization remains on the "to do" list for now, but the fact that all of this work is done in user space will make it easy to add such features in the future. The nftables tool will also be able to perform a higher level of validation on the rules it is given, and it will be able to provide more useful diagnostics than can be had from the iptables code. But, arguably, the most important motivation is the ability to dump the current ABI. The iptables ABI has become an increasing impediment to development over time. It includes protocol-specific fields which has made it hard to extend; that is part of why there are actually three copies of the iptables code in the kernel. When developers wanted to implement arptables and ebtables, they essentially had to copy the code and bang it into a new, protocol-specific shape. Patrick estimates that, even after four years of unification work, the kernel contains some 10,000 lines of duplicated filtering code. Beyond that, the structures used in the ABI are also used directly in the kernel's internal representation, making that implementation even harder to change. Separating the two would be possible through the addition of a translation layer, but the details involved (including the need to translate in both directions) increase the risk of adding subtle problems. In summary, the iptables ABI has become a serious impediment to further progress in packet filtering. Nftables is a chance to dump all of that code and replace it with a much smaller filtering core which should prove to be quite a bit more flexible. With any luck, nftables should last a long time; the virtual machine can be extended in unexpected ways without the need to break the user-space ABI (again). It's smaller size should make it well suited to small router deployments, while its lockless design should appeal to administrators of high-end systems. All told, chances are good that the larger community will eventually see this change as being worthwhile. But not for a while: there are some unfinished pieces in nftables, and the larger discussion has not yet begun. (For more information, see this weblog posting from August, 2008 and the slides from Patrick's presentation [ODF] at the Netfilter Workshop). Patches and updates Kernel trees Build system Core kernel code Development tools Device drivers Filesystems and block I/O Janitorial Memory management Networking Security-related Virtualization and containers Benchmarks and bugs Miscellaneous Page editor: Jonathan Corbet Distributions News and Editorials This article was contributed by Koen Vervloesem These days it looks like every major Linux distribution is trying to slim down its boot times: a faster boot-up is one of the main goals of Ubuntu 9.04, and so-called 'fastboot' systems such as HyperSpace and Splashtop are becoming mainstream as PC vendors are preinstalling them on mainboards. The Intel-sponsored Moblin project is part of the same evolution. Nevertheless, there's a fundamental difference: while fastboot solutions have minimal functionality and are meant to be used if you would like to read your Gmail account but don't want to wait for Windows booting, Moblin aims to have a full-fledged distribution which boots in seconds. The unique selling point of the recently released Moblin 2 alpha is clearly the read-ahead boot technology by Intel. The release shows an impressive boot time: on an Acer Aspire One with SSD the Moblin 2 alpha boots in 6 seconds from the GRUB menu to the Xfce desktop (with autologin enabled). Other distributions will surely borrow this technology in the future. For example, the Netbook Edition of Ubuntu 9.10 ("Karmic Koala") will include Moblin's fastboot technology; Linpus and Mandriva are also planning to build on Moblin. In addition, at the beginning of this month, embedded Linux company MontaVista announced a Moblin-based Linux platform, as its competitor Wind River did last year. Moblin 2 alpha is more a technology showcase and a platform, rather than yet another Linux distribution. Moblin 2 is not based on another distribution, but borrows parts from various other distributions, and leans heavily on Fedora by its use of RPM package management and other Fedora tools. The Moblin toolchain comes from openSUSE. Moblin Core, the heart of the Moblin platform, provides a base that can be shared for platform-specific implementations, such as netbooks, MID's and even in-vehicle systems. It is built on GNOME Mobile and extended with Intel's fastboot and power saving technologies. Intel engineers have also sent patches to Xfce to improve the startup time of the graphical session. Moblin 2 alpha uses a kernel version named 2.6.29.rc2-13.1.moblin2-netbook. It supports Intel Atom and Intel Core 2 cpu's. Moblin 2 is reported to work on the Acer Aspire One, Asus eeePC 901, Dell Mini 9 and MSI Wind. Your author was delighted to see wireless networking work out-of-the-box on his Acer Aspire One. Moblin 2 can be tried out easily on a MID or netbook. Just download the Moblin live image, copy it with dd to a USB pen drive and boot from it. If you install Moblin on your netbook's SSD or hard drive, what you get is fairly minimal: the Minefield (the future Firefox 3.5) web browser, the Thunar file manager, the Totem movie player, the Mousepad text editor, the Pimlico suite of PIM applications, a terminal, and some other tools. The graphical interface is based on the Xfce desktop environment, but, according to Intel, this is a placeholder which will be replaced in the final release. Moblin 2 doesn't use GNOME's Network Manager, instead it uses the Linux Connection Manager, which accounts for the lightweight connman daemon and applet connman-gnome. The project is specifically designed to run on embedded devices with low resources. Using the alpha version for day-to-day work is not recommended: there are errors floating on VT 1 and many things don't work yet. For example, choosing Quit in the Xfce menu doesn't halt the machine, but restarts X. Because it's an alpha version and because Moblin is more a platform than a distribution, it's not fair to attach too much importance to these errors. Actually, there are only two reasons to use Moblin 2 alpha: to play with the bleeding edge fastboot technology, or to build your own Moblin-based distribution. As Moblin is targeted to distribution builders, there's a toolkit to build your own Moblin-based distribution: Moblin Image Creator 2 (MIC2), which is based primarily on Fedora live CD tools. MIC2 automates the creation of installation media, such as an ISO image or an image for a USB pen drive. You can create a project and a target, customize your target with specific packages, then create an image. You can specify different repositories, such as Ubuntu, OpenSUSE, and Fedora. MIC2 is a generic tool that can be used to create images from any yum or apt package repository, so applications can be packaged as rpm or deb files. Thus, MIC2 makes it possible to build a full-fledged distribution which goes much further than the standard Moblin application set. The Moblin 2 alpha release is a good showcase of what we can expect from netbook-targeted Linux distributions in 2009. Intel's fastboot technology, the Linux Connection Manager and the Moblin Image Creator are a good base platform. It will make distributors and netbook makers lives a lot easier. If these parties pick it up, the lives of netbook users will also be much easier by the end of this year. New Releases Distribution News Debian GNU/Linux Full Story (comments: none) Fedora Gentoo Linux SUSE Linux and openSUSE Ubuntu family New Distributions Distribution Newsletters Newsletters and articles of interest Page editor: Rebecca Sobol Development March 24, 2009. System Applications Audio Projects Clusters and Grids Database Software Middleware Networking Tools Telecom Web Site Development Web Services Desktop Applications Audio Applications Desktop Environments Full Story (comments: 2) Fonts and Images Full Story (comments: 8) Games Interoperability Mail Clients Multimedia Music Applications Office Applications Science Video Applications Languages and Tools Caml Java Perl Python XML Cross Compilers Test Suites Version Control Page editor: Forrest Cook Linux in the news Recommended Reading Companies Linux Adoption Legal Resources Reviews Announcements Non-Commercial announcements Commercial announcements Contests and Awards Event Reports Meeting Minutes Calls for Presentations Upcoming Events If your event does not appear here, please tell us about it. Web sites Creative Commons recently made some comments on ODbL that are rather critical of the license, at least for use by OSM; it would rather see OSM data reside in the public domain—as would a number of OSM contributors. ." This seems likely to muddy the waters further, which may delay or change any OSM relicensing plans. Linux is a registered trademark of Linus Torvalds
http://lwn.net/Articles/324413/bigpage
CC-MAIN-2013-20
refinedweb
11,589
59.84
Yet Another Damn ToDo App in Vue.js So last week I published my thrilling post on building a ToDo app in Vue.js ("Another Damn ToDo App in Vue.js"). As promised, I'm following up on that post with an "enhanced" version of the application. The previous version was quite simple. It used Vue as a script tag, not a full Vue application, and stored the ToDos in memory. That meant on every reload the data was lost. In this version I made three main changes: - First I switched over to a complete Vue application. - I added Vuex as a way to put my all my data access code in one place. - I used IndexedDB to persist the ToDos over every load. This is still only per device so if you open the app on another machine or in another browser, it won't have the same data. Let me explain each step of this. Switching to an Application This part should be relatively straight forward. The original version of my application (which you can see here) was built with just a script tag and some code, no build process. There's nothing wrong with that! But with the idea that I'm enhancing this application to make it more powerful, it made sense for me to move this into an application. I simply used the Vue CLI to scaffold a new application, using the -b option to keep it clean of stuff I didn't need. With the new application, I copied over the HTML, CSS, and JavaScript from the first version and ensured everything still worked. A tip I like to share from time to time is to take baby steps as you develop. Adding Vuex I then added Vuex to the application. The idea being that my application components will ask for their data from Vuex and Vuex will handle retrieving, updating, and so forth. This required changes in the front-end component, so let's take a look. First, the HTML as the change here is super minor. <template> <div id="app"> <h2>ToDos</h2> <table> <tr v- <td><span :{{todo.text}}</span></td> <td> <button @ <span v- Incomplete </span><span v-else> Done </span> </button> </td> </tr> </table> <p> <input type="text" v- <button @Save ToDo</button> </p> </div> </template> So literally the only change here is in the index in my loop. Previously my todos didn't have a primary key so I had to use the loop index as the key. Now my todos do have one so I use that instead. ANd that's it. The JavaScript changed quite a bit more though. import { mapGetters } from 'vuex'; export default { data() { return { todoText:'' } }, created() { this.$store.dispatch('loadToDos'); }, computed: { ...mapGetters(['sortedToDos']) }, methods: { saveToDo() { if(this.todoText === '') return; this.$store.dispatch('saveToDo', { text:this.todoText, done:false} ); this.todoText = ''; }, toggleDone(todo) { this.$store.dispatch('toggleToDo', todo); } } } First, I import mapGetters. This Vuex utility makes it easier to use getters from Vuex, which act like computed properties. My created method calls an action on the store that will fetch our data. Both saveToDo and toggleDone now call the store to handle their logic. Implementing IndexedDB For the most part, I copied the work I did back in October last year when I first discussed this topic, Using IndexedDB in Vue.js. My store handles the data, but the persistence is handled by another script, idb.js. (That isn't the best name, but whatevs...) Here's my store: import Vue from 'vue' import Vuex from 'vuex' import idb from '@/api/idb'; Vue.use(Vuex) export default new Vuex.Store({ state: { todos: [] }, getters: { sortedToDos(state) { return state.todos.slice().sort((a,b) => { if(!a.done && b.done) return -1; if(a.done && b.done) return 0; if(a.done && !b.done) return 1; }); } }, mutations: { addToDo(state, todo) { state.todos.unshift(todo); }, clearToDos(state) { state.todos = []; }, toggleToDo(state, id) { state.todos = state.todos.map(t => { if(t.id === id) t.done = !t.done; return t; }); } }, actions: { async loadToDos(context) { context.commit('clearToDos'); context.state.todos = []; let todos = await idb.getToDos(); todos.forEach(t => { context.commit('addToDo', t); }); }, async saveToDo(context, todo) { await idb.saveToDo(todo); context.dispatch('loadToDos'); }, async toggleToDo(context, todo) { todo.done = !todo.done; await idb.saveToDo(todo); context.dispatch('loadToDos'); } } }) Note that I'm importing that second, new script, and I don't actually ever manipulate the state values. I load them from logic in the script. I manipulate a copy in my getter. But reading and writing is done in idb.js. That code is pretty much exactly the same as the blog post mentioned above, but here it is: const DB_NAME = 'tododb'; const DB_VERSION = 1; let DB; export default { async getDb() { return new Promise((resolve, reject) => { if(DB) { return resolve(DB); } console.log('OPENING DB', DB); let request = window.indexedDB.open(DB_NAME, DB_VERSION); request.onerror = e => { console.log('Error opening db', e); reject('Error'); }; request.onsuccess = e => { DB = e.target.result; resolve(DB); }; request.onupgradeneeded = e => { console.log('onupgradeneeded'); let db = e.target.result; db.createObjectStore('todos', { autoIncrement: true, keyPath:'id' }); }; }); }, async getToDos() { let db = await this.getDb(); return new Promise(resolve => { let trans = db.transaction(['todos'],'readonly'); trans.oncomplete = () => { resolve(todos); }; let store = trans.objectStore('todos'); let todos = []; store.openCursor().onsuccess = e => { let cursor = e.target.result; if (cursor) { todos.push(cursor.value) cursor.continue(); } }; }); }, async saveToDo(todo) { let db = await this.getDb(); return new Promise(resolve => { let trans = db.transaction(['todos'],'readwrite'); trans.oncomplete = () => { resolve(); }; let store = trans.objectStore('todos'); store.put(todo); }); } } Again, if you want more details on how this works, check out my earlier post (and feel free to ask me in a comment below). And that's pretty much it. You can see the complete source code of the application here:. I also have a live version you can run here: Header photo by Glenn Carstens-Peters on Unsplash
https://www.raymondcamden.com/2020/01/08/yet-another-damn-todo-app-in-vuejs
CC-MAIN-2020-16
refinedweb
985
61.12
Can't build with Binutils Candidate VERIFIED FIXED Status -- major People (Reporter: nilson, Assigned: bryner) Tracking Firefox Tracking Flags (Not tracked) Details Attachments (1 attachment) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030917 Firebird/0.6.1+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030917 Firebird/0.6.1+ When I try to build with the new required version of Binutils, my builds always fail right toward the end of the process. I'm using the exact same build environment that build many previous Firebirds using the older binutils. I applied CLS's patch to allow building with Win32API 2.4 to my tree before it was checked in, and I was building with Win32 API 2.4/ and the current binutils. The required binutils is a candidate release, BTW. Reproducible: Always Steps to Reproduce: 1. 2. 3. Can you attach a log of the build failure? I'm not 100% sure but I believe this is the same problem I have been running into since upgrading to the candidate release of binutils (binutils-2.14.90) for MinGW. My build gets pretty far, and then consistently breaks at this point: Creating Resource file: module.res /cygdrive/c/mozilla/mozilla/build/cygwin-wrapper windres -O coff --use-temp-file -DMOZ_PHOENIX --include-dir /cygdrive/c/mozilla/mozilla/browser/app -DOSTYPE=\" WINNT5.1\" -DOSARCH=\"WINNT\" --include-dir ../../dist/include/appshell --includ e-dir ../../dist/include/string --include-dir ../../dist/include/xpcom --include -dir ../../dist/include/xulapp --include-dir ../../dist/include --include-dir .. /../dist/include --include-dir ../../dist/include/nspr -o module.res /cygdrive/c /mozilla/mozilla/browser/app/module.rc c:\mozilla\mingw\bin\windres.exe: c:/mozilla/mozilla/browser/app/module.rc:106: syntax error make[4]: *** [module.res] Error 1 make[4]: Leaving directory `/cygdrive/c/mozilla/mozilla/browser/app' make[3]: *** [libs] Error 2 make[3]: Leaving directory `/cygdrive/c/mozilla/mozilla/browser' make[2]: *** [libs] Error 2 make[2]: Leaving directory `/cygdrive/c/mozilla/mozilla' make[1]: *** [alldep] Error 2 make[1]: Leaving directory `/cygdrive/c/mozilla/mozilla' make: *** [alldep] Error 2 Chris, any ideas on this? Bernie, can you attach the generated module.rc file from mozilla/browser/app? i think this should fix it. it will also let firebird build with gcc 3.3.1 I checked in the patch; Bernie, can you confirm that this fixes the build for you? I'm trying it right now... Comment on attachment 132436 [details] [diff] [review] a fix Same as the fixes from bug 203292. r=cls Attachment #132436 - Flags: review+ Shouldn't the bug be confirmed? I forgot to attach my email address when I initially commented on the bug, so I've been out of the loop. Sorry about that. If need be I can test the checked-in patch tomorrow afternoon and post my findings here. My guess based on looking at the patch, though, is that it should fix the problem. When I looked at module.rc after the build error showed up, I saw this part of the code around line 106: #ifndef __MINGW32__ IDB_SPLASH, #endif IDB_SPLASH, Well, I've built off of MinGW and Cygwin, with the latest versions (candidate releases) just now, and it's working just fine. I didn't attempt building earlier before the check-in, though, since I just re-configured and updated MinGW with the binutils and such, because I haven't tried a build in about a month. marking fixed based on comments Status: UNCONFIRMED → RESOLVED Closed: 16 years ago Resolution: --- → FIXED Got a successful build. Well done, guys :) the same problem exist on Thunderbird. basiclly it's the same fix just in another file: mail/app/module.rc like 114 verified fixed 2003-11-09 Status: RESOLVED → VERIFIED Component: Build Config → General Product: Firefox → Firefox Build System
https://bugzilla.mozilla.org/show_bug.cgi?id=220433
CC-MAIN-2019-26
refinedweb
652
60.01
CS::Mesh::iAnimatedMeshSubMesh Struct Reference [Mesh plugins] Sub mesh (part) of an animated mesh. More... #include <imesh/animesh.h> Inheritance diagram for CS::Mesh::iAnimatedMeshSubMesh: Detailed Description Sub mesh (part) of an animated mesh. It can be used to apply various materials and rendering parameters on sub-parts of the animated mesh. Definition at line 739 of file animesh.h. Member Function Documentation Get the factory of this submesh. Get the material of this submesh. Get the shader variable context for this submesh. Get whether or not this submesh has to be rendered. Set the material of this submesh, or 0 to use the material of the factory. Set whether or not this submesh has to be rendered. The documentation for this struct was generated from the following file: Generated for Crystal Space 2.1 by doxygen 1.6.1
http://www.crystalspace3d.org/docs/online/api/structCS_1_1Mesh_1_1iAnimatedMeshSubMesh.html
CC-MAIN-2014-15
refinedweb
140
52.05
Who knows, maybe a part of the "exciting plans for 2015" is to release PolarSSL under a liberal open source license... It's probably to do with how much simpler they are - if I can put my finger on it, I'd say it's because they don't have lots of Things which can tempt you to distraction; for example - if they had a web browser of some kind back then, you'd be tempted away from learning to program in BASIC, or learning how to load that simple-but-fun game. They generally were single task machines that allowed you to focus on one Thing. I'm looking at my Linux desktop right now on this machine. I have a web browser I'm using to type this reply. It also has 8 other tabs open - more tabs will be added later as I continue on my search for knowledge. I have a Konsole terminal open with IRC sessions to multiple servers and channels open. I have PyCharm loaded. I have a VM running, and more to run later. All vying for my time and energy. A child using this machine would be overwhelmed. Even a Raspberry Pi can distract the user of it in the same manner as my desktop. Perhaps it's time to reintroduce kids today to the CoCo2's, the VIC-20's, the C64's, the Spectrums, the ZX81's and so on. Perhaps getting kids to use single-task-at-a-time systems to learn instead of the distraction-inducing tech. of today, would be a very good idea. When my son was 2.5 years old, I put in front of him an ancient old Compaq laptop running Debian. It had Tuxpaint running on it, and I just put it in front of him and let him go on it. Within a short space of time he was using Tuxpaint like a "pro", and then he learned how to power the machine up, and type in his login name and password. Sure, you can do this with today's systems, but they do make it so easy to provide tons of distractions. Here's an old blog post about it:... - I think its a fun read. Fast forward to now; that blog post is hopelessly out of date! I gave them old-but-decent laptops and, eventually, internet access. As soon as they had internet access they stopped tinkering and exploring and started only using the laptop to watch repeat episodes of childrens TV. And now they often want to use their mum's iPad - to play music and watch TV - but they are completely utterly uninterested in tinkering with any PCs. Its sad but its true and I wish I knew what to do about it. Within days, he was "typing" away, loading new paper, working the lever to return the carriage to the start and replacing the ink ribbons. By the end of the month, it was in pieces as he tried to dismantle it to see out how it works. Luckily, I was supervising him so that he does not electrocute himself. The mind of a young child is an amazing thing to watch. I wrote a program in 1986 to automatically generate forms and reports from a 3rd normal form data base. A few weeks ago, I loaded it onto a client's server, and it compiled and ran flawlessly. Right now, it's delivering the same value it did 28 years ago. That old stuff may not have done everything that by today's technology does, but a lot of what it did do has sure stood the test of time. The BBC Master (which my children love) was also a terrific platform to learn to program on. It's just a shame that a lot of the disk drives and disks haven't survived very well. Fire up some Defence Force, Harrier Attack, Doggy, or Zorgon's Revenge, from the good old days! YAY, 8-bit party! Space 1999, 1337, Pulsoids, Skool Daze .. STORMLORD! W00t! :) What's really great, is that the 8-bit days are not over. I see this now, with my kids getting attracted very much to programming on the 8-bit machines. "10 PING:WAIT 10 20 GOTO 10", represent!! 1) For me, this is a prime example of why I personally like programming environments with exceptions. If libnih could throw an exception (I know it can't), then they could do that which would allow the caller to at least deal with the exception and not bring the system down. If they don't handle the exception, well, we're were we are today, but as it stands now, fixing this will require somebody to actually patch libnih. Yes. libnih could also handle that error by returning an error code itself, but the library developers clearly didn't want to bother with that in other callers of the affected function. By using exceptions, for the same amount of work it took to add the assertion they could also have at least provided the option for the machine to not go down. Also, I do understand the reservations against exceptions, but stuff like this is what makes me personally prefer having exceptions over not having them. 2) I read some passive aggressive "this is what happens if your init system is too complicated" assertions between the lines. Being able to quickly change something in /etc/init and then have the system react to that is actually very convenient (and a must if you are pid 1 and don't want to force restarts on users). Yes, the system is not prepared to handle 10Ks of init scripts changing, but if you're root (which you have to be to trigger this), there are way more convenient (and quicker!) ways to bring down a machine (shutdown -h being one of them). Just removing a convenient feature because of some risk that the feature could possibly be abused by an admin IMHO isn't the right thing to do. 3) I agree with not accepting the patch. You don't (ever! ever!) fix a problem by ignoring it somewhere down the stack. You also don't call exit() or an equivalent in a library either of course :-). The correct fix would be to remove the assertion, to return an error code and to fix all call sites (good luck with the public API that you've just now changed). Or to throw an exception which brings us back to point 1. I'm not complaining, btw: Stuff has happened (great analysis of the issue, btw. Much appreciated as it allowed me to completely understand the issue and be able to write this comment without having to do the analysis myself). I see why and I also understand that fixing it isn't that easy. Software is complicated. The one thing that I'm heavily disagreeing though is above point 2). Being able to just edit a file is way more convenient than also having to restart some daemon (especially if that has PID 1). The only fix from upstarts perspective would be to forego the usage of libnih (where the bug lives), but that would mean a lot of additional maintenance work in order to protect against a totally theoretical issue as this bug requires root rights to use. Many developers ignore this, so it's not really surprising that this has happened with inotify too. It's mentioned that a patch wasn't accepted, but it was with good reason - it doesn't fix the problem (by traversing the directory). The bug is not fixed because in order to trigger it you need root to spam file operations in /etc/init, which implies bigger problems elsewhere. If you have root and want to see panics, just echo c >/proc/sysrq-trigger. I find it equally hilarious, scary and wonderful that it's now cost-effective to build a keyboard whose brain is a 72 MHz ARM Cortex-M3 with 127 KB of program space. Of course the manufacturer also proudly tells you this, that the keyboard is powered by an ARM. It's also fun that the firmware of the keyboard is protected (partly by the old-faithful XOR trick, even!) against IP theft. Too bad they didn't include a hub in there, but I guess someone thinks doing so would introduce scary latency, or whatever. Gamers can be a sensitive bunch. If I knew what I was doing I'd try to write an OSC interface into a DAW. Things like transport control or mapping the 10 columns of keys to solo/mute/group buttons on a mixer, or trying to rig it up so that 1QAZ 2WSX 3EDC 4RFV are the 16 keys on a drum machine... I believe the systems that we employ to help us find a job/recruit falls short of our expectations and is in need of some desperate rejuvenation and optimisation! 5 months ago I arrived back from San Francisco and teamed with 2 former colleagues who shared a passion in trying to improve this experience for both developers and hirers. I would like to invite you to be one of the first people to see and use Workshape.io - a talent matching service for Startups. The key premise to Workshape.io is that we are a matching service that focuses on what you want to do in your next role - more specifically: what tech you want to work with and how you want to spend your time as a developer. We feel when you are open to another role your aspirations should be recognised as one of the key components to matching you to a role.We are focussed on rolling out in London right now and currently have roles from companies such as Shazam, Spotify, Qubit and Moo.com online. We are very early stage right now and would really welcome your feedback on the experience, thoughts on the site and how we match you to roles. Thank you for your time CERN's ROOT software alleviates some of this issue with their dictionary builder for their own format. See the relevant bit from Qt's documentation for more information: Whatever library is used by lesspipe - you're safe as long as the output terminal and your kernel are safe. This is a trend not uncommon in GNU software -- features added by someone who at some point thought it was a good idea, but probably didn't even bother using them much beyond an initial test to see that they are somewhat working. Most users likely think of 'less' as nothing more than a bidirectional version of 'more', and not as the "file viewer that attempts to do everything" that it seems to actually be. It's also a little reminiscent of ShellShock. One thing that it is proving (exactly as a lot of people expected) is, we don't have any idea where security bugs (think the next heartbleed or shellshock) are going to show up, we have no idea how good the software out there is (meaning it is bad), and most of the time we don't even know what's running on our own boxes. If these basic things we use hundreds of times a day (less, strings) have huge flaws, we have a lot of work ahead of us. Probably the best exploit in this line is crafting JPEG files which cause buffer overflows in forensic tools and take over the machine being used for forensics. We need an effort to convert Linux userspace tools likely to be invoked as root or during installs from C/C++ to something with subscript checking. Less only installs a mailcap entry for "text/*". A mail reader that could not handle plain text itself would not be much of a mail reader. That also means that it is kind of stupid to have less display non-text things. Still not a real security issue. LESSOPEN or LESSPIPE is a feature that is already achievable via manual means. But automation is the king so it's a nice feature to have it in the software implemented. If we could just stop and move on whenever software is capable of doing what they are intended for as smooth as possible, many of these issues would diminish to exist. $ env|grep LESS LESS= -R LESSOPEN=| /usr/share/source-highlight/src-hilite-lesspipe.sh %s Safe, as long as source-highlight isn't buggy. I also checked my .bashrc and found this # make less more friendly for non-text input files, see lesspipe(1) # NO! I don't want this! # [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" So yes, lesspipe was the default and for some reason I commented it out. I vaguely remember at being annoyed about less showing me something different from the actual binary content of the files. alias less=/usr/share/vim/macros/less.sh Problem solved. Any binary utility that I haven't used in a 6 month period can get lost. The problem is that there are probably a hundred or so more issues like this hiding in /bin/* and /usr/bin/* and wherever else executables are hiding. Is there a way to retrofit 'can shell out' as a capability flag not unlike the regular access permission bits? If even Ange Albertini has had all of his three proposed talks rejected, the rest this year better be damn good! I hope they won't make again those ridicolous creepercards from two years ago, some people seem to never have grown out of highschool. tickets.events.ccc.de uses an invalid security certificate. The certificate is not trusted because the issuer certificate is unknown. (Error code: sec_error_unknown_issuer) That's unfortunate. Doing s/https/http/ doesn't work either. Of course I guess all expected customers know how to add an exception to their browsers, but I couldn't be bothered when just browing out of curiosity. :) Supporter 140: 140.00 EUR Supporter: 120.00 EUR Standard: 100.00 EUR Business Platinum: 750.00 EUR Business Gold: 600.00 EUR Business Silver: 450.00 EUR Members of the CCC e.V.: 80.00 EUR Up-and-coming: 25.00 EUR The revlog data structure from then is still around, slightly tweaked, but essentially unchanged in almost a decade. [1]... If you want to see the commits going forward from here. *. * Um, What? I skimmed through looking to see if at some point the author says "oh, by the way, I told you a lie earlier", but it doesn't look like he does. (If anyone reading this has difficulty believing that there are more rank-2 tensors than outer products ("dyads") of two vectors, note that in 3 dimensions you can specify two vectors by giving 6 numbers, but it takes 9 to specify a rank-2 tensor because it can be represented by an arbitrary 3x3 matrix.) The focus is slightly different: Rascal focuses more on automated code transformations and less on being a syntax highlighting service for editors. But Rascal is remarkably powerful and surprisingly accessible. Basically, Rascal allows you to build Lispy macros in any language. Or to easily parse-and-transform new languages. Or to design entirely new languages and transpile them into something existing. To drive the point home, CoffeeScript, Nimrod and Sass could've easily been built with Rascal. The approach seemed to be, if things break, people will report it and well fix it. While this may not be the best approach, the number of languages supported is too high for a person to check each one manually. Generally, I imagine they wouldn't expect a change like this to break anything significant. [people] use it as a portfolio. [..] To suddenly doink the appearance of peoples portfolios is unfortunate. It is very unlikely that syntax highlighting errors in GitHub will affect someone's chances of getting a job. Sure, this switch could cause some issues but they don't seem to be severe enough to kick up a fuss over. I know the argument: Someone, somewhere has a copy of each repo checked out, so we (the nebulous "we") could reconstruct everything from the diaspora of ".git" directories. It just bothers me to think how dependent OSS has become upon GitHub. It is really easy to highlight simple things (keywords, numbers, ...). However when it comes to more complex scenarios (e.g. where the type of a word depends on the previous one) then the singleline regex based mechanism shows it weakness. Due to that many language support plugins will yield wrong results when you start to split things like function declarations over several lines, even though it's perfectly legal in the languages. Some things can be worked around with the start/end regexes, but nesting those multiple levels deep can get quite akward and I don't think that they were thought of for things beyond braces and multiline comments. Therefore I don't know if Githubs move here is a really good choice. However I think their main motivation might be that this file format already has such a big ecosystem due to Textmate, Sublime and Atom and the parser has a high performance so that they went for it. Browsing the issues list, this isn't just "fringe" languages, either. Perl, PHP, Go, and Clojure all appear to have regressed to some degree. I normally wouldn't understand this type of thing (others say they don't see the problem and it's quite clear where they are coming from), but in a way I _do_ see the author's point of view. When you build something people really care about, any change, no matter how minor, has the opportunity to impact someone. That's why we all build things, isn't it? If Racket syntax highlighting was causing performance issues that were noticeable to Github, performance must have really sucked. Why should Github let Racket drag down its capacity? [1] -... Game 3, which Anand won: And game 11, in which Carlsen clinched the title:...... Podcasting is probably my main "media" for the last 5 or so years. I listen to 15-20 hours per week as I commute, exercise, wash dishes Right now. As a marginal, unprofitable, poorly understood medium podcasts are amazingly "free." At least some of that stems from podcasting being broken. Anyway, if anyone is looking for some fertile space to innovate, podcasting is it. Discovery is completely and utterly broken. Even just getting a podcast that you know the name of can be borderline impossible for less savvy users. Podcasting apps kind of suck too. Podcasts struggle to get interaction, which is important for discovery. I grew up not far from Woodlawn High, attended a neighboring school. After hearing about the trees that were planted in Hae Min's memory, particularly the second tree which was planted behind the school where "Lee liked to flop after an exhausting practice session with the lacrosse or field hockey teams" I recalled doing exactly that every summer after baseball practice (summer league was at woodlawn high) and I was curious to know if the tree giving me shade all those years was the one planted in her memory. So I decided to stop by after work and take some photos with my phone while I was around. Side note I also went to Sunday School with Adnan's brother - or at least saw him around the campus - did not know any of them personally however. My only memory from the trial days is my parents telling me "See what happens when you have a girlfriend!" (grew up in a similarly conservative household, personally very liberal) But I feel that it's disaster porn; gripping us by appealing to the worst of us. I was excited for Serial until I realized what it is. I feel for the wrongly convicted, if that's indeed what happened, but I'm not watching/listening to be an activist against injustice. No, I'm just distracting myself without learning anything by absorbing scintillating details and pondering irrelevant mysteries. FWIW, I have listened to a lot of NPR via podcast for many years, and see a podcast-only version of it as a natural step. At this point, the amateur "three nerds and a microphone" stuff is background noise for when I can't sleep. [1]... [2]... Anyone know if the timing of Serial's debut was co-incidental, or if there's something happening between the two ex-TIL producers that we don't know about? The very high level of engagement the show has with some listeners is surprising. I don't think it's typical, but many posters talk about dedicating hours to reading case documents, re-listening to episodes, doing independent research, etc. [1] To be fair they had quite the career on television before that, but podcasting seems to have become a thing here. [1] But it's production qualities are high quality and so anything that leads people to create more content at a similar level the better ! The fact is that kernel/user hasn't been a very interesting boundary for a long time. There are hundreds of systems-programming problems that can be solved on either side of that boundary, except that if you try to solve them in the kernel debugging will be harder and you'll get embroiled in the constant turf wars that are the hallmark of a declining specialty. The idea that only kernel hackers do systems programming needs to die. Influential counterpoints: distributed systems management/configuration/orchestration, distributed datastores (CAP, CALVIN, Dynamo, etc), system languages (Go, Rust), distributed processing (tilera, niagra, larrabe, gpus), network fabrics instead of trees, &stream processing jnstead of batch (kinesis, millwheel). There has been mind boggling progress since the 90s, just not in the direction he expected. [1] Also, I can't help but note the (probably non-existent) connection to 3-way partitioning for quicksort (which is consistently ~10-15% (iirc) faster than traditional quicksort). It is interesting how we seem to assume that surely factors of two must be the best choice, computers working in binary and all. But sometimes this is true only in theory, but not in practice (binary search), sometimes it's good but not optimal (quicksort), and sometimes it outright is the provably worst choice (dynamic arrays)! But there is an interesting point to note here : GM is not fundamentally the same as Google or other software companies of today. Companies which make physical goods, make more money through making more and more of the same thing. If they have done it many times, the process is well-understood and can be managed by a specialized person ( who specialises in management ) in a central way and that is probably more efficient. Software companies make money from making new and different things. To make a new copy of a software once it is written, all it takes is Ctrl + C and Ctrl + V, or make a new web request. These type of companies are probably more efficient if you simplify the communication structures enabling more collaboration. The well-understood parts ( such as Amazon warehouses, Apple's supply chain etc ) can still be managed using the old management style. The creative organizations can still use the new management style. You can see this style variation when the founders are ousted from the company and management is handed off to MBA folks ( Apple with John Sculley etc. ). Maybe by the time the founders from the new age tech companies have to pass the baton, the management schools of thought will catch up to this ( they already seems to be doing so ) and things won't be so bad as the author predicts. It's a shame that libfdk-aac is also GPL incompatible. It's hands down the best free AAC encoder, but a version of FFmpeg/libav/Handbrake that's compiled against it is not allowed to be distributed. But of course, it's not open-source, while Handbrake is. [1] For those who havent heard of it, 2b2t is an anarchy survival server that's been around for about the same period of time, 3-4 years, with no resets. Virtually the entire map from the spawn point to 5km from spawn is a desolate wasteland littered with ruins griefed bases, castles, and megastructures. With the introduction of the hunger system everything got a lot more interesting, requiring new players to make a mad scramble from spawn and try to find some source of sustenance. It's not uncommon for new players searching for food to duck into a 2-3 year old base that's been long abandoned but has a few precious pieces of bread left in a chest. Typically players will build their bases anywhere between 10-500km away from spawn, and when they do, they build some of the most impressive bases I've seen in the game. One favored hobby of many regulars is to go hunting for these gems that have usually been abandoned years past. Google it and you can get a good idea of exactly how old the map is, but the pictures really don't do justice to the absolute carnage of spawn. Here's a map from a server I play on. This map represents only 6 months or work (we reset our map every 3-6 months) and was done 100% in survival mode: Minecraft, Reddit, Imgur, Facebook, all things you will eventually have to block from your life if you want to achieve anything real. Don't let it consume you. The only winning move is not to play. On the other hand, my single player world which is about 4 years old isn't nearly as impressive. Between material-gathering, going to the work site, clearing the path ahead (largely avoided here by elevation, but still) and actually laying down the road one... block... at... a... time... roads are very slow to build in Minecraft. They take a large amount of investment before they start to pay off, unlike most buildings, and they can't really be fully appreciated except from map views like this site, so they're kind of low-reward for the people doing the work, too. I only run a vanilla server, so I don't know how mods might affect that. Were these tool-assisted in some way? I just can't wrap my head around that time involved if not. Also, some gems in there[1]. [1] The physical Google button is a somewhat terrible idea, I think someone tried something similar a while back Although I guess the first guy's idea was ok (even if the design itself was terrible) as google actually do something similar now Sherpard and Davis' are trite in both concept and execution. IDEO's is prophetic, but they're a pretty good forecasting company. Truly disappointed with Sherpard and Davis' though, walkover commercial designers. Shepard Fairey's one isn't too bad. I can imagine Google having been like that, even if it never was. So what if the weather is insane outside, no big deal if we have to wear masks to breathe, we can always buy clean water at the supermarket and outside reality will be just fine. We'll spend our life inside these programmed virtual worlds, were we can be Gods instead. Fuck reality, we're going Virtual. I know it's not the most popular idea, but I'm just saying...What is the purpose of this, except really cool entertainment ? Why is it that so many extremely smart people work on entertainment instead of some real save-the-world-because-we're-fucked kind of problems ? I see this as a great opportunity and industry in the future. I'm surprised Oculus themselves and Facebook haven't teased any sort of OS layer on top of the VR environment. BTW, what are the basic applications of VR headsets. IE, a smartphone's basic jobs are text based communication (SMS, whatsapp, twitter, email etc), calls, camera, web browser, media players, games There are an unlimited number of the jobs and different people use different things, but well, online shopping isn't one of the big ones. What are VR headsets for? Do we have any better understanding of this now than we did ten years ogo? I'm not sure if this is practical, but my mind goes to 3d movies. IE, there's a movie that you watch by walking around and listening to different conversations and seeing different things. What I would really like to know, is how far along development of this thing really is at the moment. The "preorder" button leads to an IndieGogo page which mentions expected delivery in June 2015 and aside from a really well executed landing page with impressive videos and interface shots, there is little detail about the state of the project. This is how it should sound: Okay. here's a question: how would the world look like today had Android started based on Plan 9 instead of Linux? It doesn't really seem "dead" (though close to it), it's interesting to me that even 6 years after this post Plan 9 was still being ported. To be honest, a fair amount of the good features have been ported from Plan 9 into Linux. I don't bother using Plan 9 personally because it doesn't have a lot of the support I need, and many Linux distros support what I need. However, if there more general support I would definitely use it, it's pretty slick. Bottom line is unix is good enough and no one is interested in the effort/risk it'd take to develop something significantly better. I blame the ultimate demise of commercial unix on infighting between HP, Sun, Cray, Digital, Tandem and everyone else who had a better idea of what UNIX should look like: i.e. how their UNIX was perfect in every way and safe to lock into because it addressed all your needs. I remember impassioned arguments about whether HP-UX or Solaris was the better server to host Sybase or Oracle because the developers of said products developed on one first and ported to another, or so it was said. When I tried to show Linux to my peers in the early 90's it was "Meh, proprietary hardware is better than PC hardware, why would we use that?" Eventually as we all know commercial Linux won the day over pretty much everything else. I also tried to show people Plan 9 and was again shot down by people who lacked vision, but this time they were right. The only thing it seems most UNIX family members agree on is Plan 9's the red-headed cousin every UNIX vendor hates. For me it had echoes of Apollo's open namespace concept on their OS. But as others have stated a) it didn't have any compelling reasons to adopt it over standard UNIX for an average business, b) it had a bunch of UI quirks that only a mother could love. I still think we have things to learn from Plan 9 if you take the open namespace concept and wrap it in a container. My company (a Fortune 50) is getting rid of laptops, privileged remote access (no root over VPN) and even desktops (most everyone's hosted on virtual desktops now.) Why not give me access to a desktop wrapped in an encrypted container? I boot their OS, it establishes contact with a server that verifies my boot-disk is uncorrupted and then downloads whatever I need to work inside the container, but once I'm done it's all destroyed until next time? I can operate inside my employer's namespace but once the access is gone there are no local traces? shrug Anyway back to Plan 9, it was good. It wasn't great enough to make anyone switch. The last problem is a hurdle that that all good operating systems with fewer than a hundred million installs face. Driver support. Plan9 with a Wayland style compositor supporting hardware acceleration could be a base for some cool new directions in UI. A Raspberry PI running Plan9 with a spiffy accelerated compositor and plan9ish file-framebuffer-windows would be enough to convince me to dive in and have a play around.... Looks like V8 runs Mozilla's JS tests too. I didn't know that. Does Mozilla do something similar to ensure that V8's tests work in Mozilla(Firefox) as well? Generally having so many devs working off the same branch at the same time can be a bit problematic. My philosophy is that master should be for branch merges only. My post: It is good to see that a company can accept that there is a better tool, github. They were WRONG Google is moving to github Lots of repos are hours old thanks down voters. I worked on Angular last year building an app with a few complex views. The initial days were full of glory. Data-binding was new to me, which produced much goodwill towards the framework. Things started falling apart as I had to inevitably understand the framework in a little more depth. They practically wrote a programming language in the bid to create declarative templates which knows about the Javascript objects they bind to. There is a hand-rolled expression parser (...), new scoping rules to learn, and words like transclusion and isolate scope, and stuff like $compile vs $link. There is a small cottage industry of blogs explaining how Angular directives work (). The unfortunate thing is that all of Angular is built on directives (ng-repeat, ng-model etc.); so till one understands it in depth, we remain ignorant consumers of the API with only a fuzzy idea of the magic beneath, which there is a lot of. The worst however was when we started running into performance problems trying to render large tables. Angular runs a $digest cycle whenever anything interesting happens (mouse move, window scroll, ..). $digest runs a dirty check over all the data bound to $scope and updates views as necessary. Which means after about 8k-10k bindings, everything starts to crawl to a halt. There is a definite cap on the number of bindings that you can use with Angular. The ways around it are to do one-time binding (the data won't be updated if it changes after the initial render), infinite scrolling and simply not rendering too much data. The problem is compounded by the fact that bindings are everywhere - even string interpolation like `{{startDate}} - {{endDate}}` produce two bindings. Bindings are Angular's fundamental abstraction, and having to worry about its use due to performance issues seems quite limiting. Amidst all this, React feels like a breath of fresh air. I've written a post about what makes it attractive to me here:. Compared to Ember, neither Angular nor React dictate as rigorous an organization of files and namespaces (routes, controllers, views), and have little mandatory conventions to follow. But React is as much a framework as Angular is. The event loop is controlled by the framework in the case of both, and they dictate a certain way of writing templates and building view objects. They can however be constrained to parts of the app, and so can play well with both SPA and non-SPA apps. The data models are plain Javascript objects in both (it is not in Ember), which is really nice. Google recently released a new version of their developer console () which is built on Angular. So the company is definitely putting their weight behind the framework. However, Angular 2 is not at all backwards compatible. That was quite unexpected. If I had known this going in, I would have never used it for the project. But it felt like such a good idea at the time... The Mithril blog is also worth a look, it addresses a lot of concrete scenarios with recipies to solve common front end problems with the framework. For example, here's a post on asymetrical data binding [3]. 0.... 1.... 2. 3.... A: I've used tech X in a lot of Y contexts, and I find it's not great. I will generalise slightly imply that tech X is not the panacea that it has been presented as. B: Yeah? Well, I've used tech X in a lot of Z contexts, and I find it works fine! You're wrong! You're using it wrong! Maybe you're not wrong in context Y, but for most other contexts X is still the best tech! C: I haven't used tech X at all, but here's my opinion on it anyway. One thing I agree with the author about is the importance of expertise for a successful Angular project. Some specialized knowledge is needed to get a decent fit and finish, and the results can be horrible without that. Strongly discouraging globals goes a long way towards improving code written by inexperienced engineers, but Angular's provider system is still not clearly documented with practical examples, which makes those engineers more likely to shove everything into the unavoidable Angular constructs (controllers, directives, $scope). The middling quality and small availability of third-party Angular libraries is a problem. I believe that greater awareness/better tooling for ngDoc would be a tremendous help there. Best practices are not well-presented anywhere in the Angular world, particularly for designing reusable Angular libraries. The other big problem is the project source code which I find poorly organized and documented. If you want to get into the guts of Angular for debugging purposes, good luck! Have I just drunk too much kool-aid? Or is it possible that with the right team, the right architecture, Angular can actually be a really great framework to use? The common theme for every large Angular project I've worked on is that the teams have leaned towards a more functional design where state is rarely used. This has always seemed to encourage smaller, decoupled modules which don't suffer from many of the problems that the author mentions. But hey, it's probably the kool-aid. I'm currently working on a comparatively large webapp built in Angular and it was after about 7 months into the project that we started realising it's pitfalls, and it was very difficult to abandon it then. So we worked it around by:1) using one-way binding (or bindonce to be exact) to reduce watches2) avoiding un-necessary $apply() and using $digest() carefully if required3) using ng-boilerplate for scaffolding4) defining our own style guides/coding conventions/design patterns to overcome Angular's bad parts5) frequent code-reviews that made sure new team members are upto speed with the above techniques luckily we haven't ran into much issues after that :) - create a big form based on an XML schemas, the form will be used to generate valid XML with the schemas - some schemas can be really big with more than 3000 elements, the whole thing won't be shown in full to the user directly but probably folded - because it is based on XML Schema, it must have interactivity to make some elements repeatable, and groups of nested elements repeatable, some elements with bounds, some maybe draggable to reorder them, everything an XSD can do... - it will also some kind of polymorphism where you can choose the children element type and have the corresponding schema showed - it will also show a leaflet map, with some interaction between the form and the map - there is also a rich text editor where you can arrange xml objects between formated text I fear that angular won't be fast enough for that, but his support for forms seems better, I've tested JsonSchema forms generator like and the first one is slow when editing 3000 items the second seems fast when editing, and slow when it generates the json. I've done some angular tutorials and their concepts don't stick in my head. I've tested React and their concept stick easily in my head but there is less native support for forms. I had just decided to go with angular partly because of all the hype around it, but I see the article and others as a bad omen and I want to go with react now. Any advise ? The thing I would like to add to the debate is this: We've all learned that Angular is hard. It's a complex beast with it's own nuances and idiosyncrasies. It also offers plenty of ways to do things you probably shouldn't do (i'm looking at you expressions). But more than that, with Angular in the tool box, people push themselves to deliver products vastly more complex than would be feasible without it. And these two issues collide all the time. Learning a framework + the desire to deliver more; One should follow the other, but people tend to attempt both at the same time. I personally don't think there's anything "wrong" with Angular, but people have to acknowledge that despite the marketing hyperbole, learning Angular means setting out on a long and difficult journey that will require the developer to rethink a lot of what they know about building web stuff. But that's web development in a nutshell. It's a different gig every year, and within an alarmingly short amount of time, Angular will probably be replaced with something better suited to the tasks that try to accomplish the thing we want to accomplish with mere HTML, CSS and Javascript. There's also a lot to be said for how you organise your projects and what tools you use (eg Require or Browserify etc etc), but that's a very different kind of conversation. But this article is not Angular specific at all, it stays on a very high-level. Replace the word Angular with any other web framework and the article would still make perfect sense. Not that the article does not have some value, just that it has very little to do with its title. Take example of rails. I was trying to learn it sometime ago and was really amazed how it has a process for nearly everything. Migrations, asset pipelines, generators, and very extensive command line. Sure it does make it seem like "Once I learn it, it will be so much easy to make the next app" but it is easy to realize after sometime that you have to cross usual hurdles of Googling everything, learning these processes, facing issues, digging out new ways of debugging to finally be good at it. My idea is that frameworks should be minimal which only ensure a basic working architecture and everything else should be extensible (via packages). But most developers think, that when they learn once a Framework, they can use it for any kind of project. When i read "xxx is really cool and fun" iam really careful. Most people create a "Hello World" and then THEIR favorite framework is the greatest thing in the universe and they communicate it to others. Take a framework, live with the mistakes, until the next "better" framework appear... and it will appear, and the next, and .... ;) It's also hard to motivate starting a potentially large project in Angular right now, knowing that v2 is on the way that is basically a new framework. Angular is the Rails of Javascript. That probably sounds like a derogation. But behold: I offer nuance! They're both big and powerful, and capable of rewarding dedicated study with enormous power. Thus they develop a devoted following whose members often do things lesser mortals find little short of wizardry. They're also both built to be friendly and welcoming to the newcomer, and offer a relatively short and comfortable path from zero to basic productivity. Thus they trigger the "I made a thing!" reward mechanism which excites newbies and leaves them thirsting for more. They also, in order to go from newbie to wizard, involve a learning curve like the north face of K2. In both cases, it's a necessary consequence of the design decisions on which the platform is based, and those decisions, by and large, have sensible reasons behind them -- not, I hasten to note, decisions with which everyone will (or should) agree, but decisions which can be reasonably defended. But that doesn't make it a good thing. When people start off with "I made a thing!" and then run smack into a sheer wall of ice and granite, initial excitement very often turns into frustration and even rage, as on display in some comments here in this very thread. (I hasten again to add that I'm not judging anyone for being frustrated and angry over hitting that wall -- indeed, to do so would make me a hypocrite, given my reaction to hitting that wall with Rails a year or so ago.) Further compounding the issue is that, often enough, wizards who've forgotten the travails of their ascent will condescend to say things like "Well, what's so hard? Just read {this book,that blog post,&c.} and it's all right there." Well, sure, for wizards, who are well accustomed to interpreting one another's cryptic aides-memoire. For those of us still toiling our way up the hill, not so much. I will note, though, that while I hit that wall (hard!) with Rails, and in the end couldn't make it up, I haven't had the same problem with Angular. The sole significant difference I can identify, between the two attempts, is this: When I took on Rails, there was no one else in the organization who knew (or should've known) the first thing about the platform. When I had a problem with Rails, I faced it all alone, with only my Google-fu, my source-diving skills, and my perseverance on which to rely. For a while I did well, but in the long run, for all but the most exceptional engineers, such expenditure of personal resource without resupply becomes unsustainable. When I take on Angular, I do so with the support of a large team, composed of the most brilliant and capable engineers among whom I have ever had the privilege of working. When I have a problem with Angular, I have a dozen people at my back, at least one of whom is all but guaranteed to have encountered the exact same situation previously -- or, if not this precise permutation, then something very like it, from which experience more often than not comes precisely the advice I need to hear, to guide me in the direction of a solution. Of course, whether this is really useful to anyone is an open question; I think it's a little facile, at least, to say "Oh, if you're having Angular problems, all you have to do is find a team of amazing people who mostly all have years of Angular experience, and work with them!" But, at the very least, if you're going to be fighting through the whole thing all by your onesome, maybe think about picking up a less comprehensive but more comprehensible framework, instead.
http://hackerbra.in/news/1416837722
CC-MAIN-2018-26
refinedweb
7,956
68.7
Look-Ahead Bias: What It Is & How to Avoid Look-ahead bias occurs by using information that is not available or known in the analysis period for a study or simulation, leading to inaccurate results. An often-overlooked point regarding look-ahead bias is that it isn’t just about when a data observation becomes available; it’s also about when you can access the data. One of the challenges with look-ahead bias is that it is difficult to detect during backtesting. The backtest cannot signal that the data is biased. Often our only indication that the data contains bias is that the returns are excellent. The best solution to prevent backtesting is to thoroughly understand look-ahead bias and then set up systems and processes to protect against it. Let’s look at a few examples of look-ahead bias and then how to prevent it. Look-Ahead Bias Examples In the below examples, think about how each example introduces look-ahead bias. Try to identify the following three moments in time for each piece of data: - When was the data observation? - At what time was the data released? - What time was it available to us? Selection Look-Ahead Bias Consider you’re a fan of Apple products, and you know the company has been performing well over recent history. You decide to create a trading strategy to trade Apple backtesting your approach over the 2014-2019 period. This strategy’s performance will look unreasonably good as Apple’s stock price increased by 190% compared to 63% over the same five-year period for the S&P 500 index. Data Observations & Revisions Let’s examine a more complicated example incorporating look-ahead bias using Federal Reserve Economic Data. The Bureau of Labor Statistics (BLS) released state and local employment data on March 13, 2017. The BLS initially estimated that St. Louis added 38,300 jobs in 2016, but the revised data show that only 17,100 jobs were added. A trader using unemployment data in their strategy would need to simulate using the initial estimate up until the time a revision was made available. Don’t be surprised employment data get revised. Let’s look at the moments in time for the first revised observation. The data is released at 8:30 AM, so our strategy should be able to trade on the data the same day it is released. If it’s hard to see from the chart, I’ve provided a table of the unemployment data. Release vs. Availability Take a look at Apple’s income statement below. Imagine that we created a trading strategy that buys companies when their after-tax profit margin reaches 22%. In our example, Apple reaches this level of profitability on 9/30/2018, so we buy, right? \(\frac{\$59,531,000}{\$265,595,000} = 22.4\%\) Unfortunately, the earnings observation for the quarter ended 9/29/2018 wouldn’t be available to us until the data was released to the public after market close. An after-hours release means we could only start trading using the information on the next day when the market opens. How to Protect Against Look-Ahead Bias To prevent look-ahead bias, you have to avoid it in both your data and the backtesting system. Bitemporal Data The best way to protect against look-ahead bias at the data level is to use bitemporal modeling, or more simply, to record data along two different timelines: - Data as it was recorded - Data as we know it now In other words, we would need a column for every time there is a new revision. Using the above Federal Reserve data above makes this more concrete. If you’re not familiar with Python, skip the code and look at the spreadsheet data underneath it. import pandas as pd import urllib url = '... analyzingalpha/master/look-ahead-bias/unemployment.csv' with urllib.request.urlopen(url) as f: unemployment = pd.read_csv(f, parse_dates=True, index_col='observation_date') print(unemployment.head()) 2017-01-24 2017-03-13 observation_date 2012-01-01 0.3 0.3 2012-02-01 0.4 0.4 2012-03-01 0.4 0.5 2012-04-01 -0.3 -0.2 2012-05-01 -0.1 0.0 The ALFRED data provides us with bitemporal data with three columns: - The observation date - The initial observation data - The revised observation data We would need to add a column for each revision. Again, we always need to know how the data was at the time of recording, and how it is today. Providing the right data to our backtesting software is the first step in preventing look-ahead bias. Look-Ahead Bias in Backtesting Systems Even with the right data, look-ahead bias can still creep into our backtests. There are two types of backtesting software: - Vectorized “for-loop” backtesting systems - Event-driven backtesting systems Vectorized Backtesting Systems A vectorized, for-loop backtester is the most straightforward type of backtesting system. Vectorized systems loop over each trading day and perform a calculation, such as a moving average on the data set. The danger with vectorized, for-loop backtesters is that they are prone to look-ahead bias, due to mistakes with indexing. For instance, with the Federal Reserve data above, what should your unemployment data value be for 2012-04-01 on 2017-01-24 if you’re an Australian trader? What about 2017-03-13? It’s easy to make a mistake if you’re not careful. This is a logical indexing problem, and event-driven backtesting systems prevent this from happening. Event-Driven Backtesting Systems Event-driven systems are much more complex and more closely replicate live trading performance. Without getting too technical, event-driven systems eliminate look-ahead bias at the trading level by how they use queues and pass messages. Armed with bias-free data and an event-driven backtesting system, you’re taking the first steps to develop a good backtest. Additional Resources Exclusive email content that's full of value, void of hype, tailored to your interests whenever possible, never pushy, and always free.
https://analyzingalpha.com/look-ahead-bias
CC-MAIN-2020-29
refinedweb
1,020
55.03
I have started to learn Python. I very confused with one-liner used in this code (5th line in the below code). Can someone please explain to me how this one liner is working? May be re-write in verbose way? multiset = [2, 2, 3, 3, 4, 5, 6, 7, 8, 10] x = [0] deltaSet = set(multiset) for candidate in deltaSet: if sum([(abs(candidate-member) in multiset) for member in x]) == len(x): for member in x: multiset.remove(abs(candidate-member)) x.append(candidate) if len(x) == n: break I believe the line you are looking at is: sum([(abs(candidate-member) in multiset) for member in x]) First, there are far too many parenthesis there. Lets get rid of the stuff we don't need: sum(abs(candidate-member) in multiset for member in x) Phew, that's a little better already. Now lets actually look at the expression piece by piece: abs(candidate - member) in multiset This is self explanatory enough ... Is the absolute value of the candidate minus the member in the multiset? If yes, the expression returns True, if not, the expression returns False. Now what are the member? Well, there's one for each thing in the iterable x. So you're summing a bunch of True and False. In python, booleans are subclassed from int (with True == 1 and False == 0), the sum is basically counting the number of times that expression we talked about earlier is True. Then they check if it is equal to the len(x) so basically, the code is checking if the expression is True for every member in x. Fortunately, there's a better way to write this in python: all(abs(candidate - member) in multiset for member in x) If this is still confusing, we could rewrite this as a function (lets call it f(x): def f(x): """Equivalent to `all(abs(candidate - member) in multiset for member in x.""" for member in x: if not abs(candidate - member) in multiset: return False return True For some reference reading, in both cases, I've used generator expressions (which are similar to list-comprehensions in syntax and meaning, but they generate the items "yielded" on the fly rather than materializing an entire list at once. They're more memory efficient and faster for some operations. They're particularly useful for cases where you don't need to look at every item to know the result (e.g. this one where a single False is enough to make the entire expression False).
https://codedump.io/share/LpxhOjT2r1Ii/1/python-how-to-write-this-python-one-liner-in-39readable39-way
CC-MAIN-2017-39
refinedweb
426
60.35
0 i see how this code prints s which is 'cad' but, then it somehow backtracks to print s again which is 'cat' according to the results after i execute it. can someone walk me through how this works? it would be a great help. def eds(k,L,s): """ starting with the k-th list in L, adds letters to the current string s """ if k >= len(L): print s else: for i in range(0,len(L[k])): eds(k+1,L,s+L[k][i]) def main(): """ enumerates letter combinations """ S = ['c','s','v'] V = ['a','e','i','o','u'] E = ['d','t','w'] L = [S,V,E] eds(0,L,"") main()
https://www.daniweb.com/programming/software-development/threads/262977/please-explain-backtracking
CC-MAIN-2016-44
refinedweb
115
74.73
Open a file #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int open( const char * path, int oflag, ... ); int open64( const char * path, int oflag, ... ); If you set O_CREAT in oflag, you must also specify the following argument: libc Use the -l c option to qcc to link against this library. This library is usually included automatically.: You can also specify any combination of the remaining flags in the value of oflag:. The largest value that can be represented correctly in an object of type off_t shall be established as the offset maximum in the open file description. A nonnegative integer representing the lowest numbered unused file descriptor. On a file capable of seeking, the file offset is set to the beginning of the file. Otherwise, -1 is returned (errno is set). ; } open() is POSIX 1003.1; open64() is Large-file support The open() function includes POSIX 1003.1-1996 and QNX extensions. chmod(), close(), creat(), dup(), dup2(), errno, fcntl(), fstat(), lseek(), read(), write()
http://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/o/open.html
CC-MAIN-2022-21
refinedweb
167
69.89
23 April 2012 16:25 [Source: ICIS news] LONDON (ICIS)--Braskem remains interested in a potential ethylene and polyethylene (PE) project based on Bolivian gas, an executive with the Brazilian producer said on Monday. The best location for the project would be the border area between ?xml:namespace> “Braskem has an ongoing interest to build ethylene and PE units based on the ethane content in the natural gas that goes to Braskem does “not have details relating to this new approach that YPFB is considering”, Thiesen remarked. YPFB’s proposed project in Yacuiba has been modified and is now expected to include 1.05m tonnes/year of PE, according to Jorge Buhler, director of US-based Polyolefins Consulting. Previously, the PE capacity was planned to be 600,000 tonnes/year. The project is scheduled to start up in 2016, Buhler said. Last year, YPFB.
http://www.icis.com/Articles/2012/04/23/9552817/braskem-confirms-interest-in-brazilbolivia-ethylene-pe-project.html
CC-MAIN-2013-20
refinedweb
144
62.78
In this we will explore the dataset further. The dataset is available here. import pandas as pd # Only to get a broader summary pd.set_option('display.max_rows', 300) pd.set_option('display.max_columns', 30) pd.set_option('display.width', 1000) data = pd.read_csv('riasec.csv', delimiter='\t', low_memory=False) print(data) Which will output the following. R1 R2 R3 R4 R5 R6 R7 R8 I1 I2 I3 I4 I5 I6 I7 ... gender engnat age hand religion orientation race voted married familysize uniqueNetworkLocation country source major Unnamed: 93 0 3 4 3 1 1 4 1 3 5 5 4 3 4 5 4 ... 1 1 14 1 7 1 1 2 1 1 1 US 2 NaN NaN 1 1 1 2 4 1 2 2 1 5 5 5 4 4 4 4 ... 1 1 29 1 7 3 4 1 2 3 1 US 1 Nursing NaN 2 2 1 1 1 1 1 1 1 4 1 1 1 1 1 1 ... 2 1 23 1 7 1 4 2 1 1 1 US 1 NaN NaN 3 3 1 1 2 2 2 2 2 4 1 2 4 3 2 3 ... 2 2 17 1 0 1 1 2 1 1 1 CN 0 NaN NaN 4 4 1 1 2 1 1 1 2 5 5 5 3 5 5 5 ... 2 2 18 1 4 3 1 2 1 4 1 PH 0 education NaN If you use the slider, I got curious about how family sizes vary around the world. This dataset is obviously not representing any conclusive data on it, but it could be interesting to see if there is any connection to where you are located in the world and family size. What often happens in dataset is there might be inaccurate data. To get a feeling of the data in the column familysize, you can explore it by running this. import pandas as pd data = pd.read_csv('riasec.csv', delimiter='\t', low_memory=False) print(data['familysize'].describe()) print(pd.cut(data['familysize'], bins=[0,1,2,3,4,5,6,7,10,100, 1000000000]).value_counts()) Resulting in the following from the describe output. count 1.458280e+05 mean 1.255801e+05 std 1.612271e+07 min 0.000000e+00 25% 2.000000e+00 50% 3.000000e+00 75% 3.000000e+00 max 2.147484e+09 Name: familysize, dtype: float64 Where the mean value of family size is 125,580. Well, maybe we don’t count family size the same way, but something is wrong there. Grouping the data into bins (by using the cut function combined with value_count) you get this output. (1, 2] 51664 (2, 3] 38653 (3, 4] 18729 (0, 1] 15901 (4, 5] 8265 (5, 6] 3932 (6, 7] 1928 (7, 10] 1904 (10, 100] 520 (100, 1000000000] 23 Name: familysize, dtype: int64 Which indicates 23 families of size greater than 100. Let’s just investigate the sizes in that bucket. print(data[data['familysize'] > 100]['familysize']) Giving us this output. 1212 2147483647 3114 2147483647 5770 2147483647 8524 104 9701 103 21255 2147483647 24003 999 26247 2147483647 27782 2147483647 31451 9999 39294 9045 39298 84579 49033 900 54592 232 58773 2147483647 74745 999999999 78643 123 92457 999 95916 908 102680 666 109429 989 111488 9234785 120489 5000 120505 123456789 122580 5000 137141 394 139226 3425 140377 934 142870 2147483647 145686 377 145706 666 Name: familysize, dtype: int64 The integer 2147483647 is interesting as it is the maximum 32-bit positive integer. I think it is safe to say that most family sizes given above 100 are not realistic. You need to make a decision on these data points that seem to skew your data in a wrong way. Say, you just decide to visualize it without any adjustment, it would give a misrepresentative picture. It seems like Iceland has a tradition for big families. Let’s investigate that. print(data[data['country'] == 'IS']['familysize']) Interestingly it give only one line that does not seem correct. 74745 999999999 But as there are only a few respondents the average is the highest. To clean the data fully, we can make the decision that family sizes above 10 are not correct. I know, that might be set a bit low and you can choose to do something different. Cleaning the data is simple. data = data[data['familysize'] < 10] Magic right? You simply write a conditional that will be vectorized down and only keep those rows of data that fulfill this condition. We will use geopandas, matplotlib and pycountry to visualize it. The process is similar to the one in previous tutorial where you can find more details. import geopandas import pandas as pd import matplotlib.pyplot as plt import pycountry # Helper function to map country names to alpha_3 representation - though some are not known by library def lookup_country_code(country): try: return pycountry.countries.lookup(country).alpha_3 except LookupError: return country data = pd.read_csv('riasec.csv', delimiter='\t', low_memory=False) data['alpha3'] = data.apply(lambda row: lookup_country_code(row['country']), axis=1) data = data[data['familysize'] < 10] country_mean = data.groupby(['alpha3']).mean() world = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres")) map = world.merge(country_mean, how='left', left_on=['iso_a3'], right_on=['alpha3']) map.plot('familysize', figsize=(12,4), legend=True) plt.show() Resulting in the following output. Looks like there is a one-child policy in China? Again, do not make any conclusions on this data as it is very narrow of this aspect. Read the next part here:
https://www.learnpythonwithrune.org/pandas-explore-datasets-by-visualization-exploring-the-holland-code-riasec-test-part-ii/
CC-MAIN-2021-25
refinedweb
913
66.74
Back when Apple finally lifted the NDA on its iPhone software development kit, we published a review that mentioned it was possible to get an object-oriented SQLite manager called QuickLite to compile on the iPhone. Since then, a few people have asked how exactly to get that done, so a short tutorial seemed to be in order. This tutorial assumes that you've already set up an iPhone application project in Xcode. QuickLite was popular back in the days before CoreData existed outside of Cupertino, as it provides a nice, Objective C-based interface for getting objects into and out of an SQLite database. SQLite is conveniently located on iPhones out there, and is the tool of choice for storing searchable collections of data. CoreData is not on the iPhone, so it seems like a fine time to go back to the future and resurrect QuickLite, even if it hasn't been updated in over three years. Fortunately, Tito Ciuro, its developer, has maintained the site. QuickLite makes life a bit easier because it frees a developer from translating many of the standard Cocoa objects into formats that can be stored in SQLite. It allows objects like NSStrings, NSDates, and NSData to be inserted directly into SQLite with a single Objective C method call; tables and columns can be identified using NSStrings. Objects pulled out of the database are also accessible as Cocoa objects. Because QuickLite was designed back before SQLite was included as part of the basic OS install, the entire SQLite source code is included with the install. You don't need that in an iPhone application, since the same code is present as an OS-level library. Instead, you just have to add that library to our project. In Xcode, select the Project; Add to Project menu item. When the file dialog appears, navigate to: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/ and select libsqlite3.0.dylib. To actually use any of the code in the library, you need to include the relevant header files to your project. Navigate to a neighboring directory: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/ In that directory, you'll find two files—sqlite3.h and sqlite3ext.h—that need to be added to the project. Simply drag them to your Xcode window, and you should be set to work with SQLite. The final project should look like this. Next, you need to add the QuickLite code. In the folder you downloaded from the QuickLite site, you should find a folder named "QuickLite API." Simply drag that folder into your project's Xcode window, and you should be ready to compile the QuickLite code. When you do, you should get one error and one warning. You can ignore the warning, but the error needs to be fixed. It's in the QuickLiteDatabase.m file, where Xcode will flag the line: return (!myDB->autoCommit); Simply change that to: return (!sqlite3_get_autocommit(myDB)); And you should be set. Now, to use QuickLite, all you have to do is import "QuickLiteDatabase.h" into any of the relevant source files. I've successfully run the code and created an SQLite database in the iPhone simulator, although I haven't used it extensively. If anybody has and would like to contribute some pointers, please do so in the discussion.
http://arstechnica.com/apple/news/2008/11/building-quicklite-for-an-iphone-app.ars
crawl-002
refinedweb
560
65.32
Faking Context In Javascript's Function() Constructor In my jQuery Template Markup Language (JTML) project, I needed a way to compile JTML templates down into Javascript functions such that they could be executed at any time in order to generate new HTML markup. This is a tricky problem because the JTML code makes references to non-scoped variables that have to be available in the rendering engine's context at the time that it executes. When I coded this project, the only solution that I could figure out at the time was to actually create a new Function() every time a template needed to be rendered. This, to some degree, defeats the purpose of compiling the rendering engine ahead of time. After thinking about this problem for a while, I wondered if I could leverage Javascript's apply() functionality to create dynamically-scoped, pre-compiled functions. When you use the apply() or call() methods to change the execution context of a given function, all it really does is change the "this" reference; this has no effect on non-scoped variables, which will still be found by crawling up the function's closure chain. However, what if we had a function that checked for its own "this" context before it executed? If we created a function that appended this-scoped variables onto its local context before running, we should be able to dynamically change the available non-scoped variables simply by changing the function's context. That is exactly what I tried to do in the demo below: - <!DOCTYPE HTML> - <html> - <head> - <title>Javascript Function() With Context</title> - <script type="text/javascript" src="jquery-1.4.2.js"></script> - <script type="text/javascript"> - // I am a proxy for the Function() constructor that prepends - // code to copy the function's context variables into the - // function local scope so that they may dynamically changed - // at the time of execution. - function FunctionContext( sourceCode ){ - // Call and return the Function() constructor. Notice - // that if the THIS is not Window, we are VAR'ing the - // context variables into the function local scope. - return(Function( - "if (this != window){" + - "for (var __i in this ){" + - "eval( 'var ' + __i + ' = this[ __i ];' );" + - "}" + - "}" + - sourceCode - )); - } - // -------------------------------------------------- // - // -------------------------------------------------- // - // Define a function that uses a variable that is not - // defined as part of the function source code. - var saySomething = FunctionContext( - "console.log( name + ', you\\\'re looking so hot!' );" - ); - // -------------------------------------------------- // - // -------------------------------------------------- // - // Now, execute the saySomething() method in three different - // contexts, each of which changes the name. - saySomething.apply({ - name: "Tricia" - }); - saySomething.apply({ - name: "Vicky" - }); - saySomething.apply({ - name: "Erika" - }); - </script> - </head> - <body> - <!--- Intentionally left blank. ---> - </body> - </html> Here, I have created the function, FunctionContext(), which is essentially a proxy to Javascript's Function() constructor. All it does is prepend a bit of logic to the given source-code before it is passed off to the native Function() constructor. The extra logic checks the "this" context of the function; if the function's context is not the window object, indicating that it has been overridden with a call() or apply() method, all of the this-scoped values are var'd into the compiled function's local scope. In this way, any variable that was in the context at the time of execution is now available as a non-scoped value within the function's logic. When we run the above code, we get the following console output: Tricia, you're looking so hot! Vicky, you're looking so hot! Erika, you're looking so hot! As you can see, through the use of apply(), I am changing the context of the compiled function for each execution. And, since the first part of that execution copies this-scoped variables into the local scope, the unscoped variable, "name," never causes an error. I needed a way to dynamically change the variables that were available at the time of a function execution. If I just used the eval() function, I lose the benefit of pre-compiled optimization. If I use just the Function() constructor, I can't really figure out a way to change the available variables without using named arguments (which I may not even know ahead of time). By using both approaches together, however, I think I have found a mostly-elegant way to change the set of available local variables at the time of function execution. a little over my head but I'm subscribing to the entry to be privy to what the rest of your readers have to add. @David, Here's a perhaps more straight-forward was to accomplish this: Yes, interesting. But at the end it comes to question isn't it too expensive to use eval in such an extent. Probably it is possible to solve this using literal notation or exploating namespaces? I quess. I thought the article was interesting, but I found the "{{women's name}} you're looking so hot" examples a bit off-putting.
http://www.bennadel.com/blog/1927-faking-context-in-javascript-s-function-constructor.htm?_rewrite
CC-MAIN-2016-40
refinedweb
810
60.75
I know, this is not Starling/Feathers issue, but maybe somebody else know the answere for this really irritating issue. I create a really simple php to get response from it: <?php echo "TEST"; ?> here is a very simple script for request this php: import flash.net.URLRequest; import flash.events.Event; import flash.net.URLLoader; var request:URLRequest =new URLRequest("");//I created on localhost, and tried with ssl too (https://) var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE,function(eventLEvent):void{trace(loader.data);}); loader.load(request); <b>Got #2032 Stream Error</b> BUT WHYYYYY!!?! I tried on real server too, but the same happend. If I set back the sdk version from 28 to 19, the issue is gone. Its very frustrating, because it's trivial and I dont know whats going on. I know to from air 20 there is a NSAppTransportSecurity on iOS, but I wanted to load data on Android/Desktop
https://forum.starling-framework.org/topic/urlloader-not-work-up-to-air-20
CC-MAIN-2018-26
refinedweb
157
60.31
When this time, I didn’t want to create my own system, but I would use Savant to power the template system. Side note: One of good things about using a 3rd party system rather than writing your own is that the developers of the product are usually dedicated to improving that product. They are not involved in your development so they work on their program, improving, bug fixing and updating. This means that part of your product improves without you needing to do much, except update your integration of it! You can work on other parts of your product whilst that bit is handled by someone else. Comparing Savant to Smarty is difficult. Yes they are both template engines, but Savant does not compile its templates. Nor does it have its own built in scripting syntax. It uses PHP. Many people also consider Smarty to be ‘heavy’ with lots of complex features that aren’t necessarily needed in all situations. For example I didn’t need caching or compiling in my products and I also wanted to work with PHP syntax in the templates, not the custom syntax that Smarty has. [quote="Savant Website"]In short, PHP is itself a template language, so in general there is no need for another template language on top of it. However, there are some specific cases where using customized markup is safer than PHP; for that reason, Savant allows you to hook in a custom compiler for your own purposes.[/quote] (Also see articles by Harry Fuecks and Brian Lozier) Savant2 The idea behind Savant is (what any PHP developer should be trying to do) to separate design from the application itself. i.e. separate the HTML from the PHP code that performs the majority of the functions. This is Smarty does 100% - you see no PHP in the templates. But in Savant, this is not the case. Whilst all the main code is in separate PHP files, there is some PHP in templates. Savant always has 2 files. One of them is the PHP file which does most of the work and then other is a template file (usually with the .tpl.php extension). To illustrate this, here is an example, where I have Savant2.php in the same directory: 'James', 'Country' => 'UK'), array('name' => 'Jill', 'Country' => 'Canada')); $template->assign('title', $title); // Assigning a var to be used in the template $template->assign('customers', $list); $template->display('customers.tpl.php'); // Display the template now ?> In the HTML template customers.tpl.php, I would have this: There are no customers. ... HTML ... customers)): ?> title; ?> There are no customers.... HTML ... This would echo the 2 customers I added to the $list array. Notice how the variables assigned from the $template->assign() call are class variables using $this->varname. Also notice that I’m using PHP control structures (the shortened versions) within the template. Plugins That is a very simple example and the real usefulness of Savant comes with its various plugins and filters. [quote="Savant Website"]Template plugins are objects you can call from your template to automate repetitive tasks. Savant loads plugin objects dynamically as you call them, so you don’t have to pre-load them. However, if you want to pre-load a plugin, you can sometimes configure its behavior in advance; whether or not a plugin can be configured depends on the specific plugin.[/quote] The plugins available include form generation, image/CSS/JS display, and general options like date formatting. Of these, one of the most useful is the option list plugin. One of the problems with dynamically generated option lists is selecting the default value. This is made easy with the options plugin. For example, when editing a database record, I could have this code: // Status list menu options $status_options = array(1 => 'Active', 0 => 'Disabled'); $template->assign('status_options', $status_options); This sets the status drop menu options and assigns them to the template variable. Elsewhere in the code, I have already obtained the data from the record in the database. In the template, I can then create the list, populate it with the 2 options and also set a default value based on the data returned from my database record: Here, the plugin method is called. The first parameter is the name of the plugin, the second is the array of options and the third is the default value. This value could be at any point in the list, it only needs to reference the array key of the options you provide. The output might look like: Another really useful plugin is the HTML checkbox. I’m sure everyone has encountered the problem of trying to determine the value of a ticked checkbox! Savant makes it easy with the checkbox plugin so it is easy to set a value when ticked. You can also just as easily have it set as a value when you’re editing a database record (for example) like with the option menu above. Savant2 works with both PHP4 and PHP5 (Savant3 is written specifically for PHP5). From working with Savant since around October last year, I have been able to do everything I want to do with it. I found that it has easily coped with a large application such as my own, and I expect it could easily scale both ways. It is not bloated, it is well coded (includes PHPDoc source documentation) and it does exactly what I need it to do. There are plenty of engines around. It is all about finding one you like and that suits your project. You’ll find a useful list of engines at Holiday This will be my last post for just over a week. I’m going on holiday to Canada tomorrow and will be back next week on 5th when I shall resume my regular (every other day) posts. July 26th, 2005 at 8:23 pm Great way to introduce XSS attacks into your code… Do you know where that came from? - is it safe? Never trust your own code here, that may be safe today, but one day you will make a change to the backend code, and forget it is used at output time.. -> opening the door to XXS attacks... That’s without getting into the undocumented madness that smarty and savant use with $object->assign()… July 26th, 2005 at 8:37 pm Wow, quite a good post - and something very useful to me. I write software and this templating system looks quite useful, as I don’t want something as complex as Smarty. Although I have my own small templating system for Ottoman, but a future product I’m working on would be much easier to program and manage if I used Savant2. Again that’s for the post. July 26th, 2005 at 8:52 pm In my work and projects I tend to use Brian Lozier’s Template class. It uses pretty much exactly the same mechanism that Savant uses, e.g basically a fancy wrapper for a function-scoped call to extract. Its light-weight, simple and does exactly what I need. For plugins I simply pass in view objects. One thing worth mentioning about templating in PHP is that it’s not about separating PHP code from template files, its about separating business logic from presentation. There is nothing inherently evil about having code in your template files, so long as its code which exists solely to service the presentational aspects of what you are trying to accomplish. This separation isn’t ever going to be solved entirely by the templating software, it’s something which has to be separated by the developer as part of a conscious design decision. July 26th, 2005 at 11:59 pm The template markup looks like PHP, but does it validate? I don’t think so: Parse error: syntax error, unexpected T_ENDFOREACH There is no “endforeach”, while the language looks the same, it is still a custom markup. With smarty, this: <img src=”{$image}/t1.jpg”/> is nicer than: <img src=”<?php echo $value['image']; ?>”> This isn’t a “smarty is better” comment, but a “why choose one over the other if they are the same?” comment. July 27th, 2005 at 1:40 am Hey, I think I have a simpler solution(simpler in syntax). Just a class Template.class.php ——————– I use the template engine of my own. the syntax in the template file will be cleaner. simple, yet it fits my neeeds. < ?PHP class Template { var $path; var $file; var $_vars = array(); function Template() { require_once 'inc/html.php'; } function set($k,$v) { $this->_vars[$k] = $v; } function get($k) { return $this->_vars[$k]; } function parse() { //import vars into this namespace extract($this->_vars); //start buffering output ob_start(); require $this->file; //get the output in buffer $output = ob_get_contents(); //clean buffer ob_end_clean(); return $output; } } ?> sample.tpl.php ————— < ?=$body?> php script to use the template —————————— < ?PHP $tpl = new Template; $tpl->file = 'sample.tpl.php'; $tpl->set('title', 'Hello'); $tpl->set('body','Hello, world!'); echo $tpl->parse(); ?> July 27th, 2005 at 2:21 am Actually, have a read of the manual page: Alternatively you could have looked at the list of PHP parser tokens. Either place lists endforeach as valid PHP. July 27th, 2005 at 2:40 am I’m not sure I follow, isn’t having a presentation detail like calls to htmlspecialchars located in the presentation template a good thing? If you have your calls to htmlspecialchars sprinkled throughout your business logic layers how are you going to prevent double escaping? I tend to work on a Programming By contract method, whereby my templating layer (the view) counts on the fact that it is being passed unescaped data. The templates job is to then format the data provided for presentation, if that presentation language is html then it gets escaped. July 27th, 2005 at 4:15 am There is currently discussion on the Savant mailing list about a new function in the 2.4 release which will handle all the escaping for you. So instead of using echo, which you rightly said might cause XSS problems, you would use the built in Savant function and then any necessary escaping would be done for you. July 27th, 2005 at 4:58 am I still like smarty :/ July 27th, 2005 at 7:22 am For my purposes, Savant is a perfect fit. It’s quick, lightweight, easy to understand, use, and extend. Smarty is huge, slow, complex, hard to set up and debug. Having a few more characters for template tags is a completely acceptable trade-off. Alan, regarding your comments: - Any PHP templating system, and PHP itself, is going to be vulnerable to XSS unless you’re careful about checking your data. Savant is not unique in this regard, and Smarty is just as vulnerable (unless you drop |escape:”html” into every template tag, which seems just as bad as your comment about htmlspecialchars().) - Take a look at assign() and assignRef() in Savant2. assign() is somewhat clumsy, but assignRef() is completely straightforward, and they’re both well-documented. July 27th, 2005 at 8:23 am Thanks for the post David. I am researching PHP template engines and this post (and the links to the articles) couldn’t have been better timed. July 27th, 2005 at 9:11 am iam using the template engines just to make the life easier for the designer as i can’t force him to learn coding with php and there is some customers loves to play with the html in the scripts to fit thier needs so .i love to work with smarty or any better TmpEngine July 27th, 2005 at 9:49 am A very mature and fine templating system that does a lot of the heavy lifting is . It is distinguishable from the large majority of ‘open’ software by its exceptional manual and brilliant examples. If you want to have an exceptionally popular project check out out the examples page to see how you should do it - While the system is exceptionally powerful and flexible the examples are so good (and so cleverly implemented) I reckon you could have a working knowledge of the system in less than an hour. The authors’ support forum is also superb. Tiny has consistently cut my development time by 40% and made it much more maintainable as well. It doesnt get better than that. Oh that all projects had such good documentation. I reckon the principle failing of PEAR is the lack of decent working examples of the libraries in action. July 27th, 2005 at 10:14 am shref: Your comment also applies to Smarty, or any engine that uses a a scripting language. If they don’t learn a bit of PHP to manipulate the templates then they have to learn the scripting syntax of that particular engine. At least if you’re learning a bit of PHP, it isn’t just limited to the templates - you could use it anywhere. July 27th, 2005 at 11:03 am Ian Eure: I don’t understand how you can say smarty is hard to debug? you add $smarty->debug = true; and you get a console of the assigned variables and templates… how can that be hard? As for being hard to setup…. it takes about 45 seconds, I hardly call that hard. July 27th, 2005 at 11:39 am Alan Knowles mentioned “undocumented madness” regarding the assign() method of Savant2. Alan, to what are you referring? The assign() method is pretty thoroughly documented at: If there’s a specific issue that hasn’t been addressed, I’d be very happy to hear about it so I can correct the problem. July 27th, 2005 at 11:50 am Hi, zjcboy, You have described the core of Savant quite nicely with the example of your own template system. Savant works exactly the same way. However, Savant also extends that a bit to allow a very few extra features that, while simple, are very powerful. For example, Savant provides path-management tools. These makes it easier to “skin” an application — if a user wants to replace one template with another, instead of editing the business logic of your code, the user can point to any number replacement directories with the alternative templates in it). Similarly, Savant provides a system for writing and auto-loading convenience code (”plugins”) for common output needs. You write a plugin class, and Savant finds and loads it for your the first time you call it, instead of you having to load up every function and class you might possibly use in advance, whether or not you actually use it in a given template. Hope this begins to explain why Savant is functionally identical to your system, and why the vew few additional features are so handy. :-) July 27th, 2005 at 8:08 pm I’ve been using PHP Savant for a while now. I must look in to using some more of the plugins. July 27th, 2005 at 9:01 pm Undocumented madness is the fact that there is no location where you can natrually document the variables used in the template (it’s just a random array that you sent into assign(). It’s a bit like writing a class, and putting everything into $this->variables[] and expecting someone to understand your code in the future.. (I’ve worked in detail with someone elses smarty templates, and this is a constant nightmare…) - when we converted to flexy, we just used standard PHP document comments and hey presto the code is readable.. Using tags for template engines, that by default use htmlspecialchars() - when you do {givemeavalue} and force you to request the raw data {givemeraw:h} enables you got quickly grep a directory of templates for potential problems ‘grep :h} * -r’ - then backtrace to check if they are really issues. using php or any other method, involves you looking (and probably printing out every single html file) - as some lines may be longer than 80 characters and looking for any variable that is output without escaping!.. (let alone the backtracking to check if it was safe or deliberatly left unescaped) ** or become a regex king? ;) Beginning to get an idea? - design in security early, dont try and kludge it on later… July 28th, 2005 at 12:05 am July 28th, 2005 at 8:26 am Alan said: “Undocumented madness is the fact that there is no location where you can natrually document the variables used in the template (it’s just a random array that you sent into assign().” Ah yes, I see your point. One of the benefits of PHP-based templates is that you can put phpDoc comments in them directly, but generally I have not actually done that in practice. Looks like I need to start, and to recommend the practice. Thanks for the pointer. As far as grepping for non-escaped output, with the new 2.4.0 version (upcoming) you can grep for any instance of echo or print; using $this->_() to escape-and-echo is going to become the recommended practice. (BTW: Funny to see how easily you pwnd planet-php like that. :-) July 29th, 2005 at 8:32 am Why not just use XSL? Its fast, produces standard-compliant code, has a massive user-base so it’s constantly being improved, and its quick and easy to learn! Its also standalone, so doesn’t require PHP to be used, meaning you can swap out your business logic if needed (eg. migrating from PHP4 to PHP5, switching to java/coldfusion/asp…). July 29th, 2005 at 1:01 pm But why bothering so much with templating engines and such? I think it’s much easier just to create a pure PHP file in charge of the creation and display of the interface for the site. This file can contain all the validation/escaping code and interface drawing functions required, thus separating business logic from presentation logic. That is: just put every part in a separate file in order to separate different layers of the MVC model! July 31st, 2005 at 2:12 am Well the savant2 templating engine is quite strain=ght forward and easy to implement but it all depends on the nature and robustness of the web application you are developing. In our projects we tend to use our own template engine, more like savant2. We have three level of template files i.e For Simple page,For Table and for the Rows. So putting evry thing in separate part makes it much more flexible and we can use the ideas of both Smarty and Savant2 templates in our projects. Singing Off !! August 13th, 2005 at 3:35 am I agree with mutant. To me it lookes like you removed the “Smarty shell” from Smarty, found the exposed guts of php and somehow thought that that looked more appealing. Your “template” system may be good for the php developer but now designers need to learn it php to get any work done. August 22nd, 2005 at 7:23 pm Hi Chris — Regarding designers who need to learn a new language to get work done: either they get stuck learning the Smarty markup language, or they get stuck learning a minimal set of PHP commands. If they’re not a security threat, I’d say PHP itself is both easier and more flexible. August 26th, 2005 at 8:48 pm To me it better for designer to learn basic PHP commands once, than to learn once Smarty, other time some other template language. At our office we came to the resolution, that Savant like template engines are more flexable. If designer needs something special, we always can write a plugin! We are developers by the way! If you write a quite big aplication, usualy it has it’s own unique plugins, which make life much more easier. Some of them are universal, some not. In any case, I worked whith smarty… when i came to the table building whith colspans and rowspans at once, I started to hate it, because I had to write a lot of PHP code in aplication core, so that smatry could handle that table generation. Savant would make it much more easier, because you could write complex PHP code in template if you need it. And that was that thing that i needed in my case.
http://www.sitepoint.com/blogs/2005/07/26/savant-template-engine/
crawl-002
refinedweb
3,400
61.26
Monday, January 24, 2011 | 50¢ COMMUNITY AT CROSSROADS Lighting up at the DSS may get even tougher PARABLE ON PARK AVENUE Board set to take action over smokers who ignore signs at entrances BY KARISSA MINN kminn@salisburypost.com JON C. LAKEY/SALISBURY POST Shelia Hargrave, left, talks with Pastor Annalee Allen before a New Tomorrows meeting at Park Avenue Methodist Church. New Tomorrows is a training program offered by the church to the homeless and needy. Church builds relationships with neighbors to fight fear BY EMILY FORD eford@salisburypost.com hen Annalee Allen arrived at Park Avenue United Methodist Church in 2005 as a first-time pastor, she started each morning by cleaning the sheltered entrance. She removed beer bottles. Drug paraphernalia. Condoms. People even used this historic church, built in 1916 and anchor of the pivotal Park Avenue neighborhood, as a bathroom. When Allen arrived at Park Avenue United Methodist, a church once so full of children that teachers held Sunday school classes in the bell tower, she found bullet holes in more than a dozen windows and an average weekly attendance of about 20 people. She found drug deals on the corner, one of the most notorious intersections in Salisbury — Park Avenue and North Shaver Street. She found a congregation caring deeply and profoundly for each other, and soon for her, but still wounded emotionally from the murders of two beloved members in 1992, gunned down in their home across the street. “Fear was very present,” Allen said. “Within the church was a feeling that they were just here, just existing. Almost like they were waiting for something.” For something else bad. W James ‘Bubba’ Phillips helps Pastor Annalee Allen with a pall blanket at Park Avenue Methodist Church. Phillips graduated from New Tomorrows and is now the church janitor. United Methodist Church now opens its doors every weekday to more than a dozen homeless people for Opening the doors an instructional proThe church had closed itself off from the gram called New Todeteriorating neighborhood, figuratively and morrows. literally. In the 1980s, the church tore down Congregation the parsonage, moving its pastor to a home members say New in another community. Tomorrows is one of After numerous break-ins and the murthe best things the ders of B.P. and Ruby Tutterow, the church church has ever bricked up more than two dozen windows. done. But over the past six years, slowly and Class participants gently, Allen has worked to reopen the walk two blocks from church, teaching members to serve the Rowan Helping Minneighborhood they once feared. istries to the church, With a steadfast faith in God and calm de- where they learn to termination, Allen, 43, a former shoe store cook, practice yoga, manager, has encouraged church members study the Bible and A bullet hole in a window at the front of Park Avenue United Methodist to open their hearts and reach out to the less more. offers a view of the house where B.P. and Ruby Tutterow were murfortunate in the Park Avenue neighborhood. Dianne Scott, for“She keeps pushing them gently former executive direc- dered in October 1992. The church members’ murder sent shockwaves ward,” said Sally Langford, the United tor for Rowan Helping through the congregation. Methodist district supervisor who assigned Ministries, calls Allen Allen to Park Avenue. “And generally, Downtown Salisbury Cooperative Parish. a visionary. they’ve come along with her.” The cooperative parish, unique in the re“She does not easily get discouraged,” gion, was Allen’s idea, Langford said. A new prayer garden graces the church’s Scott said. “She can’t get up the mountain “She has great vision for what to do with front yard. Anyone is welcome. one way, she comes around and tries to ministry,” Langford said. “She has great pasThe church hosts neighborhood picnics in climb it another way.” sion for growing whatever situation she is Cannon Park and at Halloween, a trunk or A growing vision in, for imagining how the church can ministreat. Anyone may attend. Allen’s assignment in Salisbury has ter to the community.” This winter, standing on the porch once so grown. Assisted by her husband Craig Allen, While the three churches remain indedefiled, church members handed out 47 blankets and 41 cups of hot chocolate. Anoth- a student at Hood Theological Seminary, she pendent, they share ideas and collaborate on now serves three United Methodist churches weekly service projects like a clothing closer Sunday, they handed out dozens of — Park Avenue, Coburn Memorial and Main scarves and gloves. See CHURCH, 11A Street — and has created the mission-driven Perhaps most remarkably, Park Avenue [|xbIAHD y0 0 1rzu Two county departments are considering widening their bans on the use of tobacco products to their entire campuses. The Rowan County Board of Social Services will discuss changing its tobacco policy at Tuesday’s meeting at the Department of Social Services, 1813 East Innes St., Salisbury. The meeting begins at 5:30 p.m. The Board of Health also plans to consider the changes on Feb. 8. In 2006, the county boards of social services and health adopted policies — with the approval of county commissioners — that allowed their departments to ban smoking within 50 feet of their facilities’ main entrances. “These policies have worked well since adoption; however, the public continues to ignore the posted signs and smoke near the main entrance,” Social Services Director Sandra Wilkes wrote in a letter attached to Tuesday’s agenda. “In addition, since the new DSS facility has been completed and occupied, the number of smokers congregating in smoking and non-smoking areas in front of the building has increased.” Wilkes wrote that directors of both departments have agreed to request that the boards consider adopting a “stronger and more comprehensive ‘Tobacco Free’ policy” for the outside areas surrounding the health department and DSS. The amended policy would ban the use of tobacco products by staff members and visitors at any time on either campus. Tobacco use already is prohibited inside department buildings or vehicles. In other news, the Board of Social Services plan to introduce Tuesday the new DSS safety officer, Michael Buchanan, who joined the staff Jan. 3. “This position was created to help ensure a safe environment for both employees and visitors to DSS,” Wilkes wrote. “Michael will introduce himself and describe his duties.” Also at Tuesday’s meeting, Jon Hunter will advise Board of Social Services members about the Feb. 4 One Church One Child meeting, where Ernie Kirchin will speak about prescription drug abuse. Contact reporter Karissa Minn at 704-797-4222. Proposed law would allow authorities to alter 911 tapes DURHAM (AP) — Officials in Durham want North Carolina lawmakers to give police permission to alter 911 calls before they are released to the public. The request came after the broadcast of a 911 call made a witness decide to stop talking with investigators. The witness’ voice was easily recognizable and the caller reported being threatened after it aired, Deputy Police Chief for Operations Steve Mihaich told The Herald-Sun of Durham. Mihaich didn’t release other details about the call. Recordings of 911 calls are public records, but the city wants to be able to only release transcripts of calls, digitally alter voices so they are not recognizable or allow reporters to listen to calls, but not be able to broadcast them. Durham is asking the state League of Municipalities and the state Association of County Commissioners to help them See 911, 7A — Conclusion of two-day series — Today’s forecast 43º/25º Mostly cloudy Deaths Ruby Holshouser Farrington Anthony “Tony” Gegorek William "Jimmy" Hairston Juanita Hurt Mary Flora Bame Plummer Hilda Lee James Redmond Contents Bridge Classifieds Comics Crossword 11B 5B 10B 10B Day in the Life 8A Deaths 4A Horoscope 11B Opinion 10A Second Front 3A Sports 1B Television 11B Weather 12B 2A • MONDAY, JANUARY 24, 2011 SALISBURY POST M O N D AY R O U N D U P TOWN CRIER Community events TODAY • China Grove Community Blood Drive, 26:30 p.m., St. Mark’s Lutheran Church, 326 N. Main St., China Grove. For an appointment, call the Red Cross office at 704-633-3854 • Red Cross Blood Drive, 2:30-7 p.m., St. Paul’s Lutheran Church, 205 Saint Pauls Church Road. Walk-ins welcome. • The Kneeling Gardeners — 7 p.m., Trinity United Methodist Church, Kannapolis. Authors and Master Gardeners Joyce and Jim Lavene speak on their use of native plants in their writing. 704-933-1127. • Kannapolis City Council, 6 p.m. at the train station, 201 S. Main St. • Salisbury-Rowan Board of Education, 5 p.m., 110 S. Long St., East Spencer. • Rowan County Planning Board, 7:30 p.m., 130 W. Innes St. TUESDAY • Habitat Day at participating Cabarrus restaurants. Eat at the following restaurants and a portion of the proceeds will benefit Habitat Cabarrus: Afton Tavern, Bob Evans, Carino’s Italian, Foster’s Grille, Longhorn Steakhouse, Old Stone Vino and On the Border. • Salisbury-Rowan Choral Society spring concert rehearsals, beginning 7 p.m., Tuesday, Jan. 25, Coburn Memorial United Methodist Church, for all interested singers 16 years and older, 901 S. Church St.,. WEDNESDAY • “Plato Not Prozac” — 4-5:30 p.m., Wednesday and 7-8:30 p.m., Thursday: Dr. Jim Spiceland leads discussion of book by Lou Marinoff. Held at Center for Faith & the Arts, 207 W. Harrison St. (lower level Haven Lutheran Church), no cost to attend, pre-registration requested, 704-647-0999, faithart@bellsouth.net. THURSDAY • Piedmont Players’ “The Three Musketeers” — Jan. 27-30, Feb. 2-5. Meroney Theater, 213 S. Main St. 704-633-5471.. • “Carolina Gator Gumbo” at the Davis Theater,7:30 p.m. Cajun and Creole band plays the music of southwest Louisiana, $10, Davis Theatre, 65 Union St. S., Concord, 704-920-2753, council.org/davis-theatre. FRIDAY • Red Cross Blood Drive, 2-6:30 p.m., Granite Quarry Elementary, 118 S. Walnut St., Granite Quarry. For an appointment, call Patty Helms at 704-279-2154. YESTERDAY: Buck Station baseball Buddy Gettys, former mayor of Spencer, provided this photograph of the Buck Steam Station’s baseball team from the 1950s. Gettys grew up in Dukeville, the village associated with the steam plant. He wrote in a recent guest column that the Buck men’s team played Landis, China Grove, Cooleemee and mill teams in Salisbury as part of a local industrial league. It also played other power plants, including Dan River, Cliffside, Riverbend and Allen. ‘Baseball was a big deal for Duke Power Co.,’ Gettys said. ‘Being a star could weigh more on a job application than other qualifications.’ Gettys (first row, far left) was the youngest player in this photograph. Emil Sparger (first row, far right), Jim Sharpe (second row, second from right) and Craig Bennett (second row, third from left) were among three former professional players on the team. The players were, front row, left to right: Gettys, Cary Grant, Douglas Truesdale, Jim Everson, Ted Stroupe and Sparger; second row, left to right (standing): Kenneth Queen, Day McCoy, Bennett, Taft McCoy, Gary West, Talmadge Broughton, Sharpe and John Leonard. Gettys worked at Buck Steam Station in the summers while going to school. Aerobic exercise can help with aging SATURDAY • “American Heroes” Family Concert by Salisbury Symphony Orchestra, 4 p.m., Varick Auditorium, Livingstone College, featuring the All-County Fifth Grade Honors Chorus; tickets at door, $2-$17, /performancestextonly.asp • Red Cross Blood Drive, 1-5:30 p.m., Salem Evangelical Lutheran, 5080 Sherrills Ford Road. For an appointment, call Penny Barger at 704-636-0352. TUESDAY, Feb. 1 • Salisbury City Council, 4 p.m., City Hall, 217 S. Main St. (Shown on Access16 Wednesdays, Fridays & Sundays at 9 a.m., 3 p.m., 8 p.m.) • China Grove Board of Aldermen, 7 p.m., Town Hall, 205 Swink St., China Grove. THURSDAY, Feb. 3 • Old Courthouse Theatre’s “Divorce Southern Style” — 8 p.m., Feb. 3-5, 11-12, 18-19; 2:30 p.m., Feb. 6, 13, 20, tickets $15/$12/$10, 49 Spring St,. SW, Concord,. 704-788-2405. MONDAY, Feb. 7 • Rowan County Board of Commissioners, 3 p.m., 130 W. Innes St. • Cabarrus County Board of Commissioners work session, 3:30 p.m., Cabarrus County Governmental Center, 65 Church Street, SE, Concord. Lottery numbers — RALEIGH (AP)— The winning lottery numbers selected Sunday in the N.C. Education Lottery: Cash 5: 08-12-23-24-39, Evening Pick 3: 8-6-5, Pick 4: 5-4-5-7 and circulatory function by increasing oxygen consumption. Running, walking, swimming, bicycling are such activities. Fries started this study in 1984 when the “jogging craze” just began. Many scientist thought that the vigorous exercise would do older folks more harm than good. Some even feared that the long term effect of jogging would increase the chance of orthopedic running injuries. Fries saw this differently. He thought that regular exercise would lead to an extended high-quality life free of disabilities. Before this study he didn’t necessarily feel that exercise would extend longevity, but he felt it would shorten the period at the end of life when people couldn’t carry out the daily tasks on their own. Starting this study with 538 runners all older than 50, the participants ran an average of 4 hours per week. Yearly, they would answer questions about their ability to perform everyday activities such as walking, dressing themselves, grooming, getting out of chair and gripping objects. Of course, as they aged, their running time declined to an average of 76 minutes per week, but they were still seeing health benefits. So did they find the fountain of youth? Of the groups of runners and non-runners in the study, on an average both groups were seeing disabilities after 21 years of aging, but it started much later. Runners’ initial disability were 16 years later than nonrunners. That is very impressive if you ask me. Not only did running delay disability, but that gap between the runner group and non-runner group got bigger with time. Even Fries and his team did not expect this. The health benefits of exercise are greater than researchers expected. Fries was surprised the gap between the runners and nonrunners continues to widen, even when the participants in the study entered the ninth decade of their lives. Of course, eventually everyone has to face the inevitable, but so far the effect of running on delaying death has also been more dramatic than the scientists expected. Not surprisingly, running has slowed cardio-vascular deaths but has also been associated with fewer early deaths from cancer, neurological disease, infections and other causes. I know what you are thinking! I bet the knee replacements on runners are through Kluttz, Reamer, Hayes, Randolph, Adkins & Carter, LLP Michael S. Adkins Tyou’ll he only law firm ever need For your convenience, we now accept Ester H Marsh, ACSM Cpt UP TO 500 $ in FEDERAL TAX CREDITS on QUALIFYING SYSTEMS PROGRAM ENDS DEC. 31, 2011 A graduate of the Wake Forest University School of Law, Mike has been practicing in Salisbury since 1992. Let him help you with your auto accident, personal injury, wrongful death, traffic or civil case. See his page on the website for more information. 129 N. Main Street, Salisbury • 704-636-7100 the roof! An article in the August issue of American Journal of Preventative Medicine showed that running was not associated with greater rates of osteoarthritis in elderly runners. Fries said that runners do not require more total knee replacements than non-runners. Before you start “going crazy” and start running your little heart out, check with your doctor if it is the right thing to do, though. As mentioned earlier, this study has been done on runners, but Fries also feels that the benefits seen in this running study are also from aerobic exercises. Fries says that all the wonderful effects are probably due to the great cardiovascular health, a greater lean body mass and healthier habits in general. So yes, if your doctor is OK with you starting a running program, you can contact David Freeze, who is a certified USATF coach with tons of running experience and knowledge. His phone number is 704-3106741. If you already are participating in wonderful aerobic activities such as walking, swimming, bicycling ... stick with it. We are all drinking from the fountain of youth. 705 W. Ryder Ave. Landis, NC 28088 Lic. #: 19627 704-857-5684 Call now for the lowest payments on high efficiency Trane equipment from S.A. Sloop Heating & AC, Inc. Visit us on Facebook: R129064 SUNDAY, Jan. 30 Q: I read your article this past week and in the AARP magazine I read an article on the “Fountain of Youth.” I think it is another great story to share with the Salisbury Post readers. Would you share that with them? A: As I mentioned, I think it is a great follow up on this past week’s column on aging and weightlifting. The story this person is referring to is that Stanford University came out with a study that ESTER regular running MARSH slows the effects of aging. I know what you are thinking: “Tell me more!” The Stanford University School of medicine has conducted a study of more than 20 years tracking more than 500 runners over the age of 50 years of old. The senior author of this study is Dr. James Fries, a professor of Medicine at Stanford Medical school. Even though this particular study is done on runners, Fries says “that if you have to pick one thing to make people healthier as they age, it would be aerobic exercise.” Aerobic exercise is any cardio that improves respiratory R124835 • Winter Flight 8K, NC State 8K Championship, 28th Annual, benefits Rowan Helping Ministries, • Big Band Dance with The Salisbury Swing Band at JF Hurley Family YMCA — 7-10 p.m., Jan. 29, $5 entry fee, bring a snack to share. 828 W Jake Alexander Blvd., 704-636-0111. SECONDFRONT The SALISBURY POST Hospital proposes new hospice facility BY EMILY FORD eford@salisburypost.com Rowan Regional Medical Center plans to ask the city to allow development of a 14-bed Rowan County Hospice facility. The proposed 15,287-square-foot building would stand at 1229 Statesville Blvd., along the south side of the street and across from the intersection with Meadowbrook Road. The hospital’s request will go before the Salisbury Planning Board at 4 p.m. Tuesday at City Hall, 217 S. Main St. The hospital will request an amendment to the city’s Land Development Ordinance & Land Development District Map by rezoning approximately 6 acres to amend an existing Conditional District Overlay, permitting the development the facility. The Planning Board agenda also includes district map amendments requested by the following: • Penny and Terry Sides, to rezone approximately one-half acre at 601 Faith Road from Urban Residential to Residential Mixed-Use. • City of Salisbury, to rezone approximately 17 acres, or 15 parcels, along multiple streets west of Martin Luther King Jr. Ave. from General Residential and Corridor Mixed-Use to Light Industrial. The location includes industrial properties located along Mildred Avenue, Lumber Street, Railroad Street, and East Harrison Street, including such businesses as Goodman Lumber, Akzo Nobel and Graham Roofing. • Jake Alexander/A&H Investments Inc., to rezone .86 acres at 825 E. Liberty St. from Urban residential to Corridor Mixed-Use. The location is vacant property located at the corner of East Liberty Street and North Arlington Street. Contact reporter Emily Ford at 704797-4264. Democrats, GOP take new roles at NC session start RALEIGH (AP) — Democratic Sen. Linda Garrou used to have a key post in the Senate majority, a spacious corner office, extra research assistants and the ear of Senate leader Marc Basnight. People listened intently to what she said because she held sway on forming the state’s $19 billion budget. Now, the longtime appropriations committee chairwoman has to squeeze into one-quarter the size of her previous office. On the same day reporters peppered the GOP senator that took over her old office for hints on the budget, Garrou spent time vacuuming the dust stuck behind her credenza. And Basnight is about gone, set to resign after 26 years in the Senate the day before Democrats officially lose their Senate majority for the first time since 1898. Basnight’s own corner spot awaits expected successor GOP Sen. Phil Berger. “I cannot bring myself to walk over and see Sen. Basnight’s office, I can’t do that. I know that I’ll have to, but I can’t,” said Garrou, D-Forsyth. “It’s ... the end of an era.” While power shifting is commonplace in other states, Democrats aren’t used to being the minority in North Carolina’s Legislature. As the GOP takes charge of both chambers for the first time in 141 years, Democrats are trying to find their bearings, anxious to know how they’ll respond without any real power and how they’ll be treated by their political rivals. Will 2011 be about GOP revenge, or about cooperation and civility? “It is the great unknown,” said Rep. Alice Bordsen, D-Alamance, who led two committees while in the majority. She’ll have no need for gavels the next two years — House Democrats aren’t getting any committee chairmanships. She said her new role is to speak out about GOP policies she believes will harm the state: “I have to become a little noisier.” Berger and presumptive House Speaker Thom Tillis, who’ve been prepping for weeks for Wednesday’s historic opening session by hiring See SESSION, 4A 3A MONDAY January 24, 2011.” N e i t h e r. susan shinn/FoR The sALIsBURY PosT Retiring Chief Gary McLaughlin, left, and new Chief Tim Beaver have served with Atwell Volunteer Fire Department since they were teenagers. “I’ve always been somebody who liked to help. I have a hard time turning people down. It’s more a family than anything else. Everybody sticks together in fire service.” TIM BEAVER new Atwell Fire Department chief, See CHIEF, 5A 13-year-olds donate birthday money to cystic fibrosis research BY CYNTHIA HOOPER For the Salisbury Post The screams of a roomful of boys and girls made it sound like an ordinary birthday party, but this one was different, this one had a goal in mind. Friends Brittany McGee and Margaret Young, who turned 13 in November and December had been planning their joint birthday party since the fall. With the holidays so busy, they hadn’t been sure where or when to have it, but they knew what the end result would be. Friday night was the party, the 7th graders, from Erwin Middle school, decided that they would forgo any presents for themselves, instead asking friends to donate the gift money to cystic fibrosis (CF) research. When the Faith Legion heard about the party and the planned donation, they graciously offered the use of their facilities so the 50 guests would have plenty of space to celebrate. Everyone seemed to be having a wonderful time at the party, even though it was a school night. By the big smile on eight-year-old Gracie Hodge’s face, you would have thought the party was for her. In a way it was, the money raised will be donated in her honor to cystic fibrosis research, and hopefully someday will help find a cure for the disease she was diagnosed with when she was a few months shy of her fourth birthday. When Laura Hodge heard what the girls wanted to do she was ecstatic, “I was shocked, it’s somebody’s birthday and they are taking donations to help others, I am blown away,” she said. Gracie’s dad, Robert and Margaret’s dad, Graham, have worked together at Freightliner for over 20 years. Margaret remembered going to spend time with the Hodge family when she was younger, that was when she met Gracie and learned about CF. The donation idea was hatched earlier this year when one of Brittney’s and Margaret’s teachers, Mr. Klinger, told them they were going to do a project this year that would make a difference in the world. “I always wanted to do something to help CF, but couldn’t think of anything to do. Since our birthdays are so close, we decided to have a party-and instead of presents, we asked for donations,” Margaret said. Right before they cut the cake, Graham Young gathered all the kids around and introduced them to Gracie, holding her up on his shoulder. As he spoke about CF and the struggles the family has gone through, one by one, guests began to find tears rolling down their cheeks, when Young saw them tearing up, his tears started as well. The tears were quickly replaced with screams of joy when Gracie announced that they had raised a whooping $655 so far, that does not include any pledges that were made. Wendy Miller, Brittany’s mother, was very impressed with the idea. “I am so proud of the girls and their dedication to the cause. I think it’s great when young people have compassion and concern for others.” Gracie thought it was great too and had a wonderful time dancing with all See DONATE, 5A sUBMITTeD PhoTo Margaret Young, left, Gracie and Claire hodge and Brittany McGee pose together. McGee and Young donated their birthday money to cystic fibrosis research. Olympians come to Salisbury always enjoy reading Ronnie Gallagher and Mike London’s columns about local athletes who have gone on to achieve significant status in college or professional sports. It is fun to hear about famous athletes who come here too, but seldom do they get to compete on the local stage. DAVID One of my faFREEZE vorite memories is of the Sunday afternoon that baseball great Mickey Mantle came to Salisbury and sat in the stands at Newman Park while his team of ex-professional athletes and current media and entertainers played a local all-star team. It didn’t matter who won, because the demand for Mantle’s autograph never ceased that afternoon. The fans came out to see him. One of the world’s most famous athletes, though past his prime, still made a very special visit to Salisbury. Mantle wore his baseball uniform, but never played. We all hoped he would hit at least once, but he didn’t. Mantle just kept signing those free autographs for anyone who wanted one. On Jan. 29th at Catawba College, many of the region’s best runners will come here to compete in the Road Runners Club of America 8K State Championship. The event is the 2011 Winter Flight 2011, the oldest 8K and the 4th oldest road race in North Carolina. The race has a rich history in its 28 years of existence. I recently came into possession of the race history, compiled for many years by Judy Zirt, who along with husband Bob, were the mainstays and backbone of the local running club for more than 20 years. The other day, while flipping I through a running magazine, I thought of how many times Olympic hopefuls had come here to compete. Some I knew, a few I raced against, but mostly I was just in awe of their abilities. The 8K female course record was established by Joan Nesbit in a time of 26 minutes and 48 seconds in the 1992 race. Nesbit is arguably the most famous of these and is considered a living legend among runners. Nesbit was a collegiate All-American and competed in the 1996 Atlanta Olympics in the 10K event. Her personal is best is 32:04, a spectacular time. She currently lives in the Carrboro area, still running and coaching others. Male course record holder is Hans Koeleman, a Dutch steeplechase champion. His time in Salisbury was 23 minutes and 35 seconds, set in 1988. That record is 22 years old and has not been approached since. Koeleman participated in the 1988 Summer Olympics in the steeplechase event. Runners leap over a tall hurdle and water stop while racing around a track during the steeplechase. Koeleman was the first Dutch athlete sponsored by Nike and became a VP with Nike later. He has been a consultant on many of the new running models, most notably the Air Max line. Other Olympic hopefuls included Jim Cooper, another steeplechase competitor from Charlotte. He was a favorite for the Olympic trials in 1988, but did not win. Cooper actually had the fastest time on record for a 5 mile race in Salisbury, but it was not on the current Winter Flight course. For two years in the early 80s, Winter Flight had both a 5 mile and 10 mile race. The course moved to Catawba College and it’s current 8K course in 1986. Five miles is just over 3 one hundredths of a mile longer than an 8K. Other Olympic hopefuls were Julie and Mary Shea, who finished 1st and 2nd in the Olympic Trials 1,500 meter race and earned guaranteed slots for the 1980 Olympics. America boycotted that Olympics so the Shea sisters did not get to compete. Betty Springs, who married her coach and became Betty Springs Geiger, was 6th in the 10,000 meter trials for the 1988 Olympics. Only the top three qualify. This year, former winner and runner-up last year, Ryan Woods of Boone will return to try to retain the title. Woods is a former All-American and Olympic trials qualifier in the 1500 meter race prior to the 2004 Olympics. I hope I didn’t miss anyone, and better yet I hope that there will be a future Olympian competing this year. Several times I competed in a 10 mile race called the Virginia Ten Miler, annually held in Lynchburg. Once in that particular race, Frank Shorter and Bill Rodgers were entered. Shorter and Rodgers are the Richard Petty’s of road racing. The chance to run in the same race as these guys is a special memory of mine. The same has applied here in Salisbury for many of our local runners when some of the world’s best have competed. This year’s event will be special once again. Start time is 9:30 for the halfmile fun run for kids 12 and under. The 8K run and the 5K Health Walk both kick off at 10 a.m. All events are at Catawba College, and will use the surrounding roads and streets. All proceeds for the event will go to Rowan Helping Ministries. The Winter Flight 8K is founded and operated by the Salisbury Rowan Runners Club. For more information, go to or call 704-310-6741. SESSION quiet and move on.” Republicans generally have followed the methods followed by predecessors Basnight, D-Dare, and House Speaker Joe Hackney, D-Orange, for handing out the prime perks of being in the majority — committee chairmanships and the distribution of office space. GOP lawmakers have received all of the announced chairmanships in both the House and Senate, although the Senate has yet to announce leadership for all committees. Basnight gave chairmanships to a few Republicans. As for office space, it’s tradition that the majority party moves to larger spaces and the minority to smaller ones. Still, new Senate Minority Leader Martin Nesbitt, DBuncombe, said he was pleased how Republicans have handled the move that sent nearly every returning senator to a new office. Republicans even replaced two small offices their members had to use in 2009 and 2010 with larger space for the Democrats to use. In the notso-distant past, people in power punished political enemies by giving them office space Republicans complained resembled a phone closet. Nesbitt said he’s had a cordial relationship with Berger and other Republicans and doesn’t expect that to change although the GOP will usually come out on top on issues. “At the end of the day, they’re probably going to win,” Nesbitt said. “They’re supposed to win. It’s their turn, but it will be perhaps our job to persuade them and move them a little and make sure the public’s informed to what we’re doing down here.” Ran Coble, executive director of the nonpartisan North Carolina Center for Public Policy Research, said it will be interesting to see the significant adjustments the parties must make in their new roles. Republicans will have the responsibility of making budget decisions, instead of merely complaining about them. Democrats will have to draw the fine line of where to cooperate and where to fight the GOP. “This is a chance to see something we’ve never seen before,” Coble said. family also has to worry about her getting osteoporosis, which is not a common concern for a third grader. This is not the first time people have stepped up to the plate to make things a little better for the Hodge family. In June, they went to the Animal Kingdom in Orlando as a Make-a-Wish Foundation trip. They also host an annual golf tournament which last year raised $10,500 for CF research, that was matched 100% by donors. By the end of the party, Avery Wright and Carlie Darnell were exchanging phone numbers with Laura Hodge. Their birthdays are this summer and they want to raise money to help CF as well. Her eyes red from crying, Carlie was asked if she would miss the gifts, “Save a life...that is a present.” According to the Cystic Fibrosis Foundation’s website, cystic fibrosis is an inherited disease that affects the lungs and digestive system of about 30,000 children and adults in the United States. CF is caused by a defective gene and its protein product which cause the body to produce unusually thick, sticky mucus that clogs the lungs and can cause life-threatening lung infections. The mucus can also obstruct the pancreas and stops natural enzymes from helping the body break down and absorb food. Recent advances in research and medical treatments have enhanced and extended life for children and adults with CF. Many people with the disease can now expect to live into their 30s, 40s and beyond. There is still no cure and much more to learn about the chronic disease. “That is astounding to me to hear about young children supporting each other — being that selfless, it is just amazing,” said Sabrina Watt, Executive Director for the Charlotte Chapter of the Cystic Fibrosis Foundation. To make a donation in Gracie’s name, please go to FROM 3a staff, moving offices and setting strategy, say people on both sides of the aisle will be treated fairly under their leadership. Although the majority party has inherent advantages, they say they’ll aim to treat Democrats the way they wanted to be treated while the GOP was in the minority. “We’ve been there for a long time and we know how frustrating it’s been,” said Tillis, R-Mecklenburg. He said some people may think “once you get back in power, it’s payback, right? But from the rules, I don’t think you’ll see that.” For example, operating rules for the House and Senate will remove provisions the GOP has complained for years they say stifles debate. But Sen. Tom Apodaca, the incoming Senate Rules Committee chairman, said the GOP won’t allow debate as simply a delaying tactic. “We want to be fair in the process,” said Apodaca, RHenderson, but “we still know that there comes a time to be DONATE FROM 3a the older kids and her little sister, Claire. Thankfully, Claire does not have CF. When asked what she most wanted people to know about CF, she said, “They don’t have to be afraid, they can’t catch it.” The Hodge family, who owns Hodge Farm in Mt Ulla, were devastated when they found out Gracie was sick. “Because you know she is never going to get over it,” her mother said. Gracie takes over 15 medications daily, including her “old lady drugs,” as she calls them. The cost of treatment is unfathomable, with one chest therapy machine costing over $15,000 and one of her medications alone costing $5,000 a month. In December, Gracie was fitted with a feeding tube to help her gain weight and get the nutrition she needs. She has taken to reading the nutrition labels on food, since she needs to eat a diet high in fats, calories and salt. The SALISBURY POST AREA/OBITUARIES Hilda Lee Redmond Ruby H. Farrington Mary Flora Plummer SALISBURY — Ruby HolSALISBURY — Mary Floshouser Farrington, peaceful- ra Bame Plummer, age 85, of ly passed away on Sunday, Salisbury, passed away SaturJan. 23, 2011, after having had day, Jan. 22, 2011, at Northher with us for East Medical 88 wonderful Center in Conyears. cord. Ruby, the Ms. Plumdaughter of mer was born Carrie Miller Aug. 1, 1925, in and James F. Owensboro, Holshouser. Ky. She was born She attendNov. 21, 1922, in Rowan CounBoyden High School and ed ty, the youngest of their 10 was a member of Stallings children. She graduated from Gran- Memorial Baptist Church and ite Quarry High School in Neel Road Baptist Church. She was a 50 year member 1940. On July 20, 1941, she of the Eastern Star #117. She married Cecil (Buck) Farrington, Sr., who preceded her in owned and operated Mary's Flower Shop in Salisbury. Afdeath. Ruby was employed at ter she retired she worked for Rickman Manufacturing Salisbury Marble. She was a gifted flower deCompany for 13 years and at Carolina Maid Products in signer as well as an excepGranite Quarry for 32 years tional organist and pianist in as a Sewing Room Supervisor. which she played for the EastOver the years she held all ern Star and Churches. offices in the Livengood-PeelMrs. Plummer was preceder-Wood American Legion ed in death by husbands, Max Auxiliary, Post #448 and was Bame and Bill Plummer. also President and Chaplain of She is survived by her the Rowan County Council. sons, Jerry Bame of Salisbury Ruby won the Citizen of and Christopher B. Bame and the Year Award from the fiancée, Amanda Kanson of Granite Quarry Civitan Club Ft. Lauderdale, Fla.; three in 1990. grandchildren, Jeffrey Bame She was a life-time mem(Angela) of Salisbury, Rodney ber of Christiana Lutheran Bame (Raleigh) of Raleigh Church, a member of the Jennie Thomas Bible Class, and Kyle Bame of Port St. Luhelped organize the Altar cie, Fla.; and two great-grandGuild and was a member of children, Max Bame of Salisbury and Barron Bame of WELCA of Christiana. Ruby was preceded in Raleigh. Service: Graveside serdeath by her husband, Buck; and her youngest son, James vices will be held at 2 p.m. Tuesday, Jan. 25, at Chestnut David (Jim). Those left to cherish her Hill Cemetery; conducted by memory are her daughter and Rev. Neil Westbrook. Lyerly Funeral Home is son-in-law, Clarice and Freddy Einstein; and her son and serving the Plummer Family. daughter-in-law, Cecil, Jr. Online condolences may be (Buster) and Monica Farring- made at; 11 grandchildren, home.com. Brad/Maggie, Hayley, Greg/Janet, Chip/Amy, MurAnthony “Tony” Gegorek ray, T.J., Madeleine and SPENCER — Anthony Maryclaire; and six great“Tony” Gegorek, age 52, of grandchildren, Nate, Macyn, Brandon, Nikki, Thomas and Spencer, died at his home in Spencer on Sunday, Jan. 23, Charley. Service and Burial: Funer- 2011. Arrangements are inal services will be held at 11 complete with Summersett a.m. Tuesday, Jan. 25, at Funeral Home serving the Christiana Lutheran Church, family. Granite Quarry, conducted by Juanita Hurt Rev. Carl M Haynes. Burial to SALISBURY — Juanita follow in the church ceme- William James Hairston LEXINGTON — William Hurt, age 88, of 628 E. Bank tery. Visitation: Visitation at the James "Jimmy" Hairston, age Street, passed away Thursday, Jan. 20, 2011, at Rowan Church Tuesday, Jan. 25 from 73, of 404 Frankhulin Road, Regional Med- 10-11 a.m. Lexington, died Sunday, Jan. Memorials: Memorials to 23, 2011, at Hinkle Hospice ical Center. Born Aug. Christiana Lutheran Church, House, Lexington. Funeral ar4, 1922, in 6190 US 52 Highway, Salis- rangements are incomplete Chester, S.C., bury, NC 28146. and entrusted to Hairston FuLyerly Funeral Home is neral Home, Inc. she was the daughter of serving the Farrington famithe late ly. Online condolences may be made at home.com. Thompson Nicholas. A graduate of J.C. Price High School, she was a retired dietitian at Bellview Hospital in N.Y. A member of Mt. Zion CME Church where she served on the Stewardess Memories carved in stone become Board. a lasting tribute. From design to Rev. Benny R. Hillard She was preceded in death installation, monuments are our 2:00 PM-Monday by a granddaughter, Keisha business… Let us help you with Landmark Church Robinson. a memorial that is appropriate, She is survived by daughpersonal and affordable. Mrs. Marion Goodman ters, Joanne Smith of BrookMurphy lyn, N.Y. and Jean Leary of Incomplete Virginia Beach, Va.; devoted granddaughter, Tiffany Robinson of the home; grandMr. Anthony “Tony” daughter, Jasmine Leary of Gegorek 503 Faith Rd, Salisbury Fairfax, Va.; 17 grandchilIncomplete Next to Winks dren; and a host of nieces, 704-762-9900 nephews, cousins other relaMonday-Friday 9am-5pm Saturdays by Appointment tives and friends. Locally Owned & Operated by Visitation: Tuesday, 12 James Poe, Dwight Garrison p.m. at the A.R. Kelsey & Mark Honeycutt Memorial Chapel, Noble and Kelsey Funeral Home. At other times the family will receive friends at the home of family member, Montina Fox, 229 Milford Hills Dr., Salisbury. Service and Burial: TuesView the Salibury Post’s complete list of obituaries day, 1 p.m. At the Chapel, with and sign the Obituary Guest Book at Reverend Brenda Geter, officiating. Burial will follow at Oakwood Cemetery. Noble and Kelsey Funeral Home, Inc. will be serving the family. Online condolences may be sent to. CHINA GROVE — Hilda Lee James Redmond, age 79, went to be with the Lord, surrounded by her loving family on Saturday, Jan. 22, 2011, at her home. Mrs. Redmond was born in Royston, Ga. on Sept. 5, 1931. She was a daughter of the late Reppard Allen James and Carrie “Peggy” James. She was a member of New Hope Worship Center and retired from Cannon Mills after 35 years of employment. In addition to her parents, she was preceded in death by her husband, Hoyt Marshall Redmond. Survivors include children, Mr. & Mrs. Stephan Redmond of Kannapolis, Mr. & Mrs. Timothy Redmond of China Grove, Lisa Redmond Burleson and husband, Rick of China Grove, Mr. & Mrs. Mark Redmond of Concord, Melody Redmond Proctor and husband, Rick of Thomasville, and Kevin Redmond of the home; one brother, Mr. & Mrs. Ferrell James of Kannapolis; 10 grandchildren; and five great-grandchildren. Service and Burial: Funeral services will be conducted at 3:30 pm Monday at New Hope Worship Center in Concord. Rev. Dale Jenkins, Rev. Larry Morgan, Jr. and Dr. Tom Snipes will officiate. Burial will be at West Lawn Memorial Park in China Grove on Tuesday. Visitation: The family will receive friends at the church from 1:30-3:15 p.m. Monday prior to service. Memorials: Memorials for Mrs. Redmond may be sent to Hospice and Palliative Care of Iredell County, 2347 Simonton Road, Statesville, NC 28625. Lady's Funeral Home & Crematory is assisting the family of Mrs. Redmond with arrangements. Online condolences may be sent to the family at. MONUMENTS ARE OUR BUSINESS R128587 4A • MONDAY, JANUARY 24, 2011 Express your feelings. Mrs. Ruby Holshouser Farrington Visitation: 10:00-11:00 AM Service: 11:00 AM Christiana Lutheran Church Ms. Mary Flora Bame Plummer Graveside Service: 2:00 PM Chestnut Hill Cemetery SALISBURY POST MONDAY, JANUARY 24, 2011 • 5A CONTINUED CHIEF r nte i W le Sa FRom 3a FREE FLOWING WATER CONTROL J.A. FISHER 704-788-3217 Attention Residents of China Grove, Landis & Kannapolis! Salisbury susan shinn/FoR the saLisbuRY post Above: From left, firefighters tim beaver, Frank Greene and Gary mcLaughlin talk about how technology has changed the way the fire department operates. Below: incoming Chief tim submitted photo mrs. byrne speaks to the class on what it is like to work for Lowe’s home improvement corporate office in mooresville. Snow make-up day becomes career day for second-graders plained the importance of math in his career and made each child promise “I will learn math!” Mrs. Byrne works in merchandising for Lowe’s Home Improvement corporate headquarters in Mooresville. She explained how she helps customers to choose the right materials for their home. She also told the children about Lowe’s policy of making sure that their customers and their employees are happy. Mr. Bond is an artist of an unusual material; he constructs artwork using neon lighting. He displayed one of his designs, a rabbit. He also creates artworks for various customers. Special guests included Beverly Roberts, principal at Landis Elementary, and Mr. Fox, assistant principal, who also plans to come later to tell the children about his career. Several parents were also kind enough to bring some of their products for the children to take home. The excitement in the room was contagious and many children, as well as parents, were heard saying, “What a fun day! I learned so much!” Students enjoyed learning so much that no one was overheard complaining about the fact that it was a snow makup day. Tourism authorities to hold joint meeting The Salisbury and Rowan County tourism authorities will hold a joint meeting of their marketing committees. The groups will meet at 2 p.m. Tuesday at the Visitors Center, 204 E. Innes St., to discuss and plan the 2011 spring and summer joint marketing campaign. Then on Wednesday, the Salisbury Tourism and Cultural Development Commission will meet at noon in the City Council Chamber, 217 S. Main St. Contact reporter Emily Ford at 704-797-4264. Kannapolis Look in tomorrow’s for GREAT DEALS from… 295 East 22nd St., Kannapolis NC How To Get The Perfect Shoe Fit 704-933-3510 • STORE HOURS: Monday-Saturday 8:00am-9:00pm; Sunday 9:00am-8:00pm WE ACCEPT ALL MAJOR CREDIT CARDS, FEDERAL FOOD STAMP CARD, WIC, EBT & DEBIT CARDS. WE ALSO ACCEPT PERSONAL AND PAYROLL CHECKS. go to view the at Our 71st Semi -Annual Sale! Ladies Assorted Rack Shoes Now Lots of styles to choose from or 2 pairs for.... Regular price to over $100 New Balance Performance Athletic Shoes Regular price $110-$150 Now 49 – 79 $ 88 $ 88 Special Group Ladies sizes over 10 slightly higher Men’s sizes over 12 slightly higher Your e Choic R128405 beaver's helmet was on display.. gonna be a firefighter, too!” Four-year-old Zachary Zachary said. Barham was one of the children in the group, his shoes Freelance writer Susan lighting up as he ran. “My dad- Shinn lives in Salisbury. dy’s a firefighter and I’m R124211 A Specialty Contractor Since 1979 With Over 7000 Completed Jobs From cowboys, to doctors, from artists to an iron chef, these were some of the chosen careers of second graders at Landis Elementary School on Saturday. This snow makeup day lent itself to several of the North Carolina State objectives, particularly in social studies where students are asked to learn and describe types of employment and ways people can earn an income. Students in Gail Oakley’s and Roxanne Wiggins’ classes were asked to participate by dressing in their chosen career and then writing about that career. Parents, and school personnel were also asked to participate by coming to speak. Sharon Beck, school nurse, explained to the children about her job at Landis and some of the other schools that she works for in the district. One of the parents also spoke about the importance of nurses and their jobs in doctor’s offices. Another parent, Shane Fite, is biomedical equipment technologist for Carolina’s Medical Center. He explained that one of the reasons for the high cost of a hospital stay is the cost of some of the equipment. He also brought a blood pressure/heart monitor to demonstrate to the students. Rick Chabala is a mortgage consultant, and he ex- Gutter R122864gallon No Leaf Lots of styles for men & women Rockport Gore-tex Hiker • New Balance Gore-tex Hiker Dunham Waterproof Hiker • Hush Puppies Chukka Now Regular price $140 $ 79 88 Men’s sizes over 12 slightly higher Home Owned / Home Operated 428 N. Main Street, Salisbury, NC 704-636-1850 God Bless America! HOURS: MON.- SAT. 10:00-5:00 • ralphbakershoes.com R127766 6A • MONDAY, JANUARY 24, 2011 Around the state Perished snowmen week after the recent snow, the white stuff had virtually vanished. Its only noticeable remains seemed to be in those great open spaces for parking, where, in order to make it possible for shopping, the graceful covering of snow had been compacted into mountains, almost obscene in their unnaturalness. I happened to spot what MACK like WILLIAMS seemed the snow’s only remaining trace within a residential setting. Walking along one of the thoroughfares regularly traveled by cars and pedestrians, I saw a two-foot wide clump of “beaded ice,” which is the look that snow always assumes with age. Due to it being the only “ice” around, and being in the vicinity of a local college, I had to look twice to make sure that it wasn’t just discarded ice from some college students’ party. In those yards where tall snowmen once stood, was now nothing taller than grass. In these once “occupied” yards, two small tree A SALISBURY POST A R E A / S TAT E branches could always be seen, having once formed the upper “limbs” of a snowman. A few small rocks were lying about, having once been buttons and eyes, along with a withering carrot nose here and there. In some yards, hats and scarves were in the grass, as if someone had lost them while in a hurry and didn't seem to care if they were sufficiently wrapped for a winter day. A few brooms were scattered about, as if someone had been sweeping the steps or sidewalk and gotten distracted by a phone call, forgetting to resume their sweeping where they had left off. I thought of a way to view the apparent absence of the snowmen who perished as the temperatures rose: The men of snow were once quiet sentries standing guard on the lawns far behind their winning front. That front shifted in reverse, leaving them trapped in territory which now belonged to the opposing side. Being only equipped with brooms and unable to excavate foxholes for their protection in battle, they ingeniously solved their predicament by seeping subtly into the ground. Appliance maker to cut 100 jobs at New Bern plant. NEW BERN (AP) — A New Bern appliance plant is shutting down one of its production lines, leaving 100 workers without a job. The Sun Journal of New Bern reports that BSH Home Appliances Corp. will stop making its 27-inch front load washers and dryers by the end of the year. Company spokeswoman Marni Hale says BSH will continue to make dishwashers and stoves at the New Bern plant, meaning most of the 730 workers will not be affected. Hale says the company began making the 27-inch washers and dryers in 2002, but demand for the larger machines has shrunk. BSH will continue to push its 24inch models. State and local officials say they will work with BSH to bring other manufacturing lines to the New Bern plant. and said more investigation will be needed. Family members told the newspaper the victim’s 12-year-old daughter found her mother dead after spending the night with her grandmother. Man pleads guilty to killing ex-wife’s new husband DURHAM (AP) — A Durham man has been sentenced to more than a decade in prison after admitting he killed his exwife’s new husband because he was tired of being taunted by the man. The Herald-Sun of Durham reports Randy Tyson Bledsoe pleaded guilty to second-degree murder last week and was sentenced to anywhere from nearly 14 years to more than 17 years in prison. Authorities say Bledsoe kicked in the door of 44-year-old Edward Riddle’s home in June 2009, shooting him in the basement. Bledsoe was arrested at his home about 20 minutes later. Bledsoe’s attorney says Riddle refused to let Bledsoe see his children and sent him disparaging text messages. Riddle’s daughter told Bledsoe she hopes God makes the rest of his life hard for what he did. Carbon monoxide may have killed Charlotte woman CHARLOTTE (AP) — Authorities are checking if carbon monoxide poisoning killed a woman found dead in her Charlotte home along with her dog and cat. Police say family members found the body of the woman and her pets Saturday morning in one unit of a duplex. Since the dog and cat were also dead, investigators thought it might be carbon Buncombe County man dies monoxide poisoning. after truck falls on him But the victim’s mother lives in the WEAVERVILLE — Authorities say a unit next door and told The Charlotte ObBuncombe County man has died after a server that authorities didn’t find toxic truck he was working on fell on top of levels of the odorless gas in either unit Planning board to elect chair, vice chair The Rowan County Planning Board will elect a new chairman and vice chairman Monday. It also will recognize outgoing members Mike Caskey, Ann Furr and Terry Hill; reappointed members Greg Edds and John Linker; and new members Bill Brown, Craig Pierce and Joe Teeter. The planning board will meet at 7 p.m. Monday on the second floor of the J. Newton Cohen Sr. Administration Building, 130 W. Innes St., Salisbury. Also at the meeting, the board will discuss two versions of text amendments to the farmland preservation ordinance. It will then recommend one to county commis- sioners. One version approved by the Rowan County Agricultural Advisory Board would continue to give that board authority to approve or revoke agricultural district applications. According to another version approved by the planning board, the agricultural advisory board could only make recommendations to the Board of Commissioners for final decision-making. In addition, the planning board will discuss a rezoning Monday of 1.06 acres at 4725 Long Ferry Road from rural agricultural to commercial, business and industrial. This would allow a vacant convenience store to be used as a funeral home. Say “Happy Valentine’s Day” to that special loved one, friend, child, pet or co-worker and have it seen worldwide on salisburypost.com! To: Kaytlyn, Brady, Colin Jr. and Cameron Happy Valentine’s Day! I love you! Mommy OR 2 cols. x 3” $ My Precious Boys 30 choose Up to 10 Lines $ 1 col. x 3” $ 20 Will you be my Valentines? Love, Mommy Publishes: Valentine’s Day & online for one week. Deadline: Thurs., Feb. 10TH at 12pm 5.00 Nick, I love you as much as cactus puppies! Okay probably more. Love u, Lisa. Happy Valentine’s Day to Cheryl, Kathy, Denise, SharonC, Ina & the whole gang! From SharonJ aSSoCiaTeD preSS North Carolina Department of Transportation worker Tim Smith and Danny Walton head to the cabs of their trucks to begin clearing of roads Sunday from accumulated ice and snow. ATLANTIC BEACH wintery. RDU Airport opens new portion of Terminal 2 MORRISVILLE (AP) — Raleigh-Durham International Airport is ready to unveil its newest terminal area, and just in time to greet travelers coming to the region for a major event. Airport officials say construction crews have finished work on the second phase of Terminal 2, which officially opened on Sunday. The new terminal section will host Continental Airlines and US Airways, which will operate from Concourse D. The first phase of the terminal opened in late October 2008. The new terminal area opens in advance of the NHL AllStar Weekend in Raleigh, which starts Friday. Clara and Debbe It was great spending time with you this summer! Love, Mickey 4 cols. x 3” Coastal roads still icy after half-foot of snow $ 50 CHOOSE ONE: ❑ 1 col. x 3 - $20 ❑ up to 10 lines - $5 ❑ 2 col. x 3 - $30 ❑ 11-24 lines - $10 ❑ 4 col. x 3 - $50 Name: Address: City: Zip: Day Time Phone: Troopers: Teen intentionally crashes into truck CHARLOTTE (AP) — Troopers say a 19-year-old woman admitted she intentionally ran her car into a tractor-trailer, causing a wreck that briefly closed part of Interstate 77 in Charlotte. Highway Patrol Trooper C.T. Hodges told The Charlotte Observer that the teen’s car rammed the truck several times in the northbound lanes near Uptown before getting trapped under the rig as the truck driver stopped Authorities say the teen did not suffer life-threatening injuries. Hodges says the teen told investigators the crash was intentional and she had been taking prescription medicine. Troopers say no one else was injured in the wreck. Call 704-797-4220 or email your “Valentine Love Letters” to Love@SalisburyPost.com, also, you can mail your message to: Salisbury Post, c/o Valentine Love Letters, 131 West Innes St., Salisbury, NC 28144 R126817 Boom-era plans often going bust Unfinished foundations become symbols of failed building projects CHARLOTTE (AP) — Developers, ‘Bigger,’ “ recalls Wiggins, senior vice president of retail development. “They wanted threequartersfoot office building. The retail plan calls for a grocery store, restaurants and other services that support a neighborhood’s everyday needs. Mammoth Crocs Kid's Now Reg. $29.99 $19.99 Mammoth Crocs Men's & Women's Now Reg. $39.99 $29.99 Reg price $2.49 each CLOSEOUT PRICE Now just 99¢ each! Largest Selection of Collegiate Merchandise in Rowan & Cabarrus Counties 704-637-5144 Open Mon-Fri 9am-5pm • Sat 10-2 IMPRESSIVE Cars Affordable Prices the DNA evidence Dew presented and have never released the results of their own DNA tests. Capt. Jody Young, a prosecutor, also pointed out the defense argued the DNA resulted from consensual sex between Hennis and Eastburn. “How can you argue consent and then say (the SBI) got it wrong?” Young asked. Army prosecutors began pursuing Hennis again in 2006 after a new DNA test linked Hennis from evidence collected from Eastburn’s body. Young also asked the judge to consider Eastburn’s family and not make her husband have to go to another trial and “tell 14 more strangers how he felt when his family was murdered.” The judge did deny a request from defense attorneys to get documents from an investigation into the SBI crime lab. Hennis is separately asking a federal appeals court to rule that the Army had no jurisdiction and shouldn’t have forced him back into uniform after he was discharged. Theatre group plans 100th production ROCKINGHAM (AP) — The Richmond Community Theatre is approaching its 100th main stage production, and the theater itself has seen many changes since it opened in 1977. The first production that came to the stage was “Never Too Late,” a comedy that opened in the spring of 1977, with six shows that drew a crowd of 767 people. Their 100th production will be “The Dixie Swim Club” by Jamie Wooten, Jessie Jones and Nicholas Hope, opens Feb. 3 at 8 p.m. and runs until Feb. 13. Sunday shows begin at 2 p.m. and tickets are $9 each. “I’m not sure we could have a better show for the event,” said Mark Colbenson, Richmond Community Theatre director. He said there will be a reception to celebrate the 100th production, and a slideshow will display pictures from the theater’s history. The theater was different when it first opened. Before it was a theater for plays, it was a movie theater. Renovations began to transform the building, making the stage twice as deep as it was. According to Peggy Andersen, 73, of Rockingham, who had a part in the theater’s first play, the new stage was so big, three rows of seats had to be removed. “That’s why it starts in row D now,” Andersen said. “It was like an old abandoned building would have been.” She recalled the mess of reconstruction, and noted several changes and peculiarities about the building. One of the biggest changes that took place in the transformation of the theater was the green room and dressing room. Beneath the stage is a basement area, accessible by ducking down and watching your step as you come down the stairs. The tight area seems not to have been able to hold a large cast, and Andersen said it would get very crowded. “It’s pretty much a dungeon,” said Mark Colbenson, director of the theater. The basement consists of a hallway and a room, with the stage for the ceiling. A curtain hung down the middle of the room, separating the males from the females while the actors got dressed. A shallow shelf along one hallway wall 911 FROM 1a lobby to change the law. Durham defense attorney James “Butch” Williams said changes to the law would likely be fought by both media groups and defense attorneys. One solution may be for lawmakers to allow police to ask a judge for permission to alter a recording or only release a transcript, putting the burden of proof on law enforcement for keeping the information from the is all that is left of the makeup area. “It was really just a hole in the ground,” said Andersen. She said the basement would flood during rains, and the actors had to hop around in the water to get dressed. Because of the location of the dressing room and green room, the actors waiting beneath the stage were not allowed to make single sound, for they could be heard out in the audience. “Everybody had to be very, very quiet,” Andersen said. “The toilet couldn’t be used. We didn’t need an intercom system because you could hear your cues, you were right under the stage.” “I think at one time they did a trap door thing,” said Colbenson about the actors’ access to the stage from underneath it. “I think there’s an awful lot of history in this theatre,” said Colbenson. He said the 100th production is a landmark. “We’ll let everyone know,” said Colbenson. “It’s fun to celebrate, it’s not only for us but for the community. They’ve continued to support the theatre for years.” public, Williams said. “Let a judge decide, much as you do with medical records and things of that nature,” he said. Emergency calls can be critical for defense attorneys, said Williams, who thinks the 911 call in the rape case involving members of the Duke lacrosse team helped lawyers discredit the accusers because the tone of voice on the call didn’t sound right. “That’s one that when I hear it, I knew immediately it was a hoax,” Williams said. “We wouldn’t have been able to do that if the voices had been disguised in some form or fashion.” Regular Cab Short Bed, Full Power, Running Boards, V8, Only 28k miles Factory Warranty K3740 Sunroof, Extra Clean, Full Power,Balance Of Factory Warranty, 53K miles K3738 9,990 $ 14,990 $ 06 PONTIAC SOLSTICE CONV. 06 FORD E350 ONLY 16K MILES, LEATHER, LOADED!!!! K3790 Passenger Van, XLT, Full power, keyless entry, extra clean K3772 15,990 $ 15,990 $ Come In For A FREE Appraisal We will buy your vehicle whether it is paid for or not. 941 S. Cannon Blvd. • Exit 58 Off I-85 • Kannapolis R129091 FORT LEAVENWORTH, Kan. (AP) — Attorneys for a former Fort Bragg soldier who is on death row in the killings of a mother and her two children say problems at North Carolina’s crime lab should give him a new trial. Jurors in the military trial might have changed their minds about convicting Timothy Hennis or sentencing him to death if defense attorneys were aware that a State Bureau of Investigation crime lab worker who testified was accused of writing misleading reports in other cases, according to The Fayetteville Observer, which had a reporter at a hearing Friday held at Fort Leavenworth where Hennis is imprisoned. The military judge, Col. Patrick Parrish, didn’t make a ruling at the hearing, saying he would issue a written decision later. Hennis was convicted at a court-martial last year after he was recalled to Army duty to face a trail in the killings of Kathryn Eastburn and her 5and 3-year-old daughters more than 25 years ago. Hennis was originally found guilty of the slayings in state court in 1985, but that conviction was overturned. Problems in the SBI lab surfaced shortly before Hennis’ court-martial began and his attorneys didn’t have time to digest them, said one of Hennis’ lawyers, Lt. Col. Andrew Glass. A lab worker who testified about DNA evidence, Brenda Bissette Dew, was cited two dozens times in other cases for writing misleading reports. If Hennis’ lawyers had known that, they would have tried to discredit her testimony, Glass said. “It’s evidence of her bias,” Glass said. “She thinks she works for the government. She thinks it’s her job to put Master Sgt. Hennis away.” But prosecutors argued that defense attorneys never questioned the credibility of 09 CHEVY SILVERADO 1500 LS 08 PONTIAC G6 SEDAN SBI lab problems may lead to new trial Case involves deaths of mother, two children MONDAY, JANUARY 24, 2011 • 7A C O N T I N U E D / S TAT E R127755 SALISBURY POST 704/933-1077 *All prices plus tag, tax & $389 admin fee PRICES GOOD Other GREAT deals at THRU 01-28-11 THE BEST DEALS ARE UNDER THE SIGN ON HWY 29! @dgfikXek E\njXYflk D\[`ZXi\ You may have received a letter from :\ek\ij]fi D\[`ZXi\D\[`ZX`[J\im`Z\j:DJ or your Medicare provider stating that your health plan was discontinued for 2011. If you have not selected a new Medicare Advantage plan, it’s not too late. Pfl_Xm\lek`cAXelXip*(kfj\c\ZkX?ldXeX D\[`ZXi\8[mXekX^\)'((gcXe% With more than 20 years experience providing Medicare benefits, Humana offers the experience and dependability you deserve. ;fe¾kd`jjflk% :Xcckf[Xp1 1-877-214-3508 (TTY: 711) 8 a.m. - 8 p.m., seven days a week. A health plan with a Medicare contract. Y0040_GHA0C7QHH File & Use 12192010 01/11 R128729 DAYintheLIFE MONDAY January 24, 2011 SALISBURY POST Jeremy Judd, Online Content Manager, 704-797-4280 jjudd@salisburypost.com 8A Photo Provided by Sonya martineZ Photo Submitted onLine by uSer: kadkinS Zane Shirley and bella sledding. Sonya martinez and kasey Scarborough pose with a snowman in china Grove. Have a photo for Day in the Life? Submit it online! Just go to : salisburypostables.com and click the photo icon to get started. Photo Provided by Steve ShuPinG Josh Price and his father built a snow robot. Picture taken by Grandmother Linda your next rock stars, tatum and Lori Shirley. Photo Provided Lt. corporal mitchell W. barringer, son of david and tina barringer of Gold hill, shakes hands with General david Petraeus on christmas day in afghanistan. barringer asked his commander to extend his enlistment so he could serve in afghanistan. mitchell and his wife kimberly have two children, they live in Jacksonville, n.c. So it begins... Michelle Condra-Peck writes about the challenges and rewards of being a working mom, raising a child with ADHD, and making a blended family work…on a budget. Humans have a great capacity for love, kindness, compassion and understanding, so I am often troubled by stories about man’s inhumanity towards his fellow man. I sometimes feel overwhelmed with a demanding job and stress at home. I worry about what type of man my son will be, and if any of the things I am trying to teach him are actually sinking in to that cute little head. When things begin to get me down and I start worrying about what type of future we will leave to our children and grandchildren if things don’t change, I find solace and inspiration in the strangest of places. Let me tell you about a horse. She is an equine of exceptional beauty. She is not the boss of our modest herd nor is she the lowest on the totem pole, but comfortably in the middle of the hierarchy. She is extremely gentle, and my 7-year-old nephew, Jay Ball (her own- er), loves her. They both have blue eyes and a gentle heart. Vessie is her name. My nephew named her when he was much younger, so we’re not sure if he meant Bessie and couldn’t pronounce it or if this was the intended pronunciation. (Personally I would have called her Vesper because of the light, ghostly quality of her blue eyes, but I digress). She is almost completely black with one side of her face being white and with white stockings. She is striking and hard to miss. One would think that was enough to admire, but that doesn’t even begin to describe her best qualities. Last year, Vessie got incredibly sick. She had a twist in her intestines and developed an intestinal blockage. We almost lost her. The doctors told my sister that they thought she was going to die, but they never gave up on her. My nephew worried his poor lit- “I wish more people were like horses. Maybe we should all rejoice in being with our fellow man instead of worrying about who has what and how we are all different.” S47976 Horse Sense tle heart out about her. When she possibly torn muscles. pulled through we were as relieved As of this writing, she is still befor his sake as for hers. ing kept in the barn to prevent furA few days before the New Year, a ther injury with the ice and weather, neighbors’ cows got out in the midbut she doesn’t like it. dle of the night and for some reason She wants to get out and rejoin the decided they wanted to be pastured herd. Use whatever term you want with our horses. They broke our to for her. Call her tough, plucky, fence down in several places. One of stubborn or just plain trouble, but our neighbors was kind enough to she’s an inspiration to me. call to tell us the horses were out. BeI wish more people were like horsfore we could get there, Vessie had es. been hit by a car. Her dark color did Maybe we should all rejoice in benot serve her well in this instance. ing with our fellow man instead of Again, we were afraid we were go- over the weekend. worrying about who has what and ing to lose her. The lady who hit her We put her in the barn when we how we are all different. said she went all the way over the top brought her home and my sister and No two of the horses in our herd of her car. one of her friends have been tending are alike. They are all colors, sexes, My father hooked up to the trail- to her cuts and sores. personalities and sizes. I can't reer and went to pick Vessie up. After a week, Vessie wanted to re- member one time that they all didn't He took his pistol with him think- join the herd. want to be together. ing that he might have to do the The doctor says she has radial I hope my son grows up to view worst. nerve damage in one shoulder and the world like a horse. When he arrived, Vessie was standing on all four feet waiting on him. The car that hit her was BOBBY R LEAR totaled. It took (704) 642-0451 five men to lift 444 Jake Alexander Salisbury, NC her onto the trailbobbylear@allstate.com er because she Call me today for a complimentary financial was extremely and insurance review. lame and in pain (704) 642 0451 and shock. BOBBY R LEAR My family 444 JAKE ALEXANDER took her to DAVID R LEAR SALISBURY (704) 642-0451 Statesville a083194@allstate.com 444 Jake Alexander Bovine and Salisbury, NC davidlear@allstate.com Equine Clinic. subject to availability and qualifications.Allstate Insurance Company and Allstate Property and Casualty Insurance They kept her Insurance Company, Northbrook, Illinois © 2009 Allstate Insurance Company. SALISBURY POST MONDAY, JANUARY 24, 2011 • 9A C O L U M N S / N AT I O N Getting hubby to talk Gunman shoots four officers in police station is serious business creators.com Witness Victor Meyers told KOMO-TV that he heard the first shot, then six more in rapid succession. “I heard one shot, which I thought was a car backfiring, and then several more reported back, which I knew to be gunfire,â€? Meyers said. He said he saw a female deputy running toward a victim on the ground before he Shop Us For ANY Brand Tire: Michelin, BF Goodrich, Uniroyal THE WORLD’S MOST PASSIONATE ENERGY CONSERVATIONIST. Trane XL20i helps you protect a precious resource: The The Trane helps you protect a precious resource: your The Trane XL19iXL19i helps you protect a precious resource: your ÂŽ ÂŽ money. With side-by-side Climatuff your With Compressors money. With side-by-side Climatuff for twomoney. side-by-side Climatuff Compressors forÂŽCompressors twotwo-stage cooling and the industryĘźs highest for stage cooling and the industry’s highest efficiency rating*, stage cooling and the industry’s highest efficiency rating*, * rating, XL20i operates efficiently, efficiency the theXL19i XL19i operates efficiently, energy costs. the operates efficiently, loweringcosts. your lowering energy costs.your your energy Throw in the industryĘźs lowering Throw in industry’s the industry’s and the XL19i makes Throw the best andwarranty, the XL19i makes andwarranty, thebest XL20i maked the world a better bestinwarranty, the world a better place to live –and both the world a better place to live–both outside inside.outside and inside. to live - both outside and inside. place The Trane helps you protect a precious resource: your *Based on 2002 ARI XL19i Directory Listings. money. With side-by-side Climatuff ÂŽCompressors for twostage cooling and the industry’s highest efficiency rating*, the XL19i operates efficiently, lowering your energy costs. Throw in the industry’s best warranty, and the XL19i makes the world a better place to live – both outside and inside. 704-633-8095 r nte Wi le Sa Heating • A/C Electrical BRAKE INSPECTION with purchase of four tires. Up to $500 tax credit on qualifying systems thru 2011 Brake Service • Shocks Check Engine Lights most cars and light trucks. 10% OFF Mark Stout WHEEL ALIGNMENT CHECK FREE FREE Serving Salisbury for 40 Years since 1971 Landis (704) 857-2448 Service call with this ad thru February “We Service All Brandsâ€? 4243 S. Main St. Salisbury, NC and other witnesses were hustled from the scene. The man who ran from the deputies died of his wounds in the parking lot, Wilson said. Wilson said no other suspects were involved in the incident, which began at about 3:45 p.m. He didn’t know whether the woman and the man who were killed knew each other. BEST TIRE SERVICE IN TOWN! All quotes include your favorite tire, all taxes, disposable fee, wheel balancing, rotation & flat tire repairs for life. Jerry’s Shell Service 704.636.3803 • Salisbury, NC NC State Inspections 7am-6pm Monday-Saturday Since 1949 “The Best Insulatedâ€? WINDOWS CreTax dit & No Leaf GUTTER FACTORY DIRECT DISCOUNTS New Year’s Savings! MARCH MATTRESS SALE! Tempur-Pedic In-Stock & Floor Samples 20% OFF Last Year’s Mattress Models! 25% OFF Mattress Floor Samples! 10-15% OFF! J.A. FISHER No Additional Charge for Mattress Foundations A Specialty Contractor Since 1979 With Over 7000 Completed Jobs CUSTOM ROOFS 704-788-3217 jafisherexteriors.com PATIO CANOPIES • • Spa Pedicure .......................$1999 Kid Spa .................................$1500 Spa Head (45 min)................... $3099 Gel Nails w/white tips........$2999 Full Set ............................$1999 Massage Available ...1 Hr. $50/ 1/2 Hr. $30 Fill-in ...............................$1299 Eyelashes.....................................$1999 FREE Hot Stone Massage with pedicure service 704.636.0390 Night Dimensions Park PlaceSet Mattress $ Queen $ Set ...................... $ $ 279 Orange Full Euro TopQueen Twin 149 189 199 Park Place Mattress Set Plush, Firm, & Super $ QueenTop Plush or Firm.... Pillow Queen Set 399 Refreshments Served OPEN SUNDAY 12-5 1040 Freeland Dr., Ste 112 Salisbury, NC 28144 Includes 2 FREE Pillows! Please bring ad to receive special pricing. Exp. 1/30/11 Need Dental Work? • Tooth Colored Crowns start at $550 • Dental Implants for $750 • Zoom Whitening $300 • Cleanings, Fillings and Extractions Sensa Adjustable Beds Starting at $ 999 Park PlaceBeautyrest Red Rose Simmons Plush,Mattress Firm, or PlushSet Pillowtop 699 $ Queen Pillowtop.... Queen Set ..........$299 3900 Twin/Twin Albany Futon Discovery Panel Bed Spice Collection Bedroom Group Metal Bunkbed $199 $ $ 169 15% OFF Twin Inner Springs Mattress....$79 each Includes standard 6â€? Mattress. 289 Drawers&& Nightstand Nightstand sold Drawers Soldseparately Separately Payment Plan with CareCredit R128323 •ALL SIDINGS •CARPORTS R128577 man. He never would touch me in a harmful way. His last option was to scream, yell, plead, beg and nag. And he did plenty of that. That being said, though I did take full responsibility for my actions and did the hard work to restore and recover, the truth is that we were in it together. While he was not 100 percent aware of everything I was doing, he went along. He signed to refinance the house and to lease multiple cars, for example. No situation, not even yours, is completely onesided. You need to examine your culpability in all of this, as minor as it might be. I have so little information from your letter, but it is curious to me that you refer to the ’90s. That’s more than a decade ago. If he is abusing your joint bank account still, why don’t you open a second account in your name only so that you can manage the income you do have better? You shouldn’t do this in secret. And if he has income, perhaps he should agree to allow you to manage it, as well, and then put him on a strict allowance. I am certainly not a marriage counselor, but I know someone who is. Dr. Willard Harley is the author of the book “His Needs, Her Needs.â€? I suggest you get that and read it as soon as possible. Dr. Harley, a marriage counselor in Minneapolis, also has an excellent website,. If I had to guess, I would say that you have a serious marriage problem. The money is just a symptom. If you ever have had any love for this man, you can find it again. in Port Orchard, Wilson said. The man ran and started shooting when three deputies tried to talk to him, he said. The deputies, including the two men who were wounded, returned fire, Wilson said. Witness Ray Bourge told KOMO-TV that he saw a man running through the parking lot toward nearby woods, firing his gun back toward the store. “Right behind him there was an officer chasing him, and he began to open fire,â€? Bourge said. The officer was about 30 to 40 feet behind the suspect when he started firing, Bourge said. CITY TIN SHOP INC. R121882 Dear Mary: I’ve been a fan of yours since the early 1990s. I have a question. Not for you, but for Harold, your husband. How did he do it? Why did you two stay together? Why didn’t he hate you for what you did? You humiliated him on a regular basis with your behavior, and then he was on the brink of bankruptcy for no fault of his own. I’m in a similar situation. I’m married to a former credit card junkie, and I know that he’s only a former credit card junkie because he doesn’t have access to credit anymore. In the MARY early ’90s and HUNT beyond, I was trying to get out of debt. Every time I would pull us out of that quicksand, he would gleefully cannonball back in. MY wages have been garnisheed. I get humiliating calls at work. MY checking account was seized. (While I was on a business trip, I had to survive for three days on $10.) HE did the crime, and I get the time. I have tried, but I still hate him. I can’t even move out because of the wage garnishment because I can’t rent my own place on what’s left. What would you suggest? — Prisoner Dear Prisoner: I think I can adequately respond for my husband by asking you, What were his choices? He could have left me, but he is a godly man of integrity. He took our marriage vows very seriously. More than that, he loves me deeply. He could have broken my arm, but he is not a violent precincts added hand-held metal detectors at the public entrances. He worked at the 6th precinct for years and says the desks are open once you walk in the door. “I was always very comfortable working the desk because I wanted that one-onone feeling with the public, but I thought it was an accident waiting to happen and it did,â€? said Malhalab, who spent 23 years on the force and retired in 2005. R128586 PORT ORCHARD, Wash. (AP) — A shootout in front of a Walmart in Washington state left two people dead and two sheriff’s deputies wounded Sunday afternoon, a sheriff’s spokesman said. One of the dead was a man who shot at deputies, said Scott Wilson of the Kitsap County Sheriff’s Office. The other victim was a young woman who died after she was taken to a Tacoma hospital, he said. The deputies’ wounds did not appear life-threatening, Wilson said. Details were sketchy Sunday evening, but the sheriff’s office received a call about a suspicious person at the store *Based on 2002 ARI Directory Listings. Marriage problems can be disguised as money problems city, there are no metal detectors at the entrance and visitors are permitted to come in and talk face-to-face with police sitting behind a large, rounded desk. “We have to take a step back and look at security at each of our facilities . . . as far as we screen our public when they come in,â€? Godbee said. Retired police Sgt. David Malhalab told The Associated Press that after the Sept. 11 terrorist attacks, the Two people shot to death in shootout at Walmart R128335 tribune media services associated press a detroit police officer looks over one of the plate glass windows that was hit inside the precinct building. R124210 while we were closed for two weeks over the holidays. I called to inform them of my mother’s passing. I told them of the funeral arrangements in her hometown about two hours away. I did not expect them to come out for the services. However, whenever an employee has a death or major illness in the family, the owners either send flowers or contribute to the office collection. I am deeply hurt because I did not even get a sympathy card from them. When work resumed, they didn’t even ask how my family or I was doing. I am finding it hard to go into work every day. This has me so upset I am thinking of leaving my job. What can I do to get over these feelings? — Hurt Feelings Dear Hurt: I assume that as part of your job, you may have been responsible for some of these thoughtful gestures on behalf of your employers during the last 20 years. You might be able to provoke some sympathy by expressing yourself judiciously directly to them. Because you are so hurt that you are contemplating leaving your job, you owe yourself (and them) the benefit of a clear and honest explanation of how you feel. And so you say, “You are always so thoughtful to other employees when they experience a loss like this. I know the holidays got in the way, but I’m very sad that you haven’t offered your sympathy and support to me, too. It would have really made a difference.â€? Dear Amy: Could you please help with what is a baffling problem for me, and probably many others? It is extremely frustrating when people send a text message but don’t attach a name at the end. This leaves me wondering whom the phone number the text is being sent from belongs to. I am finally forced to respond by sending the embarrassing “Who are you?â€? text. Please remind readers that not everyone can magically identify them from a phone number. — Annoyed Dear Annoyed: Poet Emily Dickinson crafted the perfect response to this awkwardness. When receiving a mysterious text, you can reply: “I’m nobody! Who are you? Are you nobody, too?â€? surgery Sunday evening and his prognosis was “very good.â€? “very soberedâ€? by the shootings, Godbee said he was “just very relieved that it appears all of our officers are going to be OK.â€? The one-story brick building is located along the main street in what is a predominantly business district on the city’s northwest side. After the shooting, city and state police squad cars converged on the scene, and an ambulance was seen taking away at least one victim. Like other precincts in the Voted 18 Times Best Place to Buy Beds! FINANCING AVAILABLE! Mike Morton Dentistry 201 Security Street, Kannapolis, NC 28083 info@mikemortondentistry.com 704/938-3189 R122513 Dear Amy: It is very difficult to talk to my husband about serious topics. For instance, the other day we tried discussing if we are going to have children. He talked about it for a minute and then said he didn’t want to talk about it right now. The thing is, he says that for just about every difficult topic we try to talk about! I feel we never get anything accomplished, and it is making me depressed. I even wonder if I should keep this marriage going. I hate living with this uncertainty. — Sad Wife Dear Wife: It takes a stouthearted individual to want to plunge into a serious or difficult topic — and stick with it. Challenging issues bring out the “fight or flightâ€? response in most of us. Your husband is clearly in the “flightâ€? ASK category. This AMY leads me to conclude that the issue of having children isn’t as challenging for you as it is for him. When marriage counseling works (and it doesn’t always work), it is partly because counseling brings couples together on a schedule to discuss issues they know in advance will be challenging. This schedule enables each party to anticipate the discussion, prepare for it — and bring Kleenex. Rather than plunging into serious topics and then being frustrated when your husband demurs, scheduling such a talk might work for you. Ask your husband in advance for two hours when you two can talk about personal matters. At the appointed time, free yourselves of other distractions, make a hot beverage and sit down at the kitchen table and talk. Also, listen. If your husband continues to run from serious talks, a counselor will help. Dear Amy: I am the administrative assistant to the husband-and-wife owners of a family business. I have worked for this company for 20 years. The owners rely on me to do errands/assignments on off-hours. They have always made me feel part of their own family. My mother passed away DETROIT (AP) — A gunman opened fire inside a Detroit police precinct on Sunday, wounding four officers including a commander before he was shot and killed by police, authorities said. The gunman walked in through the precinct’s revolving door shortly after 4 p.m. and opened fire indiscriminately at officers, police said. The officers fired back, killing the gunman. “Utter chaos and pandemonium took place,â€? Police Chief Ralph Godbee said at a news conference. “We have a number of officers who are shaken up.â€? Godbee said the gunman has been identified but it was “too early to characterizeâ€? Kannapolis Kannapolis 10A • MONDAY, JANUARY 24, 2011 SALISBURY OPINION LETTERS TO THE The Monday forum Kannapolis The writer operates Hess Mental Health Consulting & Education. Another option Health insurance premiums continue to increase. Is anyone trying to prevent these increases? The constant hassle of meeting premium payments is a financial drain faced by businesses that offer health insurance and by individuals who pay their own premiums. It also decreases sales-tax income, taking funds out of consumers’ pockets. This problem is one of the big three “choke points” in the private business economy, along with fuel prices and taxes. Here’s a thought: What if Rowan Regional Medical Center had an option that allowed insurance premiums be paid to the hospital by employers, for their employees, and by individuals who pay insurance premiums? Surely, this would cut paper-work costs and give private insurance companies more competition. It could cut insurance costs for companies that locate in Rowan County. Wow! That’s what you call enticing. The problem of health insurance costs isn’t going away unless leaders take action. Rowan County commissioners could approach RRMC officials, encouraging them to go forward with this suggestion, check the possibilities and doors it would open. The new federal healthcare law is rejected by many people, and rightly so. It imposes a required expense, just like car insurance. You do not have to own a car. It’s your choice. But everyone has a God-given body, so you have no choice but to obey the health insurance law. This letter’s suggestion could help lower health-care costs, bringing the people of Rowan County together on one important issue, encouraging a large amount of money to stay within the county while controlling costs. My personal thought: If more money remains in people’s pockets locally, you will have a united county, a bettertrained medical center and more private businesses wanting to locate here. The problems of enacting such a program can be solved. Rules can be changed. This can be accomplished with leadership. — Ron Sweet Faith Why isn’t it a raise? Pardon me for thinking, but if we pay Dave Treme a salary of $140,00 for two more delightful years, would that be $280,000, plus a $70,000 bonus? Does that equal a cool $350,000 for not even bothering to return phone calls or being seen by the public? Is that not tantamount to a raise? Would other city employees contemplating retirement like the same offer? Would this be about $500 a day? Am I just another nobrained, amorphous blob paying more taxes? Tell me again how hard times are now. Oh, to be on the city payroll. Sign me: Struggling to keep up with the Tremes. — Clyde (formerly Overcash) Salisbury Passion & incivility A Jan. 18 Post editorial likened that “Crossing the Aisle” — bipartisan seating among members of Congress during the State of the Union address — is a good idea. Wrong! It’s a very bad idea and not one that can be endorsed by true conservatives. For the past 12 years, attempts by Republicans to “reach across the aisle” and work with Democrats in a bipartisan manner hasn’t worked, except to the advantage of Democrats and liberal senators like John McCain and Lindsey Graham. Already the “C-word”— compromise — has creeped back into the congressional vocabulary; not exactly what the founders had in mind. When the government of this country was formed, checks and balances were assured by having three branches: The executive, legislative and judicial. The two-party system assured an adversarial approach to issues. Debate has traditionally been, at times, contentious. Talking civility is no more than code for politically correct, and it is political correctness that has helped our society dig the hole it’s in today. It certainly wasn’t civility when Democratic members stood on the floor of the House recently debating Obama care as they compared Republicans to Nazis and efforts to defeat Obama care to creating another Holocaust. Politicians get passionate discussing critical issues. Counter-strategy is meeting passion with passion. Closer to home, the new Republican-controlled legislature has a mess to clean up, one left by the departed De- Common sense (Or uncommon wisdom, as the case may be) The dead might as well try to speak to the living as the old to the young. — Willa Cather “The truth shall make you free” My Turn: Major John Misenheimer Jr. EDITOR Why I wear this uniform N Week puts focus on eliminating bullying Jan. 24-28 marks the sixth annual No Name-Calling Week. It was developed to provide schools the tools and inspiration to launch an on-going dialogue about bullying and name-calling of all kinds and focus on eliminating bullying. So it seems an appropriate time to talk more about bullying. According to the National Educators Association (NEA) “Bullying has become more lethal and has occurred more frequently than in the two previous decades.” The National Association of School Psychologists has called bullying “the most common form of violence in society.” Bullying affects nearly one out of every three U.S. children in grades six to 12. Most studies show 15-25 percent of American students are bullied “sometimes” and others more often. Bullying is an intentional aggressive behavior. It involves an imbalance of power and strength that is repeated over time and can be very harmful for children. Bullying can take many forms, including teasing, name-calling, note passing, texting, cell phone pictures, gestures, social exclusion, hitting, punching, verbal threatening and cyberbullying. Fear of retaliation prevents many children and youth from reporting it to adults. Those being bullied are more likely to be depressed, lonely, anxious, have low self-esteem, feel sick and frequently miss school and have thoughts about suicide. Adults are frequently unaware of bullying problems because they usually take place in areas of schools and communities not well supervised by adults. According to the Human Resources & Services Administration (HRSA), “Just about every student in a school may be affected by bullying, either as a victim, the bully himself/herself, or as a witness. A conservative estimate is that 10 percent of students are chronic victims of bullying.” For more information on bullying, check out. hrsa.gov/kids. It’s sad we have to designate a week to focus on no name-calling. We should continue to raise awareness to protect our children and youth and put an end to bullying! — Julia Hess Salisbury Post mocrats. Tax codes in North Carolina have been bleeding revenue to special interests for years. According to Chris Fitzsimon of N.C. Policy Watch, multistate corporations have been allowed to shift profits they make in N.C. to other states to avoid paying NC taxes. And we the taxpayers are expected to pay incentives to these companies? It will be interesting to note how many, if any, of the new Republicans as-well-as the incumbents will succumb to the siren call of special interest lobbyists. Those who elected you are watching. — Bill Ward Salisbury School uniforms My issue is that we have to wear uniforms at many of our middle schools and elementary schools. It is a problem because most kids don’t like the idea of having to wear a belt, tuck in their shirt and stick to one color for shirts and pants. My problem is that I don’t see why the high school kids get more freedom then we do when it comes to this topic. It seems to me that the schools want us younger kids to suffer while high school students get all the freedoms. To help fix this problem, the people in charge should bring back regular clothes to our dress code but limit things that people can wear and have more severe consequences for people who don’t follow the rules. If the leaders decide to stick with these uniforms, then I think we shouldn’t have to tuck in our shirts and should have more color choices for our shirts . Some of the ways I think the schools could punish rule breakers are that they should have to copy vocabulary words and type them up for a test grades. They should be made to suffer so that everybody else doesn’t have to. I understand that everyone makes mistakes, but the other schools shouldn’t be made to suffer for one kid’s wrong. Another solution could be more fundraising days on which students are allowed to wear jeans, such as students donating one dollar to help buy books or to help spread recycling around schools. — Brittany Goodman Salisbury ap Major John G. never met my mother’s faMisenheimer Jr. ther before he passed away, grew up in SalisI learned from my grandbury and attended mother about how he swept South Rowan High. her off of her feet in his He currently Army dress uniform before serves at the U.S. their marriage. These tradiArmy Command tions took root as my charand General Staff acter developed and steered College at Fort me toward a path of service Leavenworth, Kan. uGh. SALISBURY POST MONDAY, JANUARY 24, 2011 • 11A CONTINUED CHURCH R128395 tle Annalee to look again. She peered into the nest to discover one egg had returned. FROM 1A Years later, she realized her grandfather had placed et for foster children. a chicken egg in the nest to “The status quo or going mend his granddaughter’s backward or accepting debroken heart. cline is not on her radar “I needed that sense of screen,” Langford said. hope. We all do,” she said. “She thinks outside the box “He fostered that for me.” about how the church can be Just as Allen fosters hope engaged in the community.” for Park Avenue United Methodist Church. Turning points The jagged bullet holes Allen, mother of Claire, remain. The beautiful 16, and Joy, 12, has expericurved pews are mostly enced her own transformaempty on Sunday. But a tion since arriving at Park church once closed in fear Avenue United Methodist has opened its doors to a Church. community in need. Church Fresh from a stint as the members have learned to be youth director at a thriving servants, and people use the church in rural Davidson education building each County with more than 40 weekday. children, Allen said she Keona Simons runs the spent the first six months of New Tomorrows program her new assignment in culJon C. LaKey/SALISBURY POST and was so inspired by ture shock. Pastor Annalee Allen leads Sunday worship service at Park Avenue United Methodist Church on an icy morning. Turnout was Allen, she joined Main Street “I kept asking God, why United Methodist. unusually low because of the weather, though weekly attendance has dwindled to about 20 people over the years. have I been sent here? “I don’t believe I’ve ever trated. Even sad. But despite met a pastor who loves peoeventually, with help from Why?” “It was devastating,” helped raise. the challenges, she mainConfused and unsure, Young said. ple the way she does,” SiHer membership, howev- others, would become the tains her optimism. New Tomorrows program. Allen walked into the sanctu- er, remains at Park Avenue. The church has tried to mons said. “She is a living “I am very intentional every example of what a pastor Some 100 volunteers from bring in new members, said ary one day, alone. “I will not move my memchurches and Pfeiffer Uni“I just felt this presence Sue Crowell, whose husband single day looking for where should be.” bership,” she said. “I have a God is at work,” she said. versity spent two months with me,” Allen said. “And William Crowell served as warm place in my heart for “That’s where my hope is.” renovating the education the line came to me, ‘Teach pastor. Contact reporter Emily that neighborhood and that Allen doesn’t fixate on building to host the prothem to be servants.’ ” The women worry about Ford at 704-797-4264. church.” growing the membership at gram, which focuses not on Allen carried the experithe future of their beloved Learning to serve Park Avenue, or any of her home ownership or employence with her for several church. To learn to be servants, ment but on self-worth. days, pondering what the Only a few members have churches. Instead, she conchurch members had to be centrates on growing their When participants enroll, joined. The church hasn’t charge could mean for the able to serve food, Allen deconnections with God. they often are angry, hurt pastor of a church where made its budget since 2007. cided. “I see my role as a yoke and lonely, Allen said. As the The sanctuary and education nearly everyone is older The church kitchen was between God and the conweeks and months pass, she than 75. building need additional rein horrible condition, with gregation,” she said. “God is watches a transformation. Finally, Allen shared her pair. plaster falling off the walls at work transforming them. “They begin to realize, directive from the Holy Between her three ‘Hey, I am important. Some- churches, Allen has conduct- God is at work, not me.” Spirit with the congregation. as people tried to cook. Volunteers from Coburn Memo- body does love me, someAs a child growing up in They were willing to try. ed 53 funerals in six years. Franklin, N.C., Allen once body does care,’ ” she said. “We decided to take baby rial and a Catholic men’s “It’s been a huge chalgroup spent a month renofound a bird’s nest with Since New Tomorrows be- lenge,” Langford said. “And steps,” she said. vating the kitchen, now three eggs. Later, the eggs gan, abuse of the church has it remains so.” They began by collecting clean and useful. were gone. stopped. Allen no longer has canned goods for the food Pastor Annalee Allen, right, Toward the end of the Distraught, she went to to clean up the porch. People A sense of hope pantry at Rowan Helping with husband, Craig, and chilLike anyone, Allen beproject, Allen finished tiling have stopped shooting the her grandfather in tears. Ministries. They met their comes discouraged and frusa portion of the floor. Alone The next day, he urged lit- dren Joy, front left, and Claire. windows. Litter has disapgoal each month. peared from the front yard. They started filling 5-gal- one day, on her knees, she She hasn’t witnessed any lon buckets with supplies for had a vision. She saw people, many more drug deals, “although flood victims in the N.C. people, using the church on I’m not naive enough to mountains. They reached a regular basis. think it’s not going on. It’s that goal. For years, the three-story just not going on here,” she Lay leaders in the church education building had stood said. were thrilled with the reempty except for Sundays. Allen believes people besults. Excitement started to But Allen’s vision was clear gan to respect the church grow. — there were people, someand its work in the commuFaith over fear where, who needed to use nity. Park Avenue church Then one Sunday in July Park Avenue United has once again become a vi2007, Allen arrived at the Methodist Church every tal presence in the Park Avchurch with day. enue neighborhood. her family “I carried James “Bubba” Phillips, a for worship. that with former New Tomorrows parDaughter me. Actualticipant, joined the church, Joy saw it ly, I tried to served as a trustee and now first. forget it, but works as the janitor. “Mommy, I couldn’t,” “Bubba is our greatest someone Allen said. evangelist,” Allen said. broke a win“I learned Still a challenge dow,” Allen the definiPhillips brought four visirecalls Joy tion of pastors with him to a recent saying. sion: You Sunday service. In all, 15 A bullet don’t know people gathered for worship. had shatwhy you Though the pews sat neartered a procare, but ly empty, Allen’s passion tective covyou do and ering and you can’t let filled the sanctuary. She urged the congregation to pierced one go of it.” of the majesShe final- share Park Avenue’s mission with others. tic stained ly called Invite them to “come with glass winLangford. me and see how our hearts dows in the Allen’s suhave been broken over the front of the pervisor pain suffered in the world. church. suggested Come with me and see how From inshe start we are allowing God to use side the contacting church, people, any- us as a tool to alleviate some of the suffering,” Allen said. through the one she “Come with me and see jagged bulcould think what can happen through the let hole, of, who power of Jesus Christ on the Allen could might need corner of Park Avenue and see the Tutto use the Park Avenue United Methodist terow house church’s edu- Shaver Street.” has long been a fixture in the cation buildAfter the service, memacross the neighborhood. bers talked about their street. ing. “That was In 2008, at church, once home to five women’s circles and a halfa turning point,” she said. 5:15 p.m., Allen made her dozen Sunday school classes. “That, for me, was the first first phone call to Scott at Many left when they martime I felt a little twinge of Rowan Helping Ministries. ried, but these ladies stayed. fear. Up until that time, I’d She expected to have to “We loved the church never been fearful.” leave a message, but soon enough that we kept comThey called the police and Scott was on the phone. ing,” Darlene Drye said. reported the crime. And Allen identified herself. The church lost members eventually, Allen’s fear sub“I’ve been waiting for Now available when Cannon Mills Plant 7 sided. your call,” Scott said. for ANDROID closed, Hilda Hart said. The She hasn’t felt afraid New tomorrows Tutterow deaths were since, even discouraging a Together, the women painful, Kathleen Young drug deal across the street said. from the church before a fu- brainstormed ideas that t: obile site a m neral. r u o it is v or “She’s not a very tall person, but she stands tall in her faith,” Craig Allen said. Sara Potts, daughter of B.P. and Ruby Tutterow, credits Allen with much of the healing that has taken place in the church since the brutal murders of her parents. “Personally, I think it takes a woman to do that,” said Potts, who grew up sitting in the front row with her father, listening to her The Salisbury Post is ready mother sing in the choir. Allen is the church’s first to roll with you with text female pastor. Potts, a retired sheriff’s alerts, mobile version and deputy who directs the new iPhone app. Rowan County Housing Authority, attended Park Avenue for several years after her parents’ deaths. As membership dwindled, she moved to another church seeking a youth program for her grandson, whom she andy mooney/SALISBURY POST R128559 Salisbury Post iPhone App! m o c . t s o p y ur b s i l a s . m http:// Get headlines wherever you are headed. 12A • MONDAY, JANUARY 24, 2011 SALISBURY POST N AT I O N Tea partiers demanding budget cuts say military in the mix. FBI: NC woman who raised kidnapped child violates parole HARTFORD, Conn. (AP) —. WASHINGTON (AP) — Republic re- leased Saturday that he will focus on economic issues, particularly jobs, as the economic recovery creeps along and unemployment hovers above 9 percent. His references to investing in educating workers and in research and technology set off alarms for Republicans. Case in Giffords shooting likely to take years phas- esyear. Portugal re-elects conservative president LISBON, Portugal (AP) — Portugal elected its conservative president to a second term Sunday, delivering a harsh political setback to the minority Socialist government which is struggling to contain an acute economic crisis. Anibal Cavaco Silva, who is supported by the main opposition Social Democratic Par- ty, collected 53 percent of the vote compared with 20 percent for second-placed Socialist Party candidate Manuel Alegre, official figures showed with 98 percent of districts returning. Four other candidates picked up the remaining votes. The government has enacted. COMFORTABLE JUST GOT AFFORDABLE. R E T WIN ist l k c h C With Trane CleanEffects™, you can reduce dust, health concerns and cleaning time, all at once. 5.9%through FINANCING 5.9% financing the end of Feburary on through the end Qualifying of FebruaryUnits on Qualifying Units Beat the Spring Rush and SAVE! 10% OFF SERVICES People spend 90% of their time indoors. Unfortunately, dust spends 100%. Which is why Trane CleanEffects™ Air Filtration System can make such a difference. CleanEffectsTM lessens harmful dust by 50%. Plus, it can also reduce serious health concerns due to airborne fine particle exposure by 34%. That means you lower your risk for asthma attack, heart attack and stroke. Experience the effect of clean air with Trane CleanEffectsTM. You don’t have to wait for installation to experience the Trane difference. You’ll experience it right from the start. Our staff is experienced and skilled in every area of customer service. We also know Trane systems inside out and are committed to helping you find the best system for your home and budget. When you expect more you get more. It’s that simple. thru 2/28/11 585 West Ritchie Road Salisbury, NC • I-85 at Exit 74 (704) 431-4566 Expect more from your independent Trane dealer. independent Trane dealer. C O U P O N Get Your Lawn Equipment Serviced This Winter to be Ready for Spring. It is right around the corner. Get 10% OFF now thru 2/28/11 Stout Heating & Air “Call The Doctor of Home Comfort. He Makes Housecalls.” Conditioning, Inc. 4243 S. Main St., Salisbury, NC 4243 S. 704 Main633 St., 8095 Salisbury, NC Stout Heating & Air 704-326-4568 Conditioning, Inc. NOW OFFERING WELDING SERVICES OUTDOOR POWER EQUIPMENT 3242 S. Main St., Salisbury • 704/633-8484 4243 S. Main St., Salisbury, NC 704 633-8095 S48855 2011 $39.95 SPECIALS $64.95 OIL CHANGE & ROTATION $39.95 SYNTHETIC OIL DEXOS1 OIL CHANGE CHANGE & ROTATION & ROTATION Up To 6qts (Excludes Synthetic And Diesel) Up To 6qts (Excl Diesel) (2011 & newer requirement) Plus… FREE “code check” – read code for check engine light only (diagnosis extra) FREE Battery test – charging system $99.95 $159.95 GM DURASTOP BRAKE PAD REPLACEMENT ORIGINAL EQUIPMENT GM BRAKE PAD REPLACEMENT Car And Light Truck (Exc Some Models) (Machine Rotors Extra) Car And Light Truck (Exc Some Models) (Machine Rotors Extra) diagnosis extra Alignment Check $7.00 car & light truck FREE Roadside Assistance & Tire road hazard cards with qualifying services Coupon Matching within 30 mile radius Tire price match guarantee 404 Jake Alexander Blvd. S., Salisbury, NC 28147 866-370-3516 w w w. Te a m A u t o G r o u p . c o m *Chevrolet will warrant each 2007-2011 model passenger car, light-duty truck, crossover or van for 100/000 miles or 5 years. All prices and payments exclude tax, tag and $399 administrative fee and require lender approval. Payments are based on a 39 month lease with 12k milesper year allowed. Cruze example based on $16,995 MSRP, $8497.50 residual and $2,676 total due at signing. Malibu example based on $22,695 MSRP, $10,893.60 residual and $2,776.93 total due at signing. 6LOYHUDGR SULFH H[DPSOH LQFOXGHV LQFHQWLYHV ZKLFK UHTXLUH ÀQDQFLQJ SXUFKDVH WKURXJK *0$& DQG EHLQJ D 86$$ PHPEHU ZKLFK HYHU\RQH PD\ QRW TXDOLI\ IRU $OO YHKLFOHV DUH VXEMHFW WR SULRU VDOH DQG SLFWXUHV DUH IRU LOOXVWUDWLRQ SXUSRVHV RQO\ S46830 S48854 Republicans push for vote on repealing health care law GOP leaders look for different approach in Obama’s address S48857 WASHINGTON . SPORTS Ronnie Gallagher, Sports Editor, 704-797-4287 rgallagher@salisburypost.com NASCAR Vickers returns to track after medical scare/3B MONDAY January 24, 2011 SALISBURY POST 1B Steelers, Pack are Super Defense does it for Pittsburgh BY BARRY WILNER Associated Press PITTSBURGH — Ben Roethlisberger and the Pittsburgh Steelers Steelers 24 found a fitting way to shut 19 down the New York Jets’ Jets season. What started with “Hard Knocks,” ended with hard knocks. For the third time in six seasons, Terrible Towels will twirl at the Super Bowl, where the Steelers will meet Green Bay after silencing Rex Ryan’s wild bunch in a 24-19 victory for the AFC championship Sunday. Look out Big D, here comes another Big D — in black and gold, and with an unmatched history of carrying off the Lombardi Trophy. The Steelers (14-4) also will challenge the Packers, who are 21⁄2-point favorites, with a versatile attack led by their quarterback and running back Rashard Mendenhall. The defense, led by James Harrison,.” The Steelers ended the Jets’ season with a See STEELERS, 4B Rodgers leads Pack BY CHRIS JENKINS Associated Press AssociAted Press Pittsburgh’s Ben roethlisberger heads to the end zone against the Jets. Sands, Seager impress CHICAGO — There was one MonPackers 21 ster of the Bears 14. AssociAted Press Greg Jennings celebrates the See PACKERS, 4B Packers’ victory on sunday. Pack edges Miami NOTES ‘N’ QUOTES BY MIKE LONDON BY JOEDY MCCREARY mlondon@salisburypost.com Associated Press Area athletes update ... Two players from the area are rated among their organization’s top 10 prospects by Baseball America. Jerry Sands (Catawba) is listed as the Los Angeles Dodgers’ No. 1 power prospect and the No. 6 prospect SANDS in the organization. Baseball America projects Sands as a future starter in left field for the Dodgers. Infielder Kyle Seager (NW Cabarrus, UNC) is ranked as the No. 9 prospect in Seattle’s organization. Both are SEAGER coming off tremendous minor league seasons. Seager batted .345 and scored 126 runs in 135 games in advanced A ball. Sands belted 35 homers while batting .301 and stealing 18 bases in 20 attempts at the A and Double A levels. Pitcher Zach Ward (A.L. Brown) has signed with the Grand Prairie (Texas) AirHogs of the independent American Association. COLLEGE BASEBALL Charlotte has been voted the preseason favorite in the Atlantic 10. RALEIGH — After a huge lead got N.C. State 72 away from Miami 70, be- See GALLAGHER, 4B See N.C. STATE, 3B See ATHLETES, 3B jon c. lakey/sALisBUrY Post salisbury football coach Joe Pinyan, left, and West coach scott Young are already thinking about next year. Football never ends for these guys t’s January, which means basketball season. But for Scott Young and Joe Pinyan, football season never seems to end. Both of the state championship coaches are already thinking seven months ahead to when 2011 practice officially begins. There’s National Signing Day in a couple of weeks when both will be holding parties to salute their RONNIE seniors moving on to GALLAGHER the college ranks. There’s schedule openings to be filled. At West Rowan, where the Falcons have won three straight state 3A championships, Young is busy sup- I porting, 2B • MONDAY, JANUARY 24, 2011 TV Sports Monday, Jan. 24 MEN’S COLLEGE BASKETBALL 7 p.m. ESPN — Notre Dame at Pittsburgh 9 p.m. ESPN — Baylor at Kansas St. NHL HOCKEY 7:30 p.m. VERSUS — N.Y. Rangers at Washington TENNIS 9 p.m. ESPN2 — Australian Open, quarterfinals, at Melbourne, Australia 3:30 a.m. ESPN2 — Australian Open, quarterfinals, at Melbourne, Australia WOMEN’S COLLEGE BASKETBALL 7 p.m. ESPN2 — Iowa at Ohio St. Area schedule Monday, January 24 SENIOR HIGH Y HOOPS 6 p.m. First Presbyterian vs. Sacred Heart Blue 7 p.m. Love Christian vs. St. John’s Lutheran 8 p.m. Young Life vs. First Baptist MIDDLE SCHOOL BASKETBALL Rowan County Tournament at Southeast 4:30 p.m. Erwin vs. Corriher-Lipe (boys) 6 p.m. Knox vs. China Grove (girls) 6. West (6) Prep hoops Scoring Name, school Avery, West Dulkoski, Carson Steele, West Monroe, Carson Rankin, Salisbury Cuthbertson, North Blaire, Salisbury Sabo, East Blackwell, Carson Dixon, West As. Holmes, Salisbury Ay. Holmes, Salisbury Heilig, Salisbury Richardson, Salisbury A.Goins, East Phillips, Carson Barringer, South Gaddy, South Wike, East S.Goins, South Holman, Carson Carby, North Barber, West Drew, East Miller, South G 17 14 17 15 12 13 13 14 15 17 13 13 13 13 11 15 14 14 11 14 15 14 17 14 13 Pts. 299 169 204 179 142 152 141 151 158 176 126 119 116 115 94 119 105 104 76 93 97 89 107 86 78 Avg. 17.6 12.1 12.0 11.9 11.8 11.7 10.8 10.8 10.5 10.4 9.7 9.2 8.9 8.8 8.5 7.9 7.5 7.4 6.9 6.6 6.5 6.4 6.3 6.1 6.0 Area boys Name, school T. Jones, Brown K. Sherrill, West Gaddy, South Dillard, Davie N. Jones, Davie Rankin, Salisbury Houston, Carson B. Sherrill, West Murphy, Salisbury Knox, Salisbury Starks, North Givens, North Hargrave, North McDaniel, South Ca. Martin, Davie Medlin, South Clanton, Carson Weant, Salisbury A.Rogers, East Morgan, West Smith, Brown Gittens, East Kimber, North Copeland, Brown D. Heggins, Carson McCain, Salisbury Wagner, Carson R. Heggins, Carson Shepherd, East Parks, West Rivens, Salisbury Akers, South Connor, North Co. Martin, Davie Petty, Salisbury Johnson, Brown Hough, East Warren, West Ford, North Waddell, Brown G 11 14 15 16 15 10 15 9 14 11 14 6 14 15 16 15 11 13 14 12 11 14 11 11 13 9 15 15 14 16 14 8 13 16 14 11 14 12 12 11 Pts. 256 290 278 292 256 169 235 125 183 139 172 72 164 172 182 164 117 131 141 120 107 123 96 91 106 73 119 116 106 120 101 57 92 109 88 68 86 73 73 66 Avg. 23.3 20.7 18.5 18.3 17.1 16.9 15.7 13.9 13.1 12.6 12.3 12.0 11.7 11.5 11.4 10.9 10.6 10.1 10.1 10.0 9.7 8.8 8.7 8.3 8.2 8.1 7.9 7.7 7.6 7.5 7.2 7.1 7.1 6.8 6.3 6.2 6.1 6.1 6.1 6.0 Rowan girls career Ayana Avery, West, Sr. ...............1,775 Olivia Rankin, Salisbury, Sr. .......786 Ashia Holmes, Salisbury, Sr. ......693 Ayanna Holmes, Salisbury, Sr. ...638 Teaunna Cuthbertson, NR, Jr. ....583 Jessica Heilig, Salisbury, Sr........494 Chloe Monroe, Carson, Jr...........445 Shay Steele, West, So................427 Allison Blackwell, Carson, So. ....385 Olivia Sabo, East, Sr...................371 Sam Goins, South, Sr. ................323 Kelly Dulkoski, Carson, So. ........290 Tiffany Brown, North, Sr..............278 Doreen Richardson, Salis., Jr. ....265 Demya Heggins, Carson, Sr. ......252 Tyesha Phillips, Carson, So........244 Isis Miller, Salisbury, Sr. ............216 Amber Holloway, West, Jr...........214 Lauren Miller, South, Jr...............205 Nicole Barringer, South, Sr. .......203 Area boys career Darien Rankin, Salisbury, Sr.......1,179 Keshun Sherrill, West, Jr. ...........1,020 Nick Houston, Carson, Sr. ..........828 Shannon Dillard, Davie, Jr. .........766 Javon Hargrave, North, Sr. .........731 Teven Jones, Brown, Sr..............630 John Knox, Salisbury, Sr.............598 Cody Clanton, Carson, Sr...........585 B.J. Sherrill, West, Sr..................573 Alex Weant, Salisbury, Sr. ..........549 Nate Jones, Davie, Jr. ................509 Mark McDaniel, South, Sr...........447 Sam Starks, North, Sr.................378 Romar Morris, Salisbury, Sr........368 Johnathan Gaddy, South, Sr.......360 Jordan Kimber, North, Jr.............345 Devon Heggins, Carson, Sr. .......317 Domonique Noble, West, Sr. ......306 Pierre Givens, North, Jr. .............282 Daniel Chambers, North, Jr. .......266 Corey Murphy, Salisbury, Sr. ......258 Cole Honeycutt, East, Jr. ............218 Zach Wagner, Carson, Sr. ..........212 Brad Akers, South, Sr. ................202 Standings 1A Yadkin Valley Boys YVC Overall North Rowan 7-0 11-3 Albemarle 5-1 7-2 West Montgomery 7-2 7-5 North Moore 6-2 9-5 South Davidson 4-5 7-7 East Montgomery 3-4 4-5 Chatham Central 3-6 4-10 Gray Stone 1-7 2-13 South Stanly 0-9 0-12 Saturday’s games North Rowan 64, South Davidson 61 North Moore 55, South Stanly 25 East Mongomery 65, Gray Stone 46 YVC Overall Girls Albemarle 6-0 7-2 Chatham Central 8-1 10-3 North Moore 5-2 9-5 East Montgomery 3-3 3-7 South Davidson 4-5 6-8 North Rowan 3-4 4-10 South Stanly 3-5 3-9 West Montgomery 2-7 2-10 Gray Stone 0-7 0-11 Saturday’s game South Davidson 69, North Rowan 56 Tuesday’s games North Moore at Chatham Central South Davidson at Albemarle East Montgomery at Providence Grove South Stanly at West Montgomery Wednesday’s game Chatham Central at Albemarle Thomasville 0-1 3-10 West Davidson 0-3 4-8 Saturday’s games Salisbury 66, West Davidson 61 Lexington 75, Central Davidson 62 Girls CCC Overall 3-0 12-1 Salisbury Central Davidson 3-0 12-2 Thomasville 1-0 13-1 1-2 11-5 East Davidson Lexington 0-3 6-9 West Davidson 0-3 1-10 Saturday’s games Salisbury 82, West Davidson 22 Central Davidson 67, Lexington 54 Monday’s game Thomasville at Central Davidson Tuesday’s game East Davidson at Thomasville Wednesday’s game Salisbury at Central Davidson 3A North Piedmont Boys NPC Overall 6-0 11-3 Statesville West Rowan 5-1 7-9 West Iredell 3-3 8-7 3-3 6-9 Carson North Iredell 2-3 5-8 East Rowan 1-5 1-13 0-5 3-12 South Rowan Saturday’s game West Rowan 57, North Iredell 43 Girls NPC Overall North Iredell 5-0 12-1 5-1 11-4 Carson West Rowan 4-2 12-5 South Rowan 2-3 5-9 2-4 4-10 East Rowan West Iredell 2-4 3-11 Statesville 0-6 0-14 Saturday’s game North Iredell 62, West Rowan 36 Wednesday’s games South Rowan at Statesville East Rowan at Carson West Rowan at West Iredell 3A South Piedmont Boys Salisbury Central Davidson Lexington East Davidson CCC 3-0 2-1 2-1 1-2 Overall 10-4 8-6 7-9 9-7 Overall 14-1 9-3 10-5 9-6 9-7 4-10 4-10 4-11 Boys SPC Concord 7-0 A.L. Brown 5-1 5-1 NW Cabarrus Central Cabarrus 3-4 Hickory Ridge 3-4 2-4 Cox Mill Robinson 0-5 Mount Pleasant 0-6 Saturday’s game Concord 80, A.L. Brown 73 Girls SPC Overall 7-0 9-6 Concord Hickory Ridge 6-1 11-5 Robinson 4-1 10-3 3-3 7-8 A.L. Brown NW Cabarrus 3-3 4-10 Mount Pleasant 3-4 9-7 0-7 1-11 Central Cabarrus Cox Mill 0-7 1-13 Saturday’s games Concord 60, A.L. Brown 46 Mount Pleasant 61, Cox Mill 42 Monday’s game Mount Pleasant at NW Cabarrus Tuesday’s games A.L. Brown at Central Cabarrus Cox Mill at Hickory Ridge Concord at Robinson Wednesday’s game A.L. Brown at NW Cabarrus 4A Central Piedmont Boys CPC Overall 4-0 17-0 Reagan Mount Tabor 3-1 16-2 Davie County 2-2 13-3 1-2 6-8 West Forsyth R.J. Reynolds 0-2 3-10 North Davidson 0-3 8-6 Saturday’s game Davie 60, R.J. Reynolds 53 Overall Girls CPC Mount Tabor 4-0 13-2 West Forsyth 3-1 11-4 2-1 9-5 R.J. Reynolds Reagan 1-2 5-9 North Davidson 0-3 5-8 0-3 5-11 Davie County Saturday’s game R.J. Reynolds 62, Davie 36 Tuesday’s games North Davidson at Davie R.J. Reynolds at Reagan Wednesday’s game Forbush at West Forsyth College hoops South Carolina 3-2 12-6 Vanderbilt 2-2 14-4 2-2 12-7 Tennessee Western SEC Overall Alabama 4-1 12-7 2-2 10-8 Mississippi State LSU 2-2 10-9 Arkansas 2-3 12-6 1-4 12-7 Mississippi Auburn 0-5 7-12 Tuesday’s games Florida at Georgia, 7 p.m., ESPN Auburn at Arkansas, 9 p.m., ESPNU Wednesday’s game LSU at Tennessee, 8 p.m. Other scores EAST Canisius 75, Iona 73 Fairfield 57, Niagara 49 New Hampshire 80, UMBC 60 Princeton 73, College of N.J. 40 St. Peter’s 62, Manhattan 53 Vermont 70, Binghamton 52 West Virginia 56, South Florida 46 SOUTH Belmont 72, ETSU 62 Lipscomb 76, S.C.-Upstate 55 MIDWEST E. Michigan 41, Cent. Michigan 38 Evansville 70, Bradley 67 Illinois St. 59, S. Illinois 55 Iowa 91, Indiana 77 Kent St. 78, Miami (Ohio) 57 Wis.-Green Bay 63, Valparaiso 61 Wis.-Milwaukee 86, Butler 80, OT Wisconsin 78, Northwestern 46 Notable boxes N.C. State 72, Miami 70 MIAMI (12-7) Scott 5-13 0-0 10, Grant 9-14 0-0 23, Adams 1-5 0-0 2, Swoope 0-1 0-0 0, Johnson 9-17 2-2 20, Brown 1-2 0-0 3, Thomas 3-6 0-0 8, Gamble 1-3 2-3 4. Totals 29-61 45 70. N.C. STATE (12-7) Howell 8-11 1-1 17, Harrow 2-10 0-0 5, Wood 3-6 2-2 11, Williams 2-4 1-2 6, T. Smith 6-14 4-5 16, Painter 2-3 0-0 4, Brown 3-8 4-4 10, Leslie 1-2 1-2 3, Gonzalez 0-2 0-0 0. Totals 27-60 13-16 72. Halftime—N.C. State 37-30. 3-Point Goals—Miami 8-14 (Grant 5-5, Thomas 25, Brown 1-1, Adams 0-1, Scott 0-2), N.C. State 5-11 (Wood 3-4, Williams 1-2, Harrow 1-4, Gonzalez 0-1). Fouled Out—None. Rebounds—Miami 35 (Johnson 14), N.C. State 31 (T. Smith 7). Assists—Miami 11 (Grant 3), N.C. State 19 (Harrow 7). Total Fouls— Miami 14, N.C. State 9. A—15,222. West Va. 56, South Fla. 46 SOUTH FLORIDA (7-14) Anderson Jr. 3-6 0-1 6, Gilchrist 6-12 811 20, Poland 3-10 2-2 9, Crater 1-6 0-0 2, Robertson 1-8 2-2 4, Dority 0-0 0-0 0, Noriega 0-3 1-2 1, Burwell 0-1 0-0 0, Famous 1-4 0-0 2, Fitzpatrick 1-1 0-0 2. Totals 16-51 13-18 46. WEST VIRGINIA (13-5) Thoroughman 0-1 0-0 0, Jones 6-15 12 13, Flowers 5-12 2-3 13, Mitchell 6-19 0-0 13, Bryant 2-9 2-2 6, West 0-0 0-0 0, Kilicli 3-8 2-5 8, Mazzulla 0-0 3-4 3, Pepper 0-2 0-0 0. Totals 22-66 10-16 56. Halftime—West Virginia 27-16. 3-Point Goals—South Florida 1-13 (Poland 1-5, Robertson 0-2, Crater 0-3, Noriega 0-3), West Virginia 2-11 (Flowers 1-2, Mitchell 1-5, Jones 0-1, Bryant 0-3). Fouled Out— None. Rebounds—South Florida 41 (Anderson Jr., Gilchrist 10), West Virginia 45 (Mitchell 14). Assists—South Florida 6 (Robertson 3), West Virginia 12 (Bryant, Thoroughman 4). Total Fouls—South Florida 19, West Virginia 16. A—10,744. Women’s hoops Standings Standings SAC SAC Overall Lincoln Memorial 8-0 16-0 5-3 10-6 Wingate Anderson 5-3 11-7 Brevard 5-3 7-5 5-3 8-8 Carson-Newman Tusculum 5-3 8-10 Catawba 2-6 6-10 2-6 5-11 Mars Hill Newberry 2-6 7-9 Lenoir-Rhyne 1-7 2-14 Monday’s game Brevard at Winston-Salem State Wednesday’s games Newberry at Brevard Mars Hill at Catawba Wingate at Anderson Lincoln Memorial at Carson-Newman Lenoir-Rhyne at Tusculum CIAA Northern Division Overall Virginia Union 2-0 7-5 1-0 11-3 Bowie State Elizabeth City State 1-0 11-4 St. Paul’s 1-0 5-8 0-1 1-13 Lincoln Chowan 0-1 1-14 Virginia State 0-3 1-14 Division Overall Southern Winston-Salem State 1-0 12-3 Johnson C. Smith 1-0 12-4 1-0 5-10 St. Augustine’s Shaw 0-1 11-6 Livingstone 0-1 7-5 0-1 7-8 Fayetteville State Monday’s games Dist. Columbia at St. Augustine’s Brevard at Winston-Salem State Elizabeth City State at Bowie State Chowan at Lincoln Virginia Union at St. Paul’s Tuesday’s games Livingstone at Apprentice School Conference Carolinas CC Overall Queens 8-0 12-4 Limestone 6-1 12-3 Mount Olive 5-3 10-6 Barton 4-4 9-7 St. Andrews 4-4 8-8 Pfeiffer 4-4 6-9 Coker 3-4 5-9 Belmont Abbey 3-5 7-8 Erskine 1-6 2-10 Lees-McRae 0-7 3-11 Wednesday’s games Coker at Pfeiffer Limestone at Erskine Queens at Mount Olive Barton at St. Andrews Belmont Abbey at Lees-McRae ACC ACC Overall Florida State 5-1 15-5 Duke 5-1 18-1 North Carolina 3-1 13-5 Boston College 4-2 14-6 Virginia Tech 3-2 13-5 Clemson 2-3 13-6 Maryland 2-3 12-7 N.C. State 2-3 12-7 Virginia 2-3 11-8 Georgia Tech 2-3 9-9 Miami 1-4 12-7 Wake Forest 0-5 7-13 Sunday’s game N.C. State 72, Miami 70 Tuesday’s games N.C. State at Clemson, 7 p.m., RSN Virginia Tech at Georgia Tech, 9 p.m. Wednesday’s games UNC at Miami, 7:30 p.m., ESPN2 Southeastern Eastern Florida Kentucky Georgia SEC 4-1 3-2 3-2 Overall 14-4 15-4 14-4 San Antonio at Golden State, 10:30 p.m. Sunday’s box Tusculum Mars Hill Newberry Wingate Catawba Lenoir-Rhyne Lincoln Memorial Anderson Carson-Newman Brevard SAC 6-2 5-3 5-3 5-3 5-3 5-3 3-5 3-5 2-6 1-7 Overall 10-6 12-4 10-6 10-6 11-7 8-8 8-8 7-9 6-12 5-13 Division Northern Elizabeth City State 1-0 Virginia State 1-0 1-0 Chowan Virginia Union 0-0 Bowie State 0-1 0-1 St. Paul’s Lincoln 0-1 Southern Division 1-0 Johnson C. Smith Winston-Salem State 1-0 Shaw 1-0 0-1 St. Augustine’s Livingstone 0-1 Fayetteville State 0-1 Overall 12-5 9-4 6-9 0-12 7-7 1-12 1-13 Overall 14-1 11-6 12-7 11-6 9-4 4-11 ACC ACC Overall Duke 5-0 19-0 Miami 4-0 18-1 5-1 17-5 Georgia Tech Florida State 3-1 15-4 North Carolina 3-2 17-3 3-2 16-3 Maryland Boston College 2-3 15-5 Clemson 2-4 9-12 1-4 9-10 N.C. State Wake Forest 1-4 10-11 Virginia 1-4 12-9 0-5 9-10 Virginia Tech Sunday’s games Georgia Tech 67, Boston College 54 Virginia 72, Virginia Tech 37 Clemson 77, Wake Forest 73 (OT) Maryland 88, North Carolina 65 Duke 65, N.C. State 64 Arkansas at Florida, 8 p.m., FSN NBA Standings EASTERN CONFERENCE Atlantic Division W L Pct GB Boston 33 10 .767 — New York 22 21 .512 11 Philadelphia 18 25 .419 15 Toronto 13 31 .295 201⁄2 New Jersey 12 32 .273 211⁄2 Southeast Division W L Pct GB Miami 31 13 .705 — Orlando 29 15 .659 2 Atlanta 29 16 .644 21⁄2 CHARLOTTE 17 25 .405 13 Washington 13 29 .310 17 Central Division W L Pct GB Chicago 30 14 .682 — Indiana 16 25 .390 121⁄2 Milwaukee 16 25 .390 121⁄2 Detroit 16 28 .364 14 Cleveland 8 35 .186 211⁄2 WESTERN CONFERENCE Southwest Division W L Pct GB San Antonio 37 7 .841 — Dallas 28 15 .651 81⁄2 New Orleans 29 16 .644 81⁄2 Memphis 21 23 .477 16 Houston 20 25 .444 171⁄2 Northwest Division W L Pct GB Oklahoma City 28 15 .651 — Utah 27 17 .614 11⁄2 Denver 25 18 .581 3 Portland 25 20 .556 4 Minnesota 10 33 .233 18 Pacific Division W L Pct GB L.A. Lakers 32 13 .711 — Phoenix 20 22 .476 101⁄2 Golden State 19 24 .442 12 L.A. Clippers 17 26 .395 14 Sacramento 9 32 .220 21 Sunday’s Games Denver 121, Indiana 107 Monday’s Games Cleveland at New Jersey, 7 p.m. Detroit at Orlando, 7 p.m. Phoenix at Philadelphia, 7 p.m. Memphis at Toronto, 7 p.m. Washington at New York, 7:30 p.m. Milwaukee at Chicago, 8 p.m. Houston at Minnesota, 8 p.m. Oklahoma City at New Orleans, 8 p.m. Sacramento at Portland, 10 p.m. Anthony hot for Nuggets Nuggets 121, Pacers 107 INDIANA (107) Granger 2-10 4-4 8, Hansbrough 10-17 7-9 27, Hibbert 6-15 0-2 12, Collison 2-10 1-1 5, Dunleavy 3-6 2-2 10, Foster 2-3 4-4 8, Price 1-6 3-3 6, George 7-10 1-2 17, Posey 1-4 0-0 3, Rush 3-4 0-0 9, S.Jones 0-2 2-2 2. Totals 37-87 24-29 107. DENVER (121) Anthony 14-27 2-5 36, Martin 2-5 0-0 4, Nene 7-11 1-1 15, Billups 4-9 3-3 12, Afflalo 3-7 2-2 9, Harrington 7-11 1-1 16, Smith 4-9 0-1 8, Lawson 4-6 4-4 13, Ely 0-1 0-0 0, Williams 1-2 2-2 4, Carter 1-2 0-0 3, Forbes 0-2 1-2 1. Totals 47-92 16-21 121. Indiana 30 21 27 29 — 107 Denver 27 32 34 28 — 121 3-Point Goals—Indiana 9-21 (Rush 3-3, Dunleavy 2-3, George 2-3, Price 1-3, Posey 1-4, Granger 0-2, Collison 0-3), Denver 1120 (Anthony 6-8, Carter 1-1, Lawson 1-1, Harrington 1-2, Billups 1-2, Afflalo 1-3, Forbes 0-1, Smith 0-2). Fouled Out—Nene. Rebounds—Indiana 52 (Hansbrough 10), Denver 53 (Nene 10). Assists—Indiana 25 (Price 8), Denver 28 (Billups 6). Total Fouls—Indiana 22, Denver 22. Technicals— Indiana defensive three second, Denver defensive three second. A—17,047 (19,155). NHL Standings EASTERN CONFERENCE Atlantic Division GP W L OT Pts GF GA Philadelphia 49 32 12 5 69 169 128 Pittsburgh 49 30 15 4 64 153 114 N.Y. Rangers 50 28 19 3 59 143 121 N.Y. Islanders47 15 25 7 37 117 157 New Jersey 48 16 29 3 35 100 143 Northeast Division GP W L OT Pts GF GA 48 27 14 7 61 150 109 Boston Montreal 49 27 17 5 59 128 118 Buffalo 48 22 21 5 49 134 142 47 19 23 5 43 120 145 Toronto Ottawa 49 17 25 7 41 106 157 Southeast Division GP W L OT Pts GF GA Tampa Bay 50 30 15 5 65 152 154 Washington 49 27 14 8 62 139 126 51 23 19 9 55 151 166 Atlanta Carolina 48 23 19 6 52 143 149 Florida 47 21 21 5 47 126 126 WESTERN CONFERENCE Central Division GP W L OT Pts GF GA Detroit 48 29 13 6 64 163 142 Nashville 48 27 15 6 60 132 114 49 26 19 4 56 155 135 Chicago St. Louis 47 22 18 7 51 126 138 Columbus 48 23 20 5 51 128 149 Northwest Division GP W L OT Pts GF GA Vancouver 48 29 10 9 67 156 119 48 24 18 6 54 155 157 Colorado Minnesota 48 24 19 5 53 126 132 Calgary 49 22 21 6 50 137 150 Edmonton 47 14 25 8 36 117 162 Pacific Division GP W L OT Pts GF GA Dallas 48 29 14 5 63 143 129 51 27 20 4 58 137 144 Anaheim Phoenix 49 24 16 9 57 141 139 San Jose 49 25 19 5 55 137 135 Los Angeles 48 25 22 1 51 138 122 Sunday’s Games Nashville 3, Edmonton 2, SO Philadelphia 4, Chicago 1 New Jersey 5, Florida 2 Buffalo 5, N.Y. Islanders 3 Tampa Bay 7, Atlanta 1 Monday’s Games Toronto at Carolina, 7 p.m. N.Y. Rangers at Washington, 7:30 p.m. Nashville at Calgary, 9:30 p.m. St. Louis at Colorado, 9:30 p.m. Dallas at Vancouver, 10 p.m. Boston at Los Angeles, 10:30 p.m. NFL SAC CIAA 2A Central Carolina SALISBURY POST SCOREBOARD Sunday’s sums Steelers 24, Jets 19 N.Y. Jets Pittsburgh 0 3 7 9 — 19 7 17 0 0 — 24 First Quarter Pit—Mendenhall 1 run (Suisham kick), 5:54. Second Quarter Pit—FG Suisham 20, 6:51. Pit—Roethlisberger 2 run (Suisham kick), 2:00. Pit—Gay 19 fumble return (Suisham kick), 1:13. NYJ—FG Folk 42, :09. Third Quarter NYJ—Holmes 45 pass from Sanchez (Folk kick), 12:13. Fourth Quarter NYJ—DeVito safety, 7:38. NYJ—Cotchery 4 pass from Sanchez (Folk kick), 3:06. A—66,662. NYJ Pit 17 23 First downs Total Net Yards 289 287 Rushes-yards 22-70 43-166 219 121 Passing Punt Returns 0-0 2-10 Kickoff Returns 5-51 4-70 2-10 0-0 Interceptions Ret. Comp-Att-Int 20-33-0 10-19-2 Sacked-Yards Lost 2-14 2-12 4-36.5 1-38.0 Punts Fumbles-Lost 2-1 3-0 Penalties-Yards 6-50 4-25 34:41 Time of Possession 25:19 INDIVIDUAL STATISTICS RUSHING—N.Y. Jets, Greene 9-52, Tomlinson 9-16, Sanchez 3-6, Cotchery 1-(minus 4). Pittsburgh, Mendenhall 27-121, Redman 4-27, Roethlisberger 11-21, Moore 1(minus 3). PASSING—N.Y. Jets, Sanchez 20-33-0233.. Packers 21, Bears 14 Green Bay Chicago 7 7 0 7 — 21 0 0 0 14 — 14 First Quarter GB—Rodgers 1 run (Crosby kick), 10:50. Second Quarter GB—Starks 4 run (Crosby kick), 11:13. Fourth Quarter Chi—Taylor 1 run (Gould kick), 12:02. GB—Raji 18 interception return (Crosby kick), 6:04. Chi—Bennett 35 pass from Hanie (Gould kick), 4:43. A—62,377. GB Chi First downs 23 17 Total Net Yards 356 301 Rushes-yards 32-120 24-83 Passing 236 218 Punt Returns 3-13 4-38 Kickoff Returns 3-44 4-63 Interceptions Ret. 3-58 2-43 Comp-Att-Int 17-30-2 19-38-3 Sacked-Yards Lost 1-8 2-15 Punts 8-41.8 9-37.1 Fumbles-Lost 2-0 1-0 Penalties-Yards 6-40 9-89 Time of Possession 34:04 25:56 INDIVIDUAL STATISTICS RUSHING—Green Bay, Starks 22-74, Rodgers 7-39, Jackson 2-5, Kuhn 1-2. Chicago, Forte 17-70, Cutler 2-10, Hanie 13, Taylor 3-2, Bennett 1-(minus 2). PASSING—Green Bay, Rodgers 17-302-244. Chicago, Hanie 13-20-2-153, Cutler 6-14-1-80, Collins 0-4-0-0. RECEIVING—Green Bay, Jennings 8130, Nelson 4-67, Jackson 1-16, J.Jones 110, Driver 1-9, Kuhn 1-6, Starks 1-6. Chicago, Forte 10-90, Bennett 3-45, Olsen 3-30, Knox 2-56, Taylor 1-12. Tennis Australian Open Results Purse: $24.7 million (Grand Slam) Surface: Hard-Outdoor Singles Men’s Fourth Round Alexandr Dolgopolov, Ukraine, def. Robin Soderling (4), Sweden, 1-6, 6-3, 61, 4-6, 6-2. Women’s Fourth round Petra Kvitova (25), Czech Republic, def. Flavia Pennetta (22), Italy, 3-6, 6-3, 6-3. Vera Zvonareva (2), Russia, def. Iveta Benesova, Czech Republic, 6-4, 6-1. DENVER (AP) — Carmelo Anthony gave the home Nuggets 121 crowd nothing to about Sunday Pacers 107 boo seaHANSBROUGH son. Tyler Hansbrough had 27 points and 10 rebounds for Indiana, which trailed 59-51 at halftime.. Flyers cool off Chicago Associated Press NHL roundup ... CHICAGO —. Predators 3, Oilers 2, SO EDMONTON, Alberta —. Devils 5, Panthers 2 NEWARK, N.J. —. Sabres 5, Islanders 3 UNIONDALE, N.Y. — Nathan Gerbe snapped a tie early in the third period with a power-play goal, and Buffalo salvaged a split of the homeand-home series. After scoring goals 5 seconds apart in the third period Friday night in Buffalo’s 5-2 home loss to New York, Gerbe finished a three-way passing play to net the winner 1:48 into the final period Sunday. Red Devil wrestler shines rebounds and five block shots. Chili Chilton added seven points, including China Grove wrestler Alex Lyles the go-ahead basket in OT. has won five tournaments this year. The Dolphins travel to Conover for Lyles was the champion at 215 a league double header on Tuesday. pounds in the Rowan County Middle School Tournament held at China College commitments Grove on Saturday. South Rowan’s He recently won the open state championship held at Davie and also Caleb O’Neal has won a Christmas tournament at North signed with Southern Rowan and tournaments held at Wesleyan’s cross Thomasville and Mebane. He’s won country program. South Rowan two events while wrestling in the 250second baseman Japound class. Lyles is 34-0 this season and has cob Dietz has verbalgiven up only six total points in all ly committed to Belmont Abbey’s basethose matches. Erwin wrestlers, coached by for- ball program. DIETZ Northwest mer East Rowan standout Aaron Plyler, finished second in Saturday’s Cabarrus left-hander Rob Bain, who has lots of family ties to Rowan Counconference tournament. Brady Argabright and Marshall ty, has verbally committed to DavidShank won championships for the Ea- son’s baseball program. Bain is one of the nominees for gles while Robert Barringer, Justin Coe and Bryant Godsey had second- Greater Charlotte Pitcher of the Year. That award will be announced Feb. 5. place finishes. Play continues in the middle Stories are upcoming. school basketball tournament today with semifinals at Southeast. Hurley Y basketball Erwin’s top-seeded boys play CorA boys basketball league for ages riher-Lipe at 4:30 p.m., and Knox’s top-seeded girls meet China Grove at 5-14 starts in February at Hurley YMCA. 6 p.m. Games will be played in February and March. There will be a coaches Jayvee girls basketball meeting this Friday at 6 p.m. in the Salisbury’s jayvee girls basketball Y conference room. team rolled 49-18 against West DavidVolunteer coaches and assistants son on Saturday. are needed. Contact Phillip Hilliard, Patreece Lattimore scored 17 sports director, for information at points for the Hornets (9-0, 3-0 CCC). 704-636-0111. Monifa Angle had nine points, and Daterria Connor scored eight. China Grove sign-ups From staff reports Sacred Heart hoops China Grove youth baseball and softball registrations will start on Jan. 19 at Dale’s Sporting Goods. Registration lasts through Feb. 26. Baseball fees are $40 for Coach Pitch (ages 5-6); $50 for Coach Pitch (ages 7-8); $50 for Junior Division (ages 9-10); and $50 for Senior Division (ages 11-12). Softball fee is $45 for Coach Pitch (ages 6-9) or Senior Division (ages 1014). League age is as of April 30, 2011. If you have questions, contact James Solomon at 704 857-1439 or email ymcanewhouse@yahoo.com. Sacred Heart’s varsity girls beat Hickory Christian 50-43 at the Boyd Dolphin Tank. Erin Ansbro had 23 points, eight assists, seven rebounds and seven steals to lead the Dolphins (16-5, 4-0). Meghan Hedgepeth added 10 points, six assists, five rebounds and five steals. Annie Habeeb had seven points. Caroline Parrott had seven reboards and Breya Philpot had five. Sacred Heart’s boys rallied from a halftime deficit and topped Hickory Christian 34-30 in overtime. Spencer Storey hit a key 3-pointer during the rally. Pfeiffer volleyball Max Fisher hit three 3-pointers to Pfeiffer’s men’s volleyball team lift his season total to 43. He scored opened the season by going 3-1 at the 12 points. Christian Hester had 11 points, 12 Hampton Inn & Sleep Inn tourney. SALISBURY POST MONDAY, JANUARY 24, 2011 • 3B SPORTS Tigers honor Sparky Associated Press The baseball notebook ... DETROIT — The Detroit. “When you think of great managers and people in the game that really epitomize what it is to be a baseball manager ... you think of Sparky Anderson,” general manager Dave Dombrowski said Saturday. Anderson, who also won the World Series twice as Cincinnati’s manager, died Nov. 4. Dombrowski expressed regret that Anderson passed away before his number was retired. “I know in a way, it’s a shame,” Dombrowski said. “It’s the same thing, I see somebody go into the Hall of Fame, and you say, ‘Gee, I wish they’d gone in when they were alive.’” The date for the number retirement has yet to be determined. NEW RAYS TAMPA, Fla. — Manny Ramirez and Johnny Damon are about to become teammates again, this time in Tampa Bay. Both free-agent outfielders agreed to one-year contracts with the Rays, a person familiar with the negotiations told The Associated Press. The person spoke on condition of anonymity because the agreements. WRITER’S AWARDS NEW YORK — chapte. ‘for. ATHLETES FroM 1B AssociAted Press Kasey Kahne (4), Brian Vickers (83), Martin truex Jr. (56), and david reutimann (00) participate in the afternoon bump-drafting session during auto racing testing at daytona. Vickers back after medical scare Associated Press DAY.” West Virginia bounces back; Duke women nip Wolfpack Associated Press The college basketball roundup ... MORGANTOWN, W.Va. — Casey Mitchell had 13 points and 14 rebounds to lead No. 21 West Virginia to a 56-46 win over South Florida on Sunday. John Flowers and Kevin Jones added 13 points apiece for West Virginia (13-5, 4-2 Big East). The Mountaineers bounced back from a 75-71 loss to Marshall on Wednesday after entering the Top 25 for the first time this season. Augustus Gilchrist had his third straight double-double with 20 points and 10 rebounds for South Florida (7- 14, 1-7). The Bulls lost for the 11th time in 13 games. West Virginia gave up its fewest first-half points this season and the Mountaineers led by as many as 16 points after halftime. No. 18 Wisconsin 78, Northwestern 46 EVANSTON, Ill. — Jon Leuer scored 19 points to lead a balanced attack and No. 18 Wisconsin rolled to a Big Ten victory over Northwestern. Keaton Nankival had 16 points and Taylor Jordan added 14 as the Badgers (15-4, 5-2 Big Ten) won their third straight game to remain third in the conference standings. Wisconsin freshman Josh Gasser had a triple-double with 10 points, 12 rebounds and 10 assists. John Shurna and Luka Mirkovic scored 13 apiece for the Wildcats. Iowa 91, Indiana 77 IOWA CITY, Iowa — Freshman Melsahn Basabe scored 20 points, Matt Gatens added 19 and Iowa snapped a six-game losing streak by drilling depleted Indiana. Freshman Devyn Marble scored a career-high 18 for the Hawkeyes (811, 1-6 Big Ten), who picked up their first league win. Women No. 3 Duke 65, N.C. State 64 RALEIGH — Freshman Chelsea Gray hit a driving layup with 12 seconds left to help No. 3 Duke rally from a 20-point deficit to beat rival North Carolina State on Sunday. Jasmine Thomas scored 14 points to lead the Blue Devils (19-0, 5-0 Atlantic Coast Conference). No. 15 Maryland 88, No. 10 UNC 65 COLLEGE PARK, Md. — Alyssa Thomas had 16 points and 13 rebounds, and No. 15 Maryland had four other players score in double figures in a surprisingly easy 88-65 victory over No. 10 North Carolina on Sunday. Italee Lucas scored 17 for the Tar Heels (17-3, 3-2). North Carolina has gone 3-3 since starting out 14-0. The 49ers’ roster includes East Rowan products Corbin Shive, Justin Roland and Ross Steedley and North- ROLAND west Cabarrus grad Justin Seager. PRO BASKETBALL Carlos Dixon (South Rowan) led his team in Okinawa to a recent 98-96 overtime win with 18 points and 12 rebounds. Dixon is averaging a teambest 14.3 points a game. FOOTBALL Linebacker SaMario Houston (Catawba) signed with the Carolina Speed of the Southern Indoor Football League. The 220pound Houston has had previous stints in Europe and Canada. Houston was the SAC Freshman Defensive Player of the Year in 2002. COLLEGE BASKETBALL Charlotte sophomore K.J. Sherrill (West Rowan) shot 4-for-4 from the field in Saturday’s 83-67 loss to Duquesne. Doug Campbell (Salisbury) scored a team-high 16 points for Rio Grande on CAMPBELL Friday in a 91-70 loss to Georgetown, Ky. Darius Moose (Carson) scored nine points for Brevard in Saturday’s 65-49 loss to Wingate. WOMEN’S BASKETBALL Tallahassee Community College freshman Bubbles Phifer (Salisbury) scored a career-high 16 points in 64-54 upset of Gulf Coast Community College, the nation’s 4thranked junior college, on Saturday. Rashonda Mayfield (West) scored 11 points for Voorhees in a 77-56 win against Morris on Thursday. Mayfield also had nine assists and five rebounds. SWIMMING UNC Wilmington’s Tanner Lowman (East) placed fourth in the 100 breaststroke and fifth in the 200 breast as the Seahawks beat South Carolina. PRO GOLF Elliot Gealy (Salisbury) earned his Nationwide card in December at PGA Qualifying School and will return to competitive golf when the Nationwide Tour begins play in late February in Panama. N.C. STATE FroM 1B DO YOU HAVE TOENAIL FUNGUS Do you have trouble breathing? ON BIG TOE? Or a persistent cough? hit three 3s and scored 11 points during the burst that Scott capped with a layup with 1:04 left that put Miami up 7069. for the Wolfpack. For more information call 704.647.9913 or visit TNL0904 AssociAted Press N.c. state’s richard Howell, left, reaches for the ball as he battles Miami’s durand scott. If you you answered answered yes, yes, and and between If between 18 18 to to 70 70 years years old, old,you you hronic Obstructive Ifmay so, you may have a disease called C to participate participateininaaclinical clinicalresearch researchstudy studyusing using may qualify qualify to Pulmonary Diseasetopical or COPD. A clinical research study is being an topical product for toenail toenail fungus of the the an investigational investigational product for fungus of conducted great great toe. toe. on an investigational inhaled medication for COPD. We are looking for people who are smokers or ex-smokers, at least 40 years old, never diagnosed asthmaKOH andtest currently Qualified participants must have havewith positive KOH test and have no Qualified participants must aa positive and culture at study visit. other significant health culture at this this first first studyconditions. visit.Study Studyparticipants participantswill willreceive receive all allstudy-related care and study product at no cost. study-related care and study product at no cost. If you qualify, you will receive study medication and study related Qualified participants may receive financialcompensation medical at no cost while participating incompensation the study. up to Qualifiedcare participants may receive financial up to $385 for time and travel. for time and travel. If$385 eligible, financial compensation will be provided for time and travel. For more information call 704.647.9913 or visit R128447 ing 410 Mocksville Avenue Salisbury, NC 28144 4B • MONDAY, JANUARY 24, 2011 SALISBURY POST PRO/PREP FOOTBALL Teams with tradition, hair matched up in Super Bowl Associated Presstalk STEELERS FROM 1B.” At game’s end, Roethlisberger knelt on the field, his face buried in an AFC championship T-shirt. “I’m going to enjoy this,” he said. No one had to ask what he meant. Roethlisberger. “God is good and this one was for Steelers fans,” Roethlisberger said. “I’m really proud of the way you came out and supported us tonight.” Now he will lead the Steelers into their eighth Super Bowl, a game they handle pretty well — and have a the hair department, too, with the grungy locks of Clay Matthews matched against Polamalu’s thick mass of curls. A pair of over-the-top ‘dos 240 but needed a goal-line stand to finally silence the Jets. The Packers jumped ahead by two touchdowns PACKERS FROM 1B19 in the AFC championship game. The Packers opened as 21 AssOciAted PRess with a knee injury early in the chicago’s Julius Peppers (90) puts a big hit on Green Bay’s third quarter. Even before the injury, Cutler was having Aaron Rodgers, but Rodgers turned in a fine performance. GALLAGHERlooking ‘68 with Vince Lombardi stalking the sideline. AssOciAted PRess Pittsburgh tight end Heath Miller battles New York Jets safety eric smith for a pass.out to begin the second half. closer,” said Pinyan, who was the only coach to play the other five county schools last year. FROM 1A • Feb. 2 promises to be a busy day streak at 55 before losing last seafor Young and Pinyan. As many as son. The Rams handed the title of 13 players could possibly sign on longest winning streak to West, that day from those two title teams. which now stands at 46. The two Young wouldn’t be surprised if KNOX WARREN will play in Reidsville. seven of his Falcons sign between Young had an opening in the National Signing Day and Feb. 14. eighth week of the season and feels The biggest name is defensive Knox was leaning toward lucky to find such an intriguing op- back Domonique Noble, who is ex- Charleston, a Division II school in ponent. pected to sign with Georgia Tech. West Virginia. “Next year, it’s 11 games in 11 He also mentioned quarterback Speedster Morris and safety weeks,” Young said. “It was tough B.J. Sherrill, defensive backs Trey Rankin are Carolina Blue-bound. to find somebody to play in Week Mashore and Eric Cowan, defenKicker David Simons plans to walk 8. They had an opening and we had sive lineman Emmanuel Gbunblee, on at Division III Randolph-Macon. an opening. They were excited linebacker Quentin Sifford and Pinyan said tight end Riley Galabout the potential to play us. I tight end Patrick Hampton. lagher and defensive back Tre think it’s going to be a big-time Cowan, Rowan County’s DefenJackson could go to Division III matchup.” sive Player of the Year, took the schools. Davie County dropped Salisbury SAT on Saturday and is expected to At Carson, Mark Woody will (“I guess they were tired of beatmake his first visits. Word is, Aphave a celebration for running ing us,” Pinyan laughed). The War palachian State is one of the schools back Shaun Warren (Western CarEagles will be replaced by Besseworking on a package for Sherrill. olina) and receiver Cody Clanton mer City. At Salisbury, the big question (Catawba). “It was between us and West surrounds John Knox, a talented • Davidson and they said we were wishbone quarterback. Pinyan said Speaking of Warren, who shared the county’s Offensive Player of the Year award with Sherrill, Pinyan wonders if he’ll be available to play in the East-West AllStar proba- bly. SALISBURY POST MONDAY, JANUARY 24, 2011 • 5B CLASSIFIED JOBS AUTOS SUNDAY & WEDNESDAY Sell It Faster with an Attention Getter! Choose an “eye-catching” image and make your ad stand out in print and online! FRIDAY Heather Kristin SALISBURYPOST.com is Rowan’s most visited local site with more than 2.5 million page views per month REAL ESTATE SATURDAY YOUR CLASSIFIED LISTINGS… Barbara SERVICES LEGALS DAILY DAILY 797.4220 Call 704. Employment Pets & Livestock Notices Garage & Yard Sales Transportation Real Estate or Online Merchandise for Sale Service Directory Rentals Employment Automotive AUTO TECH All Levels, Great Pay, Benefits and opportunity. Call 336-542-6195 Looking for a New Pet or a Cleaner House? CLASSIFIEDS! TO ADVERTISE CALL (704) 797-4220 Employment Musician for church needed. 704-640-6360 or 704-278-9116. Allen Temple Presbyterian Ch. Other HOUSECLEANERS Residential Up to $10/Hour to Start Paid Travel Time Paid Mileage Full Time Car Required Mon-Fri Days Only EOE. 704-762-1822 Other Sitter needed for WWII veteran in VA Hospital. Socialization only. 2-4 hrs/day Mon.-Fri. Perfect for retired person. References & criminal background check. Call 336-972-4402 Baby Items Baby sling for small frame, blue/brown/white. $10. Closet M-F clothes hangers (2) $5 ea. Safety 1st potty w/foam seat. $8. Crib bedding (yellow, green, white) $50. Call 704-787-4418 Double jogging stroller by In Step. Great shape. $125. Single jogging stroller by Jeep. Like new. $70. My Breast Friend nursing pillow (used twice) Blue & white. $20. 704-787-4418 Boocoo Auction Items *All Boocoo Auction Items are subject to prior sale, and can be seen at salisburypost.boocoo.com Got puppies or kittens for sale? Cat, beautiful male lap cat. Very sweet, test neg, shots, no dogs or kids, neutered. 704-636-0619 Dogs needed full-time. Highly motivated & outgoing. Must be a team player. Please email resume to: dental330@gmail.com Want to get results? See stars Playful & Sweet! Free kitten, 4 months old, long haired, black tabby male. Sweet, good natured. Needs good home. 704-933-9708 Manufacturing Textile Plant Electrician Building Equip. & Supplies Giving away kittens or puppies? Puppies. Rat Terriers, full blooded. Ready to go to a loving home. 1st shots, born Nov. 16, parents on site and are also for sale. two One male $75, females $100. 704-4336108 or 704-433-6052 STEEL BUILDING 2010 WINTER CLOSEOUTS! SAVE THOUSANDS! Canceled Orders, Repo's. 30X40, 16x24, 20x30, others. Limited supply selling for balance owed. Additional display program savings. Please call 866-352-0469 Dogs Dogs Free dog. One 1½ year old female and one 2 yr old male Rottweiler not aggressive to a good home. 704-638-9498 FREE Puppies. Jack Russell/Terrier Mix. Available Feb. 6th. 4 boys, 2 girls. Call 704-640-9274 after 6 p.m. Greyhound Mix – Free, 10 year old three legged greyhound mix. Very sweet. House broken. Good w/children & other pets. 704-212-7299. Puppies. 6 week old Yorkie-Shons. 3 brown males with little white and black markings and 1 black female with little white marking. Tails docked, dewormed and first shots. Call William Petersheim at 330-2313816 or 330-231-7136 Puppies Free cat. Black & white tabby. Totally declawed. Never sick in 15 yrs. Still chases her tail. Long life expectancy. Ideal for adults wanting quieter pet. Loving. Owner going to nursing home. 704-647-9795 Dental Assistant Parkdale 23 100 S. Main St. Landis, NC Dogs Free dog. Mini 19 lb. multicolored Poodle. Neutered. Black racing stripe nose to tail. Handsome & friendly. 12 yo. Exc. health. Loves to run. Owner going to nursing home. 704-647-9795 Cat, neutered, fluffy white male cat. Needs good indoor home. Call 704630-6972 Healthcare Electrical, Electronics, and PLC knowledge exp. preferred but not required in troubleshooting on Schlafhorst, Rieter, and Truetzschler equipment. Competitive pay including benefits. Apply in person to: Cats Dogs CKC puppies. Pomeranians, 9 wks. $200. Blue male Chihuahua. 4½ mo. $150. Cash. 704-633-5344 Classifeds 704-797-4220 Golden Retrievers full blooded. Parents on site. Born December 20. Males $75, females $100. 704819-6159 Puppies Puppies. Boxers, full blooded, born Nov. 28, 1st shots, tails docked, parents on site. 4 females & 2 males are left. $250 each. 704-6366461 after 5pm Puppy. Miniature Schnauzer, female. Ready. 1st shots, de-wormed. Parents on site. $400. 704-2989099 or 704-738-3042 YORKIE Gold color Yorkie, small dog. Call Pat, 704-2263835 moving out of town asking $300. Salisbury Puppies. Yorkshire Terriers AKC tea cup size, baby doll face, born Dec. 4, 2010, 1st shot, dewormed, tail docked, dew claws removed, vet checked. 704-223-0742 or 704-279-5349 Other Pets HHHHHHHHH Check Out Our January Special! Dentals 20% discount. Rowan Animal Clinic. Call 704-636-3408 for appt. Supplies and Services TOY POODLE CKC Brown female, 6 weeks old, health guaranteed Cash only $500. 704-798-0450 Rabies Clinic Saturday, February 12, 8am12noon. $10 per vaccine. Follow us on Face Book Animal Care Center of Salisbury. 704-637-0227 Education Cell Phones & Service Rowan-Cabarrus Community College seeks applications for the following positions: Blackberry - Nextel with spare battery charger & otter box. No scratches, looks new, works great $55. Call 704-239-2342 talk to Nolan HR Program Manager Training & Development Clothes Adult & Children Required: Bachelor's degree in Human Resources, Human Relations, Training and Development, Labor Relations, Organizational Development or related area. Four to six years of Human Resources experience. Men's 2 pack XXL shisrts, 2 pair, brand new $5 each. Computer desk $20. 704-640-4373 Administrative Specialist Required: Associates Degree; high level of competence with all Microsoft Office tools; extensive experience with budgets and purchasing processes. Must have excellent time management skills and able to keep several priorities on task and meet all deadlines. Must have experience generating enrollment and financial reports and must possess excellent communication skills. Information Commons Lab Assistant P/T Required: Associate's degree in Information Technology or related field. Interested candidates may apply online at. EOE. Seeking Employment Employment $10 to start. Earn 40%. Call 704-754-2731 or 704-607-4530 Earn extra holiday cash. $10 to start. 704-2329800 or 704-278-2399 Certified Nursing Assistant seeking evening home care position for child or elderly. 10 yrs experience. Have references. Salisbury, Concord area. Ask for Carol, 704-279-5750 Bank - Stars Wars CPO/R2D2 working, excellent cond. No box $50.00 336-406-3969 Dishes - 52 piece set of Blue Ridge dishes, poinsettia pattern. $350 firm. Includes serving pieces Rockwell 704202-5022 Hall Tea Pots, a collection of 32. 3 pitchers and 4 coffee perculators, all in good condition. 704-431-4178 Be a part of our popular annual publication! This widely-read full color special is a “Who’s Who” of area businesses! Women's 8½W black pumps $2, women's 8½M Timberland boots $45. 704-640-4373 Women's clothing sizes 14-18, some L maternity. Jeans/dress pants, $7 each. Shirts $5 each. Call 704-787-4418 Computers & Software Dell Desk Top Computer Computer. Complete P4 Dell. Internet ready, CD burner. Mouse, keyboard, 17” monitor included. $125. Please call 980-205-0947 DELL LAPTOP COMPUTER • Publishes Sunday, February 27, 2011 in the Salisbury Post • Wednesday, February 23, 2011 in Marketplace Miner • Online February 27-March 5 at where we get over 3 million page views a month! FREE COLOR! Receive a 2 col. (2.375”) X 2” ad in the Salisbury Post and the Marketplace Miner for 1905 40 $ ∫ 106 Years OR FOR TOTAL MARKET COVERAGE 50 $ for we’ll run your ad also in the Davie County Enterprise-Record and the Clemmons Courier’s Business Honor Roll sections! Entry Form Name of Business ________________________________________ Address __________________________________________________ Phone ____________________________________________________ Dell Laptop Computer, internet ready, wireless, Windows XP. $125. 980-205-0947 Antiques & Collectibles 2011 BUSINESS HONOR ROLL Office Equipment. Includes computer, software, printer, battery back-up, transcribers and much more. All for $250. 704-638-6470 SINCE 1905 Year Business Started ______________________________________ “The truth shall make you free” 704-633-8950 EXAMPLE: Consignment Growing Pains Family Consignments Call (704)638-0870 115 W. Innes Street Contact/Approved By ______________________________________ Deadline for entry: February 17 • 5 PM Mail Form and Payment to: Business Honor Roll c/o Salisbury Post P.O. Box 4639 Salisbury, NC 28145 or Call 704-797-4220 We accept Sweet Peas 2127 Statesville Blvd. 50% off all Clothing Now thru Jan. 31st. C46089 6B • MONDAY, JANUARY 24, 2011 Electronics Jewelry Misc For Sale Home Theater System, JVC audio/ video receiver, 6 JBL speakers 100 watt. $175 Rockwell 704-202-5022 Gemstones (3) - .50 carat natural ruby, 1.23 carat natural sapphire & 1.04 carat natural sapphire. Cut & ready to be set. $300. 704-638-6470. Piano. Marcellus upright piano. Great condition. 80 years old. $350. YOU MOVE! 704-857-0093 Window air conditioner with remote. You pickup. $80, 704-638-5633. No calls after 7 pm, or leave a message. Food & Produce Lawn and Garden Holshouser Cycle Shop Lawn mower repairs and trimmer sharpening. Pick up & delivery. (704)637-2856 Misc For Sale A.R.E. fiberglass truck cap. Fits '07 and newer Silverado/Sierra long beds. Came off regular cab. Dark blue color. $375. 704-638-6470. ANDERSON'S SEW & SO, Husqvarna, Viking Sewing Machines. Patterns, Notions, Fabrics. 10104 Old Beatty Ford Rd., Rockwell. 704-279-3647 Many buyers won’t leave a message; give the best time to call. Firewood for Sale: Pick-up/Dump Truck sized loads, delivered. 704-647-4772 Firewood. Split & seasoned. 95% oak, 5% mixed hardwood. $200/cord. Also, seasoned & green hickory $250/cord. 704-202-4281 or 704-279-5765 Water Heater - New 40 gallon natural gas water heater. Paid $530 Sacrifice for $400 Rockwell 704-202-5022 Music Sales & Service Baldwin spinet elec. Piano & bench, earph. Set. Walnut cabinet. Perf. Cond. $495. WS: 336-722-8237 Furniture & Appliances Bed – Queen w/headboard, footboard, chest of drawers & Cherry, nightstand. made by Dixie in USA. $375. Call 704-857-6274 Bedroom suite - Double bed, dresser w/mirror, chest of drawers, end table. Good condition. $350 704-932-6769 MUST SELL Bingham Smith Lumber Co. !!!NOW AVAILABLE!!! Metal Roofing Many colors. Custom lengths, trim, accessories, & trusses. Call 980-234-8093 Patrick Smith Bedroom suite, new 5 piece. All for $297.97. Hometown Furniture, 322 S. Main St. 704-633-7777 Books. Danielle Steel. Hard and soft copies. Fifteen for $10. Call 336751-5171 Electric range, Jenn-Air with grill option, slide in down draft, black $275. 704-798-1213 Free couch wiwth two built-in recliners, blue. 704-431-4424 Call Anytime Kitchen table, 6 chairs wrought iron legs solid wood table top, bakers rack matching set $500 OBO. 704-278-1614 Living room suite. Sofa and love seat, plaid (burgundy, navy, tan and green). $200. Good condition 704-636-4149 Mixer. White Sunbeam Mixmaster Mixer with 2 stainless steel bowls, beaters & dough beaters. EC. $50. 704-245-8843 Office Furn.: Solid Oak 4 drawer desk & chair. 5ft.x2.5ft. $250. W-S: 336-722-8237 Refrigerator, Mini Haier white, $40. Please Call 704-310-8090 Stainless steel two bowl kitchen sink with Delta faucet/sprayer $125. 704-798-1213 Table. St. Bart's 54” round wood table with pineapple base. Cost $350 new. Great condition. $350. 336936-9452 TV 27” $75; DVD Converter box $45; 10,500 BTU heater microwave 1100 704-636-1136 $30; New $65; $35. Washer and dryer. Washer works fine, dryer needs heating elememt. $50 for both. Call Tony at 704-305-0355. Games and Toys Pool Table Combination Poker/ Bumper Pool Table with balls & cue stick included. Heavy duty! $125.00. 704-202-5282. Please leave message. Camper top shell, red shortbed, great cond. $500 leave message 704-279-4106 or 704798-7306 Ceramic & porcelain figurines & vases, approx. 60. 60-80 years old. $150 for all. Call 704-857-0093 Christmas tree and decorations. Too much to list. You pick up. $75. For more info call 704-6385633, no calls after 7pm, or leave a message. Dolls. (Not antiques) (6 avail). If you like dolls, you need to see these. $75 ea. 704-633-7425 Furnace - Used Natural Gas Wall Furnace, heats up to 1,000 sq ft. good condition $125 Rockwell 704-202-5022 Gas Grill. Olympian 4100 Portable. New & unused. Cast aluminum housing & stainless steel burner. $35. 704-638-6470. Homedics bubbling foot massager w/heat. New in box. Only $8.00 Please Call 704-245-8032 METAL: Angle, Channel, Pipe, Sheet & Plate Shear Fabrication & Welding FAB DESIGNS 2231 Old Wilkesboro Rd Open Mon-Fri 7-3:30 704-636-2349 Playground. Jungle Adventure wooden playground. Swings, slide, monkey bars, climbing wall. $350. Good condition. Laura 704-637-1248 Refrigerator, HotPoint, side-by-side. $150. Overstuffed couch & chair, $75. Wooden table & 4 chairs, $75. Please call 704-213-3667 Show off your stuff! With our Send us a photo and description we'll advertise it in the paper for 15 days, and online for 30 days for only 30*! $ Call today about our Private Party Special! 704-797-4220 *some restrictions apply Timber wanted - Pine or hardwood. 5 acres or more select or clear cut. Shaver Wood Products, Inc. Call 704-278-9291. Watches – and scrap gold jewelry. 704-636-9277 or cell 704-239-9298 Bank Foreclosures & Distress Sales. These homes need work! For a FREE list: 1409 South Martin Luther King Jr Ave., 2 BR, 1 BA, fixer upper. Owner financing or cash discount. $750 Down $411/month. 1-803-403-9555 Alexander Place China Grove, 2 new homes under construction ... buy now and pick your own colors. Priced at only $114,900 and comes with a stove and dishwasher. B&R Realty 704-633-2394 BUYER BEWARE The Salisbury Post Classified Advertising staff monitors all ad submissions for honesty and integrity. However, some fraudulent ads are not detectable. Please protect yourself by checking the validity of any offer before you invest money in a business opportunity, job offer or purchase. Bring All Offers 3 BR, 2 BA, newer kitchen, large dining room, split bedrooms, nice porches, huge detached garage, concrete drives. R51548 $89,500. Monica Poole 704-245-4628 B&R Realty East Rowan New Listing Beautiful 3 BR, 2 BA in a great location, walk-in closets, cathedral ceiling, great room, double attached garage, large lot, back-up generator. A must see. R51757. $249,900. B&R Realty, 704-202-6041 Fulton Heights Reduced Brand new & ready for you, this home offers 3BR, 2BA, hardwoods, ceramic, stainless appliances, deck. R51547. $99,900. Call Monica today! 704.245.4628 B&R Realty Motivated Seller 3 BR, 2 BA. Well cared for, kitchen with granite, eat at bar, dining area, large living room, mature trees, garden spot, 2 car plus storage garage bldgs. $149,500. Monica 704.245.4628 Poole B&R Realty Salisbury Motivated Seller Well 3 BR, 2 BA, established neighborhood. All brick home with large deck. Large 2 car garage. R50188 $163,900 B&R Realty 704.633.2394 Rockwell A Must See J.Y. Monk Real Estate School-Get licensed fast, Charlotte/Concord courses. $399 tuition fee. Free Brochure. 800-849-0932 3 BR, 2 BA in Hunters Pointe. Above ground pool, garage, huge area that could easily be finished upstairs. R51150A. $179,900. B&R Realty 704-633-2394 Rockwell REDUCED $500 Down moves you in. Call and ask me how? Please call (704) 225-8850 Salisbury. 2 or 3 bedroom Townhomes. For information, call Summit Developers, Inc. 704-797-0200 Government loans available. Call Now! 704-528-7960 Lake Property 3rd Creek Ch. Rd. 3BR, 2BA. DW. .71 acre. 1,700 sq. ft. FP, LR, den. $540 about. 704-489-1158 Fin. avail. Kannapolis. 608 J Avenue, 3BR/2BA. Totally remodeled, stainless steel appliances & granite. Rent to own! Owner will help obtain financing. $79,900. Call Scott for information. Lifetime opportunity! 704-880-0764 East Salisbury. 4BR, 2½BA. Lease option purchase.1,800 sq. ft. +/-. Call 704-638-0108 Salisbury Rent With Option! New Home Forest Creek. 3 BedNew room, 1.5 bath. home priced at only $98,900. R48764 B&R Realty 704.633.2394 Salisbury OPEN HOUSE Saturday 2-4 pm 322 Camelot Dr. Gorgeous remodeled 4 BR home in Country Club Hills. Large kitchen, granite counters, huge master suite, family room, wide deck, attached garage, and fenced back yard with great in-ground pool. 704202-0091 MLS#986835 3 BR, 2.5 BA, wonderful home on over 2 acres, horses allowed, partially fenced back yard, storage building. $164,900 R51465 B&R Realty 704.633.2394 Headline type North of China Grove, 225 Lois Lane. 3BR/2BA, Double garage and deck on a quiet dead end street. Country setting. No water bills. No city tax. Possible owner financing. Will work with slow credit. $950/mo + dep. Please call 704-857-8406 Homes for Sale Land for Sale ********************** Exit 86. 3.37 acres, almost completed 50' x100' bldg. $44K. 704-636-1477 Beautiful year round creek, 3.06 acres. Buy now, build later, $47,900 owner fin. 704-563-8216 Instruction Become a CNA Today! Fast & affordable instruction by local nurses. 704-2134514. Lost & Found Found dog. Ellis Park area. January 14. Gray. Call to identify. 704-2137270 Found dog. Male Collie, sable. Not neutered. Found on Ben Anderson Rd. Call 336-492-2528 Found in Fulton Heights area, white and brown female Jack Russell or Rat Terrier. Call 704-6370229 between 8am-5pm Found Medium sized female dog, mixed breed, possibly golden Reddish-light brown in color, blue collar Found near Long Ferry Road, Spencer. Very affectionate. Call Lab at 704639-7912 Found Part Siamese cat with blue eyes in the Irish Creek Country Club area. Call 704-932-7188 Salisbury Area 3 or 4 bedroom, 2 baths, $500 down under $700 per month. 704-225-8850 Single Section TradeIns needed. Top Dollar Paid. Please call 704-528-7960 Real Estate Services Allen Tate Realtors Daniel Almazan, Broker 704-202-0091 B & R REALTY 704-633-2394 Century 21 Towne & Country 474 Jake Alexander Blvd. (704)637-7721 1 Hr to/from Charlotte, NC near Cleveland &: Rowan Realty, Professional, Accountable, Personable . 704-633-1071 Lots for Sale William R. Kennedy Realty 428 E. Fisher Street 704-638-0673 Homes for Sale Sale or Lease Olde Fields Subdivision. ½ acre to over 2 acre lots available starting at $36,000. B&R Realty 704.633.2394 Real Estate Commercial Southwestern Rowan Co. Faith. 1145 Long Creek. 3 Beds, 2 Baths, 2 Bonus Rooms. Master on main, Hardwood and ceramic tile floors. Storage everywhere. $199,900 or lease for $1,300/mo. Kerry, Key Real Estate 704-8570539 or 704-433-7372. Directions: Faith Rd to L on Rainey. R into Shady Creek. Barnhardt Meadows. Quality home sites in setting, country restricted, pool and pool House complete. Use your builder or let us build for you. Lots start at $24,900. B&R Realty 704-633-2394 Western Rowan County Wanted: Real Estate. Reduced to sell! $389,000. Call for appt. 704-431-3267 or 704-213-4544 to show your stuff! The more you tell, the surer you’ll sell. Homes for Sale Homes for Sale Manufactured Home Dealers Dealers FOR SALE BY OWNER 36.6 ACRES AND HOME Apartments 1 & 2BR. Nice, well maintained, responsible landlord. $415-$435. Salisbury, in town. 704-642-1955 Free Stuff TV - Free Sony color rear video projector TV, not working, needs blue tube Model KPR-41DS2. 704633-3976 LM Harrison Rd. near Food Lion. 3BR, 2BA. 1 ac. 1,800 sq. ft., big BR, retreat, huge deck. $580/mo. Financing avail. 704-489-1158 25 Acres Beautiful Land for Sale by Owner Ads with a price ALWAYS generate more qualified calls 1st Time Home Buyer Homes of American Rockwell Oldest Dealer in Rowan County. Best prices anywhere. 704-279-7997 Land for Sale Salisbury Over 2 Acres Genesis Realty 704-933-5000 genesisrealtyco.com Foreclosure Experts High Rock waterfront, beautiful, gently sloping, wooded in Waters Edge subdivision. Approx. 275' deep, 100' waterline. Excellent HOA. For Sale By Owner. $248,000. Appraisal available. Call 704-609-5650 Homes for Sale Salisbury 3 BR, 2 BA, Attached carport, Rocking Chair front porch, nice yard. R50846 $119,900 Monica Poole 704.245.4628 B&R Realty China Grove. New carpet, Fresh Paint, replacement windows. Large rooms, 10'x16' Master walk in closet and bath. Double detached garage, double attached carport, plus 20'3x 12'6 detached wood outbuilding. Address is eligible for USDA loan $97,500 #51717 Jim 704-223-0459 Manufactured Home Sales Homes for Sale Salisbury Want to get results? Use Business Opportunities Homes for Sale Great Location All Coin Collections Silver, gold & copper. Will buy foreign & scrap gold. 704-636-8123 Bedroom Suite - Must sell, beautiful 3-piece bedroom suit. Double bed, chest of drawers, dresser w/mirror. $400 704-932-6769. Dining room suite, maple. Table, 6 chairs & hutch. $400 firm. Please call 704-857-0093 TYNER'S PIANO TUNING Tuning Repairing Regulating Humidity Control 15 years' experience. 704-467-1086 Homes for Sale Salisbury Want to Buy Merchandise BINGHAM-SMITH LUMBER CO. Save money on lumber. Treated and Untreated. Round Fence Post in all sizes. Save extra when buying full units. Call Patrick at 980-234-8093. Coffee Table & end tables, glass top. $75; Sofa & 2 chairs, $150; Bedroom $100; Metal suite, desk,$15. All in great shape. 704-279-9138 Homes for Sale E. Spencer Wood stove front double doors $175. pipe included Gold Hill 704-209-1233 or 704-707-9360 Air Conditioners, Washers, Dryers, Ranges, Frig. $65 & up. Used TV & Appliance Center Service after the sale. 704-279-6500 Homes for Sale Safe. Sentry combination safe. 16” deep x 14” wide. Have all paper work. Very heavy. $150. 704-857-0093 Pecans. Local this year's crop. Cracked pecans $2/lb. Pecans in the shell $1/lb. Call 704-857-1822 for more information Fuel & Wood SALISBURY POST CLASSIFIED 2 BR, 1 BA, hardwood floors, detached carport, handicap ramp. $99,900 R47208 B&R Realty 704.633.2394 Homes for Sale Salisbury - Newly remodeled 3 BR, 2 BA on large corner lot in Meadowbrook. New plumbing, water heater, roof & stainless steel appliances, heat pump, new kitchen w/granite tops & more. $3500 down + $599/mo. on approved credit. 704-239-1292 Salisbury Awesome Location Investment Property 1, 2, & 3 BR Huge Apartments, very nice. $375 & up. 704-754-1480 Modular Homes Display Sale! Inventory Discount. $15,000 off. Choose from 3 models $59,000 to $104,491. Call 704-463-1516 for Dan Fine. Select Homes, Inc. Investment Property 2 BR, 1 BA, close to Salisbury High. Rent $425, dep. $400. Call Rowan Properties 704-633-0446 Manufactured Home Sales A Country Paradise 2BR brick duplex with carport, convenient to hospita. $450 per month. 704-637-1020 China Grove Salisbury Over 2 Acres 3 BR, 2.5 BA, wonderful home on over 2 acres, horses allowed, partially fenced back yard, storage building. $164,900 R51465 B&R Realty 704.633.2394 Child Care Facility/Commercial Bldg. Approximately 5500 sq. ft. Child care facility / commercial building with commercial kitchen on approximately 1.75 acres. Daycare supplies included. Playground measures 10,000 sq. ft. Call 704-855-9768 15 minutes N. of Salisbury. 2001 model singlewide 3 BR/2 bath on large treed lot in quiet area. $850 start-up, $475/mo includes lot rent, home payment, taxes, insurance. RENT or RENT-TO-OWN. 704210-8176. Call after 1pm 2BR, 1BA Duplex Central heat/air, appliances, laundry room, yardwork incl. Fenced backyard, storage building. $600/mo. plus $600 deposit 704-633-2219 3BR, 2BA. Wonderful location, new hardwoods in master BR and living room. Lovely kitchen with new stainless appliances. Deck, private back yard. R51492 $124,900 Monica Poole B&R Realty 704-245-4628 Salisbury Convenient Location Lost Small Female Calico Cat Henderson St. Near N. Caldwell St. 704-637-9351 Monument & Cemetery Lots Rowan Memorial Park in the Veteran Field of Honor Section, two spaces. $1,000 ea. 336-284-2656 Very nice 2 BR 2.5 BA condo overlooking golf course and pool! Great views, freshly decorated, screened in porch at rear. T51378. $98,500 Monica Poole B&R Realty 704-245-4628 Need extra cash? Check out our JOBS section and you will be on your way to making money. 131 West Innest Street • 704-797-4220 SALISBURY POST Apartments Apartments AAA+ Apartments $425-$950/mo. Chambers Realty 704-637-1020 East Schools. Efficiency & 3BR. Refrigerator and stove. Central air and heat. Please call 704-638-0108. Airport Rd. area. 118-A Overbrook Rd. 2 story apt. $535/mo. Very nice. Daytime 704-637-0775 North Rowan. 1-2BR apt with all appliances. Central heat & air. $450/mo. + dep. 704-603-4199 Lv. msg. Airport Rd. Duplex. 2BR, 2BA. $575/mo. 2BR, 1BA $550/mo., lease + dep., water furnished. No pets. Call 704-637-0370 Salis. Nice modern 1BR, energy efficient, water furnished, off Jake Alexander $395 + dep. 704-640-5750 Airport Rd., 1BR with stove, refrig., garbage pickup & water incl. Month-month lease. No pets. $400/mo+$300 deposit. Furnished $425/mo. 704-279-3808, 2BA. All electric. Clean & safe. No pets. $575/month + deposit. 704-202-0605 CLANCY HILLS APARTMENTS 1, 2 & 3 BR, conveniently located in Salisbury. Handicap accessible units available. Section 8 assistance available. 704-6366408. Office Hours: M–F 9:00-12:00. TDD Relay Equal 1-800-735-2962 Housing Opportunity. Clancy-hills@cmc-nc.com Clean, well maintained, 2 BR Duplex. Central heat/air, all electric. Section 8 welcome. 704-202-5790 Colonial Village Apts. “A Good Place to Live” 1, 2, & 3 Bedrooms Affordable & Spacious Water Included 704-636-8385 Condos and Townhomes Salisbury – 2 BR duplex in excellent cond., w/ appl. $560/mo. + dep. Ryburn Rentals 704-637-0601 Salisbury. Free Rent, Free Water, New All Elec. Heat/air, on bus route. $495. 704-239-0691 STONWYCK VILLIAGE IN GRANITE QUARRY Nice 2BR, energy efficient apt., stove, refrigerator, dishwasher, water & sewer furnished, central heat/ac, vaulted ceiling, washer/dryer connection. $495 West Rowan. 2BR duplex. All elec. Newly remodeled. W/D hookup & cable ready. Water, lawn maint. included. $450/mo rent; $400 dep. Sect. 8 OK. 704-278-2891. Condos and Townhomes Wiltshire Village Condo for Rent, $700. 2nd floor. Want a 2BR, 2BA in a quiet setting? Call Bryce, Wallace Realty 704-202-1319 Houses for Rent Fulton St. 3 BR, 1 ½ BA. Refrigerator, stove furnished. Rent $725, Dep., $700. Call Rowan Properties 704-633-0446 Houses: 3BRs, 1BA. Apartments: 2 & 3 BR's, 1BA Deposit required. Faith Realty 704-630-9650 Long Ferry Rd. 2BR, 1½BA. Newly renovated w/privacy fence. $650/mo + deposit. 704-202-1913 N. Church St. 2BR/1BA home. Stove & refrigerator, All electric. fireplace. $450/mo. 704-633-6035 Old Concord Rd., 3 BR, 1 BA, has refrigerator, stove & big yard. No $550/rent + pets. $500/dep. Call Rowan Properties 704-633-0446 Colony Garden Apartments 2BR and 1-1/2 BA Town Homes $575/mo. College Students Welcome! Near Salisbury VA Hospital 704-762-0795 Houses for Rent Apartments Duplex for Rent 2 to 5 BR. HUD Section 8. Nice homes, nice st areas. Call us 1 . 704-630-0695 3 BR, 1 BA, has refrigerator, stove & big yard. No pets. $625/rent + $600/dep. Call Rowan Properties 704-633-0 Faith, 2 BR, 1 BA duplex. Has refrigerator & stove. No pets. $450/rent + $400/dep. Call Rowan Properties 704-633-0446 Kannapolis - 1 BR. $430 per month + $400 deposit. References required. 704-933-3330 or 704-939-6915 Lovely Duplex Rowan Hospital area. 2BR, 1BA. Heat, air, water, appl. incl. $675. 704-633-3997 4 BEDROOMS BONUS ROOM Brand new home in Faith. Kitchen appliances included. Fireplace, 2-car garage. One year lease @ $1,300 a month, plus deposit. Pets possible. Call 704-642-1362. Available for rent – Homes and Apartments Salisbury/Rockwell Eddie Hampton 704-640-7575 China Grove - 440 Sylvan, 3 BR, 2 BA. $725 mo.; Kann, 1902 Mission Oaks, 3 BR, 2.5 BA, $850 mo. KREA 704-933-2231 China Grove. 158 3rd Ave. 3BR, 2BA. Gas heat/AC. No pets. $650/mo. & $650 deposit. 704-857-3347 China Grove. 2-3BR / 1BA, nice & cozy, easy I-85 access, $600/mo + dep. 704-857-7699 Don't Pay Rent! 3BR, 2BA home at Crescent Heights. Call 704-239-3690 for info. E. Rowan, 3BR/2BA, deck, all electric, no pets. $750/mo + $750 dep. Sect. 8 OK. Credit check. 704-293-0168. Faith/Carson district. 3BR / 2BA, no smoking, no pets. $650/mo + dep + refs. 704-279-8428 Body Shop Salisbury 2BR. $525 and up. GOODMAN RENTALS 704-633-4802 Rooms for Rent China Grove. 1200 sq ft. $800/mo + deposit. Call 704-855-2100 Salis./China Grove area, whole house use included. $100/wk + dep. Utilities pd. Call Marty 704-496-1050. Ford Focus SES Sedan, 2006. Liquid gray clearcoat metallic exterior w/dark flint interior. Stock #F10444A. $8,259. 1-800-542-9758 Furnished Key Man Office Suites - $250-350. Jake & 150. Util & internet incl. 704-721-6831 Office Building with 3 office suites; small office in office complex avail.; 5,000 sq.ft. warehouse w/loading docks & small office. Call Bradshaw Real Estate 704-633-9011 Autos NOTICE TO CREDITORS All persons and entities having claims against the Estate of Barry Victor Shive, deceased, of Rowan County, North Carolina (File#10E1251), are hereby notified to present them to Starr R. Shive, 125 Richmond Road, Salisbury, North Carolina 28144, Executor of the decedent's estate, on or before 13th day of April, 2011, or this notice will be pleaded in bar of their recovery. All persons and entities indebted to said estate are notified to make immediate payment to the above named Executor. This the 6th day of January, 2011. F. Rivers Lawther, Jr., Attorney at Law, 225 N. Main Street, Ste. 200, Salisbury, NC 28144 Ford Focus ZX3 Base 2004. Silver Metallic w/gray interior, est. 33 mpg, automatic transmission. 704-603-4255 NOTICE TO CREDITORS Having qualified as Executor for the Estate of Tom Walter Baker, 7311 Mooresville Rd., Salisbury, NC 28147.. Sherri Goodman, Executor of the estate of Tom Walter Baker, File #11E18, 7295 Mooresville Rd., Salisbury, NC 28147 No. 60983 BMW, 2005 325i Midnight Black on tan leather 2.5 V6 auto trans, am, fm, cd, sunroof, dual seat warmers, all power, duel power seats, RUNS & DRIVES NICELY!! 704-603-4255 OFFICE SPACE Prime Location, 1800+ sq.ft. (will consider subdividing) 5 private offices, built in reception desk. Large open space with dividers, 2 bathrooms and breakroom. Ample parking 464 Jake Alexander Blvd. 704 223 2803 No. 60936 No. 60937 Salisbury 3 BR, 2 BA, West Schools. Quiet, private location in nice subdivision. 3 miles to mall. Central heat/air, appliances, dishwasher, wired storage building, concrete drive. $800 plus deposit. 704-279-0476 Autos Cleveland. To share country home, totally furnished & untilities included. $450/mo. 704-278-1982 MILLER HOTEL Rooms for Rent Weekly $110 & up 704-855-2100 Numerous Commercial and office rentals to suit your needs. Ranging from 500 to 5,000 sq. ft. Call Victor Wallace at Wallace Realty, 704-636-2021 Salis., 3BR/1BA Duplex. Elec., appls, hookups. By Headstart. $500 & ½ MO FREE! No pets. 704-636-3307 Roommate Wanted Concord area, across from hospital. Body shop/detail shop. Great location. Frame rack, paint booth, turn key ready. 704-622-0889 Sali. 4 BR, 1½ BA $800 all elec., brick, E. Spen. Apt. 2 BR, 1 BA, $425. Carolina-Piedmont Properties 704-248-2520 NOTICE TO CREDITORS Having qualified as Executor for the Estate of Rebecca N. Simerson, 710 Julian Rd., Salisbury, NC 28147. This is to notify all persons, firms and corporations having claims against the said decedent to exhibit them to the undersigned on or before the 28th day of April, 2011, or this notice will be pleaded in bar of their recovery. All persons, firms and corporations indebted to said estate are notified to make immediate payment. This the 21st day of January, 2011. Danny K. Simerson, Executor of the estate of Rebecca N. Simerson, File #11E62, 2951 Old Mocksville Rd., Salisbury, NC 28144 Ford Mustang, 2000. Atlantic blue metallic exterior with gray cloth interior. 5 speed, 1 owner, extra clean. Call Steve at 704-603-4255 GREAT GAS MILEAGE!! Buick LaCrosse CXS Sedan, 2005. Black onyx exterior w/gray interior. Stock #F11096A. $10,959. 1-800-542-9758 Salisbury Office Space No. 60984 NOTICE TO CREDITORS Having qualified as Executor for the Estate of Frank Reid Wright, 2875 Cannon Farm Rd., China Grove, NC 28023. 21st day of January, 2011. Frank Reid Wright, deceased, Rowan County File #2011E70, David C. Wright, P.O. Box 265, Landis, NC 28088 No. 60985 Ford, Focus SE 2000. Hunter green. Four door. Very clean. New tires, new CD player. Automatic. $5,000. Call 704-798-4375 NOTICE TO CREDITORS Having qualified as Administrator for the Estate of Charles Edward Peeler, 1375 Peeler Rd., Salisbury, NC 28146. 20th day of January, 2011. Mary W. Peeler, Administrator of the estate of Charles Edward Peeler, File #11E34, 1375 Peeler Rd., Salisbury, NC 28146 No. 60986 Salisbury 3BR/1BA, newly renovated interior, new appliances, all washer/dryer connection, new carpet, new and efficient heating & air. Nice and cozy living arrangement. Section 8 considered. $600/mo + deposit. 704-213-0991 Salisbury City, Near Rowan Regional Medical Center. 4BR /2½BA, 2 car garage, fenced-in yard, many ugrades. $1,400 per month, $1,000 deposit, one year minimum. Credit check & references required. 704-232-0823 Salisbury city. 3BR, 1BA. New central air & heat. Total electric. $550/ mo. + dep. 704-640-5750 Salisbury Great Convenient Location! We have office suites available in the Executive Center. First Month Free with No Deposit! With all utilities from $150 and up. Lots of amenities. Call Karen Rufty at B & R Realty 704-202-6041 Camaro SS, 1999 with white leather interior, V8, six speed, AM/FM/CD, MP3, DVD player w/JL subwoofer, T-tops, ridiculously low miles, chrome rims, EXTRA CLEAN! 704-603-4255 Salisbury. 12,000 sq ft corner building at Jake Alexander and Industrial Blvd. Ideal for retail office space, church, etc. Heat and air. Please call 704279-8377 with inquiries. Salisbury. Six individual new central offices, Spencer Shops Lease great retail space for as little as $750/mo for 2,000 sq ft at. 704-431-8636 Warehouse space / manufacturing as low as $1.25/sq. ft./yr. Deposit. Call 704-431-8636 Chevrolet Aveo LS Sedan, 2008. Summer yellow exterior w/neutral interior. Stock #F11069A. $9,959. 1-800-542-9758 303-B W. Council St. Impressive entry foyer w/mahoghany staircase. Downstairs: L/R, country kit. w/FP. Laundry room, ½BA. Upstairs: 2BR, jacuzzi BA. Uniquely historic, but modern. 704-691-4459 Salisbury, 1314 Lincolnton Rd., 2 BR, 1 BA brick house. Hardwood floors throughout, close to Jake Alexander Blvd. Wallace Realty 704-636-2021 Salisbury, 3 BR, 1 BA, central heat/air, garage & carport. $650/mo. + $650 dep. 704-637-7605 or 704-636-0594 Salisbury, in country. 3BR, 2BA. With in-law apartment. $1000/mo. No pets. Deposit & ref. 704855-2100 Salisbury. 3 & 2 Bedroom Houses. $500-$1,000. Also, Duplex Apartments. 704636-6100 or 704-633-8263 Between Salis. & China Grove. 2BR. No pets. Appl. & trash pickup incl. $475/ mo + dep. 704-855-7720 Camp Rd, 2BR, 1BA. Appls, water, sewer, trash incl. Pet OK. $475/mo. + $475 dep. 704-279-7463 East area. Completely remodeled 1BR. Perfect for one or two people. Trash & lawn service. $360/mo. + deposit. 704-640-2667 Spencer. 3BR. Appliances. Well water. $550/ mo. + $500 dep. 704630-0785 / 704-433-3510 Rockwell. 2BR, 2BA. Appl., water, sewer, trash service incl. $500/mo. + dep. Pets OK. 704-279-7463 Spencer. 3BRs & 2BAs. Remodeled. Great area! Owner financing available. 704-202-2696 Rockwell. Nice 2BR from $460/mo + dep, incls water, sewer, & trash pick up. No pets. 704-640-6347 Whisnant Dr. 3BR, 1½BA. $600/month + deposit. Please call 704637-0621 for more info. Salis 3990 Statesville Blvd., Lot 12, 3BR/2BA, $439/mo. + dep. FOR SALE OR RENT! 704-640-3222 1st Month Free Rent! Salisbury, Kent Executive Park office suites, $100 & up. Utilities paid. Conference room, internet access, break room, ample parking. 704-202-5879 Salisbury, 2 BR, 2 BA, Pets OK $440 + $400 dep. incl. water, sewer, trash. 3 people max 704433-1626 Jaguar S-Type, 2005. w/black leather Black interior, 6 sp. auto trans, 4.2L V8 engine, AM/FM/CD Changer, Premium Sound. Call Steve today! 704-6034255 Woodleaf. 2BR, 1BA. Private dirt road. Private lot. Water, sewer incl. Pets OK. 704-642-2235 No. 60987 Chevrolet Malibu LT Sedan, 2008. Imperial Blue Metallic exterior w/titanium interior. Stock #P7562B. $12,359. 1-800-542-9758 NOTICE OF FORECLOSURE SALE Default having been made in the payment of the note thereby secured by the said Deed of Trust and the undersigned, Trustee Services of Carolina, LL, 2011 at 10:00AM, and will sell to the highest bidder for cash the following described property situated in Rowan County, North Carolina, to wit: BEING all of Lot No. 4, Section 1, as recorded upon the map of CRESTVIEW , prepared by Hudson and Almond, dated August 1970, recorded in Book of Maps at page 1161 in the Office of the Register of Deeds for Rowan County, North Carolina. Mercedes S320, 1999 Black on Grey leather interior, 3.2, V6, auto trans, LOADED, all power ops, low miles, SUNROOF, chrome rims good tires, extra clean MUST SEE! 704-6034255 Dodge Neon SXT, 2005. Automatic, power package, excellent gas saver. Call Steve at 704-603-4255 Financing Available! Ford Focus SE Sedan, 2009. Stock #P7597. Brilliant silver exterior with medium stone interior. $10,559. 1-800-542-9758 No. 60951 Under and by virtue of a Power of Sale contained in that certain Deed of Trust executed by Rufino Carbajal and Gladis Lopez Marin to Investors Title Insurance Company, Trustee(s), which was dated May 16, 2006 and recorded on May 17, 2006 in Book 1065 at Page 812 and rerecorded/modified/corrected on July 9, 2010 in Book 1164, Page 431, Rowan County Registry, North Carolina. Kia Spectra EX Sedan, 2009. Champagne gold exterior w/beige interior. Stock #P7568. $9,359. 1-800-542-9758 HONDA, 2003, ACCORD EX. $500-800 down, will help finance. Credit, No Problem! Private party sale. Call 704-838-1538 By: Rowan County Purchasing Agent, Rowan County Finance Department NORTH CAROLINA, ROWAN COUNTY - 10 SP 965 Chevrolet Malibu LS Sedan, 2005. White exterior w/neutral interior. Stock #F11109A. $8,459. 1-800-542-9758. Nissan Maxima 3.5 SE, 2005. Automatic, moonroof, power options. Excellent condition. Call Steve at 704-603-4255 Salisbury. 2BR, 2BA. Kitchen appliances. NO pets. $100 deposit. Please call 704-213-9703 West & South Rowan. 2 & 3 BR. No pets. Perfect for 3. Water included. Please call 704-857-6951 NOTICE TO CREDITORS Having qualified as Administrator of the Estate of Gerhard H. Laube, 209 South Deerfield Circle, Salisbury, NC 28144, this is to notify all persons, firms and corporations having claims against the said decedent to exhibit them to the undersigned on or before the 14th day of April, 2011, or this Notice will be pleaded in bar of their recovery. All persons, firms and corporations indebted to said estate are notified to make immediate payment. This the 7th day of January, 2011. Lizanne Trimble, Admn. For the estate of Gerhard H. Laube, deceased, File 11E24, 2130 Jarvis Lane, Calabash, NC 28467 Attorney at Law: J. Andrew Porter, 120 N. Jackson St., Salisbury, NC 28144 The Rowan County Board of Commissioners will consider a waiver of competitive bidding under G.S. 143-129(g) at its regular meeting on February 7, 2011 for the purchase of two 2011 Type III Chevrolet G4500 ambulances for the Rowan County Emergency Services Department from Taylor Made Ambulances, the seller having agreed to extend to Rowan County the same or more favorable price and terms set forth in its contract with Cleveland County effective April 1, 2010. Kia Amante 2005. Leather, sunroof, heated seats, extra clean. Must See!! Call Steve at 704-603-4255 Ellis Park. 3BR/2BA. Appls., water, sewer, incl'd. $525/mo. + $525 deposit. Pet OK. 704-279-7463 Faith. 2BR, 1BA. Water, trash, lawn maint. incl. No pets. Ref. $425. 704-2794282 or 704-202-3876 NOTICE TO CREDITORS Having qualified as Co-Executors of the Estate of Nancy Frazier Erb, deceased, this is to notify all persons, firms and corporations having claims against the said decedent to exhibit them to the undersigned on or before the 21st day of April, 2011, or this notice will be pleaded in bar of their recovery. All persons, firms and corporations indebted to said estate are notified to make immediate payment. This 7th day of January, 2011. Michael Schribner Erb, Donald Frazier Erb and Christopher Shepherd Erb, Co-Executors, Estate of Nancy Frazier Erb, 150 Larkscroft Drive, Salisbury, NC 28146. File 2011-E-8, Shuford Caddell & Fraley, LLP, PO Box 198, Salisbury, NC 28145-0198. This is the 24th day of January, 2011. East Rowan. 2BR. trash and lawn service included. No pets. $450 month. 704-433-1255 Salisbury. 3BR, 2BA. $800/mo. + $800 deposit. Please call 704-202-4281 or 704-279-5765 No. 60938 No. 60939 Chevrolet Aveo LT Sedan, 2009. Stock # P7600. Cosmic Silver exterior w/charcoal interior. $9,859. 1-800-542-9758. Hyundai Accent GLS Sedan, 2009. Stock # P7572. Nordic white exterior with gray interior. $10,559. 1-800-542-9758 NOTICE TO CREDITORS Having qualified as Administrator for the Estate of Norma Wetmore Goodson, 9050 Stadium Street, Woodleaf, NC 27054. This is to notify all persons, firms and corporations having claims against the said decedent to exhibit them to the undersigned on or before the 26th day of April, 2011, or this notice will be pleaded in bar of their recovery. All persons, firms and corporations indebted to said estate are notified to make immediate payment. This the 19th day of January, 2011. Norma Wetmore Goodson, deceased, Rowan County File #2010E1153, John W. Goodson, 9050 Stadium Street, Woodleaf, NC 27054 WAIVER OF COMPETITIVE BIDDING Manufactured Home for Rent Office and Commercial Rental High Rock Lake home! 3 BR, 2½BA. Open concept living to enjoy beautiful lake views. Private master suite. Plus addt'l living space in basement. Large deck and dockable pier. 1 year lease. $1300/month. Convenient to I-85. Call 336-798-6157 450 to 1,000 sq. ft. of Warehouse Space off Jake Alexander Blvd. Call 704279-8377 or 704-279-6882 Rockwell – 3 BR, 2 BA with appliances. $775/mo. + Dep. Ryburn Rentals 704-637-0601 3 Homes. 2-East district, 1Carson district. 3 BR, 2 BA. $800-$1050. Lease, dep. & ref. req. 704.798.7233 407 S. Carolina Ave. 1 BR, 1 BA, very spacious, washer & dryer hookup, gas heat, water included. 704-340-8032 Office and Commercial Rental Granite Quarry - Start the New Year Right! Only two units left! Move in by 1/31/11 and pay no rent until 4/1/11. Comm. Metal Bldg. perfect for hobbyist or contractor. Call for details 704-232-3333 Salisbury 4BR/2BA, brick ranch, basement, 2,000 SF, garage, nice area. $1,195/mo. 704-630-0695 China Grove. One room eff. w/ private bathroom & kitchenette. All utilities incl'd. $379/mo. + $100 deposit. 704-857-8112 MONDAY, JANUARY 24, 2011 • 7B CLASSIFIED Saturn Aura XR, 2008, Silver with Grey cloth interior 3.6 V6 auto trans, all power opts, onstar, am,fm,cd, rear audio, steering wheel controls, duel power and heated seats, nonsmoker LIKE NEW!!!! 704-603-4255 This property is subject to restrictions as fully set forth in Deed Book 544 at page 993, and Deed Book 542 at page 927, Rowan County Registry. This property is also subject to Duke Power Company right-of-way as recorded in Deed Book 293, at page 101, Rowan County Registry. Save and except any releases, deeds of release or prior conveyances of record. Said property is commonly known as 111 East Chamblee Drive, Salisbury, NC 28147. Rufino Carbaj, Trustee Services of Carolina, LLC By: Jeremy B. Wilkins, NCSB No. 32346 Brock & Scott, PLLC, Attorneys for Trustee Services of Carolina, LLC 5431 Oleander Drive Suite 200, Wilmington, NC 28403 PHONE: (910) 392-4988, FAX: (910) 392-8587, File No.: 09-26357-FC02 8B • MONDAY, JANUARY 24, 2011 Cleaning Services Fencing Cleaning Services Auctions Auction Thursday 12pm 429 N. Lee St. Salisbury Antiques, Collectibles, Used Furniture 704-213-4101 Reliable Fence All Your Fencing Needs, Reasonable Rates, 21 years experience. (704)640-0223 Carolina's Auction Rod Poole, NCAL#2446 Salisbury (704)633-7369 Heritage Auction Co. Glenn M.Hester NC#4453 Salisbury (704)636-9277 Financial Services “We can remove bankruptcies, judgments, liens, and bad loans from your credit file forever!” Job Seeker meeting at 112 E. Main St., Rockwell. 6:30pm Mons. Rachel Corl, Auctioneer. 704-279-3596 KEN WEDDINGTON Total Auctioneering Services 140 Eastside Dr., China Grove 704-8577458 License 392 H H FREE ESTIMATES Licensed, bonded and insured. Since 1985. Call the Post to Sell the Most! 704-797-4220 Carpet and Flooring Carport and Garages “Allbrite Carpet Cleaning” Eric Fincher. Reasonable rate. 20+ years experience. 704-720-0897 Lippard Garage Doors Installations, repairs, electric openers. 704636-7603 / 704-798-7603 A message from the Salisbury Post and the FTC. Grading & Hauling JSJ Computer Services. We repair, buy, sell, upgrade & build computers. Virus, malware, adware removal. On site. Home or Office. 704-469-9128 Beaver Grading Quality work, reasonable rates. Free Estimates 704-6364592 OLYMPIC DRYWALL New Homes Additions & Repairs Small Commercial 704-279-2600 Since 1955 olympicdrywall@aol.com olympicdrywallcompany.com Around the House Repairs Carpentry. Electrical. Plumbing. H & H Construction 704-633-2219 Home Improvement Junk Removal Miscellaneous Services CASH PAID BSMR Sewing for junk cars. $200 & up. Please call Tim at 980234-6649 for more info. Kitchens, Baths, Sunrooms, Remodel, Additions, Wood & Composite Decks, Garages, Vinyl Rails, Windows, Siding. & Roofing. ~ 704-633-5033 ~ WILL BUY OLD CARS With keys, title or proof of ownership, $200 and up. (Salisbury area only) R.C.'s Garage & Salvage 704-636-8130 704-267-4163 Professional Services Unlimited Quality work at affordable prices NC G.C. #17608 NC Home Inspector #107. Complete contracting services, under home repairs, foundation & masonry repairs, light tractor work & property maintenence. Pier, dock & sea wall repair. 36 Yrs Exp. 704-633-3584 Duke C. Brown Sr. Owner Brisson - HandyMan Home Repair, Carpentry, Plumbing, Electrical, etc. Insured. 704-798-8199 Lawn Equipment Repair Services Lyerly's ATV & Mower Repair Free estimates. All types of repairs Pickup/delivery avail. 704-642-2787 Junk Removal Lawn Maint. & Landscaping $ $ $ $ $ $ $ $ $ $ We Buy Any Type of Scrap Metal At the Best Prices... Browning ConstructionStructural repair, flooring installations, additions, decks, garages. 704-637-1578 LGC Earl's Lawn Care Don t take chances with your hard earned money. Run your ad where it will pay for itself. Daily exposure brings fast results. Household sewing machines, new and older models and parts. ALL home repairs. 704857-2282. Please call! I need the work. Roofing, siding, decks, windows. 704-797-6840 704-797-6839 Moving and Storage TH Jones Mini-Max Storage 116 Balfour Street Granite Quarry Please 704-279-3808 SEAMLESS GUTTER Licensed Contractor C.M. Walton Construction, 704-202-8181 Painting and Decorating Bowen Painting Interior and Exterior Painting 704-630-6976. Guttering, leaf guard, metal & shingle roofs. Ask about tax credits. BowenPainting@yahoo.com Cathy's Painting Service Interior & exterior, new & repaints. 704-279-5335 ~ 704-633-5033 ~ Tree Service 3Landscaping 3Mulching F HMC Handyman Services. Any job around the house. Please call 704-239-4883 3Core Aeration 3Fertilizing We will come to you! F David, 704-314-7846 Buying Vehicles, Junk or Not, with or without titles. Any/ All. 704-239-6356 Hometown Lawn Care & Handyman Service. Mowing, pressure washing, gutter cleaning, odd jobs ~inside & out. Comm, res. Insured. Free estimates. “No job too small” 704-433-7514 Larry Sheets, owner FREE Estimates A-1 Tree Service 704-636-3415 704-640-3842 3Established since 1978 3Reliable & Reasonable 3Insured Free Estimates! ~ 704-202-8881~ GAYLOR'S LAWNCARE For ALL your lawn care needs! *FREE ESTIMATES* 704-639-9925/ 704-640-0542 Recognized by the Salisbury Tree Board Graham's Tree Service Free estimates, reasonable rates. Licensed, Insured, Bonded. 704-633-9304 Outdoors By Overcash Mowing, shrub trimming & leaf blowing. 704-630-0120 Lawn Maint. & Landscaping The Floor Doctor Complete crawlspace work, Wood floor leveling, jacks installed, rotten wood replaced due to water or termites, brick/block/tile work, foundations, etc. 704-933-3494 Machine Repair Roofing and Guttering 3Mowing 3Yard Cleanup 3Trimming Bushes Guaranteed! Garages, new homes, remodeling, roofing, siding, back hoe, loader 704-6369569 Maddry Const Lic G.C. Heating and Air Conditioning Piedmont AC & Heating Electrical Services Lowest prices in town!! 704-213-4022 Drywall Services Cleaning Services WOW! Clean Again! New Year's Special Lowest Prices in Town, Senior Citizens Discount, Residential/Commercial References available upon request. For more info. call 704-762-1402. Computer Services We Build Garages, 24x24 = $12,500. All sizes built! ~ 704-633-5033 ~ Carport and Garages Perry's Overhead Doors Sales, Service & Installation, Residential / Commercial. Wesley Perry 704-279-7325 H 704-633-9295 Rowan Auction Co. Professional Auction Services: Salis., NC 704-633-0809 Kip Jennings NCAL 6340. H H R. Giles Moss Auction & Real Estate-NCAL #2036. Full Service Auction Company. Estates ** Real Estate Had your home listed a long time? Try selling at auction. 704-782-5625 SALISBURY POST CLASSIFIED • Stoner Painting Contractor John Sigmon Stump grinding, Prompt service for 30+ years, Free Estimates. John Sigmon, 704-279-5763. • 25 years exp. • Int./Ext. painting • Pressure washing • Staining • References • Insured 704-239-7553 Junk Removal Manufactured Home Services Pools and Supplies CASH FOR JUNK CARS And batteries. Call 704-279-7480 or 704-798-2930 Mobile Home Supplies~ City Consignment Company New & Used Furniture. Please Call 704636-2004 Bost Pools – Call me about your swimming pool. Installation, service, liner & replacement. (704) 637-1617 WORKS by TREE Jonathan Keener. Insured – Free estimates! Please call 704-636-0954. MONDAY, JANUARY 24, 2011 FOR FREE BIRTHDAY GREETINGS Please Fax, hand deliver or fill out form online 18 WORDS MAX. Number of free greetings per person may be limited, combined or excluded, contingent on space available. Please limit your birthday greetings to 4 per Birthday. Happy Birthday Ethan F. Love you, The Drew Gang Happy Birthday Judy S. Have a wonderful day. Your Southern City Meal Site Friends Happy 7th Birthday Jarrell. Love you, Nana & PawPaw Happy Birthday to Jarell. Aunt Jack Jack Happy Birthday to our 7 year old, Jarrell (Cool J.). Love you, Mom and Dad Happy Birthday to Uncle Jarrell. Davis HAM SALAD SANDWICH 4.99 W/CHIPS & DRINK $ Must present ad. Salisbury location only. Not valid w/any other offer. Exp. 2/14/11 Hours of daily personal attention and doggie fun at our safe 20 acre facility. Professional homestyle boarding, training, and play days with a certified handler/trainer who loves dogs as much as you do. 704-797-4220 Hours: Mon-Fri: 10-7; Sat 10-6; Sun 11-2 1 POUND OF HAM SALAD REGULARLY $8.99 $ 5.99 S45263 THE HONEYBAKED HAM CO. & CAFE 413 E. Innes Street of Salisbury 704-633-1110 • Fax 704-633-1510 (under Website Forms, bottom right column) birthday@salisburypost.com Happy Birthday "Bubba" Ethan F. Your hunting bud, T.J. EXIT 76 WEST OFF HWY 85! HAPPY BIRTHDAY! A 2”x3” greeting with photo is only $20, and includes 4 copies of the Post Happy 7th Birthday to Brother. Brother S48856 Tell Someone MawMaws Kozy Kitchen SATURDAY 11-4 ....BUY 1 FOOTLONG GET 1 FREE 2 Hot Dogs, Fries & Drink ..............$4.99 Every Night Kids Under 12 eat for 99¢ with 2 paying Adults HOT DOG SPECIAL 5/$5.00 If so, then make ad space work for you! Thurs-Fri CHICKEN & DUMPLINGS 6.25 $ 5550 Hwy 601 • Salisbury, NC 28147 • 704-647-9807 HOURS: Mon, Tues, Thurs, Fri, Sat: 11AM-8PM Wednesday 11AM-3PM • Closed on Sundays Call Classifieds at 704-797-4220 for more information!!! Birthday? ... We want to be your flower shop! Salisbury Flower Shop 1628 West Innes St. Salisbury, NC • 704-633-5310 S48510 Ready to Take the Real Estate Plunge? Find your answer in the Salisbury Post Classifieds – in print and online! Go to salisburypost.com/classifieds or call 704-797-4220 ARE YOU IN THE CELEBRATING BUSINESS? HOMES FOR SA LE STARTER HOM E. 2-bedroom ranch. Great lo cation. Just reduced. Call Wendy 555-32 10. S40137 SALISBURY POST Autos Autos Nissan 300ZX, 1990. Red. All original equipment. Please call for details. 704-664-0321 Buick Skylark 1991, automatic, clean, V-6, well equipped, only 71K miles. $2,000. 704-636-4905 Dealer 17302 Saturn ION 2 Sedan, 2006. Stock # F10530A. Cypress Green exterior with tan interior. $6,959 Call Now 1-800-542-9758. MONDAY, JANUARY 24, 2011 • 9B CLASSIFIED Volvo S80, 2000, automatic, leather interior, heated seats, sunroof, CCD. Must see! Call Steve 704-603-4255 Service & Parts EZGO Authorized Trucks, SUVs & Vans Trucks, SUVs & Vans Chevy Suburban 2006 Dark Blue metallic w/tan leather interior, 4 speed auto trans, am, fm, cd premium sound. Third row seating, navigation, sunroof, DVD. 704-603-4255 Ford Explorer XLT SUV, 2007. Red fire metallic clearcoat exterior w/black/stone interior. Stock# F10127A. $17,459. 1-800-542-9758 Ford Expedition Eddie Bauer SUV, 2006. Black clearcoat exterior w/medium parchment interior. Stock #F11093A. $17,759. 1-800-542-9758 Ford F-150 XL Extended Cab, 2003. Oxford white clearcoat exterior w/ medium graphite interior. Stock #F10512A 1-800-542-9758 Ford Explorer Sport Trac XLT SUV, 2007. Red fire clearcoat exterior w/camel interior. #F10543A. Stock $19,959. 1-800-542-9758 Ford F-150 XLT Crew Cab, 2010. Sterling gray metallic exterior w/medium stone/ interior. Stock stone #P7604. $25,359. 1-800542-9758 Ford Explorer XLT SUV, 2004. Black clearcoat exterior w/midnight gray exterior. Stock #F10521B. $11,459. 1-800-542-9758 Ford F-250 Super Duty Lariat 4 Door Crew Cab, 2006. Dark shadow gray clearcoat exterior w/medium flint interior. Stock #F10422A. $18,959. 1-800-542-9758 Ford Ranger Extended Cab XLT, 2004. Oxford White with gray cloth. 5 speed auto. trans. w/OD 704-603-4255 Trucks, SUVs & Vans Trucks, SUVs & Vans Trucks, SUVs & Vans Jeep Grand Cherokee Laredo SUV, 2010. Brilliant black crystal pearlcoat exterior w/dark slate gray interior. Stock # F10541A1. $25,559. 1-800-542-9758 Toyota 4Runner SR5 SUV, 2008. Salsa red pearl exterior w/stone interior. Stock #T11212A. $26,359. 1-800-542-9758 Toyota RAV4 Base SUV, Classic silver 2007. metallic exterior w/ash interior. Stock #T11153A. $16,259. 1-800-542-9758 BATTERY-R-US BIG TRUCK BATTERIES 900 CCA $69.95 Faith Rd. 704-213-1005 Scion xA Base Hatchback, 2006. Silver streak mica exterior w/ dark charcoal interior. Stock # F10460A. $11,759. 1-800-542-9758 Volvo V70, 2.4 T, 2001. Ash Gold Metallic exterior with tan interior. 5 speed auto trans. w/ winter mode. 704-603-4255 Jeep Grand Cherokee Limited, 2003. Automatic, 4x4, CD, heated seats, sunroof. Must See! Call 704-603-4255 Honda Element LX SUV, 2008. Tango Red Pearl exterior w/Titanium/Black interior. Stock #T10724A. $15,159. 1-800-542-9758 Suzuki XL7 Luxury SUV 2007. Stock #F10395A. Majestic silver exterior with gray interior. $15,959 Toyota 4 Runner, 1997 Limited Forest Green on Tan Leather interior V6 auto trans, am, fm, cd, tape, SUNROOF, alloy rims, good tires, CHEAP TRANSPORTATION!!!! 704-603-4255 Toyota Highlander Hybrid SUV, 2006. Millennium silver metallic exterior w/ash interior. Stock #T11108A. $16 Engines. Two 24 HP Onan Engines, one locked up, one minor repair. $200 for both. 704-279-5765 Toyota, 2007-2008, Camry hood & front bumper. OEM. Like new. $125 for both or $75 each. 704-960-2735 Transportation Dealerships Suburu Impreza 2.5i Sedan, 2009. Spark Silver Metallic exterior w/carbon black interior. Stock #T10726A. $16,559. 1-800-542-9758 Ford Ranger Extended Cab, 2010. Dark shadow gray metallic exterior w/medium dark flint. Stock #F10496A. $17,559. 1-800-542-9758. TEAM CHEVROLET, CADILLAC, BUICK, GMC. 704-216-8000 Toyota Tacoma Prerunner, 2007. Silver on Lt. Gray cloth interior, 4 cylinder, 5 speed, AM/FM/CD, cruise, toolbox, rhino liner, chrome rims, MUST SEE TO APPRECIATE! 704-603-4255 Volvo XC90 T6 AWD, 2005 gold w/tan leather int., V6, twin turbo, tiptronic trans. All pwr opt., AM/FM/CD changer, dual power/heated seats, alloy rims, navigation, Ready for that special buyer! 704-603-4255 Tim Marburger Dodge 287 Concord Pkwy N. Concord, NC 28027 704-792-9700 CASH FOR YOUR CAR! We want your vehicle! 1999 to 2011 under 150,000 miles. Please call 704-216-2663 for your cash offer. ELLIS AUTO AUCTION 10 miles N. of Salisbury, Hwy 601, Sale Every Wednesday night 6 pm. Toyota Corolla CE Sedan, 1997. Cashmere beige metallic exterior w/oak interior. Stock #F10541A2. $6,759. 1-800-542-9758. Want to attract attention? Get Bigger Type! Transportation Financing We are the area's largest selection of quality preowned autos. Financing avail. to suit a variety of needs. Carfax avail. No Gimmicks – We take pride in giving excellent service to all our customers. Call Steve today! 704-603-4255 SOMETHING TO SELL $ 500 OR LESS? FREE! Autos If you’re an individual, with merchandise to sell priced $500 or less, we will give you 4 lines of Classified Advertising for 7 days Weekly Special Only $17,995 Please: NO PHONE CALLS FOR “4 LINES FREE” Trucks, SUVs & Vans We Do Taxes!! ABSOLUTELY FREE! Acura MDX, 2001. Starlight silver metallic w/ charcoal leather interior, 3.5 V6, backed w/auto trans., all power options, sunroof, dual power seats, steering wheel controls. Runs & drives new. 704-603-4255 Buick Rainier CXL Plus SUV, 2004. Olympic white exterior w/light cashmere interior. Stock # T11111C. $11,459. 1-800-542-9758 Over 150 vehicles in Stock! Chevrolet Beautiful! Open Sundays 12pm-5pm Over 150 vehicles in Stock! Rentals & Leasing Open Sundays 12pm-5pm Over 150 vehicles in Stock!: City: Collector Cars Chevrolet Avalanche 1500 LS Crew Cab, 2007. Gold mist metallic exterior w/dark titanium interior. Stock #T11201A. $22,959. 1-800-542-9758 Rentals & Leasing Over 150 vehicles in Stock! 4 LINES Jeep Wrangler Unlimited, 2005. Bright Silver Metallic exterior with black cloth interior. 6-speed, hard top, 29K miles. Won't Last! Call Steve today! 704-603-4255 Collector Cars We Do Taxes!! State: Home Phone: N.C. Daytime Phone: l Zip: No l FORM MAY ALSO BE USED FOR FREE KITTENS, PUPPIES, OR OTHER THINGS YOU ARE GIVING AWAY. Please: NO PHONE CALLS FOR “4 LINES FREE” Open to residents of Rowan, Cabarrus, Davie, Davidson, Iredell and Stanly counties. Chevrolet, Trailblazer, 2003. Dark green exterior. Power windows. and locks. CD/AM/FM. 1 family owner. 140,000 miles. $6,000. Please call 704-857-1401 or 704213-0295 Chevrolet Trailblazer LS SUV, 2006. Silverstone metallic exterior w/light gray interior. Stock #T10295A. $11,959. Call now 1-800-542-9758 Salisbury Post Classifieds PO Box 4639 Salisbury, NC 28145 Mail Form: 704-630-0157 131 West Innes Street in Salisbury Drop Form at: ADS ARE FOR THE ONE TIME SALE OF PRIVATE PARTY, INDIVIDUAL MERCHANDISE - NO BULK ITEMS, BUSINESSES OR CONTINUOUS SALES. ITEMS(S) ADVERTISED MUST BE PRICED TO TOTAL $500 OR LESS AND MUST NOT BE OF A BUSINESS NATURE. *ADS FOR ANIMALS AND GUNS ARE NOT INCLUDED IN “4 LINES FREE”. LIMIT 4 FORMS could run for up to 7 days depending on space available. Please: No Phone calls for “4 lines free” 10B • MONDAY, JANUARY 24, MONDAY, JANUARY 24, 2011 • 11B TV/HOROSCOPE MONDAY EVENING JANUARY 24, 2011 A - Time Warner/Salisbury/Metrolina Monday, Jan. 24 Numerous happy circumstances are likely to prevail for you and your loved ones in the next year, and even disappointing condiBROADCAST CHANNELS tions could prove to be of value. Something CBS Evening Wheel of Jeopardy! How I Met Your Rules of Hawaii Five-0 “Ho’apono” A Navy News 2 at 11 Late Show W/ Two and a Half (:31) Mike & ^ WFMY News/Couric Mother SEAL takes hostages. Letterman Fortune (N) Å (N) Å Engagement (N) Å Men Molly Å important can be learned from mistakes. Who Wants to How I Met Your Rules of WBTV News Two and a Half (:31) Mike & Hawaii Five-0 “Ho’apono” A Navy WBTV 3 News Late Show With # WBTV 3 CBS Evening Aquarius (Jan. 20-Feb. 19) — Live in the now Men (In Stereo) Molly “Mike’s SEAL takes hostages. (In Stereo) at 11 PM (N) David Letterman News With Katie Prime Time (N) Be a Millionaire Mother Å Engagement CBS and deal with things as they occur. You’ll (N) Å Å Å Couric (N) “Rug-of-War” Apartment” make yourself and everybody else miserable Extra (N) (In TMZ (N) (In House (N) (In Stereo) Å Lie to Me (N) (In Stereo) Å FOX 8 10:00 News (N) Seinfeld Jerry Seinfeld The ( WGHP 22 Access Hollywood Stereo) Å Stereo) Å four pals are takes pity on a if you worry about every little insignificant FOX (N) Å arrested. Å foreigner. detail and event. Inside Edition Entertainment The Bachelor (N) (In Stereo) Å (:01) Castle “Knockdown” Castle WSOC 9 News (:35) Nightline ) WSOC 9 ABC World Pisces (Feb. 20-March 20) — You could do (N) Å News With Tonight (N) (In and Beckett grow closer. (N) (In Tonight (N) Å (N) Å ABC Diane Sawyer Stereo) Å Stereo) Å yourself much more harm than you thought NBC Nightly Inside Edition Entertainment Chuck “Chuck Versus the Gobbler” The Cape “Scales on a Train” Dana Harry’s Law “Heat of Passion” WXII 12 News at (:35) The possible, if you seek out business advice from , WXII News (N) (In (N) Å Tonight (N) (In Sarah and Mary try to take down and Trip cope with their loss. (N) (In Adam tries to impress a beautiful 11 (N) Å Tonight Show inexperienced parties. Go only to looped-in NBC Stereo) Å Stereo) Å Volkoff. (N) Å Stereo) Å woman. (N) Å With Jay Leno folks people for help. Everybody How I Met Your How I Met Your House (N) (In Stereo) Å Lie to Me (N) (In Stereo) Å Fox News at (:35) Fox News The Simpsons King of the Hill Mother “Stuff” 10 (N) Edge Better school. Å Hank and boys 2 WCCB 11 Loves Raymond Mother Å Aries (March 21-April 19) — Instead of letÅ Å on adventure. ting another tell you what to think, weigh and Chuck (:35) “Chuck Versus the Gobbler” The NBC Nightly Jeopardy! Wheel of The Cape “Scales on a Train” Dana Harry’s Law “Heat of Passion” NewsChannel D WCNC 6 analyze all the facts for yourself, especially Tonight Show News (N) (In (N) Å Fortune “Gone Sarah and Mary try to take down and Trip cope with their loss. (N) (In Adam tries to impress a beautiful 36 News at NBC Volkoff. (N) Å With Jay Leno Stereo) Å Fishin”’ (N) Stereo) Å woman. (N) Å 11:00 (N) if it has something do with an important caPBS NewsHour (N) (In Stereo) Å Nature Å To Be Announced Massive Nature To Be Announced reer matter. Be the court of last resort. 4 Everyday J WTVI Edisons Å Taurus (April 20-May 20) — Your efficacy ABC World (:01) Castle “Knockdown” Castle Entourage (In (:35) Nightline Are You Who Wants/ The Bachelor (N) (In Stereo) Å M WXLV will suffer if you fail to make and follow a News and Beckett grow closer. (N) (N) Å Smarter? Stereo) Å Millionaire quality game plan concerning an important Guy (In Two and a Half Two and a Half 90210 “Liars” Mr. Cannon holds Gossip Girl Chuck and Serena WJZY News at (:35) Seinfeld New Adv./Old (:35) The Office 8 Family N WJZY Stereo) Å Men Men Naomi hostage. (N) Å unite against Lily. (N) Å 10 (N) “The Finale” Christine Å assignment. Strive to be methodical in hanThe Simpsons Two/Half Men Two/Half Men Law & Order: Criminal Intent Law & Order: Criminal Intent The Office The Office House-Payne Meet, Browns P WMYV dling your work. Law & Order: Criminal Intent Family Feud (In Law & Order: Special Victims Law & Order: Criminal Intent Tyler Perry’s Tyler Perry’s My Wife and George Lopez Gemini (May 21-June 20) — To be on the safe “Gemini” The detectives look for a Stereo) Unit “Undaunted House House Kids (In Å Å “Recall” Detectives have Mettle” Architect is of Payne of Payne “Double Stereo) W WMYT 12 side, it is best not to borrow anything from anracist. (In Stereo) Å trouble building a case. Å killed with a screwdriver. Date” Å Å Å BBC World (:00) PBS Nightly North Carolina Antiques Roadshow “San Diego” American Experience “Panama Canal” The Panama Sleeping Charlie Rose (N) other. However, if you have no other recourse, Business Now (In Stereo) Handwritten draft of “Stormy Canal opens Aug. 15, 1914. (N) (In Stereo) Å (DVS) Monsters-Fires News (In Stereo) (In Stereo) Å Z WUNG 5 NewsHour treat it with the same care that you would any Å (N) Å Report (N) Å Å Weather.” (N) Å of your own prized possessions. CABLE CHANNELS Cancer (June 21-July 22) — Because it is Intervention “Jimbo” A man snorts Heavy “Rickywayne; Jessica” Intervention Woman who wants to Intervention “Lorna” A former (:00) Heavy Heavy “Tom; Jodi” A 5’9” man A&E 36 “Tom; Jodi” best not to spring any surprises on your mate, drugs. (N) Å dancer is addicted to crack. be a man uses heroin. (N) Å weighs 630 lb. Å Movie: ››‡ “The Brave One” (2007) Jodie Foster, Terrence Howard, Nicky Katt. Movie: ››‡ “Sleeping With the Enemy” Movie: ››‡ “The Brave One” (2007) Jodie Foster, make sure s/he is informed of any important AMC 27 (:00) (1991) Julia Roberts. Å Terrence Howard. decision or action that you decide to take beKiller Aliens Invasive species in Florida. (In Stereo) Å Maneaters (In Stereo) Å Investigates: Gang Dogs Maneaters (In Stereo) Å ANIM 38 Untamed fore you actually do so. (:00) 106 & Park: BET’s Top 10 Live Å The Game The Game Movie: ›› “Honey” (2003) Jessica Alba, Mekhi Phifer. The Mo’Nique Show Å BET 59 Leo (July 23-Aug. 22) — Normally you are Housewives/Atl. (:45) The Real Housewives of Atlanta Tabatha’s Salon Takeover (N) Tabatha’s Salon Takeover BRAVO 37 Real Housewives/Beverly extremely careful about your choice of words, Mad Money The Kudlow Report (N) CNBC Reports American Greed On the Money Mad Money CNBC 34 especially if they are critical in nature. If Parker Spitzer (N) Piers Morgan Tonight Anderson Cooper 360 Å CNN 32 Situation Rm John King, USA (N) you’re reckless about how you put things, Cash Cab (In County Jail (In Stereo) Å Get Out Alive (In Stereo) Å American Chopper: Senior vs. FBI’s 10 Most Wanted (In Stereo) Get Out Alive (In Stereo) Å DISC 35 Stereo) Å you’ll reap the whirlwind. Å Junior Lee returns. (N) Å Virgo (Aug. 23-Sept. 22) — Being hasty in Luck The Suite Life The Suite Life Movie: ››‡ “Hannah Montana: The Movie” (2009) Miley Cyrus, Billy Hannah Hannah The Suite Life The Suite Life DISN 54 Good Charlie on Deck Å on Deck Å Ray Cyrus, Emily Osment. Montana Å Montana Å on Deck Å on Deck Å your behavior or your handling of matters can E! Special E! Special Fashion Police The Soup Chelsea Lately E! News E! 49 (:00) E! Special E! News lead to a series of boners and gaffes. Take the (:00) College Basketball Notre Dame at Pittsburgh. (Live) College Basketball Baylor at Kansas State. (Live) SportsCenter (Live) Å time to pace yourself properly, and you’ll reESPN 39 SportsCenter Å duce mistakes. Women’s College Basketball Iowa at Ohio State. (Live) Tennis Australian Open, Men’s and Women’s Quarterfinals. From Melbourne, Australia. Å ESPN2 68 Tennis Libra (Sept. 23-Oct. 23) — Instead of mereStill Standing Pretty Little Liars The Liars get a Pretty Little Liars Liar doesn’t Greek Beaver finds an unlikely love Pretty Little Liars Liar doesn’t The 700 Club Å FAM 29 Å little help. Å always get what she wants. (N) always get what she wants. interest. (N) Å ly ordering others about, set a good example Action Sports World Tour (N) The Game 365 Final Score Profiles Final Score FSCR 40 Sports Stories Women’s College Basketball Miami at Florida State. (Live) as to how you want things handled. Actions al“Austin Powers- Two and a Half Two and a Half Movie: ››› “Forgetting Sarah Marshall” (2008) Jason Segel. In Hawaii struggling to get over a bad Movie: ››› “Forgetting Sarah ways speak louder than words, and it’s likely FX 45 Spy” Men Men breakup, a musician encounters his former lover and her new boyfriend. Marshall” (2008) to be the only way to get others to see the light. Hannity (N) Greta Van Susteren The O’Reilly Factor FXNWS 57 Special Report FOX Report W/ Shepard Smith The O’Reilly Factor (N) Å Scorpio (Oct. 24-Nov. 22) — Unless you are Pipe Dream Haney Project Fabulous World of Golf The Golf Fix Golf Central Learning GOLF 66 Play Lessons The Golf Fix (Live) guarded, you could unintentionally betray a Movie: “Accidental Friendship” (2008) Chandra Wilson. Å Golden Girls Golden Girls HALL 76 Who’s Boss? Who’s Boss? Who’s Boss? Little House on the Prairie trust, so keep a close eye on your pie hole. It House Hunters Property Virgin Property Virgin House Hunters Hunters Int’l Cash & Cari Hunters Int’l My First Place My First Place HGTV 46 Designed/Sell Hunters Int’l won’t matter that you didn’t mean to speak Pawn Stars American Pickers Å Pawn Stars Å Pawn Stars Å American Pickers An auctioneer’s Pawn Stars Tech It to Modern History HIST 65 (:00) out of turn — the damage will be done. the Max collection. (N) Å (N) Å (N) Å The Waltons Inspir. Today Life Today Joyce Meyer Fellowship Hal Lindsey Christ-Proph Sagittarius (Nov. 23-Dec. 21) — You have INSP 78 Highway Hvn. Our House Å Adv./Old How I Met Your How I Met Your Reba “All Fore Reba (In Stereo) Movie: “Final Sale” (2011) Laura Harris, Ivan Sergei, Kaitlin Doubleday. How I Met Your How I Met Your little tolerance for stingy people. If you go to LIFE 31 New One” Å Mother Å Mother Mother Christine Premiere. Å Mother lunch with someone who doesn’t know how to Movie: “The Capture of the Green River Killer” (2008) Tom Cavanagh, Amy Davidson, Sharon Lawrence. Detective David Reichert begins a Movie: ›› “Evil Has a Face” (1996) Sean LIFEM 72 (:00) mathematically split a check down the midYoung, William R. Moses. Å relentless search for a serial killer in Washington state. Å dle, keep a cool head. Countdown With K. Olbermann The Rachel Maddow Show The Last Word Countdown With K. Olbermann MSNBC 50 The Ed Show Hardball With Chris Matthews Capricorn (Dec. 22-Jan. 19) — Do be cogThe Truth Behind the Ark Ancient X-Files (N) Explorer (N) The Truth Behind the Ark NGEO 58 (:00) Explorer Wild Justice “Outgunned” nizant of small details when you are working George Lopez George Lopez The Nanny (In The Nanny (In My Wife and Everybody iCarly (In Stereo) iCarly (In Stereo) SpongeBob My Wife and Everybody NICK 30 Å Å Å Å Kids Å Hates Chris SquarePants Kids Å Hates Chris Stereo) Å Stereo) Å on something that calls for precision. HowevThe Bad Girls Club Å The Bad Girls Club (N) Å The Bad Girls Club Å The Bad Girls Club Å OXYGEN 62 Bad Girls Club The Bad Girls Club Å er, do not become obsessed with the nitty-gritUFC Unleashed (In Stereo) Movie: ››‡ “Barbershop” (2002) Ice Cube. Premiere. (In Stereo) Movie: ››‡ “Barbershop” SPIKE 44 Unleash ty when it comes to minor things in life. Bruce Pearl Pat Summitt Spotlight Spotlight Spotlight Darrin Horn Phenoms Women’s College Basketball SPSO 60 Spotlight Know where to look for romance and you’ll Movie: ›‡ “Saw IV” (2007) Tobin Bell, Scott Patterson, Betsy Russell. Being Human Josh and Aiden (:00) Movie: ››‡ “Pirates of the Caribbean: Dead Being Human Aidan and Josh find it. The Astro-Graph Matchmaker instantSYFY 64 Man’s Å learn more about Sally. (N) move in together. (Part 1 of 2) Chest” (2006) Å ly reveals which signs are romantically perFamily Guy (In Family Guy (In Family Guy (In Family Guy (In Family Guy Å Family Guy (In Conan (N) Seinfeld “The King of Seinfeld “The TBS 24 The Stereo) Å Queens Å Alternate Side” Stand-In” Stereo) Å Stereo) Å Stereo) Å Stereo) Å fect for you. Mail $3 to Astro-Graph, P.O. Box (:15) Movie: ››› “Member of the Wedding” (1952) Ethel Waters, 167, Wickliffe, OH 44092-0167. TCM 25 (:00) Movie: ››› “Assault on a Queen” (1966) Movie: ››› “The Heart Is a Lonely Hunter” (1968) Alan Arkin, TLC TNT TRU TVL USA 6:30 7:00 7:30 8:00 8:30 Frank Sinatra, Virna Lisi. Cake Boss: Next Great Baker Bones Mutilated remains of a (:00) Law & 26 Order (In Stereo) chicken farmer. Å Cops Å Cops Å 75 Police Video All in the Family Sanford & Son Sanford & Son Sondra Locke, Stacy Keach. Cake Boss: Next Great Baker Bones Remains of a gamer are found. (In Stereo) Å Bait Car Bait Car (N) Sanford & Son Retired at 35 “Pilot” Å NCIS “Once a Hero” The NCIS try NCIS McGee takes things into his (:00) NCIS own hands. Å to clear a Marine’s name. “Sandblast” W. Williams Meet, Browns Meet, Browns Dr. Phil (In Stereo) Å Dharma & Greg America’s Funniest Home Videos New Adv./Old New Adv./Old Å Christine (In Stereo) Å Christine 48 Cake Boss 56 28 WAXN 2 WGN 13 9:00 9:30 10:00 10:30 11:00 11:30 Julie Harris, Brandon de Wilde. Å Cake Boss: Next Great Baker To Be Announced Cake Boss: Next Great Baker Bones “The X in the File” (In Rizzoli & Isles The murder of a Rizzoli & Isles Jane clashes with Stereo) Å wealthy couple. Å her new boss. Å All Worked Up All Worked Up All Worked Up All Worked Up Forensic Files Forensic Files Movie: ›››› “Terms of Endearment” (1983) Shirley MacLaine, Debra Winger, Jack Nicholson. A spunky woman babies her daughter, then her ex-astronaut neighbor. WWE Monday Night RAW (In Stereo Live) Å (:05) White Collar “Burke’s Seven” Å The Oprah Winfrey Show Eyewitness Entertainment The Insider America’s Funniest Home Videos WGN News at Nine (N) (In Stereo) Scrubs (In Å (In Stereo) Å Stereo) Å Inside Edition Scrubs (In Stereo) Å PREMIUM CHANNELS HBO Ricky Gervais: Movie: ›› “Clash of the Titans” (2010) Sam Worthington, Liam The Ricky Neeson, Ralph Fiennes. (In Stereo) Å Gervais Show Out, England Masterclass “Bill Movie: ››› “Dead Men Don’t Wear Plaid” (1982) Movie: ›››‡ “Fantastic Mr. Fox” (2009) Voices of Big Love Bill attempts to stage a Movie: ›››‡ “Minority Report” T. Jones” Steve Martin. Å George Clooney. Å meeting. (In Stereo) Å (2002) Å (5:45) Movie: ›››‡ “A Beautiful Mind” (2001) Six Feet Under Kroehner corpo- Movie: ›› “Gothika” (2003) Halle Berry, Robert (:45) Uncle Movie: ›››‡ “The Wrestler” Russell Crowe. Å rate headquarters burns. Downey Jr. (In Stereo) Å Killa Å (2008) Å (5:45) Movie: ››‡ “The Ring” (:45) Movie: ›› “He’s Just Not That Into You” (2009) Ben Affleck, Jennifer Aniston, Movie: ››› “The Blind Side” (2009) Sandra Bullock, Tim McGraw, (2002) (In Stereo) Drew Barrymore. (In Stereo) Å Quinton Aaron. (In Stereo) Å Movie: ›› “Knowing” (2009) Nicolas Cage, Rose Byrne, Chandler Shameless “Aunt Ginger” (iTV) (In Californication Episodes Californication Episodes (5:00) Movie: “Nobel Son” Canterbury. iTV. (In Stereo) Å Stereo) Å (iTV) Å “Episode 3” (iTV) (iTV) Å “Episode 3” (iTV) Movie: ›› “The Time Traveler’s Wife” (2009) Real Time With Bill Maher (In 15 (:00) Rachel McAdams. (In Stereo) Å Stereo) Å HBO2 302 HBO3 304 MAX 320 SHOW 340 Has colchicine been nixed? Dear Dr. Gott: I was in my doctor’s office last week for new prescriptions, and he indicated that colchicine is being pulled from the market. I take it for gout and don’t know what I can use in its place. Do you have any suggestions? Dear DR. PETER pain. GOTT.”: I have a friend who says she is suffering from Morgellons disease. What is this? I’ve never heard of it. Dear Reader: Morgellons is a disorder that presents with itchy sores, rashes, stinging and crawling sensations on and under the skin. There may be threads or black specklike materials on or beneath the skin, visual and behavioral changes, severe fatigue, an inability to concentrate and joint pain. It was first reported almost 10 years ago. Since then, there have been confirmed cases of Morgellons in all 50 of the United States, yet researchers still know little about the disorder and even whether it’s contagious. Its symptoms share common characteristics with Lyme disease, kidney and liver dis- orders, drug and/or alcohol abuse, delusional parasitosis and more. The peripheral nervous system is often affected by the disease, but the most significant known aspect is the involvement of the central nervous system. Almost every person diagnosed with the disorder complains of depression, bipolar mood disorder, short-term memory loss and difficulties with concentration. Sadly, many people with Morgellons are misdiagnosed with a psychiatric disorder (perhaps because of the itching present under the skin). There appears to be involvement with Lyme disease, and many who suffer from Morgellons have tested positive for Lyme, but not all Lyme patients have Morgellons. This poorly understood illness can be both disabling and disfiguring, affecting people of all ages. For more information, contact the Morgellons Research Foundation at or write to P.O. Box 357, Guilderland, NY 120840357. Actor Ernest Borgnine is 94. Singer Ray Stevens is 72. Singer Aaron Neville is 70. Singer Neil Diamond is 70. Actor Michael Ontkean (“Twin Peaks”) is 65. Country singersongwriter Becky Hobbs is 61. Comedian Yakov Smirnoff is 60. Keyboardist Jools Holland (Squeeze) is 53. Actress Nastassja Kinski is 52. Drummer Keech Rainwater of Lonestar is 48. Singer Sleepy Brown of Society of Soul is 41. Actress Matthew Lillard is 41. Actress Merrilee McCommas (“Family Law”) is 40. Actor Ed Helms is 36. Actress Tatyana Ali (“The Fresh Prince of Bel-Air”) is 32. Actress Mischa Barton (“The O.C.”) is 25. East is the player with the decision BY PHILLIP ALDER United Feature Syndicate In last week’s deals, declarer had two choices of play, usually at the first trick. This week, let’s move the problem to the third person to play to trick one. Look at the North and East hands. You are defending against four hearts. West leads the diamond three. What would you do? If you win the trick, what would you do next? North had a close decision over West’s takeout double. The Law of Total Tricks suggested jumping to four hearts, but that would have been excessive without a singleton or void. Two hearts, though, was not enough. North took the middle course, making a pre-emptive raise to three hearts. (With game-invitational values, he would have responded two notrump.) The single most important defensive rule is when third hand plays high, he tables the bottom of equally high cards. Here, you must play the jack. Then, if South takes the trick with his ace, you are marked with the queen. West will win trick two with his heart ace and play another low diamond, putting you on lead for the lethal spade shift. Note that if you erred by playing the diamond queen at trick one, West would think South had the jack. He would not underlead again in diamonds, and declarer would take 10 tricks: four hearts, one diamond, four clubs and a ruff in the dummy. Finally, if declarer ducks the first trick, you should immediately switch to the spade nine (high denying an honor). West’s lead marks South with the diamond ace, so returning that suit would be a waste of time. Royal engagement photos ‘inspired by Diana’ be- fore her death in a Paris car crash. A Dr. B. D. Smith, General Dentistry 1905 N. Cannon Blvd., Kannapolis (704) 938-6136 12B • MONDAY, JANUARY 24, 2011 SALISBURY POST W E AT H E R Are you losing your hearing, or are your ears just plugged with earwax? Become Informed...Get Involved! Find out for yourself! Ear inspection using the latest video technology always free at Miracle-Ear FREE SERVICES & LIMITED TIME SPECIAL OFFERS Learn more about the AIR QUALITY in Rowan & Cabarrus. $495 Lowest Price Ever! Read about: TRADE IN Digital In The Ear YOUR OLD AIDS $50 OFF on any hearing aid or $100 OFF Any Pair Exceptional savings on an exceptional hearing aid Model AC 702I circuit 105/30 only. Fits up to a 35db mild loss ONLY Expires January 31, 2011 • Air-pollutant levels INSIDE school buses $845 Limit one per customer. Expires January 31, 2011 Digital Micro Canal BATTERIES SAVE 50% FOR ALL BRANDS BUY ONE 8 PACK GET ONE 8 PACK FREE Exceptional savings on an exceptional hearing aid Model AC 700MC circuit 105/30 only. Fits up to a 35db mild loss Reg Price $1695 Expires January 31, 2011 • The importance of BUYING LOCAL foods for your health & the air you breathe Limit one per customer. Expires January 31, 2011 FREE FREE Ear Canal Inspection* FREE Tune-up & Cleaning Receive a FREE, no-obligation hearing test from your local Miracle-Ear® representative. Hearing Test* • The EPA’s new, stricter proposed air quality standards • The reason children are particularly vulnerable to dirty air Using a miniature video otoscope camera, we’ll look inside your ear canal and show it on a TV monitor. Bring in your current hearing aid, no matter what make or model, and we’ll perform a 10-point clean and check. Interested in Something Smaller? Ask about our “completely-in-the-canal” style Visit Now you don’t! R129253 Now you see it. They’re virtually invisible! ACCEPT NO SUBSTITUTES! Hearing Tests are given for the purpose of selection and adjustment of hearing instrumentation. Results may vary related to duration and severity of impairment. Early detection is important. *Hearing tests, ear canal inspections and hearing aid cleanings and tune-ups are always free at Miracle-Ear. spec313283 and click on ENVIRONMENT. Salisbury Concord Sears Albemarle Carolina Mall 2106 Statesville Blvd. 283 N. Third Street (Salisbury Marketplace) Toll Free 1-877-427-1130 National Cities 5-D 5-Day ay Forecast for for Salisbury Salisbury Today Tonight Tuesday Wednesday Thursday Friday High 43° Low 25° 47°/ 36° 36°/ 23° 43°/ 22° 43°/ 25° Mostly cloudy Partly cloudy tonight Chance of snow Rain likely and mostly cloudy Mostly sunny Partly cloudy Today Hi Lo W 52 36 pc 24 19 pc 26 22 pc 40 27 pc 11 9 pc 32 19 i 25 22 sn 52 32 pc 39 19 sn 27 23 sn 7 -2 sn 32 22 sn City Atlanta Atlantic City Baltimore Billings Boston Chicago Cleveland Dallas Denver Detroit Fairbanks Indianapolis Tomorrow Hi Lo W 43 38 r 42 27 sh 42 30 pc 42 24 i 34 24 fl 28 16 pc 33 20 sn 45 31 pc 44 21 pc 33 15 pc 12 -3 cd 32 19 pc City Kansas City Las Vegas Los Angeles Miami Minneapolis New Orleans New York Omaha Philadelphia Phoenix Salt Lake City Washington, DC Today Hi Lo W 32 17 pc 63 43 pc 77 50 pc 74 65 pc 29 3 sn 62 50 sh 18 18 pc 31 12 pc 21 20 pc 69 43 pc 38 22 pc 28 25 pc Tomorrow Hi Lo W 31 17 pc 67 42 pc 77 50 pc 80 71 t 23 14 pc 60 42 r 36 28 sn 26 16 pc 39 29 pc 69 43 pc 39 27 sn 45 32 pc Today Hi Lo W 66 42 s 41 35 pc 22 6 pc 44 32 pc 91 71 s 21 3 pc 50 33 pc Tomorrow Hi Lo W 64 46 pc 46 37 pc 15 -4 pc 41 35 pc 91 73 s 24 6 pc 46 33 s World Cities Today Hi Lo W 44 33 r 32 12 s 68 53 pc 35 32 sn 89 71 s 39 24 pc 42 41 pc City Amsterdam Beijing Beirut Berlin Buenos Aires Calgary Dublin Tomorrow Hi Lo W 46 33 r 32 10 s 68 59 pc 39 32 r 91 73 s 39 22 pc 46 33 pc City Jerusalem London Moscow Paris Rio Seoul Tokyo Pollen Index Almanac Data from Salisbury through ough 6 p.m. yest. Temperature Regional Regio g onal W Weather eather Knoxville Kn K le le 47/29 Frank Franklinn 445 45/25 5 5 Wins Salem Winston Win a 40/ 5 40/25 Boone 36/ 36/22 Hi Hickory kkory 41/27 A Asheville s ville v lle 443/23 43/ Sp Spartanburg nb 47/2 47/29 Kit Kitty Hawk Haw H wk w 3666//366 36/36 D Danville 41/22 Greensboro o D Durham h m 40/25 40/27 27 Ral Raleigh al 440/27 Salisb S Salisbury alisb sbbury b y 43/25 255 Charlotte ha ttte 45/27 Cape Ha C Hatteras atter atte attera tte ter era raass ra 4433/ 43/4 43/43 3/4 /43 4 W Wilmington to 49/38 Atlanta 52/34 Co C Col Columbia bia 50/ 50/32 Darlington D Darli /3 49/31 Au A Augusta ug u 554/38 54 54/ 4/38 .. ... Sunrise-.............................. 7:27 a.m. Sunset tonight 5:40 p.m. Moonrise today................... 11:35 p.m. Moonset today.................... 10:08 a.m. Jan 26 Feb 2 Feb 11 Feb 18 Last New N First Full Aiken ken en 52/ 52 52/38 /33 Allendale A Al llen e ll 554/34 /34 34 naah Savannah 59/400 High.................................................... 44° Low..................................................... 15° Last year's high.................................. 49° Last year's low....................................38° .................................... 38° Normal high........................................ 51° Normal low......................................... 32° Record high........................... 75° in 1927 ...............................9° Record low............................... 9° in 2003 ...............................30% Humidity at noon............................... 30% Moreh Mo M Morehead o ehea oreh orehea heaaadd Cit Ci C City ittyy ity 4 0 45/4 45/40 Forecasts and graphics provided by Weather Underground @2011 Myrtle yrtle yr lee B Be Bea Beach ea each 550/40 50 0//40 00/4 /4 Ch Charleston leest les 554/43 54 H Hiltonn He Head e 554/47 54/ 4///477 Shown is today’s weather. Temperatures are today’s highs and tonight’s lows. LAKE LEVELS Lake Charlottee Yesterday.... 32 ........ good .......... particulates Today..... 51 ...... moderate N. C. Dept. of Environment and Natural Resources 0-50 good, 51-100 moderate, 101-150 unhealthy for sensitive grps., 151-200 unhealthy, 201-300 verryy unhealthy, 301-500 haazzardous ...........0.00" 24 hours through 8 p.m. yest........... 0.00" ...................................0.97" Month to date................................... 0.97" Normal year to date......................... 2.96" ............... ... 0.97" Year to date..................................... -10s Seattle Se S eaatttttle le -0s 552/42 52 22///44422 0s Southport outh uth 449/38 Air Quality Ind Index ex Precipitation LLumberton be b 47 47/311 G Greenville n e 45/32 32 SUN AND MOON Go Goldsboro b bo 43/29 Salisburryy Today: Tuesday: Wednesday: - Observed Above/Below Full Pool High Rock Lake............. 644.49......... -10.51 -3.14 Badin Lake.................. 538.86.......... ..........-3.14 Tuckertown Lake............ 594.8........... -1.2 Tillery Lake.................. 278.1.......... -0.90 Blewett Falls.................177.9 ................. 177.9.......... -1.10 Lake Norman................ 96.50........... -3.5 10s H 20s S San an an Francisco Fra Fr rancisco anncciissscccoo 30s 663/49 63 3/4 /4499 Minneapolis iinnn M nnneea eaappol olliiiss 229/3 99///33 339/19 39 99///11199 27/23 227 77///22233 Angeles Looss A Los Annngggeeellleeess Kansas K Kaansas annsas ssas aass C City Ciiitttyy 777/50 77/50 /50 /5 333/18 33//18 /18 H Cold Front Paso EEll P Pa aasssoo 90s Warm Front Attllaan ant nttaa A Atlanta M iiaaam mi Miami Snow Ice 774/65 44///66655 Hoouston ttooonn uuston sston LHouston 55999/4 59/43 9///44433 WEATHER UNDERGROUND’S NATIONAL WEATHER Jess Parker Wunderground Meteorologist 228/25 88///22255 5222///36 /336 552/36 H Staationary 110s Front Rain n Flurrries Washington Waasshiinnngton ggton tton oonn 559/27 99///22277 100s Showers T-storms torms H oiitt Detroit Deetttrrroit Denver D eenver nnver vver eerr 70s 18/18 1188//1 1188 /18 332 32/19 22///11199 H 50s 80s N New York eew wY Yooorrrkk Chicago Chhiiicccaaagggoo Ch 40s 60s H L B Billings illiinnngggss 440/27 0//22277 More active weather is expected in the eastern half of the nation Monday. The trough of low pressure over the Central Plains will drop southeastward throughout the day, supporting a wave of low pressure that will trek eastward into the lower Ohio Valley with light to moderate snow showers. The trough will also support the development of another low pressure system along a cold front near the Western Gulf Coast. Flow associated with this system will enhance moisture along the Central and Western Gulf Coasts, allowing for showers, periods of heavy rainfall, and chances of thunderstorms to develop primarily along the coast of Texas. In addition to active weather, warm moist flow will allow temperatures in the Southeast to warm back to near normal values. To the north, an Alberta clipper system will bring snow to the Great Lakes Monday. While light accumulations are generally expected across the region, intense lake effect snow may produce heavier accumulations in western Mackinac County, Michigan. Temperatures in the Midwest and especially the Northeast will remain bitter cold Monday. Daytime highs in these regions are expected to drop to about 10 to 30 degrees below average. Finally in the West, high pressure will keep much of the region under fair and dry weather conditions with near to above normal daytime highs. Disturbances in the eastern Pacific will keep chances of precipitation over the Pacific Northwest. Get the Whole Picture at wunderground.com wunderground.com—The —The Best Known Secret in Weather™
https://issuu.com/salisburypost/docs/01242011-sls-a01
CC-MAIN-2016-50
refinedweb
41,474
74.79
If you want to know how to get your application to save information to disk or the registry, then a quick skim through MSDN magazine or a quick search on newsgroups will give you the answer: serialization. Mark your classes with the [Serializable] attribute and there you go. It�s a simple matter of creating a Formatter and a Stream and a couple of lines later it�s done. Alternatively, you could mark up your class with the necessary attributes and use XML Serialization. All very simple, but unfortunately all very wrong. There are a number of reasons why you should not opt for the simple approach. Here are nine important ones. XML serialization only works on public methods and fields, and on classes with public constructors. That means your classes need to be accessible to the outside world. You cannot have private or internal classes, or serialize private data. In addition, it forces restrictions on how you implement collections. If you mark your classes as [Serializable], then all the private data not marked as [NonSerialized] will get dumped. You have no control over the format of this data. If you change the name of a private variable, then your code will break. You can get around this by implementing the ISerializable interface. This gives you much better control of how data is serialized and deserialized. Unfortunately � Type information is stored as part of the serialization information. If you change your class names or strong-name your assemblies, you�re going to hit all sorts of problems. Even if you manage to code the necessary contortions to get round this, you�re going to find that � .NET isn�t going to be around in five years or so. If you start implementing the ISerializable interface in your code now, then its tendrils are going to be everywhere in five years� framework is going to be a pig. I wrote some VB6 code 5 years ago and used the Class_ReadProperties and Class_WriteProperties events to access PropertyBag objects. A neat, easy way of storing information to disk, I thought. And it was, until .NET came along and then I was stuck. Using XML serialization is inherently insecure. Your classes need to be public, and they need to have public properties or fields. In addition, XML serialization works by creating temporary files. If you think you�re creating temporary representations of your data (for example, to create a string that you�re going to post to a web service), then files on disk will pose a potential security risk. If, instead, you implement the ISerializable interface and are persisting sensitive internal data, then, even if you�re not exposing private data through your classes, anyone can serialize your data to any file and read it that way, since GetObjectData is a public method. XML is verbose. And, if you are using the ISerializable interface, type information gets stored along with data. This makes serialization very expensive in terms of disk space. The odds are you don�t really know how serialization works. I certainly don�t. This means that there are going to be all sorts of quirks and gotchas that you can�t even conceive of when you start using it. Did you know that XML serialization actually uses the CodeDom? When you think you�re creating a bunch of XML, .NET is actually doing some sort of compilation. What are the implications of that? The only thing I know is that I will not know about them until it�s too late. When I did some research for a previous article (), I noticed a few interesting things. I wrote a class that contained two double values. I created 100,000 instances of this class, stored them to disk, and then read them back again. I did this two ways. First of all, I did it the �proper� way, by implementing ISerializable, creating a BinaryFormatter, and using the Serialize and Deserialize methods. Secondly, I did it the �dirty� way, by blasting the data straight out into a Stream. Which way was faster? Perhaps not surprisingly, the dirty way. About 50 times faster. Surprised? I was. ISerializable does a lot of cunning work. This means that it doesn�t necessarily behave the way you might expect. When you deserialize a collection of objects, for example, the constructors won�t get called in the order that you might think. Take the following code sample: using System; using System.Runtime.Serialization; using System.Collections; using System.IO; using System.Runtime.Serialization.Formatters.Binary; class Class1 { static void Main(string[] args) { ParentClass c1=new ParentClass(); BinaryFormatter f=new BinaryFormatter(); MemoryStream m=new MemoryStream(); f.Serialize(m, c1); m.Seek(0, SeekOrigin.Begin); ParentClass newClass=(ParentClass)f.Deserialize(m); Console.WriteLine("Deserialized\r\n{0}", newClass.ToString()); Console.WriteLine("Press [Enter]"); Console.ReadLine(); } } [Serializable] class ParentClass : ISerializable { private ArrayList m_Collection; public ParentClass() { //set up the collection of child classes m_Collection=new ArrayList(); m_Collection.Add(new ChildClass("Hello World!")); m_Collection.Add(new ChildClass("Hello again!")); } public override string ToString() { string s=""; foreach (ChildClass c in m_Collection) { s=s+c.ToString()+"\r\n"; } return s; } public ParentClass(SerializationInfo info, StreamingContext context) { //deserialize the child collection m_Collection=(ArrayList)info.GetValue("Collection", typeof(ArrayList)); //loop through what has just been deserialized Console.WriteLine("Just deserialized items:"); //THESE WILL BE BLANK BECAUSE THE CHILD CLASSES HAVEN'T BEEN // DESERIALIZED YET foreach (ChildClass c in m_Collection) { Console.WriteLine("{0}", c.ToString()); } } public void GetObjectData(SerializationInfo info, StreamingContext context) { //serialize the collection info.AddValue("Collection", m_Collection); } } [Serializable] class ChildClass : ISerializable { private string m_TestString; public ChildClass(string testString) { m_TestString=testString; } public string TestString { get { return m_TestString; } } public override string ToString() { return m_TestString; } public ChildClass(SerializationInfo info, StreamingContext context) { Console.WriteLine("Deserializing a child class"); m_TestString=info.GetString("v"); } public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("v", m_TestString); } } This code essentially serializes and de-serializes a parent object that contains a collection of child objects. You cannot, however, access the child objects from within the deserialization constructor of the parent object. The m_Collection object has been created, a value has been assigned to it, and info.GetValue(�Collection�, typeof(ArrayList)) has been called, but the m_Collection object does not contain any child objects. This is necessary given the way that serialization works, but it is not obvious behaviour. This, and other things, means that using serialization can be non-intuitive, and very hard to debug. Although .NET provides a number of quick and easy ways to serialize and deserialize data, do not use them. A week, a month, a year, or five years down the line you will regret it. ANTS Profiler, the simple code profiling tool from Red Gate Software, will find bottlenecks in your apps and tell you what your code is really doing. General News Question Answer Joke Rant Admin
http://www.codeproject.com/KB/dotnet/noserialise.aspx
crawl-002
refinedweb
1,139
50.02
Following is the syntax of enhanced for loop − for(declaration : expression) { // Statements } Declaration − The newly declared block variable, is of a type compatible with the elements of the array you are accessing. The variable will be available within the for block and its value would be the same as the current array element. Expression − This evaluates to the array you need to loop through. The expression can be an array variable or method call that returns an array. Example public class Test { public static void main(String args[]) { int [] numbers = {10, 20, 30, 40, 50}; for(int x : numbers ) { System.out.print( x ); System.out.print(","); } System.out.print("\n"); String [] names = {"James", "Larry", "Tom", "Lacy"}; for( String name : names ) { System.out.print( name ); System.out.print(","); } } } This will produce the following result − Output 10, 20, 30, 40, 50, James, Larry, Tom, Lacy, What is Next? In the following chapter, we will be learning about decision making statements in Java programming.
http://www.tutorialspoint.com/java/java_loop_control.htm
CC-MAIN-2017-26
refinedweb
161
56.55
13 November 2013 23:00 [Source: ICIS news] HOUSTON (ICIS)--Here is Wednesday's end of day ?xml:namespace> CRUDE: Dec WTI: $93.88/bbl, up 84 cents; Dec Brent: $107.12/bbl, up $1.31 NYMEX WTI crude futures rose as concerns about Libyan supply outages outweighed estimates from the US Energy Information Administration (EIA) for a build in US stockpiles. Uncertainty about the US Federal Reserve’s actions on the stimulus also pushed prices higher. RBOB: Dec: $2.6280/gal, up 4.16 cents/gal US reformulated blendstock for oxygen blending (RBOB) gasoline futures recovered from declines the previous day, tracking stronger crude oil futures. Expectations of a draw in gasoline supplies in Thursday’s EIA report also provided support. NATURAL GAS: Dec: $3.566/MMBtu, down 5.1 cents The December front month on the NYMEX natural gas futures market fell for the first time in seven sessions. The front month contract lost value despite a strong near-term demand outlook on concerns surrounding robust inventory levels ahead of Thursday’s weekly gas storage report from the EIA. ETHANE: steady at 24.75 cents/gal Ethane spot prices were steady as demand from petrochemical plants remains stable. There have been no major outages or start-ups reported. AROMATICS: mixed xylenes tighter at $3.85-3.88/gal US November mixed xylenes traded at $3.85/gal and $3.88/gal, tighter than the previous day’s bid/offer range of $3.83-3.90/gal. OLEFINS: ethylene done higher at 54.5 cents/lb, RGP steady at 54.75 cents/lb US November ethylene traded higher on Wednesday, reaching a peak of 54.50 cents/lb, up from the previous reported trade done at 52.25 cents/lb on 11 November. US November refinery-grade propylene (RGP) was steady at 54.75 cents/lb, based on the most recent reported
http://www.icis.com/Articles/2013/11/13/9725132/evening-snapshot---americas-markets-summary.html
CC-MAIN-2015-14
refinedweb
313
61.83
detailed information on the release, please check the CHANGELOG. Let’s get started! Better pipelines The pipeline operator in Elixir is a great way to express a series of computations on top of a data structure. Given Ecto queries are just data structures, they are a perfect fit to be modified as part of pipelines. Ecto has always supported both keyword and function queries. Let’s start with a keyword query: from p in Post, where: p.author == "José", order_by: [desc: p.published_at], limit: 5 In Ecto v1.0, it could have be written using pipelines as follows: Post |> where([p], p.author == "José") |> order_by([p], desc: p.published_at) |> limit(5) Ecto v1.1 improve pipelines by making the binding argument required only when working with associations and by allowing dynamic data to be given on more places. In v1.1, we can rewrite the example above as: Post |> where(author: "José") |> order_by(desc: :published_at) |> limit(5) Most query operations like where, distinct, having support the syntax above. The only exceptions are select and group_by which will be tackled on Ecto v2.0. No more models Ecto.Model is being deprecated on Ecto v1.1. This aims to solve both conceptual and practical issues. Let’s discuss them. What are models? The big question imposed by Ecto.Model is: what is a model? One thing is clear, Ecto did not provide models in the “traditional” sense. In OO languages, you would say a model can be instantiated and it would have methods that contain business logic. However, the data that comes from the database in Ecto is just data. It is an Elixir struct. It is not an Ecto model. Working closely on Phoenix applications and on the Programming Phoenix book made it clear that, similar to controllers and views, models are not an entity. A model, a controller or a view (from the MVC pattern) are just group of functions that share similar responsibilities. They are just guidelines on how to group code towards a common purpose. For those reasons, Ecto.Model is being deprecated in Ecto. At first, this implies Ecto data structures are now defined directly with Ecto.Schema. In Ecto v1.0: defmodule MyApp.Post do use Ecto.Model schema "posts" do # ... end end From Ecto v1.1: defmodule MyApp.Post do use Ecto.Schema schema "posts" do # ... end end Not only that, many of the functions in the Ecto.Model module have been moved to Ecto. However, the biggest change with the deprecation of models is that model callbacks are being removed. To understand why this matters, let’s look at one Ecto feature that relied on callbacks and was rewritten to be a simple function. Optimistic lock Ecto provides optimistic locks on top of your schema. A simple implementation of optimistic lock uses an integer column, usually named lock_version, to store the current version of a given row. On update, Ecto would do a “compare and increase” operation. If the entry being updated had the same lock_version as in the database, the update operation succeeds and the lock_version is incremented. Otherwise, the update fails because the entry is stale. On Ecto v1.0, optimistic_lock was enabled for the whole model: defmodule MyApp.Post do use Ecto.Model schema "posts" do # ... end optimistic_lock :lock_version end This reveals the awkwardness behind callbacks. We are suddenly adding “behaviour” to our data structures. Not only that, because callbacks are enabled on all operations, we have no control over its use. For example, what if you also provide an admin interface. Do you want the admin to be under the same lock constraints as regular users? More importantly, what if you want to trigger the lock only if some fields are changing? The only way to add this functionality is by growing the complexity of the optimistic_lock implementation by providing an ever growing set of complex options. It happens Ecto has the perfect solution to this problem: changesets. For example, instead of defining validations in the model, you define per changeset: @required_params [:title, :body] @optional_params [:metadata] def changeset(post, params \\ :empty) do post |> cast(params, @required_params, @optional_params) |> validate_length(:title, min: 3) |> validate_length(:metadata, min: 3) end In other words, a changeset is a data structure that controls the changes being sent to the database. This means that, if you have different roles in your application that work on different facets of the same data, you define different changesets for every operation. Ecto v1.1 has replaced the optimistic_lock/1 macro implementation by a simple function that works on the changeset. If you want to add optimistic locking, just pipe your changeset in the optimistic_lock/2 with the lock column name: def changeset(post, params \\ :empty) do post |> cast(params, @required_params, @optional_params) |> validate_length(:title, min: 3) |> validate_length(:metadata, min: 3) |> optimistic_lock(:lock_version) end Because it is only a function call, you have control of exactly when and where you can apply the lock. And ultimately that’s the fundamental problem with callbacks: it makes developers write functionality that is hard to compose. Goodbye callbacks After a quick search on GitHub, we quickly noticed that many developers relied on callbacks in many cases where changesets would suffice, introducing exactly the same problems we saw with optimistic_lock. Furthermore, after_* callbacks provide their own set of issues. Because after_insert and after_update callbacks would still run inside a transaction, there is no guarantee the transaction that wraps both insert and update would actually commit. So someone would rely on such callbacks to index data or write to the filesystem while the transaction could rollback afterwards. Those mistakes are always bound to happen with callbacks because the execution flow is hidden from developers. For all the reasons mentioned above, callbacks are deprecated in Ecto and will be removed by Ecto v2.0. Meanwhile we are working on solutions like Ecto.Multi that will give developers a data-driven approach to work with transactions. Looking forward to 2.0 Besides the improvements already listed above, we are looking forward to many exciting new features on Ecto v2.0: - Streamlined syntax for selectand group_by - A more efficient way of working with transactions via Ecto.Multi - Many to many associations - Automatic handling of associations and embeds on insert - Automatic handling of both belongs_toand the upcoming many_to_manyassociations in insert and update - An ownership system that allow tests that rely on the database to run concurrently by managing connection access Furthermore, James Fish is working on a project called db_connection that will simplify adapter implementations and speed-up many operations by removing the amount of process communication and by providing client-side decoding. Early experiments showed performance improvements of ~25% when loading data. Such changes will also lead the way for running queries in parallel. For example, we will be able to preload associations in parallel instead of sequentially like today. The best news is that we expect Ecto v2.0 to be simpler and smaller in size than Ecto v1.1 thanks to the removal of callbacks and the support being brought by db_connection. We are really excited about future versions of Ecto and the improvements it will bring to everyday applications! Awesome work! I’m actually excited for the removal of callbacks. Few features of Rails have given me more pain that those. I’d like to bring attention to a very timely post by Daniel Berkompas on replacing Ecto callbacks with GenEvents:. His approach adds some complexity, but also gives you more control and could be a good replacement for anyone looking to migrate their Ecto callbacks before 2.0. Unless I am mistaken, Daniel still leverage Ecto Callbacks in his GenEvent solution. When I first encountered the Phoenix Framework about a year or so ago I was very dismayed that it appeared to be trying to rebuild Rails in Elixir. Why, why, why would anyone try to shoehorn an OOP framework into FP? Recently, I decided I’d better learn Phoenix anyway (how bad could it be?), and began reading the excellent new book. I’m delighted to report that I was totally wrong about Phoenix. In almost every way, it does things right, which is to say the FP way. Awesome. Models, however, were one area that still seemed a bit suspect. I think that getting rid of them is a capital idea, and am very much looking forward to Ecto 2. Any idea when it might be ready? Thank you! I would say a month from now is not an unreasonable expectation, at least for a beta release. I’m so glad callbacks are being removed! Thank you guys for making the right, tough choices!
http://blog.plataformatec.com.br/2015/12/ecto-v1-1-released-and-ecto-v2-0-plans/?utm_source=elixirdigest&utm_medium=web&utm_campaign=featured
CC-MAIN-2019-39
refinedweb
1,441
57.77
Advertisement good example for the biginners good example for the biginners Its very helpful for beginners. Its very helpful for beginners. real leap years Your leap year example gives false results for the years 1900, 2100 and others. The leap year rules are: 1. Years that are multiples of 4 are leap years, except for the following special years. 2. Years that are mutliples of 100 are not leap year Please Change The Program... This Program Dose Not Meet All The Conditions For A Leap Year... Hi Your leap year example gives false results for the years 1900, 2100 and others. The leap year rules are: 1. Years that are multiples of 4 are leap years, except for the following special years. 2. Years that are mutliples of 100 are not leap year Condition insufficient this condition is not sufficient for century years.it shud also b divisible by 400 wrong The leap year is the year that is divided by the integer 4 and isn't divided by 100 or is divided by 400. So: if ((n%4==0 && n%100 != 0) || n%400 == 0){ System.out.println("The given year is a leap year"); } else{ System.o Best Site this is best site for learn java progarmming... logic of leap year function isLeapYear (year): if ((year modulo 4 is 0) and (year modulo 100 is not 0)) or (year modulo 400 is 0) then true else false There is error in your logic.... Hi, My name is Vishal...I think the logic you have given for leap year i.e. (year%4) is not enough to decide whether a year is leap year or not.... Because 1700, 1800, 1900 These are not leap years but still are divisible by 4.... Here is the Sir , I m student of software engneering plz help me to complete some project .or send some project sample kindly request student thnks ur student java tutorials send me some more simple programs on my e-mail id ankitsre.jain08@gmail.com it worked with some modification well this java code was a success though i had to modify it to suite my need of generating a given number of leap years ahead of the current year Checking whether a year is leap or not-Correction public class Example { public void find(int n) { if((n%4==0&&n%100!=0)||(n%400==0)) { System.out.println("Leap Year") ; } else { System.out.println("Not Leap Year") ; Good
http://www.roseindia.net/tutorialhelp/allcomments/1119
CC-MAIN-2015-35
refinedweb
412
73.68
10 June 2010 By clicking Submit, you accept the Adobe Terms of Use. This article assumes that you are comfortable with ActionScript 3, and that you have a pretty thorough understanding of general Flash concepts such as sprites and bitmaps. Additionally, I highly recommend that you read my previous article entitled Authoring mobile Flash content for multiple screen sizes in order to familiarize yourself with some of the basics of multiscreen application development with the Flash Platform. Intermediate The sample code for this project is all open source and hosted on GitHub at the links below. You can either check out the source code using git, or you can simply download the zip or tar files provided on the project pages. I recently wrote a post on my blog entitled One Application, Five Screens which showed a single AIR application called iReverse running on OS X, Windows 7, Ubuntu, an iPhone, an iPad, a Motorola Droid, and in the browser. A few days later, I also showed iReverse running on a Nexus One while demoing how easy the AIR tool chain is to use with Android. Although the iPhone and iPad aren't as relevant as they once were, Adobe AIR either reaches or will reach most other next-generation devices, so knowing how to author across devices and screen sizes is becoming increasingly important. This article describes the techniques I used to write a single application that automatically adapts to any screen size and any resolution, and runs just about everywhere. There are a several different techniques for developing multiscreen applications. A few that I considered are: I think the first two options are what most developers will find work best for them. Rather than writing a single application that gets deployed everywhere, the goal would be to reuse as much code as possible, and therefore minimize the amount of device-specific code that needs to be written. For example, if you were developing a Twitter client, you might reuse your Twitter protocol library, persistence layer, and perhaps most of your application logic, but customize your presentation layer for each target platform or device. Although I think this model-view-controller approach will make sense for most applications, I decided to try the third option described above. I wanted to see if I could write a single application—one single code base—that ran on every supported platform and device, completely unchanged. As it turns out, with a little practice, it's more feasible than I expected, and I suspect many developers will find that it works for their projects, as well. Now that I've explained what this project is all about, I want to take a minute to explain what it isn't. After publishing the One Application, Five Screens video, I received a lot of comments from developers who didn't understand what I was doing. Aside from the "Java has been able to do this since 1995" comments, the second biggest misconception was that I was simply using if statements or #ifdef preprocessor directives. In my mind, that's cheating. There isn't a single if statement in all the 1,500 or so lines of code in this project that checks which platform, device, or OS the application is running on. Rather than adapting to specific devices, iReverse adapts to the context or environment. In other words, rather than checking to see if a device is a Motorola Droid or a Windows 7 computer, it pays attention to things like screen resolution and pixels per inch. In fact, I actually went a step further. iReverse doesn't even care about things like orientation or whether the screen is big or small; it simply does its best to lay itself out as optimally as possible no matter what the constrains are. That means iReverse will work fine on the smallest screen we current support to the biggest (soon to be flat-panel televisions). Before I drill down into specific implementation details, it probably makes sense to start with an overview of the general architecture I used. Although iReverse is one single code base, I still have separate projects for each device it runs on. Currently that includes the following projects: The Reversi project (named generically in case I decide to change the name of the application) basically contains all the code for the game while the device-specific projects all contain nothing more than simple wrappers which include the Reversi project in their source paths (to set a project's source path in Flash Builder, go to Properties > Flex Build Path). The Reversi project contains roughly 1,500 lines of code while the ReversiAndroid project consists entire of the following: package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; [SWF(frameRate="24")] public class ReversiAndroid extends Sprite { private var reversi:Reversi; public function ReversiAndroid() { super(); this.stage.scaleMode = StageScaleMode.NO_SCALE; this.stage.align = StageAlign.TOP_LEFT; this.reversi = new Reversi(-1); this.addChild(this.reversi); } } } As you can see, the job of the wrappers is to: That's pretty much it. So if all the iReverse wrappers basically do the same thing, why have separate projects for each? There are several reasons: -1argument being passed into the Reversi class constructor is a pixels per inch value. When -1is passed in, the Capabilities.screenDPIproperty is used to determine PPI, but since the API is hard-coded in some environments (where it might be difficult to get a device's pixel density), it is sometimes useful to be able to override it. <?xml version="1.0" encoding="utf-8" standalone="no"?> <application xmlns=""> <id>com.christiancantrell.reversiandroid</id> <supportedProfiles>desktop mobileDevice</supportedProfiles> <filename>iReverse</filename> <name>iReverse</name> <version>0.9</version> <description>A one or two player Reversi game.</description> <initialWindow> <autoOrients>true</autoOrients> <fullScreen>true</fullScreen> <aspectRatio>portrait</aspectRatio> <content>[This value will be overwritten by Flash Builder in the output app.xml]</content> <title>iReversi</title> <systemChrome>none</systemChrome> <transparent>false</transparent> <visible>true</visible> <width>480</width> <height>854</height> </initialWindow> <icon> <image57x57>assets/Icon.jpg</image57x57> </icon> </application> Note: In the example above, I have the screen size set to 480×854 which is the resolution of a Motorola Droid. Specifying the resolution of the Droid allows me to "simulate" one of my target devices during the development process, but it won't affect the dimensions of the application on the device itself. In other words, when running on a Nexus One (which has a 400×800 screen), the application will run at the appropriate size. Figure 1 shoes my Flash Builder project panel showing the architecture described in this section. Below are instructions on how to set up the Reversi projects. Note that setting up the Reversi projects is not required. If you would rather just learn the general concepts discussed in this article, feel free to skip this step. ReversiDesktop should compile and run just fine. Follow the same process (starting from step 5 above) for any of the other Reversi project that you want to set up. They all work identically except for ReversiBrowser. To set up the ReversiBrowser project, follow these steps: The ReversiBrowser project should compile now, and running it should open iReversi in your default browser. Now that you have iReverse up and running, let's explore some of the specific techniques it uses to run across multiple screen sizes. iReverse supports three distinct orientation modes: Although iReverse is very orientation conscious, it has a strange way of handling orientation events: it doesn't. Although it responds perfectly when a device is rotate , and although AIR makes it very easy to listen for and respond to orientation change events ( StageOrientationEvent.ORIENTATION_CHANGE ), iReverse doesn't use any orientation-related APIs. Instead, iReverse uses the more generic and more multiscreen friendly technique of listening for stage resize events ( Event.RESIZE ). The primary advantage to using stage resize events rather than orientation change events is that your application will lay itself out properly in any context—whether on a device that is being rotated, or inside a native window that's being resized, or inside a plugin container of arbitrary dimensions in a browser. For this technique to work, the Reversi class first needs to know when it has been added to the display list. Only after it has been added to the display list is it safe to access the stage property. The code below is how iReverse knows when its stage property won't be null: this.addEventListener(Event.ADDED, onAddedToDisplayList); The code below is an abbreviated version of the onAddedToDisplayList function: private function onAddedToDisplayList(e:Event):void { this.removeEventListener(Event.ADDED, onAddedToDisplayList); this.stage.addEventListener(Event.RESIZE, doLayout); } Now whenever the stage is resized, the doLayout function gets called. There are three circumstances that will cause the an Event.RESIZE event to fire: As it turns out, this is exactly what we need. We need the application to lay itself out when it initializes, whenever its window is resized (in environments like the desktop that have windows), and when the device's orientation changes (when running on a mobile device or tablet). Now that we know how to hook into the right event to cover all your layout scenarios, the question is what the layout logic should look like. Of course, this will be heavily dependent on the specific application, but here are some general pointers: One of the first things you will want to do is remove all the children from the stage like this: while (this.numChildren > 0) this.removeChildAt(0); iReverse uses the following code to draw a solid color background: var bg:Sprite = new Sprite(); bg.graphics.beginFill(BACKGROUND_COLOR); bg.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight); bg.graphics.endFill(); this.addChild(bg); Since iReverse uses a solid color background, it would also work to simply set the background color of the SWF using metadata like this: [SWF(backgroundColor="#666666")] However, I prefer drawing my background in code for the following reasons: BACKGROUND_COLOR. Although iReverse doesn't use orientation change events, it does need to know what the device's orientation is in order to know how to lay out the game. To make this quick and easy, I wrote the following function: private function getOrientation():String { return (this.stage.stageHeight > this.stage.stageWidth) ? PORTRAIT : LANDSCAPE; } There are other ways to find out a device's orientation, but this is the most device-independent way of doing it. In other words, this even works on devices that don't have a concept of orientation (like the desktop) which means as the native window is resized, the application will be laid out appropriately. Most of the drawing of the iReverse user interface happens inside of the following conditional: if (this.flat) // Head-to-head { // The game is in two player mode, and the device is flat. // Orient the scores toward each player. } else if (this.getOrientation() == PORTRAIT) // Portrait { // Position the scores at the top, and the game buttons at the bottom. } else // Landscape { // Position the scores on either end, and place the buttons in the corners. } Although iReverse primarily uses stage resize events ( Event.RESIZE ) to know when to redraw, it also listens for accelerometer update events ( AccelerometerEvent.UPDATE ) in order to determine when to go into or come out of "head-to-head" or "flat" mode. Of course, not all the devices that iReverse runs on have accelerometers, and not all AIR application profiles support the accelerometer APIs (for instance, the desktop profile doesn't support the Accelerometer class since relatively few computers have accelerometers at this point). So how can one code base cover devices with and without accelerometers? Fortunately, the Flash Platform makes this extremely simple by "stubbing out" APIs in contexts even where they aren't supported. In other words, even in the desktop profile where accelerometer events aren't supported, the Accelerometer class still exists which means my code compiles, verifies, and runs just fine. I do make one small concession, however. The code below is what I use to configure an Accelerometer instance and listen for accelerometer update events: if (Accelerometer.isSupported) { this.accelerometer = new Accelerometer(); this.accelerometer.setRequestedUpdateInterval(1500); this.accelerometer.addEventListener(AccelerometerEvent.UPDATE, onAccelerometerUpdated); } As you can see, I use the isSupported property on the Accelerometer class to check to see if the accelerometer APIs are supported before using them. This actually isn't strictly required; I could remove that if statement and unconditionally register for accelerometer update events, and the code would compile, verify, and run just fine, however in this case, I prefer to be explicit about APIs that don't work everywhere. In my opinion, it improves the readability of the code. Since the primary way of interacting with an application on the desktop or in the web browser is with a mouse and keyboard, applications usually capture corresponding mouse and keyboard events. Since the primary way of interacting with a mobile application is with your fingers, mobile applications usually capture corresponding touch events. So how do applications designed to run in both places handle input events? Touch events only work in environments where touch is supported by the host system's hardware and software. The same is not true of mouse events. Mouse events work on the desktop, in the browser, and on mobile devices. Therefore, if your application needs to work across screens, you are usually better of just capturing mouse events and not capturing touch events at all. The exception to this rule is when you need touch-specific data or functionality such as multitouch, gestures, or properties of the TouchEvent class such as the touchPointID . But if all you need to know is when something is tapped or clicked on, mouse events will work everywhere. iReverse only uses mouse events and no touch events. But it also registers for keyboard events so users can cycle through the history of the game using the left and right arrows. The code below registers for keyboard events: this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); The code below is responsible for reacting to the left and right arrow keys: private function onKeyDown(e:KeyboardEvent):void { switch (e.keyCode) { case Keyboard.RIGHT: this.onNext(); break; case Keyboard.LEFT: this.onBack(); break; } } Notice how none of the keyboard event code is concerned with whether the host device even has a keyboard or not. Once again, the Flash Platform insulates developers from the differences between platforms. On devices that have keyboards, keyboard events are thrown. On devices without keyboards, no keyboard events are thrown. As long as your application doesn't depend on functionality that may not be available everywhere, this is a great way to give your application additional functionality in environments that support it. For instance, the left and right arrow keys obviously don't work on the Nexus One since it doesn't have a keyboard, but they work great on the Droid using the D-pad. Additionally, on touch-enabled Windows 7 computers, forward and back gestures (swipping right or left across the screen) result in left and right arrow keyboard events, and therefore can be used to navigate through a game's history. Flash works great with both vectors and bitmaps. Designing and styling your application with bitmaps is often a great technique since it lets designers work with tools and assets they are accustomed to, and because bitmaps perform better when used with transitions and tweens. But the problem with bitmaps is that they don't always scale down well, and they almost never scale up with much fidelity at all. That means if your application is going to be usable on screens of all different sizes, embedding or loading bitmaps might not be the best approach. Vector graphics behave very different. Since vector shapes are computed from algorithms, they scale well across huge ranges of screen sizes which makes them ideal for multiscreen applications. The problem with vectors is that they can be more resource intensive if not managed properly. With iReverse, I took a middle-of-the-road approach. All the graphics in the game (stones, the game board, button skins, etc.) are generated from vectors so that they can scale to any screen size, but then they are also converted to bitmaps in order to ensure that the application performs well. I use two different techniques to go from vectors to bitmaps. All DisplayObjects (including Sprites which is what all the iReverse visual elements inherit from) have a property called cacheAsBitmap . When set to "true", the vector is transformed from a vector to an in-memory bitmap which means that it will perform better in the context of visual effects such as transitions and tweens. As with almost all performance-related best practices, however, sometimes cacheAsBitmap can do more harm than good. For instance, I don't use cacheAsBitmap for the stones in the game since applying an alpha tween (which is the effect I use to show stones being captured) to a DisplayObject with cacheAsBitmap set to true will actually dramatically decrease performance since the object is re-cached each time the alpha property changes. If I were moving an object using its x , y , or z properties, however, setting cacheAsBitmap to true would dramatically improve performance. All the stones in iReverse are bitmaps by the time the user sees them, but they actually start out as vectors. Whenever the size of the stage changes, the following process occurs: Spritesare created (one for black, and one for white), circles are drawn in them using ActionScript drawing APIs, and a filter is applied to give them a slight three-dimensional look. BitmapData.draw()function is used to draw the two Spritesinto BitmapDataobjects. BitmapDataobjects are used to create two new Bitmapobjects which are stored as class-level variables. Bitmapobjects are created for every stone that needs to placed on the board. Below is the code that turns the stone vectors into bitmaps: var cellSize:uint = (this.board.width / 8); var stoneSize:uint = cellSize - 4; var tmpStone:Sprite = new Sprite(); tmpStone.graphics.beginFill(WHITE_COLOR); tmpStone.graphics.drawCircle(stoneSize/2, stoneSize/2, stoneSize/2); tmpStone.graphics.endFill(); tmpStone.filters = [this.stoneBevel]; var tmpStoneBitmapData:BitmapData = new BitmapData(tmpStone.width, tmpStone.height, true, 0x000000); tmpStoneBitmapData.draw(tmpStone); this.whiteStoneBitmap = new Bitmap(tmpStoneBitmapData); The technique described above gives me all the advantages of vectors (i.e. they can be scaled to virtually any size without any loss in quality), and all the performance advantages of bitmaps (a high frame rate can be maintained during alpha tweens). Most applications require some sort of data persistence. Even the simplest of games should save the current state of the application whenever it changes in case the application gets closed for any reason. Adobe AIR provides four primary mechanisms for persisting data: EncryptedLocalStore. The EncryptedLocalStoreis an extremely secure way to store and retrieve sensitive data. SharedObjects. Shared objects (in this context, they are usually referred to as "local shared objects") provide a simple and fast way to store and retrieve serialized data. When considering which technique to use, there are several things to consider: EncryptedLocalStoreor an encrypted SQLite database. EncryptedLocalStoreisn't supported in the mobile AIR runtimes, so where you want your application to run will almost certainly affect your approach to data persistence. Since I wanted iReverse to run everywhere (desktop, browser, phones, tablets, and eventually other devices like televisions and set-top boxes), and because the data iReverse needs to save is relatively simple, I chose the one technique that is guaranteed to work everywhere: local shared objects. iReverse saves the following information: All the information listed above is saved at the end of every move so that the game can be shut down at any time for any reason, and the state can be fully recovered. And since I use local shared objects to store the data, it works identically on all devices. Below is the code that saves the state of the game: private function saveHistory():void { ++this.historyIndex; var historyEntry:HistoryEntry = new HistoryEntry(); historyEntry.board = this.deepCopyStoneArray(this.stones); historyEntry.turn = this.turn; this.history[this.historyIndex] = historyEntry; for (var i:uint = this.historyIndex + 1; i < 64; ++i) { this.history[i] = null; } this.so.data[HISTORY_KEY] = this.history; this.so.data[PLAYER_MODE_KEY] = this.playerMode; this.so.data[COMPUTER_COLOR_KEY] = this.computerColor; this.so.flush(); } The persistence paradigm I chose is primarily geared toward mobile since mobile applications can be closed at any time, and therefore the state of the application should be saved as soon as possible after it changes. For instance, some mobile platforms close applications when you switch away from them, and some might close an application at any time because memory is running low. Additionally, the game might get paused (or closed) when receiving a phone call, or when responding to a text message, or a phone's battery could always suddenly go dead. Although the approach to persistence I chose is most suitable to mobile platforms, I was surprised by how well it worked on the desktop and in the browser, as well. Although applications don't usually get shut down unpredictably on the desktop, it's still nice that your game is always saved in case you accidentally quit or need to reboot after installing something in the background. And in the browser, it makes a huge amount of sense in case you accidentally navigate away from the page. As soon as you go back, your game is just as you left it, and the entire game history is preserved. It's not uncommon for paradigms that make sense in one context to become conventions and start being used in other contexts, as well. For example, the concept of "back" and "forward" buttons was really pioneered by browsers, but you now find many apps (including the Finder on Mac and Windows Explorer on Windows) that use the same concept. I believe that conventions and paradigms that we typically associate with mobile devices (persistence, multitouch, and so on) will become standard on other platforms, as well. Using the Flash Platform to develop these multiscreen experiences will allow your apps to easily port these concepts across devices. One of the things I had to consider in designing the computer player was CPU usage. I considered an approach where the computer would calculate all possible outcomes several moves in advance, but it doesn't take a math genius to figure out that the number of possible outcomes to a game—especially in its early stages—is tremendous. Although I was confident that I would be able to write something that would run fairly well on the desktop, I wasn't sure how well it would "degrade" on slower mobile processors. Since the point of writing iReverse wasn't to build an advanced AI, I decided on a very simple approach that I knew would run well on any processor. The computer simply tries to make the most strategic moves first, and considers less and less strategic moves as necessary. Since the logic isn't recursive or computationally intense, the computer is able to choose its next move in a very short amount of time on every device I've used for testing. In fact, I eventually put a one-second delay in because when I started doing user testing (having friends and family play against the AI to test it out), I found that the computer moved so quickly that some opponents found it insulting. After spending several seconds or even minutes choosing a move, some players weren't happy when the computer instantly captured large numbers of their stones. When writing applications designed to run on a range of devices from a single 400MHz processor to multiple quad-core processors, make sure your application will scale up or down computationally as well as visually. Here are some techniques you might consider using: ComputerPlayerinterface which I passed into the Reversi class constructor. That would have enabled me to write an advanced implementation for the desktop, and something simpler and faster for lower powered devices. If you haven't done so already, I highly recommend that you read my previous article entitled Authoring mobile Flash content for multiple screen sizes in order to familiarize yourself with some of the basics of multiscreen application development with the Flash Platform. Between that article and this one, you will learn everything you need to know about writing applications that adapt to any screen size and can run everywhere the Flash Platform is supported.
http://www.adobe.com/devnet/air/flex/articles/writing_multiscreen_air_apps.html
CC-MAIN-2017-30
refinedweb
4,094
50.97
"ducks = birds[0]" should actually read "ducks = families[0]". I'd edit the post directly but itch.io's post edit feature messes up code pretty badly rmrenner Book Recent community posts "ducks = birds[0]" should actually read "ducks = families[0]". I'd edit the post directly but itch.io's post edit feature messes up code pretty badly That's pretty much up to you! Writing out arrays of words directly into your source file is the least difficult thing to do, but it's also not very flexible. Creating and then reading from .json files is only barely more difficult, at least in python. If you have a file like birds_north_america.json, you could load its list of birds in python 2.7 with the following: import json #assumes birds_north_america.json is in the same directory as your script bird_json = json.load(open("birds_north_america.json)) #this will print "Birds of North America, grouped by family" print(bird_json["description"]) #this gets the list of bird families families = bird_json["birds"] #this gets the first bird family from the list ducks = birds[0] #this prints the first member of the duck/geese/swam family #which is "Black-bellied Whistling-Duck". print(ducks["members"][0]) There's a famous quote that goes, "There are only two hard things in Computer Science: cache invalidation and naming things." Of course, the real problem is naming things sensibly. With that restriction lifted, naming something becomes one of the easiest projects you can do! It really only requires that you know how to do three basic things: how to choose a random element from a list, how to concatenate strings, and how to print strings. That's the bare minimum to get something up and running. Anything you add on from there, like turning it into a logo or reading from an external list of words, is just gravy. A name generator is also very well-suited to command line programs or twitter bots. Genre and specificity is definitely your friend when it comes to picking a concept for your name generators. A movie title generator is probably too general to be very interesting. Limiting your scope to pulp adventure movies is better, but a bot that makes up names for Indiana Jones sequels immediately suggests a few specific forms and word types: Indiana Jones and the {noun} of {noun}. Indiana Jones and the {adjective} {noun}. Nouns: temple, doom, crusade, skull, cathedral, city, death, bones, gold, silver, ruby, emerald magic. Adjectives: lost, last, spooky, crystal, deserted, magic, golden.
https://itch.io/profile/rmrenner
CC-MAIN-2017-34
refinedweb
422
56.25
AWT ActionEvent Class This class is defined in java.awt.event package. The ActionEvent is generated when button is clicked or the item of a list is double clicked. Class declaration Following is the declaration for java.awt.event.ActionEvent class: public class ActionEvent extends AWTEvent Field Following are the fields for java.awt.event.ActionEvent class: static int ACTION_FIRST -- The first number in the range of ids used for action events. static int ACTION_LAST -- The last number in the range of ids used for action events. static int ACTION_PERFORMED -- This event id indicates that a meaningful action occured. static int ALT_MASK -- The alt modifier. static int CTRL_MASK -- The control modifier. static int META_MASK -- The meta modifier. static int SHIFT_MASK -- The shift modifier. Class constructors Class methods Methods inherited This class inherits methods from the following classes: java.awt.AWTEvent java.util.EventObject java.lang.Object
http://www.tutorialspoint.com/awt/awt_action_event.htm
CC-MAIN-2017-22
refinedweb
146
51.85
Okay, I'm developing a program that will solve quadratic equations for users. I have them plug in values for a, b, and c in the following formula: ax^2 + bx +c. This formula probably looks familiar to you guys from highschool. Anyways, for some reason my code outputs completely inaccurate results. Here is my code: #include <iostream> #include <cmath> #include <cstdio> #include <cstdlib> using namespace std; int main() { //variable declarations int aval; int bval; int cval; int root; int preroot; double sol1; double sol2; //a user inputs an integer for each of the specified values cout<< "a = "; cin >> aval; cout<<"b = "; cin>>bval; cout<<"c = "; cin>>cval; //number crunching sol1 = (-bval + sqrt(bval*bval - 4*aval*cval))/(2*aval); sol2 = (-bval - sqrt(bval*bval - 4*aval*cval))/(2*aval); //output cout<<"Your solutions are: x = "; cout<<sol1; cout<<" or x = "; cout<<sol2<< endl; system("PAUSE"); return 0; } For example, the equation 4x^2 + 5x + 1 comes up with x = -4 and x = -16 when the answers are clearly -1 and -1/4. I'm probably making some really stupid mistake or maybe i messed up the formula but i can't seem to figure it out! Anyways, some help would be nice. And please be gentle i'm new to this. Thanks! PS. I'm plugging the user input into the quadratic formula just in case you were confused. The quadratic formula can be found here: A
http://forums.codeguru.com/showthread.php?514615-Quadraatic-Formula-Program-Problem&p=2025132&mode=linear
CC-MAIN-2016-18
refinedweb
238
58.62
21 April 2009 09:14 [Source: ICIS news] LONDON (ICIS news)--Somali pirates on Tuesday released Stolt Strength, a tanker on time charter to Stolt Tankers, and all crew members on board are safe, the Norwegian shipping company said. “We are relieved that a safe conclusion to this traumatic situation has been reached,” Stolt-Nielsen said in a statement. The company said it recognised that the safe release of the ship and crew had been a difficult and protracted process for the ship's owners and managers. The crew would shortly be reunited with their families, it added. The vessel was taken by Somali pirates in the Gulf of Aden on 10 November while on passage from ?xml:namespace> Ship owners had said the threat of piracy in the Gulf of Aden and the additional costs being placed on ship operators could jeopardise the future of eastbound trade
http://www.icis.com/Articles/2009/04/21/9209490/stolt-nielsen-tanker-released-by-somali-pirates.html
CC-MAIN-2015-06
refinedweb
148
64.24
Hello, You cannot implement protocol at runtime (either in Objective-C or in .NET). If you want to use the WebScripting protocol through the IWebScripting interface, you have to find out which class implements it, and how to obtain it. Advertising I have found some samples on calling JavaScript from Cocoa, but not the other way. Maybe you can take a look at the bridges (JS <-> Cocoa) from the Apple website ? Regards, Laurent Etiemble. 2010/5/25 Eric Slosser <eric.slos...@v-fx.com> > I've found Monobjc.WebKit.IWebScripting, a sub-class of IManagedWrapper. > It's marked as [ObjectiveCProtocol("WebScripting")]. I'm now looking for > clues on how to use this class (or should I call it an 'interface'?) > > > On May 24, 2010, at 2:43 PM, Eric Slosser wrote: > > > I'm porting a .NET app that uses the WebBrowser control, and has > Javascript that calls back into the C#. > > > > It does this by stating "[ComVisible(true)] public class Foo { }", by > having an member variable 'browser' of type System.Windows.Forms.WebBrowser" > in Foo, and by calling "browser.ObjectForScripting = this" in Foo's > constructor. After those steps, the JavaScript can call back into > Foo.Callback by calling "window.external.Callback()". > > > > On Cocoa/WebKit, that would be done by implementing the WebScripting > protocol in an object (the 4 methods that define how the selectors in Foo > are exposed to JavaScript) , then calling [someWebScriptObject > setValue:someFoo forKey:@"external"], then the JavaScript would be able to > call window.external.Callback_(). > > > > I'm trying (and failing) to figure out how to implement the 4 methods of > the WebScripting protocol so that they'll get called by Webkit. Two of them > return NSString*, and the "no op" case of returning nil is allowed. > > > > Will I be able to define these 4 in C#, or will I need to create a pure > ObjectiveC object for this? > > > > Thanks in advance. > >
https://www.mail-archive.com/users@lists.monobjc.net/msg00428.html
CC-MAIN-2017-51
refinedweb
314
66.94
#include <ElementWriter.h> ElementWriter can be used to assemble and write new content to a page, Form XObject, Type3 Glyph stream, pattern stream, or any other content stream. Definition at line 22 of file ElementWriter.h. Enumeration describing the placement of the element written to a page. Definition at line 34 of file ElementWriter.h. Begin writing to the given page. By default, new content will be appended to the page, as foreground graphics. It is possible to add new page content as background graphics by setting the second parameter in begin method to 'true' (e.g. writer.Begin(page, true)). Begin writing an Element sequence to a new stream. Use this function to write Elements to a content stream other than the page. For example, you can create Form XObjects (See Section '4.9 Form XObjects' in PDF Reference for more details) pattern streams, Type3 font glyph streams, etc. Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter. Frees the native memory of the object. Finish writing to a page This method is used to initialize ElementWriter state with the state of a given ElementReader. This can be used to avoid incorrectly writing inherited GState attributes. Writes an arbitrary buffer to the content stream. This function can be used to insert comments, inline-image data, and chunks of arbitrary content to the output stream. Write only the graphics state changes applied to this element and skip writing the element itself. This is especially useful when rewriting page content, but with the intention to skip certain elements. A utility function that surrounds the given Element with a graphics state Save/Restore Element (i.e. in PDF content stream represented as 'q element Q'). The function is equivalent to calling WriteElement three times: WriteElement(eSave); WriteElement(element); WriteElement(eRestore); where eSave is 'e_group_begin' and eRestore is 'e_group_end' Element The function is useful when XObjects such as Images and Forms are drawn on the page. Writes an arbitrary string to the content stream. Serves the same purpose as WriteBuffer().
https://www.pdftron.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_element_writer.html
CC-MAIN-2020-45
refinedweb
360
57.37
Спрашивающий Exception: DataTable internal index is corrupted: '5'. on ... Hi, I have a problem with bindingsource component in framework 2.0. I have a combobox bound to a bindingsource which is also bound to a dataset with 2 related tables and a datagridview bound to the same bindingsource. What I want to do is : When the selectedindex property of my combobox changes, the corresponding cell value must be changed in the datagridview. But although the value in bindingsource changes, datagridview does not display the new value. That value is displayed after I move the mouse over that cell and make it invalidate its region manually. Another error I caught is the one that you can see as the subject of my post. I do not know why i have that message when I try to change the property of ((DataRowView)mybindingsource.Current)["MyProperty"] programmatically. I will be grateful if someone can help me. 2 марта 2006 г. 16:08 - Перемещено Val MazurModerator 4 сентября 2012 г. 19:51 (From:ADO.NET Managed Providers) Вопрос Все ответы Post a code example for the internal index is corrupted issue, this sounds like a bug. Sorry I can't help you on the binding issue.6 марта 2006 г. 9:14 Hi Matt, I have the same problem. I have a typed dataset and sometimes, I don't know why, when I want to select some information in a DataTable and show (no Databinding) some information on my webpage I get this error. Here is the exact exception : StackTrace : Source: System.Data Methode: RBInsert Message: DataTable internal index is corrupted: '5'. StackTrace : at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 position) at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 position)) at Composants_Publicite.Afficher() It can work for many days and then I suddenly get this exception. I can send you some code but I can't post it here due to security reason. Thx for your help.15 марта 2006 г. 21:48 - I'll check with the devs to see if they've heard of this one yet.17 марта 2006 г. 5:08 We have a bug filed on this but we have not narrowed down a way to reproduce this yet. Could you reply to me with some information on how you manipulate this DataTable? For example are you modifying this DataTable from multiple threads concurrently? It is possible that this could corrupt it. According to the devs: The internal index is corrupted "5" message typically gets thrown when 2 or more rows end with the same row id. This is a problem for DataTable because the row id should always be unique. So I theorize if 2 threads simultaneously add rows to the DataTable this could cause the corruption.18 марта 2006 г. 21:32 Yes It could be the problem. My DataSet is stored on the Application Cache and every user can potentialy access and, sometimes, modify the content of a row. But I had another exception telling that I cannot modify the same row at the same time. Now I modify it in order that the DataSet is now read only and I have no more exception on this DataSet.19 марта 2006 г. 17:27 after I red this thread I'm sure it is a bug in .NET framwork 2.0. I discoverd this exception several times in different applications. but yet I was unable to reproduce it while debugging :-( .. and it could not be a threading problem, having two thread inserting data, because I do not user different threads on that DataSet. any news on it from MS ?6 апреля 2006 г. 12:25 We're still looking for a repro. So if anyone out there has a repro please post it here. Also if you have some code that reproduces it but not consistently post this too. Anything that could help us figure out how to reproduce would be good, thanks for all your help thus far folks!6 апреля 2006 г. 16:57 Note someone forwarded one repro to me thus far and it turns out that this one was caused by multi-threaded access to the DataTable. So key thing for everyone to note. If you modify a DataTable on multiple threads, you can corrupt the indexes on it and this is by design. The DataTable is not designed to be thread safe for modifications for performance reasons. So to resolve this you need to use the lock statement around all modifications to DataTable. Modifications include: 1. Adding, deleting, modifying rows in DataTable. 2. Selecting rows using Select method on DataTable (yes, this can modify the DataTable by creating a new index on it). 3. Creating DataViews over a DataTable (same as #2, this can cause a new index to be created on DataTable). 4. Modifying Sort property. I am sure there are some others I missed. In general using the same DataTable on multiple threads is tricky business unless you restrict DataTable to100% read only operations (like enumerating rows and reading values).11 апреля 2006 г. 1:26 I am 100% sure, that this bug has nothing to do with multiple-thread. Our users ran into the bug several times a day. Now I implemented the following work-around: ' ------------------------------------------------------------------------------------------------ dt.Clear() Me.Owner.DbConnector.FillDataAdapter(da, dt) <CurrentBindingContext>.SuspendBinding() Table.BeginLoadData() Table.DataSet.Merge(dt, False, MissingSchemaAction.Add) Table.EndLoadData() <CurrentBindingContext>.ResumeBinding() ' ------------------------------------------------------------------------------------------------ I added the red-maked-code to the method where I do the .Reload of my DataSet. (The same Code is used after saving the Table.) On the side of the user-code I do not change anything. Just using NewRow and Rows.Add. - what caused the corrupted: '5' Error before. And now the error is gone. ' ------------------------------------------------------------------------------------------------ DimNewRow As DataRow = Me.Table.NewRow ... Me.Table.Rows.Add(NewRow)13 апреля 2006 г. 9:06 I am getting this same "data table internal index is corrupt '5'" error when trying to update a row using one of the table adapters I created with a data source in VS 2005. This code has been working without problems for months. The error occurs about 30% of the time. Here is an example of the code I am using: DataRowView rv = (DataRowView)myBindinfSource.Current; myDataSource.myTableDataRow row = (myDataSource.myTableDataRow)rv.Row; row.ID = 12; int updated = mtTableTableAdapter.Update(row); myDataSource.AcceptChanges(); Does anyone at least know of any work arounds?13 апреля 2006 г. 15:30 I think the problem you have is not caused while Update and AcceptChanges are executing. you should add a Table.Begin/EndLoadData to you code or add Suspend/Resumebinding during .Fill you can find 2 workarounds on the MS bug-report. the combination of both is workling in my applications. апреля 2006 г. 16:29 - I have tried using the Begin/EndLoadData as well as the Suspend/ResumeBinding tricks to try to get this to work but this error keeps rearing its' ugly head...still only sometimes though. I really wish I could find more information regarding why this could be happening. I am not using threads at all.....19 апреля 2006 г. 19:45 I seem to be able to reproduce this fairly consistently. I'm handling the CurrentItemChanged event on the binding source and using that to detect changes to one column that need to be propogated to others. Whenever I set a value against a column using the binding source Current property to access the DataRowView I get this exception. I've tried all the work arounds, but none seem to work. It doesn't seem to matter which event I connect to from the binding source, they all seem to throw this exception if I try to change the underlying data.26 апреля 2006 г. 12:26 Could you post a repro so I can get this to the dev who owns the bug? Thanks!26 апреля 2006 г. 17:26 To reproduce it : 1) Load a datatable with a dataadapter 2) modify a data and save it to the database "without" closing the form and then modify the data again and save to the database again 3) That's all28 апреля 2006 г. 18:15 We found a consistent way to reproduce this: using Asp.Net: - use a DataTable and store it in the cache - Create a DataView on the table - Bind a control to the DataView (this step is not necessary I think) - stress test the web page, sending multiple http requests at the same time. Very soon the error will start to appear.5 мая 2006 г. 16:47 Yes, this goes back to my original theory. A DataTable is thread safe for read operations but not for write operations. So this means you can store a DataTable in the cache and extract it and use it in a read only fashion and it will work fine. However, creating a DataView on a DataTable is a write operation on a DataTable. Most people don't know this, and its not very intuitive so I don't blame them for not knowing this. What happens when you create a DataView on a DataTable is the DataView will create an index on the DataTable and this index is stored in the DataTable. The reason for this is performance, for example if you create a DataView saying "F1=1" as the criteria, this creates an internal index on the DataTable to locate this information. Later on if you create another DataView with the same criteria, the index is reused, so this improves performance. However the fact that these indexes are stored inside the DataTable means that these are write operations to the DataTable and thus they are not thread safe. So if you are creating random DataViews on the DataTable you are constantly creating new indexes. If you are creating the same type of DataView over and over you are constantly reusing existing index. So unfortunately you need to serialize the creating of DataViews over the DataTable. You could do this for example to avoid the problem: lock(myDataTableFromCache) { dv = new DataView(myDataTableFromCache,...); } So lock using the DataTable as the locking object and lock when creating the DataView should solve the problem.5 мая 2006 г. 18:08 OK, I met this error as well but in bit different circumstances... I have 2 tables in my dataset (loaded from xml file). I have 2 DataGridViews which are bound to 2 BindingSources respectively. my user need to be able to move a line from DataGridView A to DataGridView B and back. In my code I create new row of Table B, fills it with values from line aa of DataGridView A, add the row to table B and delete the line aa from DataGridView A. When moving line from DataGridView B to DataGridView A I do the same just the in opposite direction. I get the error after doing several move like described on the same line. A->B, B->A, A->B and get the error on this line: Me.Ds.dtB.Rows.Add(NewRow) and the weirdest thing is that when I surround the code with "try catch" - I saw the error in a messagebox but the line did enter Table B and DataGridView B !!!!!!!!!! When tried to move it back to DataGridView A - I got the same error again but this time an empty row has been added to table A and DataGridView A. Hope this help a little and that a solution is on the way...11 мая 2006 г. 11:28 Sorry to burst your bubble on this, but I have a reproduction scenario on this which does not have anything to do with threading. It seems to have to do with expression field updating using the CHILD() expression function. I will post a code sample as soon as I can isolate one. Andy Another Item - if I use the lock statement to lock the row I'm operating on, then the code works fine. Are expression evaluations performed out of band on a different thread???18 мая 2006 г. 18:56 - Awesome, if you can get me the repro code I can give it straight to the dev that wrote the DataSet and we can get this fixed.18 мая 2006 г. 21:24 - To correct my prior statements, the lock keyword did NOT work reliability. However, as this is a sometimes works/sometimes doesn't problem, I would suspect a race condition.18 мая 2006 г. 21:57 Note as a follow up I talked to the DataSet gurus and they indicated that with .NET 2.0 creating DataView is now protected by internal locks so in theory there is no need to syncrhonized creating DataViews over a DataSet with .NET 2.0. Still looking for a repro for this one. I put together some test code on my own to stress multi-threaded DataView creation and could not reproduce any failures.26 мая 2006 г. 18:52 Any ideas on a similar error ('13' instead of '5'): System.InvalidOperationException: DataTable internal index is corrupted: '13'. at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) at System.Data.Index.GetRows(Range range) at System.Data.Index.GetRows(Object[] values) at System.Data.DataRelation.GetChildRows(DataKey parentKey, DataKey childKey, DataRow parentRow, DataRowVersion version) at System.Data.DataRow.GetChildRows(DataRelation relation, DataRowVersion version) at System.Data.DataRow.GetChildRows(DataRelation relation) at Store24.Store24Lib.ScrubProductsTable(DataRelation relation, String exclCategories, String[] productExcludeArray) in C:\Documents and Settings\chrwil\My Documents\Visual Studio 2005\Projects\Store24.2\Store24.2\Store24.cs:line 1956 private static void ScrubProductsTable(DataRelation relation, string exclCategories, string[] productExcludeArray) { foreach (DataRow parentDataRow in relation.ParentTable.Rows) { bool allProdsDeleted = ScrubProductsTable(parentDataRow.GetChildRows(relation), exclCategories, productExcludeArray); if (allProdsDeleted) { parentDataRow.Delete(); // No children so kill parent } } } private static bool ScrubProductsTable(DataRow[] dataRows, string exclCategories, string[] productExcludeArray) { bool allProdsDeleted = true; // Return value At least 1 row remains foreach (DataRow mDataRow in dataRows) { if (exclCategories.Contains((string)mDataRow["sales_category_id"]) || Array.BinarySearch(productExcludeArray, mDataRow["product_id"]) >= 0) { mDataRow.Delete(); } else { allProdsDeleted = false; // At least 1 child row remains so do not delete parent } } return (allProdsDeleted); }31 мая 2006 г. 20:21 I think the problem was that the DataTable was in a DataSet that was in cache. Perhaps another user was doing the same thing with the same DataSet at the same time. I need to make a copy of the object before deleting rows from it. GarDavis2 июня 2006 г. 18:41 Yes this is very possible. I know a few years ago I was working with a customer who was using DataSet as a cache of data and one thing we did to avoid issues was implement a "copy on write" scheme. So you setup some code where if the caller wants to modify the DataSet they call a special function to get a copy and then modify the copy and when the modification is finished the writer copies over the older copy. The writer "checks out" a copy, modifies the copy, then "checks in" the new copy. Readers always get a static copy since the assignment of a DataSet to a variable is atomic. The only special case scenario you had to watch out for was multiple concurrent writers (we just used a global lock to handle this because writes were relatively rare).2 июня 2006 г. 20:28 - We found that we received this exception due to side effects of BindingManagerBase.EndCurrentEdit that caused a second nested call to EndCurrentEdit OR SuspendBinding. This was due to the way we save our data to the database in our UI and we were able to code around it. The exception never occured in 1.1 of the framework however.23 июня 2006 г. 17:41 - Any news about this issue? I've got the same problem with a multithreaded application. Unfortunately locking is no option because the app is performance critical. In my humble opinion it's a shame that such an essential data type is not working properly for months. This situation is typical for MS, this bug is apparent for months and nothing satisfying happened. You folk's should release the source code, surely somebody would fix this problem for you before you do.24 июля 2006 г. 15:51 I discoverd that this bug only appears if the Defaultview.Sort property has been set and a Column-Value wich belongs to .Sort will be changed. The Exception occured every 10-20 Row-Changes to a Col (included in .Sort). After I eleminated the Sort (now I load the records from SQL Server in order), the exception does not appear any more. Maybe this helps you to find the bug. more info needed, please dont hesitate contacting me. ' -- Code Segment -------------- Private Sub FlexGrid_CellChanged(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) DimRow As DataRow = Me.FindDataRow(e.Row) Dim ColName As String = Me.FlexGrid.Cols(e.Col).ColumnName Try Row( Row( <Reload DataSet From SQL> + continue End Try end sub25 июля 2006 г. 11:44 I got this error too and found a workaround for MY situation but I doubt that it will help anyone else. I'll post anyway though. This is NOT a threading issue in my case. I have a desktop C# application that has a tabbed form. On one of the tabs, there is a date field which defaults to today's date. It is databound to a field on a domain object, but it wasn't binding consistantly to the value, so I used the "Validated" eventHandler to manually set the value. This didn't work consistantly either though. So I changed it to use the "ValueChanged" eventHandler. This copies the value consistantly. However, I began getting this error when I tried replacing the domain object from XML after visiting this tab, whether or not I changed the value. (The ValueChanged handler is called on entry to the tab.) To get rid of this error, before changing the value in the domain object I compared the two values and did not replace them if there was no difference. Don't ask me why, but this worked. I can now change the value and it will change in the domain object, but for some reason, on the first entry into the tab, it screwed something up without the fix. Below is sample code:private void enteredDateDateTimePicker1_ValueChanged(object sender, EventArgs e) {//Manually set the date values if (sender == tDateTimePicker && !domainObject.tDate.Equals(tDateTimePicker.Value)) // I added the second condition to get rid of the error. { domainObject.tDate = tDateTimePicker.Value; } } Cheers, Nathan11 сентября 2006 г. 14:17 Note to everyone who responded to this thread: MANY THANKS! I finally got a repro over to the dev who owns this code and he is fixing the issue now. I'll post back once the fix is available.11 сентября 2006 г. 18:02 I've encountered the same problem in a project i'm currently working on. Has there been any progress on this issue as yet? Cheers21 сентября 2006 г. 6:04 Description of the Problem: I appear to have a similar situation: I have a table with several expression columns which contain information from parent tables. After I delete a row from the table in the dataset using the code below: if { ((DataRowView)this.BindingSource.Current).Row.Delete(); } And then I execute the following code: this this.m_dsStaff.RejectChanges(); The error, " DataTable internal index is corrupted: '5' " occurs on the line this.m_dsStaff.RejectChanges(); Do you have any insights or a work around for this? Additional Info: The variable m_dsStaff references my dataset. This dataset is the DataSource for the BindingSource. The BindingSource is the DataSource for all of the other controls on the form, including a DataGridView. The method EndBindingSourceEdit() is as follows: protected { if (p_BindingSource.Current != null) { if (p_BindingSource.Current is DataRowView) { if (((DataRowView)(p_BindingSource.Current)).IsEdit) { ((DataRowView)(p_BindingSource.Current)).EndEdit(); } } } }21 сентября 2006 г. 18:10 I also have the same problem. Is there any known workaround?26 сентября 2006 г. 10:57 While we wait for the developer to complete the fix, could you please provide some detail as to what scenario the repro exposed as a defect? I imagine there are a number of scenarios that might result in this exception, some of which are valid, such as the case with performing unsynchronized write operations from concurrent threads. Does the repro have anything to do with a DataTable containing DataColumn expressions that reference parent/child relations? Thanks.28 сентября 2006 г. 13:43 Hi folks, I talked to the developer yesturday and got some more detailed information on the root cause of the corruption. Let me detail the cause and this can help you avoid the problem until we have a fix. Note the fix is a bit difficult and requires some rearchitecture of event handling so unfortunately it is not a trivial fix. In general, the issue is caused by user code in a DataView event handler that modifies the underlying DataTable. According to the dev this is not supported (or we never intended for this to work), but I we have not found any mention of this in the documentation. More details from the dev: "Problem is the user is making a write operation during a DataView.ListChanged event; this is not supported in V1.0, V1.1 or V2.0. This is not documented well; I’m still looking for the reference. The workaround is to listen to the DataTable.RowChanged event." So in general the workaround is to examine your code and look at code that is triggered by the DataView.ListChanged event closely. See if you can mode this to DataTable.RowChanged event or see if you can avoid doing modifications to the DataTable in the DataView.ListChanged event. Matt28 сентября 2006 г. 16:24 From my experience I can tell you that the DataView.ListChanged Event could not be the 'only' reason for this bug. I'm not using DataView.ListChanged at all, but from time to time my useres run into the bug. Otherwise I can not rule out now that it could caused by events like BindingManager.CurrentChanged. I'm using that to handle sort of master/detail dependecies. Stefan29 сентября 2006 г. 7:00 I get this error when I've bound a DataTable to a DataGridView, and then I edit the value in the column that the DataGridView is being sorted by. I never even go near the ListChanged Event.5 октября 2006 г. 6:59 - I have managed to reproduce this problem without using the ListChanged events also. I have a form, with controls that are bound to a BindingSource. The error is caused when I am adding a new record and I want to set a field that I dont have a control for, which I am doing by BindingSource.Current("FieldName") = value. The error is then thrown on the Adapter.Update command.6 октября 2006 г. 8:24 - I have the same problem as everyone else as described, I am modifying a column that's listed in the .Sort property. I have a DataGridView bound to a DataTable, and during updates to the table everything works fine until I sort by a particular column, and start modifying the values in the column. After 10-15 or some odd number of field changes to that column, the whole program crashes and it won't even catch the exception. I don't listen for ListChanged, or RowChanged. I don't write anything during those events. If the ListChanged workaround is the case, the DataGridView is the one listening and modifying data. How do we prevent the DGV from doing anything?11 октября 2006 г. 2:17 - I removed DataGridView from the equation and manually set the DataTable.DefaultView.Sort property to a column that's being modified, and sure enough after a few updates to the column in the .Sort property: A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll() Code: Table.DefaultView.Sort = "ColumnBeingEdited"; int i = 0; foreach (DataRow dr in Table.Rows) { dr.BeginEdit(); dr["ColumnBeingEdited"] = ++i.ToString(); dr.EndEdit(); } I didn't even have to bind anything, but I did have to call the foreach() method via button click a couple times to finally corrupt it (the number of times seems to be random and based on the amount of rows in the table.) Hope this helps!11 октября 2006 г. 14:00 Ran this fairly simple code all day, no corruption, can you modify this code to make the problem reproduce? private string RandomString(int totalLength, Random rnd) { StringBuilder sb = new StringBuilder(totalLength); char ch = 'A'; for (int i=1; i<=totalLength; i++) { sb.Append(ch+((char)rnd.Next(0,25))); } return sb.ToString(); } static DataTable Table = null; static Random rnd = new Random(Environment.TickCount); private void button14_Click(object sender, EventArgs e) { if (null == Table || rnd.Next(1,10) < 5) { Table = new DataTable("table1"); Table.Columns.Add("f1",typeof(string)); int stringLength = rnd.Next(5,100); int rowCount = rnd.Next(10,1000); System.Diagnostics.Debug.WriteLine("stringLength=" + stringLength + " rowCount=" + rowCount); for (int i=1; i<=rowCount; i++) { DataRow r = Table.NewRow(); r["f1"] = RandomString(stringLength, rnd); Table.Rows.Add(r); } Table.DefaultView.Sort = "f1"; } int rowValue = 0; foreach (DataRow dr in Table.Rows) { dr.BeginEdit(); dr["f1"] = (++rowValue).ToString(); dr.EndEdit(); } System.Diagnostics.Debug.WriteLine("Done!"); }12 октября 2006 г. 16:07 - Argh! I had it reproduced with simple code and now I can't do *anything* to reproduce it, only in very rare circumstances. Back to the drawing board.13 октября 2006 г. 18:33 - Alright, now I can easily reproduce it 100% of the time without threads or binding (sorry to paste this much code): /* Note, when you remove the .Sort, you won't get the corruption. */ public static DataTable Table; public System.Threading.Timer ChangeColumns; public Random random; public System.Windows.Forms.Timer timer; public Form1() { InitializeComponent(); random = new Random(); Table = new DataTable(); DataColumnCollection cols = Table.Columns; cols.Add("Column1", typeof(String)); cols.Add("Column2", typeof(String)); cols.Add("Edited", typeof(CellObject)); for (int i = 0; i < 1000; i++) AddRandRow(); Table.DefaultView.Sort = "Edited"; //dataGridView1.DataSource = Table; timer = new System.Windows.Forms.Timer(); timer.Interval = 500; timer.Tick += new EventHandler(timer_Tick); timer.Start(); } void timer_Tick(object sender, EventArgs e) { EditColumns(); } void EditColumns() { foreach (DataRow dr in Table.Rows) { dr.BeginEdit(); ((CellObject)dr["Edited"]).test1 = random.Next(0, 1000); ((CellObject)dr["Edited"]).test2 = random.Next(0, 1000); dr.EndEdit(); } } public void AddRandRow() { DataRow newRow = Table.NewRow(); newRow.BeginEdit(); newRow["Column1"] = random.Next(0, 500); newRow["Column2"] = random.Next(0, 500); CellObject c = new CellObject(random.Next(0, 500), random.Next(0, 500)); newRow["Edited"] = c; newRow.EndEdit(); Table.Rows.Add(newRow); } } public class CellObject { public int test1; public int test2; public CellObject(int a, int b) { test1 = a; test2 = b; } public override string ToString() { return test1.ToString(); } }13 октября 2006 г. 19:11 - Cool, I can reproduce using the above code, I'll check with the dev to verify if this falls under the same scenario or not.13 октября 2006 г. 20:28 Hello Matt Neerincx: Has any news ?I Have meet this problem! октября 2006 г. 8:26 I got this error in diffrent Situation 1.I have a datatable in client side(Winform) ,i am mergeing it with a datatable which is from data access layer and binding it to datagrid for display as shown below dtPhoto.Merge(Objphotos.Get_PhotoInfo(strWarrant_Number),True) dtPhoto.AcceptChanges()Me.DGPhotoView.DataSource = dtPhoto 2.From the datagridview user can select any row of data and delete it and rebuinding i to grid view. dtPhoto.Rows(RowNumber).Delete() dtPhoto.AcceptChanges() Me.DGPhotoView.DataSource = dtPhoto 3. New row is added to same datatable as belowDim Photodetailsrow As DataRow Photodetailsrow = dtPhoto.NewRow() Photodetailsrow.BeginEdit() Photodetailsrow("Photo_Date") = StrPTDate Photodetailsrow("Photo_Time") = StrPtakenTime Photodetailsrow("Photo_View") = strPTView Photodetailsrow("File_Path") = strFilePath Photodetailsrow.EndEdit() dtPhoto.Rows.Add(Photodetailsrow)<---Line of code throws Exception: DataTable internal index is corrupted: '5'. on ... dtPhoto.AcceptChanges()Return dtPhoto Can any one help me to fix this please ,27 октября 2006 г. 19:31 Is there any progress on this matter? Is there going to be a fix avalible soon?31 октября 2006 г. 10:24 - No progress yet, no news on a fix for this either. I'm working with an ISV to push for a fix.31 октября 2006 г. 18:53 thanks, while we wait for a fix, is there a good workaround for this bug? I've tried the beginloaddata - endloaddata workaround, did not work for me.1 ноября 2006 г. 2:07 Matt, I am getting this error too. Is there anything more you can tell us so we can try to workaround this problem? None of the workarounds mentioned so far have any effect. If we could at least understand the detailed conditions/scenarios that trigger this error, it would help us come up with new ways to try to work around it. Thanks.2 ноября 2006 г. 22:34 The three possible root causes thus far are: 1. Multi-threaded modification of a DataSet/DataView/DataTable. Most customers indicated that they were not doing this. 2. Modification of DataSet/DataView/DataTable inside a ListChanged event handler. 3. Modification of a DataSet/DataView/DataTable that contains a custom type that is not defined as serializable. For example suppose you have a DataTable with column of type MyCustomClass and this class is not defined as serializable. Here is current list of workarounds: ноября 2006 г. 23:50 - Matt, I turned CellObject into a Serializable object and I still receive the same error. Were you able to fix the custom class corruption by making it serializable and if so, how did you do it?7 ноября 2006 г. 15:26 Matt Mine is a web application which has a datagrid (about 20000rows) throws up index corrupted error even with concurrency of just 2 users I modified the code such a way that datatable.copy() is done and a view is created but still problem persists, is there any hotfix? dataTable = GetProductsData(dataTable) Dim dtCopyTable As DataTable = dataTable.Copy dtCopyTable.DefaultView.Sort = hdnSortExpr.Value 'This is a hidden control which contains sort expression dgSims.DataSource = dtCopyTable.DefaultView hdnSort.Value = "0" dgSims.DataBind() Siva11 ноября 2006 г. 10:35 I've the same error. My application is a smart client which connects throug a webservice to dynamics ax. The Data from the Webservice comes as dataset and is merged to a local dataset. This is done without threading. Getting new data and inserting data (via merge) is allright, but sending changes of the local dataset and merging the returned data corrupts the index. I hope to get a fix soon :)15 ноября 2006 г. 8:39 Hi Matt! Is there any news on this topic. /Anders15 ноября 2006 г. 15:10 I just received this very, very serious Exception... and I see that is has not been fixed over the course of many months. This bug or bug complex apparently means that I cannot deliver a reliable Windows Forms application - one that does not crash. Please... when is it going to be fixed? System.InvalidOperationException was unhandled by user code Message="DataTable internal index is corrupted: '5'." Source="System.Data" StackTrace:aTable.RejectChanges() at System.Data.DataSet.RejectChanges() at Extensive.Subscription.Views.Wizard.SubscriptionViewPresenter.SaveSubscriptionInfo(SubscriptionInfoDataSet theDataSet) in E:\r\extensive-dev\trunk\technical\app\RLS\RLS-SCSF\Source\Subscription\Subscription\Views\Wizard\SubscriptionViewPresenter.cs:line 141 at Extensive.Subscription.Views.Wizard.SubscriptionView.paymentIntroWizardPage_BeforePageDisplayed(Object sender, WizardCancelPageChangeEventArgs e) in E:\r\extensive-dev\trunk\technical\app\RLS\RLS-SCSF\Source\Subscription\Subscription\Views\Wizard\SubscriptionView.cs:line 752 at DevComponents.DotNetBar.WizardPage.OnBeforePageDisplayed(WizardCancelPageChangeEventArgs e) at DevComponents.DotNetBar.WizardPage.0B0(WizardCancelPageChangeEventArgs 6H5) at DevComponents.DotNetBar.Wizard.0BR(WizardPage 6HT, eWizardPageChangeSource 6HU) at DevComponents.DotNetBar.Wizard.NavigateNext() at DevComponents.DotNetBar.Wizard.0BK(Object 6HJ, EventArgs 6HK))18 ноября 2006 г. 22:24 Hi Matt! I've got same problem on a Windows app. without using multiple threads. VB.Net. Is there any progress in solving the "index is corrupted:'5'" Error? Regards. Anders21 ноября 2006 г. 10:54 - Anyone with a solution ??? Non of the workarounds works for me!!!30 ноября 2006 г. 14:21 For your information, my complete error message is Exception: System.InvalidOperationException: Der interne DataTable-Index ist beschädigt: '5'. bei System.Data.DataTable.RestoreIndexEvents(Boolean forceReset) bei System.Data.Merger.MergeTable(DataTable src, DataTable dst) bei System.Data.Merger.MergeTableData(DataTable src) bei System.Data.Merger.MergeDataSet(DataSet source) bei System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges, MissingSchemaAction missingSchemaAction) What I do (without threading) is that I call GetChanges of a Dataset and sent this data to a webservice. This webservice returns the same dataset (with some changes) to the caller. The retrieved DataSet is merged to the originally one.3 декабря 2006 г. 23:15 - No news yet on a fix, sorry I have no good news yet.4 декабря 2006 г. 17:56 Hello Matt, i have some new informations for you, because I solved my problem. Two posts up you can read what I did. In short I have a smart client which sends data through a webservice. I got it to work with using RejectChanges! a) The Smartclients sends a dataset (with changes in e.g. one row) to the webservice. (with .GetChanges) b) The webservice processes the dataset and althoug changes in this row. He sends back the dataset c) The Smartclient calls RejectChanges on his local data, and then merges the data from the webservice ---- Some more news. I tried an extra project to send and load the data to my webservice. I couldn't reproduce the bug in this new project. So my webservice should be ok and the problem is with merging the data on the local side, maybe because there are databindings active.4 декабря 2006 г. 22:19 Hi, what's up? Why does it take so long to fix this bug? I can't understand that. Can you reproduce it? What do you need? We can help you, but please, make something going on..... By the way, one more Exception of that type: System.InvalidOperationException: Der interne DataTable-Index ist beschädigt: '5'. bei System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 position) bei System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 position) bei System.Data.Index.InsertRecord(Int32 record, Boolean fireEvent) bei System.Data.Index.ApplyChangeAction(Int32 record, Int32 action) bei System.Data.Index.RecordStateChanged(Int32 oldRecord, DataViewRowState oldOldState, DataViewRowState oldNewState, Int32 newRecord, DataViewRowState newOldState, DataViewRowState newNewState) bei System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2) bei System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception& deferredException) bei System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Boolean fireEvent) bei System.Data.DataTable.RejectChanges() bei System.Data.DataSet.RejectChanges()22 декабря 2006 г. 13:07 Dear Matt, I am a developer which is part of team working on project implemented by C# and .NET 2 (recently also .NET 3). We are having problem with DataTable throwing exception "Internal index is corrupt '5'" sometimes. It does not happen consistnently, but it happen in certen places. I follow the msdn forum thread about this exception and I saw you post a solution. It is not exactly clear to me and I hope you can explain it in more details. Specificly, you said that one should not write to the table on DataView.ListChanged event handler, but in .NET 2 you add the great class BindingSource, which we use heavily in our project, and we use BindingSource's event also. Also we notice that when you bind a DataTable to a BindingSource it actualy use the default DataView of that table, also when you set the Filter property of the BindingSource it set the Filter property of the default view. Any way, does the BindingSource class event use DataView events internally and so I should not change the DataTable using BindingSource events? Thank you very much, Ido Ran.28 декабря 2006 г. 7:13 - If it's helpful to anybody out there, I present the following example... I'm updating a DataTable that's a member of a typed DataSet on a row-basis (i.e. an update message comes into my app, I find the row, and apply the update to the row). I was having the same problem, but I found that calling .BeginEdit() and .EndEdit() on the row solves it for me. In addition, I have a SyncLock on the DataSet, and wrap the update in the DataSet's .BeginLoadData() and .EndLoadData methods. Here's the code I'm talking about (it's kinda sloppy, but whatever, it works): SyncLock DsConsole1.StatusMain Try DsConsole1.StatusMain.BeginLoadData() Using oRow As DSConsole.StatusMainRow = _ DsConsole1.StatusMain.FindByObjectName(ObjectName) With oRow .BeginEdit() .Status = Status .FailCount = FailCount .LastUpdate = EventTime .EndEdit() End With End Using DsConsole1.StatusMain.EndLoadData() Catch ex As Exception 'Logging happens here End Try End SyncLock I'm not sure if the SyncLocks or the .BeginLoadData() or .EndLoadData() are necessary or not -- they may not be... I put them in there before I remembered .BeginEdit() and .EndEdit(), but it works, and I'm getting close to my deadline, so at this point, I'm not willing to tempt fate by tinkering with it any more. I haven't read the entirety of this thread, so if this is redundant info I apologize, but I hope this may help someone. Happy programming!29 декабря 2006 г. 1:44 I was running into the same issue and found this thread looking for answers. FWIW, I was able to get the problem to go away by removing the calls to DataRow.BeginEdit() and DataRow.EndEdit() which I had wrapped around my data updates. I'm not sure what the side effects of removing these calls will ultimately be, but since I'm using "raw" data rows (e.g. no constraints or validation) I'm hoping that there won't be any. Still looking forward to a full resolution/explanation.16 января 2007 г. 19:43 Hi folks, Another update. I realize I have not been very responsive here but there has not been much news over December on this issue. I found a customer a few weeks ago that is pushing for a QFE for this issue so we are getting some traction on getting this fixed now, the dev is working on a fix. So hopefully soon we should have a fix for this available and when this happens I will post back with the details. I've provided the dev with all of the repros you guys have posted over the past few months for testing out the fix. Matt16 января 2007 г. 21:54 - Hi Matt, our software group is currently experiencing the same issue. Looking forward to a fix!!!19 января 2007 г. 19:16 - Any word on a fix? None of the other solutions have worked for me.8 февраля 2007 г. 21:44 Hi Guys... I just feel we're left alone on this matter... I'm getting the "DataTable internal index is corrupted: '5'" exception when trying to apply changes to a datatable by doing Form.Validate(), BindingSource.EndEdit(). When execution gets to the EndEdit() method the exception is raised, sometimes. My case is a WinForm with a datagridview bound to a binding source with a typed datatable as the datasource. The lower area of the form has textboxes and comboboxes which allows for data entry. They are also bound to the BindingSource object. When I add a new record using bindingSource.AddNew() method, fill it with some data using the form, and immediatly click on the save button (which calls the methods described above) everything is fine. The record is in the db. If instead I want to create two or more new records, things get screwed up. there is a case when i add two records and just after editing the last field for the last new record, i click on save. I do Form.Validate() and when i call the BondingSource.EndEdit() method to apply changes to the datatable, I get the exception DataTable internal index is corrupted: '5'. this behaviour doesn't happen if the user navigates through the datagridview after adding the last records. Pier10 февраля 2007 г. 9:23 - Hi Matt, just to update the list of possible reasons. I use a multithreaded application and get a "Der interne DataTable-Index ist beschädigt: '13'." exception: " bei System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) bei System.Data.Index.GetRows(Range range) bei System.Data.Index.GetRows(Object[] values) bei System.Data.DataRelation.GetChildRows(DataKey parentKey, DataKey childKey, DataRow parentRow, DataRowVersion version) bei System.Data.DataRow.GetChildRows(DataRelation relation, DataRowVersion version) bei System.Data.DataRow.GetChildRows(String relationName) bei PubChemMassSearcher.Form1.bgw_statistics_DoWork(Object sender, DoWorkEventArgs e) in C:\\Dokumente und Einstellungen\\jahu\\Eigene Dateien\\Visual Studio 2005\\Projects\\DB_Tools.root\\xxx\\Form1.cs:Zeile 707. bei System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) bei System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)" I want to access the childrows using GetChildRows(). Programming my application with one BackGroundWorker anything goes well. However, introducing multiple BackGroundWorkers to read in the DataSet this exception is thrown. Any of this BackGroundWorker trys to get a List of ChildRows according to a given row index in the parent data table. Any help is appreciated! with kind regards Jan11 февраля 2007 г. 22:02 - Yes I have not forgotten about this thread. I just emailed the PM to get a status update, he should post back soon.14 февраля 2007 г. 6:31 Any updates? I'm having a similar problem. Thanks!1 марта 2007 г. 23:49 Ok, we finally have a fix for this issue. Sorry for the delay on this. You can call product support and get the fix for free (there is no charge to call and get a fix). Call Microsoft Product Support and ask for fix for KB 932491. Thanks to everyone for sending me repros for this, it helped when we did the fix to ensure we fixed the problem!2 марта 2007 г. 4:00 No fix with the code yyou've given exists in Microsoft->Product Support->Knowlede Base and I also waited on the phone for 15 min, without any answer or result. If calling and getting the fix is free of charge, why don't you just give a link to download site?2 марта 2007 г. 7:51 There is no download site for this fix and the KB is not public yet. This is a hotfix, we don't normally have a download site for a hotfix, you have to call support and they will get it for you. Not sure exactly why we do things this way, but keep calling support and tell them you want the fix and they should be able to fetch it internally (I verified this much).2 марта 2007 г. 8:22 - MSDN and the technical deparment can't find this given hotfix number???2 марта 2007 г. 11:33 Yes, they can not find it :)2 марта 2007 г. 13:03 Hello, the first who gets it, could just post a link or a email address for requests. I'm from Italy and it could be a while for Ms Italia to actually distribute the hot fix. Pier2 марта 2007 г. 17:39 - Tell support folks to search web site using KB number 932491 or they can search for fix name vsuqfe4769. It's available internally I already checked this.2 марта 2007 г. 17:54, I will post back when I have more info.2 марта 2007 г. 18:03 Update to my saga.. Then they took me off hold and said what version of SQL Server did I want the fix for (which was strange) so I said I wanted the fix for 32-bit SQL Server 2005 and .NET Framework 2.0. This seemed to make them happy a bit and then they put me on hold again. Took me off hold in 30 seconds and said my case number was SRX 070302 601587. Then put me back on hold. So tell the support person you want the same hotfix that the guy for case #SRX070302601587 got, that should save some time as they put notes in the case usually explaining what happened. I'm back on hold again, thank goodness for speakerphone so I can get some work done.2 марта 2007 г. 18:17 Ok, to get the fix: Call 1-800-936-3500 and choose: 1. for support 3. for developer support. 1. for hotfix. Once you get someone on the line tell them you want the fix for KB 932491. Be sure to tell them that the KB is not public yet but the hotfix is available. Tell them that a Microsoft developer called into support and created case #SRX070302601587 and that the case notes for this case should have the details on how to get the fix.2 марта 2007 г. 21:31 I called MS support in germany and received the patch the same day ! stefan3 марта 2007 г. 9:23 - Kannst mit den mal schicken. Oder sage wo anrufen und ob man da einen Support Vertrag braucht. Ich find die richtige Nummer nicht. Kannst mit den mal schicken. Oder sage wo anrufen und ob man da einen Support Vertrag braucht. Ich find die richtige Nummer nicht. Andreas(AT)Rudischhauser.de einfach bei der Geschäftskundenbetreuung anrufen ... klappt problemlos. Privatkundenbetreuung Tel.: 01805 / 67 22 55* Geschäftskundenbetreuung Tel.: 01805 / 67 23 30* Partnerbetreuung Tel.: 01805 / 30 25 25* Hello, I have manage to get the QFE 932491 from Microsoft Support after 3 days. I am sorry to say that I am still having InvalidOperationException with "Internal Index is curropt 5" after applying the fix. I have checked that some of the files were replaced by the fixed files. I also watch with Reflector on the fixed files and I notice the use of ReaderWriterLock in DataSet, DataTable and other classes in System.Data. The thing is in my application I belive the curropting of indeces occurs in a single thread. Are there any debug files or something I can do to get logs of what is happening during the executing of my application so I can deliver those to Microsoft for analysis? Thank you, Ido.9 марта 2007 г. 9:26 - Post a code sample if possible and we'll take a look.12 марта 2007 г. 5:08 Dear Matt, We are trying to repreduce the excpetion in a project seperate from out large project. I hope we will be able to do it soon and we will post the code as soon as possible. I watch the code of the BCL wtih Reflector and I saw there is a log component (BID) in almost each method in the framework. Is it possible to capture that log and send it to you. I am asking this because inside our system we are able to repreduce the problem almost consistently. Thank you for your help, Ido.15 марта 2007 г. 19:33 Yes, you can try this. Here is a good article that explains how to enable the tracing -> марта 2007 г. 20:14 Hi, I am just wondering what the test conditions are for the bug fix that have been released... does it only address situations where this error occurs under multithreaded access? I get this exception randomly in a single-threaded application that has multiple C1TrueDBGrids bound to the same datatable. I am not able to reproduce the error on my development machine. Also, the error seems to occur at different spots in the program. Sometimes it occurs within the C1 grid itself. (See below.) We haven't applied the KB yet. Thanks..DataTable.GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter) at System.Data.DataView.UpdateIndex(Boolean force, Boolean fireEvent) at System.Data.DataView.UpdateIndex(Boolean force) at System.Data.DataView.SetIndex2(String newSort, DataViewRowState newRowStates, DataExpression newRowFilter, Boolean fireEvent) at System.Data.DataView.SetIndex(String newSort, DataViewRowState newRowStates, DataExpression newRowFilter) at System.Data.DataView.set_Sort(String value) at System.Data.DataView.System.ComponentModel.IBindingListView.ApplySort(ListSortDescriptionCollection sorts) at C1.Win.C1TrueDBGrid.BaseGrid.Frame.a(ListSortDescriptionCollection A_0) at a0.m(Int32 A_0) at C1.Win.C1TrueDBGrid.BaseGrid.View.OnClick(Point p) at C1.Win.C1TrueDBGrid.Split.OnClick(Point p) at cc.b(Point A_0) at C1.Win.C1TrueDBGrid.BaseGrid.Frame.doClick(EventArgs e) at C1.Win.C1TrueDBGrid.C1TrueDBGrid.doClick(EventArgs e) at C1.Win.C1TrueDBGrid.BaseGrid.Frame.OnClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at C1.Win.C1TrueDBGrid.C1TrueDBGrid)15 марта 2007 г. 22:14 Hi Matt, Thank you for the information about BID log. I will try to turn it on and gather the information. Can you direct me to what is the most important thing to collect and how should I send the logs once I will collect them? Thank you, Ido.17 марта 2007 г. 16:46 I'm sorry to say that I have also obtained the fix and still have the problem. I happened to find this thread earlier in the week when I first encountered the problem. I called support and got the fix - but it didn't work. I'm still getting: DataTable internal index is corrupted: '5' when I try to change a value in one particular datagridview in my application. The other datagridviews seem to work just fine. 8 of the 9 datagridviews in my application are bound to binding sources, including the one giving me the problem. There is only one thread in my application at the time. At this point I'm able to reproduce the problem very reliably. I'd be happy to send you my entire project offline if it'll help. Mike17 марта 2007 г. 21:49 Dear Matt, I have collect the log of BID interface when the exception occur. Can you pelase send me you email address to ido.ran@gmail.com so I could send you the log. I do not wish to publish the log on this forum. Thank you, Ido.27 марта 2007 г. 17:43 Dear Matt, I think we have found the reason for "Internal Index is curropted 5" exception in our system. We are using DataSet and BindingSources on this DataSet. We are also registering for BindingSource's CurrentChanged event to detect that the user select a different record in a grid. Inside the handler of CurrentChanged we are calling AcceptChanges for some of the DataRows in the DataTables. Now, when we are binding a DataTable to BindingSource the BindingSource actually use the DefaultView of that table and then the BindingSource is registered to the View's ListChanged event to raise its own CurrentChanged event. I have looked at the call stack to verify this. As you wrote in previous post, when listening to DataView's ListChanged event and changing the underlying DataTable index currption may occur. Do you have any idea how can I deffer the action on the DataRow to later time. Something like using SendMessage or PostMessage in Win32 applications to deffer the action for the next message pump cycle? Thank you, Ido.29 марта 2007 г. 14:02 - I also have a partial resolution to my problem. It seems to be related to the C1TrueDBGrid. Calling C1TrueDBGrid.UpdateData in the C1TrueDBGrid.Leave event seems to resolve the problem. I have also noticed a case where the grid was not updating changes to the underlying dataset immediately on losing focus.29 марта 2007 г. 14:26 Yes I did something like this with an application I wrote a few years ago (I was creating records on a background thread and pumping them to UI thread). I did something simple like this -> private MethodInvoker miDoOnUI = null; private void DoSomethingOnUIThread() { // Add code here... } public void SomeFunction() { if ( null == miDoOnUI ) miDoOnUI = new MethodInvoker( this.DoSomethingOnUIThread ); this.BeginInvoke( miDoAsync ); // This works if SomeFunction is a method of some System.Windows.Forms.Form derived class... }29 марта 2007 г. 17:51 Dear Matt, Thanks for the sample. My case is a little different because the update of the data occurs on the UI thread, so the CurrentChanged event handler is also executing on the UI thread. I thnk I have managed to deffer the update of DataTable and still keep it on the UI thread by using SynchronizationContext.Post method. Because I am running a Windows Forms application my SynchronizationContext.Current will return an instance of WindowsFormsSynchornizationContext. I have read the code using Reflector and did some testing and Post method of WindowsFormsSynchornizationContext uses PostMessage Windows API. This way I can deffer the update of the DataTable to the next windows message pump cycle. After making that change I did the actions which usually causing "Internal Index is curroped 5" excpetion and I was not able to repreduce the problem. Next week I will report again and tell you if it really help. Ido Ran.30 марта 2007 г. 9:05 I got this exception too, i think, the corruption takes place earlier before the exception occurres, only the next usage of the index throws the exception, but not the action that corrupts the index. Why does MS not check the index after each (wrong) modification, so it would be verry easy to find the code that corrupts it? My question is, how can i refresh or rebuild the index, so that it is no longer corrupted? (As i have seen, a lot of users working with TrueDBGrid, this has a wrong list changed handler, that does not work correct after clearing a table an reload it with new data) Can we have hope for a correct solution of this problem by MS? Tnx Roman2 апреля 2007 г. 11:37 OK, for what it's worth, I've encountered this problem as well. I have nailed the source of the problem down to the index that is attached to a DataGridView control within my app. The only way I found to sort out the problem was to force the DataGridView to rebuild its index. I did this by executing a MoveLast() followed immediately by a MoveFirst() when I'd finished adding new rows to the list. I know it's not particularly elegant but it worked for me.12 апреля 2007 г. 6:29 I used to get this error in my in a couple of my web apps. These apps are built using a common code base in the form of webcontrols. recently i change the code that does sorting and selecting on datasets to use dataviews rather than using the select() method on the datatable. After doing this the error started to return '13' rather than '5' in the error above. The other thing I have observed is that out of 6 web apps built using these controls (all used decleratively ONLY i.e. no code behind on the web pages) the ones throwing this error uses sort functionality on columns of the dataset that potentially get changed if the value for a particular row is null or empty for example. In my case i think threading can play a part also as these datasets are cached using the Cache API but sorting/selecting/dataviews also play a part. I'm going to try and come up with some code to repro this to confirm it is this so will post here as and if.16 апреля 2007 г. 23:14 I got the same error message yesterday. Followed the guidelines to get the fix. Support was great but really bizarre. Can I have this hotfix? Sorry the hotfix doesn't exist. Yes it does, it's just not public. Well if it's not public, how did you get it? I Googled it and found it on the Microsoft forum. Well, you still can't have it - it's not public. But it says right here that "Once you get someone on the line..." where upon I was transfered to developer support. Suddenly, the image of Charlie Sheen going up the river to Cambodia on a patrol boat with self-dialog and really cool 60's rock music playing in the background popped into my mind. Developer support was great - gave me the hot fix - and, voila, the problem went away. :-)18 апреля 2007 г. 12:20 Hi, Any updates on this? It seems like for me sorting and updating datatables directly i.e. datatable.select() gives DataTable internal index is corrupted: '5'. and doing the same via DataViews gives DataTable internal index is corrupted: '13'. These datatables are cached using the Cache API before they are processed on so multithreading may be an issue. However I have not been able to re create this in test code. Anybody else come across this scenario? Any code to recreate ?25 апреля 2007 г. 11:35 I'm also getting this error, but its when executing a RejectChanges() after a failed delete operation. This dataset is bound through a binding adapter to a datagridview. I have three other datasets that are also bound the same way, but do not have the issue. My application is not multithreaded (unless the datagridview or bindingsource are). I haven't tried the hot fix yet, but I had another thought. Since I plan to distribute this application commercially, what good will the hot fix do me? Can I update the .Net Framework code when the user installs the application? Based on the amount of activity I've found on the web related to issues with datasets (especially with .Net 2.0), is it better to just stay away from datasets altogether?26 апреля 2007 г. 22:31 Okay, I seemed to have given up too soon. As it turns out, the answer was to move where I was issuing the updates. I was using the RowChanged and RowRemoved event of the datagrid to issue my updates to give the user the same experience as a spreadsheet. The proper place to do this appears to be by handling the RowChanged and RowDeleted events of the datatable. I add a handler in my business class and issue the updates from there. This works perfectly, and does not give me the internal index is corrupted error. I assume that either the datagridview or the binding adapter must create a dataview behind the scenes and this causes the error.27 апреля 2007 г. 0:50 Dear John, I think I have expreience the same problem you have with updating the DataSet to a database in the RowChanged of the DataGridView. I have also move it to the RowChanged of the DataTable and it seem to fix the problem. The thing is it is not always fix the problem. Please read my messages in this thread about using SynchornizationContext to ensure it will work prefectly. Cheers, Ido.28 апреля 2007 г. 5:06 - I was able to consistently reproduce this error in an application I'm writing. My code handled the RowChanged event of the dataTable itself (not a dataGridView) in multiple places.. I managed to find the particular handler that was causing the problem, and the only touching of the dataTable that I could find was to set a value in the row and to call beginEdit() on the row. I changed the handler so it didn't do either of these things and that seemed to fix the problem. I tried to write a sample application to reproduce the problem but was unable to, even though I did the same things (calling beginEdit() and changing a row in the rowChanged event of the table) so there must be more going on, but I couldn't figure out what it was.9 мая 2007 г. 16:37 I have an Access database with related tables and when saving one time my program for some reason froze in the middle of saving. Later when I opened it it had only some records saved as expected. The funny thing is when I went to add a related record I got the error: Message: DataTable internal index is corrupted: '5'. I clicked the button again to add a record and got: Message: DataTable internal index is corrupted: '5'. Target Site: Int32 RBInsert(Int32, Int32, Int32) Stack Trace:) ............. My program opens different database files and other access database files were woring fine but that specific one was giving an error so I thought it was the database. I opened it in Accesss and did compact and repair and the next time I opened it it worked fine like it was supposed to. I knew this was a problem with no real known cause or solution so I made a backup of the database first. I looked at it again and the way it works is it adds records with a number as the count. For example the first record would be called "Record 1" then "Record 2" and so on. Like I said my tables are related so I had: Level 1 Record "Record 1" Level 2 Record "Record 1" Level 3 Record "Record 1" Level 4 Record "Record 2" Level 3 Record "Record 2" (Was not in the database but to show the structure) Level 4 Record "Record 1" (Was not in the database but to show the structure) If you can see how the record giving me problems was adding a record under Level 3 Record "Record 1" giving me an error. After clicking twice to add I got the new record but it was numbered 2 which should have been Record 2. These numbers come from the record counts so there was another record in the table but "lost" not connected to a parent so I got the number 2. After finally getting this record added I tried saving and got an error. So I assume because the file failed to save the first time it got corrupted and in turn corrupted my dataset. I guess if you're having this error in Access databases try a compact and repair.11 мая 2007 г. 2:31 I have reproduced this issue in a very simple windows app, no listchanged events, no threading. I have the patch from earlier in the thread applied. Please let me know if others can get this code to reproduce the error. I narrowed this down from a much larger project. It reproduces for me everytime. I got it down to the point where changing the AllowDBNull on Column Term from False to True cures the problem. The funy thing is the particular column is never referenced in the project. Helluva fun way to pull an all nighter.... I'm not sure how to post the Typed DataSet since the designer code is so large. The name of the typed dataset is dsQuote. It contains 1 table call dtQuote. dtQuote has 4 fields: QuoteID (AutoIncrement=True, AllowDBNull=False,DataType=System.Int32,Unique=True, PrimaryKey) Term (AllowDBNull=False, AutoIncrement=False,DataType=System.Int32,Unique=False, DefaultValue=12,NullValue=0) TotalCost(AllowDBNull=True, AutoIncrement=False,DataType=System.Decimal,Unique=False, DefaultValue=0,NullValue=0) FinancedItemsAmount(AllowDBNull=True, AutoIncrement=False,DataType=System.Decimal,Unique=False, DefaultValue=0,NullValue=0) P.S. Sorry if there is a better way to post code:Code Snippet using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication2 { public class SampleControl : TextBox { public SampleControl() : base() { } private object _value; public virtual object Value { get { return _value; } set { if (_value != value) { _value = value; this.Text = _value.ToString(); } } } } public class frmParent : Form { private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new SampleControl(); this.SuspendLayout(); this.button1.Location = new System.Drawing.Point(461, 207); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 1; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); this.textBox1.Location = new System.Drawing.Point(25, 13); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 2; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(624, 266); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Name = "frmParent"; this.Text = "frmParent"; this.ResumeLayout(false); this.PerformLayout(); } private System.Windows.Forms.Button button1; private SampleControl textBox1; dsQuote _dsSample1 = new dsQuote(); public frmParent() { InitializeComponent(); textBox1.TextChanged += new EventHandler(textBox1_TextChanged); _dsSample1.BuildBindings(); _dsSample1.ReadXml(Application.StartupPath + "\\abcde.agq"); Binding _binding = new Binding("Value", _dsSample1.bsQuote, _dsSample1.dtQuote.FinancedItemsAmountColumn.ColumnName, true, DataSourceUpdateMode.OnPropertyChanged); _binding.ControlUpdateMode = ControlUpdateMode.OnPropertyChanged; textBox1.DataBindings.Add(_binding); } void textBox1_TextChanged(object sender, EventArgs e) { if (_dsSample1.bsQuote.Position < 0) return; dsQuote.dtQuoteRow dqr = _dsSample1.dtQuote[_dsSample1.bsQuote.Position]; dqr.TotalCost = 10000; dqr.FinancedItemsAmount = 50; } private void button1_Click(object sender, EventArgs e) { Decimal financedFeeAmount = 0; dsQuote.dtQuoteRow dqr = _dsSample1.dtQuote[_dsSample1.bsQuote.Position]; dqr.FinancedItemsAmount = financedFeeAmount; } } } The file referenced in thecode is listed below:Code Snippet <!-- <?xml version="1.0" standalone="yes"?> <dsQuote xmlns=""> <dtQuote> <FinancedItemsAmount>1000</FinancedItemsAmount> <TotalCost>1000</TotalCost> <Term>36</Term> <QuoteID>0</QuoteID> </dtQuote> </dsQuote> --> The following code is in the file dsQuote.csCode Snippet public partial class dsQuote : System.Data.DataSet { public void BuildBindings() { _bsQuote.DataSource = this.dtQuote; } private BindingSource _bsQuote = new BindingSource(); public BindingSource bsQuote { get { return _bsQuote; } } }7 июня 2007 г. 9:39 Hello there. I'm not sure, if my problem is the same as the one, discussed in this thread. But it looks related to me and I didn't finde any thing else on the internet looking like my exception. The Application has many threads, but all Calls changing the DataSet are laid on a System.Collections.Generic.Queue (using Reflection) and invoced by one thread in the background. It's a "IndexOutOfRangeException" with the message "An der Position 1386 befindet sich keine Zeile." and following StackTrace: bei System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) bei System.Data.DataTable.EvaluateExpressions() bei System.Data.Merger.MergeDataSet(DataSet source) bei System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges, MissingSchemaAction missingSchemaAction) bei System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges) bei CDBaisys.CDB.loadData(IDbDataAdapter da, String TableName, String SourceTable, Boolean ReadOnly) in N:\aisys\aisys\CDB\CDataBase.cs:Zeile 497. bei CDBaisys.CDB.Sql(String SelectQuery, String TableName, Boolean ReadOnly) in N:\aisys\aisys\CDB\CDataBase.cs:Zeile 583. bei CDBaisys.CDB.getnxtnr(String myObject) in N:\aisys\aisys\CDB\CDataBase.cs:Zeile 2502.18 июня 2007 г. 12:30 This thread has been going for more than one year now. How many years will it take Microsoft to fix this problem? Any bug that causes corruption of data (duplicated rows) would seem to be a pretty big deal to me, especially in a financial application where we may end up with double payments or other financial damage.21 июня 2007 г. 14:52 - Dear Don, I am not working at Microsoft, but I feel I want to answer your remark. I have also experience "Internal Index is corrupted 5" and I am also try all the different solutions with no luck what so ever. After almost year of fighting with this bug we have found solution in this very forum and thread which state that Microsoft did not intend that people will use DataView.ListChanged event and to change the underlying DataTable's data inside that event handler. After we have understand this issue we change our code as needed and I am happy to say that until now we have not experience "Internal Index Corrupted 5". Microsoft also create QFE which available by calling Microsoft support and the QFE number can be found in this thread. I agree that there is problem in the design of DataTable and DataView but it is not right to say that Microsoft did not do as much as they can about this issue. Thank you, Ido.26 июня 2007 г. 18:25 Dear Ido, i think, your post is inappropriate in this thread. You are trying to justify Microsoft and nothing else. And i think, you probably work with Microsoft - this is the only one thing to explain your post. The metter is that programmers from Microsoft have written the code that uses DataView.ListChanged event and changes the underlying DataTable's data inside that event handler. As you can see from the stack trace which happened in my case, I am trying to set the value of DataRow and have the exception in response: System.InvalidOperationException: DataTable internal index is corrupted: '13'. at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) at System.Data.DataView.GetRecord(Int32 recordIndex) at System.Data.DataView.GetRow(Int32 index) at System.Data.DataView.UpdateDataRowViewCache() at System.Data.DataView.OnListChanged(ListChangedEventArgs e) at System.Data.DataView.IndexListChanged(Object sender, ListChangedEventArgs e) at System.Data.DataViewListener.IndexListChanged(Object sender, ListChangedEventArgs e) at System.Data.Index.OnListChanged(ListChangedType changedType, Int32 index)) Thank you.28 июня 2007 г. 8:17 Dear Microsoft support, please solve the folowing problem you have published the hotfix (see) but in details, related to this fix was written (see link on page) "The Requested Web Page is Not Available" but i found another page, related to this topic (see) where in description was sad FIX: Data that is associated with a component that uses the System.Data object may become corrupted in an application that is built on the Microsoft .NET Framework 2.0 and also sad that described problem will be fixed in service pack or hotfix My dear friens from Microsof, please investigate this, and give this miserable hot fix (that i hope you already done). it is desirable you publish the link on fix to this forum. Thank you very much.29 июня 2007 г. 9:26 Recently i have installed SP1 for VS 2005 and i have the same problem) ************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.802 (QFE.050727-8000) CodeBase: июня 2007 г. 13:08 I agree with Juliy Cesar on this point. I'm setting a value on a row which is then internally fireing events (which cause issues) on the default dataview. wonder it there are any fixes for this in .Net 3.5?3 июля 2007 г. 9:57 I have been watching this thread for a couple of weeks, since I got the similar kind of “Index” related issue on DataTable, when it is working in a multi -threaded scenario.I shall explain the situation briefly, to get a better understanding of this. I’m developing a middle-tire component, which populates data as bunch-by-bunch into a DataTable through a background process, while Presentation-tire can access the, so far populated, data in main thread. The background processing is developed by using BackgroundWorker class in framework 2.0. A lock is also applied to Data table to ensure its thread-safety on background processing. When the Presentation -tire try to access the data from DataTable, exception is getting. I have made both Console and GUI client application to test my middle-tire component. In console application I’m getting index out of range exception like “There is no row at position 1443. at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) “. But in GUI application, the exception is “DataTable internal index is corrupted: '5'. The position of index, which causes the exception, is not stable, and some times it is working fine with out giving any exception. After watching this thread, I have collected and installed the hotfix “KB 932491”, but that couldn’t help me to get out of this. Is there any other fix or work around to solve this issue? Please help.3 июля 2007 г. 12:28 I have the same problem. I try writte expression evaluator and I need change data row in ListChanged event. I dowload and installed Hot Fix but it still doasn't work. Any sollution for this problem?6 июля 2007 г. 12:48 Hi Anneesh, The thing is, if you are modifying the data on a background thread while the data is bound to some controls in the UI, then you essentially have two concurrent threads modifying the dataset, even if you lock on the datatable. Some ways to avoid the threading issue: 1. Push the changes to the main UI thread using a delegate. I wrote some code to do this in the past. In your main form, create a function like so: delegateProcessWorkerMessage delegateProcessWorkerMessageImpl =null; private void ProcessWorkerMessageImpl( int MessageType, Object message ) {// Process messages here... switch ( MessageType ) {case FormMessage.MSG_APPLY_FILTER: ApplyCustomFilter( (string) message ); break; case FormMessage.MSG_RESET_FILTER: ApplyCustomFilter("" ); break; case FormMessage.MSG_SET_STATUS: SetStatus( (string) message ); break; case FormMessage.MSG_SET_STATUS_ERROR: SetStatusError( (string) message ); break; } }public void ProcessWorkerMessage( int MessageType, Object message ) {// Process messages here... Object [] objParams = { MessageType, message }; this.BeginInvoke( delegateProcessWorkerMessageImpl, objParams ); } then on your background thread you call: form1.ProcessWorkerMessage(FormMessage.MSG_SET_STATUS, "Scan complete."); I made this function generic so it takes an enum for message type and an object for the data, so in your case you would serialize changes to the main thread. Another way to solve this is the "copy on write" approach. In your background thread, you make a copy of the datatable, modify it, then push the whole thing to the main UI thread and assign it. The problem with this is you have to watch out for writing over user input on the main thread. But if you have the main UI thread read only, then this works well.6 июля 2007 г. 17:06 Hi, this is an interesting thing. I also have a dataset as a local cache in a static class. The controls are bound to that dataset. New data is fetched asynchronsly so that the ui can show an animation. I thought, this would not be a 2 thread scenario, because nothing is entered while filling, but if i understand you, it is in fact so that the binding in the ui reacts on the async fill of the dataset and destroys the index.... What can I do to fill the dataset async (so that the animation on the ui works) and to be sure, that the binding does not occur? Is SuspendBinding a way? But how to suspend all bindings? It's not possible with currencymanger[..] because there is not possibility to list all bindings... Quiet confusing6 июля 2007 г. 17:36 This is a case where copy on write would work ok. Before updating data, lock the UI so users cannot enter data. Then on the background thread, make a copy of the dataset (using clone I believe will work). On the background thread, modify the copy of the dataset to your hearts content until you are finished (while UI animation is running). Once background thread is finished, background thread assigns the new dataset to the bindings, overwriting the old one. Then last step is to re-enable the UI. I worked with a customer about 3-4 years ago that was using a dataset and associated dataviews inside an ASP.NET application where the dataset was a centralized cache. We used this same approach to allow multiple threads to modify the data. Each thread would lock a centralized global lock object, then make a copy, increment a checkout counter, then release lock. Thread would modify the data copy (take as long as it likes) then lock the global lock, check the counter and if the counter was still 1, then copy over the dataset. This worked out well for the customer because writes were infrequent, the cost of copy and global lock was not a huge issue. In the end, what we were trying to do is write a concurrent database server, so we finally agreed this is the purpose of having a database server and got rid of all the crazy code and life became simple again. The thing about dataset is that it is not thread friendly, even today with the fix. It was designed for single threaded UI apps. This is why it creates the indexes to improve perf but the cost is a lack of thread safety. I've written a few multi-threaded ui apps in my day, and the way I typically deal with dataset is as follows: 1. Perform all write operations on the main UI thread. This means posting writes from background threads to main thread. 2. To avoid "eventing" data modification issues (like corrupting the index of the dataset), don't modify data in data driven events. It just takes a little more thinking when you design the UI but it can be done. 3. Be careful when storing things in dataset that you don't modify the stored objects outside of dataset. We had a customer who was storing custom objects in a dataset and then modifying the objects both in the dataset and outside the dataset at the same time. This confuses the index because the index is maintained by dataset code. 4. Be careful when using DataViews. Just remember creating a DataView is a write operation on a DataSet. So creating a DataView on background thread is a big NO-NO, this is a write operation. Creating a DataView will drill into the dataset and add an index to the collection of indexes in the dataset (if an appropriate index is not available). But this is me, mileage may vary. I'm not a huge GUI programmer so take this with a grain of salt. I will forward this thread to the DataSet program manager again so he can chime in here.6 июля 2007 г. 18:00 One other note. A long while ago I came up with a brilliant idea of writing a generic pending modifications queue for dataset. This would allow background thread or any code anywhere (even in data driven events) to post changes to dataset that would later be queued and performed on the main UI thread. I thought it would be possible to copy off the datarow and do this in a generic fashion but at the time creating a new datarow was a write operation so this did not work. But in general the idea is sound, but making it happen generically might be a bit of work. But you could do something like create a bit of code that stores off a copy of the datarow, the modifications (or new values), some action like {insert, update, delete}, the target datatable, etc... These would be queued into a fifo in a thread safe manner. When you queue something, this auto-triggers a delegate on the UI thread to perform the actions. Delegate on UI thread locks the queue and cleans it out. But in my life I always have more ideas than time to implement them, so I never got around to this one. Would be a good small project for CodePlex.6 июля 2007 г. 18:10 BUT, Dear Matt Neerincx from [MSFT] I use the folowing construction to call method that change DataTable, and got the paltry exception (see SUbj ) ... m_MainForm.BeginInvoke(request.Callback, new object[] { results }); ... as i understand, this means the request.Callback method is executed in main thread, because m_MainForm is the main form of the application. consequently modification of DataTable occurs in the same thread. Im sorry ,but your fabrication about thread non-safty behaviour of the datatable is not expalins the real reason of this crush. Thank you for your care about our troubles.7 июля 2007 г. 10:33 > Once background thread is finished, background thread assigns the new dataset to the bindings, overwriting the old one. > Then last step is to re-enable the UI. For better reading: Dataset Cache ; Dataset CopyOfCache; I did'nt understand this step. After I updated the data in CopyOfCache in the Async Method I have to bring the data back to the Cache. How could this be done? I think if I do something like Cache = CopyOfCache I will loose my bindings... The Question is hot to assing the bindings to CopyOfCache or copy the data back to Cache... Thanks... I've understood the main thing... I hope I will get that to work7 июля 2007 г. 12:18 I'm yet another user with the same problem. I have tried applying hotfix 932491, but it hasn't made a difference. I've since uninstalled this hotfix. Like Aneesh, I have a multi-tier, multi-thread Windows application. At unpredicitable times, I get the "DataTable iinternal index is corrupted: '5'" error as well as the "DataTable internal index is corrupted: '13'" error. I also get the IndexOutOfRange exception thrown with a message like "There is no row at position <nnn>". I have a grid that is bound to a datatable. In a background thread, I add/remove rows from the datatable. As you have already explained, this means that I have two concurrent threads modifying the datatable, even if I do try to lock on the datatable. Like Rudsen, I'm trying to follow your suggestion to "copy on write", but I can't figure out how to seal the deal. I could clone the original datatable (Cache) to make CopyOfCache and modify that instead. But then what? How do I safely update my original datatable and/or change my grid's bindings?10 июля 2007 г. 19:32 Ok, here are the steps I would use: 1. Lock UI. This means setting dataGrid1.Enabled = False for example. 2. Make copy of data table. 3. On background thread, modify copy of data table. 4. Once modifications are complete, signal main thread. 5. Main thread takes copy of datatable, assigns to datagrid1.DataSource. 6. Unlock UI. If you want user to have ability to modify data on main UI thread at the same time background thread is modifying it, then the design is more complex. To allow UI + background concurrent modification, the simplest solution is to serialize all modifications to main UI thread. You can use a delegate to push the modifications to the main UI thread. Then all modifications to datatable are coming thru message loop and thus are serialized. It is just as if the background thread is typing into the datagrid along with user in other words. But as I mentioned earlier there is not a nice clean generic way to do this that I can think of. The problem is calling InsertRow for example is a write operation.10 июля 2007 г. 19:52 We used to get the dreaded "DataTable internal index is corrupted...". After applying the patch, the problem went away. Picture a form with two panels. The first panel contains a grid used for navigation plus it can also add and delete rows with the imbedded navigator. The grid is bound to bsEmployee. The second panel contains a "form layout view" with a bunch of controls to edit a single row. Each field is also bound to bsEmployee. Because we were adding a row with the grid but entering the data in the second panel, the underlying ado framework stuff blew up with the "index is corrupted" error. Once the patch was applied, the problem went away. To the best of our knowledge, threading was not involved. With that said, the form also uses background threading to update lookup tables and to also get the less important stuff associated with a multi-table dataset. The model we are using is to merge the changes (obtained on a background thread) with the dataset on the GUI thread. So far, it works perfectly. {bool ok = false; if (_GUISync.InvokeRequired) { ok = (bool) _GUISync.Invoke(new UpdateDataSetDelegate(UpdateDataSet), null); }else {try {this.AcceptChanges(); this.Merge(_dsNewData, false); this.AcceptChanges(); NoteMaxTimestamps(); ok =true; }catch (System.Exception ex) { _log.Warn("UpdateDataSet merge failed", ex); ok =false; }return ok; }return ok; }10 июля 2007 г. 21:16 I'm getting this error. I installed the fix from NDP20-KB932491-X86.exe The error is still happening. I have also installed sp1 for .net framework 2.0. Is it possible my application isn't targeting the new sp1 version? What can I do? Single Threaded app. I am calling the delete method through the bindingsource, ((DataRowView)(this.BindingSource.Current)).Row.Delete(); The error only seems to occur when I set a datetime column in the row to a value. help19 июля 2007 г. 17:58 I have been struggling with the bug for a couple of weeks. The System.Data.RBTree index becomes corrupt and throws "DataTable internal index is corrupted: '5' ". My example is a single threaded application with no UI or databinding and I have already installed the hotfix. The exception is thrown from the method System.Data.RBTree.RBInsert() because root_id is not equal to 0 (when it should be). Here is a snippet of my test application that reproduces the problem (although this snippet is not enough to debug the problem, so I am looking for a Microsoft developer to send the full source to). The exception is thrown every time on the third iteration through the "for" loop. This bug is preventing us from shipping. Thanks, FernandoCode Snippet // In this code sample, currentTrial aggregates a DataRow. private void ReproduceDataTableBug(MeasurementDataObject measurement) { for (int i = 0; i < 10; i++) { NriTrial currentTrial = BusinessServices.Instance.GetNewNriTrialForEdit(measurement, 128); currentTrial.DataPoints[0] = 1.0f; currentTrial.N1XValue = 1.0f; currentTrial.N1YValue = 1.0f; currentTrial.P2XValue = 1.0f; currentTrial.P2YValue = 1.0f; currentTrial.CurrentLevel = 2; currentTrial.ActualGain = 3.0f; currentTrial.ActualIterations += SAMPLE_SIZE; } }26 июля 2007 г. 1:06 I'm getting the dreaded "DataTable internal index is corrupted again". What I'm discovering is that if you have a grid bound to a binding source, if you add new rows to the underlying datasource directly, the data table internal index will become corrupted. As a workaround, I simulated a user pressing the add button of the bound data navigator and adding the row that way. Here's how I did it: Created a grid view with an embedded navigator and bound it to binding source "bsRegistration". Thing works great. Now I've added a smart card reader which gets some info and adds a row to the underlying datasource of bsRegistration: dsEventSet.CERegistration.AddCERegistrationRow(ceRegRow) // with this code, the data table starts getting internal index corruption. ------------------ Now for some trickery to simulate the user adding the new registrant ---------------- 1) ceRegRow now becomes _ceRegRow (module level variable) 2) rather than adding the row to the data set, simulate button press: gridRegistration.EmbeddedNavigator.Buttons.Append.DoClick(); 3) Handler for EmbeddedNavigator button click: void EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e) { if ((e.Button.ButtonType == NavigatorButtonType.Append) && (_ceRegRow != null)) { bsRegistration.AddNew(); e.Handled = true; } } 4) Get the card reader data in bsRegistration events: bool _AddingNew = false; private void bsRegistration_AddingNew(object sender, AddingNewEventArgs e) { _AddingNew = true; } /* Card reader - Capture NonMemberID or RealtoID */ private void bsRegistration_CurrentChanged(object sender, EventArgs e) { if (_AddingNew) { _AddingNew = false; if (_ceRegRow != null) { if (!_ceRegRow.IsNonMemberIDNull()) { ((DataRowView)bsRegistration.Current).Row["NonMemberID"] = _ceRegRow.NonMemberID; } if (!_ceRegRow.IsRealtorIDNull()) { ((DataRowView)bsRegistration.Current).Row["RealtorID"] = _ceRegRow.RealtorID; } _ceRegRow = null; } } } The internal index corruption goes away.26 июля 2007 г. 13:53 I had this problem too but it was fixed by applying Hotfix KB932491 I have a single threaded Windows Forms app. It uses DataSets through BindingSources and shows different DataTables of the same DataSet through different Forms. I'm using cascaded Binding Sources to get Master/Child functionality. I have some Expression columns where the Expression is set and cleared as forms are opened and closed. My Expressions typically count the number of child records in related DataTables. I don't fiddle with RowChanged, ListChanged, CurrentChanged The Exception was being thrown on ...BindingSource.EndEdit() when one of my forms was being closed after fields had been updated. All seems to be working fine now. I just need to know when this Hotfix is going to appear in a fully regression tested .Net Framework ServicePack.31 июля 2007 г. 13:28 My application is ASP.net 2.0 Web application. I am storing dataset with Four tables in the Web Cache. After Retrieving the data, I am doing Select on the DataTable. I am not able to reproduce this problem. One of my Business user got this error., String sort) I have gone through the whole blog. 31 июля 2007 г. 15:31 - Should i Lock my dataset ? - I can not create a copy of the Dataset after fetching from cache as this will degrade the performance on the web server. - Is Dataset thread safe in ADO.net 2.0? - Do i have to avoid using Select on DataTable? - Is this problem related to Caching a Dataset and only one copy is shared between all the web requests. - Is there a definte fix for this problem. hi guys, to me it finally helped to simply AVOID the BindingSource's CurrentChanged event. without this event i dont get this nerving error again.... if you need a "change" event you can use the "xDataSet.tableRowChange" event in the dataset itself....just inherit your dataset and then override that event. hope this helps some of u. foxxed27 августа 2007 г. 12:14 - 28 августа 2007 г. 9:29 - Hi, I'm having the same problem, without multi-threading (Windows Forms application - only main UI thread). But I suppose the cause of many of the people having the issue is somehow related to the "CurrentChanged" of the binding. (CurrencyManager.CurrentChanged) The grid that I'm using subscribes to this in order to raise SelectionChanged event. (Probably the "CurrentCellChanged" is another one). I got it from the stack trace. My case is rather straight forward, and I haven't thought of a workaround yet. I want to cancel the changes of the user if the user moves to another row in the grid. This means that I have to listen to "SelectionChanged" event of the grid, and call "RejectChanges" in the handler. I guess the binding / dataset implementation rely on the currency manager's properties, and they are not fully consistent when the current selection is changing. (I haven't tested the KB Hotfix yet, but I suppose that would not help, as I want to distribute the application on many machines) -Hamed22 октября 2007 г. 9:30 I struggled for a day with the issue, and it turns out to be an issue of updating dataset in the middle of the binding context being updated. I tried many ways to force the index to be re-built, nothing worked. Finally, I'm using the "SynchronizationContext" class in "System.Threading", and update the dataset after the event handlers are complete. I'm happy with the "SynchronizationContext" solution, as this way fixes other minor issues too.22 октября 2007 г. 14:51 - This is interesting.. over a year and no solution. I have a VERY simple app. A Windows form with text boxes, bound to a BindingSource. A Binding Navigator, a tableAdapter and a Dataset. It doesn't get much simpler than this. No multi-threading. if I use BindingSource.Find(), eventually, when navigating back and forth on the BindingNavigator, I'll get the corrupted index exception. if I use TableAdapter.Update() on the BindingSource.CurrentItemChanged event handler, eventually I'll get the corrupted index exception. To me, this indicated that the BindingSource is broken. I'm going to have to manage everything manually, using SqlDataAdapters in code and manually created datasets. Feels like going back to DotNet 1.0 and the original ADO.31 октября 2007 г. 9:20 Tim, Are you running Visual Studio 2008 Beta 2? We made a number of fixes in 2008 that address this error. Thanks, Erick31 октября 2007 г. 19:25Модератор Come on...you can't tell us to wait untill YOU release vs2008...my company will adopt it in 2 years time at least...what do we do untill then? reverting to traditional ADO is not an option for me. Good luck to everyone! pier6 ноября 2007 г. 11:25 Since ADO.NET is in the 2.0 framework, does this mean a service pack for 2.0 is coming out to address this bug?6 ноября 2007 г. 13:21 - As part of Visual Studio 2008 there are a number of fixes for 2.0 assemblies, including some that will fix this issue. Once Visual Studio 2008 is released, these fixes will be available for 2.0. Installing VS 2008 is not a requirement, but the fixes are only available in 2008 at this time. Just to be clear, the fixes for 2.0 bits (including DataSet) are being beta tested as part of VS 2008, but will be released on their own - VS 2008 will not be a requirement to get these fixes. The main reason that I asked is that I want to make sure that there isn't another issue that we didn't cover in our work for VS 2008. If you can install VS 2008, just for updates, but continue to use VS 2005 in the way that you are doing now, this will help determine if the problem will be fixed. Does this make sense? Thanks, Erick6 ноября 2007 г. 18:50Модератор If I understand this, what you are saying is that projects developed using VS2008 targeted to the 2.0 framework will be incompatible to the 2.0 framework deployed at client sites. The reason being that 2.0 for VS 2008 is different than 2.0 for VS 2005. If this is the case, it does not make any sense at all. Is there going to be a big disclaimer on the VS 2008 box that says "Not For Deployment Until 2.0 SP1 is released"?8 ноября 2007 г. 15:37 Hi Erick! If we can't test now, on VS 2005, how do we know the issue is addressed in the fix for Framework 2.0. (Whenever it comes) Last fix did not do any good. (to my apps) If next fix do the same to our app's, i se the years go by verry fast:-( Regards Anders13 ноября 2007 г. 8:01 The installation for Visual Studio 2008 includes a set of fixes for the 2.0 version of the Framework. So if you install VS 2008, you will get the fixes. This does not mean that you need to use VS 2008, just that you need to install it. Once VS 2008 is released, I believe that the 2.0 updates will be released as a standalone package. Thanks, Erick13 ноября 2007 г. 20:29Модератор - I installed the 2.0 SP1 framework that was released on Nov 22, 2007, and the problem has not gone away.22 января 2008 г. 17:42 - We have the 2.0 SP1 installed with VS 2005, and I do still get the error. There are two, actually: DataTable internal index is corrupted: '5' DataTable internal index is corrupted: '8' I'm not sure if the number refers to the corrupted index, or some other internal code. Is there a way to lock the dataset so that if there is another thread trying to access the data, then that thread will wait? Jim22 января 2008 г. 18:45 - I'm already doing that, it doesn't help. This is not a thread safety problem, or at least, that's not the only way to reproduce it. In our case, we're trying to modify cells in an Infragistics grid from the InitializeRow event handler. As a workaround, I am placing that portion of the event handler inside a SynchronizationContext.Post() and directly modifying the DataRow. Normally you'd use SynchronizationContext.Post() to solve a cross-threading problem, but in this case, it's useful for just getting code out of the DataView.ListChanged event handler (which apparently is where Infragistics fires their InitializeRow event). I'm already on the UI thread, so I know this is not a cross threading issue.22 января 2008 г. 18:52 Curtis, Can you let me know what the culture of the current thread is? Also, please let me know what the data types of your columns are. Are you using a string expression anywhere (filter and/or sort)? If so, please use explicit conversion functions and let me know if this helps. We're trying to narrow down the problem area. Thanks, Erick23 января 2008 г. 2:14Модератор - CurrentThread.CurrentCulture and CurrentThread.CurrentUICulture are both set to "en-US". Our data types are: string, string, Boolean, string, DateTime, string, DateTime, Decimal, string, Int32, string, string, string, string, Boolean We aren't using any filter expressions or sorts, although since it is an Infragistics grid, and they support sorting by clicking on the column header, I suppose they might be doing some sorting behind the scenes that would impact this behavior. Curtis23 января 2008 г. 15:44 Curtis, Do any of the string columns contain data that could be implicitly converted to another type (e.g., a string column containing DateTime like strings)? Can you check the Sort expression at various points in your code, especially just before the corruption? If there is a sort occuring, having the string will be very helpful. Thanks, Erick23 января 2008 г. 21:27Модератор - So far as implicit type conversions go, when populating the DataTable initially we are passing strings into all the columns except the Booleans. I didn't suspect that as a potential source of problems, but will try changing our code to do an explicit conversion first. There was one place specifically in an event handler (after the data had been populated via strings, as described above), where we were trying to update the value in a DateTime column by setting the grid's cell value. I could comment out that line of code and the corruption would go away. I tried setting the cell value to a string containing the date/time, and also using DateTime.Parse(string). I saw corruption either way. I also tried setting the DataRow[columnName] directly, and still saw the corruption whether passing it a string or a DateTime. The sort expression on DataTable.DefaultView.Sort is an empty string right before the corruption happens. Again, though, if Infragistics is setting the Sort expression on a different DataView, I don't have visibility into that. We aren't doing anything explicitly to sort, and grid.DisplayLayout.Bands[0].SortedColumns is empty.24 января 2008 г. 17:00 Can you post the call stack during your call where you update the value (the line that causes corruption)? Thanks, Erick24 января 2008 г. 21:53Модератор - Here is the stack trace from our application when the crash occurs: at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append) at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append) at System.Data.Index.InsertRecord(Int32 record, Boolean fireEvent) at System.Data.Index.ApplyChangeAction(Int32 record, Int32 action, Int32 changeRecord) at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2) And here's the stack trace where we update the value: > Spillman.Modules.JailModule.dll!Spillman.Modules.JailModule.PropertyIssue.IssueItemsDialog.issueItemsSpillmanGrid_InitializeRow(object sender = {Spillman.Framework.UI.Controls.Grid.SpillmanDBGrid}, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e = {Infragistics.Win.UltraWinGrid.InitializeRowEventArgs}) Line 162 C# Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeRow(Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) + 0x4c bytes Spillman.Framework.UI.Controls.dll!Spillman.Framework.UI.Controls.Grid.SpillmanGrid.OnInitializeRow(Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e = {Infragistics.Win.UltraWinGrid.InitializeRowEventArgs}) Line 1048 + 0xa bytes C# Spillman.Framework.UI.Controls.dll!Spillman.Framework.UI.Controls.Grid.SpillmanDBGrid.OnInitializeRow(Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e = {Infragistics.Win.UltraWinGrid.InitializeRowEventArgs}) Line 617 + 0xb bytes C# Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(Infragistics.Win.UltraWinGrid.GridEventIds id = InitializeRow, System.EventArgs e) + 0x7b5 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.FireInitializeRow(Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) + 0x50 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow() + 0xb8 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.FireInitializeRow(System.Collections.IList rows) + 0x9b bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.InitNonGroupByRows(System.Collections.IList fireInitializeRowOnTheseRows) + 0x169 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.SyncRowsHelper(System.Collections.IList boundList) + 0x51f bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.SyncRows() + 0x44b bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.EnsureNotDirty() + 0x49 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.VerifyAgainstScrollVersion() + 0x58 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.GetItemAtVisibleIndex(int visibleIndex = 0) + 0xe bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtVisibleIndex(int visibleIndex = 0, bool includeSpecialRows) + 0x59 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.GetFirstVisibleRow() + 0x9 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.FirstRow.get() + 0x17b bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(bool scrollToFill = true) + 0x141 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(bool calledFromRegenerateVisibleRows) + 0x5a bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(bool resetScrollInfo = true) + 0x4e bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(Infragistics.Win.UltraWinGrid.ScrollbarVisibility assumeColScrollbarsVisible = Check) + 0xc9 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(bool resetScrollInfo = false) + 0x77 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(int origin, int extent) + 0x18 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(int origin, int extent) + 0x1c bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions() + 0xdf bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements() + 0x28 = false) + 0x51 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(Infragistics.Win.ControlUIElementBase controlElement, bool recursive) + 0xf0 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.DataAreaUIElement.Rect.set(System.Drawing.Rectangle value) + 0x37 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements() + 0xabc = true) + 0x51 bytes Infragistics2.Win.UltraWinGrid.v7.3.dll!Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(Infragistics.Win.ControlUIElementBase controlElement, bool recursive) + 0x2f bytes Infragistics2.Win.v7.3.dll!Infragistics.Win.UIElement.VerifyChildElements(bool recursive) + 0x30 bytes Infragistics2.Win.v7.3.dll!Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(bool verify, bool syncMouseEntered = false) + 0x26 bytes Infragistics2.Win.v7.3.dll!Infragistics.Win.ControlUIElementBase.CurrentCursor.get() + 0x24 bytes Infragistics2.Win.v7.3.dll!Infragistics.Win.UltraControlBase.Cursor.get() + 0x26 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WmSetCursor(ref System.Windows.Forms.Message m) + 0x74 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x3ce bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 32, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x20 (WM_SETCURSOR) hwnd=0x3c0e58 wparam=0x3c0e58 lparam=0x2000001 result=0x0}) + 0xcc bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v7.3.dll!Infragistics.Win.EditorWithMask.AccessibleTextManager.AccessibleTextSubclasser.WndProc(ref System.Windows.Forms.Message msg) + 0x43 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 32, System.IntPtr wparam, System.IntPtr lparam) + 0x57273 Spillman.Framework.UI.FormManagement.dll!Spillman.Framework.UI.FormManagement.FormLauncher.LaunchChildForm(object argument = {Spillman.Framework.UI.FormManagement.FormInfo}) Line 318 + 0x8 bytes C# mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x57 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x81 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x4a bytes Note that updating the value seems to set up the dataset for failure later on, the crash does not occur until later.5 февраля 2008 г. 18:02 Hi Curtis, I don't know if this will help you or not, but I recently had to debug this same issue. Your last statement there sounds like something I myself had said when I finally traced the cause of the issue. Our process goes something like this: We create a new blank DataRow, populate it with default data, then add it to the DataTable. That table belongs to a DataView which we use to databind to a grid. I discovered that there was code which had been added that was populating some columns with data after the new row was added to the DataTable. I was able to trace the error we were getting down to that code that was populating data after the new row was added to the DataTable. After about three times of add row/change data/add row/change data, the next new row to be added to the DataTable would cause the "Index is corrupted" error to appear. I had to remove the code which was populating data after the row was added down to the method which populates the newly created row before the row was added. For me, this "fixed" the issue. Hope this is helpful, Jim5 февраля 2008 г. 18:50 I am getting this error using Visual Studio 2008 Professional version 9.0.21022.8 RTM in a solution using the .NET 3.5 Framework. It's occuring on the "assemblyBindingSource.EndEdit();" line. However, if I change the method to a "SuspendBinding()" it does the same thing. It might happen on other method calls to my BindingSource, but I only tried those two. My application contains a WCF service middle tier, hosted by IIS. I get the data from this middle tier using my GetLookupTables() and GetAllAssemblies() methods. My dataset contains a one to many relationship (with cascade update on) from my AssemblyTable and my ScheduleTable. The error occurs when I change a value on a control (like a textbox) which is bound to the AssemblyTable. For some reason I never get the error if I only only change a value on a control bound to the ScheduleTable. I hope this helps. { ... public { InitializeComponent(); coordinatorDataSet.Merge(coordinatorWebClassClient.GetLookupTables()); coordinatorDataSet.Merge(coordinatorWebClassClient.GetAllAssemblies());... } { assemblyBindingSource.EndEdit(); scheduleBindingSource.EndEdit(); coordinatorWebClassClient.UpdateAssembly(coordinatorDataSet); coordinatorDataSet.AcceptChanges(); enableModeExtender.SetMode(EnableModeExtender.FormMode.Save); refreshScheduleControls(); } ... ... ... }15 февраля 2008 г. 21:45 I could replicate the problem I am having, every time. I found a solution to my problem. I narrowed the my code down the the following. usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingClassLibraryTest.CoordinatorService; namespaceFormTest {public partial class Form1 : Form {CoordinatorWebClassClient coordinatorWebClassClient = new CoordinatorWebClassClient(); //bool dataLoad = false; public Form1() { InitializeComponent(); coordinatorDataSet.Merge(coordinatorWebClassClient.GetAllAssemblies()); //dataLoad =true; }private CoordinatorDataSet.AssemblyRow currentAssembly() {return (CoordinatorDataSet.AssemblyRow)(((DataRowView)assemblyBindingSource.Current).Row); }private void button1_Click(object sender, EventArgs e) { //dataLoad =false; coordinatorDataSet.Assembly[0].Description ="Test"; //dataLoad =true; }private void assemblyListBox_SelectedIndexChanged(object sender, EventArgs e) {//if (dataLoad) //{int assemblyId = currentAssembly().Id; coordinatorDataSet.Merge(coordinatorWebClassClient.GetAssembly(assemblyId)); //} } } } I have a coordinatorDataSet object on the form, which contains an Assembly DataTable object. I have an assemblyBindingSource object on the form, which is bound to the coordinatorDataSet. I have a reference to an coordinatorWebClass which I'm using to get data to put into my coordinatorDataSet. I have an assemblyListBox control on my form which is bound to the assemblyBindingSoruce object. I have a button on the form, which changes data in the Assembly DataTable object. I could have replaced my button with a bound control, and an AssemblyBindingSource.EndEdit with the same results. (Essentially does the same thing) I believe that my problem is happening because I have a ListBox object bound to a DataTable, and I am handling the SelectedIndexChanged event which re-populates my DataTable. When my constructor fires the Merge command to intially fill the table, it causes the index to change in the ListBox, which launches another Merge command. This causes two merges to happen at the same time. I added the a bool dataLoad flag which prevents this from happening, which fixes my problem. For some reason, my currentAssembly() function has something to do with the problem, but I haven't figured out how. If I remove that function, and do what its doing in my SelectedIndexChanged event, that also fixes the problem.21 февраля 2008 г. 22:21 - I downloaded the hotfix, but I cannot install it, it says the installer could not find the program to be updated or the incorrect version is installed. What exactly is it looking for?2 апреля 2008 г. 11:57 - System info: .NET Framework 2.0.50727.832, Visual Studio 2005 Professional with SP1 I downloaded and applied the Hotfix, but that didn't fix the problem. In fact, it seems the Hotfix wasn't even installed, because all versions of System.Data.dll on my computer are version 2.0.50727.832, whereas the KB article says they should be v2.0.50727.802. In my case, the code that causes the crash is: dataRow.Column = myValue; and the associated stack trace is:) Digging in System.Data.RBTree<K> with Reflector, I'm pretty sure that it's this code in the RBInsert() method that's throwing the exception: if (root_id != 0) { throw ExceptionBuilder.InternalRBTreeError(RBTreeError.InvalidStateinInsert); } because RBTreeError.InvalidStateinInsert == 5. Microsoft, YOU NEED TO FIX THIS. This bug has been around for over two years and it STILL hasn't been resolved. Just because it only happens to 0.001% of people using the Framework, doesn't give you the right to ignore it!7 апреля 2008 г. 11:11 Rather than assigning myValue directly to dataRow.Column, try assigning it to the edit value of the bound control. That's what I did to avoid the conflict. Also, isn't the syntax dataRow["columnName"] = myValue?7 апреля 2008 г. 12:45 You comment: ...try assigning it to the edit value of the bound control... What would be the exact syntax for this? Thanks!17 апреля 2008 г. 6:19 The issue I ran into was adding a new row where I had two controls competing for the same binding source. Because of a requirements change, the piece of code where I dealt with the conflict that corrupted the internal index is somewhere out there in the old bit bucket. With that said, here is an approach resulting from an experiment. In a new windows form project: 1) Add a dataset. Add a table adapter to it referencing Northwind.Categories. 2) Add the dataset to your main form. 3) Add a binding source (bsNorthwind) referencing the dataset. 4) Add a grid using the binding source as its datasource. 5) Add a button to the form with a click handler private void btnAddRow_Click(object sender, EventArgs e) { Object o = bsNorthwind.AddNew(); DataSet1.CategoriesRow categoryRow = ((DataRowView)o).Row as DataSet1.CategoriesRow; categoryRow.CategoryName = "Fudge"; categoryRow.Description = "Type of Fudge"; } Because the row is added via the binding source and returned as as a reference, you probably will avoid the data index corruption problem. 17 апреля 2008 г. 15:07 I current use VS 2008 and i can reproduce this error, in my case in a datatable that contain a Key, I can walk arround eliminating the key but a hava another data table with other keys, and I dont want to loose fait in .Net, but this issue has more tha 1 year, first I install de hotfix, now I chaange to VS2008 and still the same problem good lock to all5 мая 2008 г. 23:56 thanks for the tip! this worked well for me. i was getting the index corrupted error when clicking on the delete item button on my bindingnavigator in my C# winform application. in the event handler for the button click, I called openingsBindingSource.RemoveCurrent(); to remove the current record from the openings datatable. this is the line of code that threw the exception. after placing openingsBindingSource.MoveFirst() and openingsBindingSource.MoveLast() before calling removecurrent, the index corrupted exception is no longer thrown. rebuilding the index = great idea, thanks again!15 мая 2008 г. 0:59 We have the same issue (corrupted index error 5) already described before. We have a DataSet binded to a UltraGrid (Infragistics). DataViews are created by Infragistics component. When the user has a sort and filter setting active on the grid (that should corresponds to an equivalent DataView), *sometime* (once a day, in average) the user get the exception of corrupted index when the DataRow.EndEdit is called in the code that is loading a new record in the DataTable. We don't have multiple threads, and we don't have UI events occurring during the DataTable loading, which is the operation that generates the exception (even if not in a reproducable manner). We have already installed .NET 2.0 SP1. What is the current state of the issue? Are you working on it or is this issue "freezed" because you're not able to reproduce? Thanks. Marco Russo июля 2008 г. 10:50 - How are you adding the new row? Is it being added through the grid? Is it being added by the binding source? Is it being added directly to the data table?2 июля 2008 г. 13:10 The row is created calling DataTable.NewRow(), then their fields are compiled and it is added to the Data Table and at last it is added to the DataTable calling DataTable.Rows.Add() method. Marco2 июля 2008 г. 13:34 Try adding the row to the binding source instead of the underlying data table. For example: Assuming your grid is bound to bindingSource bsLeadership Datasets.DSLeadershipForm.LeadershipRow leadershipRow = bsLeadership.AddNew() as Datasets.DSLeadershipForm.LeadershipRow; leadershipRow becomes a pointer to which you can apply column values. This should eliminate your corrupted index problem. Jim2 июля 2008 г. 14:51 It is not so easy. The DataSet contains three DataTables, which are nested in an UltraWinGrid component by Infragistics. The BindingSource.AddNew would add a record in the table that corresponds to the record type at the current position, but this is not what the code has to do. However, I think that this unstable behavior of DataTable should be addressed or at least documented by Microsoft... Marco3 июля 2008 г. 7:07 Here is some code that adds rows both to the header and detail of a master/detail bound grid. private void btnParse_Click(object sender, EventArgs e) { string[] lines = memoEdit.Text.Split(new char[] { '\n' }); if (lines.Length > 8) { // bsWeb is bound to the dataset dsWeb with the data member set to WebHdr Datasets.DSWeb.WebHdrRow hdrRow = (Datasets.DSWeb.WebHdrRow)((DataRowView)bsWeb.AddNew()).Row; bsWeb.EndEdit(); int index = bsWeb.Find("WebHdrID", hdrRow.WebHdrID); bsWeb.Position = index; for (int i = 0; i < lines.Length; i++) { string[] words = lines .Trim().Split(new char[] { ' ' }); if (words.Length >= 2) { // bsDetail is bound to bsWeb with the data member set to the relationship to between the header and detail Datasets.DSWeb.WebDtlRow dtlRow = (Datasets.DSWeb.WebDtlRow)((DataRowView)bsDetail.AddNew()).Row; dtlRow.FieldName = words[0]; string fieldValue = words[1]; for (int j = 2; j < words.Length; j++) { fieldValue += " " + words[j]; } dtlRow.FieldValue = fieldValue.Trim(); bsDetail.EndEdit(); if (dtlRow.FieldName == "Fullname") { hdrRow.CompanyName = dtlRow.FieldValue; bsWeb.EndEdit(); } } } } memoEdit.Text = null; } }23 июля 2008 г. 12:42 -17 сентября 2008 г. 17:01 - I dug around using reflector on .NET 2.0 (post hotfix), I've found that a DataTable has a private ReaderWriterLock field. That field (Reflector calls it System.Data.DataTable.indexesLock) is used to make all internal System.Data.Index operations threadsafe -- except for in one very notable instance, the CreateIndex() call inside System.Data.Select.SelectRows(). Several method calls inside this use the lock point to grab a WriteLock on the indexes, however, nowhere inside of SelectRows() does it take a ReadLock. This means ThreadA could be in the middle of reading an index while ThreadB is creating one, since the WriteLock will be granted due to no current ReadLocks. I think System.Data.Select.SelectRows() should be aquiring a ReadLock from the shared index locking point. For a few reasons: 1) It sticks out as being inconsistent in relation to all other index operations. The others are all threadsafe but his one is not. It doesn't matter if DataSet and its children are supposed to be inherently threadsafe or not, somebody started something in there that did not get finished. 2) It is completely unintuitive that DataTable.Select(...) is a potential WRITE operation on a DataTable. This is compounded by the fact that it is not listed in the documentation. The creation of an index to speed selection is a completely internal implementation feature of which we should not need be aware. Threadsafety was started in here but seemingly has a bug, so see #1. 3) This will probably fix the index corruption issues for people doing concurrent Selects, though from the researched comments from others, I think they'll still be a few other issues (mainly with data binding) that this doesn't fix. 4) For people wanting to use a DataTable shared between threads, they currently need to take an exclusive lock on the object just to Select from it. Yes there are workarounds, but there shouldn't need to be. Performance would be drastically increased if they could use ReaderWriterLocks of their own when sharing a DataTable. Many of them probably are already and just haven't hit this race condition. Thoughts?26 сентября 2008 г. 16:12 - Hi, I am writing a very simple application yet had to struggle with the DataTable Internal Index is Corrupted problem for a couple of days. Now I had found a solution that I would like to share with others who are writing similarly simple applications. The Problem - The Solution - In my application, I have a DataGridView that is bound at design-time to a Strongly Typed Dataset. I programmed the underlying TableAdapters to update the database from the underlying DataSet upon the DataGridView RowEnter event (doing this with the RowLeave event does not work) which fires when the user moves from one row to another. The same update is also programmed into the DataGridView Leave event which fires when the user moves from one form to another. This arrangement works for inserts and updates, but not deletes. There is a need to refresh the underlying dataset after deletes have been updated to the database, or the abovenamed error will occur. The solution is to perform an update and a refreshing read of the underlying data into the DataSet in the DataGridView RowRemoved event.Complications - The solution gave rise to some complications, but these were easily removed.Following is the code for a form with a databound DataGridView containing a databpund Combobox Firstly, the RowEnter and RowRemoved events fired during Form loading, and this caused problems as it was occuring in conjunction with the initial data loading process. The solution is to create a sentinel value at the form level which is set to True only upon Form Activated event. The update routine then checks for this value to be true before performing any update. Secondly, I continued to have problems in error handling for rows using databound Comboboxes. This was easily removed by creating another sentinel value at Form level which is set to True after the first time data is loaded into the combox. Data is not loaded into the combobox if on subsequent refreshes the sentinel value had already been set to true. <CODE> Public Class ServicesFrm Private isInitiated As Boolean Private isComboInitiated As Boolean Private Sub ServicesFrm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated isInitiated = True End Sub Private Sub ServicesFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load readData() End Sub Private Sub ServicesFrm_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize Me.DataGridView1.Top = 0 Me.DataGridView1.Left = 0 Me.DataGridView1.Width = Me.Width Me.DataGridView1.Height = Me.Height End Sub Private Sub saveData() Try Dim i As Integer = Me.LDRYServices_SP_getListTableAdapter.Update(Me.LaundryDS.LDRYServices_SP_getList) Catch e As Exception MsgBox(e.Message) readData() End Try End Sub Private Sub readData() Try If iscomboinitiated = False Then Me.LDRYUOM_SP_getListTableAdapter.Fill(Me.LaundryDS.LDRYUOM_SP_getList) isComboInitiated = True End If Me.LDRYServices_SP_getListTableAdapter.Fill(Me.LaundryDS.LDRYServices_SP_getList) Catch e As Exception MsgBox(e.Message) End Try End Sub Private Sub DataGridView1_RowEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowEnter saveData() End Sub Private Sub ServicesFrm_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave saveData() End Sub Private Sub DataGridView1_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError MsgBox(e.Exception.Message) readData() End Sub Private Sub DataGridView1_RowsRemoved(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsRemovedEventArgs) Handles DataGridView1.RowsRemoved If isInitiated Then saveData() readData() End If End Sub End Class </CODE> I will upload the unfinished application to for those who want to try and see how it works. The code was written using Visual Studio 2008 SP1 (but the behaviour was the same before SP1) and the database is SQL Server Express. Please take normal precautions to check the downloaded files for viruses etc as my hosted website is protected only with rudimentary security. Hope this will be helpful to the community. 3 октября 2008 г. 4:29 - hi, i am a beginner at VB.Net using VS2008 Express, 3.5 framework, and am working on my very first windows application that uses a MS Access 2003 database, and i am getting this index error. i notice that there has not been any more discussion on this topic since october 2008 and i was wondering if a solution has been figured out. i have read this discussion in its entirety and have not yet tried the hotfix. i am thinking it should have already been included in the version of visual studio that i have. if there is anyone still following this thread that might be able to point me in a direction to fix this problem, please reply. thank you, sherry I am using VS 2005 Express Edition13 января 2009 г. 18:42 - I am using Visual Studio 2008 SP1, running against .NET 3.5 and have also been experiencing this error for quite some time, intermittently. The code that trips it for me is when I set the .Expression member on a DataColumn of a DataTable: So despite the Begin/EndLoadData calls, setting column.Expression blows up from time to time. Not using multithreading, not calling ListingChanged or using BindingSources, nothing. As I understand it from reading this thread, a fix was supposed to make it into VS2008, but this apparently didn't remedy things. Would appreciate anyone's advice on how to fix this in my simple case. 13 января 2009 г. 19:23 - i tried the Begin/EndLoadData() approach too, with no success other than it changed the error type. yesterday i was getting the error very consistently. then this morning i added code to the Catch statement in the Try block to: 1. refill the data table 2. re-populate the new row from the textbox fields 3. call AddNewRow() again on the data table 4. show me a messagebox that says the first attempt had failed then proceeded with the rest of the code which first called the TableAdapter.Update(dataTable), and it had been accepting that. several times it failed the first attempt, but succeeded at the second attempt. so then i moved my TableAdapter.Fill(dataTable) statement to the very beginning of the whole method. (Previously i had statements to declare a new DataTableRow before the TableAdapter.Fill(DataTable).) Since that change, it has not failed the first attempt to add a new row. sherry I am using VS 2005 Express Edition14 января 2009 г. 10:32 - DataTable internal index is corrupted: '5' while changing combobox options : If you have BindingSource.CurrentItemChanged Event loaded along with ComboBox.SelectedIndexChanged twice then that would cause the problem. Resolution : Unwire outer BindingSource.CurrentItemChanged Wire ComboBox.SelectionChangeCommitted nilesh gite4 февраля 2009 г. 0:48 I had done the exact same thing as Stefano and am receiving the same error. I believe the specific error only idea we can come up with is that this hotfix is meant for Vista Home Edition only, whereas we have Enterprise Edition on our computers. Has anyone else run into this problem or know of a cause/fix? - Kevin10 июля 2009 г. 20:43 - I have reviewed this with interest and may be able to propose a workaround that helps some people if they are still struggling.I have a binding navigator and it is bound to some text boxes - for the detail record and a data grid for the summary.I was using the CurrentChanged event to run a query. This would cause 2 items in the current record to be updated (an acknowledgement it has been viewed). This worked fine going forwards through the records with the next button on the navigator. However selecting a different record from the grid would seem to cause the error to be provoked.I considered the various work arounds (e.g. using the RowChanged event on the underlying table). Unfortunatley these were impractical, the row changed event was fired every time a row was added during initial population and thus this causes probolem, also after loading I would need to confirm the firsat one (and I couldn't figure out a way do finding the current record in a data table).However, my work around was to move the code to the Position event. When I did this all my problems went away.I also noticed another problem:-If the underlying data table was changed during the current changed event then the bound grid was NOT updated properly.No idea if this is helpful to anybody else, but I though it might be worth changing. Of course not being able to change the underlying table during a changed event is a major flaw, this must be a very common scenario.Regards,Simon. 18 октября 2009 г. 9:53 -
https://social.msdn.microsoft.com/Forums/ru-RU/18544cd3-1083-45fe-b9e7-bb34482b68dd/exception-datatable-internal-index-is-corrupted-5-on-?forum=adodotnetdataset
CC-MAIN-2015-18
refinedweb
21,168
59.6
I might like to check out pysvn extension from pysvn.tigris.org for a working and python friendly svn client interface. pysvn is rich enough to allow all the command line client to be written in python and a subversion GUI. Windows installation kits are available in the files area and svn client written in python in the examples. Barry At 09-01-2004 13:25, Toshio wrote: >Looking through the mail archives I found a sugestion by Barry Scott in >October to rename many of the python bindings from: > >svn.client.svn_client_status() to svn.client.status() > >This met with some approval and discussion of how svn.core needed to be >treated differently. AFAIK this hasn't been implemented. Is it not a >good idea? Too late because of the freeze for 1.0? > >If it were a good idea, it seems it should happen before 1.0 so we don't >doom ourselves to writing doubly "namespaced" code for the life of the >1.0-stable branch. > >-Toshio >-- >Toshio <toshio@tiki-lounge 14 22:31:49 2004 This is an archived mail posted to the Subversion Users mailing list.
http://svn.haxx.se/users/archive-2004-01/0458.shtml
CC-MAIN-2014-41
refinedweb
190
76.11
Attentional-blink tutorial (advanced) - Difficulty - The goal - Step 1: Download and start OpenSesame - Step 2: Choose template, font, and colors - Step 3: Implement counterbalancing - Step 4: Define experimental variables that are varied between blocks - Step 5: Create instructions - Step 6: Modify feedback - Step 7: Define experimental variables that are varied within a block - Step 8: Define trial sequence - Step 9: Create RSVP stream (prepare phase) - Step 10: Execute RSVP stream (run phase) - Step 11: Create fixation point - Step 12: Define response collection - Step 13: Specify number and length of blocks - Step 14: Run experiment! - Extra 1: Check timing (and learn some NumPy) - Extra 2: Add assertions to check your experiment - Extra 3: Use PsychoPy directly - References Difficulty This tutorial assumes a basic knowledge of OpenSesame, experimental design, and Python. An introductory OpenSesame tutorial can be found here: Links to introductory Python tutorials can be found here: The goal In this tutorial, we will implement an attentional-blink paradigm, as introduced by Raymond, Shapiro, and Arnell (1992). We will re-create experiment 2 from Raymond et al. almost exactly, with only a few minor modifications. In this experiment, the participant sees a stream of letters, typically called an RSVP stream (for Rapid Serial Visual Presentation). There are two conditions. In the experimental condition, the participant's task is twofold: - Report the identity of the white letter (all other letters were black). - Indicate whether an 'X' was present. In the control condition, the participant's task is only to ... - Indicate whether an 'X' was present. The white letter is called the T1 (or 'target'). The 'X' is called the T2 (or 'probe'). The typical finding is that the T2 is often missed when it is presented 200 - 500 ms after T1, but only when T1 needs to be reported. This phenomenon is called the attentional blink, because it is as though your mind's eye briefly blinks after seeing T1. But surprisingly, T2 is usually not missed when it follows T1 immediately. This is called lag-1 sparing. The results of Raymond et al. (1992) looked like this: Figure 1. T2 accuracy as a function of the serial position of T2 relative to T1 ('lag'). A lag of 0 means that T1 and T2 where identical (i.e. a white 'X'). Adapted from Raymond et al. (1992). Step 1: Download and start OpenSesame OpenSesame is available for Windows, Linux, Mac OS (experimental), and Android (runtime only). This tutorial is written for OpenSesame 3.0.X. You can download OpenSesame from here: When you start OpenSesame, you will be given a choice of template experiments, and a list of recently opened experiments (Figure 2). Figure 2. The OpenSesame window on start-up. Step 2: Choose template, font, and colors The 'Extended template' provides the basic structure of a typical trial-based experiment with a practice and experimental phase. Because our experiment fits this template very well, we're going to use it. Therefore, double-click on 'Extended template' to open it. In the 'General tab' that now appears, you can specify the general properties of your experiment. For this experiment, we want to use black letters on a gray background. Also, the default font size of 18 is a bit small, so change that to 32. Finally, it's good practice to give your experiment an informative name and description. Your 'General tab' now looks as in Figure 3. Figure 3. The General tab is where you define the general properties of your experiment. Step 3: Implement counterbalancing In Raymond et al. (1992), the experimental and control conditions were mixed between blocks: Participants first did a full block in one condition, and then a full block in the other condition. Condition order was counterbalanced, so that half the participants started with the experimental condition, and the other half started with the control condition. Let's start with the counterbalancing part, and use the participant number to decide which condition is tested first. We need to do this as the very first thing of the experiment, and we need to use some Python scripting to do it. Therefore, drag an inline_script from the item toolbar onto the very top of the experiment. Change the name of the new item to counterbalance. In the Prepare phase of the counterbalance item, enter the following script: if var.subject_parity == 'even': var.condition1 = 'experimental' var.condition2 = 'control' else: var.condition1 = 'control' var.condition2 = 'experimental' Ok, let's take a moment to understand what's going on here. The first thing to know is that experimental variables are properties of the var object. Experimental variables are variables that you have defined yourself, for example in a loop item, as well as built-in variables. One such built-in experimental variable is subject_parity, which is automatically set to 'even' when the experiment is launched with an even subject number (0, 2, 4, etc.), and to 'odd' when the subject number is odd (1, 3, 5, etc.). We further create two new experimental variables condition1 and condition2. By setting these as properties of var, we make them available elsewhere in OpenSesame, outside of inline_script items. So this line: var.condition1 = 'experimental' ... creates an experimental variable with the name condition1, and gives it the value 'experimental'. In step 4, we will use this variable to determine which condition is tested first. In other words, this script says the following: - All even-numbered subjects start with the experimental condition. - All odd-subjects start with the control condition. Step 4: Define experimental variables that are varied between blocks As mentioned above, conditions are varied between blocks. To understand how this works in OpenSesame, it's best to start at the bottom (see Figure 4), with ... - the trial_sequence, which corresponds (as you might expect) to a single trial. One level above ... - the block_loop corresponds to a single block of trials. Therefore, this is where you would define experimental variables that are varied within a block. One level above ... - the block_sequence corresponds to a single block of trials plus the events that happen before and after every block, such as post-block feedback on accuracy, and pre-block instructions. One level above ... - the practice_loop and experimental_loop correspond to multiple blocks of trials during respectively the practice and non-practice (experimental) phase. Therefore, this is where you would define experimental variables that are varied between blocks. In other words, we need to define our between-block manipulations near the top of the experimental hierarchy, in the practice_loop and experimental_loop. Figure 4. A fragment of the experimental structure as shown in the overview area. Click on practice_loop to open the item. Right now, there is only one variable, practice, which has the value 'yes' during one cycle (i.e. one block). Let's get to work! Add a variable called condition, change the number of cycles to 2, and change the order to 'sequential'. Now use the previously created variables condition1 and condition2 to determine which condition is executed first, and which second (see Figure 5). To indicate that something is the name of a variable, and not a literal value, put square brackets around the variable name: '[my_variable]' Figure 5. The practice_loop item after Step 4. Do the same thing for experimental_loop, except that the variable practice has the value 'no'. (The practice variable doesn't have a real function. It only allows you to easily filter out all practice trials during data analysis.) Step 5: Create instructions Because the task differs between blocks, we need to show an instruction screen before each block. The block_sequence is the place to do this, because, as explained above, it corresponds to a single block of trials plus the events that occur before and after every block. There are various items that we could use for an instruction screen, but we will use the sketchpad. Insert two new sketchpads at the top of block_sequence by dragging them from the item toolbar. Rename the sketchpads to instructions_experimental and instructions_control. Click on both items to add some instructional text, such as shown in Figure 6. Figure 6. An example of instructional text in the instructions_experimental item. Right now both instruction screens are shown before every block, which is not what we want. Instead, we want to show only the instructions_experimental item in the experimental condition, and only the instructions_control item in the control condition. We can do this with conditional ('run if') statements. Click on block_sequence to open it. You will see a list of item names, just as in the overview area, except that each item has the text 'always' next to it. These are run-if statements, and they determine the conditions under which an item is executed. Double click on the run-if statement next to instructions_experimental and add the following text: [condition] = experimental This means that instructions_experimental will only be executed when the variable condition has the value 'experimental.' Analogously, change the run-if statement for instructions_control to: [condition] = control Your block_sequence should now look as in Figure 7. Figure 7. The block_sequence item at the end of Step 5. Step 6: Modify feedback Open feedback. By default, in the Extended Template, the participant receives feedback on speed ( avg_rt) and accuracy ( acc) after each experimental block. However, our experiment doesn't require speeded responses, and we should therefore only provide feedback on accuracy. Modify the feedback item to look something like Figure 8. Figure 8. The block_sequence item at the end of Step 6. Links Step 7: Define experimental variables that are varied within a block Raymond et al. (1992) vary the position of T2 relative to T1 from 0 to 8, where 0 means that one letter is both T1 and T2 (i.e. a white 'X'). They also have trials in which there is no T2. This is all varied within a block. There are various ways to code this, but the easiest way is to use two variables: lagindicates the position of T2 relative to T1. It has a value of 0 - 8, or no value if there is no T2. T2_presentis 'y' for trials on which there is a T2 and 'n' for trials on which there is no T2. Of course, this is redundant, because T2_presentis 'y' on all trials on which laghas a value. But it's convenient to define T2_present, because we can use it later on to specify the correct T2 response. Click on block_loop and create a variable table as shown in Figure 9. Figure 9. The block_loop item after Step 7. Step 8: Define trial sequence We will use an inline_script item to do most of the heavy lifting, and therefore our trial_sequence is quite simple. It consists of: - A sketchpad (called fixation) to show a fixation dot. - An inline_script (called RSVP) item that implements the RSVP stream. - A sketchpad (called ask_T1) that asks the participant to report T1. - A keyboard_response (called response_T1) that collects the T1 report. - A sketchpad (called ask_T2) that asks the participant to report T2. - A keyboard_response (called response_T2) that collects the T2 report. - A logger (called logger) that writes all the data to a log file. Drag all the required items from the item toolbar into trial_sequence, re-order them if necessary, and give them informative names. Also, use run-if statements to collect a T1 response only in the experimental condition. Your trial sequence should now look like Figure 10. Figure 10. The trial_sequence item after Step 8. Step 9: Create RSVP stream (prepare phase) Now we're getting to the fun-but-tricky part: implementing the RSVP stream. Click on RSVP to open the item. You see two tabs: Prepare and Run. The golden rule is to add all code related to stimulus preparation to the Prepare tab, and all code related to stimulus presentation to the Run tab. Let's start with the preparatory stuff, so switch to the Prepare tab. First, we need to import the Python modules that we plan to use: import random import string Next, we need to define several variables that determine the details of the RSVP stream. We will make them properties of the var object, that is, turn them into experimental variables. This not necessary, but has the advantage that they will be automatically logged. # The color of T1 var.T1_color = 'white' # The presentation time of each stimulus # (rounded up to nearest value compatible with refresh rate) var.letter_dur = 10 # The inter-stimulus interval # (rounded up to nearest value compatible with refresh rate) var.isi = 70 Next, we are going to create the letter stream. Raymond et al. have a few rules: - The number of letters that precede T1 is randomly selected between 7 and 15. - The number of letters that follow T1 is always 8. - Letters are randomly sampled without replacement from all uppercase letters except 'X' (which is used for T2). Let's translate these rules to Python: # The position of T1 is random between 7 and 15. Note that the first position is # 0, so the position indicates the number of preceding stimuli. var.T1_pos = random.randint(7, 15) # The maximum lag, i.e. the number of letters that follow T1. var.max_lag = 8 # The length of the stream is the position of T1 + the maximum lag + 1. We need # to add 1, because we count starting at 0, so the length of a list is always # 1 larger than its maximum index. var.stream_len = var.T1_pos + var.max_lag + 1 # We take all uppercase letters, which have been predefined in the `string` # module. Converting to a `list` creates a list of characters. letters = list(string.ascii_uppercase) # We remove 'X' from this list. letters.remove('X') # Randomly sample a `stream_len` number of letters stim_list = random.sample(letters, var.stream_len) Ok, stim_list now contains all letters that make up our RSVP stream on a given trial, except for the T2 (if present). Therefore, on T2-present trials, we need to replace the letter at the T2 position by an 'X'. if var.T2_present == 'y': var.T2_pos = var.T1_pos + var.lag stim_list[var.T2_pos] = 'X' We now have a variable called stim_list that specifies the letters in our RSVP stream. This is a list that might contain something like: ['M', 'F', 'O', 'P', 'S', 'R', 'Y', 'C', 'U', 'Z', 'G', 'A', 'T', 'E', 'H', 'J', 'V', 'N', 'B', 'K', 'X', 'Q']. Note that stim_list is not an experimental variable, i.e. it is not a property of the var object. This is because experimental variables cannot be lists: The var object would turn the list into a character string, and that's not what we want! The next step is to create a list of canvas objects, each of which contains a single letter from stim_list. A canvas object corresponds to a static visual stimulus display, i.e. to one frame in our RSVP stream. You can create a canvas object using the canvas() function, which is one of OpenSesame's common functions that you can call without needing to import anything. # Create an empty list for the canvas objects. letter_canvas_list = [] # Loop through all letters in `stim_list`. `enumerate()` is a convenient # function that automatically returns (index, item) tuples. In our case, the # index (`i`) reflects the position in the RSVP stream. This Python trick, in # which you assign a single value to two variables, is called tuple unpacking. for i, stim in enumerate(stim_list): # Create a `canvas` object. letter_canvas = canvas() # If we are at the position of T1, we change the foreground color, because # T1 is white, while the default color (specified in the General tab) is # black. if i == var.T1_pos: letter_canvas.set_fgcolor(var.T1_color) # Draw the letter! letter_canvas.text(stim) # And add the canvas to the list. letter_canvas_list.append(letter_canvas) We also need to create a blank canvas to show during the inter-stimulus interval: blank_canvas = canvas() Finally, we set the identity of T1 as an experimental variable, because it has been randomly determined in the script: # Extract T1 from the list var.T1 = stim_list[var.T1_pos] Preparation done! Links Step 10: Execute RSVP stream (run phase) Now, let's switch to the Run tab of the RSVP item. Here we add the code that is necessary to show all the canvas objects that we have created during the Prepare phase. And that's not so hard! All we need to do is: - For each letter canvas in the letter-canvas list - Show the letter canvas - Wait for letter_durmilliseconds - Show the blank canvas - Wait for isimilliseconds This translates almost directly into Python: for letter_canvas in letter_canvas_list: letter_canvas.show() clock.sleep(var.letter_dur) blank_canvas.show() clock.sleep(var.isi) Done! Step 11: Create fixation point After all this coding, it's time to get back to something simpler: Defining the fixation point. Click on fixation in to open the item. Change the duration to 995. This value will be rounded up to the nearest value compatible with your monitors refresh rate, which is 1000 ms for most common refresh rates. Draw a fixation dot in the center, using the fixation-dot tool (the dot with the little hole in it). Figure 11. The fixation sketchpad after Step 11. Step 12: Define response collection We will collect responses as follows: - Ask for T1 - Collect a response, which is a single key press that corresponds to T1. So if T1 was 'A', the participant should press the 'a' key. - Ask for T2 - Collect a response, which is 'y' when T2 was present and 'n' when T2 was absent. We will use the ask_T1 sketchpad to ask the participant for T1. Click on ask_T1 to open the item, and add a line of text, such as 'Please type the white letter'. Change the duration to 0. This 0 ms duration does not mean that the text is only shown for 0 ms, but that the experiment moves immediately to the next item, which is response_T1. Open response_T1. The only thing that we have to do is define the correct response. To do this, we can use the T1 experimental variable that we have set while preparing the RSVP stream. Therefore, enter '[T1]' in the 'Correct response' field. Open ask_T2, and add a line of text, such as 'Did you see an X? (y/n)'. Again, set the duration to 0, so that the experiment moves immediately to the next item, which is response_T2. Open response_T2. Again, we need to define the correct response, this time using the variable T2_present, which we had defined in the block_loop. Therefore, add '[T2_present]' to the 'Correct response' field. It's also useful to restrict the allowed responses to 'y' and 'n', so that participants don't accidentally press the wrong key. You can do this by entering a semicolon-separated list of keys in the 'Allowed responses' field (i.e. 'y;n'). So how will the responses be logged? Each response item sets response, correct, and response_time variables. In addition, to distinguish responses set by different items, each response item sets these same variables followed by _[item name]. In other words, in this experiment the response variables of interests would be correct_T1_response and correct_T2_response. Step 13: Specify number and length of blocks You now have a fully working experiment, but one thing still needs to be done: Setting the length and number of blocks. We will use the following structure: - 1 practice block of 9 trials in each conditon. - 5 experimental blocks of 36 trials in each condition. First, open block_loop. The 'Repeat' value is currently set to 1, which means that each trial is executed once, giving a block length of 18 trials. We want to specify the 'Repeat' value with a variable, so that we can have a different value for the practice and experimental blocks. To do this, we need to make a small modification to the script of block_loop. Click on the 'View' button in top-right of the tab (the middle of the three buttons), and select 'View script'. This will hide the graphical controls, and show the underlying OpenSesame script. Now change this line ... set repeat "1" ... to ... set repeat "[block_repeat]" ... and click 'Apply and close'. This means that the variable repeat is now defined in terms of another variable, block_repeat. OpenSesame will tell you that it doesn't know the length of the block anymore (see Figure 12), but that's ok: As long as the variable block_repeat is defined, things will work fine. Figure 12. If the length of a loop is variably defined, OpenSesame notifies you of this. Now open practice_loop. Add a variable block_repeat and give it the value 0.5. This means that 0.5 x 18 = 9 cycles of block_loop will be executed, just as we want. Now open experimental_loop. Again, add a variable block_repeat and give it the value 2. This means that each block has a length of 2 x 18 = 36 trials. Also, change the number of cycles to 10, and arrange the loop table so that you first have five blocks of condition1, followed by five blocks of condition2 (see Figure 13). Figure 13. If the length of a loop is variably defined, OpenSesame notifies you of this. Step 14: Run experiment! That's it. You can now run the experiment! Figure 14. Yes, you did! Extra 1: Check timing (and learn some NumPy) In time-critical experiments, you should always verify whether the timing is as intended. When using canvas objects, you can make use of the fact that the canvas.show() method returns the timestamp of the display onset. Therefore, as a first step, we maintain two lists: one to keep track of the letter-canvas onsets, and one to keep track of the blank-canvas onsets. To do this, we need a small modification to the script in the Run tab of the RSVP item: l_letter_time = [] l_blank_time = [] for letter_canvas in letter_canvas_list: t1 = letter_canvas.show() l_letter_time.append(t1) clock.sleep(var.letter_dur) t2 = blank_canvas.show() l_blank_time.append(t2) clock.sleep(var.isi) We now have two lists with timestamps: l_letter_time and l_blank_time From these, we want to determine the average presentation duration of a letter, the average duration of a blank, and the standard deviation for both averages. But because lists are not great for these kinds of numerical computations, we are going to convert them to another kind of object: a numpy.array. import numpy a_letter_time = numpy.array(l_letter_time) a_blank_time = numpy.array(l_blank_time) Now we can easily create an array that contains the presentation duration for each letter: a_letter_dur = a_blank_time - a_letter_time This creates a new array, a_letter_dur, in which each item is the result of subtracting the corresponding item in a_letter_time from the corresponding item in a_blank_time. Schematically: a_letter_dur -> [ 1, 1, 1 ] = a_blank_time -> [ 11, 21, 31 ] - a_letter_time -> [ 10, 20, 30 ] Similarly, but slightly more complicated, we can create a new array, a_blank_dur, in which each item is the result of subtracting item i in a_blank_time from item i+1 in a_letter_time. a_blank_dur = a_letter_time[1:] - a_blank_time[:-1] Schematically: a_blank_dur -> [ 9, 9 ] = a_letter_time[1:] -> [ 20, 30 ] # The leading 10 is stripped off - a_blank_time[:-1] -> [ 11, 21 ] # The trailing 31 is stripped off The next step is to use the array.mean() and array.std() methods to get the averages and standard deviations of the durations in one go. To inspect these values, we set them as experimental variables (i.e. as properties of the var object). That way they will be logged and visible in the variable inspector. var.mean_letter_dur = a_letter_dur.mean() var.std_letter_dur = a_letter_dur.std() var.mean_blank_dur = a_blank_dur.mean() var.std_blank_dur = a_blank_dur.std() Done! Extra 2: Add assertions to check your experiment A Dutch proverb states that a mistake is in a small corner. (I suspect that according to the original proverb the mistake, rather than the corner, was small, but no matter.) Developing experiments, or any kind of software, without bugs is almost impossible. However, you can protect yourself from many bugs by building safeguards into your experiment. For example, our experiment has two conditions, defined as 'experimental' and 'control'. But what if I accidentally misspelled 'experimental' as 'experimentel' in the experimental_loop? The experiment would still run, but it would no longer work as expected. Therefore, we want to make sure that condition is either 'experimental' or 'control', but nothing else. In computer-speak, we want to assert that this is the case. Let's take a look at how we can do this. First, drag a new inline_script item to the start of the trial_sequence and rename it to assertions. Add the following line to the Run tab: assert(var.condition in ['experimental', 'control']) Let's dissect this line: var.conditionrefers to the experimental conditionvariable. in ['experimental', 'control']checks whether this variable matches any of the items in the list, i.e. whether it is 'experimental' or 'control'. assert()states that there has to be a match. If not, the experiment will crash (an AssertionErrorwill be raised). In other words, whatever you pass to assert() has to be True, otherwise your experiment will crash. This useful for sanity checks. Some more assertions: assert(var.T2_present in ['y', 'n']) assert(var.lag in ['']+range(0,9)) And a final one that is a bit more complicated. Can you figure out what it does? assert((var.lag == '') != (var.T2_present == 'y')) Links - - Advice on protective programming in Axelrod (2014, doi:10.3389/fpsyg.2014.01435) Extra 3: Use PsychoPy directly OpenSesame is backend independent. This means that different libraries can be used for controlling the display, sound, response collection, etc. You can select the backend in the General tab. So far, we have used OpenSesame's own canvas object, which automatically maps onto the correct functions of the selected backend. Therefore, you don't have to bother with or know about the details of each backend. However, you can also directly use the functions offered by a specific backend, such as PsychoPy. This is especially useful if you want to use functionality that is not available in OpenSesame's own modules. First, to use PsychoPy, you need to switch to the psycho backend, which you can do in the 'General properties' tab of your experiment . Now, when you start the experiment, OpenSesame will automatically initialize PsychoPy, and the psychopy.visual.Window object will be available as win in inline_scripts. Now let's see how we can implement our RSVP stream in PsychoPy. (The script below replaces the part in the Prepare phase of RSVP in which we created letter_canvas_list.) from psychopy import visual textstim_list = [] for i, stim in enumerate(stim_list): if i == var.T1_pos: color = 'white' else: color = 'black' # All stimuli require an psychopy.visual.Window object to be passed as first # argument. In OpenSesame, this object is available as `win`. textstim = visual.TextStim(win, text=stim, color=color) textstim_list.append(textstim) The main difference with our previous script is that we don't draw text on a canvas object. Instead, the text is an object by itself (a TextStim), and it has its own draw() method to draw it to the screen. Of course, we also need to update the Run phase of the RSVP stream, which now looks like this: for textstim in textstim_list: textstim.draw() win.flip() clock.sleep(var.letter_dur) win.flip() clock.sleep(var.isi) The main difference here is that we need to call several methods to show our stimuli, instead of only canvas.show(). First, we need to call the draw() method on all stimuli that we want to show: textstim.draw() Next, we need to call win.flip() to refresh the display so that the stimuli actually become visible. If we call win.flip() without any preceding calls to draw(), as we do before the inter-stimulus-interval, it has the effect of clearing the display. That's it! References Axelrod, V. (2014). Minimizing bugs in cognitive neuroscience programming. Frontiers in Psychology: Perception Science, 5, 1435. doi:10.3389/fpsyg.2014.01435 Raymond, J. E., Shapiro, K. L., & Arnell, K. M. (1992). Temporary suppression of visual processing in an RSVP task: An attentional blink? Journal of Experimental Psychology: Human Perception and Performance, 18(3), 849–860. doi:10.1037/0096-1523.18.3.849
https://osdoc.cogsci.nl/3.2/tutorials/advanced/
CC-MAIN-2019-22
refinedweb
4,691
65.32
TT-2 USB 02 OWNER’S MANUAL 03 ILLUSTRATIONS 04 CONNECTIONS 06 SETUP & USAGE 10 SPECIFICATIONS 11 TROUBLESHOOT ww w. a r g on au d i o. c om 1 TT-2 USB Owner’s manual Dear Customer, Quality has always been our driving force and founding Argon Audio is a natural extension of this philosophy. We have 20 years’ experience in creating and specifying high quality products, manufacturing them and selling them on to end users with Value-for-Money as the primary aim. And Argon Audio is a brand fully compliant with these values. Design, features and quality standards are all specified in Denmark and manufacturing takes place in the Far East, where quality vendors are highly competitive - and as a result supply outstanding Value-for-Money products – to the delight of both ourselves and our customers! Introduction Thank you for choosing Argon Audio TT-2 Turntable, we hope it will bring you many years of enjoyment. Please read this manual fully before unpacking and installing the product. Maintenance and cleaning Your record player requires little or no regular maintenance. Remove dust with a slightly moistened antistatic cloth. Never use a dry cloth because this will create static electricity which attracts more dust! Antistatic cleaning fluids are available at specialist stores but must be applied sparingly to avoid damage to rubber parts. It is recommended to fit the needle cover before cleaning or maintenance is carried out to avoid damage. If the player is not used over a long period of time the drive belt can be removed to prevent unequal stretching. Always disconnect the record player from the mains power supply as a precaution before maintenance! Useful tips The record player should be positioned on a low-resonance surface such as wood or multiple layer ply board to avoid structural vibrations disturbing replay. Environmental information Argon TT2 complies with international directives on the Restriction of Hazardous Substances (RoHS) in electrical and electronic equipment and the disposal of Waste. Electrical and Electronic Equipment (WEEE) - the crossed bin symbol indicates compliance and that the products must be appropriately recycled or processed in accordance with these directives. Safety instructions Please store this instruction manual for future reference. Do not use this product near water or moisture. Place the unit on a solid surface. Do not block any ventilation openings. Do not put it in a closed bookcase or a cabinet that may keep air from flowing through its ventilation openings. Do not install near any heat sources, such as radiators, heat registers, stoves or other appliances that produce heat. Protect the power cord from being walked on or pinched, particularly at plugs and the point where they exit from the product. Servicing is required when the product has been damaged. Do not attempt to service this product yourself. Opening or removing covers may expose you to dangerous voltages or other hazards. ww w. a r g on au d i o. c om 2 Please contact the manufacturer to be referred to an authorized service center near you. To prevent risk of fire or electric shock, avoid over loading wall outlets, extension cords, or integral convenience receptacles. Do not let objects or liquids enter the product. Use proper power sources. Plug the product into a proper power source, as described in the operating instructions or as marked on the product. TT-2 USB Unpacking We have during production and packing carefully checked and inspected this Turntable. After unpacking please check for any damage from transport. We recommend that you keep the original carton box and packing material for any future shipping. ww w. a r g on au d i o. c om 3 Controls, features and connections ww w. a r g on au d i o. c om TT-2 4 Controls, features and connections 1 Power switch 2/22 Stepped drive pulley and drive belt 3 Platter with felt mat 4/4a Tonearm counterweight - 4a Downforce scale 5 Tonearm lift lever 6/66 Tonearm rest and removable transport lock 7 Tonearm tube 8 Anti-skating weight adjustment scale 9 Anti-skating weight support hoop 10 Anti-skating weight with wire 11 Headshell with finger lift and fitted Ortofon OM 5E cartridge 12 Signal output cable 13 Power supply socket (on USB version in middle) 14 Lid hinges with Hinge fasteners *Power supply not shown TT-2 Connections especially for USB version Compared to the non-USB version, the USB version has connectors on the back. The RCA cable and the ground cable have to be connected to the turntable. Whereas on the Non-USB version the RCA cable is mounted on the turntable. USB connection is also on the back of the USB version. ww w. a r g on au d i o. c om 5 TT-2 Setup and usage In order to achieve maximum performance and reliability with this record player you should study these instructions for use carefully. The Argon Audio TT2 record player is supplied with a factory fitted and adjusted cartridge. During assembly and adjustment of the deck, small parts could be lost if not carefully placed in a suitable receptacle. Before starting assembly make yourself acquainted with the parts listed above and correspondingly numbered in the technical drawings above. Set-up Make sure the surface you wish to use the turntable on is level (use a spirit level) before placing the turntable on it. Fit the drive belt (2/22) around the hub (2/22) and the smaller diameter part of the motor pulley (2/22). Avoid getting sweat or grease on the belt as these will deteriorate the performance and reduce the belt's lifespan. Use absorbent kitchen paper to remove any oil or grease from the outer edge of the hub and the belt. Fit the platter (3) and felt mat over the spindle of the hub (2/22). Cartridge down force adjustment Adjusting the down force and anti-skating if you are not familiar with it can be complicated. We recommend that you watch the following video for your convenience. YouTube video for adjusting down force and anti skating on a turntable (click here). The counterweight (4) supplied is suitable for cartridges weighing between 3,5 - 5,5g. An alternative counterweight for cartridges weighing between 6 - 9g is available as an accessory part. Adjust the down force prior to installing the anti-skating weight. Gently push and turn the counterweight (4) onto the arm tube stub. Lower the arm lift and position the cartridge in the space between arm rest and platter. Carefully rotate the counterweight (4) until the arm tube balances out. The arm should return to the balanced position if it is moved up or down. This adjustment must be done carefully. Do not forget to remove the cartridge protection cap if fitted. Once the arm is correctly balanced return it to the rest. Hold the counterweight (4) without moving it, and gently revolve the down force scale ring (4a) until the zero is in line with the anti-skating prong (8). Check whether the arm still balances out. Rotate the counterweight counter clockwise (seen from the front) to adjust the down force according to the cartridge manufacturer's recommendations. One mark on the scale represents 1 mN (= 0,1g / 0,1 Pond) of downforce. The recommended downforce for the factory fitted cartridge is 17,5mN ww w. a r g on au d i o. c om 6 TT-2 Anti-skating force adjustment The anti-skating force must be adjusted according to the mass of the cartridge as follows: Downforce Groove in the stub (8) 10 - 15mN 1st from bearing rings 15 - 20mN 2nd " " " rd " " " 20mN and bigger 3 Slip the loop of the anti-skating weight's thread over the second groove of the stub to set the correct anti-skating force for the factory-fitted cartridge. Feed the thread through the loop of the wire support (10). Connection to the amplifier The Argon Audio TT2 has a captive tonearm signal lead (12) for connection to the amplifier. Use the Phono input (sometimes labelled gram, disc or RIAA) on your amplifier. Make sure that the phono input offers correct matching and amplification for the type of cartridge used. Line inputs (such as CD, Tuner, Tape or Video) are not suitable. Take care to connect the left and right channels correctly. The right channel is usually marked red, the left channel black or white. Check the manual supplied with your amplifier for relevant information., the NAD RIAA AMP or the CAMBRIDGE RIAA AMP, which is then connected between the record player and a free line level input of the amplifier. NOTICE. Argon Audio TT2 USB version has build in RIAA AMP The recommended load resistance for the factory fitted cartridge is: 47kohms /MM-input ww w. a r g on au d i o. c om 7 TT-2 Connecting to a Computer Connect the USB-output of the unit to a free USB-socket on your computer and turn it on/make sure it is powered on. The “new hardware found assistant“ will automatically detect the unit and announces it as a Microphone USB audio codec. There is no need to install a driver manually. After installation, one setting has to be done. For example - Windows 7® operating system: Control Panel Sound Recording Microphone USB Audio CODEC Properties Advanced: set to 2 channel, 16 bit, 48000 Hz (DVD Quality) Please note: Connection should be made to a USB-socket of your computer directly. Connecting to USB-hubs or switches can cause problems. Recording Programme In case you do not have a recording programme installed on your computer, you may download one free from the Internet. Recording programmes may be found by searching Google. In the menu of the recording programme, source or input may have to be set to Microphone USB audio codec. Please be aware that downloads from the Internet are made entirely at your own risk. Under no circumstances can we carry responsibility or provide support for third-party software products sourced from the internet or for any damage or problems arising from the use thereof. All downloads should be checked with an up-to-date anti-virus programme. License fees may be applicable. Mains power connection The turntable is supplied with a power supply suitable for your country's mains supply. Check the label before connecting to ensure compliance with the mains rating in your house. Connect the low voltage plug from the power supply to the socket (13) on the rear of the record player before connecting the power supply to the mains. Fitting the lid Fit the lid carefully over the hinge fasteners and adjust the screws (14) until the lid stays open where you want it to without being too stiff to open or close. Switching on and off Pressing the power switch (1) alternately starts or stops the motor. ww w. a r g on au d i o. c om 8 TT-2 Changing replay speed To play records at 45 r.p.m. first remove the platter (3). Using the accessory tool provided, hook the belt over the larger diameter part of the motor pulley (2/22). Refit the platter. To revert to 33,33 r.p.m. repeat the proceedings using the smaller step on the pulley. Fitting and connecting the cartridge ** All cartridges with half inch mounting holes can be fitted. Leaving the needle's protection cover on, fit the cartridge to the headshell using the screws supplied with the cartridge by passing one screw through each slot in the headshell (11). Do not tighten the nuts yet. Connect the tonearm wires to the cartridge pins as follows: white left channel positive (L+) red right channel pos. (R+) green right channel return (R -) blue left channel return (L -) The full sound quality of the Argon Audio TT2 can only be achieved if the cartridge is correctly adjusted. If you are not well acquainted with the adjustment of cartridges you are advised to call upon the willing help of your Argon Audio dealer to accomplish this task for you. ww w. a r g on au d i o. c om 9 TT-2 Technical specifications Argon Audio TT2 Nominal speeds Speed variance Wow and flutter Signal to noise Downforce range Effective tonearm length Overhang Power consumption Outboard power supply Dimensions (W x H x D) Weight USB Version specific 33,33/45,11 Build in RIAA AMP Technical specifications ORTOFON OM 5E Frequency response Channel balance Channel separation Output voltage 20Hz - 20kHz <2dB >22dB 4mV Recommended load resistance Amplifier connection Recommended tracking force Weight ww w. a r g on au d i o. c om 47kohms MM -input 17,5mN 5g 1 0 Troubleshoot - Potential incorrect use and fault conditions TT-2 Argon Audio turntables are manufactured to the highest standards and undergo strict quality controls before leaving the factory. Faults that may possibly occur are not necessarily due to material or production faults but can sometimes be caused by incorrect use or unfortunate circumstances. Therefore the following list of common fault symptoms is included. The platter doesn't turn although the unit is switched on: • • • The unit is not connected to the mains power supply. No mains at the socket. Drive belt is not fitted or has slipped off. No signal through one or other channel or both channels: No signal contact from the cartridge to the internal tonearm wiring or from that to the arm lead or from that to the phono box or between that and the amplifier. This could be due to a faulty plug, broken wire or solder joint or simply loose plug/socket connection. • Phono input not selected at amplifier. • Amplifier not switched on. • Amplifier or speakers defective or muted. • No connection to the loudspeakers. Strong hum on phono input: • No earth connection from cartridge or arm or arm cable to amplifier, or earth loop. Distorted or inconsistent sound from one or both channels: • Record player is connected to wrong input of amplifier, or MM/MC switch incorrectly set. • Needle or cantilever damaged. • Wrong r.p.m., drive belt overstretched or dirty, platter bearing without oil, dirty or damaged. ww w. a r g on au d i o. c om 1 1 * Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
https://manualzz.com/doc/10995496/tt--2-u---s---b
CC-MAIN-2021-04
refinedweb
2,409
62.68
From that webpage, someone has just used Cython to implement them -- they don't come with Cython. You can install that package in the same way as most packages on PyPI: Download bintrees-0.3.0.tar.gz from PyPI Extract the tarball. Run sage -python setup.py install You'll be able to run import bintrees from within your Sage sessions now. As for using the package, you'll have to look at that package's specific documentation. The Cython documentation is not built / included in Sage, but you can find it at. For other packages, it varies. For example, you can find the Pari documentation under $SAGE_ROOT/local/share/pari/doc/. None of this package specific documentation is specifically made available from within the notebook. When you type in cython? from the notebook, you're getting the documentation a specific function called cython within Sage -- this is different than the documentation for Cython itself. I'm not sure what you mean about "optional included sub-packages".
https://ask.sagemath.org/answers/11585/revisions/
CC-MAIN-2018-34
refinedweb
168
59.7
A Comprehensive Study Of Input/Output Operations In C++. In this tutorial, we will discuss C++ input/output (I/O) operations in detail. Data is transferred to/from output/input device in the form of a sequence of bytes called stream. The stream flowing from an input device like a keyboard to the main memory, it is called the Input Operation. On the other hand, streams that flow from the main memory to an output device like a screen is called an Output Operation. C++ provides us with an extensive set of I/O functions through its libraries. What You Will Learn: C++ I/O Library Header Files C++ provides the following I/O header files: Standard Output Stream (cout) C++ standard output stream – cout is an object of the ostream class which has iostream as its parent. Cout is used in with the operator “<<” and is also called as an insertion operator to output the information or data to an output device. The display screen is usually the output device to which the cout object is connected to. Depending on the data types used, C++ compiler determines the data displayed and also determines the type of insertion operator to be used for displaying the data. The object Cout and the insertion operator support the built-in data types of C++, string and pointer values. We can also use more than one insertion operator along with cout in a single statement. For Example, cout<<” Hello, World!!”<<” Good morning!!”; When “endl” is being used at the end of cout, it indicates the next line. Standard Input Stream (cin) C++ standard input stream – cin is an object of class istream class which is also a child of iostream class. The cin object along with “>>”, which is also known as extraction operator is used to read data from the input device. An Example of an input device to which cin is connected to is a keyboard. As per the data type, C++ compiler determines the data to be read and also determines the type of extraction operator to be used for reading and storing data. Just like cout, we can use more than one extraction operator in a single cin statement. When “endl” is used at the end of the cin statement, it indicates the end of the line. In the Example given below, we demonstrate the usage of cin and cout in C++. #include <iostream> using namespace std; int main( ) { char str[] = "This is C++ basic Input Output"; int number; cout<<"Enter the number: "; cin>>number; cout<<"The number entered is: "<<number<<endl; cout << "Value of str is: " << str << endl; } Output: Enter the number: 100 The number entered is: 100 Value of str is: This is C++ basic Input Output As we see in the above program, we use cin to read a number from the keyboard and store it in an integer variable named “number”. Then using cout, we display this number and also the character message. Standard Error (cerr) And Standard Log (clog) Streams Both cerr and clog are objects of the ostream class which are similar to cout and cin. Clog and cerr are used for writing log and error messages respectively to standard log or error devices which can also be a display screen. Though both are the members of stderr (standard error), the main difference between clog and cerr is that clog is buffered. By buffered we mean, that the output is collected in a variable and written to the disk at once. Non-buffered entities, continuously write output to the disk without collecting it in a variable. Clog is used to write messages that are not critical but needs a proper description. However, events or errors that are too critical like system crash need to be written to the output immediately. In this case, we use cerr. We have demonstrated the use of clog I/O operation in the following coding Example. #include <iostream> #include <fstream> using namespace std; int main() { char fileName[] = "data.txt" ifstream infile(fileName); if(infile) cout << infile.rdbuf(); else clog << "Error while opening the file " << fileName << endl; return 0; } Output: Error while opening the file data.txt Here we provide a filename “data.txt” in a variable and try to open this file. If the file is successfully opened, then the contents of the file are read in a buffer. If the file cannot be opened, then a log message is displayed by the clog operation. You need to note that clog also uses the stream insertion operator as the cout operation. We have demonstrated the usage of the cerr operation in the below example. #include <iostream> #include <fstream> using namespace std; int main() { char fileName[] = "input.txt"; ifstream infile(fileName); if(infile) cout << infile.rdbuf(); else cerr << "Cannot open file:" << fileName <<endl; return 0; } Output: Cannot open file:input.txt In the above program, we try to open a different file “input.txt”. We read the file if it is opened successfully. If the file opening is not successful then the message is displayed to a standard device that is the display screen saying “cannot open input.txy”. Conclusion This is all about basic Input/Output operations in C++. We will discuss a few more important concepts in C++ in our upcoming tutorials. => Watch Out The Complete List Of C++ Tutorials In This Series.
https://www.softwaretestinghelp.com/input-output-operartions-in-cpp/
CC-MAIN-2021-17
refinedweb
894
62.38
#include <qtabdialog.h> A tabbed dialog is one in which several "tab pages" are available. By clicking on a tab page's tab or by pressing the indicated Alt+{letter} key combination, the user can select which tab page they want to use. QTabDialog provides a tab bar consisting of single row of tabs at the top; each tab has an associated widget which is that tab's tab page. In addition, QTabDialog provides an OK button and the following optional buttons: Apply, Cancel, Defaults and Help. The normal way to use QTabDialog is to do the following in the constructor: 1 Create a QTabDialog. Create a QWidget for each of the pages in the tab dialog, insert children into it, set up geometry management for it, and use addTab() (or insertTab()) to set up a tab and keyboard accelerator for it. Set up the buttons for the tab dialog using setOkButton(), setApplyButton(), setDefaultsButton(), setCancelButton() and setHelpButton(). Connect to the signals and slots. If you don't call addTab() the page you have created will not be visible. Don't confuse the object name you supply to the QWidget constructor and the tab label you supply to addTab(); addTab() takes user-visible name that appears on the widget's tab and may identify an accelerator, whereas the widget name is used primarily for debugging. Almost all applications have to connect the applyButtonPressed() signal to something. applyButtonPressed() is emitted when either OK or Apply is clicked, and your slot must copy the dialog's state into the application. There are also several other signals which may be useful: cancelButtonPressed() is emitted when the user clicks Cancel. defaultButtonPressed() is emitted when the user clicks Defaults; the slot it is connected to should reset the state of the dialog to the application defaults. helpButtonPressed() is emitted when the user clicks Help. aboutToShow() is emitted at the start of show(); if there is any chance that the state of the application may change between the creation of the tab dialog and the time show() is called, you must connect this signal to a slot that resets the state of the dialog. currentChanged() is emitted when the user selects a page. Each tab is either enabled or disabled at any given time (see setTabEnabled()). If a tab is enabled the tab text is drawn in black. You can change a tab's label and iconset using changeTab(). A tab page can be removed with removePage() and shown with showPage(). The current page is given by currentPage(). QTabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than QTabDialog provides, consider creating a QDialog and using a QTabBar with QTabWidgets. Most of the functionality in QTabDialog is provided by a QTabWidget. Definition at line 52 of file qtabdialog.h.
http://qt-x11-free.sourcearchive.com/documentation/3.3.4/classQTabDialog.html
CC-MAIN-2018-22
refinedweb
477
53.31
#include <Teuchos_RawMPITraits.hpp> List of all members. A specialization of this traits class should only be created for datatypes that can be directly handled by MPI in some way. Note that this traits class assumes that the datatype T is directly composed of datatypes that MPI can directly handle. This traits interface allows for specializations to create user-defined MPI_Datatype and MPI_Op objects to be returned from their static functions. char, int, float, and double. std::complex<T>where it is assumed that the real type Tis directly handlable with MPI. ScalarTraits<T>::isComparable==truewhich is a compile-time boolean that can be used in template metaprogramming techniques. Definition at line 68 of file Teuchos_RawMPITraits.hpp.
http://trilinos.sandia.gov/packages/docs/r6.0/packages/teuchos/doc/html/classTeuchos_1_1RawMPITraits.html
CC-MAIN-2014-35
refinedweb
116
57.98
A Python module to control a FreshRoastSR700 coffee roaster. Project description A Python module to control a FreshRoastSR700 coffee roaster. Usage import time import multiprocessing import freshroastsr700 # freshroastsr700 uses multiprocessing under the hood. # call multiprocessing.freeze_support() if you intend to # freeze your app for packaging. multiprocessing.freeze_support() # Create a roaster object. roaster = freshroastsr700.freshroastsr700() # Conenct to the roaster. roaster.connect() # Set roasting variables. roaster.heat_setting = 3 roaster.fan_speed = 9 roaster.time_remaining = 20 # Begin roasting. roaster.roast() # This ensures the example script does not end before the roast. time.sleep(30) # Disconnect from the roaster. roaster.disconnect() API & Documentation Complete code documentation and a breakdown of the FreshroastSR700 communication protocol can be found at freshroastsr700.readthedocs.org. The Fresh Roast SR700 can be purchased directly from the manufacturer at homeroastingsupplies.com. Installation The latest release of this package can be installed by running: pip install freshroastsr700 Please note that on OS X and Windows systems, you will need to install te ChiHeng CH341 driver in order for the freshroastsr700 module to talk to hardware. The easiest way to do this is to download the Openroast installer package, which bundles these drivers. Version History Version 0.2.4 - Oct 2017 - Resolves feature request documented in issue #31 freshroastsr700 object can now be instantiated with manual control of the software-based heater algorithm. Tested in Ubuntu 16.04. Version 0.2.3 - May 2017 - Resolves issues #22, 23, 24 and 25, and 29 (the latter introduced by 0.2.2). Added logic to handle hardware connects and hardware disconnects properly in all supported OSes. Software now supports multiple connect()-disconnect() cycles using the same freshroastsrs700 object instance. Tested in Windows 10 64-bit and Ubuntu 14.04. Version 0.2.2 - May 2017 - [Introduced issue #29. Inoperable in Windows environments - do not use.] Version 0.2.1 - March 2017 - Resolves issue #20 by managing hardware discovery logic in the comm process, eliminating the need for the thread heretofore associated with auto_connect. Openroast 1.2 (currently in development) now operates properly in Windows 10 64-bit, with this fix. Version 0.2.0 - March 2017 - Completely rewritten PID control for tighter tracking against target temperature (when freshroastsr700 is instantiated with thremostat=True). - Callback functions for update_data_func and state_transition_func now called from a thread belonging to the process that instantiated freshroastsr700. This was necessary for Openroast version 1.2 code refactoring. - Reduced processor load for PID control as part of code refactoring. Version 0.1.1 - Dec 28 2017 - Added support for python 2.7. Version 0.1.0 - (no notes) License MIT License. Please refer to LICENSE in this package for details. Project details Release history Release notifications 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/freshroastsr700/
CC-MAIN-2020-05
refinedweb
465
51.34
Question Answering Dialog System Project description Let Me Answer For You A Simple and Powerful Deep Learning Dialog System for Question and Answering A bot that can answer specific and complex questions. It has been built on top of the deeppavlov library Pip Install The sentiment classifier can be found on PyPI so you can just run: pip install let_me_answer_for_you Simple Usage Once the package is installed you can download the file chatbot.py of the repo and run: python chatbot.py After finishing the installation process, an interface like the following will appear: In this example, there was already an answer to the question and a new context was also added. The function chatbot.py accepts the context and faq files as their flags. If no flags for the files are provided, the system reads them (if inexistent, makes them) from the data directory at same path-level of chatbot.py Technologies The Chatbot is based on two types of question/answer models: It is strongly recommended to consult the deeppavlov library for further details of the available models for dialog systems. Structure of the Package The chatbot.py module calls the ChatBot class in let_me_answer_for_you.chatbot. The ChatBot is the child of the DialogSystem class. This class lives in let_me_answer_for_you.chatbot.dialog_system and is composed of the three main methods of the library: The first method retrieves a set of answers for a given question. The second method adds a new question-answer pair to the dataset and the third method adds a new context to the dataset. These are the methods that may be exported as the API calls. Documentation Requirements The library has been tested in python 3.7 Install the configuration files by instantiating the SystemClass from let_me_answer_for_you.dialog_system import DialogSystem() ds = DialogSystem( context_data_file=None, faq_data_file=None, configs_faq=None, download_models=True) If the context_data_file or the faq_data_file parameters are None , a data directory will be created in the directory where the script is running. The data directory will contain the FAQ or the context CSV files Get Response To get a response to a question call the method question_answer in the instance of SystemClass ds.question_answer() Introduce question: what can you offer me at Intekglobal? what can you offer me at Intekglobal?: 1: expert resources to connect your different devices and exchange data within those devices 2: Connect with us for further information 3: We like to provide world class solutions with complete features what you want to impletement in your business! New Question-Answer Pair Populate the FAQ data file with a new question answer by calling the method new_q_a: ds.new_q_a() Introduce question: What type of Dialog System is this? Introduce the answer: Is a combination of context question answering system with a faq system New Context The systems accept a response as a context. The advantage of having contexts is that many answers can be found in one context. To create a new context, call the new_context method: ds.new_context() Give context a title: IOT Introduce the context: We can provide expert resources to connect your different devices and exchange data within those devices. Further make the data accessible via web tools. Connect with us for further information. DevOps Our team can help you organization to implement best DevOps practices that can automate the processes between software development and various IT teams, in order that they can build, test, and release software faster and more reliably. Docker A container with all the configurations installed can be pulled it with the following instruction: docker pull ejimenezr/dialog_system 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/let-me-answer-for-you/0.1.0/
CC-MAIN-2020-45
refinedweb
623
53
New firmware release 1.4.0.b1 I have seen in later releases that I get a lot of these: I have no idea why, I cannot recall that I got them before. They seem to be harmful since my sockets are being dropped after a while. Also, when they arrive the hw seem to stall for many seconds. - jmarcelino last edited by @mohpor Yes thats is correct, the notification events are for the Py boards working as a GATT client only. What are you trying to achieve by having a notification callback as GATT server? Servers usually just send a notification if a characteristic was updated (this isn't implemented yet) Thanks for the updates. The Bluetooth.CLIENT_CONNECTEDand Bluetooth.CLIENT_DISCONNECTEDare working as expected. but I just can't work the Bluetooth.CHAR_NOTIFY_EVENT! It simply won't call the callback function. I'm developing my own test app for iOS and when I try to subscribe to the characteristic I have defined, I get an update from my peripheral manager that indicates the characteristic is not subscribed for notification! Meaning the BLE characteristic has rejected the subscription. Could you provide us with a working example of the event callback to work on? Am I missing something here? Here is how I'm defining the callback: def char_subscribed(chr): print("Char Subscribed: %r" % chr) chr1_cb = chr1.callback(trigger = Bluetooth.CHAR_NOTIFY_EVENT, handler = char_subscribed) P.S.: If I substitute CAHR_NOTIFY_EVENTwith CHAR_READ_EVENTthe callback is called when I try to read. UPDATE: As I was browsing through the newly available source code of the MicroPython for pycom boards (Thanks a lot), I have noticed that the Notify event is for the BLE Client mode only (?!) am I right? it says MOD_BT_GATTC_NOTIFY_EVTwhich from GATTCpart I'm guessing it is for GATT Client only! Could someone confirm my findings? UPDATE 2: Using other utilities leads to same results: If you try to subscribe, it simply fails to subscribe. Tools I tried: LightBlue (iOS and macOS) - crankshaft last edited by crankshaft OK, just discovered something.... If I power the WIPY2 via expansion board / USB then it boots, but if I power it by VIN and GND it does not. I have proved that it appears to be firmware related by performing the same test on another board that has factory firmware. Can someone else verify this ? Update 1 Is there a circuit diagram for the expansion board, I can't seem to find one ?? If I remove the expansion board jupmers for TX and RX and power it via USB, it does not boot, same as powering with VIN, I now suspect that the new firmware may not be pulling the TX/RX lines high during boot, or something is waiting for these lines to be pulled up. Update 2 OK, If I hold P0 high, then the board will boot when: - powered via VIN - powered via USB but the TX jumper is removed. So my guess is that the firmware is not doing a soft-pullup on this pin during bootup ?? Update 3 After more study, I believe that this issue is caused when calling the serial console in the boot.py file, the system tries to initialise the serial console and if the line is not high then it just waits forever until it is. So not really a bug ! and also problem with i2c previous code run without any problem but now i got: I (8388) wifi: connected with livius, channel 9 WLAN connection to the router succeeded! Traceback (most recent call last): File "boot.py", line 16, in <module> File "wifi_sta_router.py", line 65, in <module> File "bmp180.py", line 48, in __init__ OSError: I2C bus error was something changed also in i2c? @jmarcelino i can also understand this in that way but what is then purpose about parameter pycom.heartbeat(1) pycom.heartbeat(0) i can disable it and enable back with the same color as previous? but pycom.heartbeat(1) also disable it when it was enabled i suppose that this work as toggle instead on/off @daniel also i see that when i send file - size 3201 bytes throught wifi it is somehow broken inside - it is transmitted as 3201 but some lines are wrong when i download it back throught wifi e.g. oryginal file ileTemp180=0 if (prevCisnienie180!=cisnienie180): prevCisnienie180=cisnienie180 s.send('{"U":"' + UID + 'C180' + '", "V":[[' + str(cisnienie180)+','+str(ileCisnienie180) +']]}\n') ileCisnienie180=0 time.sleep(1) and after download back: ileTemp180=0 if (pr180) +']]}\n') ileCisnienie180=0 time.sleep(1) UPDATE i see that problem with i2c was only because this crash(trash) in file not i2c itself (i suppose) when i send this file e.g. 20 times (always successfully) then it was eventually as should be and code work ok also in newest firmware 12 sensors read data throught i2c, one wire, digital and ADC and send it back throught wifi to service on computer and back to database :) And now i have question - how many times we can write to flash? What is the write cycle life of that flash? UPDATE 2 I supposed that it all was fixed but after fresh start on early morning it bring me back same error about i2c WLAN connection to the router succeeded! Traceback (most recent call last): File "boot.py", line 16, in <module> File "wifi_sta_router.py", line 65, in <module> File "bmp180.py", line 48, in __init__ OSError: I2C bus error @livius This is how I understand it: heartbeat is a special function associated to the led and needs exclusive access. If it's active (set to 1 or True) you can't override it and the led will just blink periodically in blue. rgbled doesn't just change the colour, it sets the led immediately to the colour you give it. If the colour is anything other than 0 (black) it turns the led on. To turn it off do pycom.rgbled(0) but something is wrong try this: 1. pycom.heartbeat(0) #disable pycom.rgbled(0xff0000) #change color - but this also turn it on pycom.heartbeat(1) # strange this also disable led @jmarcelino file 3 month ago and i suppose copy paste from doc or forum but why i can not change color of led when it is on? and i disable default blink of led which is after normal boot(firmware blink) @livius Why is the code turning the heartbeat signal off just to turn it on right after? If you remove the pycom.heartbeat(1) line it should work. i have this file from start(3 month ago) file "wifi_ap.py" import pycom print('wifi_ap') pycom.heartbeat(0) pycom.heartbeat(1) pycom.rgbled(0xff0000) this worked in all previous version of firmware now it does not work. If it should not work previously in that way i can fix this @livius I noticed that, but wasn't sure if it's new. You have to disable the heartbeat before using rgbled pycom.heartbeat(False) pycom.rgbled(0x007f00) # green Maybe a little jarring for first time users just trying to blink the led @livius that's being done on purpose, you need to disable the heartbeat first. You can either have the heartbeat enabled or control the LED manually. What are you trying to do? Cheers, Daniel @daniel something is wrong pycom.rgbled(0xff0000) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: the requested operation is not possible >>> os.uname() (sysname='WiPy', nodename='WiPy', release='1.4.0.b1', version='v1.8.6-398-g4a4a81e on 2017-01-20', machine='WiPy with ESP32') - crankshaft last edited by @daniel Been waiting for this, thanks very much, I am looking now at my power supply which definitely shows the current is down, but fluctuating a lot. But I have a feature request, is it possible to have a machine.sleep(msec) where msec is the number of milliseconds that you want to sleep. This would be really cool, to be able to put it to REAL sleep without interrupts. And on the same subject, are the RTC interrupts on the horizon so that we can achieve the above, only with more code ? from network import WLAN wlan = WLAN() wl.mode(WLAN.STA) If that's the case that's an issue. We'll check. Thanks! So there's the small caveat that disabled doesn't mean 'turn off' the interface :-) Thanks for the clarification! The STA power savings are very good news though, can save a lot of battery with almost no effort. By the way I found that if I do: from network import WLAN wlan = WLAN(mode=WLAN.STA) power saving is enabled, but if I use this instead it doesn't: from network import WLAN wlan = WLAN() wl.mode(WLAN.STA) @PeterBaugh: Just looking at my power supply reading at the moment. I also use a coulomb counter (LTC4150) for consumption over time (without needing to do integration) I'm hoping to do a blog post on this soon. - constantinos last edited by Can you give us more explanation for machine.idle and sleep modes? Thanks - PeterBaugh last edited by @jmarcelino Out of interest how are you measuring the power consumption of your device? Thanks @daniel. Being able to properly disable network interfaces you don't intend to use is really critical. Not only for power reasons, but in order to avoid conditions in which a "stray" network device with a life of its own (after all both have reasonably complex associated software stacks) can lead to some nefarious behavior due to environmental circumstances. An example: imagine that you have deployed LoPys as some kind of embedded sensors. You are using LoRa, not WiFi nor Bluetooth. Now, some device with a buggy Bluetooth or WiFi stack moves close, or it doesn't have a buggy implementation but, nevertheless, something happens that triggers a bug in the LoPy's stack. So, the WiFi or Bluetooth goes mad and something Bad™ happens. Of course it could be an intentional attacker as well. It would be nice to tell the Espressif guys that "off must be off" and the relevant silicon must be really powered off with no possibility of zombie behavior ;) @borjam memory from Bluetooth is not released when is not in use. This is something that we are looking to implement as it is very important. @jmarcelino we are aware of this and we are checking with Espressif.
https://forum.pycom.io/topic/522/new-firmware-release-1-4-0-b1/54?lang=en-US
CC-MAIN-2020-34
refinedweb
1,739
72.16
0 Hello all, I have been trying for a few days now and done quite a bit of reasearch on the internet and this website to find out how I can authenicate to a website. It could very well be that this particualar web server is picky I'm not to sure. It would be great if I could get some help with this, I would also recommend the site to anybody with some free time on their hands and that doesn't wanna sit around thinking of ideas for programs all day. They have a fun list of entertaining challenges. Here is the code that I have came up with so far but no success in logging in. import urllib, urllib2, cookielib username = 'username' password = 'password' host = '' user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0)' referer = '' content_type = 'application/x-www-form-urlencoded' accept_encoding = 'gzip,deflate' values = {'Host': '', 'User-Agent':'Mozilla/4.0 (compatible; MSIE 8.0)', 'Referer':'', 'Content-Type':'application/x-www-form-urlencoded', 'Accept-Encoding':'gzip,deflate', } cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) data = urllib.urlencode(values) url = referer req = urllib2.Request(url, data) page = urllib2.urlopen(req) req = urllib2.Request("", data) page2 = urllib2.urlopen(req) print page.info() print page.geturl() print page2.info() print page2.geturl() print page2.read() Thanks a bunch ahead of time. :D Edited 7 Years Ago by willygstyle: messed up code tags
https://www.daniweb.com/programming/software-development/threads/242071/authenicate-to-website-help
CC-MAIN-2017-04
refinedweb
236
54.59
/* * * ChartDateTimeAxis. * * */ #ifndef _CHARTDATETIMEAXIS_H_ #define _CHARTDATETIMEAXIS_H_ #include "ChartAxis.h" #include "ChartString.h" //! A specialization of the CChartAxis class for displaying date and time data. class CChartDateTimeAxis : public CChartAxis { friend CChartCtrl; public: //! Enum listing the different base intervals. enum TimeInterval { tiSecond, tiMinute, tiHour, tiDay, tiMonth, tiYear }; //! Sets the tick increment. /** The tick increment is the value between two adjacents ticks on the axis. In case of a date time axis, the interval is specified by a time period because this interval might not be constant (for instance, if a tick interval of one month is specified, the distance between two adjacents ticks is not constant: it depends on the number of days in the month). The full tick interval is made of a base interval (day, month, hour, ...) and a multiplier, that is applied to this base interval. So, for an interval of three months between two ticks, you have to specify tiMonth for the interval and 3 for the multiplier. @param bAuto Specifies if the tick increment is automatically calculated. @param Interval The base interval. @param Multiplier The multiplier applied to the base interval. **/ void SetTickIncrement(bool bAuto, TimeInterval Interval, int Multiplier); //! Sets the format of the tick labels. /** @param bAutomatic Specifies if the format is calculated automatically. @param strFormat The format to apply to the tick label if bAutomatic is false. <br>Check the documentation of the COleDateTime::Format function on MSDN for more information about the format string. **/ void SetTickLabelFormat(bool bAutomatic, const TChartString& strFormat); //! Sets the reference tick. /** The reference tick is a date/time which specifies a tick which should always be displayed on the axis. This is needed when the tick interval multiplier is not 1 (e.g. the interval between two ticks is 3 months). In that specific case, there is no way for the control to know which ticks should be displayed (in our example, the chart doesn't know if the first tick will be january, february or march). This is particularly annoying when the axis is panned (in that case, if we always take the first month on the axis as first tick, the ticks will always switch from one month to another). By having a refence tick, this forces the control to calculate all tick intervals based on this reference. It is set to January 1st 2000 by default. **/ void SetReferenceTick(COleDateTime referenceTick); private: //! Default constructor CChartDateTimeAxis(); //! Default destructor ~CChartDateTimeAxis(); double GetFirstTickValue() const; bool GetNextTickValue(double dCurrentTick, double& dNextTick) const; TChartString GetTickLabel(double TickValue) const; long ValueToScreenDiscrete(double Value) const; long GetTickPos(double TickVal) const; void RefreshTickIncrement(); void RefreshFirstTick(); //! Forces a refresh of the date/time tick label format void RefreshDTTickFormat(); //! Add a number of months to a date. /** The function takes care of 'overflow' (total number of months higher than 12) error when adding the months. @param Date The date to which months will be added. @param iMonthsToAdd The number of months to add to the date. @return the resulting date. **/ COleDateTime AddMonthToDate(const COleDateTime& Date, int iMonthsToAdd) const; double GetTickBeforeVal(double dValue) const; //! Format of the date/time tick labels TChartString m_strDTTickFormat; //! Specifies if the tick labels format is automatic bool m_bAutoTickFormat; //! Specifies the base time interval for ticks /** This specifies an base interval in sec, min, hour, day, month or year. The total tick increment is a mutliple of this base interval (specified by m_iDTTickIntervalMult). E.g: 2 days **/ TimeInterval m_BaseInterval; //! Specifies the multiplicator for the base interval /** This multiplies the base interval for the ticks, resulting in something like 3 minutes (a multiplicator of 1 can also be specified). **/ int m_iDTTickIntervalMult; //! Caches the value of the first tick. double m_dFirstTickValue; //! The reference tick. See the SetReferenceTick function for details. COleDateTime m_ReferenceTick; }; #endif // _CHARTDATETIMEAXIS)
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=14075&zep=ChartDemo%2FChartCtrl%2FChartDateTimeAxis.h&rzp=%2FKB%2Fmiscctrl%2FHigh-speedCharting%2F%2FChartCtrl_demo.zip
CC-MAIN-2015-35
refinedweb
616
50.63
Can someone push me in the right-direction with studying/developing a plug-in please? The second to last line of the following code is my sticking point at the moment. import sublime, sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): # self.view.insert(edit, 0, "Hello, World!") the_sels = self.view.sel() for a_sel in the_sels: # the_text = self.view.substr(a_sel) # self.view.insert(edit, 0, the_text) # self.view.replace(edit,a_sel,"howdy") the_text = self.view.line(a_sel) # the current line of text? self.view.insert(edit, 0, the_text) I want to read (store) the current line of text. How do I achieve this please? 2) Also, do I need to loop through all selections, or is it possible just to specify the current line/ cursor location?3) How do I read/store the current 'point'? That is, the cursor position (on the current line)? Andy. 1) view.substr()2) view.sel() => list of sels3) view.sel()[0].begin() or .end() or .a or .b I can help When you first start creating a plugin, don't worry about multiple cursors. It will just get your code messy and you'll get confused. The best way to start it looking through the premade plugins in Packages/Default or at someone else's plugin. Also, when working on a plugin, always keep your console open (control + `). "Print" is your friend, especially when learning the difference between a Region, a RegionSet, a String, and a Point. For example, on your second to last line, line() returns a region while insert() is expecting a string. Try printing out a Region to your console, it is essentially a tuple of points. To retrieve the actual text that corresponds to that Region, use self.view.substr(). sel = self.view.sel()[0] because more often than not, I'm only using one cursor. However, sel is a Region here, meaning that if you have something selected, it will look like this: (Start of Selection, End of Selection) Note: Start of Selection does not mean beginning. If you select text from right to left, the Region will be reversed. So to retrieve a point: you have a few options. sel.a --> the start of the selection (aka what the user selects first)sel.b --> the end of the selection (aka where the user stopped the selection)sel.begin() --> the minimum of a and b (If you need to know the leftmost/topmost point of the selection no matter how the user selects the text)sel.end() --> the maximum of a and b Each of these 4 methods returns an int, which, as far as the API is concern, is equivalent to a point. If there is no text selected, sel.b and sel.end() will return the same thing it's your preference as to which you use to retrieve the current cursor position. So your code would be something like: sel = self.view.sel()[0] line = self.view.line(sel.b) Another great resource: Will Bond wrote an excellent piece on Nettuts+ on how to create a plugin (here: net.tutsplus.com/tutorials/pytho ... -2-plugin/) This is great, thanks both! @COD312 I had that web page already open . It's good, but I needed to ignore bits of it (such as threading), and the multi-select is distracting for a beginner. I did manage to grab the current line and replace it, woo-hoo! But it replaces the initial tabs as well. line = self.view.line(the_region) self.view.replace(edit, line, "Hello there") How would I skip the tabs at the beginning of the line please? Regards, Andy. Short anwer: regex + python's string.strip() method Long answer: I just had to do this for a plugin of mine. I was working with PHP and wanted to prepend certain lines with $. Unfortunately, the spacing in the beginning of the line would get screwed up. So here's my workaround: github.com/BoundInCode/PHP-Sani ... eatevar.py I used view.find() to get the actual start of the line. @COD312 Thanks again. I've a bit of studying to do! I'm not yet familiar with Python, but I testedprint line_contents.find('\t'); to find the first tab position (if any). But if find() uses regex then I suppose it could find the first non-whitespace character. I'll admit I haven't studied your example yet (it's a bit late!) but I'm assuming I could store all the (beginning) non-ws characters in a variable, then pre-pend them to my new string before replacing the line. I'll have a look again tomorrow. Regards, Andy. I got this to work . That is, to replace the current line of text, but keep the same indenting: sel = self.view.sel()[0] cur_line = self.view.line(sel) print cur_line # tuple line_text = self.view.substr(cur_line) print '#' + line_text + '#' # includes tabs/ spaces mtc = re.search('\S',line_text) pos_ltr = mtc.start(0) # the posn of the 1st character print pos_ltr white_sp = line_text[0:pos_ltr] self.view.replace(edit, cur_line, white_sp + "Hello there") It stores the white-space at the beginning of the line (hopefully!) and then prepends this to the replacement text. I could then add it to any further lines. It's not bullet-proof yet. In particular, if begin() = end() is there an 'Exit Function' or 'End' equivalent in Python? Andy. if sel.empty(): return [quote="C0D312"] [/quote] Thank you. But, oops! My mistake. I meant if the current line is empty. I suppose, given that I'm reading past all the white-space characters, I should check if this either 'fails', or is at, or beyond, the end-point of the line.. No worries if not mtc: print 'nothing there' return I'm making good progress and I'm using the console to run/feed a Snippet. At the moment I grab the console text, insert it into the view, run the Snippet, and then delete the line that was added. The Snippet uses TM_CURRENT_LINE for its input. But want I *really *want to do is feed the console text directly to the Snippet. Is this possible please? import sublime, sublime_plugin class AndyOutput(sublime_plugin.WindowCommand): def run(self): self.window.show_input_panel('Andy>','', self.on_done, self.on_change, self.on_cancel) pass # empty statement def on_done(self, text): # if self.window.active_view(): # why? self.window.active_view().run_command("use_main_view", {"the_text": text}) def on_change(self, text): pass def on_cancel(self): pass class UseMainView(sublime_plugin.TextCommand): def run(self, edit, the_text): # self.view.insert(edit, 0, the_text) sel = self.view.sel()[0] pt = sel.end() self.view.insert(edit, pt, the_text) self.view.run_command("insert_snippet",{"name": "Packages/CSS/Andypropxs.sublime-snippet"}) cur_linef = self.view.full_line(sel) self.view.erase(edit, cur_linef) I'm getting somewhere If they type a space in the input panel, I show the quick panel. If they choose an item its text is added to the main window, and the focus is given back to the input panel, whe'hay. But I'm still struggling to discover whether it's possible to feed text directly to a Snippet? Andy. Hello. I'm assuming it's not possible to feed text directly to a snippet, so I'm moving on (although I could probably copy the entire snippet as 'contents' and insert the text into this string..). I can track someone's editing of a css file, but I'm unable to use 'view.insert(edit, pt, 'ght')' to add additional text to the current view/region - because 'edit' is not defined within an event listener (code below). This may be intentional, in that it's not possible to insert text within the modified event? I can see how this may be an issue (circular reference..). But perhaps it can be done by appending data to an internal buffer? Or by creating, and appending, a new region? Any suggestion is welcome [code]class EditorTracking(sublime_plugin.EventListener): def init(self): pass def on_modified(self, view): sel = view.sel()[0] pt = sel.end() if not view.match_selector(pt, ('source.css meta.property-list.css')): # print 'not in css' return else: # print 'yes, in css property list' cur_line = view.line(sel) line_text = view.substr(cur_line) if line_text-2:] == 'ri': view.insert(edit, pt, 'ght')[/code] Added: 'view.is_read_only()' returns False, so maybe it is possible to add text?? [code]class EditorTracking(sublime_plugin.EventListener): def init(self): self.ignore = False def on_modified(self, view): if self.ignore: return sel = view.sel()[0] pt = sel.end() if not view.match_selector(pt, ('source.css meta.property-list.css')): # print 'not in css' return else: # print 'yes, in css property list' # print view.is_read_only() cur_line = view.line(sel) line_text = view.substr(cur_line) edit = view.begin_edit() try: if line_text-2:] == 'ri': view.insert(edit, pt, 'ght') pass finally: self.ignore = True view.end_edit(edit) self.ignore = False[/code] Next task is to disable the auto-complete list (while my code is running) and to find some way to remove my event listener.. Andy. Hello. Is it possible to disable/detach my on_modified event-listener within my event's code? Or do I need to use a second key-binding that sets on_modified back to None?
https://forum.sublimetext.com/t/kick-start-for-plug-in/4507/11
CC-MAIN-2016-30
refinedweb
1,531
60.72
There isn't much I can say that hasn't already been said about Django: the granddaddy of all web frameworks. I owe a large part of my engineering career to learning Django on a whim in 2012. Django was a surprisingly elegant take on MVC, written in a programming language that was far from mainstream at the time of Django's inception. Most of us have surely forgotten what it was like to learn 1) programming language, 2) a framework, and 3) an entire programming paradigm, all at the same time. In the face of that challenge, Adrian Holovaty and Jacob Kaplan-moss produced a phenomenal book dubbed The Definitive Guide To Django , which artfully articulated all of those things simultaneously. I believe the book is now either free or serves as Django's official documentation. Without those who created Django and championed its mainstream popularity, our website of sloppy Python tutorials surely would not exist today. To say a lot has happened since 2012 would be the understatement of the decade. Staying within the topic of software, some might remember the prophecy of Ruby on Rails eating the world. It was a popular sentiment which coincidentally took rise while Guido Von Rossen enraged the Python community with the announcement of Python 3 (which was, for the record, a completely necessary and reasonable course of action). My condolences to the families of developers lost to traumatic finger injuries, as they were forced to rewrite their So why start writing Django tutorials now? I've had a very public and notorious love affair with Flask for well over a year now... how does Django fit into this love triangle? Is this considered cheating? Let's consider the top complaints developers have about their profession. Perhaps the most common (and painfully cliche) complaint is that software professionals are pressured to learn "countless frameworks" to stay relevant in the industry. That surely feels like an unfortunate fate when compared to the non-technical office worker, who has learned exactly zero frameworks. Is there legitimacy to this complaint? Well, let's start by looking at how a sample of how MVC frameworks have fared over the past six years: Google search trends aren't flawlessly scientific, but it's hard to deny Django's resilient popularity. Django is the only example in this sample which is highly relevant in both 2013 and 2019, and actually gains interest over time to steal the #1 most Googled MVC framework in 2019. Different surveys will tell narratives, but there's an undeniable truth worth recognizing: if a software developer spent their entire career developing exclusively in Django, they could comfortably retire from a successful career having learned only a single framework. In fact, any of us could have chosen to do so, and still can. The mystery of human nature instead leads down self-destructive paths, hurting ourselves with diseases like Angular, or even worse, ASP.NET. Anyway, welcome to Django 101. This post is the first in a series where we dissect Django from top-to-bottom for people in 2019. If you've ever felt the hopeless feeling that the world has an unfair 10-year head start doing something you love, this series is for you. Welcome to the family. A Note About Django Vs Flask This comparison is bound to pop up, so let’s get it out of the way. Flask’s claim to fame is its zero-configuration quick-start, which contains seven lines of code and exactly zero bells-and-whistles. Flask prioritizes ease-of-entry over features, where “features” are plugins (AKA Flask-specific Python libraries). Django is the antithesis to Flask’s “as-you-go” philosophy of development. Batteries are included with Django to the extent where Django’s batteries have batteries of their own. No amount of imagination could fathom a paradigm that Django doesn't handle out of the box. Flask is akin to the lean startup advocating agile, whereas Django is equivalent to an Enterprise behemoth in denial about using waterfall (this analogy is also a pretty accurate manifestation of who-uses-what). I’ve found Flask to have a much easier learning curve, partially because Flask is far less rigid than Django. Flask projects inherently have no sense of structure, whereas Django forces developers into an organized paradigm. Flask projects have the ability to be structured similarly to Django, but cohesiveness becomes highly unlikely as your development team approaches hundreds of devs. This reason alone enough to perpetuate an assumption you probably already have: “Django for large projects, Flask for small projects.” I’m not suggesting this is entirely accurate, but it isn’t inaccurate either. Getting Started The goal of this tutorial is to create the simplest possible Django application that provides some sort of value. Learning to print “Hello world” is fine, but it’s kind of a useless exercise in terms of learning the internals of a Framework. We’ll instead focus on building an application that serves a single HTML page. It doesn't sound like much, but you should walk away with a grasp of: - Installing and running Django locally - Configuring Django settings properly - Creating and managing “app” modules - Serving templates via Django’s native templating system - Styling templates with static assets - Routing in Django To make things interesting, I’ll be walking through this with Django 3.0, which was actually released two days ago. You could very well be reading the first Django 3 tutorial ever written*.* We’re going to be running Django locally for the purpose of this tutorial. If you’re looking for details to set up Django on Ubuntu, I'd start here. * This is a meaningless claim. Nothing we’ll cover has changed from Django 2.x, but claiming this achievement makes my life appear less meaningless. Installing Django in a Virtual Environment As always, we want to set up a virtual environment for our project before installing Python packages. Feel free to use whichever Python virtual environment you're comfortable with; I'm personally going to use Pipenv. cd into the directory you'd like to start your app in and create your virtual environment: $ python3.8 -m pip install pipenv $ python3.8 -m pipenv shell $ pipenv install django Now we have an active virtual environment with Django installed. Just to make sure everything is fine, run the following line to check the proper version of Django was installed: $ python3 -m django --version 3.0 We're ready to rock. Lucky for us, Django has a built-in command called django-admin to help us generate our first project (amongst other things we'll explore later). To generate the scaffolding for our project, we invoke one of django-admin's methods called startproject: $ django-admin startproject [YOUR_PROJECT_NAME] Boom, we just started our first project! My project happens to be called djangotutorial. Let's see what's inside. Anatomy of a Django App The first key to understanding Django is understanding the pieces that make it work. Here are the "pieces" we created by starting our project: /djangotutorial ├── /djangotutorial │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── manage.py Our new project contains one file and one directory. We'll touch on what purpose manage.py serves in a moment, but let's first address the glaring question: is why there a folder called djangotutorial in our project called djangotutorial? It’s as though we just started a band called Iron Maiden, created a song named Iron Maiden, and featured it on our new album: Iron Maiden. It seems strange, but this begins to make sense as we unravel how Django apps scale. Django projects are designed to be large by design: a single Django project is intended to consist of modules, or as Django calls them, “apps”. Let’s see what a mature Django project with multiple “apps” might look like: It’s best to think of a Django "app” as a subsection of your project that serves a general purpose. Think along the lines of a checkout flow for an e-commerce site, or logged-in user profiles: both of those examples would probably consist of multiple pages, but share common logic and assets between those pages. One of our apps always shares the name of the parent project. This app contains the “core” of our project: it serves as the entry point, which ties our other apps together and holds settings common to all of our apps, such as database information. It would be fairly accurate to state Django projects are a collection of app “nodes,” where djangotutorial is our “master node.” Here's what's inside: - settings.py handles everything imaginable related to configuration. This is where we activate Django plugins, store database credentials, set our hostname, etc. This is usually the type of file you don't want to commit to Github (or if you do, make sure to obscure the credentials). - urls.py is where we set the top-level URLs for our projects. Remember: Django projects are intended to be broken up into individual modules, so this file usually reserves a URL for each module, with modules handling their own independent URL routers. - wsgi.py where we point webservers like Nginx, Caddy, or whatever to serve our site. You'll probably never need to touch this. manage.py We briefly glossed over the other thing created we created when we ran django-admin: manage.py. This file is the key to the kingdom: it contains logic covering everything related to “managing” our project. For example: python3 manage.py runserverdeploys our app in "development mode" so that we may access it via our browser (this will be accessible via localhost by default). python3 manage.py migrateupdates your project's database tables to match the data models you've defined. python3 manage.py startapp [MY_APP_NAME]is the equivalent of django-admin startproject [YOUR_PROJECT_NAME]. Indeed, django-admin is simply an alias for manage.py! Definitely check out what manage.py can do by running python3 manage.py --help to list all commands some other time. For now, we have a job to do: let's make an app. So far, all our app can do is serve a generic canned page confirmed that Django was installed correctly. Let's confirm all is good: $ python3 manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). December 04, 2019 - 23:18:54 Django version 3.0, using settings 'djangotutorial.settings' Starting development server at Quit the server with CONTROL-C. Now open your browser and check out: Seeing this page is a beautiful thing, but we’ve only barely started to lay the groundwork for a respectable app. Django development truly begins with its configuration, but don't gloss over this just because it sounds boring: setting up Django reveals everything about how the framework works as a whole . Settings.py: The Gist of Django The top section of settings.py contains configuration variables that Django absolutely depends on to function. Without any modifications, this section should look as follows: import os # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '$HVG687rTFDuYdtfg8yiuf87fuib&)lw#6btg5_p' #', ] ... SECRET_KEY is a concept you might already be familiar with: in short, this is a random string of characters that Django uses to encrypt sensitive information passed around the app. This is automatically generated for you, but please, for the love of Steve Buscemi, just don't share it with anybody. Sometimes we make mistakes when writing code, and it isn't always easy to figure out what when wrong. With DEBUG enabled, any parts of your app which throw errors will serve you a detailed error report of what went wrong. ALLOWED_HOSTS seems comically understated, as it is the most important variable we to get Django working. When Django is running, ALLOWED_HOSTS serves as a whitelist for which traffic pointing to your app it will actually acknowledge. You could have Nginx perfectly configured to point to your Django app, but if the traffic source from Nginx isn't present in ALLOWED_HOSTS, your app will not be accessible. We're going to run our app locally, so we should include "hosts" synonymous with your local machine: ALLOWED_HOSTS = ['0.0.0.0', '127.0.0.1', 'localhost', '127.0.0.1:8000'] It's a bit curious that hosts like localhost aren't present here by default. Whatever. If you were building an app to be served at a domain like example.com , you'd include that hostname in your allowed hosts like so: ALLOWED_HOSTS = ['0.0.0.0', '127.0.0.1', 'localhost', '127.0.0.1:8000', 'example.com'] Next in our configuration is INSTALLED_APPS. This one is a doozy; remember when we mentioned Django being a collection of modules called "apps"? When we create an app in Django, we need to add it to INSTALLED_APPS to actually be recognized and served in our project. The admittedly strange part about this is that Django considers its own core features to be called "apps" as well, which is why we see things like Django's admin library pre-populated here. It's not intuitive. We'll come back to this after making our first "app" in a moment. Setting up a Database Django really, really wants you to configure a database upfront, even if you aren't going to use it right away. In fact, running manage.py runserver without setting a database will automatically create an SQLite database by default. That's because the database section of settings.py starts off like this: ... # Database DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } ... Take special notice to the ENGINE key and how it specifies that we're using an SQLite database. This is Django using its internal SQLite connector to connect to our database. We aren't limited to SQLite, however; any of the following database flavors are supported out of the box: 'django.db.backends.mysql'(includes MariaDB in Django 3) 'django.db.backends.postgresql' 'django.db.backends.sqlite3' 'django.db.backends.oracle' We won't be needing a database for our intro app, but if we hypothetically wanted our app to use a MySQL database, our config might look something like this: ... # Database DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'myDatabase', 'USER': 'root', 'PASSWORD': 'password123', 'HOST': '534.13.356.35', 'PORT': '3306', } } ... Even though we specify 'ENGINE': 'django.db.backends.mysql', we still need to install the MySQL connector that Django expects, which happens to be mysqlclient. I don't understand why, and I'd rather move the reasons why this is annoying: $ pip3 install mysqlclient Logging Configuring logging is optional, but I'd recommend configuring this to keep a record of things gone wrong. Feel free to steal my configuration below: ... # Logging LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': 'logs/debug.log', }, }, 'loggers': { 'django': { 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, }, } ... Static Files In the spirit of backend developers disrespecting frontend code, Django refers to all frontend code (such as JS, CSS, images, etc.) as "static files." The term seems to imply that the product of frontend development is an afterthought to be tossed into a folder and forgotten, but whatever; we backed developers aren't exactly heralded for our camaraderie or social skills. We'll keep all static files in one place for the purposes of our app, but it's otherwise somewhat common for Django apps to each contain their own styles and JavaScript. Our simple configuration looks like this: ... # Static files (CSS, JavaScript, Images) STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(PROJECT_DIR, "static") ] ... This means that our "master node" app, djangotutorial , will host all of our CSS and what-not in a subdirectory called /static. Extra Settings There are a lot more things we could add to settings.py ranging from email settings, file uploads, security tokens, whatever, If you'd like to explore those things, be my guest and read the documentation. The one variable I will call out, however, is APPEND_SLASH. Enforcing slashes on URLs is dope as hell, so you should totally do this unless you're some kind of weirdo: APPEND_SLASH = True Templates and Static Assets Quick recap: Django projects are made up of modules called "apps." Of these apps, there is always a "master" app that contains settings, logic, and anything to be shared across all child apps. Page templates and static assets are among the things we can choose to share between apps in a Django project: If every part of our project is going to share the same base styles or the same HTML meta headers, we can opt to keep those things in tutorialapp for our other apps to use. We'll keep our site-wide styles and images in a directory named /static, and our base page template in /templates. Our Base Page Template If you aren't familiar with page templating systems like Handlebars or Jinja, I'm gonna have to leave you in the dark here to keep moving. Take a few minutes to read up on Jinja when you can. Every page of most sites shares roughly the same boilerplate of meta tags and so forth. Instead of duplicating boilerplate every time we make a new page, we'll create a "base" page called layout.html which we'll use to load other page templates into: {% load static %} <!DOCTYPE html> <html lang="en"> <head> <title>{{title}}</title> <meta charset="utf-8" /> <meta name="description" content="This is a description"> <meta name="HandheldFriendly" content="True" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> <meta name="theme-color" content="#5eb9d7"> <link rel="apple-touch-icon" href="icon.png"> <link rel="stylesheet" href=""> <link href="{% static 'css/styles.css' %}" rel="stylesheet" type="text/css"> </head> <body class="{{template}}"> {% block content %}{% endblock %} </body> </html> {% load static %} tells Django to look for our static files in our static folder. It's a bit redundant, but whatever. Once that's done, we can load in assets like stylesheets as we do with {% static 'css/styles.css' %} With that done, djangotutorial now looks like this: /djangotutorial ├── /static │ ├── /css │ │ └── styles.css │ └── /img │ └── logo.png ├── /templates │ └── layout.html ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py Making a Django "App" We're roughly 3000 words deep into this tutorial and we haven't even written any meaningful logic yet. I wasn't kidding when I said Django was rigid, but the good news is getting set up is the hardest part: everyday Django development is far more straightforward than what we've dealt with so far. cd back into the top-level directory which contains manage.py. We'll create our first app by using this command: $ django-admin startapp [YOUR_APP_NAME] Now we can start writing actual business logic. Remember: our goal is to serve a single-page application. Eyes on the prize here, folks. I used the startapp command to create a Django app named myapp. Here's what came out of it: /myapp ├── __init__.py ├── admin.py ├── apps.py ├── /migrations │ └── __init__.py ├── models.py ├── tests.py └── views.py Models? Views? Things are starting to feel more MVC already. Here are the broad strokes of what makes a Django app tick: - models.py is where we'd store database models for Django's ORM. For the scope of this tutorial, we aren't going to bother with database interactions. By the time we actually manage to serve a page template, we'll both be too burnt out to function anyway. - views.py is where we handle building and serving "views" to users - more on this in a moment. - urls.py is actually missing here, but it's expected that any Django app intending to "serve" pages or endpoints will have them. Setting "urls" is equivalent to setting routes: this is where we tell Django to serve view X when visiting URL Y. To make our first page, we'll start by creating a view in views.py. Creating a Homepage A view is simply "something to serve to a user at a given URL." When a user requests a URL from whichever domain Django is hosted on, Django looks through its collection of routes (the stuff in urls.py ) to see if the requested URL is associated with a view. If an association exists, Django passes information about the requester to the view function, and the user is served a response (like a web page). Here's what a simple view looks like: from django.shortcuts import render def index(request): context = {'template': 'homepage', 'title': 'My Django App', 'description': 'You\'ve launched your first Django app!'} return render(request, 'myapp/index.html', context) The only "magic" happening here is thanks to two things Django provides to us: the request object and the render function: - request is an object inherently passed to a view whenever a view is requested. requestcontains metadata about the incoming request such as headers, parameters, HTTP method, etc. Most views would use this metadata as a way to serve responses contextually, but we're not going to do anything special today. - render builds a response to serve to users. In this case, we're returning a page template called index.html, as well as a few variables to render with our page dynamically. So our view is set to return a template at myapp/index.html , but that template doesn't actually exist yet. We need to create a templates folder in our "myapp" module. Django looks for templates here in a way that isn't entirely intuitive. Check out our app's folder structure after we add a template and corresponding stylesheet: /myapp ├── /templates │ └── /myapp │ └── index.html ├── /migrations │ └── __init__.py ├── __init__.py ├── admin.py ├── apps.py ├── models.py ├── tests.py └── views.py Yes, our /templates folder contains a subdirectory named /myapp , which matches the name of the Django app. This a Django thing, and it's admittedly a bit confusing. Moving on to index.html , all we need to do here is extend the layout.html template we made earlier and fill in some content. We'll load in the attributes we passed in our view to keep things interesting: {% extends 'layout.html' %} {% load static %} {% block content %} <div class="card"> <img src="{% static 'img/logo.png' %}" alt="logo" class="logo" /> <h1>Hello world!</h1> <p>{{ description }}</p> </div> {% endblock %} Values in double brackets ( {{title}}, {{template}}, and {{description}}) will be replaced with the values of the matching keys in the dictionary we created in our index view. Then, the entirety of our block named "content" will get loaded into the space we reserved in layout.html for the very same block name. Setting a URL Route myapp now has a view, as well as a corresponding template. The only thing missing is specifying which URL should route to this view. Go ahead and create urls.py : from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), ] urlpatterns is a list of paths, where each path consists of three parameters: - The URL pattern to serve our view at. This always takes the form of a regex pattern. In our example, we want our view to be the homepage, therefore providing an empty string tells Django to serve our view at our site's root. - The view we created in views.py. This is the view that will be served to the user when visiting the URL pattern specified above. - The "name" of our route. Giving our route a name is an easy way to reference URL patterns later on. urls.py allows us to set different URLs pointing to the same view, meaning we can serve the same view at different URLs. For example, here's how we can expand urlpatterns to serve the same page at different URLs: ... urlpatterns = [ path('', views.index, name='index'), path(r'^home/$', views.index, name='index'), path(r'^home/(?P<user>\w+)$', views.index, name='index'), ] Django will now respect three different routes to serve our homepage: /home?user=todd, and our root (aka /). The last example is a way to specify query string parameters to our view, which is a good way to offer context to our views for more dynamic content. It's worth noting that we're allowed to specify the same name for each of these routes, even though they can technically accept URLs. Activating myapp Our app is almost ready! There's one thing left to do... remember the list of INSTALLED_APPS that lives in settings.py? We still need to add our app here before Django respects it: ... # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'myapp', ] ... We're almost there, folks. Our app is good-to-go, and it's been sufficiently "installed." The only thing left is tell our core Django app to listen to the urls myapp/urls.py in our main module. To do this, we need to modify our core Django app's urls.py to look something like this: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('myapp.urls')), ] This probably seems confusing as shit, but the good news is we're done! Let's wrap our heads around this before we see our app in action. Any time a user visits our deployed Django server (at 127.0.0.1:8000 in our case), our "master app" djangotutorial picks up the incoming traffic. djangotutorial compares the URL the user provided to its list of URLs in urls.py , and if a match is found, the user is then directed accordingly. In our example, we're expecting users only to visit the homepage (AKA the root directory, AKA /), which is why our url is seen as an empty string. Our urls.py file tells djangotutorial to defer traffic coming to this URL to myapp , which then takes over from there. The end result is effectively a route that points to another route, which points to a view, which happens to serve our homepage. Run python manage.py runserver to see for yourself: I Hope Somebody Actually Read This I've you've managed to survive this long, you're probably feeling a lot of emotions right now. Fatigue, pride, confusion, hope... perhaps all of the above. This is normal, especially if you happen to be a newcomer to MVC (in which case I'm sorry that you landed here of all places). Make no mistake: Django is no joke. The power of a fully-featured web framework comes with a lot of shit to unpack, but the feeling of overwhelming complexity fades quickly as these patterns become more familiar. As with all things software related, it takes a bit of fussing around before the concepts of Django truly "click." For that reason, I've gone ahead and uploaded the source code for this tutorial to Github for you to pull down and mess around with. You might just be surprised by what you come up with. Discussion (3) It's really comprehensive and easy to read, it's much better when I was starting out as it took me a while to understand Django using 2 Scoops of Django and Coding For Entrepreneurs to help me to land an internship 2 years+ back. I believe the hardest part to understand Django is the difference between MVC and Django's MVT model. Plus the differences between class-based view or function-based view on when is a great time to use it. Lastly, With the release of Django 3. I believe it will become more relevant especially the part where ASGI is actually supported by Django 3.0 onwards. Thanks Max, that means a lot! I completely agree with your top two pain points for learning Django. MVC was a foreign concept to me until I picked up Django. Learning an entirely new software design pattern in parallel to a monolithic framework such as Django is a VERY tall order (in retrospect, I'm not sure how I even managed to stick through it). There may very well be an effective way to convey these concepts to aspiring devs, but I'm not quite sure I've nailed down what that method would look like. It's something I'd love to tackle. Confusion behind class-based vs function-based views actually threw me for a ride just the other day! This aspect of Django is in need of clearer documentation... perhaps a great candidate for the next post! Thanks again for chiming in! It's reassuring to hear my personal pain points are shared with others... it's a great way to know what to write about next :) Hahaha I should thank you as well. Since I was thinking of what are the other topics for me to write for Django. If it is such a major pain point. I might write it down and play around with the newly released Django 3 on how is done.
https://dev.to/hackersandslackers/getting-started-with-django-49cb
CC-MAIN-2021-43
refinedweb
4,878
64.61
How do I find the Index of the smallest number in an array in python if I have multiple smallest numbers and want both indexes? numpy argsort get index of max value in numpy array python numpy argpartition numpy partition numpy argmin numpy get n smallest values numpy find index of values greater than I have an array in which I want to find the index of the smallest elements. I have tried the following method: distance = [2,3,2,5,4,7,6] a = distance.index(min(distance)) This returns 0, which is the index of the first smallest distance. However, I want to find all such instances, 0 and 2. How can I do this in Python? You may enumerate array elements and extract their indexes if the condition holds: min_value = min(distance) [i for i,n in enumerate(distance) if n==min_value] #[0,2] Find K smallest and largest values and its indices in a numpy array , To find the maximum and minimum value in an array you can use numpy argmax and argmin function. These two functions( argmax and argmin )� Python Program to find the Smallest Number in a List Example 2. This python program is the same as above. But this time, we are allowing the user to enter the length of a List. Use np.where to get all the indexes that match a given value: import numpy as np distance = np.array([2,3,2,5,4,7,6]) np.where(distance == np.min(distance))[0] Out[1]: array([0, 2]) Numpy outperforms other methods as the size of the array grows: Results of TimeIt comparison test, adapted from Yannic Hamann's code below Length of Array x 7 Method 1 10 20 50 100 1000 Sorted Enumerate 2.47 16.291 33.643 List Comprehension 1.058 4.745 8.843 24.792 Numpy 5.212 5.562 5.931 6.22 6.441 6.055 Defaultdict 2.376 9.061 16.116 39.299 Python - Find the indices for k Smallest elements, Sometimes, while working with Python lists, we can have a problem in which we This task can occur in many domains such as web development and while Let's discuss a certain way to find indices of K smallest elements in list. If you like GeeksforGeeks and would like to contribute, you can also write� To find largest and smallest number in a list. Approach : Read input number asking for length of the list using input() or raw_input(). Initialise an empty list lst = []. Read each number using a Surprisingly the numpy answer seems to be the slowest. Update: Depends on the size of the input list. import numpy as np import timeit from collections import defaultdict def weird_function_so_bad_to_read(distance): se = sorted(enumerate(distance), key=lambda x: x[1]) smallest_numb = se[0][1] # careful exceptions when list is empty return [x for x in se if smallest_numb == x[1]] # t1 = 1.8322973089525476 def pythonic_way(distance): min_value = min(distance) return [i for i, n in enumerate(distance) if n == min_value] # t2 = 0.8458914929069579 def fastest_dont_even_have_to_measure(np_distance): # np_distance = np.array([2, 3, 2, 5, 4, 7, 6]) min_v = np.min(np_distance) return np.where(np_distance == min_v)[0] # t3 = 4.247801031917334 def dd_answer_was_my_first_guess_too(distance): d = defaultdict(list) # a dictionary where every value is a list by default for idx, num in enumerate(distance): d[num].append(idx) # for each number append the value of the index return d.get(min(distance)) # t4 = 1.8876687170704827 def wrapper(func, *args, **kwargs): def wrapped(): return func(*args, **kwargs) return wrapped distance = [2, 3, 2, 5, 4, 7, 6] t1 = wrapper(weird_function_so_bad_to_read, distance) t2 = wrapper(pythonic_way, distance) t3 = wrapper(fastest_dont_even_have_to_measure, np.array(distance)) t4 = wrapper(dd_answer_was_my_first_guess_too, distance) print(timeit.timeit(t1)) print(timeit.timeit(t2)) print(timeit.timeit(t3)) print(timeit.timeit(t4)) numpy.amin(), Python's numpy module provides a function to get the minimum If it's provided then it will return for array of min values along the axis i.e. Get the array of indices of minimum value in numpy array using numpy.where() i.e. Tuple of arrays returned : (array([0, 2], dtype=int32), array([0, 2], dtype=int32)). C Program to Find Smallest Number in an Array. In this C Program to find the smallest number in an array, we declared 1 One Dimensional Arrays a[] of size 10.We also declared i to iterate the Array elements, the Smallest variable to hold the smallest element in an Array. We can use an interim dict to store indices of the list and then just fetch the minimum value of distance from it. We will also use a simple for-loop here so that you can understand what is happening step by step. from collections import defaultdict d = defaultdict(list) # a dictionary where every value is a list by default for idx, num in enumerate(distance): d[num].append(idx) # for each number append the value of the index d.get(min(distance)) # fetch the indices of the min number from our dict [0, 2] How do I find the indices of the maximum (or minimum) value of my , Learn more about maximum, minimum, max, min, index, array, matrix, find, I would like to know how to find the indices of just the maximum (or minimum) value. The "min" and "max" functions in MATLAB return the index of the minimum and maximum values, respectively, I got two indices, both have the same value. Given a list of numbers, the task is to write a Python program to find the smallest number in given list. Examples: Input : list1 = [10, 20, 4] Output : 4 Input : list2 = [20, 10, 20, 1, 100] Output : 1 You can also do the following list comprehension distance = [2,3,2,5,4,7,6] min_distance = min(distance) [index for index, val in enumerate(distance) if val == min_distance] >>> [0, 2] Chapter 7: Arrays, We need a way to declare many variables in one step and then be able to store and access Like Strings, arrays use zero-based indexing, that is, array indexes start with 0. If we changed the numbers array to have a different number of elements, this code sort(array), rearranges the values to go from smallest to largest. Java program to find largest and second largest in an array: Find the index of the largest number in an array: find largest and smallest number in an array in java: find the second smallest number in an array in java: Find the index of the smallest number in an array: Spring mvc hello world example for beginners: Spring MVC tutorial with examples 8.6. array — Efficient arrays of numeric values — Python 2.7.18 , On narrow Unicode builds this is 2-bytes, on wide builds this is 4-bytes. Array objects support the ordinary sequence operations of indexing, slicing, When using slice assignment, the assigned value must be an array object with the Return the smallest i such that i is the index of the first occurrence of x in the array . Python | Largest, Smallest, Second Largest, Second Smallest in a List 29-11-2017 Since, unlike other programming languages, Python does not have arrays, instead, it has list. Sorting Arrays, This section covers algorithms related to sorting values in NumPy arrays. science courses: if you've ever taken one, you probably have had dreams (or, For example, a simple selection sort repeatedly finds the minimum value from a list, [1 2 3 4 5]. A related function is argsort , which instead returns the indices of the� As our array arr is a flat 1D array, so returned tuple will contain only one array of indices and contents of the returned array result[0] are, [ 4 7 11] Get the first index of element with value 15, 9. Lists — How to Think Like a Computer Scientist: Learning with , A list is an ordered set of values, where each value is identified by an index. With all these ways to create lists, it would be disappointing if we couldn't assign list Since strings are immutable, Python optimizes resources by making two names Since variables refer to objects, if we assign one variable to another, both� In this article we will discuss how to find the minimum or smallest value in a Numpy array and it’s indices using numpy.amin(). numpy.amin() Python’s numpy module provides a function to get the minimum value from a Numpy array i.e. - get the smallest number, and then linearly iterate, get all the indexes for that number. - Why would you calculate the minimum for every iteration? - @YannicHamann Nothing surprising at all. I ran these tests before posting my answer. NumPy is not a silver bullet. - Interesting. I would not have expected that. I wonder why that is the case? - when you compare distance of the type numpy.ndarraywith an integer it always evaluates the FULL array. - I think this brings up an important point: numpy shines in efficient computation with very large arrays. For small arrays, numpy may not be the most efficient, as you have clearly pointed out. But numpy is much more scalable than most other methods. This discussion contains some relevant explanation. - No problem. I made the plot above in Excel, because it was quick. - I re-made the plot using Matplotlib. - I ran some additional tests using your code which show how numpy performs well even as the array size increases dramatically. - How is this different from my previously posted answer? - @DYZ I think we both posted the answer at the same time. Or do you have any reason to suggest that my answer came from your? What if I turned around and asked you the same question? - Calculating the minimum for every iteration seems wasteful in both of your answers.
http://thetopsites.net/article/55189626.shtml
CC-MAIN-2021-04
refinedweb
1,636
60.85
Read bytes from a file #include <sys/uio.h> ssize_t readv( int fildes, const iov_t* iov, int iovcnt ); libc Use the -l c option to qcc to link against this library. This library is usually included automatically.: When attempting to read from a file (other than a pipe or FIFO) that supports nonblocking reads and has no data currently available: If you call readv() on a portion of a file, prior to the end-of-file, that hasn't been written, it returns bytes with the value zero. If readv() succeeds, the st_atime field of the file is marked for update.
http://www.qnx.com/developers/docs/6.6.0.update/com.qnx.doc.neutrino.lib_ref/topic/r/readv.html
CC-MAIN-2018-26
refinedweb
101
68.91
Here we will see how to count number of objects are created from a specific class using some static member functions. The static members are class properties, not the object properties. For a single class there will be only one instance for static members. No new members are created for each objects. In this problem we are using one static counter variable to keep track the number of objects, then static member will be there to display the count value. When a new object is created, so the constructor will be called. Inside the constructor, the count value is increased. Thus we can get the output. #include <iostream> using namespace std; class My_Class{ private: static int count; public: My_Class() { //in constructor increase the count value cout << "Calling Constructor" << endl; count++; } static int objCount() { return count; } }; int My_Class::count; main() { My_Class my_obj1, my_obj2, my_obj3; int cnt; cnt = My_Class::objCount(); cout << "Number of objects:" << cnt; } Calling Constructor Calling Constructor Calling Constructor Number of objects:3
https://www.tutorialspoint.com/count-the-number-of-objects-using-static-member-function-in-cplusplus
CC-MAIN-2021-43
refinedweb
163
53.41
Pretty much every web site on the Internet features a form for users to provide feedback via email to site owners. This site is no different. Migrating to ASP.NET MVC requires a slightly different approach to that used by Web Forms development, so this article looks at one way to implement a web site contact form using the MVC framework and jQuery that degrades nicely. AJAX functionality is said to be "degradable" if a way is provided for the process to work, even though users don't have Javascript available to them. The form will be very simple. It will contain fields to accept the user's name, email address and comments. In addition, it will contain a simple method to verify that the submitter of the form is human. Once submitted, the contents of the form will be sent via email. The form itself can be seen on the Contact page and uses some css to set the style (which is easily borrowed from the site's css file if you want it). The View code is as follows: <div id="contactform"> <p> If you feel like contacting me, please use this form to do so.</p> <form id="contact" action="<%= Url.Action("Index") %>" method="post"> <fieldset> <legend>Message/Comments</legend> <div class="row"> <span class="label"> <label for="name"> Your name:</label></span> <%=Html.TextBox("name", ViewData["name"] ?? "")%> <%=Html.ValidationMessage("name")%> </div> <div class="row"> <span class="label"> <label for="email"> Your email address:</label></span> <%=Html.TextBox("email", ViewData["email"] ?? "")%> <%=Html.ValidationMessage("email")%> </div> <div class="row"> <span class="label"> <label for="comments"> Your comments:</label></span> <%=Html.TextArea("comments", ViewData["comments"] != null ? ViewData["comments"].ToString() : "", new{ <span class="label"> <label for="preventspam"> </label> </span> <%=Html.TextBox("preventspam", ViewData["email"] ?? "")%> <%=Html.ValidationMessage("preventspam")%> </div> <div class="row"> <span class="label"> </span> <input type="submit" id="action" name="action" value="Submit" /> </div> </fieldset> </form> </div> HtmlHelpers are used to construct the form. At the moment, there is nothing in the label next to the preventspam input (TextBox). This will be looked at next along with the Controller Action. The whole form (including some text welcoming comments etc) is wrapped in a div with the id of contactform. This will be used by jQuery when the form is submitted. More of that a bit later. In the meantime, here is the promised code for the Index() action of the ContactController: using System; using System.Web.Mvc; using System.Net.Mail; using System.Text.RegularExpressions; namespace MikesDotnetting.Controllers { public class ContactController : BaseController { public ActionResult Index() { if (HttpContext.Session["random"] == null) { var r = new Random(); var a = r.Next(10); var b = r.Next(10); HttpContext.Session["a"] = a.ToString(); HttpContext.Session["b"] = b.ToString(); HttpContext.Session["random"] = (a + b).ToString(); } return View(); } } } This is called when the page requested. It contains a little bit of code that intialises two random numbers between 0 and 10. These are used to prevent spammer bots from repeatedly submitting the form. The user is presented with these two numbers and asked to perform some simple addition. Then they enter the sum of the numbers in the preventspam box. Both numbers and the total are stored in session variables. As far as I am concerned, you can keep your impossible-to-read Captcha stuff. Before I implemented this approach in the Web Forms version of the site, I used to get tons of spam each day, and the volume was growing rapidly. As soon as I implemented this, it stopped completely. I have not had one single bot-submitted comment. Well, I had one - or at least the person claimed to be a bot and said my prevention measures did not work because they had got around it. What a loser. Anyway, I digress.... We need to see how these session values are presented to the user, so here's the amended portion of the View that's relevant: <div class="row"> <span class="label"> <label for="preventspam"> <%= HttpContext.Current.Session["a"] %> + <%= HttpContext.Current.Session["b"]%> </label></span> <input type="text" id="preventspam" name="preventspam" class="required" /> </div> And here's how the rendered page looks (part way through a redesign...) The second Controller action, an overloaded version of Index()is marked with the AcceptVerbs attribute with a parameter of POST passed in, as this is the method for the HTTP Request that comes from the form: [AcceptVerbs("POST")] public ActionResult Index(string name, string email, string comments, string preventspam) { const string emailregex = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; var result = false; ViewData["name"] = name; ViewData["email"] = email; ViewData["comments"] = comments; ViewData["preventspam"] = preventspam; if (string.IsNullOrEmpty(name)) ViewData.ModelState.AddModelError("name", "Please enter your name!"); if (string.IsNullOrEmpty(email)) ViewData.ModelState.AddModelError("email", "Please enter your e-mail!"); if (!string.IsNullOrEmpty(email) && !Regex.IsMatch(email, emailregex)) ViewData.ModelState.AddModelError("email", "Please enter a valid e-mail!"); if (string.IsNullOrEmpty(comments)) ViewData.ModelState.AddModelError("comments", "Please enter a message!"); if(string.IsNullOrEmpty(preventspam)) ViewData.ModelState.AddModelError("preventspam", "Please enter the total"); if (!ViewData.ModelState.IsValid) return View(); if (HttpContext.Session["random"] != null && preventspam == HttpContext.Session["random"].ToString()) { var message = new MailMessage(email, "me@me.com") { Subject = "Comment Via Mikesdotnetting from " + name, Body = comments }; var client = new SmtpClient("localhost"); try { client.Send(message); result = true; } catch { } } if (Request.IsAjaxRequest()) { return Content(result.ToString()); } return result ? View() : View("EmailError"); } Initially a bool is initiated along with a string containing a Regular Expression pattern for matching a valid email address structure. Having obtained the values which ASP.NET MVC passes in to the method, the code checks to ensure that they all validate against business rules - that there is something there and that the email is valid. If the form was submitted via AJAX, all of these should pass, since the clientside validation will have come into play. However, if the form was submitted manually and any of the validation rules are not met, the View is returned with the values and error messages held within the ViewDataDictionery. If the ModelState is valid (all test have passed) the next step is to make sure that Session["random"] is valid, and that it matches the value submitted by the user. Once that test is passed satisfactorily, an email message is constructed and sent. The bool result, which was initially set to false is set to true if everything is successful. It is at this stage that we now know whether all the tests were passed and whether the email was sent, so a suitable response is prepared for the user. jQuery automatically applies values to the Request header to say that the request was initiated via xmlhttprequest, and the Request.IsAjaxRequest() method returns a bool to indicate if indeed this request was via AJAX. If the form was submitted via AJAX, the return value is simply a string which reads either "True" or "False". This is returned via the Controller.Content() method that allows for a customised content to be returned by the controller action. At this stage, however, there is no provision for those with Javascript disabled. All they will see is a blank page with a single "True" or "False" written to it. To cater for this, another View has been created - EmailError EmailError.aspx <%@ Page Contact Me </asp:Content> <asp:Content <h2>Contact Me</h2> <div id="oops"> <p> Unfortunately, something went wrong and your message or comments have not been submitted successfully. I'll try to fix whatever the problem is as soon as I can.</p> </div> </asp:Content> If the form was not submitted by AJAX, the appropriate View is returned instead using the Controller.View() method. So, how do these values get posted to the SendMail() action in the Controller via AJAX? This question can be answered by looking at the jQuery code that has been added to the Index View. <script type="text/javascript"> $(document).ready(function() { $("#name,#comments,#preventspam").addClass("required"); $("#email").addClass("required email"); $("#contact").validate({ submitHandler: function(form) { $.ajax({ type: "POST", url: $("#contact").attr('action'), data: $("#contact").serialize(), dataType: "text/plain", success: function(response) { $("#contactform").hide('slow'); response == "True" ? $("#thanks").show('slow') : $("#oops").show('slow'); }, error: function(response) { $("#contactform").hide('slow'); $("#oops").show('slow'); } }); } }); return false; }); </script> This might look a bit of a chunk, but it is straightforward really. The $(document).ready() event occurs once the page has fully loaded so that jQuery can make sure all elements in the DOM are accessible. I have used the jQuery Validation plugin to perfom clientside validation, which checks to see that there are values in each of the form fields, and that the email address is at least of the right format. This is illustrative only, and makes no use of the options available within the plugin to check for minimum lengths, customise the error messages and so on. It's not the focus of this article. However, it is worth pointing out that at a basic level, validation can be hooked up through the use of class attributes on the various <input> elements. This leads to warnings in Visual Studio unless you declare those classes in your css file, or you apply the css classes through Javascript. I opted for the latter approach because if the page is NOT submitted via Javascript, ASP.NET MVC's built-in validation will automatically add class attributes which can mean problems in getting css styles to work as desired. Basically, they get munged. It is also worth mentioning that this does not replace the server-side validation that was covered within the overloaded Index() action earlier. Clientside validation should be seen purely as a convenience for the user, and not a gate keeper for your application. Once the form is in a valid state, the submitHandler option manages the posting of the values to the overloaded Index() controller action. The response will be either True or False, depending on whether there was an error or not somewhere along the line, and the jQuery then manipulates the divs showing the appropriate one below (which appear at the bottom of the Index.aspx file) depending on the returned value. In both cases, the form itself is slowly hidden and replaced with a message - confirming success, or apologising for the lack of success in the process. <div id="oops" style="display:none"> <p> Unfortunately, something went wrong and your message or comments have not been submitted successfully. I'll try to fix whatever the problem is as soon as I can.</p> </div> <div id="thanks" style="display:none"> <p> Thanks for you comments. They have been successfully sent to me. I will try to respond if necessary as soon as I can.</p> </div> Room For Improvement The email sending is not particularly testable if you are taking a TDD approach. It's certainly not testable if you have no SMTP Service available on the local machine. Ideally, the mailing function would be housed in a Service Layer, implemented perhaps as ISendMail. Dependency Injection can then be used to resolve the respective types for Development and Production. The same could be said of the server-side validation. Something very similar will be used for the Comments form at the bottom of each article on my web site. At that point, I will move the validation to a Service Layer too. PLEASE NOTE: The form below is NOT an example of the form the article refers to, so please don't send comments through it with stuff like "Just Testing". 26 Comments - Balaji Birajdar - NoEmptyCatchBlocksPlease However I wouldn't suggest this ever (even in examples, rather just let it get thrown).. try { /* some code here 8? client.Send(message); result = true; } catch { /* no code here !! */ } Its always better for you and the user to know something when wrong... - Darren Oster - Mike You need to read the disclaimer on my Contact page ;-) But, yes. A call to a logging component would ideally go into the catch block. The user already knows that something didn't work even with the code as-is. - Mike Without knowing how you have tried to apply the code, I have no idea what the problem could be. I suggest that you post a question to the forums at showing the code you are attempting to use, and a reference to this article so that people who answer questions there know what you are trying to do. - swamy - Mike Please send me £500.00 - Bruno Nepomuceno - Mike Not to my coments form - no. - test - Saurabh Thanx for this nice post. But I have a question. if (Request.IsAjaxRequest()) { return Content(result.ToString()); } is this condition always true??? because you are not using any kind on ajax like (<%=Ajax.BeginForm() %>) in your HTML page. Kind Regards, Saurabh - roger what this line does? - Mike I am using jQuery for Ajax, not ASP.NET Ajax. I could have hard-coded the xmlhttprequest, or used any one of a number of libraries, but I chose jQuery. So there is AJAX in the page. - Mike It does what it says on the tin - it basically serialises all the contents of the form fields and constructs the data for the HTTP POST request: - Hari - Michael Is it possible to have an attachment using your sample? cheers, - adham - Tony thanks in advance. - AJAX Development - Mike The break happens on and everything was copied straight from your example, so im not sure whats going on. if i figure it out i will reply. Thanks again for the concept though! - Mike Did you include the jQuery Validate scripts? - Miraç - borat If yes, please post it here. I'm having the same problem: my code breaks at the same place as Mike's: $("#contact").validate({...... and I'm including the jQuery validate scripts! Please help! - Mike I'll ask you the same question I asked Mike - are you sure you referenced the Validate script correctly? If you did, try posting a question the forums at. This site isn't a forum, and it can take me a while to get round to publishing comments. - Guru - David I have to tell you, you have a great site! I've learned a lot from you and thank you for it. For the past few months I've referenced your website to learn ASP.NET (MVC, Web Forms & Web Pages). I was all set to redeploy my website (classic ASP) using ASP.NET Web Pages when they announced vNext - that motivated me to stick with classic ASP a while longer. So I redesigned everything using my tried and true (since 2001) code, adding some bootstrap and jQuery and frankly, it took me a couple of days instead of months. Okay, I'm getting a little long. To the point: You wrote, "As far as I am concerned, you can keep your impossible-to-read Captcha stuff." I couldn't agree more and really wanted YOUR solution on MY antiquated website. I wanted to tell you that the snippet of code found in this article was inspirational!!! I was receiving hundreds of spambot messages from our contact form. Since I am sticking with classic ASP, I had to "revise" your code just a little to make it work. FROM if (HttpContext.Session["random"] == null) { var r = new Random(); var a = r.Next(10); var b = r.Next(10); HttpContext.Session["a"] = a.ToString(); HttpContext.Session["b"] = b.ToString(); HttpContext.Session["random"] = (a + b).ToString(); } return View(); To Dim max, min max = 10 min = 0 If ISNULL(Session("spamcheck")) or Session("spamcheck") = "" then Randomize Session("a") = Int((max-min+1)*Rnd+min) Session("b") = Int((max-min+1)*Rnd+min) Session("spamcheck") = Int(Session("a") + Session("b")) End If Yeah, that easy! I clear the spamcheck session when the form submits successfully. I share to thank you - perhaps a reader or two will find this useful too. If you're interested in seeing the whole site, send me an email. Thank you again!!! David
http://www.mikesdotnetting.com/article/106/a-degradable-jquery-ajax-email-form-for-asp-net-mvc
CC-MAIN-2015-32
refinedweb
2,659
66.03
NAME tmpnam, tmpnam_r - create a name for a temporary file SYNOPSIS #include <stdio.h> char *tmpnam(char *s); DESCRIPTION name that is created, has a directory prefix P_tmpdir. (Both L_tmpnam and P_tmpdir are defined in <stdio.h>, just like the TMP_MAX mentioned below.) RETURN VALUE The tmpnam() function returns a pointer to a unique temporary filename, or NULL if a unique name cannot be generated. ERRORS No errors are defined. NOTES The tmpnam() function generates a different string each time it is called, up to TMP_MAX times. If it is called more than TMP_MAX times, the behaviour is implementation defined. Portable applications that use threads cannot call tmpnam() with NULL parameter, define _SVID_SOURCE or _BSD_SOURCE before including <stdio.h>. BUGS Never use this function. Use tmpfile(3) instead. CONFORMING TO SVID 2, POSIX, 4.3BSD, ISO 9899 SEE ALSO mkstemp(3), mktemp(3), tempnam(3), tmpfile(3) 2003-11-15 TMPNAM(3)
http://manpages.ubuntu.com/manpages/dapper/man3/tmpnam.3.html
CC-MAIN-2013-48
refinedweb
152
52.15
Hi, I need to reduce WKT (Well Known Text) length. The reduction is done by rounding/trunkating decimal places from 11 to 3 - default output for the script !shape.wkt! returns coordinate list with 11 decimal places (in a metric projected coordinate system). I ran across a RegEx expression that might do the job, but it returns an error (arcGIS Pro 2.7 - python): %Expression: regex(!WKT!) %Code Block: import re def regex(!WKT!): return re.replace (!wkt!, '(\d+. \d{4}) \d+)', '\1') I'm not experianced python user. I'd be happy to get help with solution - it doesnt has to be this expression - any creativ/simple solution (in Field Calculator) is welcomed. I attached a sample layer (FGDB). Thanks in advance, Solved! Go to Solution. The following script should work: %Expression: re.sub(compiling, mround, !SHAPE.wkt!) %Code Block: import re compiling = re.compile(r"\d*\.\d+") def mround(wkt): return "{:.3f}".format(float(wkt.group())) def regex(!WKT!): return re.replace (!wkt! you switch text case... !WKT! keep it consistent if that is the name of the field fix the re.replace section You changed the code I provided, in your Code Block, that's why you're getting the error. I also tried it on your dataset and I'm getting the right output. Input: MULTIPOLYGON (((198102.99230000004 666117.40980000049, 198102.99230000004 656117.40980000049, 208102.99230000004 656117.40980000049, 208102.99230000004 666117.40980000049, 198102.99230000004 666117.40980000049))) Output: MULTIPOLYGON (((198102.992 666117.410, 198102.992 656117.410, 208102.992 656117.410, 208102.992 666117.410, 198102.992 666117.410))) My bad It worked 🙂 Many thanks perhaps the following. You have to use the mround function and pass in the SHAPE field I think %Expression: mround(!SHAPE!) %Code Block: import re def mround(!SHAPE!): compiling = re.compile(r"\d*\.\d+") re.sub(compiling, mround, !SHAPE!.wkt) return "{:.3f}".format(float(wkt.group())) Thanks Got error: File "<string>", line 2 def mround (!SHAPE!): SyntaxError: Invalid Sytax %Code Block: import re def mround(fld): compiling = re.compile(r"\d*\.\d+") re.sub(compiling, mround, fld.wkt!) return "{:.3f}".format(float(wkt.group())) For a moment @DanPatterson , I thought you were proposing a regex solution right off the bat, and then I realized you were tweaking the OP's regex. 🙂
https://community.esri.com/t5/geoprocessing-questions/field-calc-pro-2-7-reduce-wkt-length-by-rounding/td-p/1046258
CC-MAIN-2022-33
refinedweb
379
68.87
Using the 'Navigation' option you can create custom navigation structure for the webshop. Navigation editor allows to link the pages to the navigation items and edit them to build a fully functional webshop navigation. The navigation can be configured in the backoffice at the following location: Content -> Navigation. Four types of navigation can be created: Top, Left, Sitemap and Footer. Each type of navigation corresponds to the location where the menu is shown on the webshop. The group code must be set in the backoffice for the appropriate type of navigation. In the default theme of the Sana Commerce webshop there will be only up to 3 levels presented. But within the navigation tree you can create unlimited levels. More information about navigation settings and their configuration can be found here. The overall structure of the navigation is presented as a tree. The names of the invisible items have the grey colour: The Navigation Tree The navigation tree can be managed using the toolbar or context The table below provides the description of the toolbar functionality: If you need to create navigation for different languages do not import item categories and product groups from NAV (item groups or product categories from AX) for each language. Only import it to the base language and then copy the navigation tree to the other languages and translate the navigation items. The navigation tree structure can also be created and managed using the context menu. In addition to the toolbar functionality you can also delete navigation item and related page from the context menu. It is impossible to delete an external page, so if the external URL is linked to the navigation item. The navigation item itself can be deleted but not with a related page. The navigation item editor is presented to the right from the navigation tree (see the screenshot below). By using it you can: For more information about each type of the internal pages please read the 'Content' section.
http://help.sana-commerce.com/sana-commerce-83/user_guide/content/navigation
CC-MAIN-2018-13
refinedweb
329
52.9
Hi all, I'm just getting started with Java and created a simple app. Please see the code and the output. Where did I go wrong? Do I need to set the variable of "display" on top of the input? Why is the input not being stored as a variable? import java.util.Scanner; public class UserInput { public static void main (String args[]){ Scanner jason = new Scanner(System.in); String fname; String lname; String addr1; String addr2; String display; System.out.println("Enter first name: "); fname = jason.nextLine(); System.out.println("Enter last name: "); lname = jason.nextLine(); System.out.println("Enter Address 1: "); addr1 = jason.nextLine(); System.out.println("Enter Address 2: "); addr2 = jason.nextLine(); display = ("fname, lname, addr1, addr2"); System.out.println("The information you entered is: "+ display); } } Enter first name: Joe Enter last name: Rogan Enter Address 1: 123 Fastlane Enter Address 2: LA CA 90211 The information you entered is: fname, lname, addr1, addr2
http://www.javaprogrammingforums.com/whats-wrong-my-code/29852-newbie-question-print-out-strings-input.html
CC-MAIN-2015-11
refinedweb
157
52.66
django-gcharts 1.2 Provides a QuerySet, Manager and other tools for easy integration with the Google Visualization API - Requires installation of the gviz_api library which is freely available from Google. - See for details. ## Note ## **Development status updated to beta. The code is still short on unit tests, so bad stuff can happen!** Please feel free submit patches/pull requests ;) ### Disclaimer ### This library is heavy influenced by [mvasilkov's django-google-charts]() and some of the code (template tags and javascript code) are directly copied from him. I've done some minor adjustments to make it work for my approach. ## About django-gcharts ## As I find mvasilkov's approach very clever, I think it would be nice if the model could deliver it's data in a format the Google Visualization API can read. This library is an attempt of doing that, by using a custom QuerySet and Manager which is plugged directly into the model, and some wrapper methods to bind the QuerySet data up against the gviz_api library. The goal is to "fully" support the QuerySet (with aggregates, joins, extra, annotates, etc) so that we can gather data by using familiar QuerySet syntax. ### Demo site ### The git version now includes a demo site which can be run at your local machine once cloned. The demo site previews a few of the charts included in the Google Visualization API, and should contain enough working examples for you to figure out how this stuff works. **Important: The [gviz_api]() library is _not_ included, and must still be installed separately.** To get started with the demo site, follow these steps. $ git clone $ cd django-gcharts $ python manage.py syncdb $ python manage.py initdata $ python manage.py runserver Then point your browser to and you should see a few different charts displayed. ## Configuration ## ### Installation ### $ pip install django-gcharts ### settings.py ### GOOGLECHARTS_API = "1.1" GOOGLECHARTS_PACKAGES = ["corechart"] INSTALLED_APPS = ( ... 'gcharts', ... ) * `GOOGLECHARTS_API` - Optional. Defaults to 1.1 * `GOOGLECHARTS_PACKAGES` - Optional. List of packages that should be loaded. Defaults to only `corechart`. ### Packages ### The charts in the Google Visualization API are separated into different packages. For the most basic charts you would only need to load the `corechart` package (which is the default if none is specified). Below follows a list of which charts are available in the different packages. **Please note that all packages specified in settings.py will load every time the `{% gcharts %} ... {% endgcharts %}` block is rendered.** Optionally, the package for the specific chart can be specified in the `{% render ... %}` tag as a the last option. The tag should in that case be written as: `{% render "div_id" "data" "options" "package name" %}`. This will cause the package to be applied to the current `{% gcharts %} ... {% endgcharts %}` block only, in addition to those specified in settings.py. * `corechart` contains these charts * [AreaChart]() * [BarChart]() * [BubbleChart]() * [CandleStickChart]() * [ColumnChart]() * [ComboChart]() * [LineChart]() * [PieChart]() * [ScatterChart]() * [SteppedAreaChart]() * `gauge` * [Gauge]() * `geochart` * [GeoChart]() * `table` * [Table]() * `treemap` * [TreeMap]() ### models.py ### Register the GChartsManager to the model you'd like to draw charts from from django.db import models from gcharts import GChartsManager class MyModel(models.Model): # when using multiple managers, we need to specify the default 'objects' manager as well # NOTE: Make sure to specify the default manager first, else wierd stuff can happen! # See #Issue3 objects = models.Manager() # register the GChartsManager as a manager for this model gcharts = GChartsManager() my_field = models.CharField(....) my_other_field = models.IntegerField() ... ## Examples ## Spam Inc. needs to chart how much spam they sell. **models.py** from django.db import models from gcharts import GChartsManager class Spam(models.Model): objects = models.Manager() gcharts = GChartsManager() name = models.Charfield(max_length=10) ... ... cdt = models.DateTimeField(auto_add_now=True, verbose_name="Creation datetime") **views.py** from dateutil.relativedelta import relativedelta from django.shortcuts import render_to_response from django.template.context import RequestContext from models import Spam def render_chart(request): if request.method == "GET": # Get a point in time we want to render chart from series_age = datetime.today() - relativedelta(months=3) # Create a fairly advanced QuerySet using: # - filter() to get records newer than 'series_age' # - extra() to cast a PostgreSQL 'timestampz' to 'date' which translates to a pyton date object # - values() to extract fields of interest # - annotate() to group aggregate Count into 'id__count' # - order_by() to make the aggregate work qset = Spam.gcharts.filter(cdt__gt=series_age).extra(select={"date": "cdt::date"}) \ .values("date").annotate(Count("id")).order_by() # Call the qset.to_json() method to output the data in json # - labels is a dict which sets labels and the correct javascript data type for # fields in the QuerySet. The javascript data types are automatically set, # except for extra fields, which needs to be specified in a dict as: # {'extra_name': {'javascript data type': 'label for field'}} # - order is an iterable which sets the column order in which the data should be # rendered # - formatting is a dict {'field_name': 'expression'}, where expression is a # valid string.format() expression. spam_json = qset.to_json(labels={"id__count": "Spam sold", "date": {"date": "Date"}}, order=("date", "id__count"), formatting={"id__count": "{0:d} units of spam"}) return render_to_response("sales_overviews/spamreport.html, {"spam_data": spam_json}, context_instance=RequestContext(request)) **spamreport.html** ... {% load gcharts %} {% gcharts %} options = { width: 500, height: 300 }; spam_opt = _clone(options); spam_opt.title = "Units of Spam sold last 3 month"; {% options spam_opt %} kind: "ColumnChart", options: spam_opt, {% endoptions %} {% render "spam_chart" "spam_data" "spam_opt" %} {% endgcharts %} <div id="spam_chart"> </div> ... Should output something like this. - Author: Rolf Håvard Blindheim - Keywords: django google charts graph plot --gcharts-1.2.xml
https://pypi.python.org/pypi/django-gcharts/1.2
CC-MAIN-2016-36
refinedweb
884
58.58
Learn Threading Programming Stephen Toub: Inside TPL Dataflow PodcastTPL Dataflow (TDF), System.Threading.Tasks.Dataflow,builds upon the foundational layer for asynchronous and concurrent programming using Tasks provided in TPL in .NET 4. 6 years ago Deep C# - avoiding race conditions ArticleMike James explores the perils of multi-threading and explores ways of staying safe in a multi-core environment. 7 years ago by Mike James Automate web application UI testing with Selenium ArticleTesting web applications is a problem, but Sing Li thinks the solution might be easier than you think with Selenium. 7 years ago by Sing Li C# 3.0 Unleashed: With the .NET Framework 3.5 BookWhether you need an approachable on-ramp to .NET or you want to enhance your skills, C# 3.0 Unleashed is a comprehensive, in-depth guide to the solutions you seek. 9 years ago by Sams WPF Custom Controls ArticleWPF completely overturns the classic approach to developing Windows applications and adds user interface flexibility and pizzazz unavailable to Windows developers up to now. 9 years ago by George Shepherd Rail-trails Midwest Great Lakes: Illinois, Indiana, Michigan, Ohio and Wisconsin BookIn this edition in the popular series, the Rails-to-Trails Conservancy presents the best of the Great Lakes rail-trails, home to the most rail-trails in the country. 8 years ago by Wilderness Press Multithreading in VB.NET ArticleMultithreading, a very powerful technique, is essential for modern software development. Software users expect to work with a very responsive program that they don’t have to wait on, which is a very 11 years ago by John Spano .NET Threading Part II ArticleThis is the second article of two parts on .NET threading. In this second part, I will discuss further the synchronization objects in the System.Threading .NET namespace, thread local storage, COM int 13 years ago by Randy Charles Morin C# Threading in .NET ArticleThe first in a two part series on C# threads, introducing how to create and manipulate threads with the .NET framework, including creating a thread, thread pools, syncronization, race conditions and t 14 years ago by Randy Charles Morin Worker Threads ArticleThis describes techniques for proper use of worker threads. It is based on several years' experience in programming multithreaded applications. 16 years ago by Joseph M. Newcomer Discussion Share a good dvd copy software! 5 years ago by christinesmith169 (2 replies) Multithreading Modal Form/Message 8 years ago by Akhtar Hussain (0 replies)
http://www.developerfusion.com/t/threading/
CC-MAIN-2017-51
refinedweb
410
54.93
On Thu, May 01, 2003 at 10:40:45PM +0200, Mickael Marchand wrote: > > Does anyone have a repackaged deb of kmail, kvim and whatever else needs > > to be modified that will support using the vimpart > >. Yeah, I did that hoping it would auto-magically work... of course, I didn't realize that kmail also needed to be rebuilt. I did get the vimpart "installed" -- of course with no where to test it, it's hard to see if what I did worked. :) > apt-get source kmail apply the patch > () and rebuild the > pkg for 3.1.1. Thanks for the pointers... The reason that I was asking is that I'm having a hard time building the source. I'm getting the same error after grabbing the source and trying to let apt build it as well: $ apt-get source -b kmail [...] checking for Qt... configure: error: Qt (>= Qt 3.1.0) (library qt-mt) not found. Please check your installation! For more details about this problem, look at the end of config.log. Make sure that you have compiled Qt with thread support! make: *** [configure-stamp] Error 1 Build command 'cd kdenetwork-3.1.1 && dpkg-buildpackage -b -uc' failed. E: Child process failed $ Then in the config.log the build error I'm getting (linker error): -------------------------------------------------------------------- configure:22273: rm -rf SunWS_cache; g++ -o conft -fno-exceptions -fno-check-new -I/usr/include/qt3 -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -L/usr/share/qt3/lib -L/usr/X11R6/lib conftest.cc -lqt-mt -lpng -lz -lm -ljpeg -ldl -lXext -lX11 -lSM -lICE -lpthread 1>&5 /tmp/ccKGFVhw.o(.text+0xb): In function `main': : undefined reference to `QString::null' /tmp/ccKGFVhw.o(.text+0x10): In function `main': : undefined reference to `QStyleFactory::create(QString const &)' /tmp/ccKGFVhw.o(.text+0x1e): In function `main': [...] : undefined reference to `QString::makeSharedNull(void)' collect2: ld returned 1 exit status configure:22276: $? = 1 configure: failed program was: #include "confdefs.h" #include <qglobal.h> #include <qapplication.h> #include <qcursor.h> #include <qstylefactory.h> #include <private/qucomextra_p.h> #if ! (QT_VERSION >= 0x030100) #error 1 #endif int main() { (void)QStyleFactory::create(QString::null); QCursor c(Qt::WhatsThisCursor); return 0; } Looks to me like a library is missing... (lib qt-mt, per the configure message, perhaps?). But I have: (100) kmail $ dpkg -l |grep qt ii libqt2 2.3.2-5 Qt GUI Library (runtime version) ii libqt2-mt 2.3.2-12 Qt GUI Library (runtime threaded version) rc libqt3 3.1.1+cvs.2002 Qt GUI Library (runtime files) ii libqt3-headers 3.1.1-7 Qt3 header files rc libqt3-mt 3.1.1+cvs.2002 Qt GUI Library (Threaded runtime version) ii libqt3-mt-dev 3.1.1-7 Qt development files (Threaded) ii libqt3c102 3.1.1-7 Qt Library ii libqt3c102-mt 3.1.1-7 Qt GUI Library (Threaded runtime version) ii qt2-dev-tools 2.3.2-12 Qt2 development tools ii qt3-dev-tools 3.1.1-7 Qt3 development tools (0) kmail $ Any ideas where to look? Maybe I'm missing something obvious? /db
https://lists.debian.org/debian-kde/2003/05/msg00023.html
CC-MAIN-2015-40
refinedweb
513
62.14
The QGraphicsItemGroup class provides a container that treats a group of items as a single item. More... #include <QGraphicsItemGroup> Inherits QGraphicsItem. This class was introduced in Qt 4.2. The QGraphicsItemGroup class provides a container that treats a group of items as a single item. A QGraphicsItemGroup is a special type of compound item that treats itself and all its children as one item (i.e., all events and geometries for all children are merged together). It's common to use item groups in presentation tools, when the user wants to group several smaller items into one big item in order to simplify moving and copying of items. If all you want is to store items inside other items, you can use any QGraphicsItem directly by passing a suitable parent to setParentItem(). The boundingRect() function of QGraphicsItemGroup returns the bounding rectangle of all items in the item group. QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on its children (i.e., with respect to the geometry of the group item, the children are treated as if they were transformable). There are two ways to construct an item group. The easiest and most common approach is to pass a list of items (e.g., all selected items) to QGraphicsScene::createItemGroup(), which returns a new QGraphicsItemGroup item. The other approach is to manually construct a QGraphicsItemGroup item, add it to the scene calling QGraphicsScene::addItem(), and then add items to the group manually, one at a time by calling addToGroup(). To dismantle ("ungroup") an item group, you can either call QGraphicsScene::destroyItemGroup(), or you can manually remove all items from the group by calling removeFromGroup(). // Group all selected items together QGraphicsItemGroup *group = scene->createItemGroup(scene->selecteditems()); // Destroy the group, and delete the group item scene->destroyItemGroup(group); The operation of adding and removing items preserves the items' scene-relative position and transformation, as opposed to calling setParentItem(), where only the child item's parent-relative position and transformation are kept. The addtoGroup() function reparents the target item to this item group, keeping the item's position and transformation intact relative to the scene. Visually, this means that items added via addToGroup() will remain completely unchanged as a result of this operation, regardless of the item or the group's current position or transformation; although the item's position and matrix are likely to change. The removeFromGroup() function has similar semantics to setParentItem(); it reparents the item to the parent item of the item group. As with addToGroup(), the item's scene-relative position and transformation remain intact. See also QGraphicsItem(). Removes the specified item from this group. The item will be reparented to this group's parent item, or to 0 if this group has no parent. Its position and transformation relative to the scene will stay intact. See also addToGroup() and QGraphicsScene::destroyItemGroup(). Reimplemented from QGraphicsItem::type().
http://doc.trolltech.com/4.7.1/qgraphicsitemgroup.html
crawl-003
refinedweb
473
54.63
Data Abstraction is showing essential information to the user but hiding the background details. In this article we would be understanding Data Abstraction in C++. Following pointers will be covered in this article, So let us get started with this article, Abstraction In C++ Consider an example A person uses a mobile phone unless he is from an IT or ECE background he does not know anything other then what buttons to press. This is a proper example of Data Abstraction. There are two ways of implementing Data Abstraction in C++: Abstraction Using Classes In classes, we use access specifiers to bring about data abstraction. Abstraction using header files We use a different function from different header files, but we do not know any of the implementation details. Let us move on with this abstraction in C++ article Abstraction Using Specifiers We can implement Abstraction by using access specifiers. They give the programmer the control on what data or functions are to be made visible to the user and what is kept a secret. There are three main access specifiers, Private: Abstraction In C++: When data member or member functions are made private, it can only be accessed inside the class and no one outside the class can access it. Public: Abstraction In C++: When data member or member functions are made public, it can be accessed by everyone. Protected: Abstraction In C++: Protected Access Specifier is a special kind of access specifier. When data member or member functions are made protected, it works similarly to private and it can be accessed to members of the class. Let us move on with this abstraction in C++ article Types Of Abstraction There are 2 types of abstraction, Data Abstraction Hiding the details about the data is called data abstraction. Control Abstraction Hiding the details about the implementation is called control abstraction. Advantages Of Abstraction Only you can make changes to your data or function and no one else can. Makes the application secure by not allowing anyone else to see the background details. Increases reusability of the code. Avoids duplication of your code. Let us move on with this abstraction in C++ article Sample Code #include<iostream> using namespace std; class test { private: int x; public: test(int a) { x =a; } int get() { return x; } }; int main() { test a(7); cout<<"The Number is: "<<a.get(); return 0; } Output data-src= alt width=1485 height=1001 With this we come to the end of this article on ‘Abstraction.
https://www.edureka.co/blog/data-abstraction-in-cpp/
CC-MAIN-2019-35
refinedweb
417
50.67
The move command is used to change the positions of geometric objects. The default behaviour, when no objects or flags are passed, is to do a absolute move on each currently selected object in the world space. The value of the coordinates are interpreted as being defined in the current linear unit unless the unit is explicitly mentioned. When using -objectSpace there are two ways to use this command. If numbers are typed without units then the internal values of the object are set to these values. If, on the other hand a unit is specified then the internal value is set to the equivalent internal value that represents that world-space distance. The -localSpace flag moves the object in its parent space. In this space the x,y,z values correspond directly to the tx, ty, tz channels on the object. The -rotatePivotRelative/-scalePivotRelative flags can be used with the -absolute flag to translate an object so that its pivot point ends up at the given absolute position. These flags will be ignored if components are specified. The -worldSpaceDistance flag is a modifier flag that may be used in conjunction with the -objectSpace/-localSpace flags. When this flag is specified the command treats the x,y,z values as world space units so the object will move the specified world space distance but it will move along the axis specified by the -objectSpace/-localSpace flag. The default behaviour, without this flag, is to treat the x,y,z values as units in object space or local space. In other words, the worldspace distance moved will depend on the transformations applied to the object unless this flag is specified. allows any iterable object to be passed as first argument: move("pSphere1", [0,1,2]) NOTE: this command also reorders the argument order to be more intuitive, with the object first Derived from mel command maya.cmds.move Example: import pymel.core as pm pm.polySphere() # Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] # pm.move( 1, 1, 1 ) pm.move( 5, y=True ) pm.move( '1in', '1in', '1in', relative=True, objectSpace=True, worldSpaceDistance=True ) pm.move( 0, 0, 0, 'pSphere1', absolute=True )
http://www.luma-pictures.com/tools/pymel/docs/1.0/generated/functions/pymel.core.general/pymel.core.general.move.html#pymel.core.general.move
crawl-003
refinedweb
363
64.71
This code does not compile with the latest C# compiler: public class Program { public static void Main() { IntEnum a = (IntEnum)-1; } } public enum IntEnum : int { } (3,22,3,29): Error CS0119: 'IntEnum' is a type, which is not valid in the given context 4 int.MinValue (IntEnum)(-1) Behavior is expected and documented to allow expressions like (Var)-1 to be parsed. Compiler Error CS0075 goes into spec details (I would expect you to get that error instead/in addition to CS0119): To cast a negative value, you must enclose the value in parentheses If you are casting using a keyword that identifies a predefined type, then you do not need parentheses. Otherwise, you must put the parentheses because (x) –y will not be considered a cast expression. From the C# Specification, Section 7.6.6: From the disambiguation rule it follows that, if x and y are identifiers, (x)y, (x)(y), and (x)(-y) are cast-expressions, but (x)-y is not, even if x identifies a type. However, if x is a keyword that identifies a predefined type (such as int), then all four forms are cast-expressions (because such a keyword could not possibly be an expression by itself).
https://codedump.io/share/Zst54SOh9Tx1/1/why-isn39t-the-c-compiler-able-to-cast-a-literal-negative-value-to-an-enum
CC-MAIN-2017-43
refinedweb
203
52.83
(For more resources related to this topic, see here.) Since it is community-driven, everyone is in an equal position to spot bugs, provide fixes, or add new features to the framework. This has led to the creation of features such as the new temporal ORM (Object Relation Mapper), which is a first for any PHP-based ORM. This also means that everyone can help build tools that make development easier, more straightforward, and quicker. The framework is lightweight and allows developers to load only what they need. It's a configuration over convention approach. Instead of enforcing conventions, they act as recommendations and best practices. This allows new developers to jump onto a project and catch up to speed quicker. It also helps when we want to find extra team members for projects. A brief history of FuelPHP FuelPHP started out with the goal of adopting the best practices from other frameworks to form a thoroughly modern starting point, which makes full use of PHP Version 5.3 features, such as namespaces. It has little in the way of legacy and compatibility issues that can affect older frameworks. The framework was started in the year 2010 by Dan Horrigan. He was joined by Phil Sturgeon, Jelmer Schreuder, Harro Verton, and Frank de Jonge. FuelPHP was a break from other frameworks such as CodeIgniter, which was basically still a PHP 4 framework. This break allowed for the creation of a more modern framework for PHP 5.3, and brings together decades of experience of other languages and frameworks, such as Ruby on Rails and Kohana. After a period of community development and testing, Version 1.0 of the FuelPHP framework was released in July 2011. This marked a version ready for use on production sites and the start of the growth of the community. The community provides periodic releases (at the time of writing, it is up to Version 1.7) with a clear roadmap () of features to be added. This also includes a good guide of progress made to date. The development of FuelPHP is an open process and all the code is hosted on GitHub at, and the main core packages can be found in other repositories on the Fuel GitHub account—a full list of these can be found at. Features of FuelPHP Using a Bespoke PHP or a custom-developed framework could give you a greater performance. FuelPHP provides many features, documentation, and a great community. The following sections describe some of the most useful features. (H)MVC Although FuelPHP is a Model-View-Controller (MVC) framework, it was built to support the HMVC variant of MVC. Hierarchical Model-View-Controller (HMVC) is a way of separating logic and then reusing the controller logic in multiple places. This means that when a web page is generated using a theme or a template section, it can be split into multiple sections or widgets. Using this approach, it is possible to reuse components or functionality throughout a project or in multiple projects. In addition to the usual MVC structure, FuelPHP allows the use of presentation modules (ViewModels). These are a powerful layer that sits between the controller and the views, allowing for a smaller controller while still separating the view logic from both the controller and the views. If this isn't enough, FuelPHP also supports a router-based approach where you can directly route to a closure. This then deals with the execution of the input URI. Modular and extendable The core of FuelPHP has been designed so that it can be extended without the need for changing any code in the core. It introduces the notion of packages, which are self-contained functionality that can be shared between projects and people. Like the core, in the new versions of FuelPHP, these can be installed via the Composer tool . Just like packages, functionality can also be divided into modules. For example, a full user-authentication module can be created to handle user actions, such as registration. Modules can include both logic and views, and they can be shared between projects. The main difference between packages and modules is that packages can be extensions of the core functionality and they are not routable, while modules are routable. Security Everyone wants their applications to be as secure as possible; to this end, FuelPHP handles some of the basics for you. Views in FuelPHP will encode all the output to ensure that it's secure and is capable of avoiding Cross-site scripting (XSS) attacks. This behavior can be overridden or can be cleaned by the included htmLawed library. The framework also supports Cross-site request forgery (CSRF) prevention with tokens, input filtering, and the query builder, which tries to help in preventing SQL injection attacks. PHPSecLib is used to offer some of the security features in the framework. Oil – the power of the command line If you are familiar with CakePHP or the Zend framework or Ruby on Rails, then you will be comfortable with FuelPHP Oil. It is the command-line utility at the heart of FuelPHP—designed to speed up development and efficiency. It also helps with testing and debugging. Although not essential, it proves indispensable during development. Oil provides a quick way for code generation, scaffolding, running database migrations, debugging, and cron-like tasks for background operations. It can also be used for custom tasks and background processes. Oil is a package and can be found at. ORM FuelPHP also comes with an Object Relation Mapper (ORM) package that helps in working with various databases through an object-oriented approach. It is relatively lightweight and is not supposed to replace the more complex ORMs such as Doctrine or Propel. The ORM also supports data relations such as: - belongs-to - has-one - has-many - many-to-many relationships Another nice feature is cascading deletions; in this case, the ORM will delete all the data associated with a single entry. The ORM package is available separately from FuelPHP and is hosted on GitHub at. Base controller classes and model classes FuelPHP includes several classes to give a head start on projects. These include controllers that help with templates, one for constructing RESTful APIs, and another that combines both templates and RESTful APIs. On the model side, base classes include CRUD (Create, Read, Update, and Delete) operations. There is a model for soft deletion of records, one for nested sets, and lastly a temporal model. This is an easy way of keeping revisions of data. The authentication package The authentication framework gives a good basis for user authentication and login functionality. It can be extended using drivers for new authentication methods. Some of the basics such as groups, basic ACL functions, and password hashing can be handled directly in the authentication framework. Although the authentication package is included when installing FuelPHP, it can be upgraded separately to the rest of the application. The code can be obtained from. Template parsers The parser package makes it even easier to separate logic from views instead of embedding basic PHP into the views. FuelPHP supports many template languages, such as Twig, Markdown, Smarty, and HTML Abstraction Markup Language (Haml). Documentation Although not particularly a feature of the actual framework, the documentation for FuelPHP is one of the best available. It is kept up-to-date for each release and can be found at. What to look forward to in Version 2.0 Although this book focuses on FuelPHP 1.6 and newer, it is worth looking forward to the next major release of the framework. It brings significant improvements but also makes some changes to the way the framework functions. Global scope and moving to dependency injection One of the nice features of FuelPHP is the global scope that allows easy static syntax and instances when needed. One of the biggest changes in Version 2 is the move away from static syntax and instances. The framework used the Multiton design pattern, rather than the Singleton design pattern. Now, the majority of Multitons will be replaced with the Dependency Injection Container (DiC) design pattern , but this depends on the class in question. The reason for the changes is to allow the unit testing of core files and to dynamically swap and/or extend our other classes depending upon the needs of the application. The move to dependency injection will allow all the core functionality to be tested in isolation. Before detailing the next feature, let's run through the design patterns in more detail. Singleton Ensures that a class only has a single instance and it provides a global point of access to it. The thinking is that a single instance of a class or object can be more efficient, but it can add unnecessary restrictions to classes that may be better served using a different design pattern. Multiton This is similar to the singleton pattern but expands upon it to include a way of managing a map of named instances as key-value pairs. So instead of having a single instance of a class or object, this design pattern ensures that there is a single instance for each key-value pair. Often the multiton is known as a registry of singletons. Dependency injection container This design pattern aims to remove hard coded dependencies and make is possible to change them either at run time or compile time. One example is ensure that variables have default values but also allow for them to be overridden, also allow for other objects to be passed to class for manipulation. It allows for mock objects to be used whilst testing functionality. Coding standards One of the far-reaching changes will be the difference in coding standards. FuelPHP Version 2.0 will now conform to both PSR-0 and PSR-1. This allows a more standard auto-loading mechanism and the ability to use Composer. Although Composer compatibility was introduced in Version 1.5, this move to PSR is for better consistency. It means that the method names will follow the "camelCase" method rather than the current "snake_case" method names. Although a simple change, this is likely to have a large effect on existing projects and APIs. With a similar move of other PHP frameworks to a more standardized coding standard, there will be more opportunities to re-use functionality from other frameworks. Package management and modularization Package management for other languages such as Ruby and Ruby on Rails has made sharing pieces of code and functionality easy and common-place. The PHP world is much larger and this same sharing of functionality is not as common. PHP Extension and Application Repository (PEAR) was a precursor of most package managers. It is a framework and distribution system for re-usable PHP components. Although infinitely useful, it is not as widely supported by the more popular PHP frameworks. Starting with FuelPHP 1.6 and leading into FuelPHP 2.0, dependency management will be possible through Composer (). This deals with not only single packages, but also their dependencies. It allows projects to consistently set up with known versions of libraries required by each project. This helps not only with development, but also its testability of the project as well as its maintainability. It also protests against API changes. The core of FuelPHP and other modules will be installed via Composer and there will be a gradual migration of some Version 1 packages. Backwards compatibility A legacy package will be released for FuelPHP that will provide aliases for the changed function names as part of the change in the coding standards. It will also allow the current use of static function calling to continue working, while allowing for a better ability to unit test the core functionality. Speed boosts Although initially slower during the initial alpha phases, Version 2.0 is shaping up to be faster than Version 1.0. Currently, the beta version (at the time of writing) is 7 percent faster while requiring 8 percent less memory. This might not sound much, but it can equate to a large saving if running a large website over multiple servers. These figures may get better in the final release of Version 2.0 after the remaining optimizations are complete. Summary We now know a little more about the history of FuelPHP and some of the useful features such as ORM, authentication, modules, (H)MVC, and Oil (the command-line interface). We have also listed the following useful links, including the official API documentation () and the FuelPHP home page (). This article also touched upon some of the new features and changes due in Version 2.0 of FuelPHP. Resources for Article: Further resources on this subject: - Installing PHP-Nuke [Article] - Installing phpMyAdmin [Article] - Integrating phpList 2 with Drupal [Article]
https://www.packtpub.com/books/content/fuelphp
CC-MAIN-2015-27
refinedweb
2,128
54.83
#include <ggi/internal/triple-int.h> unsigned *add_3(unsigned l[3], unsigned r[3]); unsigned *sub_3(unsigned l[3], unsigned r[3]); unsigned *mul_3(unsigned l[3], unsigned r[3]); unsigned *divmod_3(unsigned a[3], unsigned b[3], unsigned q[3], unsigned r[3]); sub_3 subtracts r from l. Equivalent to l-=r. mul_3 multiplies r with l. Equivalent to l*=r. divmod_3 calculates the quotient q and the remainder r of a/b such that a = q * b + r. Equivalent to r=a%b,q=a/b. Multiplication and division needs to operate on limbs to perform long multiplication and division. If a type with twice the precision of an unsigned is found (typically the long long type), unsigned is used as the limb. If not, half the bits of an unsigned are used as the limb. The division algorithm is probably similar to the algorithm described by Donald E. Knuth in "The Art of Computer Programming", volume 2, but the author of the code has not actually read that book, only a short description of the algorithm. The degree of similarity is therefore uncertain. divmod_3 returns a pointer to the quotient q. unsigned x[3], y[3], q[3], r[3]; assign_int_3(x, 4); assign_int_3(y, 5); add_3(x, y); /* x == 9 */ assign_int_3(q, 3); sub_3(x, q); /* x == 6 */ mul_3(x, q); /* x == 18 */ divmod_3(x, y, q, r); /* q == 3, r == 3 */
http://www.makelinux.net/man/3/G/ggidev-sub_3
CC-MAIN-2014-10
refinedweb
236
57.06
Hi, I have programs running for years on previous Arduino versions (1.8.13 and earlier). I installed now the current 1.8.16 and get several errors on compilation: Repeating tens times on similar lines: c:\program files (x86)\arduino-1-8-16\hardware\tools\avr\avr\include\stdlib.h:300:21: error: 'size_t' was not declared in this scope extern void *malloc(size_t __size) ATTR_MALLOC;" Another error that repeats itself for each print and println command: error: 'class HardwareSerial' has no member named 'print'; did you mean 'Print'? and: error: 'class HardwareSerial' has no member named 'println'; did you mean 'Print'? (Its certainly with an L, not I, and its shown in red, recognized as command. The Serial has been initialized: Serial.begin(115200);). the libraries I use (same as for 1.8.13): #include <Arduino.h> #include <EEPROM.h> #include <RTClib.h> #include <ModbusMaster.h> My guess is that the version is missing a header file, but this is for experts. Please help.
https://forum.arduino.cc/t/new-installed-verion-1-8-16-problems/921700
CC-MAIN-2021-49
refinedweb
166
61.43
If you don’t break out of a switch statement, you get fall-through. For instance, if the value of verse is 3, the following code prints all three lines — Last refrain, He’s a pain, and Has no brain. switch (verse) { case 3: out.print(“Last refrain, “); out.println(“last refrain,”); case 2: out.print(“He’s a pain, “); out.println(“he’s a pain,”); case 1: out.print(“Has no brain, “); out.println(“has no brain,”); } Comparing values with a double equal sign When you compare two values with one another, you use a double equal sign. The line if (inputNumber == randomNumber) is correct, but the line if (inputNumber = randomNumber) is not correct. Adding components to a GUI Here’s a constructor for a Java frame: public SimpleFrame() { JButton button = new JButton(“Thank you…”); setTitle(“…Katie Feltman and Heidi Unger”); setLayout(new FlowLayout()); add(button); button.addActionListener(this); setSize(300, 100); setVisible(true); } Whatever you do, don’t forget the call to the add method. Without this call, you go to all the work of creating a button, but the button doesn’t show up on your frame. In real-life Java programming, you see that exception all the time. A NullPointerException comes about when you call a method that’s supposed to return an object, but instead the method returns nothing. Here’s a cheap example: import static java.lang.System.out; import java.io.File; class ListMyFiles { public static void main(String args[]) { File myFile = new File(“\windows”); String dir[] = myFile.list(); for (String fileName : dir) { out.println(fileName); } } } This program displays a list of all the files in the windows directory. But what happens if you change \windows to something else — something that doesn’t represent the name of a directory? File myFile = new File(“#*%$!!”); Then the new File call returns null (a special Java word meaning nothing), so the variable myFile has nothing in it. Later in the code, the variable dir refers to nothing, and the attempt to loop through all the dir values fails miserably. You get a big NullPointerException, and the program comes crashing down around you. To avoid this kind of calamity, check Java’s API documentation. If you’re calling a method that can return null, add exception-handling code to your program. Helping Java find its files You’re compiling Java code, minding your own business, when the computer gives you a NoClassDefFoundError. All kinds of things can be going wrong, but chances are that the computer can’t find a particular Java file. To fix this, you must align all the planets correctly. - Your project directory has to contain all the Java files whose names are used in your code. - If you use named packages, your project directory has to have appropriately named subdirectories. - Your CLASSPATH must be set properly.
https://www.dummies.com/programming/java/avoiding-mistakes-in-java/
CC-MAIN-2019-13
refinedweb
473
66.84
Dear lispers, I am working on a separate manual for people who want to use ECLS as embedded language or who want to write C extensions to the ECLS environment. The first pages have been both uploaded to the web page and submitted to CVS. The manual, right now, covers the inner representation of lisp objects in general, plus sections about fixnums, characters, arrays and strings. The docs somehow resemble my idea of what the interface to C should look like. You may notice some changes in the names of macros, types and functions with respect to ECoLisp and to previous versions of ECLS. I would like to hear your opinion about this. I first thought about creating a separate namespace for ecls by prepending every function with the "cl_" prefix. Right now I feel the ecls library is too large for this to be worth and I am considering to minimize the changes. I also thought about creating macros and functions for hiding the details about the inner representation of nonimmediate objects. I now feel it is not worth creating a hundred of these functions, and that having a cl_object which is a pointer to a union is a good thing. Just my 0.02$. If I do not receive enough feedback, I will proceed with the development on my own, but I feel it would be better to have some constructive discussion in this community (whose size I still ignore). TIA Juanjo -- que pasó juanjo, hello ecls list. I've been watching ecls from the sidelines for a while now, so I'm not sure if I count as part of the community or not, nor have I read the new C manual, but I must say I'm very impressed with the pace of development and hopeful about the future. In classic free software freeloader style, I do have an opinion about the way Juan should spend his time. If a goal for this project is more users, I would suggest getting the threads implementation working. As is well known, no free Common Lisp implementation has preemptive threads, which rules out common lisp for a variety of internet applications. This is a need felt by many, and various incomplete initiatives exist (barlow's work on sbcl, cohen's on clisp). From what I gather though, ecls is pretty close to a working threads implementation, although I have seen references to "the bug" in the source code scattered around #Ifdef THREAD directives. my $0.02 Ok make it $0.04. Another tactic I would suggest is focusing the ANSI compatibility efforts on getting existing free systems (especially reusable libraries) to work under ecls. My selfish first choices are uncommonsql and imho, and actually i am considering doing one or both of the ports myself as a way to get the hang of ecls. does anybody else have ideas as to what systems could be ported to good "visibility effect?" Also, does ecls work with ilisp? -Lyn
http://sourceforge.net/mailarchive/forum.php?forum_name=ecls-list&max_rows=25&style=nested&viewmonth=200110&viewday=11
CC-MAIN-2013-48
refinedweb
498
67.69
by lihengming Java Version: V1.3 License: No License by lihengming Java Version: V1.3 License: No License Download this library from Support Quality Security License Reuse kandi has reviewed spring-boot-api-project-seed and discovered the below as its top functions. This is intended to give you an instant insight into spring-boot-api-project-seed implemented functionality, and help decide if they suit your requirements. ~ No Code Snippets are available at this moment for spring-boot-api-project-seed. QUESTION How to redirect in React Router v6?Asked 2022-Mar-24 at 17:22 I am trying to upgrade to React Router v6 ( react-router-dom 6.0.1). Here is my updated code: import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; <BrowserRouter> <Routes> <Route path="/" element={<Home />} /> <Route path="/lab" element={<Lab />} /> <Route render={() => <Navigate to="/" />} /> </Routes> </BrowserRouter> The last Route is redirecting the rest of paths to /. However, I got an error TS2322: Type '{ render: () => Element; }' is not assignable to type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'. Property 'render' does not exist on type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'. However, based on the doc, it does have render for Route. How to use it correctly? ANSWERAnswered 2022-Mar-18 at 18:41 I think you should use the no match route approach. Check this in the documentation. import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; <BrowserRouter> <Routes> <Route path="/" element={<Home />} /> <Route path="/lab" element={<Lab />} /> <Route path="*" element={<Navigate to="/" replace />} /> </Routes> </BrowserRouter> To keep the history clean, you should set replace prop. This will avoid extra redirects after the user click back. Thanks @Paul for this tip. Source QUESTION Is every "complete" object a "most-derived" object?Asked 2022-Mar-21 at 02:30 Per [intro.object]/2: [..] An object that is not a subobject of any other object is called a complete object [..]. So consider this snippet of code: struct Base {}; struct Derived : Base {}; struct MostDerived : Derived {}; I can't understand the wording in this quote from the standard: If a complete object, a member subobject, or an array element is of class type, its type is considered the most derived class [..] An object of a most derived class type or of a non-class type is called a most derived object. From the quote what I understand is that a type of a complete object is of "most-derived" class type. I stopped here, I really do not understand the rest of the wording. Per the question "What does the "most derived object" mean?" I think that (correct me if I am wrong), objects of type "most-derived" class only, like MostDerived, are called "most-derived" objects. Is this true? If I have created an object of Base like this: Base b_obj = Base(), is the object b_obj a "most-derived" object? If I have created an object of Derived like this: Derived d_obj = Derived(), is the object d_obj also a "most-derived" object? Does the word "derived" in "most-derived" mean that the object is an object of a class like MostDerived, or mean that the object has no class subobject in it? ANSWERAnswered 2022-Mar-21 at 00:32 void foo() { int i = 0; // complete object, but not most-derived (not class type) } class A { int i = 0; // non complete object, not most-derived } void bar() { A a; // complete object, but not derived, so can't be "most derived" } class B : A { } void biz() { B b; // complete object, derived object, and most-derived object } Is every "complete" object is "most-derived" object No. A most-derived object is an object of a most-derived class, and a most-derived class must be of a class type. Objects may be of class type, but non-class type objects also exist. So if I have created an object of Base like this: Base b_obj = Base(), Is the object b_objis "most-derived" object? Yes. The most-derived object of b_obj is an object of type Base. This is not necessarily a complete object, however, since this could be a class member definition. Again, complete is not synonymous with most-derived. Also if I have created an object of Derived like this: Derived d_obj = Derived(), Is the object d_objis also a "most-derived" object? Yes. The most-derived object of d_obj is an object of type Derived. If you have an object created as type MostDerived: MostDerived md; MostDerived Derived Base MostDerived Derived, which is neither a complete object nor a most-derived object Derivedhas a subobject of type Base, which is neither a complete object nor a most-derived object. Source QUESTION Filter out everything before a condition is met, keep all elements afterAsked 2022-Feb-23 at 21:32 I was wondering if there was an easy solution to the the following problem. The problem here is that I want to keep every element occurring inside this list after the initial condition is true. The condition here being that I want to remove everything before the condition that a value is greater than 18 is true, but keep everything after. Example Input: p = [4,9,10,4,20,13,29,3,39] Expected output: p = [20,13,29,3,39] I know that you can filter over the entire list through [x for x in p if x>18] But I want to stop this operation once the first value above 18 is found, and then include the rest of the values regardless if they satisfy the condition or not. It seems like an easy problem but I haven't found the solution to it yet. ANSWERAnswered 2022-Feb-05 at 19:59 You can use itertools.dropwhile: from itertools import dropwhile p = [4,9,10,4,20,13,29,3,39] p = dropwhile(lambda x: x <= 18, p) print(*p) # 20 13 29 3 39 In my opinion, this is arguably the easiest-to-read version. This also corresponds to a common pattern in other functional programming languages, such as dropWhile (<=18) p in Haskell and p.dropWhile(_ <= 18) in Scala. Alternatively, using walrus operator (only available in python 3.8+): exceeded = False p = [x for x in p if (exceeded := exceeded or x > 18)] print(p) # [20, 13, 29, 3, 39] But my guess is that some people don't like this style. In that case, one can do an explicit for loop (ilkkachu's suggestion): for i, x in enumerate(p): if x > 18: output = p[i:] break else: output = [] # alternatively just put output = [] before for Source QUESTION "Configuring the trigger failed, edit and save the pipeline again" with no noticeable error and no further detailsAsked 2022-Feb-16 at 10:33 I have run in to an odd problem after converting a bunch of my YAML pipelines to use templates for holding job logic as well as for defining my pipeline variables. The pipelines run perfectly fine, however I get a "Some recent issues detected related to pipeline trigger." warning at the top of the pipeline summary page and viewing details only states: "Configuring the trigger failed, edit and save the pipeline again." The odd part here is that the pipeline works completely fine, including triggers. Nothing is broken and no further details are given about the supposed issue. I currently have YAML triggers overridden for the pipeline, but I did also define the same trigger in the YAML to see if that would help (it did not). I'm looking for any ideas on what might be causing this or how I might be able to further troubleshoot it given the complete lack of detail that the error/warning provides. It's causing a lot of confusion among developers who think there might be a problem with their builds as a result of the warning. Here is the main pipeline. the build repository is a shared repository for holding code that is used across multiple repos in the build system. dev.yaml contains dev environment specific variable values. Shared holds conditionally set variables based on the branch the pipeline is running on. name: ProductName_$(BranchNameLower)_dev_$(MajorVersion)_$(MinorVersion)_$(BuildVersion)_$(Build.BuildId) resources: repositories: - repository: self - repository: build type: git name: Build ref: master # This trigger isn't used yet, but we want it defined for later. trigger: batch: true branches: include: - 'dev' variables: - template: YAML/variables/shared.yaml@build - template: YAML/variables/dev.yaml@build jobs: - template: ProductNameDevJob.yaml parameters: pipelinePool: ${{ variables.PipelinePool }} validRef: ${{ variables.ValidRef }} Then this is the start of the actual job yaml. It provides a reusable definition of the job that can be used in more than one over-arching pipeline: parameters: - name: dependsOn type: object default: {} - name: pipelinePool default: '' - name: validRef default: '' - name: noCI type: boolean default: false - name: updateBeforeRun type: boolean default: false jobs: - job: Build_ProductName displayName: 'Build ProductName' pool: name: ${{ parameters.pipelinePool }} demands: - msbuild - visualstudio dependsOn: - ${{ each dependsOnThis in parameters.dependsOn }}: - ${{ dependsOnThis }} condition: and(succeeded(), eq(variables['Build.SourceBranch'], variables['ValidRef'])) steps: **step logic here Finally, we have the variable YAML which conditionally sets pipeline variables based on what we are building: variables: - ${{ if or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['Build.SourceBranch'], 'refs/heads/users/ahenderson/azure_devops_build')) }}: - name: BranchName value: Dev ** Continue with rest of pipeline variables and settings of each value for each different context. ANSWERAnswered 2021-Aug-17 at 14:58 I think I may have figured out the problem. It appears that this is related to the use of conditionals in the variable setup. While the variables will be set in any valid trigger configuration, it appears that the proper values are not used during validation and that may have been causing the problem. Switching my conditional variables to first set a default value and then replace the value conditionally seems to have fixed the problem. It would be nice if Microsoft would give a more useful error message here, something to the extent of the values not being found for a given variable, but adding defaults does seem to have fixed the problem. Source QUESTION Multiple labels per item on Kendo chartAsked 2022-Jan-02 at 21:14 I'm trying to get multiple label per item on Kendo Column chart Desired layout looks like this I was able to get only this layout import { Component } from '@angular/core'; import { groupBy, GroupResult } from '@progress/kendo-data-query'; import { ValueAxisLabels } from '@progress/kendo-angular-charts'; export type TrendItem = { clientName: string; periodName: string; income: number; }; @Component({ selector: 'my-app', template: ` <kendo-chart> <kendo-chart-category-axis> <kendo-chart-category-axis-item [categories]="categories"> </kendo-chart-category-axis-item> </kendo-chart-category-axis> <kendo-chart-value-axis> <kendo-chart-value-axis-item [labels]="valueAxisLabels"> </kendo-chart-value-axis-item> </kendo-chart-value-axis> <kendo-chart-series> <kendo-chart-series-item * <kendo-chart-series-item-labels [content]="labelVisual"> </kendo-chart-series-item-labels> </kendo-chart-series-item> </kendo-chart-series> </kendo-chart> `, }) export class AppComponent { public valueAxisLabels: ValueAxisLabels = { font: 'bold 16px Arial, sans-serif', }; public trendItems: TrendItem[] = [ { clientName: 'Client1', periodName: 'Q1 2020', income: 20, }, { clientName: 'Client1', periodName: 'Q2 2020', income: 15, }, { clientName: 'Client1', periodName: 'Q3 2020', income: 35, }, { clientName: 'Client1', periodName: 'Q4 2020', income: 40, }, { clientName: 'Client2', periodName: 'Q1 2020', income: 15, }, { clientName: 'Client2', periodName: 'Q2 2020', income: 20, }, { clientName: 'Client2', periodName: 'Q3 2020', income: 15, }, { clientName: 'Client2', periodName: 'Q4 2020', income: 30, } ]; public categories = (groupBy(this.trendItems, [{ field: 'clientName' }]) as GroupResult[]) .map((e) => e.value); public groupedTrendsByPeriod = groupBy(this.trendItems, [{ field: 'periodName' }]) as GroupResult[]; public labelVisual(e: { dataItem: TrendItem }) { return `$${e.dataItem.income}\r\n${e.dataItem.periodName}`; } } You can try this code here. My current result look like this So my question is how to display multiple labels per item like on the first picture? My current obstacles. <kendo-chart-series-item-labels>elements. Only one will be rendered, rest will be ignored. ANSWERAnswered 2022-Jan-02 at 08:18 Source QUESTION Python 3.10 pattern matching (PEP 634) - wildcard in stringAsked 2021-Dec-17 at 10:43 I got a large list of JSON objects that I want to parse depending on the start of one of the keys, and just wildcard the rest. A lot of the keys are similar, like "matchme-foo" and "matchme-bar". There is a builtin wildcard, but it is only used for whole values, kinda like an else. I might be overlooking something but I can't find a solution anywhere in the proposal: Also a bit more about it in PEP-636: My data looks like this: data = [{ "id" : "matchme-foo", "message": "hallo this is a message", },{ "id" : "matchme-bar", "message": "goodbye", },{ "id" : "anotherid", "message": "completely diffrent event" }, ...] I want to do something that can match the id without having to make a long list of |'s. Something like this: for event in data: match event: case {'id':'matchme-*'}: # Match all 'matchme-' no matter what comes next log.INFO(event['message']) case {'id':'anotherid'}: log.ERROR(event['message']) It's a relatively new addition to Python so there aren't many guides on how to use it yet. ANSWERAnswered 2021-Dec-17 at 10:43 You can use a guard: for event in data: match event: case {'id': x} if x.startswith("matchme"): # guard print(event["message"]) case {'id':'anotherid'}: print(event["message"]) Quoting from the official documentation, Guard We can add an ifclause to a pattern, known as a “guard”. If the guard is false, match goes on to try the next caseblock. Note that value capture happens before the guard is evaluated: match point: case Point(x, y) if x == y: print(f"The point is located on the diagonal Y=X at {x}.") case Point(x, y): print(f"Point is not on the diagonal.") Source QUESTION Redirect in react-router-dom V6Asked 2021-Dec-15 at 05:41 I need to navigate back to the original requested URL after login. For example, user enters as user is not authenticated, it will navigate to login page. Once authenticated, it should navigate back to automatically. My original approach with react-router-dom v5 is quite simple: const PrivateRoute = ({ isLoggedIn, component: Component, ...rest }) => { return ( <Route {...rest} render={(props) => isLoggedIn? ( <Component {...props} /> ) : ( <Redirect to={{ pathname: `/login/${props.location.search}`, state: { from: props.location } }} /> ) } /> ); }; <PrivateRoute exact isLoggedIn={isLoggedIn} path="/settings" component={Settings} /> Can some one tell me how to do that in v6? Thanks in advance ANSWERAnswered 2021-Dec-15 at 05:41 In react-router-dom v6 rendering routes and handling redirects is quite different than in v5. Gone are custom route components, they are replaced with a wrapper component pattern. v5 - Custom Route Takes props and conditionally renders a Route component with the route props passed through or a Redirect component with route state holding the current location. const CustomRoute = ({ isLoggedIn, ...props }) => { const location = useLocation(); return isLoggedIn? ( <Route {...props} /> ) : ( <Redirect to={{ pathname: `/login/${location.search}`, state: { location }, }} /> ); }; ... <PrivateRoute exact isLoggedIn={isLoggedIn} path="/settings" component={Settings} /> v6 - Custom Wrapper Takes props and conditionally renders an Outlet component for nested Route components to be rendered into or a Navigate component with route state holding the current location. const CustomWrapper = ({ isLoggedIn, ...props }) => { const location = useLocation(); return isLoggedIn? ( <Outlet /> ) : ( <Navigate to={`/login/${location.search}`} replace state={{ location }} /> ) }; ... <Route path="settings" element={<CustomWrapper isLoggedIn={isLoggedIn} />} > <Route path="settings" element={<Settings />} /> </Route> Source QUESTION Patch request not patching - 403 returned - django rest frameworkAsked 2021-Dec-11 at 07:34 I'm trying to test an API endpoint with a patch request to ensure it works. I'm using APILiveServerTestCase but can't seem to get the permissions required to patch the item. I created one user ( adminuser) who is a superadmin with access to everything and all permissions. My test case looks like this: class FutureVehicleURLTest(APILiveServerTestCase): def setUp(self): # Setup users and some vehicle data we can query against management.call_command("create_users_and_vehicle_data", verbosity=0) self.user = UserFactory() self.admin_user = User.objects.get(username="adminuser") self.future_vehicle = f.FutureVehicleFactory( user=self.user, last_updated_by=self.user, ) self.vehicle = f.VehicleFactory( user=self.user, created_by=self.user, modified_by=self.user, ) self.url = reverse("FutureVehicles-list") self.full_url = self.live_server_url + self.url time = str(datetime.now()) self.form_data = { "signature": "TT", "purchasing": True, "confirmed_at": time, } I've tried this test a number of different ways - all giving the same result (403). I have setup the python debugger in the test, and I have tried actually going to in the browser and logging in manually with any user but the page just refreshes when I click to login and I never get 'logged in' to see the admin. I'm not sure if that's because it doesn't completely work from within a debugger like that or not. My test looks like this (using the Requests library): def test_patch_request_updates_object(self): data_dict = { "signature": "TT", "purchasing": "true", "confirmed_at": datetime.now().strftime("%m/%d/%Y, %H:%M:%S"), } url = self.full_url + str(self.future_vehicle.id) + "/" client = requests.Session() client.auth = HTTPBasicAuth(self.admin_user.username, "test") client.headers.update({"x-test": "true"}) response = client.get(self.live_server_url + "/admin/") csrftoken = response.cookies["csrftoken"] # interact with the api response = client.patch( url, data=json.dumps(data_dict), cookies=response.cookies, headers={ "X-Requested-With": "XMLHttpRequest", "X-CSRFTOKEN": csrftoken, }, ) # RESPONSE GIVES 403 PERMISSION DENIED fte_future_vehicle = FutureVehicle.objects.filter( id=self.future_vehicle.id ).first() # THIS ERRORS WITH '' not equal to 'TT' self.assertEqual(fte_future_vehicle.signature, "TT") I have tried it very similarly to the documentation using APIRequestFactory and forcing authentication: def test_patch_request_updates_object(self): data_dict = { "signature": "TT", "purchasing": "true", "confirmed_at": datetime.now().strftime("%m/%d/%Y, %H:%M:%S"), } url = self.full_url + str(self.future_vehicle.id) + "/" api_req_factory = APIRequestFactory() view = FutureVehicleViewSet.as_view({"patch": "partial_update"}) api_request = api_req_factory.patch( url, json.dumps(data_dict), content_type="application/json" ) force_authenticate(api_request, self.admin_user) response = view(api_request, pk=self.future_assignment.id) fte_future_assignment = FutureVehicle.objects.filter( id=self.future_assignment.id ).first() self.assertEqual(fte_future_assignment.signature, "TT") If I enter the debugger to look at the responses, it's always a 403. The viewset itself is very simple: class FutureVehicleViewSet(ModelViewSet): serializer_class = FutureVehicleSerializer def get_queryset(self): queryset = FutureVehicle.exclude_denied.all() user_id = self.request.query_params.get("user_id", None) if user_id: queryset = queryset.filter(user_id=user_id) return queryset The serializer is just as basic as it gets - it's just the FutureVehicle model and all fields. I just can't figure out why my user won't login - or if maybe I'm doing something wrong in my attempts to patch? I'm pretty new to Django Rest Framework in general, so any guidances is helpful! Edit to add - my DRF Settings look like this: REST_FRAMEWORK = { "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "DATETIME_FORMAT": "%m/%d/%Y - %I:%M:%S %p", "DATE_INPUT_FORMATS": ["%Y-%m-%d"], "DEFAULT_AUTHENTICATION_CLASSES": [ # Enabling this it will require Django Session (Including CSRF) "rest_framework.authentication.SessionAuthentication" ], "DEFAULT_PERMISSION_CLASSES": [ # Globally only allow IsAuthenticated users access to API Endpoints "rest_framework.permissions.IsAuthenticated" ], } I'm certain adminuser is the user we wish to login - if I go into the debugger and check the users, they exist as a user. During creation, any user created has a password set to 'test'. ANSWERAnswered 2021-Dec-11 at 07:34 The test you have written is also testing the Django framework logic (ie: Django admin login). I recommend testing your own functionality, which occurs after login to the Django admin. Django's testing framework offers a helper for logging into the admin, client.login. This allows you to focus on testing your own business logic/not need to maintain internal django authentication business logic tests, which may change release to release. from django.test import TestCase, Client def TestCase(): client.login(username=self.username, password=self.password) However, if you must replicate and manage the business logic of what client.login is doing, here's some of the business logic from Django: def login(self, **credentials): """ Set the Factory to appear as if it has successfully logged into a site. Return True if login is possible or False if the provided credentials are incorrect. """ from django.contrib.auth import authenticate user = authenticate(**credentials) if user: self._login(user) return True return False def force_login(self, user, backend=None): def get_backend(): from django.contrib.auth import load_backend for backend_path in settings.AUTHENTICATION_BACKENDS: backend = load_backend(backend_path) if hasattr(backend, 'get_user'): return backend_path if backend is None: backend = get_backend() user.backend = backend self._login(user, backend) def _login(self, user, backend=None): from django.contrib.auth import login # Create a fake request to store login details. request = HttpRequest() if self.session: request.session = self.session else: engine = import_module(settings.SESSION_ENGINE) request.session = engine.SessionStore() login(request, user, backend) # Save the session values. request.session.save() # Set the cookie to represent the session. session_cookie = settings.SESSION_COOKIE_NAME self.cookies[session_cookie] = request.session.session_key cookie_data = { 'max-age': None, 'path': '/', 'domain': settings.SESSION_COOKIE_DOMAIN, 'secure': settings.SESSION_COOKIE_SECURE or None, 'expires': None, } self.cookies[session_cookie].update(cookie_data) Django client.login: Source QUESTION Haskell: Can I read integers directly into an array?Asked 2021-Dec-05 at 11:40 In this programming problem, the input is an n× m integer matrix. Typically, n≈ 105 and m ≈ 10. The official solution (1606D, Tutorial) is quite imperative: it involves some matrix manipulation, precomputation and aggregation. For fun, I took it as an STUArray implementation exercise. I have managed to implement it using STUArray, but still the program takes way more memory than permitted (256MB). Even when run locally, the maximum resident set size is >400 MB. On profiling, reading from stdin seems to be dominating the memory footprint: Functions readv and readv.readInt, responsible for parsing integers and saving them into a 2D list, are taking around 50-70 MB, as opposed to around 16 MB = (106 integers) × (8 bytes per integer + 8 bytes per link). Is there a hope I can get the total memory below 256 MB? I'm already using Text package for input. Maybe I should avoid lists altogether and directly read integers from stdin to the array. How can we do that? Or, is the issue elsewhere? {-# OPTIONS_GHC -O2 #-} module CF1606D where import qualified Data.Text as T import qualified Data.Text.IO as TI import qualified Data.Text.Read as TR import Control.Monad import qualified Data.List as DL import qualified Data.IntSet as DS import Control.Monad.ST import Data.Array.ST.Safe import Data.Int (Int32) import Data.Array.Unboxed solve :: IO () solve = do ~[n,m] <- readv -- 2D list input <- {-# SCC input #-} replicateM (fromIntegral n) readv let ints = [1..] sorted = DL.sortOn (head.fst) (zip input ints) (rows,indices) = {-# SCC rows_inds #-} unzip sorted -- 2D list converted into matrix: matrix = mat (fromIntegral n) (fromIntegral m) rows infinite = 10^7 asc x y = [x,x+1..y] desc x y = [y,y-1..x] -- Four prefix-matrices: tlMax = runSTUArray $ prefixMat max 0 asc asc (subtract 1) (subtract 1) =<< matrix blMin = runSTUArray $ prefixMat min infinite desc asc (+1) (subtract 1) =<< matrix trMin = runSTUArray $ prefixMat min infinite asc desc (subtract 1) (+1) =<< matrix brMax = runSTUArray $ prefixMat max 0 desc desc (+1) (+1) =<< matrix good _ (i,j) | tlMax!(i,j) < blMin!(i+1,j) && brMax!(i+1,j+1) < trMin!(i,j+1) = Left (i,j) | otherwise = Right () {-# INLINABLE good #-} nearAns = foldM good () [(i,j)|i<-[1..n-1],j<-[1..m-1]] ans = either (\(i,j)-> "YES\n" ++ color n (take i indices) ++ " " ++ show j) (const "NO") nearAns putStrLn ans type I = Int32 type S s = (STUArray s (Int, Int) I) type R = Int -> Int -> [Int] type F = Int -> Int mat :: Int -> Int -> [[I]] -> ST s (S s) mat n m rows = newListArray ((1,1),(n,m)) $ concat rows prefixMat :: (I->I->I) -> I -> R -> R -> F -> F -> S s -> ST s (S s) prefixMat opt worst ordi ordj previ prevj mat = do ((ilo,jlo),(ihi,jhi)) <- getBounds mat pre <- newArray ((ilo-1,jlo-1),(ihi+1,jhi+1)) worst forM_ (ordi ilo ihi) $ \i-> do forM_ (ordj jlo jhi) $ \j -> do matij <- readArray mat (i,j) prei <- readArray pre (previ i,j) prej <- readArray pre (i, prevj j) writeArray pre (i,j) (opt (opt prei prej) matij) return pre color :: Int -> [Int] -> String color n inds = let temp = DS.fromList inds colors = [if DS.member i temp then 'B' else 'R' | i<-[1..n]] in colors readv :: Integral t => IO [t] readv = map readInt . T.words <$> TI.getLine where readInt = fromIntegral . either (const 0) fst . TR.signed TR.decimal {-# INLINABLE readv #-} main :: IO () main = do ~[n] <- readv replicateM_ n solve Quick description of the code above: nrows each having mintegers. Sample input and Commands Command: > stack ghc -- -main-is CF1606D.main -with-rtsopts="-s -h -p -P" -rtsopts -prof -fprof-auto CF1606D > gtime -v ./CF1606D < inp3.txt > outp ... ... MUT time 2.990s ( 3.744s elapsed) # RTS -s output GC time 4.525s ( 6.231s elapsed) # RTS -s output ... ... Maximum resident set size (kbytes): 408532 # >256 MB (gtime output) > stack exec -- hp2ps -t0.1 -e8in -c CF1606D.hp && open CF1606D.ps Question about GC: As shown above in the +RTS -s output, GC seems to be taking longer than the actual logic execution. Is this normal? Is there a way to visualize the GC activity over time? I tried making matrices strict but that didn't have any impact. Probably this is not a functional-friendly problem at all (although I'll be happy to be disproved on this). For example, Java uses GC too but there are lots of successful Java submissions. Still, I want to see how far I can push. Thanks! ANSWERAnswered 2021-Dec-05 at 11:40 Contrary to common belief Haskell is quite friendly with respect to problems like that. The real issue is that the array library that comes with GHC is total garbage. Another big problem is that everyone is taught in Haskell to use lists where arrays should be used instead, which is usually one of the major sources of slow code and memory bloated programs. So, it is not surprising that GC takes a long time, it is because there is way too much stuff being allocation. Here is a run on the supplied input for the solution provided below: 1,483,547,096 bytes allocated in the heap 566,448 bytes copied during GC 18,703,640 bytes maximum residency (3 sample(s)) 1,223,400 bytes maximum slop 32 MiB total memory in use (0 MB lost due to fragmentation) Tot time (elapsed) Avg pause Max pause Gen 0 1399 colls, 0 par 0.009s 0.009s 0.0000s 0.0011s Gen 1 3 colls, 0 par 0.002s 0.002s 0.0006s 0.0016s TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1) SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled) INIT time 0.001s ( 0.001s elapsed) MUT time 0.484s ( 0.517s elapsed) GC time 0.011s ( 0.011s elapsed) EXIT time 0.001s ( 0.002s elapsed) Total time 0.496s ( 0.530s elapsed) The solution provided below uses an array library massiv, which makes it impossible to submit to codeforces. However, hopefully the goal is to get better at Haskell, rather than get points on some website. The red-blue matrix can be separated into two stages: read and solve In the main function we only read total number of arrays and dimensions for each array. Also we print the outcome. Nothing exciting here. (Note that the linked file inp3.txt has a larger array than the limits defined in the problem: n*m <= 10^6) import Control.Monad.ST import Control.Monad import qualified Data.ByteString as BS import Data.Massiv.Array as A hiding (B) import Data.Massiv.Array.Mutable.Algorithms (quicksortByM_) import Control.Scheduler (trivialScheduler_) main :: IO () main = do t <- Prelude.read <$> getLine when (t < 1 || t > 1000) $ error $ "Invalid t: " ++ show t replicateM_ t $ do dimsStr <- getLine case Prelude.map Prelude.read (words dimsStr) of -- Test file fails this check: && n * m <= 10 ^ (6 :: Int) -> do [n, m] | n >= 2 && m > 0 && m <= 5 * 10 ^ (5 :: Int) -> do mat <- readMatrix n m case solve mat of Nothing -> putStrLn "NO" Just (ix, cs) -> do putStrLn "YES" putStr $ foldMap show cs putStr " " print ix _ -> putStrLn $ "Unexpected dimensions: " ++ show dimsStr Loading the input into array is the major source of problems int the original question: text, ascii characters is the only valid input expected by the problem. Normally in such situation it would be much better to read input in a streaming fashion using something like conduit. In particular, reading input as stream of bytes and parsing those bytes as numbers would be the optimal solution. That being said there are hard requirements on the width of each array in the description of the problem, so we can get away with reading input line-by-line as a ByteString and then parsing numbers (assumed unsigned for simplicity) in each line and write those numbers into array at the same time. This ensures that at this stage we will only have allocated the resulting array and a single line as sequence of bytes. This could be done cleaner with a parsing library like attoparsec, but problem is simple enough to just do it adhoc. type Val = Word readMatrix :: Int -> Int -> IO (Matrix P Val) readMatrix n m = createArrayS_ (Sz2 n m) readMMatrix readMMatrix :: MMatrix RealWorld P Val -> IO () readMMatrix mat = loopM_ 0 (< n) (+ 1) $ \i -> do line <- BS.getLine --- ^ reads at most 10Mb because it is known that input will be at most -- 5*10^5 Words: 19 digits max per Word and one for space: 5*10^5 * 20bytes loopM 0 (< m) (+ 1) line $ \j bs -> let (word, bs') = parseWord bs in bs' <$ write_ mat (i :. j) word where Sz2 n m = sizeOfMArray mat isSpace = (== 32) isDigit w8 = w8 >= 48 && w8 <= 57 parseWord bs = case BS.uncons bs of Just (w8, bs') | isDigit w8 -> parseWordLoop (fromIntegral (w8 - 48)) bs' | otherwise -> error $ "Unexpected byte: " ++ show w8 Nothing -> error "Unexpected end of input" parseWordLoop !acc bs = case BS.uncons bs of Nothing -> (acc, bs) Just (w8, bs') | isSpace w8 -> (acc, bs') | isDigit w8 -> parseWordLoop (acc * 10 + fromIntegral (w8 - 48)) bs' | otherwise -> error $ "Unexpected byte: " ++ show w8 This is the step where we implement the actual solution. Instead of going into trying to fix the solution provided in this SO question I went on and translated the C++ solution that was linked in the question instead. Reason I went that route is twofold: Note, that it should be possible to rewrite the solution below with array package, because in the end all that is needed are the read, write and allocate operations. computeSortBy :: (Load r Ix1 e, Manifest r' e) => (e -> e -> Ordering) -> Vector r e -> Vector r' e computeSortBy f vec = withLoadMArrayST_ vec $ quicksortByM_ (\x y -> pure $ f x y) trivialScheduler_ solve :: Matrix P Val -> Maybe (Int, [Color]) solve a = runST $ do let sz@(Sz2 n m) = size a ord :: Vector P Int ord = computeSortBy (\x y -> compare (a ! (y :. 0)) (a ! (x :. 0))) (0 ..: n) mxl <- newMArray @P sz minBound loopM_ (n - 1) (>= 0) (subtract 1) $ \ i -> loopM_ 0 (< m) (+ 1) $ \j -> do writeM mxl (i :. j) (a ! ((ord ! i) :. j)) when (i < n - 1) $ writeM mxl (i :. j) =<< max <$> readM mxl (i :. j) <*> readM mxl (i + 1 :. j) when (j > 0) $ writeM mxl (i :. j) =<< max <$> readM mxl (i :. j) <*> readM mxl (i :. j - 1) mnr <- newMArray @P sz maxBound loopM_ (n - 1) (>= 0) (subtract 1) $ \ i -> loopM_ (m - 1) (>= 0) (subtract 1) $ \ j -> do writeM mnr (i :. j) (a ! ((ord ! i) :. j)) when (i < n - 1) $ writeM mnr (i :. j) =<< min <$> readM mnr (i :. j) <*> readM mnr (i + 1 :. j) when (j < m - 1) $ writeM mnr (i :. j) =<< min <$> readM mnr (i :. j) <*> readM mnr (i :. j + 1) mnl <- newMArray @P (Sz m) maxBound mxr <- newMArray @P (Sz m) minBound let goI i | i < n - 1 = do loopM_ 0 (< m) (+ 1) $ \j -> do val <- min (a ! ((ord ! i) :. j)) <$> readM mnl j writeM mnl j val when (j > 0) $ writeM mnl j . min val =<< readM mnl (j - 1) loopM_ (m - 1) (>= 0) (subtract 1) $ \j -> do val <- max (a ! ((ord ! i) :. j)) <$> readM mxr j writeM mxr j val when (j < m - 1) $ writeM mxr j . max val =<< readM mxr (j + 1) let goJ j | j < m - 1 = do mnlVal <- readM mnl j mxlVal <- readM mxl (i + 1 :. j) mxrVal <- readM mxr (j + 1) mnrVal <- readM mnr ((i + 1) :. (j + 1)) if mnlVal > mxlVal && mxrVal < mnrVal then pure $ Just (i, j) else goJ (j + 1) | otherwise = pure Nothing goJ 0 >>= \case Nothing -> goI (i + 1) Just pair -> pure $ Just pair | otherwise = pure Nothing mAns <- goI 0 Control.Monad.forM mAns $ \ (ansFirst, ansSecond) -> do resVec <- createArrayS_ @BL (Sz n) $ \res -> iforM_ ord $ \i ordIx -> do writeM res ordIx $! if i <= ansFirst then R else B pure (ansSecond + 1, A.toList resVec) Source QUESTION Typescript: deep keyof of a nested object, with related typeAsked 2021-Dec-02 at 09:30 I'm looking for a way to have all keys / values pair of a nested object. (For the autocomplete of MongoDB dot notation key / value type) interface IPerson { name: string; age: number; contact: { address: string; visitDate: Date; } } Here is what I want to achieve, to make it becomes: type TPerson = { name: string; age: number; contact: { address: string; visitDate: Date; } "contact.address": string; "contact.visitDate": Date; } In this answer, I can get the key with Leaves<IPerson>. So it becomes 'name' | 'age' | 'contact.address' | 'contact.visitDate'. And in another answer from @jcalz, I can get the deep, related value type, with DeepIndex<IPerson, ...>. Is it possible to group them together, to become type like TPerson? When I start this question, I was thinking it could be as easy as something like [K in keyof T]: T[K];, with some clever transformation. But I was wrong. Here is what I need: So the interface interface IPerson { contact: { address: string; visitDate: Date; }[] } becomes type TPerson = { [x: `contact.${number}.address`]: string; [x: `contact.${number}.visitDate`]: Date; contact: { address: string; visitDate: Date; }[]; } No need to check for valid number, the nature of Array / Index Signature should allow any number of elements. The interface interface IPerson { contact: [string, Date] } becomes type TPerson = { [x: `contact.0`]: string; [x: `contact.1`]: Date; contact: [string, Date]; } Tuple should be the one which cares about valid index numbers. readonly attributes should be removed from the final structure. interface IPerson { readonly _id: string; age: number; readonly _created_date: Date; } becomes type TPerson = { age: number; } The use case is for MongoDB, the _id, _created_date cannot be modified after the data has been created. _id: never is not working in this case, since it will block the creation of TPerson. interface IPerson { contact: { address: string; visitDate?: Date; }[]; } becomes type TPerson = { [x: `contact.${number}.address`]: string; [x: `contact.${number}.visitDate`]?: Date; contact: { address: string; visitDate?: Date; }[]; } It's sufficient just to bring the optional flags to transformed structure. interface IPerson { contact: { address: string; } & { visitDate: Date; } } becomes type TPerson = { [x: `contact.address`]: string; [x: `contact.visitDate`]?: Date; contact: { address: string; } & { visitDate: Date; } } The interface interface IPerson { birth: Date; } becomes type TPerson = { birth: Date; } not type TPerson = { age: Date; "age.toDateString": () => string; "age.toTimeString": () => string; "age.toLocaleDateString": { ... } We can give a list of Types to be the end node. ANSWERAnswered 2021-Dec-02 at 09:30 In order to achieve this goal we need to create permutation of all allowed paths. For example: type Structure = { user: { name: string, surname: string } } type BlackMagic<T>= T // user.name | user.surname type Result=BlackMagic<Structure> Problem becomes more interesting with arrays and empty tuples. Tuple, the array with explicit length, should be managed in this way: type Structure = { user: { arr: [1, 2], } } type BlackMagic<T> = T // "user.arr" | "user.arr.0" | "user.arr.1" type Result = BlackMagic<Structure> Logic is straitforward. But how we can handle number[]? There is no guarantee that index 1 exists. I have decided to use user.arr.${number}. type Structure = { user: { arr: number[], } } type BlackMagic<T> = T // "user.arr" | `user.arr.${number}` type Result = BlackMagic<Structure> We still have 1 problem. Empty tuple. Array with zero elements - []. Do we need to allow indexing at all? I don't know. I decided to use -1. type Structure = { user: { arr: [], } } type BlackMagic<T> = T // "user.arr" | "user.arr.-1" type Result = BlackMagic<Structure> I think the most important thing here is some convention. We can also use stringified `"never". I think it is up to OP how to handle it. Since we know how we need to handle different cases we can start our implementation. Before we continue, we need to define several helpers. } I think naming and tests are self explanatory. At least I want to believe :D Now, when we have all set of our utils, we can define our main util: /** * = ''> = // if Obj is primitive >) ) // "user" | "user.arr" | `user.arr.${number}` type Test = Extract<Path<Structure>, string> There is small issue. We should not return highest level props, like user. We need paths with at least one dot. There are two ways: Two options are easy to implement. Obtain all props with dot (.): type WithDot<T extends string> = T extends `${string}.${string}` ? T : never While above util is readable and maintainable, second one is a bit harder. We need to provide extra generic parameter in both Path and HandleObject. See this example taken from other question / article: type KeysUnion<T, Cache extends string = '', Level extends any[] = []> = T extends PropertyKey ? Cache : { [P in keyof T]: P extends string ? Cache extends '' ? KeysUnion<T[P], `${P}`, [...Level, 1]> : Level['length'] extends 1 // if it is a higher level - proceed ? KeysUnion<T[P], `${Cache}.${P}`, [...Level, 1]> : Level['length'] extends 2 // stop on second level ? Cache | KeysUnion<T[P], `${Cache}`, [...Level, 1]> : never : never }[keyof T] Honestly, I don't think it will be easy for any one to read this. We need to implement one more thing. We need to obtain a value by computed path. type Acc = Record<string, any> type ReducerCallback<Accumulator extends Acc, El extends string> = El extends keyof Accumulator ? Accumulator[El] :: [] } } You can find more information about using Reducein my blog. Whole code: type Structure = { user: { tuple: [42], emptyTuple: [], array: { age: number }[] } }>) ) type WithDot<T extends string> = T extends `${string}.${string}` ? T : never // "user" | "user.arr" | `user.arr.${number}` type Test = WithDot<Extract<Path<Structure>, string>> type Acc = Record<string, any> type ReducerCallback<Accumulator extends Acc, El extends string> = El extends keyof Accumulator ? Accumulator[El] : El extends '-1' ? never :: [] } } type BlackMagic<T> = T & { [Prop in WithDot<Extract<Path<T>, string>>]: Reducer<Prop, T> } type Result = BlackMagic<Structure> This implementation is worth considering Source Community Discussions, Code Snippets contain sources that include Stack Exchange Network No vulnerabilities reported Save this library and start creating your kit Explore Related Topics Share this Page Save this library and start creating your kit
https://kandi.openweaver.com/java/lihengming/spring-boot-api-project-seed
CC-MAIN-2022-33
refinedweb
6,442
56.25
stas 01/10/06 07:03:21 Modified: src/devel/writing_tests writing_tests.pod Log: - improving the structure of the document, moving sections around - improving the 'How to Setup Testing Environment' section - fixing lots of error in the rest of the doc - adding a 'References' section Revision Changes Path 1.10 +497 -363 modperl-docs/src/devel/writing_tests/writing_tests.pod Index: writing_tests.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/devel/writing_tests/writing_tests.pod,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- writing_tests.pod 2001/10/05 03:51:47 1.9 +++ writing_tests.pod 2001/10/06 14:03:21 1.10 @@ -1,10 +1,117 @@ -=head1 Writing tests with Apache::Test framework +=head1 Developing and Running Tests with C<Apache::Test> Framework -=head1 Running Tests +=head1 Introduction -Running test is usual just like for any perl module, first we have to -create the I<Makefile> and build everything. So we run: +This chapter is talking about the C<Apache::Test> framework, and in +particular explains: +=over + +=item * how to run existing tests + +=item * setup a testing environment + +=item * develop new tests + +=back + +But first let's introduce the C<Apache::Test> framework. + +The C<Apache::Test> framework is designed for easy writing of tests +that has to be run under Apache webserver (not necessarily +mod_perl). Originally designed for the mod_perl Apache module, it was +extended to be used for any Apache module. + +You can write tests in Perl and C, and the framework will provide an +extensive functionality which makes the tests writing a simple and +therefore enjoyable process. + +If you have ever written or looked at the tests most Perl modules come +with, C<Apache::Test> uses the same concept. The script C<t/TEST> is +running all the files ending with I<.t> it finds in the I<t/> +directory. When executed a typical test prints the following: + + 1..3 # going to run 3 tests + ok 1 # the first test has passed + ok 2 # the second test has passed + not ok 3 # the third test has failed + +Every C<ok> or C<not ok> is followed by the number which tells which +sub-test has succeeded or failed. + +C<t/TEST> uses a C<Test::Harness> module which intercepts the +C<STDOUT> stream, parses it and at the end of the tests print the +results of the tests running: how many tests and sub-tests were run, +how many succeeded, skipped or failed. + test that you cannot +proceed with the tests and it's not a must pass test, you just skip +it. + +It's important to know, that there is a special verbose mode, enabled +with I<-v> option, in which everything printed by the test goes to +C<STDOUT>. So for example if your test does this: + + print "testing : feature foo\n"; + print "expected: $expected\n"; + print "received: $received\n"; + ok $expected eq $received; + +in the normal mode, you won't see any of these prints. But if you run +the test with I<t/TEST -v>, you will see something like this: + + testing : feature foo + expected: 2 + received: 2 + ok 2 + +When you develop the test you should always put the debug statements +there, and once the test works for you do not comment out or delete +these debug statements. This is because if some user reports a failure +in some test, you can ask him to run the failing test in the verbose +mode and send you back the report. It'll be much easier to understand +what the problem is if you get these debug printings from the user. + +In the section L<"Using Apache::TestUtil"> we discuss a few helper +functions which make the tests writing easier. + +For more details about the C<Test::Harness> module please refer to its +manpage. Also see the C<Test> manpage about Perl's test suite. + +=head1 Prerequisites + +In order to use C<Apache::Test> it has to be installed first. + +Install C<Apache::Test> using the familiar procedure: + + % cd Apache-Test + % perl Makefile.PL + % make && make test && make install + +If you install mod_perl 2.x, you get C<Apache::Test> installed as +well. + +=head1 How to Run Tests + +It's much easier to copy-cat things, than creating from scratch. It's +much easier to develop tests, when you have some existing system that +you can test, see how it works and build your own testing environment +in a similar fashion. Therefore let's first look at how the existing +test enviroments work. + +You can look at the modperl-2.0's or httpd-test's (I<perl-framework>) +testing environments which both use C<Apache::Test> for their test +suites. + +Running tests is just like for any CPAN Perl module; first we create +the I<Makefile> and build everything with I<make>: + % perl Makefile.PL [options] % make @@ -13,9 +120,9 @@ % make test -but it adds the overhead of checking all the directories that -everything is built (the usual make modification control). So it's -faster to run the tests directly: +but it adds quite an overhead, since it has to check that everything +is up to date (the usual C<make> source change control). Therefore +faster to run the tests directly via: % t/TEST @@ -23,9 +130,14 @@ mode: % t/TEST -v + +In this case the test may print useful information, like what values +it expects and what values it receives, given that the test is written +to report these. In the silent mode (without C<-v>) these printouts +are suppressed by the test suite. -When debugging problems it's helps to keep the I<error_log> file open -in another console, and see the debug output in the real time via +When debugging problems it helps to keep the I<error_log> file open in +another console, and see the debug output in the real time via tail(1): % tail -f t/logs/error_log @@ -33,8 +145,13 @@ Of course this file gets created only when the server starts, so you cannot run tail(1) on it before the server starts. +[F] Later on we will talk about I<-clean> option, for now just +remember that if you use it I<t/logs/error_log> is deleted, therefore +you have to run the tail(1) command again, when the server is +started. [/F] + If you have to run the same tests repeatedly, in most cases you don't -want to wait for the server to start every time, so you can start it +want to wait for the server to start every time. You can start it once: % t/TEST -start @@ -43,19 +160,40 @@ % t/TEST -or only specific tests: +or only specific tests, by explicitly specifying them. For example to +run the test file I<t/protocol/echo.t> we execute: % t/TEST protocol/echo + +notice that you don't have to add the I<t/> prefix and I<.t> extension +for the test filenames if you specify them explicitly. + +Also when you run specific tests, it's because something is not +working, therefore usually you want to run them in the verbose mode, +that we have mentioned before. + + % t/TEST -v protocol/echo + +following two commands are equivalent: -note that you don't have to add the I<t/> prefix for the test -filenames if you specify them explicitly. + % t/TEST protocol/echo protocol/eliza + % t/TEST protocol There is one bit you should be aware of. If you run the tests without restarting the server any changes to the response handlers that you apply won't take effect, untill the server is restarted. Therefore you -may want to use C<Apache::Reload> module (META: not working with 2.0 -yet), or use the following trick: +may want to use C<Apache::Reload> module, which will reload files +automatically if they change between requests. +META: do we include it in modperl-2.0? +document the new syntax. + +<ToGo when the issue with Reload is resolved> +Or use this trick: + PerlModule Apache::Foo <Location /cgi-test> PerlOptions +GlobalRequest @@ -63,105 +201,348 @@ PerlResponseHandler "sub { delete $INC{'Apache/Foo.pm'}; require Apache::Foo; Apache::Foo::handler(shift);}" </Location> +</ToGo> + This will force the response handler C<Apache::Foo> to be reloaded on every request. Since the request test files don't reside in memory you can change them and the changes will take effect without restarting the server. +The command: + % t/TEST -start always stops the server first if any is running. In case you have a server runnning on the same port, (for example if you develop the a -few tests at the same time in different trees), you should either kill -that server, or run the server on a different port. +few tests at the same time in different trees), you should run the +server on a different port. C<Apache::Test> will try to automatically +pick a free port, but you can explicitly tell on which port to run, +using the I<-port> configuration option: - % t/TEST -start Port 8799 + % t/TEST -start -port 8799 or by setting an evironment variable C<APACHE_PORT> to the desired value before starting the server. -=head1 Writing tests with C<Apache::Test> framework +META: a lot more stuff to go here from the pods/modperl_dev.pod and +Apache-Test/README -The C<Apache::Test> tests framework is designed for easy writing of -tests that need to be run under Apache webserver. Originally designed -for the mod_perl Apache module, it was extended to be used for any -Apache module. +=head1 How to Setup Testing Environment -You can write tests in Perl and C, and the framework will provide an -extensive functionality which makes the tests writing a simple and -therefore enjoy-able process. +We will assume that you setup your testing environment even before you +have started developing the module, which is a very smart thing to do. +Of course it'll take you more time upfront, but it'll will save you a +lot of time as you develop and debug your code. The L<extreme +programming methodology|/item_extreme_programming_methodology> says +that tests should be written before starting the code development. + +So the first thing is to create a package and all the helper files, so +later on we can distribute it on CPAN. We are going to develop an + +C<h2xs> is a nifty utility that gets installed together with Perl and +helps us to create some of the files we will need later. + +However we are going to use a little bit different files layout, +therefore we are going to move things around a bit. -If you have ever written or looked at the tests most Perl modules come -with, C<Apache::Test> uses the same concept. I<t/TEST> is running all the -files ending with I<.t> it can found in the I<t/> directory, and looks -at what they print. A typical test prints the following: +We want our module to live in the I<Apache-Amazing> directory, so we +do: - 1..3 # going to run 3 tests - ok 1 # the first test has passed - ok 2 # the second test has passed - not ok 3 # the third test has failed + % mv Apache/Amazing Apache-Amazing + % rmdir Apache -C<t/TEST> uses a standard Perl's C<Test::Harness> module which -intercepts the STDOUT parses it and at the end of the tests print the -results of the tests running: how many tests were run, how many -failed, how many suceeded and more. +From now on the I<Apache-Amazing> directory is our working directory. -Some tests may be skipped by printing: + % cd Apache-Amazing - 1..0 # all tests in this file are going to be skipped. +We don't need the I<test.pl>. as we are going to create a whole +testing environment: -You usually want to do that when some feature is optional and the -prerequisites are not installed on the system. Once you test that you -cannot proceed with the tests and it's not a must pass test, you just -skip it. + % rm test.pl -It's important to know, that there is a special debug mode, enabled -with I<-v> option, in which everything printed by the test goes to -STDOUT. So for example if your test does this: +We want our package to reside under the I<lib> directory: - print "testing : feature foo\n"; - print "expected: $expected\n"; - print "received: $received\n"; - ok $expected eq $received; + % mkdir lib + % mkdir lib/Apache + % mv Amazing.pm lib/Apache -in the normal mode, you won't see any of these prints. But if you run -the test with I<t/TEST -v>, you will see something like this: +Now we adjust the I<lib/Apache/Amazing.pm> to look like this: - testing : feature foo - expected: 2 - received: 2 - ok 2 + file:lib/Apache/Amazing.pm + -------------------------- + package Apache::Amazing; + + use strict; + use warnings; + + use Apache::RequestRec (); + use Apache::RequestIO (); + + $Apache::Amazing::VERSION = '0.01'; + + use Apache::Const -compile => 'OK'; + + sub handler { + my $r = shift; + $r->content_type('text/plain'); + $r->print("Amazing!"); + return Apache::OK; + } + 1; + __END__ + ... pod documentation goes here... -So when you develop your tests and need to debug them, keep the debug -statements there, don't even comment them out. In fact when you -develop the test you should always put the debug statements -there. This is because if some user reports a failure in some test, -you can ask him to run the failing test in the verbose mode and send -you back the report. Using this report it'll probably be much easier -for you to discover the problem. +The only thing it does is setting the I<text/plain> header and +responding with I<"Amazing!">. -In the section L<"Apache::TestUtil"> we discuss a few helper functions -which make the tests writing easier. +Next adjust or create the I<Makefile.PL> file: -For more details about the C<Test::Harness> module please refer to its -manpage. + file:Makefile.PL + ---------------- + require 5.6.1; + + use ExtUtils::MakeMaker; + + use lib qw(../blib/lib lib ); + + use Apache::TestMM qw(test clean); #enable 'make test' + + # prerequisites + my %require = + ( + "Apache::Test" => "", # any version will do + ); -=head2 Prerequisites + # accept the configs from comman line + Apache::TestMM::filter_args(); + Apache::TestMM::generate_script('t/TEST'); -In order to use C<Apache::Test> it has to be installed first. +]; + } -Install C<Apache::Test> using the familiar procedure: +C<Apache::TestMM> will do a lot of thing for us, such as building a +complete Makefile with proper I<'test'> and I<'clean'> targets, +automatically converting I<.PL> and I<conf/*.in> files and more. - % cd Apache-Test - % perl Makefile.PL - % make && make test && make install +As you see we specify a prerequisites hash with I<Apache::Test> in it, +so if the package gets distributed on CPAN, C<CPAN.pm> shell will know +to fetch and install this required package. -If you install mod_perl 2.x, you get C<Apache::Test> installed as -well. +Next we create the test suite, which will reside in the I<t> +directory: + + % mkdir t + +First we create I<t/TEST.PL> which will be automatically converted +into I<t/TEST> during I<perl Makefile.PL> stage: + + file:t/TEST.PL + -------------- + # tell Perl where to find it. For +example you could add: + + use lib qw(../Apache-Test/lib); + +to I<t/TEST.PL>,, which will +reside in I<t/conf>: + + % mkdir t/conf -=head2 One Part Perl Tests: Response only +We create the I<t/conf/extra.conf.in> file which will be automatically +converted into I<t/conf/extra.conf> before the server starts. If the +file has any placeholders like C<@documentroot@>, these will be +replaced with the real values specific for the used server. In our +case we put the following configuration bits into this file: + file:t/conf/extra.conf.in + ------------------------- + # this file will be Include-d by @ServerRoot@/httpd.conf + + # where Apache::Amazing can be found + PerlSwitches -Mlib=@ServerRoot@/../lib + # preload the module + PerlModule Apache::Amazing + <Location /test/amazing> + SetHandler modperl + PerlResponseHandler Apache::Amazing + </Location> + +As you can see we just add a simple E<lt>LocationE<gt> container and +tell Apache that the namespace I</test/amazing> should be handled by +C<Apache::Amazing> module running as a mod_perl handler. + +As mentioned before you can use C<Apache::Reload> to automatically +reload the modules under development when they change. The setup for +this module goes into I<t/conf/extra.conf.in> as well. + + file:t/conf/extra.conf.in + ------------------------- + PerlModule Apache::Reload + PerlPostReadRequestHandler Apache::Reload + PerlSetVar ReloadAll Off + PerlSetVar ReloadModules "Apache::Amazing" + +For more information about C<Apache::Reload> refer to its manpage. + +Now we can create a simple test: + + file: + + file:Makefile.PL + ---------------- + WriteMakefile( + ... + dist => { + PREOP => 'pod2text lib/Apache/Amazing.pm > README', + }, + ... + ); + +in this case C<README> will be created from the documenation POD +sections in I<lib/Apache/Amazing.pm>, but the file has to exists for +I<make dist> to succeed. + +and finally we adjust or create the C<MANIFEST> file, so we can +prepare a complete distribution. Therefore we list all the files that +should enter the distribution including the C<MANIFEST> file itself: + + file:MANIFEST + ------------- + lib/Apache/Amazing.pm + t/TEST.PL + t/basic.t + t/conf/extra.conf.in + Makefile.PL + Changes + README + MANIFEST + +That's it. Now we can build the package. But we need to know where +C<apxs> utility from the installed on our system Apache is located. We +pass its path as an option: + + % perl Makefile.PL -apxs ~/httpd/prefork/bin/apxs + % make + % make test + + basic...........ok + All tests successful. + Files=1, Tests=2, 1 wallclock secs ( 0.52 cusr + 0.02 csys = 0.54 CPU) + +To install the package run: + + % make install + +how amazingly it works and how amazingly it can be deployed by other +users. + +=head1 How to Write Tests + C<Apache::Test> can auto-generate the +client part of the test for you. + +=head2 Developing Response-only Part of a Test + If you write only a response part of the test, C<Apache::Test> will automatically generate the corresponding test part that will generated the response. In this case your test should print I<'ok 1'>, I<'not ok @@ -235,7 +616,7 @@ so when you run your new tests the new configuration will be added. -=head2 Two Parts Perl Tests: Request and Response +=head2 Developing Response and Request Parts of a Test But in most cases you want to write a two parts test where the client (request) parts generates various requests and tests the responses. @@ -332,298 +713,29 @@ problem. The name of the request part of the test is very important. If . -=head2 Tests Written in C +=head2 Developing Tests in C META: to be written - -=head1 Writing Test Methodology -META: to be written +=head1 Developing Tests: Gory Details -=head1 Using Apache::TestUtil -META: to be written -=head1 Using C<Apache::Test> framework +=head2 Writing Test Methodology META: to be written - -=head2 C<Apache::Test> Inside mod_perl 2.0 - -There is nothing to be done to add new tests for the mod_perl 2.0, -other than writing the tests as explained before. The rest of the -setup is already in place. - -=head2 C<Apache::Test> Standalone - -If you have developed an Apache module that you want to develop the -tests for with C<Apache::Test>, you have to prepare a special setup -for it. - -Let's say that your package is called C<Apache::Amazing> and we are -going to prepare a setup for it. If the module is going to be -distributed on CPAN or you simply want to take a benefit of all the -package distribution and developing features Perl provides, you -probably already have the right layout in place, but in case you -aren't let's go fast through it: - - % mkdir Apache-Amazing - % cd Apache-Amazing - -As you have noticed we have created the C<Apache-Amazing> directory -and from now on will be working from it. Next let's prepare a -directory for our module: - - % mkdir lib - % mkdir lib/Apache - -Now put the module into I<lib/Apache/Amazing.pm>: - - package Apache::Amazing; - - $Apache::Amazing::VERSION = '0.01'; - - use Apache::Const -compile => qw(:common); - use Apache::compat (); - - sub handler { - $r = shift; - $r->send_http_header('text/plain'); - $r->print("Amazing!"); - return Apache::OK; - } - 1; -The only thing it does is setting the I<text/plain> header and -responding with I<"Amazing!">. - -Next prepare the I<Makefile.PL> file: +=head2 Using C<Apache::TestUtil> - require 5.6.1; - - use ExtUtils::MakeMaker; - - use lib qw(../blib/lib lib ); - - use Apache::TestMM qw(test clean); #enable 'make test' - - # prerequisites - my %require = - ( - "Apache::Test" => "0.1", - ); - - # accept the configs from comman line - Apache::TestMM::filter_args(); - Apache::TestMM::generate_script('t/TEST'); - - WriteMakefile - ( - NAME => 'Apache::Registry', - VERSION_FROM => 'lib/Apache/Registry.pm', - PREREQ_PM => \%require, - clean => { - FILES => "@{ clean_files() }", - }, - ); - - sub clean_files { - return [@scripts]; - } - -C<Apache::TestMM> will do a lot of thing for us, such as building a -complete Makefile with proper I<'test'> and I<'clean'> targets, -automatically converting I<.PL> and I<conf/*.in> files and more. - -As you see we specify a prerequisites hash with I<Apache::Test> in it, -so if the package gets distributed on CPAN, C<CPAN.pm> shell will know -to fetch and install this required package. - -Next we create the test suite. First we create I<t/TEST.PL> which will -be automatically converted into I<t/TEST> during I<perl Makefile.PL> -stage: - - # Perl where to find it. For example -you could add: - - use lib "../Apache-Test/lib"; - , so we create -the I<t/conf/extra.conf.in> file which will be automatically converted -into I<t/conf/extra.conf> before the server starts. If the file has -any placeholders like C<@documentroot@>, these will be replaced with -the real values for a specific server that is run. In our case we put -the following configuration bits into this file: - - # this file will be Include-d by @ServerRoot@/httpd.conf - - # where Apache::Amazing can be found - PerlSwitches -Mlib=@ServerRoot@/../lib - # preload the module - PerlModule Apache::Amazing - <Location /test/amazing> - PerlOptions +GlobalRequest - SetHandler modperl - PerlResponseHandler Apache::Amazing - </Location> - -As you can see we just add a simple E<lt>LocationE<gt> container and -tell Apache that the namespace I</test/amazing> should be handled by -C<Apache::Amazing> module. - -In case you do a development you may want to force a reload of this -module on each request: - - PerlResponseHandler "sub { delete $INC{'Apache/Amazing.pm'}; require Apache::Amazing; Apache::Amazing::handler(shift);}" - -Alternatively you can put this code into: - - lib/Apache/AmazingReload.pm: - ---------------------------- - package Apache::AmazingReload; - - use lib qw(../lib); - - sub handler{ - delete $INC{'Apache/Amazing.pm'}; - undef *Apache::Amazing::handler; # avoid reload warnings. - eval { require Apache::Amazing; }; - if ($@) { - warn "reason: $@"; - } - else { - Apache::Amazing::handler(shift); - } - } - 1; - -And now use this configuration instead: - - PerlSwitches -Mlib=@ServerRoot@/../lib - # preload the module - PerlModule Apache::AmazingReload - <Location /test/amazing> - PerlOptions +GlobalRequest - SetHandler modperl - PerlResponseHandler Apache::AmazingReload - </Location> - -C<Apache::AmazingReload> will worry to forward all the requests to the -real handler, but first it'll reload it, so any changes will -immediately take an effect. - -[META: update this when Apache::Reload will work with 2.0!] - -Now we can create a simple test: - -: - - WriteMakefile( - ... - dist => { - PREOP => 'pod2text lib/Apache/Amazing.pm > README', - }, - ... - ); - -in this case C<README> will be created from the pod in -I<lib/Apache/Amazing.pm>. - -and finally we create the C<MANIFEST> file, so we can prepare a -complete distribution. Therefore we list all the files that should -enter the distribution including the C<MANIFEST> file itself: - - MANIFEST: - --------- - lib/Apache/Amazing.pm - t/TEST.PL - t/basic.t - t/conf/extra.conf.in - Makefile.PL - README - MANIFEST - -That's it. Now we can build the package. But we need to know where -C<apxs> utility from the installed on our system Apache is located. We -pass its path as an option: - - % perl Makefile.PL apxs /path/to/httpd-2.0/bin/apxs - % make - % make test - - basic...........ok - All tests successful. - Files=1, Tests=2, 1 wallclock secs ( 0.52 cusr + 0.02 csys = 0.54 CPU) - g -how amazingly it works and how amazingly it can be deployed by other -users. - -=head1 Gory Details on Writing Tests +META: to be written Here we cover in details some features useful in writing tests: @@ -826,13 +938,15 @@ =head1 When Tests Should Be Written + +=over -=head2 New feature is Added +=item * A New feature is Added Every time a new feature is added new tests should be added to cover the new feature. -=head2 A Bug is Reported +=item * A Bug is Reported Every time a bug gets reported, before you even attempt to fix the bug, write a test that exposes the bug. This will make much easier for @@ -849,16 +963,36 @@ code that reproduces the bug, it should probably be easy to convert this code into a test. +=back + + + + +=head1 References + +=over + +=item * extreme programming methodology + +Extreme Programming: A Gentle Introduction: +. + +Extreme Programming:. + +See also other sites linked from these URLs. + +=back + =head1 Maintainers Maintainer is the person(s) you should contact with updates, corrections and patches. -Stas Bekman E<lt>stas@stason.orgE<gt> +Stas Bekman E<lt>stas (at) stason.orgE<gt> =head1 Authors -Stas Bekman E<lt>stas@stason.orgE<gt> +Stas Bekman E<lt>stas (at) stason.orgE<gt> =cut --------------------------------------------------------------------- To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org For additional commands, e-mail: docs-cvs-help@perl.apache.org
http://mail-archives.apache.org/mod_mbox/perl-docs-cvs/200110.mbox/%3C20011006140321.97349.qmail@icarus.apache.org%3E
CC-MAIN-2014-23
refinedweb
4,249
63.59
String.Concat Method (Object[]) SystemSystem Assembly: mscorlib (in mscorlib.dll) Parameters - args - Type:, Object), The following example demonstrates the use of the Concat method with an Object array. using System; public class ConcatTest { public static void Main() { // Create a group of objects. Test1 t1 = new Test1(); Test2 t2 = new Test2(); int i = 16; string s = "Demonstration"; // Place the objects in an array. object [] o = { t1, i, t2, s }; // Concatenate the objects together as a string. To do this, // the ToString method of each of the objects is called. Console.WriteLine(string.Concat(o)); } } // Create two empty test classes. class Test1 { } class Test2 { } // The example displays the following output: // Test116Test2Demonstration.
https://msdn.microsoft.com/library/windows/apps/k9c94ey1(v=vs.100).aspx
CC-MAIN-2017-34
refinedweb
109
58.38
Writing CSS is easy. Making it scalable and maintainable is not. How many times: - did you update the CSS of your application and you broke something else? - did you wonder where the CSS you have to change is coming from? - did you update some HTML and it broke your design? - did you write some CSS and wonder why it wasn’t applied to then discover it was overridden by some other CSS? This is when you decide there is a better way and come across some CSS methodologies, which seems like a good solution to all those headaches. You heard of SMACSS, BEM, OOCSS, but at the end of the day, it’s all about what fits your projects. Also, you may think you’re perfectly fine without them and you may be right. But you might be missing out on big improvements too. You should at least have an idea on what’s out there and why you or you’re not using it. So what should you use? First, what is the issue you are trying to solve? Why are you looking into this? - Prevent your CSS to break each time you touch something? - Finding CSS you want to change easily? - Working better as a team? - Write less to do more? It’s all about maintainability and reusability. Now how do you get there? When eating an elephant take one bite at a time. - Creighton Abrams Same apply here. Applying a modular approach to your CSS will save you hours. Web components are the future of the web and starting now will make your life easier. Each piece of your app/design helps you build the final results and you should be able to move or replace it without breaking anything else. This is the goal most CSS methodologies aim for. How to choose what fits your needs? SMACSS: CSS organisation and architecture The theory SMACSS stands for Scalable and Modular Architecture CSS. According to it’s author Jonathan Snook, this is a style guide rather than a rigid spec or framework. SMACSS is about organising your CSS in 5 rules: Base This include selector rules. No classes or id here. This is to reset browser rules and set a base style for elements which are going to be consistent and reused. You are defining here the default style for your elements. This can include html, body, h1, h2, h3, h4, h5, h6, img, a… Layout This is where the style used to lay out your pages will sit. It should be separated to your module style for flexibility. You want to be able to use your layout style to build your pages in the most flexible way possible. A module or components should be added to any place in your site independent from the layout. Using classes instead of id allow you to reuse those layout style anywhere and lower your CSS specificity, making it easier to control. Modules A module is a part or a component of your page. Your menu, dialog box, download list or any widget you have on your page. It depends of your design. A module is independent from your layout so it can live anywhere in you app. You should be able to copy/paste the html and move somewhere else, and it will look and behave the same. A module should be encapsulated in one file and easily accessible. It will be easy to find and you’ll be in control of what you want to update as it won’t be depending on any other style. That’s your single source of truth for a feature. States A state will be a style which modifies or overrides other rules. A great example is accordion when collapsing or expanding elements. Using a is-collapsed class will make sure your element is collapsed. This is a good place to use !important (and probably the only one) as you want this state to be applied no matter what. Also, it can relate to modified state with javascript. Good practise is to prefix or add a namespace to those states classes like is- or has-: is-hidden, is-displayed, is-collapsed, has-children, etc Theme Idea is to have a file called theme.css where you can define all the theme rules. // box.scss .box { border: 1px solid; } // theme.scss .box { border-color: red; } In practise The first time I read about SMACSS, I found it great but a bit hard to know how to implement it. My approach was mainly through my file architecture. I tend to have the following directories and file structure: / **global** \_base.scss // Base rules \_settings.scss \_states.scss // generic state rules … / **layout** \_grid.scss … / **modules** \_card.scss \_menu.scss … As you can see, I have all the layers except the theme one, as I never really needed it. Perks : ✓ Modular ✓ Flexible ✓ File organisation ✓ States are great reusable classes. Cons : - Can be hard to put in practise. - No class name convention, modules and submodules can be hard to identify BEM: naming convention The theory BEM stands for Block Element Modifier. It’s a naming convention and it works really well with modular CSS. A block is a module or a component, however you prefer to call it. This is a piece of your design you encapsulate to reuse it anywhere on your site. **// Block** .button {} **// Element** .button\_\_icon {} .button\_\_text {} **// Modifier** .button — red {} .button-blue {} In practise BEM is great for flexibility. I personally use the SMACSS appellation: module. Therefore, a block is a module. I have a different file per module and BEM allow me to encapsulate those modules perfectly. When reading the HTML, I know exactly what is part of the module or not and I don’t need to nest my CSS, which means less specificity and then less headaches. Full example // Without BEM .nav ul .item { color: black; float: left; } // With BEM .nav\_\_item { color: black; float: left; } Perks : ✓ Modular ✓ Flexible ✓ Easy to maintain ✓ Write less CSS ✓ Be in control of your CSS Cons : - Long HTML classes - Verbose OOCSS: Object Oriented CSS In theory OOCSS stands for Object Oriented CSS, and the purpose is to encourage code reusability and ease maintainability. To do so, OOCSS is based on two principles: Separate structure from skin All your elements have some kind of branding, right? Colours, background, borders. Also, they do have a structure which you may sometimes repeat between those elements. A good example can be a button again. Before you may have had: .button { display: inline-box; width: 200px; height: 50px; color: white; background: black; } .box .button { color: black; background: red; } Now with OOCSS: .button { width: 200px; height: 50px; } .button-default { color: white; background: black; } .button-red { color: black; background: red; } You can see the point. Now you can reuse your CSS for every button and make it less specific. Separation of containers and content This is to separate your style from it’s content. You can have a side menu and a box in you main content that applies style to some paragraph. .sidemenu p { } .box p { } This ties your HTML and CSS together forever and apply the same style to all p tag in those elements. This may not be what you want. Also, if you need the same style in your article content for example, you will repeat it again. Instead, create a new style for this paragraph which you can reuse at any time. Like BEM, OOCSS avoid specificity through nesting and using ids. It also allows you to apply separation of concerns really easily. In practise I didn’t use OOCSS much until recently. I suppose I kind of did by separating colour modules using BEM modifier but I never did it at a large scale. I found the concept really interesting and start seeing a use in my current company. We have a product which have 3 different skins available on 3 different url. We have the same modules used on most of the 3 websites but with a different branding. We created objects we reuse on those website and we have modules defining the branding for each websites. Perks : ✓ High reusability ✓ Ease of maintainability Cons : - Can be confusing for new developers. What is an object and what is not? This will force you to document things and introduce new dev to your codebase (which is good to do). ITCSS: CSS organisation to avoid high specificity The theory ITCSS stands for Inverted Triangle CSS. This is a way to organise your CSS according the specificity of your CSS rules. - Settings : variables, mixins, anything you set to use as setting or functions - Tools : external includes - Generic: reset/normalize rules - Elements : elements base style - Objects : Object and structure style - Components : Modules styles - Trumps : utilities, grid, states This goes from the less specific rules to the most specific one. This will allow you to take back control of your style. I am sure we all tried to style an element and adding a rule to find out it doesn’t work because of more specific rule was defined above in your stylesheet. Controlling your style specificity will save you hours of debugging and hating your colleagues. In practise /\* === SETTINGS === \*/ @import “global/site-settings”; @import “global/mixins”; @import “global/typography”; /\* === TOOLS === \*/ @import “libs/material-icons”; /\* === GENERIC === \*/ @import “global/normalize”; /\* === ELEMENTS === \*/ @import “global/base”; /\* == Modules === \*/ // Module example @import “modules/icon”; @import “modules/header”; @import “modules/footer”; @import “modules/form”; @import “modules/buttons”; @import “modules/menu”; @import “modules/form”; @import “modules/logo”; /\* == Trumps === \*/ @import “layout/grid”; @import “global/states”; @import “global/utilities”; Perks : ✓ Lower CSS specificity ✓ Clear organisation Cons : - It can be hard to decide what goes into which categories for juniors but this is somethings that can be really clear to more intermediate and senior in my opinion, who should help others. In a nutshell We are all aware of it, CSS can turn pretty bad because of it’s own nature. At the end of the day, it’s about what you need and what makes sense to you. But if you work a large scalable project, what you want is to: - Control your specificity - Be modular and create reusable style - Ease maintenance - Work better as a team - Write less to achieve more All the above can help you do that in their own way. I personally think they work best mixed to fit my needs depending on what makes sense for the project I work on. I keep an open approach rather than “this is what you need to use cause it’s trendy”. Whats works best for you? What have you been using on your projects? Any other methodologies? Discussion (0)
https://practicaldev-herokuapp-com.global.ssl.fastly.net/digitaledawn/css-lost-in-methodologies-mng
CC-MAIN-2021-49
refinedweb
1,784
73.78
Tune to it in the future. My favorite testing framework for Java (and Groovy) is Spock. However, its mocks are not suitable for some purpose and I still use Mockito in various places. In addition, I still conduct a lot of my testing training in a JUnit/Mockito/AssertJ variant for teams which already have a test suite in that stack and would like to improve their skills without changing the known technology. Therefore, as an interlude, this blog post about testing in the pure Java style and propose how to tune up your JUnit testing framework assuming that you are already using Mockito and AssertJ (you should give them a try in the other case). This blog post consists of tree parts. Firstly, I propose a BDD-style section-based test structure to keep your test more consist and more readable. Next, I explain how simplify – using the AssertJ and Mockito – constructions with Java 8. Last, but not least, I show how to configure it in IntelliJ IDEA as a default JUnit test (class) template (which isn’t as trivial as it should). Part 1. BDD-style sections Well written unit tests should meet several requirements (but it is a topic for a separate post). One of the useful practices is a clear separation into 3 code blocks with precisely defined responsibility. You can read more on that topic in my previous blog post. As a repetition just the core rules presented in a short form: given– an object under test initialization + stubs/mocks creation, stubbing and injection when– an operation to test in a given test then– received result assertion + mocks verification (if needed) @Test public void shouldXXX() { //given ... //when ... //then ... } That separation helps to keep tests short and focused on just one responsibility to test (in the end it’s just an unit test). In Spock those sections are mandatory (*) – without them a test will not even compile. In JUnit there are just comments. However, having them in place encourage people to use them instead of having one big block of mess inside (especially useful for newbies in a testing area). Btw, the mentioned given-when-then convention is based on (is a subset of) a much wider Behavior-Driven Development concept. You may encounter a similar division on 3 code blocks named arrange-act-assert which in general is an equivalent. Part 2. Java 8 for AssertJ and Mockito One of the features of Java 8 is an ability to put default methods in an interface. That can be used to simplify of calling static methods which is prevalent in the testing frameworks such as AssertJ and Mockito. The idea is simple. A test class willing to use a given framework can implement a dedicated interface to “see” those methods as its own methods on code completion in an IDE (instead of static methods from external class which require giving a class name before or a static import). Under the hood those default methods just delegate execution to static methods. You can read more about it in my other blog post. AssertJ natively supports those construction starting with version 3.0.0. Mockito 1.10 and 2.x are Java 6 compatible and therefore it is required to use a 3rd-party project – mockito-java8 (which should be integrated into Mockito 3 – once available). To benefit from easier method completion in Idea it is enough to implement two interfaces: import info.solidsoft.mockito.java8.api.WithBDDMockito; import org.assertj.core.api.WithAssertions; class SampleTest implements WithAssertions, WithBDDMockito { } Part 3. Default template in Idea I’m a big enthusiast of omnipresent automation. Wouldn’t it be good to have both given-when-then sections and extra interfaces automatically in place in your test classes? Let’s eliminate those boring things from our life. Test method Changing a JUnit test method is easy. One of the possible ways is “CTRL-SHIFT-A -> File Template -> Code” and a modification of JUnit4 Test Method to: @org.junit.Test public void should${NAME}() { //given ${BODY} //when //then } To add a new test in an existing test class just press ALT-INSERT and select (or type) JUnit4 Test Method. Test class With the whole test class the situation is a little bit more complicated. Idea provides a way to edit existing templates, however, it is used only if a test is generated with CTRL-SHIFT-T from a production class. It’s not very handy with TDD where a test should be created first. It would be good to have a new position “New JUnit test class” next to “Java class” displayed if ALT-INSERT is pressed being in a package view in a test context. Unfortunately, to do that a new plugin would need to be written (a sample implementation for Spock). As a workaround we can define a regular file template which (as a limitation) will be accessible everywhere (e.g. even in a resource directory). Do “CTRL-SHIFT-A -> File Template -> Files”, press INSERT, name template “JUnit with AssertJ and Mockito Test”, set extension to “java” and paste the following template: package ${PACKAGE_NAME}; import info.solidsoft.mockito.java8.api.WithBDDMockito; import org.assertj.core.api.WithAssertions; #parse("File Header.java") public class ${NAME} implements WithAssertions, WithBDDMockito { } Showcase We are already set. Let’s check how it can look in practice (click to enlarge the animation). Summary I hope I convinced you to tune your test template to improve readability of your tests and to safe several keystrokes per test. In that case, please spend 4 minutes right now to configure it in your Idea. Depending on a number of tests written it may start to pay off sooner than you expect :). Btw, at the beginning of October I will be giving a presentation about new features in Mockito 2 at JDD in Kraków. Self promotion. Would you like to improve your and your team testing skills and knowledge of Spock/JUnit/Mockito/AssertJ quickly and efficiently? I conduct a condensed (unit) testing training which you may find useful.
https://solidsoft.wordpress.com/tag/bdd/
CC-MAIN-2018-17
refinedweb
1,009
54.02
On Fri, 2006-09-15 at 21:44 +0200, Niklaus Giger wrote: > Hi > > First I was surprised that a lot of vxworks return -1 unless > running inside a thread created by taskSpawn, e.g. taskIdSelf > or taskMCreate return -1. Advertising You likely have obtained those results on top of the direct syscall interface (i.e. your application being linked against libvxworks.so, and the latter sending real VxWorks syscalls to the kernel module xeno_vxworks.ko). This kind of interface is about to replace the UVM support (available from libvxworks_uvm.so) for all skins in next releases. In that case, the VxWorks services in question bail out because the main() context is NOT a real-time one, and thus return ERROR (-1), and since VxWorks has no conventional return code for "wrong calling context", the VxWorks skin simply sets errnoOfTask to -EPERM (-1), which is consistent with all other Xenomai APIs. When running over the UVM or the simulator, root_thread_init() is actually a real-time context, and the calls succeed. Maybe the example is misleading in that respect; the patch below makes the behaviour constant among all environments: --- satch.c (revision 1634) +++ satch.c (working copy) @@ -1,7 +1,7 @@ /* * Copyright (C) 2001,2002,2003 Philippe Gerum <[EMAIL PROTECTED]>. * - * pSOS and pSOS+ are registered trademarks of Wind River Systems, Inc. + * VxWorks is a registered trademark of Wind River Systems, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -20,6 +20,9 @@ #include <vxworks/vxworks.h> +#define ROOT_TASK_PRI 100 +#define ROOT_STACK_SIZE 16*1024 + #define CONSUMER_TASK_PRI 115 #define CONSUMER_STACK_SIZE 24*1024 @@ -45,17 +48,22 @@ int main (int argc, char *argv[]) { - int err; + int tid; mlockall(MCL_CURRENT|MCL_FUTURE); atexit(&root_thread_exit); - err = root_thread_init(); - if (!err) + tid = taskSpawn("RootTask", + ROOT_TASK_PRI, + 0, + ROOT_STACK_SIZE, + (FUNCPTR)&root_thread_init, + 0,0,0,0,0,0,0,0,0,0); + if (tid) pause(); - return err; + return 1; } #endif /* Native, user-space execution */ -- Philippe. _______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org
https://www.mail-archive.com/xenomai-core@gna.org/msg03403.html
CC-MAIN-2018-13
refinedweb
337
54.93
Hello everyone! I've read a lot of articles on DaniWeb and I've decided to join your community! I have a university project to make a bank account system, which consists of at least 10 account classes, and 3 of them inherit from at least 2 other. The system has 1 base account "Account" and all other classes inherit from it. I'd like to share with you guys my progress and if anyone has any suggestions, please do post and let me know... So far, my ideas are of classes - Account, SavingsAccount, Salary account, CardAccount, NetworkAccount, SharedAccount(so multiple people can withdraw money) ... and I am out of account ideas for now! If you have any let me know :) I've just started and I have the Account class defined as follows Account.h #include <iostream> #include "string" using namespace std; #ifndef ACCOUNT_H #define ACCOUNT_H class Account { public: Account(); int deposit(int); int withdraw(int); void account_balance()const; private: float balance; }; #endif Account.cpp #include "Account.h" #include <iostream> using namespace std; Account::Account() {balance = 0.0;} int Account::deposit(int amount){ balance += amount; return balance; } int Account::withdraw(int amount){ balance -= amount; return balance; } void Account::account_balance()const{ cout<<balance; } And I have a main to test the account class main.cpp #include <iostream> #include "Account.h" using namespace std; int main() { Account *acc; acc = new Account; acc->deposit(23); acc->account_balance(); cout<<endl; acc->withdraw(12); acc->account_balance(); return 0; } I am wondering now if I need an interest method, to calculate different interest for different accounts? I will put the implementation of the other classes as soon as possible! I hope if I get into a trouble with inheritance someone will be able to help me out :)
https://www.daniweb.com/programming/software-development/threads/469299/bank-account-system
CC-MAIN-2017-17
refinedweb
292
53.71
I am trying out something new and I am wondering if this is valid and is not working because of some other code glitch. Graphics class: import java.awt.*; import javax.swing.JPanel; public class Drawing extends JPanel{ KeyCommands kc = new KeyCommands (); public void startGraphics (){ System.out.println ("Adding KeyListener"); addKeyListener (kc); System.out.println ("Taking Focus"); requestFocus(); repaint(); } public void paintComponent (Graphics g){ super.paintComponents(g); g.fillRect(15,40, 40, 40); } } KeyListener portion import java.awt.event.*; public class KeyCommands implements KeyListener{ CharacterAnimation charAnimate = new CharacterAnimation (); Frame frame; String direction; public void setUpWindow(Frame f){ frame = f; System.out.println ("Frame Set up"); } public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub int key = e.getKeyCode(); System.out.println ("Key Pressed"); if (key == KeyEvent.VK_UP){ direction = "UP"; } else if (key == KeyEvent.VK_DOWN){ direction = "DOWN"; } else if (key == KeyEvent.VK_LEFT){ direction = "LEFT"; } else if (key == KeyEvent.VK_RIGHT){ direction = "RIGHT"; } else if (key == KeyEvent.VK_ESCAPE){ System.out.println ("Escape Pressed"); frame.closeWindow(); } } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } } I am trying to separate the KeyListener from the drawing class. Then I want to add the KeyListener class to the drawing class, so they act like one code, but they are separate. I am assuming that when I add it and the drawing class has focus and I press a button it will realize that it is a key event and then go to the KeyCommands class to see what it needs to do. I ran into this problem when I tried closing the window with escape. That is why only that one like has a println. Thanks for any help.
https://www.daniweb.com/programming/software-development/threads/384910/separate-keylistener
CC-MAIN-2017-26
refinedweb
287
58.58
Decimal the d parameter. method, which supports rounding toward negative infinity. The following example illustrates the Ceiling method and contrasts it with the Floor method. using System; public class Example { public static void Main() { decimal[] values = {12.6m, 12.1m, 9.5m, 8.16m, .1m, -.1m, -1.1m, -1.9m, -3.9m}; Console.WriteLine("{0,-8} {1,10} {2,10}\n", "Value", "Ceiling", "Floor"); foreach (decimal value in values) Console.WriteLine("{0,-8} {1,10} {2,10}", value, Decimal.Ceiling(value), Decimal.Floor(value)); } } // The example displays the following output: // Value Ceiling Floor // // 12.6 13 12 // 12.1 13 12 // 9.5 10 9 // 8.16 9 8 // 0.1 1 0 // -0.1 0 -1 // -1.1 -1 -2 // -1.9 -1 -2 // -3.9 -3 -4 Available since 8 .NET Framework Available since 2.0 Portable Class Library Supported in: portable .NET platforms Silverlight Available since 2.0 Windows Phone Silverlight Available since 7.0 Windows Phone Available since 8.1
https://msdn.microsoft.com/en-us/library/system.decimal.ceiling(v=vs.110).aspx
CC-MAIN-2016-44
refinedweb
164
65.28
The Dice Roll Simulation can be done by choosing a random integer between 1 and 6 for which we can use the random module in the Python programming language. In this article, I will take you through how to create a Dice Roll Simulator with Python. Dice Roll Simulator with Python To simulate a dice roll with Python, I’ll be using the random module in Python. The random module can be imported easily into your code as it is preinstalled in the Python programming language. Also, Read – 100+ Machine Learning Projects Solved and Explained. After importing the random module, you have access to all the functions included in the module. It’s a pretty long list, but for our purposes, we’ll use the random.randint() function. This function returns a random integer based on the start and end we specify. The smallest value of a dice roll is 1 and the largest is 6, this logic can be used to simulate a dice roll. This gives us the start and end values to use in our random.randint() function. Now let’s see how to simulate a dice roll with Python: Rolling The Dices… The Values are : 5 4 Roll the Dices Again?yes Rolling The Dices… The Values are : 1 3 This is a good task for someone beginner in Python to start with. These type of programs helps you to think logically and in the long run, it can also help you to create algorithms. I hope you liked this article on how to create a dice roll simulator with Python. Feel free to ask your valuable questions in the comments section below. 3 Comments the rolling is going forward how to stop the rolling. is there any idea to stop by giving ‘no’ because in jupyter the kernal is getting bisy Hi Aman this is my code import random import time while True: dice_rolled = random.randint(1, 6) user = str(input(” ‘C’ for Continue or ‘Q’ for Quit : “).upper()) if user == ‘C’: print(‘Dice rolling …’) time.sleep(2) print(dice_rolled) print(‘—————————————-‘) else: break Great
https://thecleverprogrammer.com/2021/01/10/dice-roll-simulator-with-python/
CC-MAIN-2021-43
refinedweb
349
71.34
The sample service in this chapter will check Web sites for you to be sure they are serving pages. It will make extensive use of a configuration file, because it has no user interface. The configuration file will control The URLs to check An email address to notify if a site is down How often to check The service will check the URLs when it starts, and then sleep for the specified period of time. If any URL doesn't respond, an email will be sent and an entry will be added to the event log. Email and event logs are excellent ways for applications without a user interface to notify an administrator of problems that need intervention. Start by creating the project. Create a Windows Service (.NET) project called URLChecker . Because a service doesn't have a user interface, the view that opens (of your user interface) is not very useful. Click the link to switch to code view. A class has been generated, called URLCheckerWinService , which inherits from ServiceBase in the System::ServiceProcess namespace. This class has two useful methods : OnStart() and OnStop() . You add code to these methods to actually implement the service. Services that react to events thrown by others don't need a loop construct; the OnStart adds the service to the list of listeners for a particular event and then you write the corresponding event handler. This chapter's service, however, will use a loop. The OnStart() method creates a new thread which loops until a control variable makes it stop. It has to loop in a separate thread so that OnStart() can return control to the code that called it. Add these private variables to the class, just before the definition of OnStart() : private: bool stopping; int loopsleep; //milliseconds Thread* servicethread; Add a function to the class: void CheckURLs() { loopsleep = 1000; //milliseconds stopping = false; while (!stopping) { Threading::Thread::Sleep(loopsleep); } } This is the function the thread will call. It loops until it is told to stop, through the control variable stopping . This function is just a skeleton to begin with and will expand later in this chapter. Add code to OnStart() and remove the TODO comment, so that it reads like this: void OnStart(String* args[]) { Threading::ThreadStart* threadStart = new Threading::ThreadStart(this,CheckURLs); servicethread = new Threading::Thread(threadStart); servicethread->Start(); } This code uses a helper class called ThreadStart to hold the delegate representing CheckURLs . The ThreadStart object is passed to the constructor of a Thread() object, and finally OnStart() starts the thread. This kicks off the loop. To be sure that the loop will stop, implement OnStop() as follows : void OnStop() { stopping = true; } Although this service doesn't do anything yet, it can be installed, started, and stopped . Switch back to the empty design view of your service, right-click the background, and choose Properties. Change the name for URLCheckerWinService to URLChecker . Then right-click the background again and choose Add Installer. A new file is created and opened in design view, showing a service process installer and a service installer.. Changing the Account property to LocalSystem will run the service as a privileged account. Use this only if you need it; LocalService is a less-privileged choice for services that don't need to pass credentials to another machine, and Network Service is another nonprivileged account that can authenticate to another machine. Although this service contacts other machines, it doesn't need to authenticate, so LocalService is a good choice if you are installing the service on a Windows 2003 machine. To support a variety of operating systems, use the older LocalSystem account. The service installer is used to control the way the service runs, and you have three choices: Manual, Automatic, and Disabled. An Automatic service starts whenever the machine is restarted. A Manual service can be started on request. A Disabled service cannot be started. A user can change the startup type with Computer Management or Server Explorer, but other code cannot start the service. Leave this property set to Manual. In order to test the service, you must install it. Services written in Visual Basic or C# can be installed using a utility called installutil.exe, but this utility has trouble loading C++ assemblies. The wizard generates a main() function for this service that you can use to install the service. Open a command prompt and change directories to the Debug folder beneath the project folder. Make sure you have built the project, and then execute its main function like this: urlchecker.exe Install Expand the Services node in Server Explorer and scroll down to the bottom, where you should see URLChecker preceded by a symbol made from a gear wheel and a small red square. Right-click it and choose Start. After a small delay, the red square becomes a green triangle. Right-click it again and choose Stop. You have demonstrated that your service can be installed successfully, and can process both Start and Stop commands without errors. Now it's time to add code so that the service does something useful. Once the service is installed, you don't need to reinstall it or update or refresh anything when you make changes to your code. Just stop the service in Server Explorer, change your code, build the project, and start the service again. Your new code will execute. (If you forget to stop the service before building, you'll get a fatal link error because the linker will be unable to open your .EXE file.) To change the service so that it checks URLs, first add a configuration file to the project. Configuration files are discussed in Chapter 11, "Writing a Data Layer in Managed C++," where a configuration file holds a connection string for database access. Right-click the project in Solution Explorer, and choose Add, Add New Item. Select a Configuration File and click Open. Enter XML so that the configuration file reads like this: <configuration> <appSettings> <add key="urls" value="" /> <add key="email" value="you@yourdomain.com" /> <add key="minutesinterval" value="2" /> </appSettings> </configuration> Make sure you change the email address to one that will reach you. If you want, add some more URLs. Leave a space between each URL, and don't forget to include the http:// specifier . Add a postbuild step, as first discussed in Chapter 11, to copy the configuration file to the output directory. The command line should read like this: copy app.config $(ConfigurationName)$(TargetFileName).config Add this code at the beginning of CheckURLs() , just before the loop: //get config info from file String* URLString = Configuration::ConfigurationSettings::AppSettings->get_Item("urls"); String* delims = S" "; Char delimiter[] = delims->ToCharArray(); URLs = URLString->Split(delimiter); email = Configuration::ConfigurationSettings::AppSettings->get_Item("email"); interval = Configuration::ConfigurationSettings::AppSettings-> get_Item("minutesinterval")->ToInt16(NULL); //set lastrun to force an immediate check lastrun = DateTime::Now - TimeSpan(0,interval+1,0); //hours, minutes, seconds This code could go in the OnStart() method, but you can't debug a service until it is started, so you want as little code as possible in OnStart() . Because this code is before the loop, it will only execute once anyway. This code retrieves the list of URLs from the configuration file and uses Split() to separate it at spaces. It also retrieves the email address and the interval at which the URLs should be checked. You might be tempted to change the Sleep() call at the bottom of the loop to sleep for however many minutes the configuration file requested , but that will leave your service unable to respond to stop requests until it wakes up. An unresponsive service can interfere with shutdown and other system processes. It's better to leave the loopsleep value at one second, and use a saved time to track when URLs were last checked. This variable, called lastrun in this sample, starts at a value small enough to ensure the URL checking will happen immediately when the service starts running. The calculation uses the TimeSpan helper class, which simplifies date and time arithmetic significantly. Add these member variables to the class: DateTime lastrun; String* URLs[]; String* email; int interval; //minutes Change CheckURLs() to use the information from the configuration file and attempt to retrieve information from each URL in turn . Edit the body of the loop so that it reads like this: if (DateTime::Now > lastrun + TimeSpan(0,interval,0)) { lastrun = DateTime::Now; for (int i = 0; i < URLs->Length; i++) { try { Net::WebRequest* req = Net::WebRequest::Create(URLs[i]); req->Method = "HEAD"; Net::WebResponse* resp = req->GetResponse(); } catch (...) { //couldn't reach server - notify someone } } } Threading::Thread::Sleep(loopsleep); This code determines whether it's time to check URLs, and if it is, it sets lastrun and then goes through all the URLs in the array. Notice that the array, declared with square brackets just like an old-style C++ array, has a property called Length that can be used to set up this loop. The WebRequest class is used to get the headers only by setting the Method to HEAD . This saves time, because there's no need to read the entire page returned from the server; you just want to confirm there's a page to return. If this service was a link-checker, it might be interested in whether the Web server returned a page for that URL, or a 404 error, or some other kind of response. But this service is simply confirming that the server exists and responds. If the server doesn't exist, the GetResponse() method throws an exception, which this code catches and uses as the trigger to notify the administrator that one of the monitored Web sites is down. The SmtpMail class in the System::Web::Mail namespace represents a mail message. The simplest way to use it is with the static Send() method, which takes four string parameters: The email address from which the message will appear to come The email address to which the message will be sent The subject line for the message The body of the message Add a reference to System.Web.dll and then edit the catch block in CheckURLs to read as follows: catch (Exception* e) { Text::StringBuilder* body = new Text::StringBuilder(S""); body->Append(S"URLChecker could not reach "); body->Append(URLs[i]); body->Append(Environment::NewLine); body->Append(e->ToString()); Web::Mail::SmtpMail::Send(S"urlchecker@yourdomain.com", email, S"URL Checker failure report", body->ToString()); } If there is no SMTP server running on your machine, set the shared Web::Mail::SmtpMail::SmtpServer property to the IP address or fully qualified name of your mail server, such as mail.yourdomain.com , before calling Send() . Also, make sure you change the From address to your own domain when you edit this code. You can test this service now. Simply edit the configuration file so that it contains at least one URL that will not return a page. For example, if there's a computer on your network that does not have a Web server installed, use that computer's IP address. If you plan to try making up a domain name, check in a browser first to see whether there is a server at that domain or not. Stop the service, rebuild the solution (so as to trigger the post build step that copies the configuration file), and start the service. Wait for at least as long as your interval time, and then check your mail. You should receive a message that reads like this (with a different URL): [View full width] URLChecker could not reach URLChecker.URLCheckerWinService.CheckURLs() in e:\urlchecker\urlcheckerwinservice.h :line 94 Stop the service, or you'll continue to get email every few minutes. Sending email is one way a service can notify the administrator of a problem. The Event Log is another way. Because it's easy to use, and works even when your Internet connection cuts you off from your email, why not add event logging to URLChecker ? Before the loop in CheckURLs() , add these lines: Diagnostics::EventLog* log; if (! Diagnostics::EventLog::SourceExists("URLCheckerService") ) Diagnostics::EventLog::CreateEventSource("URLCheckerService", "URLCheckerLog"); log = new Diagnostics::EventLog("URLCheckerLog"); log->Source = "URLCheckerService"; This sets up an event source called URLCheckerService and a custom event log called URLCheckerLog . It then creates a EventLog object that can write to URLCheckerLog and sets the source to URLCheckerService . Add this line at the end of the catch block, after the lines that send the email: log->WriteEntry(body->ToString(),Diagnostics::EventLogEntryType::Error); That's all it takes to add event logging to your service! Stop the service, build it, and start it again. Wait for the email to reach you, and then scroll up in Server Explorer to the EventLogs node. Expand it, and then expand URLCheckerLog (the log name) beneath it, and finally URLCheckerService (the source name) beneath that. You see at least one error entry, identified with an X on a red background as in Figure 12.3. The Server Explorer only shows the first few characters of the log entry. To see the whole entry, use the Event Log section under Computer Management. You might have to close and re-open Computer Management to refresh the list of Event Logs. Expand Event Viewer, and then select URLCheckerLog . You will see the log entries: Double-click one for the details, as in Figure 12.4.
https://flylib.com/books/en/1.37.1.94/1/
CC-MAIN-2021-04
refinedweb
2,225
61.46
Computational Methods for Database Repair by Signed Formulae - Felix Patterson - 2 years ago - Views: Transcription 1 Computational Methods for Database Repair by Signed Formulae Ofer Arieli Department of Computer Science, The Academic College of Tel-Aviv, 4 Antokolski street, Tel-Aviv 61161, Israel. Marc Denecker, Bert Van Nuffelen and Maurice Bruynooghe Department of Computer Science, Katholieke Universiteit Leuven, Celestijnenlaan 200A, B-3001 Heverlee, Belgium. Abstract. We introduce a simple and practical method for repairing inconsistent databases. Given a possibly inconsistent database, the idea is to properly represent the underlying problem, i.e., to describe the possible ways of restoring its consistency. We do so by what we call signed formulae, and show how the signed theory that is obtained can be used by a variety of off-the-shelf computational models in order to compute the corresponding solutions, i.e., consistent repairs of the database. 1. Introduction Reasoning with inconsistent databases has been extensively studied in the last few years, especially in the context of integration of (possibly contradicting) independent data sources. The ability to synthesize distributed data sources into a single coherent set of information is a major challenge in the construction of knowledge systems for data sharing, and in many cases this property enables inference of information that cannot be drawn otherwise. If, for instance, one source knows that either a or b must hold (but it doesn t know which one is true), and another source knows a (i.e., that a cannot be true), then a mediator system may learn a new fact, b, that is not known to either sources. There is another scenario, however, in which one of the sources also knows b. In this case, not only that the mediator system cannot consistently conclude b, but moreover, in order to maintain consistency it cannot accept the collective information of the sources! In particular, the consistency of each data source is not a sufficient condition for the consistency of their collective information, which again implies that maintaining consistency is a fundamental ability of database merging This paper is a revised and extended version of [9]. c 2005 Kluwer Academic Publishers. Printed in the Netherlands. f_amai04.tex; 10/01/2005; 15:11; p.1 2 2 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe systems. 1 The management of inconsistency in database systems requires dealing with many aspects. At the representation level, for instance, systems that keep their data consistent (in contrast to systems that are paraconsistent, that is: preserve the inconsistency and yet draw consistent conclusions out of it) should be able to express how to keep the data coherent. This, of course, carries on to the reasoning level and to the implementation level, where algorithms for consistency restoration should be developed and supported by corresponding computational models. In this paper we introduce a novel approach to database repair that touches upon all the aspects mentioned above: we consider a uniform representation of repairs of inconsistent relational databases, that is, a general description of how to restore the consistency of database instances that do not satisfy a given set of integrity constraints. In our approach, a given repair problem is defined by a theory that consists of what we call signed formulae. This is a very simple but nevertheless general way of representing the underlying problem, which can be used by a variety of off-the-shelf computational systems. We show that out of the signed theories, these systems efficiently solve the problem by computing database repairs, i.e., new consistent database instances that differ from the original database instance by a minimal set of changes (with respect to set inclusion or set cardinality). Here we apply two types of tools for repairing a database: We show that the problem of finding repairs with minimal cardinality for a given database can be converted to the problem of finding minimal Herbrand models for the corresponding signed theory. Thus, once the process for consistency restoration of the database has been represented by a signed theory (using a polynomial transformation), tools for minimal model computations (such as the Sicstus Prolog constraint solver [23], the satisfiability solver zchaff [50], and the answer set programming solver DLV [31]) can be used to efficiently find the required repairs. For finding repairs that are minimal with respect to set inclusion, satisfiability solvers of appropriate quantified Boolean formulae (QBF) can be utilized. Again, we provide a polynomial-time transformation to (signed) QBF theories, and show how QBF solvers (e.g., those of [12, 22, 30, 32, 35, 41, 54]) can be used to restore the database consistency. 1 See., e.g., [4, 10, 11, 17, 18, 25, 27, 37, 36, 45] for more details on reasoning with inconsistent databases and further references to related works. f_amai04.tex; 10/01/2005; 15:11; p.2 3 Computational methods for database repair by signed formulae 3 The rest of the paper is organized as follows: In Section 2 we discuss various representation issues that are related to database repair. We formally define the underlying problem in the context of propositional logic (Section 2.1), show how to represent it by signed formulae (Section 2.2), and then consider an extended framework based on first-order logic (Section 2.3). Section 3 is related to the corresponding computational and reasoning aspects. We show how constraint solvers for logic programs (Section 3.1) and quantified Boolean formulae solvers (Section 3.2) can be utilized for computing database repairs, based on the signed theories. At the end of this section we also give some relevant complexity results (Section 3.3). Section 4 is related to implementation issues. Some experimental results of several benchmarks are given and the suitability of the underlying computational models to the database repair problem is analyzed in light of the results. In Section 5 we link our approach to some related areas, such as belief revision and data merging, showing that some basic postulates of these areas are satisfied in our case as well. Finally, in Section 6 we conclude with some further remarks and observations Preliminaries 2. Database repair and its representation In this section we set-up the framework and define the database repair problem with respect to this framework. To simplify the readings we start with the propositional case, leaving the first-order case to Section 2.3. This two-phase approach may also be justified by the fact that the main contribution of this paper can be expressed already at the propositional level. Let L be a propositional language with P its underlying set of atomic propositions. A (propositional) database instance D is a finite subset of P. The semantics of a database instance is given by the conjunction of the atoms in D, augmented with the Closed World Assumption [53] (CWA(D)), stating that each atom in P that does not appear in D is false. We shall denote the (unique) model of D and CWA(D) by H D. Now, a formula ψ follows from D (or is satisfied in D; notation: D = ψ) if H D satisfies ψ. Otherwise we say that ψ is violated in D. DEFINITION 2.1. A database is a pair (D, IC), where D is a database instance, and IC the set of integrity constraints is a finite and consistent set of formulae in L. A database DB=(D, IC) is consistent f_amai04.tex; 10/01/2005; 15:11; p.3 4 4 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe if every formula in IC follows from D (notation: D = IC), that is, there is no integrity constraint that is violated in D. Given an inconsistent database, our goal is to restore its consistency, i.e., to repair the database: DEFINITION 2.2. An update of a database DB = (D, IC) is a pair (Insert, Retract), where Insert, Retract P are sets of atoms such that Insert D = and Retract D. 2 A repair of a database DB is an update (Insert, Retract) of DB, for which ((D Insert) \ Retract, IC) is a consistent database. DEFINITION 2.3. The database ((D Insert) \ Retract, IC) is called the updated database of DB=(D, IC) with update (Insert, Retract). Intuitively, a database is updated by inserting the elements of Insert and removing the elements of Retract. An update is a repair when its updated database is consistent. Note that if DB is consistent, then (, ) is a repair of DB. Definition 2.2 can easily be generalized by allowing repairs only to insert atoms belonging to some set E I, and similarly to delete only atoms of a set E R. Thus, for instance, it would be possible to forbid deletions by letting E R =. In the sequel, however, we shall always assume that any element in P may be inserted or deleted. This assumption can easily be lifted (see also footnote 3 below). EXAMPLE 2.4. Let P = {p, q} and DB = ({p}, {p q}). Clearly, this database is not consistent. It has three repairs: R 1 = ({}, {p}), R 2 = ({q}, {}), and R 3 = ({q}, {p}). These repairs correspond, respectively, to removing p from the database, inserting q to the database, and performing both actions simultaneously. As the example above shows, there are usually many ways to repair a given database, some of them may not be very natural or sensible. It is common, therefore, to specify some preference criterion on the possible repairs, and to apply only those repairs that are (most) preferred with respect to the underlying criterion. The most common criteria for preferring a repair (Insert, Retract) over a repair (Insert, Retract ) are set inclusion [4, 5, 10, 11, 17, 18, 27, 37, 36], i.e., (Insert, Retract) i (Insert, Retract ) if Insert Retract Insert Retract, 2 Note that these conditions imply that Insert and Retract must be disjoint. f_amai04.tex; 10/01/2005; 15:11; p.4 5 Computational methods for database repair by signed formulae 5 or minimal cardinality [10, 11, 25, 45], i.e., (Insert, Retract) c (Insert, Retract ) if Insert + Retract Insert + Retract (where S denotes the cardinality of the set S). Both criteria above reflect the intuitive feeling that a natural way to repair an inconsistent database should require a minimal change, therefore the repaired database is kept as close as possible to the original one. According to this view, for instance, each one of the repairs R 1 and R 2 in Example 2.4 is strictly better than R 3. Note also that (, ) is the only i -preferred and c -preferred repair of consistent databases, as expected Representation of repairs by signed formulae Let DB = (D, IC) be a fixed database that should be repaired. The goal of this section is to characterize the repair process of DB by a logical theory. A key observation in this respect is that a repair of DB boils down to switching some atoms of P from false to true or from true to false. Therefore, to encode a repair, we introduce a switching atom s p for every atom p in P. 3 A switching atom s p expresses whether the status of p switches in the repaired database with respect to the original database: s p is true when p is involved in the repair, either by removing it or inserting it, and is false otherwise (that is, s p holds iff p Insert Retract). We denote by switch(p) the set of switching atoms corresponding to the elements of P. I.e., switch(p) = {s p p P}. The truth of an atom p P in the repaired database can be easily expressed in terms of the switching atom s p of p. We define the signed literal τ p of p with respect to D as follows: τ p = { sp if p D, s p otherwise. An atom p is true in the repaired database if and only if its signed literal τ p is true. Now, as the repaired database can be expressed in terms of the switching atoms, we can also formalize the consistency of the repaired 3 In general, one can impose the requirement that inserted atoms belong to E I and deleted atoms belong to E R, by introducing switching atoms only for the atoms in (E I \ D) (E R D). An atom of this set with a truth value true encodes either an insertion of an element in E I \ D or a deletion of an element in E R D. f_amai04.tex; 10/01/2005; 15:11; p.5 6 6 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe database with respect to IC in terms of the switching atoms. This condition is expressed by the theory obtained from IC by simultaneously substituting signed literals τ p for all atoms p occurring in IC. Formally, for every formula ψ of L, its signed formula with respect to D is defined as follows: ψ = ψ [ τ p1 /p 1,..., τ pm /p m ]. As we shall show below (Theorem 2.6), repairs of DB correspond to models of IC = {ψ ψ IC}. EXAMPLE 2.5. Consider again the database DB = ({p}, {p q}) of Example 2.4. In this case τ p = s p and τ q = s q, hence the signed formula of ψ = p q is ψ = s p s q, or, equivalently, s p s q. Intuitively, this formula indicates that in order to restore the consistency of DB, at least one of p or q should be switched, i.e., either p should be removed from the database or q should be inserted to it. Indeed, the three classical models of ψ are exactly the three valuations on {s p, s q } that are associated with the three repairs of DB (see Example 2.4). As Theorem 2.6 below shows, this is not a coincidence. Next we formulate the main correctness theorems of our approach. First we express the correspondences between updates and valuations of the switching atoms. Given an update R = (Insert, Retract) of a database DB, define a valuation ν R on switch(p) as follows: ν R (s p ) = t iff p Insert Retract. ν R is called the valuation that is associated with R. Conversely, a valuation ν of switch(p) induces a database update R ν = (Insert, Retract), where Insert = {p D ν(s p ) = t} and Retract = {p D ν(s p ) = t}. Obviously, these mappings are the inverse of each other. THEOREM 2.6. For a database DB = (D, IC), let IC = {ψ ψ IC}. a) if R is a repair of DB then ν R is a model of IC, b) if ν is a model of IC then R ν is a repair of DB. Proof. For (a), suppose that R is a repair of DB = (D, IC). Then, in particular, D R = IC, where D R = (D Insert)\Retract. Let ψ IC and let H DR be the (unique) model of D R and CWA(D R ). Then H DR (ψ) = t, and so it remains to show that ν R (ψ) = H DR (ψ). The proof of this is by induction on the structure of ψ, and we show only the base step (the rest is trivial), i.e., for every atom p Dom, ν R (p) = H DR (p). Note that ν R (p) = ν R (τ p ), hence: f_amai04.tex; 10/01/2005; 15:11; p.6 7 Computational methods for database repair by signed formulae 7 if p D \Retract, then p D R, and so ν R (p) = ν R ( s p ) = ν R (s p ) = f = t = H DR (p). if p Retract, then p D \ D R, thus ν R (p) = ν R ( s p ) = ν R (s p ) = t = f = H DR (p). if p Insert, then p D R \ D, hence ν R (p) = ν R (s p ) = t = H DR (p). if p D Insert, then p D R, and so ν R (p) = ν R (s p ) = f = H DR (p). For part (b), suppose that ν is a model of IC. Let R ν = (Insert, Retract) = ({p D ν(s p ) = t}, {p D ν(s p ) = t}). We shall show that R ν is a repair of DB. According to Definition 2.2, it is obviously an update of DB. It remains to show that every ψ IC follows from D R = (D Insert) \ Retract, i.e., that H DR (ψ) = t, where H DR is the model of D R and CWA(D R ). Since ν is a model of IC, ν(ψ) = t, and so it remains to show that H DR (ψ) = ν(ψ). Again, the proof is by induction on the structure of ψ, and we show here only the base step, that is: for every atom p Dom, H DR (p) = ν(p). Again, ν R (p) = ν R (τ p ), hence if p D \ Retract, then p D R and ν(s p ) = f, thus H DR (p) = t = ν(s p ) = ν( s p ) = ν(p). if p Retract, then p D \ D R and ν(s p ) = t, hence H DR (p) = f = ν(s p ) = ν( s p ) = ν(p). if p Insert, then p D R \ D and ν(s p ) = t, therefore H DR (p) = t = ν(s p ) = ν(p). if p D Insert, then p D R and ν(s p ) = f, and so H DR (p) = f = ν(s p ) = ν(p). The second part of the above theorem implies, in particular, that in order to compute repairs for a given database DB, it is sufficient to find the models of the signed formulae that are induced by the integrity constraints of DB; the pairs that are induced by these models are the repairs of DB. We have now established a correspondence between arbitrary repairs of a database and models of the signed theory IC. It remains to show how preferred repairs according to some preference relation correspond f_amai04.tex; 10/01/2005; 15:11; p.7 8 8 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe to a specific class of models of IC. We do this for the minimal cardinality preference relation c and the set inclusion preference relation i. For any two valuations ν 1, ν 2 of switch(p), denote ν 1 c ν 2 if the number of switching atoms that are assigned the value true by ν 1 is less than those that are assigned true by ν 2. Similarly, denote ν 1 i ν 2 if the set of the true switching atoms of ν 1 is a subset of the set of the true switching atoms of ν 2. Now, the following property is straightforward: LEMMA 2.7. Let R 1, R 2 be two updates of a database (D, IC) and let ν 1, ν 2 be two models of IC = {ψ ψ IC}. Then: a) if R 1 c R 2 then ν R 1 c ν R 2 and if R 1 i R 2 then ν R 1 i ν R 2. b) if ν 1 c ν 2 then R ν 1 c R ν 2 and if ν 1 i ν 2 then R ν 1 i R ν 2. This lemma leads to the following simple characterizations of c - preferred and i -preferred models in terms of the models of IC. THEOREM 2.8. For a database DB = (D, IC) let IC = {ψ ψ IC}. Then: a) if R is a c -preferred repair of DB, then ν R is a c -minimal model of IC. b) if ν is a c -minimal model of IC, then R ν is a c -preferred repair of DB. Proof. By Theorem 2.6, the repairs of a database correspond exactly to the models of the signed theory IC. By Lemma 2.7, c -preferred repairs of DB (i.e., those with minimal cardinality) correspond to c - minimal models of IC. It follows that c -preferred repairs of a database can be computed by searching for models of IC with minimal cardinality (called c - minimal models). We shall use this fact in Section 3, where we consider computations of preferred repairs. A similar theorem holds also for i -preferred repairs: THEOREM 2.9. For a database DB = (D, IC) let IC = {ψ ψ IC}. Then: a) if R is an i -preferred repair of DB, then ν R is an i -minimal model of IC. f_amai04.tex; 10/01/2005; 15:11; p.8 9 Computational methods for database repair by signed formulae 9 b) if ν is an i -minimal model of IC, then R ν is an i -preferred repair of DB. Proof. Similar to that of Theorem 2.8, replacing c by i First-order databases We now turn to the first-order case. As we show below, using the standard technique of grounding, our method of database repairs by signed formulae may be applied in this case as well. Let L be a language of first-order formulas based on a vocabulary consisting of the predicate symbols in a fixed database schema S and a finite set Dom of constants representing the elements of some domain of discourse. In a similar way to that considered in Section 2.1, it is possible to define a database instance D as a finite set of ground atoms in L. The meaning of D is given by the conjunction of the atoms in D augmented with following three assumptions: the Domain Closure Assumption (DCA(Dom)) states that all elements of the domain of discourse are named by constants in Dom, the Unique Name Assumption (UNA(Dom)) states that different constants represent different objects, and the Closed World Assumption (CWA(D)) states that each atom which is not explicitly mentioned in D is false. These three assumptions are hard-wired in the inference mechanisms of the database and therefore are not made explicit in the integrity constraints. The meaning of a database instance under these three assumptions is formalized in a model theoretical way by the least Herbrand model semantics. The unique model of a database instance D is the least Herbrand model H D, i.e., an interpretation in which the domain is Dom, each constant symbol c Dom is interpreted by itself, each predicate symbol p S is interpreted by the set {(x 1,...,x n ) p(x 1,...,x n ) D}, and the interpretation of the equality predicate is the identity relation on Dom. As Dom may change during the lifetime of the database, it is sometimes called the active domain of the database. Again, we say that a first-order sentence ψ follows from D if the least Herbrand model of D satisfies ψ. f_amai04.tex; 10/01/2005; 15:11; p.9 10 10 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe Now, a (first-order) database is a pair (D, IC), where D is a database instance, and the set IC of integrity constraints is a finite, consistent set of first-order sentences in L. Consistency of databases is defined just as before. As in the propositional case, an inconsistent first-order database (D, IC) can be repaired by inserting or deleting atoms about elements of Dom. However, there may be also other ways of repairing a database that do not have an equivalent in the propositional case: a database may be updated by adding new elements to Dom and inserting facts about them, or deleting elements from Dom and removing from the database instance all atoms in which they occur; a database may also be updated by equalizing different elements from Dom. The following example illustrates these methods: EXAMPLE a) Let DB = ({P(a)}, { x(p(x) Q(x))}). Clearly, this database is not consistent. When Dom = {a} the actual meaning of this database is given by ({P(a)}, {P(a) Q(a)}) and it is equivalent to the database considered in Examples 2.4 and 2.5 above. As noted in those examples, the repairs in this case, R 1 = ({}, {P(a)}), R 2 = ({Q(a)}, {}), and R 3 = ({Q(a)}, {P(a)}), correspond, respectively, to removing P(a) from the database, inserting Q(a) to the database, and performing both actions simultaneously. Suppose now that the database instance is {P(a), Q(b)} and the domain of discourse is Dom = {a, b}. Then the update ({a = b}, {}) would restore consistency by equalizing a and b. Notice that this solution violates the implicit constraint UNA(Dom). b) Let DB = ( {P(a)}, { x(p(x) y(y x Q(x, y)))} ), and Dom = {a}. Again, this database is not consistent. One of the repairs of this database is R = ({Q(a, b)}, {}). It adds an element b to the domain Dom and restores the consistency of the integrity constraint, but this repair violates the implicit constraint DCA(Dom). In the context of database updating, we need the ability to change the database domain and to merge and equalize two different objects of the database. However, this paper is about repairing database inconsistencies. In this context, it is much less clear whether database repairs that f_amai04.tex; 10/01/2005; 15:11; p.10 11 Computational methods for database repair by signed formulae 11 revise the database domain (and hence violate DCA(Dom)) or revise the identity of objects (and hence violate UNA(Dom)) can be viewed as acceptable repairs. In what follows we shall not consider such repairs as legitimate ones. From now on, we assume that a repair does not contain equality atoms and consists only of atoms in L, and hence, does not force a revision of Dom. This boils down to the fact that DCA(Dom) and UNA(Dom) are considered as axioms of IC which must be preserved in all repairs. Under this assumption, it turns out to be easy to apply the propositional methods described in Section 2 on first-order databases. To do this, we use the standard process of grounding. We denote by ground(ψ) the grounding of a sentence ψ with respect to a finite domain Dom. That is, ground(ψ) = ψ if ψ is a ground atom, ground( ψ) = ground(ψ), ground(ψ 1 ψ 2 ) = ground(ψ 1 ) ground(ψ 2 ), ground(ψ 1 ψ 2 ) = ground(ψ 1 ) ground(ψ 2 ), ground( x ψ(x)) = a Dom ψ[a/x], ground( x ψ(x)) = a Dom ψ[a/x]. (where ψ[a/x] denotes the substitution in ψ of x by a). Since Dom is finite, ground(ψ) is also finite. The resulting formula is further simplified as follows: substitution of true for equality s = s and substitution of false for equality s = t where s t, 4 elimination of truth values by the following rewriting rules: false ϕ false true ϕ true true false true ϕ ϕ false ϕ ϕ false true Clearly, a sentence ψ is satisfied in D if and only if ground(ψ) is satisfied in D. Now, the Herbrand expansion of a database DB = (D, IC) is the pair (D, ground(ic)), where ground(ic) = {ground(ψ) ψ IC}. As a Herbrand expansion of a given (first-order) database DB can be considered as a propositional database, we can apply Definition 2.2 on it for defining repairs of DB. PROPOSITION The database (D, IC {DCA(Dom), UNA(Dom)}) and the propositional database (D, ground(ic)) have the same repairs. 4 In general, when a set E I of insertable atoms and a set E R of retractable atoms are specified, we substitute false for every atom A P \ (D E I ), and true for every atom A D \ E R. f_amai04.tex; 10/01/2005; 15:11; p.11 12 12 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe 3. Computing preferred database repairs In this section we show that various constraint solvers for logic programs (Section 3.1) and quantified Boolean formulae (Section 3.2) can be utilized for computing database repairs based on the signed theories. The complexity of these computations is also considered (Section 3.3) Computing preferred repairs by model generation First we show how solvers for constraint logic programs (CLPs), answerset programming (ASP), and SAT solvers, can be used for computing c -preferred repairs (Section 3.1.1) and i -preferred repairs (Section 3.1.2). The experimental results are presented in Section Computing c -preferred repairs In what follows we discuss two techniques to compute c -minimal Herbrand models. The first approach is based on using finite domain CLP solvers. Encoding the computation of c -preferred repairs using a finite domain constraint solver is a straightforward process. The switching atoms s p are encoded as finite domain variables with domain {0, 1}. A typical encoding specifies the relevant constraints (i.e., the encoding of IC), assigns a special variable, Sum, for summing-up the values of the finite domain variables associated with the switching atoms (the sum corresponds to the number of true switching atoms), and searches for a solution with a minimal value for Sum. EXAMPLE 3.1. Below is a code for repairing the database of Example 2.5 with the Sicstus Prolog finite domain constraint solver CLP(FD) [23] 5. domain([sp,sq],0,1), %domain of the atoms Sp #\/ Sq, %the signed theory sum([sp,sq],#=,sum), %Sum: num of true atoms minimize(labeling([],[sp,sq]),sum). %resolve with min. sum The solutions computed here are [1, 0] and [0, 1], and the value of Sum is 1. This means that the cardinality of the c -preferred repairs of DB should be 1, and that these repairs are induced by the valuations ν 1 = {s p : t, s q : f} and ν 2 = {s p : f, s q : t}. 6 Thus, the two c -minimal 5 A Boolean constraint solver would also be appropriate here. As the Sicstus Prolog Boolean constraint solver has no minimization capabilities, we prefer to use here the finite domain constraint solver. 6 Here and in what follows we write ν = {x 1 : a 1,..., x n : a n} to denote that ν(x i) = a i for i = 1,..., n. f_amai04.tex; 10/01/2005; 15:11; p.12 13 Computational methods for database repair by signed formulae 13 repairs here are ({}, {p}) and ({q}, {}), which indeed insert or retract exactly one atomic formula. A second approach is based on using the disjunctive logic programming system DLV [31]. To compute c -minimal repairs using DLV, the signed theory IC is transformed into a propositional clausal form. A clausal theory is a special case of a disjunctive logic program without negation in the body of the clauses. The stable models of a disjunctive logic program without negation as failure in the body of rules coincide exactly with the i -minimal models of such a program. Hence, by transforming the signed theory IC to clausal form, DLV can be used to compute i -minimal Herbrand models. To eliminate models with nonminimal cardinality, weak constraints are used. A weak constraint is a formula for which a cost value is defined. With each model computed by DLV, a cost is defined as the sum of the cost values of all weak constraints satisfied in the model. The DLV system can be asked to generate models with minimal total cost. The set of weak constraints used to compute c -minimal repairs is exactly the set of all atoms s p ; each atom has cost 1. Clearly, i -minimal models of a theory with minimal total cost are exactly the models with least cardinality. EXAMPLE 3.2. Below is a code for repairing the database of Example 2.5 with DLV. Sp v Sq. %the clause :~ Sp. %the weak constraints :~ Sq. %(their cost is 1 by default) Clearly, the solutions here are {s p : t, s q : f} and {s p : f, s q : t}. These valuations induce the two c -minimal repairs of DB, R 1 = ({}, {p}) and R 2 = ({q}, {}) Computing i -preferred repairs The i -preferred repairs of a database (D, IC) correspond to the i - minimal Herbrand models of the signed theory IC. Below we use this fact for introducing some simple techniques to compute an i -preferred repair by model generators; in Section 3.2 we consider another method that is based on reasoning with quantified Boolean formulae. A. A naive algorithm First, we consider a straightforward iterative algorithm for computing all the i -preferred repairs of the input database. The idea behind the following algorithm is to compute, at each iteration, one i -minimal f_amai04.tex; 10/01/2005; 15:11; p.13 14 14 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe model of the union of the signed theory IC and the exclusion of all the repairs that have been constructed in previous iterations. By Theorem 2.9, then, this model induces an i -preferred repair of the input database. A pseudo-code of the algorithm is shown in Figure 1. input: a database DB = (D, IC). 1. T = IC; Exclude-Previous-Repairs = ; 2. do { 3. T = T Exclude-Previous-Repairs; 4. compute one i -minimal Herbrand model of T, denote it by M; 5. if {s p M(s p ) = t} = then 6. return (, ) and exit; % this is the only preferred repair 7. else { 8. return the update that is associated with M; 9. ψ M = {s p M(s p)=t} s p; 10. Exclude-Previous-Repairs = Exclude-Previous-Repairs {ψ M }; 11. } 12. } until there are no i -minimal models for T; % no more repairs Figure 1. i-preferred repairs computation by minimal models. EXAMPLE 3.3. Consider the database of Examples 2.4 and 2.5. At the first iteration, one of the two i -minimal Herbrand models of T = ψ = s p s q is computed. Suppose, without a loss of generality, that it is {s p : t, s q : f}. The algorithm thus constructs the corresponding ( i -preferred) repair, which is ({}, {p}). At the next iteration s p is added to T and the only i -minimal Herbrand model of the extended theory is {s p : f, s q : t}. This model is associated with another i - preferred repair of the input database, which is ({q}, {}), and this is the output of the second iteration. At the third iteration s q is added, and the resulting theory is not consistent anymore. Thus, this theory has no i -minimal models, and the algorithm terminates. In particular, therefore, the third repair of the database (which is not an i -preferred one) is not produced by the algorithm. In the last example the algorithm produces exactly the set of the i -preferred repairs of the input database. It is not difficult to see that f_amai04.tex; 10/01/2005; 15:11; p.14 15 Computational methods for database repair by signed formulae 15 this is the case for any input database. First, by Theorem 2.6, every database update that is produced by the algorithm (in line 8) is a repair, since it is associated with a valuation (M) that is a model of IC (as M is an i -minimal model of T ). Moreover, by the next proposition, the output of the algorithm is exactly the set of the i -preferred repairs of the input database. PROPOSITION 3.4. A database update is produced by the algorithm of Figure 1 for input DB iff it is an i -preferred repair of DB. Proof. One direction of the proposition immediately follows from the definition of the algorithm (see lines 4 and 8 in Figure 1). The converse follows from Theorem 2.9 and the fact that Exclude-Previous-Repairs blocks the possibility that the same repair will be computed more than once. Observe that Proposition 3.4 also implies the termination of the algorithm of Figure 1. B. Some more robust methods The algorithm described above implements a direct and simple method of computing all the i -preferred repairs, but it assumes the existence of an (external) procedure that computes one i -minimal Herbrand model of the underlying theory. In what follows we describe three techniques of using ASP/CLP/SAT-solvers for efficiently computing the desired repairs, without relying on any external process. I. One possible technique is based on SAT-solvers. These solvers, e.g. zchaff [50], do not directly compute minimal models, but can be easily extended to do so. The algorithm uses the SATsolver to generate models of the theory T, until it finds a minimal model. Minimality of a model M of T can be verified by checking the unsatisfiability of T, augmented with the axioms p M p and p M p. The model M is minimal exactly when these axioms are inconsistent with T. A pseudo-code of an algorithm that implements this approach is shown below. if T is not satisfiable then halt; while sat(t) { % as long as T is satisfiable } M := solve(t); % find a model of T { T := T p M p, } p M p ; return M % this is an i -minimal model of T f_amai04.tex; 10/01/2005; 15:11; p.15 16 16 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe We have tested this approach using the SAT solver zchaff [50]; the results are discussed in Section 4. II. Another possibility is to adapt CLP-techniques to compute i - minimal models of Boolean constraints. The idea is simply to make sure that whenever a Boolean variable (or a finite domain variable with domain {0, 1}) is selected for being assigned a value, one first assigns the value 0 before trying to assign the value 1. PROPOSITION 3.5. If the above strategy for value selection is used, then the first computed model is an i -minimal model. Proof. Consider the search tree of the CLP-problem. Each path in this tree represents a value assignment to a subset of the constraint variables. Internal nodes, correspond to partial solutions, are labeled with the variable selected by the labeling function of the solver and have two children: the left child assigns value 0 to the selected variable and the right child assigns value 1. We say that node n 2 is on the right of a node n 1 in this tree if n 2 appears in the right subtree, and n 1 appears in the left subtree of the deepest common ancestor node of n 1 and n 2. It is then easy to see that in such a tree, each node n 2 to the right of a node n 1 assigns the value 1 to the variable selected in this ancestor node, whereas n 1 assigns value 0 to this variable. Consequently, the left-most node in the search tree which is a model of the Boolean constraints, is i -minimal. In CLP-systems such as Sicstus Prolog, one can control the order in which values are assigned to variables. We have implemented the above strategy and discuss the results in Section 4. EXAMPLE 3.6. Below is a code for computing an i -preferred repair of the database of Example 2.5, using CLP(FD). domain([sp,sq],0,1), % domain of the atoms Sp #\/ Sq, % the signed theory labeling([up,leftmost],[sp,sq]). % find min. solution For computing all the i -minimal repairs, a call to a procedure, compute minimal([sp,sq]), should replace the last line of the code above. This procedure is defined as follows: f_amai04.tex; 10/01/2005; 15:11; p.16 17 Computational methods for database repair by signed formulae 17 compute_minimal(vars):- % find one minimal solution once(labeling([up,leftmost],vars)), bb_put(min_repair,vars). compute_minimal(vars):- % find another solution bb_get(min_repair,solution), exclude_repair(solution,vars), compute_minimal(vars). exclude_repair(sol,vars):- % exclude previous solutions exclude_repair(sol,vars,constraint), call(#\ Constraint). exclude_repair([],[],1). exclude_repair([1 Ss],[V Vs],V#=1 #/\ C):- exclude_repair(ss,vs,c). exclude_repair([0 Ss],[V Vs],C):- exclude_repair(ss,vs,c). Note that the code above is the exact encoding for the Sicstus Prolog solver of the algorithm in Figure 1. III. A third option, mentioned already in Section 3.1.1, is to transform IC to clausal form and use the DLV system. In this case the weak constraints are not needed Computing i -preferred repairs by QBF solvers Quantified Boolean formulae (QBFs) are propositional formulae extended with quantifiers, over propositional variables. It has been shown that this language is useful for expressing a variety of computational paradigms, such as default reasoning [20], circumscribing inconsistent theories [21], paraconsistent preferential reasoning [6], and computations of belief revision operators (see [29], as well as Section 5 below). In this section we show how QBF solvers can be used for computing the i -preferred repairs of a given database. In this case it is necessary to add to the signed formulae of IC an axiom (represented by a quantified Boolean formula) that expresses i -minimality, i.e., that an i -preferred repair is not included in any other database repair. Then, QBF solvers such as QUBOS [12], EVALUATE [22], QUIP [30], QSOLVE [32], QuBE [35], QKN [41], SEMPROP [43], and DECIDE [54], can be applied to the signed quantified Boolean theory that is obtained, in order to compute the i -preferred repairs of the database. Below we give a formal description of this process. f_amai04.tex; 10/01/2005; 15:11; p.17 18 18 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe Quantified Boolean formulae In what follows we shall denote propositional formulae by Greek lowercase letters (usually ψ, φ) and QBFs by Greek upper-case letters (e.g., Ψ, Φ). Intuitively, the meaning of a QBF of the form p q ψ is that there exists a truth assignment of p such that ψ is true for every truth assignment of q. Next we formalize this intuition. As usual, we say that an occurrence of an atomic formula p is free if it is not in the scope of a quantifier Qp, for Q {, }, and we denote by Ψ[φ 1 /p 1,...,φ m /p m ] the uniform substitution of each free occurrence of a variable p i in Ψ by a formula φ i, for i=1,...,m. The notion of a valuation is extended to QBFs as follows: Given a function ν at : Dom {t, f} {t, f} s.t. ν(t) = t and ν(f) = f, a valuation ν on QBFs is recursively defined as follows: ν(p) = ν at (p) for every atom p Dom {t, f}, ν( ψ) = ν(ψ), ν(ψ φ) = ν(ψ) ν(φ), where {,,, }, ν( p ψ) = ν(ψ[t/p]) ν(ψ[f/p]), ν( p ψ) = ν(ψ[t/p]) ν(ψ[f/p]). A valuation ν satisfies a QBF Ψ if ν(ψ) = t; ν is a model of a set Γ of QBFs if it satisfies every element of Γ. A QBF Ψ is entailed by a set Γ of QBFs (notation: Γ = Ψ) if every model of Γ is also a model of Ψ. In what follows we shall use the following notations: for two valuations ν 1 and ν 2 we denote by ν 1 ν 2 that for every atomic formula p, ν 1 (p) ν 2 (p) is true. We shall also write ν 1 < ν 2 to denote that ν 1 ν 2 and ν 2 ν Representing i -preferred repairs by signed QBFs It is well-known that quantified Boolean formulae can be used for representing circumscription [49], thus they properly express logical minimization [20, 21]. In our case we use this property for expressing minimization of repairs w.r.t. set inclusion. Given a database DB = (D, IC), denote by IC the conjunction of all the elements in IC (i.e., the conjunction of all the signed formulae that are obtained from the integrity constraints of DB). Consider the following QBF, denoted by Ψ DB : s p1,...,s p n ( IC [ s p 1 /s p1,...,s p n /s pn ] ( n i=1 (s p i s pi ) n i=1 (s pi s p i ) ) ). f_amai04.tex; 10/01/2005; 15:11; p.18 19 Computational methods for database repair by signed formulae 19 Consider a model ν of IC, i.e., a valuation for s p1,...,s pn that makes IC true. The QBF Ψ DB expresses that every interpretation µ (valuation for s p 1,...,s p n ) that is a model of IC, has the property that µ ν implies ν µ, i.e., there is no model µ of IC, s.t. the set {s p ν(s p ) = t} properly contains the set {s p µ(s p ) = t}. In terms of database repairs, this means that if R ν = (Insert, Retract) and R µ = (Insert, Retract ) are the database repairs that are associated, respectively, with ν and µ, then Insert Retract Insert Retract. It follows, therefore, that in this case R ν is an i -preferred repair of DB, and in general Ψ DB represents i -minimality. EXAMPLE 3.7. For the database DB of Examples 2.4 and 2.5, IC Ψ DB is the following theory Γ: { s p s q, s p s q }. ( (s p s q) ((s p s p ) (s q s q ) (s p s p) (s q s q)) The models of Γ are those that assign t either to s p or to s q, but not to both of them, i.e., ν 1 = (s p : t, s q : f) and ν 2 = (s p : f, s q : t). The database updates that are induced by these valuations are, respectively, R ν 1 = ({}, {p}) and R ν 2 = ({q}, {}). By Theorem 3.8 below, these are the only i -preferred repairs of DB. THEOREM 3.8. Let DB = (D, IC) be a database and IC = {ψ ψ IC}. Then: a) if R is an i -preferred repair of DB then ν R is a model of IC Ψ DB, b) if ν is a model of IC Ψ DB then R ν is an i -preferred repair of DB. Proof. Suppose that R = (Insert, Retract) is an i -preferred repair of DB. In particular, it is a repair of DB and so, by Theorem 2.6, ν R is a model of IC. Since Theorem 2.6 also assures that a database update that is induced by a model of IC is a repair of DB, in order to prove both parts of the theorem, it remains to show that the fact that ν R satisfies Ψ DB is a necessary and sufficient condition for assuring that R is i -minimal among the repairs of DB. Indeed, ν R satisfies Ψ DB iff for every valuation µ that satisfies IC and for which µ ν R, it is also true that ν R µ. Thus, ν R satisfies Ψ DB iff there is no model ) f_amai04.tex; 10/01/2005; 15:11; p.19 20 20 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe µ of IC s.t. µ < ν R, iff (by Theorem 2.6 again) there is no repair R of DB s.t. ν R < ν R, iff there is no repair R = (Insert, Retract ) s.t. Insert Retract Insert Retract, iff R is an i -minimal repairs of DB. DEFINITION 3.9. [4, 5] Q is a consistent query answer of a database DB = (D, IC) if it holds in (the databases that are obtained from) all the i -preferred repairs of DB. An immediate consequence of Theorem 3.8 is that consistent query answering [4, 5, 37] may be represented in our context in terms of a consequence relation as follows: COROLLARY Q is a consistent query answer of a database DB = (D, IC) iff IC Ψ DB = Q. The last corollary and Section provide, therefore, some additional methods for consistent query answering, all of them are based on signed theories Complexity We conclude this section by an analysis of the computational complexity of the underlying problem. As we show below, Theorem 3.8 allows us to draw upper complexity bounds for the following two main approaches to database integration. a) A skeptical (conservative) approach to query answering (considered, e.g., in [4, 5, 37]), in which an answer to a query Q and a database DB is evaluated with respect to (the databases that are obtained from) all the i -preferred repairs of DB (i.e., computations of consistent query answers; see Definition 3.9 above). a) A credulous approach to the same problem, according to which queries are evaluated with respect to some i -preferred repair of DB. COROLLARY Credulous query answering lies in Σ P 2, and skeptical query answering is in Π P 2. Proof. By Theorem 3.8, credulous query answering is equivalent to satisfiability checking for IC Ψ DB, and skeptical query answering is equivalent to entailment checking for the same theory (see also Corollary 3.10 above). Thus, these decision problems can be encoded by QBFs in prenex normal form with exactly one quantifier alternation. The corollary is obtained, now, by the following well-known result: f_amai04.tex; 10/01/2005; 15:11; p.20 21 Computational methods for database repair by signed formulae 21 PROPOSITION [60] Given a propositional formula ψ, whose atoms are partitioned into i 1 sets {p 1 1,...,p1 m 1 },...,{p i 1,...,pi m i }, deciding whether p 1 1,..., p 1 m 1, p 2 1,..., p 2 m 2,...,Qp i 1,...,Qp i m i ψ is true, is Σ P i -complete (where Q = if i is odd and Q = if i is even). Also, deciding if p 1 1,..., p 1 m 1, p 2 1,..., p 2 m 2,...,Qp i 1,...,Qp i m i ψ is true, is Π P i -complete (where Q = if i is odd and Q = if i is even). As shown, e.g., in [37], the complexity bounds specified in the last corollary are strict, i.e., these decision problems are hard for the respective complexity classes. 4. Experiments and comparative study The idea of using formulae that introduce new ( signed ) variables aimed at designating the truth assignments of other related variables is used, for different purposes, e.g. in [7, 8, 19, 20]. In the area of database integration, signed variables are used in [37], and have a similar intended meaning as in our case. In [37], however, only i - preferred repairs are considered, and a rewriting process for converting relational queries over a database with constraints to extended disjunctive queries (with two kinds of negations) over a database without constraints, must be employed. As a result, only solvers that are able to process disjunctive Datalog programs and compute their stable models (e.g., DLV), can be applied. In contrast, as we have already noted above, motivated by the need to find practical and effective methods for repairing inconsistent databases, signed formulae serve here as a representative platform that can be directly used by a variety of off-theshelf applications for computing (either i -preferred or c -preferred) repairs. In what follows we examine some of these applications and compare their appropriateness to the kind of problems that we are dealing with. We have randomly generated instances of a database, consisting of three relations: teacher of schema (teacher name), course of schema (course name), and teaches of schema (teacher name, course name). Also, the following two integrity constraints were specified: f_amai04.tex; 10/01/2005; 15:11; p.21 22 22 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe ic1: A course is given by one teacher: ( X Y Z (teacher(x) teacher(y ) course(z) teaches(x, Z) teaches(y, Z)) X = Y ) ic2: Each teacher gives at least one course: ( ) X teacher(x) Y (course(y ) teaches(x, Y )) The next four test cases (identified by the enumeration below) were considered: 1. Small database instances with ic1 as the only constraint. 2. Larger database instances with ic1 as the only constraint. 3. Databases with IC = {ic1,ic2}, where the number of courses is the same as the number of teachers. 4. Databases with IC = {ic1,ic2} and fewer courses than teachers. Note that in the first two test cases, only retractions of database facts are needed in order to restore consistency, in the third test case both insertion and retractions may be needed, and the last test case is unsolvable, as the theory is not satisfiable. For each benchmark we generated a sequence of instances with an increasing number of database facts, and tested them w.r.t. the following applications: ASP/CLP-solvers: DLV [31] (release ), CLP(FD) [23] (version ). QBF-solvers: SEMPROP [43] (release ), QuBE-BJ [35] (release number 1.3). SAT-solvers: A minimal-model generator based on zchaff [50]. The goal was to construct i -preferred repairs within a time limit of five minutes. The systems DLV and CLP(FD) were tested also for constructing c -preferred repairs. All the experiments were done on a Linux machine, 800MHz, with 512MB memory. Tables I IV show the results for providing the first answer. 7 7 Times are given in seconds, empty cells mean that timeout is reached without an answer, vars is the number of variables, IC is the number of grounded integrity constraints, and size is the size of the repairs. We focus on the computation of one minimal model. The reason is simply that in most sizable applications, the computation of all minimal models is not feasible (there are too many of them). f_amai04.tex; 10/01/2005; 15:11; p.22 23 Computational methods for database repair by signed formulae 23 Table I. Results for test case 1. Test info. i -repairs c -repairs No. vars IC size DLV CLP zchaff SEMPROP QuBE DLV CLP Table II. Results for test case 2. Test info. i -repairs No. vars IC size DLV CLP zchaff f_amai04.tex; 10/01/2005; 15:11; p.23 24 24 O. Arieli, M. Denecker, B. Van Nuffelen and M. Bruynooghe Table III. Results for test case 3. Test info. i -repairs c -repairs No. vars size DLV CLP zchaff DLV CLP Table IV. Results for test case 4. Test info. i -repairs c -repairs No. teachers courses DLV CLP zchaff DLV CLP The results of the first benchmark (Table I) already indicate that DLV, CLP, and zchaff perform much better than the QBF-solvers. In fact, among the QBF-solvers that were tested, only SEMPROP could repair within the time limit most of the database instances of benchmark 1, and none of them could successfully repair (within the time restriction) the larger database instances, tested in benchmark 2. Another observation from Tables I IV is that DLV, CLP, and the zchaff-based system, perform very good for minimal inclusion greedy algorithms. However, when using DLV and CLP for cardinality minimization, their performance is much worse. This is due to an exhaustive search for a c -minimal solution. While in benchmark 1 the time differences among DLV, CLP, and zchaff, for computing i -repairs are marginal, in the other benchmarks the differences become more evident. Thus, for instance, zchaff performs better than the other solvers w.r.t. bigger database instances with f_amai04.tex; 10/01/2005; 15:11; p.24 CHAPTER 7 GENERAL PROOF SYSTEMS CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes Logic in Computer Science: Autumn 2006 Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Now that we have a basic understanding: CS510 Software Engineering CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang. Which Semantics for Neighbourhood Semantics? Which Semantics for Neighbourhood Semantics? Carlos Areces INRIA Nancy, Grand Est, France Diego Figueira INRIA, LSV, ENS Cachan, France Abstract In this article we discuss two alternative proposals Correspondence analysis for strong three-valued logic Correspondence analysis for strong three-valued logic A. Tamminga abstract. I apply Kooi and Tamminga s (2012) idea of correspondence analysis for many-valued logics to strong three-valued logic (K UPDATES OF LOGIC PROGRAMS Computing and Informatics, Vol. 20, 2001,????, V 2006-Nov-6 UPDATES OF LOGIC PROGRAMS Ján Šefránek Department of Applied Informatics, Faculty of Mathematics, Physics and Informatics, Comenius University,: Efficient Fixpoint Methods for Approximate Query Answering in Locally Complete Databases Efficient Fixpoint Methods for Approximate Query Answering in Locally Complete Databases Álvaro Cortés-Calabuig 1, Marc Denecker 1, Ofer Arieli 2, Maurice Bruynooghe 1 1 Department of Computer Science, THE ROOMMATES PROBLEM DISCUSSED THE ROOMMATES PROBLEM DISCUSSED NATHAN SCHULZ Abstract. The stable roommates problem as originally posed by Gale and Shapley [1] in 1962 involves a single set of even cardinality 2n, each member of which Mathematical Induction Mathematical Induction Victor Adamchik Fall of 2005 Lecture 2 (out of three) Plan 1. Strong Induction 2. Faulty Inductions 3. Induction and the Least Element Principal Strong Induction Fibonacci Numbers Mathematical Induction Mathematical Induction In logic, we often want to prove that every member of an infinite set has some feature. E.g., we would like to show: N 1 : is a number 1 : has the feature Φ ( x)(n 1 x! 1 x) 2: Universality CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal Chapter 7. Sealed-bid Auctions Chapter 7 Sealed-bid Auctions An auction is a procedure used for selling and buying items by offering them up for bid. Auctions are often used to sell objects that have a variable price (for example oil) Scheduling Shop Scheduling. Tim Nieberg Scheduling Shop Scheduling Tim Nieberg Shop models: General Introduction Remark: Consider non preemptive problems with regular objectives Notation Shop Problems: m machines, n jobs 1,..., n operations XML with Incomplete Information XML with Incomplete Information Pablo Barceló Leonid Libkin Antonella Poggi Cristina Sirangelo Abstract We study models of incomplete information for XML, their computational properties, and query answering. Satisfiability Checking Satisfiability Checking SAT-Solving Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 10/11 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 40 A basic SAT algorithm Assume the CN Exponential time algorithms for graph coloring Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V 3. Cartesian Products and Relations. 3.1 Cartesian Products Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing Lecture 7: NP-Complete Problems IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs The Foundations: Logic and Proofs Chapter 1, Part III: Proofs Rules of Inference Section 1.6 Section Summary Valid Arguments Inference Rules for Propositional Logic Using Rules of Inference to Build Arguments 4 Domain Relational Calculus 4 Domain Relational Calculus We now present two relational calculi that we will compare to RA. First, what is the difference between an algebra and a calculus? The usual story is that the algebra RA is 17 : Equivalence and Order Relations DRAFT CS/Math 240: Introduction to Discrete Mathematics 3/31/2011 Lecture 17 : Equivalence and Order Relations Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last lecture we introduced the notion Fixed-Point Logics and Computation 1 Fixed-Point Logics and Computation Symposium on the Unusual Effectiveness of Logic in Computer Science University of Cambridge 2 Mathematical Logic Mathematical logic seeks to formalise the process of Boolean Representations and Combinatorial Equivalence Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discuss the applications of these representations for proving Logical Foundations of Relational Data Exchange Logical Foundations of Relational Data Exchange Pablo Barceló Department of Computer Science, University of Chile pbarcelo@dcc.uchile.cl 1 Introduction Data exchange has been defined as the problem of, } Computability Theory CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Computability Theory This section is partly inspired by the material in A Course in Mathematical Logic by Bell and Machover, Chap 6, sections 1-10. Expressive powver of logical languages July 18, 2012 Expressive power distinguishability The expressive power of any language can be measured through its power of distinction or equivalently, by the situations it considers indistinguishable. Advanced Relational Database Design APPENDIX B Advanced Relational Database Design In this appendix we cover advanced topics in relational database design. We first present the theory of multivalued dependencies, including a set of sound GRAPH THEORY LECTURE 4: TREES GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection XML Data Integration XML Data Integration Lucja Kot Cornell University 11 November 2010 Lucja Kot (Cornell University) XML Data Integration 11 November 2010 1 / 42 Introduction Data Integration and Query Answering A data
http://docplayer.net/12185651-Computational-methods-for-database-repair-by-signed-formulae.html
CC-MAIN-2018-39
refinedweb
10,348
61.97
SharePoint 2010 Enterprise Search has great wildcard search support built in now. However, it requires the use to add an asterisk to their query every time they want a wildcard search. This is a great step compared to what we had in MOSS 2007, but now it results in a training issue. In 2007, many people wrote custom code or relied on the Wildcard Search Web Part that I built. So I thought why not use the QueryManager object to override the query and add an asterisk to the query for the user. Since they’ve given us some methods to override now on the CoreResultsWebPart, these kind of changes can be done easily without using reflection. We start by adding assembly references to Microsoft.Office.Server.Search. Then we create a new web part inheriting from CoreResultsWebPart and add the following using statements. using Microsoft.Office.Server.Search.Query; using Microsoft.Office.Server.Search.WebControls; We then override the GetXPathNavigator method and get a reference to the QueryManager and override the UserQuery property. In reality, there are only two lines of code involved. QueryManager queryManager = SharedQueryManager.GetInstance(this.Page).QueryManager; queryManager.UserQuery = string.Format("{0}*", queryManager.UserQuery); You can look at the code in the CodePlex project for specifics. Instructions to add the solution package are included in the readme.txt file. You can use PowerShell to add the solution package or use stsadm still if you like. Once the solution is installed, activate the Wildcard Search Core Results (DotNetMafia.com) site collection feature. Now, go edit any search center results.aspx page you have and use the add web part button on the bottom zone. Click on the Search group, and choose the Wildcard Search Core Results (DotNetMafia.com) web part. Remove the existing CoreResultsWebPart from the zone and drag it into place. You can then stop editing (or publish) the page. Try a wildcard query and you should get results like the one below. Notice how i search for accoun and yet I get matches for Accounting and Account. Very cool. I’ll warn you that this is a very preliminary release. It definitely needs more testing so if you run into issues, please let me know. This was compiled against the release version of SharePoint 2010. Give it a try and let me know what you think. Wildcard Search Web Part for SharePoint 2010 Follow me on twitter. Pingback from Twitter Trackbacks for Wildcard Search Web Part for SharePoint 2010 - Corey Roth - DotNetMafia.com - Tip of the Day [dotnetmafia.com] on Topsy.com Hi Corey Roth, This a great post and it help me a lot. I have a requirement to override the Search Action Link Webpart in People Search. I want to add two more managed property to the DropDown so that I can sort on that. I want to add LastName and FirstName to the dropdown with the existing Relevance,social distance and name Can you help on that Thanks, Corey. This is a help! After setting this up, however, I'm not receiving any message when no results are found. Any way I can rectify this? Thanks in advance Hello Corey, Comment: When you do not use the asterix wildcard the refinement panel is not filtered. So this makes this solution limited in use. Question: We want to modify the WildcardSearchCoreResultsWebPart to change the look of the results web part. But whatever we do in Designer is not displayed in the browser. Do you know why? Kind regards, Mario m.vandeneijnde@on-l-i-n-e.com Do you have any idea why this webpart won't work against the FAST SSA? Against the built-in search it works just fine, but if you point it to use FAST results it shows nothing at all. @Mikael I'm surprised it doesn't work. The syntax should be the same. I'll try this out when I get a chance. Hello, This is a great solution. It does work for fast for SharePoint 2010. But when I use it does not returns the "Did you mean ?" or as mentioned before it does not return any message when no results are found. Do you know why, or how to solve it? Thanks' Yael. Hi, if all you need to do is to add the asterisk to the query, then it's possible to add it in the confuguration of the federated location you are using. Since even local searches are routed through the federation layer, as documented here: msdn.microsoft.com/.../ee558338.aspx - “The search result Web Parts in SharePoint Enterprise Search are built on top of the federated search object model.” - then you can add the asterisk to the query template of the "Local Search Results" location, like so: {searchTerms}* . It seems to me you'll achieve pretty much the same, no programming needed. Hi Corey, I have the same requirement that Sathish who wrote "How to override the Search Action Link Webpart, I want to add two more managed property to the DropDown so that I can sort on that." Could You help me? PEPE joseluisolivarez@hotmail.com I changed the QueryManager.UserQuery in GetXPathNavigator() method. But it seems that though user query is getting updated. Results fetched are not getting changed as per the new query. ApprovedCountries is the custom managed property. Here is the code: [ToolboxItemAttribute(false)] public class CMSCoreResultsWebPart : CoreResultsWebPart { private QueryManager queryManager; private KeywordQuery keyQuery; protected override void OnInit(EventArgs e) { queryManager = SharedQueryManager.GetInstance(this.Page).QueryManager; base.OnInit(e); } protected override System.Xml.XPath.XPathNavigator GetXPathNavigator(string viewPath) try { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertPartNumbe1r", "<script type='text/javascript'>alert(' " + queryManager.UserQuery + "');</script>"); queryManager.UserQuery = queryManager.UserQuery + " ApprovedCountries:India"; Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertPartNum33be1r", "<script type='text/javascript'>alert(' " + queryManager.UserQuery + "');</script>"); } catch (Exception ex) Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertPartNumber", "<script type='text/javascript'>alert('" + ex.GetBaseException().ToString() + "');</script>"); return base.GetXPathNavigator(viewPath); } @Manisha your code looks like it should work. You can download the source code to the web part I did from codeplex if you need something to compare against but it is pretty simple. I added the astriks like Cecilie Widsteen said and it seems to work without needing this webpart... Thanks Cecilie Widsteen! That technique does work but you may run into issues if you start creating custom queries using managed properties as it will render the syntax invalid. Hi Corey - I'm struggling to activate the feature - what's the syntax? I've been trying: Enable-SPFeature –Identity WildCardSearchCoreResultsWebPart –url And I'm getting the error: The feature is not a farm level feature and is not found in a site level defined by the url What have I done wrong? @AJ Your syntax looks correct. Are you sure the solution package installed correctly. Verify that it's there and deployed in Central Administration. You can also activate the feature through the UI in Site Collection features. I absolutely agree with Corey - this could have side effects that you haven't thought of and you need to be aware of what you're doing :) like, I presume what you mean by custom queries using managed properties is when you do a fielded search? Like this: keyword1 fieldname:keyword2 - you'll acheive nothing here, because the asterisk will be added towards the end of the expression... and a fielded search is by default a wildcard search. Thing is, if you don't have users that are likely to be aware of the possibility to do fielded searches, then you'll risk little. And you could always create another location without the asterisk added under the hood and let experienced users perform their search towards this other location. But if you for instance use append to query on your web part, you'll actually get the asterisk appended after the appended text AND a space. So you should also be aware of this and check if this is something that renders this solution useless to you. Corey, I activated the feature and am having trouble with making it the default search engine. What exactly do you mean by: "The Wildcard Search Core Results Web Part can then be added to your Search Center's results.aspx page. Simply add this web part to the bottom zone and remove your existing Core Results Web Part." I guess that starts with: "Now, go edit any search center results.aspx page you have and use the add web part button on the bottom zone." but I'm confused how to get there. Thanks in advance! Pingback from Wildcard Search Sharepoint 2010 | Code ??ffle Blog @Walt. Just edit the results.aspx page of your search center, remove the existing CoreResultsWebPart, and ad this new one in its place. Hello, i'm facing this problem that the web part is not displaying, though i activated the feature in the "Site collection features"... what should i do @Samo It doesn't appear in the web part list? Does it appear in the web part gallery of the site collection? Thank you for your great work. I have created a custom webpart inheriting from Coreresultwebpart that do the sorting on LastName. I am using Ranking model logic to sort the results on LastName as this was not available as default. But when i added your code to override the XPathNavigator method then sorting stopped working. Please help as this is urgent for my client. Client want both cutom sorting with wildcard search. @Ajay do you have a code snippet you can share? I just installed this webpart and noticed: 1) The refinement panel only displays ‘No refinements available’. Is this expected behavior? If not then I will continue investigating. 2) I see that someone else tested with a known condition of no items returned, and did not get any message stating such. I will back out the new web part and try the approach mentioned by Cecilie Widsteen (May 5, 2011). We are having a problem with refinements. When the search term is a wildcard, "stew" rather than "stewart" it returns a set of results but the refinements are not found. If we search on "stewart" the results are the same and we get refinements. Another odd thing is in the first scenario, using a wildcard search term, we get the results, click on a sort column and we get refinements with a refresh sorted result set. Any suggestions on this? Thank you - Thank you for this !! Just having an alignment issue where it right justifies (leaving a very, very large left margin on the screen which looks silly) the results when we de-select the 4 items below..... Display "Search from Windows" Link Display "Alert Me" Link Display "RSS" Link Allow users to display language picker Tried moving to middle lower left zone and that's too "skinny" but it is left Any easy idea for this? I download the tool, seems to be working fine, thanks for sharing. I have five type of following documents in my document libraries 1123AVK.DOCX 1123AVKS.DOCX 123AVK237.DOCX 123AVKS.DOCX 2123AVK.DOCX Now when I search keyword as 123AVK, it returns following two result I want it should result all 5 records as mentiond above because all five documents are containing 123AVK. so please share your thoughts and let me know how can I do this? Avian How to do wildcard search in Infopath form 2013
http://dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/05/13/wildcard-search-web-part-for-sharepoint-2010.aspx
CC-MAIN-2017-13
refinedweb
1,905
66.54
Hello, I'm trying to create a custom field in WordPress to add Vine.co videos. I found the guide which demonstrate how to add a custom meta box for YouTube videos only. Code: Can anyone help me to change that metabox from YouTube Videos to Vine.co Videos? This is the function for Vine.co Videos PHP Code: function vine($id) { // gets the raw .mp4 url from the vine id $vine = file_get_contents("{$id}"); preg_match('/property="twitterlayer:stream" content="(.*?)"/', $vine, $matches); return ($matches[1]) ? $matches[1] : false; } Another function I want to merge is to get the vine featured image and set it automatically in WordPress using the guide below? If anyone can help it will be greatly appreciated. Thanks in advance.
https://www.blackhatworld.com/seo/please-help-me-to-create-this-function.654546/
CC-MAIN-2017-34
refinedweb
122
77.13