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
|
|---|---|---|---|---|---|
The Comma Operator in C++
There is a seemingly useless operator in C++ known as the comma operator. It appears as follows: expression1, expression2;. This says execute expression1 and then execute expression2. The resulting value and type of the overall expression is the same as that of expression2.
Thus, you could say something like the following:
int i; int j; i = 1, j = 2;
Why would you ever want to do such a thing? Answer: You wouldn’t except when writing for loops.
The following CommaOperator program demonstrates the comma operator in combat. This program calculates the products of pairs of numbers. If the operator enters N, the program outputs 1 * N, 2 * N-1, 3 * N-2, and so on, all the way up to N * 1. (This program doesn’t do anything particularly useful.)
// // CommaOperator - demonstrate how the comma operator // is used within a for loop. // #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { // enter a target number int nTarget; cout << "Enter maximum value: "; cin >> nTarget; for(int nLower = 1, nUpper = nTarget; nLower <= nTarget; nLower++, nUpper--) { cout << nLower << " * " << nUpper << " equals " << nLower * nUpper << endl; } // wait until user is ready before terminating program // to allow the user to see the program results cout << "Press Enter to continue..." << endl; cin.ignore(10, 'n'); cin.get(); return 0; }
The program first prompts the operator for a target value, which is read into nTarget. It then moves to the for loop. However, this time not only do you want to increment a variable from 1 to nTarget, you also want to decrement a second variable from nTarget down to 1.
Here the setup clause of the for loop declares a variable nLower that it initializes to 1 and a second variable nTarget that gets initialized to nTarget. The body of the loop displays nLower, nUpper, and the product nLower * nTarget. The increment section increments nLower and decrements nUpper.
The output from the program appears as follows:
Enter maximum value: 15 1 * 15 equals 15 2 * 14 equals 28 3 * 13 equals 39 4 * 12 equals 48 5 * 11 equals 55 6 * 10 equals 60 7 * 9 equals 63 8 * 8 equals 64 9 * 7 equals 63 10 * 6 equals 60 11 * 5 equals 55 12 * 4 equals 48 13 * 3 equals 39 14 * 2 equals 28 15 * 1 equals 15 Press Enter to continue . . .
In this example run, 15 is the target value. You can see how nLower increments in a straight line from 1 to 15, while nUpper makes its way from 15 down to 1.
Actually, the output from this program is mildly interesting: No matter what you enter, the value of the product increases rapidly at first as nLower increments from 1. Fairly quickly, however, the curve flattens out and asymptotically approaches the maximum value in the middle of the range before heading back down. The maximum value for the product always occurs when nLower and nUpper are equal.
Could you have made the earlier for loop work without using the comma operator? Absolutely. You could have taken either variable, nLower or nUpper, out of the for loop and handled them as separate variables. Consider the following code snippet:
nUpper = nTarget; for(int nLower = 1; nLower <= nTarget; nLower++) { cout << nLower << " * " << nUpper << " equals " << nLower * nUpper << endl; nUpper--; }
This version would have worked just as well.
The for loop can’t do anything that a while loop cannot do. In fact, any for loop can be converted into an equivalent while loop. However, because of its compactness, you will see the for loop a lot more often.
|
https://www.dummies.com/programming/cpp/the-comma-operator-in-c/
|
CC-MAIN-2019-51
|
refinedweb
| 602
| 60.55
|
There is an interesting discussion on the BCL blog about a new BCL type called TimeZone2. Just take a look at the comments below the System.TimeZone2 Starter Guide post. The new type supersedes an existing type called TimeZone (which is obsolete now).
Lots of people are not thrilled with the “2” suffix. I am responsible for the guidelines (excerpt below), and so I thought I would try to provide some context:
· Some comments suggest that the BCL team just take a breaking change, i.e. remove the old type and add a new one with the same name. This is not an option for such a widely used framework. We basically have a policy against doing any intentional breaking changes. In other words, this is not negotiable 🙂
· Some comments suggested using a new namespace, e.g. System.Globablization.TimeZone. This would cause all sorts of problems. The main one is that most source files import System namespace and this approach would mean that most source files have to fully qualify the new TimeZone (otherwise you would get type name ambiguity). I don’t like fully qualifying core types when I program and usability studies we conducted have shown that I am not alone. There are other issues related to the difficulty in searching for documentation on such duplicated types, referring to such types in books and in speech, etc.
· Using numeric suffixes is the last resort thing. If you have a “good name” that does not include a numeric suffix, you should use it. The problem is that sometimes all reasonable names are already taken, and that’s when the guideline is applicable. It’s what we call the best out of many bad alternatives.
Having said that, I would love the BCL team to find a new “good name” for the type. If you have a great name, post it to my or the BCL blog.
And for reference, here is the excerpt from the design guidelines:
Naming New Versions of Existing APIs.
Sometimes a new feature cannot be added to an existing type even though the type’s name implies that it is the best place for the new feature. In such case a new type needs to be added, often leaving the framework designer with a difficult task of finding a good new name for the new type. Similarly, often an existing member cannot be extended or overloaded to provide additional functionality and a member with a new name needs to be added. The following guidelines describe how to choose names for new types and members that supersede or replace existing types or members.
þ Do use a name similar to the old API when creating new versions of an existing API.
This helps to highlight the relationship between the APIs.
class AppDomain {
[Obsolete(“AppDomain.SetCachePath has been deprecated. Please use AppDomainSetup.CachePath instead.”)]
public void SetCachePath(String path) { /* … */ }
}
class AppDomainSetup {
public string CachePath { get { /* … */ }; set { /* … */ }; }
}
þ Do prefer adding a suffix rather than a prefix, in order to indicate a new version of an existing API.
This will assist discovery when browsing documentation, or using Intellisense. The old version of the API will be organized close to the new APIs as most browsers and the Intellisense show identifiers in alphabetical order.
þ Consider using a brand new, but meaningful identifier, instead of adding a suffix or a prefix.
þ Do use a numeric suffix to indicate a new version of an existing API, if the existing name of the API is the only name that makes sense (i.e. it is an industry standard), and adding any meaningful suffix (or changing the name) is not an appropriate option.
// old API
[Obsolete(“This type is obsolete. Please use the new version of the same class, X509Certificate2.”)]
public class X509Certificate { /* … */ }
// new API
public class X509Certificate2 { /* … */ }
Yeah.. Krzysztof have finally blogged about the controversal naming guidelines around TimeZone2! Check
How about TimeZoneRegion?
Right now, there is no easy way to convert a time from one arbitrary timezone to another arbitrary timezone
I remember the highlighted paragraph from the (excellent) FDG book (which I own and recommend as one of the first books to read before starting to design applications in .NET) as one of the very few paragraph I wholeheartedly disagreed with.
I’m with the first camp that calls ‘Break! Break!’ and I think that this is the best option, considering how .NET’s handling of assemblies and deprecation by ObsoleteAttribute is supposed to work.
Walking on your tippy-toes in _every_ situation in an attempt not to break _anything_ would, a few years down the line, result in an unusable patch-work. Some things you can’t see down the line and sometimes you have to get back to the drawing-board to re-define something you though would never change.
Think about someone new to the framework 3.0 who encounters TimeZone and TimeZone2. That just seems ridiculous.
Totally cheap. .NET has jumped the shark. I hate the new name.
Since Kathy’s article mentions a relationship to the new Vista API and looking at her example #4, TimeZoneInformation sounds like a feasible alternative to me.
However, Information is probably one of your black-listed suffixes, isn’t it?
I’m one of the people who wrote a comment on making it a breaking change.
I don’t argue that making a breaking change will hurt some people, but I think this is an investment in the framework in the long run. If we look ahead 10 years, will .NET be littered with TimeZone9 and X509Certificate6? Will we still want to use it?
You say that you cannot introduce breaking changes due to policy, yet .NET 2.0 introduced many breaking changes? So has the policy changed – are you saying that there won’t be a single breaking change in .NET 3.0?
I think you should have the courage to realize that this /should/ be a breaking change, and that you will be better off taking the hit now, than letting developers suffer for it in the many years to come.
If Microsoft are going to choose backwards compatibility over a clear sensible evolving API we are going to be in the same scenario as Win32 is now within a few years.
I’d go with giving the new class the TimeZone name and moving the old one to a .Obsolete namespace (for 1 version only) and adding the Obsolete attribute to it.
The VS 200x project upgrade wizard should detect references to the original TimeZone class and switch them to System.Globalization.Obsolete.
If Microsoft aren’t prepared to break the underlying API between major revisions .NET is going be become a mess real quick.
Where they want to support an old version of a class for some time then an old-API wrapper round the replacement class might also be an option.
[)amien
We recognize the problem of frameworks deteriorating over time and we look for ways to stop or reverse this process – but without resorting to breaking changes. For example, in 2.0 we added type forwarders which we plan to use to fix some of the layering/dependency issues. We are also thinking about technologies that would allow us to fix naming and design issues without resorting to breaking changes.
Breaking changes are just too disruptive for many projects/customers and they almost never add enough value to be worth the pain. There are cases where we feel like the benefits outweigh the costs (for example changes required to fix security issues) and we do approve limited breaking changes in such cases. But, I would assert naming changes for hygiene reasons can never provide enough value to offset their cost.
This is especially true in Orcas. Orcas is an in-place (not Side-by-Side) update to the .NET Framework. See the following blog describing more detail:. Changing TimeZone APIs in Orcas would amount to breaking applications in a service pack. This is a big no-no.
Hi Krzysztof,
I’ve a name suggestion, what about calling the new type “TimeRegion”
Cheers
I noticed a good debate going on the BCL blog (and now Krzysztof Cwalina’s blog) about the naming of
I honestly don’t understand the problem with a breaking change…when you publish the next .net version … the dll version numbers are different, it shouldn’t break anything published unless you try and recompile…and if you are recompiling…its not such a big deal particularly for such a non impacting class.
If you went and changed the interface on string … ok perhaps you have an argument…but otherwise ..what is the problem? Change happens, and from what i have seen of timezone2 .. the change is a good one. Don’t screw up a positive change with a confusing migration….and yes it is a migration because you are going to eventually get rid of system.timezone, so the code changes need to be done anyway…all you are doing by adding a 2 to the name is making it harder for programmers to find the right classes, which doesn’t help anyone.
If you feel so compelled, please do include a framework API migration wizard in the next release, but keep the API name the same.
Ever since Kathy Kam announced on her weblog that a new type named TimeZone2 will be introduced into
Diego and Henry, I forwarded the suggestions to the BCL team. I actually talked to Kathy and she pointed me to the following blog which describes tradeoffs related to many of the names people suggested. See
Adam, we are not changing version number in Orcas. This is basically the distinction between in-place and SxS. Also, even if we were doing a SxS release, it is a big deal for many people when they recompile and find a ton of errors. Migration tools cannot migrate everything. Also, there are various publisher policies which by default run applications on the new SxS release. Anyway, this whole compatibility discussion is probably a good topic for a blog post. I will ask around maybe somebody has already written on this, if not, I will try to write something.
When I read the design guideline, it says use numeric suffix "if the existing name of the API is the only name that makes sense".
But "TimeZone" isn’t the only name that makes sense – there are many names that make sense…
You could name it TimeZoneInfo as suggested in Kathys blog comments.
You could name it after the reason you chose to create the new class – for instance if the main purpose was conversions it could be named ConvertibleTimeZone.
So by your own admission you cannot apply this rule, and as such it must not be named TimeZone2… *yesss! SCORE!* 😉
Dudes, TimeZone2 is an attrocious name for a class. We’ve been through this before with COM and it’s been a nightmare. Names need to be descriptive. Including a version number describes nothing about what the class does.
If the new class cannot replace the old TimeZone then it should have a _significant_ name that explains why it’s different. Ex: DynamicTimeZone, WorldTimeZone etc.
There’s nothing wrong with breaking the 3.0 codebase at this time. It’s still very far from release.
I’m going to add my 2 cents in as well and say "Bad BCL team! Bad!"
You can use all kinds of logic to say why TimeZone2 should be used. But when it comes right down to it, its still stupid. How does the quote go? "Logic is nothing more than a way to err with confidence."
Micael and urig, I will pass your proposal to Kathy. She owns TimeZone naming.
Dear Lord! Please, please, please don’t do this to the BCL. Think of a different name, please! Your customers obviously cannot stand the appending 2 to the class name. Please don’t do this, please use a different name. I beg you.
> I don’t like fully qualifying core types when I program and usability studies we conducted have shown that I am not alone.
using System;
using TimeZone = System.Globablization.TimeZone;
Done !
I have to agree with the comments on adding a "2" suffix is a bad decision. Especially the comments by Micael Baerens are interesting. There’s a number of other suggestions for names.
The in-place installation is, however, an issue and this just adds to the arguments that .NET 3.0 should not be named .NET – rather .NET 2.1 (or 2.5) for what it is (.NET 2.0 with WinFX).
Releasing the new version of the BCL as a side by side installation would allow you to make the breaking change now and use the "obsolete" features to inform developers about the new class.
Already mentioned in other comments, the .NET 2.0 framework made several changes (some breaking). The changes to the Xslt namespace is a good example. The addition of compiled transformations forced a lot of people to update their code.
Were the developers angry with this decision? no.
Were the developers positive towards the investment Microsoft made in the BLCs? definately yes.
It is extremely positive that Microsoft shows more transparency, allowing us – the developers – to comment on the decisions. We’re hoping it makes a difference (hint hint) 🙂
I agree that a way to rename a class without breaking versioning would be nice. I’ve thought about this before, and the only con to it would be possible confusion in the documentation. If somebody looks up System.TimeZone in the help file and finds a listing for a completely different class that could be a problem, but not an unsolvable problem.
So in case you’re considering a feature like this, count me in as a supporter. I don’t see how we can get this in time to solve the TimeZone/TimeZone2 problem (it’ll have to be a major version update to support the new versioning capabilities). But still, it’d be nice to think that someday after TimeZone has been obsoleted for a while we can rename TimeZone2 to TimeZone and TimeZone to _OBSOLETE_TimeZone without making any binary breaking changes.
I’m not entirely sure how Reflection would work with type-renaming (I’m not sure what it does with type-forwarding), but if you have a way to see what version of a library an assembly was compiled against then I’m sure there’s a solution that would work.
Having built my own TimeZone class for a very large international law firm (because the System.TimeZone class is ridiculously short-sighted), I have done a lot of research about time zones and daylight saving time around the world and am very interested to see how this plays out.
I’ve been reading a lot of comments in several blogs about the TimeZone2 proposal. This is my take on the whole thing.
1) TimeZone2 should not be based on the Vista "dynamic/historic timezone API", it should contain all the logic/data to compute this independent of the OS. This is so much easier for the developer, less things to think about and consider.
2) TimeZone is a broken, almost useless class. The ideal recourse is to replace it – it is already broken. That said, if you are adamant about not replacing it, the new name should describe a class which clearly indicates that it is a replacement and therefore I am ok with the TimeZone2 name.
3) Define interfaces so we have more flexibility… such as IDateTime and ITimeZone.
4) Also, I don’t like this: TimeZone2.FindSystemTimeZoneById(“Hawaiian Standard Time”);
I would like all the time zones be listed, like the Color class lists many colors. Easier discoverability, strongly typed (no misspelling bugs), less frustration and time wasted looking things up on msdn or wherever.
5) May I suggest an instantiation of a TimeZone2 object have the methods:
ToLocalTime(DateTime utcDateTime)
ToUniversalTime(DateTime localDateTime)
but still maintain the "ConvertTime" static method.
I named my static method "ToOtherTimeZone", but I like "ConvertTime" as well.
Last but not least. I am very happy you guys are working on this TimeZone thing. The framework certainly needs it!
Cheers,
Jules
Jules,
Thanks for the very detailed feedback. I have passed it to the team working on TimeZone2.
Hey Krzysztof.
Did you thought about different solution?
Maybe your should separate TimeZone class as a container and a manager of TimeZones (all that static methods and calculating stuff).
I didn’t dig enought deep into the problem, but, perhaps, you could implement all time management features in a static (?) class named (for example) "Clock" (that would be really a good name) or "Time" and have a stupid TimeZone container (maybe even keep the old TimeZone class, or create a base class to improve compartability) . In that case, that would not be that important how this container would be called.
The usage pattern will be something like this:
Clock.GetTimeZone("name").IsDayLightSavingTime() .
And the method could delegate the functionality back in the clock class via internal methods.
I agree, from the point of OOP this is not the best thing to do, but from the point of usability, maybe it’s the thing to consider ?
p.s: just finished reading your book (design guidelines) a couple of weeks ago, and want to say my "thanks". Great one.
I think a lot of commenters here are simply ignoring an important part of what krzystof is saying: There is no new version number in .net 3.0 or 3.5 for assemblies that already existed in 2.0. Therefore, breaking changes are absolutely not an option, this is not a mere matter of preference.
Consider what a breaking change would mean. Among other things it would bring library developers in an impossible situation. Once I update my libraries to the new version of the .NET assemblies, they are not going to work in older versions. Worse, strong naming won’t prevent this error because the version numbers did not change.
The effects of such a decision would be simply unacceptable to any library developer (and cause problems for application developers too). We would end up having to query the installed framework version during installation (adding the requirement of an installation routine, which is unnatural for libraries), and this is still not robust, because the framework could get updated afterwards. This would be ridiculous.
The other option would be to increase the version number. Thanks, but no thanks. Migrating build scripts and delivering seperate library versions for 1.1/2.0 was painful enough (not everybody is building their solutions solely via VS). We definately don’t want this only because of some obscure class most people have not even noticed before.
Once we accept this, there are still a few things that I’m uncomfortable with. Krzystof, you seem to think that your solution would still be the best one even if the version numbers would increase to a new major number.
1) You mention the possible use of publisher policies. This is technically correct, but this raises the following question: Why do we have to struggle with the unforgivingness of strong naming and still do not get to depend on it? I mean, doesn’t that give us the worst of both worlds – the missing robustness of dynamic programming AND the complicated build scenarios of statically typed languages? Arguably, in this case it could be better to drop the static checking altogether and depend solely on unit tests for robustness.
2) If we ignore the publisher policy problem for a second, I’d strongly agree with the posters arguing for a breaking change in case of a major update.
3) I would feel better about this decision if you would consider renamimg TimeZone2 back to TimeZone with the next major update of the respective assemblies. After all, once I have completely migrated to TimeZone2 and removed every reference to the old TimeZone, renaming TimeZone2 seems pretty painless (hit the obsolete message, search&replace in files). And aliases are always a possibility. (Although I have to say that this would be much easier if i had a project/solution-wide way of defining aliases, having to put a "using" in every code file is a pain. Especially if I have to decorate them with #if’s. There are still moments when I miss those old #includes’s ;-))
Stefan
Stefan,
This is precisely why releasing an in-place "update" to the framework was a terrible idea in the first place. I am shocked that the BCL team didn’t see this problem or something just like it coming from miles down the road when that "solution" was first proposed.
Krzysztof,
"I would assert naming changes for hygiene reasons can never provide enough value to offset their cost."
You could not be more wrong. Naming is the SINGLE GREATEST USABILITY ISSUE that developers deal with on a daily (no, line by line) basis. When I can’t remember which namespace KeyedCollection<> is in (who in their right mind came up with ObjectModel?), its because someone made a bad naming decision. That costs me time and breaks my rhythm as I have to fire up MSDN and go look it up. If you start making these kinds of decisions with every release, my productivity starts going down as I have to refer to documentation more and more often just to figure out the name of the class that I want to use. As previous comments have pointed out, Win32 suffered terribly from this. I use .NET for RAD (rapid application development); if your design decisions are slowing me down, .NET ceases to be useful to me.
And as a side note, I completely agree with Stefan that project-level aliases are an absolute necessity. I hate when "moving forward" in languages (C++ to C#) causes me to go backward in functionality.
David,
I disagree. Keeping the changes in existing components on a service-pack level makes a lot of things easier for a lot of people. It simply means that I can cease support for the "old" 2.0 version and require customers to install the SP if I depend on any bug fixes, or I can just be agnostic of the SP-level of 2.0 components. 3.0 and 3.5 only affect me if I use those features. In fact, we put 3.0/3.5-dependent features in separate assemblies, so customers get a choice without us having to maintain seperate build processes as we did for 1.1 and 2.0. I wouldn’t want it any other way, really.
TimeZone2 is just not a big enough issue to justify any of this. If stuff like that starts to be all over the BCL, I’d be with you though. Thats why I’d think it’d be worth the trouble of eliminating TimeZone and renaming TimeZone2 to TimeZone in the next major.
Probably far too late for this. But couldn’t most of this been handled with a "TimeZoneConverter", "TimeZoneManager" or using Extension methods?
|
https://blogs.msdn.microsoft.com/kcwalina/2006/10/06/system-timezone2-naming-and-related-design-guidelines/
|
CC-MAIN-2016-44
|
refinedweb
| 3,866
| 64.2
|
const int Sensor1 = 2 ;int i;void setup (){ pinMode(Sensor1,INPUT);}void loop (){Sensor_1: // statement...............}void delay_function (){for(i=0;i<10000;i++) { if (digitalRead(Sensor1) == 0) { goto Sensor_1 ; } }}
You just call your function like this:Delay_function();When it is finished doing what it should, program flow will be returnd to where you called it from.
#include <setjmp.h>jmp_buf unwind_stack;voidinner_function (void){ if (some_condition ()) { lonjmp (unwind_stack, 1); }}voidloop (void){ if (setjmp (unwind_stack) == 0) { /* normal code, do whatever you need here. */ inner_function (); } else { /* code after longjmp is called. */ Serial.println ("whoops"); }}
i need when make specific action such as press switch exit from Delay_function() and back to the void loop (), what order can i used
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
Thank you for subscribing!
Arduino
via Egeo 16
Torino, 10131
Italy
|
http://forum.arduino.cc/index.php?topic=141349.msg1061848
|
CC-MAIN-2016-30
|
refinedweb
| 150
| 52.19
|
Hello Blynkers, I have a garage door project that I need help with. I am teaching my self so it very well could be an obvious answer. I have a WeMos D1 mini with a DHT sheild and a Relay shield. The project works fine as of now but I wanted to add a notification when the door is left up for longer than 10 or 15 minutes. I have seen other code that allows a notification if a temperature gets to high or at a certain time with the timer, but I was wanting it to realize the change in the switch and start counting till 30 minutes and then let me know I left the door up. The code I putting up is the very basic that works as of now to open and close the door with a relay, read the temperature status and show the status of the magnetic switch I have on the door. The Magnetic switch is on D2 and when its low the switch is together and when its high then the switch is broken and the door is up. I will also show a picture of the code that i tried to implement but it will only send me an alert as soon as the switch is broken. I would just want it on a timed delay to notify me. Any help would be greatly appreciated!!
#include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <DHT.h> char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxx"; char ssid[] = "xxxxxxxxxxxxx"; char pass[] = "xxxxxxxxxx"; #define DHTPIN D4 #define DHTTYPE DHT22 DHT dht(DHTPIN, DHTTYPE); BlynkTimer timer; void sendSensor() { float h = dht.readHumidity(); float t = dht.readTemperature(true); //() { // put your setup code here, to run once: Blynk.begin(auth, ssid, pass); dht.begin(); // Setup a function to be called every second timer.setInterval(1000L, sendSensor); } void loop() { // put your main code here, to run repeatedly: Blynk.run(); timer.run(); }
|
https://community.blynk.cc/t/garage-door-project-with-wemos-d1-mini-sheilds-blynk/26478/14
|
CC-MAIN-2019-39
|
refinedweb
| 316
| 79.8
|
A Comprehensive Guide to Validating and Formatting Credit Cards
Credit card forms are one of those elements that every online business will have to implement at one point or another, and they can often be a pain point for both developers and users. That being said, it’s crucial that these forms are designed to be user-friendly and intuitive as they are the entry point for paying users: it would be a shame if a company lost a potential customer to a badly-designed payment form, even if they did everything else right.
The goal of this post is to explain how to implement your own super-awesome credit card form, complete with bug-free validation and formatting. If you’re only here for the code, feel free to scroll to the very bottom to view the final implementation.
Table of Contents
Types of Credit Cards
A couple of things to note here:
- As part of Mastercard’s 2-series expansion, their cards can now begin with 2
- American Express has an unusual CVV that is 4 digits long
- The cards that you support should depend on what your selected payment gateway supports. It’s bad practice to allow unsupported cards to pass through your client-side validation.
- Maestro is a complete pain to deal with and is unsupported by most payment gateways. As such, Maestro will not be covered in the remainder of this post.
For a list of common payment gateways and the cards they support, see this list by Aria Systems. For a list of test cards, see this Github repo. For more cards and their RegEx patterns, view this list on Github.
Validating Cards
Why?
- The user gets immediate feedback on an input error; if an invalid card is entered, they don’t need to click on the submit button, wait for the server to return an error, and then fill out the form again.
- It lessens your server load and prevents invalid requests from counting towards your API rate limit.
The Luhn Algorithm
Credit card numbers may look random, but there is actually a hidden meaning behind each group of numbers.
In the above diagram:
- Major Industry Identifier (MII) — identifies the industry of the card. See here for a list of industries and their corresponding digits.
- Issuer Identification Number (IIN) — identifies the issuer of the card. American Express starts with 34 or 37, Mastercard starts with 2221–2720 or 51–55, Visa starts with 4. See here for a list of all IIN ranges. This is especially useful for future updates if card issuers ever decide to expand their IIN ranges.
- Account Number — identifies the customer’s account
- Checksum — makes sure that the account number is valid
The Luhn Algorithm determines the validity of a card using the account number and checksum (labels 3 and 4). It works almost like magic:
- From the rightmost digit of your card number, double every other digit.
- If the doubled digit is larger than 9 (ex. 8 * 2 = 16), subtract 9 from the product (16–9 = 7).
- Sum the digits.
- If there is no remainder after dividing by 10 (sum % 10 == 0), the card is valid.
Using the card from above, here is the Luhn Algorithm in action:
Summing up the last row gives us a value of 90, which is a multiple of 10. This card is valid!
Here’s a Javascript implementation of the Luhn Algorithm:
function checkLuhn;
}
return (sum % 10) == 0;
}
You can view implementations of the Luhn Algorithm in other languages such as Java, Swift, PHP, and Python here.
Checking for Supported Cards
With reference to the list of cards above and their specifications, we can create a validator based on the RegEx for each specific card.
The best way to keep track of different cards and their patterns is to store them in an object literal:
var acceptedCreditCards = {
visa: /^4[0-9]{12}(?:[0-9]{3})?$/,
mastercard: /^5[1-5][0-9]{14}$|^2(?:2(?:2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7(?:[01][0-9]|20))[0-9]{12}$/,
amex: /^3[47][0-9]{13}$/,
discover: /^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$/,
diners_club: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
jcb: /^(?:2131|1800|35[0-9]{3})[0-9]{11}$/
};
We can then create a function that tests the inputted value against all RegEx patterns to determine the card’s validity:
function checkSupported(value) {
// remove all non digit characters
var value = value.replace(/\D/g, '');
var accepted = false;
// loop through the keys (visa, mastercard, amex, etc.)
Object.keys(acceptedCreditCards).forEach(function(key) {
var regex = acceptedCreditCards[key];
if (regex.test(value)) {
accepted = true;
}
});
return accepted;
}
Putting it Together
Finally, we can combine the Luhn algorithm with our supported credit cards checker to complete our magical validation formula.
function validateCard;
}
var valid = (sum % 10) == 0;
var accepted = false;
// loop through the keys (visa, mastercard, amex, etc.)
Object.keys(acceptedCreditCards).forEach(function(key) {
var regex = acceptedCreditCards[key];
if (regex.test(value)) {
accepted = true;
}
});
return valid && accepted;
}
Validating the CVV
Why?
- For the exact same reasons as validating credit card numbers: to reduce the number of invalid requests being made to the server.
The card verification value (CVV) is a set of 3–4 digit numbers on the back of your card and is used for security reasons. Most CVVs are 3 digits, with the exception of Maestro, which may not even require a CVV, and American Express, which has a CVV of 4 digits. Since we’re not supporting Maestro, American Express is the only exception we’ll have to make.
A CVV doesn’t have anything like a Luhn algorithm to check its validity, so all we have to do is check its length:
function validateCVV(creditCard, cvv) {
// remove all non digit characters
var creditCard = creditCard.replace(/\D/g, '');
var cvv = cvv.replace(/\D/g, '');
// american express and cvv is 4 digits
if ((acceptedCreditCards.amex).test(creditCard)) {
if((/^\d{4}$/).test(cvv))
return true;
} else if ((/^\d{3}$/).test(cvv)) { // other card & cvv is 3 digits
return true;
}
return false;
}
Let’s also set a maxlength for it:
$('#cvv').attr('maxlength', 4);
We can then integrate this with our credit card validation.
Toggling the Submit Button
When the credit card or CVV is invalid, we should disable the submit button because we don’t want invalid form data to be sent to the server. This is as easy as changing the
#status element to a
submit button and then toggling the
disabled prop.
Formatting Cards
Why?
- The user can see at a glance whether they missed or added an extra character
- It’s easier for the user to go back and change a digit in the case of typos
There are also a couple of UX goals we want to accomplish when adding auto-formatting:
- We don’t want to disallow the user from typing spaces as they enter their card number
- The user should be able to insert and remove digits before and after a formatted space
- The cursor position should be retained when inserting and removing digits
- When formatting is changed (ex. American Express → Visa), digits should be re-formatted to match the new layout
With those goals in mind, here are a couple of approaches to formatting cards:
Input Masking Libraries
Advantages:
- many libraries to choose from
- easy to implement
- wide variety of pre-built masks
Disadvantages:
- some are bulky and slow to load
- many have bugs that are hard to fix without modifying the source
- all give you less control over what’s happening
Here are some of the input masking libraries I’ve tested:
Plain Javascript: (180KB)
React: (5KB)
Angular, Ember, Vue: (4KB)
Regardless of the library used, the logic behind each implementation should be similar:
$("#cc").on("input propertychange paste", function() {
var value = $("#cc").val().replace(/\D/g, '');
var mask;
if ((/^3[47]\d{0,13}$/).test(value)) { // American Express
// set mask to 4-6-5
} else if ((/^3(?:0[0-5]|[68]\d)\d{0,11}$/).test(value)) { // Diner's Club
// set mask to 4-6-4
} else if ((/^\d{0,16}$/).test(value)) { // Other Credit Cards
// set mask to 4-4-4-4
}
// apply your input mask to #cc
});
Here’s an implementation of RobinHerbots’s Inputmask, which I believe to be the best library from the list above. Although it is significantly larger in size and comes with an array of unnecessary features, it allows user input of spaces, inserting/removing digits after spaces, and re-formatting of cards.
However, the cursor position isn’t retained if the card is re-formatted. If you start out by entering an American Express number (ex. 3782 822463 10005), and then delete the 3 in the beginning, the card is re-formatted correctly but the cursor skips to the end.
Although this isn’t that big of an issue, I wasn’t happy with it. It seemed that whatever library I used would miss out on at least one of the 4 goals. In the end, I got fed up and decided to implement my own input mask.
Custom Input Masking
I wanted my custom input mask to achieve all of the 4 goals while also retaining some quality of life features of input masking libraries, such as limiting the length. At its core, an input mask updates the current input value with the correctly formatted value.
To accomplish this, I created a function that takes in a card number and outputs the correctly formatted number. In this function, I also limit the length of the input depending on the card type:
function formatCardNumber(value) {
// remove all non digit characters
var value = value.replace(/\D/g, '');
var formattedValue;
var maxLength;
// american express, 15 digits
if ((/^3[47]\d{0,13}$/).test(value)) {
formattedValue = value.replace(/(\d{4})/, '$1 ').replace(/(\d{4}) (\d{6})/, '$1 $2 ');
maxLength = 17;
} else if((/^3(?:0[0-5]|[68]\d)\d{0,11}$/).test(value)) { // diner's club, 14 digits
formattedValue = value.replace(/(\d{4})/, '$1 ').replace(/(\d{4}) (\d{6})/, '$1 $2 ');
maxLength = 16;
} else if ((/^\d{0,16}$/).test(value)) { // regular cc number, 16 digits
formattedValue = value.replace(/(\d{4})/, '$1 ').replace(/(\d{4}) (\d{4})/, '$1 $2 ').replace(/(\d{4}) (\d{4}) (\d{4})/, '$1 $2 $3 ');
maxLength = 19;
}
$('#cc').attr('maxlength', maxLength);
return formattedValue;
}
The core functionality is achieved by a chain of
.replace methods. This allows for the card to be formatted as it is being typed. As such, we’re also not making use of the
acceptedCreditCards object that we defined earlier on. The RegEx is modified to match the IIN ranges of each issuer. For example, we can change the mask to 4–6–5 as soon as 34 or 37 is entered (American Express). Furthermore, for the cards that we support, only American Express (15 digits) and Diner’s Club (14 digits) require special formatting.
We can then update our input to reflect the formatted value:
$('#cc').on('input', function() {
var value = $('#cc').val();
var formattedValue = formatCardNumber(value);
$('#cc').val(formattedValue);
});
For 25 lines of code, this isn’t too bad. It allows user-input of spaces and re-formats credit card numbers. However, deleting any digit or inserting a digit before a space will move the cursor to the end. You also can’t delete spaces.
All of these bugs happen because updating the value of an input will move the cursor to the end. We can fix this by storing the cursor position and then updating it. There are also two blocks here that adjust the cursor position to allow for the removal of spaces and the insertion of digits before a space.
$('#cc').on('input', function() {
var node = $('#cc')[0]; // vanilla javascript element
var cursor = node.selectionStart; // store cursor position
var lastValue = $('#cc').val(); // get value before formatting
var formattedValue = formatCardNumber(lastValue);
$('#cc').val(formattedValue); // set value to formatted
// keep the cursor at the end on addition of spaces
if(cursor === lastValue.length) {
cursor = formattedValue.length;
// decrement cursor when backspacing// i.e. "4444 |" => backspace => "4444|"
if($('#cc').attr('data-lastvalue') && $('#cc').attr('data-lastvalue').charAt(cursor - 1) == " ") {
cursor--;
}
}
if (lastValue !== formattedValue) {
// increment cursor when inserting character before a space// i.e. "1234| 6" => "5" typed => "1234 5|6"
if(lastValue.charAt(cursor) == " " && formattedValue.charAt(cursor - 1) == " ") {
cursor++;
}
}
// set cursor position
node.selectionStart = cursor;
node.selectionEnd = cursor;
// store last value
$('#cc').attr('data-lastvalue', formattedValue);
});
Perfect! Now users can type spaces as they’re entering their card number, insert/remove digits before and after a formatted space, retain the cursor position when a digit is inserted or removed, and, when formatting is changed, re-format the card while preserving the cursor position.
Wrapping It Up
Now that we have the validation and formatting of credit cards complete, let’s combine them into the ultimate credit card form.
|
https://medium.com/hootsuite-engineering/a-comprehensive-guide-to-validating-and-formatting-credit-cards-b9fa63ec7863?source=collection_home---6------11-----------------------
|
CC-MAIN-2020-05
|
refinedweb
| 2,178
| 54.52
|
User Decision Text box not visible in SAP UWL
The Universal Work list (UWL) provides Portal users unified and centralized way to (single point of) access their work and the relevant information in the SAP Enterprise Portal. It collects tasks and notifications from multiple provider (ECC, SRM, CRM etc…) systems in one list for single access. We can call it as portal inbox for all work items. Configuration of UWL in portal is easy task but issues encounter during implementation and support phase is tough always. I always had good experience in each project and issues are unique in nature. I would like to share my recent experience to my peer group in SAP Community so that it would be helpful for their next implementations. This blog is not a guide on UWL configuration but it contains the knowledge I gained while trouble shooting the issue.
I know lot of information available on SCN portal forums and SAP help for UWL configuration .However issue resolution approach and similar issue I did not find any where in SAP community web sites. So I cannot stop myself to write this blog and hope it will be helpful to my fellow consultants.
EHSM team reported one issue, when user click on work item in portal UWL he / she should get text box to write comment in it before taking any action. It is working fine in Portal box and Portal DEV but not in Portal QAS, PRD
1) User not getting “User decision text box in Portal UWL.
2) When User selects work item in UWL then he is expecting “User decision text box” before taking any action. Following screen shot captured from development portal
3) To analyze issue I asked my workflow consultant to verify SWFVISU transaction in ECC system .There you can find list of task and it holds key information in task visualization. For example Task Number, visualization type, application, dynamic parameters, namespace, system alias etc…Every time any change in backend it should reflect in portal UWL. My workflow consultant verified and confirmed that it was same as ECC Dev which is working fine in portal Dev.
4) Then I started my analysis in portal side, First verified system object and alias then reregistered system object. Downloaded xml file from “Click to Manage Item Types and View Definitions”
5) Verified my xml code with my task number and manually added user decision code in xml file
<Properties>
<Property name=”UserDecisionNote” Value=”mandatory”/>
<Property name=”decisionKey” value=”1″/>
</Properties>
6) After uploading xml file into portal still issue is not resolved.
7) I checked portal server version in both development and quality then realized that there is version mismatch between dev and quality server. Referred note “1564566 – User decision note not visible”. Note says “If the value of the decisionKey property in the Actions section in UWL configuration XML starts with leading zeroes then the UserDecisionNote property in the XML configuration is disregarded”.Note also says portal upgrade is required from SP6 to SP9
8) While updating patch on portal server we caught with error and not allowed to proceed further. The UWLJWF component will fail on upgrade when this table contains data. You remove the data before upgrading from Table KMC_WF_SUBSTITUTE. Also take back up and deleted existing data. After the upgrade is finished, re-import the data into the respective tables from backup table which you have taken earlier.
9) After successful UWL patching our issues is resolved.
10) The conclusion is, we need to check the version difference across the systems. If there is any difference in support pack then we need to bring it to same level. However the above said issue resolved by upgrading UWL patch alone.
Hello Rajesh,
That is a good post.
Currently we are using portal 7.4.
What will be the suitable SP for this ??
BR,
Nagarjuna.P
Hi Rajesh
Further to this i have a question.
Specifically in travel management old workflow (before sap_basis patch 211) the decision task didn't have remarks field. Now if I enable remark / note field from xml then what would be additional task that I have to do to pass this note content to the workflow.
thank you for above information.
regards
barin
|
https://blogs.sap.com/2014/01/06/user-decision-text-box-not-visible-in-sap-uwl/
|
CC-MAIN-2022-05
|
refinedweb
| 709
| 52.8
|
Push the lwkt_replymsg() up one level from netisr_service_loop() to the message handler so we can explicitly reply or not reply as appropriate.
/*- * Copyright (c) 2001-2002 Luigi Rizzo * * Supported by: the Xorp/kern/kern_poll.c,v 1.2.2.4 2002/06/27 23:26:33 luigi Exp $ * $DragonFly: src/sys/kern/kern_poll.c,v 1.9 2004/04/09 22:34:09 hsu Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/socket.h> /* needed by net/if.h */ #include <sys/sysctl.h> #include <i386/include/md_var.h> /* for vm_page_zero_idle() */ #include <net/if.h> /* for IFF_* flags */ #include <net/netisr.h> /* for NETISR_POLL */ #ifdef SMP #include "opt_lint.h" #ifndef COMPILING_LINT #error DEVICE_POLLING is not compatible with SMP #endif #endif /* the two netisr handlers */ static void netisr_poll(struct netmsg *); static void netisr_pollmore(struct netmsg *); void init_device_poll(void); /* init routine */ void hardclock_device_poll(void); /* hook from hardclock */ void ether_poll(int); /* polling while in trap */ int idle_poll(void); /* poll while in idle loop */ /* * Polling support for [network] device drivers. * * Drivers which support this feature try to register with the * polling code. * * If registration is successful, the driver must disable interrupts, * and further I/O is performed through the handler, which is invoked * (at least once per clock tick) with 3 arguments: the "arg" passed at * register time (a struct ifnet pointer), a command, and a "count" limit. * * The command can be one of the following: * POLL_ONLY: quick move of "count" packets from input/output queues. * POLL_AND_CHECK_STATUS: as above, plus check status registers or do * other more expensive operations. This command is issued periodically * but less frequently than POLL_ONLY. * POLL_DEREGISTER: deregister and return to interrupt mode. * * The first two commands are only issued if the interface is marked as * 'IFF_UP and IFF_RUNNING', the last one only if IFF_RUNNING is set. * * The count limit specifies how much work the handler can do during the * call -- typically this is the number of packets to be received, or * transmitted, etc. (drivers are free to interpret this number, as long * as the max time spent in the function grows roughly linearly with the * count). * * Deregistration can be requested by the driver itself (typically in the * *_stop() routine), or by the polling code, by invoking the handler. * * Polling can be globally enabled or disabled with the sysctl variable * kern.polling.enable (default is 0, disabled) * * A second variable controls the sharing of CPU between polling/kernel * network processing, and other activities (typically userlevel tasks): * kern.polling.user_frac (between 0 and 100, default 50) sets the share * of CPU allocated to user tasks. CPU is allocated proportionally to the * shares, by dynamically adjusting the "count" (poll_burst). * * Other parameters can should be left to their default values. * The following constraints hold * * 1 <= poll_each_burst <= poll_burst <= poll_burst_max * 0 <= poll_in_trap <= poll_each_burst * MIN_POLL_BURST_MAX <= poll_burst_max <= MAX_POLL_BURST_MAX */ #define MIN_POLL_BURST_MAX 10 #define MAX_POLL_BURST_MAX 1000 SYSCTL_NODE(_kern, OID_AUTO, polling, CTLFLAG_RW, 0, "Device polling parameters"); static u_int32_t poll_burst = 5; SYSCTL_UINT(_kern_polling, OID_AUTO, burst, CTLFLAG_RW, &poll_burst, 0, "Current polling burst size"); static u_int32_t poll_each_burst = 5; SYSCTL_UINT(_kern_polling, OID_AUTO, each_burst, CTLFLAG_RW, &poll_each_burst, 0, "Max size of each burst"); static u_int32_t poll_burst_max = 150; /* good for 100Mbit net and HZ=1000 */ SYSCTL_UINT(_kern_polling, OID_AUTO, burst_max, CTLFLAG_RW, &poll_burst_max, 0, "Max Polling burst size"); static u_int32_t poll_in_idle_loop=1; /* do we poll in idle loop ? */ SYSCTL_UINT(_kern_polling, OID_AUTO, idle_poll, CTLFLAG_RW, &poll_in_idle_loop, 0, "Enable device polling in idle loop"); u_int32_t poll_in_trap; /* used in trap.c */ SYSCTL_UINT(_kern_polling, OID_AUTO, poll_in_trap, CTLFLAG_RW, &poll_in_trap, 0, "Poll burst size during a trap"); static u_int32_t user_frac = 50; SYSCTL_UINT(_kern_polling, OID_AUTO, user_frac, CTLFLAG_RW, &user_frac, 0, "Desired user fraction of cpu time"); static u_int32_t reg_frac = 20 ; SYSCTL_UINT(_kern_polling, OID_AUTO, reg_frac, CTLFLAG_RW, ®_frac, 0, "Every this many cycles poll register"); static u_int32_t short_ticks; SYSCTL_UINT(_kern_polling, OID_AUTO, short_ticks, CTLFLAG_RW, &short_ticks, 0, "Hardclock ticks shorter than they should be"); static u_int32_t lost_polls; SYSCTL_UINT(_kern_polling, OID_AUTO, lost_polls, CTLFLAG_RW, &lost_polls, 0, "How many times we would have lost a poll tick"); static u_int32_t pending_polls; SYSCTL_UINT(_kern_polling, OID_AUTO, pending_polls, CTLFLAG_RW, &pending_polls, 0, "Do we need to poll again"); static int residual_burst = 0; SYSCTL_INT(_kern_polling, OID_AUTO, residual_burst, CTLFLAG_RW, &residual_burst, 0, "# of residual cycles in burst"); static u_int32_t poll_handlers; /* next free entry in pr[]. */ SYSCTL_UINT(_kern_polling, OID_AUTO, handlers, CTLFLAG_RD, &poll_handlers, 0, "Number of registered poll handlers"); static int polling = 0; /* global polling enable */ SYSCTL_UINT(_kern_polling, OID_AUTO, enable, CTLFLAG_RW, &polling, 0, "Polling enabled"); static u_int32_t phase; SYSCTL_UINT(_kern_polling, OID_AUTO, phase, CTLFLAG_RW, &phase, 0, "Polling phase"); static u_int32_t suspect; SYSCTL_UINT(_kern_polling, OID_AUTO, suspect, CTLFLAG_RW, &suspect, 0, "suspect event"); static u_int32_t stalled; SYSCTL_UINT(_kern_polling, OID_AUTO, stalled, CTLFLAG_RW, &stalled, 0, "potential stalls"); #define POLL_LIST_LEN 128 struct pollrec { poll_handler_t *handler; struct ifnet *ifp; }; static struct pollrec pr[POLL_LIST_LEN]; /* * register relevant netisr. Called from kern_clock.c: */ void init_device_poll(void) { netisr_register(NETISR_POLL, cpu0_portfn, netisr_poll); netisr_register(NETISR_POLLMORE, cpu0_portfn, netisr_pollmore); } /* *. * * WARNING! called from fastint or IPI, the MP lock might not be held. */ void hardclock_device_poll(void) { static struct timeval prev_t, t; int delta; if (poll_handlers == 0) return; microuptime(&t); delta = (t.tv_usec - prev_t.tv_usec) + (t.tv_sec - prev_t.tv_sec)*1000000; if (delta * hz < 500000) short_ticks++; else prev_t = t; if (pending_polls > 100) { /* * Too much, assume it has stalled (not always true * see comment above). */ stalled++; pending_polls = 0; phase = 0; } if (phase <= 2) { if (phase != 0) suspect++; phase = 1; schednetisr(NETISR_POLL); phase = 2; } if (pending_polls++ > 0) lost_polls++; } /* * ether_poll is called from the idle loop or from the trap handler. */ void ether_poll(int count) { int i; int s = splimp(); if (count > poll_each_burst) count = poll_each_burst; for (i = 0 ; i < poll_handlers ; i++) if (pr[i].handler && (IFF_UP|IFF_RUNNING) == (pr[i].ifp->if_flags & (IFF_UP|IFF_RUNNING)) ) pr[i].handler(pr[i].ifp, 0, count); /* quick check */ splx(s); } /* * idle_poll is replaces the body of the idle loop when DEVICE_POLLING * is used. YYY not currently implemented. */ int idle_poll(void) { if (poll_in_idle_loop && poll_handlers > 0) { int s = splimp(); cpu_enable_intr(); ether_poll(poll_each_burst); cpu_disable_intr(); splx(s); vm_page_zero_idle(); return 1; } else return vm_page_zero_idle(); } /* * netisr_pollmore is called after other netisr's, possibly scheduling * another NETISR_POLL call, or adapting the burst size for the next cycle. * * It is very bad to fetch large bursts of packets from a single card at once, * because the burst could take a long time to be completely processed, or * could saturate the intermediate queue (ipintrq or similar) leading to * losses or unfairness. To reduce the problem, and also to account better for * time spent in network-related processing, we split the burst in smaller * chunks of fixed size, giving control to the other netisr's between chunks. * This helps in improving the fairness, reducing livelock (because we * emulate more closely the "process to completion" that we have with * fastforwarding) and accounting for the work performed in low level * handling and forwarding. */ static struct timeval poll_start_t; /* ARGSUSED */ static void netisr_pollmore(struct netmsg *dummy __unused) { struct timeval t; int kern_load; int s = splhigh(); phase = 5; if (residual_burst > 0) { schednetisr(NETISR_POLL); /* will run immediately on return, followed by netisrs */ goto out; } /* here we can account time spent in netisr's in this tick */ microuptime(&t); kern_load = (t.tv_usec - poll_start_t.tv_usec) + (t.tv_sec - poll_start_t.tv_sec)*1000000; /* us */ kern_load = (kern_load * hz) / 10000; /* 0..100 */ if (kern_load > (100 - user_frac)) { /* try decrease ticks */ if (poll_burst > 1) poll_burst--; } else { if (poll_burst < poll_burst_max) poll_burst++; } pending_polls--; if (pending_polls == 0) /* we are done */ phase = 0; else { /* * Last cycle was long and caused us to miss one or more * hardclock ticks. Restart processing again, but slightly * reduce the burst size to prevent that this happens again. */ poll_burst -= (poll_burst / 8); if (poll_burst < 1) poll_burst = 1; schednetisr(NETISR_POLL); phase = 6; } out: splx(s); lwkt_replymsg(&msg->nm_lmsg, 0); } /* * netisr_poll is scheduled by schednetisr when appropriate, typically once * per tick. It is called at splnet() so first thing to do is to upgrade to * splimp(), and call all registered handlers. */ /* ARGSUSED */ static void netisr_poll(struct netmsg *dummy __unused) { static int reg_frac_count; int i, cycles; enum poll_cmd arg = POLL_ONLY; int s=splimp(); phase = 3; if (residual_burst == 0) { /* first call in this tick */ microuptime(&poll_start_t); /* * Check that paremeters are consistent with runtime * variables. Some of these tests could be done at sysctl * time, but the savings would be very limited because we * still have to check against reg_frac_count and * poll_each_burst. So, instead of writing separate sysctl * handlers, we do all here. */ if (reg_frac > hz) reg_frac = hz; else if (reg_frac < 1) reg_frac = 1; if (reg_frac_count > reg_frac) reg_frac_count = reg_frac - 1; if (reg_frac_count-- == 0) { arg = POLL_AND_CHECK_STATUS; reg_frac_count = reg_frac - 1; } if (poll_burst_max < MIN_POLL_BURST_MAX) poll_burst_max = MIN_POLL_BURST_MAX; else if (poll_burst_max > MAX_POLL_BURST_MAX) poll_burst_max = MAX_POLL_BURST_MAX; if (poll_each_burst < 1) poll_each_burst = 1; else if (poll_each_burst > poll_burst_max) poll_each_burst = poll_burst_max; residual_burst = poll_burst; } cycles = (residual_burst < poll_each_burst) ? residual_burst : poll_each_burst; residual_burst -= cycles; if (polling) { for (i = 0 ; i < poll_handlers ; i++) if (pr[i].handler && (IFF_UP|IFF_RUNNING) == (pr[i].ifp->if_flags & (IFF_UP|IFF_RUNNING)) ) pr[i].handler(pr[i].ifp, arg, cycles); } else { /* unregister */ for (i = 0 ; i < poll_handlers ; i++) { if (pr[i].handler && pr[i].ifp->if_flags & IFF_RUNNING) { pr[i].ifp->if_ipending &= ~IFF_POLLING; pr[i].handler(pr[i].ifp, POLL_DEREGISTER, 1); } pr[i].handler=NULL; } residual_burst = 0; poll_handlers = 0; } schednetisr(NETISR_POLLMORE); phase = 4; splx(s); lwkt_replymsg(&msg->nm_lmsg, 0); } /* * Try to register routine for polling. Returns 1 if successful * (and polling should be enabled), 0 otherwise. * A device is not supposed to register itself multiple times. * * This is called from within the *_intr() functions, so we do not need * further locking. */ int ether_poll_register(poll_handler_t *h, struct ifnet *ifp) { int s; if (polling == 0) /* polling disabled, cannot register */ return 0; if (h == NULL || ifp == NULL) /* bad arguments */ return 0; if ( !(ifp->if_flags & IFF_UP) ) /* must be up */ return 0; if (ifp->if_ipending & IFF_POLLING) /* already polling */ return 0; s = splhigh(); if (poll_handlers >= POLL_LIST_LEN) { /* * List full, cannot register more entries. * This should never happen; if it does, it is probably a * broken driver trying to register multiple times. Checking * this at runtime is expensive, and won't solve the problem * anyways, so just report a few times and then give up. */ static int verbose = 10 ; splx(s); if (verbose >0) { printf("poll handlers list full, " "maybe a broken driver ?\n"); verbose--; } return 0; /* no polling for you */ } pr[poll_handlers].handler = h; pr[poll_handlers].ifp = ifp; poll_handlers++; ifp->if_ipending |= IFF_POLLING; splx(s); return 1; /* polling enabled in next call */ } /* * Remove interface from the polling list. Normally called by *_stop(). * It is not an error to call it with IFF_POLLING clear, the call is * sufficiently rare to be preferable to save the space for the extra * test in each driver in exchange of one additional function call. */ int ether_poll_deregister(struct ifnet *ifp) { int i; int s = splimp(); if ( !ifp || !(ifp->if_ipending & IFF_POLLING) ) { splx(s); return 0; } for (i = 0 ; i < poll_handlers ; i++) if (pr[i].ifp == ifp) /* found it */ break; ifp->if_ipending &= ~IFF_POLLING; /* found or not... */ if (i == poll_handlers) { splx(s); printf("ether_poll_deregister: ifp not found!!!\n"); return 0; } poll_handlers--; if (i < poll_handlers) { /* Last entry replaces this one. */ pr[i].handler = pr[poll_handlers].handler; pr[i].ifp = pr[poll_handlers].ifp; } splx(s); return 1; }
|
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_poll.c?f=h;rev=1.9
|
CC-MAIN-2014-42
|
refinedweb
| 1,788
| 52.6
|
- If you are able to upgrade to a new version of flickrapi, you can get the latest flickrapi from PyPI.
However, as of mid-2014, many Linux distros, including Ubuntu 14.04 (supported until 2019), still package flickrapi version 1.2, which cannot connect to Flickr's API and is therefore non-functional. Since developers may for various reasons choose to use their distro's version of python-flickrapi, this project provides a very very small Python class that overrides flickrapi's FlickrAPI class to connect to Flickr over HTTPS rather than HTTP, and allows continued use of the Flickr API.
If you were previously doing something like this:
import flickrapi flickr_conn = flickrapi.FlickrAPI(api_key, api_secret)
You can replace it with this:
import flickrssl flickr_conn = flickrssl.FlickrAPI(api_key, api_secret)
|
https://gitlab.com/puzzlement/flickrapissl/blob/master/README.md
|
CC-MAIN-2016-44
|
refinedweb
| 129
| 62.98
|
07 August 2012 10:35 [Source: ICIS news]
(adds outlook and segment earnings)
LONDON (ICIS)--German specialty chemicals maker LANXESS on Tuesday said it does not expect to see any further momentum in the second half of the year in view of increasing economic challenges.
The company continues to predict weak economic development in Europe as a result of the euro debt crisis, while it anticipates moderate economic growth in Asia and Latin America, and continued expansion in the ?xml:namespace>
Raw material and energy costs are expected to remain volatile in the second half of the year.
LANXESS said it expects the earnings before interest, tax, depreciation and amortisation (EBITDA) contributions of the first half of the year in relation to the second half in a ratio of 60:40.
“We therefore expect the operating result in the second half of 2012 to be approximately at the prior-year level,” said CEO Axel Heitmann.
For the whole 2012, the company confirmed it expects its EBITDA pre-exceptionals to grow by 5–10%, said Heitmann.
In addition, on the back of strategic investment projects in growth markets in the first half of the year, the company has now forecast that its capital expenditures in 2012 will be €650m–700m ($802m–864m), compared with €600m originally planned.
“Our performance is reflected against a very strong previous year and we are on the way to achieving an even better result in 2012 after our strong second quarter,” said Heitmann.
The company's second-quarter net profit fell by 2.8% year on year to €176m, weighed down by exceptional charges from reorganisation at its Performance Chemicals segment.
Its group sales increased by 8.1% year on year to €2.42bn in the second quarter, “mainly as a result of currency effects and selling price increases”, it said.
“Raw material cost increases were fully passed on to the market in all segments,” added LANXESS.
The firm’s EBITDA pre-exceptionals rose by 6.8% year on year to €362m during the same period, said the company.
The company’s Performance Polymers segment registered a year-on-year sales increase of more than 11% in the second quarter of 2012, to €1.43bn, as rising raw material costs, especially for butadiene (BD) and isobutylene, were quickly passed on to the market through selling price increases. EBITDA pre-exceptionals for the segment rose by more than 12% to €257m.
Sales in the Advanced Intermediates segment edged up by 1% in the second quarter to €399m, supported by strong demand for agrochemicals despite weakness in the construction and coatings industries. The segment’s EBITDA pre-exceptionals grew by 22% year on year to €79m.
The Performance Chemicals segment’s sales rose by more than 4% against the same period last year, to €585m, LANXESS said. However, EBITDA pre-exceptionals fell by nearly 18% to €78m following a “decline in orders from the construction and electrical/electronics industries, as well as by maintenance shutdowns in a number of business
|
http://www.icis.com/Articles/2012/08/07/9584528/germanys-lanxess-not-expecting-further-momentum-in-h2-2012.html
|
CC-MAIN-2014-49
|
refinedweb
| 502
| 50.46
|
The following code does the same lookups using a list and a dictionary. Lists are sequential in memory, meaning that the program has to get the offset for the beginning of the item it wants to use, go to that offset, compare to what it wants to find, and go back and do it all over again for each element in the list. A dictionary uses a hash which creates small groups, for lack of a better term, so there is a relatively small number of lookups. For each tenfold increase in data, the dictionary's time increases by ten times also, but is still pretty fast. The list's lookup time increases by 100+ times for the same increase. One would expect the same increases for a tenfold increase in the size of each individual item being stored as that would also increase the anount of memory that has to be traversed. So it appears that you can't really decide on using a list vs. dictionary based on the number of items but have to consider the total amount of memory to be consumed.
import datetime def add_to_list(num): a_list=[] start_time=datetime.datetime.now() for ctr in xrange(num): ## lookup up each time to show the "cost" of lookups if ctr not in a_list: a_list.append(ctr) print "elapsed time:", datetime.datetime.now()-start_time def add_to_dict(num): a_dict={} start_time=datetime.datetime.now() for ctr in xrange(num): ## lookup up each time to show the "cost" of lookups if ctr not in a_dict: a_dict[ctr]=ctr print "elapsed time:", datetime.datetime.now()-start_time for num in [1000, 10000, 100000]: print "list of %6d" % (num), add_to_list(num) print "dict of %6d" % (num), add_to_dict(num) print """ compare execute times for list vs. dictionary for different lengths of input data list of 1000 elapsed time: 0:00:00.012220 dict of 1000 elapsed time: 0:00:00.000264 Approx 61 times faster list of 10000 elapsed time: 0:00:01.210761 dict of 10000 elapsed time: 0:00:00.003146 Approx 390 times list of 100000 elapsed time: 0:02:30.698131 dict of 100000 elapsed time: 0:00:00.03296 Approx 4566.7 times """
|
https://www.daniweb.com/programming/software-development/threads/450381/timing-lists-vs-dictionaries
|
CC-MAIN-2018-43
|
refinedweb
| 363
| 72.97
|
my friends, I want to ask about JSP, and I am still confused, because i am new in JSP and i am in processs of learning, and do not understand about the JSP.
how to create a file.war anyway?explain to me step by step,one by one, from the beginning until the end, from step one to the end,so i can understand, pleasee.. i am really need help
AND NEXT QUESTION IS:
how to create a swing that acts as an applet, with characteristic using JApplet class, with the following code sample:
public class extends JApplet {SwingApplet
JButton button;
public void init () {
/ / Force SwingApplet to come up in the System L & F
String laf = UIManager.getSystemLookAndFeelClassName ();
try {
UIManager.setLookAndFeel (laf);
/ / If you want the Cross Platform L & F instead, comment out the above line and
/ / Uncomment the Following:
/ / UIManager.setLookAndFeel (UIManager.getCrossPlatformLookAndFeelClassName ());
} Catch (UnsupportedLookAndFeelException exc) {
System.err.println ("Warning: UnsupportedLookAndFeel:" + laf);
} Catch (Exception exc) {
System.err.println ("Error loading" + laf + ":" + exc);
}
getContentPane (). setLayout (new FlowLayout ());
button = new JButton ("Hello, I'm a Swing Button");
getContentPane (). add (button);
}
public void stop () {
if (button! = null) {
getContentPane (). remove (button);
button = null;
}
}
}
LAST QUESTION :
Make a swing that can display a query data form from following picture,from file .docx that i upload:
please help ya, I really beg, and God bless you all
Forum Rules
|
http://forums.codeguru.com/showthread.php?523009-JSP-and-file-war&p=2064182
|
CC-MAIN-2014-35
|
refinedweb
| 225
| 55.03
|
What is Exploratory Data Analysis?
Exploratory data analysis (EDA) is a critical component of any data scientist's tool box. EDA involves learning about a data set to make sure you're using the right predictive tools to analyze it.
Despite their importance, exploratory data analysis principles are seldom taught. They are learned through the course of building many real data science projects.
This tutorial will teach you the basics of exploratory data analysis in Python.
Table of Contents
You can skip to a specific section of this exploratory data analysis tutorial using the table of contents below:
- What is Exploratory Data Analysis (EDA)?
- Why is EDA Important?
-
- A Simple EDA Exercise in Python
- Final Thoughts
What is Exploratory Data Analysis (EDA)?
Exploratory data analysis (EDA) is used to analyze a data set to assess its nature and characteristics. EDA primarily uses visualization techniques to do this.
The objectives of EDA are
- To understand the distribution of the dataset
- To identify potential patterns and trends
- To identify outliers or anomalies
- To produce a hypothesis
- To validate assumptions
- To generate a visually-summarized representation of the dataset
Why is EDA Important?
Although many tend to skip it, exploratory data analysis is an essential step in any data science project. It helps you understand whether the model you're applying to the data will be logical, well-defined, and scoped within the boundaries of its intended application.
EDA also helps to find anomalies, errors, noise, loss of data, and the overall validity of the data set with respect to the application.
Performing EDA helps you in modeling outcomes, determining the best-suited algorithm, finding new data patterns, and even defining which variables are dependent and independent.
Using proper exploratory data analysis techniques can save you from building invalid or erroneous models, building models on unsuitable data, selecting unsuitable variables, and even unoptimized development of the model. EDA can be helpful in preparing data for the model as well (this is typically called data cleaning).
EDA can also save you from making bad predictions by revealing that your data set is not adequate for the task at hand. This means you'll need to go back to the data collection stage.
To summarize, the main goal of EDA is to ensure that the dataset aligns with the model that you're building. The rest of this article will explain a few methods you can use to perform exploratory data analyses.
Methods to Perform EDA
There are many methods that can be used for exploratory data analysis.
Note that as with everything else, it's often best to use multiple EDA techniques. You can then compare the results of each analysis to see if they align with each other.
Univariate Visualization
This method can be used to produce a statistical summary for each separate column of the unprocessed dataset.
Bivariate Visualization
This method is used to determine the connection between each independent variable and the intended dependent variable.
Multivariate Visualization
This method can be used to understand the relationship between different columns of the dataset.
Dimensionality Reduction
In simple terms, dimensionality reduction can be used to reduce the number of dimensions in a dataset and transform to another dimensional space that is lower than the original while still sustaining the meaningful and resourceful characteristics of the dataset.
Principal component analysis is one of the most common techniques used for dimensionality reduction.
Dimensionality reduction methods can be used to develop questions to answer during your analysis or to develop a sense of how the results of this model should be interpreted. The usual procedure to perform exploratory data analysis in your code is as follows.
- Acquire a suitable dataset and import it
- Understand the nature of the dataset by observing data from different rows.
- Try to further understand the nature of the dataset by querying the data
- Identify if there are any missing values and determine how the handle the missing data
- Try to comprehend the features of the dataset from a data science standpoint
- Identify the difficulties of working with the dataset due to its missing and extreme values.
- Identify any potential patterns even if they cannot be explained right away
This process is often encompassed by a step called data profiling.
Data profiling is performed after summarizing the dataset using visualization and statistics to help you understand the dataset even better.
Based on the outcome of data profiling, the next steps can be decided regarding the dataset whether or not to rectify or reject depending on the suitability to the potential machine learning model.
We will now put everything we have learned to practice.
A Simple EDA Exercise in Python
We will now get started with getting ourselves familiar with the basics of exploratory data analysis by practicing on a dataset.
We will be using the Cortex cryptocurrency dataset in this exercise.
You'll also need the following libraries as a prerequisite:
Pandas is a highly optimized Python library written for manipulation and analysis of data. It is well-known for its highly useful pandas DataFrame data structure.
NumPy is one of the most versatile libraries intended towards mathematical and numerical computations on matrices of various dimensions. It's NumPy array data structure is similar to a Python list, but is more well-suited towards high-performance computing.
Matplotlib is a Python library that is written for the visualization of data.
- Seaborn
Seaborn is a library that is based on Matplotlib and it helps to make visualizations of data easier.
We will now install the above libraries using the
pip package manager. Run the following statements on your command line to do this:
pip install pandas pip install numpy pip install matplotlib pip install seaborn
Additionally, we also require the
datapackage library to be installed. This is because we are directly importing data through a remote server.
pip install datapackage
Now that our imports are complete, you can import the data for this tutorial with the following code:
import pandas as pd import datapackage remote_url = '' my_pkg = datapackage.Package(remote_url) my_rsc = my_pkg.resources for rsc in my_rsc: if rsc.tabular: df = pd.read_csv(rsc.descriptor['path']) df
The last line of this code block will output the data as follows.
If we look at the fields within this data set, we will see that there are 8 columns (in addition to the index column).
For this exercise, you don't need to know what each column means from the start. Just know that they are variables. You will get familiar with each specific column as you work through this tutorial.
If you want to learn the shape of the data set, you can easily run the following command to get the number of columns and rows.
df.shape
Here's the output of this command:
(156, 8)
This means the above dataset has 156 observations and 8 features.
In addition to that, by running the following
head and
tail statements, you can print the first five rows and the last five rows from the dataset.
df.head()
This prints:
Similarly, here's how you can print the tail of the data set:
df.tail()
This prints:
As we noticed in the first five observations, the data set contains null values. It's important to understand how prevalent these null values are in the rest of the dataset.
The
info method is an excellent tool for learning more about missing data in a pandas DataFrame.
df.info()
This generates:
The output of the
info method tells us that except for the
date field, all the other fields have float values.
Moreover, except for in the
date column, every other field has
NaN values.
We have a few options on how to deal with this missing data:
- go ahead with the existing table
- replace the
NaNvalues with another value
- discard all the observations that have
NaNvalues
In this scenario, let’s choose the last option and drop all the observations with
NaN fields. We'll use the pandas
dropna method to do this:
df = df.dropna() df
Here's what the new DataFrame looks like:
To see how many rows have been removed from our data set, we can look at the DataFrame's
shape attribute:
df.shape
Here's the output of this code:
(119, 8)
You can tell that our data set has dropped from
156 observations originally to
119 observations now. This shows that there were 37 observations with missing data in the original data set.
You'll also notice that the DataFrame's indices start from 37 and have lost their consistency. You can reset the indices of the DataFrame using the
reset_index method, like this:
df = df.reset_index(drop = True)
This will reset the indices of the DataFrame. Note that we've passed a
drop = True argument into the
reset_index method because we do not require the old indices to be included in the new DataFrame as another column.
We can now use the
pandas.describe() function to look at a summary of all the fields using statistics like means, percentiles, standard deviation, minimums, and maximums.
df.describe()
If you want to know the median of a particluar column, it's not explicitly labelled here. With that said, the median is just another name for the 50th percentile.
You can see from this output that the difference between the 50th percentile and the 75th percentile of
txCount field is much greater than the difference between the 25th percentile and the 50th percentile.
The
describe method also shows similar characteristics for some of the other fields. In many columns, the mean is significantly higher than its median.
Both these observations suggest that there are outliers in the dataset.
Provided that this dataset had lots of similar values or repeated values, we could have used the
unique() function to observe all the unique values from each field. In addition, the
value_counts() method shows the number of times each value in a column occurs.
Take your own time and try to observe more patterns in the dataset. There could be hundreds of different patterns that are just waiting to be found!
Now that we are a bit familiar with the nature of this dataset, we can produce a correlation matrix for this dataset using the
corr() function.
Correlation matrices are highly useful in summarizing massive amounts of data and to identify patterns among the different fields. They also allow us to perform diagnostics to find if certain variables are extremely correlated to each other. This indicates multicollinearity and would suggest that some types of modelling (such as linear regressions) would produce unreliable predictions.
Here's the code to generate a correlation matrix from the DataFrame:
df.corr()
Here's the output of this code:
You'll also want to use the
seaborn library we installed earlier to generate some visualizations. Let's start by importing the library into our script:
import seaborn as sns import matplotlib.pyplot as plt
One of my favorite
seaborn visualizations is the
heatmap. Here's the code to generate a basic
heatmap using
seaborn that presents our correlation matrix in a visually-appealing manner:
sns.heatmap(df.corr(), annot=True) plt.show()
This visualization reveals that
txCount has a very strong positive correlation with
activeAddresses.
Why is this?
If we consider what
txCount actually is, it is a field that denotes the number of blockchain transactions that a specific user has completed. The field
activeAddresses represents the number of individual addresses that have engaged in blockchain transactions with that specific user. With this in mind, it makes sense that these two fields have a high correlation.
There are many more such patterns in this data set. Try and identify more of the. It's a great way to practice your exploratory data analysis skills!
You can also look at how the price has changed over the available dates. Let's first see if there are any duplicate dates. As you already know, there are
119 observations. Let's produce the array of unique values in the date field and find its length:
len(df['date'].unique())
This returns:
119
Since then number of unique dates is equal to the number of total dates, this shows that all dates are unique.
It also shows that the dates are in chronological order even with the
NaN values dropped.
Let's produce a matplotlib scatterplot to see how the prices have changed over the months:
import matplotlib.pyplot as plt plt.scatter(df['date'],df['price(USD)']) plt.xlabel('Timeline') plt.ylabel('Price') plt.show()
We can also produce a scatterplot that shows how the number of active addresses has varied over the months.
import matplotlib.pyplot as plt plt.scatter(df['date'],df['activeAddresses']) plt.xlabel('Active Addresses') plt.ylabel('Price') plt.show()
From the description we produced earlier, we know that the mean for active addresses is approximately 204.
We also observed that on some dates, there are numbers as high as
4270 and numbers as low as
16.
The charts we just created allow us to observe those outliers in a visual way.
There are many more patterns in this data set that are best observed visually. Feel free to produce more plots involving other fields that might be useful in inferring important information in this exploratory data analysis step.
Final Thoughts
Exploratory data analysis is used to summarize and analyze data using techniques like tabulation and visualization.
Using EDA in statistical modeling can be extremely useful in determining the best-suited model for the problem at hand. Moreover, it also helps in identifying unseen patterns in a dataset.
This tutorial provided a broad overview of exploratory data analysis techniques. Please feel free to use it as a reference when approaching new data science problems in the future.
|
https://nickmccullum.com/what-is-exploratory-data-analysis/
|
CC-MAIN-2021-04
|
refinedweb
| 2,299
| 53.81
|
Some Assembly Required - It's Hot in Here. Connecting to Diverse Sources of Temperature…
Scott Hanselman
Summary: To kick off his new "Some Assembly Required" column, Scott Hanselman explains how to use Visual C# 2005 Express Edition and the .NET Framework 2.0 to control an LED Display Panel and interface it with Windows Media Player or iTunes to show "What's Playing?"
Interfacing with the World
Welcome.
I'm constantly surprised by how much can be accomplished with so little code as I wander the Web and the Blogosphere. We are truly standing on the shoulders of giants. I recall manually configuring jumpers to get my Sound Blaster off IRQ5, and now I can plug my 256 Meg USB Key directly into the hub on my flat screen LCD with zero configuration. Things have certainly changed.
What's Playing?
When I first read Duncan Mackenzie's article "Coding in the Blue Glow" I was totally digging his CrystalFontz LCD Panel. I knew one day I wanted to write an application to report whatever music I was currently playing. It seems that everyone who's blogging includes a little tagline telling you what they're listening to this instant, why shouldn't I have a backlight LCD informing my officemates?
Our goal is to write a .NET Framework-based application using Visual C# 2005 Express Edition that interfaces with a CrystalFontz XE634 4-line by 20-character or XE632 2-line by 16-character display. Both are USB displays with associated virtual COM ports. These virtual ports are very useful to us because there's no standard way to address a USB device, but programming to a COM port is an easily understood problem for us to solve.
The application will determine the song currently playing in either Windows Media Player or iTunes and output the title, artist name, album and song length to the LCD panel.
Figure 1. The CrystalFontz USB LCD displays have an associated “virtual” COM Port.
After installing the free drivers for the CrystalFontz LCD the device manager shows both the USB device and the virtual COM port. I take note that the virtual COM port is COM3 on my system. I'll want to make that a configurable part of the application.
The Magic that is the new System.IO.Ports Namespace
That column was written in 2003 and Duncan lamented the lack of Serial Port support in the .NET Framework 1.x. It was a major drag and folks, particularly hobbyists, have been complaining about it on the boards for years. Well, complain no more because System.IO.Ports is here in the 2.0 BCL and it's very intuitive to use!
Here is a subset of the methods and properties of the System.IO.Ports.SerialPort class that comes new with the .NET BCL 2.0:
public class SerialPort : System.ComponentModel.Component
{
public System.IO.Stream BaseStream {get; }
public int BaudRate {get; set; }
public void Close();
public int DataBits {get; set; }
public bool DsrHolding {get; }
public bool DtrEnable {get; set; }
public System.Text.Encoding Encoding {get; set; }
public static string[] GetPortNames();
public static int InfiniteTimeout;
public bool IsOpen {get; }
public void Open();
public System.IO.Ports.Parity Parity {get; set; }
public int Read(char[] buffer, int offset, int count);
public int Read(byte[] buffer, int offset, int count);
public int ReadBufferSize {get; set; }
public int ReadByte();
public int ReadChar();
public string ReadExisting();
public string ReadLine();
public string ReadTo(string value);
public int ReceivedBytesThreshold {get; set; }
public SerialPort(string portName, int baudRate, System.IO.Ports.Parity parity, int dataBits, System.IO.Ports.StopBits stopBits);
public SerialPort(string portName, int baudRate, System.IO.Ports.Parity parity, int dataBits);
public SerialPort(string portName, int baudRate, System.IO.Ports.Parity parity);
public SerialPort(string portName, int baudRate);
public SerialPort(string portName);
public System.IO.Ports.StopBits StopBits {get; set; }
public void Write(byte[] buffer, int offset, int count);
public void Write(char[] buffer, int offset, int count);
public void Write(string str);
public void WriteLine(string str);
}
Since I'll be writing data (rather than reading it) to the LCD, I suspect I'll be using some of the Write() overloads, as well as Open() and IsOpen. I'll want to read the hardware specification for the LCD Display that I'm using to create an LCDPanel class that models the Display's capabilities. Note: The spec for the 634 I'm using corresponds with hardware v2.0 and firmware v2.0, but the concepts in this article can be applied to any LCD panel with a serial interface.
Reading a Hardware Spec
The CrystalFontz Hardware Specification has a section called "Explanation of Control Functions" that lists each of the commands that can be sent to the LCD Panel. Here are a few sentences that stand out and will drive the implementation:
The Crystalfontz intelligent serial displays will accept “plain ASCII” characters and display them on the screen at the current cursor position. For instance, if you send “Hello World”, the display shows “Hello World”.
That's useful, and it means we can perform a "Hello World" test with the following code.
SerialPort port = new SerialPort("COM3",19200);
port.Open();
port.Write("Hello World");
port.Close();
My LCD Panel is on COM3 as seen in Figure 1, and the specification, as well as the LCD's own boot up screen, indicate that it's running at 19.2k or 19200 bits per second.
Now that I can write out a few things to the LCD Panel, I'll design a class that exposes the useful things about the Panel (what it can do) and hides a reasonable amount of the details (what's hard). After reading the spec, here are the definitions for the LCDPanel Class. Notice that our LCDPanel contains a SerialPort. When the LCDPanel is constructed, the developer can pass in the PortNumber and Baud Rate as well as an enum describing what model of panel it is. We'll open the SerialPort in the constructor and include not only a Close() method, but we'll also make the LCDPanel "IDisposable." This will allow use of the Using() keyword in both C# and VB that will automatically call Dispose (which will in turn call Close).
public
class LCDPanel : IDisposable
{
private SerialPort port;
private LCDType type;
public
void Write(string text)
public void Write(string[] lines)
public void Write(byte[] bytes)
public void Write(byte aByte)
public void Write(int anInt)
public void Write(Command aCommand)
public void Write(HorizontalGraphStyle aStyle)
public void WriteToRow(string text, int row)
public void WriteToRow(string text, int row, TextAlignment alignment)
public void WriteToRow(string text, int row, TextAlignment alignment, bool clearRow)
public int MaxWidth
public
void SetContrast(int level)
public void SetBacklight(int level)
public void SetCursorPosition(int column, int row)
public void ShowHorizontalBarGraph(HorizontalGraphStyle style, int startColumn, int endColumn, int lengthInPixels, int row)
public void SetMarqueeString(string marquee)
public void StartMarquee(int row, int pixelShift, int updateSpeed)
public void StopMarquee()
public void MoveUp()
public void MoveDown()
public void MoveRight()
public void MoveLeft()
}
It might look complicated, but for now, just focus on the Write() method overloads. There are seven of them, and three for WriteToRow. The ones that take a string will write out the string to a port, just like we did with our Hello World test earlier. We'll also write out the same text to System.Diagnostics.Trace.Write for debugging purposes.
public void Write(string text)
{
port.Write(text);
Trace.Write(text);
}
In the "Control Functions" section of the CrystalFontz Hardware Specification it lists out each of the commands that the LCD panel understands.
In this manual, for "Binary" data the notation \xxx is used, where xxx is the decimal representation of the number. \000 to \255 cover all possible values for a character.
So, in this specification \000 means a byte "0" and \255 is byte "255." If we're going to be writing out bytes, it's fortunate that System.IO.Ports.SerialPort.Write() has an overload that takes a byte array. We can now add three implement Write() methods for our LCDPanel class, one that takes a byte array, which maps directly to the underlying SerialPort, one that takes a single byte and calls laterally to the byte array overload. A final class takes an int and down-casts it to a byte. Note that in these three functions we're adding a lot of flexibility to the programmer but there's only one call to port.Write in the code. Making smart and thoughtful use of overloads is a great way to add flexibility to a developer-focused API, but adds additional testing burden.
public void Write(byte[] bytes)
{
if (bytes == null) throw new ArgumentNullException("bytes");
port.Write(bytes, 0, bytes.Length);
}
public void Write(byte aByte)
{
Write(new byte[] { aByte });
}
public void Write(int anInt)
{
Write((byte)anInt);
}
The specification lists out a pile of Commands that can be sent to the LCD Panel. Here are a few from the spec:
\001 Cursor Home
\002 Hide Display
\003 Restore Display
\004 Hide Cursor
\005 Show Underline Cursor
\006 Show Block Cursor
\007 Show Inverting Block Cursor
etc...
Looks like it's time for an enum!
public enum Command :
byte
{
CursorHome = 1,
HideDisplay = 2,
RestoreDisplay = 3,
HideCursor = 4,
ShowUnderlineCursor = 5,
ShowBlockCursor = 6,
ShowInvertingBlockCursor = 7,
//etc...
Now we can send not only text, but also single byte commands to the LCD Panel. However, some commands are multi-byte, meaning that you send the command byte then a parameter. For example, from the Hardware Specification:
Backlight Control (\014 ; Control N)
Send "Control-N", followed by a byte from 0-100 for the backlight brightness. 0=OFF, 100=ON, intermediate values will vary the brightness. There are a total of 25 possible brightness levels.
Examples:
\014\000
\014\050
\014\100
We could leave the LCDPanel class with just Write() methods, but for the class to be convenient enough to use often, it'd be nice to have methods to handle complex functions. We have a command enum and enough Write() methods to create a SetBacklight() method that encapsulates the command along with it's param. We'll also throw an ArgumentOutOfRangeException if the level isn't in line with the specification.
public void SetBacklight(int level)
{
if (level < 0 || level > 100) throw new ArgumentOutOfRangeException("Backlight Level must be between: 0 = OFF and 100 = ON");
Write(Command.BacklightControl);
Write(level);
}
Now, we'll repeat this thinking with each of the commands in the specification that you want to expose in the LCDPanel class. I've included 95% of the commands that the CrystalFontz 634 supports in this article's sample code.
Getting Data from Media Player (and iTunes)
Windows Media player includes support for Plug-ins and the one we'll be using is what they call the "Windows Media Player 9 Series Fun Pack," specifically the Blogging Plug-in. This Plug-In works with Media Player 9 and 10. The Blogging Plug-in does two things, first it adds the artist, song, and album name to the Windows Media Player 9 Series title bar, but more importantly it also populates a specific key in the registry with this information. The idea for this Fun Pack came from the fact that bloggers like to announce what music they are listening to when they post to their blog, and the blogging software they use can check for this information and include it in their post.
Since we're not blogging, we're sending the information to an LCD Panel, the Blogger Plug-In might be better named the "Windows Media What's Playing Publisher Plug-In," but no one asks me when they name these things. Anyway, the What's Playing data is published to four registry values under HKCU\Software\Microsoft\MediaPlayer\CurrentMetadata.
We'll create an (EXE) executable that uses our LCDPanel assembly and does the retrieval. We've designed the LCDPanel class to be reusable, so we'll keep it separate from the code that gathers music data. We might want to make other programs that use the LCDPanel later. The Registry is easy to access with the Microsoft.Win32.RegistryKey class.
RegistryKey currentMetadata = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\MediaPlayer\CurrentMetadata",
false);
if (currentMetadata != null)
{
string newCurrentTitle = currentMetadata.GetValue("Title", "No Title") as string;
string newCurrentAlbum = currentMetadata.GetValue("Album", "No Album") as string;
string newCurrentAuthor = currentMetadata.GetValue("Author", "No Author") as string;
string newDurationString = currentMetadata.GetValue("durationString", "No Duration") as string;
///etc...
Registry.CurrentUser.OpenSubKey will return null if the key doesn't exist, so it's important to be proactive. GetValue() on the returned RegistryKey is called once for each of the four values. GetValue() is a little less forgiving and takes your preferred default value as its second parameter, so if "Title" isn't available "No Title" will be returned. We'll run this code in a timer, perhaps every two seconds. Since we'll be accessing the registry each time, we'll want to save the strings we retrieved previously and compare them to the new values. There's no need to update the LCD display if the song being played hasn't changed.
As an aside: Personally, I'm more of an iTunes person than a Windows Media person, at least so far. Anyway, one fellow has seen fit to create a Plug-In of his own for iTunes that populates these Windows Media registry keys with what's playing in iTunes! What does that mean for us? It means we won't have to change this What's Playing LCD application at all to work with iTunes. I just dropped hi iTunes Plug-In into Program Files/iTunes/Plug-Ins and was able to retrieve track information from the same registry keys.
Making the Connection
So far we've proven that we can retrieve data from the Registry using either the Windows Media Blogging Plug-In or the iTunes Plug-In, and we can can send text and commands to a CrystalFontz LCD Panel. Now let's tie them together. We'll create a WinForms application that will live in the Tray (that little row of icons down in the TaskBar near the clock.)
Create a new Windows application in Microsoft Visual C# 2005 Express Edition (or VB if you like) and drag a ContextMenu control and a Timer control onto the form. We'll have the Timer fire every two seconds (2000 ms) to retrieve the data from the registry and write it out to the LCD panel.
Since we want the application to be in the
Tray only, we will hide the main form as soon as possible and hook our context menu up to the NotifyIcon control. When someone right clicks on the icon in the Tray, the context menu will appear showing a single menu item "Close." In the Click handler of the
Close menu item we'll exit the application.
The tick event handler of the timer control will be called every two seconds when we set it's interval to 2000. Its event handler is our opportunity to check the registry and write our findings out to the LCD panel. Additionally we'll call the ShowBalloon method to pop a balloon up from the tray.
Conclusion
This application only reports "What's Playing" to the LCD, but the concepts in this article along with the features in Visual C# 2005 Express Edition enable you to create any number of applications to interface with your LCD Screen. Here are some ideas to get you started: book on ASP.NET 2.0 with Bill Evjen and company, which will be released later in 2005. His thoughts on the Zen of .NET, Programming and Web Services can be found on his blog at.
It's too bad you didn't include a finished zip of the program, at the end. This is EXACTLY what I'm looking for, but I don't have the coding experience, or the programs to do it.
If you do decide to release this into the world, let me know! nave of hearts (one word, no spaces or underscores) at hotmail dot com.
I think its very bad articale becouse it does not has any sample to learning
@Yaman: It has stuff to learn, it teaches you how to interface with a device you don't have APIs with.
Let me see if Scott still has the source laying around
how about adding effects when displaying the text... how do you do that?
@LED up to you on how to create that. There has to be some 2D Sprite animation examples out there.
hi,
I am new at this way. Also i am computer engineering strudent. I want do something about windows embedded systems. Before this, i want to do same project like this.
|
https://channel9.msdn.com/coding4fun/articles/Some-Assembly-Required-Whats-Playing-Interfacing-Your-Media-with-an-External-LED-Screen-using-Visual
|
CC-MAIN-2017-47
|
refinedweb
| 2,807
| 62.48
|
in reply to
Let a module call a sub of the caller
Should call "foo" after compilation (not during BEGIN). Could the module somehow define an INIT block that calls the sub?
The problem with that is that modules INIT and runtime are still compile time from the perspective of the calling script.
You could run it in an END block, which is also after compilation, but I could imagine that that's too late for your purpose. So I don't know any solution, except via source filters (or maybe evil hijacking of DESTROY subs, depending on when exactly the routine should run).
Speaking of which, what is your purpose? Maybe there's a better solution to it if we know the bigger picture.
I just wanted to facilitate the use of a Module and avoid exorting into the caller's namespace. In particular, the Module does not just call the method but does some processing to pass it the right parameters. The same could be done with an export:
use My::Module qw(call);
call(\&foo);
sub foo { ... };
[download]
I am not that familiar with the processing phases BEGIN,INIT,END, that's why I asked. Is there a way to call the method at the END of execution of the caller?:
use My::Module call => 'foo';
sub foo { ... };
# foo is called at the end
[download]
I]
Used as intended
The most useful key on my keyboard
Used only on CAPS LOCK DAY
Never used (intentionally)
Remapped
Pried off
I don't use a keyboard
Results (437 votes),
past polls
|
http://www.perlmonks.org/?node_id=992172
|
CC-MAIN-2015-11
|
refinedweb
| 262
| 70.23
|
In the very first example in this series, we saw a simple function that calculated the sum of squares, implemented in both F# and C#. Now let’s say we want some new functions which are similar, such as:
Obviously, all these requirements are similar, but how would you extract any common functionality?
Let’s start with some straightforward implementations in C# first:
public static int Product(int n) { int product = 1; for (int i = 1; i <= n; i++) { product *= i; } return product; } public static int SumOfOdds(int n) { int sum = 0; for (int i = 1; i <= n; i++) { if (i % 2 != 0) { sum += i; } } return sum; } public static int AlternatingSum(int n) { int sum = 0; bool isNeg = true; for (int i = 1; i <= n; i++) { if (isNeg) { sum -= i; isNeg = false; } else { sum += i; isNeg = true; } } return sum; }
What do all these implementations have in common? The looping logic! As programmers, we are told to remember the DRY principle (“don’t repeat yourself”), yet here we have repeated almost exactly the same loop logic each time. Let’s see if we can extract just the differences between these three methods:
Is there a way to strip the duplicate code and focus on the just the setup and inner loop logic? Yes there is. Here are the same three functions in F#:
let product n = let initialValue = 1 let action productSoFar x = productSoFar * x [1..n] |> List.fold action initialValue //test product 10 let sumOfOdds n = let initialValue = 0 let action sumSoFar x = if x%2=0 then sumSoFar else sumSoFar+x [1..n] |> List.fold action initialValue //test sumOfOdds 10 let alternatingSum n = let initialValue = (true,0) let action (isNeg,sumSoFar) x = if isNeg then (false,sumSoFar-x) else (true ,sumSoFar+x) [1..n] |> List.fold action initialValue |> snd //test alternatingSum 100
All three of these functions have the same pattern:
List.fold. This is a powerful, general purpose function which starts with the initial value and then runs the action function for each element in the list in turn.
The action function always has two parameters: a running total (or state) and the list element to act on (called “x” in the above examples).
In the last function,
alternatingSum, you will notice that it used a tuple (pair of values) for the initial value and the result of the action. This is because both the running total and the
isNeg flag must be passed to the next iteration of the loop – there are no “global” values that can be used. The final result of the fold is also a tuple so we have to use the “snd” (second) function to extract the final total that we want.
By using
List.fold and avoiding any loop logic at all, the F# code gains a number of benefits:
By the way, the sum of squares example could also be written using
fold as well:
let sumOfSquaresWithFold n = let initialValue = 0 let action sumSoFar x = sumSoFar + (x*x) [1..n] |> List.fold action initialValue //test sumOfSquaresWithFold 100
Can you use the “fold” approach in C#? Yes. LINQ does have an equivalent to
fold, called
Aggregate. And here is the C# code rewritten to use it:
public static int ProductWithAggregate(int n) { var initialValue = 1; Func<int, int, int> action = (productSoFar, x) => productSoFar * x; return Enumerable.Range(1, n) .Aggregate(initialValue, action); } public static int SumOfOddsWithAggregate(int n) { var initialValue = 0; Func<int, int, int> action = (sumSoFar, x) => (x % 2 == 0) ? sumSoFar : sumSoFar + x; return Enumerable.Range(1, n) .Aggregate(initialValue, action); } public static int AlternatingSumsWithAggregate(int n) { var initialValue = Tuple.Create(true, 0); Func<Tuple<bool, int>, int, Tuple<bool, int>> action = (t, x) => t.Item1 ? Tuple.Create(false, t.Item2 - x) : Tuple.Create(true, t.Item2 + x); return Enumerable.Range(1, n) .Aggregate(initialValue, action) .Item2; }
Well, in some sense these implementations are simpler and safer than the original C# versions, but all the extra noise from the generic types makes this approach much less elegant than the equivalent code in F#. You can see why most C# programmers prefer to stick with explicit loops.
A slightly more relevant example that crops up frequently in the real world is how to get the “maximum” element of a list when the elements are classes or structs. The LINQ method ‘max’ only returns the maximum value, not the whole element that contains the maximum value.
Here’s a solution using an explicit loop:
public class NameAndSize { public string Name; public int Size; } public static NameAndSize MaxNameAndSize(IList<NameAndSize> list) { if (list.Count() == 0) { return default(NameAndSize); } var maxSoFar = list[0]; foreach (var item in list) { if (item.Size > maxSoFar.Size) { maxSoFar = item; } } return maxSoFar; }
Doing this in LINQ seems hard to do efficiently (that is, in one pass), and has come up as a Stack Overflow question. Jon Skeet event wrote an article about it.
Again, fold to the rescue!
And here’s the C# code using
Aggregate:
public class NameAndSize { public string Name; public int Size; } public static NameAndSize MaxNameAndSize(IList<NameAndSize> list) { if (!list.Any()) { return default(NameAndSize); } var initialValue = list[0]; Func<NameAndSize, NameAndSize, NameAndSize> action = (maxSoFar, x) => x.Size > maxSoFar.Size ? x : maxSoFar; return list.Aggregate(initialValue, action); }
Note that this C# version returns null for an empty list. That seems dangerous – so what should happen instead? Throwing an exception? That doesn’t seem right either.
Here’s the F# code using fold:
type NameAndSize= {Name:string;Size:int} let maxNameAndSize list = let innerMaxNameAndSize initialValue rest = let action maxSoFar x = if maxSoFar.Size < x.Size then x else maxSoFar rest |> List.fold action initialValue // handle empty lists match list with | [] -> None | first::rest -> let max = innerMaxNameAndSize first rest Some max
The F# code has two parts:
innerMaxNameAndSizefunction is similar to what we have seen before.
match list with, branches on whether the list is empty or not. With an empty list, it returns a
None, and in the non-empty case, it returns a
Some. Doing this guarantees that the caller of the function has to handle both cases.
And a test:
//test let list = [ {Name="Alice"; Size=10} {Name="Bob"; Size=1} {Name="Carol"; Size=12} {Name="David"; Size=5} ] maxNameAndSize list maxNameAndSize []
Actually, I didn’t need to write this at all, because F# already has a
maxBy function!
// use the built in function list |> List.maxBy (fun item -> item.Size) [] |> List.maxBy (fun item -> item.Size)
But as you can see, it doesn’t handle empty lists well. Here’s a version that wraps the
maxBy safely.
let maxNameAndSize list = match list with | [] -> None | _ -> let max = list |> List.maxBy (fun item -> item.Size) Some max
|
https://fsharpforfunandprofit.com/posts/conciseness-extracting-boilerplate/
|
CC-MAIN-2018-13
|
refinedweb
| 1,111
| 54.02
|
Ruby/GTK is a Ruby binding for Gtk+.
WWW:
NOTE: FreshPorts displays only information on required and default dependencies. Optional dependencies are not covered.
This port is required by:
No installation instructions: this port has been deleted.
The package name of this deleted port was: ruby19-gtk
ruby19-gtk
No options to configure
Number of commits found: 42
- Change EXPIRATION_DATE to 2013-10-10, to match removal of lang/ruby18
Discussed with: swills
Add NO_STAGE all over the place in preparation for the staging support (cat:
x11-toolkits)
- Use single space after WWW:
- Mark BROKEN fails to build
I/usr/local/include -DUSE_XIM -c rbgdkcursor.c
rbgdkcursor.c:48:27: error: rbgdkcursors.h: No such file or directory
*** Error code 1
Feature safe: yes
-
- Kick MD5 support
- Switch SourceForge ports to the new File Release System: categories starting
with X
-
With portmgr hat on, reset maintainership of knu's ports since he has
been inactive more than 6 months. We hope to see him back sometime.
Incorporate ruby-gnome/Makefile.common into this port since it is the
last remaining consumer of it.
Bump PORTREVISION on all ports that depend on gettext to aid with upgrading.
(Part 1)
Remove USE_GNOMENG.
De-pkg-comment.
Use RUBY_MOD*.
Deploy USE_GNOMENG infrastructure
PR: 42309
Submitted by: Edwin Groothuis <edwin@mavetju.org>
Update WWW.
Update the Ruby/GNOME suite to 0.30.
Update the Ruby/GNOME suite to 0.28.
Perform extconf.rb cleanup with no functional change.
Update ruby-{gnome,gtk,gdk_imlib,gdk_pixbuf} to 0.27.
Take over the maintainership. He hasn't replied to me for months.
Update graphics/ruby-gdk_imlib, graphics/ruby-gdk_pixbuf, x11/ruby-gnome and
x11-toolkits/ruby-gtk to ruby-gnome 0.26.
Bump the PORTREVISION's of the ports which install architecture dependent ruby
modules, due to the RUBY_ARCH change I've just committed.
Update to 0.24.
Add %%PORTDOCS%%.
Fix the breakage regarding bsd.gnome.mk variables. WANT_IMLIB and USE_IMLIB.)
Set DIST_SUBDIR=ruby for all these Ruby ports to stop distfile namespace
pollution.
Servers and bandwidth provided byNew York Internet, SuperNews, and RootBSD
36 vulnerabilities affecting 91 ports have been reported in the past 14 days
* - modified, not new
All vulnerabilities
|
http://www.freshports.org/x11-toolkits/ruby-gtk/
|
CC-MAIN-2015-32
|
refinedweb
| 364
| 59.3
|
Updating HAProxy Configurations in OpenShift
A quick tutorial on how to fine tune the OpenShift router to make it more secure.
Join the DZone community and get the full member experience.Join For Free
For security reason we need to tune up the OpenShift router. OpenShift router uses the HAProxy. HAProxy has this settings:
acl network_allowed src 20.30.40.50 20.30.40.40 http-request deny if !network_allowed
If there would be any possibility to update the HAProxy configuration it should be working. But how to update the configuration?
The solution is to update the Docker image with the router.
Download the OpenShift proxy from and update file conf/haproxy-config.template like this (find the section backend and add those 4 lines):
backend be_edge_http_{{$cfgIdx}} ... {{ if (index $cfg.Annotations "rohlik.cz/acl") }} acl network_allowed src {{ index $cfg.Annotations "rohlik.cz/acl" }} http-request deny if !network_allowed {{ end }} ...
After updating the file you have to build docker image and update the router definition.
docker build -t rohlik-haproxy:v1.3.1 .
And update the router definition (dc/router in namespace default):
spec: strategy: type: Rolling rollingParams: updatePeriodSeconds: 1 intervalSeconds: 1 timeoutSeconds: 600 maxUnavailable: 25% maxSurge: 0 updatePercent: -25 resources: triggers: - type: ConfigChange replicas: 1 test: false selector: router: router template: metadata: creationTimestamp: null labels: router: router spec: volumes: - name: server-certificate secret: secretName: router-certs containers: - name: router image: 'rohlik-haproxy:v1.3.1'
Now you are able to use the annotations section in your route definition:
apiVersion: v1 kind: Route metadata: name: rohlik namespace: rohlik selfLink: /oapi/v1/namespaces/rohlik/routes/rohlik labels: app: rohlik annotations: rohlik.cz/acl: 22.22.22.22
Finished :) I hope this article helps you.
Opinions expressed by DZone contributors are their own.
|
https://dzone.com/articles/updating-haproxy-configurations-openshift
|
CC-MAIN-2022-27
|
refinedweb
| 291
| 50.23
|
The April refresh of the Azure Service Bus EAI and EDI Labs is now live. Here’s some dough that you would be interested in:
- Read the forum post about preparing to use the April refresh at. This post gives some key information on what you should do as a preparation for using the April release.
- Read the forum post announcing the April 2012 refresh at. This will give you some information on what’s new and what to expect from the refreshed service.
- Provision a namespace for the CTP bits from
- If you are primarily a user who would configure bridges and LOB connect components, you must download the SDK. The SDK download is available at
- If you are primarily an EDI user, the EDI portal is available at
- You might also want to start playing around with the samples that are available for Service Bus EAI and EDI Labs. The samples can also be downloaded from
- All the documentation and tutorials for the April refresh are available at
That should be a good list to get you started. In my next post, I am going to talk about some new features that have been introduced in the April 2012 release of Service Bus EAI/EDI Labs.
|
https://blogs.msdn.microsoft.com/nitinme/2012/04/09/windows-azure-service-bus-eai-and-edi-labs-april-2012-release-is-now-live/
|
CC-MAIN-2019-47
|
refinedweb
| 208
| 65.25
|
I am just trying to make a python method to respond for a http request (Interact with python using javascript).
I got an url from splunk wiki
The configuration given in that url is
1. Create an app with my python module inside controllers folder
2. In web.conf create a endpoint as [endpoint:
3. just restart. The method inside the puython module can be accessed through the url
./custom/
4. Restart and login again
But, even after doing the above configuration URL of the above pattern is not available.
Anyone Please share your knoledge related to this.
Thanks.
Sorry.. Same set up works for me...
Previously I just configured the web.conf in $SplunkHome$/etc/system/local..
Now I did the same configuration inside $SplunkHome$/etc/apps//default. It works and my python function is working as a listener for a http request (http:/ip:/custom///)
web.conf :
[endpoint:netutils] #Name of the python file
netutils.py
import cherrypy
import splunk.appserver.mrsparkle.controllers as controllers
from splunk.appserver.mrsparkle.lib.decorators import expose_page
from splunk.appserver.mrsparkle.lib.routes import route
class MyControllerController(controllers.BaseController):
@exposepage(mustlogin=True)
def listenerGet(self, **kwargs):
cherrypy.response.headers['Content-Type'] = 'text/plain'
return 'I am responding for your request'
Please refer
Hi paramagurukarthikeyan, Thanks for posting this. I am also looking similar one like this.
couple of clarifications.
1, How you called "MyPython.py" in your HTML view page?
2. You mentioned endpoint as "netutils", But where are you using this?, I am not seeing this in .py file.
Thanks for your time.
Sorry, I couldn't help you.. I just saw 🙂
I can't get this to work. Is it not supported in 6.4.x and above?
The documentation you've linked to in another answer is of Splunk 4.x
I always get a error 404, even when I tried to run your exact code. Anyway I can fix this?
Thanks
|
https://community.splunk.com/t5/Developing-for-Splunk-Enterprise/Python-end-point-configured-in-web-conf-is-not-working/td-p/178803?sort=newest
|
CC-MAIN-2020-29
|
refinedweb
| 323
| 62.85
|
Opencv Tutorial colors channels
Opencv C++ simple tutorial about the colors and color channels. There is couple of tricks you can play with in Opencv. It is fun and easy to use to achieve color mixing and gain the channel by for example slide bar.. Enjoy the coding..
Opencv installation in Visual Studio 2015
Opencv colors introductionI always forget what is the right order of colors in the opencv. The purpose of this short tutorial is different. It is not necessary to know if the blue rectangle in RGB should be defined like [255 , 0 , 0] or [0, 0 , 255] . Hopefully it is still BGR that mean blue, green and red channel. Just to be clear and sure that anyone understand. You can change that order but for no reason the default order is BGR.
There is more color space available in opencv and in practice there is a reason for that. There is also different scales for each colors.
Example is simple. BLUE should be 0 to 255 for min and max value of the channel (CV_8U). Same blue color can have a same min and max visual levels but color is divided into more steps 0 to 65535(CV_16U).
Opencv color space transformation basics
There is also pure gray scale. GRAY is equal of small piece of blue plus small piece of green and small piece of the last one. Something like Gray = 0.3 x R + 0.3 x G + 0.3 x B. Ok constants are different but who cares if there is 0.299 in R channel and lots of green color. This is it in principle..
Opencv tutorial Video color mixing
In this tutorial there is only one milestone. Learn this
IMage.at<Vec3b>(y, x)[0] to Access the pixel at Y and X position. !For 0 color channel.
and this
IMage.at<Vec3b>(y, x)[1] Same but different color.
and also
IMage.at<Vec3b>(y, x)[2] This should be Blue or Red thats depends on Opencv mood. Probably red.
In tutorial we make a copy of the image by
OneImage.copyTo(SecondMatRepresentation);
Into that copy just insert the image retrieve by video capture and each pixel of each color channel just multiply by value of slider.
Opencv dependencies
The code is well described and in right setting of Opencv 3.1 instalation works. For example the easies instalation in Visual studio is by NUGET packages described here
Proper setting of the video writer it should be found Here. The only magic is right instalation and proper size of output image. Ok codec also.
Opencv Video color channels example
Opencv tutorial code
#include "opencv2\imgproc.hpp"
#include <vector>
#include <stdio.h>
#include <Windows.h>
#include <iostream>
using namespace cv;
using namespace std;
// slider globa value
int iSliderValue1 = 0;
int iSliderValue2 = 0;
int iSliderValue3 = 0;
int main(int argc, const char** argv)
{
// read video or cap(0) the web cam
VideoCapture cap("mov.MOV");
//prepare the writer for output
VideoWriter outputVideo;
outputVideo.open("video4.wmv", CV_FOURCC('W', 'M', 'V', '2'), 30, Size(1280, 960), true);
for (;;)
{
bool Is = cap.grab();
if (Is == false) {
cout << "Video Capture Fail" << endl;
break;
}
else {
Mat img;
Mat Original;
cap.retrieve(img, CV_CAP_OPENNI_BGR_IMAGE);
resize(img, img, Size(1280, 960));
img.copyTo(Original);
// we got a video in img and its copy in Original
// Lets access all pixels in X and Y (Y,X) and also visit all colors [0-2]
for (int x = 0; x < img.cols -1 ; x++)
{
for (int y = 0; y < img.rows -1 ; y++)
{
//Rewrite Original copy by IMG multipy by some value based on SLIDER value
Original.at<Vec3b>(y, x)[0] = img.at<Vec3b>(y, x)[0]* (iSliderValue1 )/200 ;
// Do it for another color
Original.at<Vec3b>(y, x)[1] = img.at<Vec3b>(y, x)[1]* (iSliderValue2 )/200 ;
// If you wat also for the last one
Original.at<Vec3b>(y, x)[2] = img.at<Vec3b>(y, x)[2]* (iSliderValue3 )/200 ;
}
}
// Simple slider , parameters are some description R, G and B
// also some window prew, and update some value
// the last parameter 215 is maximum value.....
createTrackbar("R", "prew", &iSliderValue1, 215);
createTrackbar("G", "prew", &iSliderValue2, 215);
createTrackbar("B", "prew", &iSliderValue3, 215);
// show the result
namedWindow("prew", WINDOW_AUTOSIZE);
imshow("prew", Original);
// write the output
outputVideo << Original;
int key1 = waitKey(20);
}
}
}
Share if you like it... Thanks :)
|
http://funvision.blogspot.com/2016/10/opencv-rgb-colors-tutorial-color.html
|
CC-MAIN-2018-22
|
refinedweb
| 723
| 68.36
|
java.lang.Object
org.apache.cocoon.components.midi.xmidi.ByteLenorg.apache.cocoon.components.midi.xmidi.ByteLen
public class ByteLen
The MIDI file parsing parts of this class are based on code from the XMidi project, written by Peter Arthur Loeb () and used with permission. The warranty disclaimer of the MIT license () applies to Peter Arthur Loeb's code.
public byte[] ba
public int len
MX.deltaToIntmethod, it is the length of the delta field being converted, not the length of the array.
There is nothing about this class that requires that this variable be used in this way. It could be any int.
public ByteLen()
public ByteLen(byte[] b, int l)
MX.deltaToIntmethod to create this class, which it then returns.
b- a byte array; used to set
ba
l- a length; used to set
len
|
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/midi/xmidi/ByteLen.html
|
CC-MAIN-2013-20
|
refinedweb
| 136
| 75.1
|
IRC log of xproc on 2007-05-03
Timestamps are in UTC.
14:46:10 [RRSAgent]
RRSAgent has joined #xproc
14:46:10 [RRSAgent]
logging to
14:46:18 [MoZ]
Zakim, what is the code ?
14:46:18 [Zakim]
the conference code is 97762 (tel:+1.617.761.6200 tel:+33.4.89.06.34.99 tel:+44.117.370.6152), MoZ
14:51:23 [avernet]
avernet has joined #xproc
14:56:11 [PGrosso]
PGrosso has joined #xproc
14:57:54 [Zakim]
XML_PMWG()11:00AM has now started
14:58:01 [Zakim]
+Norm
14:58:15 [Norm]
Norm has joined #xproc
14:58:37 [Norm]
zakim, this is xproc
14:58:37 [Zakim]
Norm, this was already XML_PMWG()11:00AM
14:58:38 [Zakim]
ok, Norm; that matches XML_PMWG()11:00AM
14:58:47 [MoZ]
MoZ has changed the topic to:
14:58:59 [Norm]
ty MoZ
14:59:16 [Norm]
Meeting: XML Processing Model WG
14:59:16 [Norm]
Date: 3 May 2007
14:59:16 [Norm]
Agenda:
14:59:16 [Norm]
Meeting number: 66, T-minus 26 weeks
14:59:17 [Norm]
Chair: Norm
14:59:19 [Norm]
Scribe: Norm
14:59:21 [Norm]
ScribeNick: Norm
14:59:44 [Zakim]
+ +95247aaaa
14:59:53 [MoZ]
Zakim, aaaa is MoZ
14:59:54 [Zakim]
+MoZ; got it
14:59:57 [ht]
ht has joined #xproc
15:00:31 [avernet]
avernet has joined #xproc
15:00:58 [Zakim]
+Alessandro_Vernet
15:01:12 [Zakim]
+[ArborText]
15:02:00 [Andrew]
Andrew has joined #xproc
15:02:13 [ht]
zakim, please call ht-781
15:02:18 [Zakim]
ok, ht; the call is being made
15:02:20 [Zakim]
+Ht
15:02:28 [Norm]
Regrets: Richard
15:02:35 [Zakim]
+??P14
15:02:38 [Norm]
zakim, who's on the phone?
15:02:38 [Zakim]
On the phone I see Norm, MoZ, Alessandro_Vernet, PGrosso, Ht, ??P14
15:02:43 [Norm]
zakim, ??P14 is Andrew
15:02:43 [Zakim]
+Andrew; got it
15:02:59 [Norm]
Regrets: Richard, Rui
15:03:14 [Norm]
MSM, are you joining us today?
15:03:43 [Norm]
Present: Norm, Mohamed, Alessandro, Paul, Henry, Andrew
15:03:57 [Norm]
Topic: Accept this agenda?
15:03:57 [Norm]
->
15:04:05 [Norm]
Accepted.
15:04:12 [MSM]
zakim, please call MSM-Office
15:04:12 [Zakim]
ok, MSM; the call is being made
15:04:13 [Zakim]
+MSM
15:04:14 [Norm]
Topic: Accept minutes from the previous meeting?
15:04:14 [Norm]
->
15:04:18 [Zakim]
+Alex_Milows
15:04:28 [Norm]
Accepted.
15:04:35 [Norm]
Present: Norm, Mohamed, Alessandro, Paul, Henry, Andrew, Michael, Alex
15:04:44 [Norm]
Topic: Next meeting: telcon 10 May 2007
15:05:03 [alexmilowski]
alexmilowski has joined #xproc
15:05:05 [Norm]
We have regrets from Rui, Alessandro, Michael
15:05:24 [Norm]
Topic: Open action items
15:05:37 [MSM]
zakim, mute me
15:05:37 [Zakim]
MSM should now be muted
15:05:43 [Norm]
Henry to propose a debugging alternative to p:tee
15:05:44 [Norm]
Completed.
15:05:49 [Norm]
Alex to craft a proposal on serialization
15:05:51 [Norm]
Continued.
15:06:02 [Norm]
Topic: Options vs parameters
15:06:02 [Norm]
->
15:07:08 [Norm]
Henry: I think Richard and I are alike in being sympathetic to Jeni's use cases, we're getting things out of proportion here.
15:07:16 [Norm]
...XSLT is the only step that uses parameters at all.
15:07:40 [Norm]
...The simplest possible mechanism which allows them to work is therefore the best solution.
15:08:09 [Norm]
...I propose:
15:08:41 [Norm]
Henry: Amended with the ability to unbind parameters.
15:08:53 [Norm]
15:09:07 [Norm]
Henry: p:parameter is the only thing there is to do with parameters.
15:09:24 [Norm]
...All you can do is give them a value or ungive them a value. No namespace changing; no importing, no declaring. Nothing.
15:09:45 [Norm]
... The analogy Richard draws is with the environment and shell scripts.
15:09:57 [Norm]
... They're a single, global space and you can give them values and take them away and that's it.
15:10:42 [Norm]
Henry: All the proposals about options are correct, I'm only arguing for a radically simpler parameter story.
15:11:03 [Norm]
Alex: We have three steps that use parameters: XQuery and both XSLT's.
15:11:24 [Norm]
...I've been thinking about serialization parameters; we could use parameters for that.
15:11:35 [Norm]
...I think there are a lot of things where parameters are going to be useful.
15:11:43 [Norm]
...Including step types that we aren't defining.
15:12:24 [Norm]
Henry: I agree with the position that Norm and Jeni agreed with is that the crucial thing about them is that you don't know much about them
15:13:44 [Norm]
Henry: The difference between what we have today and my proposal is get rid of import-parameter and parameter declarations.
15:13:57 [Norm]
Alessandro: So import-parameters is done automatically?
15:14:11 [Norm]
Henry: Yes, all the in-scope parameters are always availble.
15:14:16 [Norm]
Alessandro: Why?
15:14:33 [Norm]
Henry: Because all of the examples we've seen so far have import-parameters = "*"
15:14:44 [Norm]
Alex: And your implementation always has all the parameters available.
15:15:29 [Norm]
Norm: And how does undeclare work?
15:15:57 [Norm]
Henry: Making sure a parameter doesn't have a value seems like a marginal case, but I'd read <p:parameter as an unbinding.
15:16:01 [Norm]
Alex: That's a little weird.
15:16:07 [Norm]
Henry: But value="" is perfectly sensible.
15:17:43 [Norm]
Norm: My concern is that one of the things I think XProc is going to be used for quite a bit is chaining together multiple XSLT steps. And most stylesheet authors put all their parameters in no namespace. So the proposal you're making, Henry, begs for collisions.
15:18:32 [Norm]
Alex: Looking at your example, the select="$per-page" will still be legal.
15:20:01 [Norm]
Henry: I think packaging up lots of XSLT steps is something we're going to do a lot, but I almost never use parameters from the command line for any of my XSLT stylesheets.
15:20:32 [Norm]
...Doing so is a dodgy business. If you're writing a carefully constructed pipeline to do a task, you'll know what the parameters are.
15:21:03 [Norm]
Alex: You can solve the random parameters from the command line use case with options or by massaging the stylesheet as part of the pipeline.
15:21:25 [Zakim]
-MSM
15:21:36 [Norm]
Norm: I'm in favor of simple, and I'm willing to float Henry's proposal to the public and see what they say.
15:22:43 [Norm]
Henry: What I think this will also really help our users. The way we were headed, with all this duplication, looked parallel but wasn't. Users were going to be baffled by the question of when do I use which.
15:23:17 [Norm]
Norm: I'm convinced that this proposal is sufficiently simple that we should try it.
15:23:19 [Norm]
Alex: Me to.
15:23:31 [MoZ]
s/to/too/
15:23:32 [Norm]
Alessandro: Me too, but I'm concerned about this automatic import of parameters.
15:24:08 [Norm]
...Why not just make users list all the parameters explicitly.
15:24:15 [Norm]
s/explicitly./explicitly?/
15:24:19 [MoZ]
q+
15:24:40 [Norm]
Henry: What could possibly go wrong from passing all the parameters?
15:24:58 [Norm]
...The only case that we're worried about is the case where you know that there's a collision between two stylesheets in the same pipeline.
15:25:09 [Norm]
...Alex pointed out that you can protect them if you know that's the cas.e
15:25:14 [alexmilowski]
15:25:14 [Norm]
s/cas.e/case./
15:26:03 [Norm]
Alex: You already have a set of parameters in the environment. Then there's a derivation done to compute the actual parameters for each step.
15:26:32 [Norm]
...The actual parameters are the same as the in-scope parameters and you're done.
15:26:58 [Norm]
...The worst case is that you have to bind a bunch of extra parameters.
15:27:33 [MoZ]
q++
15:27:41 [Norm]
Alessandro: I guess I'm not worried about implementation, I'm just thinking about programming languages.
15:27:53 [Norm]
...Generally when you call a function, you enumerate the parameters that you're passing.
15:27:58 [Norm]
Henry: Exactly, that's what options are for.
15:28:12 [Norm]
Alessandro: You don't usually have all the parameters. It could be a security issue, there are lots of reasons.
15:28:44 [MoZ]
q+ to remind why we split options and parameters
15:28:47 [Norm]
Henry: You have to declare the options that you accept, you have to pass them explicitly, etc. Parameters are this funny business that we only have because of XSLT and its friends.
15:28:48 [Norm]
q?
15:28:56 [Norm]
ack moz
15:28:56 [Zakim]
MoZ, you wanted to remind why we split options and parameters
15:28:57 [Norm]
ack +
15:29:09 [Norm]
Mohamed: I think we missed the point about why we split options and parameters in the first place.
15:29:36 [Norm]
...We were thinking about collisions between parameters that were for steps and options that were for the pipeline processor.
15:29:46 [Norm]
Henry: Options are in a separate space; we've solved that problem.
15:30:00 [Norm]
Mohamed: I'm speaking options declared in the spec.
15:30:12 [Norm]
Henry: But they're in a separate space from the names of parameters; that's not going to change.
15:30:45 [Norm]
Henry: If there's a stylesheet that takes a parameter named "filename", no option can collide with that.
15:31:21 [Norm]
Mohamed: Consider this example: I have a pipeline with two XSLT steps. I want to make a parameter that called "filename" for the two steps.
15:31:39 [Norm]
Henry: Then you write in each step:
15:31:46 [ht]
<p:parameter
15:32:00 [ht]
<p:parameter
15:32:15 [Norm]
Henry: where o1 and o2 are *options* that you pass to your pipeline.
15:32:18 [ht]
and say runipipe o1=x.xml o2=y.xml
15:32:36 [Norm]
Mohamed: The second point was that one day in import parameter we might have an "except" parameter.
15:32:45 [Norm]
s/parameter/option/
15:33:00 [Norm]
s/option/attribute/
15:33:07 [alexmilowski]
The only feature we don't have is the one that Norm mentioned: Pass all options in namespace A as parameters to XSLT A and all options in namespace B as parameters to XSLT B.
15:33:14 [alexmilowski]
...which is OK by me.
15:33:18 [ht]
<p:unbind-parameter
15:33:35 [Norm]
Henry: if you really, really want to make sure that no parameter named foo gets into a particular step, then you write something like p:unbind-parameter.
15:34:04 [Norm]
Henry: I'd be happier if a I saw a use case.
15:34:33 [Norm]
Norm: I'd be happier to write it up without that feature and see if the world demands it.
15:34:38 [Norm]
Henry: It's clear how we could add it.
15:35:25 [Norm]
Norm summarizes the proposal.
15:35:51 [Norm]
Alex: And sibling options cannot refer to each other.
15:37:00 [Norm]
Norm: I understood that we have no forward references.
15:37:09 [Norm]
Norm: Let's make that a separate issue.
15:37:29 [Norm]
Norm: Anyone not understand our current proposal wrt options/parameters?
15:37:30 [Norm]
No.
15:37:31 [Norm]
Accepte.d
15:37:38 [Norm]
s/te.d/ted./
15:38:55 [Norm]
Norm: I propose to skip item 2; Alex has an open action to propose something about serialization; I think we should just put all these things in that proposal.
15:39:19 [Norm]
Alex: I think we've accepted the names unescape-markup and escape-markup, so I think we can drop that issue.
15:39:23 [Norm]
Norm: good.
15:39:38 [Norm]
Topic: p:tee proposal or alternate debugging proposal
15:39:38 [Norm]
->
15:39:38 [Norm]
->
15:39:57 [ht]
HST suggests that the right strategy wrt the 'sibling options' question is to a) be sure that wherever we allow an XPath expression in the spec., we specify the XPath context and b) the answer wrt options is "the options in the inherited environment"
15:40:25 [Norm]
Henry: I raised the question of whether a component was the right way to do this.
15:40:33 [Norm]
...Or to think of it more as an annotation.
15:41:23 [Norm]
Henry: I offered two proposals.
15:42:02 [Norm]
...The question is, at which end do you want to do the logging/journaling.
15:42:14 [Norm]
...One answer is: you do it at the place where the document comes from.
15:43:08 [Norm]
...So you could add <p:journal
15:43:22 [Norm]
Henry: That doesn't require any changes, you just add that.
15:43:53 [Norm]
Henry: The alternative is to go to the other end; on the input binding you could add a journal attribute.
15:44:00 [MSM]
zakim, please call MSM-Office
15:44:00 [Zakim]
ok, MSM; the call is being made
15:44:02 [Zakim]
+MSM
15:44:10 [Norm]
<p:pipe
15:44:36 [Norm]
Henry: The disadvantage is that it requires you to put in a p:input with explicit names and things because it can't all be defaulted.
15:44:46 [Norm]
Henry: On balance, I think I favor the first over the second.
15:45:42 [Norm]
Henry: So there are three proposals: a new component, p:tee or something; p:journal element in a step; or the journal attribute which you can add to pipes.
15:46:23 [Norm]
Norm: Anyone else have an opinion?
15:47:27 [Norm]
Alex: The advantage of the builtin solution is that makes solving the sequence problem easier.
15:47:57 [Norm]
Henry: The thing that swung me to option 1 is that you have to add two elements and maybe a name to use a journal attribute in a fully defaulted pipeline.
15:49:36 [Norm]
Norm: Does anyone favor Henry's option 2 over his option 1?
15:49:37 [Norm]
No one.
15:50:02 [Norm]
Straw poll: Which do you prefer, the builtin journaling solution or a letting a component do it?
15:50:18 [Norm]
zakim, who's on the phone?
15:50:18 [Zakim]
On the phone I see Norm, MoZ, Alessandro_Vernet, PGrosso, Ht, Andrew, MSM, Alex_Milows
15:52:05 [Norm]
Journaling: 6; Step: 1; 1 Abstain (2 concur)
15:52:24 [Norm]
Norm: Anyone who can't live with the journaling element?
15:52:26 [Norm]
No.
15:52:44 [Norm]
Norm: And sequences?
15:53:12 [MoZ]
$p:position
15:53:58 [Norm]
Henry: I think we should provide options that are always bound in an iteration and use attribute value templates to let the user specify how to deal with it.
15:54:11 [Norm]
Norm: We don't have AVTs. Do you really want to add them for this?
15:54:27 [ht]
href="'foo.xml'"
15:54:38 [Norm]
Henry: I'd be perfectly happy to say that the value of the href is an XPath expression, but then the 90% case is "'xxx'".
15:54:51 [ht]
href="concat('foo',$p:position,'.xml')"
15:54:58 [Norm]
Norm: I have another: implementation defined.
15:55:30 [Norm]
Henry: I can live with that, but I think that having iteration and sequence number variables in the environment is going to turn out to be hugely useful.
15:55:51 [Norm]
Norm: This is Mohamed's p:position everywhere right?
15:56:07 [Norm]
Henry: Yes, but I think we're also going to need named index iterations for nested for-eaches.
15:56:13 [Norm]
Henry: we need both.
15:56:53 [ht]
for iteration step name='foo', there an option p:foo_i is bound
15:57:30 [ht]
s/there an/then an/
15:58:01 [Norm]
Norm: I'm starting to feel like functions are a better way to do this than automatic variable bindings.
15:58:15 [Norm]
Mohamed: We have to figure out what it means to evaluate an XPath expression on a sequence.
15:58:16 [ht]
<p:input
15:58:28 [ht]
<p:pipe
15:58:31 [ht]
</p:input>
15:58:54 [Norm]
...If we say that it's the same as evaluating the expression over each document in the sequence, then functions and variables are the same.
15:59:48 [Norm]
Norm: I'm still not sure I understand.
16:00:13 [Norm]
Henry: At the end of the day, what I want is a third variable or function which is unique per pipeline evaluation episode.
16:00:30 [Zakim]
-MSM
16:01:00 [Norm]
ACTION: Henry to write up all the variables/functions he wants.
16:01:10 [Norm]
Topic: Any other business
16:02:04 [Norm]
Henry: Are we meeting in November?
16:02:11 [Norm]
Norm: I think we said yes, but I'll double check.
16:02:17 [Norm]
Adjourned.
16:02:20 [Zakim]
-Ht
16:02:22 [Zakim]
-Norm
16:02:23 [Zakim]
-Alessandro_Vernet
16:02:23 [Zakim]
-PGrosso
16:02:24 [Zakim]
-MoZ
16:02:26 [Zakim]
-Alex_Milows
16:02:28 [Zakim]
-Andrew
16:02:29 [Zakim]
XML_PMWG()11:00AM has ended
16:02:30 [Zakim]
Attendees were Norm, +95247aaaa, MoZ, Alessandro_Vernet, PGrosso, Ht, Andrew, MSM, Alex_Milows
16:02:32 [Norm]
rrsagent, set logs world-visible
16:02:38 [Norm]
rrsagent, draft minutes
16:02:38 [RRSAgent]
I have made the request to generate
Norm
16:03:24 [PGrosso]
PGrosso has left #xproc
16:04:46 [Norm]
rrsagent, draft minutes
16:04:46 [RRSAgent]
I have made the request to generate
Norm
17:23:31 [Norm]
rrsagent, bye
17:23:31 [RRSAgent]
I see 1 open action item saved in
:
17:23:31 [RRSAgent]
ACTION: Henry to write up all the variables/functions he wants. [1]
17:23:31 [RRSAgent]
recorded in
17:23:33 [Norm]
zakim, bye
17:23:33 [Zakim]
Zakim has left #xproc
|
http://www.w3.org/2007/05/03-xproc-irc
|
CC-MAIN-2014-10
|
refinedweb
| 3,148
| 70.33
|
note sundialsvc4 <p> No, I think that you are exactly correct. The module will be compiled, regardless, if not done already. Then, any name in <tt>@EXPORT</tt> will be added to the global namespace. If you provide a list of routines in your <tt>use</tt> statement, they must be in <tt>@EXPORT_OK</tt>. </p><p> Nothing will lead to any sort of performance problem. Everything goes through a one-time “compile (on the fly)” process and, once done, never happens again (AFAIK) for the duration of the run. If there is a performance issue in this app, “red herring ... look elsewhere.” </p> 1054305 1054338
|
http://www.perlmonks.org/index.pl?displaytype=xml;node_id=1054371
|
CC-MAIN-2018-05
|
refinedweb
| 106
| 75.91
|
Opened 6 years ago
Closed 6 years ago by
comment:2 Changed 6 years ago by
comment:3 Changed 6 years ago by
Thanks for your patch.
- This change removes
twisted.python.util.unsignedIDbut the compatibility policy states that it should be deprecated first
twisted/topfiles/5544.removalshould be one sentence.
comment:4 Changed 6 years ago by
Fixed problems above by thijs :)
comment:5 Changed 6 years ago by
- This patch changes the behaviour of the public
setIDFunctionin
twisted/python/util.pybut 6 years ago 6 years ago by
fixed problems described by thijs.
comment:8 Changed 6 years ago by
Thanks.
unsignedIDis still imported in
twisted/internet/tcp.py(as reported by pyflakes)
- in
twisted/internet/test/test_base.py, the old assertion about the repr of a
DelayedCallhad one shortcoming and one advantage relative to the new assertion:
- It verified the address in the repr started with "0x". The new assertion relies on
hextomustmust therefore not be modified as this patch modifies it.
- Nor may
unsignedIDbe removed from
__all__of its defining module.
- The change needs a "removal" news fragment, summarizing the deprecation and suggesting the replacement api (the builtin
idmethod).
Thanks again.
comment:9 Changed 6 years ago 5 years ago by
comment:11 Changed 5 years ago by
Please review.
- added test for
internet.tcp._BaseTCPClient.__repr__that was using
util.unsignedID
- removed usage of
util.setIDFunction(was only used in tests)
- deprecated
setIDFunctionand
unsignedID
- removed unused import from
twisted.python.reflect
comment:12 Changed 5 years ago by
comment:13 Changed 5 years ago by
- The tests for the deprecated functions should suppress the warnings from those functions, using something like
class Tests(unittest.TestCase): suppress = [((), {'action': ignore', 'message':'%s was deprecated' % (reflect.fullyQualifiedName(unsignedId),), 'category':DeprecationWarning})]
- There is still mixed use of
hexand
'0x%x'to format ids. A single one should be used consistently.
Please commit after fixing the above.
- Since
twisted.test.connectionmixins.TCPClientTestsMixin.test_addressesis being changed, it would be nice to make a single assert with all the relevant data.
comment:14 Changed 5 years ago by
The tests for the deprecated functions should suppress the warnings from those functions, using something like
Yes, except actually use
twisted.trial.util.suppress instead.
comment:15 Changed 5 years ago by
comment:16 Changed 5 years ago by
comment:17 Changed 5 years ago by
comment:18 Changed 5 years ago by
- I don't like the change from
import a, btoimports).module docstring is missing an article - "the" would fit nicely before the module name. Alternatively, drop the trailing module.
- The change to the test in
twisted/internet/test/test_base.pymakesand since monkey patching the
idattribute of the
basemodule is pretty gross, maybe this ticket inevitably just makes this test (and others) worse.
- in
test_reflectpy3,
test_classIDStrseemsIntells us very little about the string (clearly that's a pre-existing issue, not a problem introduced by this change).
- The indentation for the new code in
test_addressesis all a bit funny. This is the sort of thing I really wish twistedchecker knew about. :/
Please fix 2, 4, and 6 and file a ticket for 5, then merge. Thanks.
comment:19 Changed 5 years ago by
|
https://twistedmatrix.com/trac/ticket/5544
|
CC-MAIN-2018-30
|
refinedweb
| 528
| 57.98
|
Issue
import pandas as pd data={"product_name":["Keyboard","Mouse", "Monitor", "CPU","CPU", "Speakers",pd.NaT], "Price":[500,None, 5000.235, None, 10000.550, 250.50,None], "Final_Price":[5,None, 10, None, 20, 8,None], "Available_Quantity":[5,9,6,None,6, 5,8], "Available_Since_Date":['11/5/2021', '4/23/2021', '08/21/2021','09/18/2021','09/18/2021','01/05/2021',pd.NaT] } df = pd.DataFrame(data) df
The filter to find the rows that meet the condition
myfilter= (df.query("Price=='Nan' and Final_Price=='Nan'and Available_Quantity >=5 ")) myfilter
It works because I found the rows that I want. Now I want to delete that rows of the
DataFrame but not using
df.loc or
df.iloc because in a bigger
DataFrame that would not be useful.
Solution
I am not sure what you want though using
query we could do:
df.query('Price.isna() & Final_Price.isna() & Available_Quantity > 5') product_name Price Final_Price Available_Quantity Available_Since_Date 1 Mouse NaN NaN 9.0 4/23/2021 6 NaT NaN NaN 8.0 NaT
df.query('~(Price.isna() & Final_Price.isna() & Available_Quantity > 5)') product_name Price Final_Price Available_Quantity Available_Since_Date 0 Keyboard 500.000 5.0 5.0 11/5/2021 2 Monitor 5000.235 10.0 6.0 08/21/2021 3 CPU NaN NaN NaN 09/18/2021 4 CPU 10000.550 20.0 6.0 09/18/2021 5 Speakers 250.500 8.0 5.0 01/05/2021
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0
|
https://errorsfixing.com/pandas-how-to-delete-the-rows-that-meet-conditions-by-filter/
|
CC-MAIN-2022-27
|
refinedweb
| 260
| 63.15
|
1." If you haven't read that article already, please read it before reading this article. The concepts in this article will take a closer look at Python modules and packages.
If you've been following my Python series, you know how classes in Python work. But so far I haven't addressed how Python classes can be used in modules and packages. As in other programming languages, in Python you need to import classes that have similar functionality, along with storing these classes in a package.
Modules and Packages
In Python, modules are simply Python files with one or more classes and functions declared. For example, suppose we have a file called Customer. This would be a class that represents attributes and operations that can be performed with a Customer object, such as adding, removing, and modifying a Customer. With other languages like Java, you would normally have only a single class representing a single file, but it doesn't have be that way in Python. It's a matter of style and what the programmer prefers. A module with multiple class, function, and method names represents a namespace. For example, when accessing a class method from a module called Books, that method name is considered to be part of the Books namespace.
There are two ways to import modules in Python: by using the import module or the from module import syntax, where module is the name of the module. Let's take a look at using import, using two modules called Customer and Address. These two files contain the classes and methods necessary for associating one or more addresses with a customer. To import the Address module namespace into the Customer namespace, add the following line to the top of the Customer module:
import Address
Pretty simple. Next, to use the class objects from Address, all we need to do is use the dot (.) notation:
customerAddress = Address.CustomerAddress() address = customerAddress.getAddress(custId) print(address)
What if we wanted to import just a single class or a set of specific classes from Address? Well, that's easy, too: Use the from module import syntax, followed by one or more class names, separated by commas:
from Address import CustomerAddress
To use the class objects from the class we imported, no dot notation is required:
customerAddress = CustomerAddress() address = customerAddress.getAddress(custId) print(address)
We don't need to qualify the customerAddress class using dot notation with the module name because using this import syntax in Python loads the class attributes and methods directly into the namespace. In other words, the attributes and methods that were previously part of the Address namespace now belong to the Customer namespace. If you want to import all classes of a module using this syntax, simply do the following:
from Address import *
As programs grow larger, it becomes necessary to organize the modules into packages. To do that, we create a folder for each set of modules that will become a package. The package name is the name of the folder containing the modules. If you've programmed with Java, no doubt you'll be familiar with this concept.
When we create a package, Python needs to know that the folder is a package. In the folder, a blank file should be added called __init__.py. Python will look for this file; if it's not found, the folder won't be considered a package. The folders can be nested, providing different package levels. Packages are used by importing them into a module in one of two ways: as absolute imports or as relative imports.
For an absolute import, we specify the full path to the class we want to use, including the package name. For example, let's say we have a parent package called Employer. This package has the Company module. In another package called Employee (which belongs to Employer), this package has the Address and Customer modules. To call a method in the Company module from the Address module, use the full path to the address:
from Employee.Address import CustomerAddress customerAddress = CustomerAddress()
or just use the import module syntax:
import Employee.Address customerAddress = Address.CustomerAddress()
A relative import allows us to import modules without having to specify the package name. Instead, we use periods (dots) to indicate the number of levels where Python should look for a class or function. For example, to call the Address module from the Customer module, do the following:
from .Address import CustomerAddress
In the code above, the period before the Address module tells Python to look for this module in the same package. To call the Company module, which is inside the Employer parent package, go up a level from Customer by using another period:
from ..Company import CompanyAddress
Each period before the module represents bumping up one package level to look for the module.
Conclusion
In this article, you learned how to structure your Python programs by using modules and packages. With modules, it's important to note the two ways that modules can be imported syntactically, along with how to import them from packages using absolute or relative imports.
Packages are very much like they are with Java, using folders to represent package levels holding modules that are similar to each level.
At this stage, you should be comfortable creating your own small programs. Typically, it's a best practice to have a main.py file in the parent directory or top level of your package structure containing all the lifecycle logic to implement the application.
In Part 3 of this series, I'll cover inheritance in Python. This OO concept is important to developing Python programs that work with web frameworks such as Pyramid.
|
https://www.informit.com/articles/article.aspx?p=2145969
|
CC-MAIN-2021-04
|
refinedweb
| 952
| 53.81
|
Re: How to Return an XML Doc via a Web Method
From: charlie (spamnongrata_at_yahoo.com)
Date: 04/29/04
- Previous message: charlie: "Puzzling SOAP Error..."
- In reply to: Tom Ficker: "How to Return an XML Doc via a Web Method"
- Messages sorted by: [ date ] [ thread ]
Date: 29 Apr 2004 12:52:22 -0700
Tom,
There can be issues getting your .NET WSDL recognized in something
other than a .Net language for certain datatypes. If all you want to
do is transfer an XML document you could perform this quite simply by
sending the file as an array of bytes - example (quickly cobbled
together from an existing app so it may not be 100% syntactically
correct):
public class Document
{
public byte[] GetXMLDocumentBase64(string fileName)
{
public byte[] base64 = new byte[]{ 0x1, 0x2, 0x3, 0x4, 0x5 };
try
{
FileStream fs = new FileStream(fileName,FileMode.Open);
BinaryReader reader = new BinaryReader(fs);
reader.BaseStream.Seek(0, SeekOrigin.Begin);
long lLength = reader.BaseStream.Length;
int nLength = System.Convert.ToInt32(lLength);
base64 = reader.ReadBytes(nLength);
fs.Close();
reader.Close();
}
catch (Exception)
{
base64 = new byte[]{ 0x1, 0x2, 0x3, 0x4, 0x5 };
}
return base64;
}
}
This particular service also uses DIME attachments to return documents
but if you are interfacing with Java that is not an option (that I
know of). Finally, if your XML is quite large this may not be very
efficient. I have tested this on document transfers up to 2 mb.
Good luck.
Charlie
"Tom Ficker" <tomficke@ages.com> wrote in message news:<eWeUEtGLEHA.1340@TK2MSFTNGP12.phx.gbl>...
> Hello,
> I am trying to return an xml document from a asp .net web service. I am
> using the XMLDocument object and it works fine within .NET, but I cannot
> read the
> WSDL file from a java client.
> Basically it tells me that "the XML Node type is not included". From
> what I have read the last few days, it looks like I have to create a complex
> data type in the WSDL file.
>
> If you have any advise on returning XML from a [webmethod], please let
> me know. I figured it would be simple to transfer XML between .NET and Java
> (Eclipse), but it is proving to be more difficult...
>
> Thank you
> Tom Ficker
- Previous message: charlie: "Puzzling SOAP Error..."
- In reply to: Tom Ficker: "How to Return an XML Doc via a Web Method"
- Messages sorted by: [ date ] [ thread ]
|
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.webservices/2004-04/0363.html
|
crawl-002
|
refinedweb
| 391
| 65.83
|
0,3
A toothpick is a copy of the closed interval [-1,1]. (In the paper, we take it to be a copy of the unit interval [-1/2, 1/2].)
We start at stage 0 with no toothpicks.
At stage 1 we place a toothpick in the vertical direction, anywhere in the plane.
In general, given a configuration of toothpicks in the plane, at the next stage we add as many toothpicks as possible, subject to certain conditions:
- Each new toothpick must lie in the horizontal or vertical directions.
- Two toothpicks may never cross.
- Each new toothpick must have its midpoint touching the endpoint of exactly one existing toothpick.
The sequence gives the number of toothpicks after n stages. A139251 (the first differences) gives the number added at the n-th stage.
Call the endpoint of a toothpick "exposed" if it does not touch any other toothpick. The growth rule may be expressed as follows: at each stage, new toothpicks are placed so their midpoints touch every exposed endpoint.
This is equivalent to a two-dimensional cellular automaton. The animations show the fractal-like behavior..
A "toothpick" of length 2 can be regarded as a polyedge with 2 components, both on the same line. At stage n, the toothpick structure is a polyedge with 2*a(n) components.
Conjecture: Consider the rectangles in the sieve (including the squares). The area of each rectangle (A = b*c) and the edges (b and c) are powers of 2, but at least one of the edges (b or c) is <=
From Benoit Jubin, May 20 2009: The web page "Gallery" of Chris Moore (see link) has some nice pictures that are somewhat similar to the pictures of the present sequence. What sequences do they correspond to?
For a connection to Sierpiński triangle and Gould's sequence A001316, see the leftist toothpick triangle A151566.
Eric Rowland comments on Mar 15 2010 that this toothpick structure can be represented as a 5-state CA on the square grid. On Mar 18 2010, David Applegate showed that three states are enough. See links.
For a three-dimensional version of the toothpick structure, see A160160. - Omar E. Pol, Dec 06 2009
From Omar E. Pol, May 20 2010: (Start)
Observation about the arrangement of rectangles:
It appears there is a nice pattern formed by distinct modular substructures: a central cross surrounded by asymmetrical crosses (or "hidden crosses") of distinct sizes and also by "nuclei" of crosses.:
a) There is a central cross, of size 4, with 16 rectangles.
b) There are four hidden crosses, of size 3, where every cross has 12 rectangles.
c) There are 16 hidden crosses, of size 2, where every cross has 8 rectangles.
d) There are 64 nuclei of crosses, of size 1, where every nucleus has 4 rectangles.
From Omar E. Pol, Mar 12 2011: (Start)).
For the connection with the Ulam-Warburton cellular automaton see the Applegate-Pol-Sloane paper and see also A160164 and A187220.
(End)
From Omar E. Pol, Sep 16 2012: (Start)
It appears that a(n)/A147614(n) converges to 3/4.
It appears that a(n)/A160124(n) converges to 3/2.
It appears that a(n)/A139252(n) converges to 3.
Also:
It appears that A147614(n)/A160124(n) converges to 2.
It appears that A160124(n)/A139252(n) converges to 2.
It appears that A147614(n)/A139252(n) converges to 4.
On the infinite Cairo pentagonal tiling consider the symmetric figure formed by two non-adjacent pentagons connected by a line segment joining two trivalent nodes. At stage 1 we start with one of these figures turned ON. The rule for the next stages is that the concave part of the figures of the new generation must be adjacent to the complementary convex part of the figures of the old generation. a(n) gives the number of figures that are ON in the structure after n-th stage. A160164(n) gives the number of ON cells in the structure after n-th stage. - Omar E. Pol, Mar 29 2018
D. Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, Congressus Numerantium, Vol. 206 (2010), 157-191
L. D. Pryor, The Inheritance of Inflorescence Characters in Eucalyptus, Proceedings of the Linnean Society of New South Wales, V. 79, (1954), p. 81, 83.
Richard P. Stanley, Enumerative Combinatorics, volume 1, second edition, chapter 1, exercise 95, figure 1.28, Cambridge University Press (2012), p. 120, 166.
N. J. A. Sloane, Table of n, a(n) for n = 0..65535
David Applegate, The movie version
David Applegate, Animation of first 32 stages
David Applegate, Animation of first 64 stages
David Applegate, Animation of first 128 stages
David Applegate, Animation of first 256 stages
David Applegate, C++ program to generate these animations - creates postscript for a specific n
David Applegate, Generates many postscripts, converts them to gifs, and glues the gifs together into an animation
David Applegate, Generates b-files for A139250, A139251, A147614
David Applegate, The b-files for A139250, A139251, A147614 side-by-side
David Applegate, A three-state CA for the toothpick structure
David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, which is also available at arXiv:1004.3036v2
Joe Champion, Ultimate toothpick pattern, Photo 1, Photo 2, Photo 3, Photo 4, Boise Math Circles, Boise State University. [Links updated by P. Michael Hutchins, Mar 03 2018]
Barry Cipra, What comes next?, Science (AAAS) 327: 943.
Steven R. Finch, Toothpicks and Live Cells, July 21, 2015. [Cached copy, with permission of the author]
Ulrich Gehmann, Martin Reiche, World mountain machine, Berlin, (2014), first edition, p. 205, 238, 253.
Mats Granvik, Additional illustration: Number blocks where each number tells how many times a point on the square grid is crossed or connected to by a toothpick, Jun 21 2009.
Gordon Hamilton, Three integer sequences from recreational mathematics, Video (2013?).
M. F. Hasler, Illustration of initial terms
M. F. Hasler, Illustrations (Three slides)
Brian Hayes, Joshua Trees and Toothpicks
Brian Hayes, Idealized Joshua tree, a figure from "Joshua Trees and Toothpicks" (see preceding link)
Brian Hayes, The Toothpick Sequence - Bit-Player
Benoit Jubin, Illustration of initial terms
Chris Moore, Gallery, see the section on David Griffeath's Cellular Automata.
Omar E. Pol, Illustration of initial terms
Omar E. Pol, Illustration of initial terms using "gulls" (or G-toothpicks)
Omar E. Pol, Illustration of initial terms using quater-circles (or Q-toothpicks)
Omar E. Pol, Illustration of the toothpick structure (after 23 steps)
Omar E. Pol, Illustration of patterns in the toothpick structure (after 32 steps)
Omar E. Pol, Illustration of patterns in the toothpick structure (after 32 steps) [Cached copy, with permission]
Omar E. Pol, Illustration of initial terms of A139250, A160120, A147562 (Overlapping figures)
Omar E. Pol, Illustration of initial terms of A160120, A161206, A161328, A161330 (triangular grid and toothpick structure)
Omar E. Pol, Illustration of the substructures in the first quadrant (As pieces of a puzzle), after 32 stages
Omar E. Pol, Illustration of the potential growth direction of the arms of the substructures, after 32 stages
Programing Puzzles & Code Golf Stack Exchange, Generate toothpick sequence
L. D. Pryor, Illustration of initial terms (Fig. 2a)
L. D. Pryor, The Inheritance of Inflorescence Characters in Eucalyptus, Proceedings of the Linnean Society of New South Wales, V. 79, (1954), p. 79-89.
E. Rowland, Toothpick sequence from cellular automaton on square grid
E. Rowland, Initial stages of toothpick sequence from cellular automaton on square grid (includes Mathematica code)
K. Ryde, ToothpickTree.
N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
Alex van den Brandhof and Paul Levrie, Tandenstokerrij, Pythagoras, Viskundetijdschrift voor Jongeren, 55ste Jaargang, Nummer 6, Juni 2016, (see the cover, pages 1, 18, 19 and the back cover).
Wikipedia, Cairo pentagonal tiling
Wikipedia, H tree
Wikipedia, Toothpick sequence
Wikipedia, T-square (fractal)
Index entries for sequences related to toothpick sequences
Index entries for sequences related to cellular automata
a(2^k) = A007583(k), if k >= 0.
a(2^k-1) = A006095(k+1), if k >= 1.
a(A000225(k)) - a((A000225(k)-1)/2) = A006516(k), if k >= 1.
a(A000668(k)) - a((A000668(k)-1)/2) = A000396(k), if k >= 1.
G.f.: (x/((1-x)*(1+2*x))) * (1 + 2*x*Product(1+x^(2^k-1)+2*x^(2^k),k=0..oo)). - N. J. A. Sloane, May 20 2009, Jun 05 2009
One can show that lim sup a(n)/n^2 = 2/3, and it appears that lim inf a(n)/n^2 is 0.451... - Benoit Jubin, Apr 15 2009 and Jan 29 2010, N. J. A. Sloane, Jan 29 2010
Observation: a(n) mod 4 == 3 for n>=2. - Jaume Oliver Lafont, Feb 05 2009
a(2^k-1) = A000969(2^k-2), if k >= 1. - Omar E. Pol, Feb 13 2010
It appears that a(n) = (A187220(n+1) - 1)/2. - Omar E. Pol, Mar 08 2011
a(n) = 4*A153000(n-2) + 3, if n >= 2. - Omar E. Pol, Oct 01 2011
It appears that a(n) = A160552(n) + (A169707(n) - 1)/2, n >= 1. - Omar E. Pol, Feb 15 2015
It appears that a(n) = A255747(n) + A255747(n-1), n >= 1. - Omar E. Pol, Mar 16 2015
Let n = msb(n) + j where msb(n) = A053644(n) and let a(0) = 0. Then a(n) = (2 * msb(n)^2 + 1) / 3 + 2 * a(j) + a(j + 1) - 1. - David A. Corneth, Mar 26 2015
It appears that a(n) = (A169707(n) - 1)/4 + (A169707(n+1) - 1)/4, n >= 1. - Omar E. Pol, Jul 24 2015
a(10^10) = 52010594272060810683 - David A. Corneth, Mar 26 2015
G := (x/((1-x)*(1+2*x))) * (1 + 2*x*mul(1+x^(2^k-1)+2*x^(2^k), k=0..20)); # N. J. A. Sloane, May 20 2009, Jun 05 2009
# From N. J. A. Sloane, Dec 25 2009: A139250 is T, A139251 is a.
a:=[0, 1, 2, 4]; T:=[0, 1, 3, 7]; M:=10;
for k from 1 to M do
a:=[op(a), 2^(k+1)];
T:=[op(T), T[nops(T)]+a[nops(a)]];
for j from 1 to 2^(k+1)-1 do
a:=[op(a), 2*a[j+1]+a[j+2]];
od: od: a; T;
CoefficientList[ Series[ (x/((1 - x)*(1 + 2x))) (1 + 2x*Product[1 + x^(2^k - 1) + 2*x^(2^k), {k, 0, 20}]), {x, 0, 53}], x] (* Robert G. Wilson v, Dec 06 2010 *)
(PARI) A139250(n, print_all=0)={my(p=[] /* set of "used" points. Points are written as complex numbers, c=x+iy. Toothpicks are of length 2 */,
ee=[[0, 1]] /* list of (exposed) endpoints. Exposed endpoints are listed as [c, d] where c=x+iy is the position of the endpoint, and d (unimodular) is the direction */
c, d, ne, cnt=1); print_all && print1("0, 1"); n<2 && return(n);
for(i=2, n, p=setunion(p, Set(Mat(ee~)[, 1])); /* add endpoints (discard directions) from last move to "used" points */
ne=[]; /* new (exposed) endpoints */
for( k=1, #ee, /* add endpoints of new toothpicks if not among the used points */
setsearch(p, c=ee[k][1]+d=ee[k][2]*I) || ne=setunion(ne, Set([[c, d]])); \\
setsearch(p, c-2*d) || ne=setunion(ne, Set([[c-2*d, -d]]));
); /* using Set() we have the points sorted, so it's easy to remove those which finally are not exposed because they touch a new toothpick */
forstep( k=#ee=eval(ne), 2, -1, ee[k][1]==ee[k-1][1] && k-- && ee=vecextract(ee, Str("^"k"..", k+1)))\
cnt+=#ee; /* each exposed endpoint will give a new toothpick */ print_all && print1(", "cnt)); cnt} \\ M. F. Hasler, Apr 14 2009
(PARI)
\\works for n > 0
a(n) = {my(k = (2*msb(n)^2 + 1) / 3); if(n==msb(n), k , k + 2*a(n-msb(n)) + a(n - msb(n) + 1) - 1)}
msb(n)=my(t=0); while(n>>t>0, t++); 2^(t-1)\\ David A. Corneth, Mar 26 2015
(Python)
def msb(n):
t=0
while n>>t>0: t+=1
return 2**(t - 1)
def a(n):
k=(2*msb(n)**2 + 1)/3
return 0 if n==0 else k if n==msb(n) else k + 2*a(n - msb(n)) + a(n - msb(n) + 1) - 1
print [a(n) for n in xrange(101)] # Indranil Ghosh, Jul 01 2017, after David A. Corneth's PARI script
Cf. A000079, A139251, A139252, A139253, A147614, A139560, A152968, A152978, A152980, A152998, A153000, A153001, A153003, A153004, A153006, A153007, A000217, A007583, A007683, A000396, A000225, A000668, A006516, A006095, A019988, A160570, A160552, A000969, A001316, A151566, A160406, A160408, A160702, A078008, A151548, A001045, A147562, A160120, A160160, A160170, A160172, A161206, A161328, A161330, A002450, A160124.
Sequence in context: A169626 A160808 A151567 * A256265 A266535 A182634
Adjacent sequences: A139247 A139248 A139249 * A139251 A139252 A139253
nonn,look
Omar E. Pol, Apr 24 2008
Verified and extended, a(49)-a(53), using the given PARI code by M. F. Hasler, Apr 14 2009.
Further edited by N. J. A. Sloane, Jan 28 2010
approved
|
http://oeis.org/A139250
|
CC-MAIN-2018-39
|
refinedweb
| 2,194
| 72.16
|
The QTextEdit class provides a widget that is used to edit and display both plain and rich text. More...
#include <QTextEdit>
Inherits QAbstractScrollArea.
Inherited by QTextBrowser.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text..:
This property holds whether the text edit is read-only.
In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible.
This property's default is false.
Access functions:.
By default, this property contains a value of 80..
Access functions:
This property holds whether undo and redo are enabled.
Users are only able to undo or redo actions if this property is true, and if there is an action that can be undone (or redone).
Access functions:
This property holds the mode QTextEdit will use when wrapping text by words.
By default, this property is set to QTextOption::WrapAtWordBoundaryOrAnywhere.
Access functions:
See also QTextOption::WrapMode.
Constructs an empty QTextEdit with parent parent.
Constructs a QTextEdit with parent parent. The text edit will display the text text. The text is interpreted as html.
Destructor.
Returns the alignment of the current paragraph.
See also setAlignment().
Returns the reference of the anchor at position pos, or an empty string if no anchor exists at that point..
Returns whether text can be pasted from the clipboard into the textedit.
This function was introduced in Qt 4.2.
Deletes all the text in the text edit.
Note that the undo/redo history is cleared by this function.
See also cut(), setPlainText(), and setHtml().; }
Reimplemented from QWidget.
Copies any selected text to the clipboard.
See also.
Returns the char format that is used when inserting new text.
See also setCurrentCharFormat().
This signal is emitted if the current character format has changed, for example caused by a change of the cursor position.
The new format is f.
See also setCurrentCharFormat().
Returns the font of the current format.
See also setCurrentFont(), setFontFamily(), and setFontPointSize().
returns a QTextCursor at position pos (in viewport coordinates).
This signal is emitted whenever the position of the cursor changed.
returns a rectangle (in viewport coordinates) that includes the cursor.
returns a rectangle (in viewport coordinates) that includes the cursor of the text edit.
Copies the selected text to the clipboard and deletes it from the text edit.
If there is no selected text nothing happens.
See also copy() and paste().
Returns a pointer to the underlying document.
See also setDocument().
Ensures that the cursor is visible by scrolling the text edit if necessary.
Returns previously set extra selections.
This function was introduced in Qt 4.2.
See also setExtraSelections().
Finds the next occurrence of the string, exp, using the given options. Returns true if exp was found and changes the cursor to select the match; otherwise returns false.
Returns the font family of the current format.
See also setFontFamily(), setCurrentFont(), and setFontPointSize().
Returns true if the font of the current format is italic; otherwise returns false.
See also setFontItalic().
Returns the point size of the font of the current format.
See also setFontFamily(), setCurrentFont(), and setFontPointSize().
Returns true if the font of the current format is underlined; otherwise returns false.
See also setFontUnderline().
Returns the font weight of the current format.
See also setFontWeight(), setCurrentFont(), setFontPointSize(), and QFont::Weight..
Convenience slot that inserts text at the current cursor position.
It is equivalent to
edit->textCursor().insertText(text);.
Reimplemented from QWidget.().
Redoes the last operation.
If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens.
This function was introduced in Qt 4.2.
See also undo().
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
Scrolls the text edit so that the anchor with the given name is visible; does nothing if the name is empty, or is already visible, or isn't found.
Selects all text.
See also copy(), cut(), and textCursor().
This signal is emitted whenever the selection changes.
See also copyAvailable().
Sets the alignment of the current paragraph to a. Valid alignments are Qt::AlignLeft, Qt::AlignRight, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally).
See also alignment()..().
Sets the font family of the current format to fontFamily.
See also fontFamily() and setCurrentFont().
If italic is true, sets the current format to italic; otherwise sets the current format to non-italic.
See also fontItalic().
Sets the point size of the current format to s.
Note that if s is zero or negative, the behavior of this function is not defined.
See also fontPointSize(), setCurrentFont(), and setFontFamily().
If underline is true, sets the current format to underline; otherwise sets the current format to non-underline.
See also fontUnderline().
Sets the font weight of the current format to().
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
Returns the text color of the current format.
See also setTextColor().
Returns a copy of the QTextCursor that represents the currently visible cursor. Note that changes on the returned cursor do not affect QTextEdit's cursor; use setTextCursor() to update the visible cursor.
See also setTextCursor(). by making the base font size range points larger and recalculating all font sizes to be the new size. This does not change the size of any images.
See also zoomOut().
This is an overloaded function.
Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size. This does not change the size of any images.
See also zoomIn().
|
http://doc.qt.nokia.com/4.5-snapshot/qtextedit.html#acceptRichText-prop
|
crawl-003
|
refinedweb
| 941
| 62.04
|
If I have that code:
try: some_method() except Exception,e:
How can I get this Exception value (string
representation I mean)?
Thanks
use
str
try: some_method() except Exception as e: s = str(e)
Also, most exception classes will have an
args attribute. Often,
args[0] will be an error message.
It should be noted that just using
str will return an empty string if there’s no error message whereas using
repr as pyfunc recommends will at least display the class of the exception. My take is that if you’re printing it out, it’s for an end user that doesn’t care what the class is and just wants an error message.
It really depends on the class of exception that you are dealing with and how it is instantiated. Did you have something in particular in mind?
Use repr() and The difference between using repr and str
Using repr:
>>> try: ... print x ... except Exception, e: ... print repr(e) ... NameError("name 'x' is not defined",) >>>
Using str:
>>> >>> try: ... print x ... except Exception, e: ... print str(e) ... name 'x' is not defined >>> >>>
Another way hasn’t been given yet:
try: 1/0 except Exception, e: print e.message
Output:
integer division or modulo by zero
args[0] might actually not be a message.
str(e) might return the string with surrounding quotes and possibly with the leading
u if unicode:
'integer division or modulo by zero'
repr(e) gives the full exception representation which is not probably what you want:
"ZeroDivisionError('integer division or modulo by zero',)"
edit
My bad !!! It seems that
BaseException.message has been deprecated from
2.6, finally, it definitely seems that there is still not a standardized way to display exception messages. So I guess the best is to do deal with
e.args and
str(e) depending on your needs (and possibly
e.message if the lib you are using is relying on that mechanism).
For instance, with
pygraphviz,
e.message is the only way to display correctly the exception, using
str(e) will surround the message with
u''.
But with
MySQLdb, the proper way to retrieve the message is
e.args[1]:
e.message is empty, and
str(e) will display
'(ERR_CODE, "ERR_MSG")'
Even though I realise this is an old question, I’d like to suggest using the
traceback module to handle output of the exceptions.
Use
traceback.print_exc() to print the current exception to standard error, just like it would be printed if it remained uncaught, or
traceback.format_exc() to get the same output as a string. You can pass various arguments to either of those functions if you want to limit the output, or redirect the printing to a file-like object.
For python2, It’s better to use
e.message to get the exception message, this will avoid possible
UnicodeDecodeError. But yes
e.message will be empty for some kind of exceptions like
OSError, in which case we can add a
exc_info=True to our logging function to not miss the error.
For python3, I think it’s safe to use
str(e).
If you don’t know the type/origin of the error, you can try:
import sys try: doSomethingWrongHere() except: print('Error: {}'.format(sys.exc_info()[0]))
But be aware, you’ll get pep8 warning:
[W] PEP 8 (E722): do not use bare except
Tags: exception, laravelpython
|
https://exceptionshub.com/getting-the-exception-value-in-python.html
|
CC-MAIN-2022-05
|
refinedweb
| 560
| 64.61
|
Introduction
While the de facto .NET languages C# and Visual Basic .NET are certainly capable, only the former is especially portable (in practice, that is), and users coming from scripting backgrounds or users who don’t enjoy C-style syntax may not feel at home. Fortunately, however, the Common Language Infrastructure allows support for multiple languages, and these languages can be used together as the developer sees fit. Boo is one such language for the CLI. It offers the features of the .NET Framework and Mono, and it features a Python-like syntax. In this article, we’ll explore the Boo language and some of its basic features.
Boo can be obtained at:
The Boo Toolbox
Boo comes with three basic tools for working with Boo code. The first is the Boo compiler, which compiles Boo code into an assembly. It goes by the name of booc:
$ booc HelloWorld.boo
Boo Compiler version 0.7.8.2559 (CLR v2.0.50727.42)
The next tool is the Boo interpreter. Instead of compiling a Boo file, you can interpret it using booi:
$ booi HelloWorld.boo
Hello World!
It’s also possible to interpret code directly form standard input:
$ booi –
print "Hello World!"
print "Goodbye!"
Hello World!
Goodbye!
The final tool is the Boo interactive interpreter, booish, similar to Python’s interactive interpreter. As its name implies, it allows one to interact with it, immediately seeing the results of code, among other things:
$ booish
Welcome to booish, an interpreter for the boo programming language.
Running boo 0.7.8.2559 in CLR v2.0.50727.42.
The following built-in functions are available:
dir(Type): lists the members of a type
help(Type): prints detailed information about a type
load(string): evals an external boo file
globals(): returns the names of all variables known to the interpreter
getRootNamespace(): namespace navigation
Enter boo code in the prompt below.
>>> print "Hello World!"
Hello World!
>>>
{mospagebreak title=Program Structure and Variables}
Unlike C# and Visual Basic.NET, Boo does not require a class to be declared with a static method as the program’s entry point. A basic "Hello World" program can be written in a single line:
print "Hello World!"
Here, print is actually a macro. Boo users are free to develop their own macros as substitutes for repetitive code. Using the print macro is the same as calling the built-in print method:
print("Hello World!")
To access a namespace’s contents without having to specify the namespace itself, import is used:
import System
Console.WriteLine("Hello World!")
Python programmers should take note: although import looks exactly the same as its Python equivalent, it isn’t. Python’s import allows the developer to find and access Python modules, while Boo’s import merely provides a shortcut to a namespace’s types, which could otherwise be accessed by specifying the namespace in front of the target type. Boo may look similar to Python, but their similarities don’t extend too deep – watch out, Python users!
Now let’s look at defining variables in Boo. Boo is a statically typed language, so the types of variables are determined at compile-time. Let’s define some variables of various types:
name as string = "John Doe"
gender as char = char(‘m’)
married as bool = false
age as int = 35
savings as double = 12345.67
Note how we explicitly assign each variable a type. In some instances, such as when we define but don’t immediately initialize a variable, this is required. However, Boo can usually determine the type of a variable at compile-time just by looking at what’s assigned to it:
name = "John Doe"
gender = char(‘m’)
married = false
age = 35
savings = 12345.67
Although Boo is a statically typed language, there exists a special type called duck that provides support for duck typing. That is, you’re free to use a variable of type duck as you see fit, without the compiler watching your back at compile-time:
x as duck
x = 4
x = "four"
x = false
The above code assigns an integer value to x, followed by a string and then false. Normally, this wouldn’t compile, but with Boo’s duck typing, it does. The above example is poor, however, since the same effect could be achieved by declaring x as type object. Consider this next example, then, where we use methods associated with specific types:
x as duck
x = 4
x = x.MinValue
x = "string"
x = x.Replace("s", "q")
Note, though, that Boo is still a statically typed language and that duck typing should not generally be used.
{mospagebreak title=Arrays and Collections}
In Boo, arrays are defined a little differently from the way they are defined in other languages. Here, we create an array of integers and an array of strings:
ints = array(int,4)
ints[0] = 3
ints[1] = 6
ints[2] = 8
ints[3] = 90
strings = array(string, ["one", "two", "three"])
Note how the type of the array’s elements is passed, followed by either the size of the array or the array’s elements.
One very useful feature of arrays is slicing, which Python users will recognize. Slicing provides an easy way to extract a portion of an array:
theArray = [1, 2, 3, 4, 5]
print theArray[1:]
print theArray[1:3]
print theArray[2:]
[2, 3, 4, 5]
[2, 3]
[3, 4, 5]
Boo has support for two built-in collections, lists (for which slicing also works) and hashtables:
a = [4, 8, 15, 16, 23, 42]
a[0] = 8
a[1] = 15
a.Add(16)
b = {"jdoe": "John Doe", "jsmith": "John Smith"}
b["msmith"] = "Mary Smith"
However, the two collections are not type-safe:
c = [1,2]
c.Add("three")
d = {1: "one", "two": 2}
Fortunately, Boo has recently added support for generics, so one can create a type-safe collection using the collections in System.Collections.Generic:
import System.Collections.Generic
names = List of string()
names.Add("John")
names.Add("Sam")
names.Add("Mary")
rooms = Dictionary[of int,string]()
rooms.Add(100, names[0])
rooms.Add(200, names[1])
rooms.Add(300, names[2])
{mospagebreak title=Conditionals and Loops}
Boo’s if statement is similar to Python’s, accompanied by an elif statement and and else statement. No parentheses are needed around the condition being tested, and the body of each branch, which is intended, is introduced by a colon:
n = 3
if n % 2:
print "Odd."
else:
print "Even."
rating = 7
if rating >= 7:
print "Good."
elif rating >= 4:
print "Average."
else:
print "Bad."
Odd.
Good.
Boo also features an unless statement, which executes the associated code unless the condition is met:
password = "ginger"
unless password == "licorice":
print "You can’t come in."
You can’t come in.
Boo provides a while loop with no surprises:
n = 5
nFactorial = 1
while n > 1:
nFactorial = nFactorial * n
n = n – 1
print nFactorial
120
However, Boo’s for loop is equivalent to a foreach loop in languages such as C#. It iterates through an enumerator:
for n in [4,8,15,16,23,42]:
print n
4
8
15
16
23
42
In order to obtain the functionality of a traditional for loop, one has to iterate over the sequence of numbers that would be passed through the for loop. This sequence of numbers can be generated by range:
for n in range(5):
print n
0
1
2
3
4
The range method can also take arguments specifying where the sequence should end and by what the starting point should be incremented to obtain the next number:
for n in range(1,3):
print n
for n in range(1,3,2):
print n
1
2
1
{mospagebreak title=Functions and Types}
Unlike C#, a method in Boo does not necessarily have to belong to a class. These functions provide an alternative to defining static methods that don’t fit in too well with any class. They are defined using the def keyword. For example, here is a function that squares an integer and then returns the result:
def square(x as int) as int:
return x*x
Notice how we explicitly assign int as the return type of our function. While this is a good idea for complex functions, it’s possible to omit return type and make Boo determine it at compile-time. The following function works exactly the same as the one above:
def square(x as int):
return x*x
The only difference is that it took a few less keystrokes to define the latter function.
A void method can be created the same way — with or without void specified as the return type. The following two functions are equivalent:
def a() as void:
print "This is a void function."
def b():
print "This is a void function."
To define a class in Boo, use the class keyword. Constructors go by the name of constructor. For example, here is a class that prints a string when initialized:
class TestClass:
def constructor():
print "TestClass initialized."
test = TestClass()
TestClass initialized.
Here is a class named Person whose constructor accepts a string, a name, and an int, age. Both values are then assigned to fields:
class Person:
private _name as string
private _age as int
def constructor(name as string, age as int):
_name = name
_age = age
Now, of course, in order to access these fields, we need to create properties that correspond to them. Here, we create two properties, Name and Age, each providing a way to get and set the value:
…
Name as string:
get:
return _name
set:
_name = value
Age as int:
get:
return _age
set:
_age = value
…
Of course, this seems like overkill just to define two simple properties. Fortunately (and this is where it gets interesting), Boo provides a much neater way to do this. Instead of creating the property for a field explicitly, one can have Boo do it. Here, we recreate the Person class, compacting it into fewer lines:
class Person:
[Property(Name)]
private _name as string
[Property(Age)]
private _age as int
def constructor(name as string, age as int):
_name = name
_age = age
As you can see, this makes things a lot easier on the developer. The class is considerably shorter but still quite readable. However, let’s say we want to make Name a read-only property. Boo provides a short way of doing this as well:
[Getter(Name)]
private _name as string
Interfaces may be created with the interface keyword. Method signatures that do not specify a return type are assumed to be void:
interface IBuyable:
def GetPrice() as double
def Buy()
To inherit from a class or to implement an interface, simply specify the name of the class or interface in parentheses:
class Pencil(IBuyable):
def GetPrice():
return 0.50
def Buy():
print "You bought a pencil!"
Conclusion
Though other .NET languages will get the job done, Boo may require less effort to work with, and it certainly will save the developer keystrokes. For example, rather than packing a program into a class, one can immediately start typing instructions, and rather than drawing out properties into multiple lines, one can neatly compact a simple property into two lines. Boo’s Python-style syntax and effort-saving features certainly merit consideration of the language.
|
http://www.devshed.com/c/a/braindump/a-quick-tour-of-boo/1/
|
CC-MAIN-2015-27
|
refinedweb
| 1,882
| 61.26
|
I'm trying to build a basic program which has 2/3 threads. The main thread, signaler thread, and receiver thread. I'm trying to make it so the main thread starts both a signaler and receiver thread. The signaler thread is then supposed to send 10 SIGUSR1 signals to the receiver thread and increase a global counter. The receiver thread is supposed to receive the 10 signals while increasing its own counter for each signal received.
The trouble I'm having is with joining the threads back together at the end, specifically joining the receiver thread. The majority of the time the program stalls if I try to join them back together, I assume because the receiver thread hasn't finished its job (maybe it has missed signals?) and so it never finishes. I thought maybe this was the case, so I introduced a wait command in the signaler thread to slow it down, but that didn't change anything.
If I comment out the pthread_join(receiver, NULL) then the program runs, but it only catches one signal most of the time. I assume this is because the receiver thread isn't getting much time to run. (although sometimes it catches various amounts, depending on when it was preempted?)
Leaving the pthread_join(receiver, NULL) in the program makes it stall 19/20 times, but that 1/20 time the program returns 10 signals sent and 10 received. This leads me to believe it has something to do with preemption, but I don't understand why it would ever stall in the first place.
Also right now I just have the receiver thread receiving threads while the received counter is < 10. Ideally I would just want to leave it in while(1) loop, but then again I don't know how to join that back into the main thread without freezing everything.
If someone could help me figure out why signals are being missed / why the program is freezing I would be most grateful. I have a suspicion that I'm not setting up the signal mask correctly for the receiver, but I don't know how else I am supposed to do it. Here is the code:
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <signal.h>
void *receivetest(void *args);
void *signaltest(void *args);
int received = 0;
int sent = 0;
pthread_t signaler;
pthread_t receiver;
sigset_t mask;
int main(){
//setting up the signal mask
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
//creation of both threads
pthread_create(&receiver, NULL, receivetest, NULL);
pthread_create(&signaler, NULL, signaltest, NULL);
pthread_join(signaler, NULL);
pthread_join(receiver, NULL);
//printing results after joining them back
printf("I'm the main function\n");
printf("Receieved: %d, sent: %d\n", received, sent);
}
void *signaltest(void *args){
int i = 0;
for(i=0;i<10;i++){ //sends 10 signals to receiver thread
pthread_kill(receiver, SIGUSR1);
sent++;
}
}
void *receivetest(void *args){
int c; //sigwait needs int
pthread_sigmask(SIG_BLOCK, &mask, NULL); //sets up the signal mask for this thread
while(received < 10){ //waits for 10 signals and increments receieved
sigwait(&mask, &c);
received++;
}
}
Signals just don't work that way. If a thread receives a signal while that same signal is already pending, nothing happens. Please use an appropriate inter-thread communication method, not signals.
|
https://codedump.io/share/j8dYN7ctGcuz/1/signal-receiver-threads-in-c-and-pthreadjoin-stalling-program
|
CC-MAIN-2017-26
|
refinedweb
| 543
| 68.2
|
How to add ncurses library to project?
I am trying to start with ncurses library but QtCreator does not compile it. Here is the simple code:
#include <iostream> #include <ncurses.h> using namespace std; int main(int argc, char *argv[]) { initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print it on to the real screen */ getch(); /* Wait for user input */ endwin(); /* End curses mode */ return 0; }
I added to .pro file these lines but i could not find where i am doing wrong:
QMAKE_CXXFLAGS += -lncurses QMAKE_CXXFLAGS_DEBUG += -lncurses
When I compile it with g++ manually with -lncurses option it works though. QtCreator gives me undefined reference for those functions.
Hi! Your *.pro file should contain:
INCLUDEPATH += /path/to/ncurses/headers/ LIBS += -L/path/to/ncurses/library/ -lncurses
@Wieland I have just added this and it works:
LIBS += -L/usr/include -lncurses
But I dealed with finding include path still, I don't know why only -lncurses is not enough.
- mrjj Qt Champions 2016
@maydin
Hi you also need to tell about
.h files with
INCLUDEPATH += /path/to/ncurses/headers/
as @wieland says
- jsulm Moderators
|
https://forum.qt.io/topic/77217/how-to-add-ncurses-library-to-project
|
CC-MAIN-2018-09
|
refinedweb
| 186
| 71.14
|
This article has been provided courtesy of MSDN.
Learn about developing robust smart client device applications with the .NET Compact Framework 1.0 and Visual Studio .NET 2003. (34 printed pages)
Microsoft developed the .NET Compact Framework with one intention in mind: to build applications. I am talking about applications that display, gather, process and forward information, those applications that give users a reason to carry a device. While they typically will have an interface, they do not require one. The data that they are working with might be local, might be remote, or some combination of both.
The .NET Compact Framework simplifies application development on smart devices. Currently this includes the Pocket PC, Pocket PC 2002, Pocket PC Phone Edition and other devices running Windows CE.NET 4.1 or later.
You will need Visual Studio .NET 2003 to build applications that target the .NET Compact Framework. You can build applications using either Visual C# .NET, Visual Basic .NET, or both.
The .NET Compact Framework has two main components: the common language runtime and the .NET Compact Framework class library.
The runtime is the foundation of the .NET Compact Framework. It is responsible for managing code at execution time, providing core services such as memory management and thread management while enforcing code safety and accuracy. Code that targets the runtime is known as managed code; code that does not target the runtime, as is the case with eMbedded Visual C++, is known as unmanaged, or native code.
The .NET Compact Framework class library is a collection of reusable classes that you can use to quickly and easily develop applications. This framework was designed with porting in mind, whether to Microsoft or third-party platforms. What does this mean to you? Simply that the coding techniques and the applications you create today to run on a Pocket PC could run on other platforms, such as a cell phone or another vendor's PDA, if a version of the .NET Compact Framework was created for that platform.
The common language runtime provides a code-execution environment that manages code targeting the .NET Compact Framework. Code management can take the form of memory management, thread management, security management, code verification and compilation and other system services.
The runtime is designed to enhance performance. It uses just-in-time (JIT) compiling, which enables managed code to run in the native machine language of the platform on which your application is running. This allows you to create applications that can target a variety of platforms and not have to worry about recompiling or generating executables that target each specific platform.
Even though your mobile application is written in Visual Basic .NET or C# .NET, and as such is managed code, you are still able to incorporate functions and subroutines stored externally in dynamic link libraries (DLLs), including the Windows CE APIs. The .NET Compact Framework provides the data types and support for structures to allow you to easily incorporate functions from the Windows CE APIs into your application.
The .NET Compact Framework class library is a collection of reusable classes that tightly integrate with the common language runtime. Your applications leverage these libraries to derive functionality.
As you would expect from an object-oriented class library, the .NET Compact Framework types enable you to accomplish a range of common programming tasks, including tasks such as interface design, leveraging XML, database access, thread management and file I/O.
Following is a list of common functionality available through the .NET Compact Framework.
The .NET Compact Framework implements a subset of the
System.Windows.Forms and
System.Drawing classes, which allows you to construct a rich Windows CE-based user interface for your device application. The Form Designer in Visual Studio.NET manages much of the interaction with these classes for you.
The implementation of Windows Forms under the .NET Compact Framework includes support for forms, most controls found in the .NET Framework, hosting third-party controls, bitmaps and menus. Table 1 lists the controls included with the .NET Compact Framework.
Since the .NET Compact Framework is a subset of the full .NET Framework, the included controls have a subset of their desktop cousins' functionality. Due to size and performance considerations, some control properties, methods and events have been omitted from .NET Compact Framework controls. With a little coding, you can implement these omitted features yourself as needed. This is because the .NET Compact Framework allows you to create your own controls by inheritance from the base control class. From this foundation, you can add your own properties, methods and events to create just the control you need.
The .NET Compact Framework includes a set of classes that allow you to easily incorporate data (whether from a relational or non-relational data source), including XML content, into your mobile applications. These classes are defined under the
System.Data and
System.Xml namespaces. The implementation of both data and XML classes in the .NET Compact Framework is a subset of that found in the .NET Framework.
The .NET Framework is much about Web services. In the .NET Compact Framework
System.Web namespace, you have a scaled-down version of the capabilities and functionality offered in the corresponding .NET Framework namespace. Most significantly, you can create Web services clients but are not able to host Web services under the .NET Compact Framework.
These XML Web service clients can be either synchronous or asynchronous. Creating an XML Web service client that targets the .NET Compact Framework is easy. The Visual Studio .NET IDE does much of the work for you.
The .NET Compact Framework provides support for the basic GDI drawing elements including bitmaps, brushes, fonts, icons and pens through the
System.Drawing namespace.
The .NET Compact Framework provides a robust set of base classes that expose a wide-range of functionality for use by developers. This underlying infrastructure enables you to write rich .NET applications including being able to create multi-threaded applications (
System.Threading), leveraging networking resources (
System.Net), and working with files (
System.IO).
Windows CE devices, such as the Pocket PC and Pocket PC 2002, include infrared (IR) communication capabilities. In support of this, the .NET Compact Framework includes classes that allow you to leverage IR communication from within your application. These classes are part of the
System.Net.IrDA namespace. You can use IR to communicate with Pocket PCs, printers and other IR-enabled devices.
The .NET Compact Framework does not natively provide support for Bluetooth. You can access most third-party Pocket PC implementations of Bluetooth via either serial port communications or through a provider's API.
Visual Basic .NET makes liberal use of helper functions that are located in a Visual Basic Helper library. The .NET Compact Framework includes a subset of these functions as well. These functions are considered by Visual Basic developers to be a core part of the language, which is the reason for their inclusion.
If you are a Visual Basic or eMbedded Visual Basic developer converting over to the .NET Compact Framework, this means that many of the Visual Basic language functions you are used to working with will be available to you in Visual Basic .NET.
To conserve resources on the target device, Microsoft divided the .NET Compact Framework into logical components. By delivering components as separate DLLs�or assemblies as they are referred to within the .NET Compact Framework�Microsoft gives you the option of picking and choosing the features you need, and only those features that your target device has the space to hold.
An example of this is the
System.SR assembly, which contains error message strings. Including this assembly with your application allows access to detailed descriptions of any errors encountered, which is certainly helpful during a debugging session, but infrequently needed in an application once it is released to production. Excluding this assembly does not affect the performance or functionality of your application; it simply means you will not have access to detailed error messages.
Another example of the .NET Compact Framework ala carte approach is SQL Server CE components, delivered in a set of DLLs totaling slightly over 1MB in size. Unless you explicitly add a reference to the
System.Data.SqlServerCe assemblies, these DLLs will not be included with your application.
Some serious trimming had to be made to the .NET Framework so that it could fit into the operating constraints of Windows CE. The most notable .NET Framework features that did not make it into the .NET Compact Framework are the subject of this section.
Overloading a method provides alternative ways to call that method. It also increases the size of the Framework. Because of this, the .NET Compact Framework trimmed the overloads from almost all methods.
What this means to you is two-fold. First, there is a good chance that a particular method overload you used with a desktop application will not be available when developing .NET Compact Framework-based applications. Second, when you read the documentation, pay close attention to whether or not a method is supported by the .NET Compact Framework.
A number of .NET Framework controls did not make their way into the .NET Compact Framework. The absence of most of these controls is insignificant to mobile developers. Since printing has such a limited role in mobile applications, removing the whole family of print-related controls is not an issue. That takes care of the CrystalReportViewer, PageSetupDialog, PrintDialog, PrintDocument, PrintPreviewControl and PrintPreviewDialog controls. You can replace many of the missing dialogs with your own dialogs or by accessing system dialogs directly using the Windows CE API.
Third-party controls are already becoming available to fill in for the controls that were left out of the .NET Compact Framework. For a list of third-party .NET Compact Framework controls see the references at the end of this article.
As much as the .NET Compact Framework offers in the way of XML, an equal amount of functionality was trimmed. The key missing XML-related component is the
System.Xml.XPath namespace. The
XPath namespace made XML parsing far easier than the methods offered under the .NET Compact Framework. In its absence, you can use a combination of recursive and iterative searches against the Document Object Model (DOM).
The .NET Compact Framework is missing another key XML component, Extensible Stylesheet Language Transformation, or XSLT. With XSLT, you can convert an XML document into different formats.
On an XML-related note, the .NET Compact Framework does not currently provide support for developing device-based XML Web services.
The .NET Compact Framework offers a robust set of data-related tools. Local database support is provided for SQL Server CE. On the server side, the .NET Compact Framework provides support for SQL Server.
Note that there is a third party who provides a .NET Compact Framework component for working with Pocket Access databases. For more information, see the references at the end of this article.
Due to size and performance considerations both the
BinaryFormatter and
SoapFormatter classes have been omitted from the .NET Compact Framework.
The .NET Framework has the Microsoft.Win32.Registry namespace, which makes it easy to work with the Windows registry from an application. Obviously, this namespace was not included in the .NET Compact Framework, because it relates to Win32, not Windows CE. You may access the Windows CE registry by invoking the relevant Windows APIs.
Incorporating COM objects into a .NET Compact Framework-based application is a two-step process. First, you must write an unmanaged�that is to say eMbedded Visual C++�DLL wrapper that exposes the COM object. Depending upon the complexity of the COM object, this may be anything from simple to extremely complicated. Second, you must use PInvoke to access your DLL wrapper. Luckily, the development community has already begun work on accessing the more commonly used COM components, several of which are included in the references at the end of this article.
The .NET Compact Framework does not secure access to unmanaged code. Any application can call any system or non-system API.
There is currently no role-based security with the .NET Compact Framework. The principal object has no understanding of known identity or known role.
The most notable exclusion from the .NET Compact Framework XML Web service capabilities is the ability to use cookies. Cookies are widely used to maintain state on the server between calls from a client. While the use of cookies in Web services is not as prevalent as their use on Web sites, they are still in use.
The .NET Compact Framework offers limited cryptographic abilities with respect to Web services.
The .NET Compact Framework provides no support for printing. There is no easy way to interact with either network printers or external printers via IR.
The workaround for accessing network printers is to build a server-based application, which accepts and prints jobs submitted by your mobile application.
You can send output through the IR port directly to IR-enabled printers. You use the
System.Net.IrDA namespace to access the IR port of your device
Windows CE does not natively support GDI+, so GDI+ related functionality was removed from .NET Compact Framework.
The first release of the .NET Compact Framework does not support remoting.
Visual Studio .NET 2003 provides a robust development environment for creating applications that target the .NET Compact Framework. Included with Visual Studio .NET is a set of pre-built device profiles. A device profile contains information necessary to build applications that target specific devices. With Visual Studio .NET, there are profiles that enable you to create applications for the Pocket PC, Pocket PC 2002, and Windows CE .NET 4.1 and later. These profiles allow you to create applications that include Windows Forms and ADO.NET, and offer the ability to consume Web services.
Profiles may be device-specific, such as targeting the Pocket PC, less-specific platforms that target the Windows CE platform in general, or generic profiles that target any platform to which the .NET Compact Framework has been ported.
Visual Studio .NET supports device kits (formerly known as SDKs). As were earlier versions of the embedded tools, device kits are separate from Visual Studio .NET and may be installed and updated independently.
In addition to all of the features found natively in Visual Studio .NET, there are the following device-specific features:
The .NET Compact Framework supports two development languages, C# .NET and Visual Basic .NET. While previous versions of Windows CE development tools favored C-based languages�namely eMbedded Visual C++�with the .NET Compact Framework it makes little difference which of the languages you choose, because both are equally powerful and functional.
As a late addition to the Visual Studio .NET development environment, J# is not supported by the .NET Compact Framework.
You should also be aware that there is another language limitation under the .NET Compact Framework that does not exist under the .NET Framework. Under the .NET Framework you can use mixed-language components within a single project. In comparison, .NET Compact Framework projects are restricted to a single language, either C# .NET or Visual Basic .NET. The workaround to this single-language project limitation imposed by .NET Compact Framework is to create additional projects using the Class template. Add your alternate language code to the template, and then simply add references to these classes in your application project.
The documentation included with Visual Studio .NET provides information relating to the .NET Compact Framework. You will find both .NET Compact Framework-specific topics, such as "Creating Custom Controls with the .NET Compact Framework", and line item identification of features supported under the .NET Compact Framework.
Figure 1 shows an example of the DataTable properties supported under the .NET Compact Framework. Each of the supported properties carries the note "Supported by the .NET Compact Framework". This is an excellent way to find out what features an object supports, and to ascertain quickly the differences between the .NET Framework and the .NET Compact Framework.
When Visual Studio .NET is launched, it will display the Start Page, as shown in Figure 2. From the Start Page, you can open existing projects and create new projects, including projects that target the .NET Compact Framework.
Clicking the New Project button causes the New Project dialog box to be displayed, as shown in Figure 3. From this dialog box, you can select a template to create a wide variety of project types, including two that target the .NET Compact Framework. Under both the Visual Basic Projects and Visual C# Projects folders is a Smart Device Application template.
To create a Visual Basic .NET project
To create a Visual C# .NET project
Selecting the Smart Device Application template will result in the loading of the Smart Device Application Wizard, as showing in Figure 4. This wizard is used to walk you through the process of selecting the project type for your application.
The interface of this wizard is divided into two list boxes. The top list box allows you to select the target platform. It contains two options, Pocket PC or Windows CE. Where Pocket PC targets a specific device platform, the Windows CE template is used to create a more general-purpose application that could run on a variety of devices that are running that operating system.
The lower list box displays the project types that are available for the target device (Pocket PC or Windows CE) you selected.
Four project types target the Pocket PC and Pocket PC 2002 platforms, as shown in Figure 5. These are Windows Application, Class Library, Non-graphical Application and Empty Project. A description of each of these project types is provided in Table 2.
These project types can be used to create applications that target Pocket PC devices running SH3, MIPS or ARM processors and Pocket PC 2002 devices with ARM or XScale processors.
Note The Pocket PC device does not come with console support. As a workaround you can load console.dll yourself, which is available with Platform Builder.
As shown in Figure 6, four project types target the Windows CE platform. These are Windows Application, Class Library, Console Application and Empty Project. A description of each of these project types is provided in Table 3.
As with all Visual Studio .NET projects, .NET Compact Framework projects are configured using the Project Property Pages dialog box. Through this dialog box, you can configure namespaces that you want included; what form to use as your startup form; an icon to associate with your application; how your application will be built; where it will be built; how it will be deployed; optimization configurations and a variety of other settings.
There are two methods for accessing the Property Pages dialog box:
If you are already an experienced Visual Studio .NET developer, you will require little orientation to begin creating user interfaces for applications that target the .NET Compact Framework. For those who are new to the Visual Studio .NET IDE, new projects based on the Windows Application template will automatically display a default form as shown in Figure 8.
In this example, the project type is a Windows Application that will target the Pocket PC. The template for this type of application includes a form that is sized correctly for the Pocket PC platform. A menu control, shown below the form, is included with the form because most Pocket PC applications include menus.
The .NET Compact Framework includes a subset of the controls that can be used to construct a desktop Windows application. For the most part, you will find that these controls offer a subset of equivalent controls found under the .NET Framework. This difference has to do with resource limitations imposed by the target platforms.
The controls provided through .NET Compact Framework are shown in Table 4.
Note There are also a number of third-party controls available. Refer to the reference section at the end of this document for more details.
One of the coolest features about the .NET Compact Framework is how it enables you to code around limitations. Take controls, for example. All of the controls delivered with the .NET Compact Framework are limited in comparison to their full-Framework counterparts. They are missing properties, methods and events. Through the .NET Compact Framework, you can modify the functionality of the standard controls to fit just your need.
You can divide custom controls into three categories: user, inherited and owner-drawn. User controls are the simplest to create, but unfortunately are not supported under the .NET Compact Framework. Inherited controls start with a .NET Compact Framework control. They then add, remove or modify the properties, methods and events of that base control as desired. As complexity of a control goes, inherited controls tend to fall between user and owner-drawn controls. Owner-drawn controls offer the most flexibility in the way of their interface. They also require the greatest amount of work.
While the process of creating custom controls for the .NET Compact Framework is outside of the scope of this article, you will find that most of the techniques and approaches used with the .NET Framework carry over to .NET Compact Framework.
The following links provide additional details on creating custom controls for use with the .NET Compact Framework:
Look at any commercially successful Pocket PC application, and you will find a menu bar. Almost without exception, to build a highly effective Pocket PC application with a fair set of functionality requires the use of a menu bar.
The use of menu bars is so common that the default Pocket PC Windows Application template automatically attaches a menu bar to the initial form it creates. With Visual Studio .NET and the .NET Compact Framework, building menus is easy and straightforward. You simply build a menu hierarchy with a graphical tool provided through the Forms Designer.
While constructing menus with the design-time tool is the easiest approach, it's not the only approach. Menus can also be constructed with code. While slightly more complicated, there are situations where you will want to create your menus on the fly while your application is running.
It is the
MainMenu control that physically implements a menu bar on a form. The Menu Designer offers a graphical interface to configuring a
MainMenu control. You use the Menu Designer to construct the menus and menu items that will compose your overall menu bar.
To activate the Menu Designer
MainMenucontrol, add one at this time.
If you are building a menu, you need to respond to the user tapping, or clicking, a menu item. Each menu item has a Click event procedure that executes when the user taps on the item. Listing 1 shows an example of such a procedure.
Listing 1. A click event procedure for a menu item
'[Visual Basic] Private Sub mnuEditCut_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles mnuEditCut.Click MessageBox.Show("cut...") End Sub
//[Visual C#] private void mnuEditCut_Click(object sender, System.EventArgs e) { MessageBox.Show("cut..."); }
Desktop developers should note that toolbars as they exist in the Pocket PC environment are different from those deployed with a standard desktop application. Most notably, Pocket PC toolbars appear at the bottom of an interface, rather than the top. In addition, they are always limited to a small number of buttons, a restriction enforced by the minimal screen real estate offered on the Pocket PC. Both of these traits can be seen in Figure 12.
Toolbars serve two important roles in an application. First, they add some spice. Pocket PC applications in general, because of the limited size, tend to be plain in appearance. Toolbars, and the buttons they contain, can give your application's interface visual 'punch'.
Second, toolbars simplify user interaction. Commonly used functions and features can be placed on a toolbar instead of nesting them in a menu. The advantage of this is that accessing a toolbar button requires only a single tap. In comparison, a menu item requires at least two taps, and possibly a third if the item is part of a submenu.
This process of constructing a toolbar is divided into three steps:
ImageListcontrol. The
ImageListcontrol provides the images that will ultimately be displayed on the buttons of your menu.
ToolBarcontrol. The
ToolBarcontrol defines the buttons that will compose the physical toolbar as it is displayed to the end user.
ToolBarcontrol uses a single event procedure to respond to taps on any of its buttons.
With toolbars, you are only concerned about a single event, the event that fires when the user taps on a button. That event is the
ButtonClick event. The event procedure for the
ButtonClick event is shared between all of the buttons.
The only issue when working with this event procedure is determining which button was tapped. This can be easily accomplished by referencing the event arguments passed to the procedure. By referencing
e.Button.ImageIndex, you can determine the image that was associated with the button that was tapped. This index is the one you originally assigned to the images as you stored them within the
ImageList control. Listing 2 provides a demonstration of handling the button taps.
Listing 2. Handing toolbar button taps
'[Visual Basic] Private Sub tlbMain_ButtonClick(ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _ Handles tlbMain.ButtonClick Select Case e.Button.ImageIndex Case 0 MessageBox.Show("print...") Case 1 MessageBox.Show("task...") End Select End Sub
//[Visual C#] private void tlBMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (e.Button.ImageIndex) { case 0: MessageBox.Show("print..."); case 1: MessageBox.Show("task..."); } }
Now that you have seen the basics of constructing an interface, we are ready to turn our attention to how you add code to your application. As with any applications developed within the Visual Studio .NET IDE, code is added through the Code window.
If you are new to the Visual Studio .NET, environment you are in for a treat. The Code window provides a plethora of functionality, everything from statement completion, to auto-listing members, providing parameter information and collapsible regions of code, just to name a few.
The easiest way to navigate through your code is by using the two combo boxes located at the top of the window. The combo box at the top left of the Code window allows you to select a class within a module. The combo box at the top right of the window allows you to select a method from within that class.
With the user interface completed and the code written, it is time to turn our attention to testing your application. Visual Studio .NET offers two methods for testing applications that target the .NET Compact Framework: through an emulator and on a device. With either the emulator or a device, Visual Studio .NET handles deploying both your application and all of the components your application requires, including the .NET Compact Framework and SQL Server CE.
All this is handled when you test a .NET Compact Framework application from within Visual Studio .NET 2003. A check of the target platform is made to confirm that the .NET Compact Framework is installed. If Visual Studio .NET determines that the .NET Compact Framework is missing, it will automatically copy and install the .NET Compact Framework before attempting to run your application. This installation process will occur the first time you test to a device or the emulator and if you hard reset either the device or emulator.
A similar process is used if your application uses SQL Server CE. Visual Studio .NET will check the target platform to confirm that the SQL Server CE components are installed. If Visual Studio .NET does not find them, it will automatically copy and install the required SQL Server CE components before running your application.
After it has been determined that all of the components required by your application are present, your application will be copied to the target platform, placed in the directory you specified in your project configurations and finally launched.
There are several ways to run a test of your application:
The emulator provides an environment within your desktop PC that mimics the functionality and operation of the device platform you are targeting with your application. The emulator is useful in situations where you do not have a device or when your device is not available.
Be forewarned: Testing in the emulator has its shortcomings. First and foremost is that the emulator runs on a desktop PC, which has far more processing resources than the target device. This can give you a false sense of how well your application performs. In addition, input for the emulator is provided through a keyboard and a mouse rather than the stylus the end user will use. If you are not consciously aware of this difference, you can create an application that is easy to use in the emulator and painful to use on the device. Finally, the emulator offers a "close" representation of a device, not an exact match. There are subtle differences in all emulators.
The emulators provided with Visual Studio .NET will not operate unless the development PC on which it is running has a network connection. If your PC does not have a network connection, you can still use the emulator by installing the Microsoft Loopback Network Adapter. This adapter simulates a network connection and effectively fools the emulator into running.
Under Windows 2000, the process for installing the Microsoft Loopback Network Adapter is as follows:
Like any network adapter, installing a loopback adapter is only half of the process. You also need to configure your new adapter. Perform the following steps to configure the loopback adapter:
Note Check to make sure that you are working with the right connection. The Connection Using field of this dialog should read "Microsoft Loopback Adapter".
Earlier versions of Windows CE / Pocket PC emulators offered two distinct approaches to creating the emulator environment. The first generation of emulators used a closed environment, which was inaccessible from standard Windows-based file management tools found on the development PC. Any files that you needed on the emulator had to either be created within the emulator or copied to the emulator using specialized utilities that were included with the eMbedded Visual Tools.
Second-generation emulators provided a more open environment, one that was accessible using common tools, such as File Explorer. The emulator directory structure existed in a subdirectory on the development PC. Copying files to and from the emulator was a simple drag-and-drop operation.
The emulator included with Visual Studio .NET returns us to the closed emulator environment. To complicate matters, unlike earlier versions of the eMbedded Visual Tools, Visual Studio .NET does not include an emulator file management tool. This absence requires some creative work-around on your part.
There are three common ways to provide files within the emulator environment. One way is to create the files through applications that run on the emulator. I don't believe that this approach requires any additional discussion here. You can use standard .NET programming techniques to create text, XML or database files.
The other two approaches, adding files to your project and copying files from a share, require some additional explanation.
The easiest method to move files to the emulator is to include them as part of your project. One advantage to using this approach is that in the event that you perform a hard reset on the emulator, you simply need to rebuild your project to resume testing.
The process for using this approach is:
The second approach offers more flexibility, and requires a minimal amount of additional work. It makes use of the network file sharing functionality built into the Pocket PC operating system, which subsequently is made available through the emulator included with Visual Studio .NET.
There are two parts to this approach: setting up a share on your development PC and then accessing that share through the emulator's File Explorer.
Setting up a share requires two configurations. First, you must configure you PC to enable sharing. Second, you configure individual folders to share.
To enable sharing on a development PC running Windows 2000
At this point, you have configured your development PC to allow file sharing. Next, you need to share a folder where you will place the files you wish to copy to the emulator.
To share a folder under Windows 2000
With your development PC configured, you're ready to copy files. First, you'll need to place all of the files destined for the emulator in the shared folder. Then, to move the files to the emulator, perform the following steps:
Depending on the security settings on your development PC, you may be prompted for a username and password before being allowed to access the share.
At this point, you're ready to copy files to and from the share on your development PC and the emulator.
Note These same approaches for copying files work equally well when using a device, but there is one known issue. Pocket PC devices by default have the device name "Pocket PC". Unless you change this name, you will not be able to access a share.
Testing on a device allows you get a first-hand experience with how your applications perform. With Visual Studio .NET you can test on devices connected to your development PC via USB, serial or Ethernet.
Note Use Ethernet to connect your device to your development PC. This is by far the quickest and easiest method for testing and debugging.
You can select to deploy to a device using any of the following ways:
The debugging environment provided through the Visual Studio .NET IDE is robust. It allows you to pause your application, see its inner workings, modify code, examine values and step through your application in a systematic manner.
The core of the debugging functionality can be found on the Debug menu in the Visual Studio .NET IDE. From this menu, you can start and stop a debugging session, set breakpoints, and navigate about your application while in debug mode.
Note Breakpoints identify a line of code within your application where you want to pause or interrupt the execution of your application when encountered.
Visual Studio .NET enables you to remotely debug applications that are running on a device or in an emulator from the comfort of your development PC. You can use the Command window to enter statements, query and set variables, execute lines of code and other similar tasks.
Note For the optimal debugging environment, use Ethernet to connect your device to your PC.
Creating setups for a .NET Compact Framework application is similar to the approach used for other Windows applications. Application setups are delivered using cabinet files, more commonly referred to as "CAB" files, after their .cab file extension. CAB files serve two purposes: 1) they compress and store files so that they may be easily distributed; 2) they make sure that all of the files and settings required by an application are correctly handled.
Applications built with Visual Studio .NET require that the .NET Compact Framework be resident on the target device. In addition, if the application makes use of SQL Server CE, you'll need to install the SQL Server CE components as well.
Your setup routine will need to take all of this into consideration. It may need to include multiple CAB files: one for your application, a second for the .NET Compact Framework and the SQL Server CE CABs.
The easiest way to create a CAB file for your application is to let Visual Studio .NET do all of the work for you. One of the features offered through Visual Studio .NET is a menu item within the IDE for generating CAB files.
To build a CAB file for an application
Note No message or acknowledgement is displayed to inform you that the CAB file has been generated. After the last of the command windows closes, you will simply be returned to the Visual Studio .NET interface.
Output from this CAB-building process is stored in a directory located under your application's directory. You will find the individual CAB files under the subdirectory \bin\release. An example of this hierarchy is shown in Figure 15.
In the example shown in Figure 15, there were several CABs generated, one for each of the target platform processor types. In this figure, you can see the four CABs, one each for the StrongArm, MIPS, SH3 and X86 processor types. This is because the deployment device was a Pocket PC, and these four processor types are supported for that device.
At this point, you could copy the appropriate CAB file to your target device, open up File Explorer on the device, tap on your CAB file and your application would be installed.
Note Remember, for your application to be able to run, you will need to install the .NET Compact Framework and, if required, SQL Server CE.
The installation process becomes slightly more complex if your application setup will be performed from a desktop PC, through a docking cradle to a device. In this situation, you will need two setups, one for the desktop PC and one for the device. The device setup is the CAB file. The desktop setup is an executable that performs two functions. First, it copies your CAB files onto the desktop PC. Second, it starts Application Manager (CeAppMgr.exe). Application Manager then takes over to copy your CAB file to the device and subsequently launches the install.
Application Manager handles adding and removing applications from devices as well as deleting application files from the PC that initiated the installation. You use an .INI file to provide installation instructions to Application Manager.
Desktop setups can be created with any application that allows you to copy your CAB files to a PC and then launch Application Manager. Two companies, InstallShield and Wise, provide commercial-grade installation development packages that provide this functionality.
Spb Software House offers a free setup product called EZSetup. While this application is not as robust as the products from InstallShield and Wise, it functions quite well for most setups.
Note If you are going to write your own desktop setup you will need to find where Application Manager is located on the installation PC. The full name and path of Application Manager is stored in the registry value of HKLM\software\Microsoft\Windows\CurrentVersion\App Paths\CEAppMgr.exe.
The .NET Compact Framework presents developers with a powerful tool for creating robust mobile applications. It enables you to leverage you existing .NET skills in the construction of applications that target Pocket PC and Windows CE .NET devices.
The .NET Compact Framework is a subset of the .NET Framework. While similar in appearance and functionality to the .NET Framework, learning how to program under the .NET Compact Framework will take time and effort. You will need to master the limitations imposed by Windows CE devices and the demands associated with creating mobile applications.
larryroof.com offers training and project consulting in designing and developing mobile applications. Services offered include 5-day training courses in the .NET Compact Framework and SQL Server CE, customized training programs and combinations of training and project consulting to aid you in quickly implementing effective mobile solutions.
General
News
Question
Answer
Joke
Rant
Admin
|
http://www.codeproject.com/KB/mobile/netcfgetstarted.aspx
|
crawl-002
|
refinedweb
| 6,576
| 58.48
|
24 October 2008 08:36 [Source: ICIS news]
SINGAPORE (ICIS news)--Finland’s Neste Oil reported a 76% year-on-year decline in third-quarter operating profits to €44m ($34.3m), having suffered massive inventory losses from plunging crude values, the company said on Friday.?xml:namespace>
An inventory loss of €180m was incurred due to rapidly falling oil prices, the company added.
Neste’s negative cash flow from operations widened to €175m from €32m in the same period last year due to temporarily high receivables at the quarter’s end, it said.
“The oil market witnessed even higher than normal volatility and crude oil prices dropped rapidly and significantly after rising for eight months,” said Jarmo Honkamaa, deputy chief executive officer at Neste.
The company’s refining margins, meanwhile, reached a new record of $13.54 /bbl, up 33% from a year earlier, mainly driven by demand for middle distillates and diesel, he said.
“All our diesel production units are operating normally again after maintenance carried out at the Porvoo diesel line in August and September,” Honkamaa said.
Crude prices have fallen from a record high $147/bbl in mid-July to currently stand out well below $100/bbl.
(
|
http://www.icis.com/Articles/2008/10/24/9166012/nestes-q3-operating-profits-slump-on-crude-dive.html
|
CC-MAIN-2014-41
|
refinedweb
| 200
| 50.77
|
I will assume you have the following installed:
- Internet Information Server
- Visual Studio 2010
- Dynamics AX 2012 Client
- Dynamics AX 2012 Visual Studio Tools
First, let us create a new Project in Visual Studio. I'm want something easy and swift, so let's choose .Net 3.5 and ASP.Net Web Service Application. I'm naming the Project "PizzaSearchService" and this will automatically be part of the namespace for this application.
The project loads and you will be presented with the code for "Service1". Now just copy the code underneath and paste it in.
using System.ComponentModel; using System.Collections.Generic; using System.Web.Services; namespace PizzaSearchService { public class PizzaInfo { public string Name; public string Description; public double Prize; } [WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class Service1 : WebService { [WebMethod] public List< PizzaInfo > SearchPizza(string query) { return new List< PizzaInfo > { new PizzaInfo{ Name = "AX Beef Extreme", Description = "One of our favourites with mushroom, beef, onion and mozzarella cheese.", Prize = 12.99 }, new PizzaInfo{ Name = "AX Regular Meatlover", Description = "The good old classic with mushroom, meat, pepperoni, peppers and mozzarella cheese.", Prize = 10.99 } }; } } }
This is just a very simple service that takes a string as an input for a query for pizzas. It then returns a list of two pizzas. I love pizza, so I just couldn't help myself.
Open Internet Information Services Manager, right-click the Default Web Site and choose Manage Website and Advanced Settings...
Then click choose to select the correct Application Pool. By default IIS will have preconfigured some Applications Pools, and the one we want for now is the one named "Classic .Net AppPool", because it runs .Net 2, and our Web Service is of .Net 3.5 (built on .Net 2).
Having this set, you can head back to Visual Studio and Publish your built solution. Right-click the project and choose Publish...
Select "File System" as Publish method, and then choose a target Location.
Select Local IIS and your Default Web Site.
Now simply press Publish and your Service1.asmx and precompiled binaries will be copied to the location of your Web Site, normally under C:\inetpub\wwwroot\.
You should be able to test the Web Service by opening a browser and navigating to it. Try loading and see what happens. Unless something went horribly wrong, you should see this page listing service entry points and some extra textual description.
If you click the SearchService-link you will get a description of that service and since it takes a simple string you can invoke the service from here.
We already know the service returns the same result each time, so just press invoke and watch it open the result.
This only took you like 5-10 minutes and you're ready to consume this Web Service from within AX 2012. I recommend having a look at one of the blog posts linked above. In short, you need to do the following:
- Create a new Visual Studio Project
- Select .Net Framework 4
- Select a template from Visual C# and Windows
- Select the Class Library as template.
- Give it a name like "DynamicsAXPizzaService".
- Add a Service Reference and point to
- Add the project to the AOT
- Deploy!!
Now you are ready to consume it from within AX. You will have to restart the AX client, as already mentioned in the documentation.
In order to get you started quickly, I wrote this main-method which you can just copy and paste to test if it works.
public static void main(Args args) { DynamicsAXPizzaService.WebService1.Service1SoapClient wcfClient; DynamicsAXPizzaService.WebService1.PizzaInfo[] pizzaInfoArray; DynamicsAXPizzaService.WebService1.PizzaInfo pizzaInfo; System.ServiceModel.Description.ServiceEndpoint endPoint; System.ServiceModel.EndpointAddress endPointAddress; System.Exception ex; System.Type type; int i, numOfPizzas; str name, description, prize; ; try { type = CLRInterop::getType('DynamicsAXPizzaService.WebService1.Service1SoapClient'); wcfClient = AifUtil::createServiceClient(type); endPointAddress = new System.ServiceModel.EndpointAddress(""); endPoint = wcfClient.get_Endpoint(); endPoint.set_Address(endPointAddress); pizzaInfoArray = wcfClient.SearchPizza("mozarella"); numOfPizzas = pizzaInfoArray.get_Count(); for(i = 0; i < numOfPizzas; i++) { pizzaInfo = pizzaInfoArray.get_Item(i); name = pizzaInfo.get_Name(); description = pizzaInfo.get_Description(); prize = pizzaInfo.get_Prize(); info(strFmt("%1 - %2 - %3", name, description, prize)); } } catch(Exception::CLRError) { ex = CLRInterop::getLastException(); while(ex) { info(CLRInterop::getAnyTypeForObject(ex.ToString())); ex = ex.get_InnerException(); } } }
The output when running this class should be this:
Now that you have this working, you can start tamper with it and make it break and learn how the pieces fits together. Here are a couple of things you might want to try understand:
Now that you have this working, you can start tamper with it and make it break and learn how the pieces fits together. Here are a couple of things you might want to try understand:
- What dll is being used when the X++ code is running client side?
- Tip: have a look at this path: "%localappdata%\Local\Microsoft\Dynamics AX\VSAssemblies\"
- What dll is being used when the X++ code is running server side?
- Tip: find the location where your AOS Server files are installed and look for the VSAssemblies-folder under the bin-folder.
- What about when you activate hot-swapping of assemblies on the AOS?
- What happens if you deploy new versions of these dlls and you want the client or the AOS to load this new version?
- Either restart the client or restart the AOS, depending on what dll you want reloaded.
- What if you plan to have the dll run only server side and never client side, but you need intellisense while developing the X++ code?
- You need the dll deployed client side on the developer machine. :-)
Finally, I wanted to show you a neat little tool by JetBrains named dotPeek. If you take any of the dlls you just created and drop them into this tool, you can explore the content and even browse the code. I have used this tool in many different scenarios to peek inside managed assemblies.
If you have any concerns or you bump into any issues while trying to follow the steps in this article, please leave a comment underneath.
If you have any concerns or you bump into any issues while trying to follow the steps in this article, please leave a comment underneath.
|
http://yetanotherdynamicsaxblog.blogspot.com/2013/10/
|
CC-MAIN-2017-22
|
refinedweb
| 1,025
| 58.48
|
The.
The original code looks like this:); }
Maybe its author wrote it like that because he uses Visual Studio, or some other editor that allows collapsing of regions so that it shows only function headers, and with that weird spacing, all function names line up just fine. In every other editor, it’s a big WTF.
Emacs, my favorite editor, allows (relatively) easy programming of your own functions, especially that it already sports an impressive number of primitives. I already use indent-region, bound to a short-cut.
For a function like this to be useful, it should at least offer two variants, one for the whole buffer, and one only for the current function/block/class.
(defun whitespace-respace() "Replaces all (non-line changing) series of whitespaces by a single space, then reindent" (interactive) (save-excursion (mark-whole-buffer) (replace-regexp "[[:space:]]+" " ") (indent-region (region-beginning) (region-end) nil) ) ) (defun whitespace-respace-function() "Replaces all (non-line changing) series of whitespaces by a single space, then reindent" (interactive) (save-excursion ; from (save-restriction ; narrows regexp replace on region (c-mark-function) (narrow-to-region (region-beginning) (region-end)) (goto-char (point-min)) (while (re-search-forward "[[:space:]]+" nil t) (replace-match " " nil nil) ) ) (c-mark-function) (indent-region (region-beginning) (region-end) nil) ) )
Let’s have a look on how it works. The first variant respaces/reindent the whole buffer. save-excursion saves the cursor position, executes the statements listed, then restores it. mark-whole-buffer selects the whole buffer. replace-regexp replaces the regular expression on the whole buffer, without deactivating, or rather, while ignoring, the selection. At last, indent-region reindents the region marked by its region-beginning and its region-end.
The second variant is a bit more difficult: replace-regexp must be limited to the selection, which in turns depend on the function/class/etc, as selected by c-mark-function. I used the Emacs Wiki article on narrowing to get started. Basically, we have to iterate find-and-replace manually over the selection. Everything else is pretty much as in the first variant.
Applying the whitespace-respace-function on the previous code snippet yields:); }
*
* *
I used the “namespace” whitespace because that’s were I saw I could place it and remember where I placed it. The code also isn’t overly specific. Except for c-mark-function, it can be easily applied to other source languages because indent-function is supposed, I think, to be supplied by your major mode.
Hi! Nice little tool! However, I would recommend that you check that the spaces you remove aren’t in a string, that way you could accidentally change the behavior of the program. A `(unless (nth 3 (syntax-ppss) …)` should do it.
I’ll have to look into it. I’m *not* an Emacs Lisp expert, and I have never used parser states… but hey, il y a un début partout.
It’s not as advanced as it looks, really. (Well, it is, under the hood, but that’s another story.) `syntax-ppss` describes the context of the point and element 3 (counting from 0) tells you if you’re in a string. That’s it.
You don’t need to use narrowing, just pass (region-end) as the 2nd parameter (BOUND) to re-search-forward.
Oh, that’s an interesting fix! I will get to it sometime this week (it’s the finals’ week and I’m quite busy).
Thats a nice script. I can’t tell you how many times I have encountered the tab/space problem.
Have you looked at the clang-format tool? It’s very configurable, so you can restrict it to just fix spacing if that is what you want/need. It can also be integrated into Vim, Emacs, and BBEdit.
No, I haven’t. I haven’t had time to try all the proposed modifications either. (It’s finals’ week and I’ve been marking exams and assignments for the last few days.)
|
https://hbfs.wordpress.com/2016/04/19/respace/
|
CC-MAIN-2017-26
|
refinedweb
| 665
| 55.54
|
Running desktop code on Pythonista.
Man, I really wish we had gfm style codeblocks... indentation not showing up above in the code.
EDIT: Fixed with html and pre. Thanks to ccc. Still wish for the gfm :)
I have not done extensive testing on numerous types of machines but you might try:
import platform if platform.system() == 'Darwin': if platform.machine().startswith('iP'): print('You are running on iOS!') else: print('You are running on Mac OS X!') else: print('Please upgrade to a real computer and then press any key to continue...')
Machines starting in 'iP' would include iPhone, iPad, iPod but NOT iMac, iBook, iBook Pro.
- mintyfresh190
@n8henrie Why don't you just use a <code>try...except</code> to import one of the Pythonista specific modules as a test?
Good thoughts, thanks to both.
- DennisNg141
import platform
print "platform.system() is -"+platform.system()+""
print "platform.machine() is -"+platform.machine()+""
|
https://forum.omz-software.com/topic/257/running-desktop-code-on-pythonista
|
CC-MAIN-2019-09
|
refinedweb
| 151
| 72.22
|
Skip to 0 minutes and 1 secondGo back to your Room class. Locate the attributes self.name self.description, and underneath them, add a new attribute called linked rooms, which for now is a blank dictionary.
Skip to 0 minutes and 15 secondsNow let's add another method to allow us to link rooms together. This method takes three arguments-- the object itself, which we can ignore, the Room object to link to, and the direction this object is in.
Skip to 0 minutes and 34 secondsHere is a diagram of how I would like my rooms to be laid out. As you can see, the kitchen is to the north of the dining hall, and the ballroom is to the west. Change to your main.py file. Create the dining room object and give it a description.
Skip to 1 minute and 1 secondThe dining hall is to the south of the kitchen, so I'm going to use the link room method on the kitchen object, like this.
Skip to 1 minute and 11 secondsTo show you how the dictionary looks, I'm going to go back to the Room class and add a line of code inside the link room method to display the contents of the dictionary.
Skip to 1 minute and 26 secondsRun in the main.py code and you will see something similar to this. South is the key in the dictionary, and the room object is the part which says room.roomobject.
Skip to 1 minute and 40 secondsThis code is not necessary for the game. I'm just using it to show you how the dictionary gets built up. You can remove it once you get the idea.
Linking rooms
In our game we would like to have lots of rooms, and so we need to add some attributes and methods to handle linking multiple room objects together.
We will add a dictionary of all of the rooms which are linked to a
Room object. You may not have encountered a dictionary data structure before. Dictionaries are similar to lists, but allow you to give each element a name. Here is an example of a dictionary that stores the winners of various medals:
winners = { "gold": "Alex", "silver": "Brian", "bronze": "Clare"} print( winners["gold"] ) >>> Alex
As you can see, we can ask the dictionary for a specific element by name. This will be useful in our adventure game, because we can ask for the room in a particular direction. For example, here is how we would refer to the room to the east:
self.linked_rooms["east"]
Go back to your
Room class, locate the attributes
self.name and
self.description and below them add a new attribute called
linked_rooms.
self.linked_rooms = {}
The
linked_rooms = {} code creates an empty dictionary; its empty because at the moment the room isn’t linked to any other rooms.
Now let’s add a method to allow us to link rooms together.
New methods are added below the other methods:
Add the
link_room method:
def link_room(self, room_to_link, direction): self.linked_rooms[direction] = room_to_link
This method takes three parameters: the object itself (which we can ignore when we use the method), the room object to link to, and the relative direction of this object.
Here is a diagram of how I would like my rooms to be laid out:
Challenge
- Go back to your main.py code. Underneath your existing code, create two more objects to represent the dining_hall and the ballroom
- Set names and descriptions for all of your room objects
Link the rooms together
The dining hall is to the south of the kitchen, so I am going to use the
link_room method on the kitchen object in my main.py file, like this:
kitchen.link_room(dining_hall, "south")
See inside the dictionary
If you would like to see what’s inside the dictionary, add this line of code inside the
link_room method in room.py to display the contents of the dictionary:
print( self.name + " linked rooms :" + repr(self.linked_rooms) )
Run the main.py code and you will see something similar to this:
Kitchen linked rooms :{'south': <room.Room object at 0x03A22770>}
This code is not necessary for the game – I am just using it to show you how the dictionary gets built up. Comment it out by putting a
# at the start of the line when you have seen how it works.
Challenge
- Use the
link_roommethod three more times in main.py to link the rooms together to match the diagram above. Don’t forget that links only go one way:
kitchen.link_room(dining_hall, "south")
This code links from the kitchen to the dining hall. However, at the moment there is no link back from the dining hall to the kitchen, so the player will be stuck there forever!
The room we are linking from is the object we call the method on, and the room we are linking to is the object we pass into the method.
If you would like some help, you can see all of the code so far as a Trinket here.
© CC BY-SA 4.0
|
https://www.futurelearn.com/courses/object-oriented-principles/3/steps/348317
|
CC-MAIN-2018-47
|
refinedweb
| 855
| 79.9
|
Take)
I had a similar problem at windows, but I believe the solution is same on
Ubuntu LTS.
So, if you increase the Java Heap Memory of Matlab, the Matlab will consume
more memory from your system but it will be faster.
To do that go to:
File->preferences->General->Java Heap Memory and increase to the maximum.
The default value is 128, that is too little.
Have you tried rebooting? in the old days it helped clearing the memory
once in a while.
another thing making apache slow is the hostnamelookup, perhaps the dns
chaching server has issues.
as always look at the log files. perhabs there's somewhere a loop (dns or
302 .htaccess).",
The two issues were:
require_debug_false filter was inadvertently missing from the mail_admins
logging
handler: ...
'handlers': { ...
'mail_admins': {
'filters': [''],
should have specified:
'filters': ['require_debug_false'],
As a result, even with DEBUG=True Django would attempt to send an error
email to mail_admins however the settings were only configured to work with
the SMTP mail server in a staging or production environment so it was
hanging trying to connect to the mail server.
Doing the requests sequentially will take longer than doing the requests in
parallel. You'll want to do concurrent requests to speed this up.
Take a look at this answer using curl_multi.
ImageResizer.MvcWebConfig adds a total of 235kb to your project, and takes
no actions during startup except reading from the Web.config file.
You're seeing 3 minute debugger attach times - that generally indicates a
symbol loading problem, and you can fix that in Visual Studio settings.
Any NuGet package you install will cause the same behavior - if the package
offers source code and/or symbols.
I suggest retagging your question as 'nuget' and 'visualstudio'.
Your best option is to upload the images directly to Amazon S3 and then
have it ping you with the details of what was uploaded.
You haven't given us enough information to be sure, but there's a pretty
good chance this is your problem:
If some_text is a unicode object, then this line:
html1, html2 = html.split(some_text) # this line spits out the error
… is calling split on a str, and passing a unicode parameter. Whenever
you mix str and unicode in the same call, Python 2.x handles that by
automatically calling unicode on the str. So, that's equivalent to:
html1, html2 = unicode(html).split(some_text) # this line spits out the
error
… which is equivalent to:
html1, html2 = html.decode(sys.getdefaultencoding()).split(some_text) #
this line spits out the error
… which will fail if there are any non-ASCII characters in html, exactly
as you're seeing.
The easy workaround is to explicitly encode some_t)
This is untested, but my suspicion is:
The error says you cannot connect to 'localhost', which is a network name
for the computer you are using. However, you ask Firebird to connect to
'/tmp/test.fbd', which is a file system location. Basically, firebird
thinks that the you want to connect to the file '/tmp/test.fbd' as if it
were a server.
Try:
con = fdb.connect(host="localhost", database="/tmp/test.fdb",
user="fernando", password="root")
or
con = fdb.connect(dsn="localhost:/tmp/test.fdb", user="fernando",
password="root")
Assuming of course, that /tmp/fest.fbd is actually on your localhost..
The way you've written the code, you have to wait for each file to save
before you grab the next screenshot. That's where your "very small delay"
comes from.
You could grab all of the snapshots in memory and then write them at the
end:
snapshots = []
for i in range(20):
b = wx.EmptyBitmap(w, h)
m.SelectObject(b)
m.Blit(0, 0, w, h, s, 0, 0)
m.SelectObject(wx.NullBitmap)
snapshots.append(b)
for snapshot in snapshots:
snapshot.SaveFile('{0:05d}.png'.format(i), wx.BITMAP_TYPE_PNG)
But this will use up a lot of memory—maybe enough for the malloc calls
(or, worse, swap thrash) to slow you down.
Another alternative is to push the write off to a background thread. (Since
the work is probably I/O bound, normal Python threads should be fine here.)
For example:
with concurre
You did in fact properly install the python bindings for Qt4 when you used:
sudo aptitude install python-qt4
You should usually use the Distribution-provided packages - the
Ubuntu-provided packages are perfectly adequate for your needs.
What's puzzling me is the error you got after installing the Ubuntu
package. I just tried this on a Ubuntu 12.04 installation and it worked for
me. That suggests to me that your current installation of Ubuntu on your
system is broken in some way.
You could try completely purging the python-qt4 package and reinstalling it
again;
sudo apt-get remove --purge python-qt4
If you also issue:
sudo apt-get clean
... that will remove any downloaded package files from the system, so that
apt will then download the package file again when you issue a
sudo a
I'm not sure what you expect to happen here. The cronjob won't have access
to a display where it can display the GUI, so the button will never be
displayed, so print_this will never be run
FWIW, when I tried to run your code I got an error:
File "./t.py", line 4
def __init__(self,parent):
^
IndentationError: expected an indented block
Not sure if that's just caused by copy/paste into the page or if it's a
real problem with your code.
In Python, due to the GIL, threads doesn't really execute in parallel. If
the RPC part is waiting in an active way (loop poling for connection
instead of waiting), you most probably will have the behavior you are
describing. However, without seeing any code, this is just wild guess.
It is slow because you are re-reading a file for each loop iteration, and
create a new function object. Neither of these two things are dependent on
the loop variable; move these out of the loop to only run once.
Furthermore, the simple function can be inlined; calling a function is
relatively expensive. And don't call ''.join() twice, either. And you are
only using lowercase letters to generate the words, so .lower() is
redundant:
with open('/Users/kyle/Documents/english words.txt') as word_file:
english_words = set(word.strip().lower() for word in word_file)
for p1 in itertools.combinations('abcdefghijklmnopqrstuvwxyz', 4):
word = ''.join(p1)
print '{} is {}'.format(word, word in english_words)
Since you are generating words of length 4, you could save yourself some
memo
You can use py2exe for Windows
Freeze on Linux and as you say py2app for Mac
I found this blog post which has the answer:
Essentially, you need to ensure you have the necessary development
libraries installed:
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
Try creating a https handler and see if that fixes the problem.
Change this line:
proxy = urllib2.ProxyHandler({'http': ''})
to
proxy = urllib2.ProxyHandler({'https': ''})
and see if that works, since the Twitter API you are trying to access is
over HTTPS.
Update your PYTHONPATH in Eclipse, go to Preferences > PyDev >
Interpreters - Python Then update your paths to lxml package. I suggest you
to reload your interpreter (first delete it, and next add it again) it will
load all packages and PyDev will recognized lxml
You need to write a script in /etc/init.d/ ,in this script ,you need to
define how to start and stop the software.here is an example:
case "$1" in
start)
start_software
;;
stop)
stop_software
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
exit 0
A 32-bit OS can only address up to aroung 4gb of ram, while a 64-bit OS can
take advantage of a lot more ram (theoretically 16.8 million terabytes).
Since your OS is 32-bit, your OS can only take advantage of 4gb, so your
other 4gb isn't used.
The other 64-bit machine doesn't have the 4gb ram limit, so it can take
advantage of all of its installed ram.
These limits come from the fact that a 32-bit machine can only store memory
address (pointers) of 32-bytes, so there are 2^32 different possible memory
locations that the computer can identify. Similarly, a 64-bit machine can
identify 2^64 different possible memory locations, so it can address 2^64
different bytes.
Why is there any need for a Python module???
All can be done from the command line!
E.g. take a look
at:
Get the commands needed and execute them from Python.
The MemoryError means you're running out of system-wide virtual memory. How
much virtual memory you have is an abstract thing, based on the actual
physical RAM plus swapfile size plus stuff that's paged into memory from
other files and stuff that isn't paged anywhere because the OS is being
clever and so on.
According to your comments, each process averages 0.75GB of real memory,
and 4GB of virtual memory. So, your total VM usage is 32GB.
One common reason for this is that each process might peak at 4GB, but
spend almost all of its time using a lot less than that. Python rarely
releases memory to the OS; it'll just get paged out.
Anyway, 6GB of real memory is no problem on an 8GB Mac or a 7GB c1.xlarge
instance.
And 32GB of VM is no problem on a Mac. A typical OS X system has virtually
I think you actually get more interesting data by grabbing the raw JSON
that it uses to build the graphs. It includes the related headlines that
don't come with the CSV download. This works for a few queries (5?) before
you reach the quota.
import re
import requests
_GOOGLE_TRENDS_URL =
''
term = 'foo'
response = requests.get(_GOOGLE_TRENDS_URL % term)
if response.status_code == requests.codes.ok:
data_line = [l for l in response.content.splitlines() if 'var
chartData' in l][0]
chart_data = re.sub(r'.*var chartData = (.*?);.*', r'1', data_line)
# Fix for date representation
chart_data = re.sub(r'new Date((d+), (d+), (d+))', r'"1-2-3"',
chart_data)
data = json.loads(
If you are using a requests.get call to obtain your HTTP response, you can
use the raw attribute of the response. Here is the code from the requests
docs.
>>> r = requests.get('',
stream=True)
>>> r.raw
<requests.packages.urllib3.response.HTTPResponse object at
0x101194810>
>>> r.raw.read(10)
'x1fx8bx08x00x00x00x00x00x00x03'
See here:
E.g. if 'requests' is a directory, which has __init__.py, Python executes
this file each time it sees from requests import ... or import requests.
See more in Modues.
This, although not pretty at all, works:
import requests
req = requests.get('')
pool =
req.connection.poolmanager.connection_from_url('')
conn = pool.pool.get()
# get() removes it from the pool, so put it back in
pool.pool.put(conn)
print(conn.sock.getpeercert())
I think you want to do something like this:
for x in coords:
loc={'?contains' : x , '&sets' : 'a_parameter'}
...
This references the x variable, not the string 'x'.
After several days, I finally figured out the (simple) problem. The
CloudApp API requires a "GET" request to the "Location" header in Amazon's
response.
Pycloudapp was working correctly because it properly authenticated the GET
response with return json.load(self.upload_auth_opener.open(request)).
I'm not sure why I was able to post correctly using Postman without any
authentication -- somehow it was properly following the GET without
credentials, even though the CloudApp API specifies that following the
redirect requires authentication.
I was unable to follow the redirect properly with Requests because I was
posting unauthenticated values (if I continued the Session() with s.post,
the auth headers throw an error because Amazon doesn't expect them), and
therefore the subsequent GET was
I looked through the site and it appears that you are using a GET HTTP
method to retrieve the data when what you actually need is a POST.
Typically an HTTP 501 is sent across as a response to the client, when the
web server does not understand the HTTP verb sent across by the client
within the request.
Try changing the code:
r = requests.get('',
data=payload, cookies=cookies, headers=headers)
to something like
r = requests.post('',
data=payload, cookies=cookies, headers=headers)
Note : I have not used Requests, hence you may want to double check the
function call parameters. For a quick reference see this link.
Hope this helps - and here is a dump of my header as visible in Chrome.
Observe that y
|
http://www.w3hello.com/questions/ubuntu-14-04-python-requests-slow
|
CC-MAIN-2018-17
|
refinedweb
| 2,097
| 65.32
|
When I first started programming approximately 5 years ago, I was dreaming big. I wanted to make a chat system from scratch with no issues that was fast, reliable, and lightweight.
However, most ambitious projects for new programmers get shot down real fast and this was no different. I searched and struggled to find a decent system or decent code that would allow me to do some simple communication with two clients with a centralized server. Apparently, that was rather difficult for me to find (I didn't get good with Google until a few years later) anything that would do exactly what I wanted.
A few years go by and I gathered more skill and I decided, "Hey, I should write that chat system". So I did just that. It stunk, but I learned quite a few things. RattleSnake is an example of the things I learned.
RattleSnake
I wanted a flexible system that would take anything I gave it, and produce what I wanted. That sounds really stupid sounding, but bear with me. I wanted to be able to serialize structures, or send custom coded byte arrays without having to change my methods of sending. RattleSnake can do just that.
RattleSnake
This started as a pet project and has evolved into something massive. RattleSnake can handle just about whatever you actually want, from Client-Server connections, to even handling UPnP.
RattleSnake has 4 major namespaces:
RattleSnake.Client
RattleSnake.Client.Client
RattleSnake.Client.TcpClientEx
RattleSnake.Server
RattleSnake.Server.Server
RattleSnake.Server.TcpListenerEx
RattleSnake.Security
RattleSnake.Security.WhirlpoolManaged
RattleSnake.Security.MersenneTwister
WhirlpoolManaged
RattleSnake.Security.Encryption
RattleSnake.UPnP
It's quite clear what each namespace actually contains and what it does.
I had to do a few cases of Inheritance, such as inheriting the TcpClient & TcpListener to provide future functionality (the MyBase.Active() property for example) as I update this project. For now, though, RattleSnake is relatively complete minus a few new features I want to put in.
TcpClient
TcpListener
MyBase.Active()
It's extremely simple to use RattleSnake's Client, Server, UPnP, and Security features. The Client and Server are completely event driven, making it pretty simple to understand.
UPnP
Here's a quick example of using the Client:
' This is for the Client.
Dim _rsc As New RattleSnake.Client.RattleSnakeClient()
' Now perform a connection
_rsc.Connect("127.0.0.1", 6110)
That is all you need to do to perform a connection. But, how do we keep track of when the client connects? What about receiving data, or a disconnection, or even an exception? The RattleSnakeClient class has events to handle all of that:
RattleSnakeClient
Public Event ConnectionEstablished(ByVal sender As Object, _
ByVal e As EventArgs.RattleSnakeClientConnectionEstablishedEventArgs)
This event will fire when a connection is established. The EventArgs passed contains the following properties:
EventArgs
IP
String
Port
Port
Public Event DataReceived(ByVal sender As Object, _
ByVal e As EventArgs.RattleSnakeClientDataReceivedEventArgs)
This event will fire when Data comes through the connection. The EventArgs passed contains the following properties:
Data
Object
New Object
Public Event Exception(ByVal sender As Object, _
ByVal e As EventArgs.RattleSnakeClientExceptionEventArgs)
This event will fire when the RattleSnakeClient throws an Exception. The EventArgs passed contains the following properties:
Exception
These events are easy, straightforward, and keep RattleSnake running smoothly.Sending data is also extremely simple with RattleSnake:
'Define some random data in a Byte Array; filled with junk data or what not.
Dim _data As new Byte(255)
'Now send it with RattleSnake
_rsc.BeginSend(_data)
It is that easy to send data with RattleSnake. It is also possible to simply pass the .BeginSend() method with an Object that is Serializable and have it be sent as well; RattleSnake makes use of that internally.
.BeginSend()
Disconnection is a breeze as well:
'Disconnect.
_rsc.Disconnect(True)
In RattleSnake, unless it's really important, .Disconnect() will always take a True. The True tells RattleSnake to notify the other side that a disconnection is happening. I do this just to make sure that there are no Exceptions raised on the other end that could otherwise be avoided.
.Disconnect()
True
True
Now, a quick overview on the UPnP class in RattleSnake. The UPnP class allows for the quick and easy addition (or removal) of port mappings on UPnP enabled devices. This is a list of the methods, properties, and enumerations of the UPnP class:
UPnP
Add()
Remove()
Exists()
LocalIP()
Print()
Dispose()
Each method has XML style comments, so I won't go into much details here, but it's pretty easy to add a port mapping to a UPnP enabled device:
Using rs = New RattleSnake.UPnP.UPnP
rs.Add(RattleSnake.UPnP.UPnP.LocalIP(), 100,
RattleSnake.UPnP.UPnP.Protocol.TCP, "Description")
End Using
That is all it takes to add a port mapping to a UPnP enabled device. The code adds a mapping to the local IP address, on port 100, with the TCP protocol and a description of "Description". Removing is pretty simple as well:
Description
Using rs = New RattleSnake.UPnP.UPnP
rs.Remove(100, RattleSnake.UPnP.UPnP.Protocol.TCP)
End Using
The port that was just added earlier has now been removed. The Add() and Remove() routines internally call Exists() so, as a programmer, it's not required to do it as well (However, the class will throw an ArgumentException()).
Add()
ArgumentException()
RattleSnake, as a whole, should not be riddled with bugs. It has gone through multiple field tests without many errors at all, but if any bugs should pop up, I will try my best to fix them as quickly as possible.
I should note that RattleSnake has seen its fair share of rewrites. As of 12/5/2011, this is the third rewrite of RattleSnake to provide cleaner and more efficient code. UPnP is a recent addition to RattleSnake and one that took me a bit of research to figure out how to easily do in Windows. I use the term 'easily' rather loosely because it's relatively simple but takes a bit of figuring out to make it work (such as it only works in I believe .NET 3.5 and above as the required Interface isn't exposed in .NET 2.0).
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
formlesstree4 wrote:I will definitely expand this article in the future when I have more time to do so.
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
http://www.codeproject.com/Articles/294357/Simple-Network-Programming
|
CC-MAIN-2014-52
|
refinedweb
| 1,096
| 55.64
|
Hello! Welcome to this tutorial series. First of all, sorry for the delay in publishing this tutorial. I was quite busy for the last week and couldn't do it. Fortunately, I'm back this week to continue where we left.
This tutorial will build upon the previous episode. Remember you were able to create the home, item and categories pages using Livewire components in the last episode. You learnt how to display all posts in the homepage and show posts from a particular category in the categories page. You also learnt how to reuse Livewire components at multiple places by using the post item component in both the home and category pages.
In this episode, you'll turn your focus to displaying the details of individual posts. When you click a post from either the home page or the category page, the details page shows the details of the post.
At the end of this episode, you should be able to:
- run select queries for a single row from the database using Eloquent.
- use Tailwind CSS to create a responsive layout for a post.
- create a mobile-first top navigation bar and nav menu for any website using Tailwind CSS.
- use Alpine.js to make the navigation menu mobile-friendly.
OK, let's start our journey.:)
Creating the Detail Component
When a user clicks a post in either the home page or categories page, the person should be redirected to the Detail page. This is where they'll be able to read the post.
Technically speaking, the link to the detail page will pass the post's slug along and this will be captured by the Laravel Router and then passed to the Detail Component. This is what you'll use to retrieve the post from the database.
Enter the command to create the Detail component:
php artisan make:livewire Detail
Now open the Detail component from app/Http/Livewire. Make sure it contains this code:
<?php namespace App\Http\Livewire; use App\Models\Post; use Livewire\Component; class Detail extends Component { public $post; public function mount($slug) { $this->post = Post::firstWhere('slug', $slug); } public function render() { return view('livewire.detail') ->layout("layouts/guest"); } }
First of all, you're using the
Post model. You used the
firstWhere method to get the post by its slug. This ensures only the first post matching the slug is returned(you're sure the post is what you asked for because each post has a unique slug).
If you can remember, in the last episode I made mention that Livewire automatically makes
public properties in a component available in the view. Therefore, the
$post member variable is readily available in
detail.blade.php.
We also said that the
mount method is called once the component is mounted. Therefore, it is the best place to initialize properties, run database queries and carry out other initialization in the component. When you bind a route with parameters to a Livewire component, the
mount method can also be used to capture the argument(s) from the route and make them available to the component.
This is exactly what you've used the
Detail component's
mount method for - to capture the
$slug parameter passed to the route.
Since the
$post variable is available in the detail view, we now have to edit the resources/views/livewire/detail.blade.php view file to display the post.
Open the view file and enter this code into it:
<div class="mx-auto md:w-4/5 lg:w-3/5"> <h2 class="mt-2 text-xl font-bold lg:text-2xl"> {{ $post->title }} </h2> <div class="flex flex-row my-3"> <div class="mr-2 text-gray-700"> {{ $post->user->name }} </div> <div class="w-2 h-2 my-auto mr-1 text-xl bg-gray-300 rounded-full"></div> <div class="my-auto mr-2 text-sm text-gray-500" title="Category"> {{ ucwords($post->category) }} </div> <div class="w-2 h-2 my-auto mr-1 text-xl bg-gray-300 rounded-full"></div> <div class="my-auto text-sm text-gray-500"> {{ $post->published_date }} </div> </div> <img src="{{ asset("storage/posts/$post->featured_image") }}" alt="{{ $post->title }}" class="w-full my-4 rounded-sm max-h-96"> <div> {!! $post->body !!} </div> </div>
This is what each class utility means from the view:
mx-auto: centers the element it's been applied to on the horizontal axis. This is the same as applying
autoto both
margin-leftand
margin-right.
my-autowill center it in vertical direction while
m-autodoes same on both axis.
w-{number}applies
width: {number}to the element and
h-{number}also applies
height: {number}.
- The
sm:,
md:,
lg:prefixes apply responsive variants of the utility classes. So
md:w-4/5makes this element occupy 4/5th of the screen size in medium-sized devices.
m{side}-{number}is used to set margin of size
{number}to
{side}. The value for
{side}can be
tfor top,
bfor bottom,
rfor right,
lfor left,
xfor horizontal,
yfor vertical or nothing at all to represent all sides.
text-xland
text-2xlmakes the text extra-large and extra-extra-large(2x extra-large). Other text size utilities include
text-xs,
text-sm,
text-base,
text-lg,
text-3xlup to
text-9xl.
- I discussed
flexand
flex-rowin the previous episode. As a reminder, these arrange children of the element in a flex row.
- All other utilities have been discussed before in the previous episodes.
Routing to the Detail Page
Now that the detail page is ready, all you have to do is change the action for the
post-detail route. Open the routes/web.php routes file and change the
post-detail named route from this:
Route::get('{slug}', function ($slug) { return view('welcome'); })->name('post-detail');
to the following:
Route::get('{slug}', Detail::class)->name('post-detail');
Save all the files and start both your database server and the built-in PHP server. The latter can be started with this command if you've forgotten:
php artisan serve
Now you should be able to see something like this if you click any post from the home page:
Creating a Navigation Bar for the Tall Blog
Though our blog is able to display pages as expected, wouldn't it be nice if you could navigate to the categories page and back to the home page without using the browser's back button? Or, perhaps, from the detail page to either categories or home pages? This would not only improve the user experience of the blog, it would also make it consistent with other websites on the internet.
Consequently, you're going to create navigation component for the navbar. However, this is not going to be a Livewire component: it's going to be a Laravel component. It's going to be a Laravel component because that's more suitable for such cases than a Livewire component.
Create an anonymous
nav component in the resources/views/components directory. Name it nav.blade.php and put this code into it:
<nav x- <div class="mr-6 text-xl font-bold"> <a href="{{ route('home') }}" class="grid grid-cols-3 gap-1 transition duration-500 hover:text-purple-500"> <x-jet-application-logo <div class="col-span-2">Tall Blog</div> </a> </div> <button x-on: <svg class="w-6 h-6 fill-current" xmlns="" viewBox="0 0 24 24"> <path x- <path x- </svg> </button> <div class="flex-grow w-full transition-all duration-500 ease-in lg:flex lg:items-center lg:w-auto" : <ul class="items-center justify-end flex-1 pt-4 space-y-4 lg:pt-0 list-reset lg:flex lg:space-y-0"> <li class="py-2 md:py-0"> <a href="{{ route('home') }}" class="mx-4 text-lg hover:text-indigo-500">Home</a> </li> <li class="py-2 md:py-0"> <a href="{{ route('home') }}" class="mx-4 text-lg hover:text-indigo-500"> Login </a> </li> </ul> </div> </div> </nav>
This code is pretty large. But don't worry, apart from a few snippets you've encountered most of the others before.
From the code:
- The first attribute in the
navelement is an Alpine.js attribute. What it does is that it defines a variable called
isOpenwith an initial boolean value of
false. This is used to toggle the navigation menu on mobile devices.
- The
@keydown.escape="isOpen = false"is also an Alpine.js snippet that sets the
isOpento false when the Escape key is pressed while the nav menu is open on mobile. This will close the menu.
Next is the
classattribute. Again, this makes use of Tailwind CSS utilities a lot. Explanation each utility is as follows:
z-10sets the
z-indexCSS property. Accepted values are within [
z-0,
z-10,
z-20,
z-30,
z-40,
z-50and
z-auto].
flex-wrapis the Tailwind way of applying
flex-wrap: wrapto a flex element.
- all the other utilities have been looked at already.
The next
divelement serves as a container for the logo and site title. The
font-boldutility you applied to it here makes the title font bold. Here are the others:
- We decided to display the logo and site title in a grid of three columns with a gap between them(indicated by
grid grid-cols-3 gap-1).
- Also, the
transition duration-500 hover:text-purple-500adds a purple color transition of length 500ms to the title text on hover.
- The
application-logoJetstream component has been reused here and is almost similar to the way you used it in the second episode. The only difference now is that you have added a blue border(indicated by
border border-blue-300) to it.
- The site title is the last element in this container. It takes two of the three grid columns, as indicated by the
col-span-2utility class.
Our next element is the button that displays and hides the menu on mobile devices:
- You applied the
x-on:clickAlpine.js handler on it. This fires the
onClickevent, giving you the chance to toggle the
isOpenvariable (
isOpen = !isOpen) to its opposite value(from true to false or vice versa).
- By specifying
lg:hiddenyou're hiding this element on large screen devices.
- The next encounter is the
:classAlpine.js attribute. This appends the values you define within it to the element's
classHTML attribute, allowing you to add certain classes based on JavaScript variables. You've made use of this by adding a 180-degrees transform and transition to this button when
isOpenis true.
- The SVG element is made up of two path objects - a close sign and a hamburger sign representing closed and opened states of the menu, respectively. Thus, the first sign (close) is shown when
isOpenis true while the second sign (hamburger) is shown when
isOpenis false.
Finally, we come to the
divthat contains the menu. The only new things here(on the Alpine side) are the attributes
@click.away="isOpen = false"and
x-show.transition="true". The
@click.awayimplies clicking away from this
divcloses the menu(it sets
isOpento false).
x-show.transition="true"adds transition to the element when it's showing.
Now add the
nav component to resources/views/layouts/guest.blade.php layout file:
<x-nav/>
This should come just after the opening
body tag. Save all files and reload your webpages to see the navigation bar:
This brings us to the end of this episode. In our next episode, we'll create and set up the pages making up the dashboard for the blog.
Discussion (0)
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/nayi10/creating-your-first-blog-with-tall-part-six-2dgk
|
CC-MAIN-2021-25
|
refinedweb
| 1,932
| 63.29
|
- 03 Mar, 2018 2 commits
By default pgrep/pkill should not kill processes in a namespace it is not part of. If this is allowed, it allows callers to break namespaces they did not expect to affect, requiring rewrite of all callers to fix. So by default, we should work in the current namespace. If --ns 0 is specified, they we look at all namespaces, and if any other pid is specified we continue to look in only that namespace. Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com> References: !41Debabrata Banerjee authored
With a little luck, this should be the final tweak for our support of extra wide characters. Currently, those characters don't always display the '+' indicator when they've been truncated. Now, it should always be seen. [ plus it's done a tad more efficiently via snprintf ] Signed-off-by: Jim Warner <james.warner@comcast.net>
- 02 Mar, 2018 4 commits
The previous commit had one minor bug in it because the fields need to be alphabetical and times comes after timeout. Added NEWS item for this feature Added another testsuite check for new flags in case they disappear or go strange one day. References: commit 8a94ed61
These format specifiers are to time & cputime what etimes is to etime. Signed-off-by: Sébastien Bigaret <sebastien.bigaret@telecom-bretagne.eu> References: !43Sébastien Bigaret authored
-
I frequency use pidof command with strace system call tracer. strace can trace MULTIPLE processes specified with "-p $PID" arguments like: strace -p 1 -p 1030 -p 3043 Sometimes I want to do as following strace -p $(pidof httpd) However, above command line doesn't work because -p option is needed for specifying a pid. pidof uses a whitespace as a separator. For passing the output to strace, the separator should be replaced with ' -p '. This maybe not a special to my use case. This commit introduces -S option that allows a user to specify a separator the one wants. $ ./pidof bash ./pidof bash 24624 18790 12786 11898 11546 10766 7654 5095 $ ./pidof -S ',' bash ./pidof -S ',' bash 24624,18790,12786,11898,11546,10766,7654,5095 $ ./pidof -S '-p ' bash ./pidof -S '-p ' bash 24624-p 18790-p 12786-p 11898-p 11546-p 10766-p 7654-p 5095 $ ./pidof -S ' -p ' bash ./pidof -S ' -p ' bash 24624 -p 18790 -p 12786 -p 11898 -p 11546 -p 10766 -p 7654 -p 5095 $ strace -p $(./pidof -S ' -p ' bash) strace -p $(./pidof -S ' -p ' bash) strace: Process 24624 attached strace: Process 18790 attached strace: Process 12786 attached ... Signed-off-by: Masatake YAMATO <yamato@redhat.com>Masatake YAMATO authored
- 01 Mar, 2018 5 commits
Missed removing the extern from the header file
The procio functions that were in the library have been moved into sysctl. sysctl is not linked to libprocps in newlib and none of the other procps binaries would need to read/write large data to the procfs. References: be6b048a
thereby use one allocated buffer for I/O which now might be increased by the stdio function getline(3) on the file if required. Signed-off-by: Werner Fink <werner@suse.de>
to be able to read and write large buffers below /proc. The buffers and file offsets are handled dynamically on the required buffer size at read, that is lseek(2) is used to determine this size. Large buffers at write are split at a delimeter into pieces and also lseek(2) is used to write each of them. Signed-off-by: Werner Fink <werner@suse.de>
by using getline(3) to use a dynamically increased buffer if required by the input found in sysctl configuration files. Signed-off-by: Werner Fink <werner@suse.de>
- 19 Feb, 2018 10 commits
The w flag is not needed for key=val type options but only forces all options to be that format. References: #83
In addition to exploiting the login user ID provision, the following miscellaneous changes are also included: . unnecessary braces have been eliminated from an 'if' . a comment with case EU_CPU: was corrected to 's_int' and the associated block of code relocated accordingly . case EU_CPN: wasn't shared with other enumerators so reference to 'i' was changed to that actual enumerator . case EU_SGN: wasn't shared with other enumerators so reference to 'i' was changed to that actual enumerator Signed-off-by: Jim Warner <james.warner@comcast.net>
This patch represents a newlib adaptation of the merge request offered by Jan Rybar that is referenced below. Reference(s): !57 Signed-off-by: Jim Warner <james.warner@comcast.net>
This patch represents the newlib implementation of Jan Rybar's merge request referenced below. It essentially moves that code out of the ps program and into our new library where it's available via the <pids> interface. Reference(s): !57 Signed-off-by: Jim Warner <james.warner@comcast.net>
-
-
As it turns out, that Ukrainian 'demo' text supporting the '=' command was 152 bytes long, up from an English version of 80 bytes. Unfortunately, the buffer used to format all such strings was insufficient at 128 bytes. Depending on the width of one's terminal, some strange result could be experienced when a multi-byte sequence was truncated. So, this just makes that buffer bigger. Signed-off-by: Jim Warner <james.warner@comcast.net>
After wrestling with extra wide characters, supporting languages like zh_CN, sometimes default/minimum column widths might force a truncation of translated headers. So, this commit explores one way that such truncations could be avoided. It is designed so as to have minimal impact on existing code, ultimately affecting just one function. But it's off by default via its own #define. Signed-off-by: Jim Warner <james.warner@comcast.net>
When I recently added extra wide character support for locales like zh_CN, I didn't worry about some overhead associated with the new calls to 'mbtowc' & 'wcwidth'. That's because such overhead was usually incurred with user interactions, not a normal iterative top display. There was, however, one area where this overhead would impact the normal iterative top mode - that's with the Summary display. So I peeked at the glibc source code. As it turns out, the costs of executing those 'mbtowc' and 'wcwidth' functions were not at all insignificant. So, this patch will avoid them in the vast majority of instances, while still enabling extra wide characters. Signed-off-by: Jim Warner <james.warner@comcast.net>
There is (should be) no justification for changing the width of the percentage columns (%CPU, %MEM) depending on the BOOST_PERCNT #define. So this patch will ensure that both columns are fixed at their former maximum 5. Signed-off-by: Jim Warner <james.warner@comcast.net>
- 12 Feb, 2018 4 commits
-
With the documentation update in the commit referenced below, we should also account for such threads as they will already be represented in the task/thread totals. [ and do it in a way that might avoid future changes ] Reference(s): commit 91df65b9 Signed-off-by: Jim Warner <james.warner@comcast.net>
Back when top was refactored to support UTF-8 encoding it was acknowledged that languages like zh_CN were not supported. That was because a single 'character' might require more than a single 'column' when it's printed. Well I've now figured out how to accommodate languages like that. My adaptation is represented in this patch. [ and just in case someone wishes to avoid the extra ] [ runtime costs, a #define OFF_XTRAWIDE is included. ] Along the way, I've cleaned up some miscellaneous code supporting the 'Inspect' feature so that the rightmost screen column was always used rather than being blank. [ interestingly, my xterm & urxvt terminal emulators ] [ are able to split extra wide characters then print ] [ 1/2 of such graphics in the last column. the gnome ] [ terminal emulator does not duplicate such behavior ] [ but prints 1 extra character in same width window. ] Reference(s): . Sep, 2017 - original utf8 support commit 9773c56a Signed-off-by: Jim Warner <james.warner@comcast.net>
When the new approach for startup defaults was adopted in the reference below, a file might be left open that technically should be closed. This situation arises in the unlikely event the #define RCFILE_NOERR is active. Without that #define, the program will exit early thus rendering the open file issue moot. However, even with that #define there was no real harm with an open file. It simply meant a 2nd FILE struct would have been used when, or if, the rcfile was written via a 'W' command. Anyway, this patch ensures such a file will be closed. Reference(s): . Dec, 2017 - /etc/topdefaultrc introduced commit 55a42ae0 Signed-off-by: Jim Warner <james.warner@comcast.net>
- 13 Jan, 2018 4 commits
The previous two patches updated free, but needed a tweak and the tests also needed to be updated. I've hand-calculated the results using bc and both the testsuite and bc results equal what free prints out. References: commit 9365be76 #45
-
-
Linux 4.2 provided a new process state of I which is used for an idle kernel thread. This new state means that kernel threads do not contribute to the loadavg as they are no longer state D or S but I. While both ps and top displayed this state, it wasn't documented in either manual page until now. References:
- 07 Jan, 2018 1 commit
-
- 29 Dec, 2017 3 commits
-
- 23 Dec, 2017 6 commits
References: !51
-
Since the value of number_of_signals is known at compile time, we can use a compile-time check instead. This also adds SIGLOST for the Hurd, uses the correct signal counts for the Hurd and FreeBSD, and only gives a compile-time warning when compiled on an unknown platform that it does not know whether the number of signals is correct. Author: James Clarke <jrtc27@jrtc27.com> References: commit bd72ba3a (jrtc27/procps-cross-platform) procps-ng/procps~!52
Those references below offer more detail regarding the default startup changes beginning with version 3.3.10. It is important to remember that all such changes were supposed to impact only new users or users who had not saved the personal config file (via that 'W' command). However, I introduced a bug wherein the rcfile was not fully honored. This gave the changes a bad reputation. That bug was corrected in release 3.3.11 but the issue of default startup options keeps resurfacing. And it's clear there's no consensus on what should be included. Our --disable-modern-top configure option is of little help since it remains an all-or-nothing approach. What we need is an answer offering unlimited customization. So, this commit will provide distribution packagers or system administrators with a much more flexible way to set their own preferred startup default configuration. A new rcfile is being introduced: '/etc/topdefaultrc', whose format/content is the same as a personal rcfile. Thus once a 'proper' enterprise configuration has been established and saved via 'W', it can be copied to the /etc/ directory. Thereafter, startup in the absence of a saved rcfile will use that configuration as default. Now if a distribution packager or system administrator wishes to expose their users to some of top's advanced capabilities they can do so gradually. Perhaps setting up graph mode for summary area task and memory display while retaining the %CPU sort could be tried. Or maybe showing colors, but better customized for a particular terminal emulator. Such possibilities are now endless. [ in exploiting this new capability, i hope that the ] [ other windows (alt display mode) aren't overlooked ] Reference(s): . Sep, 2014 - Not fully honoring rcfile bug discussed . Oct, 2014 - Attempt to defend new startup defaults . Jul, 2015 - Forest vs. %CPU views discussion #6 . Oct, 2017 - Question the use of --disable-modern-top . Oct, 2017 - Forest vs. %CPU views discussion again . Dec, 2017 - Rehash of 3.3.10 startup defaults change #78 Signed-off-by: Jim Warner <james.warner@comcast.net>
With the library having now normalized errno handling, perhaps it is time at least one program took advantage of it. So, instead of printing just a message with the programs's line number, top will now also provide that associated errno string text, compliments of strerror. [ with those newlib functions returning NULL, we can ] [ use errno directly in strerror. for the ones which ] [ yield an int, all we need do is invert such return ] [ values before passing it to the strerror function. ] Reference(s): Signed-off-by: Jim Warner <james.warner@comcast.net>
[ ok, there's also 1 newly added #undef included too ] Signed-off-by: Jim Warner <james.warner@comcast.net>
- 22 Dec, 2017 1 commit
|
https://gitlab.com/procps-ng/procps/commits/newlib
|
CC-MAIN-2018-13
|
refinedweb
| 2,104
| 56.76
|
Make Objects Editable (Streamlined)?
Hi,
I understand that there is a working script from Donovan Keith in this thread.
In his script, he uses
GetClone. I'm guessing to have another copy of the object.
I'm trying to rewrite the script without using the
GetClonemethod.
Is this possible?
Here is my script so far:
import c4d from c4d import utils res = c4d.utils.SendModelingCommand( command = c4d.MCOMMAND_MAKEEDITABLE, list = op, mode = c4d.MODELINGCOMMANDMODE_ALL, doc = doc ) c4d.EventAdd()
With this script, it gives me an error of
TypeError: GeListNode_mp_subscript expected Description identifier, not long
Did a google search but it doesn't give me any relevant hits.
Is there a way around this?
Thank you for looking at my problem
- m_magalhaes last edited by m_magalhaes
hello,()
Cheers
Manuel
Thanks Manuel! Works as expected. Didn't expect that you had to add brackets. That was news to me.
Thanks again!
P.S. You also need to add brackets on your example.
Have a great day ahead!
- m_magalhaes last edited by
i don't know what you are talking about
- m_magalhaes last edited by m_adam
Just to add some side notes :
SendModelingCommand is waiting for a list of objects in case you want to execute that command on several objects.
In your case, you only got one element in your list.
You can have more informations about list here
|
https://plugincafe.maxon.net/topic/11477/make-objects-editable-streamlined
|
CC-MAIN-2020-10
|
refinedweb
| 226
| 69.58
|
Hi,
I am solving already 3 hours this weird problem:
class Func
def self.md5(string)
Digest::MD5.hexdigest(string)
end
def self.salt(length=10)
chars = ‘abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789’
salt = ‘’
length.times { salt << chars[rand(chars.size)] }
salt
end
end
In controller:
password = Func.md5(params[:registrace][:heslo])
passsalt = Func.salt(10)
puts password //here is it ok puts passsalt //here is it ok @saveit = Table.new(:pass_salt => passsalt, // problem -- to dabase
is stored NULL
:passw => password + passsalt)
//but here is is ok, passalt contains right string
The column in database ‘Table’ for salt called ‘pass_salt’. This column
have type ‘varchar(10)’. The lenght of salt is 10 chars.
I don’t know where could be fault, but into the column ‘passw’ is
everything stored great, but to the column ‘pass_salt’ the string
contains salt does not stored…
I will glad for any help, I have no idea, where could be a problem…
Thanks a lot,
Manny
|
https://www.ruby-forum.com/t/the-salt-of-password-cant-save-to-mysql/207793
|
CC-MAIN-2021-49
|
refinedweb
| 156
| 76.01
|
15, 1958 Subjects Spatial Coverage: United States -- Florida -- Dade -- Miami Coordinates: 25.787676 x -80.224145 ( Place of Publication ) Record Information Bibliographic ID: UF00028321 Volume ID: VID00589 Source Institution: University of Florida Holding Location: University of Florida Rights Management: All rights reserved by the source institution and holding location. Resource Identifier: oclc - 2264129isbn - 0739-0319 Full Text _. . ' ' Lambert., Sylvia and lis. Edwards. Gladys ,and this. .to day that. from zeal with ,Guide and Journal,, Norfolk the of three Hadley.of Howard child oldest Mrs.the and is Dr.ley 1 George and Wanza James. .,J4111er.1f.Clark 1 t I within regeneration.activity; radio during the each trace F2 Smith Doris Shannon! Marion Wil Pauline and, Williams Louis Jones .Jones.Katt1e, Vernay mission crusading: its pursued of president Young W. Thomas, young high Francis ,Barnett Gwendolyn : to counter geiger a and iodine , ,McKellar Dorothy Williams Wilcox Hazel, PuUins Laura -Johnson. Bernice Edwards Hannah has States United the in Press. program. the out round Had- school Mrs. 'are teachers science The I I active radio locate to Evelyn) Dean. Marion Colson Ponte Ruth McPfaee' Glenda, Miller., Marguerite Thomas genia Negro The' slavery. of -committee relations public. sociation's, -Washington T. Booker at. senior macbe j -attempting was she ,Lastly regeneration. Willie ,Cherry Johnnie ,Fortson ,Johnson Ethel Foster Inez Blue Eu- Llghtsey Francis Mesdames theinstitution against crusade. to was as- the of chairman and rockets.A made papier' in dinosaur prehistoric of process the on influence! any sponsors :are sponsors! The are group this for Sponsors -mission Its 1827. 17 March on City -Defender Louisville the of publisher home- for first Countyfe' Dade be. see amdno-icids Rosa Sorors :are The Willye. Sorors I case Hadley The a of replica: ( a made Davis Mary 1 have) they if to 'pursue novels. reading and dancing York New in Journal Freedom's' Stanley,L. Frante by statement to reported Is has she pediatrics. of field the Church. Orthodox African: And matter. of theory molecular the with working been enter to hopes sewing are hobbies> Her founded who Russwurm B. John a and Jr King Luther Martin repair. for necessary from, regeneration. in and Sept. in college' Spanish club the of analysis an did Escix mie this Aside FTA and Club by message minute five ! physical i 2: alter named were s awards The Rev. the be would Job skin-grafting: . mortician.a or therapist determine to aria She Teensy and Club Press teens Ma-! bought. or begged found factor time the .. studies' sodal the of member singing Fitzgerald programs. radio these on A Wind. -111' was it where treatment Association Athletic Youth Allied' become to is ambition Juanita's an charming 1 declareda pipeshe of sections discarded using 1 Plan- of cuttings hundred over active is miss This Indigo singing . -announced be will founded is nation Ella and Mood examination an Counselors Girl :organizations Locka. Opa High Washington .. medical and engine jet a constructed Sands made has Sarah "pjanaria.:] of School Horne Lena features these of One - following the in !membership\ holds' In 'High Dade North at grader BookerT.at sophomore a Is She whiChour on Ideals. democratic the stations.. radio local over for Kendall at Hospital County Ponald): Florida.' of map, a on\ _Powers, Recisperative Remarkable and 'Club' French the of president, 10th liked and known. wen A realizationof greater a to ;I -broadcasting for transcribed been have Dade the to taken was Hadley them locate to tried and Florida The'' project her with Williams is She Jazz. modern of lover :. contest. Cinderella" .Uss!" the for contest. -contributions significant persons for I programs raeuo IS-minute Two blocks two of distance in found snakes 40 of drawings ;Sarah) was t student winning The' ' anda dancer excellent an is Jewyll contestant a is Johnson Miss Cinderella Miss annual Sorority -organizations and to Association, I carrieda that air the into missile made Lamb David evolved. -I high,. BTW of Cinderella. Miss for contestant 4; Locka. Opa Beta Phi Zeta of chacter: Zeta the by annually given Awards "Freedom. to Way the a put successfully had Hadley man how out finding in interested I, instructor science Dunccmbe>I Eugene Booker(, group Russwurm ten the of Winners Lighting::Press Negro The is vance Dorsey of }botl a is High& Washington T. ;: NW 16125 of Johnson Tau Beta of IV for hand. was She "Speaking. and High Junior 22nd&: announcer. Ct. the of member a a Hardy Mrs.! and the is ier!obser- year's' this of theme The Mingo's Loretta eluded coordinator materials Hepburn at class senior Mrs. and Mr. of daughter I -contestant is Harreil left} his injuring' exploded "Anthropologically , OscarT. Pittsburgh I I Cour- publisher today. Johnson Rose Jewyll Lovely Jiunlta\ Charming Mr. of daughter Harrell Doris the of 1 cellconstructedrocket the when lives >*.tn projects noteworthy Other George ;instructor science Spicer Johnson Carter Beverly of City. York New place taking change social ' '. :organisms various in hearts of Emma Mrs. ;schools County Dade --- .. .... , ill . pero'" ve ex a near ROSE JrwvLL I ecuti noel and -drama great the in Press Negro the JOHNSON rY HOWARD JOHNSON JUANITA = K JR. HADLEY study' comparative a for animals of science of supervisor Allister I .. I Dodgers, Brooklyn' the of ol: role. the 01 discussions to -. -- ._ ---- by March last .. .. from hearts of collection srrtall Mc- Birdie Mrs. 7 I.I.I' formerly;Robinson Jackie and group sermons their! devoting are ministers were projects( and. -': a of presentation his for Sands Judged rr--: , newspapei: the of president the churches: many In arranged. Charles to went prize Third I Experiments institution. the at A : ,Walker O. William by statements being is events of variety A aloe. the I-display on now Fair Science Annual i i : .'!!... ..addition in be will There, "Road.I 22. to 16 March frcra :,4Y, ,plant grown locally l a from Second the t p c presentation large "Lonesome singing Jr Newspaper Negro observing . Davis Ii ;-11i..I; ,Sammj. i Week -cosmetics and laxatives as such its through recognition much and Somebody- I \ Help by nation the across -all event I medicines made who Williams Evelina receiving is department : II I .- I ;.tc Want "I singing Edetine Billy historic, this : was second s close a Running High'sccience' Senior Northwestern y. '. "' features program other The .: iscommemorating 17 March 'on old years 131 ; : ........... ; :_- .L... , F h': announcer. the is Negro ;- -' Pk - '" be will which Press :- 1 v '" F.'s' If{ 3.3.i 7 ObservedThe Be To hSpL Week Newspaper Negro J 4 r ,- h l lvL '1' ,. .i. > Sheriff County; Manatee manded Miami.} Gibson R. Theodore , ; r repri severely governor . ;, Father and Miami, Perry RuthW.Mrs ;Tampa Harvey Perry I organization.The: of , either meetings . l .;Tampa Gray Johnnie ;Miami peaceful; with interfere to , . Berckman R. A. Mrs. and Mr. idM. -officers enforcement law expect I , ... not ; ; --- Cin- "Miss annual their branch Fla Tallahassee the of did he plain it made Collins - , derella*' end will and 3 23% February -presenting again are :Inc Sorority Beta Members certificateswere and merit Officers of The Winners he where from street the across -Cingan Miss be will Who 5. April be- contest The contest derella" Phi Zeta the of members> masked. and nightriders.; lot vacant a in try !missile second I :week last Greensboro in ner his experiencing, was enthusiast I bycrossburnings characterized violence din- awards Freedom held missile rocket a Hadley Young I R74i Miss Be WillThe Who backgroundof loan's the of cause recently ? Cinderella' C be- KKK the and NAACP NAACP the at in contributions 1957 during activities standing a in home his explosion.near at rocket betweenthe distinctions: certain drew out- for awards won Floridians -afternoon Sunday injured was Heights )4)C page on continued: ( was ave.. 5th NW 1912 of man old tlons..1ra. but state the of extremists White I Several .N.C. ,Greensboro ,Richmond, ,St more Y 14800. of 20-year-. a WILLIAMS JAMES demon- such prevent to joops the placate to doubt no NAACP 16 Jr Hadley )Boo( Howard make to expect) and t assailant> the . the t Included hearing. .the out call or powers emergency also Collins i on lead a have police ever'*'Ho . -preliminary inquest coroner's HAND INJURES made. been had arrest no and broad his use to hesitate not rill. violence. -combined a pending being now 4s held ,, , up and case , -afternoon Thursday )to necessary and riots incite to investigatingthe still are Police man. is and murder degree flirt with !he said Collins -U designed ly REGIONALMEET E. v EXPLODES 4 4x wo a and man a with : charged later was Thompson' I clear- are that Klan Klux Ku the killing. the escort. police a with by demonstrations public [ ROCKET -altercation an in involved 1< was Hunt said I other E ATS.AWARDS Police: night. Saturday o'clock' 9 with, connection: in investigation, ,, t night Saturday Bradenton f if and parades prevent to sheriffs| home his at times several for ave. 5th NW 535 of 29 district: Negro the through parade; Florida ordered Thursday ! about / Young Collins MIAMIANS 4 Miami wounded and. shot was st 12th -Thompson James William arrested: !.KKK. the letting for Baden Roy LeRoy Gov. Tallahassee II WIN ENTHUSIAST MISSILE. YOUNG)Promise Show Scientists/ I Police nigh Friday last 11:20 NW 112 ef' 67. HUNT fair.HENRY ., about at. 14th NW 404 ar Mattie's was condition his where at altercation an in ,chest. the )4)I page on continued( I Miami Metropolitan the reported Jackson. to taken stabbedin fatally was st 20th NW is It Church. Baptist Villa : Hospital Memorial , and arrested. hip.was the in Williams.Williams 409 of 34 SMITH HERMAN:were Parades KKK Outlaws Collins Gov. was presi-variance Hawthorne the to David any Opposition by led I I. ,.buildings Orchard White three.the housed containing formerly area ;. striking l bullet the once fired incidents violent ol string the in :there obstacles Park Floral the in lots six The encounter expected not is It tion. Butler officer. the at gun his! led assailants and victims Among to - but level-,stop and to turned Williams man for fleeing times Ial I Monday. to up night_ Friday evening.last PAGES SIXTEEN 1958 ,15 MARCH .SATURDAY ,FLORDA ,MIAMI 29 NO. YEAR 35th i;lo"thItyac for week goes next petition Commission The' \ and premise 57th between, building ave streets.15th ---GaUr NW tise - sever- yelled) Butler hand. in gun: since shootings 5 and stabbing: -cA ; "' expanai Jar sn and of .. = permanentroam a permit to variance a for! night Av Second along running was I fatal 2 least t at were There Ellis hi Mutamar Nos et Mutantar Tempera ; give quately Tuesday Beard Planning Miami! - a police B department. the . Bar Avenue Second In and : '**ad will fije\fCJties*$ ::; repairs and. the from approval of vote moo --before shortly man another shot had of Bureau Homicide the to lag . ,, \ Haalr *raa>nee Miami Greater night. today' past over alteration ' WOliams said Police accord' weekend the , Sat- 1157: about Butler. Eugene: area Miami the in times seven Carves; e. YMCAwut'E'* ,of CA -3S.tbar.-.; of Breach Offeer by hip right the in 'shot least at struck violence Grim the for # *Carver Wakhinftca George The _ ------ -- - Violence of '; fig/Z0: / Zoning ' I IWeekend' In Injured 5 ,2"Elled;: P 9 '"- Carver 1 I ,.. Y . . 'I' \ ;;;;:::- ; - -- - ----- - - -- -- - - --- - - - -- - - r -- -- -- THE MIAMI TIMES "The People Newspaper"SATURDAY ;' I PAGE 2 MARCH 15, 1958 -- /VQ s$ fCAtRE x ,v D ' ?. 1I 7 NE 5-3513 N.W. 22nd Ave. & 69th St. 4 g : ; FRIDAY, SATURDAY BRIDO r ABIO ANDANEXQUISriENEW ,. F JAPANESE STAR IN y 5MOMARA4IidMlosaGvQtagVfRP' ;[ > ,', : 4: :! ,, '$ twuuiM PATRICIA OWEKHIYOSHIOUEn RED 151188$ IICUDO MONTILIAN MAATBA$ iil *JAMES GARIEKOIIJCTtl MIIKO TAKAPIODUBt111 sssltanararFAUlOS60RN 1 r If suussaTWIlosast '4 "t IlllLM GOEf2 -JNUUOM[ amnm Ire'saewrrafweIKUSIrala..s.| IIM mn+, i y !, 4.'t r I : 4P Shown only at 8:45 ARMORIIV'TTAcM r I I : -------------------- Aditional honors came to , Northwestern Cagers >g. Ncrthwesterners: John Davis, Wil- Have the you seen Capture Southeast bert Pollock and James Betterson Wonderful who' were named to the All changes q ""' ....-.wSTARTS Championship Tournament Team. EVERGREEN Being made CEMETERY at ? -.-....-----.."-'. Other tournament results were: Go out there and *eeft Swift as lightning are these. Attucks 53, Blanche Ely 51; BTW will do you r heart good Northwestern Senior High bas 43, Roosevelt 40( ; Carver 67, At- . keteers who captured the South hifk"! 57; BTW 65, Attucks. 3Q. SUNDAY"SAYONARA" east Championship last March 8 ..u...____ J. during the Southeastern' Basket- , ball Tournament held at Booker r AIRCONDITIONEDCAPITOL T. Washington High of Miami. The accuracy and sfclll which Shown at 7tOO and 10:29CMOLVARCABYEONKET. they displayed while piling up scores, and their fair play with /aJINCIa 1AlITL a.110T N.NOUCII eat . all opponents have kept these 3I9 8AT. MIDNIGHTSUN. a men high on the list 00 winning ., MON., TUES. favorites schools of among high MARCH 16 17 18 various counties. 'Their dexterity came throughthe JEFF CHANDLER hard and ceaseless coaching I of Lee Perry, driving education KIM NOVAK instructor and bans manager. "Jeanne Eagles" Perry, was named the outstandingcoach e of the tournament. 'k i A t 1 SI The first coveted trophy was awarded these students last De- _If.__ cember during the :Middleton Invitational Tournament In Tampa UUNCHJ: ! after they defeated 'the Roosf- I COLOR veil High of West Palm Beach THEATRE OPA LOCKA rac.ucmN HARVEY...,, LM.ws * 48-43; Booker T. Washington uf Tel. NA 1.7322 ww '- Shown only at 9:50 Sarasota, 55-125.and; Booker T. of SUN., MON., TUES. . Miami 5048.DissatrstJ ;! with winning only "PICK UP ALLEY" the previous trophy, these: men LEE PERRY Victor Mature STARTS THURSDAYFROM went all out to captive the sec . winning coach Anita Ekberg ,ond championship trcgitqr sad Jane RussellKeenan ,I were successful while competing Pictured are Charles Hartsfleld, Wynn PREACHER'S with Dullard of Ft Lauderdale Ronald Wromas, Robert Howard, l , -48-<<; Booker T. of flQaroi 48-47: James Betterson, Austin Wise "The Fuzzy Pink SON TO # ,\ and Carver of Miaaal 48-46. Asa 'and Eugene Lowery (standing); Nightgown"SUGAR ROCK'N'ROLLKINOI ? . result of their play, Eforihwest- 'I Isaac Green, Reginald Sawyer ""- D ern along with'Carver and BTW Ernest Brinson, Wilbert Pollock, < :3 will compete in the State Tour- .Calvin Butler, Roosevelt Richard nament to be held at FU. A and .1 son and Eddie Spraggins (kneeling RAYROBINSON M University March 14-15. .) SANDS .k TOMMY Jf A % III&iII5IElCiJiiiiiBlliJIDIIIiIIIIIII'! oM vs. ! CARMENBASILIO Ull GENTLE + Richmond Heights Flashes N drol .... WORLD MIDDLEWEIGHT _ 'By ORA D. TALYOR CHAMPIONSHIP. FIGHT m IIIGJ11i1! !!!!! ___ UI' TUES, MAR25 KEEPING A TRUB LHNT-,Dr. County is 15000. This fund helps ON O'BRIEN , Flllmore says, "1f God had not over 30 Negro colleges and unl- mm planned to make Jena a contin- varsities which do not receive Big Screen TV JOHN McINTIREnwr.r. uous working! factor in our civilization state or federal aid. .+ww.lalr 6Maa1..wwqWBt there would be no good THANKS TO HEART FUND AT THE aims purpose for His having been sent WORKERS The Heart Assoc and for the great sacrifice: that He iation joins the area chairman CAPITOLTHEATRE :,) made." He came to show us "the and her captains and volunteers way, and the truth,and the life," 'who did an excellent! job on Heart and He promised, PLo I am with Sunday as follows: All Seats $3.50 tax plus :you always." He also promisedthat Mrts. Ruth Freeman, captain; He would !be -with ua as a coluntters, Mrs. V. Moon, Mrs. 4_ --- .- I teacher. Can you sacrifice some Katie Alexander, 13.$39; Mrs. I -- - thing ,for Him who gave His life Katie Alexander, $13.39, Mrs. AMBUSH that we can be assured of everlasting Lee Taylor, Mrs. M. V Moore, life? Thb is the spirit: of $25.89; Mcs.; Ethel Grant, cap- RITZTHEATRE a' true Lent secriflce fast, tail;; volunteers Miss Rasa Lee pray He who seeth In secrecy Grant, $8.59; Mrs.. Lonnie Session KTdMfiRRON shall reward thee openly captain, collection, $15.(){); LAST FEW DAYS Mrs. J. Irvin, captain, $8.71; Mrs. THE UNCF DRIVE 'Dr. W. Whitehead, $2.00; Rev. W E. "Peyton Place"Recommended Richard V.. Moore, president of Taylor $7.10; miscellaneous 'donations Adults Only PASS rTT Eethune-Cookman College heads from Hearts, 2000. To- Starring Lana Turner. the United College Fund Drive for tal collection, 10068. Florida with Atty. Henry Arlington Those who yet wish to contrib- Lloyd Nolan and SCOTT local chairman. Many fine ute to :your Heart Fund mail to Arthur Kennedy MARGIA citizens are on the board of directors Heart Association of Greater MI- Cinemascope ColorAdmlnlon DEAN BRADY. helping the drive to besuccessful. ami, rnc. 2 S. E. 13th St., Miami. If you hare not already 93eJOIN . pJiJlfJ3 3r3 *JJMMg M| EASTWOOD made your substantial The Tlersk gee Club of Miami sMsVHssVXBslBHRil sVVKBBBslOiBB CLINT rr..a..yM rM1M 01 Mwa.rei. pledge please call or send to Mrs. and Dade County sponsors a _.arawrau wwi + ' THE ... OraD. Taylor FOB 8M or call Tropical Sip on Sunday after j -_-t aaa 1e1 GE 6-4248. The drive ,uU first noon, March 16 at the home of Y. M. C. A. TODAY Dade Mr. and Mrs. week in April Our goal for Roger Williams --- .'" 'IV !O<1t1'l'' ' ra -- State Announces THE MIAMI TIMES-"The Peoples' Newspaper" SATURDAY, MARCH 15, 1958 PAGE 33 ' Around Miami "Miss NAACP ofFlorida" Contest SPECIAL EASTER DISCOUNT SALE ' By DAVE (Mr. Swing BONDUI TAMPA! Rev. A. Leon SOUTHERN CHOIR ' Lowry, president of ,the Florida State Conference of NAACP : GOWNS COMPANY ' branches, announced today that guess the Big 7 Gospel the "Miss NAACP of Florida"I 216 N.E. 2nd Ave. MiamiFR best way to Train contest will officially open on 4.2737 FR 1-8011 SundayThe start this column April 1 and will terminate on Room 212 this week Is by May 18 with the winner being saying "U something BIg 7 Gospel Train will be crowned at the "Freedom Sunday Custom made >choir gowns doesn't at the Longshoreman's Hall at Rally" where the Hon. James happen, around 816 NW 2nd ave. there will be Roosevelt will speak. ,: ! i: Highest Quality I ; ; , here soon 'I'm two performances. Time 3:00 p.m., ALL EXPENSE' TRIP I gonna hang up and 8 p.m. Sunday, March 16. I'' First /prize will be an expense Lowest Prices 1! my pen" "Us's"is The program will feature paid trip to Cleveland, Ohio, for leaving the Madam Edna Gallmon Cooke, the one week. Additional prizes will From $10.95 , city so fast you'd Singing Sons, The: Inspirational I be announced for second, third think the KKK was chasing 'em. Singers: The Spirit of Memphis and fourth prize winners. In ad. New Styles Old Styles They are leaving because there Quartette, The Five Blind Boys, dition, there will be many con Choice of Finest Fabrics just ain't any money floating and the Gospelalrs. solation awards to runner-ups in Caps Collar Stoles ',' around, and as the hustlers would Advance admission is $150 at the contest: put it, "w1 en there isn't any the dor $1.75. Tickets: are now on The awards will be made to ' All Colon and Combinations 'ten; money around, it1* time to cutout sale at North Travel Bureau, To- the lady submitting the largest ' Dickttt wilt call . snow or' no snow." backs Grove Pharmacy, Oneal I sum of, money raised during the Larry on you at no ! Beauty Salon Pratt1 Cleaners, .contest Persons wishing to take obligation _ and Neal's Super Market. The part are asked to contact their , OLD, stub from your admission ticket local branches or write to Robert A8 I AM the dance will,be placed in the drawing box W.. Saunders, field secretary, 709 ! given by the King of Clubs, the for: the grand prize, which is a East Harrison, Tampa. other night was a humdinger.Just brand new 1958 Oldsmobile Get I. about everybody who is anybody your tickets now. You don't haveto I wu there. Bouquets to the Kingof be present at the drawing' you DON'T MISS Opa Locka's Largest I Clubs for a well planned and will be notified It you are the , beautifully! executed affair . winner. THE 6TH ANNUALCALENDAR 'While checking into a series of The 1055 Oldsmobile will be on breaking and entering cases in display in the Miami. area this TEAOF , his neighborhood. Officer William weekend. GARDEN APARTMENTS ' Kimfbroulh's house was THE broken Into . Another of the DADE COUNTY YOUNG \ big dances coming off win be that \ . of the Loyal Buddie at the W5 Daughter Elks DEMOCRATIC ASS'N II things there are more and more AnniversaryCelebration Sun., April 13 4 p.m.CLUB I of the social clubs and civic clubs having affairs this year. It's very Friday 535 STOVES AND REFRIGERATORS"i good for Miami, as we do need I i more social life. By EDNA DAVIS Sir John Hotel , AT NO EXTRA COST r I The Daughter Elks and their kl LOUIS JORDAN and Al Hlb- friends will turn out in full force " I bier really flipped the folk at the to observe the 14th anniversary Mary Elizabeth Lounge lost Fri- of Greater Miami Temple No. 769. Free Water Laundry, Room ':,! ':" ! day night. They sang a duet that Elaborate plans have been made Blanche Calloway was a "pistol." Louie is here to and a happy time is promised to dudk the cold weather and to reorganize those attending. The sale of tickets 0 I' " his band . Pickpocket; and tables have been excel. Proudly Present of The Week: Three Cuban cats t lent and funds raised will go toI were arrested for trying to picka I ward purchasing a piece of property A STARSTUDDED Open Daily and Sunday 7 am. 9 p.m. ' pocket. The pocket happened( I for a new, beautiful Elks to be In the pants of Officer home. Dts. Sarah Smalley and REVUEAT 'Tremble . Dottie Anderson I Dt. Ruler Ellen Taylor report 14255 N. W. 22nd Aye widely known as the "Bahama that several thousand' dollars are THE POPULAR ! Mama" has finally closed the Malayan |already on hand toward this pro- Lounge. The owner gave 'cram. ' : Dottie a check: that was chock fun District Deputy Dt. Marie See Superintendent, Apt. 2 '' i 11 ,of Goodyear. Bahama Mama has White loft Thursday for the been on the same gig for almost School for Girls in Ooala, but will JIMJAM aix years. She holds the longest return to lead the grand march Call MU 8-9092 or WI 7.2420 ' record of any performer, for lon- for the celebration Dt Fannie gevity on the Beach. Mae Moton is seen quite often on the race track. The ailing and lick daughters are up and out THE DEVINE ONE, MI.! Sarah and will be seen at the Ann' Vaughn comas to Miami on April, versary Celebration when they 1. She'll appear at the Fontaine trip the fantastic toe to the M bleu . Policeman: of the Week: merry strains of Alex Stephens. There is Vodka Sgt. Leroy A. Smith . Pretty Girl of the Week: Mary Alice Smith (no relation to Sgt. Smith) Official Visit CLUB like Gordon's. of Hollywood, Fla. . Earl Cole- .. man, star of Porgy and Best, was Fred Alexander Earl sentenced was charged to 20 days with in disorderly or $50. Grand IUgh Priest, 33rd of the degree Most 1900 N.W. 75th St. 189 yean of tradition In,evay bottle I Excellent Union Grand Chapter conduct: (and on the charge that's State of Florida and its Jurisdiction not fit to print) and when arrested Phone PL 9-8651 he told the officers, Bowe worldvg under the protection 1 working under the protec- "I'm the only and Westmoreland -f th HEADED BY , married in Russia e'ate of Florida, will make ! Negro who got his official visit to Miami Sun.I . \ to"toooo which?" PS.the officers Earl't wife replied ...arch 16 at 2:30 pm. at the SATCHROBINSON ORDON Masonic Temple, Ml NW 3rd .and from this 1 Is a Negro, too. ave. \ end, so what 'All Royal Arch Masons are re- Quested to be present at the : MARY WILSON, owner of the above stated hour. AU Muter the Mary's House of Beauty, has Masons and other departments M. C. ) and done it again. This time are Invited to see and hear the she gone is the sole owner of the Mary Grand High Priest Alexander. THUR., FRI., SAT., SUN. 1 Elizabeth Restaurant Mary is The Grand High: Priest also featuring: America's favorite dish holds an important, office In the ADMISSION 50 CENTS Grand Lodge of the State and Souse. The restaurant is open TABLES FREE 6 Jurisdiction of Florida. 7 days a week from 9 pin. to a=n. '. and Mary Iez, "Tall You will miss a -real treat if Show Time: Come". . Sharp Cat of the you fail to bear him on the above 10:30 p.m. and 1 a.m. Week: Eddie Williams manager date. The Royal Arch MUCIM Sat S Shows of the Carver Hotel . If you have grown by leaps and bounds 10:30 1:00 and 3:00 are a coffee drinker, I have under his leadership.HICKS'. found that you can get' the best Always surprise guett artists at " cup of coffee in town at '. (Ian show Saturday evening a3TittED4DK ' place, 715H NW 2nd ave. You ,'I'I know I alwaYs like to keep you HAVE YOU ANY TALENT? t informed on these little thugs I KURLE KOMBE j find around town. If so Cash Prizes are OFFICER NAT MATTOX U Beauty Salon Awarded ,at our \ walking around with his hand in 5550 N.W. ITttj Ave. TUESDAY NITE a bandage. Seems a Louise Car- Announce its new ter told Mattox "if you're 'gonna Amateur Show take ne to Jail, you gotU carry Telephone number I' As Mattox puts it, ' me down. PL 89113Com OPPORTUNITY KNOCKS hand. She "that's bow I hurt my , weighs over 200 pounds . Our In for FREE Color sympathy to Cecil Sweeting wen Music by Consultation Sunday { ", morning known Mr. Swtetihrg left his Expert hair coloring, tinting Carlos BermudezAnd GORDOH'SVODKA apartment togo downstairs to have his place cleaned, and upon dyeing, reconditioning; HI Orchestra his return (found that his wife Stylos by had died. It is reported that Mrs. Vera Hicks Prop.No Wo eater to prlvato parties, organizations . . the name that makes k better Sweeting had been ill for quite club*, church.*, wotf some time: . Once again will waiting four operators dings, dnetrtc.. you beer In mind that vr-i T "st: to serve you so AltO HO rseor to* NEUTRAL VISITS asmfe- not MAM Live life, every golden minute of I +- oeeon DIY GIN c0.,LTD..U..1- --- - It. Peace. .' . PAGE 4 SATURDAY, MARCH 15, 1958 I .... ..... "" ..... ..... -.. itoy: JUST BROWSIN'By PAUL R. HENRY PROCLAMATIONBy ------ .........-.... .. + r +* the power Invested in me as president of In Atlanta Ga., the 238member - NATIONAL NEWSPAPER house of delegates, :governing THE body of the American Bar Association PUBLISHERS ASSOCIATION -,-, .,,-- went on record as opposing " a Congressional move to f proclaim the week of TBMPORA MI7TA9TUR BT MO8 MCTAMCB IN ELLIS"The . limit the United States Supreme ThaN Are Oh..(.4 Lad W. Are Ch.Bed With Them MARCH 16-23 1958NATIONAL -- Court's Jurisdiction over appeals. , The opposition was expressed OHlM M 111$ If.W. Tblri ATM.*, Miami Plorlde-Telephe.. FB 1-"" as against Bill Introduced Sen. Plant I' .T4. N. W. lltk &.*....-Tel..h.M PL 4-tltS a by Jenner, Republican from Indiana NEGRO and take away the right of the ".,.r"'4 .. ..to.. m.. MUM .., *.(.*. I. 1M7 .t the Poet OBIflk .* Supreme Court to hear appealson WEEK Miami .......* ..d.r the art .( M.reh I, 18T congressional NEWSPAPER cases involving .. mt>*.r. .{ the ........ Newspaper Pobllihtri Ai.nUHoa committees executive security During this period, I called upon all of our M...k.ff .f th. AMUt Negro Press programs, state security - programs member, friends and supporters, to observe school boards or atimli- H. i. CIOtflMtTND BERVXS!, EdtUr sions to the bar. with ceremonies, articles and public expression, UAHTH f I.) RKBTRH. As* .. ... Editor ..<! B..I... Maa*...rON ., the achievements of the Negro Press during Its ----- - iln Mississippi, Superintendent 131 of continuous service and, in a fitting Schools IL V. years VBdCKIPTION) HATKtMl Qf Hooper announced - VRAK MM MONTH0! ..... THREE MONTHS Sill that the new million manner, recognize the contributions our many .. \ -- dollar school now under construe distinguished editors (past and present) have MOKBDO Or THE NISORO FBESS" tion for Negroes will be named THB NiCORO PKK8U-**!!**.. that America e.. best load the world after a retired Negro teacher. It made In service to their race, their nation and ,.*.. r.rUI MM! ..tl.ol ..t.rU.>. when It accords to ever mal re..rdof will be known as the Ross the world, In proclaiming (ustlce, human rights *... rare. e.l.,r or fir.... kl. k.u.n .nd !..*.! rlfhti. Hating BO mac, f...- Temple High School. Mr. Ross: Rae .. m.-the Noire Press ..*!... to help ever man In the firm belief tb.tI served the community, church and the advocacy of fint-cJais citizenship for sit sea ar* h.rt' es !..* M MTM. U held back I and school for a period of more all. than 60 ;years. Done this 1st day of February, 1958 YE EDITOR'S NOTEBOOKA William O. Walker Too (bad! Our Explorer II has e not been a success. She vanished I President NECESSITY FOR FREEDOM I after a 1,900( mile trip and her fate remained a mystery to .... . up ' The Negro Newspaper an important egment of the \IJIiBI\nllIII this: vvrlt'ng.! Better ]luck next Great American Press: is one hundred and thirty-one years .":."I"... '.. we Uopc.Rq. . old this week. Today, as in 1827, ,there is tremendous need for its untrammeled yoke of truth, freedom, and justice Robert Sikes of Florida Carver Student CARVER YMCA , The Negro press is the conscience America Throughoutits has asked the Postmaster General -: WINS ZONING to issue a postage stamp depicting I distinguished history it has ever been in the forefrontof the birth of Christ for use /the fight for decency and right. at Christmas time. Dies Fnroufe FIGHT Originating in the struggle of our forefathers to win (continued from page 1)) freedom and full citizenship, the Negro Press today faces Now it's Easter Seals. If youhaven't in To HospitalMinnie already received some dent of the Dade County Property - the necessity of greater effort //toward the ultimate ful- the mail, you'll get them. The Owners Association and local fillment of its original mission. proceeds go to the fund for han- + Winkfield, 15, daughterof loader of the White Citizens Now functioning in an of dynamic transition, dicapped children and adults. Mr. and Mrs. Grady Winkfield Council. age of 10341 SW 84th st., Perrine, Inexplalnable to the entire the hunger for enlightment deepens as desegregation be At the City Commissioners and a popular student of George body was the appearance of nine comes more legal and segregation itself becomes more meeting on Wednesday March 19 Washington Carver High School Negroes in Hawthorne's group real. I Mayor Robert King High will introduce died suddenly on Tuesday morn opposing a YMCA for their own Because there are those who would still deny some an ordinance that, if ing about 10:30. while in a Wil .' community. will all liams' Ambulance enroute to of the Representatives YMCA passed give persons con- citizens full to life and would not have the I aiccess A good victed for bollta for the first Jackson Memorial Hospital did an excellent Job of sellingthe truth known, it becomes more incumbent upon the Negro time a jail sentence of 30 days. A 9th grader, with Mrs. Jeanette cause to the Panning Board. Press to readily, openly and fully expose every evidenceof For second offense 45 days. Frierson, her homeroom Those speaking in favor of theY unfairness, inaccuracy: and distortion. Only in this teacher, Minnie went to school ' were:: James L Keller, presi- The Federal Housing and Home Tuesday morning as usual and dent of the YMCA of Greater manner can the Negro Press remain the most democraticof Finance Agency has granted was stricken about 9:30) while a Miami; Atty. L. Eo Thomas, Rev. all newspapers by applying the great variety of facts $1,925,000 to the University of physical education class under'I Edward: T. Graham, Herbert and opinions necessary to extend and accelerate democ- Florida for construction of stu- the instruction of Mrs. Frankie Mannings, John W. Dilfard Mrs. dent apartments. Of course thatIs Rolle. The ambulance was called Oscar Range and Moses L. Perry racy.As a loan, but, well here is a by school officials and the girl I executive secretary of the Carver the progenitor of everything worthwhile about question mark? was rushed to the hospitaL She branch. its readers, as well as those who would aid their progress, died in the ambiance at the corner the Negro Press singularly supplies that awareness which On Sunday Dr. Joe Hall, coun- of NW 20th st. and 27th ave, 2 Killed 5 InjuredIn must precede intelligent group action. But the veil of ignorance ty school superintendent will be according to the attendants. , superstition and fear must be further penetratedif laymen's speaker at Mt. Zion Minnie is also survived by four Weekend Violence Baptist, Church. The Laymen Ed. full victory is to be won. Thus, until that dlay, (the Ne- ucation Project is a monthly program sisters Mrs. and Rolle nine was brothers.so over-come gro Press must remain the courageous, clear, calm voico with outstanding speakers. from the shock that she required' (continued from page 1) sounding from the bridge, pointing out the shoals ahead. Last month former Mayor Abe medical treatment. an arrest shortly. Never in the history of journalism has the need to Aronovitz was the speaker. Funeral services for Minnie Hunt is now in Jackson Memo will be held on Monday afternoon rial Hospital where his conditionwas keep the issue of social equality clear, been more acute. Fire on Saturday afternoon at 4 o'clock at Mt. Moriah reported as serious. Never has the opportunity for our press to become a destroyed the property of the Baptist Church under the direction JOHN BROWN, 29, of 810 NW truly great asset in the struggle for human dignity, beenso family of the late Nathaniel Deanat of the Bain's Funeral Home First Court toLd police his gun manifest.On 16th st. near 3rd ave. Two with the Rev. W. C. Edcar, pastor went oft accidentally about' 10:15: small frame building were destroyed I officiating. Saturday night at his home and the eve of the beginning of its 132nd year of ser- and a t\vo-story buildingwas shot and wounded his girl friend. vice, the Negro Press, fully.cognizant. of its expanding responsibility badly damaged. These: buildings Miss Elsino JoneSnthenmn reaecucates itself with renewed vigor and were condemned sometime TRIUMPH CHURCH Brown added that he could not ago. Nearby property, owned by stand the sight of the blood run- determination to the unfinished task of achieving a sdcle-I also . Henry Dean, was damaged.In Prince H. Mobley, pastor ning from Miss Jones'k arm and ty in which there will be unimportant people. no Sister C. McKinney, reporter shortly after became excited he Chicago, Robert Dukes, 19- also shot himself in the arm. Both METRO YOUTH BOARD yearold Englewood High School Opa Lodka were taken to Jackson Hospital 'student, drew a 60-day jaJl term The school of Wisdom was at for treatment. Brown was being The authorities finding'their hands full} and juvenile and five-year probation in boys its best on Sunday past. Bro. B, held in Jail up to Thursday on a court last week for the striking charge of suicide Edwards is our new elected sup attempted according - the increase have decided to createa delinquency still on principal and a teacher when erintendent. "The Church's Influence to police. Mtropolitan Youth Board. they sought to break up a fightIn : on Society" (Temperance - the school between Dukes EARL ROACH, 29 of 1711 NW The request for this board was made last week by and another youth.yard ) was the subject of the les 5th Court, was shot by Willie the ,Child's Guidance Association and agreed to by Coun- son. In the lesson we find that Johnson an employee of the ty Manager 0. W. ,Campbell. However, :Mr. Campbell let we as Christians are light of the Ebony Bar NW 15th ave. and Jack Bell, well known Miami world. The life that God lead it be known in no uncertain terms that he "is not a damn columnist wrote very interesting through us daily; should be so 69th at. shortly after midnightlast Saturday. Police said John- bit interested in aching up an Agency that will take on ly on the recent NAACP investi- bright that men will be drawn to son suspected Roach of one more part of an already split-up program" Its job gation by the Florida State Investigating ,God through UIS.I to break into the juke box trying at the will be to pull things together. "Then when we find a Committee headed by The subject of the YPE Band" bar. Roach was taken to Jack former Governor Charley Johns. I was "Search: My Heart, 0 God. i son Hospital for treatment and loophole, we can plugit, Mr. Bell in his usual manner, Scripture found Psalm 26:1-12.: was discharged Wednesday Dr. Eugene Byrd, local psychologist, has been namedas went right down the line and told Bro. R. 1. Multry was in chargeof Pollee sad they arrested Johnson - chairman of a committee that will recommend .members things about' this hearing as he the service. on a charge of assault and and work out till program for the youth board. saw them. The evening devotional service battery with a gun. Police indicated . If you didn't read his column was high in spirit and many tes that it was not With the Juvenile Court, the Police Department, the get a copy of the Miami Herald timonies were told. The message for Johnson to shoot Roach necessary In Youth Board and other interested agencies at work, let for March 9 and read it, please was delivered by our Mother M. order to prevent the suspected us hope some definite improvement will be shown in the robbery. behaviour of our delinquents in the not distant future. The governor believes there should be no substandard GUS GOODMAN of 3880 Ch .. Juvenile delinquency is on the increase practicallyall housing in Florida. Florida has not been able to par Terrace, Coconut, Grove, was the United States also in some foreign countries.It dead on arrival at Jackson Me- over ticipate in the Federal Housing program because of a morial Hospital on Monday as a is, a major problem, and it should be ddalt with boldly. Supreme Court ruling that declared unconstitutional a result of stab wounds. IVuce aid Among the delinquent juvenile of today there could stat law which permitted slum clearance for housing de- Goodman's death resulted from a be, some of the rulers of the nation tomorrow. velopments. family altercation involving his wife Mary Grace and his mother - However, under amendments made to the National Mrs. Sarah Gardner. Policeare OFFICIAL AGREEMENT Housing Act in 1954 Florida would be able to participate.This still investigating the case. 1 It's unusual uow-a-day, but it really happened. Tho committee will also study the problem of relo- city of Miami and the county officials have endorsed a cating displaced families by state highway construction Williams. There Is a meeting inproires.s in Miami and other now at the church for State and Federal to abolish slum areas. areas. program the healing of tnycne who Is sick Gov. LeRoy ColliDe has appointed a State Committee It is good to see City, County and State working to: and believe that God will heal and named J. E. Earn manager of the State Planning and gether. Now they ought to be able Ao accomplish something them. We would like to take this time to wish Mother Llllie Mar- Community Service Board as charm ui. worthwhile. shall a happy birthday. .", ....,:' .'," _1..... 1I \ '''' I t '" IN JOINT RECITAL MONDAY NIGHT Letters to The Editor THE MIAMI TIMES-"The Peoples' Newspaper" , I -.......... .. .........._____._. I I SATURDAY, MARCH 15, 1958 PAGE I 5 vw READER WARNS: V ItfA ,+ I II DON'T GETCAUGHT r !I ON "NO fA _ I DOWN PAYMENT" It Itf L IFs HOMESTo The Editor : Miami Times f Dear Sir: ; Please caution your readers to "Don't get caught" in the last ditch attempt Of the Get Rich Quick Bays who are offering to ? build a home on your lot for no : down payment. p4 ; I Your city administration !Is a. : working full speed ahead in applying - } for Federal Add for urban I S development. Which means especially - ( for those of you who live .... '. ..'..... >', ..., _"....._"' _,....... ..... '..0.-- ,,,,,,," in 1.downtown New home Miami.for you at no MRS. JOSEPHINE MALLOY C. C. MILLER down payment. . Mezzo Soprano . Baritone 2. Small monthly (payments. Lovers of good music are In ler enjoy the benefits of training 4. 40 years to pay your bill in for a rare treat on this Monday under some of the greatest musical full. can't otter night, March 17 at :15, when directors in the South. A complete The get-rich-boys Harris Chapter No. 160, Order of program, consisting of you mall monthly payment; 40 Willie Coffee in full. Eastern Star, proudly presents sane of the finest works in clas. years to pay your bill I Mrs. Josephine Malloy, mezzo ales: semi-classics, spirituals, There who are people and In the right Completes TrainingFor Power Sewing at doing soprano, and C. C. Miller dramatic gospels and pqpulars has been places care are .' baritone, in a joint recitalat prepared and wil Ibe presentedby everything to right the wrong the Masseur CareerWillie Northwestern T f scheemers have made for Itwouldn't the James E. Scott Homes both artists.Admission you. be fair to these say Auditorium, 7200 NW 22nd ave. Is $1.00 and ticketsare people are spurred to action because Coffee, registered masseur The power sewing class at Mrs. Gladys McFord will be at on sale at Miller's Cleaners, they see corruptive prac. is the new title of this former Northwestern Senior High Schoolis the piano and Elliott J. Pleze 814 NW 3rd ave., and by mem- ticca popping up in their own concessionaire at Station "D" offering on Monday and Wed will serve as master of ceremon- bers of the sponsoring group. The back yards. Out it would 'be fair Post Office. Last July, The Times nesday evenings from 7 to 10 \ ies for the occasion.:: public is invited to an evening of to say, commendations are theirs gave a rather detailed account on o'clock training; for beginners who Both Mrs. Malloy and Mr. MilHAPPENINGS fine musical entertainment. for having the courage to call a Willie Coffee who at that time wish to learn power machine operation , spade a spade. Knowing full well had been apprenticed to Mrs. shirt or blouse making, I I that many of their friends are Susan Harris director of the Reactivation garment designing, and garment 20' Discuss involved. Health Center, since tilting. Royal Why can't 'have non May 23. On March 1, Coffee took we a Special training is offered Ito the Anal examination to becomea AT JESCA profit appraisal board to point pcnons who aro already employed "- 16th AnniversaryThe out some of these outrageous licensed and registered mas- - sour He passed all of hU work at power machine operators DID YOU KNOW prices. People are asking for with high grades. This is a tribute I who wish to improve themselves Royal Twenties Women'sClub these third to sixth handed homes That a quiet school is not to this soft-spoken man's so that they may receive promo , necessarily met at the home of Mr. and and perhaps prevent some of tions in their Jobs a, good school. Children ability to concentrate and to or get new po Mrs. A. Davis Sunday, March 9 at these gangsters from crowding sitions. For further need to talk to people and to I I 5:15 in the afternoon to discuss Negroes in areas against the laws grasp subject matter as shown i call PLaza 4-0491. Information themselves, this way we help too its. 16th anniversary ball. The of the city, health and human through practical application. It I build the vocabulary, social discussion was the highlight of kindness.A is also a tribute to Mrs. Harris ---.- mindedness, emotional stability the and investigation whose experience and training meeting. survey grand jury - I has made! her on excellent instructor and many more phases of thebpd's The dance will be held on Fri- will reveal come facts . Mrs Harris Coif cc is the second and the "textbook"tape : personality. day March 21 which will make heart person I evening in the your sing to be trained by Mrs. Harris, recordings. The prayers and Harlem Square Club ballroom.An and one deacon and his 11 cohorts PATRON'S COUNCIL NEWS and the second to pass with hl hlfadClS' good wishes of many people in open invitation is extendedto will end up behind bars for per this The Patron's", Council of Liber- community were with Coffee I the club's friends and petuating on the human race, a ty Square Day Care Center met many to lin his work toward becoming a Tuesday evening, March 12 at 8 those who failed to receive one scheemer to deprive that race of Totally blind Coffee studied the self-sup;or'ting citizen in this or to those who have its birthright, community development changed fcjn. As the parents gathered we seven-month course in massageand community. He will be on she had a group "singing Parents their address, you may call Mrs. and Individual progressive physical theraphy as givenat daft of the enlarged Reactivation suggested songs and we all rang Carlee Daniels at HI 4-2907 initiative Lindsay Vocational School by Health Center in the Sir John together, after this the business at The dance is expected to be Observing the clock of means o.>f the direct teaching& of Hotel. one of the outstanding events of the time hand dtacuescd. was the and the Royal Twentiesare \ year At Center Two at James E. Scott Homes the Patron's Coun. there.looking forward to seeing you Dear Editor cil met Wednesday evening and At the adjournment of Sunday's The 'results". of the late investigation CLEAN..CLEAN to the delight the short of parents a meeting, Mrs. Alice HSsmith Lucas of the NAACP Indicate for program exclusively the hostess served a deUce that it Never Advocated Anti- parents was given. Miss Helen ious repast which American Communist Philosophy, was enjoyed by CLEAN. : Dorsett of toe public libraries of i an O. E. T. is the club's reporter. and that it was Not Acting ' the . city prepared a very enjoy Against Country's Policy. In fact able outline of events on the NAACP means democratic action.It . adult level. WHAT IS was the Investigating committee DAY CARE ACTIVITIESDid that made me see Red! you see the birthday list Sincerely, for last month? Every last Friday 930 ? George Savitt of each month the school is open, I ___ the children at each oi the Day Care Centers are given a birthday party. The names of these children are printed every month in LAST CHANCE TO SEE AND HEAR the column of happenings at JESCA; in: site of the limited recognition of words our children LEE ANDREWSAND look forward eagerly to the appearance of this list. Fi THE HEARTS LEST WE FORGET Remember the "King andQueen" _ contest held annually at PLUS * 1 the Liberty Square Auditorium? This year the contest will be held WILLIE MABON AND BAND at the same place, the auditoriumand the date is April 8, at 8 p.m. FRI. SAT. SUN. MARCH 14 15 16 Come out and enjoy yourself. , There Is admission no price charged SUNDAY MATINEE 5:30 p.m.-2 a.m. TALENT SHOW The Sub-Dobs Talent Show will . be held Tuesday, March 18 at the _4 um' Liberty Square Auditorium. Wai- BEGINNING MONDAY MAR. 17 ley Futch will emcee the show , also entertainers now in Miami area will be appearinl,1, Those FabulousMIDNIGHTERS ists on the show. For of pleasure! you are invited. I '- aThat's Tickets may be purchased from I any Sub-Deb or the James E. , Scott Community Association office the super-dry taste you get 6244. NW 15th ave., phone PLUS when you make your JQt ' ft 7-T289. If I CAL (Pee Wee) GREEN & BAND Martini with clcan-tasting .. . --- --- --- - - - WARNER MaULLED DgYatN ' ADMISSION 75 Cents FLEISCHMANN'S HINES, Inc. I Nom... k Painting and _"... . Wat.rprooflapContractors : GIN.CISTIUIO I $2.55 4' LleonMd and x THE PALMSHALLANDALE Pint ' 'Insured by City FROM AMERICAN GRAIN I rj and County ' 1S6S NW 8Mb St.Fro. .; 90 PROOF THE FUISCHMANN OISTILUNQ S 'I ; NEW YORK CITY EaUmataCall n. CORPORATION, any hour I Ph. NE B-6879 - _,- ,-"i** I.\ .. .'..;': r. JLI // . . . I , l : .' " I' , . ." " . ' I /, -- . e . THE MIAMI TIMES-"Tho Peoples Newspaper" From Jim Crow Schools. ; \ , ' I PAGE 6 SATURDAY, MARCH 15, 1958 Congress Asked to Withold Funds EASTER SUNRISE t Carolina the Women, who of is the looking State of forwardto South SERVICES SET FOR seeing a mammoth crowd on hand to'watch the sun ris from !r Washington, Match 8 The 1fu1 inadequacies of the illegally an even more severe handicap the ocean and send forth its rays National Association for tbe Advancement I segregated Negro schools impose upon the national effort." JUPITER'BEACH over the worshippers. of Colored People has I Palm Beach Area cit. West - again urged Congress to withhold _._ .- will their first concerted - federal funds for education from 80 ATTEND at FAMU. Mr. Smith is directorof izens get opportunity to watch the sun segregated schools. the workshop. rise over the blue Atlantic while I The BookwormBy Testifying: before Labor the and Senate Public FAMU PRESSWORKSHOP One of the highlights of the raising their voices in' singing Committee on William Henry Huff for ANP this Easter morning Sunday year Welfare here on. March 5, Clar- conference was ,the organization I' ence Mitchell, director, of the of the Florida InterscholasticPress According to H. E. McKinney, I have to smite and give a NAACP Washington Bureau, cited Association a State wide well known local public relations I I friendly look the continuing defiance of the I Ay William, Junior, Edw. iYr* organization of high school figure who is handling publicityfor At every one In whose hand Is . United States Supreme Court I journalists and advisers. The idea the project, the first Easter a book. High, Palatka, Fla. Sunrise Mission Services to be ruling against segregation: in was brought to light by Mrs. I gladly lift hat to him or her and MoRae of Central Academy held here will take place at Jupi- my Marian H. Shannon, adviser to : education fcf political action public such where No matter may Some eighty Tallahassee I ter Beach on Sunday morning, the Booker T. Washington High Arkansas leaders erf Alabama , young junior journalists from all April 6 beginning at 5 a.m. occur , School The Washingtonian.Those I I Louisiana Mississippi paper. Florida Georgia, , over Florida gathered on the For those who will be called uponto South Carolina and Virginia A truly spiritual songfest will of Florida A and M University lead ,campus who participated from be conducted with Mrs. Seretha in the to that Promised Land to participate Miami Anna Jean Hawkins My people were , "The question arises* he said Eighth Annual InterscholasticPress White Strong of Miami conducting n Whereon we all must some day Cynthia Ferguson, Ulysses , " group of 150 voices, assisted by can the official of these statesbe Workshop held last week. stand. Marcelle Wake Booker T. Wash- trusted to handle kind ,of Rev. Ira McCall, director of the any federal assistance tor the educa- High schools represented included ington High; Eunice Mosley, Bar. Miami Master Singers. The Mas I tion of all of our dtiscns with- Central Academy High, bara Seniors, Cedric Moss, Mays ter Singers are expected to ren- out finn anti-segregation safeguards Palatka, ; Howard, Ocala; BookerT. High; der several numbers also, as well ? The answer. to that Washington, Miami; New as choirs from West Palm Beach, question is "No" Stanton Senior High, Jacksonville Riviera Beach, Pompano, Fort ; Miiddleton, Tampa; Univer-; W. P. B. NEGROESWIN Lauderdale, Stuart, Fort Pierce, The NAACP, Mr. Mitchell told High, Tallahaisee and Mays High, Vero Beach and Miami. I the committee members, asks Goulds. Messages from several out OOTH "that no state be given y funds GOLF SUITNew standing Florida ministers will unless its appropriate officials These young journalists had the precede the delivery of the mes- AGUE pledge that such money will be opportunity to work with some Orleans, La. (ANP) sage by Bishop J. W. Wilson, spent in conformity wttA the requirements Qf the nation's best known newsmen Negroes in West Palm Beach, outstanding Souht Carolina of the U. S. Supreme which included such notables Ha., again won the right to use church leader.Sponsoring . Court decisions of May 17, 1954, us: Robert Ratcliffe, managing I the city's municipally-owned golf the sunrise pro- and May 31, 1953 in tOO school editor of the Piittsgurb Courier; course when the United States gram is Mrs. Alice Sa under' of ORA-JEL desegregation cases." Calvin Adams, reporter, The St. Fifth Circuit Court of Appeals, in West Palm Beach, church missionary I Petersburg Times; Russell Cowan, a ruling here last week, refused mother, and ,leader of, Mr. Mitchell read into the rec- sports editor, The Chicago Defender to lift an injunction ordering the ord a letter'which NAACP Executive -- -- --- -- ---- I ; Alice Dunnigan, Washington city to discontinue its Jim crow - Secretary Ray Wilkins Correspondent, Associated ban on the course. wrote to Marion Folsom, secretary I Negro Press; Cliff Mackay, editorof I of health, education and the 9froAmerican Newspaper, The permanent injunction was OPPORTUNITY AWAITS YOU welfare, on Jan. 3. In this letter issued last June 13 after Dr.. Mr. Wilkins charged and Frances H. Mitchell, associ- Warren H. Collie and three other . "Two million Negro children ated editor, Jet Magazine.At Negroes filed a suit contending SEE THE SOUTH'S LEADING COLORED continue to be deprived of their that the city, in not pedmitting PSYCHIC READERLet right to equal access to the best the opening session Thursday them to use the golf course, violated - training their communities pro << morning Charles J. Smith, : their civil rights. vide. Education and training In III, brought official greetings to the sciences for the generality of the entire body. Greetings were The appellate court here main students are now deemed inade- also brought by Dean H. Manning tained that the appeal was overruled - quate to meet the challenge to Efferson and Dr. Dorwin Turner, by three !previous opinionsof national security, and the shame. I head of the English Department the court. \ + e my years of Experience guide and protect yeu through Life o a. a Lighthouse guides'the ship In a storm A , WHEN OTHERS FAIL YOU SEE ME For Success in Business And Love CONSULT HER - You can now have your home made happy Get and Hold the position you so long wanted Don't Stay in the rut get out now t By the help of God she can help you Remove evil influence, if you are sick, worried or in troubleIt j. will pay you to call and see this Gifted Medium First Where thousands come yearly for help end advice, you too can :,'; b..touched by this strange mysterious power WHY GO THROUGH LIFE UNHAPPYThe same God who delivered Moses and the children of Israelof ' J old I. still alive today and will open a way for you throughthe : {.\ troubled seas of IIf. Let not him that Is blind lead you or .1'' ,it There's only one truly modern way to cook and that's you stumble with him. ; tltctrkalfy..because only modern electric cooking . ,.\s V; can glv you ett these advantages: Do you doubt the existence of things because you cannot set I itJ1\.p CLEANEST No soot to'sott curtains,walls pans... themt housekeeping's....er. } What do you think of the Invisible, waves end sounds that make Wlrelees, Telephone, Radio and Television possible? COOUCST-Half u anany beat-snlts needed; heal goes right Into the bed,cantipttr up around the A seed before It sprouts, lies concealed, secret, silent In the dark pea to beat up your Mtehen. earth or ,womb of Nature. THERE, 18 AN "UNSEEN POWER" In Florida SAFEST-No open game fumes, pilot lights; safe Therefore, acquaint y o u r- " u electric lights. self with the one who is an t *'NIODERNVV 'ASTECT-Fo cooktaRcordtIine. : >b1 aetaJleIt. authority. Whose private f' consultation will evolve you y aiEAPEST-lfs cheaper td go all-electric In your j y' to a higher state of mind.AUlnEormation . Utchen-laundry than to use s combination of tack m_n s I IILECTRI'C is ,, Strictly ConfidentialOffice Hours: 0 ajn8 pjn. : r Sunday: 10 ajn. to 1 pan. "' j. : k I II ' Don't Write-Call in Person ' ' 1 'I\\ DAILY READING 11.00 ,UP :, : SSfe/< BiG DIFFE/lENC8.. . III ,., 20 YEARS EXPERIENCE F*} ***-** UYS DDT lf' r.tCl'MCdLLY S.yow applfmra ik 1"today! ' ; , MADAM HUNTER .... ... .; ($) PIOItiDA POWER .& M.HT COMPANY 1657 N.W. 73rd St. Miami ,_.-- -I ,.., ...." BETHUNE THE MIAMI TIMES "The People Newspaper"? Freedom's RoadBy WILDCATS SCHEDULE I -SATURDAY, MARCH 15, 1958 PAGE 7 JESCA YOUTH tants finishing> in that order In RUTH PERRYI 8 GAMES the Junior and Senior Divisions TALENT SHOW > Dl the 'show.Stesldes . Bethune-Cookman College has the youth, we plan to think all of us who are in-1'i No matter how much the Par- TUESDAYWhat its 1958 football completed have for your enjoyment a number terested in freedom and an end ty says it is working for Negro schedule which calls for only of outstanding guest artists, to segregation! read Jack Bell's rights this is a deception and a eight games, according to a release is probably the greatest currently appearing) in this area. column in last Sunday's Miami fraud, says Mr. Hoover. The from the office: of RudolphC. array of local talent ever to appear >- Admission for teen-agers and Herald with a great deal of interest Party's sole interest as most Matthews, director of athleticsand on any one program has adults Is. cents and'tickets may and thankfulness.: I don't American Negroes know, is to head coach. been assembled by the Sub-Deb be purchased from Sub-Deb members believe the stand the officers of hoodwink the Negro, to exploit The Wildcats will play only Clubs of the James E. Scott and at the office of the the NAACP took in the recent him and use his as a tool to two games on their home groundsbut Community Association for its James E. Scott Community Association - investigation, could be explainedany build a communist America. Florida fans will be able to Fourth Annual Youth Talent 6246 NW 15th ave. Net better than Mr. Bell did in NAACP AND COMMUNISM see them in action in Jackson- Show scheduled for 8 p.m. Tues- proceed from, the show will go his column. For this reason, if ville and Tampa. day, March 18 In the Liberty to the James 'E, Scott Community - any readers interested in doingso I I Square Auditorium 6301 NW ' Mr. Hoover gives many interesting Association to help with its will take a few moments and Coach Matthews announces 14th ave. of recreational I facts in the chapter entitled program 'and educational drop Mr. Bell a line or two I. Communism and Minori that the annual Tilt of the Maroon First, second and third place activities' in the communlty. - thanking him for writing as he ties. There is no doubt but that and Gold will return to Tampa, prizes will be awarded to contes. . did, I am sure he will appreciate the Communist Party has made and would be played October 11 it. vigorous efforts to infiltrate the which is earlier than usual be- -- -- NAACP. However, in 1950 the cause of the problem of getting MASTERS OF DECEITJ. NAACP authorized its board of the field in November. I---------- late to have your Edgar Hoover has recently directors to revoke the charter of In a discussion of the schedule, . written a book called "Mastersof any chapter found to be commun.: Coach Matthews informed that GRADUATION PHOTO Made Deceit published by Henry ist-controlled. Quoting Mr. the team would play nine games Holt and Co. As all of us know, j Hoover "The NAACP's national providing the November open Mr. Hoover is director of the leadership has vigorously denounced date on the schedule could be fiU. Cap and Gown Furnished. Alto tassel with your Federal Bureau of Investigation, I! communist attempts at ed. He b still in search for a . and has been for many years. His infiltration. Minority groups, game on that date. school's colors . I boor is the story of Communism! like other patriotic organizations,, 1 .., 1 In America know that no communistcreatedUtopia The 1858 Football Schedule: and how to fight it. No I can compete with the September 27, South Carolina .- man, believe is qualified more American way of life. The ability State, South Carolina; Oct. 4, to write this of book type of the communists to Florida propagate Normal Daytona; Oct. 11, and I would suggest that the Prom Backdrop Available for Prom Photo their false doctrines is a Morris Drown, Phillips Fields, reading of it is a "must" for challenge to our educational pro- 20th Annual Tilt of the Maroon those who want to know really cess. We need to counter communism and Gold, Tampa! ; Oct. 18, Dene- about combat Communism it. and how to by making the hopes and dice, Columbia, S. C.; Oct. 23, Fla. Johnson of Miami aspirations of the American ideala A and M, Gator Bowl, Florida Aa Mr. Hoover says in the foreword reality; for all to enjoy. Classic Jacksonville; Nov. 1, to his book, he wrote k. he. This book is required reading I Open; Nov. 8, Fort Valley, homecoming 1182 N.W. 3rd Avenue Phone FR 1-9M1 cause he believes that every citizen for those who want to know more ,, Daytona; Nov. 15, Xavier has a' dubto learn more I about communism and its threatto (L, New Orleans; Nov. 23, Allen about the menace that threatensus. America. U., Columbia, S. C. If citizens will take the time 1 to inform themselves, they will FREE TRAINING NAACP OFFICIAL , find mysteries that as communism its leaders holds have blueprinted no CLASSES FOR SAYS "YOU CAN'T There is no'Vbdka ' their objectives.Mr. NURSES' AIDES TRUST THE Hoover goes on to say that he has faith in the ,American Interesting volunteer activity as i SOUTH"Washington like Gordon's. people and in our American way Nurses Aides is being offered by (ANP) Offl. .. of life, but he knows what communism the Red Cross and a free train. I cials of deep southern states cannot - could do to us. The danger ing class for Nurses' Aides will be trusted to handle any kind 189 yean of tradition fa very; i+bottle is this: We may not learn until begin shortly, according to Mrs.C. Off Federal assistance for the education - : it is too late to recognize who P. Homberger, chairman. I of all of our citizens the communists are what they U you wish to talk to Mrs. without firm anti-segregation are doing, and what we ourselves I Horriberger about joinglng this safeguards, declared Clarance therefore, must do to defeat group, she invites you to see her Mitchell, director of the Wash- them. He also says that he at Red Cross headquarters, B020 ington Bureau, NAACP. hopes that members of the Com- Biscayne Blvd., between the Testifying before the Senate )RDON munist Party will take the time hours of 10 a.m. on Thursday, Committee on Labor and Public to read his book. to see how, light March 20. If you cannot come Welfare, Wednesday, Mitchell before their eyes, the party is then, she invites calls at her urged the congress to withhold t. deceiving them. It is a known home, Mo 17398. funds from any state, whose officials ODKAfe 't I IIM fact that many members, once Mrs. Homberger point out that refuse to pledge the money awakened to the true nature of Red Cross Nurses' Aides, after in conformity with the requirements - communism, have renounced the completing the free training may Qf the U. S. Supreme Court Party. This is especially true of wear the distinctive Nurses' Aide decisions of May 17, 1954 and a very small number of Negroes uniforms and insignia while on May 1 1055, in UK school desegregation who misguidedly joined the duty. Nurs& Aides are expectedto case Communist Party, thinking it was give a few hours a week of the answer to their problem of their time as volunteers in hos segregation. pitals. At present there are scores of Nurses' Aides who en- "Rhomania"Friday joy this activity in Dade hos March COMMUNIST AND THE pitals. 2Ut NEGROIt The training course, which is B. T. W. Auditorium is also true that Communist easy, consists of evening sessions leaders have bitterly complained once a week for ten weeks. These aThLLEDp about the Party's inability to indoctrinate will be taught by Miss Geraldine any large number of Jackson, registered nurse, at a C i 1 . Negroes. For all their history of room .provided by Jackson Memo i. 'M'X 0NRV HoM'fi, segregation and Jim Crow, the rial Hospital. Following the class- oR 3 DEOROOMSG proportion of Negroes joining the room sessions, Nurses' Aide volunteers flOOM'KUfCHl **, Communist Party has been very will receive practical on- ev .. ,? the-job training, and then be smell, and many of them who presented their certificates and joined renounced the Party later Insignia at a graduation cere: when they discovered that Com- munism did cot really want to mony. additional Nurses Aides help the Negro. It only wanted to Many needed Red Cross and Mrs. are by further the aims of world com- munism. Hornberger urges interested per- I sons to telphone or see her. - - - -- - -------_,...._-_-------_.. _.......... . -. -- ft"R r A 0'4 * SHOP ATBerkley's i GoIwoJsYooxA: 1 Cut RateWHERE Y I . the name that makes it better QUALITY LIES I IO) AND 109 WOOF 100J5 NEUTRAL SflWTS1 DISTILLED hat GRAIN 1201 N.W. 3rd Ave. FR 4-2376 l/N'l'ft' .8414)) GORDON'S DRY GIN CO.,LTD,UHDW,Hi_ ._ - Gifts, Cards, Dolls and Gifts of all Kind I >* v k HOMi Pokena Set __ 1At :.'. Dresser Seta S.19 to 12.98 Men's Box Silent NightHandkerchief. a SUCCESS ,!.(/< UAPPIMES ...._eo .91 Cologne Set .-. 1.25 1.69 ,Tfc* Electric Iron 3.98 '.95 Old Spice Cologne YOUR HAW e "fna r cs.u' Waste Basket ..___._ .61 and Lanolin __....._ 1.00 lUUt T. ne rateT.t.11.Ntbatwabiq.PM1. " to Approaching Evening In Part eywN stiO.lN.4wrwH. Winter Medicine Seta _--..__ 1'00 J.98 ...., ppr..ns.n..I'stasi s sew. ',r.s..q Seo<<'. Emulsion .ta 1.71 Comb and Brushl ar1M- Dr. Brown's Magnolia Seta .****.. .nfl vw 2.49 J z 8 WHY vc THRU * >..; .; tin; tease aad ___ 1.4' Men'a Small Brief. cautry 4 Remedy -. ..._ . 2.9f yoQN PROFESSOR HOMES 'ITree aedtaas John ....-.6b 1.35 Cases --- Father Tabs ._ 2.tI Evening 'In PartsKing's ; : :z:! True advice lUll many dolian and untold worry. BeJbrt making any claims contuliOi Yaramln 2.10 Stick Deodorant 2 for $1 Sr meat once. TbU pried medium wUJ act only advlM. bat wiU glv beep oa an attain Men'e 8eti -- i eaR of life Mia as love. cowuhlp. nawrUje and ..lroda.1oI1 alt,cuoaa. Advice all 5 money matun. No problem U wo 4Ufktm for me to 101... 1"1'"U' Toe row same to BARKLEY'S EVERY WEEK full,and give names dates and facts about your probUroi. Visit roe ndaj aoomiew SHOP AT may be wo tail Dont |0 thru Ufo unhappy Ill dhow you dill way to iocc u. Tow Where Price Are Right i 7/>* treaieit wish can k icalls d 111 gin l you your Lack,Number LMhy DAya,1A' 113al'k 1201 N.W. 3rd Avenue 2 IMdin&lconfldeat1'1 2118 N. W. 62nd STREET. .MIAMI Can FR 3-9458 or FR 4-237 *ffAlong We Deliver ar ;!i.: .. .. _..........._..,................4 ,.)i ....,"1ii ,,_4." , _ ., a - I THE MIAMI TIMES "The People Newspaper"PAGE SATURDAY MARCH 15; 195ft MEMORIALS DEATHS .8 .... 1 I Francis . , IN MEMORIAMIn CARD OF THANKSThe Range . GOING r-or 438 NW 7th st, I Fad but loving memory of I family of the late Nash Hogan March of 5 at Jackson Me- / expired our dear husband and father, MRS. BETSY FRAZIER rial Hospital. Funeral services BAREFOOTCan t who died Feb 25, in Charleston, will be held Saturday, March 15, ., S. C., takes this method to thankall Be Rev. GeorgeE. 2 pm. in the chapel, kind friends of Miami and Johnson officiating. He is survived - Bethel AME Church COSTLYJohnson members of M. Claudia wife Mrs. by a , ho remembered us with tokens : I > Hogan, two daughters, Florida her Illness 1 Ke.pchildr..ti during Of sympathy , Mae and Naomi, a son John anda I death and burial. ef+... . Mrs Victoria Harris, I stepdaughter, Codkie of Coconut ......... ... i Grove. Interment In Lincoln. daughterAnd .. SI".. fir Family ..... ,a.,. Tobe Swint of 1954 NW 6th YWII tel IN MEMORIAMIn ave., died March 7. Funeral ser- .., -- 4 ..... .. loving memory of our dar .' vices were held on Monday, mother March 10, 2 pm. at the chapel. _ - I ling ,-_... _.._-- _. ._._ I Rev N. F. Clark officiated. Survivors ... ........ ) 1' '.I . are a wife, Mrs. Lucinda ... ........., ;' i iII I Swint, two daughters, Mrs. Hat- ......... , tie lUll and Mrs. Alzone Alex- A ; sons, - , ;. and Clarence. Interment in - Pik Y Rs t I ,'4.,:',",:. ", Lincoln Cemetery. and Son JL.- H_ :_.._ _ir"_ _. Howard Aytes of 357 NW 16thst. 6570 N.W. 15th Av.. died March 7. The body was :Mrs. Lydia Jane Hill of 2340 shipped at 10 pjn. Tuesday to Shoe ShopREPAIRING ! NW 154th st, Opa Lcjcka, died at Deland. Funeral services will be THEODORE A. LIGHTBOURN Jackson Memorial Hospital on held March 16 in the chapel of ii i March 10. Mrs. Hill was among Charles Bailey Funeral who died March 18, 1948. Home. He'' i He's but not forgotten. pioneer Miamians, having come is survived by three sons, Clemon w. Savt Your Solei -While Voi I gone Nassau dur- to this country .from Limas and Howard. Watt t tI Mrs Julia Lightbourn ,rAyt ing the year 1921. Survivors are I' And Children her mother, Eleanor Thompson of Fine Shoe Repairing Nassau, two( sons, William I Shoe Shined and Oy+4 MEMORIAMIn of of the taxi daughters and other relatives. .. IN Bethel, owner one Phone PL 9 9190> companies of Nassau, and James. Chapel services will be conducted - memory of our devoted sister Tngraham of Miami, two daughters I' on Friday, March 14 at 2 p.m. Mrs. Enid Rahming and with Rev. J. N. Byrd officiating ' EDNA MAE ARMSTRONG .;. Ellen Welch of Miami, 19 grand- Burial will be held at Lincoln j" ? <\ "( I who departed this life on March I children, and others. Funeral Memorial Cemetery.Mrs. . 13 1957 will be conducted at services Willie Mae If you happen to .*. a leak. You have gone to a home far Trinity OME Church on Satur- Bailey of 3079 away JENNIE FERGUSON day, March 15 at'2 pun with NW 45th st., died at Jadkson Call me, don't watt until Where no sin can enter, no sor. 'who departed this life March 18, Rev. Harris officiating. Burial Hospital on March 10. Survivorsare next week. row dismay; 1957. She is gone, but not forgotten will be conducted at Lincoln Memorial five daughters Mrs. Lottie But I can still hear your sweet to that Heavenly home Cemetery. Mae Johnson, Annie Mae Young, When next week rtlla voice saying above. Edith Bailey; six sons, Love around, My dear, follow me. Some sweet day we long to meet Harry Jackson of 518 NW 17th Enice Men, Lillian Williams and The rain will come down. Mrs Margaret Johnson, sister her, st., died at his residence on Willie, Mack, Samuel, Joseph and And Family And share in her infinite love. March 8. He Is survived by his Robert; a sister: Mrs. Ethel Mit- And when the rain comes God knows how much we miss widow, Keola four sons and chell, 34 grandchildren. Funeral down, services will be conducted on you Tuesday at 2 I ean't make a dim.. at the fade pan First IN MEMORIAMThe \saver shall your memory( Baptist shall always Church of Brownsville Request save time, family of the late Loving thoughts CARD OF THANKS with Rev. E. 'Brown officiating. you . wander, Burial will be held> at Lincoln. And gain a dime.COOPER . ,, 1:" laid. .' !I where were To the spot you .f >f: ; ; I We the family of the late, !Rose White, daughter ? Harold Ferguson, son \ WILLIAM A. KANADY Dlnck Dean of 1201 NW 64th * is who entered into Eternal Rest st., died at his residence on March fit .' ''1 And The Family Saturday morning, March 1, 12. He is survived by a son, MHMMMHMMMMMV MW MMM > M 1958 at White Springs wish to Booker, and a daughter, Mrs. & SON i; : . IN MEMORIAMIn express our sincere thanks and Annie Lee Miazon Arrangementsare f.t appreciation to the host of at this time incomplete. :: : memory of our loving mother friend and neighbors, who remembered Roofing Company and sister, with kind expres- 'her us Angela Denlce of 1749 ......., ... ,. sad hour bereavement - "t''f< > O;' sions during our of NW 6th ave., the young daughterof f : Mr. and Mrs. Edward Fisher, 6306 N.W. 15th Ave. II I Thanks to all whom space will died at home on March 8. Chapel jjpp ',i IfJ not permit us to name personally services were conducted March Phone PL 4-7032 '"Ii; i for cards telegrams and 11 with Rev. A. J. Reddick officiating - ; florals. Special thanks to the St. Burial was: conducted at i i I John Baptist Church family for Lincoln Memorial Cemetery. , s, their floral of sympathy; Mrs \ Sd s :'Lt Selena Jackson, who put aside t > <; all her duties to come and stand ; .1 so faithfully by us. We especially thank Rev. D. '. B. Solomon Funeral Home White, Rev Carter and membersof .sA' I IRa I, Spriagville Baptist Church; -:-I' I I Bass' and Hall Mortuary for its (EetabUahed 1926) .....; ,... _..._'-- d courteous and efficient service. May God bless all of you.Becsle Dignified, Personal, Courteous Service ;il OPHELIA BROWN IIYLOR Kanady Hutchinson, who departed this life Feb. 27, 4ry ,. W' :.i ii. daughter tc Funeral Within Range of Each Budget 1957 embraces this opportunity Grace P. Rivers, daughter .acknowledge with profound gra- 1 William A. Kanady Jr., son ciousness, the kind expressions ol (: Harley Kanady, son :sympathy and courtesy afforded J us The during solace our deeds bereavement rendered bj >i1 CARD OF THANKS 315 N.W. 16th Street Ph. FR 3'1440 .... . __ and . Rev A. D. Hall, officers ,,- .ow _. - """' "' amid late members of Ebenezer Methodist CARNETTA MORLEYwho ine fANNIE y ut ute PEARL \ ELIZA E'rlf, CASH Church the Grand United Order ; died March 11, 1957 Gone, who died Feb. 28. 1958 wishes to 1 of Pallbearers; The Household of , ''but not forgottenThough thank all kind friends and relatives Ruth the Dade County Negro - ; ,' thou hast called me to Morticians Association, and our 'Who remembered us with RAPHU S. WILLIAMS resign acts of kindness! during the> death friends, shall always be many it ne'er was Wlut most I prized, and burial of beloved wife vivid in our hearts and memories. our PRIVATE FOR HIRE mine and mother.To . 0 Divine Master, grant that thine I have but yieJdod'what! was we may not so much seek to be done! the Graylyn Hotel staff, will be consoled, as to console; to be understood Thy will from day to day Francis Funeral Home, Fr. JohnE. as to understand to beloved Blend Renew It my with thine, and takeaway Culmer and members of St.Algnes' Ambulance ServiceFRanklin a* to love; for it is in giving Church, added thanks for I services rendered. that we receive. that makes Jt hard to splendid AU now The FamilyCARD Tern Cah. husband 3-5900 say, Joseph Cumberbatch, son Thy will be done OF 'THANKS Virginia Ne\\bc-ld, daughter: HAVE CASH BEFORE YOU CALL Roosevelt Morley,. son IN MEMORIAM The family of the late Alma Smith, sister TOBE SWINT And Family In sad bat loving memory of of 1954 NW 6th ave., wish to our beloved mother and grandmother - take this method to thank our CARD OF THANKSThe , many friends and neighbors, MARTHA B. SYMONETTE "A Living Service for the Living"Range along with understanding rela- family of the late, who departed this life March 17, tives, who were so kind and ANDREW BULLARD 1950 at Key West Gone but not' thoughtful to us in our hours of takes this method to thank the forgotten. Funeral HomeOSCAR and Asleep in Jesus blessed sleep bereavement. Words could never many kind friends neighbors express how grateful we are to relatives for the many cards,, From which none ever wakes to ;you. Mr. Swint died on Friday, 'etters, telegrams. flowers and ''Yo.et1p. AND ATHALIC RANGE. Owner March 7 at the home. of his son, 'he use of cm diurinj the deatht A ca'm and undisturbed repose Arthur P-\lnt. our loved one. Special thank:, Unbroken by the last of foes PHONES PL 4-7468 PL 1-1331 We would like to five a special 'o the Range Funeral Home foi The Family ,thanks to the neighbors of 6th its efficient and courteous services -. I Bernice Farrington, daughter ave. and 19th st, and the Food and to Bishop- II. Curtis 01: ,Harry Symonette, son Oscar Range Licensed Embalmer Funeral Director Fair/;Inc., for their donations. We, the Church of God of Prcvthecy: 'William Symonette, son 5727 N.W. 17th also give. f!;edal thanks to the Carver Rarchcs. May God blcs:, Six grandchildren Avenue Miami, FloridaCARDS Francis,Funeral Home. you all I Six great grandchildren The Family The Family I Key West, Fla. s .. -- ,... - MIAMI TIMES 'The People Newspaper National Library NEGRO INAMERICA recovered.the heart from which the patient ; SATURDAY, MARCH 15, 1958 PAGE 9 Week March 16-22 TO BE And there .are minutely informed I appraisals of the modern Negro - The Dorsey Memorial Branchof PUBLISHEDNEW intelligent, labor leaders and the Miami Public Library will sports figures: W E. B. DuBols YW to Send Five to join the nation in celebrating YORK The Lonesome Robert S. Albbott, Paul Robeson National Library Week from Road: The Story of the Negro's Langston Hughes, Countee Cullen . March 16 to March 22. Part in America, by Saunders I Walter White, A Phillip Redding will be ,published March Randolph, Thurgood Marshall and to Miss H. M. Dor- of individuals . According Joe Louis. These appraisals National Conference 31 by Doubleday and Co., it was sett branch librarian the library announced this week. The author provide an Illuminating will offer three official of racial programs approach to solutions 3. professor of English at Hampton during the week: institute, Hampton, Va., brings question'S.RINGWORMDANDRUf'' . Murrell branch of the Young Monday, March 17 at 7:30: pjn. into view great but little-kribwn ,I Women's Christian Association of "Wake up and Read" A panel Negroes who have given so much I Ito Miami, will have five representatives f discussion on the importance C>treading America. Among those Included - at the 21st National Trien- in the adult world. Open are: Daniel Payne, whowas born to a freedman in : house and refreshments. SUFFERERS nials Convention of the YWCA of , Charleston in 1811 founded Wednesday, March 19 at 4 pm. a the U. S. A., starting March 13, "Books and You" Presenta- school for Negroes, and went onto IT YOU HAVE.aczL DM u,R1UTTI.E MNOVORM.O NAG OTHER DANMOrTTETTER. KMOR " and continuing through March 19 tion of newer books for teenage become Bishop of the African KALP OUOTATKMM, PERMIAN WILL AJT. I at Kiel Auditorium boys and girls.Thursday Methodist Church; Sojourner roan TRAMITORY REUEr 99 THE KAUNO in St. Louis, IIaUOOIlToI AND ITCHWO. AM TOV DOCTOR. I Mo. it March 20 at 4 p.m.'Children's Truth, who escaped! her chains BEAUTICIAN oa RAAftER AROVT..DlVe.tUllrlj...\ announced was yesterday Hour" Puppet and traveled around the nation by Mrs. A. Louise 'Taylor exec- show and stories. preaching against slavery and for utive director. women's rights; and Daniel Hale Delegates from this The March 17 program will be Williams, who was the first sur- I MAtII NIIUt1u..ass.w...Ir M/ ............., community moderated by F. B. Neasman, geon to perform an operation on include Mrs. BTaylor and Mrs. Family Service Consultant. Mr. Robert Ellis, Teen-Age director, Neasman will be assisted by Mrs. Miss Marie D. Roberts, branch Geradine Moore and Mrs. F. B. chairman, Mrs. Timothy Lindsey, Neasman. Following the panel branch vice chairman, to cover discussion, members of the the young adult assembly, and Friendship Garden and Civic Burnetta Sands Y-Teen. Club will entertain all persons DAY attending the program.. Mrs. Ann They will be among the approximately Coleman 1 president of the club, 3,000 women from will serve as official hostess for the more than 1900 YWCA unitsin the evening. CLEANERIN the United States who will bespeaking for the total YWCA The teen program will be con- members-hip in this country on I ducted by Miss Mary Farrell, BY 10-OUT BY 5 the formulation of YWCA policy ATTY. L, E. THOMAS young people's librarian of the for the next triennium. Theme of I Miami Public Library and the the 1958 convention is 'Deep YMCA MembershipDrive children's hour will be directed Roots and World Reach." Duringthe I by Mrs. Rose F. Byrd, assistant PANTS past several months local OpensThe librarian at the Dorsey branch. YWCAs have reviewed the con- vention Work Book:, based on this AH programs held In the library - theme, and delegates have been official opening of the '58 100 NW 17th St., are free prepared to discuss the major Membership Enrollment of the and open to the public. issues of the convention Including George Washington Carver "Visit your library Wake up a new statement on the YW'a Branch of the YMCA of Greater and Read." : 5D family life program, a peace Miami is scheduled for April 7, statement and the Public Affairs Judge L. E. Thomas, chairman of program. the drive announced today. The theme of the Metropolitan The convention program, according - to Mrs. BTaylor will emphasize YMCA Membership "Enrollmentis (kv a d4ac&t'1XitaaRey .- 'IShoot The Moon. the needs of individual The six 'yt branches of Greater Miami FULLY INSURED , members and of the local YWCA, as an organization meeting com- will be in competition with each $ . munity needs, in the light of the other, as each branch attempts to f. ., world setting. get to the "Moon" first with Son Cleaners members, according to Atty. Opening session of the conven. Thomas, Wing Commander of tion will be at 2 pm. Thursday, ship -G-W-C-Y-l" We build according to March 13, with Miss Lilac Reid 1047 N.W. 3rd AvenueOpen Barnes, national YWCA presi- The Carver Branch Organization your plans or our dent,first presiding principal, and address presentingthe of the Thedford consists Johnson of three, groups.Dr. G.Rev.W. No down payment Dally 6:30: a.m. to 7 p.m-Sat. to R p.m. Clo.ed Sunday Hawkins and Dr. Edward J. week4onzpuley.( "Our Deep Use lot _ Roots" is the subject of Miss Braynon Jr., are Group Com- your Mggj Mg M nnnM na0HHHHMBBBIHOHHn| BMBBIH Barnes' address. manders. The names of the l& l1 7 Squadron Captains and Space tJ1J L.p Lnaoa Other leaders in religious and Cadets will be announced at a fit ) Q national and world affairs will later date. !! ( In Fine WliislteijFLEISCHMAWS 1 speak on various facts of the convention 100% FinancingNE theme. They include Dr. I Buell G. Gallagher, (president af "Rhomania"Friday 5-6171 City College of New York whose subject Thursday night, March 13 March 21st Q n.ral Building Contractor will be 'The World and Us", and 1121 NW 29th 8t, Miami Dr. Hadley Cantril, chairman of B. T. W. Auditorium the 'board of the Institute for In. JSTHEB1JYfk ternational Social Research, -- -- I Ia Princeton, N. J., and Dr. Marion Milliard, outstanding woman doctor a vice president of the "Y" . Canada, and author of the best FIRST IN COCONUT GROVE ., E4T seller, "A Woman DoctorLooks at ,S"," "t i Love and Life," who will partici- '' ."., ' 1 pate in a panel discussion on Friday < 1\ night March 14, "Under Brand New Airy Apts. ",, ,ii:., ,, >: ; standing ture." Ourselves in Our Cul- ;,f"v" ..;:r: ;,r ; " ( ,;:, i At the convention dinner Sat- ;' ", "I urday night March 19, Paul G. ,, , Hoffman, corporation executiveand FURNISHEDFREE international affairs expert: _ will be the principal speaker. Dr. Zelma George of Cleveland, Ohio, singer, sociologist and leader In ELECTRIC work with young people will be featured at the dinner. WATER " ) / ro raeorILIMO1D Dr. Edwin T. Dahlberg, presi- GAS dent of the National Council of Churches, will ;eak Sunday night March 16, preceding the " '. statement.presentation of the YWCA'j peace W$1151Y ' 'N' +1J..IlI The report on election of new ' officers for the National YWCA NO! DEPOSITS "',' win be given Tuesday morning-, March 18. ,',' MOVE RIGHT IN ,. t $2.93 Pint ;. FOR SALE is WHY! 4-Bedroom 2 Bath 90 PROOF 2 Car Garage Home _ TO KEEP PLACE MANAGER LIVES ON PREMISES Only FIdsdunann'.has more Proof-90 Proof- J compared HARDWOOD AND with all other leading blends. They are only 86 Proof. TERRAZZO FLOORS, ORDERLY AND CLEAN f' Fkischmann'i Proof means more favor-more enjoymentmore satisfaction. And-FleUchmann'i surprising mildneu - Cor. 67th St. and and exceptional smoothness UU you that you're getting 24th Ct. the highest quality in every bottle.That's why Flefcchmann. 3201 Douglas Road offers you so much more than any whiskey fa America. Open Sun. 2 to 5 or , Call JE 1-6973 ': BLENDED WHISKEY 90 PROOF 65% GRAIN NEUTRAL SPIRITS I THE flEISCHMANN DISTILLING CORPORATION NEW YORK CITYmE /,. i'" i.I 1 . - - -- , Highlights of North Sooth Golf Tournament - ..... Cola," the champ replied. "Nine By MOSS H. KENDRIXI six 100?" I asked. "No 80" j ty or , picked Up the telephone . struck back Mr. Louis. Those days I' NAACP one of my bosses was calling are about gone forever, Joe. Sor- Miss. to Probe "Who's in the tournament?" be ry, everything used in the pro- asked, "I'd like to come out and duction of Coke, from water watch some of, the play.. through boor to sales taxes, has 1 JACKSON, Miss. (ANPt gone up. Product tried hard to THE MIAMI TIMES "The People Newspaper"PAGE "Well, let's see . There's Joe The Mississippi Senate early last - Louis and Me, Jackde Robinsonand hold the price-line, but couldn'tSalutes week adopted unanimously a 10 SATURDAY MARCH 15, 1958 Cans'Dick Me . The Chicago are in order for Ray and Me resolution calling for an intensive "Nite Train" Layne , and his fine tournament committed - some look-a-oners like Nat Cole, Miami's Dr. Ira P. investigation of the state chapter Cab Calloway, Frank Robinson Davis! Mrs. Ann Lindsey and qf the National Association for of the Cincinnati Reds and lots of Hurt Jackson, Ted Jones and Ray; the Advancement of Colored business and professional people Colas of New York, and all of the 'MW from the cold, cold North, who people in the city who cooperate' People. gal here just in time llyoF1 revs'weatherwlse" yearly in this wonderful golf Condemning the NAACP as not that Florida is promotion. Roy Campanella gave dedicated to the best interest of biggest golf trophy ever seen by the Negro or the White race, the Certainly, I should have added the writer no bigger than the resolution, which was sent to the that promoter-pro Ray Mitchellwas heart of the donor, however.Other House for concurrence, requeststhe there, with the Boss, Mrs., General Legislative Investigation - and secretary-daughter Beverly, trophy donors, to name a Committee to make the all Just as happy to be out of few, were Jackie Robinson and study "in an effort to determine chilly New York City aj w a s his Chock Full O'Nuts, Joe Louis their (members and directors) everyone here that resides: north and the International Boxing means, methods associates, affiliations of Jacksonville. This was Ray'a Club, Nat Cole, and The. Coca- and ultimate objectivesIn 5th annual North-SotMth Winter Cola Co. the state.Meanwhile. Tournament, the weather was The boss enjoyed watching the .,M '!'3. "wi ? r..y' fine and the Miami Springs Country : State Sen. Stanton i ro a'w r -s l.a. I play. got nothing but the fun Club was In top shape. of playing. Hall of Hattlesburg, chairman of Dignified Living at its Beat Out of the tournament came the Investigating committee, attempted - come fine chamfclons Charlie to attach the Communist CAROL ANN APARTMENTS Sifford, the Phllly pro, took first A Battle of SongsThe tag on the civil rights organ 14100 N.W. 24th Court Op Lock Fla. followed by Ted ization. He said that some of its , place money annual contest of songs between FURNISHED OR UNFURNISHED., Rhodes, St. Louis, and Herbert directors have records of subversive Dixon, Miami, in that order. Joe Greater the Bethel Gospel AME Church Chorus and ol activities. I' Bedroom and 2 Bedrooms Near Kwlk Chek Bullet who The NAACP is NOT on the Tile Baths showers Roach, Miami boy, stopped choir No. 2 of Mt. Zion Baptist Playground Louis before out in United States Department of in St. staking Church BONDED COLLECTION AGENCY will be held this year at Los Angeles, successfully defended Mt. Zion on Thursday, March 20, nitice's. subversive organizationlist. Phone MU 8-0617 Agent on Premises his amateur title, edging out at 8 Or Call Downtown Office FR 3.8418Our p.m. : Henry; Baxtdn, Los Angeles, and Both The resolution was authored by Clifford Town, Cleveland, who groups are sparing no Sen. George Yarbrough of R e d i pains to make this a gala occasion. Banks He came in two-three. Miss. said the state Come and enjoy this musical American Legion convention had Miss: Myrtle Patterson, New extravaganza and vote for adopted a resolution requiring York hotel owner and businesswoman your favorite choir. Admission js such an investigation. Classified Columns Get Fast Results became a three-time free, winner of the tournament when I she out scored the large numberof I CHAMPIONS: AND CELEBRITIES AT women entries and beat her RAY MITCHELL GOLF MEET closest competitors Miss Myrtice __ Mclver, Dayton and Mrs. Alice , fHEtt' Stewart, Detroit. The women's lfifY1 ,1 yt't'p {F rj 3 Ii first flight was won by Miss Ea- ron Floore, Cleveland, with second : , flight honors going to Miss . Daisy Gorham, Nek York City. Dr. Clarence Hilton, Newark, came ahead of Atlanta's 74-year- i old Dr. H. M. Holmes, who planed f,1 f i>Ea 3M'go' efe sl 1 second in the senior men's di- r vision. Now the secret is out - people saying that Dr. Holmes, I, who never plays a tournament without winning a trophy, can't miss as long' as his ministersonthe Rev. William Oliver Holmes, walks the holes with him. Takingup golf after fifty, Dr. Holmes 1 swings like a teenager.I 4 r k enjoyed the sun, (!on't ask my 1 , score, but my happiest experiencewas rKoo , 4 ' ; I II to have a lady golfer Intro- -k a' 4 a a I II duce me to her young ton hold trig the clubs she bought him Y after- seeing my ten-year-old tot, Alan, play in the UGA last sum- s' w ,F: a mer. Several other players told + me that they had gifted their g kids with clubs last Christmas. We'll be watching this new. crop of young golfers. Saw Joe Louis after his qualifying - round. Score? "I shot the wholesale price of a case of Coca- Ray Mitchell's recent 5th. annual - North-South Winter Tour nament was quite a success! , bringing to Miami some of the . f outstanding names in sports, en- { tertainment and business. I J Above are some of the well- , known persons participating in the tournament and its gala ac tivities. Photo (1) shows beautiful Sara Lou Harris New York model-radio-TV star and internationally -, known fashion expert, extending congratulation to Charlde Sifford, Philadelphia pro, who placed first in his division; (2)) Nat King CoJe conx.limenu Ted Rhodes of St. Louis, who was runner-up to Sifford, center; NY banker and businessman William Hudjins, left, salutes tourney II I promote Ray Mitchell; (4) in behaOf of Coca-Cola, Moss H. A,tl + Kendrix, Washington PRfirm head, awards trophy and chest to women's winner, Miss Myrtle Patterson New York Citv hotel operator; ((0)) Amateur championJoe , Roach poses wEd!'! .ra 4s, retired New York restaurant owner and businessman, who gave giant trophy donated by Roy Cacnpanella. in foreground Is 1 trophy given by the CocaColaCo. .; and (6) Just, players, a foursome from Washington, Dr. Charles Ireland. Moss Kendrix, Dr. A. K. Roberts, and Dr. Roberts . and Dr. Robert Lee. Naturally there were trophies and baiting. beauties, too. See "By My Guest," Moss H. Kendrix. I .. . . Professional THE MIAMI TIMES' "The People Newspaper" Between The Lines. Social Groups Security Under I SATURDAY, MARCH 15,1958 PAGE 11 The 1956 amendments to the the same time as the other forms make sure to show hU social security STEALING OUR Social Security Act brought lawyers that are filed as part of the Fed. account number so that ho STUFF dentists, osteopaths, veterinarians eral income tax return. may receive proper credit for his Kixnfoall Young the great socIologist chiropractors, naturopaths As a participant under the old. payment. Failure to Indicate the tells us that jazz and and optometrists under social age and survivors insurance pro.. account number may result In no blues are music Just as surely as security. They are now, for gram Mr. Blonston added, the credit and may mean loss of future . grand opera. There is the temp- the second year, required to pay professional individual is purchasing benefits. , tation their social security tax along insurance protection to glorify grand opera and deride Jazz, but according to with their Federal income tax re- against the loss of income to him I Where the taxpayer does not Young there is no basis' for such turns. This announcement was self and his family caused by retirement have an account number, he difference in music evaluations. made today by Laurie Tomlinson, due to old-age and such should obtain one from the social District Director of Internal Rev- misfortunes as total disability or security district office so that it Where hundreds or thousands enue for the Florida district. death of the family breadwinner.When ds available at income tax filing enjoy grand opera, millions en- In conjunction! with Mr. Tom- one of these hazards Is incurred time. Questions about the filing Joy Jazz; and when it comes tc linson's announcement, Edward and the participant or his of tax returns should be addressed . popular appeal, that of jazz and P. Blonston, district manager t>f survivors otherwise qualify, to the Internal Revenue Service the blues is greater by far. This the Miami (North) Office of the monthly benefits are paid to replace . writer has been tremendously w Social Security Administration in part, the earnings that impressed with the volumes oi ---- pointed out that, since the exten are lost. jazz and blues that come over sion of coverage pf these profes- Mr. Blonston and Mr. Tomlinson HARLEM SQUARE radio and television. In fact these .4 Oeia Gordoa D. Hancock sional self-employed persons, both emphasized the law is have almost a monopoly of our they are now building the same compulsory and applies to all SWEET SHOP; media of the air. kind of insurance protection for self-employed individuals, with band passed, "Mr. Bandman, puta themrelves and their families the exemption of doctors tf med- A FULL LINE OP GROCERIES What is doubly impressive Isthe little more swing in It." She that the FederaLlY- erated system icine, if their net earnings COLD CUTS COSMETICS fact that jazz and the blues was up in years but she wanted has afforded most other self amount to at least $400 in the are Negro creations and the white more swing. employed individuals since 1951. taxable year. They also pointedout 208 N.W. 10th St. music world have gone wild over And so in music and dance the (Mr Tomlinson stated that the that the taxpayer should them. When Negroes rflst played Ls law was effective with the first country stealing our stuff to jazz and Handy first wrote his taxable year ending after 1955. .. -" say nothing of our humor which blues, little did they think that Lawyers, dentists, osteopaths, Negroes popularized on the stage. creations.the world would rave over their The point we are making here is veterinarians, chiropractors,, naturopaths I, f" um-OOMMUN-' that the Negro has something to and optometrists who I But today the' whole world is offer the (world and something the file their Federal income tax returns - wild over jazz and the blues and world can use to advantage.If on a calendar year basis g DRUG STORE are required to a selfempl what pay - is the world is more becom- we take out of the worlds yment tax on their net earn- day. When the of dance and music the Negro edayazz Negro'screations wro and the blues there would be considerable ings for each calendar year after COR.' N.W. 15th Ave. & 68th St. he was making a substantial con impoverishment. Just as 1933 if their net earnings tribution to the cultural life of the Negro has made his contribution amounted to $400 or more In a PRESCRIPTIONS CAREFULLY FILLED \ the world. through his second-class year. The SE tax rate for 1957 Say what we will the world citizenship, he could have made $4,200 is 3-38] of percent net on the first Cut Rate Drugs Free Delivery I earnings. This other and I greater contributions loves its jazz and its blues andit amounts to a maximum of $141.75 COSMETICS GIFTS HOSIERY FOUNTAIN SERVICE through first class citizenship.It I - Is difficult to imagine what the I on $4,200. These taxes are in addition 8EALTEST ICE CREAM-MONEY ORDERS-LIGHT BILLS world would do without them. In II Is highly !(probable that had to any income taxes that very fact the world has stolen : this nation used to its fullest ex. you have to pay. Schedule C, Phone PLaza 8-4703 Phone Plaza 84704C. the Negro's stuff; even in the tent the scientific genius of its ,Profit (or loss) From Business or deep South where the Negro's aspiration Negro citizens the Vanguard I'Profession, must be properly M, JOLLIVETTE 8R-, Prop to public esteem Is would long since have sped into completed, including the Sched- spurned, they are rocking with its spatial orbit, instead of Ian.gubhlng |ule SE portion, and submitted at the Negro jazz and crooning with on the sands of Florida. __m___ ______ ---- I hiJ blues. | JijJ' This country cannot afford to leave unused the Negro's gifts and Nothing could prove more con- talents. clusively that races like indivi duals cannot live unto themselvesbut Just as the country has stolen +a2M6t ' must share life with each the Negro's stuff in music and w. ( other. dance, it can use, without stealing . the Negro's several abilities Not only is the nation and the that would help our nation to become world stealing our music stuff a more mighty nation.In _ but they are stealing our dance other words, the country t kJ S V ( stuff also. The current rock 'n roll does not have to steal the Ne V < __ rage is a Negro creation and Its gro's stuff which can strengthen literally sweeping the couatry. It our defenses, the Negro freely , s 6 a (j4' a, ;. can in truth be aid that Elvis offers his all, and all he asks is $s 'kV Pressley is a Negro creation be. full citizenship. Stealing the Ne ,; + f cause Negro music made him also gro's stuff. y 'S V fling Crosby with his crooning. ;: t ::k : The Negro's dance no less than _ his music Is sweeping in its ap- yryrw , peal. What about the Big Apple ELNORA and the Susie Q? What about the Charleston and the Black Bottom SUNDRIES and Trucking and synco- t pated music in general? Tap Headquarter for your dancing is a Negro creation popularized MIAMI TIMES If you live out , by, the late Bill Robin Brownsville way ? / 4J Y: son. WOMEN'S AND MEN'S HOSE - _ WE SERVE 4 The Negro has made an Indel- Foremost Ice Cream ible Impression on the dance life and the music life of the nation Phone NE 4-9441 and the world. Swing music hath "IF YOU CAN FINDA its almost universal appeal. Some 4338 N.W. 27th Ave. yeans ago when the Elks met in St. Louis I remember quite well J. FINCHER, Mar. their spectacular parade. The Indf writer was among those standing along the parade route and the BOURBONZa.BUYIT' colon were flying and the bands BETTER were playing triumphantly. JOIN THEY. Standing near me was as old lady who seemed to be around 85 M. C. A. TODAY.JAMES' . . or 90 and she yelled out as the -. .- - I 4 -I 5 &: lOc STORE ,. . 1200 N.W. 3rd Ave. Phone FR 3-9481 ... .. JI r .J ,J'1<) ,1);, ',' 'r," :: '" {I \ ' :, . . , ," .j. \ ' : q f ... '... " # J I' "Easter Is Near-April 6-Lay Away Now!" ;:;.., .' V' r ,M"': :. : ,. , : ( Easter filled Baekets .50.2.50 Bays Socks pair -29 .' .. " Easter Dresses 1JS-2JS Boys Long Pant pair 1.00 Bouffant Slip N. 149 Boy Shirt .. I.....-. 1.89 Easter Hats ___'___ 1.4. Boy Hats .._._........ 1.10 and alone, make every drop of Ancient Age. Whaf more, Ancient Ago Lbourbon made In one We we Hat & B9 Set 129 Boy Suit, 2 pc*. ....... 1.00 the distillery In Frankfort Kentucky, in the heart of the treat country.We . Pocketbooks .__ .48 Dow Tie ___.,.* N. 89 place only, at original and Ancient bourbon. That'. why, the distinctive Sock _,. .- "'. pair' & Baby Diaper Set ?*.._ 49 use bouquet bourbon Is the came...bottle after bottle.That's why Ribbon ..?._.__ yard M Baby Shoe ..._....._. .49 {ute and of this superb Bourbon in America Cotton Dresses ............ 1.00 Baby Bonnet .............. 1.00 Ancient Age is the largest selling six year old Kentucky Straight I Panties' .._.-._- pair .23 Baby Dresses _.............. 49 Kentucky Straight Bourbon Whiskey 6 Years Old 86 Proof Ancient Agt Dist Co, Frankfort Ky. "KEYS MADE WHILE 0 YOU WAIT" ourIJon Simplicity oattern Money Order Sold Every Day Jldelse Mon. Thru FrlS 7:45 .m. to 7:30, p.m/ Sat. till 930 p.m. Cloud Sunday MIAMI TIMES "The Peoples' Newspaper" MT. CALVARY BAPTISTRev. MT. CARMEL BAPTIST GREATER NEW BETHELMrs. PAGE 12 SATURDAY MARCH 15,1958 . I I E. M. Thomas, pastor Rev. D. A. Bradley, pastorL. R. Conley, clerk Oretha Holder, reporter R. Smith. reporterYe Rev. W. K. Smith, pastor O give praise unto the Lord, are the salt of the earth, Sunday School opened at 9:30: for he is good and his mercy en- but if the salt has lost his sav- a.m. with Deacon Thompson, the dureth' forever, in remembrance ior wherewith shall it be salted? assistant superintendent, officiating - of this passage of the scriptures> It is thenceforth good for nothing, Taught to 8 classes was the the services at Mt. Calvary began but to be cast out, and to be subject, The Church's Influence at 9:30 with the Sunday trodden under foot of men. on Society. The attendance banner - School with Bro. G. Mann, sup Today's. service begun with an was rewarded to class No. 3 erintendent in charge. inspiring Sunday School lesson, and class No. 8 was rewarded the 91 I The morning's devotional service "The Church's. Influence on So- offering banner. The high point was called to order at 11 with ciety." of the lesson was Rev. A. S. King. Robert Stephens and Johnny A soul stirring message was The morning service was con- Nichols in charge. The morning's delivered )by Rev. Bell of Oakland ducted by. Deacon G. Butler and me-saje was delivered by the Park. His text was found i Jn Deacon H. L. Walker. pastor, found in St. Luke 8:2: second Timothy 4:7: "I Fought a It was a great honor to have M subject, "Let us go Over to the I Good Fight, I Have Finished my a rostrum full of visiting ministers - rc+ I oi. Other Side." The sermon was well I Course, I Have Kept The Faith.' namely, Revs' Byrd, A. S. delivered and all seemed to have The spirit of the B. A. U. is King, the Missionary of the Sea i. ; 1, I. .I 1 been touched by the holy spirit. flying high, we Invite you to Joinus board Baptist Association and The pastor received five persons at :5 o'clock p.m. W. H. Edwards, pastor of the as candidates for baptism. The evening message was Bethel Bsptist Church of, Dania Sunday night an inspiring devotional brought to us by the pastor. It also the moderator of the Sea- service was held, with was delivered with vigor and board Baptist Association, also soul-stirring strmdna. His text was taken :fromGenesis present were our own Rev. C. prayer and uplifting - hymns. Rev. Stephens came 1914. McClary and our pastor, Rev. W. EBENEZER METHODIST FIRST UNITARIAN before us with the night's message We are all looking forward to K. Smith a splendid Men's Day program on The senior choir No. 1 deliver subject "Three Powerful I. On Friday Saturday and Sunday , Rev. A. D. Hall, pastor - Laws." After the the fourth Sunday in this month ed the song service and Rev. Ed- the March 14-1 delegates from sermon Ernestine Hantrick, reporter , 14 Unitarian Fellowships and four pastor was able to bring in four We invite friends and visitors to wards delivered the message as. Services Sunday was very in- churches in Florida will attend more to the Christian family come !in and worship with ut. it was rendered to him spirational. Rev. Hafl delivered a the annual meeting of the Flori- The Junior church was in Words cannot express what your it was revealed to him :from there heart stirring sermon entitled of Lib 1 presence means to us. You 17th chapter of St. John and the very da Conference era charge of the services for the day. \ "As Jesus take his Unitarian-Universalist always welcome. first: verse. He pointed out the we see Churches ( ) After the service the: SrmfhlanH last Journey through Jerusalem.", and a Leadership Development Singers, rendered- a -Ih r.p;' : sweet characteristics of our Sa. Six babies were baptized as Workshop, Jointly sponsored by I gram in behalf of the rally. ANTIOCH BAPTIST vior Jesus Christ, which showedthe Sunday was Infant Baptism Day. the Conference and the General In our prayers let us remember readiness. to always do that In the evening we were happy Alliance at the First Unitarian the sick. And our friends we Invite Rev. O. W. Foster pastorA. which pleased his father in to have the Rev. E. J. Sheppard Church, Dixie Highway at SW 29 you to worship with us, you L. Johnson, reorter Heaven. He declared .that the and his congregation from Kerr road. Three administrative offi- are always welcome. statements of Jesus, asking his Memorial Methodist Church, Per- cials of the American Unitarian Worshiping/ in unity with the Father to let this cup pass from rine. His sermon was entitled Association in Boston will participate. ! Shiloh Baptist Church, Sunday me f possible, but not my will '"The New Birth." School was timely, with a very but thine be done was a symbol At 8 pm. on Friday, Royal 11. ST. MATTHEW BAPTIST interesting lesson, subject, "The of how humble our master was, The song fest between the two Cloyd executive director of the Church's Influence on Society." and that we should exemplify our , Rev. N. F. Clark choirs of the church proved: pastor lives very Adult Education program, will The devotional service wasirltually accordingly to his precepts. successful. The church was full, give the keynote address. His Rev. J. E, Monroe, reporter high throughout the and the music was beautiful.. Both topic; "Toward Dynamic Leadership" Rev. Harold Brown, clerk day. Antioch ushers No. 1 and the Evening hymn service was choirs and Rev. Hall express male chorus served during the conducted by Deacons Lovett and the conference On I will be Sunday, March 23, the men great gratitude to those of you I theme. of St. Matthew's will morning, and: Rev. W. F. Thompson Deacon Clements. The senior who helped to make this affair a I Mrs Nelson A. Burgess, exec- their first Annual Men's sponsor Day. preached a wonderful serm- choir No. 2 rendered the Ion g success. Choir No. 1 reported utive secretary of the General They are trying to make this a mon taken from St. Luke 15:17: ; service.A . $248.68, choir No. 2 reported Alliance of Unitarian and other great event and subject, "Find Yourself." spicy message was deliveredby : are, taking this $250.75. At 3 the Rev. W. M. Mason Rev. A. S. King on the theme: I I liberal women, will open the Sat opportunity; to extend pm. a special S. U. B. No. 1 invite you to attend urday session at 9 a.m. with a invitation to the people of Miami preached another great sermon The Son, so Much Better Than their St. Patrick's Day talk on "What Are Our Goals?" and Dade County to be their in behalf of the BTU. Thesubject Angels. The message was a reve- Frappe Sip in the basement of During the day workshops on discussion guests. was, "The Presence of lation from the 1st chapter: of the church from. 4 to 6 p.m., Sun- leadership, formation and God," taken from St. Matthew Hebrews and the 4th verse. Rev. day, March. 16. conduct of committees, religious The Rev. N. F. Clark, Rev. II. King related the ma-gnlficient 283.At The men of the church are very education, church finances, youth Brown and Deacon Smith are evening worship Shiloh's No. qualities of the name of Jesus. busy setting. tile in the church, and young adult work, publicityand sending out special invitations to 2 choir rendered music: and Rev.E. Stating a few as being King of getting ready for the new pews adult education. Browns, Clanks and Smiths, and D. Dennis brought the message Kings, Lord of Lords, Chieftest The women of the church are so 7:30 will include guests will have special seats. taken from St. John 1:1: ; subject, Among Ten Thousand, Son of a proud of the men. Rev. Hall is all The banquet at "Stay In the Word." Living God and the Sweetest of smiles now and is showing an a and panel Playing discussion Certain on The speaker for the 11 o'clock Our visitors and friends are always all Jesus Christ, the Good Shep- expression of gratitude to the "Living service ard. will be our former mayor, welcome to worship with a' Roles Hostile Environment. men for their kind deed in In A delightful they are Panel members will be Mr. Cloy our opinion, the best mayof us. after service pro- doing Miami ever had, the Hon Abe gram was sponsored by Sister The rally is nearing its termination Mrs. Burgess and the Rev. C. Aronovitz. We are honored to Maggie Adams for the purpose . Rev. Hall Leon Hopper Jr., executive direr have ST. of raising finance urges you to this noble gentleman to MARY'S W. M. for the Women's - tor of the Liberal Religious Youth continue to pay each week on speak for us, so we are Inviting Day program. organization The Liberal Religious Mrs. S. Dawkins your assessment. all who reporter We acknowledge the presence I\'I Youth ,group will hold saps hear him.possibly Service can to will come begin and Rev E. A. Culmer, pastor of those of you who come to worship ,I rate workshops and social activities promptly at 11 am. Thank Sunday School began at the THE INCARNATION well discussions with you ( with and as as usual hour invite you to wor-1 in advance. with the superintendent ; shife with us always. / I I Rev. Hopper. M22 Miss Marva Trotman, in: FT. E. S. Clarke Jr., vicar The conference will be Thought for the week: "Man's'' con. charge, and the teachers at their Veronica O'Berry reporter eluded on Sunday with a business life does not consist in the abun- posts. dance session at 9:30: ajn. and the 11 SUNDAY of things he Marsha Johnson acted possesses. as sec o'clock church service. Rev. JohnC. TEMPLE BAPTIST retary. The lesson was reviewedby Church School and Adult Bible Fuller, minister of the Unitarian Rev. L. the pastor. Class ............................ 9:30: ajn NEW MT. MORIAHRev. Church of Orlando, willpreach A. Thompson, pastor Services began at 11 ajn. with Solemn Sung Mass and A. L. on "The" Warp and Woofof :Among the adults given birth the pastor in charge. He preached Sermon! .............?..... 11:00 a.m. Shipp, pastor Freedom. St. Michael's Guild ....... 5:30 Doris L. Hayes day honors for the month Sunday from Joshua 24:14.: Eeveryonewas : pjn reporterWe : In the Episcopal Young Churchmen Sunday School wree Mrs blessed. No. 2 choir rendered - cordially welcome our many FRIENDSHIP BAPTIST Augusta Newbold, superintendent music and No. 1 ushers board Unit No. 1....... 3:30 p.m. visitors to worship in aU our ser for 20 years; Mrs. Vernell Stra- served. One Infant was baptized. Solemn Evensong and , vices. Sunday School had a large Rev C. J. Burney, pastor chan, pianist for 15 years; Mrs. The 7 pjn. devotion was led by Sermon ........................ 7:30 pea attendance. The topic was, "The Claudia Wilson reporterWe Margaret Munnings, Mrs. M. E. the pastor. He then turned the TUESDAY Church! a Influence on Society." Stevens Mrs. Agnes Burroughs meeting over to Albert G. Bain Acolyte practice ......_.._... 0 p.m. The .background of the lesson was are thankful to our God for' and Mrs. E. Dtlancy. Eight who presented Ralph Basden WEDNESDAY Judaism had dealt with social His way in keeping us, and allowing youngsters cake." baritone soloist in recital. Harold> Low Mass ...................... C30 p.m. problems as best it could by the Holy SUrlt to dwell I. This "sharedFriday( ) the. women Higgs, violinist with Mrs. U. Evensong, meditation _.. 8 p.m. means of applying the law, with within our hearts so deeply. We are sponsoring a supper sale ''Higgs at the piano and No. 1 choirrendered Confirmation Instructions for Its application dealt with the effeci had a wonderful Sunday School Ion the church ground. Friends music. The No. 2 ushers Adults rather than the cause. A de- lesson which was conducted by are invited. served. THURSDAY Datable question was aiflced by the our Our superintendent devotional ,services Deacon Ross. I. I Sunday, March 23 will be Men's' St. Mary's Choir Guild class and was discused by the wereso The number 2 ushers boardwill e Day at St. Mary's. Their filled with the Holy Spirit, princIpal Rehearsal .....?...._M 6:30: pjn pastor. speaker in present its anniversary program the morning will FRIDAY Alone with the Morning devotion was high morning message and fashion review on be Lester A. Albert, and during Stations of the Cross 7:30 which l : delivered was Rev p.ts, by spiritually. The Rev. McDonald, Easter Monday. the evening, J. R. Taylor. St. Cecelia's Choir Guild visiting minister of the Lang. Text St. John 16:33: ThemeWha services will be held A dinner sale will pjn. city, delivered The usual be at the Note: All Masses on all t the world has for Saint and an inspiring message on what the Lord has for you, and on Sunday. At 3:30: .pjn. the Will church hall Sunday, March 16. Holy Days .-......._._.._ 8 a m4 you. the subject, "Mookn 'S." ing Workers' Club will give a tea All day to help the men raise Our pastor delivered the evening I at the home of Mr. and Mrs. Rob. funds For orders call Mrs. Re TRINITY At 3 pjn. choir No. 2 celebrated message, text. Gen. 1:26; ert Hudson, 1521 NW 1st court.A becca Builard, NE .....023 or Mrs. WESLEYAN its 12th anniversary. Thanks theme, Let us Make Man. Both I spicy program has been pre Sophie Dawkins, NE 5-1991. Do. Rev. George E. Johnson, pastor to the various choirs and gospel messages' were delivered with pared. Friends are invited.METROPOLITAN nation: $1.00ST. Mrs. Phyllis Andrews fingers and friends much and believed to have reporter of the city (power 1 Sunday School _.. who appeared on left a thought resting on ?-,9 un. the program 1 In our Morning worship __ .. ._... helping to make it! spiritual and minds that will help us to live and I PAUL A. M. E. Young People's Mating 11:00 successful. determine to do the will of our A. M. E 5 p., saviour. Our BTU was held at I Rev F. E. Snead, pastor Evening worship devotional 5:30 p.m. The No. two choir rendered Rev. H. M. Salmon. pastor M. Braynon, reporter NEW BETHEL BAPTIST service was consecrated with music for the morning: The Services are expected to be The C. A. Gibbs Club will cele 1571 N.W. Mth Ten, {prayers and warm hearts. Ohoir No. 1 choir rendered music for the brate its fifth anniversary dur- Rev. both and Jones high, spiritually morally 9" . pastor No. 1 the ing o' sang God's morning praises and worship evening. The No. two usher and throughout the day, beginning Sunday School usher board No.2 served. Rev. our little Juniors were in chargeof with Sunday School at 9:30 a.m. celebrate Stewardess Board No. 2 will Horning pzi.s: ,a. Shipp taken delivered a glorious ser- the day's work. All of our under the superintendence of with its 18th anniversary Evening' wonhlp ...............?. 7:30. from ? mon St. Luke 5:3 a program at 3 : visitors ; were welcome In our pjn. Sun- "Orders to Move Out." This inspirational vice Come to Friendship 1 Mrs. Celia ,Day. I :iav, March 10 Yotl are Invited. GRACE 'message was well re- a warm welcome awaits )' ser./et/ Two delightful sermons have I .,All AME.. ministers of the PRESBYTERIAN ceived. The evidence of the Holy! all times. I IBAHA'l been prepared for our spiritual -- ,* ""r "1"t-d : Rev, James Culmer, pastor ,Spirit kept pressing on. enrichment by our pastor. Ware ',! Monday March 17 at 11 Sunlit Eddie Edwards clerk "* certain each heart will be I St. Paul. This meeting is cailec, Sunday School __ 9:30 ASSEMBLY uplifted by his sermons. Muni ic ., u,,,unize the A.M& 4finte: t t1 :;:* am. Freedom" will be rendered throughout the M'tence.Htvc:! horning worship _..?.?,,,? Uoo, *Tb. Warp and Woof Mrs Emily Bethel, chairman of day by choir No. 2. .. vu visited the "'('lie? H Westminister Fellowship .... fl pin* GUM SpeakerFUv. the local Spiritual Assembly of r. T Christian duty to John Fuller of Orlando the'' Miami Baha'is, will speak on All members are urged to keel 'XT those who are ill and remem shut- ST. FRANCIS XAVIER Sunday Service M.nMWMMMV. "+'n0 'The Highest Law," 7:45 p.m. in mind the Family Rally that I n. If you can't visit send Church School .-?.??. -.-.._.1040 Sunday, March 10 at the Baha'i 1 will terminate the fourth Sun I a card. N.W. 4th Ave and 16th Terr. FIRST UNITARIAN CHURCH Dixie Hwy. at S.W. nth Road !races and faiths are cordially in- forces and make this rally MASSES I a vited. huge success. Drive Carefully! Dally -_..__.............._. g 1.Da.. Sunday .._??? 7 am. & 830THE am- -- ..,o ,....-:- -. t P 1 1I District Laymen in NOTICE UNDER FICTITIOUSNAME THE MIAMI TIMES 'The Peoples Newspaper I LAW GIVEN I SATURDAY, MARCH IS, 1958 PAGE 13 St. Paul MeetOn '. NOTICE IS HEREBY I that the ,undersigned, desiring to - February 23, the Miami .. engage in business under the fictitious - District Laymen meeting was name of SLICK CHICK,, MONROE MUSIC HOUSE Personal MentionMrs. held at St. Paul AME Church, at 1033 NW Third Ave., In the Music I Everything in Gospel Rev. T. C. Kelley, pastor. The ray City of Miami, Florida, intendsto Sarah Mae Rahmings and for the church. Also register the said name with Everything son, George, are visiting in the meeting was opened with devotion - of church furniture, Baptist stand Bahamas, where they are in attendance the Clerk of the Circuit Court led by Bro. Members First ard hymnals, AME hymnals. 242 at Nassau's Church of hymn No. 295, prayer by Bro. Dade County, Florida. NW 8th St., apt 5. FR 3.8493.NOTICE God in Prophecy's annual con Members. Scripture 122nd Psalms Dated at Miami, Florida, this The choir rendered beautiful first day of March, 1958. vention. Mrs. Rahmings's sister, Miss Parnetta Clark, will join Lionel Fahrer and music. The pastor presented the FOR SALE them shortly 'Jonathan Chirk local president, and he in turn Joe Gutnick, brother Mrs. Rahmings and presented the mistress of cere- Reduced Price! Owners M22 The Varsity Barber Shop, 6610 Miss Clark of who recently returned monies, Mrs M. Carey. A very NW 15th ave., will be closed every from his Navy service in Germany nice program was rendered and Executive custom built modern : FOR SALE Wednesday beginning April 2 13 visiting his parents, Mr. deluxe three bedroom bath two enjoyed by all. : until Labor Day. ' BEAUTY on two lots cor- and Mrs. John Clark. AU are res. home. Less than 4 old. All , Response by Prof. George. In year I Harry Smith, Prop. 829 idents of Homestead. ! our business meeting we com- large rooms, including living ner, desirable location,. 3- pleted the arrangements for the room dining room, deluxe kit- musical! to be held the third Sun chen with bar, frigidaire, stove bedroom, hardwood floor, Sale or Lease Mrs. Rhena Pinder of Hatchet day in March at.St. Paul Church and refrigerator, walk-in pantry, Bay Eleuthera, 'sister of Rev. A, Miami. We collected funds for, eight large closets, heat, attic garage, vanitories, 2901 EQUIPPEDRESTAURANT E. Hutchinson of Miami left Tues. the fans, large garage and laundry day for the Bahamas after anniversary assessment and'benevolent features too to NW 43rd terr. Lots for sale. association.The numerous men- spendig ten days in the city on tion. None other of this class in business and pleasure. During Laymen are inviting Cash for lots. Baron to meet them everyone this area. Must be seen to be ap- your Mrs. Pinder's stay she was the at St. Paul AME Church on March 18 at 3 preciated. On 125 front by 105 JE 81340. houseguest of her aunt, Mrs. Elizabeth o'clock. deep. Bethel, 1900 NW 4th ct. On Bro. Zack Price $35,000 with $15,000 cash. Beer and Wine Monday night she was guest of Ferguson Pres. Mrs. Owner will carry first mortgage New Lovely HomesOpen Washington Brown choir director Ann Smith, reporter 1480 NW 55th terr. Phone PLaza License of Bethel AME Church and from 3-6 2 bedroom, 7-1176 for appointment to see. p.m. was escorted to her plane Tues- Florida room, 2338 NW 55th terr. Baby Contest 2901 N.W. 43rd and 628 N.W. 3rd Ave. day ''by Sumner Hutcheson Jr., at Terr. Garago Dishes, glassware, pots and hardwood floors. both cousins of the visitor.ASTHMATICS. Church of IncarnationThe pans. Cheap. Call FR 1- 867 (Sat. or Sun. only). Cash paid for your lots Responsible party to take over Annual Baby Contest of Build on your lot or mine with Just small security ' the Church of the Incarnation, GAS RANGE. Good condition. Lot for sale , Rev. E. S. Clarke Sr., vicar, is Reasonable price.: Sterling trombone JE 1.134D-OARON VMN '. .' ctfrMlMM from dMII : being announced by Mrs. Lev good condition, reasonable =as"bronctkkl Mtfc ''''.wer:0s ''\ Johnson of several, chairman.annual projects This is spon-one price. Call PL 7-0973. For Sale by Builder See Mr. Myers OM. 't.:r.m-: .'""IM.W '".'". \ FOLDING CHAIRS! with leather CXNDf or's EI btu sored by the Women's Auxiliary 1545 N.E. 151st Terr.N. 320 N.W. 7th St. , Mrs. David Julius! president. The seat and back. Phone NE 4-1714. j 4 j DRUG DEPT. STORE'i410 Miami Beach contest will continue for Williams. ' a periodof six weeks during which time New 3-Bedroom CDS or Call FR 1-4554 v ( N.W. 62nd 81, Miami, Pis I patrons will be asked. to supportone Priced Right at, $ 2OgO or more of your favorite ba FOR RENT $2,600 Down I I j bies. Some 25 Infants and toddlers Will consider your clear lot as THE PHYLLIS WHEATLEY ART & SOCIAL CLUB COMPLETELY Furnished house, part payment will compete for the top 1934 NW 58th at. NE 5-8915. prizes. Build home on your lot PRESENTS Baby: contest committee man.bers Quiet neighborhood. No water NO DOWN PAYMENT |II| bil. $16.50 weekly. are Mesdames Irene Alex. Fasftfoneffo Anniversary Banquet ander, Jean White Carroll, Winnie D&W Construction i MODERN furnished Use of room. Cleare Florida Dean, Mar garet Jones, Alice Knowles, Joyce home facilities. 1986 NW 57th it. Company THURSDAY, APRIL ,10, 1058 8 O'CLOCK I Phone NE 41290. Matthews: Olive Pender, Carrie Sawyer and Marsha Strachan. ROOM Private home. Phone 405 Pacific Bldg. Liberty Square Auditorium Subscription $1.50 I PL 9-2498 790 NW 66th st. Miami Phone FR 1.1583 YOUR PATRONAGE 18 EARNESTLY SOLICITED 10 Best Dressed EFFICIENCY APT. Furnishedwith Reservations can be made by calling Mrs.. Mable Danish/ at modern conveniences. Near PL 4-3039 and Mrs. Pearl Wise, FR 9 672S AS Women. to be PickedSaints two bus lines. Located at 3268 3 UnitsThree Ann and Margaret NW 46th st. Call PL 84433.2BEDROOM . 1-bedroom( efficiencies located - chapter of the Woman's auxiliaryof the Church of the Incarnationis HOME. Furnished. near 20th St., furnished, sponsoring a Fashion Show Reasonable. By wecflo or month. $5,500 total. (featuring the Ten Best Dressed Call FR 42526.FURNJSHED For Discerning Families Women in Miami. DUNCHE PARK We are asking the people in CBS HOUSE. 1961 Down the commuity to eend in the NW 55th St. Call NE 4-1290. $755 names of the ladies you think Beautiful 2-bcdroom CDS, nice- are the best dressed women In ly landscaped, one mortgage pay- EVERGREENMEMORIAL Miami. This includes all of Dade. HELP WANTED ment, $79 month. Near every- Send or drop the names in bal- lot boxes at the Miami Times'downtown thing. See today. office, the Liberty Selling Avon is easy. 10 City plant or the Vestibule of the 12th AVE and 57th 8T. PARK Church of the Incarnation, 1835 representative to be ap- 5 Bedrooms' 2 Baths ! NW 54th st. MOST BEAUTIFUL IN ALL THE SOUTH Mrs. Ellsha S. Clarke, chairman, pointed immediately. Excellent Lovely CDS partly furnished, tile NA 1-0957 or the Miami Times. roof, hardwood floors, $3,500 opportunity. Call cash will handle, reduced to N.W. 41st St. and 31st Ave., Miami Thank YouDr. FR 16407 for appointment. $19,500. Ii I Sweeting wishes to thank OPPORTUNITIES for Negro men CALL OR VISIT everlastingly protected by a ,Perpetual Care Fund the friends and visitors who Gold Coast many and women. We pay as you learn. Realty attended the birthday celebration Phone FR 4-1561. on the Sweeting's Estate, and to 4301 N.W. 2nd Ave. I I A living memorial, the final tribute to those we love thank the many friends who The Exclusive Beauty Shop hai PL 4.5508 , thought about him to send tele- opening for 3 operators. The grams, cards and gifts and especially phone number has been changed 1 A :selection of a family plot is a vital part of all of the out-of-town to PL 7-9237. ind. WHY IS friends.Dr. life's planning. Your inspection is invited and Mrs. Anthony of St. OPPORTUNITIES lor Negro men Albans, New York were the ? and women. We pay as you learn. 930 house guests of Dr. Sweeting for Phone FR 4-1561. the past week. -- ---- - S BRAND NEW ATTENTION NEW OPENING Beautiful ROCKLAND Palace FIRST TIME IN MIAMI (LADY FROM CENTER HILL) 3-Bedroom Hardwood Floor Your Biggest Dollar Value in MADAM MARS Gas age Goods and BeveragesThe Liquors, Package ADVISER GFTED PALMIST AND Open Sun. 2 to 4:30 p.m. 4 2010 N.W. 56th St. Finest Foods at Popular Prices If you need help to overcome Bad CAPPER ____________ Luck, Spells or Evil Influences. If you CONST. CORP.J. 829 NW. 2nd Avenue Phone FR 4-9943 seem to be crossed in Luck, Sick in body or mind . . f I CAN AND WILL HELP YOU!, Has the one you love changed? I can tell you why!'' Meals Eat AtBuster's Let me explain higher powers to you now. I do what Home-Cooked - For Tasty , B. SMITH others claim to do. Gives you your Lucky Days and your Lucky Num- ELECTRICSERVICE Kitchenin bers. Satisfaction guaranteed. Come let me make you Lucky, Happy and Successful, Baker's Famous Corner Open Dally and Sunday-Heurs ff a.m.to 8 p.m. Electrical Contractor Readings/ for Colored and White HOUSEWIRING"Don't Buster Collie, Prop. BUS NO. IS PASSES DOOR EVERY IS MINUTES cuss Call ua" Specializing in Souse, Peas and Rice and Boiled Flab Phone NE 4-9601-Permanently Located PHONE NE 5-3058 2590 N.W. 27th Avenue Miami Fla.' w Night or Day 6901 N.W. 15th Ave. Liberty City , W- . - "--- - -- - - I .' \ L ' i MIAMI TIMES-"The Peoples' Newspaper" RhomaniaSpring ,j:' PAGE 14 SATURDAY, MARCH 15, 1958 BEN H. ATKINSON JR. D.D.S. '; :''f. has come again, and in q Miami Sigma Gamma Rho Sorors , consider "Rhomania" synony- ANNOUNCES THE OPENING OF HIS OFFICE mous to this very enjoyable season of, the year. FOR THE GENERAL PRACTICE OF DENTISTRY ,;: Our second annual Rhomania ' e promises an evening of pleasureto OFFICE HOURS: 10 a.m. to 2 p.m .- 4 p.m. to 8 p.m. .. all who attend and inviting we are - C l Ze 0S our friends and the Inter- And by Appointment ested public to be our guests on I Friday, March 21 at 8 pjn. in the 6705 NW. 15th Avenue Phone PL 7-5601 Staple Sweetie Booker T. Washington High I 'School auditorium. ... "Our Youth In Song and t I : ? . Sunday closing of all bus- operate. The variance was granted .LJ.ance is tins year's theme, and inesses (non essentials) !is on tap with the only serious protest the various schools of the coun- I for a discussion at the next meet- coming from the White Citizens' ty are appearing in competitionfor SEABOARD MEDICAL CENTER I ing of the Ministerial Alliance Council. The pay-off came, too, one of three prizes. Will your . Workers, now compelled to laboron when during the hearing, a favorite school win? Come out. I the Sabbath, argue that Sunday group of Negroes stood side-by- and see your children in dance 2186 N.W. 7th Avenue Phone FR 3-2691 work keeps them from wor- side with the Council, protesting and enjoy their songs, then see E sh ping at the church they at- the YMs occupancy if you agree with the decision of tend. the judges. HOURS: 9 a.m. to 6 p.m. o Georgette's Tea Room own- Our coronation ceremony will DAILY EXCEPT SUNDAY A There's a pert secretary er, Georgia Campbell, is throwing precede the general program. about town who's just wild about a (buffet luncheon for her Seven lovely young ladies are Buddy Johnson's band and birthday guests, Afrril\ 9. Special competing for the coveted title, Buddy Johnson. Coco around to guests will be members of the "Miss Rhomania." see him everytfane he hits town. Collegians' Club (of which she Is club sweetheart) and their Demure Bennette Ruth John- . Blanche Calloway's show at wives and sweethearts. son, Miss Rhomania of 1957 is DOUGLAS ROAD CLINIC the Jim Jam Club is a "solid anxiously awaiting the hour sender." It's the shot-in-the-arm Kelsey Pharr, the retired i when she will relinquish the 3197 Douglas Road kind of entertainment needed mortician, just; can't stay put. crown to her successor.-nn- Who.. --- will.'-- Coconut Grove, Miami, Fla. hereabouts tor too long a time. During burial hours in his Lincoln be the winner? The only note that sours around i Memorial Park cemetery, the You and your friends are Invited Specializing 'In Maternity Cues and Diseases of Women. OfferIng the stay-up-late hot spot is the i mild-mannered Kelsey continues ; come out and enjoy an the Highest Standard of Service In the Pre-Natal care sad tag hung onto the nitery. Jim to smile broadly, as he passes out evening of pleasure and at the ) ( long month Jam fe a coined word for the courtesy gestures to 'scores of same time help lu financially in before the delivery); The Delivery; Poet.p.rtum owners, Jimmle and James. i mourning families. the awarding of our second annual care (care otter delivery), and equipped with modern facllN \ , eO-I scholarship. The dater Friday I ties to treat all To hear legal minds . Model Marie Adams, North's March 21 at 8 pm. in the of the expectant mother. need. ate it, they are likening the approach Travel Bureau's pert secretary, BTW auditorium. Office Hour: 12 " to civil rights by the Rev. 1 had to retire from the cast of noon to 9 p.m. Dally except Sunday v. Theodore R. Gibson to that of '"Thunder in the Morning," the 24 Hour Phone ,. Dr. Martin Luther King. The Robert Earl Sawyer productionon Have you seen the Service Dr. Jame. T. ROM 1,1, Miami minister, they say, has integration. Miss Adams, who Wonderful changes Phone: HHand 8-2310 Director the approach, 'tho not the finesse recently won the "Miss Bathing Being made at ,{ Of the Montgomery boycott leader. Suit of 1958" bathing beauty EVERGREEN CEMETERY? contest at the termination of Ray Go out there and see l Mitchell's North-South golf tour- lt will do your. heart good ,) What night club fans havebeen ney, says business travels and discussing for the past two' other activities forced her retirement '( weeks is the appearance of Roy from the play. GLAND TROUBLE STAR MEAT MARKET Hamilton and Al Hitler at the I 1 mediocre Palms of Hallandale. Mary Hanna, Perry's sales- Urinary Ailments They feel that hard times are girl, and rotund Nathaniel Owens' , forcing big name act into mediocre her hubby, celebrated their 10th Rains In BACK, HIP8, LEG8 \1 1520 N.W. 62nd Street spots. Big or small all art- wedding anniversary yesterday, Tiredness, LOSS OF VIGOR, ists have to eat. March 13. WEAKNESSIf you are a victim of these r Jrvtanlta Miles and symptoms then your trouble maybe THE MARKET WITH COURTEOUS SERVICE handsome Rubin Thomson, two Alvin Espy, youngest son traced to Glandular inflammation ,liberty City lovey-doveys' are of the Phyllis Wheatley princi- of the Prostrate Gland. ( headed for the altar on Match. pal, Elizabeth Espy Johnson and Neglect of Glandular inflammation " 16. beauteous Sylvia Reynolds, his often leads to premature talented wife, are expecting the loss of function, low vitality, lost Fresh Meat Low Wally Futch, CLub Royale arrival of Sir Story any day, now. vigor, surgery or malignancy.Why Prices entertainer, is definitely on his Suffer Delay, and way to the "big time." His song Get Worse and dance technique plus his That's it folks! Modern Methods Bring stage personality, are two attributes Gratifying Results .J that will: take him sky-high Without Surgery In Most Case d -8h among the bright lights. His song CONSULTATION FREE stylings remind you so much of Hours: Mon., Tues., Fri., Sat. AUTO LIABILITY INSURANCE Wynonie (Mr. Blues) Harris: Non.Suroleal Treatment 10 a.ra. 5 p.m. ($10,000 $20,000 $5,000) To conform Watch him gol Hernia Piles Closed Wed., Thurs. Florida Law with Drive-in theatre (Rupture) (Hemorrhoids) SOUTHERN CLINIC owner A ,Lib-City Leon Task, according to DR. LONG'S CLINIC NEW LOCATION have Get your Auto Liability Insurance now before you the grapevine, is negotiating a 21 8.W. 18th Av. 2847 Coral Way an accident-Save 25 percent. Term can be business venture over in West Phone FR 3-2748 arranged for all.SERVICE. End, Bahama Islands. A driveinfor Near 27th Ave. Grand Bahama? Could be! Add Life to Year FIRST Inc. and Year to Life , . The YMCA (Carver Branch) REDUCESpecial 645 N.W. 36th Street PL 9-5284 ' landed that 'plum' on NW 58th Medication FOR SALE St., but signatures were necessary t for a variance permit to BY SUMMONSPROPERTY All members of Lodges & Temples MANAGEMENT I Attention: Now Reopening Efficient Dependable! Reliable IBPOEW from Welt Palm Beach Bedroom Dade County pine MADAM FARRANMiami's south to Key West, Liberty LodgeNo. home. Mutt be teen to appreciate. I' ' 1052 and Temple No. 724 Located at 3270 NW 511t terr Wonder Lady Total I price $ ,tlOO; $1,600 first Nationally Known! Highly Recommended! respectfully request your presence down payment balance like rent at this . . Now open for Inspection. r r ?' LIFE READER. Brand new CBS bedroom ELKS DAY CELEBRATIONSunday home, 7545 NW 14th ave. Hard. ADVISOR BORN WITH POWER s wood floor, 'tile features, close to "' I CAN AND WILL HELP YOU but line; paved streets, .Idewalke. March 30 1958 Total price $13,900; first down Remember I am a TRUE READER , payment $1,600. Now open for BORN WITH POWER Inipectlon. TELLS YOUR NAME Starting at 9 a.m. BUSINESS PROPERTY YOUR LUCKY DAYS There will be something going on all (day long Restaurant fully equipped.,Now Licensed by State and County / rented at $100 per month, New Tell you any and everything wish Never a dull moment from 9 a.m. until CBS building located at 6351 Ing any queetlonc Give you 'to know without ask. NW 18th ave. Total price $7,600. you name of friends and enemies Come and let us (make this a miniature State Association $1,500 down, 185 per month. Give. true and never falling advice, on .? affairs of 'life. If Plenty of food and other refreshments.Big Two.bedroom CBS home do worried not ,call troubled'or at your home.DONT In doubt. consult this psychic It''once.. I h with Florida room, hardwood parade in the p.m. Registration begins 9 a.m. floor built.In fireplace, locatedat BE DISCOURAGED If you have failed to find heipi fl 1459 NW 66th et. Full price I do what other claim. to do.. No one In Turned Remember this le your day to show who and what //Is an ,Elk $12,500; down payment, $2,500 COME WITH OR WITHOUT MONEY. Private and Away ,' Come and stay all won't miss and $80 per month. Readings. My studio I. on the corner No Confidential. day eo you anything. side doo... No back FOR THESE SPECIALS doors Avoid waiting. For Further Information call NE R.925J Phone NE 4.3287 for appointment. (,) CALL or,Contact Bro. David Q. Tucker, Oen. Chairman at 4500 N.W. 27th Ave., Comer 45th St. 6525 N.W. 19th Avenue, Miami, Florida J. A. SUMMONSDAY 1 Bloc north of Booker Terrace. Bue 24 15 Every 5 mInutes , MABEL |I. ,DANIEL8, Daughter Ruler OR NIGHT CLAUDE ROLLE, Exalted Ruler HI 4.2448 or HI 60173 3781 GRAND AVENUE i Miami 33, Coconut Grove, &. Our Classified Columns Get Fast ResultsTHE - Basketball THE MIAMI TIMES' -"The Peoples1 Newspaper" City I Return Match at Tourney at BTWThe Broward i SATURDAY, MARCH 16, 1958 PAGE 15 Capitol Theatre City of Miami Recreation I f. County I Department is sponsoring a Gold : , The Long awaited return Medal Basketball Tournament on Newsby liiiCame : : : Miami Dodgers to CAMPY THINKS match between Sugar Ray Robin Friday and Saturday, March 14- : :.1 son and Carmen Basilio to be heldon 15 at the Booker T. WashingtonHigh : : Open Season HE'LL WALK, Tuesday, March 25, In Chicago, School gym. ; : will be seen at the Capitol Theatre Some of the teams participating : : : PLAY AGAINGlen on big screen (theatre) television are: Key West HomesteadAir Walter. Bow : Easter SundayThe the Force, Richmond Heights, , moment the very fight --- ------ is happening.As South Miami, Coconut Grove fast fovlnj Miami Dodgers Cove, ,N.Y. (ANP) - in the past on these fights Playground, Bain Funeral Home, one, come all, and celebrate under the able leadership of Despite his lingering paralysis all home television sets will be I Spotment R. C. Ringers, Sunland Bowe's, Gray's and Hardy's Manager "Baby Ruth", will open Roy Campanella injured Los Park Recreation Teams, Fort St. Patrick's Festival Easter' blanked Birthday on their baseball season on out .and only Angeles catcher last week your was to see the fight opportunity it Lauderdale, YMCA Miami and Monday, March 17 at 3:30 p.m. Sunday, April 6, at Dorsey Park, happens will be big as Fort Lauderdale. at Carver Ranches Community when they meet the strong team reported full of confidence that theatre television at on the screen Pompano, WPB Teams Delray Park. Games, sack and bicycle from Hector Supply Co. Admis- he will walk and even play base Capitolon Tuesday night. Beach Recreation Teams, Opa racing. Enjoy an evening of fun. sion is adults 50 cents and child ball again. Admission Locka Recreation Teams, Liberty Refreshments and dinners. Tick- ren 25 cents. The Dodgers are There will price be : $3.50 plus tax. City Recreation Teams, Miami ets on sale at all business places. 'now in training and Baby Ruth is A Dodger official Matt Burns a screen show be. Colored Police Dopt., Dorsey Proceeds will go to the C. W. H. predicting\ a fine time for the who visited Campy at Glen Cove fore and after. the fight at no additional Park, Dixie Park, Celtics of Coral Fire Dept. building fund drive. coming season Community Hospital reportedthat cost.Tickets Gables Hawks of Liberty City Roy was . the most are now on sale. Playground. cheerful fellow you ever saw. He I All members of the Juvenile Mrs. Lonnlo Brown. Alter the listens to the radio and watches Department of Pall Bearers order of business the members television and he has heard of Lodge No. 81 are asked to bo Joined in helping Mrs. Brown these reports He refuses to agree K West Southernmost present Monday at 5 pjn. A. O. and Godfrey Scavella celebrate at all that he won't walk again I ey City Henderson conductress their birthday. A delicious dinner and even believes he may play was served and the honored ball again," Burns said. The regular meeting will be By FRANCES E. PALMERREGULAR Monday at the Masonic Templeon guests' were showered with gifts Meanwhile, the hospital has Pembroke Road at 8 pjn. Althenla. Martin, Pres. not Issued a rOrt on the cat. Walter Blatch Jr., president. Vera Shelton, Fin. Sec. cher's condition since its bulletin FELLOWS TO OPEN Carey is a 1954 graduate of more thin a fortnight ago, re. REMODELLED CLUB Douglass high school. The CWH Chamber of Com- porting no change CampaneUa ts _- ferce will meet at the home of paralyzed from his chest down. Members of the Regular Fellows )UR 81CK Abbie Days, 3900 SW 28th st. : Mrs. Willa Mae Valdez would He suffered a broken neck in an Club wish to announce the Mrs. Beatrice McIntosh, Mrs. All members are asked to be like to tlunk all of the idles automobile accident Jan. 28. opening of their newly remodeled >ophie Brown, Mrs. Martha Wel- present.Ike who helped her in the Hrart club on Friday night March ers, Mrs. Edith King, Tony Mo- :und Drive. The ladles reporting. 14 starting at 9 pan I rales and John Gates. Friends Mitchell died at his home, were: The public is invited to attend .vish them well again. 5029 SW 21st st. last Friday. The Mrs. Council .......................... 10.36 that gala event which has been body was sent to Thomasvllle, Mrs. Days ........................-... 5.27 "Rhomania" planned. Refreshments will be Mrs. Lillian Roberts of D4 Fort Ga., where funeral services were Mrs. Robinson ...................t.... 8.00 served with a back ground of recorded Village is ill at her residence. held at the Pine Grove Baptist Mrs. King .............................., 7.50 music. Church on March 9. He is survived Mrs. Valdez .......................-... 12.50 B. T. W. Auditorium Starting next Sunday the club Memorial service was held In by a son, David Mitchell Total $43.63 will have a series of Jam sessions honor of the late James Nelson two daughters Patsy and Mary The total for Hyde Park and Friday, March 21st from 2 to 8 pjn. English, former principal of and other relatives. Carver Ranches was 7220. , Hats off to the members of this Douglass high school Friday af- club. This group of young men ternoon, March 7 in the tgymna- has done a wonderful Job In our torium. GRAND UNITED FAITHFULFEW community. Sister Myrtle Catherine Episcopal nun of the commnuity of The Grand United Faithful No. SEETHE Army Specialist Third Class the Transfiguration, Glendale, 3 wish to thank each and every William W. Carey Jr., whose Ohio was the guest speaker and one for helping them to make WORLD'S parents live at 826 Windsor lane Prof. Alfredo Sands gave a few their tea a success. We also Iw recently participated In Sabre remarks. Music was furnished by thank Mrs. M Jolly for lettingus Hawk a Seventh Army maneu- the school band and Douglass come into her beautiful home. GREATEST ver, which involved more than I chorus under the instruction of We wish to thank Clubs No. 1 and 100,000 troops in Germany. Mrs. Mercedes Hannibal Wild- 10 for their full support and the COLORED Carey, assigned to company' A goose. high Star Gosipel Singers. A delicious , of the 2J>9th Engineer Battalion Songs of Douglass: High School repast was served after 1 entered the army in January, ((1916) led by A. L. Saunders and the program. PSYCHIC 1956 and arrived in Europe !n Mrs. Vandelean Edwards with November, 1956. the audience participating. The clUb met at the home offiMZUBtfMM READER _ , ..............................................:.............w....,......... .....:... .__=--.. ...., .. .. .. ... ..;.;.. .. ..;.;.. ... t , xv M = .A....=......=....H..........1......N.....V.....y.....VI.....=.....=.....u .-..:4':...-1..:...--.:.. ..-..:-i"...-:;:..-..:-;:.. ..:;:..:-;:..:-;:..:ii:.. .!.'!.. !.uatn' w FAIR I I S PROFI ;:; Religious t Ja t "1t F Supply I Store .l BUNTER I:t:;; I i Flt Flt't : PROF. HUNTER If you are tick, worried or in trouble this U the ltfrlt place to come. Don't stay in the rut, push back the veil of bad luck that seems to hold you in your track, REV. W. J, FAIR tl tln and advance forward by the help of God under the leadership of Prof. Hunter who has 30 years of ex* 5 in, n perience in spiritualist and occult science. Make your in Great Spiritual Listener Flt.Eft ; home happy. He will show you how to bypass your ; I rlt' I Ij enemies and get the things that life demands'for you. j.u.; p i' #. I tit= ; { iU, He helps the rich as well as the poor. If you fit j n are troubled with unusual conditions-can't dfe]t f1t; a+ H hold friend or money Rev. W. J.. Fair will kltf16i $' pray for your condition to be changed for the g"} U= better. Some come by train some come by air, lh\ ll3' ;, some come by car to see Rev. W. J. Fair. K; .lt.g It t K1rlt Located at the Hunter's new psychic studio oa ; flt; ._, ,. 14K GOLD PLATED P..broke.Road,3 mile west of Hallandale, Fla. oa WMBMtUrtlng rM'Rsavwaetygwolr th. north tide of the road, 1 mila east of 7th ave. en'' Hear Rev. rair over r t March 9, 12:30 every Carver Ranches. Signs are placed on the top of three ..flt Sunday. hi i story building. Office U la the duplex In the front of u, f1t . .u.: I the building.He ? Rev. W. J. Fair knows many people have been w has fifty time. more power than any other Ii:II'' .helped through the power of the CROSS. He ; .i5' ,: median. You will find him far advanced la know You can enjoy 1: .d . at $ays -you can be a success. " 2t Good Health, you can be loved and wanted. t lw READINGS FROM $1.00 UP Eu Order your CROSS TODAY. Sf' f LICINSIO IV tTATI AND COUNTY OFFICE HOUftt, DAILyi Send $3.00 cash or money order. No COD' d t1KK .. .. _ . accepted. 1 P.M. TIL 4 P.M. 7-9 P.M- UNDAY I ,P.M. TIL 4 P.M. ADDRESS: FAIR'S RELIGIOUS tN S CLOSED ALL DAY WED. : SUPPLY STORE TMs"'""" cross s CALL IN PERSON Nuns w sttetttlae epwsr list 2449 Seventh Avenue .C4_uNn.a/.rri.d 8 5417 S. W. 17th St. , Ie New York 30, N.Y. a Hollywood, Fla.RobinaonBasilio . ... w ... ... W' Q.or ...Qr ..,.. .--' XSm.S3QSi3S2.. :. Q ..r.;"...,...::a. <:< .. """' .v7.a ''''''''r . MIAMI TIMES "The Peoples' Newspaper" B. T. W. HIGH SCHOOL George, Anna Jean Hawkins, NORTH DADE JR. SR. Harold Culmer, Beverly Nixon I PAGE 16 SATURDAY, MARCH 15, 1958 Congratulations and best wishes and Henry Plnkney (a Junior.) The core of activity of NorthDade's this week for a happy journey are extended campus past to Bernetta Sands who ]left Student Government Day which was the (preparation and elimination 'tuesday March 11 for St. Louis, h sponsored by the Student of the astute spellers for : Council of Churches To Mo., to attend the National YWCA Council will be held Thursday the County Spelling Bee. After Convention. Bernetta is repre- March 20. This day is given to undergoing various phases in the senting the entire area. And is the the members of the senior class I. elimination process, scores prov- only teen-ager attending the who are interested in teachingfor ed James Floyd and Charles JI, meeting frcan Greater Miami. a day. As usual the president Williams to be our best spellers Bold 25th Meet Here Plastic book covers are now f the Student Council will act as I with Udell Lanier and Shirley : being sold by members of the principal.A Rolle as runner up.!. j Girl Counselors. These covers are I The Industrial Arts Depart The 25th annual convention of, I in our school colors. This project Student Exchange programs ment invites you to attend the 'I Churches will be held in Miamion seemingly Is a success and a benefit being planned for the night of Miami Industrial exhibit North April 22-24. The Council, uNITE IN NASSAU"AT to the students who are March 17. An exchange student I Dade has five wood projects on I which Is composed of all of the purchasing them. has not been se'ected' a* of yet, exhibition in the woodworking Protestant Churches In the HARLEMYour National Newspaper Week because of the 50 applicants I section. The exhibit span is from United States serving more than starts Monday, March 17 Members Grade cards were issued on i March 8 thru the 16th admissionIs ten million Negroes, is headed by host of our newspaper staff will March 12. Seniors averages will free. The building: is open from & the Rt. Rev. Sherman L. Greene, Ions "Navau" .Clvde KIti highlight this week) by selling 'gyp compiled and posted very 230: $).m. until 10 pin. ' I IDTOU ) v areseT+ the ash senior bishop ot the AME J i tags on Wednesday morning On last week I reported that Church and (presiding bishop of Annual Greater Miami Elks'"Ntaht during homeroom period. The soon. the sum of $300 was raised in the the llth Episcopal District, who in Waau" on Sunday proceeds will help toward our Dorothy Jenkins, reporterSt. baby contest sponsored by ourPl'A. n'eht. March at P o'clock! at holds the position as president newspaper financially. This was an error. The Dr George W Lucas Is provisional the Harlem Square Club. I The senior class along with the sum raised was $3,000. chairman of the board, and .Ai usual 1 the affair' will feature 'school was well represented Sat- Matthew AME Zion Plan now to attend the dedication Dr, J, :T. McMillan is executive a never-encUntr line' ,.f +I",*.iv urday, March 8 on "Youth AI ks service of the school. secretary: Bahamian novelties, including aagnare Business" a television program. 1628 N.W. 5th Ave. Charles D. Wyche, principal The Council national head- dance and grand march, They were given the privilege of Rev. A. H. Ferguson, pastor Barbara Rollins, reporter quarters is at 1921 13th St., NW a barefoot calyTr; cont t. rw- questioning a very distinguishedpanel. vunday School............. 9:45: ajn - in Washington, DEC The late Dr. nuK cwonut nvik and conrh Persons representing the ... .... 11 a.m .> ;; chairman 'school Morning Worship - ! W. ML Jernigan, was salad and many other attractions. were: Betty Kelly, Charles t- nCarefully I of the executive board and Dr. Admission is advance $1.25 and :Johnson, Marcia Johnson Ivan Evening worship ............ 7:30: p.m. Andrew Fowler director of the dnor tl.50 and advance ticketsare Washington Bureau. I now on sale at the Gr."f"r &&* :X W..xxX{{<<<<0Xx27hX< IMt Zion Baptist Church will Miami E'ks' Club and the Harlem be convention headquarters in I Square Cluh For table r Miami. Approximately 850 dele- eTVa-1 Fair is Buy FromVISIT tion phone PR 3-3261 and a* Realty Easy to gates and visitors are expectedin either Lucky. Earl or Clvde. Miami to attend the three-day Elks Club will be closed on that I conference.The local. convention commission night OR CALL TODAY. .)e- PL 7-1645 is composed of the following -I I Mlamians: Rev. Edward .T.Graham South Florida State Ii" and Rev. S. A. Cousin, co-chairmen, Atty. Henry H. Fair Beauty ContestThe Arrington, chairman of the welcome - /program committee, Mrs. Maude Reid and Elliott J. Pieze, second annual battling co-chairmen of public relations beauty contest, M Rev. P. W. Williams, housing, South: Florida? is being held Sun- Rev. Thedford Johnson souvenir day March 16. program, Rev. W. C. Edcar and Young women between area 18 Rev. E. M. Blocker, transportation and 25 who reside in South Fla. Mrs. Llama Green and Mrs. (anywhere between West P Vn 41 aMil "' Elizabeth Espy Johnson, hospitality , Beach and Key West) are eligibleto ; flT Mrs. Mary C. Wright and participate ,in the contest. Mrs. L. E. Thomas, banquet, and I Charles L. Williams, music Last year's winner, Roberta The Council's slogan is "On White will be on hand to crown to Miami." the 1968 winner who will walk! away with a twenty-five dollar cash prize a beautiful trophy and BTW Alumni MeetsThe several other prizes. regular meeting of the The contest is stilt open' to Booker T, Washington Alumni persons desiring to enter. For Association will be held on this further Information telephonePL Tuesday, March 18 at 8 p.m. at 4-7929. the school. All members, especially - members of the (graduating classes of 148, 1936 and "Rhomania"Friday WHY PAY RENT ? 1928 who will celebrate reunions t this year, are requested to be March 21st present Plans for the annual , celebration will be completed at B. T. W. Auditorium this meeting. '.. $495 DOWN , JdINeNI..NilJtJlJIJI"NI: : 3-room CBS home-Total price $6,500-$15.00 week WORLD FAMOUSWMJ3M pays all-Large lot, landscaped, city water, close to buses and shopping. For couple or small family. Hurry. TOPS IN LISTENING NEW 3-BEDROQMS, CBS EDfSON CENTER Beautiful bedroom CBS, one year THE CASTLEROCK SHOWS $795 DOWN .new. CBS 3 bedroom, 2 tile baths, living room, dining room, formica THE GOSPEL BLIND BOY SHOW Gorgeous new 3 bedroom, Jiving kitchen, breakfast bar, extra large THE BUTTERBALL SHOW I room, combination formica kitchen closets, inside utility, rarporte, with built in oven and range, large, nicely landscaped lot. Close 0 LOCAL NEWS WITH ELLIOTT J. PIEZE breakfast bar, tile bath, sliding to Holmes and Northwestern' doors, front porch, rear patio, schools, buses and shopping City - large closets, utility. On large lot, water. Owner must sell. Beautiful Rainobw Park, Opa wk1, ranch home. 800 ON YOUR RADIOs one mortgage payment No dot s. ing costs. EZ terms on, bala:'.ce. $305 DOWN $50 MONTH BUYS >waitMl xo9ililill>t JaJlIaltItJtJtIlJlJtIlJllaJlJt s >JtJtaJtJtJlJtJlb Small deposit will hold until clos This well located Liberty City ing. See this today. 50 x 140 lot. Near N.W. 27th Ave sicki 1 New area-East of NW 17tlTAvi. TV DUPLEX We have lance selection of CBS We have several new CBS duolex homes in this lovely area. 2 and* 3 1 and 2 bedroom apartments. Live bedrooms. Priced to sell. Paved Then dial FR 4-2044-9 a.m. to 9 p.m. in one, the other apartment pays streets, city water, near everything all. East of NW 17th Ave. City T nn. SAME DAY SERVICE water, paved streets, close to buses ALL MAKES ALL MODELS and shopping. Don't wait, call now. $495 DOWN Buys 2 3 or bedroom CBS homes Picture Tube Special Cash Quick for your lots or build m Ranches Djma, West or Hallandale.Hollywood,Terrific Carver on your lot or trade lot for new bow for tlntle , 21.incb-$29.9S home -orkln* I in HmllanJ - 17.inch-$22.9S 1o nr West Hollywood. Hurry' LATCH ON TO THIS BARGAIN Converters For Channel 17-416.50 Cosh Quick for Your Lot or AcresFAIRREALTY Used 17-inch TV-Good condition $39.95 I RADIOS REPAIRED-Bring it in for quick service Vets Radio & TV Co. YOU ARE WELCOME DAY OR NIGHT-OPEN 9 to 9 201 N.W. 62nd Street Phone PL 7.1645 939 N.W. 3rd Ave. {> : _, M._,...A.YrV,.....4..... Y. -. -.-. iTHE Contact Us | Permissions | Preferences | Technical Aspects | Statistics | Internal | Privacy Policy © 2004 - 2010 University of Florida George A. Smathers Libraries.All rights reserved. Acceptable Use, Copyright, and Disclaimer Statement Last updated October 10, 2010 - - mvs
|
http://ufdc.ufl.edu/UF00028321/00589
|
CC-MAIN-2018-39
|
refinedweb
| 26,852
| 75.71
|
Multi dimensional arrays of int and char typei think you wrote it before you read my second post :)
Multi dimensional arrays of int and char typeBtw, this is the function template i HAVE to use.
bool DisplayBoard(int reversiBoard[MAX_ARRAY_SIZE...
Multi dimensional arrays of int and char typei'm making a reversi game board with and and int array of NxN,
i initialized the array as 0 but i'm ...
Empty file when outputingYour main program should do each of the following
1. Request the name of the input file
2. ...
Empty file when outputing#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
...
This user does not accept Private Messages
|
http://www.cplusplus.com/user/dritail/
|
CC-MAIN-2013-20
|
refinedweb
| 113
| 64.3
|
A backport of the dataclasses module for Python 3.6
Project description
This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python 3.7, any discussion of dataclass features should occur on the python-dev mailing list at. At this point this repo should only be used for historical purposes (it’s where the original dataclasses discussions took place) and for discussion of the actual backport to Python 3.6.
See for the details of how Data Classes work.
A test file can be found at, or in the sdist file.
Installation
pip install dataclasses
Example Usage
from dataclasses import dataclass @dataclass class InventoryItem: name: str unit_price: float quantity_on_hand: int = 0 def total_cost(self) -> float: return self.unit_price * self.quantity_on_hand item = InventoryItem('hammers', 10.49, 12) print(item.total_cost())
Some additional tools can be found in dataclass_tools.py, included in the sdist.
Compatibility
This backport assumes that dict objects retain their sort order. This is true in the language spec for Python 3.7 and greater. Since this is a backport to Python 3.6, it raises an interesting question: does that guarantee apply to 3.6? For CPython 3.6 it does. As of the time of this writing, it’s also true for all other Python implementations that claim to be 3.6 compatible, of which there are none. Any new 3.6 implementations are expected to have ordered dicts. See the analysis at the end of this email:
As of version 0.4, this code no longer works with Python 3.7. For 3.7, use the built-in dataclasses module.
Release History
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/dataclasses/
|
CC-MAIN-2020-29
|
refinedweb
| 303
| 61.73
|
"), C,),
which is a simplified version of the actual definition from
env.jl:
function getenv(var::AbstractString) val = ccall((:getenv, "libc"), Cstring, (Cstring,), var) if val == C_NULL error("getenv: undefined variable: ", var) end unsafe_string unsafe_string.
This is why we don’t use the
Cstring type here: as the array is
uninitialized, it could contain NUL bytes. Converting to a
Cstring as
part of the
ccall() checks for contained NUL bytes and could therefore
throw a conversion error.
cconvert(),
Base.cconvert()will attempt to first make a null-terminated copy of the array with each element replaced by its
cconvert()version. This allows, for example, passing an
argvpointer array of type
Vector{String.
Cstring can also be used as the
ccall() return type, but in that case it obviously does not introduce any extra
checks and is only meant to improve readability of the call.
String. Similarly, for array arguments (
T[] or
T*), the
Julia type should again be
Ptr{T}, not
Vector{T}.
Warning
Julia’s
Char type is 32 bits, which is not the same as the wide character
type (
wchar_t or
wint_t) on all platforms.
Warning
A return type of
Union{} means the function will not return
i.e. C++11
[[noreturn]] or C11
_Noreturn (e.g.
jl_throw or
longjmp). Do not use this for functions that return
no value (
void) but do return.
Note
For
wchar_t* arguments, the Julia type should be
Cwstring (if the C
routine expects a NUL-terminated string) or
Ptr{Cwchar_t} otherwise. Note
also that UTF-8.
SIMD Values¶ bitstype:
typealias¶.
When to use T, Ptr{T} and Ref{T}¶
immutable types designed to mimic the internal structure of corresponding C
structs.
In Julia code wrapping calls to external Fortran routines, all input arguments
should be declared as of type
Ref{T}, as Fortran passes all variables by
reference. The return type should either be
Void for Fortran subroutines,
or a
T for Fortran functions returning the type
T.()explicitly()explicitly.
Some Examples of C Wrappers¶
Here is a simple example of a C wrapper that returns a
Ptr type:
type reference.) Furthermore,
n can be any type that is
convertable Void, convertable using = Array{Cdouble}.
String() make copies of data instead of taking ownership
of the buffer, so that it is safe to free (or alter) the original data without
affecting Julia. A notable exception is
unsafe_wrap()
unsafe_wrap, create a
AsyncCondition object and wait on it:
cond = Base.AsyncCondition() wait(cond)
The callback you pass to C should only execute a
ccall() to
:uv_async_send, passing
cb.handle as the argument,
taking care to avoid any allocations or other interactions with the Julia runtime.
Note that events may be coalesced, so multiple calls to uv_async_send may result in a single wakeup notification to the condition.
|
https://docs.julialang.org/en/release-0.5/manual/calling-c-and-fortran-code/
|
CC-MAIN-2018-17
|
refinedweb
| 462
| 62.98
|
Opened 8 years ago
Closed 8 years ago
#1719 closed enhancement (fixed)
autocomplete is missing in shell
Description
Hi,
I am missing the functionality of autocompletion in the django shell
so:
import readline
import rlcompleter
readline.parse_and_bind("tab:complete")
a=5
a=<tab><tab>
#<tab><tab> means clicking the tab-key twice
#does not show methods ,
#which work in the normal python shell (under linux)
I like django, but i love the autocompletion,
any hints what i can do to make it work in the django shell ?
Attachments (0)
Change History (1)
comment:1 Changed 8 years ago by adrian
- Resolution set to fixed
- Status changed from new to closed
Note: See TracTickets for help on using tickets.
(In [2842]) Fixed #1719 -- Added rlcompleter autocompletion to 'manage.py shell' if IPython is not used.
|
https://code.djangoproject.com/ticket/1719
|
CC-MAIN-2014-10
|
refinedweb
| 134
| 54.76
|
The c16rtomb() function is defined in <cuchar> header file.
c16rtomb() Prototype
size_t c16rtomb(char* s, char16_t c16, mbstate_t* ps);
The c16rtomb() function converts the utf-16 character c16 to its multibyte equivalent and store it in the object pointed to by s.
If s represents a null pointer, the call is equivalent to c16rtomb(buf, u'\0', ps) for some internal buffer buf.
If c16 is the null wide character i.e. u'\0', a null byte is stored.
c16rtomb() Parameters
- s: Pointer to a character array where the multibyte character is to be stored.
- c16: The 16 bit character to convert.
- ps: A pointer to an mbstate_t object used when interpreting the multibyte string.
c16rtomb() Return value
- On success, the c16rtomb() function returns the number of bytes written to the character array pointed to by s.
- On failure, -1 is returned and EILSEQ is stored in errno.
Example: How c16rtomb() function works?
#include <cuchar> #include <iostream> using namespace std; int main() { const char16_t str[] = u"Hello World!"; char s[50]; mbstate_t ps{}; size_t length; int j = 0; while (str[j]) { length = c16rtomb(s, str[j], &ps); if ((length == 0) || (length > 50)) break; for (int i=0; i<length; ++i) cout << s[i]; ++j; } return 0; }
When you run the program, the output will be:
Hello World!
|
https://cdn.programiz.com/cpp-programming/library-function/cuchar/c16rtomb
|
CC-MAIN-2021-04
|
refinedweb
| 217
| 72.56
|
- NAME
- SYNOPSIS
- DESCRIPTION
- SUPPORT
- AUTHOR
NAME
Task - The successor to Bundle:: for installing sets of modules
SYNOPSIS
### In Makefile.PL use inc::Module::Install; name 'Task-Foo'; abstract 'Install the most common Foo modules'; author 'Adam Kennedy <adamk@cpan.org>'; version_from 'lib/Task/Foo.pm'; license 'perl'; # All the things we need for Foo requires 'perl' => '5.005'; requires 'Carp' => 0; requires 'File::Basename' => 0; requires 'Storable' => 0; requires 'Params::Util' => '0.06'; WriteAll; ### In lib/Task/Foo.pm package Task::Foo; use strict; use vars qw{$VERSION}; BEGIN { $VERSION = '1.00'; } 1;
DESCRIPTION
The
Bundle:: namespace has long served as the CPAN's "expansion" mechanism for module installation. A
Bundle:: module contains no code in itself, but serves as a way to specify an entire collection of modules/version pairs to be installed.
The Problem with
Bundle::
Although it has done a reasonably good job,
Bundle:: modules suffer from some problems.
Firstly,
Bundle:: functionality is fairly magical. The
Bundle:: magic needs to be specially implemented by the CPAN client, and a
Bundle:: dist is treated differently to every other type of dist.
It provides only static dependencies. That is, it only provides a specific set of dependencies, and you cannot change the list depending on the platform (for example, installing an extra Win32:: module if the bundle is being installed on Windows).
Finally, it exists only in CPAN. It is not possible to take a
Bundle:: dist and just install it, because Makefile.PL files are irrelevant for
Bundle:: dists.
The irony now is that an ordinary module has far more flexible and powerful dependency capabilities than
Bundle:: distributions. And because the functionality is hard-coded into the CPAN clients for the entire
Bundle:: namespace, moving beyond the current situation is going to mean a change of namespace.
Requirements for a
Bundle:: Successor
The
Task:: namespace (modeled off the Debian packages of the same name) is used to provide similar functionality to the traditional
Bundle:: namespace, but without the need to magic and special client-side support in order to have them work.
A
Task:: module is implemented as a normal .pm module, with only a version defined. That .pm module itself should NOT load in all the dependencies.
This implementation as a module allows normal Perl tools to be able to load the module and check it's version to confirm you have the required modules, without the need for a CPAN client involved.
Instead of using a magic POD format, the dependency specification is implemented using the Makefile.PL, as you would for any other module.
This also means that if the Task needs to check for the existence of a non-Perl application, or some other dependency, it can be done as well.
And you can adapt the dependencies based on the configuration of the system.
For example, if a module is upgraded to repair a critical bug that applies only for Windows platform, you can use two alternate versions based on platform detection code, rather than needing to apply the highest version in all cases.
This "normal" implementation also means that
Bundle:: modules can be created privately and no longer need to be stored in CPAN, opening up the bundling capability to companies and other non-public users.
You should also be able to do things like encode the full dependencies for you web application as a private
Task:: dist and send this tarball to the hosting company.
Their admin can then use the dist to install the required modules from CPAN and you can be far more certain that the required modules have been installed than in the traditional case.
Implementation
At this time the preferred implementation is done using Module::Install.
Module::Install allows a much more simplified syntax, and bundles the required "Do What I Mean" functionality in the distribution itself.
This bundling removes many assumptions on what may or may not be installed on the the destination system, as the installation logic can be included in the dist and does not have to be first fetched from CPAN.
It also provides you with the additional functionality from the family of Module::Install extension classes. See the Module::Install page for more details.
Of course, this is merely a convention. If you wish to write your Makefile.PL/Build.PL file using another installer, you are free to do so.
Please note that this Task class provides no functionality in and of itself, and your
Task:: distributions do not need to inherit from it.
In general, you also should not need to provide any test scripts for your
Task:: distribution, although you may wish to add tests to validate the correct installation if you wish (another option not available in
Bundle:: distributions).
SUPPORT
Bugs (or really, spelling mistakes).
|
https://metacpan.org/pod/Task
|
CC-MAIN-2016-50
|
refinedweb
| 796
| 53.51
|
Top Spring Framework Interview Questions
Last modified: February 12, 2021)
Table of Contents
- 1. Introduction
- 2. Spring Core
- Q1. What Is Spring Framework?
- Q2. What Are the Benefits of Using Spring?
- Q3.What Spring Sub-Projects Do You Know? Describe Them Briefly.
- Q4. What Is Dependency Injection?
- Q5. How Can We Inject Beans in Spring?
- Q6. Which Is the Best Way of Injecting Beans and Why
- Q7. What Is the Difference Between Beanfactory and Applicationcontext?
- Q8.What Is a Spring Bean?
- Q9. What Is the Default Bean Scope in Spring Framework?
- Q10. How to Define the Scope of a Bean?
- Q11. Are Singleton Beans Thread-Safe?
- Q12. What Does the Spring Bean Lifecycle Look Like?
- Q13. What Is the Spring Java-Based Configuration?
- Q14. Can We Have Multiple Spring Configuration Files in One Project?
- Q15. What Is Spring Security?
- Q16. What Is Spring Boot?
- Q17. Name Some of the Design Patterns Used in the Spring Framework?
- Q18. How Does the Scope Prototype Work?
- 3. Spring Web MVC
- Q19. How to Get Servletcontext and Servletconfig Objects in a Spring Bean?
- Q20. What Is a Controller in Spring Mvc?
- Q21. How Does the @Requestmapping Annotation Work?
- 4. Spring Data Access
- Q22. What Is Spring Jdbctemplate Class and How to Use It?
- Q23. How Would You Enable Transactions in Spring and What Are Their Benefits?
- Q24. What Is Spring Dao?
- 5. Spring Aspect-Oriented Programming (AOP)
- Q25. What Is Aspect-Oriented Programming?
- Q26. What Are Aspect, Advice, Pointcut, and Joinpoint in Aop?
- Q27. What Is Weaving?
- 6. Spring 5
- Q28. What Is Reactive Programming?
- Q29. What Is Spring Webflux?
- Q30. What Are the Mono and Flux Types?
- Q31. What Is the Use of Webclient and Webtestclient?
- Q32. What Are the Disadvantages of Using Reactive Streams?
- Q33. Is Spring 5 Compatible with Older Versions of Java?
- Q34. How Ow Spring 5 Integrates with Jdk 9 Modularity?
- Q35. Can We Use Both Web Mvc and Webflux in the Same Application?
1. Introduction
In this article, we're going to look at some of the most common Spring-related questions that might pop up during a job interview.
Further reading:
Java Interview Questions
Java 8 Interview Questions(+ Answers)
Java Collections Interview Questions
2. Spring Core
Q1. What Is Spring Framework?
Spring is the most broadly used framework for the development of Java Enterprise Edition applications. The core features of Spring can be used in developing any Java application.
We can use its extensions for building various web applications on top of the Jakarta EE platform, or we may just use its dependency injection provisions in simple standalone applications.
Q2. What Are the Benefits of Using Spring?
Spring targets to make Jakarta Spring Sub-Projects Do You Know? Describe Them Briefly.
- Core – a key module that provides fundamental parts of the framework, like IoC or DI
- JDBC – this module enables a JDBC-abstraction layer that removes the need to do JDBC coding for specific vendor databases
- ORM integration – provides integration layers for popular object-relational mapping APIs, such as JPA, JDO, and Hibernate
- Web – a web-oriented integration module, providing multipart file upload, Servlet listeners, and web-oriented application context functionalities
- MVC framework – a web module implementing the Model View Controller design pattern
- AOP module – aspect-oriented programming implementation allowing the definition of clean method-interceptors and pointcuts
Q4. What Is Dependency Injection?
Dependency Injection, an aspect of Inversion of Control (IoC), is a general concept stating that you do not create your objects manually but instead describe how they should be created. An IoC container will instantiate required classes if needed.
For more details, please refer here.
Q5. How Can We Inject Beans in Spring?
A few different options exist:
- Setter Injection
- Constructor Injection
- Field Injection
The configuration can be done using XML files or annotations.
For more details, check this article.
Q6. Which Is the Best Way of Injecting Beans and Why?
The recommended approach is to use constructor arguments for mandatory dependencies and setters for optional ones. Constructor injection allows injecting values to immutable fields and makes testing easier.
Q7. What Is the Difference Between Beanfactory and Applicationcontext?
BeanFactory is an interface representing a container that provides and manages bean instances. The default implementation instantiates beans lazily when getBean() is called.
ApplicationContext is an interface representing a container holding all information, metadata, and beans in the application. It also extends the BeanFactory interface but the default implementation instantiates beans eagerly when the application starts. This behavior can be overridden for individual beans.
For all differences, please refer to the reference.
Q8. What Is a Spring Bean?
The Spring Beans are Java Objects that are initialized by the Spring IoC container.
Q9. What Is the Default Bean Scope in Spring Framework?
By default, a Spring Bean is initialized as a singleton.
Q10. How to Define the Scope of a Bean?
To set Spring Bean's scope, we can use @Scope annotation or “scope” attribute in XML configuration files. There are five supported scopes:
- singleton
- prototype
- request
- session
- global-session
For differences, please refer here.
Q11. Are Singleton Beans Thread-Safe?
No, singleton beans are not thread-safe, as thread safety is about execution, whereas the singleton is a design pattern focusing on creation. Thread safety depends only on the bean implementation itself.
Q12. What Does the Spring Bean Lifecycle Look Like?
First, a Spring bean needs to be instantiated, based on Java or XML bean definition. It may also be required to perform some initialization to get it into a usable state. After that, when the bean is no longer required, it will be removed from the IoC container.
The whole cycle with all initialization methods is shown on the image (source):
Q13. What Is the Spring Java-Based Configuration?
It's one of the ways of configuring Spring-based applications in a type-safe manner. It's an alternative to the XML-based configuration.
Also, if you want to migrate your project from XML to Java config, please refer to this article.
Q14.="scheduler.xml"/>
Q15..
You can find the whole series of articles related to security on Baeldung.
Q16. What Is Spring Boot?
Spring Boot is a project that provides a pre-configured set of frameworks to reduce boilerplate configuration so that you can have a Spring application up and running with the smallest amount of code.
Q17. Name Some of the Design Patterns Used in the Spring Framework?
- Singleton Pattern: Singleton-scoped beans
- Factory Pattern: Bean Factory classes
- Prototype Pattern: Prototype-scoped beans
- Adapter Pattern: Spring Web and Spring MVC
- Proxy Pattern: Spring Aspect Oriented Programming support
- Template Method Pattern: JdbcTemplate, HibernateTemplate, etc.
- Front Controller: Spring MVC DispatcherServlet
- Data Access Object: Spring DAO support
- Model View Controller: Spring MVC
Q18. How Does the Scope Prototype Work?
Scope prototype means that every time you call for an instance of the Bean, Spring will create a new instance and return it. This differs from the default singleton scope, where a single object instance is instantiated once per Spring IoC container.
3. Spring Web MVC
Q19. How to Get ServletContext and ServletConfig Objects in a Spring Bean?
You can do either by:
- Implementing Spring-aware interfaces. The complete list is available here.
- Using @Autowired annotation on those beans:
@Autowired ServletContext servletContext; @Autowired ServletConfig servletConfig;
Q20. What Is a Controller in Spring Mvc?
Simply put, all the requests processed by the DispatcherServlet are directed to classes annotated with @Controller. Each controller class maps one or more requests to methods that process and execute the requests with provided inputs.
If you need to take a step back, we recommend having a look at the concept of the Front Controller in the typical Spring MVC architecture.
Q21. How Does the @Requestmapping Annotation Work?
The @RequestMapping annotation is used to map web requests to Spring Controller methods. In addition to simple use cases, we can use it for mapping of HTTP headers, binding parts of the URI with @PathVariable, and working with URI parameters and the @RequestParam annotation.
More details on @RequestMapping are available here.
For more Spring MVC questions, please check out Spring MVC Interview Questions article.
4. Spring Data Access
Q("org.baeldung; } }
For further explanation, you can go through this quick article.
Q23.24. What Is Spring Dao?
Spring Data Access Object is Spring's support provided to work with data access technologies like JDBC, Hibernate, and JPA in a consistent and easy way.
You can, of course, go more in-depth on persistence, with the entire series discussing persistence in Spring.
5. Spring Aspect-Oriented Programming (AOP)
Q25. What Is Aspect-Oriented Programming?
Aspects enable the modularization of cross-cutting concerns such as transaction management that span multiple types and objects by adding extra behavior to already existing code without modifying affected classes.
Here is the example of aspect-based execution time logging.
Q26.27..
6. Spring 5
Q28. What Is Reactive Programming?
Reactive programming is about non-blocking, event-driven applications that scale with a small number of threads, with back pressure being a key ingredient that aims to ensure producers don't overwhelm consumers.
The primary benefits of reactive programming are:
- increased utilization of computing resources on multicore and multi-CPU hardware
- and increased performance by reducing serialization
Reactive programming is generally event-driven, in contrast to reactive systems, which are message-driven. Thus, using reactive programming does not mean we're building a reactive system, which is an architectural style.
However, reactive programming may be used as a means to implement reactive systems if we follow the Reactive Manifesto, which is quite vital to understand.
Based on this, reactive systems have four important characteristics:
- Responsive: the system should respond in a timely manner
- Resilient: in case the system faces any failure, it should stay responsive
- Elastic: reactive systems can react to changes and stay responsive under varying workload
- Message-driven: reactive systems need to establish a boundary between components by relying on asynchronous message passing
Q29. What Is Spring Webflux?
Spring WebFlux is Spring's reactive-stack web framework, and it's an alternative to Spring MVC.
In order to achieve this reactive model and be highly scalable, the entire stack is non-blocking. Check out our tutorial on Spring 5 WebFlux for additional details.
Q30. What Are the Mono and Flux Types?
The WebFlux framework in Spring Framework 5 uses Reactor as its async foundation.
This project provides two core types: Mono to represent a single async value, and Flux to represent a stream of async values. They both implement the Publisher interface defined in the Reactive Streams specification.
Mono implements Publisher and returns 0 or 1 elements:
public abstract class Mono<T> implements Publisher<T> {...}
Also, Flux implements Publisher and returns N elements:
public abstract class Flux<T> implements Publisher<T> {...}
By definition, the two types represent streams, hence they're both lazy, which means nothing is executed until we consume the stream using the subscribe() method. Both types are immutable, therefore calling any method will return a new instance of Flux or Mono.
Q31. What Is the Use of Webclient and Webtestclient?
WebClient is a component in the new Web Reactive framework that can act as a reactive client for performing non-blocking HTTP requests. Being a reactive client, it can handle reactive streams with back pressure, and it can take full advantage of Java 8 lambdas. It can also handle both sync and async scenarios.
On the other hand, the WebTestClient is a similar class that we can use in tests. Basically, it's a thin shell around the WebClient. It can connect to any server over an HTTP connection. It can also bind directly to WebFlux applications using mock request and response objects, without the need for an HTTP server.
Q32. What Are the Disadvantages of Using Reactive Streams?
The major disadvantages of using reactive streams are:
- Troubleshooting a Reactive application is a bit difficult; be sure to check out our tutorial on debugging reactive streams for some handy debugging tips
- There is limited support for reactive data stores, as traditional relational data stores have yet to embrace the reactive paradigm
- There's an extra learning curve when implementing
Q33. Is Spring 5 Compatible With Older Versions of Java?
In order to take advantage of Java 8 features, the Spring codebase has been revamped. This means older versions of Java cannot be used. Hence, the framework requires a minimum of Java 8.
Q34. How Does Spring 5 Integrate With Jdk 9 Modularity?
In Spring 5, everything has been modularized, thus we won't be forced to import jars that may not have the functionalities we're looking for.
Please have a look at our guide to Java 9 modularity for an in-depth understanding of how this technology works.
Let's see an example to understand the new module functionality in Java 9 and how to organize a Spring 5 project based on this concept.
To start, let's create a new class that contains a single method to return a String “HelloWorld”. We'll place this within a new Java project – HelloWorldModule:
package com.hello; public class HelloWorld { public String sayHello(){ return "HelloWorld"; } }
Then let's create a new module:
module com.hello { export com.hello; }
Now, let's create a new Java Project, HelloWorldClient, to consume the above module by defining a module:
module com.hello.client { requires com.hello; }
The above module will be available for testing now:
public class HelloWorldClient { public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); log.info(helloWorld.sayHello()); } }
Q35. Can We Use Both Web Mvc and Webflux in the Same Application?
As of now, Spring Boot will only allow either Spring MVC or Spring WebFlux, as Spring Boot tries to auto-configure the context depending on the dependencies that exist in its classpath.
Also, Spring MVC cannot run on Netty. Moreover, MVC is a blocking paradigm and WebFlux is a non-blocking style, therefore we shouldn't be mixing both together, as they serve different purposes.
7. Conclusion
In this extensive article, we’ve explored some of the most important questions for a technical interview all about Spring.
We hope that this article will help you in your upcoming Spring interview. Good luck!
|
https://www.baeldung.com/spring-interview-questions
|
CC-MAIN-2021-17
|
refinedweb
| 2,366
| 57.98
|
For older versions, you may use the sort() method
df.sort(['q', 'w'], ascending=[True, False])
Nowadays, we don’t use the sort() method as it got removed in the 0.20.0 release. To sort a dataframe in python pandas by two or more columns you can use the following code-
df.sort_values(['q', 'w'], ascending=[True, False])
Ex- Let's create a DataFrame first,
Creating a data frame:
import pandas as pdimport numpy as np df = {'Topic':pd.Series(['A','B','C','D']), 'Slno':pd.Series([1,2,3,4]), 'Pgno':pd.Series([11,12,13,14])} a = pd.DataFrame(df)print a
import pandas as pd
import numpy as np
df = {'Topic':pd.Series(['A','B','C','D']),
'Slno':pd.Series([1,2,3,4]),
'Pgno':pd.Series([11,12,13,14])}
a = pd.DataFrame(df)
print a
Then sorting in ascending order:
df.sort_values(by=['slno', 'pgno'],ascending=[True,False])
Output:
Slno Topic Pgno
1 A 11
2 B 12
3 C 13
4 D 14
As of pandas 0.17.0, DataFrame.sort() is deprecated and set to be removed in a future version of pandas. The way to sort a dataframe by its values is now is DataFrame.sort_values
As such, the answer to your question would now be
df.sort_values(['b', 'c'], ascending=[True, False], inplace=True)
You can use the following video tutorials to clear all your doubts:-
Learn in detail about Python by enrolling in Intellipaat Python Course online and upskill.
|
https://intellipaat.com/community/48/how-to-sort-a-dataframe-in-python-pandas-by-two-or-more-columns
|
CC-MAIN-2021-10
|
refinedweb
| 250
| 73.98
|
React-native mobile product showcase
This simple guide will show you how to adapt the Flotiq Mobile Expo application source code to work as a product showcase app.
You will build a mobile app that will let your users:
- browse through the list of products,
- read product details,
- search through the product list.
The app will be synchronized with your Flotiq account, so you can use the CMS to add and update products and it will compile for Android and iOS phones, out of the box. The code changes required in this guide are minimal, but it might take some time to setup the working environment, both for Android and iOS.
Prerequisites
We encourage you to download the Flotiq mobile expo application from your Google Play or Apple App Store and connect it with your Flotiq account. This way you will understand how the application works and what you can expect.
The article assumes:
- you already registered a free Flotiq account
- you know how to retrieve your API keys.
Here are the remaining essentials:
Fork the application repo
Go to Flotiq Mobile Expo on GitHub and fork our repo. You will be making some changes to the code and it will be easier to keep track of it later on. Don't forget to give us a star if you find it useful!
Setup your workspace
- Install XCode on your Mac or
- Install Android Studio, for example through JetBrains Toolbox. Once installed - launch it and install an emulator with a recent Android Virtual Device
- Clone the git repository you just forked or use ours:
git clone
- Install node dependencies in your project directory:
npm install
- Start the iOS emulator
npx react-native run-ios
- Or start the Android emulator
npx react-native run-android
This should bring up the emulator and launch Flotiq app.
The screen you will see allows you to connect with your Flotiq account, but we will do this through a simple change in the source code.
If you have any issues - consult the README file in the application repo.
Code updates
Here are the steps needed to connect the app to your Flotiq account and simplify it, so it only displays the products.
Authenticate with your Flotiq API key
The code in the repository uses a login screen to authenticate with your API key. We won't need that for our Product Showcase application, but we still need to authenticate with the Flotiq API.
- Login to the Flotiq dashboard
- Create a scoped API key for the Product and Media content types
- Copy the key.
- Now save it in your React code, by adding the following line to the
App.jsfile:
import FlotiqNavigator from './app/navigation/FlotiqNavigator/FlotiqNavigator'; import contentTypesReducer from './app/store/reducers/contentTypes'; import authReducer from './app/store/reducers/auth'; // Add this line after imports: AsyncStorage.setItem('flotiqApiKey', "<< YOUR FLOTIQ READ-ONLY API KEY HERE >>"); enableScreens();
Once you save the file - the application should automatically reload in the emulator and the login screen should be skipped. You should now see the application's home screen:
Simplify navigation
For our Product Showcase app we would like to skip to the product list immediately, instead of showing the default Home screen and Content Type browser screen. To achieve that - you will need to update how the navigation is structured.
Open the
StackNavigator.js file and make the necessary adjustments:
- Remove the
{{HomeStackScreen()}}line in the
RootStackNavigatorcomponent,
- Remove the entire
Stack.Screencalled
ContentTypesScreenin the
ContentTypesStackScreenconstant,
- Make the following adjustments in
ContentTypeObjectsScreen.js
- comment out the first line add the following constants:
//const { contentTypeName, partOfTitleProps, withReachTextProps, refetchData, contentTypeLabel } = props.route.params; const contentTypeName = 'product' const partOfTitleProps = ['name'] const withReachTextProps = ['description'] const refetchData = true
Now, to properly hide the splash screen - add the following import statement:
import SplashScreen from 'react-native-splash-screen';
and add the following
useEffect() before the first one appearing in the file:
useEffect(() => { if (!isLoading) { SplashScreen.hide(); } }, [isLoading]);
Finally, in the
contentTypeObjectsScreenOptions method - replace the
screenTitle const with a static one:
const screenTitle = "Products"
Here's the full list of changes that have to be made to simplify the original app, in case you missed something.
Effects
That's it! You should now see the product list immediately after the app has loaded:
Now, you can go and play with it or publish it straight to the App stores. The original application has already been approved by Apple and Google stores, so it should be a quick and easy task to get your app approved too!
Some ideas you can try:
- add product images to the list,
- modify the product detail screen,
- remove add / edit content buttons.
Have fun, and tell us what you built!
Discussion (1)
Let us know in the comments if you found this useful, we would love to see your apps in the stores, too :-)
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/flotiq/product-showcase-mobile-app-in-react-52hh
|
CC-MAIN-2021-10
|
refinedweb
| 803
| 50.87
|
Subject: Re: [boost] [smart_ptr] No more shared_ptr<T>::value_type?
From: Andrew Hundt (athundt_at_[hidden])
Date: 2013-04-16 14:57:43
On Tue, Apr 16, 2013 at 1:45 PM, Peter Dimov <lists_at_[hidden]> wrote:
> As Nathan already pointed out, value_type has never been a documented part
> of shared_ptr's interface. It should never have been added in the first
> place. Containers, allocators and iterators have a value_type, and
> shared_ptr is none of those. In addition, even if we squint and view it as
> iterator-like, value_type is and has always been wrong - the value_type of
> a pointer to a const T must be T and not const T.
>
The value_type typedef wasn't marked as deprecated in a comment or any
other indication in the code itself. Of course the change is sensible, I
just believe that breaking changes of components in the most widely used
libraries in boost that have been present for multiple years are worth a
mention in the release notes. :-)
There are many interfaces and use cases all over boost that aren't in a
detail namespace or otherwise marked as internal implementation details
that are not mentioned or clear in the documentation :-) . They inevitably
end up getting used, and while I'm personally happy to update interfaces to
use improvements to libraries I've found around half the developers across
two completely different organizations that I've worked at will get
extremely grumpy if such changes don't come with adequate advanced notice.
Some will even go so far as to avoid using libraries entirely after one or
two breaking changes that cost them a lot of time. From their perspective I
understand that it is helpful to be able to know when to expect a 5 minute
boost update vs a 5 hour or even a 50 hour update.
Of course, I'm in favor of improvements that break existing interfaces to
make them better. I just want to convey some of the resistance I've
encountered while advocating for boost and while updating it.
You probably want element_type, although it depends on the specific case.
> shared_ptr<T>::element_type was always T before 1.53, but in 1.53
> shared_ptr<int[]>::element_**type is int and not int[]. This is not
> likely to be a problem in existing code, though.
Thanks! element_type worked for me.
Cheers!
Andrew Hundt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
|
https://lists.boost.org/Archives/boost/2013/04/202493.php
|
CC-MAIN-2020-29
|
refinedweb
| 417
| 62.98
|
Created on 2009-06-09 06:40 by rickysarraf, last changed 2010-02-25 02:29 by r.david.murray. This issue is now closed.
Shoudl argparse be included in the Python Standard Library.
I know we already have getopt and optparse but optparse doesn't
support many features easily. (like options without hyphen, nargs=*)
Here a little about argparse:
argparse: Python command line parser
One important prerequisite for including it is that the author of the
code contributes it for inclusion (irrespective of any license that may
allow us to fork the code), and that he, or somebody else, volunteers to
maintain it.
IIUC, you are not the author, so I have to reject this request.
If you find that some features are lacking in optparse, please provide
patches to enhance it.
From the author, Steven Berthard:
====================
Sorry about the delay - conferences and moving means that I haven't
had as much time for argparse as I'd like. Basically, the way things
get into the Python standard library is if a large enough community
requests it. I'm happy to contribute (and support) it if there's
enough demand, though since Python 3.1b1 is already out, the earliest
releases that might include it would be Python 2.7 and 3.2.
====================
From the conversation I have had with the author, he does seem to be
interested in it. I'll ask the author to respond to this bug report.
I hope you read this thread which discusses the same issue.
*
MvL,effbot and jjlee had shared their views to the original author of
argparse module. It did not go anywhere from there.
I see that this issue might be rejected unless followed the steps as
mentioned in that mail thread.
Thanks for the link. As a user, I see many of the features that argparse
brings, to be helpful.
Since they are missing in optparse, and since it doesn't look like
argparse will be included, should I open new bugs for those features
against optparse ?
> Since they are missing in optparse, and since it doesn't look like
> argparse will be included, should I open new bugs for those features
> against optparse ?
I think chances are very low that any such bug report would be reacted
on within the next decade.
I'm happy to contribute argparse to the standard library and volunteer
to maintain it.
For what it's worth, I don't agree that there are already too many
argument parsing libraries in the standard library. I do agree that
there are already too many *option* parsing libraries. But both getopt
and optparse don't know how to parse positional arguments at all. For
example, if your program usage looks like:
prog eggs [spam] [baz [baz [...]]]
then getopt and optparse are worthless to you - they'll just return
sys.argv[1:] since there are no options. The argparse module, on the
other hand, can correctly parse out "eggs", "spam" and the "baz" list
into appropriate attributes (in addition to doing all the other stuff
that optparse does).
I also don't think there's much of a chance of optparse ever growing
most of the argparse features. When I started argpasre, my goal was
exactly that - to keep the module fully backwards compatible with
optparse and just to add the missing features. The optparse code just
wasn't written in a way that allowed me to do that. In particular, the
optparse extension API is horribly designed, and exposes so many
internals of optparse that it's nearly impossible to add any new
features to optparse without breaking this.
Steven Bethard wrote:
> In particular, the
> optparse extension API is horribly designed, and exposes so many
> internals of optparse that it's nearly impossible to add any new
> features to optparse without breaking this.
It would be useful if several people could confirm that argparse
is *not* horribly designed.
I'm not sure about the design part, but as a user, I find both to have very
similar interfaces.
argparse is better because it handles nargs=*. This has long been
asked in optparse. Positional arguments is something I wanted recently,
and argparse makes it very easy to use that too.
On Tue, Jun 9, 2009 at 11:45 PM, Martin v. Löwis<report@bugs.python.org> wrote:
> It would be useful if several people could confirm that argparse
> is *not* horribly designed.
A totally reasonable request. Anyone willing to evaluate this can take
a look at:
It also may help to look at the extensive test suite:
If anyone has specific questions about how something works or how to
extend argparse with new functionality, I'm happy to answer those
questions.
I'll take a look at it. I've been meaning to use argparse, anyway.
It's unfortunate (at least to me, but I know I have a skewed view of
this) that the help string in add_argument uses %-formatting when
formatting the result. I'd much rather it use str.format().
I see a couple of options:
- leave it as-is and live with %-formatting forever
- add a different, mutually exclusive parameter,
like help_ex or help_str
- try to guess whether to use %-formatting or str.format,
based on inspecting the help string
I'm not really wild about any of these.
I'm still looking through the code, slowly.
Yeah, the % formatting is an artifact of argparse being around before
str.format was available. If argparse became part of the standard
library, it might be reasonable to change to str.format formatting
instead as part of the move.
It would mean that folks would have to modify their code to switch from
the current argparse module to the stdlib one, but maybe that's an
acceptable tradeoff. I'm certainly happy to change things to str.format
if that's agreed on.
Thanks again for looking at this.
I would also like to voice support for including argparse in the
standard library. It seems silly to deny a module from being added just
because we already have two inferior ones. Argparse adds so many new
(and badly needed!) features that it would be very difficult to make a
backwards-compatible wrapper around ArgumentParser. It would be much
easier, and less error-prone, to leave optparse as-is and just add this
module in addition.
If the problem is having a third module clutter up the module list,
here's a simple solution: rename the existing optparse to _optparse,
rename argparse to optparse, and in (the new) optparse, from _optparse
import *. Done. Now you have a backwards-compatible OptionParser
(which ought to be deprecated), and the new ArgumentParser. Would this
solution work?
we should never pretend an old module doesn't exist. leave optparse as
optparse. argparse can come in under its own name.
we can mark getopt and optparse as deprecated at some point and remove
them in 10 years :)
+1 on inclusion btw. It looks like it'll obsolete a bunch of crappy
argument parsing code that exists in some projects i work on but I
haven't had time to clean them up and switch.
I'm +1 on inclusion one way or another as well. I haven't made time to
do anything other than a cursory code review, but as an end user I find
the module fits my needs much better than optparse.
This was rejected prior to Steven Bethard becoming involved, so I'm
reopening.
+1 from me - argparse is a great module to use.
Only +0 purely because I haven't used argparse myself yet.
Otherwise I would probably be +1, since I have several scripts that have
fairly kludgy hacked together optparse based approaches to handling
positional arguments, subparsers and building new parsers that accept
the superset of options defined in existing parsers. The feature
comparison between argparse and optparse makes it sound like argparse
does a much better job of supporting these use cases.
The reasons I don't use argparse for them are that: a) I didn't know it
existed until recently; and b) the scripts are in an environment where
getting approval to use new third party modules is something of a pain.
Why does this have to go into the standard library? People that want to
use it can still install it from PyPI. -sys.maxint from me.
@Armin: Doesn't that argument apply to *any* library proposed for
inclusion in the standard library? By which logic we should never add
anything to the standard library ever again. Surely you don't mean that,
so could you be more specific on what you think is particularly
inappropriate about argparse?
> )
Fix packaging and do not dump useless stuff into the standard library to
make it appear more modern. Decentralization is modern, not replacing
modules in the stdlib.
[snip]
> Fix packaging and do not dump useless stuff into the standard library to
> make it appear more modern. Decentralization is modern, not replacing
> modules in the stdlib.. Another option would be to add documentation to them
warning that they're out of date and pointing users to alternative
external libraries.
>.
Documentation and a new kind of deprecation warning. It's
documentation-deprecated in one version, one later a real deprecation
warning appears that sticks around for a couple of versions. The
documentation would explain how to hide the deprecation warning and
tells the user to better use more modern alternatives.
This of course requires packaging to work flawlessly first which I
consider to be high priority.
I disagree. I think option and argument parsing belongs in the standard
(batteries included) library, regardless of how well external package
management works.
argparse has the advantage over optparse that it has an active
maintainer. What we do about the stuff in the stdlib that is no longer
maintained is a different discussion, IMO.
Command line parsing is a basic need, including amongst other standard
library modules. argparse has many advantages over optparse (not the
least of which is that it has an active maintainer). Several of these
features *can't* be added to optparse whilst maintaining backwards
compatibility, which is what prompted Steven to create argparse in the
first place.
Improvements that I am aware of include:
- handling of standard Windows way of specifying options
- sub-commands
- handling of positional arguments
I had to implement my own technique for handling a sub-command in recent
unittest changes that would have been much simpler if argparse were in
the standard library.
It must be convenient to operate in an environment where you can install
new software so easily Armin.
For those of us that operate in environments where every new piece of
software has to go through contracts review to ensure that we can both
license it for our own purposes and also subsequently transfer those
licenses to our customers, having things in the standard library is a
*huge* benefit.
This is the usual batteries included vs better packaging argument. For
developers in an environment where adding new packages is a low overhead
operation, adding something to the stdlib isn't a big gain for them
while better packaging tools are awesome. For others (including me), the
actual package installation is the least of our hassles and anything
that helps us avoid dealing with the lawyers is a big gain.
> It must be convenient to operate in an environment where you can
> install new software so easily Armin.
Trust me, it is.
> For others (including me), the actual package installation is the
> least of our hassles and anything that helps us avoid dealing with
> the lawyers is a big gain.
So you're suggesting Python should suffer because some companies have a
weird legal department?
@Michael Foord: I totally agree that argument parsing is something that
*should* be in the standard library because everybody needs it. However
at the same time it's something I could imagine comes from an external
source. I would rather maintain optparse myself for python.org than
seeing another argument parsing library in the stdlib so that everybody
has to switch over because the Python devs did not find someone to
maintain it. The stdlib is very often unmaintained for large parts; we
can't just replace a module because the developer got bored...
I think optparse just got a new maintainer.
He has a few important feature requests to deal with as well.
On Mon, Sep 14, 2009 at 11:15 AM, Armin Ronacher <report@bugs.python.org> wrote:
>
> Armin Ronacher <armin.ronacher@active-4.com> added the comment:
>
>> .
By that logic we should remove getopt and optparse,
>
>)
One is only enough if its a useful one. argparse can be that one.
optparse and getopt are both sorely lacking. If anything deprecate
getopt and optparse so that they're gone in 3.4.
By your argument we shouldn't even have one command line parser
because it does nothing to cross platform support.
Please DO NOT drag an issue asking to add a useful library to the set
of batteries included into the packaging decentralization flamewar.
There are is a large python user base that can never code that does
not come as part of python itself for one or more of legal and
technical reasons. This issue is not the place to debate how stupid
anyone thinks that concept is.
Armin; if you are serious in wanting to help out with the stdlib and core
work, feel free to help us discuss this over on the stdlib-sig
()
or help commit patches and fixes for all of the modules that are growing
long in the tooth and need help.
Argparse seems to be overloaded with rarely used features. Instead of providing
API to add these features and allow users copy examples it tends to be an all-in-
one solution that is hard to use due to abundance of specific parameters.
Look at constructor, for example -
{{{
description - Text to display before the argument help.
epilog - Text to display after the argument help.
version - A version number used to add a -v/–version option to the parser.
add_help - Add a -h/–help option to the parser. (default: True)
argument_default - Set the global default value for arguments. (default: None)
parents - A list of :class:ArgumentParser objects whose arguments should also be
included.
prefix_chars - The set of characters that prefix optional arguments. (default: ‘-
‘)
fromfile_prefix_chars - The set of characters that prefix files from which
additional arguments should be read. (default: None)
formatter_class - A class for customizing the help output.
conflict_handler - Usually unnecessary, defines strategy for resolving conflicting
optionals.
prog - Usually unnecessary, the name of the program (default: sys.argv[0])
usage - Usually unnecessary, the string describing the program usage (default:
generated)
}}}
the only useful arguments by default is 'description' and 'add_help' (which is
better to see as 'no_help' to turn off default behaviour). 'version' is not
useful, because it adds '-v' shorthand that is often used for verbosity.
'prefix_chars' is not useful, because the only sense one may need it is to provide
windows conventions like '/longarg' for '--longarg' and not '//longarg', but it
doesn't allow to do so.
Everything else is constructor bloat, and even with such abundance of options it
still unable to generate usage help prefixed by program name and version - the
sole feature I miss from optparse.
-1 for now
@techtonik: If you have a specific feature request for argparse, I
recommend that you file an issue on the argparse tracker[1]. I assure
you that despite the fact that you only have need for a couple of the
constructor parameters, the rest exist because people have asked for
them. Fortunately, since they're keyword parameters, you only have to
specify the ones that you care about.
[1]
PEP 389 has been accepted.
|
http://bugs.python.org/issue6247
|
CC-MAIN-2016-30
|
refinedweb
| 2,634
| 62.98
|
In fact, I am trying to load all the bitmaps which I need for the whole game. I don't think this is the right thing to do, I would much more prefer to load only the bitmaps which I need for the first level, and load bitmaps for another level as and when I start that particular level, but I don't know how to do it either - to load the bitmaps later, I need the Context and I don't know how to pass it into onDrawFrame function, where is my main game loop (as explained in my other post)
Ahhh
You don't want to pass the context to onDrawFrame the interface won't let you. What you can do is pass the context into the Renderer so that it is available for use elsewhere.
This might get a bit long and so I apologise if i am being too verbose and at too simple a level. Also I am not making any claims that this is the only way to do things.
You have your Activity (Generally you will have an activity for the game, and 1 or more activities for menu screens and so forth). Moving between your activities is a place where you can decide to do some loading of the things you need for the next activity and free up any memory (If this is going to be a time consuming process you display a lightweight loading screen while the loading takes place).
In your activity for your game I am assuming you will have your GlSurfaceView and your GlRenderer of some kind. The surface view as far as I recall has a setRenderer method that allows you to inject the renderer you want to use. The GlRenderer exposes the onDrawFrame(GL10 gl) method which will get called constantly by the surfaceView. It sounds like your onDrawFrame(GL10 gl) looks a little like the below.
public void onDrawFrame(GL10 gl) { endTime = System.currentTimeMillis(); long dt = endTime - startTime; int fps = Math.round(1000f / dt); if (fps < TargetFps) { try { Thread.sleep(TargetFps - fps); } catch (InterruptedException e) {} } startTime = System.currentTimeMillis(); // update the game state // render the game using the gl context }
So your question is how do I get my Bitmaps into memory such that my Level has access to them?
I would very much recommend using a class purely for loading the bitmaps (This can be a Singleton but you have to be careful about how you work with a Singleton in Android as your application can be killed at anytime and thus your Singleton has to rebuild its state when the app resumes. For managers of things like bitmaps and sounds this generally is not a big deal and easily handled.).
You could possibly do something like the below if you use a singleton style object for handling your bitmap management.
// This is just off the cuff code, i don't expect it to compile it's just to give you an idea. public class GameActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyGameLevel level = createTheLevel(); GlSurfaceView view = // Get a hold of your view or create it Renderer r = new LevelRenderer(level); view.setRenderer(r); // If this causes noticeable issues on starting the activity don't do it Runtime.getRuntime().gc(); } private MyGameLevel createTheLevel() { // Create a level it can load the textures MyGameLevel level = new MyGameLevel(); // Load all the textures i need (this could be done by the level class this is just an example for arguments sake) MyTextureManager.instance().loadBitmap(context, R.drawable.whatever); MySoundManager.instance().loadSound(context, R.raw.sound1); // etc...but all your resources are loaded } } public class LevelRenderer extends Renderer { MyGameLevel level; public LevelRenderer(MyGameLevel l) { level = l; } @Override public void onDrawFrame(GL10 gl) { // Game loop level.update(dt); level.render(gl); } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { // You can do this or you can wait until you call level.render before binding the textures, your implementation will suit your needs level.bindGlTextures(gl, config); } } public class MyGameLevel() { public void bindGlTextures(Gl10 gl, EGLConfig config) { // here you can use the MyTextureManager to get the bitmaps and bind them to your gl context as you call this as soon as the surface is // created...if you wan't to, delay this until the render call it is fine the important thing is the Textures exist already in the manager in bitmap form. // something like ....can't quite remember the syntax gl.bindTexture(GL_TEXTURE_2D, MyTextureManager.instance().getBitmap(R.drawable.whatever); } public void render(GL10 gl) { // draw the level } public void update(long dt) { // update the level } }
There are many ways to achieve the same thing so what I have posted above is one method for loading the Bitmaps and providing access to them. In the onfinish method of the activity you can clear the texture manager and recycle any bitmaps you no longer need. Does this help at all?
I realised I didn't post any code for the MyTextureManager class I made up in the example above...however I think you can get the idea. You are just using that as a cache to store your Bitmaps. The method to load a bitmap takes the context which is readily available in the Activity (where I used it in my example..but it can be wherever you pass the context...you could for example call getApplicationContext() in your Activity and pass that context into the Level and have the Level manage putting the Bitmaps it needs into the MyTextureManager) and a resource ID. Thus you would just call BitmapFactory.decodeResource(context.getResources(), resourceId). Obviously how you architect things will be suited to your needs I am just proposing ideas to get you thinking.
|
http://www.gamedev.net/user/189010-fiallen/?tab=reputation&app_tab=forums&type=received
|
CC-MAIN-2014-52
|
refinedweb
| 957
| 57.91
|
- status: open --> open-accepted
When I type "velvet" or type "velvet filename" I get the
error message
Major opcode of failed request: 12
(X_ConfigureWindow)
Value in failed request: 0x0
Serial number of failed request: 5607
Current serial number in output stream: 5768
filename is the name of a felt input file that ran
successfully through
felt.
When I compiled the system complained about the
#include <GL/xmesa.h> in the opengl.c program
I replaced it with
#include <GL/osmesa.h> and it compiled OK.
I am running GNU/Linux 2.6.12
Logged In: YES
user_id=15536
This is a known problem with Velvet. A workaround is to
change the Makefile in src/Velvet. Instead of linking to
Xaw3d, link to Xaw. Here is a cvs diff on my Makefile
(compared to the CVS repository):
% cvs diff Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/felt/felt/src/Velvet/Makefile,v
retrieving revision 1.4
diff -r1.4 Makefile
21c21
< -lGLw -lGLU -lGL -L/sw/lib -lXaw3d -lXmu -lXt
-lSM -lICE -lXext -lX11 -lm
---
> -lGLw -lGLU -lGL -L/sw/lib -lXaw -lXmu -lXt -lSM
-lICE -lXext -lX11 -lm
|
https://sourceforge.net/p/felt/bugs/8/
|
CC-MAIN-2016-30
|
refinedweb
| 187
| 66.03
|
Feel free to send your feedback or ask some help here!
Hi,I post here because i need some advice for this puzzle.
My first idea for this challenge was obviously to use trees so i created :
struct Tree{ char data; // a number (between 0 and 9) vector< Tree > childs; // following of any phone numbers starting in the same way};
In that way, i thought the following picture was perfectly illustrated.
So, I created also 3 little functions :
My programs works perfectly for the 4 first tests but fails the last one and i can see in the console that the program stops at about the 750th number (on 10.000).
So i suppose my idea was not optimal (or maybe functions implementations) and i'm looking for some new leads, or hints. I think about using struct Tree {map< int, Tree>} maybe... ?Thank you for your help !
Edit : Made in C++
I think you're overkilling it, we only need to deal with strings and substrings here.
If you decompose a given string (phone number), with all its prefixes, you get exactly phone.length() substrings. 0123 -> 0, 01, 012, 0123 - so the idea is to check the existence of each prefix in a common list of prefixes. If it's new, then you need to count it (+1), if it's already there, do not count it (0). For example we already have 0123 stored, now you compute 01299 -> 0, 01, 012, 0129, 01299, the first three give a result of 0 (already in our list), but both 0129 and 01299 are new, so the whole string would compute as 0+0+0+1+1
phone.length()
0123 -> 0, 01, 012, 0123
0123
01299 -> 0, 01, 012, 0129, 01299
0129
01299
This idea allowed me to compute 7k5 phone numbers before timeout.. Not quite enough for the 10k needed, had to use another trick to reduce the computing time from around 17" to 3" (it took me a little while though, but the trick is simple enough)
I did the same thing at first with a recursive search, and by the end it was taking far too long. What rkj said is key! Without giving away the answer, think on the fastest way to count all the string/substring entries. In the end this puzzle is the shortest code block I've written for any puzzle at CodinGame. The longest list test completes on avg in about 80 milliseconds. (this is coded in Go)
I did it using the "tree" algorithm and I passed all tests in C++, so I guess it is more an implementation issue than an algorithmic problem. However, I did not use a vector, but a Tree* table[10] filled with NULL in the constructor. Then you can fill the table only when you need it, which can probably speed the algorithm up to a factor of 10.
Combining the "string" method to a binary search (perhaps using a map container, which uses an efficient hash method) looks like an interesting candidate for reaching even faster speed...
hi, I used the same system as rkj (almost) -> decompose a String Phone number in substring and try to add each substring to a list if it doesn't already exist.
at the end return the size of the list.
with Java and the Set Interface, processing the 10k phone numbers requires 180ms.
so that's definitively a good solution (and the shortest I wrote in Codingame...)
Actually, you don't even need additional storage. Simply sorting the input (using an appropriate comparator) and then iterating once over the pairs of consecutive numbers is enough. 20 lines of Clojure (I know, I know... Using Clojure is kind of cheating )
20 lines is actually long for this puzzle.
Oh noes!!! *clojure_addict heads over to a dark corner and starts crying uncontrollably not being able to face the humiliation...*
Seriously though, 20 lines of what language and using what approach?
EDIT: Actually, I just realized that I could improve it more. I noticed that I don't need a custom comparator after all (the built-in string comparator is enough), and I also optimized away a variable I used only once. I now am at 10 lines!
I need 12 lines with Java.
12 lines sounds pretty good for a Java solution. I'm curious, how much of it is boilerplate (e.g. imports, class definitions, method signatures etc...) and how much is actual problem solving code? For example, ATM, I have 7 lines of Clojure but the body of my main function only spans 3 lines. The rest are namespace declarations, newlines for readability etc...
Things get so much easier after reading tips on solving puzzles.
.NET Spoiler Alert
UPD: ugly not formatted non-readable and non-usable one-liner :-D:
Console.WriteLine(new HashSet<string>(Enumerable.Range(0, int.Parse(Console.ReadLine())).Select(t => Console.ReadLine()).SelectMany(t => Enumerable.Range(1, t.Length).Select(index => t.Substring(0, index)))).Count);
As @nickmaovich prove it, you shouldn't count in lines but instead count in characters
lines
characters
yep, in fact, the complete code needs 19 lines :
4 for imports and new line,
1 for "class solution"1 for " public static void main"3 to read input (scanner etc...)7 really doing the job,1 for outputand 2 more for closing "}"
A problem here, my implementation go through the first tests but not the last one.My solution is similar of @arnaudus'. But I get a Segmentation fault (only on the last test) that I don't understand.. I would be glad if one of you can have a look.
//Tree structure
struct Node{
Node* children[10]={NULL};
int elm=-1;
};
typedef struct Node Node;
//add a new node and increment the compter
Node* add(Node* dad, int _elm,int& cpt){
Node* son;
son=(Node*)malloc(sizeof(Node));
son->elm=_elm;
dad->children[_elm]=son;
cpt++;
return son;
}
int main(){
int cpt=0;
Node* phone_book;
phone_book=(Node*)malloc(sizeof(Node));
int N;
cin >> N; cin.ignore();
for (int i = 0; i < N; i++){
string telephone;
cin >> telephone; cin.ignore();
Node* cnode=phone_book;//phone_book cursor
for(string::iterator it=telephone.begin();it!=telephone.end();++it){
Node* child=cnode->children[*it];//Segmentation fault
if(child==NULL)
cnode=add(cnode,*it,cpt);
else
cnode=child;
}
}
cout << cpt << endl;
I think I will try the solution proposed above (that seems a bit cheaty to me but should work easily)I think that the problem comes from "malloc' but I'm still very naive about dynamic memory allocation so I cannot figure out where is the bug.
Thank's in advance.
Ok, so here's what i'm gonna do: I'm gonna explain why what you did isn't good for C++ and then i'm gonna explain two ways to do it, the way to do it properly, and the way to it your way.
PLEASE refrain from using another code, yes you'll pass, get 100% and badges, but you won't have learn anything.
So why wrong?
What you did is C, malloc is a good function when you know how to use it, but only in C.In C++ we almost never use malloc, for simple reasons that I'll explain later.
Wrong too because you reinvent the wheel, which is fine in C, but not in C++, you try to implement a trie and that's good, but to do linked list, use <list>, <vector> etc...
<list>, <vector>
Solutions
Good one:
class Node {
public:
char val;
Node(new_val) : val(new_val) {}
vector<Node *> children;
};
And in the main
vector<Node *> list
and when you need to add a new elem:
list.push_back(new Node(char_value))
Bad one:
struct Node{
Node* children[10]={NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
int elm=-1;
};
Your children was badly initialized, which cause
Node* child=cnode>children[*it];//Segmentation fault
To fail.
If you want to continue coding like this, please use C, doing C++ won't do you any good if you keep using C coding style. if not please look at this: Vector Reference
Hope I helped
Thank you for your quick answer @CvxFous (as always).I know I'm still C oriented and I try to get read of it, but it's never easy to forget the language you learned first. Well, enough excuses.
So basicaly, you told me to replace my malloc by a constructor. It's the only difference between your class and my struct, am I wrong ? I'll try it !Then I still don't understand why my code only crashes on test 5 and not before. And what is the purpose of your "list" (which is a vector.. notation very disturbing to me).I know what a C++ vector is, thank you, and that is why I'm not using it here. In fact, I need a random acces in O(1) that's why I use an array.
Don't fear, you always help, and I thank you again for that.
Because in your struct you didn't initialize all the 10 elements of children.Let's take an example:
Node* child=cnode->children[*it];
if(child==NULL)
cnode=add(cnode,*it,cpt);
else
cnode=child;
if (*it) == 2 then cnode->children[2], because it is unitialized, may be an invalid pointer like 0xFFF02521. so child isn't NULL and you affect cnode to the value of child.Then you do another loop, and again:
Node* child=cnode->children[*it];
and there you got cnode which is 0xFFF02521 and you try to access to the value that it is pointing cnode->children (which means (*cnode).children). Not only cnode is random, but *cnode is more and cnode->children is another layer of random, and chances are that you access invalid memory adress -> segfault.
Now there's a second issue with your program.Truth is, C++ is a good guy, even if you didn't initialize everything, it MAY have do it for you, so MAYBE the problem isn't there.But one thing sure is:
for(string::iterator it=telephone.begin();it!=telephone.end();++it)
Node* child=cnode->children[*it];//Segmentation fault
*it doesn't range from 0 to 9, it range from '0' to '9', which is from 48 to 57. Even if C++ has initialize to NULL the first ten value of your array, it didn't for THAT far away.
Fix: it - 48 of it - '0'
Now, second part
C++ vector isn't only a list, is also the equivalent of array in C.You can do stuff like tab[5] with it.
And you didn't do a hastable of O(1), you did a Trie, each element contain up to N sons, and each sons contain up to N sons. The complexity is O(N) to access the element. for you N is 10 so it is trivial and you've found a great way to do the exercice. (I did it that way too)
Back to C++.
My point is that with c++, you don't need to create your own add function, neither do any malloc:
vector<Node*> phone_book(10, NULL);
int N;
cin >> N; cin.ignore();
for (int i = 0; i < N; i++){
string telephone;
cin >> telephone; cin.ignore();
vector<Node*> &cnode = phone_book;//phone_book cursor
for(string::iterator it=telephone.begin();it!=telephone.end();++it){
Node* child=cnode[*it - '0'];
if(child==NULL)
{
Node *n = new Node(*it - '0')
cnode.push_back(b);
cnode = n->children;
}
else
cnode=child->children;
}
}
cout << cpt << endl;
Something like that
Thank you for your time !
This was the big problem, I was starting to desperate! I'm kind'of blind in this case... I'm glad you enlighted this point for me. Really BIG thank's.
For me, N always refer to the input, so O(10) ~ O(1) ^^"But basically you're right, I'll become more vector friendly, I promise !
I wish there were more people like you on the forum. Hope I'm not a too stupid student.Eryns.
Actually, when reading your code, it seems obvious to me that a clean and elegant solution would be to use a map<char, Node*> instead of the vector. No need to initialize it and to fill it with NULL, or even to save some space for all these NULL elements. And this will work for any character, and not only for 0-9 (think about the + in international phone numbers ). And no need to assume that 0-9 are contingous and ordered in the character table.
map<char, Node*>
There is probably a small cost in using map instead of vector, but a lot of time is saved when constructing a new node, so I wonder if the map thing is not faster.
|
http://forum.codingame.com/t/telephone-numbers-puzzle-discussion/43
|
CC-MAIN-2018-30
|
refinedweb
| 2,138
| 70.43
|
Join devRant
Search - "list"
- Front-end developer's to-do list :
☑ Climb Everest
☑ Learn how to speak mandarin
☑ Become god
◻ Vertically center something in CSS21
-
-
-
-
- Yo momma so fat, she sat on my binary tree and it collapsed into a linked list!
- Anon from Reddit.11
-
-
-
-
- So I got a notification that my LinkedIn profile showed up in several searches this week. Not sure I should be too happy about it though...6
- I am new to Linux and still trying to figure out the CLI
Luckily my colleague and good friend helped me out with a list!18
- My smartphone specifications list
1. Should come with 3.5 mm jack
2. No exploding battery please.15
-
-
-
- He's making a list
He's testing it twice
SELECT * FROM users WHERE behavior="nice"
SQL-clause is coming
To town.
Credit to @leeflower on Twitter2
- > project nearing deadline [✔]
> an IDE that hangs itself [✔]
> awkward status meetings that turns into pointless discussion [✔]
> confusing requirements [✔]
> getting addicted to tea [✔]
> losing track of time [✔]
> sleepless nights [✔]
> overgrown hair and beard [✔]
> did I shower today ? [✔]
> no srsly did I ? [✔]
> I don't know where am going with this [✔]
> I should probably get some sleep [?!]6
-
- enabling firewall on a vps to secure my docker containers and forgetting to add openssh to allowed list --> ssh blocked 😃🔫24
-
- Want free stickers? Here's a short list:
Will update (in comments) when new ones are found.4
-
-
-
- You have been unsubscribed from this mailing list.
You will recieve a confirmation email.
Why is the confirmation needed?12
-
- A curated list of awesome websites, tools and resources on internet across different categories and genres.97
-
- Last day of vacation, decided to check my work email.... The list of things they've broken is.... terrifying, I don't want to go back... ever...3
- DON'T LIST A JOB UNDER "PHP DEVELOPER REQUIRED" IF THE SPECIFICATIONS MENTION NOTHING ABOUT PHP BUT ASK FOR WORDPRESS AND WOO COMMERCE EXPERIENCE YOU UTTER BLOODY GRAVY BOAT7
-
- Fight against procrastination.
//now I can cross "make your first rant" item on my todo list from 2016.6
- My last girlfriend was a Linked List. It was easy to get head but getting tail required serious effort
-
- Making our own linked list class in C++
This is how he deleted his list in the destructor
~myList() {
delete head;
}
Gets a couple of points off, blames the prof for biased marking6
-
-
- Going through the name list of Manifesto for Responsible Software Development at... when suddenly.....!11
-
- When management produces a list of priorities but every item on the list is #1 priority. So some items are in BOLD to signify their even greater priority over other priorities.14
- Privacy Check List
- Mullvad VPN ☑️
- Random agent switcher for the lolz ☑️
- HTTPS Everywhere ☑️
- uBlock Origin ☑️
- Privacy Badger (Still think it's suspicious somehow) ☑️
Anything else you would recommend aka add to the list?23
- Hugging hell i hugging hate this shit.
*/Linux users who watch mailing list will understand this rant/*22
- Woohoo we asked for a prioritized list of changes , we got 2 power points instead.
Yeah, fuck you too.4
-
-
- Note to self:
Don't try to remove elements from a list using a for loop because the FUCKING LIST SIZE CHANGES!
Just copy required elements to another list and discard the previous.
Spent fucking 2 hours on this.
/Rant9
-
-
-
-
-
-
-
- Was looking through the most used passwords list (the one that had 'removed my password from lists...'). 'password' is like one of the top one, and then 'PASSWORD' is 810th !?!?!?! At least it's before hentai...8
- When I slice the head off a list I usually call the rest decapitated.
const [head, ...decapitated] = myList1
- Python is such a elegant language, but why can't I have an if-clause on a simple for-statement when I can have it in a list comprehension??23
- Hey guys I just installed Arch Linux and a desktop environment, I don't know what to do with my life now...10
-
- A year ago, in the second programming course in uni, we had an assignment about making a linked list. It was nice, as I learnt how they are made. But then we had another, then a lab, and after that other 3 assignments adding functionalities to our list and improving it. It was horrible, but it was finally over.
The problem is that the following semester, the first assignment of the operating systems course was about making a list. The first assignment of the programmimg course made us implement a list too, to practice polymorphism. We had lists also for the last assignments for those two courses (they were about heaps and custom memory management respectively).
At this point I was completely fed up with lists. That brings us to the present, and guess what we are having for the first assignment of the algortihms & data structures course... Yeah. I hate linked lists6
- For people who love Open Source.
A list of open and self hosted applications....
Enjoy!!! 😊2
-
- Today I sent email blast to wrong list of 12k recipients. I was given the list by another employee. I crashed the email server. It was fun.2
- wrote a todo list program, which also is my first self written api. Currently load testing. Server is ok.6
- 1 bug, 2 hours.
Just from
this.setState({list : list})
To
this.setState({list : [...list]})
OMG...4
- Who ever decided to put Stop right above Publish in the WebSphere server options list is a sadist10
- So one problem checked off my list today, solved by concluding:
MOTHERFUCKERS DON’T READ WHAT THE CHECKBOX SAYS4
-
- Patterns 👏 are 👏 a 👏 language 👏 to 👏 talk 👏 about 👏 design 👏 not 👏 a 👏 comprehensive 👏 list 👏 of 👏 the 👏 only 👏 things 👏 you're 👏 allowed 👏 to 👏 do 👏 in 👏 code.6
- When I'm trying to find resource to setup react-toolbox with react using same keyword in google for past 3 hours ....(google removed me from human being list to bot list)9
-
-
-
-
- > devRant offers to let me share my rants on Facebook.
> Majority of my colleagues and boss in my friends list.
Nope.2
- Need help with creating an awesome-list for devRant!
If you have any devRant-related projects, please add them!31
-10
-
-
-
-
-'ve spent so much time writing terms and conditions, I'm tempted to list it as a feature of my app3
-
-
-
-
-
-
- Does anyone else make a list of new things you hear about to research later? I have a big ass list, as well as dozens of open tabs with things to read up on.4
-
-
- What the actual fuck...
What kind of API does not do data integrity validation, and allows me to subscribe a user to a newsletter list with a non-existant list id ?
That's some fucking bullshit. fucktards at
- Interviewing for a front end JavaScript position. Interviewer asks me to converge a linked list in c#. wtf?4
-
-
-
-
- Here is way to find the element with maximum frequency in a list in Python:
a = [1,2,3,4,1,2,3,4,1,2,3,1]
print(max(set(a), key = a.count))6
- Finally, it's working..
A new device added to my Collection.
Welcome Echo Dot !!!!!
Long list of skills planning to implement..7
-
- My first rant !
Me: Can you give me a list of items in game please?
Him: List<Items> itemsInGame;
Me: Come on ... 😅2
-
-
-
-
-
-
-
-
-
- MRW a client needs a site with new content but they leave to go on holiday and don't give you a list of content.
- Initialize List ✔️
Initialize and hydrate DTO ✔️
Forget to add DTO to List and wonder why my list is returning empty?
Every fucking time!2
-
- I started thinking it would be a good idea to write a shopping list in json so it's nice and categorised.
Then I thought what people who saw my list in the shop would say.3
-
-
- @dfox great podcast cant wait for the next one
I must admit i havent read the pragmatic programmer its going on my bucket list5
-
-
-
-
-
- What podcasts are you guys and gals listening to?
My list:
Startup School
Myxergy
The pitch
This week in startups
Tim Ferris podcast
What's yours?3
-
- This has been here for atleast 6 months. When are we getting a more extensive list? Would be quite interesting 🙂1
-
- So COSMOs hasn't implemented a proper clearing method for lists... Having to do this to clear my output list hurts!7
- When you're so deep into programming that you see this piece of code in a bulleted list and start to feel your body shaking and feeling really badly.2
- An example of bad documentation? Unity. It has a list of poorly described methods of deprecated classes. The only reasonable documentation is the community. Docommunitation.10
-
- Any tips on how to organize the ever growing shit list that is my tasks list? Maybe some of you are using some awesome methods that I don't know about?8
-
- !rant
What do you listen to when programming?
Here's my playlist:
-
- Have you guys seen the cool write up fossBytes did on the new devRant 'Most Annoying Programming List'. Many news sources picked up the story. Way to go devRant!
-
- Todo list when you tell someone you are developer:
1. Fix slow computer
2. Remove virus.
3. Help with Microsoft Word
4. Check why printer is not working
- Tye branch manager just made me spend 1.5 hours rearranging a huge dropdown list because he wanted to be able to sort it differently. We are deleting that dropdown list tomorrow.1
- An incomplete list of 2018 personal dev goals:
* do more web development (It's fun. In a crude way.)
* finish the smart lamp I started building in 2016 ...
* fix up more electronic devices while learning their inner workings
* learn Python and some other language
* get myself a blog again
* get that testautomation thing which is haunting me in my dreams already to production
* be more relaxed
* do some home automation while not cursing all that much
-
-
- I once sent a test message mail to a list full of over 500 customers instead of the actual test list on mailchimp! :p
- I appreciate people making tutorials to help people learn, but please, please, please, choose a different topic than creating a task list next time.
- Three hundred programming problems from interviews.
You can stretch your brains out a little.
-
-
-
-
- me: yes..hurray I fixed 5 of 25 critical bugs. Its turning out to be a great day.....
...checks the bug list....
"There are 29 critical bugs in the list"1
- Everyone comment one programming language that someone else did not already comment. Let's see how many different ones we can list. GO!58
- Want to get last value of a list?
value = 0
for value in list:
pass
working with 10 year old code :/3
-
- Wonder how long time it will take until haveibeenpwned.com will be listed on it's on list of data breaches....
-
- Just discovered my little devrant april fools inspired binary tampermonkey script made it onto the devrant awesome list 😊3
-
- How do you customise your arch installation ?
Desktop environment and stuff ..
Give me the whole list3
- !rant
Hmm... so I was thinking...
What if devRant implemented a feature that lets you get rants into some kind of list, accessible via your profile? Kind of like the "Watch later" list on YouTube, or playlists. I know we have a "Favourites" list of rants, already, on devRant, but being organized about this might be a good idea.
What do you think?3
-
-
-
- Installing a Library update, so that 2 lines of code can put some space between 2 list items
Thanks google2
-
- and this is why you dont let a first timer build your database....
"has 34 column names in index key list. The maximum limit for index or statistics key column list is 16"4
- I had perfect code until the exception handling was on my Todo list... Fuck my beautiful architecture I guess6
- That feeling when your rant is on top of weekly rant list..
Feeling awesome thanks for the support buds !
- The other day I was having a problem with a RecyclerView. A button was being drawn all the way on the top of the screen with a HUGE padding. Changed background of said button, fixed. I will never understand..
-
- Have stopped using 9gag completely since I started using devrant. Soon 9gag is going to be in a list of my 'to-be-deleted-apps'
-
-
-
- When an architect in your team asks for a list of open source frameworks being used in your front end, and follows it up requesting the JARs. *facepalm*1
- so what's on the list for today? writing unit tests for a broken php app because NO ONE THOUGHT TO WRITE THEM BEFORE HAND.......
- current site issue, client and pm cant see the full list of people in multiple select box because they cant find the scroll bar.
-
-
- Last year, I made an application of A* maze-solving algorithm in class. I used a linked list and my friends used arrays. Their algorithms were way faster than mine (I remade it later :p).
OK I understand that accessing memory by address if way faster than accessing by iterations, but I also see that python lists or C# lists are really fast. How is it possible to make a list performance-proof like this? Do the python interpreter make a realloc each time you append or pop a value?1
- Why do developers leave out the google search engine when they list out their development tools?2
-
- how am i supposed to be interested in a company if they list all the requirements of what skills i HAVE TO HAVE, they list EVERYTHING except HOW MUCH FKING MONEY THEY PAY?4
- Python list and dictionary comprehension is some crazy awesome black magic. More languages should have these.5
-
-
-
- My coolest project is my Facebook - to - email adapter 😜
An interface that takes emails from an inbox (mailing list) and posts it to a Facebook group, if it is a new mail. If it is an answer, it finds the original post and posts the new mail as a comment.
Once every hour it checks Facebook for comments on the posts it made, creates a list and sends it the the mailling list 😀
-
-
- Does anybody know an awesome list of services relevant to (.NET) developers? Preferably self hosted.
The section in kickballs list is too short I think.7
-
-
- feature request, a list to which people can add feature requests to prevent people requesting a feature multiple times.4
- Life :)
But seriously, there's sooooo many side projects I'd really like to start/finish I can't even list them...1
- create, read, update, delete, get, store, put, post, show, view, patch, destroy, list, remove, save, status, ...
crudgsppsvpdlrss?
- awesome-calculators: 😎 A curated list of calculators, for every platform! Please suggest more calculators and ⭐ !
- Python list / dict comprehension, one of the numerous reason I truly love python. Simple and powerful abstraction2
-
- Dear emailing list,
Do not send me a confirmation email to let me know that my cancellation to your stupid email list was successful. Fuck you. I don't believe you.
- So why does the devrant list stays the same all the time 🤷♂️ I read those rants since monday wtf ...3
-
-
-
- I have a question that my friend and I can't work out an answer for. Is a list of length 0 sorted?
A list of length 1 is sorted so you'd expect this to be sorted but then there's no items to be sorted. But does this mean it it sorted???3
- Let's list off all the craziest stuff that happened in 2016. (Crazy meaning unexpected not good or bad)
I'll start with the cubs winning the world series.7
-
- Didn't see this mentioned before. BeyondCompare is one I use everyday, but goes unnoticed in the fav software list.3
-
- Wanted to share one of my projects from school.
3 years ago I had to create a Linked List Mesh in Java that held data in each individual node, as well as location data of each of two of it's neighboring nodes.1
-
-
-
-
- Whatsapp went down.. "Who cares" typical american person.. "Wtf just happened" - Brazilian, Portuguese, Indian and the list goes on.. #notRacistRant #americanSwag4
-
-
-
- Today I wondered why the heck there where null-Elements in my list.
When searching for elements to add I check if this element == null after adding it to the list. Not my brightest idea.
- What would be the best language to build a randomiser?
I want to build a little program where you can insert a number of items and picks one at random.22
- On a white board discussing with the team, rubbed list leaving numbers so that I won't have to list them again.1
-
- The code I'm working in always has problems with stuff like "Object obj=new Object();" or "List stuff=new List;" without type specification, but now I found the summit: "private void methodName(Type parameter) *throws Exception*"
- Completing an application as Head of my department. (Digital Media)
Question: 3 greatest weakness. What should I list down? :/2
- #magento
Idk who's developing that, but that's what occured to me:
Request for getting specific category in shop:
V1/categories/{category_id}
Request for getting categories list:
V1/categories/list
....?
"Invalid type for value: "list". Expected Type: "int""
I wonder fucking why -.-'1
- When the previous dev's function returns null instead of an empty list when no results were found. Why?!
-
-
- That moment when ur boss asks you to list what you would do this week and I don't have the minimal idea...2
- Illusionism, hands down. Although chess and speedcubing are close seconds in my list of geeky non-dev activities. 😀
- Everything looks easy in .NET MVC, but making it generate a checkbox list for you is so damn complicated.4
-.”
- Fuck netlogo,
Fuck the way you have to code anything in there, you can't even access an element in a list or string using list[index] but you have to use "item index list".
Netlogo is aimed at kids so it also avoids using math symbols like it's a sin to use them.
You make variables with "let name value" and "set name value".
It's a huge pain whenever I get a assignment which I need to make in netlogo again.
Fuck netlogo.1
- ...when your project TODO list is growing exponentially and you just give up tracking new ideas/feature requests
;(1
-
- is there any quality browser apart from safari chrome chromium canary firefox opera (the list is in randim order)12
-
-
-
-
- ! Rant...
Very nice interactive workshops for brushing up on web dev skills ☺1
-
- am launching an Android app in Play store for the firdt time, any To-do list that I should consider before launching it? already been thru SO to-do, anyone has anything more to add?4
-
-
-
- I spend so much time trying to come up with great app ideas, and something as simple as The List App () goes viral.2
-
-
- Why, oh why can I not just get distinct values in my query so I don't hit the goddamned list view threshold in SharePoint?
- -.- why not keep the image url in a list for all the things?
- Planning to do a mailing list/website for a weekly updated list of *must-read* long form articles about tech trends, AI, finance and society.
Would anyone be interested in having a mailing list for this?1
- In Kotlin or Java, I have a list of items that have an ID property. This list is generated based on another list. Now I get a List of mentioned list items and I want to select all items in the parent list, selecting by ID equality.
Is there a more elegant way than just iterating the parent lost for each derived item? Thank you :)5
-
-
-
-
- Is there a Java libary or a list of the endpoints that devrant uses? Would like to write my own client2
- Class cleanBullshit() {
Function invokeAction(attr) {
If(attr==='sarahah' ) friend.remove();
}
}
Class private mylife() {
var per = new cleanBullshit();
per.invokeAction('sarahah');
}
- !rant
To all my ASMR dudes out here, there is officially C themed ASMR!...
Enjoy
-
- Made my homework
"Write the method body of setHead!"
Ok now i have 3 different solutions...
A. Shift the List "head = newHead"
B. Rotate the list so head == newHead
C. Pick newHead out of List and place it infront of the other
Yea i love you stupid guy who made these homework2
-
-
- Quote from an email: Please confirm that the attached list is the list of people that have the ability to load "versions" into SVN.
Gods, I hate non-technical project managers.
-
-
-
-
-
- def list = ['Stark', 'Bolton', 'Lennister', 'Tyrell']
def map = list.collectEntries ({[(list.indexOf(it)): it]})
-
-
- Someone answer this question.
I'm stuck on this.
I've tried almost everything that's possible
- when i read in offline, and i reach the end of the list, the + button gets in the way of reading the last rant.1
-
- (define (day p)
(map(lambda(color)
(colorize p color))
(list "red" "orange" "yellow" "green" "blue" "purple")))
>(day(square 5))
- List all commands for troubleshooting networking issues! (For Microsoft) Go!!!! (I feel like I'm forgetting some!)4
-
-
-
Top Tags
|
https://devrant.com/search?term=list
|
CC-MAIN-2019-30
|
refinedweb
| 3,592
| 73.78
|
- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- METHODS
- HIGHLIGHTING TYPES
- RELATED MODULES
- SEE ALSO
- BUGS
- TODO
- SUPPORT
- ACKNOWLEDGEMENTS
- AUTHORS
NAME
Text::VimColor - Syntax highlight text using Vim
VERSION
version 0.23
SYNOPSIS
use Text::VimColor; my $syntax = Text::VimColor->new( file => $0, filetype => 'perl', ); print $syntax->html; print $syntax->xml; print $syntax->ansi;
DESCRIPTION
This module tries to markup text files according to their syntax. It can be used to produce web pages with pretty-printed colorful source code samples. It can produce output in the following formats:
- HTML
Valid XHTML 1.0, with the exact coloring
- ANSI Escape Sequences
A string marked with Term::ANSIColor suitable for printing to a terminal. in "SYNOPSIS") and then call methods to get the markup out.
METHODS
new
my $tvc = Text::VimColor->new(%options)
Returns a syntax highlighting object. Pass it a hash of options.
The following options are recognized:
-" method (see below), allowing a single
Text::VimColorobject to be used with multiple input files.
- string
Use this to pass a string to be used as the input. This is an alternative to the
fileoption. A reference to a string will also work.
The "syntax_mark_string" method is another way to use a string as input.
If you provide a character (unencoded) string (recommended) it will be passed to vim encoded in UTF-8 and your result will be character string.
- filetype"" option" is also enabled.
This causes the CSS stylesheet defining the colors -n ), "+set nomodeline"]
You can overwrite the default options by setting this. To merely append additional options to the defaults use
extra_vim_options.
-.
syntax_mark_file
.
syntax_mark_string
.
ansi; '
html".
xml
Returns markup in a simple XML vocabulary. Unless the
xml_root_element option "HIGHLIGHTING TYPES". below.
The
<syntax> element will declare the namespace for all the elements produced, which will be. It will also have an attribute called
filename, which will be set to the value returned by the
input_filename method,(.
input_filename
Returns the filename of the input file, or undef if a filename wasn't specified.
dist_file.
BUGS
Quite a few, actually:
Apparently this module doesn't always work if run from within a 'gvim' window, although I've been unable to reproduce this so far. CPAN RT #11555..
This requires vim version 6 (it has since 2003). There may be workarounds to support version 5 (technically 5.4+). Upgrading vim is a much better idea, but if you need support for older versions please file a ticket (with patches if possible).
TODO
option for 'set number'
make global vars available through methods
list available syntaxes? (see IkiWiki::Plugin::syntax::Vim)
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc Text::VimColor-text-vimcolor at rt.cpan.org, or through the web interface at. You will be automatically notified of any progress on the request by the system.
Source Code
git clone
ACKNOWLEDGEMENTS
The Vim script mark.vim is a crufted version of 2html.vim by Bram Moolenaar <Bram@vim.org> and David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>.
AUTHORS
Geoff Richards <qef@laxan.com>
Randy Stauner <rwstauner@cpan.org>
This software is copyright (c) 2002-2006 by Geoff Richards.
This software is copyright (c) 2011 by Randy Stauner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|
https://metacpan.org/pod/release/RWSTAUNER/Text-VimColor-0.23/lib/Text/VimColor.pm
|
CC-MAIN-2017-13
|
refinedweb
| 554
| 58.89
|
Introducing Tuist
I started working on an Xcode project parser in Swift over a year ago. The goal was implementing a tool that would help large teams scale their Xcode projects. At that time I was doing much research on modularizing Xcode projects. It helped to overcome common issues such as compilation times, which had a very negative impact on developer’s productivity and motivation. You can read more about it here.
Modularization turned out to be an excellent step, but not enough. There was another set of challenges with which that Xcode and the existing tooling didn’t help. Complex Xcode projects, inconsistent settings that led to unexpected compilation errors, or non-standardized and unreliable automation DSLs are some examples of challenges that teams face when their organizations and projects grow.
Companies like Facebook, Airbnb, Uber, or Pinterest invest a fair amount of resources into addressing those challenges, for example, replacing the Xcode build system. However, not all the companies can afford it, and those have to battle the issues mentioned above on a daily basis. As you can imagine, that’s one of the last things an app developer wants to be doing as part of their job.
When I looked at the spectrum of tooling I found out that there were options on both extremes, but nothing in the middle for those medium-sized companies to adopt. One one side, there was Xcode,
xcodebuild, and Fastlane, and on the other hand, alternative build systems such as Buck, or Bazel.
I felt there was a definite need for a tool, which had user-experience oriented focus, and that helped medium-size companies overcome the scaling struggles. I’m happy to share with you a very early version of that tool, Tuist. In this blog post I’ll talk about the goal of Tuist, how we plan to achieve it, and hopefully, convince you to give it a try and contribute to the project.
🙉 What makes scaling difficult?
Before we dive into what Tuist does and how I think it’s important to understand why Tuist in the first place. I briefly mentioned in the introduction that the growth of a project comes with some challenges which I’d like to extend in this section. In my experience, the points below are a typical pattern in medium-size companies:
Configuring the project right: Configuring a multi-target project is cumbersome unless we use CocoaPods to define the project, which does all that work for us. As opposed to Android, where Gradle infers most of the build settings for you, Xcode expects us to do it right. That’s not easy, especially if it’s a large project with transitive dependencies. When we create a new project, it compiles and everything works, but as we start adding targets, dependencies, build settings, it’s our responsibility to make sure the project configuration is in a healthy state. The validation of our settings usually happens at compilation time, and sometimes when we are sending the app to the store.
Non-actionable errors When something unexpected happens, we may get an error that doesn’t tell us much about what happened. What caused this? What does this mean? What do I need to do to fix this? Sometimes, the solution is reverting our changes on git and trying again.
Non-standard DSLs: How do I build target
Core? Should I execute
fastlane build_core, or is it
fastlane core_build? Fastlane is powerful, and gives us tons of flexibility, but that comes at a cost: inconsistencies and complexity. On one side, each project defines their set of lanes, which are maintained by the team responsible for the project. Unless the collaboration and communication is is good across teams, each
Fastfilein the project will be different from the others, even though they usually expose a similar set of actions. Furthermore, those
Fastfilesare rarely tested, which leads to unreliable automation logic that breaks at any time without us noticing it. Have you ever experienced your continuous integration pipelines green for a week, and then failing when you try to release the app to the store?
Reusing configuration: In apps made of multiple projects or targets, it’s common that those targets have a similar structure. While Xcode allows reusing build settings across them by using
.xcconfigfiles, that’s the only thing you can reuse. What if we’d like to have the same linking frameworks section because all the targets link the same dependencies? What if we’d like to have similar schemes for those targets? Well, that’s not possible in Xcode projects. In my experience, those kinds of projects end up with a lot of duplicated information. Why would we reuse code but not or projects configuration?
🧠 How does it work?
In a nutshell, Tuist leverages projects generation to address those challenges. Instead of having Xcode projects and workspaces, developers define the projects in manifest files, which Tuist uses to generate the projects and workspaces and provide you with a reliable, easy to use and standard actions.
A manifest file is a
Project.swift file, which looks like this:
import ProjectDescriptionlet project = Project(name: "MyApp",targets: [Target(name: "MyApp",platform: .iOS,product: .app,bundleId: "io.tuist.MyApp",infoPlist: "Info.plist",sources: "Sources/**",dependencies: [/* Target dependencies can be defined here *//* .framework(path: "framework") */]),Target(name: "MyAppTests",platform: .iOS,product: .unitTests,bundleId: "io.tuist.MyAppTests",infoPlist: "Tests.plist",sources: "Tests/**",dependencies: [.target(name: "MyApp")])])
If you have used the Swift Package Manager before, this approach might sound familiar to you. One of the benefits of defining the project in a Swift file instead of formats like YAML or JSON is that you can leverage Xcode to validate the syntax and get code auto-completion.
Generating the project allows understanding your project and hiding implementation details and complexities. Some project elements are intentionally not available in the manifest. Instead, we provide a more straightforward interface, and we deal with the complexity.
Take for instance linking dependencies. You might already know that all transitive dynamic dependencies need to be embedded into the apps. If you forget about any transitive dependencies, you end up the simulator linker complaining about frameworks not found. With Tuist, that’s not a problem. You tell us what depends on what, and we set up the right build settings and build phases.
Getting your input through manifest files allows, not only generating a valid project but providing a set of commands that reliably work with those projects. As opposed to Fastlane, where you should write lanes that take the right arguments, Tuist knows the structure of the project and can infer most of those things for you. The goal is that developers should be able to land on a folder, where there’s a project defined, and interact with it, without having to guess which commands are available and which arguments need to be passed. Pretty much like:
tuist generatetuist buildtuist testtuist run
If the arguments can be inferred, they will be inferred. If an input is invalid, we’ll fail early instead of delegating that to the build system. Tuist is designed to fail soon and clearly. We want you to know when things go wrong, why so, and what you can do about them.
Xcode is a great tool, and we’d love you to continue to use it, but without the hassle of having to maintain a project and all the automation around it.
🖌 Design principles
I read that GitHub came up with some design principles which they shared across all the teams to make sure that they were all aligned when building features for the platform. I liked the idea and drafted a list for Tuist. This is what I came up with:
Convention over configuration: Build things to be convenient, not configurable. Configurability gives users the power to use the tool as they want, but also to screw things up without you being able to recover from it.
Design for failure: Quoting Murphy: “If things can go wrong, they will”. Don’t assume the happy path is the only valid path. Any scenario is handled, including errors, letting developers know about it at any time.
Make feedback actionable: If things go wrong try to recover from it. In case you can’t, let developers know what to do to get it working. There’s a significant difference between
Couldn't find the simulator, and
Couldn't find the simulator because simctl was not found in the system. Make sure the Xcode installation is configured by running 'xcode-select -p'
Simple is better than complex: People don’t use things if they are too complex. Developers don’t want to touch a piece of code that has grown into a huge mess. Keep things simple.
Implementation details bring little value to users: Users don’t want to know how you are doing things internally, they want you to do what they asked you for. Don’t expose implementation details, like errors that you are thrown internally, because they don’t care about that.
If it can’t be reliable, you’d better not build it: If a feature doesn’t work as expected, users will have a negative perception of the tool. If you plan to build something, which can’t be reliable, don’t build it. Instead, do some groundwork to make it reliable or find another approach to address the same problem.
It’s is a malleable list which will change and grow as the project evolves. You can check out the full list on the contributors’ repository
We implemented an endpoint, api.tuist.io/zen, to return the project design principles.
🚀 What’s coming
- 📃 Documentation: Unfortunately, We haven’t devoted much time to have a decent documentation for the project. That makes onboarding hard. We’ll work on documenting the public interfaces and the CLI.
- 🚀 Build, test, run actions: We’ll work on providing a standard interface with the most common actions developers do when they interact with the projects. Once developers learn the interface, they’ll be able to jump from one project to another seamlessly.
- 🔀 Static transitive dependencies: Although Tuist supports dynamic transitive dependencies, it doesn’t support static ones. We want to add support for that, allowing developers to specify whether they’d like to generate their dependencies to be static or dynamic.
- 🔑 Certificate management: A common source of frustration when building apps with Xcode is when you try to run the app on a device, or archive it for release, and you get a signing issue. We want to address that by setting up the environment and project with the right certificates, provisioning profiles and build settings.
- 🛒 Releasing: Once the app is ready for release, we’d like you to be able to archive and send the app to the store directly from Tuist with a single command that does all the heavy-lifting for you.
You can check out the project issues that contains some other smaller improvements and features that are also coming to the project.
📱 Start using it
Would you like to give Tuist a try? You can check out the Getting started guide that explains how to install the tool and how to bootstrap your first project.
📒 Resources
❤️ I need you
Tuist strives to build a healthy and supportive community that pushes the project forward. I’ll keep pushing it because I’m self-motivated, but I’d love to do it with developers like you.
We need feedback, ideas, bugs, code, and whatever you can imagine to make Tuist better. I’ve built the project to be accessible and inclusive to make sure everyone has a voice and can participate in shaping Tuist. I planted the seed, but this tree 🌲 needs passionate gardeners.
Don’t be afraid of getting involved with the project. If you have never done it before, drop me a line, and I’ll be pleased to get you onboard. If you are a developer for Apple platforms, you’ll feel like at home working on this project because it’s written in plain Swift, a programming language you might already be familiar with.
I’m thrilled about this project taking off; nevertheless, there’s a possibility of this project not being used a lot since there’s already trust in the community for Fastlane, Cocoapods, or the official Swift Package Manager. I’ll do my best though, but without worrying too much. Overall, I’d like to learn how to build a user-friendly and reliable command line tool that addresses real problems developers have.
Having said all that, I can’t wait to see how you use Tuist and all the ideas that come out of it.
Happy Xcoding! ❤️👩💻
|
https://tuist.io/blog/2018/07/28/introducing-tuist/
|
CC-MAIN-2020-29
|
refinedweb
| 2,125
| 62.07
|
latest = "123123123"
int number = latest.toInteger()
I am trying to convert this string to integer, tried various options from internet.
I always get "java.lang.NumberFormatException", but not converting to integer
Let mw know any possible answers
Solved!
Go to Solution.
Hi @subhaD,
It's working fine for me.
Can your share more details or screenshot where you are getting this error.
Click "Accept as Solution" if my answer has helped, and remember to give "kudos"
Thanks and Regards,
Himanshu Tayal
Thanks so much for replying @HimanshuTayal
This is my exact script.
I have converted CCN to string and then trying to make it an integer
Your number is too large for the integer data type, see the following for more details:
You will need to use the "Long" data type instead:
def numberString = '1111222233334444'
def numberValue = Long.valueOf(numberString)
The number which you mentioned in original post is different from the number for which you are getting error.
So the solution for your problem is :
Int datatype can only handle "2147483647" in groovy if you pass "2147483648" then it will give you the NumberFormatException Error
You can use Long dataType which can handle "9223372036854775807" but if you think at some point of time your number will be bigger than this then you must use BigInteger which can handle "9223372036854775807"
def latest = "4519021761189580"
def number = latest.toLong()
log.info number
|
https://community.smartbear.com/t5/SoapUI-Pro/Groovy-Script-convert-string-to-integer/m-p/172601
|
CC-MAIN-2018-51
|
refinedweb
| 230
| 59.43
|
Languages natively. The document at
Discusses this situation. It is clearly mentioned that
SharePoint
Portal Server 2003 does not support a mixture of different localized
portal servers on the server farm, nor does it support a mixture of
different localized Windows Server 2003 servers. All servers running
Windows Server 2003 in a farm topology must be in the same language,
and all servers running SharePoint Portal Server 2003 in a server farm
must be in the same language
Still, if you want to perform localization in webparts for whatever reasons, it is simple to do so.
We will create a simple MOSS 2007 webpart with localization support.
Healthcare.resx
Healthcare.de.resx for German
Healthcare.fr.resx for French
Note that you cannot add App_GlobalResources to the project since it is only valid for the web sites
And not the class library projects.
using System.Globalization;
using System.Resources;
We will pick the language settings from the web.config file. Add the following tag to the
<appsettings> section of the web.config file of your sharepoint web site.
<add key=culture
Add the following class variables to your webpart source file.
CultureInfo cult = CultureInfo.CreateSpecificCulture(ConfigurationSettings.AppSettings["culture"]);
ResourceManager rm;
This will create a CultureInfo object based on the language settings in the web.config file.
In the constructor of your webpart add a line like this
rm = new ResourceManager("CustomWebParts.HealthCare", this.GetType().Assembly);
Where HealthCare is the name of your resource file ex HealthCare.resx and HealthCare.de.resx
And CustomWebParts is the namespace of your webpart.
Basically this line creates a resource manager for the specific resource file.
Now we will load all the strings which are used in the webpart source to the resource file.
This is fairly easy.
Now to load strings at any point in the webpart source we will use the GetString() method of
ResourceManager class. For Ex
protected override void CreateChildControls()
{
base.CreateChildControls();
this.Title = rm.GetString("CarePlan", cult);
}
This method sets the title of the webpart to the appropriate language based on the web.config file
The above localization is not specific to sharepoint instead it's an asp.net 2.0 feature.
I can mail the source code of the webpart to anyone if needed.
Send your suggestions and comments.
PingBack from
pleaes can you send me source code
my email is
dream_177_33@yahoo.com
Please send your source code to me!
My email is lingmu0108@hotmail.com
Thanks in advance!
---------------------------
Forest Ling
can u send me the code to sammeta.nsprasad@gmail.com
rajesh_singh81@rediffmail.com
Can u please send me the entire source code to my mail ID i.e. urukundappa.g@mphasis.com
can u send me the source code
my email id is naveensingh222@gmail.com
can you send me source code
garg_nirmit@yahoo.co.in
Dear Friend,
Is it possible to implement a controll, to change language MOSS language.
In back end it should load a resource files based on choosen language.
Thank in advance (we are ready to pay for this solution)
Will this code work for Sharepoint 2003 as well? I am trying to make my custom webpart read the value from appsettings of the web.config.
Thanks
edwin.mendoza@bmo.com
Hi
I learnt about localization(static contents) or any reference links.
Thanks in Advance
|
http://blogs.msdn.com/b/mahuja/archive/2008/03/31/localization-in-webparts.aspx
|
CC-MAIN-2013-20
|
refinedweb
| 553
| 58.79
|
I am trying improve the accuracy of Logistic regression algorithm implemented in Spark using Java. For this I'm trying to replace Null or invalid values present in a column with the most frequent value of that column. For Example:-
Name|Placea |a1a |a2a |a2 |d1b |a2c |a2c | |d |c1
In this case I'll replace all the NULL values in column "Name" with 'a' and in column "Place" with 'a2'. Till now I am able to extract only the most frequent columns in a particular column. Can you please help me with the second step on how to replace the null or invalid values with the most frequent values of that column.
For java:
I think you need to use the fill(String value, String[] columns) method of your dataframe, which automatically replaces Null values in a given list of columns with the value you specified.
So if you are very clear about the value that you want to replace the Null with...:
String[] colNames = {"Name"}dataframe = dataframe.na.fill("a", colNames)
String[] colNames = {"Name"}
dataframe = dataframe.na.fill("a", colNames)
You can do the same for the rest of your columns.
And if you want to solve this kind of problem in scala:
You can use .na.fill function (check this for reference:org.apache.spark.sql.DataFrameNaFunctions).
The function that you need here is:
def fill(value: String, cols: Seq[String]): DataFrame
Now, you can freely choose the columns, and also you can choose the value you want to replace the null or NaN.
For your case, do something like this:
val df2 = df.na.fill("a", Seq("Name")) .na.fill("a2", Seq("Place"))
val df2 = df.na.fill("a", Seq("Name"))
.na.fill("a2", Seq("Place"))
Learn Spark with this Spark Certification Course by Intellipaat.
|
https://intellipaat.com/community/18861/how-to-replace-null-values-with-a-specific-value-in-dataframe-using-spark-in-java
|
CC-MAIN-2020-50
|
refinedweb
| 299
| 63.09
|
This is Part 2 of the object oriented programming series where we will be discussing the four object oriented programming paradigms in Java (4 pillars of oop). In our first part, we have discussed the basics of OOPs concepts like classes, objects, constructors, and many more. If you haven’t read that post then it’s recommended to do so as it will help you in understanding the concepts which we will be discussed in this blog post. The link to that first blog post can be found here 👉 (Object Oriented Programming (OOPs) concepts in Java Part 1/2).
This blog post will not be a structured kind of blog. We will explore various concepts of object oriented programming paradigm as we move forward while following a proper flow of information. Explaining these concepts individually will not make much sense since each of these concepts are interrelated to each other.
Before diving deep into the 4 pillars of oop lets first understand want are access modifiers in Java.
Access Modifiers in Java
The Access modifiers are reserved keywords in Java that can be used with variables, methods, constructors, and classes. They are used to restrict the scope of the variables, methods, constructors, and classes within classes and packages (In general, packages are also known as directory or a folder). The Access modifiers will help us in writing quality code as well as in enhancing the security of the software. There are four access modifiers in Java each of them are explained briefly.
1. public – Whenever you use a public keyword before any variable or a method then that variable or a method can be accessed inside any class or packages.
2. default – By default, if you don’t use any access modifier before variables, methods, constructors, or classes then in that case java will consider them as default access modifiers. The default access modifier can be accessed only inside a particular package in which it’s declared as well as inside the sub-packages if present.
3. private – If the variables, methods or constructors are declared as private then they can be accessed only inside that class where they are declared. When using a private keyword with classes, only make inner classes or nested classes as private and not the outer class. If we declare the inner class as private then it can be accessed from the outer class, but if the outer class itself is made private then this makes no sense since you will not be able to access any elements present inside that class.
4. protected – If the variables, methods, or constructors are made protected then they can only be accessed within the package they are defined as well as inside the subclasses (with the help of inheritance). The classes cannot be made protected.
The 4 Pillars of OOP (object oriented programming) Paradigms in Java
Polymorphism, Inheritance, Encapsulation, and Abstraction are the 4 pillars of OOP (object oriented programming). Let’s understand each of them with an example. Imagine that we have a car manufacturing company and we want to design two cars, one is an SUV car and another one is a sports car. As we know, every car has various things in common and they have some differences as well. So, we will try to represent all of these things in object oriented way such that we can get a proper understanding of each of the 4 paradigms of the OOP.
First, we will create 4 classes, Main class, SUV class, Sports class, and Car class. The Car class will contain all the common properties of both the SUV and Sports cars. So, the Car class will be the parent of both SUV and Sports classes. The SUV and Sports classes will contain car-specific properties for SUV cars and Sports cars respectively. Inside the Main class, we will create the objects of these two car types.
Initially, this is how each of these classes will look like. You can create separate files for each class or you can also specify all these classes in a single file as well. The recommended way is to create separate files for each class.
public class Main { public static void main(String[] args) { } }
public class SUV extends Car{ }
public class Sports extends Car{ }
public class Car{ }
1. Polymorphism in Java
Whenever people buy a car they are more interested in knowing the speed of the car. So, as a car manufacture company we have to make an engine for both our SUV as well as for our sports car that could take our car’s speed to the next level. To add an engine to our car, we will create a method called “engine()” which will take a single parameter of type string called “engineType”. The value of the “engineType” variable will be “SUV Engine” or “Sports Engine”. You can pass in any values, this is just for the sake of this example.
The engine() method will go under our Car class because it doesn’t matter what type of car your building it will always have an engine. And depending upon the type of the car which we are building we will tell the engine() method to create an engine for that type of car. For example, if we are building SUV car then we will tell the engine() to create an engine for SUV car by passing the value “SUV Engine” to the “engineType” parameter inside the method.
We can also make this method “public” so that we can access it inside the “Main.java” as that’s where we will be creating all of our objects.
public class Car{ public void engine(String engineType){ System.out.println("Create Engine: " + engineType); } }
In the case of Sports car, people are also interested in knowing how many seconds the car’s engine will take to go from 0 to 100 kmph. So, for this, we can also pass another parameter called “secondsToReachHundred” to the engine() method so that we can know in how many seconds our engine can reach 100 kmph. But if we pass this parameter to the above engine() method then it can cause a problem. Since whenever we will create the engine for our SUV class by calling the engine() method then during that time also we have to pass the value to the second parameter “secondsToReachHundred” as well since the engine() takes two parameters as input which we don’t want, Right.
To solve this, we can create another method specifically for our Sports car, so that whenever we will create the engine then we can call that method as shown below.
public class Car{ //); } }
As you can see above, we have created another method called engine() which takes two parameters “engineType” and “secondsToReachHundred”. This method can be called by any car that wants to know much time it will take for the engine to reach a hundred, but more specifically by the Sports car.
This is called polymorphism which is the first pillar out of the 4 pillars of OOP. In polymorphism, we can have various methods with the same name (in this case, engine) but each method will take different signatures or parameters. You can also create a method with the name “engine()” which can take no parameters as well. In this case, we don’t need a method with no parameters and that’s the reason we have not created such a method.
This is also an example of method overloading, as we are creating multiple methods with the same name but different parameters.
A Polymorphism is of two types:
a. Compile time polymorphism
In this type of polymorphism, Java can decide during the compile-time which of these methods needs to be called since all the methods have the same name. The example which we have seen above is the compile-time polymorphism as Java can decide which engine() method needs to be called based on the number of parameters passed to the method while calling the method. This is also known as static polymorphism.
b. Runtime polymorphism
Whenever we have a method present inside the parent class and we override that method in our child class then this is called as runtime polymorphism or dynamic polymorphism.
Overriding a method simply means that you already have a method defined in the parent class, but for some reason you don’t want to use that method, instead want to create your own so that you can define your own code into that method. In such cases, the method name and its parameters should remain same as that of the method present inside parent class while defining your own method in child class.
In our above example, we have engine(String engineType) method in out Car class which only prints a message to the output window. Now let’s override this method into the Sports class which is a child of the Car class. While doing so we will also create a boolean variable called “isElectric” whose value will be currently set to false which represents that the car engine doesn’t work on electric, as shown below.
public class Sports extends Car{ boolean isElectric = false; @Override public void engine(String engineType){ if(!isElectric){ System.out.printf("The %s does not work on electric, it works on petrol. \n", engineType); } } }
public class Main { public static void main(String[] args) { Sports lamborghini = new Sports(); lamborghini.engine("Sports Engine"); } }
In this case, while compilation the Java compiler will not know which engine() method you are exactly calling, either of the Sports class or of the Car class, since both of these classes have these methods present with the same name as well as with the same parameters or signature. This decision can only be taken during runtime only and therefore this is called runtime polymorphism or dynamic polymorphism.
If you run the above program at this stage then the output will be as follows.
The Sports Engine does not work on electric, it works on petrol.
2. Inheritance in Java
You might have not guessed it, but we have already seen inheritance above. The extend keyword used above represents the parent and child relationship. The class before the extend keyword is a child and the class after the extend keyword is a parent.
In our example, the SUV class and the Sports class both are children of the Car class since both can inherit and access the properties (variables and methods) present inside the Car class into their class. The Car class is the parent. This is called inheritance which is the second pillar out of the 4 pillars of OOP.
3. Encapsulation in Java
As we know, the variables which are made private cannot be accessed outside the class. This is good for security purposes because we don’t want all the classes to access these variables. But what if some of the classes want to access these variables?
To achieve this, we can use something called getter and setter methods. With the help of these methods, we can indirectly access the private variables of the classes. This helps us in achieving Encapsulation as we are enclosing the private variable with getter and setter methods because of which we cannot directly manipulate the private variable.
Let’s now create two private variables inside our SUV class. The first variable is the “navigationSystemSupported” which will tell whether the car supports a geographic navigation system or not and the second variable will “noOfSeats” which as the name suggests will tell the total number of seats the SUV car will have.
To create getter and setter methods for these two variables, on your IDE (I’m using Intellij IDEA) right-click and select “Generate”.
And after that choose “Getter and Setter”.
This will generate the below boiler plate code for you.
public class SUV extends Car{ private boolean navigationSystemSupported; private int noOfSeats; public boolean isNavigationSystemSupported() { return navigationSystemSupported; } public void setNavigationSystemSupported(boolean navigationSystemSupported) { this.navigationSystemSupported = navigationSystemSupported; } public int getNoOfSeats() { return noOfSeats; } public void setNoOfSeats(int noOfSeats) { this.noOfSeats = noOfSeats; } }
Now let’s access these variables from our Main class. To do this, we will first create the object of the SUV class using the new keyword. Then using the setter methods “setNavigationSystemSupported” and “setNoOfSeats” we will set the values of the variables navigationSystemSupported and noOfSeats as shown below.
SUV rangeRover = new SUV(); rangeRover.setNavigationSystemSupported(true); rangeRover.setNoOfSeats(9);
As you can see above, we are not directly accessing the private variables present in the “SUV” class. With the help of methods, we are setting the values of the variables. This helps to prevent unauthorized access to the variable which eventually enhances security.()); } }
In the end, we are printing the values of the private variables using getter methods “isNavigationSystemSupported” and “getNoOfSeats” as shown above.
The Sports Engine does not work on electric, it works on petrol. The SUV has 9 seats and supports navigation system.
This is all about encapsulation which is the third pillar out of the 4 pillars of OOP.
4. Abstraction in Java
Abstraction is the last pillar out of the 4 pillars of OOP in Java. There is usually confusion between people when it comes to encapsulation and abstraction. Encapsulation, as we have already seen above is used to hide or encapsulate the data so that our data could remain secure.
In Abstraction, you might have seen this definition that “Abstraction is used to hide the implementation details”. But what exactly does it mean? The definition itself seems confusing 😂. So, let me clear this out of you.
In Abstraction, we usually make the class abstract and some or all of its methods abstract as well (we will see how to make a class or method abstract in few moments). This means that we don’t write the implementation or the body of the methods which are abstract. We only write the method name and specify the number of parameters it will take and then we put a semicolon as shown below.
# This is an abstract class abstract class MyClassName{ # This is an abstract method that doesn't have a body abstract int newMethod(); }
Now whichever class will inherit this abstract class, that class will always have to define or implement these methods in its class. So, here what’s happening is that the abstract method doesn’t have the implementation of the methods present in it. The implementation is present in some other classes which will inherit this abstract class. Therefore, the definition of abstraction states that it hides the implementation.
Abstraction can be achieved with the help of abstract keyword or by using interfaces
a. abstract keyword
- A method or a class can be made abstract with the help of the “abstract” keyword.
- An abstract class can contain both abstract methods as well as normal methods.
- An Abstract method doesn’t have implementation.
- An abstract class cannot be instantiated with the new keyword (i.e we can’t create objects of the abstract class).
- To use the abstract class or its methods you can inherit this class using the “extend” keyword.
Let’s create a new abstract class named “CarFactory” where the cars are manufactured. Inside which we will be defining one normal method “totalCarsManufactured” which will tell us the total cars manufactured in the factory.
Also, we will define one abstract method called “carChassisAvailable” that will tell how many car chassis are available in the factory for both SUV and sports car. This abstract method will take two parameters “chassisSUV” (total chassis of SUV car available) and “chassisSports” (total chassis of sports car available) and the sum of both these values will be returned as an integer value.
// Abstract class public abstract class CarFactory { // Normal method public void totalCarsManufactured(){ System.out.println("A total of 50 cars are manufactured to date."); } // Abstract method with no implementation abstract int carChassisAvailable(int chassisSUV, int chassisSports); }
We will write the implementation for the above abstract method inside the Car class as follows. Notice that we are extending the CarFactory class using extend keyword.
public class Car extends CarFactory{ //; } }
Now we can call the totalCarsManufactured() and carChassisAvailable() methods by creating an object of the Car class inside the Main class.
Car totalCars = new Car(); totalCars.totalCarsManufactured(); int chassis = totalCars.carChassisAvailable(40, 50); System.out.println("Total Car Chassis Available: "+chassis);
The output of this will be look like this.
A total of 50 cars are manufactured to date. Total Car Chassis Available: 90
b. Interfaces
Another way of achieving abstraction is by using interfaces.
- To declare interface we use the “interface” keyword.
- To use the interface we use the “implements” keyword.
- An interface doesn’t allow normal methods as the abstract class does. It only allows abstract methods which provide total abstraction.
- All methods present inside the interface have no implementation (methods without body).
- No need to specify an abstract keyword before a method. By default, all the methods specified inside the interface are abstract.
- Java doesn’t support multiple inheritance. But using interfaces we can achieve it.
Now here we will create a new file for our interface and will create an abstract method but this time using an interface.
The interface will also have a name, here we will give “CarFactoryInterface” as a name for our interface. Then we will define a “noOfAssemblyLines()” method that illustrates the number of assembly lines in the car factory and the implementation of this method will be written inside the Car class.
public interface CarFactoryInterface { void totalCarsManufactured(); int carChassisAvailable(int chassisSUV, int chassisSports); }
To use the interface in the Car class we have to use the implements keyword. Then we will define the noOfAssemblyLines() method inside the Car class.
public class Car extends CarFactory implements CarFactoryInterface{ //; } // Implementation for the abstract method present in CarFactoryInterface @Override public void noOfAssemblyLines() { System.out.println("There are 2 assembly lines, one for SUV and another for Sports car."); } }
If you noticed clearly then you will see we are accessing methods from two different classes CarFactory and CarFactoryInterface at the same time This is a kind of multiple inheritance. You can create any number of interfaces as you want and implement them using commas like “public class Example implements A, B, C”. But a class can only inherit from a single parent class using the extend keyword.
At the end, you can call the noOfAssemblyLines using the Car object inside the Main class.
package com.company;()); Car totalCars = new Car(); totalCars.totalCarsManufactured(); int chassis = totalCars.carChassisAvailable(40, 50); System.out.println("Total Car Chassis Available: "+chassis); totalCars.noOfAssemblyLines(); } }
Finally, this is what you will see as an output.
The Sports Engine does not work on electric, it works on petrol. The SUV has 9 seats and supports navigation system. A total of 50 cars are manufactured to date. Total Car Chassis Available: 90 There are 2 assembly lines, one for SUV and another for Sports car.
That’s all for this blog post 4 pillars of OOP (Object Oriented Programming) Paradigms “4 pillars of OOP: Object Oriented Programming Paradigms in Java Part 2/2”
Pingback: Object Oriented Programming (OOPs) Concepts In Java Part 1/2 | LionGuest Studios
|
https://liongueststudios.com/4-pillars-of-oop-java/
|
CC-MAIN-2022-40
|
refinedweb
| 3,194
| 61.46
|
How To Generate a SAS Token for an Azure Service Bus Queue using C# communicate with the queue without this token, you will get a 401 unauthorized response. This blog post will outline how you can create a simple C# console application to generate this token for you.
As stated earlier there is nothing on any of the Azure portals that will get you this SAS token directly which means that we will have to generate it manually given the information that Azure does supply. We will do so using .NET and more specifically we will use the Azure Service Bus NuGet package shown below:
This package contains useful methods that can help us easily generate a SAS token for our other applications. While we may not necessarily need this package not doing so would require far more effort and would require us to use an HMAC-SHA256 hash to do so. For this blog post we will keep it simple and use the built in methods in the Azure Service Bus NuGet package.
So in a newly create console app add the following code to the project:
In this code replace all the variables with the following:
- sbNamespace: The namespace of the Azure Service Bus that you created
- sbPath: The name of the queue that you created
- sbPolicy: The Shared Access Key Name
- sbKey: The Shared Access Key
Once you run this console app, navigate to the location specified on the last line and you should now see the text file which when opened should contain a SAS token similar to the one shown below:
And there you have it! An easily configurable console app that generates a SAS token for your HTTP requests to the Azure Service Bus Queue.
Learn more about Tallan or see us in person at one of our many Events!
|
https://blog.tallan.com/2016/01/13/how-to-generate-a-sas-token-for-an-azure-service-bus-queue-using-c/
|
CC-MAIN-2020-34
|
refinedweb
| 306
| 57.44
|
Member
5 Points
Jul 26, 2007 04:14 PM|larrydotnet|LINK.
Jul 26, 2007 05:23 PM|Rodashar|LINKprotected);
}
Member
5 Points
Aug 22, 2007 05:37 PM|larrydotnet|LINK
Thank you very much. What i did was to create a class that inherits from Menu and overrided the Render metohd using your code. that worked for me.
Aug 22, 2007 05:47 PM|Rodashar|LINK
Glad I could be of help :D
Sep 03, 2008 10:16 AM|Mak1234|LINK.
Sep 03, 2008 12:00 PM|Rodashar|LINK?
Sep 04, 2008 11:33 AM|Mak1234|LINK
Sep 04, 2008 12:02 PM|Rodashar|LINKs
Public Class Class1
Inherits Menu
End Class
Once you have added this you can add the render code in the previous post reference your new control and vola! I hope that helps.
Sep 04, 2008 01:39 PM|Mak1234|LINK
Hi,.
Thanks,
MAK
Sep 04, 2008 04:12 PM|Rodashar|LINK" ...>
Sep 05, 2008 11:51 AM|Mak1234|LINK,
MAK.
Sep 05, 2008 12:05 PM|Rodashar|LINK.
Sep 15, 2008 01:20 PM|skkulla|LINK
I was trying to achieve the same thing by creating custom control and override the render but when i click my parent node menu on my menu control the page gets refreshed but submenu does not show up.
Can you please let me know why its happening.
Thanks
None
0 Points
Dec 07, 2009 04:11 PM|NickLocke|LINK
This looked like exactly what I wanted to do --- forcing the user to click rather than mouseover. I have implemented the code exactly as suggested, but saw no difference in the rendering.
With a bit of debugging, I got my hands on the HTML string in the Render method - and there lies my problem.
I am using .NET4 and there is no "onmouseover" code anywhere to be seen.
I'm guessing that it has been buried away in an ASD resource somewhere.
Any clues?
Thanks
None
0 Points
Mar 26, 2010 08:36 AM|technodotnet|LINK
I created a ASP.NET 3.5 Server Control class that inherits from Menu control and overrided the Render metohd using your code above.
But submenu does not show up on Clicking the parent node in the Menu. Can you tell me why? Here is the Menu server control code-
public class ServerControl1 : Menu
{
//Override the Render method to replace the onmouseover
protected);
}
}
And here is the code for Default.aspx where I am showing the above menu control -
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="ServerControl1" namespace="ServerControl1" tagprefix="cc2" %>
<cc2:ServerControl1
<Items>
<asp:MenuItem
<asp:MenuItem</asp:MenuItem>
<asp:MenuItem<>
</cc2:ServerControl1>
15 replies
Last post Mar 26, 2010 08:36 AM by technodotnet
|
https://forums.asp.net/t/1138755.aspx
|
CC-MAIN-2020-34
|
refinedweb
| 458
| 73.68
|
" == John Hunter <jdhunter@...> writes:
John> THE HACK for Windows users with the problematic install and
John> behavior: change HOME to USERPROFILE in font_manager.py.
Hi Alan,
Thanks for the bug report and the pointer to the solution I added the
following code to matplotlib.__init__.py above the get_data_path
function
def get_home():
"""
return the users HOME dir across platforms or None.
On win32, if either HOME is not set or HOME is set but doesn't
exist, the value of USERPROFILE will be used instead.
"""
if os.environ.has_key('HOME'):
path = os.environ['HOME']
if os.path.exists(path): return path
if sys.platform=='win32' and os.environ.has_key('USERPROFILE'):
path = os.environ['USERPROFILE']
if os.path.exists(path): return path
return None
And then use this everywhere in the code that wants HOME.
Fortunately, that is only two places, once in matplotlib_fname and
once in the font_manager.
In font_manager, if you import it
from matplotlib import rcParams, get_data_path, get_home
and use it
ttfpath = get_home()
if ttfpath is None: ttfpath = get_data_path()
ttfcache = os.path.join(ttfpath, '.ttffont.cache')
it should fix the bug.
Would you mind testing it for me? I tried it on a linux and winxp
platform and it worked. But I never had problems before on those two
platforms so it would be helpful to try yours as well.
Thanks!
JDH
On Wed, 18 Aug 2004, John Hunter apparently wrote:
> Would you mind testing it for me? I tried it on a linux and winxp
> platform and it worked. But I never had problems before on those two
> platforms so it would be helpful to try yours as well.
Seems to work fine.
I also changed font_manager.py the same way:
Change
afmpath = os.environ.get('USERPROFILE', get_data_path())
to
afmpath = get_home()
if afmpath is None: afmpath = get_data_path()
Sidenote:
recall that because of this problem, during installation
I ended up with a directory named literally
Python23\%USERPROFILE
literally. Until I removed this, get_home did not work
quite right (because the first existence test was unexpectedly true!)
So you'll want to make sure this installation problem is
also gone.
|
https://sourceforge.net/p/matplotlib/mailman/matplotlib-users/thread/m2wtzw7e2t.fsf@mother.paradise.lost/
|
CC-MAIN-2017-13
|
refinedweb
| 351
| 67.96
|
Submetido por Infrared5 em. She had an interview with the Perceptual computing team and they told her “that eye tracking was going to be implemented later”. What’s funny about the lack of eye tracking and even decent gaze tracking in the IPC SDK is that the contest is showing this:
Yes we know it’s just marketing, but it is a pretty misleading image. They have a 3D mesh over a guy’s face giving the impression that the SDK can do AAM and POSIT. That would be so cool! Look out FaceAPI! Unfortunately it totally doesn't do that. At least not yet.
This isn’t to say that Intel is taking a bad approach with the IPC SDK beta either. They are trying out a lot of things at once and not getting lost in the specifics of just a few features. This allows developers to tell them what they want to do with it without spending tremendous effort on features that wouldn't even be used.
The lack of decent head, gaze and eye tracking is what’s inspired us on to eventually release our tracking code as open source. Our hope is that future developers can leverage our work on these features and not have to go through the pain we did in this contest. Maybe Intel will just merge our code into the IPC SDK and we can continue to make the product better together.
Another reason we are sticking with our plan on gaze and eye tracking is that we feel strongly, as do the judges, that these features are some of the most exciting aspects of the perceptual computing camera. A convertible ultrabook has people’s hands busy with typing, touch gestures, etc. and having an interface that works using your face is such a natural fit for this kind of setup.
Latest Demo of Kiwi Catapult Revenge
Check out the latest developments with the Unity Web Player version. We’ve added a new fireball/flamethrower style effect, updated skybox, sheep and more. Note that this is still far from final art and behavior for the game, but we want to continue showing the process we are going through by providing these snapshots of the game in progress. This build requires the free Brass Monkey app for iOS or Android.
A Polished Experience
In addition to being thoroughly entertained by the judges’ video blooper this week, one thing we heard consistently from them is that they were expecting more polished apps from the non-individual teams. We couldn’t agree more! One advantage that we have in the contest is that we have a fantastic art and game design team. That’s not to say our tech skills are lacking either. We are at our core a very technically focused company, but we tend not to compartmentalize the design process and the technology implementation in projects we take on. Design and technology have to work together in harmony to create an amazing user experience, and that’s exactly what we’re doing in this challenge.
Game design is a funny, flexible and agile process. What you set out to do in the beginning rarely ends up being what you make in the end. Our initial idea started as a sort of Mad Max road warrior style driving and shooting game (thus Sascha thinking ours was a racing game early on), but after having read some bizarre news articles on eradicating cats in New Zealand we decided the story of Cats vs. Kiwis should be the theme. Plus Rebecca and Aaron really wanted to try out this 2D paper, pop-up book style, and the Kiwi story really lends itself to that look.
Moving to this new theme kept most of the core game mechanics as the driving game. Tracking with the head and eyes to shoot and using the phone as a virtual steering wheel are exactly the same in the road warrior idea. Since our main character Karl Kiwi has magical powers and can fly, we made it so he would be off the ground (unlike a car that’s fixed to the ground). Another part of the story is that Karl can breathe fire like a dragon, so we thought that’s an excellent way to use the perceptual computing camera by having the player open their mouth to be able to shoot fire. Shooting regular bullets didn’t work with the new character either, so we took some inspiration from funny laser cats memes, SNL and decided that he should be able to shoot lasers from his eyes. Believe it or not, we have been wanting to build a game involving animals and lasers for a while now. “Invasion of the Killer Cuties” was a game we concepted over two years ago where you fly a fighter plane in space against cute rodents that shoot lasers from their eyes (initial concept art shown below).
Since Chris wrote up the initial game design document (GDD) for Kiwi Catapult Revenge there have been plenty of other changes we’ve made throughout the contest. One example: our initial pass at fire breathing (a spherical projectile) wasn’t really getting the effect we wanted. In the GDD it was described as a fireball so this was a natural choice. What we found though is that it was hard to hit the cats, and the ball didn’t look that good either. We explored how dragon fire breathing is depicted in movies, and the effect is much more like how a flamethrower works. The new fire breathing effect that John implemented this week is awesome! And we believe it adds to the overall polish of our entry for the contest.
(image credit MT Falldog)
Another aspect of the game that wasn’t really working so far was that the main character was never shown. We chose a first person point of view so that the effect of moving your head and peering around items would feel incredibly immersive, giving the feeling that you are really right in this 3D world. However, this meant that you would never see Karl, our protagonist.
Enter the rear view mirror effect. We took a bit of inspiration from the super cool puppets that Sixense showed last week, and this video of an insane wingsuit base jump and came up with a way to show off our main character. Karl Kiwi will be fitted with a rear view mirror so that he can see what’s behind him, and you as the player can the character move the same as you. When you tilt your head, Karl will tilt his, when you look right, so will Karl, and when you open your mouth Karl’s beak will open. This will all happen in real time, and the effect will really show the power of the perceptual computing platform that Intel has provided.
Head Tracking Progress Plus Code and Videos
It wouldn’t be a proper Ultimate Coder post without some video and some code, so we have provided you some snippets for your perusal. Steff did a great job of documenting his progress this week, and we want to show you step by step where we are heading by sharing a bit of code and some video for each of these face detection examples. Steff is working from this plan, and knocking off each of the individual algorithms step by step. Note that this week’s example requires the OpenCV library and a C compiler for Windows.
This last week of Steff's programming was all about two things: 1) switching from working entirely in Unity (with C#) to a C++ workflow in Visual Studio, and 2) refining our face tracking algorithm. As noted in last week’s post, we hit a roadblock trying to write everything in C# in Unity with DLL for the Intel SDK and OpenCV. There were just limits to the port of OpenCV that we needed to shed. So, we spent some quality time setting up in VS 2012 Express and enjoying the sharp sting of pointers, references, and those type of lovely things that we have avoided by working in C#. However there is good news, we did get back the amount of lower level control needed to refine face detection!
Our main refinement this week was to break through the limitations of tracking faces that we encountered when implementing the Viola-Jones detection method using Haar Cascades. This is a great way to find a face, but it’s not the best for tracking a face from frame to frame. It has limitations in orientation; e.g. if the face is tilted to one side the Haar Cascade no longer detects a face. Another drawback is that while looking for a face, the algorithm is churning through images per every set block of pixels. It can really slow things down. To break through this limitation, we took inspiration from the implementation by the team at ROS.org . They have done a nice job putting face tracking together using python, OpenCV, and an RGB camera + Kinect. Following their example, we have implemented feature detection with GoodFeaturesToTrack and then tracked each feature from frame to frame using Optical Flow. The video below shows the difference between the two methods and also includes a first pass at creating a blue screen from the depth data.
This week, we will be adding depth data into this tracking algorithm. With depth, we will be able to refine our Region Of Interest to include an good estimate of face size and we will also be able to knock out the background to speed up Face Detection with the Haar Cascades. Another critical step is integrating our face detection algorithms into the Unity game. We look forward to seeing how all this goes and filling you in with next week’s post!
We are also really excited about all the other teams’ progress so far, and in particular we want to congratulate Lee on making a super cool video last week! We had some plans to do a more intricate video based on Lee’s, but a huge snowstorm in Boston put a bit of a wrench in those plans. Stay tuned for next week’s post though, as we’ve got some exciting (and hopefully funny) stuff to show you!
For you code junkies out there, here is a code snippet showing how we implemented GoodFeaturesToTrack and Lucas-Kanada Optical Flow:
#include "stdafx.h" #include "cv.h" #include "highgui.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <math.h> #include <float.h> #include <limits.h> #include <time.h> #include <ctype.h> #include <vector> #include "CaptureFrame.h" #include "FaceDetection.h" using namespace cv; using namespace std; static void help() { // print a welcome message, and the OpenCV version cout << "nThis is a demo of Robust face tracking use Lucas-Kanade Optical Flow,n" "Using OpenCV version %s" << CV_VERSION << "n" << endl; cout << "nHot keys: n" "tESC - quit the programn" "tr - restart face trackingn" << endl; } // function declaration for drawing the region of interest around the face void drawFaceROIFromRect(IplImage *src, CvRect *rect); // function declaration for finding good features to track in a region int findFeatures(IplImage *src, CvPoint2D32f *features, CvBox2D roi); // function declaration for finding a trackbox around an array of points CvBox2D findTrackBox(CvPoint2D32f *features, int numPoints); // function declaration for finding the distance a point is from a given cluster of points int findDistanceToCluster(CvPoint2D32f point, CvPoint2D32f *cluster, int numClusterPoints); // Storage for the previous gray image IplImage *prevGray = 0; // Storage for the previous pyramid image IplImage *prevPyramid = 0; // for working with the current frame in grayscale IplImage *gray = 0; // for working with the current frame in grayscale2 (for L-K OF) IplImage *pyramid = 0; // max features to track in the face region int const MAX_FEATURES_TO_TRACK = 300; // max features to add when we search on top of an existing pool of tracked points int const MAX_FEATURES_TO_ADD = 300; // min features that we can track in a face region before we fail back to face detection int const MIN_FEATURES_TO_RESET = 6; // the threshold for the x,y mean squared error indicating that we need to scrap our current track and start over float const MSE_XY_MAX = 10000; // threshold for the standard error on x,y points we're tracking float const STANDARD_ERROR_XY_MAX = 3; // threshold for the standard error on x,y points we're tracking double const EXPAND_ROI_INIT = 1.02; // max distance from a cluster a new tracking can be int const ADD_FEATURE_MAX_DIST = 20; int main(int argc, char **argv) { // Init some vars and const // name the window const char *windowName = "Robust Face Detection v0.1a"; // box for defining the region where a face was detected CvRect *faceDetectRect = NULL; // Object faceDetection of the class "FaceDetection" FaceDetection faceDetection; // Object captureFrame of the class "CaptureFrame" CaptureFrame captureFrame; // for working with the current frame IplImage *currentFrame; // for testing if the stream is finished bool finished = false; // for storing the features CvPoint2D32f features[MAX_FEATURES_TO_TRACK] = {0}; // for storing the number of current features that we're tracking int numFeatures = 0; // box for defining the region where a features are being tracked CvBox2D featureTrackBox; // multiplier for expanding the trackBox float expandROIMult = 1.02; // threshold number for adding more features to the region int minFeaturesToNewSearch = 50; // Start doing stuff ------------------> // Create a new window cvNamedWindow(windowName, 1); // Capture from the camera captureFrame.StartCapture(); // initialize the face tracker faceDetection.InitFaceDetection(); // capture a frame just to get the sizes so the scratch images can be initialized finished = captureFrame.CaptureNextFrame(); if (finished) { captureFrame.DeallocateFrames(); cvDestroyWindow(windowName); return 0; } currentFrame = captureFrame.getFrameCopy(); // init the images prevGray = cvCreateImage(cvGetSize(currentFrame), IPL_DEPTH_8U, 1); prevPyramid = cvCreateImage(cvGetSize(currentFrame), IPL_DEPTH_8U, 1); gray = cvCreateImage(cvGetSize(currentFrame), IPL_DEPTH_8U, 1); pyramid = cvCreateImage(cvGetSize(currentFrame), IPL_DEPTH_8U, 1); // iterate through each frame while(1) { // check if the video is finished (kind of silly since we're only working on live streams) finished = captureFrame.CaptureNextFrame(); if (finished) { captureFrame.DeallocateFrames(); cvDestroyWindow(windowName); return 0; } // save a reference to the current frame currentFrame = captureFrame.getFrameCopy(); // check if we have a face rect if (faceDetectRect) { // Create a grey version of the current frame cvCvtColor(currentFrame, gray, CV_RGB2GRAY); // Equalize the histogram to reduce lighting effects cvEqualizeHist(gray, gray); // check if we have features to track in our faceROI if (numFeatures > 0) { bool died = false; //cout << "nnumFeatures: " << numFeatures; // track them using L-K Optical Flow char featureStatus[MAX_FEATURES_TO_TRACK]; float featureErrors[MAX_FEATURES_TO_TRACK]; CvSize pyramidSize = cvSize(gray->width + 8, gray->height / 3); CvPoint2D32f *featuresB = new CvPoint2D32f[MAX_FEATURES_TO_TRACK]; CvPoint2D32f *tempFeatures = new CvPoint2D32f[MAX_FEATURES_TO_TRACK]; cvCalcOpticalFlowPyrLK(prevGray, gray, prevPyramid, pyramid, features, featuresB, numFeatures, cvSize(10,10), 5, featureStatus, featureErrors, cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, -3), 0); numFeatures = 0; float sumX = 0; float sumY = 0; float meanX = 0; float meanY = 0; // copy back to features, but keep only high status points // and count the number using numFeatures for (int i = 0; i < MAX_FEATURES_TO_TRACK; i++) { if (featureStatus[i]) { // quick prune just by checking if the point is outside the image bounds if (featuresB[i].x < 0 || featuresB[i].y < 0 || featuresB[i].x > gray->width || featuresB[i].y > gray->height) { // do nothing } else { // count the good values tempFeatures[numFeatures] = featuresB[i]; numFeatures++; // sum up to later calc the mean for x and y sumX += featuresB[i].x; sumY += featuresB[i].y; } } //cout << "featureStatus[" << i << "] : " << featureStatus[i] << endl; } //cout << "numFeatures: " << numFeatures << endl; // calc the means meanX = sumX / numFeatures; meanY = sumY / numFeatures; // prune points using mean squared error // caclulate the squaredError for x, y (square of the distance from the mean) float squaredErrorXY = 0; for (int i = 0; i < numFeatures; i++) { squaredErrorXY += (tempFeatures[i].x - meanX) * (tempFeatures[i].x - meanX) + (tempFeatures[i].y - meanY) * (tempFeatures[i].y - meanY); } //cout << "squaredErrorXY: " << squaredErrorXY << endl; // calculate mean squared error for x,y float meanSquaredErrorXY = squaredErrorXY / numFeatures; //cout << "meanSquaredErrorXY: " << meanSquaredErrorXY << endl; // mean squared error must be greater than 0 but less than our threshold (big number that would indicate our points are insanely spread out) if (meanSquaredErrorXY == 0 || meanSquaredErrorXY > MSE_XY_MAX) { numFeatures = 0; died = true; } else { // Throw away the outliers based on the x-y variance // store the good values in the features array int cnt = 0; for (int i = 0; i < numFeatures; i++) { float standardErrorXY = ((tempFeatures[i].x - meanX) * (tempFeatures[i].x - meanX) + (tempFeatures[i].y - meanY) * (tempFeatures[i].y - meanY)) / meanSquaredErrorXY; if (standardErrorXY < STANDARD_ERROR_XY_MAX) { // we want to keep this point features[cnt] = tempFeatures[i]; cnt++; } } numFeatures = cnt; // only bother with fixing the tail of the features array if we still have points to track if (numFeatures > 0) { // set everything past numFeatures to -10,-10 in our updated features array for (int i = numFeatures; i < MAX_FEATURES_TO_TRACK; i++) { features[i] = cvPoint2D32f(-10,-10); } } } // check if we're below the threshold min points to track before adding new ones if (numFeatures < minFeaturesToNewSearch) { // add new features // up the multiplier for expanding the region expandROIMult *= EXPAND_ROI_INIT; // expand the trackBox float newWidth = featureTrackBox.size.width * expandROIMult; float newHeight = featureTrackBox.size.height * expandROIMult; CvSize2D32f newSize = cvSize2D32f(newWidth, newHeight); CvBox2D newRoiBox = {featureTrackBox.center, newSize, featureTrackBox.angle}; // find new points CvPoint2D32f additionalFeatures[MAX_FEATURES_TO_ADD] = {0}; int numAdditionalFeatures = findFeatures(gray, additionalFeatures, newRoiBox); int endLoop = MAX_FEATURES_TO_ADD; if (MAX_FEATURES_TO_TRACK < endLoop + numFeatures) endLoop -= numFeatures + endLoop - MAX_FEATURES_TO_TRACK; // copy new stuff to features, but be mindful of the array max for (int i = 0; i < endLoop; i++) { // TODO check if they are way outside our stuff???? int dist = findDistanceToCluster(additionalFeatures[i], features, numFeatures); if (dist < ADD_FEATURE_MAX_DIST) { features[numFeatures] = additionalFeatures[i]; numFeatures++; } } // TODO check for duplicates??? // check if we're below the reset min if (numFeatures < MIN_FEATURES_TO_RESET) { // if so, set to numFeatures 0, null out the detect rect and do face detection on the next frame numFeatures = 0; faceDetectRect = NULL; died = true; } } else { // reset the expand roi mult back to the init // since this frame didn't need an expansion expandROIMult = EXPAND_ROI_INIT; } // find the new track box if (!died) featureTrackBox = findTrackBox(features, numFeatures); } else { // convert the faceDetectRect to a CvBox2D CvPoint2D32f center = cvPoint2D32f(faceDetectRect->x + faceDetectRect->width * 0.5, faceDetectRect->y + faceDetectRect->height * 0.5); CvSize2D32f size = cvSize2D32f(faceDetectRect->width, faceDetectRect->height); CvBox2D roiBox = {center, size, 0}; // get features to track numFeatures = findFeatures(gray, features, roiBox); // verify that we found features to track on this frame if (numFeatures > 0) { // find the corner subPix cvFindCornerSubPix(gray, features, numFeatures, cvSize(10, 10), cvSize(-1,-1), cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03)); // define the featureTrackBox around our new points featureTrackBox = findTrackBox(features, numFeatures); // calculate the minFeaturesToNewSearch from our detected face values minFeaturesToNewSearch = 0.9 * numFeatures; // wait for the next frame to start tracking using optical flow } else { // try for a new face detect rect for the next frame faceDetectRect = faceDetection.detectFace(currentFrame); } } } else { // reset the current features numFeatures = 0; // try for a new face detect rect for the next frame faceDetectRect = faceDetection.detectFace(currentFrame); } // save gray and pyramid frames for next frame cvCopy(gray, prevGray, 0); cvCopy(pyramid, prevPyramid, 0); // draw some stuff into the frame to show results if (numFeatures > 0) { // show the features as little dots for(int i = 0; i < numFeatures; i++) { CvPoint myPoint = cvPointFrom32f(features[i]); cvCircle(currentFrame, cvPointFrom32f(features[i]), 2, CV_RGB(0, 255, 0), CV_FILLED); } // show the tracking box as an ellipse cvEllipseBox(currentFrame, featureTrackBox, CV_RGB(0, 0, 255), 3); } // show the current frame in the window cvShowImage(windowName, currentFrame); // wait for next frame or keypress char c = (char)waitKey(30); if(c == 27) break; switch(c) { case 'r': numFeatures = 0; // try for a new face detect rect for the next frame faceDetectRect = faceDetection.detectFace(currentFrame); break; } } // Release the image and tracker captureFrame.DeallocateFrames(); // Destroy the window previously created cvDestroyWindow(windowName); return 0; } // draws a region of interest in the src frame based on the given rect void drawFaceROIFromRect(IplImage *src, CvRect *rect) { // Points to draw the face rectangle CvPoint pt1 = cvPoint(0, 0); CvPoint pt2 = cvPoint(0, 0); // setup the points for drawing the rectangle pt1.x = rect->x; pt1.y = rect->y; pt2.x = pt1.x + rect->width; pt2.y = pt1.y + rect->height; // Draw face rectangle cvRectangle(src, pt1, pt2, CV_RGB(255,0,0), 2, 8, 0 ); } // finds features and stores them in the given array // TODO move this method into a Class int findFeatures(IplImage *src, CvPoint2D32f *features, CvBox2D roi) { //cout << "findFeatures" << endl; int featureCount = 0; double minDistance = 5; double quality = 0.01; int blockSize = 3; int useHarris = 0; double k = 0.04; // Create a mask image to be used to select the tracked points IplImage *mask = cvCreateImage(cvGetSize(src), IPL_DEPTH_8U, 1); // Begin with all black pixels cvZero(mask); // Create a filled white ellipse within the box to define the ROI in the mask. cvEllipseBox(mask, roi, CV_RGB(255, 255, 255), CV_FILLED); // Create the temporary scratchpad images IplImage *eig = cvCreateImage(cvGetSize(src), IPL_DEPTH_8U, 1); IplImage *temp = cvCreateImage(cvGetSize(src), IPL_DEPTH_8U, 1); // init the corner count int int cornerCount = MAX_FEATURES_TO_TRACK; // Find keypoints to track using Good Features to Track cvGoodFeaturesToTrack(src, eig, temp, features, &cornerCount, quality, minDistance, mask, blockSize, useHarris, k); // iterate through the array for (int i = 0; i < cornerCount; i++) { if ((features[i].x == 0 && features[i].y == 0) || features[i].x > src->width || features[i].y > src->height) { // do nothing } else { featureCount++; } } //cout << "nfeatureCount = " << featureCount << endl; // return the feature count return featureCount; } // finds the track box for a given array of 2d points // TODO move this method into a Class CvBox2D findTrackBox(CvPoint2D32f *points, int numPoints) { //cout << "findTrackBox" << endl; //cout << "numPoints: " << numPoints << endl; CvBox2D box; // matrix for helping calculate the track box CvMat *featureMatrix = cvCreateMat(1, numPoints, CV_32SC2); // collect the feature points in the feature matrix for(int i = 0; i < numPoints; i++) cvSet2D(featureMatrix, 0, i, cvScalar(points[i].x, points[i].y)); // create an ellipse off of the featureMatrix box = cvFitEllipse2(featureMatrix); // release the matrix (cause we're done with it) cvReleaseMat(&featureMatrix); // return the box return box; } int findDistanceToCluster(CvPoint2D32f point, CvPoint2D32f *cluster, int numClusterPoints) { int minDistance = 10000; for (int i = 0; i < numClusterPoints; i++) { int distance = abs(point.x - cluster[i].x) + abs(point.y - cluster[i].y); if (distance < minDistance) minDistance = distance; } return minDistance; }!
|
https://software.intel.com/pt-br/blogs/2013/03/11/infrared5-ultimate-coder-update-4-flamethrowers-wingsuits-rearview-mirrors-and-face
|
CC-MAIN-2015-32
|
refinedweb
| 3,651
| 56.69
|
NUnit, MbUnit, or VSTSUnit (aka MSTest.exe) have similar syntax, which makes it easy to switch between one framework and another. Switching from NUnit to MbUnit is as simple as replacing:
using NUnit.Framework;
with:
using MbUnit.Framework;
Switching the other way is just as easy as long as you haven’t used any MbUnit-specific features such as RowTest.
Switching to/from VSTSUnit is not as easy because Microsoft decided to rename the test-related attributes. (The Assert class is largely the same fortunately. So switching is largely an attribute renaming exercise.) So here’s a snippet to place at the top of every test file that will allow you to switch between NUnit, MbUnit, and VSTSUnit via a simple #define in a code file, a compiler switch, or project properties. You then define your tests using VSTSUnit attributes. (i.e. TestClass, TestMethod, etc.)
#if NUNIT
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;
#elif MBUNIT
using MbUnit.Framework;
using TestClass = MbUnit.Framework.TestFixtureAttribute;
using TestMethod = MbUnit.Framework.TestAttribute;
using TestInitialize = MbUnit.Framework.SetUpAttribute;
using TestCleanup = MbUnit.Framework.TearDownAttribute;
using ClassInitialize = MbUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = MbUnit.Framework.TestFixtureTearDownAttribute;
#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endif
Now you’re probably thinking to yourself, “James must really love VSTSUnit because that’s the default.” Not exactly. I use a number of tools including ReSharper’s built-in Unit Test Runner and VSTSUnit’s Test View window. ReSharper works against the compiled code model. So the naming of the attributes is irrelevant. Instead of TestFixture, I could attribute my test-containing class with “MonkeysWritingShakespeare” as long as I had the proper using alias:
using MonkeysWritingShakespeare = NUnit.Framework.TestFixtureAttribute;
ReSharper’s Unit Test Runner figures it out because the whole using syntax is C# syntactic sugar so you don’t have to type fully qualified classes all the time. (The CLR only deals in fully qualified classes.)
How about VSTSUnit’s Test View? Not so good. It is apparently parsing the C# code file, not the code model, looking for tests. If you attribute a test with anything other than TestMethod (or its fully qualified equivalent), the test disappears from the Test View window even if you have the correct using alias to rename the attribute to TestMethodAttribute. Very lame. So that’s why I use VSTSUnit attributes and alias them to NUnit or MbUnit equivalents rather than the other way around.
Now should you use this unit test switching technique on every project? No, it’s not worth it. Pick a unit test framework and stick with it as long as it is not causing you pain. Because of differences between unit test frameworks, you need to run your test suite with all the test frameworks at least every few days. Otherwise you’ll accidentally use a feature specific to one framework and not realize it. (I’m assuming that you are running your test suite frequently throughout the day using your test framework of choice. My point here is that you need to run your test suite with all frameworks at least once in awhile to ensure that everything works.) There are occasions where you want to support multiple test frameworks and the snippet above will hopefully make life easier for you.
|
http://jameskovacs.com/2007/02/
|
CC-MAIN-2021-39
|
refinedweb
| 567
| 51.65
|
Convert Date to GMT
Convert Date
to GMT
In this section, you will learn to convert a date
into the GMT format. The GMT stands for Greenwich Mean Time IST
C:\unique>java GMTtoIST
GMT Time: 8/4/07 9:49 AM
IST...
Convert GMT to IST
In this section, you will learn to convert a GMT to IST format
Convert GMT to PST
Convert GMT to PST
In this section, you will learn to convert a GMT to PST format. The GMT... of program:
This example helps you in converting a GMT time to PST time
Java get GMT Time
Java get GMT Time
In this section, you will study how to obtain the GMT time.
GMT....
The following example helps you to obtain the IST and GMT time on the console.
The method
String to Date Conversion - Java Beginners
));
For read more information : to Date Conversion Hi ,
I am retreiving time stamp of a file.... But I dont want the date/time field of access database to be changed to text
Java Conversion
to convert a GMT to CST format. The GMT stands for Greenwich Mean
Time and CST stands...Java Conversion
...() method to get time/date as
long return type.
Convert Date
java conversion
java conversion how do i convert String date="Aug 31, 2012 19:23:17.907339000 IST" to long value
Getting NumberFormatException
table
%>
<%
}
else
{
str="Wrong Time Entered. Please Enter Proper Time...Getting NumberFormatException Hello Sir, I'm using Integer.parseInt.... I used the same type of code in a simple .java program but when I.m using
Type Conversion - Java Beginners
Type Conversion Hai, rajanikanth, Please explain how to convert from integer value to a string value .In a database operation i want to convert... for conversion
Java To Vb.Net Conversion - Java Beginners
Java To Vb.Net Conversion How to convert Java Code To VB.net,which Software is useful to convert java to vb.net,plz Help Me
Distance conversion - Java Beginners
in metres. The program will then present a user menu of conversion types, converting... the user.
? Write three methods to convert the distance to kilometres, feet and inches...{
System.out.println();
System.out.println("1. Convert to kilometers
how to convert time in milliseconds in to hours - Java Beginners
how to convert time in milliseconds in to hours hello,
can anyone tell me how i can convert the time in milliseconds into hours or to display it in seconds in java
How to convert date to time in PHP?
How to convert date to time in PHP? Hi, programmer.
The PHP programming language has several useful functions for getting and manipulating the date... Time (GMT). This number is handy for generating unique and random numbers
Getting time in Milliseconds
Getting time in Milliseconds
...:00 GMT. getTime()
returns total time in long datatype.
Here is the full...;java GetTimeMilliseconds
New Date:=Fri Oct 10 13:26:49 GMT+05:30 2008
Java Time Zone Example
Java Time Zone Example
Converting time between time zones
In this section we have written a java program which
will take two Time Zone IDs as its argument and then convert
Getting date by time
Getting date by time
... of java.util.Date(). For creating or generating Date by
the specific time we have used...
with the specified time .
Here is the example code
HSSFCell to String type conversion
HSSFCell to String type conversion Hello,
Can anyone help me convert HSSFCell type to string. There is a solution in the following URL...://
Conversion from color to Gray Image - Java Beginners
Conversion from color to Gray Image Hi... Sakthi here..
i am new to java. and i haven't try this so far
How to convert the color image to gray scale image in java?
could u plz help me out to start the process
Convert Time to Seconds
Convert Time to Seconds
In this section, you will learn to convert Time to
seconds. An hour has...:
This example helps you in converting a Time to seconds. Here, first of all we
have
Getting Information of All Available Time Zones
Getting Information of All Available Time
Zones... as local time.
Usually time zone is based on the GMT (Greenwich Mean Time). Each... to the appropriate time zones. Java maintains it's own time zones
database as well
Getting an error :(
Getting an error :( I implemented the same code as above..
But getting this error in console...
Console
Oct 5, 2012 10:18:14 AM... was not found on the java.library.path: C:\Program Files\Java\jre1.5.007\bin;.;C:\Windows
C GMT Time
C GMT Time
In this section, you will study how to get the gmt time in C.
GMT stands for
Greenwich Mean Time. In the given example, the time() function determines
Example program to get all the available time zones
to get all the
available time zones using java program. This example is very simple java code
that will list all the available time zones. We have used the java.util.TimeZone class.
For getting all the available time zones we have to use
Convert String to Date
Convert String to Date
In this example we are going to convert String into
date.
In java date conversion, two packages are used .They
are java.util.
Convert Time to Milliseconds
Convert Time to Milliseconds
In this section, you will learn to convert Time... thousand part of a second i.e. an unit for measuring the time.
Getting the Current Time
Getting the Current Time
This section shows the way of getting the
current time... of the time. This class helps you to convert a date
format object into the integer fields
time
time how to find the current system time between the user login and logout using java
Java Conversion
ascii to thai language conversion - Java Beginners
ascii to thai language conversion I have a string in ascii format like \u0042\u00072 ..., It was converted from thai language. How can i convert it to thai language. I would be more thankful if I get some example or some
Convert Date to Milliseconds
. The Date() constructor represents the current date (time) in
GMT...
Convert Date to Milliseconds
In this section, you will learn to convert a date
java time - Java Beginners
java time Hi,
Iam created a desktop login application using swings.
pls observe the following code:
import javax.swing.*;
import java.awt....();
}
}
and
import mysql.DataAcc;
// import package class for getting database
hexadecimal conversion java compilation - UML
hexadecimal conversion java compilation write a simple program...,
Please visit the following links:
What's wrong with my form? - Java Beginners
What's wrong with my form? Dear expert,
I'm having trouble with my enquiry form.
Hope you can tell me where my mistake lies.
Thanks.
Here's my jsp code:
Enquiries
var objForm = new Object
conversion - Java Beginners
jsp to struts 2 action conversion problem - Struts
jsp to struts 2 action conversion problem i have one jsp page that includes 3 other jsp pages(using RequestDispactcher).how to convert that jsp...(i.e no java code is involved).remaining pages involve java code. Hi
Java : String Case Conversion
Java : String Case Conversion
In this section we will discuss how to convert a String from one case into
another case.
Upper to Lower case Conversion :
By using toLowerCase() method you can convert any
upper case char/String
Convert String to Date
C:\convert\rajesh\completed>java StringToTimeExample
The date and Time: Thu...
Convert String to Date
In this example we are going to convert string into date We
Convert Miles To Kilometers program in java
Convert Miles To Kilometers program in java Write a program... places.
You will need to write a separate method to convert a
single distance....
Extend your program to support conversion from kilometres to miles. Use an extra
Convert Byte to Hexadecimal
Convert Byte to Hexadecimal
In this section, We are going to convert a byte value...
for this conversion.
Code Description: This program takes a byte number from console
convert .txt file in .csv format - Java Beginners
convert .txt file in .csv format Dear all,
I hope you are doing good.
I am looking to convert .txt file in .csv format.
The contents might have... delimiter. But I am not getting the exact out put I do wish to.
This is what I thought
Time validation
. If the user enters the time in wrong format, it displays the error message.
<...Time validation Hi. I have a text box in html to get time... box is in the correct format or not using java script.
Please help me for doing
Getting Exception
Getting Exception How to get exception from commented code in java
Convert Char To Byte
Convert Char To Byte
This section illustrate the conversion from char to
Byte. Here, we are going to convert a char type variable into byte type variable
Get current Date and Time
current date and time in
java. Java provide two classes, Date and calendar which
will display the current date and time in java. SimpleDateFormat is used
for formatting the date an time. Java provide Date class which
Getting NumberFormatException
Getting NumberFormatException Thanks for the reply. Its works well... garbage value. I dont have the idea what is going wrong. Please give me some idea... t=request.getParameter("time"); %>
<%=t2%> ");`
Hi Friend
time conversion - Date Calendar
time conversion hoe to add time in php like 01:30:00 and 00:45:20 and 02:50:40
different execution time - Java Beginners
different execution time
hello, when i run the bellow code more than one time i am getting different execution time("Total time taken"),
Ex. when i run first time it prints Total time taken 47
second time it prints Total
How to convert this Java code into GUI?
How to convert this Java code into GUI? import java.util.Scanner...++;
}
}
System.out.println("Number of student getting A+ and A grade: "
+ (count1 + count2));
System.out.println("Number of student getting B+ and B grade
String to Int Conversion
String to Int Conversion
This section illustrates you how to convert a string
into its integer equivalent. To demonstrate the conversion of string into an
integer we are
Getting and Setting Java Type Values in a Preference
Getting and Setting Java Type Values in a Preference... convenient methods to convert the Java types into
string. For example, the method... and get the Java Type values in a
Preference.
As you know that a preference
getting random number in java
getting random number in java getting random number in java
Hi... random numbers between 1 to 100 in Java. Though i m new to Java, i have tried many... in my Java application but nothing seems to work.
In order to get the random
Java convert string to InputStream
Java convert string to InputStream
In this section, you will learn how to convert string to Inputstream.
In one of the previous sections, we have discussed the conversion of
InputStream to string. Here we are going to do just reverse
How to convert a String to an int?
of data conversion in Java.
Thanks...How to convert a String to an int? I my program I am taking... format. Now I want to convert into int value.
Tell me How to convert a String
How to convert into to String in Java?
How to convert into to String in Java? Hi,
How to convert into to String in Java?
Thanks
gmdate()
PHP gmdate() Function
gmdate function format a GMT/UTC date/time. This function is similar to date() except in finding the Greenwich Mean Time (GMT... to Greenwich time (GMT) in hours (Example: +0100)
T - Timezone setting
Getting Computer Date in java
Getting Computer Date in java Hi , I want to get the PC Date and insert it to a DB, specifically MSSQL..
Everything in my scriptlet works but this..
String strDate = new Date();
I get this server error, "The type Date
Getting A File's Mime Type In Java
Getting A File's Mime Type In Java Getting A File's Mime Type In Java
Time display - JSP-Servlet
Time display In a web application or ina website if we display the time getting as
system time, whether it is server' system time or client' system time. Is
there any difference between getting time using java Date
convert to decimal
convert to decimal f42a4 convert to decimal by using java To Calendar
to represent a time in milliseconds after January 1, 1970 00:00:00 GMT. ...
Convert Date To Calendar
... into
Calendar. Here we are using format method to convert date
into string.
Getting Started With Java
Getting Started With Java
JDK 6 Tutorial
The latest news for the java programmers that the Sun MicroSystems has
released the Java SE 6 on Monday December 11.
Convert InputStream to ByteArray
Convert InputStream to
ByteArray
Here we will learn the conversion of an input
stream into a byte array.
To convert the InputStream
convert date time to int
convert date time to int convert date time to int
Conversion from String to char
Conversion from String to char:
In this tutorial we will learn how to convert a string type data to char type
data.
Description:
This program will take...(buffreader.readLine());
String mystring = "Welcome to Java";
Character
Convert to java - Java Beginners
Convert to java Can anyone convert this javascript program codes to Java codes,please...thanks!
var iTanggalM = 0;
var iTanggalH = 0;
var iBulanM = 0;
var iBulanH = 0;
var iTahunM = 0;
var iTahunH = 0;
var
about getting the hour time
about getting the hour time if i want to say, if the hour shows before noon, display message "good morning" and if otherwise, display "good afternoon" and so on..and im using tag..the problem is i dont know the code for Good
how to convert text file to xml file in java. - XML
how to convert text file to xml file in java. Hi all,
I m having some problem. Problem is I want to convert a text file which is having...://
Hope that it will be helpful
|
http://www.roseindia.net/tutorialhelp/comment/64748
|
CC-MAIN-2014-10
|
refinedweb
| 2,355
| 64.91
|
Functions are (or should be) short sections of code that may be called from within the main programme, or from another function. They usually take some inputs (arguments) and return one or more results.
Functions may be used for two purposes:
1) To avoid repeating code when the same code needs to be run in two or more locations in the main programme.
2) To structure the code, breaking the code down into smaller pieces. In functional programming the whole programme would be broken down into functions
If a function is more than 10 lines long you may want to think whether it could be broken down further, with some of the code pulled out as a separate function.
Ideally a function should do just one thing; it should be as simple as possible, and easy for another person to follow.
A docstring may be used at the start of a function to provide help to the user – in this case if the user types help(function_name) the docstring will be returned. These docstrings may also give examples of the function.
Any variables defined within functions are destroyed when the function closes. Functions are not usually used to change global variables (those variables defined in the main programme code). If a global variable is passed to a function any changes to that variable made by the function are lost when the function ends (and so global variables are protected from being changed by functions). There is a way to force the function to change the global variable, which we will cover in a later lesson, but this should usually be avoided if possible.
Defining a function
A function is defined with the def statement. It is followed by the function’s inputs (arguments or ’args’) which may also be given a default value. The user may enter the inputs either by name, or in the order in which the function expects them.
It is good practice to use verbs to define functions, to describe what they do.
Let’s do a very simple example, raising a number to the power of another number, and we will set a default where, if no other number is given, we will raise to the power of zero (which always returns a value of 1). Note that we define a default value with the = sign.
def raise_to_power (number, power = 0): result = number ** power return result
Once the function has been defined we can call it:
print (raise_to_power(2,6)) OUT: 64
We could describe the inputs by their names if we wanted to:
print (raise_to_power(number = 2, power = 6)) OUT: 64
If we define the inputs by name, the order becomes unimportant (without the names the function expects inputs in the order defined in the function):
print (raise_to_power(power = 6, number = 2)) OUT: 64
And remember that we set a default of power to zero, so if we only pass the first argument (’number’), the power defaults to zero:
print (raise_to_power(2)) OUT: 1
Adding help to a function with a docstring
A help docstring may be added to a function using triple quotes (’ or “) after the function has been defined. This may be called later by the user using help.
def raise_to_power (number, power = 0): """ This functions takes two numbers, and raises the first number to the power of the second. If no second number, or power, is given then power defaults to zero """ result = number ** power return result
Calling help:
help (raise_to_power) OUT: Help on function raise_to_power in module __main__: raise_to_power(number, power=0) This functions takes two numbers, and raises the first number to the power of the second. If no second number, or power, is given then power defaults to zero
Returning two or more results
Sometimes we may wish to return more than one value. There are two ways of doing this:
1) Return the values separately (the code that calls the argument must also refer to both results:
def calculate_sum_and_product(a, b): """Return sum and product of two numbers""" my_sum = a + b my_product = a * b return my_sum,my_product # When calling the function we need to put both results generated by the function calculated_sum, calculated_product = calculate_sum_and_product(5,6) print (calculated_sum) print (calculated_product) OUT: 11 30
2) A more common way would be to return a single result that is a container (commonly a list or a tuple) of the two results. Here we return a tuple of the two results (remember that tuples are like lists, but they cannot be changed). We can tell that the returned value is a tuple by the use of curved brackets (a list could also be used, which we would spot by square brackets.
def calculate_sum_and_product(a, b): """Return sum and product of two numbers""" my_sum = a + b my_product = a * b result = (my_sum, my_product) # this is a tuple return results results = calculate_sum_and_product(5,6) # Individual results are obtained by their index: print (results[0]) print (results[1]) OUT: 11 30
One thought on “17. Python basics: functions”
|
https://pythonhealthcare.org/2018/03/27/17-python-basics-functions/
|
CC-MAIN-2020-29
|
refinedweb
| 834
| 50.4
|
Access AWS Support
You can access the Support Center by using the following options:
Use the email address and password associated with your AWS account.
(Recommended) Use AWS Identity and Access Management (IAM).
If you have a Business or Enterprise Support plan, you can also use the AWS Support API to access AWS Support and Trusted Advisor operations programmatically. For more information, see the AWS Support API Reference.
AWS account
You can sign in to the AWS Management Console and access the Support Center by using your AWS account email address and password. This identity is called the AWS account root user. However, we strongly recommend that you don't use the root user for your everyday tasks, even the administrative ones. Instead, we recommend that you use IAM, which lets you control who can perform certain tasks in your account.
IAM
By default, IAM users can't access the Support Center. You can use IAM to create individual users or groups. Then, you attach IAM policies to these entities, so that they have permission to perform actions and access resources, such as to open Support Center cases and use the AWS Support API.
After you create IAM users, you can give those users individual passwords and an account-specific sign-in page. They can then sign in to your AWS account and work in the Support Center. IAM users who have AWS Support access can see all cases that are created for the account.
For more information, see How IAM users sign in to your AWS account in the IAM User Guide.
The easiest way to grant permissions is to attach the AWS managed policy AWSSupportAccess
Resource
element is always set to
*. You can't allow or deny access to specific
support cases.
Example : Allow access to all AWS Support actions
The AWS managed policy AWSSupportAccess
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["support:*"], "Resource": "*" } ] }
For more information about how to attach the
AWSSupportAccess
policy to your entities, see Adding IAM identity permissions (console) in the
IAM User Guide.
Example : Allow access to all actions except the ResolveCase action
You can also create customer managed policies in IAM to specify what actions to allow or deny. The following policy statement allows an IAM user to perform all actions in AWS Support except resolve a case.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "support:*", "Resource": "*" }, { "Effect": "Deny", "Action": "support:ResolveCase", "Resource": "*" }] }
For more information about how to create a customer managed IAM policy, see Creating IAM policies (console) in the IAM User Guide.
If the user or group already has a policy, you can add the AWS Support-specific policy statement to that policy.
If you can't view cases in the Support Center, make sure that you have the required permissions. You might need to contact your IAM administrator. For more information, see Identity and access management for AWS Support.
Access to AWS Trusted Advisor
In the AWS Management Console, a separate
trustedadvisor IAM namespace controls
access to Trusted Advisor. In the AWS Support API, the
support IAM namespace
controls access to Trusted Advisor. For more information, see Manage access for AWS Trusted Advisor.
|
https://docs.aws.amazon.com/awssupport/latest/user/accessing-support.html
|
CC-MAIN-2021-10
|
refinedweb
| 527
| 52.8
|
Pie Chart - 0% Values overlapping
I'm creating a pie chart and the values are all overlapping when more than 2 are 0%.
Is there a way to ensure the percentage labels do not overlap for the pie chart?
def createPieChart(ws, countRows): pie = PieChart() pie.dataLabels = DataLabelList() pie.dataLabels.showPercent = True #pie.dataLabels. -- fix overlapping 0s #update start index labels = Reference(ws, min_col=4, max_col=7, min_row=17) data = Reference(ws, min_col=4, max_col=7, min_row=20+countRows) pie.add_data(data, from_rows=True, titles_from_data=False) pie.set_categories(labels) pie.title = "Execution Breakdown" pie.height = 7 pie.width = 10 ws.add_chart(pie, "I2")
Can you provide a complete file? I suspect that Excel has some internal logic for layouting items here but it might be possible to learn from it.
Example excel report with overlapping 0's
The overlapping seems to be entirely dependent upon the application used to view the file. In Excel 2011 and 2016 for Mac there is no overlapping.
When I use Excel to recreate the chart it defaults to not displaying the percentage, which certainly makes sense in this case.
If you add some values to the chart you can experiment with various formatting options but
dLblPos = 'BestFitis the default option. Alternatively, you can disable the labels for the series with 0% to prevent them overlapping.
This cannot be solved by the library.
Removing version: 2.4.x (automated comment)
Thanks for your attention Charlie- This can be solved by disabling the labels for 0% without any additional effort. Appreciate your time!
|
https://bitbucket.org/openpyxl/openpyxl/issues/806/pie-chart-0-values-overlapping
|
CC-MAIN-2019-13
|
refinedweb
| 257
| 51.95
|
By Brannon Dorsey
Edited by Michael Hadley.
ofSketch is a barebones development environment created specifically for building and running openFrameworks sketches. Its a minimal installation openFrameworks application that allows you to spend more time coding and less time with configuration.
One of the main goals in developing ofSketch is to decrease the barriers to entry for openFrameworks. For this reason, it should be noted that ofSketch is primarily geared towards beginners and new coders.
ofSketch works by internally communicating back and forth between the ofSketch application and the browser editor. The application, among other things, reads/writes files to your computer, and compiles and launches your projects. The browser editor acts as the graphical user interface (GUI), where you code, run, and manage your projects. When you interact with ofSketch you are doing so from the browser, however the distinction between the application and the browser should not be overlooked. For more info, check out the ARCHITECTURE.md file on the ofSketch GitHub repository.
Visit the ofSketch releases page to download the ofSketch app for your platform.
ofSketch comes packaged with the following files:
It is important for the ofSketch app and the "data" folder to stay in the same directory. I recommend that you leave the app in the uncompressed folder that you download.
Double-click ofSketch to launch the editor. If you are on a Mac, you may need to right click the app, and then press "Open".
That's it! Go code.
Code in ofSketch looks a bit different than what you may be used to with openFrameworks. If you are new to openFrameworks, great! We think that ofSketch code is easier to learn than the normal
.h and
.cpp openFrameworks code structure.
ofSketch uses "header style" C++, where code implementation is written along with declarations inside of the header file, instead of the matching
.cpp source file. If this doesn't make since to you, don't worry. Essentially, this allows us to write simple, easy-to-read code, that is great for beginners!
Every ofSketch project starts with an empty project file that looks like this:
void setup() { // put your setup code here, to run once: } void draw() { // put your main code here, to run once each frame: }
If you are coming from Processing, this should be extremely familiar. To add global functions and variables, simply add them to this project file. You don't need to prefix any identifiers (variables, functions, etc...) with
ofApp.
// global variables go up here std::string text; void setup() { // put your setup code here, to run once: text = "Hello World!"; printHelloWorld(); // function call } void draw() { // put your main code here, to run once each frame: } // global functions go down here void printHelloWorld() { cout << text << endl; }
Using classes in ofSketch is easy! Press the "+" button in the tab bar in the ofSketch browser window to add a new class. When you do this a class template is automatically generated for you. Here is an example class template for a "Particle" class:
class Particle{ public: Particle(){ } };
This is essentially a regular
.h file. The default constructor is explicitly defined in the generated template, but adding class members is easy. Just remember to both declare and implement all of the functions that you write in this file. Here is an example of a basic "Particle" class that could be used in a particle system.
class Particle{ public: ofVec2f location; ofVec2f velocity; ofVec2f acceleration; ofColor color; float maxSpeed; int radius; // default constructor Particle() {}; // overloaded constructor Particle(float x, float y) { acceleration = ofVec2f(0,0); velocity = ofVec2f(0, -2); location = ofVec2f(x,y); color = ofColor(ofRandom(255), 0, 255); radius = 6.0; maxSpeed = 4; } void update() { velocity += acceleration; velocity.limit(maxSpeed); location += velocity; acceleration *= 0; } void draw() { ofFill(); ofSetColor(color); ofDrawCircle(location.x, location.y, radius); } // etc... };
Every ofSketch file includes "ofMain.h" by default. To include custom classes, simply put
#include "ClassName.h" at the top of any file that needs to use that class. Below is an example of how to include the Particle class file above in the project file.
#include "Particle.h" Particle p; void setup() { // put your setup code here, to run once: // create a particle at the center p = Particle(ofGetWidth()/2, ofGetHeight()/2); } void update() { p.update(); } void draw() { // put your main code here, to run once each frame: p.draw(); }
Here we include the "Particle.h" file, use it to instantiate a Particle object "p", and then place it in the middle of the screen.
Note that we also added an
update function. As you may know by now, it is customary in openFrameworks to separate operations that update logic from operations that render graphics to the screen. This is for performance reasons, however, it is not necessary, and all of the code placed in
void update() can instead live inside of
void draw() if you prefer.
ofSketch comes packaged with a few basic examples that illustrate the ofSketch code style. Most of them are ported from the regular openFrameworks examples, but there are a few new ones too. Press the "Open Project" button inside ofSketch to open one of them.
While the code in this chapter highlights the difference between ofSketch code and a normal implementation of C++ code, reviewing the examples should give you a better idea of the general ofSketch style.
If you take a look at an app in your Projects folder, you will see a "sketch" directory. This is where all of the ofSketch source files are saved, each with a ".sketch" file extension. When you use ofSketch, you are editing the files in this directory. Whenever you run an app from inside ofSketch, all of the files in the "sketch" directory are processed to generate source files inside of the "src" directory.
Because of this workflow, it is important to edit ofSketch projects through ofSketch only. You could easily get yourself into trouble if you edited an ofSketch project with Xcode (modifying the files in the "src" directory) and then opened it in ofSketch again, pressed the play button, and then overwrote all of our changes.
Soon, ofSketch will include fancy project import and export feature which will allow you to import/export a project from/to a professional IDE target of your choice. Until then, it is best to just copy a project if you want to edit it with something other than ofSketch.
One of the highlights of the ofSketch browser editor is the ability to edit code on a remote machine through a network connection. This is especially helpful when coding with the Raspberry Pi, or when tweaking live installation code. The figure below illustrates this in practice.
To code with ofSketch remotely, start the ofSketch application on the machine that you want to run the openFrameworks app. In order to connect to ofSketch from that machine, you need to know its unique IP address on the network. You can use an application like Bonjour Browser on device 2 to discover device 1's IP address.
Once you have the IP address of device 1, open a web browser on device 2 and visit.
You can now create, edit, and run projects using device 2.
The ofSketch project is still in its infancy. In fact, at the time of writing this chapter, the most recent ofSketch release is v0.3.2. Undoubtedly the application will change as we approach a stable release (v1.0), but we are particularly excited about some of the things we have in store. Below is a list of planned features to watch out for over the next year.
App Export will allow users to export executables and resources that can be transferred to and run on other computers. The exported project will be downloaded as zipped bundle for easy transport.
Project File Export will use an integrated version of the openFrameworks Project Generator in the ofSketch app to export a project for Xcode, Code::Blocks, and Visual Studio 2012. These project files will be useful to allow new users to access more advanced editing features available in professional IDEs.
To aid in the transition from ofSketch to more advanced IDEs, ofSketch users will be given the option to create and work with
.h and
.cpp files. Eventually, using this functionality will be as simple as including the appropriate extension when creating the file.
We intend to use some of these Clang resources to index the openFrameworks Core and use it to better provide autocomplete and syntax highlighting tools in the editor. Ideally, this system would also auto-index user code.
|
http://openframeworks.cc/ofBook/chapters/ofSketch.html
|
CC-MAIN-2017-04
|
refinedweb
| 1,428
| 63.39
|
The split() method of the String class accepts a delimiter (in the form of the string), divides the current String into smaller strings based on the delimiter and returns the resulting strings as an array. If the String does not contain the specified delimiter this method returns an array which contains only the current string.
If the String does not contain the specified delimiter this method returns an array containing the whole string as element.
To split a String into an array of strings with white pace as delimiter −
Read the source string.
Invoke split() method by passing “ ” as a delimiter.
Print the resultant array.
Following Java program reads the contents of a file into a Sting and splits it using the split() method with white space as delimiter −
import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class SplitExample { public static void main(String args[]) throws FileNotFoundException { Scanner sc = new Scanner(new File("D:\\sample.txt")); StringBuffer sb = new StringBuffer(); String input = new String(); while (sc.hasNextLine()) { input = sc.nextLine(); sb.append(input); } String source = sb.toString(); String result[] = source.split(" "); for(int i = 0; i < result.length; i++) { System.out.println(result[i]); } } }
Hello how are you
|
https://www.tutorialspoint.com/how-do-we-split-a-string-with-any-whitespace-chars-as-delimiters-using-java
|
CC-MAIN-2022-21
|
refinedweb
| 207
| 61.22
|
RFC 17: Python Namespaces
Author: Howard Butler
Contact: hobu.inc@gmail.com
Status: Adopted
Summary
GDAL bindings for Python have historically dodged the normal Python practices of using packages and namespaces to provide organization. This RFC implements a new namespace for Python, called osgeo, where the GDAL Python bindings henceforth will reside. Backward compatibility is provided, so that current code will continue to run unchanged, but new developments should utilize the namespace for code organization and global namespace pollution reasons. As of 10/1/2007, the changes described here in RFC 17 only pertain to the "next-gen" Python bindings. It is expected that these bindings will be the default bindings for GDAL 1.5.
Objective
To provide the GDAL Python bindings in a Python package that is properly namespaced, eliminating pollution of Python's global namespace.
Past Usage
GDAL's Python bindings previously used globally-aware Python modules:
import gdal import osr import ogr import gdalconst import gdalnumeric
New Usage
RFC 17 now provides these modules under the osgeo namespace:
from osgeo import gdal from osgeo import osr from osgeo import ogr from osgeo import gdalconst from osgeo import gdal_array
Additionally, the old module-style imports continue to work with a deprecation warning:
>>> import gdal /Users/hobu/svn/gdal/swig/python/gdal.py:3: DeprecationWarning: gdal.py was placed in a namespace, it is now available as osgeo.gdal warn('gdal.py was placed in a namespace, it is now available as osgeo.gdal', DeprecationWarning)
It is planned that we will remove the GDAL-specific global modules at some point in the future.
Other Sprint Updates
The work for this RFC was done at the FOSS4G2007 GDAL code sprint by Howard Butler and Chris Barker. In addition to the Python namespacing, some minor issues were dealt with respect to building the GDAL bindings.
- The next-gen Python bindings now use setuptools by default if it is available.
- The ./swig/python directory was slightly reorganized to separate extension building from pure python modules.
- gdal2tiles, a Google Summer of Code project by Petr Klokan, was integrated into the next-gen bindings
Voting History
A voice vote (our first ever!) commenced at the FOSS4G2007 sprint.
- Frank Warmerdam +1
- Howard Butler +1
- Daniel Morissette +1
- Tamas Szekerest +1
|
http://trac.osgeo.org/gdal/wiki/rfc17_python_namespaces
|
crawl-001
|
refinedweb
| 375
| 52.9
|
tag:blogger.com,1999:blog-278179752009-03-02T08:18:30.684-08:00Highlands County Real Estate UpdateMaureen Cool of RE/MAX Realty Plus provides real estate services in Highlands County including Sebring, Avon Park & Lake Placid communities. I list and sell residential real estate, investment properties, vacant land, lots for sale in Highlands County in the Central Florida area.Maureen Cool Tips to Make Your Small Room Look Larger<p><span style="font-size:85%;">When deciding to sell your home it is important to take the steps necessary to ensure that the rooms in your home are properly �??staged�?? to appeal to prospective buyers. This may harder than expected as we all have rooms in our home that may be on the smaller side and hard to decorate. What can really be done with a small room?</span></p><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="font-size:85%;">Below is a list of ten tips to help you open up the small spaces in your home to appear larger and inviting to prospective buyers.</span></p><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1"><br /><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">The use of light colors such as pastels, neutrals and white are a better alternative to �??bright�?? or dark colors.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="2"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">For your furniture, rugs, etc. you should select different shades and textures of the one color you select from above.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="3"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;".</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="4"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Declutter the room.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="5"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">A light colored floor and ceiling will open up the room and make it appear larger.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="6"><a href=""><img id="BLOGGER_PHOTO_ID_5163968474675176130" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Mirrors are a must as they add dimension to the room by reflecting images, light and colors. Mirrors provide a �??see through�?? feel to the room.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="7"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Remove large bulky furniture from the room. One or two smaller pieces placed closer to the walls are better than one large piece of furniture in the middle of the room.</span> </li><br /></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="8"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Don�??t clutter the walls with a collection of pictures. Replace the many pictures with one larger picture or painting.<br /><br /></span></li><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Take advantage of the view of your yard and bring the outside in by allowing prospective buyers to see out into your flowerbeds or gardens.</span> </li></ol><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p><ol style="MARGIN-TOP: 0in" type="1" start="10"><br /><li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><span style="font-size:85%;">Glass tables such as a dining table, end table or coffee table will maintain the �??open�?? and airy feel in a small space.</span> </li><br /></ol>Maureen Cool To Look For As a Buyer In Your Real Estate Market<a href=""><img id="BLOGGER_PHOTO_ID_5159269475510674098" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 123px; CURSOR: hand; HEIGHT: 188px" height="188" alt="" src="" width="194" border="0" /></a> <div>As we sit on the edge of our seats to see which way the real estate market will turn next, there are a number of people waiting for the market to hit bottom before they decide to buy.</div><div></div><br /><div>How do you know when is the right time?<br /></div><br /><div>Blanche Evans, columninst for <a href="" _fcksavedurl="">Realty Times</a> has outlined a number of indicators to watch for if your are thinking about buying. Keep an eye on your local market and watch for these signs.</div><br /><div></div><ul><br /><li>Inventories Start to Decline</li><br /><li>The Days on Market Reduce</li><br /><li>Mortgage Applications Increase</li><br /><li>Sold Homes Go For Closer to List Price</li><br /><li>Prices Remain Firm or Rise</li><br /><li>Incentives Disappear<br /></li></ul><p <a href="" _fcksavedurl="">click here</a>.</p>Maureen Cool Theft - What You Should Know<p class="MsoNormal">In a day and age when technology seems to rule a big part of our lives, it is important to make sure that our �??identity�?? is protected. As we have all read the horror stories of the victims of identity theft, there are steps we can take to protect ourselves and our personal information.</p><p class="MsoNormal">For starters we should be clear about what identify is and how we are identified as individuals in this high tech world we live in. Identity theft occurs when our personal information is collected without our permission and utilized, most of the time, for criminal activity. What personal<br />information do these people target?</p><ol><li><div class="MsoNormal">Your Name</div></li></ol><p class="MsoNormal" style="MARGIN-LEFT: 39pt; TEXT-INDENT: -0.25in">2.<span style="FONT: 7pt 'Times New Roman'"> </span>Address</p><br /><p class="MsoNormal" style="MARGIN-LEFT: 39pt; TEXT-INDENT: -0.25in">3.<span style="FONT: 7pt 'Times New Roman'"> </span>Birth Date</p><br /><p class="MsoNormal" style="MARGIN-LEFT: 39pt; TEXT-INDENT: -0.25in">4.<span style="FONT: 7pt 'Times New Roman'"> </span>Social Security Number (SSN)</p><br /><p class="MsoNormal" style="MARGIN-LEFT: 39pt; TEXT-INDENT: -0.25in">5.<span style="FONT: 7pt 'Times New Roman'"> </span>Credit Card Numbers</p><br /><p class="MsoNormal" style="MARGIN-LEFT: 39pt; TEXT-INDENT: -0.25in">6.<span style="FONT: 7pt 'Times New Roman'"> </span>and Other Personal Identification Numbers</p><br /><p class="MsoNormal">This is the type of information someone would need to open credit card or bank accounts, apply for cellular phone service, purchase vacations packages, forward your mail, etc. So how can you protect yourself from this information getting into the wrong hands?</p><br /><ol><li><div class="MsoNormal">If asked to provide personal information, ask why is it needed, how will it used, if it will be shared and with whom.</div></li><br /><li class="MsoNormal">Carry the least amount of personal information with you as possible.</li><br /><li class="MsoNormal">When asked for your credit number over the phone or internet, make sure that you know who you are dealing with and the communication line is secure.</li><br /><li class="MsoNormal">It�??s always a good idea to take extra security measures when dealing over the internet (i.e. digital signatures and data encryption).</li><br /><li class="MsoNormal">Knowing your billing cycles can prove to be very useful should you not receive your bills in the mail. This could help in determining if you mail has been illicitly redirected.</li><br /><li class="MsoNormal">Order your credit report at least once a year and review for any inaccuracies or any unusual activity.</li><br /><li class="MsoNormal">Report lost or stolen credit cards immediately.</li><br /><li class="MsoNormal">You can also request that your accounts require passwords before any inquiries or changes can be made</li><br /><li class="MsoNormal">Choosing the right password is extremely important. You don�??t want anything obvious and you DON�??T want to write them down.</li><br /><li class="MsoNormal">Always protect your pin number when using debit machines, bank machines or telephones.</li><br /><li class="MsoNormal">Review your credit card cardholder agreement. A number of companies offer protection from credit card fraud.</li><br /><li class="MsoNormal">Lastly, be aware of your garbage. Anything with the above mentioned personal information on it should not just be thrown out. Shredding this type of documentation (especially financial statements, receipts, etc.) is an effective step in preventing identity theft.</li><br /></ol><br /><p class="MsoNormal">Taking the necessary steps above to protect your identity is not difficult. It�??s as simple as being aware of what these identity thieves are looking for and arming yourself with the knowledge on how to properly protect your personal information. </p>Maureen Cool Tax Savings - Calculate Your Own Savings<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="" alt="" id="BLOGGER_PHOTO_ID_5155410137786593970" border="0" /></a><br /><div></div>It's tax time again and we can use a little help in determining any tax savings. Did you know that <span class="P">interest paid on a mortgage is tax deductible if you itemize on your on tax return. So are points that are paid to lower your interest rate. Use my <a href="">mortgage calculator</a> to determine how much you could save in income taxes.<br /><br />In addition to using the mortgage calculator you might want to familiarize yourself with some common tax related definitions.<br /><br /></span><dl><dt><span class="C"><b>Federal tax rate:<br /><br /></b></span></dt><dd><span class="C">The marginal federal tax rate you expect to pay.</span></dd><dt><br /></dt><dt><span class="C"><b>Interest rate<br /><br /></b></span></dt><dd><span class="C">Annual interest rate for this mortgage.</span></dd></dl><span class="C"><b>Interest rate after taxes</b></span><dl><dd><span class="C".</span></dd></dl><span class="C"><b>Mortgage amount</b></span><dl><dd><span class="C".</span></dd></dl><span class="C"><b>State tax rate:</b></span><dl><dd><span class="C">The marginal state tax rate you expect to pay.</span></dd><dt><br /></dt></dl>Click <a href="">here </a>for more tax related definitions.Maureen Cool Christmas & Happy New Year!<p> </p><br /><p align="center"><span style="font-family:Times New Roman;font-size:130%;color:#ff0000;">WISHING YOU AND YOUR FAMILIES A<br />HAPPY AND HEALTHY HOLIDAY SEASON.</span></p><p align="center"><span style="font-family:Times New Roman;font-size:180%;color:#ff0000;"><strong>MERRY CHRISTMAS!</strong></span></p><br /><p> </p>\<br /><p align="center"><embed src="" width="425" height="355" type="application/x-shockwave-flash" wmode="transparent"></embed></p>Maureen Cool County Florida - A "Cool" Place to Live<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="" alt="" id="BLOGGER_PHOTO_ID_5155405112674857634" border="0" /></a><br />As Highlands County's "Coolest Realtor" I'd like to share with you why I love Highlands County and why it's the coolest place to live. Well, we have some of the <span style="font-weight: bold;" class="header">coolest</span><span style="font-weight: bold;"> </span>communities --- Avon Park, Sebring, and Lake Placid, where the <span style="font-weight: bold;" class="header">coolest</span><span style="font-weight: bold;"> </span>of <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>people live. The lifestyle is fun, friendly, <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>and causal. In Highlands County, a morning of golf makes for a perfect afternoon and getting dressed for "The Club" translates to socks optional! <p class="main">We have an affordable cost of living and no state income tax. The median price of a home is $195,000, <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>(or should I say warm) place to live for less than $81,000. Now that's what I call soooo<span style="font-weight: bold;">...</span><span style="font-weight: bold;" class="header">COOL</span><span style="font-weight: bold;">!</span></p> <p class="main">If you have really <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span <span class="header">cool</span> people say shuffling), or antiquing you can find it all here in Highlands County!</p> <p class="main">Highlands County is a <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>place to raise a family. We have a low crime rate, wholesome living, and good schools with dedicated teachers. <span style="font-weight: bold;" class="header">Cool</span><span style="font-weight: bold;"> </span>kids love Highlands County. We have really great sports programs from baseball, soccer, football to just about all <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>organized sports. The Children's Museum of the Highlands is very <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>for kids, moms, dads and grandparents. But most of all, our great outdoors is the <span class="header">coolest</span> playground of all. </p> <p class="main">Just click on the <a href="">Cool Favorite Links</a>. I have put together some of my favorite <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>web sites which have more information about the <span style="font-weight: bold;" class="header">coolest</span><span style="font-weight: bold;"> </span>of <span style="font-weight: bold;" class="header">cool</span><span style="font-weight: bold;"> </span>things to do in Highlands County!</p> <p class="main">Oops ..... I forgot to mention, Highlands County also has a really <span style="font-weight: bold;" class="header">Cool</span><span style="font-weight: bold;"> </span>County Administrator, my husband, Carl Cool. </p>Maureen Cool? - Top 10 Packing Tips<p>When you decide to make a move to a new home there are a number of things to take care of including the dreaded packing. Not many people enjoy this process, but it can be a lot less stressful if you are organized and make a plan.<br /><br />Here are a few tips to get you started.</p><ol><li>Plan ahead and budget for the move. Will you be moving yourself or will you require the assistance of a moving company? If you are planning to use a moving company it�??s a good idea to price this out ahead of time.<br /></li><br /><li>Make sure you have plenty of the following: strong packing boxes (more than you think you will need), markers and tags to label boxes, rolls of packing tape, bubble wrap for fragile items, packing paper, scissors and a knife for opening boxes.<br /></li><br /><li>Pack room-to-room keeping similar items together.<br /></li><br /><li>Use smaller boxes for heavier items so it is easier to lift.<br /></li><br /><li>You can use towels, linens and curtains to line the bottom and sides of boxes with fragile items. All fragile items should be individually wrapped. Clearly mark these boxes FRAGILE.<br /></li><br /><li>Make sure that any opened boxes or jars are tightly sealed before packing them.<br /></li><br /><li>Use colorful tags to identify the contents of the box and which room it will be taken to in your new home.<br /></li><br /><li>Pack any rugs last so that they will be the first thing unpacked and placed in the home.<br /></li><br /><li>Make a master list of all household items and personal belongings.<br /></li><br /><li>Finally pack a box with all the essentials and mark it �??Open Me First�??. This box may contain items such as: a few basic tools (flashlight, pocket knife, masking tape, light bulbs), bathroom essentials (toilet paper, soap, shampoo, toothbrushes & paste, hand towel), Kitchen items (paper towels, coffee maker & filter, paper plates, cups, utensils, pet food, trash bags). </li></ol><p>Planning ahead will make all the difference to an overwhelming move. Do your research and make a pla</p>Maureen Cool Your Home During the Holiday Season<a href=""><img id="BLOGGER_PHOTO_ID_5139806632588626098" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a><br /><p>Are you trying to sell your home during the holiday season or will you take it off the market until after the New Year?<br /><br />Some people will argue that leaving it on the market over the holidays is a perfect way to weed out the �??<span class="blsp-spelling-error" id="SPELLING_ERROR_0">looky</span>-loos�?? from the more serious buyers. Others think that leaving your home on the market during the holiday�??s make you appear desperate to sell.<br /><br /.<br /><br />As most of us like to decorate our homes with lights, Christmas trees, and holiday scents during the Christmas season, this <span class="blsp-spelling-error" id="SPELLING_ERROR_1">doesn</span>�??t always work well with properly staging your home for potential buyers. Keep the following in mind:</p><br /><ul><br /><li>Curb appeal is still important. Try not to �??over decorate�?? your front yard. A few lights on the house should be sufficient. You want your front yard to be inviting, not clutter</li><br /><br /><li>Interior decorations should be kept to minimum. You don�??t want to take away from the many features of the home, by covering them up with decorations.</li><br /><br /><li.</li><br /><br /><li>Wrapped present should not be left out. Keep them stored away so as not to add any additional clutter to the room.</li><br /><br /><li.</li></ul><br /><p></p><br /><p>If you would like more information regarding selling your home during the holidays, please do not hesitate to <a href="">contact me</a>.</p>Maureen Cool Off ForeclosureIt is no secret that foreclosures have increased drastically this year as a result of the <span class="blsp-spelling-error" id="SPELLING_ERROR_0">subprime</span> lending disaster and a lot of people are wondering if they will be next. For many homeowners there may be options, if they know what to look for and where to look.<br /><br />In the event that you find yourself struggling to make your mortgage payments, and you fear foreclosure may be in your future, the National Foundation for Credit Counselling (<span class="blsp-spelling-error" id="SPELLING_ERROR_1">NFCC</span>) has suggested a few possible alternatives. These options to fend off foreclosure include:<br /><br /><ul><li>Repayment Plan</li><li>Reinstatement</li><li><span class="blsp-spelling-corrected" id="SPELLING_ERROR_2">Forbearance</span></li><li>Loan Modification</li></ul><p>The Federal Trade Commission wants people to know that these alternatives may not work for everyone especially if you are already three or four mortgage payments behind.</p><p>For more information regarding the above alternatives visit the <span class="blsp-spelling-error" id="SPELLING_ERROR_3">NFCC's</span> <a href="">Homeowners Crisis Resource Centre </a>website. They can also assist you in locating a certified housing counsellor to explore your options in an effort to fend off foreclosure.</p><p></p>Maureen Cool Thanksgiving Highlands County Florida<div align="center"><strong>WISHING YOU AND YOUR FAMILIES A SAFE</strong></div><div align="center"><strong>AND HAPPY THANKSGIVING.</strong></div><div align="center"><strong></strong></div><div align="center"><strong></strong></div><div align="center"><strong></strong></div><div align="center"><strong></strong></div><p></p><p><img id="BLOGGER_PHOTO_ID_5135349928062273058" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="" border="0" /></p><p align="center"><strong></strong></p><p align="center"><strong>We give thanks for unknown blessings already on their way. ~Author Unknown</strong><br /></p><div align="center"></div>Maureen Cool Ridge, Florida - Adult Community Living At Its Best<a href=""><img id="BLOGGER_PHOTO_ID_5130339353412607986" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a>At Highlands Ridge, it's all about the lifestyle. Nestled beside a nature conservancy and 260 acre lake stocked with fish, Highlands Ridge is the Florida you've dreamed of.<br /><div><br />Highlands Ridge residents come from across the country and around the world to experience the perfect combination of privacy and accessibility; city convenience and rural charm.</div><div><br /. </div><div><br />If you are looking for additional amenities consider the fitness center, pools, Founder's Hall, HH Resident Clubs, Library and Lake Bonnet. Highlands Ridge offers something for everyone. </div><br /><div>Allow me to introduce you to this wonderful community as your representative to assist you through the buying process. <a href="">Contact me </a>today.</div>Maureen Cool County Florida - A Place to Call Home<a href=""><img id="BLOGGER_PHOTO_ID_5127733470143990194" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a>You might be asking yourself, "why Highlands County" when Florida has so many great places to live? One reason is our communities are small towns and cities where people greet you and treat you like family. Avon Park is the city of charm with its mile long mall. <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Sebring</span>, located on Lake Jackson is the city on the circle, and Lake Placid is the <span class="blsp-spelling-error" id="SPELLING_ERROR_1">caladium</span> capital of the world. All our communities are unique in their own special way. Our life style is fun, friendly and casual. In Highlands County a morning of golf makes for a perfect afternoon and getting ready for the "The Club" translates to socks optional!<br /><div><br />Highlands County has an affordable cost of living and no state income tax. We are within a two-hour drive of either coast, major metropolitan areas, two international airports, Disney World and the rest of the other major Florida attractions. We have luxury homes in beautiful golfing communities, to a cozy cabin on a pristine lake, or a quiet place in the country. </div><br /><div><br />Highlands County has a lot to offer. Whether it is bass fishing on one of our 88 crystal clear lakes, or playing golf on one of a dozen or more championship golf courses, playing tennis, birdwatching, biking, <span class="blsp-spelling-error" id="SPELLING_ERROR_2">canoeing</span>, playing shuffle board or antiquing in quaint shops, you can find it all here in Highlands County. </div><br /><div><br />Highlands County is not only a great place to retire. It�??s a great place to raise a family. We have a low crime rate, wholesome living, and good schools with dedicated teachers. Kids love Highlands County. We have really great sports programs through the YMCA from baseball, soccer, football to just about all organized sports. The Children�??s Museum of the Highlands is very cool for kids, moms, dads, and grandparents. But, most of all our great outdoors is the best playground of all. </div><div></div><div></div><div><br />For more information about <span class="blsp-spelling-error" id="SPELLING_ERROR_3">Sebring</span>, Avon Park and Lake Placid communities visit <a href="">Maureen Cool - Highlands County Coolest Realtor.</a></div><br /><div></div>Maureen Cool Inspections Part II - What Does The Home Inspector Look For?<a href=""><img id="BLOGGER_PHOTO_ID_5122517562911794386" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a><br /><div>In this second installment of Home Inspections you will learn of the types of things your Home Inspector will look for when preparing your home inspection report. Your Home Inspector will perform a �??visual�?? inspection to determine the condition of your home. To better understand what may be included in your report the Home Inspector will look at the following areas of your home.<br /><br /><br /><ul><br /><li>Foundation and Framing</li><br /><li>Roofing and Flashing</li><br /><li>Gutters and Drainage</li><br /><li>Siding</li><br /><li>Decks and/or Porches</li><br /><li>Driveways and Sidewalks</li><br /><li>Doors and Windows</li><br /><li>Stairs and Railings</li><br /><li>Ceilings and Walls</li><br /><li>Electrical</li><br /><li>Plumbing</li><br /><li>Heating and A/C</li><br /><li>Ventilation</li><br /><li>Attics</li><br /><li>Basement</li><br /><li>Garage</li></ul><br /><p>Don't forget to check out <a href="">Home Inspections Part I</a> to learn how to interview a potential Home Inspector.</p></div>Maureen Cool Not Call Registry - You're Number May Expire SoonMost of us are, or have been, extremely frustrated at some point with unwanted calls made by telemarketers. One way to help prevent telemarketers from calling was the creation of the Do Not Call Registry back in 2003. Individuals can register their phone numbers with the registry in hopes to eliminate these unsolicited calls to our homes and businesses.<br /><a href=""><img id="BLOGGER_PHOTO_ID_5121420005494138050" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a><br />There were a staggering number of registrants within the first four days of the lists launch date and continued to grow to 149 million phone numbers currently.<br /><br />The important thing to remember is there is a term to your registration. Your registration with the Do Not Call Registry is only good for five years at which time your phone number will be removed from the list unless you renew by your renewal date. As the five year anniversary of the list is coming up in the summer of 2008, you early registrants will have to think about renewing. You can check the status of your registration by visiting the DoNotCall.gov website.<br /><br />Read the full MSN Money Central article titled <a href="" _fcksavedurl="">Do Not Call list about to expire</a>.Maureen Cool Questions to Ask a Potential Home Inspector<a href=""><img id="BLOGGER_PHOTO_ID_5117319797785142450" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a><br /><p>Home inspections are a necessary part of both the home selling and buying process. It is important to be sure that when hiring a home inspector that you are sure to hire a qualified individual or company. Below is a list of things to keep in mind to ask your potential inspector.</p><ol><br /><li>What are your qualifications?<br /></li><li>How many home inspections do you perform in a year that is similar to my home?<br /></li><li>Can you provide a list of references that we can contact?<br /></li><li>What is your turnaround time to receive the report?<br /></li><li>What will be included in the report?<br /></li><li>How much will the report cost?<br /></li></ol><p>For an easy, quick search of certified Home Inspectors in your area you can visit <a href="" _fcksavedurl="">The American Society of Home Inspectors</a> or the <a href="" _fcksavedurl="">National Association of Certified Home Inspectors</a>. </p><br /><p></p>Maureen Cool Six Items to Take With You to Your Mortgage Lender<a href=""><img id="BLOGGER_PHOTO_ID_5113852840054269090" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a>Applying for a mortgage can be a daunting task, but if you are prepared it will be less stressful and help your lender move things along smoothly. Below is a list of items that your lender will need in order to process your loan application. Having these things ready and with you during your meeting will not only save time, you will be more informed about your finances.<br /><ul type="disc">;">Employment information<br /><br /></span></strong><span style="font-family:Verdana;">Include current contact information for all your employers in the last 2 years </li><?xml:namespace prefix = o /><o:p></o:p></span><br />;">W-2s.</span></strong><span style="font-family:Verdana;"><br /><br />These forms should have been given to you from your employer.<br /><br />Include W-2s the last two years filed<br /><br />You may also want to make a list of any additional sources of income such as self-employment income, pension�??s, rental income, child support or alimony or social <span style="mso-tab-count: 1"><span class="blsp-spelling-error" id="SPELLING_ERROR_0">se</span></span><span class="blsp-spelling-error" id="SPELLING_ERROR_1">curity</span>.;">Pay stubs.</span></strong><span style="font-family:Verdana;"><br /><br />Include pay stubs received in the last 30 days.;">Federal income tax returns.</span></strong><span style="font-family:Verdana;"><br /><br />Include tax returns filed in the last 2;">Bank statements.</span></strong><span style="font-family:Verdana;"><br /><br />Bank statements for any/all your accounts for the last 2 months<br /><br />Providing these statements will verify that amount of cash available for your down payment<br /><br />In the event that a portion of your down payment is a gift, grant or assistance program,<span style="mso-tab-count: 1"> </span>you may need to provide documentation to verify this as"><strong><span style="font-family:Verdana;color:#333333;">Current debts.</span></strong><span style="font-family:Verdana;color:#333333;"><br /><br />Make a list of any/all debts you have with company names, account numbers, balances<span style="mso-tab-count: 1"> </span>and minimum monthly payments</span> </li><br /></ul><br /><br /><p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in left 45.0pt">Your lender may have already given you a list of items required and if not use this as a guideline. Most institutions will require similar documentation, but check with your lender first as they made need additional information from you.</p>Maureen Cool Showing Tips - How to Make a Good First Impression<a href=""><img id="BLOGGER_PHOTO_ID_5108425703980966882" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a><br /><div>You only have one chance to make a first impression with potential buyers so it is important that your home is in tip top shape and ready for showing. </div><br /><div></div><br /><div></div><div></div><div><strong></strong></div><div><strong></strong></div><div><br /><br /><strong>Follow these few tips to help your agent.<br /></strong><br />1. Tidy Your Home<br /><br />2. Unclutter cupboards and closets<br /><br />3. Make any minor repairs<br /><br />4. Cut lawn in the summer and shovel walks in the winter<br /><br />5. Put away all valuables<br /><br />6. Lock up pets or take them with you<br /><br />7. Open all drapes and blinds<br /><br />8. Make beds<br /><br />9. Turn on all the lights<br /><br />10. Leave the house<br /><br />Helping your agent with these few things will help in creating a great first impression for each prospective buyer. </div>Maureen Cool Tips To Sell Your Home Quickly in A Slow Market<a href=""><img id="BLOGGER_PHOTO_ID_5105079260444180866" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="" border="0" /></a>In a time when real estate has slowed down and the future of the market is uncertain, it is critical to be able to sell your home as quickly as possible, for the best possible price. Peter G. Miller, Columnist for <a href="" target="_blank" _fcksavedurl="">Realty Times</a> has outlined 10 negotiating steps to follow in order to increase your chances of a quick sale for the best price.<br /><p>These steps include the following:</p><p><strong>Step 1:</strong> Get a local broker.<br /><br /><strong>Step 2:</strong> Read the sale agreement.<br /><br /><strong>Step 3:</strong> Know the marketplace.<br /><br /><strong>Step 4:</strong> Know your terms.<br /><br /><strong>Step 5:</strong> Reduce deposit requirements<br /><br /><strong>Step 6:</strong> Throw in stuff.<br /><br /><strong>Step 7:</strong> Update MLS photos.<br /><br /><strong>Step 8:</strong> Review the marketing plan.<br /><br /><strong>Step 9:</strong> Visit open houses.<br /><br /><strong>Step 10:</strong> Have context. </p><p><br />For more information and detailed descriptions of each step read Peter G. Miller's full article, <a href="" target="_blank" _fcksavedurl="">10 Steps To Sell More Quickly In Stalled Markets</a>.</p>Maureen Cool County - Back to School<a href=""><img id="BLOGGER_PHOTO_ID_5100654473466691954" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a>It's back to school time and kids and parents are busy trying to get organized to start the school year prepared. Kids are typically concerned with buying the right outfit while parents concentrate on making sure their kids have the proper supplies for their classes.<br /><div><br />Check your local school website for a school supplies checklist. If your school doesn't offer this list online, below is a basic list, as provided by <a href="" _fcksavedurl="">GreatSchools.com</a>, to help you get started.</div><p><strong>Elementary School</strong><br /></p><ul><li>Glue sticks</li><li>Scissors</li><li>Ballpoint pens</li><li>No. 2 pencils</li><li>Colored pencils</li><li>Pencil sharpener</li><li>Large pink eraser</li><li>Box of crayons</li><li>Drawing paper</li><li>Construction paper</li><li>A ruler with English and metric measurements</li><li>School box</li><li>Kleenex</li><li>Small bottle of hand sanitizer</li><li>A <a href="" _fcksavedurl="">backpack</a> (Check out <a href="" _fcksavedurl="">GreatSchools.com</a> article, <a href="" _fcksavedurl="">Tips for Buying a Backpack and Carrying Safely</a>, about choosing the right backpack)<br /></li></ul><p><strong>Middle-School and High-School</strong></p><p>In addition to the basic school supply items, children in middle and high school may be required to purchase the following:</p><ul><br /><li>A calendar for time-management and for scheduling assignments</li><li>2 combination locks</li><li>Binder dividers</li><li>Several 3-ring binders</li><li>Folders to fit into binders</li><li>A small notebook to record assignments</li><li>Pencil case to fit into binder</li><li>Pens</li><li>Index cards, ruled and unruled</li><li>Calculator (Check with your teacher first for type and model)</li></ul><p>Don�??t forget to visit <a href="" _fcksavedurl="">GreatSchools.com</a> for a more complete list. Happy shopping and have a great school year.</p>Maureen Cool You Killing Your Credit Score?<a href=""><img id="BLOGGER_PHOTO_ID_5100651385385206114" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 147px; CURSOR: hand; HEIGHT: 134px" height="194" alt="" src="" width="265" border="0" /></a>When buying a home, an important factor in this process is your credit score. It is important to familiarize yourself with your credit report and the role you play in your final <span class="blsp-spelling-error" id="SPELLING_ERROR_0">FICO</span> score .<br /><br />Your <span class="blsp-spelling-error" id="SPELLING_ERROR_1">FICO</span> score is one factor that lenders consider when they are <span class="blsp-spelling-corrected" id="SPELLING_ERROR_2">trying</span> to determine if they should lend you the money, charge you more, or flat out reject your request for financing.<br /><br />Don't defeat yourself before you get started. <a href=""><span class="blsp-spelling-error" id="SPELLING_ERROR_3">CNNMoney</span>.com </a>put out an article, <a href="" _fcksavedurl="">6 ways to kill your credit score</a>, that provides some useful information and insight into how we may be sabotaging our own credit.<br /><br />Stay on top of your credit score and review your credit report regularly. This will limit the potential for errors that can also negatively affect your <span class="blsp-spelling-error" id="SPELLING_ERROR_4">FICO</span> score.Maureen Cool With Children<a href=""><img id="BLOGGER_PHOTO_ID_5095720946552840322" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a>Moving can be extremely stressful especially if you have children. Don't forget that it can be just as challenging for your kids as it is for you.<br /><br />They may be moving from the only home they have ever known and leaving close friends and their school behind.<br /><br /><br /><br />It is important to be aware of the things that may be a concern to your children when making a move. These things could include the following:<br /><br /><ul><li>Preschool children tend to worry about being left behind or separated from their parents.</li><br /><li>Kids aged 6 to 12 can be concerned with how their daily routines will be affected. </li><br /><li>Teenagers are concerned primarily with fitting in and having their social life disrupted.<br /></li></ul><p>Methods of easing some these concerns include:</p><ul><li>Communicate with your child about what the new house will be like. </li><br /><br /><li>Take them on a visit of the new home and neighborhood (if possible)</li><br /><br /><li>If you can, visit the school with your child and meet some of the teachers.</li></ul>Involving your children in the move can help make the transition easier. Your kids can be a great help to you and the move if you <span class="blsp-spelling-error" id="SPELLING_ERROR_0">involve</span> them such things as:<br /><br /><ul><li>Packing some of their own special belongings, and decorate the box with stickers and markers.</li><br /><li>Make plans together on how to decorate their new room.</li></ul>Leaving friends behind may be one of the harder things your child has to do. Throw a going away party with their friends and take lots of pictures to make a nice scrapbook for them to look back on. Give them a stationary set or <span class="blsp-spelling-error" id="SPELLING_ERROR_1">pre</span>-stamped cards so they can stay in touch with friends, too.<br /><br />There are dozens of things to consider and take care of during a move and by involving your children you just may relieve the stress your children are feeling, reduce your own stress and be able to focus more on other aspects of your move!<br /><br />For more moving tips visit my <a href="">Moving Strategies </a>page.Maureen Cool County Florida - The Best of Both WorldsLocated in the heart of <a href="">Florida</a> lies <a href="">Highlands County</a>. With communities such as <a href="">Sebring</a>, <a href="">Avon Park </a>and <a href="">Lake Placid </a>it is no wonder why we are called Sunshine State.<br /><br />Whether you're visiting, currently living or even considering a move to our wonderful <a href="">county </a>you'll want to take advantage of all that <a href="">Highlands County </a>has to offer. Such as the crystal clear <a href="" target="_blank">lakes</a> for <a href="">fishing</a>, <a href="">boating</a>, skiing and sailing, and more than a dozen <a href="">golf courses</a>. Our gently rolling hills, orange groves and charming small towns make this a <a href="">relaxing country getaway </a>- and our central location provides easy access to <a href="">Florida's best attractions</a>. Highlands County offers you the best of both worlds - within two hours of most major attractions yet removed enough for that get-away-from-it-all feeling.<br /><br /><p align="center"><a href=""><img id="BLOGGER_PHOTO_ID_5086791186305510306" style="CURSOR: hand" alt="" src="" border="0" /></a></p><p align="center"><em>Come discover Highlands County for yourself! </em></p><div align="center"></div>Maureen Cool 4th of July!<div align="center"><a href=""><img id="BLOGGER_PHOTO_ID_5083515965587223842" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a> <span style="font-size:180%;color:#000066;">WISHING YOU AND YOUR FAMILY A HAPPY 4TH OF JULY!<br /></span><br /></div><div align="center"><span style="font-size:180%;color:#000066;"></span></div><div align="center"><span style="color:#000000;">I hope you have a happy and safe holiday with your friends and families and remember...</span></div><br /><br /><div align="center">"Only our individual faith in freedom can keep us free�??</div><br /><br /><div align="right">Dwight David Eisenhower</div>Maureen Cool Your Home Need Some Sprucing Up? Four Easy Home Improvements<a href=""><img id="BLOGGER_PHOTO_ID_5079846447431824626" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="" border="0" /></a><br />Many of us are aware that our homes need a little work done before we list it, but not everyone can afford a total remodel. Marshall <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Loeb</span> of <span class="blsp-spelling-error" id="SPELLING_ERROR_1">Marketwatch</span> has listed four easy home improvements that won't break the bank.<br /><br /><ol><li>Touch up your homes exterior</li><br /><br /><li>Replace your floors </li><br /><br /><li>Update your hardware</li><br /><br /><li>Transform your yard.</li></ol><p><br />Read the full article at the <a href="">Real Estate Journal</a>.</p>Maureen Cool Father's Day!<div align="center"><span style="font-size:180%;"><em><span style="font-family:georgia;color:#000066;">HAPPY FATHER'S DAY!</span></em> </span></div><br /><div align="center"><span style="font-size:180%;"></span></div><div align="center"><img id="BLOGGER_PHOTO_ID_5076415279663428738" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="" border="0" /> <p align="left">I don't care how poor a man is; if he has family, he's rich.</p><p align="right">~M*A*S*H, Colonel Potter</p><div align="right"></div><div align="left">Wishing you and your families and Happy Father's Day. If you are having trouble deciding what to get your dad for Father's Day, below are a few ideas that might help out and it doesn't necessarily have to be a "gift".</div><div align="left"></div><ul><li><div align="left">Spending time with the family</div></li><br /><li><div align="left">Afternoon at the park for a picnic and sports</div></li><br /><li><div align="left">A heartfelt email</div></li><br /><li><div align="left">Handmade and handwritten card</div></li><br /><li><div align="left">Print digital photos and create a "dad" poster</div></li></ul><p align="left">Have a fabulous Father's Day!</p></div>Maureen Cool
|
http://feeds.feedburner.com/HighlandsCountyRealEstateUpdate
|
crawl-002
|
refinedweb
| 7,355
| 53.21
|
I've implemented the GanttCustomProvider to give me more properties on the task - using a project supplied by a kind persons at Telerik, think it was Peter Milchev .
However the GetTasks function in the GanttCustomProvider.vb needs to take into account filters specified by a RadComboBox on the calling page however I don't seem to be able to get to that control.
Regards
Steve
4 Answers, 1 is accepted
Hello Steve,
One easy approach to achieve this would be to pass the page as a parameter to the constructor. To do that, you would need to modify the constructor of the provider and make it accept and save the page reference.
If you need only to access a single combobox, you can make the constructor accept a RadComboBox instance:
public class GanttCustomProvider : GanttProviderBase { public RadComboBox FilterComboBox { get; set; } public GanttCustomProvider(RadComboBox filterCombo) : base() { this.FilterComboBox = filterCombo; } public override List<ITask> GetTasks() { foreach (var item in AllTasks) { item.Title += this.FilterComboBox.Text; } return AllTasks; }
And then you can change the provider creation as shown below:
RadGantt1.Provider = new GanttCustomProvider(RadComboBox1); Peter
The radcombo now passes from the page and I can access it in the GetTasks function .. progress there.
However I want to access it in the AllTasks function so I can filter the records returned from the database before building the sessionTasks List.
VB won't let meuse Me.filterCombo it errors with Me' is valid only within an instance method.
Hello Steve,
The solution you have is a possible approach, yes.
The main reason you would need that is because the AllTasks is a static method so you would need to have a static reference instead of an instance one:
Another approach that I would suggest is not using the static AllTasks method at all. In general, the GetTasks() method of the provider is the one where you need to get the data, hence this is the place where you would query the data base with your filters.
The static method in this example you probably used as a base is only for demo purposes, so you can easily remove the static AllTasks method and implement your logic inside the GetTasks() instance method where you would be able to access the RadComboBox with the code from my previous reply.
-
Regards,
Peter Milchev
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
|
https://www.telerik.com/forums/accessing-page-radcombobox-from-gantt-custom-provider
|
CC-MAIN-2021-49
|
refinedweb
| 420
| 57
|
Loops
How can I loop my commands over and over again
Using
foror
while
If you mean something really different than that, please let us know!
forloops are used to go over items stored in a list and repeat a piece of code for each item. For example, this code:
mylist = ["hello", "there", "how", "are", "you"] for message in mylist: print message
creates a list named
mylistthat contains a few strings, then it goes over the list and prints out every item.
whileloops are a little different. They work like an
ifblock that repeats over and over until the condition is false. For example, this code:
import random response = "" while response != "exit": print "Your random number is:", random.randint(0, 10) response = raw_input()
prints out a new random number every time you press Enter, until you type
exit.
(By the way, I'm assuming that you're using Python 2. If you're using Python 3, the code won't work like this.)
|
https://forum.omz-software.com/topic/3258/loops/2
|
CC-MAIN-2021-04
|
refinedweb
| 163
| 80.92
|
P4D Langlet 1.2.4
E4X style embedded DSL for Python but without E and X
P4D is not Python but it is also fun
P4D ( = Python for Data ) is an EasyExtend langlet used to write tree shaped textual data a.k.a XML.
P4D elements are written as statements in a notation being familiar for Python programmers. They closely resemble Python statements. Here is one used to define an element
elm philosophers: philosopher: name: "Hegel" books: book( first_edition = 1807): title: "Phänomenologie des Geistes" language: "german" philosopher: name: "Leibniz" books: book( first_edition = 1714): title: "Monadologie" language: "french"
The elm keyword is new and it is one of the few occasions where P4D breaks actual Python code. However I did not found elm being used in Pythons stdlib so it might break just none.
The subobjects of philosophers can be accessed in E4X style
books = philosophers.philosopher.(name == "Hegel").books books.book.(@first_edition < 1810).title.text() # -> "Phänomenologie des Geistes"
P4D can also be used as a template language in the sense that Python expressions can be embedded in P4D elements
L = [1,2,3] elm A: B: &L elm X: & A
The elements of the list object L will be distributed over elements of type B
assert len(A.B) == 3 assert X.A.B[0].text() == '1'
It is easy to convert a P4D element into an XML element using the xmlstr() method. Otherwise one can convert XML to P4D using P4D.from_xml(). This is so easy because internally the same datastructure is used. Building a P4D element and parsing an XML document leads to the same internal representation. This internal representation can be used to store even more distinct objects having quite different properties and are not even textual but binary.
Bytelets
Other than XML and the P4D elements we've seen above Bytelets are used to deal with binary data in a flexible manner.
Suppose you want to serialize a string and don't want to use null-termination. Then you have to send the length of the string together with the string and the type or tag for the receiver to identify the hexcode as a string
elm bl:text: Tag: 0x50 Len: &LEN Text: "{obamania}"
This P4D element produces a Bytelet. Bytelets are generally prefixed using the bl namespace prefix. The LEN object is a so called Flow object. It is kind of a dataflow binding. If you bind LEN to a field it computes the sum of the lengths of all values of subsequent fields. If you update the Bytelet the value of the `` Len`` field will be re-computed using LEN.
One can check this out
assert text.Len.hex() == 8
Here 8 is just the length of the text.
new_text = text.clone() new_text.Text = "{the merkel}" assert new_text.Len.hex() == 10
One can fully evaluate the text Bytelet
assert text.hex() == 0x50 0x08 0x6F 0x62 0x61 0x6D 0x61 0x6E 0x69 0x61
Notice that writing 0x50 0x08 0x6F ... `` without quotes is valid in P4D and it yields a ``Hex object not a number. So P4D supports enhanced hexadecimal literals which obtain a different semantics than Pythons.
Now we want to turn the Hex object back into a Bytelet for which it has to be parsed. This is done by a Schema
elm bl-schema:TextSchema: Tag: 1 Len: &LEN Text: &VAL parsed = TextSchema.parse(text.hex()) assert parsed.hex() == text.hex()
A Schema is characterized by the namespace prefix bl-schema. Otherwise it is just another Bytelet with a parse() method. Here the Schema has the exact same structure than the original Bytelet but different field values. The new value VAL is also a dataflow binding. It binds to the Len field. After the value 0x08 is assigned to Len while parsing the VAL binding uses this value to chop of 8 bytes from the input stream and assign it to Text.
More features of Bytelets:
- Specifications of Bytelets can be refined by setting individual bits and specifying bit array widths.
- Schemas can be used to parse arbitrary sequences of T(ag)L(ength)V(alue) structures like the one in our example. However the order of the TLVs need not be fixed.
- Simple arithmetics is defined for Flow objects like LEN and VAL. So we can write Len : &LEN + 1 but also Text: &VAL - VAL["IHL"]*4 where VAL["IHL"] refers not to Len but another field IHL.
For more information look at the P4D documents
- Author: Kay Schluehr
- Download URL:
- License: BSD
- Platform: Python
- Package Index Owner: schluehk
- DOAP record: P4D Langlet-1.2.4.xml
|
http://pypi.python.org/pypi/P4D%20Langlet/1.2.4
|
crawl-003
|
refinedweb
| 764
| 71.95
|
Gallery App, TurboModules, and more community modules
React Native 0.64 is out! Which means it's time to showcase all the work we've put in around supporting more community modules, TurboModules, APIs improvements, and even some tools, all in the effort to improve the developer experience.
There's been a lot of work on improving the developer experience, as that's been a focus for us as a whole across all our frameworks and platforms, and React Native for Windows is no exception! Through tooling, dogfooding our own work, and "under the hood" improvements, we're looking forward to sharing with you some of the highlights in this release that we're especially proud to announce.
📣 React Native Gallery App📣 React Native Gallery App
As part of our growing effort to improve the APIs, developer experience, and end-to-end story of developing React Native apps for Windows, we've decided to build and ship our own app, called the React Native Gallery.
The app's main purpose is to showcase all the current functionality available in React Native for Windows, while also being a way for us to test cross-platform community modules and keep ourselves honest about the process of pushing an app to the Windows Store.
Much like the XAML Controls Gallery for WinUI, we intend to have the React Native Gallery be available not only as a proving ground for our own work, but also a place where native and JavaScript components alike can be seen in action in the Windows ecosystem. This includes providing lightweight code snippets on each page for developers to copy out and use in their own scenarios.
🧪 Try it out now!🧪 Try it out now!
You can install the app today! Get React Native Gallery from the Microsoft Store.
Alternately, you can get the latest state of the app and the source to test things out directly on our main repo branch.
✨ Developer Goodness✨ Developer Goodness
As with many of our releases, there's always a number of developer and "under the covers" upgrades we make to the framework as a whole. These usually includes things like performance improvements, better API parity and of course general bug fixes, but let's take a look at some of the notable items available this release.
🎯 Easy opt-in to Hermes🎯 Easy opt-in to Hermes
Performance is a huge deal when developing in general, but especially so when it comes to using React Native.
We're very invested in using Hermes and while there are teams using it in production, support is still experimental and we do not have the full Hermes debugger or Hermes in C# capabilities online yet. We would still love to know if you try Hermes and run into any issues, so go ahead and give it a try today!
To get starting using Hermes in a new project, pass the
--useHermes flag when running the first
react-native-windows-init command. Here are the full, first setup commands:
npx react-native init <projectName> --template react-native@^0.64.0
cd <projectName>
npx react-native-windows-init --overwrite --useHermes
npx react-native run-windows
Have a pre-existing project you'd like to add Hermes to? You can still enable it, but will need to take a few extra steps to do it, but luckily, we've got you covered for that too.
🎉 API parity highlights🎉 API parity highlights
More component properties supported by the other platforms now work on Windows! Check them out.
⚙
Platform.version
The
Platform API's
version functionality has now been extended to include detection for the release version you'd like to target.
import { Platform } from 'react-native'; if (Platform.Version >= 4) { // We can use an API from UniversalApiContract 4 } else { // Fallback }
Not sure exactly which version you need? Check out our documentation around SDK extensions on Windows.
Learn more about the
Platform API through our documentation.
⚙ More
Text properties
The
Text component properties
backgroundColor,
border, and
textTransform are now available on Windows and apply to our native text controls as you'd expect.
- backgroundColor will set the backfill/plate color behind your text.
- border encompasses all the border functionalities, like borderWidth, borderColor, etc.
- textTransform can force all strings lowercase, uppercase, or capitalization depending.
import React from "react"; import { Text, StyleSheet } from "react-native"; const TextTest = () => { return ( <Text style={styles.newTextProperties}> some text goes here </Text> ); }; const styles = StyleSheet.create({ newTextProperties: { color: "white", backgroundColor: "blue", borderColor: "black", borderWidth: 1, textTransform: "capitalize" } }); export default TextTest;
⚙
AccessibilityInfo
We've begun improving the JavaScript and native control accessibility experiences by hooking up some initial behavior for these scenarios.
- isReduceMotionEnabled returns true or false depending on whether the user of the device has specified they need less motion sensitivity - full implementation.
- announceForAccessibility tires to find an element on the current screen to raise the event from - partial implementation.
- isTouchExplorationEnabled will return a boolean indicating whether or now the user has a screen narrator or similar running. This feature needs more testing, but is available in an alpha state for you to use - partial implementation.
🎇 Expanded documentation🎇 Expanded documentation
We've added a lot to our documentation too, both within the Native APIs and on other important developer topics like virtual machines and picking C or C++ to have your app created in.
🔧🔨 Choice between C++ or C# compiled apps🔧🔨 Choice between C++ or C# compiled apps
A big request for our documentation has been steps on how to set up an app for C++ or C# based development, and we're happy to announce that we've put together all the info necessary to get started with either.
📡 Develop for Windows on anything📡 Develop for Windows on anything
If you have either a local or Azure virtual machine set up, you can develop Windows app on a non-Windows PC.
Grab the VM of your choice from the Windows 10 development environment. Once you have that virtual environment up and running, set up that new VM set up for React Native for Windows development just as you would today and deploy your builds to it.
💻 Native Windows APIs💻 Native Windows APIs
We've even added a reference sheet so you can take a look at the native API's that are available under the
Microsoft.ReactNative namespace, like:
Curious about how to work with native code using a React Native for Windows app? We've got you covered for that too!
🚀 TurboModules🚀 TurboModules
We now have support for C++ JSI TurboModules using the same TurboModule interface that is available on Android and iOS. Since these APIs haven't been fully shipped or documented in React Native core yet, these APIs are subject to change.
This feature is still considered experimental in 0.64, because it is not finished in React Native Core.
🎁 Get the goodness🎁 Get the goodness
The best way to upgrade from 0.62 or 0.63 to this latest 0.64 release is to:
- Create a brand new blank 0.64 using
react-native-windows-init
- Copy over the content of your older versions project
Moving forward we are looking to provide a diff tool to help make this easier, this tool would operate similarly to
react-native-upgrade-helper.
To get the full list of release details, including breaking changes, check out our release notes over on our repo.
📚 Growing Windows community module support📚 Growing Windows community module support
Over the last couple of months, the team has made a concerted effort to increase the number of modules that target React Native for Windows. We know that modules are an important part of React Native ecosystem, so we are excited to share that we’ve added Windows implementations for several modules, including:
- react-native-tts
- react-native-codepush
- react-native-sketch-canvas
- react-native-pdf
- react-native-print
- react-native-device-info
- react-native-orientation-locker
- rn-fetch-blob (module unmaintained, but Windows code in PR)
- react-native-splash-screen (in PR)
- react-native-fs (in PR)
… and more are coming! You can see which modules we’re tracking on the Community Module Requests project board.
In addition to the modules that we have recently worked on, you can view and search the complete list of modules that work with Windows by visiting reactnative.directory. The directory catalogues modules that work on the major platforms including iOS, Android, Windows, and macOS and provides metrics around usage, popularity, and more.
You can also check out the react-native-gallery repo to see some of the modules “in action”. We’re using the Gallery as a testbed to verify and showcase modules that work with Windows – we’re adding new samples over time, so check back often!
🚧 A module I need doesn't work with Windows yet!🚧 A module I need doesn't work with Windows yet!
Fret not! We’re continually reassessing and reviewing the set of modules that are important to React Native for Windows devs, so if you need a module that doesn’t yet have a Windows implementation, please open a new issue on the React Native for Windows GitHub repo.
If you have experience writing Windows native code, you can also use the new Community module template workflow to create a module template for Windows. This is a great way to start using native Windows APIs quickly in custom modules.
🤝 Janea Systems🤝 Janea Systems
Finally, we wanted to highlight our partnership with Janea Systems, who has helped provide implementation, consultation, and support for many of the modules listed above. In particular, we wanted to shout out to @jaimecbernardo, @joaocgreis, and @bzoz from Janea Systems for their help over the last few months.
DeprecationsDeprecations
- 32-bit ARM is deprecated:
Some Windows IoT Core devices run 32-bit ARM processors. These devices are rare, and have not been tested with react-native-windows. We will be removing support for ARM32 in a future release. ARM64 remains supported.
Breaking changesBreaking changes
- Native module thread affinity
A bug was discovered which led to custom native modules often being invoked on the UI thread. This was unintentional and has been changed. We recognize that this may break existing modules in cases where affinity was relied upon without explicitly queuing to the UI thread. If you're affected by this or have a module that is, you can use the
UIDispatcher API to post to the UI thread.
acceptsKeyboardFocusremoved
In 0.63 we started warning on usage of
acceptsKeyboardFocus that the property would be replaced by the built-in and type-safe focusable. In 0.64 we removed support from the property, redboxing if it is passed to a view and ignoring the property on touchables.
AppThemeAPI reconciliation with Appearance
React Native 0.62 introduced Appearance and
useColorScheme hooks to respond to changes in light/dark mode. This functionality supersedes several APIs in the react-native-windows specific
AppTheme library.
AppTheme functions that warned about removal in 0.63 are removed in 0.64. See more here on how to write components that adapt to theme.
EmitJSEventparameter passing
Calls to EmitJSEvent on the ReactContext previously wrapped the event object in a JavaScript array instead of passing it 1:1. This was fixed in 0.64, but any existing consumption of events fired by EmitJSEvent must be updated.
ref.focus()focus visuals
Calling
focus() on a component ref will now show native focus visuals by default. If you don't want focus visuals around your component, you can set the property
enableFocusRing={false}.
- Synchronous native module returns
Native module methods marked as synchronous would previously have their results wrapped in an array. This is no longer the case.
|
https://microsoft.github.io/react-native-windows/blog/2021/03/16/64updates?utm_campaign=sebastien_lorber_newsletter&utm_medium=email&utm_source=Revue%20newsletter
|
CC-MAIN-2021-39
|
refinedweb
| 1,942
| 52.39
|
(This is part two of a four part series; part one is here, part three is here.)
Part Two: Machine-generated code:
You write
namespace Foo
{
public sealed class Foo
{
public string Blah(int x) { … }
}
}
namespace Foo); }
}
}
And maybe some other stuff in there like an implicit conversion to or from Foo, and so on. The exact details of the decorator aren’t important here; what’s important is that this code was generated by a machine.
// Machine-generated code:.
(This is part two of a four part series; part one is here, part three is here.)
"Next time: how to design a bad hierarchy"
I hope this will offer some insight on how to design a good hierarchy. 😉
This is so familiar. I’ve made the mistake of not fully qualifying things in a code generator that I had written for VS a few months ago. Luckily for me, the error quickly manifest itself, as we did have a type that actually hit this case.
Ironically, I actually did try to qualify all types (complete with global::) from the get go, because of bad experiences with not fully qualified names in the past, but somehow managed it to slip in just one case – and that was enough!
Moral of the story: I don’t know, really, but maybe write some tool that would verify that all type references in a .cs file are fully qualified, and run the output of any code generator through that? A special-purpose StyleCop rule, to be enabled for generated code?
Speaking of fully qualified names… in a similar situation a few years ago, I ran into a curious problem with C++ syntax (codegen there was outputting C++). Remember that C++ fully qualified types are of the form ::A::B – no "global" there. Now consider a fully qualified name of a method that is defined outside a class:
class ::C1 { … }; // okay
class ::C2 { ::C1 M(); }; // okay
::C1 ::C2::M() { … } // oops
In case you didn’t spot it, the problem with the third line is that it is parsed as a single type name ::C1::C2::M, which is supposed to be followed by a method name, but wasn’t. The workaround was to use parentheses around the method name, solving the mystery of why you would even need this in the language grammar:
::C1 (::C2::M)() { … } // okay
It’s an interesting perspective on language design, actually – code generators often have requirements that are very different from human coders.
What’s a cleft stick? Where can I get one?
"like good advice that you just didn’t take" :
@Tom R: “In a cleft stick (UK)” is roughly equivalent to “Between a rock and a hard place (US).” Thanks, Eric, for the new expression. I hadn’t heard that one before.
Indeed, to be “in a cleft stick” is to be trapped in a position where one can neither go forward nor backwards without making it worse. The phrase is often extended to “in a cleft stick of his own devising” or “in a cleft stick of their own cutting” to imply that the unfortunate situation one find’s oneself in is in some sense one’s own fault. President Obama is perhaps “in a cleft stick of his own devising” with respect to health care overhaul legislation: he can go neither forwards nor backwards on it without displeasing some huge constituency, and moreover he got himself into that situation. I wished to indicate that the unfortunate situation users of such a type find themselves in is a cleft stick that was devised by the author of the code generator, not its user. — Eric
Is “sealed” actually part of the example? Because I would argue that unless it makes a difference, it is visual noise that doesn’t belong. I understand that sealing your classes by default is “best practices”, but its conspicuous existence here makes me think “Oh, I can avoid this problem just by not sealing my classes”.
It is there to motivate the reason for my choice to make the code generator extend the class through aggregations rather than inheritance. There could be any number of reasons why it is not appropriate to extend through inheritance; the class being sealed is one of them. (This point might have been too subtle.) One can of course run into similar issues when extending a class through inheritance. — Eric
Not to be over blunt, but putting Foo in a namespace Foo is just absurd. Anyone who is temped to do it is a n00b. Sorry, but that’s just obviously not going to play well. Of course, namespaces could require a non-single word hierarchy, but that ship has sailed too.
The *real* problem that gets my goat is non-template driven code generators. I LOVE code generation, especially for model code where you need to implement a hundred items all with very similar behavior.
But if you don’t give me the template and the ability to substitute in my own template, then I don’t want to play. In Java land, I did wild and wonderful things with EMF because it’s all based on JET templates. We added all kinds of really business-helpful behavior to our generated model objects and it was almost as hard as coding an asp page. It just puts out compilable code instead of HTML.
However, with things like the DataSet generated db access code, I’m completely stuck.
I’m using VS 2008 and I’ve heard that this supposed to be getting better, but seriously seriously:
If you don’t give me an editable template, then you had better not be generating code on my behalf. If you do generate and fail to provide the template I will give you the Squiggly Eyebrows of Doom.
</soapbox>
It’s getting better in a sense that, in the past, there was simply no single definite solution for template code generation (and any template text generation) on .NET. The only thing you could do with stock framework is to rig up ASP.NET, but it really isn’t designed for that kind of thing, and the whole scheme gets ugly real quick.
So, most generators ended up being driven entirely from hand-written code using CodeDOM.
Now? There’s T4 (). And in VS2010, there are pre-compiled T4 templates, which are much easier to use. So now that there’s a clear single choice for this feature on the platform, there’s more incentive to use it – and that generally implies making source templates themselves available for customization.
Of Microsoft own offerings, ASP.NET MVC already does so ().
One of the things that I really like about C# is that it is designed to be friendly to code generation, with partial methods and members on one hand, and #line on the other hand. Partial classes and methods are so useful that I can’t imagine how I used to ever live without them. I remember how painful it was with Java in the old days, where it was impossible to debug because error messages had meaningless line numbers and filenames.
do appriciate your advice, If you have time, will love to read your views on the following.
Hold on a tick, ColorFoo is sealed but NOT immutable via readonly on its private fields? A buggy code generator indeed!
|
https://blogs.msdn.microsoft.com/ericlippert/2010/03/11/do-not-name-a-class-the-same-as-its-namespace-part-two/
|
CC-MAIN-2016-36
|
refinedweb
| 1,229
| 67.99
|
APIMatic Schema Libary for JavaScript
This library is currently in preview.Provides utilities for creating schema for different types, along with serialization information. These schema can later be used to:
- Validate data against schema.
- Prepare data for serialization to JSON or XML.
- Convert deserialized JSON or XML data to the schema type.
- Provide strong-typing in TypeScript for untrusted/untyped data.
BuildsThe following environments are supported:
- Node.js v10+
- Bundlers like Rollup or Webpack
- Web browsers
require('@apimatic/schema'). | | ES Module | Import like this:
import { /* your imports */ } from '@apimatic/schema'. | | Browsers | Use script: | Modern Browsers (supports ESM and uses modern JS) | Use script: Don't forget to replace VERSION with the version number. Note: We discourage importing files or modules directly from the package. These are likely to change in the future and should not be considered stable.
|
https://npmtrends.com/@apimatic/schema
|
CC-MAIN-2022-40
|
refinedweb
| 138
| 52.05
|
#include <cafe/kbd.h> KBDEc KBDSetLedsRetryEx (KBDChannel ch, KBDLedState leds);
Sends an LED command to the keyboard on channel ch. The command instructs the keyboard to turn on the LEDs specified by leds. If the attempt fails due to the
KBD_ERR_BUSY condition, a timer is set to retry the call 1 millisecond later. This will continue until a retry succeeds, or until another error status occurs.
KBDSetLedsRetryEx is a non-blocking call, and it may be used from within a callback or whenever interrupts are disabled. This is in contrast to the blocking version of this function,
KBDSetLedsEx.
Because
KBDSetLedsRetryEx sends a message over the USB bus, refrain from calling this API too frequently to prevent flooding of the USB bus. Avoid sending more than 12 LED commands (total for all keyboards) per 1/60th of a second. Even this amount is excessive and should be avoided.
This function will always attempt to send the LED command. Any "lazy" setting of LED state must be performed at a higher level.
KBDSetLedsEx
KBDSetLedsAsyncEx
2013/06/20 Initial version.
CONFIDENTIAL
|
http://anus.trade/wiiu/personalshit/wiiusdkdocs/fuckyoudontguessmylinks/actuallykillyourself/AA3395599559ASDLG/pads/hid/kbd/KBDSetLedsRetryEx.html
|
CC-MAIN-2018-05
|
refinedweb
| 178
| 65.42
|
Do you understand WINS architecture? Well, you should! In this article, we’ll look at why it’s important to understand the WINS architecture for any network running Windows NT 4.0 or earlier, as well as for any network on which Windows 2000 will run in a mixed environment.
First, an introduction to WINS
The Windows Internet Name Service, a.k.a. WINS, functions as the domain and machine locator service for Windows NT networks. WINS locates network resources in a TCP/IP-based Microsoft network by automatically configuring and maintaining the computer name and IP-address mapping tables. It also serves basic functions, such as preventing duplicate network names. While Windows 2000 does not require WINS in a pure Win2K environment, WINS will always be required in a mixed environment, where Windows 2000 computers interoperate with other systems such as Windows NT 4.0, Windows 95, and Windows for Workgroups.
Optimizing your WINS can be fun!
Requests to WINS servers are directed datagrams, which means the requests are routed. Therefore, one WINS server is adequate in a network, although at least two are recommended to provide fault tolerance. One WINS server can service up to about 10,000 client registrations.
Generally, the fewer WINS servers, the better. An organization should consider adding WINS servers only in the following situations:
- Inadequate bandwidth prevents the WINS server from promptly fulfilling client requests.
- The links between clients and the WINS server are unreliable, and the organization can’t tolerate any loss of WINS service.
- Network traffic is expected to be very high, and the organization wants to localize the WAN traffic. NetBIOS name resolution traffic is reduced, but WINS replication traffic is increased.
WINS static mappings for fun and profit
Certain nodes on a network, such as a server running UNIX, are incapable of registering a name with a WINS server. A WINS client can resolve these names if the client has a name-to-IP address entry in an LMHOSTS or HOSTS file or by querying a DNS server. However, a better solution is to enter the name-to-IP address mapping statically in the WINS server using the WINS Manager.
Static entries allow for faster name resolution because they let WINS clients resolve name-to-IP-address mapping by querying the WINS server. Secondary resolution methods, such as broadcast resolution, become unnecessary. Static entries also prevent the WINS server from allowing another WINS client to dynamically register the name. You can use the WINS Manager to enter static mappings either interactively or by importing an LMHOSTS file. Static mappings are never released and are never replaced by dynamic entries. You should use static mappings only for clients that are not WINS-aware.
Don’t you just love traffic?
WINS reduces the amount of broadcast traffic on the network. Except for broadcast traffic associated with logon requests and DHCP requests, network broadcast traffic can be reduced to nil if WINS is fully implemented.
WINS and WINS clients generate four types of traffic:
- NetBIOS name registrations
- Re-registrations and de-registrations
- NetBIOS name requests
- WINS database replications
Table 1 includes the WINS traffic summary.
Based on the given information, you can draw the following conclusions regarding WINS' impact on the network traffic and resource accessibility:
- WINS generates little network traffic for name registrations and queries.
- If the link to the primary and secondary WINS servers goes down, workstations can still access resources on server and workstations on the local subnet by issuing a local NetBIOS broadcast.
- WINS replication traffic requires a TCP connection, so it generates more network traffic and server usage than name registration and query processes.
As the NetBIOS resolves
In many organizations, WINS clients requesting NetBIOS name-to-IP address mappings of various network devices will generate the largest amount of WINS-related traffic. Each request requires two frames to complete. The WINS client sends the name request directory to the WINS server using a UDP frame, which does not involve session establishment overhead. The size of the request message is 92 bytes. The response, which contains the IP address of the requested NetBIOS name, may range from 104 to 480 bytes.
By comparison, the broadcast method of NetBIOS name resolution requires sending three broadcast messages of 92 bytes each. Each device that has the requested NetBIOS name registered responds with a single frame of 104 bytes.
A client that needs to connect to a server will first check its name cache to see if it contains the server’s IP address; if it doesn’t, the client will send out a request.
If you have more than one home, you’re multihomed!
The term multihomed refers to a workstation or server that is configured with more than one TCP/IP address. NetBIOS over TCP/IP supports only one IP address per NIC, even if you’ve configured TCP/IP to have multiple IP addresses on a single NIC. A computer configured in that manner still registers only a single NetBIOS name and IP address with the WINS server.
A computer that needs to register multiple IP addresses must use multiple network adapter cards. Each card has its own unique IP address so the computer can register with WINS as multihomed. In this situation, the NetBIOS name references each of the IP addresses, and when a client queries that NetBIOS name, the WINS server returns all of the registered addresses in response.
It’s up to the WINS client to choose the “best” IP address to connect with a multihomed computer. Currently, the WINS client uses the following algorithm:
- If one of the IP addresses in the name query list is on the same logical subnet as the calling binding of the NetBT on the local computer, the WINS client selects that address. If more than one of the addresses meets the criterion, the WINS client picks one at random from those that match.
- If one of the IP addresses in the list resides on the same logical subnet as any binding of NetBT on the local computer, the WINS client selects that address. If more than one of the addresses meets this criterion, the WINS client picks one at random for those that match.
- If none of the IP addresses in the list is on the same subnet as any binding of NetBT on the local machine, the WINS client selects an address at random.
WINS server can also be configured as multihomed systems, but for most enterprises this is not advisable, due to the name resolution and browsing problems.
Register your common NetBIOS names today!
Every service or application that supports NetBIOS must register NetBIOS names. Examples include workstation and server services, the Network Monitor application, and special names that indicate roles on the network, such as primary domain controller or backup domain controller . The actual number of names depends on the specific network services and applications the client computer initializes—typically, three or four names. Each name can be up to 15 characters long, with a sixteenth character that designates the service or application that owns the name.
Using default values, a client will refresh its name at half the renewal interval value. Under Windows NT 4.0, the NetBIOS name registration renewal process will occur every 72 hours for each client. If the administrator shortens the interval, network traffic increases as a result. By contrast, increasing the interval will reduce client-to-WINS traffic but will diminish database accuracy. The administrator must always ensure that the renewal interval is the same for primary and secondary WINS servers so the secondary server remains unused until necessary.
Every two days, each WINS-enabled client must re-register all of its NetBIOS names. Further, every time a server or workstation on the network is started, it registers each of its NetBIOS names with the WINS servers. When the computer shuts down, the names are de-registered. For this reason, it’s important to train users to log off and properly shut down their workstations so that the NetBIOS names can be properly cleared from the WINS database.
Interoperability fun for every network administrator
Earlier, we discussed WINS static mapping for nodes on a network that can’t register names with a WINS server. The WINS client can resolve those names via a number of methods, including by querying a DNS server. The DNS server provides hostname-to-IP address name resolution for non-NetBIOS network clients.
Although DNS is similar to WINS in certain respects, major differences do exist:
- DNS is a static database for name-to-address mapping and must be manually updated by an administrator. By contrast, WINS allows computers to dynamically register their name-to-address mappings—a method that requires less administration than static mapping.
- The DNS hierarchy allows database administration and replication to be segmented into zones. WINS, however, is a flat name space, without the concept of hierarchy; thus, each WINS server must maintain a complete database of entries—a feat accomplished through replication.
The DNS server works with the WINS server through a new (proprietary) record, which is defined as part of the zone database files. The WINS record instructs the domain name server to use WINS to look up any requests for hosts in the zone root that do not have static addresses in the IP database.
You want to be my WINS replication partner?
As we’ve mentioned, the WINS database is a flat, non-hierarchical namespace. Replication of database entries between servers ensures that any WINS-aware computer in the company can locate and connect to any other WINS-aware computer.
WINS servers maintain the database by means of replication partners. Each WINS server is a push partner or a pull partner, with at least one other WINS-based server. Push replication occurs based on the number of changes made to the WINS database. The push partner initiates replication by informing its partner that it has reached an update count for registrations and changes. Replicating on this basis helps keep WAN traffic to a minimum and ensures that the WINS changes are replicated expediently.
WINS also offers a Push With Propagation option that forces immediate WINS updates to all replications. Although this option increases database accuracy, it does so at the cost of increased network traffic; thus, use of this option is not advised on a sizable network.
Pull replication happens on a time interval. The pull partner replicates the database by asking its partner for all records with a higher version number than the last record stored from the last replication for that server. Replication pairs have the advantage of specifying a replication interval. If servers are connected by slow links, such as international connections, the replication interval can be set to keep link traffic to a minimum while still transferring updates. In addition, the network administrator can schedule WINS replication to occur after daily client registration traffic has peaked—typically after 10:00 A.M. on workdays. Doing so will improve available network bandwidth.
Do you have a story about using WINS in your network? Perhaps you would like to share your experiences with other TechRepublic readers. Feel free to post a message below. You can send us a note.
|
https://www.techrepublic.com/article/build-your-skills-everything-you-need-to-know-about-wins/
|
CC-MAIN-2017-47
|
refinedweb
| 1,875
| 53.21
|
Exceptions and errors¶
This section lists all available exceptions in alphabetical order.
- class ArithmeticError¶
The base class for those built-in exceptions that are raised for various arithmetic errors.
- class BaseException¶
The base class for all built-in exceptions.
It is not meant to be directly inherited by user-defined classes (for that, use
Exception).
- class EOFError¶
Raised when the
input()function hits an end-of-file condition (EOF) without reading any data.
- class Exception¶
All built-in exceptions are derived from this class.
All user-defined exceptions should also be derived from this class.
- class LookupError¶
The base class for the exceptions that are raised when a key or index used on a mapping or sequence is invalid.
- class NotImplementedError¶
In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added.
- class OSError
This exception is raised by the firmware, which is the Operating System that runs on the hub. For example, it raises an
OSErrorif you call
Motor(Port.A)when there is no motor on port A.
- class OverflowError¶
Raised when the result of an arithmetic operation is too large to be represented.
- class RuntimeError¶
Raised when an error is detected that doesn’t fall in any of the other categories.
The associated value is a string indicating what precisely went wrong.
- class StopIteration¶
Raised by built-in function
next()and an iterator’s
__next__()method to signal that there are no further items produced by the iterator.
Generator functions should return instead of raising this directly.
- class TypeError¶
Raised when an operation or function is applied to an object of inappropriate type.
- class ValueError¶
Raised when an operation or function receives an argument that has the right type but an inappropriate value. This is used when the situation is not described by a more precise exception such as
IndexError.
Examples¶
Debugging in the REPL terminal¶
from pybricks.pupdevices import Motor from pybricks.parameters import Port from pybricks.tools import wait # Initialize the motor. test_motor = Motor(Port.A) # Start moving at 500 deg/s. test_motor.run(500) # If you click on the terminal window and press CTRL+C, # you can continue debugging in this terminal. wait(5000) # You can also do this to exit the script and enter the # terminal. Variables in the global scope are still available. raise KeyboardInterrupt # For example, you can copy the following line to the terminal # to get the angle, because test_motor is still available. test_motor.angle()
Detecting devices using
OSError¶
from pybricks.pupdevices import Motor from pybricks.parameters import Port from uerrno import ENODEV try: # Try to initialize a motor. my_motor = Motor(Port.A) # If all goes well, you'll see this message. print("Detected a motor.") except OSError as ex: # If an OSError was raised, we can check what # kind of error this was, like ENODEV. if ex.errno == ENODEV: # ENODEV is short for "Error, no device." print("There is no motor this port.") else: print("Another error occurred.")
|
https://docs.pybricks.com/en/v3.1.0/micropython/exceptions.html
|
CC-MAIN-2022-05
|
refinedweb
| 516
| 50.23
|
Q: You and Brian Goetz are doing a session called "Writing the Next Great Java Technology Book" (BOF-6588). What makes for a great Java book?
A: It depends. You can present important material that has never before been presented in book form, as Brian Goetz and Tim Peierls did in Java Concurrency in Practice, or you can compose a wholly original presentation of existing material that makes it accessible to a whole new group of people, as Kathy Sierra and Bert Bates did in Head First Java. You can take a large volume of information and distill it down to its essence, as Peter Sestoft did so well in Java Precisely. And the list goes on.
Q: You wrote a book, Effective Java, that developers often tell me is their favorite Java technology book. You're twice offering a session titled "More 'Effective Java'" (TS-6623), where you're talking about the latest in best practices for the Java platform. Give us a peek at this.
A: I'm concentrating on material that's new in the second edition of the book. Last year, I spent a lot of time talking about generics, so I'm going to go light on generics this year, though I do have a new generics tip that I'm look forward to sharing.
I'll present a bunch of fun stuff on enum types, and a concise guide to best practices for lazy initialization. Oh, and I plan to display a buff picture of our state's chief executive in his younger days.
enum
Q: Describe a day in your life at Google.
A: It's a great place to work. I get to work with lots of smart people from all over the world, and there's no shortage of challenging work to do. Google understands the importance of open source and giving back to the community, so they've always been supportive of my continuing work on the Java platform. And the perks are everything they're cracked up to be.
Q: What's the best meal you've ever eaten at Google?
A: Hmm... perhaps it was the roast quail at Cafe 7 a couple of years back? Or maybe the shiro maguro sashimi at Pinxto? Some of the desserts are pretty good too.
Q: Is the food really good?
A: Yes. I'm not saying that I've never had a bad meal there, but on the whole, it's just great.
Q: If you could have "Bloch" be turned into a verb in the way that "Google" has been, what would it mean to "Bloch"?
A: Gosh, that's a tough one. Maybe "to write a good API"? Of course, it won't happen, and that's fine by me. There are only a few people in each generation that rate a word, and it's usually an adjective. You know: Newtonian, Cartesian, Shakespearean, that sort of thing.
For some reason, this makes me think of a headline I saw many years ago, when Miles Davis died, his New York Times obituary said "Miles Davis, Trumpeter, Dies; Jazz Genius, 65, Defined Cool." And I thought to myself, "Yep, that about sums it up. And no one's ever going to top that headline."
Q: What's your favorite bit of code, or what's the most beautiful code you've ever laid eyes on? Code like poetry?
A: I have seen a fair amount of code that inspires that sort of response. Like real poetry, a piece of code that's beautiful to someone might be ugly to someone else. Here's a mystic code poem:
static int inverse(int val) {
t *= 2 - val * t;
t *= 2 - val * t;
t *= 2 - val * t;
t *= 2 - val * t;
return t;
}
As its name implies, this method calculates the multiplicative inverse of its odd argument, mod 2^32. In other words, for all odd integers i, i * inverse(i) == 1. It works by Newton iteration.
mod 2^32
i * inverse(i) == 1.
Q: What's the funniest code you can think of?
A: The daily WTF is full of funny code. Also Bill Pugh often sends me funny code that FindBugs uncovers. Here's a delightful example -- unretouched, I swear:
public Object getObject(java.util.Map<String,Class<?>> map)
throws SerialException
{
map = new Hashtable(map);
if (!object.equals(null)) {
return map.get(object);
} else {
throw new SerialException("The object is not set");
}
}
Q: Is code the universal language and if so, why?
A: I think music lays claim to that, with math a distant second, because it takes natural language to link mathematical notation into a proof. Code is a lot like math: A large part of what makes a program readable is well-chosen identifier names, and they're based on natural language.
Q: Which Java luminary had the most profound impact on you and in what way?
A: Probably Doug Lea. He knows so much about so many things, and I've bounced innumerable ideas off of him over the years. He always has something interesting to say. And he has an uncanny ability to extract the best performance out of the VM. Luckily, he's taught me a few of his tricks. For example, branch free code runs fast, cache effects can be deadly, and inlining heuristics have a huge effect on performance.
Q: Can you give us an example of code that you are most proud of creating and explain why?
A: The Collections framework. It's far from perfect, but it's proven itself maintainable and pleasant over the years. The aforementioned:
java.util.concurrent
public class Anagram {
public static void main(String[] args) {
int minGroupSize = Integer.parseInt(args[0]);
// Read words from input and put into simulated multimap
Map<String, List<String>> anagrams =
new HashMap<String, List<String>>();
for (Scanner s = new Scanner(System.in); s.hasNext(); ) {
String word = s.next();
String alphagram = alphagram(word);
List<String> group = anagrams.get(alphagram);
if (group == null)
anagrams.put(alphagram, group = new ArrayList<String>());
group.add(word);
}
// Print all permutation groups above size threshold
for (List<String> group : anagrams.values())
if (group.size() >= minGroupSize)
System.out.println(group.size() + ": " + group);
}
private static String alphagram(String s) {
char[] chars = s.toCharArray();
Arrays.sort(chars);
return String.valueOf(chars);
}
}
Q: What do you do when you feel stumped?
A: I drink a nice hot steaming cup of coffee. Google has really good espresso machines, with beans from Barefoot Coffee Roasters. If that doesn't do it, I go for a walk. And if that doesn't do it, I call the aforementioned Doug Lea.
Q: What online resources do you use to keep up with Java technology?
A: The specs. And Google. I go wherever it takes me.
Q: Is there an intellectual discipline or fun activity that you feel makes you a better developer?
A: I think that math and writing both make you a better developer. Math requires the same intellectual rigor that programming does, and writing forces you to organize your thoughts. Both math and writing exercise the same aesthetic facility that is required for writing really good programs.
Q: What are some things you wish you'd learned in engineering school?
A:.
Joshua Bloch will be speaking at the following JavaOne sessions:
Effective Java Second Edition
Order this book through:
Amazon.com
DigitalGuru
|
http://java.sun.com/javaone/sf/2008/articles/rockstar_joshuabloch.jsp
|
crawl-002
|
refinedweb
| 1,228
| 75
|
So I decided to learn Python. Turns out this computer programming language isn’t so hard (well, until I got this project! :P ).
Within seconds, I fell in love with its easy, crisp syntax and its automatic indentation while writing. I was mesmerized when I learned that data structures like lists, tuples and dictionary could be created and initialized dynamically with a single line (like so, list-name = [] ).
Moreover, the values held in these could be accessed with and without the use of indexes. This makes the code highly readable as the index is replaced by an English word of one’s choice.
Well, enough said about the language. Let me show you what the project demanded.
My brother gave me this project. He came across a text file containing thousands of words. Many of the words shared almost the same meaning. Each word had its definition and an example sentence next to it but in a not-so-organized manner. There were spaces and newlines between a word and its sentence. Some aspects were missing from the words. Below are the snippets of the text file which I’m talking about:
He wanted the text aspects to be uniform. For that, he needed me to neatly assort all similar meaning words beside a topic. He told me that this could be achieved by capturing all the data in the text into a dictionary in the following format:
and then writing them into a CSV (Comma Separated Values) File.
He asked if I could take this up as my first project, now that I had learned the fundamentals. I was thrilled to work out the logic and so I instantly agreed. When asked about the deadline, he gave me a decent time of 2 days to finish.
Alas, I ended up taking double amount of time for I struggled to debug the written code properly. Frankly, if it hadn’t been for my brother’s short visits to my room to look at the progress and hinting at the wrong assumptions made by me while writing the conditions, I was destined to finish the project in eternity :P
I began by creating mini tasks within the program which I sought to finish before building up the entire program. These were as listed below:
1. Forming a Regex to match a number and the word next to it.
I examined the text file and noticed that every topic (herein referred to as ‘key’ ) had a number preceding it. So, I wrote a few lines of code for making a regex (regular expression — a powerful tool to extract text) of the pattern as follows:
However, when I ran this I got an error, UnicodeDecodeError, to be exact which meant I didn’t have access to the text file. I looked it up in and after a long search with no luck, my brother came and found a solution. The error was rectified as follows:
Still, I didn’t get the desired output. This was because some keys had slashes (‘/’) or spaces (‘ ‘) in the text which my regex couldn’t match. I thought of improving the regex expression later and so wrote a comment next to it.
2. Obtaining a list of lines as strings from the text file
For this, I wrote just 1 line of code and fortunately, no errors showed up.
However, I obtained an unclean list. It contained newlines (‘\n’) and spaces (‘ ‘) I then sought to refine the list as follows:
3. Extracting words, meanings, and example sentences separately and adding them to corresponding lists.
This was by far the hardest part to do as it involved proper logic and proper judgment by pattern recognition.
Interestingly, while glancing over the text file, I noticed more patterns. Every word had its meaning in the same line separated by a ‘=’ sign. Also, every example was preceded by ‘:’ sign and ‘Example’ keyword.
I thought of making use of regex again. I found an alternate and more elegant solution by slicing the line (now a string in the list) according to the placement of the symbols. Slicing is another cool feature in python. I wrote the code as follows:
The above code reads almost like English. For every line in the clean list, it checks whether it has a ‘=’ or a ‘:’ sign. If it does, then the index of the sign is found and slicing is done accordingly.
In the first ‘if’, the part before the ‘=’ is stored in the variable ‘word’ and the part after it is stored in ‘meaning’. Similarly for the second ‘if’ (‘elif — else if — in this case), the part after ‘:’ is stored in ‘example’. And after each iteration, the word, meaning and example sentence are stored in the corresponding lists. In this way, the whole data can be extracted.
So far so good. But, I noted that the extraction was to be done in a manner such that every word (and its aspects) of the particular key had to be accumulated together as one value for the key. This meant it was required to store each word, meaning, and example inside a tuple. Each tuple was to be stored inside a single list which would represent itself as the value for a particular key. This is depicted below:
For this, I planned to collect each word, meaning and sentence of each key inside a separate list enclosed by another list, say key-list. Again, the picture will tell you more precisely:
To do this, I added the following code to the one which I wrote for slicing:
This code’s logic (the else part) turned out to be wrong, unfortunately. I wrongly assumed that only 2 conditions(‘=’ and ‘:’) existed in the text. There were many exceptions which I failed to notice. I ended up wasting hours for debugging possible errors in the logic. I had assumed that the complete text file followed the same pattern. But that was simply not the case.
Unable to make progress, I moved on to the next part of the program. I thought I could use some help from my brother after completing the other parts. :P
To be continued…
4. Creating values for keys using Zip Function and Parameter Unpacking.
At this point, I wasn’t entirely sure what I would do even after achieving the above configuration of lists. I had learned about ‘Zip’ function and ‘Parameter Unpacking’ during one of my brother’s tech talks, which literally zipped the lists passed to it, like so:
So I thought I could somehow combine those two features to achieve the desired result. After a bit of to-ing and fro-ing, testing the features and working on dummy lists, I succeeded. I created a separate file (beta) for this task, the snippet of which is given below:
The working of the above code can be figured out by having a look at the output:
The zip() function zips the corresponding lists or values within the lists and encloses them in a tuple. The tuples inside the lists are then converted to lists for unpacking and further zipping. Finally, the desired output is obtained.
I felt much relieved for the code worked this time. I was happy that I could manipulate the would-be extracted data and mold it into the required format. I copied the code to the main file on which I was working and modified the variable names accordingly. Now all there was left to do was to assign values to the keys in the dictionary (and of course the extraction part!).
5. Assigning values to the keys in the dictionary.
For this, I came to this solution after some experimentation with the code:
This produced the desired output as follows:
The program was almost done. The main problem lay in the data extraction part.
… continuation from section 3
After hours and hours of debugging, I grew more and more frustrated as to why the damn thing didn’t work. I called my brother and he gave me a subtle hint about the assumptions I had made while defining the conditional loops and if-else clauses. We scrutinized the text file and noticed that some words had examples in two lines instead of one.
According to my code logic, since there is no ‘:’ sign in the second line (nor a ‘=’ sign, for that matter), the contents in the line would not be treated as a part of the example. As a result, this statement would make the last ‘else’ part true and execute the code written in it. Considering all this, I modified the code as below:
Here, hasNumbers() is a function which checks whether a given line has numbers in it. I defined it as follows:
What this does is that it collects the second line of the example if all other conditions fail, combines it with the first line and then adds it the corresponding list as before.
To my disappointment, this didn’t work and instead showed an error that the index was out of range. I was dumbstruck, as every line of code seemed to be logically correct in my view.
After hours of madness, my brother showed me a way to fetch the line numbers where the error occurred. One of the main skills in programming is the ability the debug the program, to properly check for possible errors and maintain a continuous flow.
Interestingly, the following addition to the code reported that the error occurred at around line number 1750 of the text file.
This meant that the program worked well till that line number and that my code was correct! The problems lay in my wrong assumptions and also the text file thanks to its heterogeneity.
This time around, I noticed some keys were not by their numbers which caused problems in the logic flow. I rectified the mistakes by further modifying the code as follows:
This worked well till line 4428 of the text file but crashed right after. I checked that line number on the text file itself but that didn’t help much. Then I realized, much to my happiness, that it must be the last line. The whole program worked on the clean list which was void of newlines and spaces. I printed the last line of the clean list and compared it with the last line of the text file. They matched!
I was extremely happy to know this as it meant the program was executed until the end. The only reason why it crashed was that after the last sentence none of the code made sense. My conditionals were designed to every time check the next line also, along with the current line. Since there was no line after the last line, it crashed.
So I wrote an additional line of code to cover that up:
Everything worked now. Finally! Now all I had to was to assign the keys to corresponding values and that’s that! I took a break at this moment, considering that my project was finally over. I would add some final touches to it later.
But before taking a break, I decided to enclose every code inside various functions so as to make the code look neat. I already had much trouble navigating up and down the lines of code. So I decided to take a break after doing this.
However, after doing so, the program started giving variable scope errors. I realized that this was because variables declared inside functions cannot be called directly from outside the function as they are in the local namespace. Unwilling to make further changes due to that lame error I decided to revert back to the same code with which I had been hitting my head from the start.
However, to my utter disbelief, the program didn’t work in the same way as it did before. In fact, it didn’t work at all! I simply couldn’t figure out the reason (and I still can’t!). I was utterly depressed for the rest of the day. It was like experiencing a nightmare even before falling asleep!
Fortunately and miraculously, the code worked the next day after I made some careful changes. I made sure that I made many beta files (for each change made) thereafter so as to avoid such unnecessary chaos.
After a few more hours, I was able to finally complete my program (but not until I consumed 4 full days). I made few more changes such as:
i) modifying the ‘hasNumbers’ function to ‘hasNumbersDot’ function and excluding the regex I made earlier in the program. This matched the keys more efficiently as it had no assumptions and hence no exceptions. The code for it is as follows:
ii) replacing the regex condition and the code for obtaining keys from the clean list.
iii) combining the ‘if’ conditions in the ‘examples extraction’ part
iv) materializing the code for dictionary key assignment
Also, after some trial and error, I was able to convert the data obtained into a beautifully structured CSV file:
You can check out my github repository on my profile for viewing the full code for the program including the text file and csv file.
Overall, it was a great experience. I got to learn so much out of this project. I also gained more confidence in my skills. Despite some unfortunate events (programming involves such things :P), I was finally able to complete the given task.
One last thing! Recently, I came across a hilarious meme regarding the stages of debugging which is so relatable to my experience that I can’t resist sharing. xD
Thanks for making it all the way until here (even if you skipped most of it to check out the final result :P).
|
https://www.freecodecamp.org/news/my-first-python-project-converting-a-disorganized-text-file-into-a-neatly-structured-csv-file-21f4c6af502d/
|
CC-MAIN-2021-31
|
refinedweb
| 2,299
| 70.53
|
#include <glib.h> GPatternSpec; GPatternSpec* g_pattern_spec_new (const gchar *pattern); void g_pattern_spec_free (GPatternSpec *pspec); gboolean g_pattern_spec_equal (GPatternSpec *pspec1, GPatternSpec *pspec2); gboolean g_pattern_match (GPatternSpec *pspec, guint string_length, const gchar *string, const gchar *string_reversed); gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string); gboolean g_pattern_match_simple (const gchar *pattern, const gchar *string);
The
g_pattern_match* functions match a string
against a pattern containing '*' and '?' wildcards with similar semantics
as the standard
glob() function: '*' matches an arbitrary, possibly empty,
string, '?' matches an arbitrary character.
Note that in contrast to
glob(), the '/' character
can be matched by the wildcards, there are no
'[...]' character ranges and '*' and '?' can not
be escaped to include them literally in a pattern.
When multiple strings must be matched against the same pattern, it
is better to compile the pattern to a GPatternSpec using
g_pattern_spec_new() and use
g_pattern_match_string() instead of
g_pattern_match_simple(). This avoids the overhead of repeated
pattern compilation.
typedef struct _GPatternSpec GPatternSpec;
A GPatternSpec is the 'compiled' form of a pattern. This structure is opaque and its fields cannot be accessed directly.
GPatternSpec* g_pattern_spec_new (const gchar *pattern);
Compiles a pattern to a GPatternSpec.
void g_pattern_spec_free (GPatternSpec *pspec);
Frees the memory allocated for the GPatternSpec.
gboolean g_pattern_spec_equal (GPatternSpec *pspec1, GPatternSpec *pspec2);
Compares two compiled pattern specs and returns whether they will match the same set of strings.
gboolean g_pattern_match (GPatternSpec *pspec, guint string_length, const gchar *string, const gchar *string_reversed);
Matches a string against a compiled pattern. Passing the correct length of the
string given is mandatory. The reversed string can be omitted by passing
NULL,
this is more efficient if the reversed version of the string to be matched is
not at hand, as
g_pattern_match() will only construct it if the compiled pattern
requires reverse matches.
Note that, if the user code will (possibly) match a string against a multitude
of patterns containing wildcards, chances are high that some patterns will
require a reversed string. In this case, it's more efficient to provide the
reversed string to avoid multiple constructions thereof in the various calls to
g_pattern_match().
Note also that the reverse of a UTF-8 encoded string can in general
not be obtained by
g_strreverse().
This works only if the string doesn't contain any multibyte characters.
Glib offers the
g_utf_strreverse() function to reverse UTF-8 encoded strings.
gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string);
Matches a string against a compiled pattern. If the string is to
be matched against more than one pattern, consider using
g_pattern_match() instead while supplying the reversed string.
gboolean g_pattern_match_simple (const gchar *pattern, const gchar *string);
Matches a string against a pattern given as a string.
If this function is to be called in a loop, it's more efficient to compile
the pattern once with
g_pattern_spec_new() and call
g_pattern_match_string()
repetively.
|
http://maemo.org/api_refs/4.1/glib2.0-2.12.12/libglib2.0/glib-Glob-style-pattern-matching.html
|
CC-MAIN-2017-30
|
refinedweb
| 453
| 53.31
|
I'm developing an application that needs to copy lots of files from one folder to another, using QT (5.6.1)
For doing this, I've been using the
QFile::copy()
qfile.cpp
char block[4096];
qint64 totalRead = 0;
while(!atEnd()) {
qint64 in = read(block, sizeof(block));
if (in <= 0)
break;
totalRead += in;
if(in != out.write(block, in)) {
d->setError(QFile::CopyError, tr("Failure to write block"));
error = true;
break;
}
}
char block[4194304]; // 4MB buffer
The inferior stopped because it received a signal from the Operating System.
Signal name :
SIGSEGV
Signal meaning :
Segmentation fault
Well, changing the buffer size did no good, since that apparently is just a fallback in case the derived function
engine()->copy() fails. I don't know exactly how that function works, nor did I want to waste time modifying core QT engine classes to make this work.
In the end, since my project was only supposed to run on Windows, I ended up using the native Win32 copy function. So I replaced my call to:
QFile::copy(src, dest);
with:
CopyFileExW((LPCWSTR)src.utf16(), (LPCWSTR)dest.utf16(), 0, this, 0, 0);
Note that you must
#include "windows.h" for this invocation to work.
|
https://codedump.io/share/MwxfD6eSxWVj/1/qt---qfile-copy-operation-extremely-slow
|
CC-MAIN-2017-43
|
refinedweb
| 200
| 64.1
|
In the first part of this series we spent some time setting up the Yahoo BOSS Mashup Framework, and ended by putting together an extremely minimal search service. For those who didn't work through part one, you can grab a zip of what we developed here, but you'll need to follow the instructions in part one for acquiring a BOSS App ID. In this second part of the series we are going to flesh out our search service a bit:
- We're going to let users search either the web, Yahoo News, or images.
- We're going to let users page through search results.
Lets get moving.
Expanding
First, open up
my_search/yahoo_search/views.py and take a look at
class SearchForm(forms.Form): search_terms = forms.CharField(max_length=200)
Now we're going to want to add functionality for changing the type of search:
SEARCH_TYPES = (('web','Web'),('news','News'),('images','Images')) class SearchForm(forms.Form): search_terms = forms.CharField(max_length=200) search_type = forms.ChoiceField(SEARCH_TYPES)
Enhancing
search and
index
Now lets improve
search to accept a second parameter that determines what kind of search it will perform.
def search(str, type): data = ysearch.search(str,vertical=type,count=10) news = db.create(data=data) return news.rows
And update
index to feed
search the value
search_type captured by our handy
def index(request): results = None if request.method == "POST": form = SearchForm(request.POST) if form.is_valid(): search_terms = form.cleaned_data['search_terms'] search_type = form.cleaned_data['search_type'] results = search(search_terms,search_type) else: form = SearchForm() return render_to_response('yahoo_search/index.html', {'form': form,'results': results})
Now, go ahead and run the development server.
python2.5 manage.py runserver
Then navigate over to, and you'll see that you can now search the web, images, or Yahoo News. Pretty nifty. Now lets get cracking on paginating our search results.
Paginating Search Results
When you are using Django and you think paginating, your train of thought should immediately about the Paginator class, which is very helpful at dealing all pagination messiness. However, we're not dealing with a normal list (or a
QuerySet, in which case we could use the
QuerySetPaginator), so we're going to have to massage things a little bit.
We're going to do that by creating an intermediary class, named
BossResultList that will implement the subset of Python list functionality that the
Paginator needs to function. Fortunately, thats only three methods:
__getitem__(self,i),
__getslice__1 and
__len__. Create a file in
my_search/yahoo_search named
boss_utils.py, and in that file we're going to insert this code:
from yos.yql import db class BossResultList(object): def __init__(self, response): self.data = response details = self.data['ysearchresponse'] self.__start = int(details['start']) self.__count = int(details['count']) self.__totalhits = int(details['totalhits']) self.__results = db.create(data=self.data).rows def __getitem__(self,i): return self.__results[i - self.__start] def __getslice__(self, i, j): return self.__results[i-self.__start:j-self.__start] def __len__(self): return self.__totalhits
The
BossResultList takes the results of
ysearch_search and uses them to mimic a list. This isn't a perfect abstraction, because it will only allow access to the subset of results that it is passed in its init function, however, it will be enough to take advantage of
Paginator2.
Now lets go back to
my_search/yahoo_search/views.py and add two imports:
from django.core.paginator import Paginator from boss_utils import BossResultList
Then we'll fix up
search to play nicely with our new
BossResultList.
def search(str, type, count=10, start=0): return ysearch.search(str,vertical=type,start=start,count=count)
This change is necessary because
BossResultList needs data contained directly
within the returned results that isn't carried over after the results are converted
into a databse using the
db.create function. (Specifically, it needs access
to the
totalhits field that lets us inform users how many pages of results we can
serve them for their search query.)
Now we just have two little details remaining before we finish updating our search app:
revamping the
index function, and updating our
index.html template. Updating the
template will be easy, but we can't do that until we write
index, which happens to
involve a pretty complete rewrite. Because there are so many changes I'll post the function
first, let you read over it, and then comment on particularly salient details.
def index(request,count=10): results,page,total_pages,terms,type = None,None,None,None,None if request.method == "GET": form = SearchForm(request.GET) if form.is_valid(): page = (request.GET.has_key('page') and int(request.GET['page'])) or 1 start = (page-1) * count terms = request.GET['search_terms'] type = request.GET['search_type'] brl = BossResultList(search(terms,type,count=count,start=start)) paginator = Paginator(brl,count) total_pages = len(brl) / count results = paginator.page(page) else: form = SearchForm() return render_to_response('yahoo_search/index.html', {'form': form,'results': results, 'term': terms,'type': type, 'current_page': page, 'total_pages': total_pages})
Okay, a few things to mention.
We are now using GET instead of POST. Infact, we never really should have been using POST to begin with. Sorry about that.
Because we are using GET its harder to distinguish between when a user first lands on the page and when they are submitting a search. That is why our response to an invalid form is not to display the error messages generated by newforms, but instead to display an empty form: the only time we'll encounter an invalid form is when a user first comes to the page, and we don't want to greet new users with error messages.
Paginator's
pagecount starts at 1 instead of at 0 which is why we calculate
startas
(page-1)*countinstead of as
page*count.
We need
total_pagesand
pagebecause we want to let users know where they are in the midst of the search results. (For example, on page 5 of 412.)
Updating the
index.html template
Much like the
index function, the
index.html template
has recieved a substantial overhaul as well. Fortunately, the
changes to the template are largely self-explanatory. After
its remodeling its going to look like this:
<html> <head> <title>My Search</title> </head> <body> <h1>My Search</h1> <form action="/" method="GET"> <table> {{ form }} <tr><td><input type="submit" value="Search"></td></tr> </table> {% if results %} {% if results.has_previous %} <a href="?page={{ results.previous_page_number }}&search_terms={{ term|urlencode }}&search_type={{ type|urlencode }}"> Previous </a> {% endif %} <span> Page {{ current_page }} of {{ total_pages}} pages. </span> {% if results.has_next %} <a href="?page={{ results.next_page_number }}&search_terms={{ term|urlencode }}&search_type={{ type|urlencode }}"> Next </a> {% endif %} <ol> {% for result in results.object_list %} <li> <span class="title"> <a href="{{ result.clickurl }}">{{ result.title|safe }}</a> </span> <span class="date"> {{ result.date }} </span> <span class="time"> {{ result.time }} </span> <span class="source"> <a href="{{ result.sourceurl }}">{{ result.source }}</a> </span> <p class="abstract"> {{ result.abstract|safe }} </p> </li> {% endfor %} </ol> {% endif %} </body> </html>
The most complex part is for handling advancing and retreating between pages of results.
Here we are using the
Page returned by our
Paginator to handle most of the
complexity (in this template context our
Page is named
results), but it gets
a bit more complex because we need to keep track of the search terms and the type of the search.
Download
You can grab a copy of this code here. Note that you'll need to
follow the instructions in the first part of this tutorial to acquire
a Yahoo BOSS App Id and to fill in your details in
my_project/config.json.
Trying it out
Okay, now we're ready to try it all out. Go to the
my_search directory and run the devel server.
python2.5 manage.py runserver
And navigate over to and you'll see our improved search engine that looks like this:
Pretty neat, wouldn't ya say? Hopefully this tutorial has been helpful, and let me know if you have any questions.
The Python documentation makes it pretty clear that
__getslice__is deprecated, but how to handle a 'slice object' as the documentation suggests is entirely unclear. As such, I am doing this the quick and easy way, while acknowleding it apparently isn't the preferable way to do so.↩
Certainly implementing a fuller implementation that allows seemless access to the entire search result set would be a fun exercise, and if I have a bit of time I'll try to throw it together.↩
Reply to this entry
|
http://lethain.com/entry/2008/jul/12/polishing-up-our-django-boss-search-service/
|
crawl-002
|
refinedweb
| 1,405
| 58.69
|
HI Everyone.
Iv tried some sample software involving my touchscreen, but there is either a latched on input from the touchscreen or no input from the touchscreen.
Is there a simple touchscreen program I can use to test the touchscreen.
Iv checked through forum and web and cant find anything ?
HI Everyone.
Well that ansers that question.
Have you tried glide?
There’s also several examples over on code.tinyclr.com
Hey Im back again. I feel at this stage im missing something very important. All of the software im trying is just failing. With the touchscreen Iv now tried several pieces of software. All have failed.
Heres the latest. (taken from tiny)
using System.Threading;
using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;
namespace Test
{
public class Program
{
// The windows.
static Window window;
static CalibrationWindow calWindow;
public static void Main() { // Load the window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window)); // Activate touch GlideTouch.Initialize(); // Initialize the windows. InitWin(); InitCalWin(); // Assigning a window to MainWindow flushes it to the screen. // This also starts event handling on the window. Glide.MainWindow = window; Thread.Sleep(-1); } static void InitWin() { Button btn = (Button)window.GetChildByName("btn"); // Open the calibration window. btn.TapEvent += new OnTap(btn_TapEvent); } static void btn_TapEvent(object sender) { // Switch to calibration window. Glide.MainWindow = calWindow; } static void InitCalWin() { // 1st argument is auto start, which immediately starts calibration once the window is open. // 2nd argument is auto save, which saves the calibration settings for future restarts. calWindow = new CalibrationWindow(false, false); // Close the calibration window. calWindow.CloseEvent += new OnClose(calWindow_CloseEvent); } static void calWindow_CloseEvent(object sender) { // Switch to normal window. Glide.MainWindow = window; } }
}
The error Im gettingn is in " public class Program"The error Im getting is :_Error 4 ‘Test.Program’ does not contain a definition for ‘ProgramStarted’ and no extension method 'ProgramStarted’
accepting a first argument of type ‘Test.Program’ could be found (are you missing a using directive or an assembly reference?)
Iv done alot of porgramming before . Not on this type of epuipment, but iv never had these kind of problems before.
Surly a program for the Gadgeterr should just work. i need to know how the modules work before if can even try to do somethime.
i admit i feel like im in over my head here:)
Or just stuiped
The code you just posted is not Gadgeteer code, it is EMX code.
Instead of building it with a Gadgeteer project template, use aEMX project template.
Apart from some errors im getting. Which I cant get rid of.
I think my major problem now is Iv downloaded Glide but it wont open. Iv tried to download it unzip it and load it but I still cant get it to open. Computer says it does not know what software to open it with. I just transfered the fill to the dll area, but this did not work.
Is there extra software i need to run this app?
For the past month Iv tried everything. I know software is not my major thing although i can program most other devices even at a basic level.
My big problem here is 1 most downloads will not open correctly.
2 sample software is bringing up too many errors. + this is gadgeteer software.
3 to program in any language is not to hard, but to understand what multiple dll codes are are required to run external devices is very hard without working examples.
Despite a month of work I can still only turn on and of an led. ( I was aiming for slightly better then that)
The spider looks like a great piece of gear but whoever said its a simple thing to program was just wrong.
Surely it cant be that hard to have one download area with ALL files required, including a list of sample programs to show how all the modules work. This would at leat give a good starting point.
Just before anyone says it. None of the Code from Tiny iv downloaded worked, Some of the internet code has worked but not completely as in only parts of the program work.
From my point of view I cant spend any more time on a project which is just not working for me.
But best ofn luck to u all and thanks for all the help and advice I got from you.
Tell me what setup you have and what exactly you need and I will email you a working project, even call you and step you through it. What about that?
You must be overlooking something simple. Let’s try one on one and will make it happen.
Hey Gus Thanks for your help.
I just wrote reply to you but lost it so now Im just too tired to go through it again.
But 2 questions for you
If you save 2 bmp images Skip and save will this program work correctly for u.
Mine wont.
Glide I downloaded it but it will not open or install. Iv tried this on 4 different computers with different operating systems.All with same results
PS Iv spent a month trying everything to see if Iv done something wrong with the setup but I cant find anything wrong.
Ill be busy for about 16 hours so no panic on replying.
Again thanks for all your help. And sorry Im so down about it but Im just not getting anywhere:(
I do not want to answer questions as this didn’t seem to help. Tell what want and I will make a project for you. I need to know what devices you own as well.
ok the simplest program to test touchscreen, just to let me know it works.
glide how do i install it
And you are using FEZ Spider Kit? Have you tried this example C:\Users\Gus Issa\Documents\Microsoft .NET Micro Framework 4.1\Samples\TouchCalibration
I dident even know there were examples there. I found them and tried 2 simple samples.
1 touchscreen
2 Touchscreen calibration
Both samples loaded and deployed with no errors.
However there was no responce from the touchscreen
I have 1 1/4 black circle in the top left hand side of the screen. But there is no responce from the touchscreen.
Do you have all 4 cables from the screen plugged into the Spider?
To follow on Eric’s point, double-check where you’ve plugged in the T (touch) cable from the display module. I was pulling my hair out at one point trying to figure out why touch wasn’t responding, and it turned out that I’d plugged the touch cable into the “PU Y” socket right next to the “AIT X” socket because I wasn’t reading the board carefully.
Once I switched to the right socket, things worked MUCH better.
Hey, Andrew, I found a picture that perfect fits for this occasion
(Can’t wait 'til Saturday)
Pete
(Don’t try this at home, kids. Andew and I have been picking on each other er working together for years. Plus, I partially blame him for me joining Microsoft)
Hey! I resemble that picture.
And blame? I think the word should be “thank”.
The good news is that most of the stuff I learn, I learn by doing it wrong the first few times.
Jim, let us know if you can verify that your T cable is plugged in, and in the right socket. I’m sure one of the geeks on the forum can help get you sorted eventually.
Thanks for the picture Pete. You are of course completely wrong. Which just seems to add to my first opion that this system does not work. But hey your the expert ?
So this is the best a so called expert can come up with.
Where i come from we dont call this support we call it abuse.
Jim4, the picture wasn’t for you! It is a Joke between Pete and devhammer.
This is a relaxed forum and jokes come up often, nothing bad was meant by it I am sure.
Look in the replies and you will see everyone trying to help you.
@ Pete, we need clarification on your posted picture please.
|
https://forums.ghielectronics.com/t/touchscreen-test/7686
|
CC-MAIN-2020-40
|
refinedweb
| 1,372
| 75.91
|
NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | SEE ALSO
#include <sys/param.h>
#include <sys/types.h>
#include <sys/fs/ufs_fs.h>
#include <sys/fs/ufs_inode.h>
Standard UFS file system storage volumes have a common format for certain vital information. Every volume is divided into a certain number of blocks. The block size is a parameter of the file system. Sectors 0 to 15 contain primary and secondary bootstrapping programs.
The actual file system begins at sector 16 with the super-block. The layout of the super-block is defined by the header <sys/fs/ufs_fs.h> .
Each disk drive contains some number of file systems. A file system consists of a number of cylinder groups. Each cylinder group has inodes and data.
A file system is described by its super-block, and by the information in the cylinder group blocks. The super-block is critical data and is replicated before each cylinder group block to protect against catastrophic loss. This is done at file system creation time and the critical super-block data does not change, so the copies need not be referenced.
fs_clean indicates the state of the file system. The FSCLEAN state indicates an undamaged, cleanly unmounted file system. The FSACTIVE state indicates a mounted file system that has been updated. The FSSTABLE state indicates an idle mounted file system. The FSFIX state indicates that this fs is mounted, contains inconsistent file system data and is being repaired by fsck . The FSBAD state indicates that this file system contains inconsistent file system data. It is not necessary to run fsck on any unmounted file systems with a state of FSCLEAN or FSSTABLE . mount(2) will return ENOSPC if a UFS file system with a state of FSACTIVE is being mounted for read-write.
To provide additional safeguard, fs_clean could be trusted only if fs_state contains a value equal to FSOKAY - fs_time , where FSOKAY is a constant integer. Otherwise, fs_clean is treated as though it contains the value of FSACTIVE . exclusively of; aligned fragments are examined to determine block availability. lost+found directory is given the next available inode when it is initially created by mkfs(1M) .
fs_minfree gives the minimum acceptable percentage of file system blocks which may be free. If the freelist drops below this level only the super-user may continue to allocate blocks. fs_minfree may be set to 0 if no reserve of free blocks is deemed necessary, however severe performance degradations will be observed if the file system.
fs_optim specifies whether the file system should try to minimize the time spent allocating blocks, or if it should attempt to minimize the space fragmentation on the disk. If the value of fs_minfree is less than 10%, then the file system defaults to optimizing for space to avoid running out of full sized blocks. If the value of fs_minfree is greater than or equal to 10%, fragmentation is unlikely to be problematical, and the file system defaults to optimizing for time.
Cylinder group related limits : Each cylinder keeps track of the availability of blocks at different rotational positions, so that sequential blocks can be laid out with minimum rotational latency. fs_nrpos is the number of rotational positions which are distinguished. With the default fs_nrpos of 8, the resolution of the summary information is 2ms for a typical 3600 rpm drive.
fs_rotdelay gives the minimum number of milliseconds to initiate another disk transfer on the same cylinder. It is used in determining the rotationally optimal layout for disk blocks within a file; the default value for fs_rotdelay varies from drive to drive (see tunefs(1M) ).
fs_maxcontig gives the maximum number of blocks, belonging to one file, that will be allocated contiguously before inserting a rotational delay.irection. MINBSIZE must be large enough to hold a cylinder group block, thus changes to (struct cg) must keep its size within MINBSIZE . Note:.
Per cylinder group information is summarized in blocks allocated from the first cylinder group's data blocks. These blocks are read in from fs_csaddr (size fs_cssize ) in addition to the super-block.
Note: sizeof (struct csum) must be a power of two in order for the fs_cs macro to work. header <sys/fs/ufs_inode.h> .
See attributes(5) for a description of the following attributes:
fsck_ufs(1M) , mkfs_ufs(1M) , tunefs(1M) , mount(2) , attributes(5)
NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | SEE ALSO
|
https://docs.oracle.com/cd/E19455-01/806-0633/6j9vn6q4f/index.html
|
CC-MAIN-2018-17
|
refinedweb
| 723
| 55.95
|
.
Kubernetes is an open-source container orchestration system that automates software container deployment, scaling, and management. You can instrument your Kubernetes workloads and apps to emit spans using client libraries from OpenTracing/Jaeger, Zipkin, and OpenTelemetry. You can then use the Grafana Agent to collect these spans from your app, buffer them, and forward them to Grafana Cloud for storage and querying. To learn more, please see Tracing with the Grafana Agent and Grafana Tempo from the Grafana Blog. Deployment. A sample Deployment manifest can be found in the Agent GitHub repository.
Save the
agent-tempo.yaml manifest on your local machine and replace
YOUR_NAMESPACE values with the Namespace into which you’ll install the Agent.
When you’re done, roll out the Agent using
kubectl apply -f:
kubectl apply -f agent-tempo.yaml
This will roll out the Agent
ClusterRole and
ClusterRoleBinding, as well as the Agent Deployment and Service with the appropriate ports exposed. You can modify these defaults depending on the receivers you need. To learn more, see Distributor from the Tempo docs.
In the next step, you’ll configure the Agent.
Step 2: Configure Grafana Agent
Copy the following ConfigMap manifest into a file called
agent-tempo-configmap.yaml:
apiVersion: v1 data: agent.yaml: | server: http_listen_port: 8080 log_level: debug tempo: configs: - batch: send_batch_size: 1000 timeout: 5s name: default receivers: jaeger: protocols: grpc: null thrift_binary: null thrift_compact: null thrift_http: null remote_sampling: insecure: true strategy_file: /etc/agent/strategies.json opencensus: null otlp: protocols: grpc: null http: null zipkin: null remote_write: - basic_auth: password: YOUR_TEMPO_PASSWORD username: YOUR_TEMPO_USER endpoint: tempo-us-central1.grafana.net:443"}}' kind: ConfigMap metadata: name: grafana-agent-traces namespace: YOUR_NAMESPACE
Be sure to replace
YOUR_NAMESPACE.
When you’re done, roll out the ConfigMap using
kubectl apply -f:
kubectl apply -f agent-tempo-configmap.yaml
This ConfigMap configures the Agent to accept traces from every supported receiver and set the appropriate labels using
relabel_configs. To learn more about the relabeling steps, please see tempo.libsonnet, the Tempo Agent docs, and Grafana Agent tempo_config docs. The Tracing with the Grafana Agent and Grafana Tempo blog post can also help you get started with the Grafana Agent and Cloud Tempo.
This configuration also specifies a Jaeger trace sampling strategy. To learn more about Jaeger’s sampling strategies, plesae see Jaeger’s documentation.
After deploying the
ConfigMap, the Grafana Agent should start.
Step 3: Restart the Grafana Agent
After modifying the Agent’s configuration, you will need to restart the Agent Pods to pick up configuration changes. Use
kubectl rollout to restart the Agent:
kubectl rollout restart deployment/grafana-agent-traces
Conclusion
You’ve now deployed the Agent into your cluster, have configured it to collect traces, and are shippping these traces.
|
https://grafana.com/docs/grafana-cloud/quickstart/agent-k8s/k8s_agent_traces/
|
CC-MAIN-2021-43
|
refinedweb
| 451
| 55.84
|
On Sunday 13 August 2006 21:52, Michael Niedermayer wrote: > looks funny, but ive no strong objection against it if it works and isnt > slower for recent gcc with optimizations on I think I found a near optimal solution. I can create the neccesary copies of the parameters on the fly using statement expressions. Now I can put everything in a macro which I can compile-time switch. That way performance won't even degrade on older compilers. #ifdef __OPTIMIZE__ #define FIX_ASM_INPUT_FOR_UNOPT(V) (V) #define FIX_ASM_OUTPUT_FOR_UNOPT(V) (V) #else #define FIX_ASM_INPUT_FOR_UNOPT(V) (({typeof(V) tmp=(V); tmp;})) #define FIX_ASM_OUTPUT_FOR_UNOPT(V) (*({typeof(V) *tmp=&(V); tmp;})) #endif Example: asm volatile( "movd %0, %%mm0 \n\t" "movd %2, %%mm1 \n\t" "punpckldq %1, %%mm0 \n\t" "punpckldq %3, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pfmul %%mm1, %%mm0 \n\t" "pswapd %%mm1, %%mm1 \n\t" "pfmul %%mm1, %%mm2 \n\t" "pfpnacc %%mm2, %%mm0 \n\t" ::"g" FIX_ASM_INPUT_FOR_UNOPT(in2[-2*k]), "m"(in1[2*k]), "g" FIX_ASM_INPUT_FOR_UNOPT(tcos[k]), "m"(tsin[k]) ); An offending parameter just needs FIX_ASM_INPUT_FOR_UNOPT prefixed. The only drawback is, that "m" constraints must be changed to "g" or similar, because gcc deprecates non-lvalues for the "m" constraint since 3.3 - This is why %0 and %2 are fixed, movd also accepts registers as operands. Fixing outputs doesn't require a change to the constraints: :"=m" FIX_ASM_OUTPUT_FOR_UNOPT(output[2*k]) , "=m" FIX_ASM_OUTPUT_FOR_UNOPT(output[n2-2-2*k]) The next good thing is, that it should be fairly easy to merge the split asm blocks again (aka FIX_ASM_INPUT_FOR_GCC2AND3) I need these macros at least in dsputil_mmx.c and fft_3dn2.c. Shall I prepare two patches for these or may I put the macros in a header file? Marco
|
http://ffmpeg.org/pipermail/ffmpeg-devel/2006-August/007473.html
|
CC-MAIN-2014-42
|
refinedweb
| 289
| 54.97
|
Extra-terrestrials problem
Hi c++ developers, I'm solving Extra-terrestrials problem and I struggled with print the output with spaces in the for loop properly. Please explain to me how can I solve this(the problem is to print the input in the reverse order) #include <iostream> #include <cstring> using namespace std; int main() { char word[100]; cin.getline(word,100); for (int i=strlen(word); i>=0;i-- ){ cout<<word[i]; } return 0; }
3/3/2021 11:50:30 AMMaryam Magdy
5 AnswersNew Answer
Printing spaces is no issue, but you need to remember that arrays are null-indexed. This means you need to start iterating at strlen( word ) - 1 because otherwise you print the null character stored after the string as well, which messes up the comparison between your output and the solution.
Usually the null character has no graphical represantation on a terminal at all, which is why it can be confusing if your output seemingly matches the solution, but does not appear to be correct.
Thank you for your reply. So, the null character is a space?
Yes that's what confused me, but I get it. An Invisible place :D
Yor comments were helpful Thx. And I just earned 10XP yay
|
https://www.sololearn.com/Discuss/2712999/extra-terrestrials-problem
|
CC-MAIN-2021-17
|
refinedweb
| 207
| 60.95
|
Hello coders!! Today we will discuss some concepts you need to know to build real complex applications with React and Redux.
In this article we'll cover the following concepts in detail:
- Why we need redux?
- What is Redux?
- Steps to create a React-redux application
- Step 1: Create a User Component
- Step 2: Create a Store
- Step 3: Create a Reducer
- Step 4: Share Redux Store with Components
- Step 5: Add an Async Function Middleware using Redux Thunk
- Step 6: Build an Action Creator
- Step 7: Connect redux store to components
Let's get started!! 🚀🚀
Why Redux?
Before we jump to more details of Redux first try to understand why we actually need it?
In a complex application with many components, if you want to share a state among the several components, then one approach you can think of is using props.
But props doesn't solve our problem completely as it only enables you to send data from a parent component to a child component using the top-down approach and not vice-versa. That means any change in the state that occurred in the child component does not impact the parent component's state.
Also, another problem that props failed to solve is to share the state among the components with no parent-child hierarchy.
So, to overcome all the above problems and to synchronize the state across the components Redux comes into the picture. Using this approach we store all the state globally and all other components can access it.
Redux is an open-source JavaScript library for managing the application state.
What is Redux?
- Redux is basically used for state management.
- It can be used with all javascript frameworks & libraries like React, angular, etc.
Main Elements of Redux includes:-
- Store: If you are working on a large application, the state is separated from the React components into its own store. The store is the global component that stores the current state and it is an immutable object.
- Action: State in the store is not changed directly, but with different actions.
- Reducer: It is used to define the impact of the action on the state of the application.
- Subscribe: It is used to create a callback function the store calls when its state is changed.
Redux Principles:
- The global state of your application is stored as an object inside a single store.
- The only way to change the state is to
dispatchan action.
- Changes are made with pure reducer functions.
Let's explore each one of them in detail by using a simple example:
We'll follow the following Folder structure:
📦src ┣ 📂actions ┃ ┣ 📜types.js ┃ ┗ 📜users.js ┣ 📂components ┃ ┗ 📂Users ┃ ┃ ┣ 📜index.js ┃ ┃ ┗ 📜user.css ┣ 📂reducers ┃ ┣ 📜index.js ┃ ┗ 📜users.js ┣ 📂store ┃ ┗ 📜index.js ┣ 📜App.js ┗ 📜index.js
You can find the final code in my github repo
Now we will create an application that fetches user data using REST APIs and display it using Redux.
In the end, our application will look like this:
Create a React application and install redux using
npm install react-redux --save.
Step 1: Create a User Component
In
src/components/Users/index.js file:
import React, { useEffect, useState } from 'react'; import './user.css'; export default function Users() { const [userDetails, setUserDetails] = useState([]); const handleButtonClick = () => { // make a call to Action Creator } return ( <div className="container"> <button className="btn" value="click me" onClick={handleButtonClick}> Fetch Data </button> <table> <tbody> <tr> <th>Id</th> <th>Name</th> <th>Phone</th> <th>Email</th> <th>Website</th> </tr> { userDetails && userDetails.map((item, key) => { return ( <tr> <td>{item.id}</td> <td>{item.name}</td> <td>{item.phone}</td> <td>{item.email}</td> <td>{item.website}</td> </tr> ) }) } </tbody> </table> </div> ) }
In the above code, we'll make an API call to fetch our data using REST API whenever a user clicks on the button and display the data in table format.
But before making an API call let's set up our store first.
Step 2: Create a Store
we'll create a Redux store in
src/store/index.js file:
import { createStore } from "redux"; import rootReducer from "../reducers"; const preloadedState = {}; const store = createStore( rootReducer, preloadedState ); export default store;
- The Redux core library has a createStore API that will create the store.
- We'll pass our rootReducer that we'll create in the next step as an argument.
- createStore can also accept a preloadedState value as its second argument. You could use this to add initial data when the store is created.
Points to remember:
- The store basically brings together the
state,
actions, and
reducersthat make up your app.
- You can only have a single store in a Redux application.
- Every Redux store has a single root reducer function.
Step 3: Create a Reducer
- Reducers basically tell us how to update the state based on the action performed.
- It must be pure functions & should not produce any side effects.
- It must be composed of immutable objects. If there is a change in the state, the old object is not changed, but it is replaced with a new, changed object.
Let's create our reducer in
src/reducers/user.js:
import { USER_DETAILS } from '../actions/types'; const initialState = { userDetails: {} } export default function (state = initialState, action) { console.log("Step 4: Inside User Reducer after action creator dispatches an action"); switch (action.type) { case USER_DETAILS: return { ...state, userDetails: action.payload, }; default: return state; } }
It is a function that is given the current state and an action as a parameter it returns a new state.
Now we have created one reducer but as our application becomes more complex we may need to introduce more reducers.
So in this case, we'll create the main root Reducer which will combine all other reducers used in our application.
In
src/reducers/index.js file:
import { combineReducers } from "redux"; import userReducer from "./users"; export default combineReducers({ userReducer: userReducer, //other reducers });
we can create the actual reducer for our application by combining the two or many existing reducers with the combineReducers function.
The combineReducer works in such a way that every action gets handled in every part of the combined reducer. Typically only one reducer is interested in any given action, but there are situations where multiple reducers change their respective parts of the state based on the same action.
Step 4: Share Redux Store with Components
As we have initially created our store, the next step is to make it available to all the components present in our application.
In
src/App.js file:
import React from 'react'; import store from './store'; import { Provider } from 'react-redux'; import Users from './components/Users'; function App() { return ( <Provider store={store}> <Users/> </Provider> ); } export default App;
By using this way. all the components can access the store.
Step 5: Add an Async Function Middleware using Redux Thunk
After setting up the store, now we need to make an API call to fetch our data but before this, we will add middleware to our store which enables us to create an asynchronous action.
Redux Thunk
This library is a so-called redux-middleware, which must be initialized along with the initialization of the store.
Because of this, it is possible to define action-creators so that they return a function having the dispatch method of redux-store as its parameter.
As a result of this, one can make asynchronous action-creators, which first wait for some operations to finish, after which they then dispatch the real action.
To introduce redux-thunk into our application first install it using
npm install --save redux-thunk.
Now in
src/store/index.js file:
import { createStore, applyMiddleware, compose } from "redux"; import thunk from "redux-thunk"; import rootReducer from "../reducers"; const preloadedState = {}; const middleware = [thunk]; const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const store = createStore( rootReducer, preloadedState, composeEnhancers( applyMiddleware(...middleware) ) ); export default store;
As you noticed we introduce many new terms in the above code. Let's try to explore each one of them one by one.
compose
compose is an example of higher-order functions. It takes bunch of functions as arguments and returns a new function that is the composition of all these functions.
- It is used when you want to pass multiple store-enhancers to the store.
- It composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function. for example:
compose(f, g, h)is identical to doing
(...args) => f(g(h(...args))).
store enhancers
- They are higher-order functions that add some extra functionality to the store. The only store enhancer which is supplied with redux by default is applyMiddleware.
applyMiddleware
- Creates a store enhancer that applies middleware to the dispatch method of the Redux store. This is handy for a variety of tasks, such as expressing asynchronous actions in a concise manner or logging every action payload.
- Because middleware is potentially asynchronous, this should be the first store enhancer in the composition chain.
We'll see the use of dispatch in the next step.
Step 6: Build an Action Creator
Now it's time to make an action creator which fetches data using REST APIs.
Action creators are a pure function which creates action.
Actions are plain JS objects that have a
type field and can contain additional data. It creates an event that describes something that happened in the application.
We'll declare all the
type field in a separate file
src/actions/types.js:
export const USER_DETAILS = 'USER_DETAILS';
To build an Action creator:-
In
src/actions/user.js file:
import axios from "axios"; import { USER_DETAILS } from './types'; export const getUserDetails = () => async (dispatch) => { console.log("Step 2: Inside Action Creator to make an API call"); const res = await axios.get(''); console.log("Step 3: Dispatch an Action to update the state"); dispatch({ type: USER_DETAILS, payload: res }) }
In the above code snippet, we make an API call, and as soon as we get our response we dispatch the action so we can change the state.
The store now uses the reducer to handle actions, which are dispatched or 'sent' to the store with its dispatch method.
Step 7: Connect redux store to components
We have finally done with the store setup. We are one step away so just follow up 🤓🤓.
In
src/components/Users/index.js file:
import React, { useEffect, useState } from 'react'; import { getUserDetails } from '../../actions/users'; import { connect } from "react-redux"; import './user.css'; function Users({ getUserDetails, userReducer }) { const [userDetails, setUserDetails] = useState([]); const handleButtonClick = () => { //make a call to the Action creator console.log("Step 1: Make a call to Action-creator from Users Component"); getUserDetails(); } useEffect(() => { // Update the UI as soon as we get our response through API call console.log("Step 5: Inside UseEffect of User Component to update the UI") setUserDetails(userReducer.userDetails.data); }, [userReducer.userDetails]) return ( <div className="container"> ..... </div> ) } const mapStateToProps = (state) => ({ userReducer: state.userReducer }); const mapDispatchToProps = { getUserDetails } export default connect(mapStateToProps, mapDispatchToProps)(Users);
In the above code snippet, we share the redux store with components with the help of
connect.
Higher-order components are a function that accepts a "regular" component as its parameter and returns a new "regular" component as its return value.
connect
connect method provided by react-redux is an example of Higher-order components.
connect method is used for transforming the "regular" React component so that the state of the Redux store can be "mapped" into the component's props.
It accepts two parameters:
mapStateToPropsand
mapDispatchToProps.
mapStateToProps
It is a function that can be used for defining the props of the connected component that are based on the state of the Redux store.
mapDispatchToProps
- It is a JS object of action-creators functions passed to the connected components as props.
- The functions passed in mapDispatchToProps must be action creators, i.e. functions that returns Redux actions.
As you noticed how we can pass our action creators and redux state as a parameter to the Users component.
On button click, we invoke action-creator which makes an API call and update the redux state.
In
useEffect we will monitor the change in redux state and update the UI with response data.
Finally, our React application with Redux is ready!!! 😎😎
We can use the Redux Devtools to test and debug how Redux states are changing.
You can find the final code in my github repo
Wrap Up!!
Thank you for your time!! Let's connect to learn and grow together.
LinkedIn Twitter Instagram
Discussion (8)
Hey, great introduction for beginners.
Since you are calling this a complete guide (not a "first look"), you might want to consider the following naggy points (not sure if appreciated or not):
mapXToPropsis superceded by
useSelectorand
useDispatchhooks
useState, unless you have a very good reason to. You want to keep your state management cleanly separated from your components. That is why people (claim to) use Redux in the first place. (Although this inconsistency is prevailant in many production code bases.)
reduxwas developed to help you avoid, including keeping things separate, modular and in "flux". Here is some possible inspiration: redux.js.org/style-guide/style-guide
Good luck! Keep on hacking!
I agree with all your points expect the first. The useSelector hook does not give you memoization out of the box like the connect API does. The useSelector uses strict equality while the connect API checks for reference changes between the previous and next props. To achieve the same functionality with the useSelector hook, you can wrap your component with the React.memo HOC.
@domiii Thank you for your feedback. I'll surely look into it!!
this is awesome, keep it up...
Thank you!!
Awesome, thank you for your posting.
I'm glad you find it useful!!
Nowadays Redux rarely if ever used without Redux Toolkit or Saga, so i'd say one would not call a guide complete without at least touching those subject.
Apart from that, great job.
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/anuradha9712/a-complete-guide-to-redux-hmj
|
CC-MAIN-2021-31
|
refinedweb
| 2,308
| 56.55
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.