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
In this section you will learn how to check whether a file or a directory exist or not. The " java.io " package provide a method exist() which return true or false. This method will return "true" if file or directory exist otherwise it returns "false". In the following program we will create a object of file class and check whether file or directory exist or not. import java.io.File; public class DirectoryExist { public static void main(String args[]) { File file = new File("C://Documents and Settings//satya//Desktop//Temp"); if(file.exists()){ System.out.println("File Exists"); }else{ boolean check = file.mkdir(); if(check)System.out.println("Directory Created = "+file.getName()); else System.out.println("Sorry could not create directory"); } } } Description : In the above code first we create an object of file class. Passing path as argument to the file class, will create a directory at the same position. The if condition checks for the file or directory existence in path by method exist(), that returns true if directory is already created and print "file Exist" to the console. If file is not there then exist() method will return false and control execute the else statement which create a directory by mkdir() method of file class and print the name of the directory to the console. Output of the program : If the Directory exist then the output will be as follows.: Checking if a file or directory exist Post your Comment
http://roseindia.net/java/beginners/java-directory-exists.shtml
CC-MAIN-2016-30
refinedweb
242
55.64
I'm creating a reusable library that targets several platforms (.NET 4.0, .NET 4.5, .NETStandard 1.0 and .NETStandard 1.3). The .NET 4.5 version of this project contains some features that are not available under the .NET 4.0 version. The unit test project that references this library project has one single target platform, namely NET 4.5.1. This test project obviously contains some code that tests the .NET 4.5 specific features of the core library. Unfortunately however, the test project does not compile, because Visual Studio seems to reference the .NETStandard 1.0 version, which obviously does not contain this feature. To demonstrate my problem, I reduced this to the following two projects: Core library: { "version": "1.0.0-*", "frameworks": { "netstandard1.0": { "dependencies": { "NETStandard.Library": "1.6.0" } }, "net40": {}, "net45": {} } } namespace CoreLibrary { #if NETSTANDARD1_0 public class ClassNetStandard { } #endif #if NET40 public class ClassNet40 { } #endif #if NET45 public class ClassNet45 { } #endif } { "version": "1.0.0-*", "dependencies": { "CoreLibrary": { "target": "project" } }, "frameworks": { "net451": {} } } // This compiles new CoreLibrary.ClassNetStandard(); // This doesn't. // error: Type or namespace 'ClassNet40' does not exist in namespace 'CoreLibrary' new CoreLibrary.ClassNet40(); // error: Type or namespace 'ClassNet45' does not exist in namespace 'CoreLibrary' new CoreLibrary.ClassNet45(); There seems to be a bug in Visual Studio tools for .NET Core. When you reference multi-framework project from another one - Visual Studio only takes first listed framework from a list (in your case - "netstandard1.0") and treats that referenced project as single targeted for this framework. However, compiler handles this correctly, and while it seems that project builds correctly - in reality it does not. On the other hand, when you use ClassNet45 definition - it seems that it does not compile (Visual Studio shows errors) - it really does compile successfully. It seems that Visual Studio tools for .NET Core are not polished enough yet, but probably this bug will be resolved in some near future.
https://codedump.io/share/5riaGjs1htUz/1/how-to-let-a-visual-studio-2015-xproject-projectjson-reference-the-highest-framework-of-a-depending-project
CC-MAIN-2016-50
refinedweb
319
57.87
RationalWiki:Saloon bar/Archive281 Contents - 1 A timecube... documentary(?) video - 2 Trump and Jerusalem - 3 While I'm not Canadain I don't quite know how I should feel on this - 4 Was Airline Deregulation good or bad? - 5 Anyone tired of hearing about sexual assaults in the media? - 6 Put out the fire! - 7 Why is the term Orient offensive? - 8 Merging Iron Chariots Wiki (sticky) - 9 Ransomware "customer service" - 10 Medical Education: Current Standards or based on pure competence? - 11 RationalWiki Community Survey 2017 - 12 Fundies are their own worst enemy - 13 Your Thoughts on UBI? - 14 Nationalist China - 15 Dumpster dive - 16 As 2017 draws to a close, let's reflect on the positives and negatives in the world - 17 Doug Jones wins Alabama special senate election - 18 Founded some pretty Biased looking video from some Aussie Called "Suit Yourself" - 19 User GrammarCommie reverting without discussion - 20 Is trinitarian Christianity polytheist? - 21 Rationalwiki on Twitter - 22 Irony - 23 Do Neo-Nazis have anything better to do than trolling Rationalwiki? - 24 say no to drugs - 25 What's the Appeal of Cults? - 26 thealternativehypothesis.org we need an article and some serious refuting. - 27 A message on my talkpage - 28 White nationalists finally getting banned on twitter - 29 Current dumpster dive - 30 Solstice holydaze - 31 Something tells me this will be the slippery slope argument for U.S gun control - 32 Homeopaths Scientists create an ultradilute quantum liquid - 33 So do Republicans just think when it's said "Black people can't be racist." that that just defeats acual racism - 34 Are these still relevant joke videos? - 35 RZ94's Official Bullshit Scale (Patent Pending) - 36 Vote: Who has the best userpage on Rationalwiki? - 37 Merry Christmas to Rationalwiki and to all a good skepticism! - 38 Found this gem shared on Quora a few hours ago - 39 The Bible is more violent than any horror or disaster film I have ever seen in my 23 years of life - 40 A wiki / database of company ethics? - 41 Midday nap - 42 Quotebox removing linebreaks - 43 Gematria - 44 Counter these arguments - 45 Spitting Image - 46 Paul Nehlen - 47 I can already Imagine the the "Liburl Sjw's are destroying Christmas." Argument - 48 I feel this video might be slightly Anti-Union,but I'm not sure? - 49 Trump recently tweets about Global Warming - 50 Your thoughts on this article? - 51 Your thoughts on this video? - 52 Evolution and Red Giant Stars - 53 Does that CAPTCHA continue to pop up for everybody each time one posts something? - 54 Question about recycling - 55 So long and thanks for all the fish (redux) - 56 Cal Cooper - 57 Flat Moon BS - 58 Syrian War Media Coverage - 59 Net neutrality has been repealed - 60 The point is, part 3 - 61 Anything wrong with being obsessed with the concept of societal collapse? - 62 Drug Education- counselors and educators should stick to the facts - 63 Manual archiving - 64 Happy New Year! - 65 Your Thoughts - 66 Pedantry - 67 Do we have an article of plant music? - 68 RZ94's potential projects for 2018 - 69 Clinton and Trump are equally unpopular - 70 Vote LeftyGreenMario for Moderator! She is the best candidate! - 71 Idea: draft namespace - 72 Evangelism in Xmas - 73 What are the causes of the proxy conflict between Saudi Arabia and Qatar? - 74 Community survey results - 75 Can we make usernames more strict? - 76 Proposed rules to govern AFD - 77 Jesus as a Mary Sue A timecube... documentary(?) video[edit] So this was recently uploaded, and it was interesting to me, so I thought other people might like to see it: I've known of and tried to read timecube before but I never knew much about the guy behind it and hadn't heard him speak or anything, this video goes into a fair amount of detail on all that and does some decent digging around to find old clips and speeches and such he's given. I wasn't sure whether to put this on the timecube/Gene Ray page but it seems generalised enough that it should go here instead. Anyway, enjoy 45 minutes of trying to make sense of the nonsensical. X Stickman (talk) 22:03, 30 November 2017 (UTC) - I love Time Cube rants, they're always good for a laugh. GrammarCommie (talk) 22:18, 30 November 2017 (UTC) - I don't really find Time Cube funny, Ray was clearly ill. Christopher (talk) 16:46, 1 December 2017 (UTC) - After enduring listening to 20-odd minutes of Michael Hughes' interview with a flat Earther, I wondered whether crank magnetism is indicative general mental illness. Bongolian (talk) 03:59, 7 December 2017 (UTC) Trump and Jerusalem[edit] Self-explanatory. Thoughts? @Aeonian? RoninMacbeth (talk) 00:07, 7 December 2017 (UTC) - Would people have supported him if he had recognized Jerusalem as the twin capitols? - At the moment, waiting for the other shoe to drop. So far, just the usual effigy and picture burning, but I'd have expected a riot or two. As for long term consequences, I get the impression that most of the most offended people are people that weren't exactly friendly to the US to begin with, so I'm not exactly sure if much drastically changes as a result of this. CorruptUser (talk) 00:33, 7 December 2017 (UTC) - There is some question as to whether it matters what the US recognizes as long as Trump is the President. None of the US allies will follow.Ariel31459 (talk) 15:43, 7 December 2017 (UTC) - Correct me, but as commented in Patheos ( this looks like a gift from Donald DuckTrump to those Fundie friends of him (you know, prophecies and all that stuff). Panzerfaust (talk) 00:20, 8 December 2017 (UTC) When isn't there violence in the middle east?[edit] Not trying to sound right wing but, there is always violence in the middle east. Not matter what- treaties, supporting Israel, aganist Israel, supporting Kurdish people, against Kurdish people, peace keeping efforts, giving money, and so on. It does not matter. Might be wrong but all I hear is about violence in the mid east. --Rationalzombie94 (talk) 02:01, 7 December 2017 (UTC) - Yes and no. A lot of the violence ongoing is a result of the Iranian revolution (which was secretly supported by Carter), in that they keep funding every other insurgency in the region. Without them mucking things up, a very uneasy peace could have been possible. To be fair, we still haven't quite learned never to trust the religious nutters, so you can't really fault him too much for that. Also to be fair, the revolution was in part because of British and American greed, plus cold war geopolitics, so we aren't exactly innocent. Saudi Arabia gets more blame than they deserve, and while their funding of the Salafi madrassas is probably the second largest roadblock to peace, well ok they deserve a huge amount of blame but not quite as much as they receive. Going forward, well, I'd really love a Kurdish state, but that's not going to happen while Turkey has any say in that. CorruptUser (talk) 03:00, 7 December 2017 (UTC) - 'in part because of british and american greed...' - entirely because of british mand american greed. we installed the shah. AMassiveGay (talk) 11:44, 7 December 2017 (UTC) - This is stupid, USA didn't get any financial change from that except more debt. You did it as part of your plan to use religious theocracies to combat the spread of Marxism in the Middle East. Lord Aeonian (talk) 20:02, 7 December 2017 (UTC) - Well, no. Iran wanted to nationalise their oil industry. Since AIOC was a british concern we werent too happy with that. The marxist thing is just what we told the americans to get them to stick their oar in. so, yeh basically greed. AMassiveGay (talk) 00:51, 8 December 2017 (UTC) - Cannot explain Western support of theocracies in all the countries conspicuously lacking oil resources, nor those without the infrastructure to harness their oil resources for that matter. And I find it hard to believe anyone was told about the Cold War element, since every Westerner I come across parrots the oil narrative without delay. Lord Aeonian (talk) 04:34, 8 December 2017 (UTC) - wasnt trying to, just the shenanigans in iran and how easy it was to get the yanks to do the dirty work if you tell em reds are involved. AMassiveGay (talk) 00:42, 10 December 2017 (UTC) - And also 'Mrs Smith had a peaceful/enjoyable day' is not news but 'Something terrible/YouTube meme happened to Mrs Smith' is. - With #most# inhabited places in the world if you want to film a documentary 'There is (much unpleasantness and problems) here' you can do so - and also a travel documentary 'The delights of charming Olde Worlde Y' etc. 2A00:23C4:F505:4F00:8DE:2F0D:9B70:A697 (talk) 12:03, 7 December 2017 (UTC) Don't forget the Saudis. $2-3 billion a year funding Wahhabism. Of course, now it seems to be coming back to bite them in the ass.Teurastaja (talk) 12:59, 7 December 2017 (UTC) To answer your question, both sides could have come to an agreement long ago but it is fundamentally an ethno-religious conflict, and so there is no room for compromise because you don't "compromise" with the kuffar. Lord Aeonian (talk) 20:02, 7 December 2017 (UTC) While I'm not Canadain I don't quite know how I should feel on this[edit] More sources would also be appreciated also. ShiningSwordofThoughts (talk) - Sounds like the longer debate in the UK about how to deal with British ISIS fighters, which ranges from calls by right-wing politicians and populist media for them all to be shot[1][2] to calls (particularly from Muslims) for them to be rehabilitated[3][4]. The British government already has deradicalisation programs that people can be forced to attend.[5][6] There's a lot of teenagers, including some women/girls, going out there and realising it's not what they thought it would be like and wanting to come home (but Isis isn't too keen on that);, the authorities have declined to press charges against at least one young man who joined Isis but changed his mind.[7] Jailing them isn't ideal because prisons are one of the main places that Muslim terrorists are radicalised.[8][9] And the security services don't have a good record when it comes to monitoring returning people and stopping them turning to terrorism.[10] The obvious solution is to do what the justice system does (or tries to do) in other situations, not treat everybody the same but differentiate hardened terrorists from kids who've gone astray. --Gospatric (talk) 10:00, 8 December 2017 (UTC) Was Airline Deregulation good or bad?[edit] ShiningSwordofThoughts (talk) 01:35, 8 December 2017 (UTC) - An absolute catastrophe. I refuse to fly. Why would I buy a ticket if the ticket isn't guaranteed to get me a seat on the flight I bought it for? Why would I buy anything without some assurance that the advertised price is actually what it costs? These problems are compounded by the humiliating 'security' pantomime, of course. - Smerdis of Tlön, LOAD "*", 8, 1. 18:00, 8 December 2017 (UTC) - Anytime I see "deregulation" I think "open gates for the free market to screw everyone over". --It's-a me, LeftyGreenMario!(Mod) 04:43, 9 December 2017 (UTC) - Or basically "deregulation" is a recipe for disaster. S.H. DeLong (talk) 08:01, 9 December 2017 (UTC) - Counterpoint: the deregulation of alcohol. There's a reason there's been an explosion in microbrews in the past few decades (in the US at least). Mock hipsters all you want, but there is no compelling reason to prevent hundreds of varieties of beer from existing. Radioactive afikomen Please ignore all my awful pre-2014 comments. 09:19, 9 December 2017 (UTC) - All depends the way said deregulation is executed and the presence of laws that control it (for consumer protection, safety, etc), as well as those that prevent the formation of oligopolies, etc (things free market bullshitters despise despite being common sense). That said, essential services (water, electricity, etc.) should not be deregulated or at the very least laws to protect those who are in poverty, so they can have access to them, must exist. Panzerfaust (talk) 14:01, 9 December 2017 (UTC) I think deregulation usually winds up badly, either as a confusing maship or what is a natural monopoly (i.e. the "fake markets" like utilities) or gratuttious price gouging and asset stripping of former state bodies, or the exploitative shitfest that is outsourcing. However, I think airlines are one, perhaps pretty much the sole, exception to this. Whilst there definitely needs to be some - and more - regulation of aspects of the airline industry when it comes to passenger rights and also minimum acceptable physcial conditions on board (i.e. minimum seat pitches and widths to ensure safety and wellbeing) - the overall reregulation *has* led to a lot of new routes opening (especially in the EU), *much* lower fares and way more choice of carriers. Another thing I would point to is the simplicity of the ticketing mechanism for airlines. I can buy a ticket online for an inter-continental flight and show up, no paper tickets of any kind needed - all done from a phone or computer. Compare this with booking train tickets in Britain, which have also been privatised and somewhat reregulated, and you do get one good example of how deregulation *can* work.... and how it - far more often - doesn't. TheEgyptian¿Dígame? 15:11, 9 December 2017 (UTC) Anyone tired of hearing about sexual assaults in the media?[edit] I cared the first hundred times I heard about sexual assaults to people when reading media. But like murder cases, I simply stopped giving a shit about it. While I'm proud that the victims are stepping forward, does the media need to be a mouthpiece for it? Is this an unpopular opinion? Maybe.—Hamburguesa con queso con un cara (talk • stalk) 20:41, 21 November 2017 (UTC) - Funnily enough, I have the same weariness of hearing sexual assault case after sexual assault case. I'm hoping the "coming out" allegations the media loves to lap up doesn't backfire or start having a jaded effect on people. --It's-a me, LeftyGreenMario!(Mod) 20:46, 21 November 2017 (UTC) - Yes, I think the media does need to be a mouthpiece for it, even at the risk of backfiring. In many cases, the victims have few alternatives when the statute of limitations has expired for the victimizer but the risk of libel upon the victims is ever present. The multiple public accusers at once approach gives weight to the evidence and reduces the likelihood of libel proceedings. Bongolian (talk) 22:01, 21 November 2017 (UTC) - This is an inevitable feeling and the news media recognizes that feeling and will soon back off on pursuing other major sexual assault claims for a while. Which... I guess is just how life goes. Hopefully some kind of systemic progress was made in this burst of activity, but I'm not holding my breath. ikanreed 🐐Bleat at me 22:36, 21 November 2017 (UTC) It's really fucked up. I want to hear more women testify against guys like Moore, but then I realize I'm hoping for more human misery to be found. At the end of the day, exposing the misdeeds of only significant persons may accomplish nothing for women. When it comes to the manager at McDonalds, who cares in the media?Ariel31459 (talk) 00:06, 22 November 2017 (UTC) - Reporting crime to law enforcement is perfectly normal. I am, however, a little disappointed to see that many people have forgotten that the accused remains innocent until they confess or are proven guilty. Nerd (talk) 00:34, 22 November 2017 (UTC) - i believe i have mentioned before about how deeply uncomfortable i am with the way these allegations are reported. i am deeply uncomfortable with allegations like 'he put his hand on my knee at a dinner party' being reported as the same ball park as 'he raped me'. I am deeply uncomfortable with the way these allegations are presented not as allegations but as fact, that a mere allegation will result in the destruction of careers. these are allegations that have not resulted in court cases, have not resulted in police investigations. the reporting of the reporting of these allegations seem to me to make it impossible that any could wind up in court - how could any of the accused hope for a fair trial when they have been declared guilty so comprehensively in news media. i cannot investigate these claims - i am not the police, i cannot even question them. we are told we must believe the victims of sexual assault. we must not doubt them. thats all well and good if an appropriate party ie the police, then goes on to investigate the claims, but here there are few or no investigations. claims are made, regurgitated verbatim thoughout the news media and we cannot question them. to do so makes us monsters. any claims of literally anything else, we would question them. any other claim from a group people i would not trust to accurately describe their breakfast i would read with a raised eyebrow and a hefty pinch of salt at the he said/she said. i am not comfortable to do so here. some of the claims are horrific. some of the claims are so minor that id question that it was even sexual assault/harassment. some are just plain outlandish. i understand that statute of limitations makes this the only option for many of the victims, but is this really the way to go? there are so many claims, about so many people, they cant really all be true can they? someone said the risk of libel is a very real threat to the accusers - is it though? the accused could win but their career and reputation would still be trashed. i am uncomfortable about all of this. i uncomfortable withn the fact that i am convinced of the guilt of some these people purely because i read report of an allegation. i am uncomfortable that i could be excusing some truely awful crimes. i fear the deluge of claims will become so widespread, so common, that while kevin spacey is airbrushed from his films and weinsteins career is finished, a year from now we will read about some star groping an extra and go straight and watch his latest box office smash. we will believe the claims if we dislike the person, if we like them we'll and believe its just a publicity seeker. but i guess thats the status quo - michael jackson died a paedophile while statutory rapist david bowie died a rock legend. i just dont see how justice is served by this perfect storm of celebrity and righteous indignation when the end result is likely not just a jaded public, but a disbelieving oneAMassiveGay (talk) 01:56, 22 November 2017 (UTC) - I hate the way this country treats artists. What would contemporary America do to Van Gogh or Picasso, I wonder? - And to the extent I am a liberal, I am an old fashioned ACLU liberal. Due process and the presumption of innocence are more important to me than any moral panic, no matter how 'feminist' it is. - The other thing that occurs to me is that it's much easier to wrong-foot Democrats and liberals by this sort of thing. - Republicans and right-wingers will, of course, circle the wagons, as we're seeing in the case of Roy Moore. For Alabama voters, the choice between a child molester and a liberal is a difficult moral quandary. Roy Moore may have chased children, but he stands up for the piss-ant god they worship down there. - On the other hand Democrats have to at least pay lip service to "feminism", whatever it means anymore. These things target key Democrat constituencies. They implicate Democratic human-resources pieties and 'professional' standards. They have invested a great deal in that kind of elite etiquette. It's much harder for them to shake off these charges levelled against their leadership, no matter how stale or how trivial they may be. There isn't a level playing field when it comes to this sort of carrying on. It didn't get Hillary Clinton elected, for one thing. Then again, she was a uniquely compromised bearer of any message about men behaving badly. There does come a time when you have to swallow everything you've been taught and root for the home team. - Smerdis of Tlön, LOAD "*", 8, 1. 02:34, 22 November 2017 (UTC) - this is an interesting read AMassiveGay (talk) 22:20, 23 November 2017 (UTC) - Yes Hamburger. What could be more tedious than famous popular figures and politicians being exposed for sexual harassment and rape. I certainly don't want to hear more about hundreds of women putting their career and personal lives on the line to expose predators and hopefuly put a permanent door stop in front of extreme apathy and disbelief of abuse. What could be less interesting than a major social shift slowly unraveling. Every time I read about a new public figure denounced by a dozen women, I'm like...hello...that news is like so October 2017! My greatest hope is that the whole story just goes away and we can get back to not giving a shit about murders and political corruption and police abuse and banking fraud. 87.218.198.157 (talk) 02:45, 24 November 2017 (UTC) - Well, you're not wrong (going by your intent because you're obviously being sarcastic).—Hamburguesa con queso con un cara (talk • stalk) 04:07, 24 November 2017 (UTC) - I've seen 'believe the victims' before. It tends not to end well. Inviting people to re-remember thirty year old memories as outrages they weren't at the time, and then using these half-remembered tales to destroy the careers of a variety of public figures, couldn't possibly go wrong, now could it? - Smerdis of Tlön, LOAD "*", 8, 1. 18:34, 24 November 2017 (UTC) - But why now? Why do people have to wait until after someone is famous to raise accusations?—Hamburguesa con queso con un cara (talk • stalk) 18:49, 24 November 2017 (UTC) - Is that really what is happening? In the Roy Moore case, many of the victims had told people about Moore's behavior long ago. It is only recently that media bigwigs have been sending their reporters out to look for them. "See? The system works," etc.Ariel31459 (talk) 14:48, 25 November 2017 (UTC) Roy Moore is an outlier here. AFAIK he doesn't have a talent that ought to cut him some slack. He also has the whole hypocrisy going for him: he wants to regulate other people's sex lives, which I'm against as well. (And I try to make that principle a 'seamless web'.) He's exceptionally easy to hate, which lends his accusers credibility if you hate him as well. He still deserves the same grace of due process, and leaving the distant past lie, that everybody else deserves. - Smerdis of Tlön, LOAD "*", 8, 1. 18:37, 25 November 2017 (UTC) - I think that this is a good thing. The media coverage of Cosby and Trump and Ailes and O'Reilley and Moore and Franken, etc. does pose the danger of making us jaded but maybe making this commonplace is not a bad thing. Women did not speak up at the time because they feared that they are alone or that they would not be supported. Perhaps, if harassment is recognized as commonplace, women will not be as reticent to speak up. That doesn't mean we shouldn't draw a distinction between President Bush Sr and (the allegations against) Moore -- Taking advantage of being in a wheelchair to make a lewd remark is not on the same level as what Moore is accused of -- but I hope this all leads to women (and girls, in Moore's case) feeling empowered to act, should they find themselves in similar situations (albeit, one action would entail a reprimand and the other would hopefully entail arrest) --Bertrc (talk) 22:45, 28 November 2017 (UTC) - And now Senator Al Franken has resigned because of this crap. I wonder if the 'feminists' realize that they've scored an own goal. - Smerdis of Tlön, LOAD "*", 8, 1. 19:31, 7 December 2017 (UTC) - Yes, I just hope the senate democrats didn't push Franken out thinking it could make Alabama voters come to their senses. Moore may not win, but I doubt the Franken affair will will have anything to do with it.Ariel31459 (talk) 01:51, 8 December 2017 (UTC) - I'm okay with Franken's move. His statements and his actions have been exemplary; I can't imagine this not, ultimately, driving us in the right direction. I always tell the young'uns to show patience so I guess it is time for me to practice what I preach. Times like this remind me why I am glad I'm a Christian. Faith that God can not only fix the messes we make, but actually transform them in their entirety (even, retroactively, the making of the messes, themselves) into something good keeps me from despair. ;-) :-P~ :-D I just hope we don't have to be stuck in this Babylon for 70 years . . . --Bertrc (talk) - If the criminal justice system decided to proceed against what Franken actually did, it would have gotten pled down to a minor misdemeanor at most. And that would be the correct resolution by law and precedent. This is how we reward someone who gave up a life of successful minor celebrity to serve his country. If this is what feminism demands, then fuck feminism. - Smerdis of Tlön, LOAD "*", 8, 1. 04:43, 11 December 2017 (UTC) Put out the fire![edit] This week's flaming bag of garbage is Angela Merkel. —Goat-Emperor Bigs (Words of Wisdom/Achievements) 20:04, 4 December 2017 (UTC) - Weren't most of the attacks either committed by people who entered the country before 2015,or had been raised in the country? ShiningSwordofThoughts (talk) - @ShiningSwordofThoughts RW:DUMP —Fake News™ (talk/stalk) 03:44, 5 December 2017 (UTC) - Angela Merkel is quite possibly the world's least interesting politician. - Smerdis of Tlön, LOAD "*", 8, 1. 17:29, 5 December 2017 (UTC) - I see your Merkel and raise you 1 Emanuel Marcon. ikanreed 🐐Bleat at me 17:31, 5 December 2017 (UTC) - interesting politicians usually means a shit show. good politics should be tedious AMassiveGay (talk) 00:41, 7 December 2017 (UTC) - Probably just being a devil's advocate because this is rationalwiki and we all do it, but tedious politics usually means a disinterested electorate, leaving only the spite voters to decide everything. And then you get a trump. ikanreed 🐐Bleat at me 18:29, 7 December 2017 (UTC) - the political climate has been far from mundane in the US long before trump. Probably more of a contributor to trump than a disinterested electorate. AMassiveGay (talk) 19:55, 11 December 2017 (UTC) Why is the term Orient offensive?[edit] I just thought why is reffering to someone as Oriental a bad thing? I can really only see it offensive in the sense that it generalizes a large group of people.— Unsigned, by: ShiningSwordofThoughts / talk / contribs 16:25, 11 December 2017 - Firstly, please sign your posts on talk pages with ~~~~ (usually shift and the key above the left tab). That'll automagically sign you username with a timestamp. - I googled your title, got the following; The basic reason is it was used as a slur for long enough to become one, and hasn't been reclaimed even to the extent that the quite analogous n* has been.Daev (talk) 09:47, 11 December 2017 (UTC) - PS The term 'Orient' not so much offensive as out-dated. Referring to someone as '(an) Oriental' is the problematic usage.Daev (talk) 09:53, 11 December 2017 (UTC) - It also seems to be a problem that only exists in North American English. Does anybody refer to Middle Easterners as 'southwest Asians?' - Smerdis of Tlön, LOAD "*", 8, 1. 16:31, 11 December 2017 (UTC) - So are these people offside? Anna Livia (talk) 16:48, 11 December 2017 (UTC) Merging Iron Chariots Wiki (sticky)[edit] Older RatWiks may know that RW merged in EvolutionWiki, a wiki dedicated to documenting evolution science and debunking intelligent design / creationist arguments, after that site became inactive and lost the funds to host itself (see EvoWiki and RationalWiki:EvoWiki). Iron Chariots Wiki appears to be on route to suffer the same fate. Iron Chariots is an explicitly atheist wiki dedicated to documenting arguments for and against god and about atheism in general. The site hasn't had any edits since September 6 -- two months ago. The forums are offline. The bottom of every page proudly displays two PHP error messages. Relevant links: - List of administrators (many of whom are on the Atheist Experience podcast) - The only active editor (and only active admin) in the past 3 months - The site doesn't appear to have explicitly copyrighted anything In short: the site has gone Citizendium'd. Do we want to try to contact Iron Chariots Wiki and merge in their content? (@Tmtoulouse, @David Gerard, @Human, @Reverend Black Percy, @Spud) Mʀ. Wʜɪsᴋᴇʀs, Esϙᴜɪʀᴇ (talk/stalk) 14:07, 6 November 2017 (UTC) - I would have no objections. SpacePriusIs always watching 15:49, 6 November 2017 (UTC) - My opinion is irrelevant but I'd say yeah. Christopher (talk) 16:57, 6 November 2017 (UTC) Copyright is the issue. Everything is born "all rights reserved" by default. If it wasn't under any licence, we have a problem unless we get permission from each individual contributor. (We sort of arsed it through with EvoWiki ...) - David Gerard (talk) 17:15, 6 November 2017 (UTC) - It appears to be licensed under Creative Commons but it's an earlier version (2.5, we're 3.0) theirs and ours are compatible though aren't they? Christopher (talk) 17:38, 6 November 2017 (UTC) - It looks like copyright isn't a problem. OK. Merge them into us and salvage anything useful from them. Spud (talk) 18:00, 6 November 2017 (UTC) - @Christopher Thanks for finding that. The Iron Chariots Wiki license is CC-BY-SA-2.5, better if anything than EvoWiki's CC-BY-NC-SA-1.0, and definitely compatible with our CC-BY-SA-3.0. Herr FüzzyCätPötätö (talk/stalk) 19:10, 6 November 2017 (UTC) - It seems like a reasonable merge to me and can follow the strategy used for EvoWiki. What we did with EvoWiki was to move EvoWiki onto our server then have it exist there for the duration of the porting process. Editors who were interested would take non-stub pages and convert them into RW style within RW and include a category link indicating that it was ported (Category:EvoWiki ports). After the port was complete, the EvoWiki page was replaced with a redirect to the corresponding RW page. @FuzzyCatPotato knows the details of this better than I do. Bongolian (talk) 19:15, 6 November 2017 (UTC) - If the copyright issue can be solved (and it looks like it can) this sounds like a decent idea. Boredatwork (talk) 19:48, 6 November 2017 (UTC) - Soounds good to me! RoninMacbeth (talk) 20:17, 6 November 2017 (UTC) - Let's do it. —Goat-Emperor Bigs (Words of Wisdom/Achievements) 23:52, 6 November 2017 (UTC) I'm glad there is interest in this getting done. I was the main contributor to IronChariots over the last few years. I have not had any response from the server admin Russell, my main contact, on updating Mediawiki software or getting more disk space, which I suspect is the underlying problem. They don't seem to have the time to commit to the project although Matt Dillahunty occasionally plugs the site. I'm still wondering what my involvement will be or what will happen to the site eventually. I will consider continuing to work on this within RationalWiki but the tone of RationalWiki is a little different :) TimSC (talk) 21:50, 7 November 2017 (UTC) - You're welcome to stay here, good sir. RoninMacbeth (talk) 22:55, 7 November 2017 (UTC) - If the site owners have no issues, go ahead. — Unsigned, by: 195.235.239.101 / talk There are a few issues. The first, and most obvious, is whether the current owners think such a merger would be appropriate. The second is the fact that RW is not explicitly an atheist site. To all intents and purposes it is, but we have historically avoided describing ourselves as such. I'm guessing that would have to change if we incorporate Iron chariots. There is the question of the differing tone of the two sites - though RW's tone seems to be rather less jokey these days. Finally there is the question of the work involved in incorporating the material. Saying "let's do it" is fine, but are those who are in favour also volunteering to do the work incorporating the articles? Bob"Life is short and (insert adjective)" 11:10, 8 November 2017 (UTC) - There may be a plurality of non-believers on RW, but it is by no means an atheist site. There are other users here with a variety of religious beliefs. It should also be noted that some religions are not incompatible with atheism (e.g. Hinduism). I think that regarding the tone difference between the two wikis, it would be worthwhile, @TimSC, to compare the tone in our Category:Logic pages, which I think tend to be more in line with those at Iron Chariots (lower levels of snark). Bongolian (talk) 21:38, 8 November 2017 (UTC) - I had similar thoughts, but we do actually have pages for a lot of the same topics as Iron Chariots already. They fit in with RW's mission in the sense that these arguments often invoke pseudoscience or questionable logic. (There are also already some pages on RW that seem to exist primarily because people here are interested in atheism and apologetics, rather than because they directly relate to RW's "mission" regarding crank ideas.) With some tweaks, we could absorb much of Iron Chariots without making RW any more atheist-leaning than it already is. - I think that the real problem is that the TAE folks probably wanted Iron Chariots to be viewed as a somewhat "scholarly" resource, and RW's snark would undermine that image. So even if they're OK with content being copied over, they might not want Iron Chariots to be swallowed whole byformally merged into RW. Quantheory (talk) 00:13, 9 November 2017 (UTC) I have IronChariots (and RationalWiki) pages linked in several easy copy pastas I give to people to refute certain categories of arguments or teach them the underlying logic; IC sometimes covers thing in greater depth than RW and for my purposes I IC's tone is much better. I suspect many others share my appreciation for a "scholarly" go to resource to refute theistic claims; on RW you're always two clicks away from goat jokes. Lord Aeonian (talk) 23:26, 10 November 2017 (UTC) Decided to actually have a look at it, and there seems to be some good info. I think our main issue is lack of organisation, no doubt most of their pages are similar to ours but look! It's so organised! —Kazitor, pending 11:14, 11 November 2017 (UTC) - I have no strong interest in atheism, myself. But given that we appear to have reasonably congruent articles on most of the subjects they cover, it might help just for the sake of priorities to make note of articles they have that we don't. - Smerdis of Tlön, LOAD "*", 8, 1. 01:52, 20 November 2017 (UTC) This comment is to prevent archivist from archiving for a while. —Kazitor, pending 04:27, 12 December 2017 (UTC) Dropped?[edit] The original thread's been archived. Just wondering, has this idea been dropped? 87.192.220.205 (talk) 15:54, 17 November 2017 (UTC) - It shouldn't have been -- Archivist is acting up. Fuzzy "Cat" Potato, Jr. (talk/stalk) 16:22, 17 November 2017 (UTC) - Reminder to self Cømяade FυzzчCαтPøтαтø (talk/stalk) 23:29, 23 November 2017 (UTC) Aww[edit] Your little atheist playgrounds can't survive on their own? What ashame. :P 73.91.2.168 (talk) 03:49, 6 December 2017 (UTC) - The size of one's fanbase does not necessarily correlate with how correct they are. ΛίνΡ (ομιλία) (συνεισφορές) @ 03:54, 6 December 2017 (UTC) - Never said it did, but remember that next time numbers are in your favor. 76.3.172.194 (talk) 03:58, 6 December 2017 (UTC) - They want a resume in order to edit it. No wonder they are practically dead. Good riddance, one less cesspool on the internet. 76.3.172.194 (talk) 04:06, 6 December 2017 (UTC) Ransomware "customer service"[edit] Here's an interesting report from last year that I just stumbled on: a evaluation of the "customer service" provided by 5 different ransomware "families".[11] Bongolian (talk) 05:09, 9 December 2017 (UTC) - It is bad when criminals can provide better costumer service. --Rationalzombie94 (talk) 15:26, 9 December 2017 (UTC) - Ah, I see these crooks plan their crimes with sustainability. This is both impressive and deeply saddening. GrammarCommie (talk) 16:03, 9 December 2017 (UTC) - It makes sense. If they provide good customer service - something that's difficult to find from legitimate businesses - their marks are much more likely to come back. But I agree with the above, very depressing. 98.110.112.28 (talk) 16:21, 9 December 2017 (UTC) - Onion marketplaces have a couple websites, such as deepdotweb.com, to rate markets that can sell illegal content. So yes, this is a thing.—Hamburguesa con queso con un cara (talk • stalk) 21:51, 9 December 2017 (UTC) This should be a lesson to businesses[edit] Provide better services. --Rationalzombie94 (talk) 14:05, 12 December 2017 (UTC) Medical Education: Current Standards or based on pure competence?[edit] Watching Grey's Anatomy, the character George O'Malley fails his intern exam by one point and stays an intern yet is a good doctor. That leads to my question: Should medical education be based on competence? It just got me thinking about it. What do you think? --Rationalzombie94 (talk) 00:37, 10 December 2017 (UTC) - "Should medical education be based on competence?" I don't don't understand the question as worded.Bob"Life is short and (insert adjective)" 20:12, 10 December 2017 (UTC) Reworded: Should there be less emphasis on paper tests and more on practical skill?[edit] I think that professional education should be based on if you can do the job than doing a test --Rationalzombie94 (talk) 18:10, 11 December 2017 (UTC) - I want my doctor to be thoroughly versed on as much as possible (an enormous human brain library of every tiny corner of the body, problems with the body, treatments, medicine, side effects, alternatives, risk and so on. My friends who studied medicine basically said they had to memorise enormous lists of body parts, chemicals, treatments etc and that it is all very useful. - As far as I know...the practical part starts once someone is a resident. They begin by observing and doing very little and then spend a few years doing increasingly more important tasks. And once that is over, at least in the European countries I know, you still have a couple years as an initiate before you can take your final training and examination in the specialty you decided. I am not sure you have to prioritise either. Studying enormous lists of theory first. Practice later (with some more theory on the go), back to studying a topic deeply, then practice with some more studying. A doctor never stops studying and is constantly adapting to changes in medicine. This is all second hand information but my various friends who went through the residency say it makes sense. 87.218.199.123 (talk) 18:52, 11 December 2017 (UTC) - Here's your(Ratzombie's) problem: thinking critically and understanding the world through application of theory are important skills that have very little to do with most careers but positively affect people. Tests aren't a particularly powerful way to examine that, neither are homework, nor essays, or presentations. But in aggregate, they show something about what students are taking away from a class. You don't want to live in a world of job-doing robots, especially since actual job-doing robots are just over the technological horizon. ikanreed 🐐Bleat at me 19:36, 11 December 2017 (UTC) - I am a rat now? I am cool with it. Anywho, I didn't mean getting rid of tests. I am just saying- focus more on practical skill on the graduate level. Undergraduate testing, I have no problem with. I admit I worded what I meant wrong. --Rationalzombie94 (talk) 14:04, 12 December 2017 (UTC) - But ... at some point you have to assess how good that skill is. You need some way to assess it, some way to test it. - I suspect that what you are getting at is something like the difference between practical skill and abstract knowledge. - But (I suspect) that the balance between the two things will be different depending on the specialty. (This is also going to be true in other areas of life in addition to medicine.) For example if you are a surgeon a taxidermist or a pianist than practical physical skill is going to be at a premium - though obviously theoretical knowledge is needed too. On the other hand if you are a pneumologist an academic historian or a musical composer then actual physical skills will be less important. - But even if you only focus on physical skills - you're still going to have to test those skills if you are going to give people qualifications. Bob"Life is short and (insert adjective)" 21:31, 12 December 2017 (UTC) RationalWiki Community Survey 2017[edit] I want to know more about who actually writes RationalWiki. To that end, I made a community survey (RationalWiki Community Survey 2017) that covers identity, religion, and politics sections. The religion and politics sections are both based on academic literature, so I'm interested to see how RationalWiki fares (results here). If nobody has any objections, I'd like to put the link into MediaWiki:Sitenotice for a week or so. Mʀ. Wʜɪsᴋᴇʀs, Esϙᴜɪʀᴇ (talk/stalk) 20:14, 9 November 2017 (UTC) - I second the motion. —Goat-Emperor Bigs (Words of Wisdom/Achievements) 16:33, 10 November 2017 (UTC) - Likewise. Nerd271 (talk) 16:42, 10 November 2017 (UTC) - I don't really see the point personally, didn't we do one of these earlier in 2017? Christopher (talk) 17:11, 10 November 2017 (UTC) - @Christopher I had about 10 people take a draft version. 32℉uzzy; 0℃atPotato (talk/stalk) 17:57, 10 November 2017 (UTC) - Oh, so it was just a draft. I didn't get that ping btw (they don't seem to work in non talk namespaces). Christopher (talk) 18:32, 10 November 2017 (UTC) - @FuzzyCatPotato Sure.-💎📀1️⃣ (talk) 22:48, 10 November 2017 (UTC) - Also, make sure to fix this broken link from page 4 of the survey.-💎📀1️⃣ (talk) 22:56, 10 November 2017 (UTC) I still think the questions from 1 to 9 are quite poor and it's very US-centric (I took the survey without submitting and had to look up "British equivalent of high school" for instance). Christopher (talk) 08:34, 11 November 2017 (UTC) - Yep. I could feel the American-ism from the values test. And we have a North Korean editing this site?????? —ClickerClock (talk) 10:31, 11 November 2017 (UTC) - - We apparently have an editor in North Korea who, being a white Hindu, is unlikely to be a native of North Korea and might well have clicked on Korea (North) instead of Korea (South) by mistake. That brings me nicely to what I was going to say. It would be nice to have separate choices for country of origin and country of residence. I live in Taiwan but I'm not Taiwanese. And previous Saloon Bar conversations suggest that we have some Brits living in Spain editing here. Spud (talk) 06:29, 12 November 2017 (UTC) - I took it even though it's hosted by Google. Surely you can do better than that? But certainly some of the later 1-9 questions didn't seem applicable. I suspect the last ones probably apply mostly to particular country? —Kazitor, pending 11:07, 11 November 2017 (UTC) - As whoever it was said - being born in a stable does not make you a donkey. Anna Livia (talk) 22:48, 12 November 2017 (UTC) - Some person apparently is 150 and living in North Korea. Seems legit!Do You Believe That?-💎📀1️⃣ (talk) 00:02, 19 November 2017 (UTC) - @DiamondDisc1So that's where the food and medical aid went. They have a doctoral degree, too, and are a committed Marxist-Leninist until they sail their submarine towards the U.S. coast to either immigrate or start a war. Nerd (talk) 02:12, 19 November 2017 (UTC) - Someone needs to tell Norway that Bouvet Island isn't uninhabited anymore.-💎📀1️⃣ (talk) 02:42, 22 November 2017 (UTC) - This is why I joined RationalWiki, I get to meet people from so many interesting places and laugh about it. GrammarCommie (talk) 02:58, 22 November 2017 (UTC) - I'm glad this wiki lets nonexistent people edit!-💎📀1️⃣ (talk) 02:36, 23 November 2017 (UTC) - @DiamondDisc1 Diversity is our strength.Do You Believe That? Nerd (talk) 16:30, 22 December 2017 (UTC) - @Nerd Yes, why should nonexistent people be discriminated against?-💎📀1️⃣ (talk) 04:22, 23 December 2017 (UTC) I'm going to close the survey this Friday. Mʀ. Wʜɪsᴋᴇʀs, Esϙᴜɪʀᴇ (talk/stalk) 08:21, 23 November 2017 (UTC) @FuzzyCatPotato this is like the third time I've had to put this topic back. Please fix Archivist :) —Kazitor, pending 04:21, 11 December 2017 (UTC) Survey results[edit] Survey is closed. I'll publish results tomorrow. αδελφός ΓυζζγςατΡοτατο (talk/stalk) 04:38, 25 November 2017 (UTC) - Still waiting...-💎📀1️⃣ (talk) 02:23, 26 November 2017 (UTC) - I was wondering about that too. Bob"Life is short and (insert adjective)" 21:11, 26 November 2017 (UTC) - FuzzyCatPotato is still in a meeting with David Rockefeller at the Eiffel Tower. He will be back when the NWO takes over. INFO WARS *WHAAAAAAAAAM*—Hamburguesa con queso con un cara (talk • stalk) 21:15, 26 November 2017 (UTC) - @FuzzyCatPotato—Hamburguesa con queso con un cara (talk • stalk) 22:26, 26 November 2017 (UTC) - @FuzzyCatPotato-💎📀1️⃣ (talk) 02:36, 27 November 2017 (UTC) - @FuzzyCatPotato I smell a conspiracy. Cosmikdebris (talk) 03:46, 27 November 2017 (UTC) - @FuzzyCatPotato Do the results somehow contain evidence for the Illuminati?-💎📀1️⃣ (talk) 05:22, 27 November 2017 (UTC) - i suspect its taking some time to make the results appear interesting and not blindingly obvious 12:07, 27 November 2017 (UTC) @FuzzyCatPotato, what do you mean publish them? They're already viewable. Christopher (talk) 15:42, 27 November 2017 (UTC) - sorry everyone -- i thought i'd have a chunk of free time to nicely sort & graph the results. i promise by next monday! Herr FuzzyKatzenPotato (talk/stalk) 03:41, 28 November 2017 (UTC) I've got the results ready (in an un-pretty form). However, I thought it might be nice to release the survey results + editcount results on January 1st, since then we could compare the 2017 survey and 2017 edit patterns in one go. Does anyone vehemently oppose releasing both results on the 1st? Sir ℱ℧ℤℤϒℂᗩℑᑭƠℑᗩℑƠ (talk/stalk) 02:08, 4 December 2017 (UTC) Can this be archived yet?[edit] -💎📀1️⃣ (talk) 05:32, 14 December 2017 (UTC) - Probably. I've just been putting it back because nobody's actually removed "sticky" from the title. —Kazitor, pending 07:56, 15 December 2017 (UTC) Fundies are their own worst enemy[edit] As you know, I have no problem with religion. That being said, if you have rules in your churches/church schools that are ultra strict and have no room to do anything fun, you will have people leave a church/religion for atheism or a more liberal faith. Hell, where I live, many fundie churches closed due to low attendance. The other churches (Methodist, Episcopalian, Catholic, Baptist and so on) are doing just fine. Maybe if these places didn't make strict rules unrelated to the bible, they would probably have more members. Thoughts? --Rationalzombie94 (talk) 18:56, 7 December 2017 (UTC) - Many leave those denominations, but those who stay will listen to your every word. —Fake News™ (talk/stalk) 19:04, 7 December 2017 (UTC) - Indeed. That's also the problem with my idea to redirect asteroids into the Vatican, Mecca and Jerusalem (so that it looks like God destroyed them). The moderates and decent people will leave. The crazy rabid literalists will be the ones who remain. --TeslaK20 (talk) 19:29, 7 December 2017 (UTC) - "That being said, if you have rules in your churches/church schools that are ultra strict and have no room to do anything fun, you will have people leave a church/religion for atheism or a more liberal faith." I'm not at all sure that is true. For example ISIS had no problem picking up followers. It may the case where you live, but that doesn't mean it's a general rule.Bob"Life is short and (insert adjective)" 13:08, 8 December 2017 (UTC) - Seconded. In the Assemblies of God we had a 2m-wide board upon which the folks who ran the church let you know exactly what media was forbidden: Ghostbusters, Mighty Mouse, everything Disney, Murphy Brown, Pee Wee's Playhouse, Blockbuster Video (crime: stocking unrated titles!), Dungeons and Dragons, to name just a few. I have fond memories of asking questions in Sunday School (Mrs. Cain, etc.) only to be physically beaten by my fellow students afterwards, which the pastor framed as being my fault for asking questions to begin with. The totalitarian approach is the appeal for people who don't want the real enemy, doubt, in their lives or minds. Semipenultimate (talk) 17:02, 8 December 2017 (UTC) - The other churches (Methodist, Episcopalian, Catholic, Baptist and so on) are doing just fine. You know that Pensacola Christian College and Liberty University are Baptist, and Bob Jones was a Methodist, right? You must be talking about straight up cults like Jehovah's Witness, Christian Science, and Scientology. 73.91.3.45 (talk) 19:48, 11 December 2017 (UTC) - I was talking about the local churches where I live. According to church planting books I have read, totalitarian approaches are killing local churches. Back in 2016 is when I tried going to church again. One I went to was very homophobic (in an ironic twist: the sermon when homophobia came up was about the teachings of Jesus). --Rationalzombie94 (talk) 01:56, 16 December 2017 (UTC) Your Thoughts on UBI?[edit] I was watching a Kurzgesagt Video on UBI and it made me actually think for a moment your thoughts? — Unsigned, by: ShiningSwordofThoughts / talk / contribs - I really like that video. I cautiously support implementing it. (Apparently, they want to give it a try in Hawaii and Finland.) Nerd (talk) 16:26, 22 December 2017 (UTC) Nationalist China[edit] What do you guys think would've happened if the KMT won? And yes, it was possible, and likely would've happened if a certain someone hadn't fucked it all up! And yes, I am aware it would still be pretty shitty afterwards, due to authoritarianism and the whole "Tibet and Xinjiang" thing. But in the end, it would probably be better than our China. Bigs (talk) 22:21, 9 December 2017 (UTC) - Given the cold war tensions at the time, I'm not sure it'd have ended much differently. The Communist forces were huge, and the absolutely massive and mostly remote border with the USSR would have made it impossible to have stopped them being constantly resupplied. The USA had minimal interest in getting sucked in to an intervention, so I think the KMT were only ever really playing for time in the hope someone would help. To be honest, Taiwan is lucky to have survived as long as it has - long enough that we now live in a media age where the PRC is more conscious of it's reputation and what it would loose in terms of respect if it directly and blatantly invaded. Had China had the naval power it's now accruing 30-40 years ago, Taiwan would be destroyed. - As it is, I think Taiwan now is probably in a position to bargain, and within the next 10-15 years will have little choice. China isn't as interested in Taiwan as much as she is access to the Pacific. Taiwan may well be able to cut a deal for de-jure independence (perhaps retaining some symbolic gesture, ie. making the status quo official and permanent) in return for ceding control of the Pratas and Orchid Island groups. These would give China the strategic locations it's wants. The Pratas is undoubtedly the most strategically important spot in the South China Sea, whilst the Orchid/Green Islands would allow the PRC to have naval bases facing directly into the Pacific, without having to risk a diplomatically and militarily costly invasion of the Taiwanese main island. If I were in the PRCs shoes, this is definitely would I'd be angling toward, and if I were in the ROCs group, what I'd be preparing for and thinking about what sort of deal I wanted. TheEgyptian¿Dígame? 00:36, 10 December 2017 (UTC) - The KMT were criticized by General Joseph Stilwell for being corrupt and ineffective, so their capacity to win was questionable, as well as for their capacity to form a non-corrupt government that would do anything to improve the lot of the peasants. Chiang Kai-shek essentially was the dictator of Taiwan until 1975, and was himself responsible directly or indirectly for millions of civilian deaths.[12] Bongolian (talk) 19:58, 10 December 2017 (UTC) - I would say the KMT's hopes to reunify China probably died with Sun Yat-sen.) 22:00, 15 December 2017 (UTC) Dumpster dive[edit] This week's is internet (why do I even bother to post these here?) Bigs (talk) 03:56, 12 December 2017 (UTC) - Cheerful company? GrammarCommie (talk) 04:01, 12 December 2017 (UTC) - It gets more eyeballs. Bongolian (talk) 06:51, 12 December 2017 (UTC) - Who has spare eyeballs in this economy? Radioactive afikomen Please ignore all my awful pre-2014 comments. 04:04, 13 December 2017 (UTC) As 2017 draws to a close, let's reflect on the positives and negatives in the world[edit] To make it clear: Not all of these are Rationalzombie's opinions, some have been added by others, I think this way of doing it is stupid personally. Christopher (talk) 18:29, 12 December 2017 (UTC) Positive - New mental health civil rights laws - Zimbabwean dictator Mugabe removed from power - Australia recognizes gender-neutral marriage - Final defeat of ISIS in Iraq - Defeat of the China-Canada free trade deal - Continued net gain of jobs in the U.S. - Detection of gravitational waves emitted by colliding neutron stars allowing for better understanding of the origins of heavier elements - Synthesis of antibodies capable of targeting 99% of HIV strands - Considerable progress in the investigation of Russian election meddling headed by Special Counsel Robert Mueller - Fun toys: - Commissioning of some vessels belonging to the latest variant of the Arleigh Burke-class Aegis-equipped guided missile destroyer and the aircraft carrier USS Gerald Ford (CVN-78), the lead ship of her class - Launching of the HMS Audacious, an Astute-class nuclear-powered fleet submarine, and completion of the aircraft carrier HMS Queen Elizabeth (R08), the lead ship of her class (please cue the opening theme of The Hunt for Red October"Heart of Oak") - Commissioning of the JS Kaga, the second Izumo-class aircraft carrierhelicopter-destroyer - Nintendo Switch!!!! - We are still here (and possibly more peaceful in a few places that weren't so at the beginning of the year) - Despite predictions to the contrary, WWIII has not happened yet (so don't get too excited but prepare for war nonetheless) - A planet nearby is revealed to be a strong candidate for hosting life as we know it (Ross 128b) - Women accusers of sexual harassment and assault are named Times Persons of the Year - A Democrat won the Senate race in Alabama Negative - Communist China expands Internet censorship - Donald Trump Presidency - North Korean ballistic missile tests - Regional accreditation of Bob Jones University - 2017 being potentially another extremely hot year on record - Disastrous forest fires in California and British Columbia - Devastating (category 5) hurricanes in the American South and Puerto Rico - Horror in South Asia - Bhudist church in Myanmar encourage and participate in aggressive and violent persecution of Muslim minority (Rohingya). - Aung San Suu Kyi fails as a human being and betrays the dignity of the Nobel Peace prize by denying the undeniable ethnic cleansing of the Rohingya people. - Pakistan government loses control to Islamic fanaticism - Hindu fanaticism and terrorism rises in India - Spanish prosecutors imprison Regional leaders for holding a vote Grey - American recognition of Jerusalem as the official capital of Israel - The '#me too' movement, a 'feminist' moral panic over stale claims of sexual harassment that does more political damage to Democrats than Republicans - Renegotiation of NAFTA underway - US withdrawal from the TPP Note- add your thoughts :) --Rationalzombie94 (talk) 14:23, 12 December 2017 (UTC) - It seems to me that the negative aspects of this year outweigh the positive or even neutral aspects. Perhaps we should take this as motivation to do better next year? Although it would seem that we have nowhere left to go but up as it stands. GrammarCommie (talk) 14:31, 12 December 2017 (UTC) - @Rationalzombie94 I hope you don't mind me editing the list directly. Nerd (talk) 15:37, 12 December 2017 (UTC) - @GrammarCommie Do better? Don't you dare spread the Red Virus globally!It is good to be able to distinguish between the things you can change and the things you cannot. As for the former, have the courage to make a positive difference. Nerd (talk) 16:30, 12 December 2017 (UTC) - those positives seem largely 'meh' at best, being rather nebulous and jumping the gun somewhat. and the negatives - you think its only the states that got hammered by bad weather? AMassiveGay (talk) 16:01, 12 December 2017 (UTC) - I agree and specifically the launching of more super-expensive military equipment in the US doesn't seem to facilitate any particular goal right now. ikanreed 🐐Bleat at me 16:59, 12 December 2017 (UTC) - Move my additions here if you prefer. Anna Livia (talk) 17:19, 12 December 2017 (UTC) Mugabe's out, but I'm pretty sure Zimbabwe is still a dictatorship. Christopher (talk) 17:29, 12 December 2017 (UTC) Leaving the TPP is grey IMO. Bigs (talk) 18:09, 12 December 2017 (UTC) The bad: The rise of effing lootboxes, sexual harassment crap (Me Too is potentially good but it sucks that Democrats are held to a higher standard than Repugnicans; Repubes can just shrug off that their senators are pedophiles while Al Franken did the right thing while the Democrats all oppose him), Roy Moore Roy Mooreing. The Confederate statue thing and the fallout of Charlottesville. Failed promise of infrastructure spending. Failed repeals of ACA and replacements being horrendous versions. Mass shooting in Vegas, being among the worst in history. My friend got diagnosed with leukemia and my paternal grandma is finally dead. :( The good: Super Mario Odyssey!!!! My friend also eventually recovered from leukemia, thanks to chemotherapy. Also, most nations have signed the Paris Accord. Donald Trump wants to crack down on Scientology. Me being active, perhaps? --It's-a me, LeftyGreenMario!(Mod) 19:57, 12 December 2017 (UTC) - if you think this year saw the rise of loot boxes, then you really havent been paying attention. AMassiveGay (talk) 21:51, 12 December 2017 (UTC) - If I'm wrong, some explanation would be nice. I'm basing from Jim Sterling's conclusion that 2017 is the Year of the Loot Box. Doesn't mean lootboxes were invented this year, it's that game companies went crazy with them. --It's-a me, LeftyGreenMario!(Mod) 00:37, 14 December 2017 (UTC) - ive personally found loot boxes a pretty shitty scam for more long just this past year. i dont have a youtuber to validate it though. the only difference now is the push back - surely a good thing? AMassiveGay (talk) 16:08, 14 December 2017 (UTC) - Any sort of pushback is a good thing, it's just that I wish it happened sooner. There's also Star Wars Battlefront which was so serious, there were government investigations. Sadly, I don't think EA or any other "whale" rapers are going to be heavily punished as they should be. --It's-a me, LeftyGreenMario!(Mod) 23:19, 15 December 2017 (UTC) On the bad, I'd add Cassini's end of mission (it was quite sad to lose her after thirteen years faithfully following its mission at Saturn), that terrorist attack at Barcelona, and... well, entropy keeps increasing. On the good, the last tablet I bought has so far lasted almost a year. Panzerfaust (talk) 23:27, 12 December 2017 (UTC) The bad: 2017 was not the year of Linux on the desktop. :( Spriggina (tal) (framlög) @ 19:52, 14 December 2017 (UTC) - The Good: Guardians of the Galaxy 2, Thor: Ragnarok, Worm 2: Ward - The Bad: Spam, Atheist-led anti-intellectualism, Donald Trump, spam, Net Neutrality repealed, Supreme Court Justice Gorsuch, Pensacola cheers the idea that Trump is bringing about the Biblical apocalypse, spam, the GOP tax cut for the rich, Trump's constant appointment of people who want to undermine the agencies they now lead, TPP pullout, spam, FUBAR response in Puerto Rico, having to rely on Kim Jong-Un to be the reasonable one that doesn't start nuclear war over nothing, an end to Obama's cyberwarfare policies allowing North Korea to get missiles capable of reaching the United States, and spam. - The Ugly: Mueller's investigation seems to be going well targeting the guy who never should have been elected in the first place, people resist the Alt-Right but only after it rises up and leads to multiple deaths, Roy Moore is defeated but just barely, the courts are trying to fight back against idiotic Muslim bans, Steve Bannon looking like what happens when you barf tofu. Women are coming forward about sexual assault and harassment now, but otherwise reasonable people are characterizing it as a Warlock Hunt- PsychoGecko (talk) 09:05, 15 December 2017 (UTC) Bad - On the Verge of nuclear war with North Korea, which is still causing me anxiety!! (albeit less anxiety right now as a result of watching Dr.Strangelove) - My Paternal Grandfather dying and my first dog being euthanized. - Doug Jones barely winning in Alabama. - Destruction of Net Neutrality - Aung San Suu Kyi denying the ethnic cleansing of the Rohingya. (Something which I will never forgive her for) Good - My trip to Japan, Germany, and Italy (Finally able to see the mosaics of Justinian and Theodora in Ravenna, being able to see Florence, and going to the summer palace of Frederick II of Prussia) - Graduating from College with a Bachelor of Sciences - Release of the new Pokemon game S.H. DeLong (talk) 07:18, 22 December 2017 (UTC) Doug Jones wins Alabama special senate election[edit] In a crazy turn of events, Doug Jones, the Democratic candidate, has won the Alabama special election (well, not officially, but it's all but guaranteed at this point)! Following a night of twists and turns, Roy Moore supporters are now singing Amazing Grace repeatedly at the headquarters and Democrats everywhere are gloating. What are your thoughts on this? Spriggina (tal) (framlög) @ 04:14, 13 December 2017 (UTC) - I'm pretty fucking pleased. This might encourage other Democrats to campaign in other states previously thought untouchable for once. RoninMacbeth (talk) 04:32, 13 December 2017 (UTC) - I honestly think the only reason he won was that Moore is a pedo. If he had all the same policy positions but wasn't a pedophile, I think he would've won. So this may not encourage Dems that much unless there's another Republican candidate accused of raping underage people in one of those states. Spriggina (tal) (framlög) @ 04:43, 13 December 2017 (UTC) - YAS!!! Bigs (talk) 04:46, 13 December 2017 (UTC) - It's about bloody arse time Alabama voters turned against that childfucking pervert!! GrammarCommie (talk) 04:55, 13 December 2017 (UTC) - Pretty sad that Doug only barely won and it's not Roy Moore's overall being a piece of unconstitutional Bible thumping fermented gorilla acne pus, but a complete extreme low that is underage sexual harassment that made people get the message. --It's-a me, LeftyGreenMario!(Mod) 06:44, 13 December 2017 (UTC) - I would have to agree with LynnR on this one. The only reason Jones won this Senate seat is because Moore is a child rapist and they were not able to get that Luther Strange guy in as the Republican candidate in the primary. Had Strange won the primary, things would've much different tonight.S.H. DeLong (talk) 06:53, 13 December 2017 (UTC) - People are doing the math on Strange vs. Moore, and it doesn't look good for Steve Bannon, so there's more good news there as well. The downside is that we now have the data point that there are 650,436 Alabamians who would vote for literally anyone so long as they have an 'R' next to their name. Semipenultimate (talk) 16:33, 13 December 2017 (UTC) - I don't think I've ever seen a better description of Roy Moore than fermented gorilla acne pus. Spriggina (tal) (framlög) @ 18:55, 13 December 2017 (UTC) - Calling him "Roy Moore" would've been a verbal hit under the belt for him. I'm being nice. --It's-a me, LeftyGreenMario!(Mod) 00:39, 14 December 2017 (UTC) - @S.H DeLong: The margins reveal very ugly implications, but I still count it as a major win. The closer the election got the more I assumed the worst, and now I'm incredibly happy to be proven wrong. 98.110.112.28 (talk) 06:42, 14 December 2017 (UTC) - Not normally a huge fan of the Democratic Party, but I am happy with Moore losing (and I live in Michigan for Goddess sake!) --Rationalzombie94 (talk) 15:41, 13 December 2017 (UTC) - Chrimbus Miracle. Oolon Colluphid (talk) 01:29, 14 December 2017 (UTC) - It probably helps Democrat momentum for 2018 because in the somewhat competitive states they can tell voters look, we took Alabama, but people had to *show up* for that to happen, so you need to actually go vote, not just think it's a good idea. Getting your base motivated to show up for off-year elections is hard, obviously being wall-to-wall on the national news helps (between seeing Crimson Tide and summer 2017 I never heard the phrase "Roll Tide" once, then I heard it six times in the past few weeks on US national broadcasters) but a success like this helps too. Tialaramex (talk) 23:25, 14 December 2017 (UTC) Founded some pretty Biased looking video from some Aussie Called "Suit Yourself"[edit] ShiningSwordofThoughts (talk) - So far All I can find is a Yahoo article : ShiningSwordofThoughts (talk) 05:00, 14 December 2017 (UTC) User GrammarCommie reverting without discussion[edit] [13] Is Rationalwiki his personal blog of favorite stories? Wangmeister (talk) 16:12, 14 December 2017 (UTC) - Yes it is, there's the story about the three bears, the story about the gingerbread house and one of my personal favorites, the story about the mermaid. GrammarCommie (talk) 16:21, 14 December 2017 (UTC) - Now in all seriousness I reverted your edit because A) it contained racist nonsense and B) you outright said to revert it in your edit summery. GrammarCommie (talk) 16:32, 14 December 2017 (UTC) - This is a scientific method of establishing whether races are equal, and you reverted it, because you feel races are equal? "Revert away" was a joke. Knowing that, will you revert back? Or just looking for cheap excuses to hide facts that conflict with your politics and feelings? What can "racist" possibly mean in this context? Not pretending races are equal in the face of evidence? Why is it "nonsense"? You need to explain. Wangmeister (talk) 16:51, 14 December 2017 (UTC) - Wangmeister is an admin from the Neo-Nazi site Rightpedia, Mikemikev - who has been banned from this site hundreds of times. He was blocked here yesterday on multiple socks for spamming defamatory Rightpedia articles he's now creating on other RationalWiki users.Tuna (talk) 17:00, 14 December 2017 (UTC) - Once again, I find the people who constantly dox this person and follow them around more bizzrely obsessive than the self-deluded racist idiot themself. ikanreed 🐐Bleat at me 17:04, 14 December 2017 (UTC) - Except we aren't following him - he stalks RW sysops now writing smear articles on them at Rightpedia. He chooses to come here and troll us; I've never once joined his Nazi wiki to engage him. He's obsessed with us, not the other way around. None of us ever go to his wiki, yet he's always here on dozens new accounts each month. The problem is since he's signing up with new accounts, people don't realise its all the same deranged person. "Doxing" is also personal information; posting his online pseudonym (Mikemikev) isn't doxing especially not since he signed up here with that name.Tuna (talk) 17:16, 14 December 2017 (UTC) - I guess I realize innately that I don't consider it banworthy doxxing, but it's still basically about identifying an individual as a way to strike at them? If I saw someone pulling a similar thing for another user, and going "aha, you're user X on reddit or wikipedia"(where x is not the same name), i'd be a bit concerned? - To immediately an accurately identify the specific person and to consistently respond in a similar way is still a bit odd in a way that reads to me as obsessive. It troubles me. Socks are a thing and identifying them is fine, but it feels like an "actively monitoring" situation. ikanreed 🐐Bleat at me 17:35, 14 December 2017 (UTC) - I don't think it qualifies as doxxing. It's more of a heads-up for a low-quality user who is sneaky and goes by pseudonyms. I don't know if this is even called stalking if it's what you call "obsessive", but information like this at least saves us trouble to respond where we'd otherwise assume good faith and waste time with Mikemikev. Now, it's another case to keep responding in a similar way every time mikemikev comes up, maybe next time, just notify a sysop or a mod's page or do it on our Discord. Post a rebuttal if you must, but maybe you won't scare ikanreed as much. --It's-a me, LeftyGreenMario!(Mod) 19:44, 14 December 2017 (UTC) ikanreed has just enough time to follow your cites[edit] Just look at what that edit was wearing, it was asking for it. No really, citing the website of a prolific racist, and citing papers that A. Don't even exist at the given url, or B. don't even remotely support the egregiously racist sentence preceding them? And then whining when that incredibly shitty edit gets reverted? Fuck off, you're not oppressed, you're full of shit. You didn't fucking read the goddamn abstract of that plos one paper, why the fuck should we waste time to read the positively useless bilge you generate in your deluded goddamn mind? Like... good job thinking that a paper that briefly touches on socioeconomic status only to assert the opposite of the idea you managed to extract from it, supports a hereditary hypothesis of capability being primarily determinative of status, you goddamn fucking imbecile, you lunatic, you illterate fucking waste of everyone's time. ikanreed 🐐Bleat at me 17:04, 14 December 2017 (UTC) - "You are racist" or "He is racist" isn't an argument. Give examples of missing papers. I've read the entire Steve Hsu compressed sensing paper. Also his more recent application to heritability of height. Why are you slandering me? It's a general method for GWAS. Can be used for any GWAS. They posit a Donoho-Tanner phase transition. You didn't understand that? Wangmeister (talk) 17:10, 14 December 2017 (UTC) - (I know they're blocked) You are a racist, and you are pointedly ignoring the content of "you clearly didn't even fucking read your own cites with any sort of comprehension" to be offended at that non-trivial point. Citing an unabashed piece of shit isn't gonna win you any debates, and nor is then crying ad hominem when their history of intellectual dishonesty and vile beliefs are pointed out. It may be a logical fallacy, but it's also a damn good reason to not treat them as authoritative. ikanreed 🐐Bleat at me 17:35, 14 December 2017 (UTC) - If someone is an admin for a Neo-Nazi site, then yes, the guy is a racist. --Rationalzombie94 (talk) 13:11, 15 December 2017 (UTC) - Sure. But saying "you are racist" or "that's racist" isn't a counterargument. It's just mindless name calling. 86.187.115.177 (talk) 16:31, 15 December 2017 (UTC) - Pretty sure the relevance to their credibility as a citable source is obvious, so instead of replying to you in a meaningful way: fuck you, and fuck your ideology, and fuck your willful ignorance. ikanreed 🐐Bleat at me 17:23, 15 December 2017 (UTC) - To the racist OP- Not matter how much logic and reason we were to give you, it is not like you would listen anyway. No point. The best way to combat racism is educating people that being different is okay, gays are not evil and teach people proper science. --Rationalzombie94 (talk) 19:19, 15 December 2017 (UTC) Is trinitarian Christianity polytheist?[edit] I would say it is as it has three deities, even with the three-in-one package., 15 December 2017 (UTC) - No. God the Father, God the Son, and God the Holy Spirit are one God. It's a mystery, meaning that you get trapped in a Borgesian labyrinth if you try to figure it out; best to just accept it and move on. I don't have issues with the Trinity, but I do think that the Greek idealistic metaphysics some resorted to as an explanation are 'problematic'. We're told that the Father, Son, and Holy Ghost are concurrently one God because they share a single 'substance' or 'essence' of God. To me, this raises the possibility of an abstract, inanimate Deity. - Smerdis of Tlön, LOAD "*", 8, 1. 02:48, 15 December 2017 (UTC) - I would say what makes the most sense out of the possibilities is this. The Father and Holy Spirit are not separate beings, they are just God. Jesus was not the literal son of God, but a prophet.:05, 15 December 2017 (UTC) - If they are to be accepted as separate, then yes. But what I find is that people claim they are separate yet still one. And though this makes no sense (see Trinity#Some attempts at formal logic), they can claim it's beyond our comprehension or mysterious, without any proper justification of how or why. —Kazitor, pending 07:53, 15 December 2017 (UTC) - It is actually another example of 'ancient science' - the deity version of this. Anna Livia (talk) 10:57, 15 December 2017 (UTC) - It totes is, but theologians are certain it isn't. ikanreed 🐐Bleat at me 16:19, 15 December 2017 (UTC) - I don't think mainstream trinitarian Christianity is, as Jesus, God, and the Holy Spirit are technically one being, but in Mormonism they are actually separate, making it polytheist. Spriggina (tal) (framlög) @ 16:24, 15 December 2017 (UTC) Christianity is as polytheistic as that classic example of polytheism - Hinduism - in that all the Hindu gods are considered to be aspects the one Ultimate Brahman. My impression is that polytheistic religions in general work like this. So it probably does not make a lot of difference.Bob"Life is short and (insert adjective)" 12:13, 17 December 2017 (UTC) Rationalwiki on Twitter[edit] Why does everyone think it's a joke? Is it some kind of self selecting sample bias? 86.187.115.177 (talk) 16:34, 15 December 2017 (UTC) You guys need to get on twitter and explain this one. I'm sure you have a good explanation and can explain this when you can't ban your opponent. Rationalwiki! 86.187.115.177 (talk) 16:46, 15 December 2017 (UTC) - By "everyone" you mean a small number of creationists, spiritualists, neo-nazis and other cranks. All these people hate rationalwiki because it criticises their crazy beliefs. One of the people moaning at RW on Twitter in the last few hours on that link you posted is the pseudo-science promoter and troll Rome Viharo. You need to explain why you think anyone takes internet crazies like this seriously; their opinion on RationalWiki is worthless.Dr. Witt (talk) 16:56, 15 December 2017 (UTC) - No, it's literally everyone that mentions it, laughing at it. Also check the new tweet after your comment above. Who are they talking about? 86.187.115.177 (talk) 17:01, 15 December 2017 (UTC) - Argumentum ad populum:07, 15 December 2017 (UTC) - Yawn. GrammarCommie (talk) 17:11, 15 December 2017 (UTC) - I don't know about everyone else here, but I'm truly shocked to find there are people on Twitter who don't appreciate the site. Its deeply and profoundly disturbing. What on earth can we do? I mean, we can't just ignore then, can we?Bob"Life is short and (insert adjective)" 18:34, 15 December 2017 (UTC) - Nah, that would imply that random twitter users' opinions of us don't matter in the slightest. And we can't have that now can we? GrammarCommie (talk) 18:40, 15 December 2017 (UTC) - If everyone on twitter that mentions you thinks you're a joke, you're a joke. Carry on! 62.30.229.198 (talk) 18:45, 15 December 2017 (UTC) - I'm reffering to the video ShiningSwordofThoughts (talk) 18:42, 15 December 2017 (UTC) Aside: people who have something to say against RW are more likely to voice their opinion. Imagine if everyone commented on every slight thing they didn't hate. No thanks. —Kazitor, pending 00:21, 16 December 2017 (UTC) Let's do science[edit] I randomly sampled(incremental monte carlo progressive samping with max(N) being 8, disregarding the @RationalWiki account and posts not directly referencing the site) 15 of the searched. And based on the first one, I decided to examine their twitter bios and avatars for signs of being literally goddamn nazis as supplemental information, as I conjectured these people would be particularly inclined to object to us. - . Literal goddamn Nazi, Negative - . Literal Goddamn nazi, very Negative - . Not nazi, Extremely positive - . Literal goddamn nazi, very negative - . Not nazi, Nuetral, - . Not nazi, Neutral, seems irrelvant to mention rational wiki, talking about disney? - . Not a nazi, exact quote: "rationalwiki is a good resource" - . Not a nazi, negative(worth noting though they were saying we target flat earthers to mock "legitimate conspiracy theories") - . Not a nazi, neutral: - . Anime nazi: very negative - . Not a nazi, Neutral? Negative? mentioning us at the end for no reason? (I can't tell if their opinion of us in the context of the tweet, but it says that the government is secretly holding the cancer cure and free energy) - . "No, I'm not a nazi" is literally in their twitter bio, but I think they probably are? Decide for yourself, negative - . "Odinist"(Actual nazi, not satiric religion): negative, but by comparing us to NYTimes and wikipedia - . Not a nazi, positive/silly - . Not a nazi, negative(gamergater, but considering I didn't specify that being relevant prior to the experiment it feels like an ad-hoc justification and should not be discounted) Short version, 2 negative posts by non nazis in this random sample. Also this IP is probably the one who's been filling the search results with the same 2-3 posts over and over again for the past week to justify their own post when they made it here? ikanreed 🐐Bleat at me 19:43, 15 December 2017 (UTC) - I'd just like to add that we are well aware of people disagreeing with us. Nothing new there. —Kazitor, pending 22:57, 15 December 2017 (UTC) Irony[edit] Does anyone else find it ironic that in spite of our criticism of libertarianism, we function as a night watchman:09, 15 December 2017 (UTC) - Not really. A night watchman state can't really work for large, modern nation states in the post-Westphalia sense. Online wikis aren't that, so it's better to have a night watchman state as a model for how we function as a website. RoninMacbeth (talk) 19:00, 15 December 2017 (UTC) - Except that that's not at all true? We even have an elected board who allocates funds and does shit you're not paying attention to to keep the wiki going? And we have rules about moderation that do not really reflect libertarian ideals? And there really isn't a commons to regulate for a wiki the way there is for a society(i.e. pollution controls or worker safety). And the only money that changes hands here is donations to the wiki, so financial fraud, and other kinds of systemic abuse aren't topical? In fact, this assertion feels so contrived I cannot even imagine the train of "thought" that might have prompted posting it. ikanreed 🐐Bleat at me 19:08, 15 December 2017 (UTC) - Wot? Spriggina (tal) (framlög) @ 19:28, 15 December 2017 (UTC) - That comment I made was like 90% a joke., 15 December 2017 (UTC) Do Neo-Nazis have anything better to do than trolling Rationalwiki?[edit] It is not like they can come up with any logical or sensible conversation. Are Nazis (There! I fixed it! Yay!) afraid of us Rationalwikians educating people? Then again, education is the worst enemy of a brainless racist. Watch the Nazi trolls say a bunch of mindless shit. --Rationalzombie94 (talk) 23:59, 15 December 2017 (UTC) - *dies over the usage of an apostrophe without a possessive nor contraction* —Kazitor, pending 00:17, 16 December 2017 (UTC) - In the name of the glorious Grammatical Revolution fix that apostrophe!!! GrammarCommie (talk) 00:20, 16 December 2017 (UTC) - Fixed it, and internet loonies tend to spend their time trolling.) 00:28, 16 December 2017 (UTC) - I admit, not the biggest grammar champion. I am more of a science guy. No offense taken. When I went to make this thread, my computer battery died. Anyways, on the main topic, it is safe to say that education is the worst enemy of racists. --Rationalzombie94 (talk) 01:46, 16 December 2017 (UTC) - RZ - in your initial post do you have an example of this? Anna Livia (talk) 21:21, 16 December 2017 (UTC) - I don't see any reason to care about Neo-Nazis or overall racists, particularly those that troll RationalWiki with edits that are easily reverted and ignored. You answered your own question: they're allergic to decency and intelligence, so they have nothing better to do. No further discussion. --It's-a me, LeftyGreenMario!(Mod) 02:19, 17 December 2017 (UTC) say no to drugs[edit] i was at a... lets say party. i am virtually blind without specs and some activities i generally do without. it was not until after that noticed the nazi eagle tattooed on his chest. when questioned, in the hope it was a regretfully permanent mistake, the answer i receivee was 'it was a tribute to a loved one'. he was not too coherant and i was a little too high to press the issue. so yeah, i might have accidently fucked a nazi AMassiveGay (talk) 02:16, 16 December 2017 (UTC) - AMG, when we say "fuck nazis" we don't mean literally fuck Nazis!! GrammarCommie (talk) 02:21,:37, 16 December 2017 (UTC) - It happens, no judgment. At least Nazi got fucked by a liberal --Rationalzombie94 (talk) 12:30, 16 December 2017 (UTC) - Maybe it was a Hindu swastika, tattooed on because of his firm Hindu beliefs. 32℉uzzy; 0℃atPotato (talk/stalk) 20:02, 16 December 2017 (UTC) - That didn't sound like Garuda! Bongolian (talk) 21:16, 16 December 2017 (UTC) - @AMassiveGay Please stay safe! Nerd (talk) 17:53, 19 December 2017 (UTC) - @LeftyGreenMario Freedom of speech and expression is a two-way street. Expect people to disagree with you. Their right to express themselves implies your right to choose whether or not to listen. If they want to become ideological idiots, let them do it, as long as they are not committing acts of violence, of course. Nerd (talk) 17:53, 19 December 2017 (UTC) - I'm not for censorship, but it's another thing when I'm on a college campus, and there is a guy with a megaphone spouting off how slutty women are and making racist or LGBT slurs. College campuses also have the right whenever to host this kind of stuff or not. That's also freedom of speech, and if they don't want to endorse it, then they have the right not to. --It's-a me, LeftyGreenMario!(Mod) 19:25, 19 December 2017 (UTC) - @LeftyGreenMario Personally I could not care less, as long as they are sprouting their nonsense at the designated time and space. (One should not tolerate disruptions in the lecture halls, libraries, or dorms.) It is a fine legal tradition dating back to the Roman Empire that people ought to be punished only for their actions, not thoughts. And we are talking about people expressing their thoughts here. Freedom of speech and expression is a wonderful thing. Of course, when they are slandering, libeling, or lying to the police, that's a different story. Nerd (talk) 15:20, 22 December 2017 (UTC) - @Nerd You couldn't care less, but people react differently to different things. You'll still be affected at some level even if you say you don't care. But some people can't build psychological barriers like that, they just aren't good at it. That's how we get the definition of "toxic people" and "toxic" in general. Campuses don't want a toxic atmosphere, understandably so since this sort of speech hurts people too even if not physical, and they also have their freedom to express their policy and thoughts too. AND they're the ones providing the platform too, so they should have that power to set limits. Besides, no one is arresting anti-abortion picketers who carry graphic imagery of bloody babies and heckling students, campus security just shows them the door. I mean, they're free to put signs on the street as long as they're law-abiding, but once they hit property of Planned Parenthood or a college campus, their absolute free speech rights end. --It's-a me, LeftyGreenMario!(Mod) 03:10, 23 December 2017 (UTC) What's the Appeal of Cults?[edit] I'm just wondering what gets people caught up in this and makes them buy into the whole song and dance. I read that some things they say are like "we are all just individual points, converging on infinity. Here on earth for a short time, need to make room for new life. Those that fight hardest against death are those most tempted by its salvation." Or how death is not the end, it's just a door and the final step is rebirth and immortality. What makes people not use logic here?Machina (talk) 04:39, 17 December 2017 (UTC) - Humans are a social species. We want to be accepted, and we'll often grab at the first thing we find. Cults create a sense of purpose. A sense of community. Another thing is, we hate feeling insignificant. They also provide that, saying that we're part of something bigger. And finally, the isolation manages to keep them from considering alternatives.:58, 17 December 2017 (UTC) - But wouldn't saying we are just "points converging on infinity" more like trying to say our issues and problems are insignificant? Wouldn't that be the opposite of a "cult"?Machina (talk) 03:07, 19 December 2017 (UTC) - There's also the fact that cults tend to be social lobster traps, easy to join but hard to leave. Whether that's the manipulations of Scientology or the fences of the Waco ranch. GrammarCommie (talk) 05:03, 17 December 2017 (UTC) - There is probably something of a continuum - with 'fan clubs and other groups' being the (mostly) reasonable equivalent. - How do cults and conspiracy theories inter-relate/compare and contrast? Anna Livia (talk) 10:55, 17 December 2017 (UTC) - Add to that the feeling of desperation and finding someone that will help you -as these-, who are present here changing their name from time to time. Panzerfaust (talk) 11:03, 17 December 2017 (UTC) - You might just as well ask "What is the appeal of religion?"Bob"Life is short and (insert adjective)" 12:06, 17 December 2017 (UTC) - There are hobbies, faiths, fandoms (including sports clubs) etc and there are cults. Some people will get involved in their 'pet interest' to an excessive degree - and some people may find that belonging to a cult (or a cult-like set up) satisfies a psychological need that cannot otherwise be satisfied or resolved. Possibly the distinction is between whether 'the interest' is central and all encompassing or peripheral/something that is there in the background (and you can have a conversation which does not include the particular topic). Anna Livia (talk) 20:51, 17 December 2017 (UTC) What's the appeal of (specific) religions?[edit] Much to the chagrin of some anti-theists here I'm not going to posit that major religions are cults. But the core appeals of both are the same: spiritual fulfillment, promises of a better life/afterlife, social acceptance, purpose, peace, and love. Most people have some affinity for religion, whether innately or learned, and cults tend to be masters of appealing to the most downtrodden in a way that a "big" religion may not be. ikanreed 🐐Bleat at me 18:30, 18 December 2017 (UTC) Further Reading[edit] - Cult membership: What factors contribute to joining or leaving? - This Is How Cults Work - The Cult Education Institute And everyone reading this should remember: We are all vulnerable to being brainwashed into a cult, so here is a cult checklist just in case. Give it a read. @Machina —ClickerClock (talk) 12:11, 23 December 2017 (UTC) thealternativehypothesis.org we need an article and some serious refuting.[edit] I am sorry if this is the wrong place, but I am both green here, and also have been away after the forums where closed, so I don't know where to talk or get help. The site seems to be trying to be more passive in its messages, but it still has that "racial realist" feel to it. I am just wondering how we can refute their more ridiculous articles; like the one on "Race Mixing". — Unsigned, by: Zavvnao / talk / contribs - Go for it dude. I think some of my brain cells rotted reading that pseudoscience garbage. --Rationalzombie94 (talk) 14:44, 18 December 2017 (UTC) - I will be more than willing to proofread any article you come up with @Zavvnao. GrammarCommie (talk) 14:48, 18 December 2017 (UTC) - Small question: are they notable? Who cites them? How much? If we covered every single shitty website with an article we'd never run out. ikanreed 🐐Bleat at me 17:35, 18 December 2017 (UTC) - since the op mentioned 'race mixing', we already have an article on miscegnation. im not sure sure we would need to refute this people speciically, notable or not. AMassiveGay (talk) 17:46, 18 December 2017 (UTC) - Wow WOW. Sounds like John Fuerst. Create an article called The Alternative Hypothesis. While race mixing has been refuted, this doesn't stop us from creating an article fot the entire site. It even mentions Kirkegaard in an article.—Hamburguesa con queso con un cara (talk • stalk) 18:11, 18 December 2017 (UTC) - There's already an article on the Alternative Hypothesis: Ryan Faulk (that's his real name). What's funny is I knew him over 10 years ago on YoutTube. Back then he was not a racist, but did videos on market economics and was an anarcho-libertarian or something similar. Overtime though he got radicalises and is now a hardcore alt-righter, anti-Semite etc. Dr. Witt (talk) 21:56, 18 December 2017 (UTC) - I'm sure you guys can refute Ryan easily. This is going to be very embarrassing for him. Good luck! Dark Ages Heretic (talk) 10:40, 19 December 2017 (UTC) Sorry, I went to post on alternative hypothesis[edit] Somehow my computer screwed up --Rationalzombie94 (talk) 16:24, 19 December 2017 (UTC) What I meant was when I posted, my post showed up on a different saloon thread. --Rationalzombie94 (talk) 13:35, 20 December 2017 (UTC) A message on my talkpage[edit] [14] Seems to indicate a shared Bugmenot account. I've looked into it and found this [15]. Thoughts? GrammarCommie (talk) 19:35, 18 December 2017 (UTC) - I didn't make this account by the way, I just found the bugmenot page and wanted to alert you guys. Anonymous User (talk) 19:37, 18 December 2017 (UTC) - I think we should comply with the idea, and not only give sysop rights but moderator privileges! —Kazitor, pending 11:46, 19 December 2017 (UTC) - I think we should appoint the account to the RMF Board of Trustees. Spriggina (tal) (framlög) @ 01:22, 20 December 2017 (UTC) - I just changed “my” password. You’re welcome. Anonymous User (talk) 03:34, 20 December 2017 (UTC) - Oh, and thanks for the new sock, random stranger. Anonymous User (talk) 02:48, 21 December 2017 (UTC) - Uh. What do you mean?—Hamburguesa con queso con un cara (talk • stalk) 03:05, 21 December 2017 (UTC) - I am a RW sysop who noticed this exposure and neutralized it. You’re welcome. It sat apparently unused on bugmenot for months, but was still an exposure, not that anyone could have done much damage with it. Anonymous User (talk) 19:39, 23 December 2017 (UTC) White nationalists finally getting banned on twitter[edit] Bout time, [16]. American Renaissance and Jared Taylor's have been deleted. Anti-Fascist for life (talk) 21:25, 18 December 2017 (UTC) - I'm sure they can take advantage of their inherent race-given magical superpowers to make a superior whites-only Twitter. --It's-a me, LeftyGreenMario!(Mod) 21:36, 18 December 2017 (UTC) - Well @LeftyGreenMario they tried that before. Remember Gab? GrammarCommie (talk) 21:42, 18 December 2017 (UTC) - I know. There is even an entire WIGO about it. It's going to be hard for them to explain why they can't make half-decent websites without the support of companies (and I think those companies have a ton of workers that aren't white or male). --It's-a me, LeftyGreenMario!(Mod) 21:50, 18 December 2017 (UTC) Don't be quick to defend deplatforming on ideological grounds. There's no reason to believe that other unprofitable views will be allowed to stay. FuzzyCatPotato of the Rotted Noseblowers (talk/stalk) 22:07, 18 December 2017 (UTC) - I agree; we shouldn't just censor everyone and anyone with dumb views. Plus, it makes it no longer a persecution complex but actual persecution, of sorts. —Kazitor, pending 22:42, 18 December 2017 (UTC) - But therein lies the problem does it not? At what point does the toxicity of hate speech cross the line into grounds where it cannot be tolerated for the health and safety of all? GrammarCommie (talk) 22:49, 18 December 2017 (UTC) - This kind of speech can mobilize hatred though. Do we really want that? --It's-a me, LeftyGreenMario!(Mod) 00:35, 19 December 2017 (UTC) - Discussing free speech and censorship in terms of "safety" is problematic. This implies both that [1] censoring racism is effective at preventing racism (an empirical claim) and [2] threatening speech is inherently unacceptable (a moral one). Yet all speech that seeks to change the status quo is "threatening" -- whether from left or right. There's a reason so many fascist governments have killed leftists under the guise of "restoring order". 32℉uzzy; 0℃atPotato (talk/stalk) 01:16, 19 December 2017 (UTC) - China does a reasonably good job of suppressing what they consider to be unsafe speech. I'm just not sure that's the example we want to follow.Bob"Life is short and (insert adjective)" 09:09, 19 December 2017 (UTC) - These people post about non-Whites committing crime which is hate. Only Whites should be shown committing crime e.g.[17] That poster was racist. Good work Jack! Let's demonize these White bastards into oblivion through controlling their media! Dark Ages Heretic (talk) 10:36, 19 December 2017 (UTC) - Oh, you again. GrammarCommie (talk) 11:06, 19 December 2017 (UTC) - And worse, asking corporations and sponsor-driven media to protect us from bad words is to invoke a power that's utterly unaccountable under current law, which is not likely to change in my lifetime. - Smerdis of Tlön, LOAD "*", 8, 1. 17:17, 19 December 2017 (UTC) - But this seems like a slippery slope argument. There is a difference between holding a ballsy unpopular view such as making a well-reasoned argument for legalizing child porn, legalizing consented incest, or advocating culling of old people and there is advocating death or rape of minorities including women. People also have their right to bar guys with hooked crosses from parties, corporations have the right to buck hateful people. That is also a type of expression. The thing we need is how to define "hate speech", which is very difficult but it's really more of a "I know it when I see it". I don't trust corporate judgement all that much but I think allowing a platform for hate screeds is problematic as it's suggestive of endorsement. And if the white nationalists get booted off Twitter, they're always free to create their own slimepool. We haven't seen Metapedia or Rightpedia or Conservapedia get booted off... yet. But in Conservapedia's case, I don't consider it hateful enough, just more stupid. --It's-a me, LeftyGreenMario!(Mod) 19:32, 19 December 2017 (UTC) - Encouraging people to break the law is where I would draw the line. (Arguing that the law should be changed is something else.) - But if someone has an unpopular opinion - they shouldn't be prevented from expressing it if people want to listen. On the other hand that doesn't mean you are obliged to give them a platform or that they can insist on a right to be given a platform.Bob"Life is short and (insert adjective)" 21:36, 19 December 2017 (UTC) - Twitter is not an open free speech forum, and hasn't been for a while. They've clearly taken an editorial stance on general issues: no curse words can be tweeted at verified accounts of real people, and no hate speech (if they deem it so anyway). Since they have crossed the line from open forum to edited forum, they've put their own corporate reputation on the line for what appears on their site. I'm all for Nazis having free speech that does not incite violence, but why should a corporation financially and reputationally support it? Bongolian (talk) 22:04, 19 December 2017 (UTC) - Claiming that a platform like Twitter is 'financially and reputationally supporting' everything written on it is part of the problem. Even with a population approaching ten billion, there aren't enough eyes to make that claim believable. And if Twitter is not an open free speech forum, where is the Twitter we actually need? - Smerdis of Tlön, LOAD "*", 8, 1. 23:19, 19 December 2017 (UTC) - Twitter is a host that provides a free service to people, so it has its own judgement and power to decide what's appropriate and what's not. I wouldn't necessarily call it an open free speech forum. You still have to agree with terms and conditions which are subject to change. Maybe it wasn't a problem back then that "there aren't enough eyes to make that claim believable", as venues for crazy hateful stuff have always existed but we've seen Twitter mobilizing and popularizing hate before with mobbing people with death threats and stuff, and there are people who take those incidents as complaints to Twitter for better regulation of this stuff. There is a recent phenomenon with the rise of the popularity of far-right viewpoints and Twitter helped spread those ideas by letting them happen in the first place, exposing vulnerable people to rancid ideas and contributing to it, along with other complex problems such as economic strain these white people are feeling. Part of me still feels the hate speech here should be limited especially since their only intent and effect is to target and harm others. --It's-a me, LeftyGreenMario!(Mod) 23:29, 19 December 2017 (UTC) Twitter mobs are not a phenomenon confined to any one political persuasion. There's been plenty of threatening behavior, doxxing, and the like aimed at people who blasphemed identity-politics pieties as well. From my perspective, some identity leftist dogmas ('rape culture', 'toxic masculinity' &c) are just as objectionable as white supremacism. I tolerate them, because you have to object to something before you are able to tolerate it. I would not want a corporation to decide that those viewpoints are outside of civil discourse, even if in one sense they are. My point is, when you approve of corporate censorship, you've unleashed a force you cannot control. - Smerdis of Tlön, LOAD "*", 8, 1. 01:53, 20 December 2017 (UTC) - Honestly, focusing on educating people should be the way to go. Racists will find other means to spew their hateful pseudoscientific garbage. --Rationalzombie94 (talk) 13:38, 20 December 2017 (UTC) - I've never said Twitter mobs occur only in one ideological wing, but those should also be restricted. I also think "educating" has a problem of backfiring. We've been trying our hardest to educate people about how blatantly irrational and stupid, how you are your worst enemy against objectivity. But the thing is Backfire effect exists. It's nice to say, "Well, let them talk and have other people say how wrong they are". Psychology seems to say, this might be counterproductive? I like to think we're persuading on-the-fence types that are reading, but maybe only if they're inclined to believe us to begin with? --It's-a me, LeftyGreenMario!(Mod) 20:09, 21 December 2017 (UTC) Some of the discussion here suggests a common misapprehension about media: they are businesses. Newspapers, for example, tend to lay off stories that upset their advertisers, and delete language that might offend their readers. Media is almost always subject to market constraints. I imagine the bosses at Twitter don't change anything until it makes financial sense to do so. There is no other way to run a for-profit corporation: the deciding factors are monetary. This hypothesis is adequate to explain why divisive groups have lasted as long as they have on commercial social media.Ariel31459 (talk) 15:37, 20 December 2017 (UTC) Why is it that whenever there is a hint of a possibility of free speech being slightly less than absolute, we get cries 'thats like communist china!!!' or any such authoritarian hell hole? there is a whole lot more wrong with such places that some minor tweaking wont cause any western democracy to become anywhere near such places. I'm quite happy with what could be described as hate speech being proscribed whether by twitter or by government. Living in a liberal democracy and all, i am quite confident any egregious abuses would be suitably scrutinised and condemned. i dare say most european countries already have limits on such things, and they are not quite north korea yet. AMassiveGay (talk) 21:20, 21 December 2017 (UTC) - I've suggested that the arguments against Twitter censorship, even here, feel like a slippery slope. There's always a concern about it, but we already ban people for conduct abuse and we at RationalWiki already don't allow people to have terrible usernames and many many forums don't allow people to be racist, sexist, homophobic, ableist (like being derogatory toward autistic people). I don't see how Twitter and Facebook are held to a different standard? --It's-a me, LeftyGreenMario!(Mod) 21:31, 21 December 2017 (UTC) - while not disagreeing with your gist, i will say the difference between facebook, twitter etc. and us is that generally policy here is decided by its users. facebook and twitter - policy is generally imposed. AMassiveGay (talk) 22:01, 21 December 2017 (UTC) - Facebook and Twitter also mold their policy based on suggestions too, so I wouldn't say they're entirely independent from user opinion. And when I say some forums, I mean GameFAQs which strictly forbids derogatory use against autistics (see TOU). This can apply here, you have to agree to a Terms of Use to use Twitter. Twitter is giving you a platform for free and you agreed to give up some of your rights so they'll let you have a platform. Now I know you also have a right to criticize how they impose a TOU, if it's too harsh or whatever "hateful speech" is and how it's defined, and Twitter and Facebook's algorithms are shitty enough for anti-vaxxers to abuse them and try to ban their opponents for misleading claims. But I don't think the whole "it's one step to full censorship to things people don't like", I don't really buy that. --It's-a me, LeftyGreenMario!(Mod) 22:09, 21 December 2017 (UTC) - there is also the fact that private companies or not, facebook and twitter are the public forums of the day. if you are banned from these places you are effectively silenced. people should be concerned when they decide to ban folk. it should not be arbitary, it should not be because to pander to business. it should have clear criteria. i believe hate speech should be banned and twitter are right to do so. i also believe it shouldnt be left to twitter to decide what is hate speech. see my comment belowAMassiveGay (talk) 22:21, 21 December 2017 (UTC) - the other thing that comes to mind when discussing limits of free speech is that even the absolutists have limits - 'yelling fire in a theatre' usually gets gets thrown around. living in London, one the most multicultural cities in the world (despite brexit) such hate speech is by its nature divisive and very much 'yelling fire in a theatre'. in my mind the question is not whether twitter has the right to ban such speech but more of why are we leaving to twitter to do this? AMassiveGay (talk) 21:27, 21 December 2017 (UTC) - I thought hate speech was defined before Twitter stepped in, so am I wrong? That hate speech wasn't defined and thus there's the argument that we shouldn't let Twitter decide what's hate speech or not? --It's-a me, LeftyGreenMario!(Mod) 23:07, 21 December 2017 (UTC) - is it unambiguously defined? show me where. is it clearly and unambiguously defined in the US? in US law? i'm not sure that it is. AMassiveGay (talk) 23:19, 21 December 2017 (UTC) - we are certainly not using a specific definition here but discussing generalities. AMassiveGay (talk) 23:25, 21 December 2017 (UTC) - @AMassiveGay hate crime —Kazitor, pending 23:30, 21 December 2017 (UTC) - those are hate crimes not hate speech AMassiveGay (talk) 00:05, 22 December 2017 (UTC) - And hate speech is a subset of hate crime. —Kazitor, pending 00:11, 22 December 2017 (UTC) - its not even remotely what we are discussing. AMassiveGay (talk) 00:27, 22 December 2017 (UTC) - Welll, I was asking you that question but it seems like "no, it hasn't been defined". I'd think it'll be more of a "rules vary depending on where you go" kind of thing. You think Twitter has that power to define hate speech across the board like that? --It's-a me, LeftyGreenMario!(Mod) 00:52, 22 December 2017 (UTC) - they clearly have the power to do so over twitter, which i have already said is unsatisfactory to me. i think its more of an issue in the US though. I think the 1st? amendment makes banning hate speech difficult. AMassiveGay (talk) 01:20, 22 December 2017 (UTC) Current dumpster dive[edit] For lack of a better suggestion, Baked Alaska is the Monday morning dumpster dive, the only topic with positive votes. At least it's apropos of the flaming dumpster iconography. We could really use both more people voting and more suggestions for next week's dive. Bongolian (talk) 05:15, 20 December 2017 (UTC) - Let's be honest. RW:DUMP is) 14:15, 20 December 2017 (UTC) - I took the challenge last weekend and completely cleaned up the Baked Alaska article. I almost feel bad that I did, though; I considered putting it up for a deletion vote after I was done. The article is now no longer simply a collection of quotes but actually has some structure and properly formatted references. It definitely needs more content, if someone has the stomach to wade through all the bullshit associated with this asshat. The dump is not dead, it just smells funny. Regards, Cosmikdebris (talk) 16:55, 20 December 2017 (UTC) - Honestly, I like how it was originally. Not revealing the quotes in plain sight can lead to misquoting, which the article is currently doing. You use an anti-semetic tweet as a citation for Baked Alaska being pro-Trump.—Hamburguesa con queso con un cara (talk • stalk) 01:17, 21 December 2017 (UTC) Impromptu discussion[edit] I set up RW:DUMP in hopes of a fourth option for RW:AFD: Delete, keep, merge, or dumpster: "The topic is good, but the article is terrible". It has been under-utilized and the dumped articles haven't radically improved. Is it worth continuing RW:DUMP? If so, how should it be changed? If not, how should we handle "terrible article, good topic" deletions in the future? FU22YC47P07470 (talk/stalk) 10:52, 21 December 2017 (UTC) - Maybe make "The topic is good, but the article is terrible" a reason for deletion that appears in the drop down menu when you delete an article. If I were deleting such an article, in the the "other/additional reasons" part I'd write, "if somebody wants to have another go at writing an article about this, that's fine." Spud (talk) 12:50, 21 December 2017 (UTC) - Maybe end the voting thing and just make it a list of pages. I also like Spud's idea.) 13:47, 21 December 2017 (UTC) - The idea for a dumpster is good but the page itself needs a little work. I've always been confused at why pages are rated there for voting. What does a positive or negative tally even mean? Perhaps an abstract of the articles can be added, instead of generic comments like "needs to be organized." This could better help guide people to articles they would like to improve. Regards, Cosmikdebris (talk) 13:57, 21 December 2017 (UTC) It almost might be simpler to just have a chronological list of articles that need to be improved -- people add articles and eventually we get to those articles? Herr FüzzyCätPötätö (talk/stalk) 21:53, 21 December 2017 (UTC) - I just don't agree with the voting system because if people have a problem or even if they're neutral, they need to spend some time also explaining about their vote. Kind of then defeats the point of a voting system. It makes more sense in a WIGO to not necessarily explain why you voted, but for a RW, it's not as helpful because the content is something we have control over. I agree with Cosmikdebris here. The concept of Dumpster is good, but I still fear people will just ignore it. But again, there is the off-chance that Dumpster Drive will help one article or so. But again, if Dumpster Drive is discontinued, I won't really miss it, given it's a souped up Category:Articles needing expansion, that's how it feels like sometimes. --It's-a me, LeftyGreenMario!(Mod) 01:17, 22 December 2017 (UTC) - Yeah. Get rid of the voting since nobody understands what it means. Just have a list of articles nominated for improvement with most recently nominated ones at the bottom and work through them in order. Spud (talk) 06:39, 22 December 2017 (UTC) - I don't think it would be terribly minded much if you just selected a less than optimal article yourself without the ritual of polls and the like. - Smerdis of Tlön, LOAD "*", 8, 1. 16:57, 22 December 2017 (UTC) This is going to sound weird[edit] When I saw the name, I thought it was the dessert. Though part of me knew it was not, but considering I never heard of it this way, that is why I thought it was the dessert. --Rationalzombie94 (talk) 01:52, 25 December 2017 (UTC) - The word "impromptu" makes you think of desert? GrammarCommie (talk) 01:59, 25 December 2017 (UTC) - There is a dessert called a Baked Alaska. I glanced at the titled before clicking the link. --Rationalzombie94 (talk) 14:23, 25 December 2017 (UTC) Solstice holydaze[edit] What's up with that? —Kazitor, pending 01:06, 21 December 2017 (UTC) - Yeah. What the hell?—Hamburguesa con queso con un cara (talk • stalk) 01:14, 21 December 2017 (UTC) - And it looks like there isn't even one for the June solstice. —Kazitor, pending 01:31, 21 December 2017 (UTC) - There is usually a 'druid wannabes hanging round Stonehenge' snippet on the UK news that time of year. - Otherwise - establish a Campaign for Summer Solstice Holidays (not to be confused with COSHH) and annoy the religious doom mongers. Anna Livia (talk) 12:01, 21 December 2017 (UTC) Pending a replacement[edit] Something about the sun being in its southernmost position. Get rid of the time cube stuff. Thoughts/ideas/suggestions? —Kazitor, pending 23:23, 21 December 2017 (UTC) - Get rid of the timecube stuff (I assume that's the random insults thing in red, white and blue in the middle), have a snowflake icon on the left and a sun icon on the right. Then you're done. Spud (talk) 06:35, 22 December 2017 (UTC) Don't forget to celebrate the Earth's perihelion on January 3 as well[18]. --Gospatric (talk) 09:50, 22 December 2017 (UTC) Something tells me this will be the slippery slope argument for U.S gun control[edit] Though I'm not sure of it's verdict considering ShiningSwordofThoughts (talk) 03:35, 21 December 2017 (UTC) - since few people in the UK get hard ons from firearms, no one here gives a shit what an american gun trade magazine thinks. AMassiveGay (talk) 10:28, 21 December 2017 (UTC) - My dude, the slippery slope is moving the other way. The Assault Weapons Ban died in what, '04, '05? Nothing real or meaningful since then with respect to controls on firearms. The presumption that if we take one step we will fall down a hill is obviated by the fact that the NRA has turned any attempt at control into an impossible uphill climb. Semipenultimate (talk) 16:06, 21 December 2017 (UTC) - "...considering to ban...". That wording really bugs me. X Stickman (talk) 21:17, 21 December 2017 (UTC) - Honestly I'd personally disgree with UK gun control,and maybe prefer Europe style gun control IE: Germany. I wouldn't be into general caliber restriction. Also got any British gun owners on Rational Wiki. ShiningSwordofThoughts (talk) - Are there not several aspects - 'legislation involving people and guns', 'the cultural aspects of having and using guns' and 'what people think guns are for' - and it is the combination which can be of most significance. (Most people own forks - but few consider using them as weapons.) Anna Livia (talk) 17:02, 22 December 2017 (UTC) Homeopaths Scientists create an ultradilute quantum liquid[edit] An ultradilute quantum liquid made from ultra-cold atoms. I feel I'd have put this on WIGO. They come too late -homeopaths are calling, and I'm imagining an enterprising one will sell stuff of that kind-. Panzerfaust (talk) 13:19, 16 December 2017 (UTC) So do Republicans just think when it's said "Black people can't be racist." that that just defeats acual racism[edit] I mean their definition of black people being racist is very different from acual racism right? ShiningSwordofThoughts (talk) 15:35, 20 December 2017 (UTC) - It's a little unclear what you are asking. I think that republicans is too large a group to expect them to think the same about anything. I know of some republicans, for example, who think they should be paying higher taxes!Ariel31459 (talk) 15:57, 20 December 2017 (UTC) - Racism is more complex than just prejudice, but prejudice should not be dismissed. If I could beat that sentence into the heads of every right wing idiot, we'd all be spared so much pain. ikanreed 🐐Bleat at me 17:08, 20 December 2017 (UTC) - The OP appears to be about some Spanish speaking cultures having little regard for others. This is a world I don't have a window to look into. I figured it might exist, but I don't know how stuff breaks. OTOH, racism is simply prejudice on the basis of race or ethnicity, without regard to merely local histories, and that's the end of the matter. Anyone telling you different is selling snake oil. - Smerdis of Tlön, LOAD "*", 8, 1. 02:05, 22 December 2017 (UTC) - Stuff like lineage tends to be tied up in racism a lot. 1/32nd rule, for example, or 18th century France's racial hierarchy that invented words like "Quadroon" and "Octaroon" while classifying people before the law. As far as Hispanics go, there were different classes depending on how much Spanish blood someone had in them. You even get Hispanic White Nationalists who try to play up the Spanish identity as a European nation, and because Spanish doesn't mean colored.-PsychoGecko (talk) 10:53, 25 December 2017 (UTC) Are these still relevant joke videos?[edit] ,and ShiningSwordofThoughts (talk) RZ94's Official Bullshit Scale (Patent Pending)[edit] This is the official bullshit scale I came up with! :) Level 1[edit] This usually consists of anti-vaccine people, anti-immigration people and Gun Rights activists. List of Offenders[edit] Level 2[edit] This consists of general racists (Individuals/minor groups), Creationists, 9/11 conspiracy theorists and militia movements (low level internet activity). Medical quacks are not forgotten. List of Offenders[edit] - Institute for Creation Research - Bob Jones University - TRACS - Various racist YouTube channels (ex. Nordic Rock and Roll) - Militias - Doctor Oz - Alphabiotics - Georgia Christian University Level 3[edit] This level consist of die hard, violent racists; major conspiracy theorists, Church of Scientology, and terrorists List of Offenders[edit] Let me know what others I should add. --Rationalzombie94 (talk) 23:16, 21 December 2017 (UTC) - Reminds me of {{hinge}}. —Kazitor, pending 23:19, 21 December 2017 (UTC) - How the hell are anti-vaxxers only Level 1, especially below random racist Youtube channels? This is from a "how much damage they can do" stand point, not how morally rancid or intellectually bankrupt these are... the scale can be based on any of these, but I'll assume just the damage part. I'd argue they're even more of a threat than terrorists given the extreme unlikelihood you'll die from a terrorist attack. I wouldn't classify them exactly under ISIS or Neo-Nazis on a "vileness" or "violence" scale but on the scale they're poised to hurt humanity, they're going to be pretty high. I'll also rank global warming deniers high too for a similar reason: far less ideologically rancid as Neo-Nazis or ISIS but can kill much more people and cause more property damage in the long term if they have power. As far as I know, global warming deniers DO have power, in the U.S.. Anti-vaxxers, somewhat given how in many countries, they're successful at having disease return. --It's-a me, LeftyGreenMario!(Mod) 00:31, 22 December 2017 (UTC) - See your point. Some of it was guess work --Rationalzombie94 (talk) 02:45, 22 December 2017 (UTC) - It does seem a bit arbitrary the way you've described it. Perhaps a 2-dimensional scale would be better: scale 1 could be disconnect from reality (with a noted high point at around Time Cube, and scale 2 could be real or hypothetical number of deaths/injuries, with authoritarianism (Hitler, Stalin, and Mao) and possibly Climate change denial at the extreme. Bongolian (talk) 07:54, 22 December 2017 (UTC) - Pretty sure NRA and Tea Party deserve to be in the general racist's category at least. They sunk a lot of money into those Confederate flags. -PsychoGecko (talk) 10:36, 25 December 2017 (UTC) Notice[edit] Go ahead and edit. My assessment was total shit. Even rename the scale if you feel up to it (everybody) --Rationalzombie94 (talk) 02:45, 22 December 2017 (UTC) Vote: Who has the best userpage on Rationalwiki?[edit] the Winner is announced. has already ended. (refresh) —ClickerClock (talk) 06:04, 26 December 2017 (UTC) - The winners are: DiamondDisc1 and Stabby the Misanthrope! —ClickerClock (talk) 01:52, 1 January 2018 (UTC) Rules - You cannot submit yourself. - Add the user to the poll. - Ping the user you entered. Poll[edit] @DiamondDisc1 —ClickerClock (talk) 12:21, 23 December 2017 (UTC) - It’s clearly me. (Yes I am joking):02, 23 December 2017 (UTC) - I have amazing Mario facts that Nintendo doesn't want to let you know. :P --It's-a me, LeftyGreenMario!(Mod) 21:21, 23 December 2017 (UTC) - On RationalWiki, we are all losers. Radioactive afikomen Please ignore all my awful pre-2014 comments. 23:27, 23 December 2017 (UTC) - Mine is at least better than my Wikipedia homepage, which has been around since like 2003 or so and is fairly Web 1.0. (Which is a good thing.) - Smerdis of Tlön, LOAD "*", 8, 1. 02:25, 24 December 2017 (UTC) I think the user page of @Weaseloid is pretty neat. (Too bad self-nomination is not possible. I'm really proud of my page.) Nerd (talk) 19:47, 24 December 2017 (UTC) - Ah, pff, your page has a ton of videos embedded in there. --It's-a me, LeftyGreenMario!(Mod) 19:52, 24 December 2017 (UTC) - I'm just gonna assume by 'pff' you mean 'pretty fascinating and fantastic'. Yep. Carefully chosen and highly educational materials. Nerd (talk) 22:17, 24 December 2017 (UTC) - Is mine the best? Boredatwork (talk) 12:22, 25 December 2017 (UTC) - @Boredatwork Nerd (talk) 14:29, 25 December 2017 (UTC) - @Stabby the Misanthrope also has a visually pleasing user page, in my humble opinion. Nerd (talk) 14:29, 25 December 2017 (UTC) You've almost convinced me to put some fancy CSS all over my page. Almost. Maybe I could try adding to it too? —Kazitor, pending 06:42, 26 December 2017 (UTC) - I have fancy CSS on my userpage. Look at that poll. I'm not even on there even through I have rainbows on my userpage. —ClickerClock (talk) 09:25, 26 December 2017 (UTC) Merry Christmas to Rationalwiki and to all a good skepticism![edit] We shall ring in the new year with more satire and pseudoscience debunking! --Rationalzombie94 (talk) 05:15, 25 December 2017 (UTC) [edit] ShiningSwordofThoughts (talk) - Archiving timestamp, idk how long ago this was posted. Christopher (talk) 19:09, 26 December 2017 (UTC) The Bible is more violent than any horror or disaster film I have ever seen in my 23 years of life[edit] Christian watchdog groups complain about violence on TV and work to censor free speech "immoral" content. But they force the bible on everyone. Each chapter in the bible could be a plot basis for a horror or disaster movie. The Great Flood[edit] Much like the movie 2012 starring John Cusack, a global flood killing billions of people Birth of Jesus[edit] Could be a slasher film like Nightmare on Elm Street (there might be better examples) considering King Herald had all baby boys slaughtered. Ten Plagues of Egypt[edit] Note- each plague could be its own movie. - 1st plague (water turned to blood, fish are killed)- Environmental disaster (can't think of a movie) - 2nd plague (frogs)- Alfred Hitchcock's The Birds (except with frogs) - Plagues 3-6- Contagion (Movie) Note- Can't think of other movies at this point, go ahead and add. Battle of Armageddon[edit] The movie Platoon, on steroids. --Rationalzombie94 (talk) 13:46, 24 December 2017 (UTC) - You forgot to mention other things mentioned in the BoR, and especially who sends all that stuff and is described as "all-loving". Panzerfaust (talk) 14:30, 24 December 2017 (UTC) - @Panzerfaust The Bible is quite Orwellian isn't it? GrammarCommie (talk) 15:37, 24 December 2017 (UTC) - Very much so. I can understand why Fundies hate so much people who use their brains to see the sheer amount of BS in said book as well as how really is Gawd. The only thing that is missing there is Him killing El, Asherah, and others who lost the game. Panzerfaust (talk) 18:35, 24 December 2017 (UTC) God[edit] Crazy Dicktator dictator who murders innocent people, much like Adolf Hitlter! --Rationalzombie94 (talk) 15:43, 24 December 2017 (UTC) - I think comparing a man who actually murdered millions of people to a work of fiction in order to make a point is in rather poor taste. Christopher (talk) 16:23, 24 December 2017 (UTC) - Well, you hear so much about Nazis that it came to mind. Maybe Stalin? The Bible is fiction anyways. --Rationalzombie94 (talk) 18:39, 24 December 2017 (UTC) - In all likelihood any authoritarian state with heavy emphasis on ideological purity and excessive use of propaganda would be a suitable comparison. GrammarCommie (talk) 19:39, 24 December 2017 (UTC) Original Sin[edit] As shown in the picture, it can be compared to North Korea.) 16:30, 24 December 2017 (UTC) - As I said above, it's in very poor taste to compare fiction with mass murderers to make a point. Christopher (talk) 18:02, 24 December 2017 (UTC) @User:Bigs, why not say social satire is wrong? I try to use insults as little as possible, however, why not just say all satire and parodies that exist are in bad taste. To me, the way you worded it implys you are against free speech. Sorry but that is what you are implying (my view). --Rationalzombie94 (talk) 01:58, 25 December 2017 (UTC) - @Rationalzombie94 How did Bigs say any of that? — Unsigned, by: Christopher / talk / contribs - I never said anything along the lines of:30, 26 December 2017 (UTC) Treatment of women[edit] Women are unnamed and generally treated a little more than objects to advance the plot, to give birth or part of economic/sex transactions. Also, it is always the woman who is infertile. It also reminds me of The Handmaid's Tale, a TV series which also takes the Bible hyper literally. --It's-a me, LeftyGreenMario!(Mod) 18:00, 24 December 2017 (UTC) - I remember a Fundie (yes, he's a Fundie since it's someone who talks about an all-loving God who did the last sacrifice sending His son to die for our sins, but at the same time telling that if you don't follow the latter you'll go to Hell) saying that women aren't equal to men due to both biological (this at least is true) and psychological differences and that equality is of the type "in a marriage man protects woman and the rest of the family", even if at least he was against domestic abuse. I'd like to know the opinion of female. Panzerfaust (talk) 11:41, 25 December 2017 (UTC) contributors - I can even argue that even the biological differences can be worked around so this God Dude... you'd expect him to know better, huh? Even if he punishes me for criticizing his logic, it's not going to make him seem smarter. And there's the whole idea that this God person has to be male, I mean, why male? Females are the one who give birth, God should be female. Maybe that's my woman in me speaking. And there's the whole menstruation thing. --It's-a me, LeftyGreenMario!(Mod) 20:42, 26 December 2017 (UTC) - I have read about the Gnostic Christian faith and they have both male/female deity. But fundies call them Satanists. --Rationalzombie94 (talk) 14:07, 28 December 2017 (UTC) A wiki / database of company ethics?[edit] Hello RW Does anyone know of a database or wiki that documents company ethics? (and apologies if this isn't the right place to ask) Thanks, Winterstein (talk) 22:30, 25 December 2017 (UTC) Midday nap[edit] We should have a nap in the middle of the day for our entire lives, like in Sp:09, 26 December 2017 (UTC) - Zzzzzz What were you saying?-💎📀1️⃣ (talk) 04:30, 26 December 2017 (UTC) - Have a Biphasic sleep cycle instead of a monophasic one? I don't know. Which is healthier? Even if both are healthy, how will the corporate and job world support such a sleep schedule?—Hamburguesa con queso con un cara (talk • stalk) 04:57, 26 December 2017 (UTC) - I support almost any system that lowers my blood pressure. GrammarCommie (talk) 05:02, 26 December 2017 (UTC) - @CheeseburgerFace It works in the countries it happens in. The hours are different from ours to factor in the midday nap.) 05:28, 26 December 2017 (UTC) - I'm against the idea. A midday nap would mean I'd have to get out of bed earlier. Boredatwork (talk) 22:55, 26 December 2017 (UTC) As an honorary Spaniard I feel I should mention that nowadays very few working people actually take siestas.Bob"Life is short and (insert adjective)" 06:53, 28 December 2017 (UTC) Quotebox removing linebreaks[edit] Quotebox removes lines when only two items are present: thing 1 thing 2 Compare with regular behavior: thing 1 thing 2 Quotebox does not when three are present: thing 1 thing 2 thing 3 Compare with regular behavior: thing 1 thing 2 thing 3 Any idea what's going on? Sir ℱ℧ℤℤϒℂᗩℑᑭƠℑᗩℑƠ (talk/stalk) 04:14, 27 December 2017 (UTC) - It's not putting the paragraph tags around the first and last lines. Kinda hacky solution: put a break before or after (or both) line break before this regular regular line break after this line break before this line break after this - Makes ugly padding, unfortunately. Applying some styles to .letter pcould possibly fix that. —Kazitor, pending 04:34, 27 December 2017 (UTC) - It's a bug in the template. I always do this: {{quotebox| text goes here }} - The bug also produces uneven spaces between lines.—Hamburguesa con queso con un cara (talk • stalk) 06:41, 27 December 2017 (UTC) - Why is this even here? This belongs in RationalWiki:Technical support. Also this isn't a glitch. The wikitext to HTML thing in Mediawiki just outputs it oddly when it comes to templates. —ClickerClock (talk) 09:39, 27 December 2017 (UTC) Gematria[edit] Is anyone interested in helping me update the section on gematria. The current section is oversimplified in regards to how it's being practiced these days. — Unsigned, by: Antigem / talk / contribs - I suspect, my friend, that even with your grains of knowledge, you know more about it than any of the regulars here. Things like Kabbalah (spelling?) etc are rather obscure, and I guess it's outside the usual range of interest of the average RationWikier. I know someone who's into it, but sadly I have no idea what she's on about most of the time. Sorry! Boredatwork (talk) 23:18, 27 December 2017 (UTC) As a new user I'm still feeling my way around. I know Kazitor has offered to help. Now I have to figure out how to set up the talk page to discuss it. Lack of time with an upcoming obligation, today or tomorrow I'll provide more detail. For starters, I want to make a distinction of gematria in the classical sense, as is historically applied. Words = numbers. Look for significance. In the past few years it has turned into a lot of superconspiracy with so many new non-words =numbers elements it's impossible to list them all here. Dates, football statistics, GPS coordinates, prime numbers, blah, blah, blah. It's usage is mostly in the Freemasonsdidit kind of way. I may have spread overstepped my bounds by editing out the previously existing reference to linguistics this morning. I contend that not only does linguistics not help, the opposite of proving that gematria, even in the "classical" form, doesn't work. Homonyms? Direct antonyms Guilty=94, Innocent=94. Then add in multiple cipher cross matching, the pattern recognition and other add ons in recent years, it's now approaching That's not even wrong!. So yeah, I'm firmly biased against it. And to keep the wiki clean I, as a newbie, welcome rational discussion before major overhaul. I can snark with the best of them, but can save that for my blog. So anyone who wants to help, "reign me in" when I step on toes. Looking forward to discussion with people that can put together a logical argument. And Kazitor...tips on setting up the discussion page? — Unsigned, by: Antigem / talk / contribs - @Antigem On talk pages, please sign your comments using four tildes (~~~~) or by clicking on the sign button: on the toolbar above the edit panel. You can also indent successive talk page comments using one more colon (:) for each line. Thank you. - Setting up the talk page is very simple. Just go there, and then press "Add topic" up the top. There'll be a field for the topic and what you want to say. Remember to sign your posts. —Kazitor, pending 22:13, 28 December 2017 (UTC) Counter these arguments[edit] ShiningSwordofThoughts (talk) 01:57, 28 December 2017 (UTC) - this answer brings up a lot of points, most of them uncited but I'll try to tackle the main ideas. - -service delays tend to be longer in Canada (My country of origin as well as my reference point) it is also a bad example because we are one of the worst for wait times [19]. However while 97% of canadians have a doctor to go to (see previous reference) 33% of Americans know someone who couldn't go to the doctor due to cost [20] which might mean that this shorter wait time is due to less overall use. This also calls into question her statement of "first rate medical care" for most people since a large porportion of people have trouble accessing it at all - -Its very questionable that American healthcare really is better since Canada has a three year longer life expectancy[21] and with a much lower risk of becoming bankrupt through it. I don't know how else you'd calculate healthcare quality outside of how long people live while using it but Susann seemed keen of flatscreen televisions - -She argues that there are large budget concerns for for public healthcare but the United States currently pays the most for healthcare, double that of Canada [ - The only part I can't argue against is the difficulty in implementing healthcare now rather than any other time since as far as I know there's no examples to point to in the last year. Vorarchivist (talk) 05:21, 28 December 2017 (UTC) Spitting Image[edit] I would love to see this show revived. Just imagine what they could do with the political characters we have now. Here's one of my favorite sketch involving Tony Blair. Bonesquad11 (talk) 15:26, 28 December 2017 (UTC) - this is absolutely terrifying, the Tony Blair puppet looks like a tortured corpse. Vorarchivist (talk) 17:23, 28 December 2017 (UTC) - You should see their Ronald Reagan puppet. Bonesquad11 (talk) 21:32, 28 December 2017 (UTC) - That's terrifying. Vorarchivist (talk) 20:25, 29 December 2017 (UTC) - The show's title should be "Spirit and Image", not "Spitting Image. "Spitting Image" is a misspoken colloquialism.—Hamburguesa con queso con un cara (talk • stalk) 21:39, 28 December 2017 (UTC) - But puppets have no spirit, so it should just be Image. Boredatwork (talk) 21:23, 29 December 2017 (UTC) Paul Nehlen[edit] It's probably a good idea to work up a page on Paul Nehlen, who's now running against Paul Ryan for Congress. If you haven't heard, he's so anti-Semitic that even Breitbart rejected him. The current Wikipedia page is crap (and has already been deleted twice and is now under AfD), but it has sufficient references to use as a start. Anyone want to help? Bongolian (talk) 18:10, 28 December 2017 (UTC) - Maybe wait to see if he wins? Boredatwork (talk) 18:12, 28 December 2017 (UTC) - He's not going to win, but he may go forth to bring his bigotry to yet another corporation. We generally don't care about notability at RW, and we've rescued deleted articles form WP in the past that were deleted on notability grounds. Bongolian (talk) 19:34, 28 December 2017 (UTC) - Should we write one on Randy "Ironstache" Bryce, his actual competition?:54, 28 December 2017 (UTC) - Unless you can show otherwise, I don't think Bryce is missional. Nehlen is missional because he's an anti-semite. Bongolian (talk) 06:45, 29 December 2017 (UTC) - Oh, look. Smoloko likes him. I say we wait until he wins to write an article about him.—Hamburguesa con queso con un cara (talk • stalk) 15:51, 29 December 2017 (UTC) I can already Imagine the the "Liburl Sjw's are destroying Christmas." Argument[edit] ShiningSwordofThoughts (talk) 02:49, 23 December 2017 (UTC) - I don't think anyone should bother neighbors who put up Jesus signs. I don't agree that Christmas and Christianity are related at all (IMO Christmas has pagan roots with no connection to Christianity and has evolved from simple winter festival and holidays which varied much in Europe; to call it a "Christian" holiday that's about "the birth of Jesus" seems like the stupider Christians want to steal Christmas from everyone; it doesn't help that at one point, hardcore Christians wanted to ban Christmas for being pagan, so no, please don't make up shit that Christmas is NOW supposed to be Christian and bitching about "war on Christmas" and "Happy Holidays"). Nevertheless, picking a fight over a Jesus sign is petty. Despite some asshole Christians wanting to reclaim Christmas, most Christians just just want to enjoy their contribution to the pagan winter tradition. --It's-a me, LeftyGreenMario!(Mod) 03:28, 23 December 2017 (UTC) - It's their own damn fault for joining a homeowner association instead of living in a libertarian paradise. 😜 Bongolian (talk) 05:46, 23 December 2017 (UTC) - I whole heartedy agree with,but I predict that's what's going to be claimed by the people who think the War on Christmas is a thing. ShiningSwordofThoughts (talk) 06:41, 23 December 2017 (UTC) - HOAs are shit.:20, 23 December 2017 (UTC) - This would probably fall under some kind of discrimination thing because it has to do with religion, but otherwise, HOAs are infamous for not letting families own more than one car, telling people they can't have American/Canadian/Mexican/etc flags in their yards, and banning real estate signs. J. Zoia (talk) 14:52, 30 December 2017 (UTC) I feel this video might be slightly Anti-Union,but I'm not sure?[edit] ShiningSwordofThoughts (talk) - I would say it's definitely anti-union because the beginning part blames the cost on union employees. Whether or not they are trying to push an agenda, I don't know because I am not familiar with the publisher. As a side note, I literally saw an ad for Pensacola Christian College before the video started and they are definitely anti-union. J. Zoia (talk) 15:24, 30 December 2017 (UTC) Trump recently tweets about Global Warming[edit] It's about as trope denialist as you will expect. БaбyЛuigiOнФire🚓(T|C) 01:24, 29 December 2017 (UTC) - Why hasn't Trump singlehandedly made Twitter lame, bogus, played out, or whatever it's called anymore? Is this the hill my gen Xers and millennials are going to die on? Twitter? Because we can't just give it to the old people and little kids? Fallacies thrive on sound bites and now tweets. The real story is rarely summed up so quickly. Gaul Dernitt (talk) 06:42, 29 December 2017 (UTC) - Because the internet is no longer the freely-tranisitioning from-site-to-site and tech-to-tech patchwork you remember for the halycon days of like... 10 years ago? Instead a few big corporations control each method of communication and if you don't like it, you can get fucked. Our cyberpunk dystopia is boring. ikanreed 🐐Bleat at me 15:47, 29 December 2017 (UTC) - It is indeed boring, no dark neon lit skylines, no rogue operatives, and worst of all no cybernetics. Comrade GC (talk) 15:51, 29 December 2017 (UTC) - You're either fucked or you can make an alternative like PewTube or Gab.ai. While the Internet is more or less centralized, there are still fringe websites that are populated by 20 or so users. However, at that point you're bound to find fringe beliefs.—Hamburguesa con queso con un cara (talk • stalk) 16:29, 29 December 2017 (UTC) - My favorite fringe belief that no sane person accepts is that a wiki can be rational. ikanreed 🐐Bleat at me 17:55, 29 December 2017 (UTC) - Which big corporation controls RationalWiki? :D J. Zoia (talk) 15:34, 30 December 2017 (UTC) Your thoughts on this article?[edit] ShiningSwordofThoughts (talk) - It's a good way to teach kids languages that their parents don't understand, and this is the US so poor people can't have nice things, ever. ikanreed 🐐Bleat at me 17:15, 29 December 2017 (UTC) - Every child needs to get started on learning a second language while they're still in the prime years for doing it. It's such an obvious advantage that it's hardly surprising that the upper classes are seizing the opportunity for their children as it presents itself. - Smerdis of Tlön, LOAD "*", 8, 1. 17:29, 29 December 2017 (UTC) - I like my way of saying it better. ikanreed 🐐Bleat at me 18:32, 29 December 2017 (UTC) - is not a second language on whatever passes as a national curriculum over there? even us brits have to learn a second language and we are known to be shit at it AMassiveGay (talk) 19:19, 29 December 2017 (UTC) - As far as here is concerned, we don't start learning a second language as late as middle school. I envy those Europeans who can speak a second language, to a far better ability than I could ever speak a second language. I fully support learning a second language very early into one's life, you get to see the world with a different set of eyes and you get insight on another culture. БaбyЛuigiOнФire🚓(T|C) 19:25, 29 December 2017 (UTC) Bilingual education is great. The article is a little confused about Latinos. It is a demographic by language group, like Quebecois in Canada. 85% of Argentinians are white. 80% of Puerto Ricans are white. Mexico has not counted their citizens of European descent for about 100 years, and estimates range from 9%-47%. It should be about serving the poor, but everyone deserves an education, and that sounds even better when you say it in French, but todos merecen ser educados.Ariel31459 (talk) 00:09, 30 December 2017 (UTC) - Il faut que tout le monde mérite une éducation. --It's-a me, LeftyGreenMario!(Mod) 20:46, 30 December 2017 (UTC) Your thoughts on this video?[edit] also thankfully the comments are disabled ShiningSwordofThoughts (talk) 05:44, 28 December 2017 (UTC) - My thoughts? This transgender nonsense is annoying. I mean, I can kind of understand why boys would want to be girls because we are totally awesome, but not really. We have periods to deal with, they don't. We get paid less. J. Zoia (talk) 15:30, 30 December 2017 (UTC) - This is a common form of authoritarianism: apologies are insufficient. Punishment is always required. Not liberal.Ariel31459 (talk) 00:58, 31 December 2017 (UTC) Evolution and Red Giant Stars[edit] I have heard scientists talk about when the sun expands that is supposed to kill all life on Earth over time. I am a little skeptical about that (not in the sense as a creationist's pseudoskeptism). Would it not be possible for life to adapt to survive much of the extreme heat? Or life evolving into a gaseous-like form (something like functioning cells made of gases and can divide. Not sure how I want to put it). It seems too early to actually make that conclusion. Scientists don't know everything about evolution yet (again, not in the creationist sense of the statement). I want to have some opinions on this one. :-) --Rationalzombie94 (talk) 01:15, 30 December 2017 (UTC) - I'm pretty sure when they meant by that, the sun will expand in heat far too rapidly for much of life to properly adapt to the changing circumstances. I think some of the life could survive the extreme heat if the sun starts brightening up, like the extremophiles water bears and cyanobacteria, but because the water will eventually dry up, the necessity of life, most of life will probably perish. БaбyЛuigiOнФire🚓(T|C) 01:19, 30 December 2017 (UTC) - The red giant branch (before helium fusion) is very rapid, there'd be little time. Another point of concern is that the inner planets will be literally swallowed by the expanding star. It is, however, uncertain if tidal effects might allow Earth to get to a higher orbit. It'd still be way too hot, though. —Kazitor, pending 01:26, 30 December 2017 (UTC) - All of the above assumes that life on Earth lasts up to the Sun's nova stage, there is a chance the Earth will be empty of life by that point due to various factors. Comrade GC (talk) 01:29, 30 December 2017 (UTC) - Well yeah, that's not accounting for random gamma ray bursts, supervolcanoes, meteorite strikes, obviously. But let's assume that life survives to that point for the sake of argument. БaбyЛuigiOнФire🚓(T|C) 01:32, 30 December 2017 (UTC) - Carl Sagan has a nice sequence in his book Cosmos with beautiful paintings that describes this. "Several billion years from now there will be a last perfect day...Then, over a period of millions of years, the Sun will swell, the Earth will heat, many lifeforms will be extinguished, and the shoreline will retreat...The oceans will rapidly evaporate and the atmosphere will escape to space. As the Sun evolves towards a red giant, the Earth will become dry, barren and airless. Eventually the Sun will fill most of the sky, and may engulf the Earth." (p. 228-229). Regards, Cosmikdebris (talk) 03:52, 30 December 2017 (UTC) - @Cosmikdebris sounds a bit poetic. Comrade GC (talk) 03:56, 30 December 2017 (UTC) - Well, stellar evolution says that's what likely will happen. Sagan did try and put astrophysics into terms for the [1970s] masses. Regards, Cosmikdebris (talk) 04:02, 30 December 2017 (UTC) - And the timespan is long enough for politicians (Homo sapiens or from 'whichever sentient species follow(s) us) to work something out - or the proverbial 'Aliens of the Galactic Zoo Quest (DA was on Book of the Week) to find Life on Earth. Anna Livia (talk) 23:41, 30 December 2017 (UTC) - It's so far off into the future, we don't even need to worry about it, the time needing to worry about it far longer than humans even started existing as the earliest hominid ancestor. БaбyЛuigiOнФire🚓(T|C) 23:44, 30 December 2017 (UTC) - I think at that time, H. sapiens are extinct, though not killed off, just populations slowly transitioning to a new species. --It's-a me, LeftyGreenMario!(Mod) 23:51, 30 December 2017 (UTC) - Forget it. Unless there's someone around to fix things a few hundred millions of years from now as the Sun increases its luminosity the carbon cycle will begin to break down and plants will begin to disappear followed by animals, leaving just bacteria. Some estimations suggest that in around 1 billion years from now the only things that will remain will be bacteria in a desertic world where the oceans have evaporated away due to an increasing greenhouse effect. If this planet does not go Venus before, killing everything that remains alive unless it has gone to the atmosphere, in less than three billion years from now even bacteria will be no more as Earth becomes a searing hot desertic world. Billions of years later, as the Sun goes red giant, things will be very hellish (as in a global magma ocean) and that even if Earth was not absorbed by the Sun (check Future of Earth). Panzerfaust (talk) 13:13, 31 December 2017 (UTC). Does that CAPTCHA continue to pop up for everybody each time one posts something?[edit] It is sooooooo annoying. How many do I have to do before the wiki realize I'm not a robot? J. Zoia (talk) 15:47, 30 December 2017 (UTC) - You've made enough edits (≥10), now you just have to wait until your account is over a day old. Christopher (talk) 16:00, 30 December 2017 (UTC) Question about recycling[edit] I read an article that said that people shouldn't put boxes with grease on them in the recycle bin because grease will ruin the whole batch. How much grease is too much grease? Because almost every store or restaurant I've worked in put boxes in the recycle bin that have some grease or other contaminants (battery acid, motor oil, liquid medicine that spilled, glue, you know), so obviously there is a certain amount of it that is okay. J. Zoia (talk) 18:42, 30 December 2017 (UTC) - link to article? БaбyЛuigiOнФire🚓(T|C) 19:01, 30 December 2017 (UTC) - Probably makes a big difference in what the material is. Plastics maybe; metals, I doubt it. - Smerdis of Tlön, LOAD "*", 8, 1. 21:12, 30 December 2017 (UTC) - This Stanford article on recycling considers even small amounts of grease to be an issue but it does say that greasy plastic and metal is not a problem. Vorarchivist (talk) 22:51, 30 December 2017 (UTC) - I was talking about cardboard. Pizza boxes usually have a lot of grease on them, so that makes sense. I'm more curious about careless businesses potentially ruining the process by throwing boxes with specs of grease on them and maybe a spill here or there (but not being covered in grease like a pizza box). I'd be suprised if dining services at that college doesn't recycle boxes with a little bit of grease on them. J. Zoia (talk) 13:05, 31 December 2017 (UTC) - That is probably causing a problem, I personally cut out the greasy sections to spare me the worry. Vorarchivist (talk) 20:54, 31 December 2017 (UTC) So long and thanks for all the fish (redux)[edit] If I wrote a computer program exploring the limits of evolution, I'd start simple but not binary. So I would need four different blocks that only interacted according to certain, specific, rules. I'd shoot for the moon, literally, judging my program a success when these four base-pairs put themselves together in such a fashion as they are able to at least once travel to their World's only satillite! Oh, heck, I'd even keep the damned thing running for fifty game-years to see if they can surprise me! 20:02, 30 December 2017 (UTC) C®ackeЯ - I need more context. Did you create a simulation of animal breeding on a computer?—Hamburguesa con queso con un cara (talk • stalk) 20:09, 30 December 2017 (UTC) Cal Cooper[edit] In this interview, Cal Cooper refers to Rationalwiki as "bastards", [22] (although he seems to have confused Wikipedia with Rationalwiki). He says he tried to fix his article. He has now turned up on the talk-page on another account. I reverted him. What is the policy here about people editing their own articles? Anti-Fascist for life (talk) 12:50, 31 December 2017 (UTC) The "Bastards" comment appears around 45.00 mins in the interview. He also says some other things about his article. He advertises himself as a "science promoter" but I cannot find any science he has done. Anti-Fascist for life (talk) 12:52, 31 December 2017 (UTC) - I guess everyone on the wiki is bastards? Oh well. --Rationalzombie94 (talk) 19:18, 31 December 2017 (UTC) - Not going to argue against that. БaбyЛuigiOнФire🚓(T|C) 19:21, 31 December 2017 (UTC) - Fun fact. I actually am a literal bastard, having been born out of wedlock and all. Comrade GC (talk) 19:23, 31 December 2017 (UTC) - I don't know if there's an official policy on editing one's own mainspace page, but it is at least unofficially discouraged. If someone has a problem with their own page, they should bring up any inaccuracies on the talk page. If these are valid complaints, we do try to correct them. Bongolian (talk) 19:49, 31 December 2017 (UTC) Flat Moon BS[edit] Have fun. Panzerfaust (talk) 17:31, 31 December 2017 (UTC) - "Why would NASA lie about the shape of the moon?...The simplest answer is that the claim is nothing more than an online hoax created by a flat Earth believer." <- best quote from the article БaбyЛuigiOнФire🚓(T|C) 19:21, 31 December 2017 (UTC) - The guy uses the bridge camera with the most powerful optical zoom in the market (Nikon P900, 83x) and in a YT video has also claimed while recording both the Moon and Jupiter on a cloudy night than the latter is in front of the clouds. Merry 2018. Panzerfaust (talk) 21:21, 31 December 2017 (UTC) Syrian War Media Coverage[edit] So... I haven't seen much on the Syrian civil war in the BBC or CNN, this year compared to prior years. There was a bit about ISIS kicked out of Iraq, supposedly, and a bit with Russia and Assad solidifying after Aleppo, but not much lately. What happened? Did people just get tired of reporting on it? Or is Brexit/Trump really worth all the attention? CorruptUser (talk) 23:22, 31 December 2017 (UTC) - pretty much. at least they got a better run than Yemen. AMassiveGay (talk) 23:32, 31 December 2017 (UTC) Net neutrality has been repealed[edit] Fuck, fuck, FUCK!:29, 14 December 2017 (UTC) - Don't worry, for $1.50 per month you can add the wikis and resources package that allows access to sites such as the Silent Hill Wiki, Conservapedia, and every other wiki comcast deems appropriate for children! They may even one day give you access to rationalwiki. ikanreed 🐐Bleat at me 18:33, 14 December 2017 (UTC) @Bigs My thoughts were more along the lines of "those bloody fucking arse crapshit morons actually did it, we're all fucking screwed" GrammarCommie (talk) 18:47,:50, 14 December 2017 (UTC) - It was suggested by Rep. Ted Lieu that by holding the vote today, Ajit Pai could be considered complicit in the criminal activity that was uncovered by New York Attorney General Eric Schneiderman's office (2 million fraudulent comments were submitted to the FCC on net neturality).[23][24] Bongolian (talk) 19:10, 14 December 2017 (UTC) - Oh hey, Susan Collins adds her name to letter asking @FCC to cancel the #NetNeutrality vote. No, I still remember her voting for the tax bill, but yeah. --It's-a me, LeftyGreenMario!(Mod) 19:49, 14 December 2017 (UTC) - So - looking at the page on the other place does this affect only the US or is it more global? - And given the election twisty in Alabama and other trumpery is there an element of 'burying bad news'? Anna Livia (talk) 20:47, 14 December 2017 (UTC) - It will be bad for non-US users of websites that need US visitors to survive and could lead to other countries repealing whatever version of net neutrality they have, so yeah. I don't think Doug Jones winning the Alabama election thing was a conspiracy to make people forget about net neutrality if that's what you mean (I've probably misunderstood you). Christopher (talk) 21:43, 14 December 2017 (UTC) On the bright side, now our fundraisers can be blunt: GIVE US MONEY TO PAY OFF COMCAST OR THEY WILL KILL US FuzzyCatPotato of the Rigid Guns (talk/stalk) 22:01, 14 December 2017 (UTC) - You misspelled bribe Fuzzy. you also misspelled "extortion payoff". GrammarCommie (talk) 22:19, 14 December 2017 (UTC) - Is this definitive or there's still hope it will overturned (it will supposedly be challenged)?. Meanwhile in the comments of a site about filesharing, a Christian lesbian libertarian entrepeneur (not making that up, unless she's a troll) is insulting everyone who thinks this is a very bad move. Panzerfaust (talk) 22:49, 14 December 2017 (UTC) - The Senate better not pass this bullshit.:57, 14 December 2017 (UTC) - It only affects the USA. If you use a proxy or shell from the United States, it affects you as well.—Hamburguesa con queso con un cara (talk • stalk) 02:02, 15 December 2017 (UTC) In other news, I saw this meme. Apparently, PornHub is offering free premium access for a week. Enjoy your free porn while it lasts!—Hamburguesa con queso con un cara (talk • stalk) 02:09, 15 December 2017 (UTC) - I'll add this event to my mental list of "Reasons to never move to the USA". Like it needed to be any longer. —Kazitor, pending 04:18, 15 December 2017 (UTC) - How much American law values citizens' privacy can be summed up in the HIPAA laws: medical companies care more about the integrity of medical records than actually protecting people's information. The UK's medical laws stress more on privacy. However, the UK's GCHQ has been whistlblown to be spying on its citizens, so there's that.—Hamburguesa con queso con un cara (talk • stalk) 07:20, 15 December 2017 (UTC) - You can shorten to just "citizens". From our health care to our gun control to our environment and air, American law doesn't give two piles of Goomba skin shavings. Sadly, Kazitor, I'm stuck in this joke for a country. Fuck the Republicans, fuck them to hell. --It's-a me, LeftyGreenMario!(Mod) 23:17, 15 December 2017 (UTC) - If I lived in a country with huge crime problems yet without the death penalty, I'd want a gun too. Lord Aeonian (talk) 17:59, 16 December 2017 (UTC) - Death penalty does nothing to deter crimes, if that's what you're implying. --It's-a me, LeftyGreenMario!(Mod) 02:22, 17 December 2017 (UTC) - Odd way for a discussion on net neutrality to) 11:57, 18 December 2017 (UTC) - Well, the discussion started in the context of the USA, not net neutrality. Unless you didn't notice that :P —Kazitor, pending 12:26, 18 December 2017 (UTC) I just realized that my country has never had Net Neutrality[edit] I kinda assumed we were better than America, therefore we totally must had Net Neutrality. Trust me, my wi-fi is shit. It's slow, laggy and just stops working sometimes. Enjoy your future, Americans. Suffer with me. —ClickerClock (talk) 03:50, 1 January 2018 (UTC) - How will all this affect the wider network, as in terms of third party data? Given how much data traffic is passing over telcos networks that originates from another network (not one of their customers) and is headed to another network (likewise), would they have the right to arbitarily slow or block this traffic on a whim? What if the origin or destination (or both?!) is outside the US? Looking at a map of global submarine data cables, it's worrying that pretty much every transpacific data link from Australasia and Asia to the Americas lands on US territory - so is an Australian who uses a Canadian or Brazilian cloud storage provider going to have their connection screwed over by Comcast - and be able to do nothing about it, since neither end are Comcast customers? I've found it really hard to actually find an explanation of exactly how the sponsors of this bill envision it working - they seem to have a very narrow or oversimplified idea of how the internet works. TheEgyptian¿Dígame? 09:33, 1 January 2018 (UTC) The point is, part 3[edit] I have received anti-female abuse (yet again) #only# on RW. I am a reasonable contributor (with occasional humour/trivia) - and RW needs 'persons not based in the US and not using male or neutral names, or IPs' more than I need RW. As I have said before I accept that RW is more boisterous than other parts of the wikiverse, and many threats/examples of abusive behaviour are reverted promptly - but there is a problem, possibly expressed in part by there being a blocking reason 'Dance, little man, dance' - but no equivalents for other genders and IPs. Anna Livia (talk) 21:08, 26 December 2017 (UTC) - <- follow this. The advice remains the same: ignore, revert, block, protect (if it's too much), forget. As I said, complaining about them is just giving them the attention they crave. It's only RationalWiki this happens because we're more partisan and provocative than other sites and there just happens to be a persistent troll. We went over this already. --It's-a me, LeftyGreenMario!(Mod) 21:12, 26 December 2017 (UTC) - We understand that it's not exactly pleasant to be told to just ignore it rather than responding to and stopping it, but there's nothing we can do. This platform is open to anyone to edit, and that comes with certain risks. It's not RW that's the problem, it's just that some troll has found some people worth annoying here. And once again, unfortunately, posting these threads only feeds into the problem. You really have to just put up with it and remove it. —Kazitor, pending 22:15, 26 December 2017 (UTC) - But it #is# RW's problem - as with Facebook etc and the adverts and postings. - The 'Dance ...' statement does say something about RW's attitude towards the user base. - How many potential RW contributors on reading exchanges such as this consider the 'If you know a better 'ole go to it' poster and do so? Anna Livia (talk) 00:43, 27 December 2017 (UTC) - I mean, the same potential problem would exist on another site similar to RW as long as it was publicly editable and built using wiki software, so I don't think that would happen. Spriggina (tal) (framlög) @ 00:53, 27 December 2017 (UTC) - This is why we need stronger blocks, people.) 01:59, 27 December 2017 (UTC) - But how? Once they set up a new account from a new IP, there's nothing we can do. Unless you advocate huge IP range blocks (which I doubt you do) —Kazitor, pending 02:02, 27 December 2017 (UTC) - "Stronger blocks". What exactly do you mean by this? Range blocks? Longer blocks? Because neither of these are going to work with some trolls, especially ones that abuse proxies and change BoN addresses. One week is usually long enough to deter most trolls and other trolls can just have their blocks renewed. And their edits are easily reverted (though they clog the history) so there is seriously little point for "stronger" blocks. - "RW's" attitude toward the user base. That's a "joke" reason and it's only there for fun. If the receiving party doesn't like that block reason, they're always welcome to tell the blocker to knock it off. Most people will comply. But I think it fits with the rest of the "snarky" chill wiki's atmosphere. I don't understand your problem with our joke block reasons, which are accompanied with joke blocks that last for 0 seconds, or that those reasons, along with vapid trolls, are enough for people to be too timid to register. --It's-a me, LeftyGreenMario!(Mod) 19:58, 27 December 2017 (UTC) Most people accept that RW is going to contain a large number of participants who are opinionated, have views at significant angles to other contributors (or even reality), or have 'offbeat/pet ideas they are fond of' etc: 'ideas and views' are things that can be changed and are legitimate targets (but should be challenged rather than abused). If someone has a passion for a particular opinion which is not of itself harmful (supporting a sports club near the bottom of the league, which Doctor Who is the best etc) it should be tolerated. Across the wikiverse IPs can and do make useful contributions or are at least harmless (and who hasn't corrected a minor typo without bothering to sign in, or used an IP to make an anonymous contribution etc?) There will always be, across the wikiverse, look-at-mes, wiki graffiti artists/blankers and suchlike where a short block suffices to deal with the problem (boring them through being unable to edit and giving the blocker the minor satisfaction of dealing with the issue). It is the actually abusive trolls who are the issue. There will also always be problems with filters (from other contexts often finding 'hidden bad words' - 'Gillespie Road' Football Club is one of the examples used). Is it possible to manipulate the programming so that 'alerts and messages' generated by harassing messages are also removed with the latter so that the person targeted is not made aware that the thing ever happened? Can RW create a culture/climate in which diversity is encouraged, as it does seem to have a certain imbalance - and people are likely to be discouraged from contributing as a result. And as for the blocking phrases 'Scramble your numbers IP' perhaps? Anna Livia (talk) 11:20, 27 December 2017 (UTC) - I don't think it is possible to remove the alerts, unfortunately. However, ClickerClock and I shall be working on hopefully preventing a fair amount of the original problem, permanently. And I would say that diversity is encouraged, at least to the degree that we don't work towards a lack of it. I don't think it would be appropriate to forbid new users who are similar to the majority in the interests of promoting "diversity", we just have to let as many people as possible join and be sure to hear the range of opinions. —Kazitor, pending 11:40, 27 December 2017 (UTC) - I meant diversity in its most general/positive sense to encourage creative, neutral and even the merely flippant contributors and passers-by across the spectrum of 'human types' and geographical localities (rather than attempting to actively recruit supposed under-represented groups - sports fans and Whovians are likely to give more priority to their particular interest wikis than RW). - Any equivalent to 'deleting the alerts' (ping, user and attached talk pages etc) would serve the same purpose (that the person being targeted is not aware that "some #### was trying to annoy them") - and any automatic filter will encounter occasional false positives (as most people are aware). Anna Livia (talk) 13:01, 27 December 2017 (UTC) - I think there is some case for un-alerting false alarms if that's possible but all the other complaints I think are invalid. Again, these trolls are not our problem and for the fiftieth freaking time, STOP COMPLAINING ABOUT THEM. We already are aware of this problem. We are aware it is difficult to prevent persistent (or you call them "abusive" trolls. They certainly are not abusive not "verbally abusive" anyway; they like to see you cry about it so they pick on you to see your reaction. I know what verbal abuse is. We have told you that the best way to remove trolls without stifling user edits is patience. Are you now implying that RationalWiki is "hostile" to diversity because some trolls are really persistent? Otherwise, your bringing up of diversity of users sounds like an entirely different subject for the Saloon. What is your specific problem with "diversity"? What do you mean "people are likely to be discouraged from contributing as a result"? Exactly how? I know we have a snarky attitude and there are quite a bunch of silly men here, but I seriously don't understand your argument since it's so vague. Anecdotally speaking I myself have minority traits: am a female, have ADHD, am a birder, am a Mario nerd, wants to be an artist, has mixed race heritage, has an identical twin sister, etc. but I also happen to like the skeptic circles and enjoy critical thinking, especially on the science side like homeopathy and alternative medicine. If you ask people, you'll probably get some more interesting viewpoints and interests on things. --It's-a me, LeftyGreenMario!(Mod) 19:58, 27 December 2017 (UTC) - The 'false positives' refers to user-names and similar; I was actually arguing for #more# diversity (including people who happen to operate outside the US); and I was distinguishing between 'wiki-graffitists', differences of opinion and discussions of wiki-relevance and suchlike on the one hand and those who use actually threatening/abusive language. - As I have said before - I contribute elsewhere in the wikiverse accept that RW by its nature will have more disruptive behaviour (of all kinds) than other thereof - and I am not against having an opinionated discussion/disagreement, and I am not aware of abusive behaviour directed at me in other open platform contexts. - Trolls 'do not make me cry' - they merely annoy me (and encourage me to operate elsewhere in the wikiverse or fandom - some of which would make some of the trolls cry). - Wikipedia says 'be bold' - and various points on[25] can apply. - And perhaps I am trying to analyse RW using its own logic. Anna Livia (talk) 00:54, 28 December 2017 (UTC) - I do belong to a minority - 'persons outside the US who edit RW' - which does seem to be #very# US orientated. I am not a snowflake/do not 'get the vapours' if someone says boo to me, and have edited in the wikiverse for more years than I care to admit - and I rarely encounter more than the wiki-graffiti-mongers (which are occasionally amusing inconveniences) apart from here. How can RW make the pathetic little individuals who become trolls less visible on the site? - And could there be other put-downs than the little man phrase? Anna Livia (talk) 18:46, 28 December 2017 (UTC) - IGNORE THEM Christopher (talk) 19:02, 28 December 2017 (UTC) - The 'wiki-graffiti-mongers and related nuisances' are easily ignored (beyond giving them 'your favourite ban-length'), and if you learn something/improve your arguments the 'persons arguing in circles etc' have lost, the 'reasons' probably do need varying over time ('your numbers will be crunched like cornflakes'?)... and the "all mou's and no trou's" can be ignored from wherever I choose. Anna Livia (talk) 15:12, 29 December 2017 (UTC) - You have implicitly asked, a number of times: why are the trolls bothering me here, they don't bother me at other wikis? I don't know, but I have a hypothesis. This wiki favors many views that are considered controversial, about feminism, social justice and the like. There isn't much difference between wise-assery and snarkiness. Trolls can be very snarky. On this wiki, if you have a female user name, trolls may assume you are a feminist of the moonbat clan, or some such nonsense. On wikipedia, trolls are unlikely to assume a female user name implies anything special. Recently I received an anonymous email, from the RW system, with the single word, "c***". I took this to mean that someone was exasperated at losing an edit conflict with me. So it goes. I have to laugh at such an exasperated admission of defeatAriel31459 (talk) 16:28, 1 January 2018 (UTC) - FYI "edit conflict" is something else that I can't be bothered to explain, the only thing that I think you might've meant is "edit war" but that's not usually something people admit to partaking in. Christopher (talk) 16:49, 1 January 2018 (UTC) - No. I don't mean edit war. I don't do that. I am willing to go along with consensus. I am trying to be supportive here.Ariel31459 (talk) 17:15, 1 January 2018 (UTC) - My previous comment did imply that you are an edit warrer, which you are not, sorry. Christopher (talk) 17:17, 1 January 2018 (UTC) - If you don't cut it out I'm going to vote for you. See how you like that!Ariel31459 (talk) 17:21, 1 January 2018 (UTC) Anything wrong with being obsessed with the concept of societal collapse?[edit] I suffer from Autism and have been obsessed with societal collapse for a while, mostly from binge-reading TV Tropes and playing Fallout: New Vegas (I admit, the Fallout games aren't a realistic scenario when it comes to societal collapse, what with radiation turning people into zombies and making scorpions six-feet long (despite the size constraints arthropods face due to the amount of oxygen in the atmosphere), genetic engineering turning Venus fly-traps into giant man-eating plants and people into hulking ogres, working computers and machines centuries after societal collapse etc, although Fallout is deliberately a satire on 1950's views of the world). I've found myself wanting society to collapse, and after reading a few pages on RationalWiki I've found myself to be a bit embarrassed. Is it wrong to feel this way?--Palaeonictis (talk) 17:47, 31 December 2017 (UTC) - Here are two possibilities: - You're depressed and want to see the world burn. - You are experiencing a symptom of autism: obsession and repetition of something. - Take your pick.—Hamburguesa con queso con un cara (talk • stalk) 18:31, 31 December 2017 (UTC) - i think that's normal tbh. i think everyone gets these passing thoughts that they want to see the world burn at points. the question is, is it long term, because that's when the depressing stuff gets serious. БaбyЛuigiOнФire🚓(T|C) 19:26, 31 December 2017 (UTC) - Probably both.--Palaeonictis (talk) 19:41, 31 December 2017 (UTC) - I have an obsession with the apocalypse. I am autistic with various mental illnesses. I repeat words and talk about the same things over and over. This includes making fun of the bible. That guy from Michigan who likes horror novels 19:33, 31 December 2017 (UTC) - We (homo Sapiens) happen to be a rather destructive form of DNA that is adept at doing damage to other forms of DNA, (while not being particularly successful in terms of absolute numbers). Perhaps what you are feeling is nothing more than a recognition of the (possible) fact that h. Sapiens might have peaked and the species is in a retrograde period...a dumbing down, if you will, that will allow other forms of DNA to more better thrive? 00:02, 1 January 2018 (UTC) C®ackeЯ Drug Education- counselors and educators should stick to the facts[edit] I have found it so annoying when drug educators twist the facts around to the point of outlandish lies. I get drug addiction is bad and all but if you stretch the truth, people have a harder time believing educators. If you want to combat drug addiction, don't lie about what happens. --Rationalzombie94 (talk) 00:14, 1 January 2018 (UTC) - I think it is a consequence on the whole War on Drugs thing. Still, educators had some effect on me by scaring me away from smoke, marijuana, cocaine, las, any sort of mind altering substance with short term benefits but with long term consequences. They kind of overblown alcohol and marijuana, which I like my beer, but I thought marijuana was some dangerous substance that'll get you hooked like nicotine does. --It's-a me, LeftyGreenMario!(Mod) 19:40, 1 January 2018 (UTC) - Same here. Growing up, I quickly learned to take the melodramatic and sensationalist claims of anti-drug education/media with a grain of salt. But it did encourage me to be careful around recreational substances, and helped me understand that substance abuse can be a very serious issue. 98.110.112.28 (talk) 21:45, 1 January 2018 (UTC) - I once had a talk where the person did just stick to the facts. He made it very clear that, if you ever did try drugs, you most likely wouldn't enjoy it. —Kazitor, pending 21:50, 1 January 2018 (UTC) - i grew up with virtually no 'formal' drug education. years of substance abuse issues later...well, swings and roundabouts AMassiveGay (talk) 21:57, 1 January 2018 (UTC) Manual archiving[edit] While Archivist's absent, should we just archive old threads manually? This page is getting rather long. —Kazitor, pending 01:57, 1 January 2018 (UTC) - Sure —ClickerClock (talk) 02:29, 1 January 2018 (UTC) - Yes! Bongolian (talk) 02:56, 1 January 2018 (UTC) Alright, done. I moved everything older than the 25th, and left some one line threads since the bot seems to avoid those. —Kazitor, pending 05:18, 1 January 2018 (UTC) Happy New Year![edit] -💎📀1️⃣ (talk) 04:05, 1 January 2018 (UTC) - Man, people are always too early. New Year's really doesn't start until four hours from now here. Damn everyone else in the east time zones. --It's-a me, LeftyGreenMario!(Mod) 04:07, 1 January 2018 (UTC) - Six minutes to midnight here.:54, 1 January 2018 (UTC) Your Thoughts[edit] ShiningSwordofThoughts (talk) 22:15, 1 January 2018 (UTC) - Can you at least provide a summary when you post youtube videos? AMassiveGay (talk) 22:20, 1 January 2018 (UTC) - And could you use the "add topic" button? When I saw your edit in recent changes I assumed you were replying to Fuzzy about the community survey. Christopher (talk) 10:59, 2 January 2018 (UTC) Pedantry[edit] Surely '2018 moderator election' would be more logical - even if the process did start a few days early. Anna Livia (talk) 22:49, 2 January 2018 (UTC) - The campaigning started in 2017, so I think calling it 2017 is better. Maybe calling it 2017-2018 election would be better БaбyЛuigiOнФire🚓(T|C) 23:00, 2 January 2018 (UTC) - I'd say that because the mods being elected serve in 2018, it should be the 2018 mod election. Add that to my list of campaign promises :P —Kazitor, pending 23:02, 2 January 2018 (UTC) - I vote 2018., 3 January 2018 (UTC) - In the grand scheme of things, it won't matter much in a couple of years whether it's indexed by 2017 or 2018. Regards, Cosmikdebris (talk) 02:35, 3 January 2018 (UTC) - But people seeing '2017' are likely to ignore the rest of the sentence. Anna Livia (talk) 10:51, 3 January 2018 (UTC) please don't make me change anything, the mob is free to vote on this, i don't think it matters Herr FuzzyKatzenPotato (talk/stalk) 11:38, 3 January 2018 (UTC) - Likewise, I don't think change is necessary. But if we really have to, why not call it the 2017-18 Moderator Election (academic style)? Nerd (talk) 15:26, 3 January 2018 (UTC) The last one was called the 2016 moderator election, the one before that 2015 etc. To someone who didn't have any context, it'd look like we didn't have an election this year. Christopher (talk) 15:36, 3 January 2018 (UTC) - Even if someone went through all of the election pages and moved them all forward a year (which would be a lot of effort for no gain), people in past discussions would still refer to them as what they've always been called. This is incredibly poorly thought through. Christopher (talk) 17:52, 3 January 2018 (UTC) Here's a vote so I don't have to look at this inanity[edit] Let's try to get a normal distribution, guys. :-) Nerd (talk) 17:45, 3 January 2018 (UTC) - @Bigs, what's with your obsession with multi polls replacing discussion? Discussion allows people to convince others that they're right, and allows of obvious troll "votes" to be ignored. Christopher (talk) 17:52, 3 January 2018 (UTC) - Either 2017-18 (or relevant years) Moderator Elections - or hold them at some other point in the year - so the pedants are less likely to complain. Anna Livia (talk) 18:43, 3 January 2018 (UTC) - Or we could just keep it as it is. Christopher (talk) 19:00, 3 January 2018 (UTC) - i believe more canand should be done to actively piss off pedants everywhere. AMassiveGay (talk) 20:20, 3 January 2018 (UTC) - Despite advocating 2018, I'm actually going for 2017. There needs to be a 2017 one, rather than apparently skipping it. And changing anything is always hassle. —Kazitor, pending 21:17, 3 January 2018 (UTC) - Complete the irregular verb - 'I am pointing out something that needs considering, you are a pedant, they are (what)'? Anna Livia (talk) 23:49, 3 January 2018 (UTC) Do we have an article of plant music?[edit] Does music help plants grow? And do we have an article on it? This is the New age hypothesis I've encountered a couple times throughout my life. I assume it's a pile of bull, but I haven't encountered any refutations or commentary on popular/notable websites.—Hamburguesa con queso con un cara (talk • stalk) 04:29, 3 January 2018 (UTC) - I don't think we do. There's a related bit of nuttery: talking to your plants makes them grow better. Jerry Baker promoted this in the 1970s with a bunch of books, in particular, Talk to Your Plants, and Other Gardening Know-How I Learned from Grandma Putt and Plants Are Like People. Bongolian (talk) 08:04, 3 January 2018 (UTC) - Prince Charles is an advocate apparently. - And plants #are# a non-disruptive audience. Anna Livia (talk) 11:10, 3 January 2018 (UTC) - I think Mythbusters did an episode on this one and found it to be plausible (with rock music). But I think a more official scientific source might be worth looking into just in case their results might be off. Comrade GC (talk) 11:19, 3 January 2018 (UTC) - I don't think it would be an inverse stopped clock, Mythbusters did try and promote critical thinking but weren't particularly rigorous. Christopher (talk) 11:33, 3 January 2018 (UTC) - I've seen a couple Mythbusters episodes. It's an entertainment show first and an educational show second. But unfortunately, I can't find any significant debunking on the Internet. I just find a bunch of obscure sites covering it. Perhaps it's time for RationalWiki to shed some light on the issue.—Hamburguesa con queso con un cara (talk • stalk) 20:38, 3 January 2018 (UTC) - Some slightly more plausible (at first glance) sounding bullshit is that it's not the sounds but the extra CO2 it surrounds the plant with. I doubt CO2 is the limiting factor for photosynthesis or any other reactions requiring it (I don't think there are many) for most plants under most circumstances though. Christopher (talk) 20:47, 3 January 2018 (UTC) - There's also a lot of amusing claims about how animals respond to music. Not scientifically rigorous. --Gospatric (talk) 17:27, 3 January 2018 (UTC) - Don't forget - animals may hear music differently to us. Anna Livia (talk) 18:46, 3 January 2018 (UTC) RZ94's potential projects for 2018[edit] - Judge Judy- Bigotry towards the disabled - Golo Diet- Popping a bunch of supplements to lose weight. Plus they silence critics by suing them. - Nations University- A fundie school stuck on the back side of the 1960's. They are actually scared of communists. --Rationalzombie94 (talk) 22:22, 3 January 2018 (UTC) Clinton and Trump are equally unpopular[edit] I can't say I'm surprised. I find both of them quite unfavorable.:25, 23 December 2017 (UTC) - Never been a fan. Part of it was that I am old enough to remember the first Clinton administration, when the Democrat president got behind "welfare reform", deregulation, 3 strikes laws, copyright extension, video game censorship, abstinence-based sex education, and purges of undocumented immigrants. There is no way in hell that anybody is going to sell me on the notion that Hillary Clinton is a 'progressive', or stands for anything other than herself. Her whiny new ghostwritten book did nothing to improve her. Not a huge Christopher Hitchens fan, but No One Left to Lie To remains the definitive take on the Clintons. - Smerdis of Tlön, LOAD "*", 8, 1. 19:30, 23 December 2017 (UTC) - I don't particularly care anymore how Clinton performs and I hope she gets out of the political arena for good. On the other hand, Trump's popularity is still too high, needs to be sub30, but if it goes even lower, I'm not complaining either. --It's-a me, LeftyGreenMario!(Mod) 21:20, 23 December 2017 (UTC) - From the other side of the pond, I canna say that surprises me. Panzerfaust (talk) 10:42, 24 December 2017 (UTC) This just goes to show that the Democrats can't afford to run another bland moderate candidate in 2020, it else they're going to keep losing. A hard liberal with progressive policy proposals and a cleaner record of supporting the right sides on the issues is virtually guaranteed to beat Trump in 2020. Hopefully that's who Democratic primary voters pick. PBfreespace (talk) 18:40, 24 December 2017 (UTC) - #Warren2020, 24 December 2017 (UTC) - Mmm, guys! We just had an election. Let's not worry too much about 2020, shall we? We will cross that bridge when we get there. Nerd (talk) 22:21, 24 December 2017 (UTC) - I still have my doubts that even a progressive will cream Trump. I'm pessimistic enough to believe that voters will just listen to party loyalty. Even if Sanders promised free ponies for everyone, people wouldn't vote him because he's part of the Democratic Party. On the other hand, Sanders does have the populist appeal. Let's see how the media reports on Sanders. As far as we've seen, they're way more interested in Trump and his voter demographics, annoyingly enough. --It's-a me, LeftyGreenMario!(Mod) 22:30, 24 December 2017 (UTC) - If there's a conspiracy theory, chances are the group it's trying to smear are either "The Jews" or "The Clintons". The amount of hate conjured up for them out of thin air is astonishing. All those debunked 90s chain letters about a kill count and the dozen Benghazi hearings where she didn't do anything wrong seemed to have worked as propaganda. Shame that this includes a number of people who count themselves as skeptics and rationalists. As far as a candidate goes, you generally don't see a more radical candidate chosen when they lost the last election. Strategy would be that, since the incumbent can always be painted as failing, the opposition party can pick someone more moderate to pick up moderate voters who have become disillusioned with the extremist. Plus, there's a reason California has some of the most Liberal politicians and places like Mississippi have some on the far-right. In states where the liberal or the conservative consistently wins, they don't have to worry about moving toward the middle. Instead, they have to worry about being primary-ed from someone further along the left or right, respectively. With the Presidency going to Trump instead, that just means the Democrat candidate can, and likely will, be further to the right than either of the Clintons ever were to try and pick up those voters.-PsychoGecko (talk) 11:03, 25 December 2017 (UTC) Comic[edit] This is how we sound right now. Cartoon by Barry Deutsch, a Jewish man. Image description at his blog post. —ClickerClock (talk) 09:33, 27 December 2017 (UTC) - The democrats would not do well appealing to my specific beliefs(low-grade antitheism would not sell well, nor would wonky obsession with reforming elections), and I find that sad. Though I suspect if they were to really emphasize a certain subset of my beliefs, they'd do way better. ikanreed 🐐Bleat at me 14:54, 29 December 2017 (UTC) - The truth of good politics: emphasize policies that have the potential to garner majority support. That doesn't mean you have to abandon the interests of small minorities. The average voter is selfish. Don't spend a lot of time telling them what you plan to do for someone else.Ariel31459 (talk) 22:02, 4 January 2018 (UTC) Vote LeftyGreenMario for Moderator! She is the best candidate![edit] Remember to vote in this election! The Undead Schizophrenic (with Depression, Borderline Personality Disorder and Bipolar) says so. --Rationalzombie94 (talk) 17:24, 28 December 2017 (UTC) - Vote for meh! Down with the Old Guard!:35, 28 December 2017 (UTC) - You can officially endorse candidates here. :) --It's-a me, LeftyGreenMario!(Mod) 20:57, 28 December 2017 (UTC) - I would vote for her because she is a girl. J. Zoia (talk) 15:26, 30 December 2017 (UTC) - Unfortunately @J. Zoia you are ineligible to vote at this time. Comrade GC (talk) 15:30, 30 December 2017 (UTC) Idea: draft namespace[edit] One thing we seem to really hate are stubs. But the thing about the stubs is they're not usually bad (for some value of "bad"), just low quality or devoid of content. The general idea is we don't want people to see low quality articles amongst our other stuff. The current convention is to work on such articles in one's userspace, but this has a downside of low visibility, and it can be uncertain whether other users can edit it. I suggest a dedicated namespace for such drafts and stubs, so they can be worked on whilst kept separate from our good material. Thoughts? —Kazitor, pending 07:15, 1 January 2018 (UTC) - I like that idea a lot. Draft namespace sounds really good to me.Spud (talk) 09:28, 1 January 2018 (UTC) - Sounds good. Christopher (talk) 10:04, 1 January 2018 (UTC) - I've created a pull request that adds in a draft namespace. Christopher (talk) 10:19, 1 January 2018 (UTC) - @Christopher On lines 249 to 251, you appear to have forgotten the commas between the array items. I'm not too familiar with github (should get onto that at some point), so you will want to fix that. —Kazitor, pending 10:48, 1 January 2018 (UTC) - @Kazitor Thanks! (The last one isn't meant to have a comma though). Christopher (talk) 11:06, 1 January 2018 (UTC) - Eh, it's PHP and commas on the ends of long arrays like that are sort of a convention so you can't forget them when adding to the list. They don't cause any errors. Although, personally, I don't do it either. —Kazitor, pending 11:08, 1 January 2018 (UTC) - Oh, what little PHP I know I just sort of picked up from seeing code. Christopher (talk) 10:58, 2 January 2018 (UTC) - For some of us [27] is more understandable than page :) - We all find topics which are worth a RW mention but which we as persons wish 'the proverbial someone else' to develop (or at least give a second opinion on). Some will be viable in their own right, others will be 'mentions/a subsection on another page, and there will be those which are promptly forgotten about. Perhaps 'Sandbox: topic X' type entries on talk pages of topics 'one level up' (so eg Oumuamua might appear initially on Space Woo) and then a decision could be made. Anna Livia (talk) 18:26, 2 January 2018 (UTC) - I honestly don't understand the problem some people have with stubs. If the article is a stub then people are welcome to expand it. If not, and it's on mission, then leave it alone. If it's a stub that is not sufficient reason for deletion. I suspect that if we create "draft space" then articles which would otherwise be be (very) slow-growing stubs will simply languish in obscurity. Let stubs live!Bob"Life is short and (insert adjective)" 18:37, 2 January 2018 (UTC) - I don't either. It isn't like we're on any deadline. - Smerdis of Tlön, LOAD "*", 8, 1. 18:45, 2 January 2018 (UTC) - Unlike Wikipedia (which rightly allows stubs), we have our reputation to think about. If someone first finds out about RationalWiki through a shitty stub, they're likely to think that we're a useless website not worth wasting their time on. If a stub could've been put together by any English speaking person with 10 minutes spare and access to Google, it's not worth having. Christopher (talk) 19:20, 2 January 2018 (UTC) I strongly support a draft page. I think I've even said that if you want to work on an article, but want to save work for later due to a busy life, it's best to construct it as a draft in your userspace rather than make a complete mainspace article out of it. БaбyЛuigiOнФire🚓(T|C) 20:45, 2 January 2018 (UTC) - Same here. There are all sorts of unfinished articles in userspace by people who have long since left. If there was a draftspace, these articles could be finished by anyone, and would be easier to find if there was a link to draftspace on, say, the to-do list. I suggest also having a "move to draft" option on AfD discussions. Readymade (talk) (bloody Sophie again) 17:06, 3 January 2018 (UTC) - Next suggestion 'Category:x-field stub' - so that those interested in the wider x-field can find the relevant short entries more rapidly: and general interest in Oumuamua is probably decreasing (until the next weird or potentially doomsday-ish flyby). Anna Livia (talk) 19:19, 3 January 2018 (UTC) - We already have this, take a look at all of the subcategories of Category:Articles needing expansion. Christopher (talk) 19:27, 3 January 2018 (UTC) Evangelism in Xmas[edit] It seems those people like to practice outreach during these days. In the last two weeks, I've had more encounters with 'em attempting to convert me than in the last months including some of a sect that have most other Evangelical churches against it, as they've these behind, a pair of Jehovah Witnesses -who did not even get the house's door being open-, and especially one who after my usual reply began with the BS of Jesus' sacrifice and that if everything was gonna end that moment I'd not be saved -thank Gods the bus came in that moment-. Panzerfaust (talk) 22:22, 3 January 2018 (UTC) - You could always try to convert them to the path of Cthulhu, if you're feeling particularly bored. Comrade GC (talk) 22:26, 3 January 2018 (UTC) - You could do this- ask, "Do you want to hear about my lord and savior Ba'al"? or ask, "Want to hear about the Goddess Asherah"? or if you are not Pagan (I am Pagan and did something like that), "You want to learn the truth of Evolutionary Biology and Astrophysics"? If you are atheist. One time when my biological dad had his stroke, a nurse would come by to help him. This nurse would preach about the Christian God and Jesus. She graduated from none other than Bob Jones University. So in response, my mom and a friend pretended to be lesbians just to get her to leave. It was classic. --Rationalzombie94 (talk) 03:17, 4 January 2018 (UTC) - i find 'no thanks, not my thing' and closing the door or walking on works pretty well. AMassiveGay (talk) 11:44, 4 January 2018 (UTC) - I haven't tried it myself, but there's a line in Kingsman: The Secret Service that could work against particular groups: "I'm a Catholic whore, currently enjoying congress (out of wedlock) with my Jewish black boyfriend who works at the military abortion clinic. So hail Satan, and have a lovely day, madam." —Kazitor, pending 11:53, 4 January 2018 (UTC) - My approach with these has been double (it's a bad idea to approach someone who is reading a book about galactic astronomy and cosmology): either telling them that I'm not interested on their "eternal life", how an asshole was Yahweh in the OT, what about -precisely- Asherah (which I very seriously doubt they'll know about; I'm talking about all of them being inmigrants, who come with a lower cultural level -whatever is called-), the many errors and inconsistences of "the Book" (starting with the discrepances on the four Gospels), and the failure of things written there that were supposed to going to pass ('nuff said), or telling them that I've already a religion and I'm not interested in others, thanking them -and if they insisted, which never has happened, talking them about any fictional RPG deity as I still remember stuff of when I played D&D-. The latter has worked most of the time except the last one when the guy began with the Jesus' sacrifice thing and that if everything was going to end game over for me. Shit, as it happened the New Year's day with just a couple hours of sleep -thus pretty much zombified-, caught me off-guard while I was taking some shots of the full Moon to fight drowsiness, he scared me being taller than me and was fearing when I replied that I'd be left with no camera and some beating. Luckily the bus came and he went away with the same "I'll pray for you/remember to accept Jesus/whatever" (don't remember well). - I really hope the next time, if there's one, I'll not be off-guard. I've a lot of desire to talk them about the beauty of the way the Universe evolved according to the Big Bang theory -and how is does not appear at all in Genesis- or about, say, Eldath, goddess of peace and waterfalls, in the Forgotten Realms. Panzerfaust (talk) 14:35, 4 January 2018 (UTC) - What I tell Mormons is that 'In the real Bible, it talks about Jericho and Jerusalem and Tyre and Nazareth. I'm not sure anything happened exactly as described, but I can say with a high degree of confidence that these were all real places. What happened to yours?' - Smerdis of Tlön, LOAD "*", 8, 1. 17:28, 4 January 2018 (UTC) - I just ask them how Jesus can both be King of the Jews and the son of god when only a direct male descendent of Judah (and David) can be king. Mary could not be heir; for that to be true, even if all other descendents of King David had died the throne would pass on to the other male members of Judah, and even if all the men were direct male descendants of converts instead of Judah, the title would still be passed on to a Levi or Kohan who are not descendants of converts. Nor does adoption does not pass on the heir either, so even if Joseph was the heir the title wouldn't go to Jesus. CorruptUser (talk) 21:11, 4 January 2018 (UTC) What are the causes of the proxy conflict between Saudi Arabia and Qatar?[edit] Does anybody here have a good analytical grip on the situation? Gewgtweg (talk) 19:00, 26 December 2017 (UTC) Well... this unfortunate post had to welcome the new year completely alone. I guess identity politics is more interesting than international relations for most people here. Gewgtweg (talk) 17:07, 3 January 2018 (UTC) - It stems from the Arab Spring, as the movement created a power vacuum in the region both nations hoped to fill. Qatar was generally supportive of the movement while Saudi Arabia was generally opposed. Other issues include the belief that Qatar is too pro-Iranian (Saudi Arabia's primary rival in the region), runs Al-Jazeera (many gulf states view the news broadcaster as hostile to their interests), and is accused of supporting pro-Iranian groups such as Hamas and the Muslim Brotherhood. It doesn't help that Qatar used to be essentially a vassal of Saudi Arabia, but through its immense fossil fuel wealth has allowed the small country to not only carve its own path, but have influence far greater than a nation its size would have. Hope that helps. BMcP - Just an astronomy guy 14:58, 7 January 2018 (UTC) Community survey results[edit] Promising to post stuff today was a bad idea. I'll try my best. Oof. Cømяade FυzzчCαтPøтαтø (talk/stalk) 10:14, 1 January 2018 (UTC) Can we make usernames more strict?[edit] Can we have more limitations on usernames? Whenever a troll decides to create three troll accounts, the entire page is dominated by excessively long usernames such as "Bush did 9/11 and put chemicals into the water". Also, long usernames are obnoxious.—Hamburguesa con queso con un cara (talk • stalk) 19:59, 2 January 2018 (UTC) - @CheeseburgerFace: I'm sure a filter that blocks usernames over a certain length wouldn't be hard to make, what should the limit be? Christopher (talk) 20:03, 2 January 2018 (UTC) - Mods can spend some time trying to rename users. I'm aware that very long usernames are never practical for anyone but I'm not sure what kind of limit we should impose here, if we even should. --It's-a me, LeftyGreenMario!(Mod) 20:08, 2 January 2018 (UTC) - If I remember correctly most sites with username limitations have a max limit of 16 to 20 characters. Comrade GC (talk) 20:12, 2 January 2018 (UTC) - I think 20-25 characters is reasonable enough. Though that's my having 15 characters to begin with. --It's-a me, LeftyGreenMario!(Mod) 20:19, 2 January 2018 (UTC) - If I remember correctly MediaWiki has a limit, it's just really, really big. Christopher (talk) 20:34, 2 January 2018 (UTC) - A quick engine search tells me that MediaWiki can support to 255 characters. >.> --It's-a me, LeftyGreenMario!(Mod) 20:37, 2 January 2018 (UTC) - who would *ever* make an account with even more than 30 characters? БaбyЛuigiOнФire🚓(T|C) 20:43, 2 January 2018 (UTC) - About half the Grawp-style usernames. Look through the user creation log. RoninMacbeth (talk) 20:47, 2 January 2018 (UTC) - I don't count asstwats like him to be legit users. БaбyЛuigiOнФire🚓(T|C) 20:48, 2 January 2018 (UTC) - Neither do I, but he does make lots of accounts with long usernames. As for why MediaWiki's absurd character length, I don't know. I think a cap of 25 characters is fairly reasonable. RoninMacbeth (talk) 20:52, 2 January 2018 (UTC) - A 25 character limit is reasonable.—Hamburguesa con queso con un cara (talk • stalk) 21:21, 2 January 2018 (UTC) - A quick look at the user list shows that long account names are almost always associated with a spammer or troll. A 20-25 character limit seems perfectly reasonable. Regards, Cosmikdebris (talk) 20:49, 2 January 2018 (UTC) - I made a filter blocking all usernames longer than 25 characters, if there's a better way of doing it, feel free to do so but this should work fine. Christopher (talk) 21:49, 2 January 2018 (UTC) - A whole two minutes of work down the drain, it doesn't work. The only reason I can think of is that it doesn't register the account you're trying to create as your username, it still treats your IP as your username. It'll probably have to be done by changing the MW configuration. Christopher (talk) 21:56, 2 January 2018 (UTC) (reset) What about the potentially reasonable contributors who are a supporter of derivatives of anti-disestablishmentarism (and others of that ilk) and the person attempting to revive [28]? Anna Livia (talk) 10:49, 3 January 2018 (UTC) - There's a handy template for that, it's {{outdent}}. And to answer your question, they are told that the name's too long so they can think of something shorter. It's not a huge obstacle. —Kazitor, pending 11:03, 3 January 2018 (UTC) - Should the warning explain that they can pick a short username and ask for their first choice at RW:Requests to change username if they're a legitimate user with a name of, say, 26 characters or thereabouts (which is still a bit long, but not that disruptive). Christopher (talk) 11:29, 3 January 2018 (UTC) This was good work! Can someone figure out what MediaWiki text should be edited to inform users of the length limit? Cømяade FυzzчCαтPøтαтø (talk/stalk) 11:37, 3 January 2018 (UTC) - @FuzzyCatPotato, you mean MediaWiki:Abusefilter-warning-toolong? Christopher (talk) 11:40, 3 January 2018 (UTC) - The two words and their derivatives are known as pseudo-synonyms for 'very long word.' Persons using such terms are unlikely to be trolls. Anna Livia (talk) 11:49, 3 January 2018 (UTC) Since I can name at least 2 (semi) regular users with objectional usernames that are way shorter than 25 chars and no one seems to bat an eyelid about, i can safely say this is a waste of time. for bonus points im not going to name them - why single them out when no one else cares? AMassiveGay (talk) 13:59, 3 January 2018 (UTC) - It's not going to stop all of them, but it will make it hard to have usernames along the lines of "[insert harassment target here] is a whore/deserves to die" etc. Plus long usernames clog up recent changes massively on mobile. Christopher (talk) 14:06, 3 January 2018 (UTC) - Beat me to the punch @Christopher. Comrade GC (talk) 14:09, 3 January 2018 (UTC) - It would also be a good thing if mods and techs, who have the power to oversight or change objectionable usernames, actually did this. Readymade (talk) 17:12, 3 January 2018 (UTC) - what exactly did we lose by doing this, may i ask? БaбyЛuigiOнФire🚓(T|C) 20:54, 4 January 2018 (UTC) Everyone above is wrong and I, the smart person, am right[edit] This problem does not require a technical solution. Ban, rename if necessary, move on. ikanreed 🐐Bleat at me 17:46, 3 January 2018 (UTC) - It's not necessary, but it does make everything easier. Christopher (talk) 17:53, 3 January 2018 (UTC) 20:50 . . User account IWant2MakeCLersCry (talk | contribs | block) was created 20:46 . . User account BullyingC-leadersIsFun (talk | contribs | block) was created 20:43 . . User account I Hate Cheerleaders (talk | contribs | block) was created - The recent edits summary as a result is far less annoying. Thanks everyone!—Hamburguesa con queso con un cara (talk • stalk) 20:59, 4 January 2018 (UTC) - The filter managed to catch four (gradually shorter) attempts in two minutes. All them are obvious trolls, no legitimate users have been caught yet (well, except for me testing it). I think it was a great idea. —Kazitor, pending 21:40, 4 January 2018 (UTC) Further suggestion: disallow questionable words[edit] Either extend the filter, or create a new one, so harassment words like "hate" or "bitch" etc. aren't permitted. Perhaps even the word "is", that seems to be used a lot by trolls. —Kazitor, pending 21:46, 4 January 2018 (UTC) - That would also cause a lot of false positives -- consider somebody who has the name Isaac or something similar trying to sign up with a username based on their name, or even Smerdis of Tlön. It would require some really complicated code to try to ban only the word is, given that a troll could sign up in any sort of format -- trying to formulate a script that would block the troll names while saving okay names would be nigh impossible. These users would probably end up being blocked using this plan (bold), plus Grawp could come up with some ways to bypass the filter (italics): - BullyingCheerleadersIsFun [grawp] - BullyingCheerleadersisFun [grawp] - IsaiahN [non-troll] - Bullying Cheerleaders is Fun [grawp] - Smerdis of Tlön [non-troll] - Bullying Cheerleaders Is Fun [grawp] - Bullying Cheerleaders iz Fun [grawp] - Isaac Smith [non-troll] - It's Fun to Bully Cheerleaders [grawp] - It'sFunToBullyCheerleaders [grawp] - ItsFunToBullyCheerleaders [grawp] - MichaelDukakis4Prez [non-troll, though a few years late] - IsabelG [non-troll] - ItzFunToBully_cheerleaders [grawp] - DaisyO [non-troll] - DiamondDisc1 [non-troll] - I Love Bullying Cheerleaders [grawp] - While blocking " Is " and " is " would probably be fine, it would only slow him down a bit, and is probably pointless in terms of effort/reward. Spriggina (sgwrs) (cyfraniadau) @ 04:14, 6 January 2018 (UTC) - @Kazitor The word "is" is one of the most common words in the English language, right up there with the word "the". - Negligible save. He can use 1337 speak or just troll by creating pages. The username length limit was a good proposal by me, however, this one is not.—Hamburguesa con queso con un cara (talk • stalk) 04:40, 6 January 2018 (UTC) Proposed rules to govern AFD[edit] RoninMacbeth proposed three criteria for deleting mainspace articles in September, under his proposed guidelines, at least two of these must be met for an article to be deleted: - The article or topic is off-mission. - The article is a stub with little to no chance of expansion. - The article does not contain any sources, nor can anyone find sources for the claims within. DiamondDisc (and presumably RoninMacbeth, if he hasn't changed his mind) both support this, I think it introduces bureaucracy that a wiki of our size doesn't need. What does everyone else think? Christopher (talk) 21:38, 3 January 2018 (UTC) - With this current model, I could make a well sourced and very long article, and it would never get deleted despite it hardly being missional. Heck, so long as the articles are long and well sourced, I could cover the following: - Mr. Krabz from SpongeBob - Sex pillows - Animal prostitution - Rubber duckies - The history Super Mario 64's development - How to have sex with a goat - A page filled with Harry Potter fanfiction - Seriously, missionality should be a requirement.—Hamburguesa con queso con un cara (talk • stalk) 22:21, 3 January 2018 (UTC) - Leave them as guidelines, but not set-in-stone rules. They might be useful for determining what sort of things can go, but shouldn't dictate it. —Kazitor, pending 22:31, 3 January 2018 (UTC) - Non-missionality should be grounds for automatic deletion. As cheeseburgerface says, under these rules we could all write long, well-referenced articles about string or Danielle Steele or local house prices. AfD isn't perfect (although it's better than the previous arrangement), but this isn't an improvement. Readymade (talk) 22:49, 3 January 2018 (UTC) - Correct. We don't need discussion for deleting articles that are obviously non-missional. Sysops currently have the capacity to delete articles with impunity that are obviously off mission, extremely small stubs, spam, doxing, harassment, legal threats etc. This is entirely reasonable. AFDs should be reserved for articles that are shortish and haven't been expanded, or articles that could be missional if someone put in the effort, and the like. Bongolian (talk) 04:21, 4 January 2018 (UTC) - I think those 3 points have always been pretty much what I've had in mind every time I've nominated an article for deletion anyway. Obviously, as far as missionality goes, I've always nominated articles that I thought were kind of borderline. I thought they were off-mission but I wanted to know what other users thought. Anything that's obviously off-mission I've always killed on sight. But, yeah, I'd have to agree that those 3 points should be "more what you'd call guidelines than actual rules", me hearties! Spud (talk) 04:50, 4 January 2018 (UTC) People already use those rules, they're just not explicitly stated right now. Just change "at least two" to "at least one" and it's the same as the status quo.) 14:34, 4 January 2018 (UTC) Reads the fourth possibility. Don't give LGM any ideas!:04, 4 January 2018 (UTC) - Is LGM a fan of rubber ducks? :P Spriggina (sgwrs) (cyfraniadau) @ 21:57, 4 January 2018 (UTC) - @Bigs I WANT to create a funspace on the Mario game series because it has a ton of weird insane things like Wario dealing with the devil, Mario tipping over the Twin Towers, Mario praying to a Koran, Mario being a Vietnam soldier, and Hitler and World War II apparently being in the same universe as Mario's world. --It's-a me, LeftyGreenMario!(Mod) 19:42, 5 January 2018 (UTC) - OK, so how about an article must be off-mission to be deleted, and the other two are grounds for merging/redirecting. RoninMacbeth (talk) 17:15, 7 January 2018 (UTC) - Then someone could write a factually inaccurate two line stub on an authoritarian monarch (therefore missional) of a country that no longer exists who ruled in the 7th century BC and it couldn't be deleted because there's nothing to merge it with. If it ain't broke don't fix it, keep the rules as they are. Christopher (talk) 18:01, 7 January 2018 (UTC) Jesus as a Mary Sue[edit] The title text of some Wondermark comic said "Rudolph is a clasic Mary Sue. But then again, so is Jesus". This got me thinking, he really is one. - He can perform miracles - He loves everyone - Everyone loves him - He's literally related to God - He's in heaven And the thing about Mary Sues is that they're always author insertions in fan fictions. Thus, we can conclude that the writer(s) of the New testament saw the Old testament and thought, "I want to write a fanfic of this, and place myself as the son of God!" And being author insertions, they attempted to do away with all the meanness and be all-loving. —Kazitor, pending 21:16, 4 January 2018 (UTC) - Oh gods and goddesses above and below!!! It all makes sense now!!! Comrade GC (talk) 21:18, 4 January 2018 (UTC) - OH MY GOD!—Hamburguesa con queso con un cara (talk • stalk) 21:23, 4 January 2018 (UTC) - But - not enough opportunity for some of the sub-genres of fanfic. Anna Livia (talk) 00:20, 5 January 2018 (UTC) It also explains the part where God and Satan are sparkly vampires and they make out. 90.222.130.219 (talk) 18:26, 5 January 2018 (UTC) - I'm not sure which Bible translation you're using, but that's certainly not in any of the ones I've read. Christopher (talk) 18:30, 5 January 2018 (UTC)
https://rationalwiki.org/wiki/RationalWiki:Saloon_bar/Archive281
CC-MAIN-2022-21
refinedweb
36,515
61.16
...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards In the previous section we mentioned a very important difference between parsers and generators. While parsers may be used without 'producing' any data, generators always need data to generate the output from. We mentioned one way of passing data to the generator by supplying it as a parameter to one of the main API functions (for instance generate() or generate_delimited()). But sometimes this is not possible or not desireable. Very much like for Spirit.Qi we have semantic actions in Spirit.Karma as well. Semantic actions may be attached to any point in the grammar specification. These actions are C++ functions or function objects that are called whenever a part of the generator is about to be invoked. Say you have a generator G, and a C++ function F, you can make the generator call F just before it gets invoked by attaching F: G[F] The expression above links F to the generator, G. Semantic actions in Spirit.Qi are invoked after a parser successfully matches its input and the matched value is passed into the semantic action. In Spirit.Karma the opposite happens. Semantic actions are called before its associated generator is invoked. They may provide the data required by the generator. The function/function object signature depends on the type of the generator to which it is attached. The generator double_ expects the number to generate. Thus, if we were to attach a function F to double_, we need F to be declared as: void F(double& n); where the function is expected to initialize the parameter n with the value to generate. There are actually 2 more arguments being passed (the generator context and a reference to a boolean 'pass' parameter). We don't need these, for now, but we'll see more on these other arguments later. Spirit.Karma allows us to bind a single argument function, like above. The other arguments are simply ignored. To sum up, the possible signatures for semantic actions are: void f(Attrib&); void f(Attrib&, Context&); void f(Attrib&, Context&, bool&); In the following example we present various ways to attach semantic actions: Let's assume we have: namespace client { namespace karma = boost::spirit::karma; // A plain function void read_function(int& i) { i = 42; } // A member function struct reader { void print(int& i) const { i = 42; } }; // A function object struct read_action { void operator()(int& i, unused_type, unused_type) const { i = 42; } }; } Take note that with function objects, we need to have an operator() with 3 arguments. Since we don't care about the other two, we can use unused_type for these. We'll see more of unused_type elsewhere. Get used to it. unused_type is a Spirit supplied support class. Most of the time it stands for 'I don't care, just use the appropriate default'. All following examples generate outputs of the form: "{integer}" An integer inside the curly braces. The first example shows how to attach a plain function: generate(outiter, '{' << int_[&read_function] << '}'); What's new? Well int_ is the sibbling of double_. I'm sure you can guess what this generator does and what type of attribute it expects. The next example shows how to attach a simple function object: generate(outiter, '{' << int_[read_action()] << '}'); We can use Boost.Bind to 'bind' member functions: reader r; generate(outiter, '{' << int_[boost::bind(&reader::print, &r, _1)] << '}'); Likewise, we can also use Boost.Bind to 'bind' plain functions: generate(outiter, '{' << int_[boost::bind(&read_function, _1)] << '}'); And last but not least, we can also use Boost.Lambda: std::stringstream strm("42"); generate(outiter, '{' << int_[strm >> lambda::_1] << '}'); There are more ways to bind semantic action functions, but the examples above are the most common. Attaching semantic actions is the first hurdle one has to tackle when getting started with generating with Spirit. If you didn't do so yet, it is probably a good idea to familiarize yourself with the tools behind it such as Boost.Bind and Boost.Lambda. The examples above can be found here: actions.cpp Phoenix, a companion library bundled with Spirit, is specifically suited for binding semantic actions. It is like Boost.Lambda on steroids, with special custom features that make it easy to integrate semantic actions with Spirit. If your requirements go beyond simple to moderate generation, I suggest you use this library. Examples presented henceforth shall be using the Phoenix library exclusively.
http://www.boost.org/doc/libs/1_43_0/libs/spirit/doc/html/spirit/karma/tutorials/semantic_actions.html
CC-MAIN-2014-10
refinedweb
750
56.05
Timeline 02/29/08: - 23:20 Ticket #13498 (xephem 3.7 will not build on MacPorts 1.5.2 on Leopard) closed by - fixed: Update committed in r34642. - 23:19 Changeset [34642] by - xephem: update to 3.7.2. Fixes #13498. - 22:06 Ticket #13494 (Error building libidl) closed by - worksforme: No response from reporter, and it builds fine for me on Leopard/x86. … - 19:09 Changeset [34641] by - Fix descriptions. - 19:03 Ticket #14530 (python25: pydoc2.5 searching for docs in the wrong directory) created by - Please review and committ the attached file. Changes made: * change … - 18:47 Changeset [34640] by - Changing share/doc/$name/Documentation to share/doc/$name - 18:33 Changeset [34639] by - New port python30-doc as motivated by #8488. - 18:15 Ticket #14529 (python30: pydoc3.0 searching for docs in the wrong directory) created by - Please review and committ the attached file. Changes made: * lint (patch … - 18:04 Ticket #13487 (new port: py25-utidylib) closed by - fixed: Thanks, committed in r34638 with some small corrections. I listed you as … - 18:02 Changeset [34638] by - new port: py25-utidylib (py25 version of py-utidylib). Closes #13487. - 17:22 Ticket #13486 (new port: py25-ctypes) closed by - invalid: As it says on the home page, ctypes is included with Python 2.5, and 'from … - 17:19 Ticket #14527 (python25: hashlib module broken) closed by - fixed: Just found .. … - 16:54 Ticket #14528 (bittorrent-5.2.0 Update to the last version.) created by - I'm new user and this my first ticket for contribute with this project. … - 16:53 Ticket #14527 (python25: hashlib module broken) created by - g4:~ thomas$ python2.5 Python 2.5.2 (r252:60911, Feb 29 2008, 16:18:01) … - 15:56 Ticket #14526 (JRuby Portfile) created by - Here's a very basic JRuby Portfile for version 1.0.3 which works on my … - 15:27 Changeset [34637] by - New port python25-doc as motivated by #8488. - 15:06 Changeset [34636] by - lint - 13:57 Changeset [34635] by - lint - 13:56 Changeset [34634] by - lint - 13:55 Changeset [34633] by - lint - 13:52 Ticket #14360 (py-ipython conflicts with py25-ipython) closed by - fixed: Fixed in r34629, r34630, r34631, r34632 - 13:51 Changeset [34632] by - update according to #14360 - 13:50 Changeset [34631] by - add python-version to installed binary - 13:48 Changeset [34630] by - apply patch from #14360 - 13:48 Changeset [34629] by - apply patch from #14360 - 13:13 Changeset [34628] by - follow upstream steatlh upgrade, remove unnecessary patch to molden.f - 12:47 Changeset [34627] by - Total number of ports parsed: 4532 Ports successfully parsed: 4532 … - 12:43 Changeset [34626] by - minor patch for ANSI wxWidgets, such as the old wxgtk port - 12:38 Changeset [34625] by - net/zabbix: Add variant descriptions - 12:32 Ticket #14525 (Patch: add +sqlite3 variant to net/zabbix) closed by - fixed: Done. r34624 I'll also document the other variants and add the larger … - 12:31 Changeset [34624] by - net/zabbix: Add a sqlite3 variant for the server, minor wordsmithing - 12:19 Changeset [34623] by - version bump to 1.91 - 12:15 Ticket #14525 (Patch: add +sqlite3 variant to net/zabbix) created by - Zabbix can also use sqlite3 for its database backend, this is a minimal … - 11:34 Changeset [34622] by - lang/python24-doc: Set svn:keywords and svn:eol-style for Portfile. Please … - 11:19 Changeset [34621] by - python24-doc: cleanups. Remove unused variable definitions, remove extra … - 10:49 Ticket #14502 (lyx-1.4.0pre3 fetch failure) closed by - duplicate: I'll call this a duplicate of #11163 since the fetch failure of … - 10:24 Ticket #14384 (Error: checksum mismatch for ImageMagick) closed by - invalid: This was fixed in r34267, also the ImageMagick port has now been updated … - 10:09 Changeset [34620] by - New upstream scala-2.7.0-RC3 release of Scala. - 10:07 Ticket #13449 (pdb crashes python24 2.4.4 on Leopard) closed by - fixed: Thanks. Marking fixed. - 08:37 Ticket #14524 (ffmpeg 0.4.9-pre1 +universal Configure error - build failure) created by - {{{$ port install ffmpeg +universal ... ---> Configuring ffmpeg Error: … - 07:26 Ticket #14523 (sqlite3 fails to build on new macos/macports installation (NAWK variable ...) created by - I just installed macports for the first time on a new mac system, and when … - 07:16 Changeset [34619] by - Correcting descriptions - 07:11 Changeset [34618] by - Set revision to 0 as this is the initial version - 07:05 Ticket #14464 (py-sqlalchemy, py25-sqlalchemy don't include doc/examples) closed by - fixed: Fixed in r34617 - 07:04 Changeset [34617] by - Update py-sqlachemy and py25-sqlalchemy to install docs/examples … - 06:46 Ticket #13985 (RFE: Move select files from python_select to appropriate python ports) closed by - fixed: Committed for python23 in r34437 and r34438. Committed for python30 in … - 06:45 Changeset [34616] by - lang/python30: Add select file for python_select with permission from … - 06:39 Ticket #14373 (Upgrade py-yaml to 3.05) closed by - fixed: Fixed in r34615 - 06:37 Changeset [34615] by - Update py-yaml to v3.05 and add corresponding py25-yaml (maintainer … - 06:29 Ticket #14341 (Update py-setuptools, py25-setuptools to 0.6c8) closed by - fixed: Ok, fixed in r34614 - 06:29 Changeset [34614] by - Update py-setuptools and py25-setuptools to v0.6c8. Fixes #14341 - 06:07 Ticket #14372 (NEW: py-daemon, py25-daemon) closed by - fixed: Fixed in r34613 - 06:07 Changeset [34613] by - New ports: py-daemon and py25-daemon. Fixes #14372 - 06:05 Ticket #14357 (NEW: sqlalchemy-migrate) closed by - fixed: Ok, fixed in r34612. - 06:05 Changeset [34612] by - New ports: py-sqlalchemy-migrate and py25-sqlalchemy-migrate. Fixes #14357 - 06:00 Ticket #14356 (NEW: py-py py25-py) closed by - fixed: Committed in r34611 with some minor changes. - 05:59 Changeset [34611] by - New ports: py-py and py25-py. Fixes #14356 - 05:54 Ticket #14522 (New port mcabber) created by - mcabber is a small Jabber console client. It includes features like SSL, … - 04:33 Ticket #8488 (python24: pydoc cannot find topics) closed by - fixed: Fixed by creating a python24-doc package in r34610. - 04:32 Changeset [34610] by - Initial commit of a python24 Doc package. Fixes #8488. If by any chance … - 04:25 Changeset [34609] by - deluge: update to 0.5.8.5 - 03:12 Ticket #14521 (aquaterm-1.0.1 build failure) created by - Hi... I have some problems installing the port aquaterm. Every time I get … - 03:07 Ticket #14520 (libsdl_mixer-framework-1.2.8 build failure) created by - Hi... I have some problems installing the port libsdl_mixer-framework. … - 03:02 Ticket #14519 (libfuse 2.7.1-3 build error: fuse_param.h: No such file or directory) created by - When building libfuse 2.7.1-3 on Mac OS 10.5.2 (Intel): […] - 02:16 Changeset [34608] by - claws-mail: update to 3.3.1 - 02:14 Changeset [34607] by - Change maintainer to sbranzo@… as he wishes by private email. - 00:49 Ticket #14518 (libpython3.0.dylib not being built) created by - With MacPorts 1.600 the python30 port does not build its shared libpython. - 00:45 Changeset [34606] by - Total number of ports parsed: 4524 Ports successfully parsed: 4524 … - 00:42 Changeset [34605] by - update snapshot - 00:08 Changeset [34604] by - bump revision 02/28/08: - 23:16 Ticket #13460 (gnome-keyring: parse error before "size_t") closed by - duplicate - 23:03 Ticket #13441 (gunits fails to build on OS X 10.5) closed by - fixed: Fixed in r34603. The configure flags really are needed to build on 10.5 … - 22:57 Changeset [34603] by - gunits: fix issues introduced in r34595. - 21:00 Ticket #12281 (BUG: p5-mac-apps-launch broken dependancy) closed by - fixed: ricci fixed this in r34589. - 20:54 Ticket #13441 (gunits fails to build on OS X 10.5) reopened by - Bad. You've caused two problems: 1. Before r34595, the port correctly … - 20:08 Ticket #13455 (mp3info doesn't compile on Leopard PPC) closed by - fixed: Committed in r34602. Thanks! - 20:07 Changeset [34602] by - mp3info: fix building on Leopard. Closes #13455. - 19:38 Ticket #14513 (Submission of new portfile for radlib) closed by - fixed: committed in r34601 with some whitespace changes, thanks - 19:37 Changeset [34601] by - devel/radlib: new port, closes #14513 - 18:19 Ticket #14516 (New portfile for wview) closed by - invalid: Dup of #14517 - 18:18 Ticket #14515 (New portfile for wview) closed by - invalid: Dup of #14517 - 18:18 Ticket #14514 (New portfile for wview) closed by - invalid: Dup of #14517 - 18:09 Ticket #14517 (New port submission for wview v3.6.0) created by - New portfile for wview3.6.0 - 18:08 Ticket #14516 (New portfile for wview) created by - New portfile for wview v3.6.0 - 18:07 Ticket #14515 (New portfile for wview) created by - New portfile for wview v3.6.0 - 18:07 Ticket #14514 (New portfile for wview) created by - New portfile for wview v3.6.0 - 18:04 Ticket #14513 (Submission of new portfile for radlib) created by - New portfile for radlib (Rapid Application Development Library). This is … - 18:02 Ticket #12026 (BUG: xmlrpc-c-1.06.11 - bad checksum) closed by - fixed: Adjusted in r34600. - 18:02 Changeset [34600] by - xmlrpc-c: checksums updated for stealth update; Closes #12026 - 17:56 Ticket #14467 (aircrack-ng 0.9.3 is out) closed by - fixed: Committed in r34598. Changed maintainer to nomaintainer as no reply to … - 17:55 Changeset [34599] by - maintainer => nomaintainer - 17:54 Changeset [34598] by - new version 0.9.3 - 17:43 Ticket #11589 (BUG: gdk-pixbuf puts its docs under $prefix/doc) closed by - fixed: Fixed in r34596 - 17:42 Changeset [34597] by - patch file naming - 17:41 Changeset [34596] by - Fixes #11589 - 17:37 Ticket #13441 (gunits fails to build on OS X 10.5) closed by - fixed: Thanks, committed in r34595. - 17:35 Changeset [34595] by - gunits: fix building on Leopard. Closes #13441. - 17:23 Ticket #14507 (UPDATE: version 0.9 of editors/ed) closed by - fixed: committed in r34594, thanks - 17:23 Changeset [34594] by - editors/ed: update to 0.9, closes #14507 - 17:11 Ticket #7103 (BUG: unix2dos-2.2 master_site gone) closed by - fixed: Fixed by r31021 - 16:33 Ticket #13386 (upgrade ploticus to 2.33 plus 8 patches) closed by - fixed: Thanks, updated to version 2.40 in r34593. - 16:26 Changeset [34593] by - ploticus: update to version 2.40. Closes #13386. - 15:20 Changeset [34592] by - science/libframe: no need to escape "-" in regular expression - 14:59 Changeset [34591] by - science/libframe: use release directory for livecheck - 14:09 Ticket #14512 (UPDATE: redland-1.0.7) created by - Update the redland port to version 1.0.7. - 13:42 Changeset [34590] by - transmission-x11: update to 1.06 - 13:41 Changeset [34589] by - make port lint happy reduce maintainer info fix dependency … - 13:08 Ticket #14511 (UPDATE: new version 0.8.1 of ruby/rb-rake) created by - New version 0.8.1 of ruby/rb-rake available - 12:52 Changeset [34588] by - whitespace - 12:46 Changeset [34587] by - Total number of ports parsed: 4523 Ports successfully parsed: 4523 … - 11:49 Ticket #14510 (add sourceforge as a master site for lcms) closed by - fixed: added in r34585, thanks - 11:45 Changeset [34586] by - graphics/lcms: fix lint warnings - 11:45 Changeset [34585] by - graphics/lcms: add sourceforge to master_sites - 11:32 Ticket #14510 (add sourceforge as a master site for lcms) created by - Currently the source site for lcms is down () … - 11:24 Changeset [34584] by - update and fix qt4-mac - 11:23 Changeset [34583] by - Update to version 0.2.3 - 11:00 Ticket #13434 (gnubg won't build in Leopard (OS X 10.5)) closed by - fixed: Fixed in r34582. - 10:59 Changeset [34582] by - gnubg: fix building on Leopard. Closes #13434. - 10:39 Ticket #14433 (ossp-uuid 1.6.0_0+universal - build failure) closed by - fixed: Fixed, r34581. - 10:38 Changeset [34581] by - add missing LDFLAGS when linking lib (#14433) - 10:18 Changeset [34580] by - devel/bzrtools: no need to escape . outside of regular expression - 10:14 Changeset [34579] by - sysutils/duplicity: correct livecheck regular expression - 10:14 Changeset [34578] by - science/metaio: correct livecheck regular expression - 10:14 Changeset [34577] by - science/libframe: use correct livecheck regular expression - 10:14 Changeset [34576] by - python/py25-baz: correct livecheck regular expression - 10:14 Changeset [34575] by - py-paramiko/py25-paramiko: correct livecheck regular expression - 10:14 Changeset [34574] by - py-dateutil/py25-dateutil: update to 1.4 - 10:14 Changeset [34573] by - math/fftw-3-single: correct livecheck regular expression - 10:13 Changeset [34572] by - devel/bzrtools: correct livecheck regular expression - 10:13 Changeset [34571] by - devel/bzr-gtk: correct livecheck regular expression - 10:13 Changeset [34570] by - devel/bzr: correct livecheck regular expression - 10:13 Changeset [34569] by - audio/vorbis-tools: correce livecheck regular expression - 10:11 Ticket #14463 (Mode line should be in a line) closed by - fixed: Fixed, r34568. - 10:10 Changeset [34568] by - modeline warts need to be on one looong line (#14463) - 10:06 Ticket #13964 (Routine to remove MacPorts should recommend a shell) closed by - fixed: Fixed, now says you need bash. - 10:06 FAQ edited by - (diff) - 10:04 FAQ edited by - Ticket #13964 (diff) - 09:09 Changeset [34567] by - games/glob2: Updated to version 0.9.2. - 08:36 Ticket #14509 (ffmpeg won't build on x86 / 10.4.11) created by - Attempting to install ffmpeg via {{{sudo port -dv install ffmpeg}} on an … - 08:35 Changeset [34566] by - version bump to 5.2.6RC1 - 06:33 Changeset [34565] by - update patch naming convention per current lint prefs - 06:32 Changeset [34564] by - update to 4.7.4 - 06:21 Ticket #14508 (UPDATE: SQLObject 0.10.0b3) created by - py-sqlobject is a bit dated. Please update to the latest. and add the port … - 06:21 Changeset [34563] by - devel/bzr: depend on py25-curl and py25-docutils - 05:56 Ticket #13500 (install of sqlite3 fails on Leopard) closed by - worksforme: gawk does the job perfectly […] and building sqlite3 yields […] I … - 05:50 Ticket #14129 (tk: configure error - /opt/local/lib directory doesn't contain ...) closed by - invalid - 03:53 Ticket #13678 (tk 8.5 doesn't build if 8.4.x is already installed) closed by - fixed: I've changed the include-flags so this _probably_ doesn't occur anymore … - 03:49 Ticket #8956 (XEmacs port missing base packages) closed by - fixed: I'm using xemacs on a daily basis (21.4.21, revision 1) and it works … - 03:38 Ticket #12417 (python 2.5 missing features) closed by - worksforme: … - 03:33 Ticket #14505 (py-curl: install docs to ${prefix}/share/doc/${name}) closed by - fixed: thanks, commited! (incl. revision inc.) - 03:32 Changeset [34562] by - fix docdir, inc. revision; #14505; thanks to ram@…! - 01:57 Ticket #14507 (UPDATE: version 0.9 of editors/ed) created by - New version 0.9 of editors/ed is available. - 01:44 Ticket #14506 (port lint should detect improper openmaintainer nomaintainer usage) closed by - fixed: Added, r34561. - 01:40 Changeset [34561] by - lint: issue error when using nomaintainer together with other or … - 00:45 Changeset [34560] by - Total number of ports parsed: 4523 Ports successfully parsed: 4523 … - 00:36 Changeset [34559] by - Setting svn:keywords to Id on all portfiles, per current guidelines - 00:03 Changeset [34558] by - Adding newline after port group as instructed by portlint email. 02/27/08: - 23:38 Changeset [34557] by - Setting svn:eol-style to native on all portfiles, per current guidelines - 23:35 Ticket #13391 (BUG: Ruby fails to compile on 10.3 with pthreads enabled) closed by - fixed: Fixed in r34556. - 23:34 Changeset [34556] by - lang/ruby: add support for 10.3 (untested) - 23:33 Ticket #13391 (BUG: Ruby fails to compile on 10.3 with pthreads enabled) reopened by - Oops, I didn't see the patch. - 23:32 Ticket #13391 (BUG: Ruby fails to compile on 10.3 with pthreads enabled) closed by - wontfix: I don't have any access to a 10.3 box and we're not supposed to support … - 23:24 Changeset [34555] by - ImageMagick: update to 6.3.9-0 All 696 tests behaved as expected (33 … - 23:15 Changeset [34554] by - winetricks: update to 20080227 - 23:07 Changeset [34553] by - glib2-devel: update to 2.15.6 - 23:06 Changeset [34552] by - replace value of MDT environment value instead of appending to it, to … - 22:44 Changeset [34551] by - graphviz: fix livecheck so it once again only finds stable versions, … - 21:39 Ticket #14457 (impossible to install ffmpeg) closed by - duplicate: Uninstall the old ffmpeg first. This is a duplicate of #13984. - 21:08 Ticket #14506 (port lint should detect improper openmaintainer nomaintainer usage) created by - It would be good if port lint would warn when a port * lists … - 21:02 Ticket #13415 (Update to phpmyadmin Portfile to bring it to latest version (2.11.2.2) as ...) closed by - fixed: I committed an updated to version 2.11.4 in r34550. - 21:02 Changeset [34550] by - phpmyadmin: update to version 2.11.4. Closes #13415. - 20:24 Ticket #13414 (Portfile upgrade for mediawiki to version 1.11) closed by - fixed: I committed an update to version 1.11.1 (without the misuse of epoch and … - 20:22 Changeset [34549] by - mediawiki: update to version 1.11.1. Closes #13414. - 20:20 ram edited by - (diff) - 20:16 Ticket #14505 (py-curl: install docs to ${prefix}/share/doc/${name}) created by - The attached patch moves the docs to ${prefix}/share/doc/${name} as to be … - 20:13 Changeset [34548] by - python/py25-curl: new port - 19:19 Changeset [34547] by - devel/git-core: Add a +gitweb variant - 19:09 Changeset [34546] by - port/port.tcl: Make a difference between: * No port specified on command … - 19:08 Changeset [34545] by - bump to 0.99.8 - 18:15 Changeset [34544] by - audio/flac: fix lint warnings - 15:54 Ticket #14504 (gsed+with_default_names fails post-destroot) created by - Hi there, brand new MBP, fresh install of Leopard + updates, fresh install … - 14:41 Changeset [34543] by - mutt-devel: restore 'trash' variant - from #13363. - 14:18 Changeset [34542] by - mutt-devel: changing to nomaintainer at former maintainer's request. - 14:09 Ticket #13365 (Update py-pyrex to 0.9.6.3 and add new py25-pyrex) closed by - fixed: Bumped to version 0.9.6.4, which fixes the setup.py problem, and committed … - 14:05 Changeset [34541] by - use current Mac OS X major version for MACOSX_DEPLOYMENT_TARGET - let's … - 14:04 Changeset [34540] by - New port: py25-pyrex - from #13365. - 13:58 Changeset [34539] by - lang/kaffe: Whitespace only changes. - 13:51 Changeset [34538] by - calculate Mac OS X version from Darwin version - 13:51 Changeset [34537] by - py-pyrex: update to version 0.9.6.4 - from #13365. - 13:41 Changeset [34536] by - Changing openmaintainer to nomaintainer for all three ports - 13:30 Changeset [34535] by - science/jmol: Updated to version 11.4.RC7. - 13:14 Changeset [34534] by - science/jmol: Updated to 11.4.RC6. - 13:00 Changeset [34533] by - fix livecheck - 12:51 Changeset [34532] by - tin: bump port revision so everyone gets the fix from r34526; see #13250 - 12:45 Changeset [34531] by - Total number of ports parsed: 4521 Ports successfully parsed: 4521 … - 12:23 Ticket #14503 (libtool: upgrade to 1.5.26, add patch to avoid -flat_namespace) created by - libtool 1.5.26 plus the attached patch will properly avoid the use of … - 11:54 Ticket #13364 (gimp-lqr-plugin fails to build on Leopard/PowerPC) closed by - invalid: Marking invalid per comment:2. - 11:53 Ticket #7510 (xpdf build failure: gcc does not see Xm/XmAll.h) closed by - worksforme: All is well. xpdf builds successfully against openmotif. Closing this bug. … - 11:36 Ticket #13357 ([UPGRADE] slrn-devel 0.9.9pre-60) closed by - fixed: Closing, since a newer version went in in r31449 and subsequent commits. - 11:30 Ticket #13325 (GNUCash Crash when Adding Transactions) closed by - duplicate: Marking as duplicate since #13472 has a lot more info. - 11:26 Ticket #14502 (lyx-1.4.0pre3 fetch failure) created by - […] - 10:52 Changeset [34530] by - lint happy - 10:50 Ticket #1435 (NEW: apan -Unfinished port) closed by - fixed: Committed in r34529. Thanks for waiting so long. Kind regards Thomas - 10:50 Changeset [34529] by - Initial commit. Fixes #1435 - 10:39 Ticket #1663 (NEW: pwlib -unfinished port) closed by - fixed: pwlib committed in r34528. Thanks for waiting so long. Kind regards … - 10:38 Changeset [34528] by - Initial commit. Fixing #1663 - 10:15 Changeset [34527] by - version 2.5.35 - 10:04 Ticket #14491 (p5-text-csv_xs 0.31 fetch failure) closed by - duplicate: Why didn't you just attach it to this ticket? :) - 10:01 Ticket #13250 (news/tin fails to handle SIGWINCH) closed by - fixed: Thanks, committed in r34526. - 09:59 Changeset [34526] by - tin: handle SIGWINCH. Closes #13250. - 09:27 Changeset [34525] by - add 'macports-gcc-4.4' as compiler option - 09:24 Changeset [34524] by - new port gcc44 (BETA snapshot!) - 09:22 Ticket #14501 (run check of fftw-3 during test phase, not build) created by - The attached patch uses the test phase to run the test suite, not during … - 09:20 Ticket #14500 (fftw-3: add livecheck) created by - The attached patch fixes livecheck for fftw-3 - 09:20 Ticket #14499 (libgda should depend on postgresql82 at least instead of postgresql80) created by - here is the diff: […] Include defs are correct, btw. Then we have 8.3 … - 08:21 Ticket #14498 (mod_perl2 not building (MacOS X 10.4, 10.5)) created by - I am trying to install mod_perl2 on my 10.4 (server) machine and I am … - 08:07 Ticket #14497 (Gnome, gnome-session fails to install (gnome-settings-daemon package not ...) created by - tsia amgines-macbook:~ amgine$ sudo port install gnome-session … - 06:55 Ticket #1595 (NEW: aide -Unfinished port) closed by - fixed: Committed in r34522 and r34523. Thanks for waiting so long. Kind regards … - 06:54 Changeset [34523] by - Files for port:aide - 06:53 Changeset [34522] by - New port. Fixing #1595 - 05:11 Ticket #12660 (BUG: fftw-3-single install failure on Intel MacBook) closed by - worksforme: No response, closing as worksforme. Reopen if problem persists. - 05:08 Changeset [34521] by - Additional file to #12851 - 05:06 Ticket #12851 (libwww fails to build) closed by - fixed: Resolved in r34520. Thanks for you help and kind regards Thomas - 05:05 Changeset [34520] by - Fixes #12851 - 03:32 Ticket #12302 (RFE: "platform" info target) closed by - fixed: Added, r32724. - 03:26 Ticket #12861 (port can't find package Pextlib 1.0) closed by - worksforme: (jmpp forgot to close) - 03:20 Ticket #14380 (port lint should warn if depending on nonexistent port) closed by - fixed: And and a small bugfix in r34516. - 03:17 Changeset [34519] by - update changelog, #13458 #14380 - 03:00 Changeset [34518] by - add default description for global variants like +universal - 02:52 Changeset [34517] by - python/py-psycopg: Add +postgresql82 and +postgresql83 - 02:43 Changeset [34516] by - actually get all dependencies, and not just the last one - 02:24 Ticket #13458 (Lint and Livecheck targets should not require root access) closed by - fixed: Use /tmp for livecheck in r34515. - 02:20 Changeset [34515] by - port1.0/portlivecheck.tcl: Use a path in /tmp to avoid issues when … - 02:13 Changeset [34514] by - avoid double free, thanks to Raim - 02:00 Changeset [34513] by - add target_state variable patch from raimue, for targets that don't need … - 01:36 Changeset [34512] by - lint: check that all dependencies actually exist (#14380) - 01:06 Ticket #14496 (UPDATE: p5-text-csv_xs-0.34) created by - p5-text-csv_xs-0.34 Find the Portfile ATTACHED. Description: Perl module … - 00:51 Ticket #14476 (asciidoc uses wrong Python binary) closed by - fixed: "${prefix}/bin/python" used to be a symlink to python2.4 but was deleted … - 00:50 Changeset [34511] by - use versioned python program (#14476) - 00:47 Ticket #14493 (ffmpeg fails to install) closed by - duplicate: Dupe, #14492 - 00:46 Changeset [34510] by - Total number of ports parsed: 4517 Ports successfully parsed: 4517 … - 00:44 Ticket #13175 (madplay-0.15.2b fails to build on Tiger or Leopard Intel H/W) closed by - fixed: Commited, r34509 - 00:43 Changeset [34509] by - fix build on Leopard Intel / needs SSE (#13175) - 00:39 Ticket #14495 (madplay-0.15.2b build error on 10.5.2) closed by - duplicate: Dupe, #13175 02/26/08: - 23:57 Changeset [34508] by - fix build with gcc 4.2 - 23:38 Ticket #13333 (xfig 3.2.5_1 won't build with XFree86, builds with Apple X11) closed by - wontfix: I'm not sure why we should support XFree86 nowadays. - 23:37 Ticket #14116 (ENHANCEMENT: graphics/xfig) closed by - fixed: Fixed in r34507. - 23:37 Changeset [34507] by - graphics/xfig: removed ugly hack (#14116) and fixed destroot violation - 22:40 Ticket #14495 (madplay-0.15.2b build error on 10.5.2) created by - Build log: […] - 22:26 Changeset [34506] by - audio/vorbis-tools: fix livecheck - 22:26 Changeset [34505] by - audio/vorbis-tools: update homepage - 22:26 Changeset [34504] by - science/libframe: fix livecheck - 21:17 Ticket #14494 (pgplot install failure) created by - When trying to install pgplot I get the following errors {{{mtroy source> … - 20:30 Changeset [34503] by - math/fftw-3-single: fix livecheck - 20:23 Changeset [34502] by - devel/bzrtools: fix livecheck - 20:23 Changeset [34501] by - devel/bzr-gtk: fix livecheck - 20:04 Changeset [34500] by - py-gnupg/py25-gnupg: fix livecheck - 19:24 Changeset [34499] by - devel/bzr: fix livecheck - 18:59 Changeset [34498] by - py-numpy/py25-numpy: fix livecheck - 18:59 Changeset [34497] by - py-paramiko/py25-paramiko: fix livecheck - 18:46 Changeset [34496] by - devel/git-core: fix port lint warnings - 17:34 Ticket #14493 (ffmpeg fails to install) created by - When trying to install the ffmpeg port I get the following: Error: Target … - 17:33 Ticket #14492 (ffmpeg staging error: usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g ...) created by - When trying to install the ffmpeg port I get the following: Error: Target … - 16:13 Ticket #14491 (p5-text-csv_xs 0.31 fetch failure) created by - Christopher Lamey … - 16:12 Ticket #14490 (gimp installation hangs) created by - I have done the Ticket 13742 fix for leopard install, thanks. The port … - 15:20 Changeset [34495] by - version 1.5.0 - 15:18 Ticket #14489 (macports installation problem) closed by - duplicate: There is a known bug in the installer for Leopard. Please either see … - 15:09 Ticket #14489 (macports installation problem) created by - I recently upgraded to leopard. I installed X11 and the X11 Xcode v3.0. I … - 14:47 Changeset [34494] by - winetricks: new port - 14:15 Changeset [34493] by - Updated to 0.0900. - 14:08 Changeset [34492] by - Updated to 1.01. - 14:05 Changeset [34491] by - Updated to 0.23. - 13:50 Ticket #13199 (poppler fails to build on Mac OS X 10.5 Leopard) closed by - fixed: No response from the reporter, and it builds fine for me now on Leopard, … - 12:49 Changeset [34490] by - Fix incorrect conf file and icons path for the macport_apache2 variant. - 12:46 Changeset [34489] by - Total number of ports parsed: 4516 Ports successfully parsed: 4516 … - 12:27 Changeset [34488] by - Update to 1.23 to fix broken fetch. - 12:26 Ticket #13167 (BUG: glitz-0.5.6 fails on Leopard) closed by - fixed: Committed in r34487. Thanks! - 12:24 Changeset [34487] by - glitz: fix build on Leopard. Closes #13167. - 12:07 Ticket #13165 (pdksh 5.2.14 fails to build on OS X 10.5 Leopard) closed by - fixed: Committed in r34483, r34484, and r34486. - 12:05 Changeset [34486] by - pdksh: fix building on Leopard. Closes #13165. - 11:59 Ticket #14293 (Privoxy 3.0.8 socks5 variant is failing during the patch phase) closed by - fixed: Closed in r34485 Kind regards Thomas - 11:59 Changeset [34485] by - Closing #14293 - 11:58 Changeset [34484] by - pdksh: add additional master_sites (from #13165) - 11:54 Changeset [34483] by - pdksh: update maintainer address (from #13165) - 11:24 Changeset [34482] by - version 0.19.1 - 11:23 Changeset [34481] by - version 0.18.2 - 11:18 Ticket #13130 (slrn-devel doesn't build) closed by - fixed: Fixed in r30820. - 11:06 Ticket #14484 (separate rdesktop into two Portfiles) closed by - fixed: Committed in r34480. Thanks and kind regards Thomas - 11:06 Changeset [34480] by - Closing 14484, there is port:rdesktop-devel now. - 10:35 Ticket #14488 (blt not building) created by - I'm trying to build blt but I'm getting an error. Here's the output: … - 10:22 Ticket #13086 (p5-log-dispatch fails to fetch source tarball) closed by - fixed: Version 2.12 is still available on some mirrors (I could install it just … - 10:21 Changeset [34479] by - ddrescue: Install a man page in addition to info file - 10:20 Changeset [34478] by - p5-log-dispatch: update to version 2.21 - 10:13 Changeset [34477] by - ddrescue: Update to version 1.8 - 10:07 Ticket #14487 (cppunit @1.12.0 doesn't build with +universal variant) created by - […] - 10:04 Changeset [34476] by - hdhomerun: update software/firmware to 20080212 version - 10:01 Ticket #14486 (PATCH: cyrus-sasl2 ldap variant) created by - Attached is a patch to add an ldap variant for cyrus-sasl. - 09:42 Changeset [34475] by - py-vorbis: update homepage/master_sites - 09:38 Changeset [34474] by - py-ogg: update homepage/master_sites - 08:06 Ticket #14481 (RFE: subversion: Install some more tools into ${prefix}/bin) closed by - fixed: Committed the mucc change in r34473. I don't really like the idea of … - 08:04 Changeset [34473] by - Only build mucc when it is going to be installed (this doesn't change what … - 07:33 Ticket #14485 (Warnings when installing iftop) created by - I installed iftop today and received some warnings that I thought I'd pass … - 07:26 Ticket #13376 (rdesktop fails to compile) closed by - worksforme: Resolving WFM as per comment:5. - 03:49 Ticket #14484 (separate rdesktop into two Portfiles) created by - I added port:rdesktop-devel as its own port in r34472 Therefore … - 03:36 Changeset [34472] by - Fix Portfile - 03:32 Changeset [34471] by - Initial commit - 01:26 Ticket #14483 (ticket status summaries on #macports) created by - Please make trac to xmlrpc macports trac ticket status changes like new … - 00:45 Changeset [34470] by - Total number of ports parsed: 4515 Ports successfully parsed: 4515 …" … Note: See TracTimeline for information about the timeline view.
http://trac.macports.org/timeline?from=2008-02-29T07%3A05%3A02-0800&precision=second
CC-MAIN-2013-20
refinedweb
5,078
62.58
This is the eighth and last module in our series on Python and its use in machine learning and AI. In the previous one, we discussed neural networks with Keras. Now we’re going to take a quick look at NumPy and TensorFlow. Because they’re the building blocks of machine learning libraries, you'll definitely come across them at some point. If you’re an enterprise developer, you won't be writing complete solutions with just these libraries (it takes much longer and is harder to maintain). That would be more for data scientists, dedicated AI/ML engineers, and developers of higher-level ML libraries. Nevertheless, it's a good idea to take a look at the lower-level libraries to see what they're about. In this module, I'll also give a short overview of the scikit-learn library, because it's the most complete machine learning (excluding deep learning) library in the Python ecosystem. If you went through the previous modules, everything you need is already installed! As noted in Module 4, the core of NumPy is its N-dimensional arrays, and it also offers features such as linear algebra and Fourier transforms. A NumPy array is a very common input value in functions of machine learning libraries. Therefore, you’ll often use NumPy directly when you have a dataset in one specific format and you have to transform it into another format. Or you might use NumPy as the result of a library function call. A NumPy array, in as many dimensions as you want, can be directly created from nested lists, nested tuples, or a combination of those, as long as the dimensions make sense. import numpy as np arr = np.array([ [1, 2, 3], (4, 5, 6) ]) print(arr[0, 1]) Here, we're importing numpy using the shorter np parlance, which is an acceptable and very common practice. numpy np Also, (0, 1) is a tuple used as an index. (0, 1) NumPy arrays have slices that let you take a row or a column: # returns the first row as a one-dimensional vector print(arr[0, :]) # returns the first column as a one-dimensional vector print(arr[:, 0]) The same syntax works with a greater number of dimensions as well (though it's harder to speak of "rows" and "columns" here): arr = np.array([ [ [1, 2, 3], [4, 5, 6] ], [ [7, 8, 9], [10, 11, 12] ] ]) print(arr[:, :, 0]) # [[ 1, 4], [ 7, 10]] print(arr[1, :, 0]) # [ 7, 10] NumPy's indexing and slicing is even more powerful than this. Check out the reference for a more complete overview. NumPy arrays can be stacked horizontally or vertically (if the dimensions are correct) with hstack and vstack, both taking a tuple of arrays as the argument (get the number of parentheses right!): hstack vstack arr1 = np.array([ [ 1, 1 ], [ 1, 1 ]]) arr2 = np.array([ [ 2, 2 ], [2, 2]]) print(np.hstack((arr1, arr2))) print(np.vstack((arr1, arr2))) A powerful method of NumPy is reshape. As the name implies, it changes the shape of an array. Here is a reshape example: reshape vector = np.array([ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]) matrix = vector.reshape((3, 3)) The argument to reshape is the new shape, a tuple of the desired dimensions. This is a rather simple example, but you can also use it for reshaping from and to arrays with more dimensions. Elements are read from the original array in a certain index order and written to a new array in the same index order. Refer to the reshape documentation to learn more about index orders. For working with neural networks at a high level, we looked at Keras in Introduction to Keras. At its core, TensorFlow is a library for tensor computations. A tensor is a generalization of vectors and multidimensional matrices: And so on. Tensors can hold any kind of data: integers, floats, strings, and more. Although you usually won’t encounter these when using a high-level library such as Keras, it's still interesting to look at them because they’re the foundational building block of TensorFlow. What's the difference, then, between a NumPy array and a tensor? Both objects represent more or less the same data, but a tensor is immutable. TensorFlow can perform various operations on tensors. Here is an example that starts with three matrices, performs a matrix multiplication on the first two, adds the third matrix to that, and inverts the result. import tensorflow as tf a = tf.constant([ [ 0.6, 0.1 ], [ 0.4, -0.3 ] ]) b = tf.constant([ [ 1.2, 0.7 ], [ 0.9, 1.1 ] ]) c = tf.constant([ [ -0.1, 0.2 ], [ 0.3, 0.1 ] ]) d = tf.matmul(a, b) e = tf.add(c, d) f = tf.linalg.inv(e) sess = tf.Session() result = sess.run(f) # a NumPy array The operations are not performed immediately. The result is only computed when a session is created and run. Before session creation, the above code constructs a graph of operations, which then gets evaluated. scikit-learn is a broad library offering many traditional machine learning methods (very roughly said: everything except machine learning). You can install it with pip in a Jupyter Notebook cell: !pip install scikit-learn Considering the breadth of the library, we won’t focus on one specific code example, but instead give an overview of what you can expect from this library. scikit-learn offers both supervised and unsupervised learning methods. Supervised means you have an expected output for every input in your training set; unsupervised means you don't and you’ll let the algorithm draw its own conclusions. Its main features for supervised learning are classification (identifying categories) and regression (predicting a continuous value), by means of algorithms such as support-vector machines, random forests/decision trees, nearest neighbors, naive Bayes, and more. Unsupervised learning is mainly focused on clustering (automatic grouping based on features), using algorithms such as k-means and mean-shift. Aside from the learning functionality itself, scikit-learn offers ways to validate, evaluate, and compare models and tools to preprocess your input data. A lot is left out here, so I invite you to take a look at their User Guide for a complete overview. We barely scratched the surface of NumPy, TensorFlow, and scikit-learn, but now you have an idea of what they can do and why they’re important in Python's machine learning ecosystem. With the end of this module, we’ve also reached the finish line of our series. You are now armed with the fundamental knowledge to leverage the various AI/ML-related libraries in Python. Thank you for reading! This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
https://www.codeproject.com/Articles/5270760/Introduction-to-NumPy-TensorFlow-and-scikit-learn
CC-MAIN-2021-39
refinedweb
1,137
64
NAMETcl_Access, Tcl_Stat - check file permissions and other attributes SYNOPSIS #include <tcl.h> int Tcl_Access(path, mode) int Tcl_Stat(path, statPtr) ARGUMENTS - - char *path (in) Native name of the file to check the attributes of. - -. - - stat *statPtr (out) The structure that contains the result. DESCRIPTION There possibity to reroute file access to alternative media or access methods. Tcl_Access checks whether the process would be allowed to read, write or test for existence of the file (or other file system_Stat), priviledge mode, nlink (always 1 on Windows), user id (always 0 on Windows), group id (always 0 on Windows), rdev (same as device on Windows), size, last access time, last modification time, and creation time. If path exists, Tcl_Stat returns 0 and the stat structure is filled with data. Otherwise, -1 is returned, and no stat info is given. KEYWORDSstat, access Important: Use the man command (% man) to see how a command is used on your particular computer. >> Linux/Unix Command Library
http://linux.about.com/library/cmd/blcmdl3_Access.htm
CC-MAIN-2014-42
refinedweb
160
53.92
This section describes how to use RAM in Function Compute to access your Alibaba Cloud resources. Here is an example about how to grant correct permission to Function Compute to access OSS resources, like writes a string to a file in the OSS bucket, and reads the data from the file and returns it to user. In this example, you can learn about: The definition of RAM The definition of OSS The steps of granting permission to Function Compute through RAM to access OSS resources Prerequisites In this example, it is assumed that the function code is stored in the code directory. OSS and RAM are activated. Using console Create OSS bucket In the OSS console, your own bucket is created, as shown in the following figure. Create Function Compute Service Create a service named “oss_demo” and create a new role with “AliyunOSSFullAccess” policy, and click “Authorize”: Click “Confirm authorization policy” in Role template page Service role has been update, click “OK”. Create Function under Service Create Function with empty template and no trigger Copy code below in online editor, replace the name of the OSS bucket in the code with your own bucket name: 'use strict'; var oss = require('ali-oss').Wrapper; module.exports.handler = function(event, context, callback) { console.log('Received event:', event.toString()); // Create oss client var ossclient = new oss ({ // Credentials can be retrieved from context accessKeyId: context.credentials.accessKeyId, accessKeySecret: context.credentials.accessKeySecret, stsToken: context.credentials.securityToken, region: 'oss-cn-shanghai', bucket: 'ls-oss-test', // your bucket }); ossclient.put('remote.txt', new Buffer('fc write ' + event.toString() + ' in oss bucket')). then(function(res) { return ossclient.get('remote.txt'); }).then(function(res) { callback(null, res.content); }).catch(function(err) { callback(err); }); }; # -*- coding: utf-8 -*- import time, os import oss2 def handler(event, context): endpoint='oss-cn-shanghai.aliyuncs.com' creds = context.credentials auth = oss2.StsAuth(creds.access_key_id, creds.access_key_secret, creds.security_token) bucket = oss2.Bucket(auth, endpoint, 'ls-oss-test') # your bucket bucket.put_object('remote.txt' , 'fc write ' + event + ' into oss bucket') remote_stream = bucket.get_object('remote.txt') return remote_stream.read() Click “Invoke”: Using fcli Create a Function Compute role and grant permissions Create a RAM role that has the permission to access OSS. Function Compute plays this role to use OSS resources. Run fcli shell to enter the interactive mode. mksr fc-oss-op mkrp fc-oss-gp -a '["oss:GetObject", "oss:PutObject"]' -r '"*"' attach -p /ram/policies/fc-oss-gp -r /ram/roles/fc-oss-op mks oss_demo -r acs:ram::12345:role/fc-oss-op Replace “12345” in the last command with your own Alibaba Cloud account ID. The preceding commands are described as follows: Create a RAM role: fc-oss-op. Create a policy for reading data from and writing data to OSS: fc-oss-gp. Assign the fc-oss-gp policy for the fc-oss-op role. In this way, the fc-oss-op role can read or write resources on OSS. Create the oss_demo service and use fc-oss-op as the service role. All functions in the oss_demo service can play as the fc-oss-op role to read data from or write data to OSS resources. Note: In fcli shell mode, all RAM related resources are managed under the /ram/ path. For more information about RAM, see related documentation. Create a function Create the code directory under the current directory and create the fc_oss.js file under the code directory, copy same code into fc_oss.js andrun mkf oss_demo/fc-oss -h fc_oss.handler -d code -t nodejs6 in fcli shell to create the fc-oss function in the oss_demo service. Call a function Run invk oss_demo/fc-oss -s hello_oss in fcli shell. The output result “fc write hello_oss in oss bucket” is displayed. Log on to the OSS console. The remote.txt file is displayed in the corresponding bucket. Complete example Note: For more information about the complete shell operation video, click here. You can directly copy the commands from the video.
https://www.alibabacloud.com/help/doc-detail/60247.htm
CC-MAIN-2018-43
refinedweb
663
50.63
A friendly place for programming greenhorns! Forums Java » Beginning Java one client and two servers Post by: Medes Agri , Greenhorn Jul 10, 2006 14:32:00 Hi all, now I have created my applications but I think it does not work correctly. I have two servers and one client , the client must get data from the servers simultaneously. It get the data from them, but it sometimes does not work correctly, and it writes the data from one of the servers. here is my code. ------------Server 1----------------------- public class ServerOne { private ServerSocket sock = null; ArrayList words = new ArrayList(); ArrayList numbers = new ArrayList(); public ServerOne(int port) { try { sock = new ServerSocket(port); }catch(IOException e){e.printStackTrace();} } public static void main(String[] args) { ServerOne so = new ServerOne(7500); so.accept(); System.out.println("done"); } public void accept(){ try{ System.out.println("Server 1"); Socket s; int ThreadId = 0; while(true) { s = sock.accept(); OutputStream os = s.getOutputStream(); PrintWriter out = new PrintWriter(os, true); for(int i=0; i<5; i++) { out.println(words.get(i) + " = " + numbers.get(i)); } } } catch(IOException e){ System.out.println("FAILED TO HOST ON 7500");} } --------------------------ServerTwo ------------------------------- is exact like server one just i used another port ----------------------------The Client ------------------------------ public class TheClient{ MyThread MT = new MyThread(); public static void main(String[] args) { TheClient TC = new TheClient(); TC.MyAccept(); } public TheClient(){} public void MyAccept() { try{ System.out.println("Client"); MT.start(); System.out.println("h�mtar data fr�n server 1..."); Socket s = new Socket("127.0.0.1",7500); InputStream is = s.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); String str; while((str = in.readLine()) != null) { System.out.println(str); } s.close(); }catch(Exception e){e.printStackTrace();} } } ---------------------My Thread ----------------------------------- public class MyThread extends Thread { public MyThread(){} public void run() { try { System.out.println("h�mtar data fr�n server 2..."); Socket s = new Socket("127.0.0.1",1234); InputStream is = s.getInputStream(); BufferedReader in= new BufferedReader(new InputStreamReader(is)); while(in.ready()) { String str = in.readLine(); System.out.println(str); } s.close(); } catch(Exception e){System.out.println(e.toString());} } } [ July 10, 2006: Message edited by: Medes Agri ] Post by: Ernest Friedman-Hill , Sheriff Jul 10, 2006 14:48:00 After sending their results, your servers are immediately exiting. This can result in the data being discarded by the operating system before the client has a chance to read it. The servers can either loop to service another client (which is of course what servers normally do) or they can just do a "System.in.read()", to wait for you to press Enter before they exit. Either way, that should fix the client. Post by: autobot Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad: Thread Boost - a very different sort of advertising This thread has been viewed 734 times. All times above are in ranch (not your local) time. The current ranch time is Apr 19, 2018 13:21:13 . FAQs Search Recent Topics Flagged Topics Zero Replies Best Topics Hot Topics | advertise | paul wheaton
https://coderanch.com/t/404084/java/client-servers?nonMobile=false
CC-MAIN-2018-17
refinedweb
506
59.9
I was recently working on a Windows Store (Metro) app. I was given a proxy class to communicate with the server. Proxy class was following the callback pattern. What I mean by that is when I invoke a server side method, I pass in an Action<T> that would be invoked when the server call completes. Personally I now like async / await pattern much more now. It seems more readable and more predictable. It also help me provide better structured error handling. So, I decided to wrap proxy calls inside Task wrappers. I would like to quickly document how to do this in this blog post. First of all, let’s look at the proxy code method. public string GetData(Action<ServerResult> callback); What I would like to have is something like public async Task<ServerResult> GetData(); To get from one to the other I will use TaskCompletionSource class. It will help me quite a bit. Actually, here is the final version of the wrapper method. public async Task<ServerResult> GetServerData() { try { var proxy = new Proxy(new Uri("")); var taskCompletionSource = new TaskCompletionSource<ServerResult>(); var task = taskCompletionSource.Task; Action<ServerResult> callback = taskCompletionSource.SetResult; await Task.Factory.StartNew(() => { try { proxy.GetData(callback); } catch (Exception exception) { taskCompletionSource.SetException(exception); } }, TaskCreationOptions.AttachedToParent); return await Task.FromResult(new ServerResult(task.Result.Result)); } catch (Exception exception) { return new ServerResult(exception); } } Let’s walk through the code above. I am creating new instance of my proxy class. Then I am creating task completion source, which is a class that will monitor my results and set my task as completed as well as set the results of that task. I am adding exception handling so that I can cleanly send exceptions to the calling code from both task and general exceptions. Server result class with contain either real data or an exception. Of course, in real app I would have two properties – one for exception, the other for results. namespace WpfApplicationAsync { public class ServerResult { public ServerResult(object result) { Result = result; } public object Result { get; private set; } } } To call GetServerData method I can do the following. private async void Button_Click_1(object sender, RoutedEventArgs e) { MainTextbox.Text = ""; var result = await GetServerData(); Action action = () => { MainTextbox.Text = MainTextbox.Text + result.Result + Environment.NewLine; }; Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); } I am calling my method GetServerData from my button. Since I am adding all error handling to GetServerData, I do not need to use try/catch. Any exceptions are going to be contained within ServerResult class. Here is my test code from Proxy class. public class Proxy { public Proxy(Uri uri) { Uri = uri; } public Uri Uri { get; private set; } public void GetData(Action<ServerResult> callbak) { Thread.Sleep(5000); callbak(new ServerResult("Done")); } } Again, this blog is just illustrate an approach of converting callbacks to awaitable tasks. I find the code from Button click that awaits the results much cleaner than passing callbacks around. Pingback: Rethreading a single threaded app. | Musings of an Augmented Reality Philosopher I have been struggling on how to do this. Thanks! Pingback: Using async BCL with async function | Ziernicki Answers When using Task.Factory.StartNew you will create a new thread to wait for the callback. Normally the purpose of async/await pattern is to release a thread while waiting for a I/O response. It probably doesn’t matter in your case, but for others that want to convert from callback to async/await pattern in a code library they should avoid this solution. I suggest looking here instead:
http://www.dotnetspeak.com/async/converting-callback-functions-to-task-pattern/
CC-MAIN-2019-09
refinedweb
580
58.69
The .NET Framework is huge. There’s often more than one way to accomplish the same programming task, and knowing which way to go can sometimes make the difference between code that is slow or fast, flexible or rigid, and either maintainable or a maintenance nightmare. In this article, you will learn several tips and tricks for developing code that is flexible, extensible, maintainable, and testable. Some techniques in this article may be familiar to you, while others you may not have thought of. Use Coding Standards. There are many reasons for using programming standards. Years ago, when mainframes were in vogue, every shop had programming standards. In fact, they used to teach programming standards in college. These days, standards are all but forgotten or never learned by the younger generation of programmers. Microsoft has published a set of programming standards for C# and Visual Basic. These are an excellent place to start, and I would like to encourage all programmers. The rules set forth in these documents are guidelines, so feel free to modify these to suit your own organization’s needs.. Extension Methods Extension methods allow you to add your own custom method to an existing type. Although this seems like a cool feature, there are a few reasons to use extension methods sparingly, such as: - Adding too many extension methods to an existing type, which clutters the API. - Naming your extension method the same as a built-in method; yours will never be called. - Naming your extension method the same as another extension method; your method shadows the other extension method. Because of the above points, you might consider inheriting from the existing type and adding your own additional methods to this new class. But, with these disclaimers in place, let’s learn how to create extension methods, because there are cases where using them is perfectly acceptable. To create extension methods, you define a static class with any name you like. Listing 1 shows a class named StringExtensions. This listing shows a couple of the available methods such as ReverseString and ToBoolean. All extension methods must also use the static keyword. The first parameter passed to an extension method is the same as the type you are extending and must be prefixed with the keyword "this". Creating classes and methods using these rules informs the compiler to add these methods to the type specified in the first parameter. To use the methods shown in Listing 1, create an instance of type you’re extending. After your new variable, type a dot (.) and your extension methods show up in the IntelliSense, as shown in Figure 1. In the listings included with this article (and on my website: ), you will find another class that works with the DateTime type. The Right Way to Use Reflection Yes, we all know reflection is slow, but sometimes it’s necessary to use it to satisfy a business requirement in your application. Just like anything else, there’s a right way and a wrong way to use reflection. Microsoft has made a significant improvement in performance for getting and setting properties. Make sure you are using this new way. Before I show you the new way to get/set properties, let’s first learn about reflection and the old way of using it. First, let’s say you’ve created a Product class that has a property named ProductName. If you wish to set the value of ProductName to a string, you write code like the following: Product entity = new Product(); entity.ProductName = "A New Product"; Instead of hard-coding the name of the property you’re setting, you might want to create a generic routine that you can pass a property name to and the value to set that property to. This can be accomplished using reflection, as shown in the following code: Product entity = new Product(); typeof(Product).InvokeMember("ProductName", BindingFlags.SetProperty, Type.DefaultBinder, entity, new Object[] { "A New Product" }); InvokeMember is a method of the System.Type class. The typeof() method returns an instance of the Type class, which contains meta-data about the Product class. You pass five parameters to the InvokeMember method. The first parameter is the name of the property to set. The second parameter is the name of the property or method to invoke; in this case, it’s the Set property. The third parameter specifies to use the default binder. The fourth parameter is the variable with a reference to the instance of the class specified by the type (in this case, the Product object). The last parameter is an object array of whatever you need to pass to the method or property you’re invoking. For setting the ProductName property, you only need a single object array of the string you’re setting. A Better Way to Set Property Values Although the InvokeMember method works for setting a property, it’s actually quite slow. There’s a more efficient way to set a property using reflection. There’s a GetProperty method on the Type class that you use to retrieve a PropertyInfo object. This PropertyInfo object has a SetValue method that you use to set the value on that property. Here’s an example of calling the SetValue method. Product entity = new Product(); typeof(Product).GetProperty("ProductName"). SetValue(entity, "A New Product", null); MessageBox.Show(entity.ProductName); That code is easier to understand than the InvokeMember method and is over 100% faster! That’s a big difference and you should take advantage of it when you need to use reflection to set properties. String Handling When working with strings, you should take advantage of certain classes and methods to avoid performance and memory problems. A key item to remember about .NET strings is that they are immutable. Immutable means that strings are read-only and the value cannot be changed after it is created. If you add more data to the original string, a new instance of a string class is created to hold the new string and the old memory is marked for garbage collection. Thus, if you are doing a lot of string manipulation, you can create performance and memory issues in your application. The StringBuilder Class for Concatenating One way to avoid these issues is to use the StringBuilder class. The StringBuilder class is mutable so manipulations on strings are much quicker. You may pre-allocate space when creating an instance of the StringBuilder class. If you know you will be concatenating a lot of strings together, pre-allocating space allows for growth without having to move memory blocks around. Use the methods Append, AppendLine, and AppendFormat to append new data into the StringBuilder object as shown here: StringBuilder sb = new StringBuilder(1024); sb.Append("Adding a new String without a line break."); sb.AppendLine("Adding onto the previous line and adding a line break"); sb.AppendFormat("Hello {0}", "Tom"); tbResult.Text = sb.ToString(); Additional String Class Methods A couple of other very useful techniques for working with strings are methods of the string class. The IsNullOrEmpty method helps you check to see if a string is a null value or an empty string. The use of this method is much better than using an "if" statement to check both. The next snippet shows the use of the IsNullOrEmpty method to check various values contained within a string variable. 1.string value = null; 2.Debug.WriteLine(string.IsNullOrEmpty(value)); 3. 4.value = ""; 5.Debug.WriteLine(string.IsNullOrEmpty(value)); 6. 7.value = " "; 8.Debug.WriteLine(string.IsNullOrEmpty(value)); 9. 10.value = "Some Text"; 11.Debug.WriteLine(string.IsNullOrEmpty(value)); The results of running the above code are "True," "True," "False," and "False." Notice that an empty space on line 7 is not an empty string. If you want to check for all white space within a string, use the IsNullOrWhiteSpace, as shown in this code snippet: string value = null; Debug.WriteLine(string.IsNullOrWhiteSpace(value)); value = ""; Debug.WriteLine(string.IsNullOrWhiteSpace(value)); value = " "; Debug.WriteLine(string.IsNullOrWhiteSpace(value)); value = " "; Debug.WriteLine(string.IsNullOrWhiteSpace(value)); The results of running the above code are "True," "True," "True," and "True." Regardless of whether you have an empty string, a string with one space, or a string with several spaces, the IsNullOrWhiteSpace method is perfect for checking user input. Some users may try to enter a lot of spaces to get around entering text into a required field. Using this method can help you ensure that spaces won’t get by your requirement for a field that has data in it. Generics Eliminate Duplicate Code Prior to .NET 2.0, when you needed a single method to work with different data types, the only way to accomplish this was to pass an "object" data type to that method. Working with the object data type introduces performance problems and bugs that can occur at runtime. The alternative is to create a new method for each data type that you wish to work with. This introduces a maintenance nightmare and leads to a larger API for programmers to learn. An example of using individual methods is shown in the next code snippet. Notice the calls to two different "ConvertTo" methods; ConvertToInt and ConvertToDateTime. The only difference between these two methods is the data types being passed in as parameters. private void HardCodedNonGenericsSample() { object value = "1"; int i = ConvertToInt(value, default(int)); value = "1/1/2014"; DateTime dt = ConvertToDateTime(value, default(DateTime)); } The ConvertToInt method shown in the following code snippet accepts two "object" parameters and returns an "int" data type. public int ConvertToInt(object value, object defaultValue) { if (value == null || value.Equals(DBNull.Value)) return Convert.ToInt32(defaultValue); else return Convert.ToInt32(value); } Now look at the ConvertToDateTime method in the next snippet. It’s almost the exact same code, except the return value is different and it uses the Convert.ToDateTime method instead of the Convert.ToInt32 method. public DateTime ConvertToDateTime(object value, object defaultValue) { if (value == null || value.Equals(DBNull.Value)) return Convert.ToDateTime(defaultValue); else return Convert.ToDateTime(value); } Create One Generic Method The two methods shown above can be rewritten in one method by using generics. To convert the above two methods into one, look at the data types in the two methods that are different. Substitute these differences with a "T," which stands for type parameter. Here’s the result: public T ConvertTo<T>(object value, object defaultValue) { if (value == null || value.Equals(DBNull.Value)) return (T)Convert.ChangeType(defaultValue, typeof(T)); else return (T)Convert.ChangeType(value, typeof(T)); } The code "public T" means that you have a public method that passes back the type specified in the <T> that comes after the method name. For the return type, you cast either the defaultValue or the value to the type that was passed in. To use this new ConvertTo method, you pass in the data type you are converting into with a less-than sign and a greater-than sign, as shown in the following code snippet: private void HardCodedGenericsSample() { object value = "1"; int i = ConvertTo<int>(value, default(int)); value = "1/1/2014"; DateTime dt = ConvertTo<DateTime>(value, default(DateTime)); } Generic Lists Prior to .NET 2.0, you were required to create your own collection classes to provide type-safety. Type safety means that you create a class that only allows you to pass in one type of object. For example, you may have a collection of string, int, or Product objects. You can’t pass an int to a string collection or a Product object to an int collection. To create a type-safe collection, you inherit from the CollectionBase class and override many properties and methods. Listing 2 shows some of the code that you’re required to write for each unique collection class you wish to create. As you can see, this is quite a bit of code. You cannot pass an int to a string collection or a Product object to an int collection. Instead of writing all of the code shown in Listing 2, use one of the Generic collection classes instead. For example, you can replace all of the code in Listing 2 with just the following three lines of code! public class IntCollection : List<int> { } The class IntCollection class created in the previous code snippet is type-safe and will only accept an int data type. You can’t add a string or a decimal type to this collection. You get all of the same features you get with CollectionBase, such as the ability to add, remove, insert, and check to see if a value is contained within the collection, but you don’t have to write all of the code for it. The generic List<T> class is just one example of the many list classes available to you in the System.Collections.Generic namespace. Another generic class is Dictionary<TKey, TValue>, which allows you to store key/value pairs generically. You also have stacks, queues and linked lists implemented, all using generics. All of these save a ton of code and a ton of time. Use XML Instead of a Database Table Most programmers automatically store data in a database such as SQL Server. However, XML files are very handy for storing data without the overhead of a database. Use XML files to cache often-used but seldom-changed data, such as US state codes, country codes, and other validation data. Keeping this data in an XML file on the local storage area in your application avoids network round-trips and may speed up your application. As an example, the next snippet is some XML to represent US state codes: <USStates> <USState> <StateCode>AK</StateCode> <StateName>Alaska</StateName> <Capital>Juneau</Capital> </USState> <USState> <StateCode>AL</StateCode> <StateName>Alabama</StateName> <Capital>Montgomery</Capital> </USState> ... More Here <USStates> Just as you would create an entity class to represent each column in a table, you create an entity class to represent each node in this XML file. Use the class USState shown below to represent each node in the XML file. public partial class USState { public string StateCode { get; set; } public string StateName { get; set; } public string Capital { get; set; } } In the USStateLoad procedure (Listing 3), you use the Load method of the XElement class to load the XML file into memory. Once loaded, you write a LINQ query to iterate over the "USState" descendants in the XML file. In this query, you use an orderby clause to sort the resulting collection by StateCode. The select part of the LINQ query creates a new USState object for each row in the XML file. You retrieve each element by passing the name of the element to the Element method of the XElement object. An extension method called GetAs<T> is used to return either a default value if there is no data, or return the string value of the element. As mentioned, an extension method called GetAs<T> is used to retrieve the data from the Element method in Listing 3. You use this extension method to ensure that there is no missing data from one of the elements, and to return the correct data if there’s incorrect data or the data is missing. This method is contained in a class called XmlExtensions. The GetAs<T> method is shown in the code below: public static class XmlExtensions { public static T GetAs<T>(this XElement elem, T defaultValue = default(T)) { T ret = defaultValue; if (elem != null && !string.IsNullOrEmpty(elem.Value)) ret = (T)Convert.ChangeType(elem.Value, typeof(T)); return ret; } } Notice the use of the optional parameter called defaultValue. If no value is passed to this parameter, it’s automatically set to the default value for the type parameter T. In the case of a string, an empty string is returned if a null is found in one of the elements. If you have a numeric value, such as an int, a zero is returned if a null was found in the numeric element. Override the ToString() Method If you hover over a collection of your objects in your debugger, you probably see something that looks like Figure 2. By default, the debugger calls the ToString() method to display this data. Instead of just taking this default, you should override the ToString() method in your class in order to display better data. Override the ToString() method and use some property or properties in your class to return some meaningful data. For example, return the StateCode property plus the StateName property enclosed in parentheses from ToString() as shown below. public partial class USState { public string StateCode { get; set; } public string StateName { get; set; } public string Capital { get; set; } public override string ToString() { return StateCode + " (" + StateName + ")"; } } After you add this override of the ToString() method, when you run the application and look at the collection of states in the debugger, you now see real data, as shown in Figure 3. Another place the ToString() override comes in handy is if you forget to use a DisplayMemberPath in your WPF ListBox or ComboBox, or the DisplayTextField in WebForms. The ToString() method is called automatically when a class is bound to a list control and you forget to fill in the appropriate display property. Wrap Up Things That Change Although .NET is very object oriented, and you use classes for everything you do in .NET, there are times where you still want to create your own wrapper classes around the .NET classes and methods. The following list should help you decide on whether or not to create your own wrapper class: Microsoft might change to a new class for doing the same thing within the .NET Framework. An example of this is the ConfigurationSettings class in .NET 1.0 that was deprecated in favor of the ConfigurationManager class. Your customer may want to store data in a new way. They change from MySQL to SQL Server or from SQL Server to Oracle. You may want to store data in a different location. You may want to take your global settings and store them in a database table instead of in the .config file of your application. There are too many lines of code to remember to perform what should be a simple function. Encrypting and decrypting data takes many lines of code and requires you to work with a few different classes and interfaces. Selecting and modifying data in a database using ADO.NET takes quite a few lines of code. You wish to centralize code that you use in many locations. You wish to call one method in all your catch blocks to publish exceptions. If you think the implementation of some functionality in your application could possibly change, it’s a good idea to create your own wrapper class. Looking at the list above, you should create your own class to retrieve global settings, a class to wrap up ADO.NET, a class to perform encryption and decryption and a class to help you publish exceptions. You want to write code in your wrapper classes such that if you need to change the underlying implementation, the code that uses your wrapper class doesn’t have to change. If you can accomplish this, your code will be very flexible in the long run. As an example, let’s create a class that wraps up the ConfigurationManager class to retrieve configuration settings. If you store data in the <appSettings> element in the .config file of your application, you’re most likely retrieving those settings using the ConfigurationManager class. Below is a sample of a configuration file where a default state code value is stored. <configuration> <appSettings> <add key="DefaultStateCode" value="IA" /> </appSettings> </configuration> To retrieve the value IA from the DefaultStateCode key, you pass the key to the indexed property AppSettings, as shown below. public string GetStateCode() { return ConfigurationManager. AppSettings["DefaultStateCode"]; } The problem with using the ConfigurationManager class is that the only place you can store the default state code is within a configuration file. So, if you use the ConfigurationManager class in 100 places within your application, and you wish to move these settings into a database table, you have to change your application code in 100 places. A better approach is to recognize that things like the storage location of configuration settings could change in the future and you shouldn’t hard-code a class and method name to retrieve those settings. Instead, create a class to retrieve configuration settings and your own method to wrap up the call to the ConfigurationManager class. Use this class and method in those 100 places in your code. Then, when you wish to change to storing your configuration settings in a table, you only have to change your code in one place. The next snippet is a simple example of a class called PDSAConfigurationManager with a GetSetting method. public class PDSAConfigurationManager { public string GetSetting(string key, string defaultValue) { string ret = string.Empty; ret = ConfigurationManager.AppSettings[key]; if (string.IsNullOrEmpty(ret)) ret = defaultValue; return ret; } } To use this class in your code, you create an instance of the PDSAConfigurationManager class, then call the GetSetting method as shown below. private void GetValue() { PDSAConfigurationManager mgr = new PDSAConfigurationManager(); MessageBox.Show(mgr.GetSetting( "DefaultStateCode", "CA")); } Calling ConfigurationManager.AppSettings is a little simpler because AppSettings is a static method and thus no instantiation of the ConfigurationManager class is required. However, using instance methods gives you much more flexibility because you could modify properties of the class prior to calling a method, or even use dependency injection to completely change the implementation of the class. But, if you wish to have a static way of accessing the GetSetting method, you can use a Singleton pattern to accomplish this, as discussed in the next section of this article. Using instance methods gives you great flexibility because you can modify properties of the class prior to calling a method, or even use dependency injection to completely change the implementation of the class. Singleton Pattern Many developers, including the ones at Microsoft, like creating classes with static methods and properties. Although these methods and properties are easy to use because you don’t have to instantiate a class in order to call them, there are some potential problems with this approach. - The ability to create an instance, modify a property, and then call a method cannot be done with a static method. - You can’t inherit from the class and override the functionality of a static method. - If you need to add additional functionality to your static method, you end up with a lot of overloads of the method or a lot of optional parameters. It’s easier to create a class with properties that you can set prior to calling an instance method. - In an ASP.NET application, you forget that a property is static and you try to use it for per-user data, only to realize that the last user to change the data "wins." - Static methods cannot be defined in an interface and thus you can’t pass these objects around by an interface. These classes cannot be used in a strategy pattern. - Developers think instantiation takes too long. Modern compilers, such as .NET, have made object instantiation a very quick operation. - Developers don’t want to write an extra line of code. - A static method or property could have problems in a multi-threaded application. There are both pros and cons to using or not using static properties and methods. Like anything in programming, use them in moderation. If you decide that you would like the flexibility of instance properties and methods but the convenience of static properties and methods, one option is to use a Singleton pattern. This design pattern gives you the benefits of a class that has all instance methods and properties, but also allows you to create a single instance when that’s all you require. The code in Listing 4 shows the PDSAConfigurationManager with the GetSetting method you learned about in the previous section of this article. A property called Instance defined as a static is added to this class. There’s a private static field called _Instance that is initially assigned to null. In the getter of the Instance property, you check to see if the field _Instance is equal to null, and if so, you create a new instance of the PDSAConfigurationManager class and assign it to the _Instance field. You then return this single instance from the getter. To call the GetSetting() method on this PDSAConfigurationManager class, you now can use a simpler version as shown below: private void GetValue() { MessageBox.Show( PDSAConfigurationManager.Instance. GetSetting("DefaultStateCode", "CA")); } By using the Instance property, you avoid having to create an instance of the PDSAConfigurationManager because a single instance is available for you to use. However, you could inherit from the PDSAConfigurationManager class and override the GetSetting() method to modify how this method works. This would not work if you had defined GetSetting() as a static method. Summary There are so many little tips and tricks that help you develop code that can be reused and keep your code maintainable, testable and flexible over the life of your software. Many of the techniques presented in this article are Object-Oriented Programming 101. Others are particular to .NET, and still others apply to almost any programming language. Striving to create flexible and maintainable code is always a good idea. You should also try to keep your code so it performs well too. Sometimes you may have to sacrifice one for the other. You’ll have to make the decision on what code to write, but hopefully, you found a few gems in this article that you can take advantage of right away. NOTE: You can download the complete sample code at my website. . Choose "PDSA Articles", then "Code Magazine -Tips and Tricks for Flexible Code" from the drop-down list.
https://www.codemag.com/Article/1405031/Tips-and-Tricks-for-Flexible-Code
CC-MAIN-2020-10
refinedweb
4,317
54.32
- dariosalvi last edited by Hello, I have a jest unit test of a component that uses the notify plugin. If import the plugin into the test with: import { Notify } from 'quasar' and then: localVue.use(Quasar, { components, plugins: [Notify] }) I get an annoying warning on the console: [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'fullscreen' of undefined" I am sure it’s the notify plugin because if I remove the plugin the message goes away. Even if the test works, I’d like to get rid of the warning message, so I was wondering if there is a good way to mock the notiify plugin. I’ve tried with the following mock but it’s clearly wrong: const Notify = { notify () { console.log('notify') } } Have you got any tip to share? Thanks! - metalsadman last edited by @dariosalvi you should also ask this in the testingchannel in our discord. - dariosalvi last edited by I have found a solution to the specific warning: the reference to fullscreen is inside the function mounted() of the Notify plugin. I have mocked mounted()with: Notify.mounted = () => { return jest.fn() } and the warning has disappeared.
https://forum.quasar-framework.org/topic/7023/mocking-notify-plugin-in-a-test
CC-MAIN-2021-21
refinedweb
191
63.29
In search of Eulerian path (vinc's solution), discarding loops solution in Clear category for Domino Chain by flpo from collections import defaultdict, deque def domino_chain(tiles: str) -> int: # build a graph tiles = {tuple(map(int, tile.split('-'))) for tile in tiles.split(', ')} ### store loops and remove them from tiles loops = {x for x, y in tiles if x == y} tiles = {(x, y) for x, y in tiles if x != y} graph = defaultdict(set) for v1, v2 in tiles: graph[v1].add(v2) graph[v2].add(v1) # check if the graph has either 0 or 2 vertices of odd degree degrees = {v: len(graph[v]) for v in graph} nodes_with_odd_degree = {v for v in graph if degrees[v] % 2} if len(nodes_with_odd_degree) not in (0, 2): return 0 if len(nodes_with_odd_degree) == 2: # if there are two vertices with odd degree, then check only one of them start = next(iter(nodes_with_odd_degree)) # any node with odd degree queue = deque([(start, set(), [start])]) else: # if all vertices have even degree, then check all of them queue = deque([(v, set(), [v]) for v in graph]) # BFS-search from each vertex in the queue with a single passage # along the edges result = 0 while queue: node, closed, chain = queue.popleft() if len(closed) == len(tiles): ### eval loops factor mul = 1 for loop in loops: mul *= chain.count(loop) result += mul else: for child in graph[node]: if frozenset({node, child}) not in closed: queue.append((child, closed | {frozenset({node, child})}, chain + [child])) if len(nodes_with_odd_degree) == 0: result //= 2 # exclude inverted chains return result Sept. 12, 2017 Forum Price Global Activity ClassRoom Manager Leaderboard Coding games Python programming for beginners
https://py.checkio.org/mission/domino-chain/publications/flpo/python-3/in-search-of-eulerian-path-vincs-solution-discarding-loops/share/5f5748a86d58dca79333db6e7bb22290/
CC-MAIN-2021-17
refinedweb
274
61.29
Summary: Microsoft Scripting Guy, Ed Wilson, illustrates how to explore WMI methods and writable properties from a Windows PowerShell script. Weekend Scripter Microsoft Scripting Guy, Ed Wilson, here. One of the things I like about Windows PowerShell is the ease in which I can modify things, experiment with things, play with things, and finally end up with a decent script. It is a rainy day in Charlotte, North Carolina, and it is beginning to actually look like spring outside. I am listening to Radiohead on my Zune HD, and sipping a cup of organic mint tea…it is just one of those sort of laid-back days. I had an extremely busy week, with a presentation to the Charlotte IT Professionals Group thrown in for fun. I absolutely love speaking to user groups, either in person or via Live Meeting, and it is always the highlight of my week. I firmly believe and wish to support these groups because they are the embodiment of community. By the way, if you are looking for a Windows PowerShell user group in your area, check out the PowerShell Group site for listings. If you know of a group that is not listed in this directory, please add it. There is also help available if you want to start a user group. One of the goals of a good scriptwriter should be to write reusable code. In Windows PowerShell, this generally means creating functions. When I created the Get-WmiClassesMethods.ps1 Windows PowerShell script and the Get-WmiClassProperties.ps1 script, I had code reuse in mind. For details about the essential logic of today’s script, refer to the following articles: Use PowerShell to Find WMI Classes that Contain Methods Use PowerShell to Find Writable WMI Properties Therefore, I encapsulated the main logic into individual functions. Due to time constraints, the functions are not as reusable as I would like them to be, but I did have reuse in mind at the time. This also illustrates that there is often a tradeoff between code reuse and development time. It takes time to design a completely portable function, and sometimes it takes a long time to analyze how a function might be reused and to abstract everything. On a rainy Saturday morning, I thought it would be a good idea to combine the two scripts into a single script that produces a consolidated listing of implemented methods and writable properties from all the WMI classes in a particular WMI namespace. I know I can use such a list, and I hope you find it useful as well. To be sure, the script is a bit complicated, and it is most certainly long. That is why I uploaded the Get-WmiClassMethodsAndWritableWmiProperties.ps1 script to the Scripting Guys Script Repository. But the script is shorter and easier to understand that a corresponding script written in VBScript. In fact, I always wanted to write such a script in VBScript but I never got around to doing it—and I wrote the book on VBScript and WMI. All right, I want to start with the Get-WmiClassMethods function. I will highlight the changes I made. The first change I made was to add a class parameter to the Param portion of the function. The reason for this is that I want to collect the WMI classes outside of the function, and pass the individual WMI class information to the function for processing. This will enable me to work on the same class and to retrieve methods and properties as appropriate. Because I am going to pass the class information to the functions, I do not need to collect the classes inside the function. Therefore, I comment out the lines in the function that perform the class collection duties. This revised portion of the code is shown here. Function Get-WmiClassMethods { Param( [string]$namespace = “root\cimv2”, [string]$computer = “.”, $class ) $abstract = $false $method = $null #$classes = Get-WmiObject -List -Namespace $namespace | Where-Object { $_.methods } #Foreach($class in $classes) #{ I changed the output to include the Word METHODS in addition to the WMI class name. To do this, I used the New-Underline function. One of the cool things about this function, and one reason I use it so often, is that it allows one to specify the character to use for underlining, in addition to the colors to use for the text and the underline string. I also had to comment out the closing curly bracket (closing braces…squiggly things…whatever) of the foreach class loop. The comments that I included when I originally created the script make lining up the curly bracket easier. This portion of the script is shown here. if($method) { New-Underline -strIN $class.name New-Underline “METHODS” -char “-“ } $method } #end if not abstract $abstract = $false $method = $null # } #end foreach class Because the two functions (Get-WmiClassMethods and Get-WmiClassProperties) are written in a similar style, similar changes are required for inclusion here. I need to add a class parameter to the Param section, and I need to comment out the code that gathers the WMI classes and implements the foreach class loop. The revised code is shown here. Function Get-WmiClassProperties { Param( [string]$namespace = “root\cimv2”, [string]$computer = “.”, $class ) $abstract = $false $property = $null #$classes = Get-WmiObject -List -Namespace $namespace #Foreach($class in $classes) #{ I add the word PROPERTIES to the output portion of the script, and remove the closing curly bracket. This revision is shown here. if($property) { New-Underline -strIN $class.name New-Underline “PROPERTIES” -char “-“ } $property } #end if not abstract $abstract = $false $property = $null # } #end foreach class } #end function Get-WmiClassProperties I moved the collection of the WMI classes, and the foreach $class construction to the entry point of the script. In addition, I added the –class parameter when I call each function. This portion of the script is shown here. # *** Entry Point to Script *** $classes = Get-WmiObject -List -Namespace $namespace Foreach($class in $classes) { Get-WmiClassMethods -class $class Get-WmiClassProperties -class $class } When the script runs, the output that is shown in the following image appears in the Windows PowerShell
https://blogs.technet.microsoft.com/heyscriptingguy/2011/03/12/explore-wmi-methods-and-properties-via-powershell-script/
CC-MAIN-2017-22
refinedweb
1,017
61.97
User talk:ICameHereInACloche From Uncyclopedia, the content-free encyclopedia edit Welcome! Hello, ICameHereInAClocameHereInACloc!) 07:36, July 23, 2011 (UTC) edit Name I like your user name! I see you have been contributing since your arrival. Is your cloche a hat or a bell? -- RomArtus*Imperator ® (Orate) 10:12, December 1, 2011 (UTC) - It's a bell-shaped hat.--ICameHereInACloche 01:52, December 11, 2011 (UTC) edit Your article I have moved it here because the maintenance template on it had expired but I think it has real potential. Feel free to continue working on it in your userspace and simply move it back to mainspace when you're finished up. If you have any questions then you can ask them on my talk page and I'll do my best to help you out. --ChiefjusticePSX 13:16, January 8, 2012 (UTC) - Sorry, I've just had real life to contend with. I'll finish it. Thanks!--ICameHereInACloche 19:35, January 8, 2012 (UTC) edit Hi Just wanted to say hi, and welcome to the neighbourhood. Beyond that I have nothing else to say. So, er, bye, I guess. Pup 10:25 08 Feb '12:18, February 10, 2012 (UTC) edit Your happy monkey topic Your topic my dear ICameHereInACloche is: High school football players of Indian descent . - Write the article on your namespace - I'll be judging the articles based on creativity, originality and cleverness. - Good luck, you have until tomorrow night (23.59 UTC, 6:59PM ET) to finish. (happy monkey just stunk up your bathroom...sorry) --ShabiDOO 11:49, February 11, 2012 (UTC) edit Happy monkey Hey I came here, how is it going? I've formatted your article a little bit, as this is your first contest and you ended up with topic that isn't super easy to say the least. I've added a generic image and put some title bars in the article.. I won't be the least bit offended if you reverse all of my edits, and you should probably change my edits to reflect how you see your article in terms of images and title bars.:39, February 12, 2012 (UTC) edit Changed thing If you comment it out then things like sigs from 4 tildes (~~~~) don't work properly. Same effect with the open div but more effective. Mind you, there are admins who will hate this. Pup 03:24 14 Feb '12 edit Hey you....nOOb guy...listen up It is totally awsome ... man ... you are just a lowly nOOb and yet you won SECOND place ... with two judges tying you for 1st and two judges scoring you as first. Incredible work ... super creative and original article and a guarenteed featured article. CONGRATULATIONS !!! --ShabiDOO 04:36, February 20, 2012 (UTC) edit He thought you were a noob, heeheehee, and awesome page Hello, and I was hoping to tie your page in the contest and wouldn't have been at all surprised if you had won. Very good work, as is the testimony on your user page which I just read. I was gone through much of 2011, so missed your pages, and have enjoyed reading them. Thanks for keeping Happy Monkey alive too, although I wish the real Happy Monkey would play someday. I look forward to voting for your page on VFH after we all polish our work (Shabidoo's pee reviews were a work of art, 16 of them in a short amount of time!). Aleister 12:10 20-2-'12 - I forgot to mention how much I like your name. I had to look up what Cloche means, and was happily educated. Aleister 23:22 20-2-'12 - Why thank you! Seems like there are still people who appreciate a good hat.--I am here in a loch 23:58, February 20, 2012 (UTC) edit Vote Hello, and please, feel free to vote against the homophone page, and nobody holds things like that against anybody except Lyeritya. Vote as you wish whenever you wish, uncyclopedia has freedom of speech and freedom to vote. And nomming your own page is fine, and is actually excouraged, as long as you know for sure that it's ready and it's of feature quality. And feel free to ask me any questions about my article, it is a layered piece and I'm very proud of some sections of it (particuarly the anti-war section). BB did that great tatochop of Richard Simmons as an homocell phone. Anyway, if I had my way your page would beat mine to feature, for yours deserved the win as much as mine did. And I like what you did to the talk link on your signature. Yay ICHIAC! Aleister 16:59 26-2-'12 - By the way, did you know some idiot put your page up for feature vote? You may or may not be done with it yet, but you have time to edit it while it's on the feature que. Aleister 23:01 26-2-'12 - Thanks. Thanks a bunch. Although, what was the main idea of your article? It'd make me understand it much more.--CameHereInACloche (Talk) 23:13, February 26, 2012 (UTC) - Doesn't usually work like that. People vote (hopefully) on the merit of the article alone. Grabbing backstory, or getting clarification, shouldn't be part of it. Having said that, the article has two main thrusts (haha). Homophone is a gramattical term meaning two words with similar sound with different meaning. (Like where and wear.) Also can be taken to mean a gay phone. Pup 11:39 26 Feb '12 - In truth, I was expecting the article to be a bunch of corny puns. I was pleasantly surprised, and still confused.--CameHereInACloche (Talk) 23:44, February 26, 2012 (UTC) - I am usually pleasantly surprised and confused. Nature of the beast. The article is an epic sweep of history as it relates to telephones and the gay culture. It starts out with Alexander Graham Bell and goes all the way into the future, dragging gayness kicking and screaming with it. History on the doorstep of sick humour. Or vica versa. Stick with me, I'll take you on some wild rides. Aleister 1:23 27-2-'12 - Interesting... view in life you have there. Something completely unrelated, have you ever watched a really good film or read a really good book and then start to actually want to do something good with your writing? Because that's how I feel now. At times, I feel as though the writing I do wouldn't be proper for this site, since I'm much more of a fictional writer than a satirical one.--CameHereInACloche (Talk) 03:39, February 27, 2012 (UTC) - It would certainly be a lot more rewarding financially to write a movie, but what about the love? The love of being poor and still, giving away to a website! That's something to write on your resumegrave!:11, February 27, 2012 (UTC) - That's not my view, it was the damn topic handed me. That's what's good about the Happy Monkey Contest, it pulls the writing out of you. Watching the Academy Awards, and clapping whenever "Hugo" wins something. This site, have you looked at the rules of uncyclopedia? There are only three. But your comment pertains to the third one - "Dance like you've never danced before." And you know what? People should be banned when they break that rule for too long. Funnybony told me that this site is a playground for adults. It's a total playground, pertaining to writing. You can do something so serious here that your intellect can sail, and then go back and edit the thing and put some funny into it. Or add it in while you're writing. But the key is to edit and polish and polish and edit. Sometimes. Whoops, best actor award is on. Aleister 4:14 27-2-'12 - Yeah! This is a playground, and regardless of whether my writing's better for a bunch of circlejerking neckbeards, my mind is scrambled up like jelly after mixed with paint thinner and rat skulls in a blender for an hour and no one wants to see the frothy mixture of that accumulated filth gushing out my eyes and running out my ears and into a computer screen except the wonderful people here, so I'm staying here for my writing needs.--CameHereInACloche (Talk) 04:58, February 27, 2012 (UTC) - If not you will be banned for violation of Rule Three. The Artist won best picture, I was hoping for Hugo, but it picked up some good awards. Must go soon, have many things to do. Aleister 5:04 27-2-'12 - There is a certain element of free-form prose and flexibility here that allows your writing ability to go in odd directions. I used to write more encyclopaedic stuff but read more comedy. I came here to develop my comedy writing skills, and was intending to go on from here to do romance writing. Never got around to that bit. It is a playground, but even in the playground there are those that stand on the monkey bars, and those that play on the swings. And who decided that tan bark was suitable flooring for a playground? Pup 09:24 27 Feb '12 - You... doing romance? I would pay a pretty penny to read that.--CameHereInACloche (Talk) 20:52, February 27, 2012 (UTC) - I've had a few previous writing styles. I've written technical stuff, motivational essays, Christian essays, plays, short stories for teens, fantasy short story, and erotica. I've had a few bits and pieces published as well - sadly mostly the Christian stuff, but a play I wrote was short-listed for an award. I've lost most of my old writing over time. I actually started an erotica piece again not long ago, but I had to stop it - after writing here for so long I kept wanting to put fart jokes in it. Pup 11:39 27 Feb '12 - Actually, UnScripts:Steal Bank Customer Service training video was based very closely on training material I actually wrote for new employees at a bank. More of that is accurate than people would believe. Pup 11:46 27 Feb '12 - From what you talk about your writing experience, you seem like a true renaissance man, albeit one that does erotica. I'm just a jerk with a computer. Maybe it'd be fun to do an erotica piece that affectionately satirizes the tropes and conventions found in erotica and porn. Anyways, best of luck to you. I have no plans of getting any of my writing published, I just do it for shits and giggles. Also, cool article!--CameHereInACloche (Talk) 23:50, February 27, 2012 (UTC) - I write for the fun of writing too. Being published is a nice side effect. I've wondered about doing a Mills & Boon satire in the past. Might have to revisit that idea. Pup 11:56 27 Feb '12 - Have you every posted any of the stories you've done in the past to Uncyclopedia? The story I'm working right now is based on an old high school assignment I had on character archetypes.--CameHereInACloche (Talk) 00:06, February 28, 2012 (UTC) edit Indian football Hi. I saw you voted against your page, so obviously I put it on VFH too quickly without asking you. When it's polished-edited it will have the votes of all the naysayers as well - including you! And thanks for your comments about my homophone page, I worked on it from your original comments too. And judging from the above we can have an erotica contest, with Puppy leading the way. Or an erotica collab, which could be a swamp. Aleister 00:45 28-2-'12 - An Uncyc erotica comp. I'm terrified by the concept. Pup 12:56 28 Feb '12 - My hips are moving on their own! Couldn't resist.--CameHereInACloche (Talk) 03:01, February 28, 2012 (UTC) edit Award from UN:REQ edit Dynamite fishing Hey, your article, is about to have the construction tag removed in 3 days. Just giving a little heads up. :) -- UserTalkContributions 18:46, March 11, 2012 (UTC) edit Nuclear semiotics I've done a minor bit of proofreading on it. I wish I'd had a chance to review this, but I was beaten to it. It's fantastic. I'm a little bugged by the barrel image though. The trefoil symbol should be in the middle of the barrel, or at least not overlapping the two sections. The word should wrap around a little more. I'm being nitpicky here, but I know what it's like to work on something like this to look at it after it was featured and say "I wish I had just..." One other thing that I thought of when reading this and the corresponding WP page - the curse of Tutankhamen. When they opened the tomb they were actually able to read the curse details. And they barely paused. • Puppy's talk page • 12:10 19 Mar - Thanks. I'm not very good with image manipulation, so it didn't really end up very well. The hole (which was supposed to be a stand-in for Yucca mountain) was meant to be more about the dangers of miscommunication. The weird mutations were supposed to be a SCIENCE! version of the effects of radiation. Again, thanks for the proofreading. Always one error that's left...--CameHereInACloche (Talk) 04:58, March 19, 2012 (UTC) - I figured it was something along the lines of Yucca mountain. The one element (from WP) that wasn't directly in your article was the "technical difficulty in getting there" part. Ignoring the fact that landscape changes over time, if there is a way to get somewhere, human beings will do it given enough time. It's part of who we are. The flowers idea I thought was actually just your invention until I read the WP version. How much did these guys get paid? • Puppy's talk page • 05:36 19 Mar - I seem to have forgotten to include that part. Maybe an idea for a future article? I focused more on the semantic part of the concept than the more physical parts, which may be my undoing.--CameHereInACloche (Talk) 05:44, March 19, 2012 (UTC) - I don't know you can say "undoing" when it's about to be featured. • Puppy's talk page • 05:52 19 Mar edit Wait, wut? You can't do that! What about the prince's hair?! Did he ever get his kingdom back?! What about the wizard?! And do the king's handlers get eaten by the dragon!? What the hell! You may have come here in a cloche, but you shall leave here in a box of Assian stone! Get back here, you! I 23 '12 6:39 (UTC) - I'm taking a break. Don't worry, I'll be back.--CameHereInACloche (Talk) 22:00, April 23, 2012 (UTC) edit I would like to bring your attention to this forum Forum:Vote to De-Op Lyrithya • Puppy's talk page • 03:20 07 May edit Feature Its time you wrote another! --ShabiDOO 05:34, June 16, 2012 (UTC) edit High school football players of Indian descent I love this article! It reminds me of an article I'm thinking on writing, you can help out too or tell me what you think of its title: Skateboarders of Polish descent. Like it, no?:27, July 11, 2012 (UTC) edit And where have you been? And what time do you think it is? • Puppy's talk page • 02:51 14 Aug - I've been elsewhere. This site depresses me. It's like a dank basement forty feet underground and fourteen years permanently behind in humor.--CameHereInACloche (Talk) 02:02, August 15, 2012 (UTC) - But forty feet underground is the only way we'll survive the nuclear winter! • Puppy's talk page • 02:10 15 Aug - Been patrolling the Mojave, lately?--CameHereInACloche (Talk) 02:28, August 15, 2012 (UTC) - Given I'm in Melbourne, Australia, it's a bit of a walk to get there. • Puppy's talk page • 02:32 15 Aug - What's happening in the Mojave? Any more of them green fellas turning:29, August 29, 2012 (UTC)
http://uncyclopedia.wikia.com/wiki/User_talk:ICameHereInACloche
CC-MAIN-2014-42
refinedweb
2,740
74.29
How to Make a Game Like Candy Crush: Part 1. And unlike eating that much real candy, it doesn’t give you a tummy ache! In this tutorial, you’ll learn how to make a game like Candy Crush named Cookie Crunch Adventure. Yum, that sounds even better than candy! tutorial assumes you have working knowledge of Sprite Kit. If you’re new to Sprite Kit, check out the beginner tutorials on the site or our book, iOS Games by Tutorials. Getting Started Before you continue, download the resources for this tutorial and unpack the zip file. You’ll have a folder containing all the images and sound effects you’ll need later on. Start up Xcode, go to File\New\Project…, choose the iOS\Application\SpriteKit Game template and click Next. Name the project CookieCrunch and enter RWT for the Class Prefix. Note: You’ll be using RWT for the class prefix for all classes you create in this tutorial. Because Objective-C does not have namespaces, it’s a good idea to add a unique prefix to your own classes to prevent potential conflicts with Apple’s own frameworks. You can read more about this in our Objective-C style guide. Click Next, choose a folder for your project and click Create. This is a portrait-only game, so open the Target Settings screen and in the General tab, uncheck the Landscape Left and Landscape Right options in the Device Orientation section: To start importing the graphics files, go to the Resources folder you just downloaded and drag the Sprites.atlas folder into Xcode’s Project Navigator. Make sure Copy items into destination group’s folder: Outside of the asset catalog in the Project Navigator, delete Spaceship.png from the project. This is a sample image that came with the template but you won’t need any spaceships while crunching those tasty cookies! :] Great! It’s time to write some code. In RWTViewController.m, add the following method to permanently hide the status bar: - (BOOL)prefersStatusBarHidden { return YES; } For the final piece of setup, replace the contents of RWTMyScene.m with this: #import "RWTMyScene.h" @implementation RWTMyScene - (id)initWithSize:(CGSize)size { if ((self = [super initWithSize:size])) { self.anchorPoint = CGPointMake(0.5, 0.5); SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"Background"]; [self addChild:background]; } return self; } @end This loads the background image from the asset catalog and places it in the scene. Because the scene’s anchorPoint is (0.5, 0.5), the background image will always be centered on the screen on both 3.5-inch and 4-inch devices. Build and run to see what you’ve got so far. Excellent! Can I Have Some Cookies?. To learn more about OpenGL ES, we have a video tutorial series for that. To being implementing this, you need to create the class representing a cookie object. Go to File\New\File…, choose the iOS\Cocoa Touch\Objective-C class template and click Next. Name the class RWTCookie, make it a subclass of NSObject, click Next and then Create. Replace the contents of RWTCookie.h with the following: @import SpriteKit; static const NSUInteger NumCookieTypes = 6; @interface RWTCookie : NSObject @property (assign, nonatomic) NSInteger column; @property (assign, nonatomic) NSInteger row; @property (assign, nonatomic) NSUInteger cookieType; @property (strong, nonatomic) SKSpriteNode *sprite; - (NSString *)spriteName; - (NSString *)highlightedSpriteName; @end The constant NumCookieTypes keeps track of the number of different cookie types in the game. You set the constant here in the header file because other classes will also need to know how many cookie types there are. The column and row properties let RWTCookie keep track of its position in the 2-D grid. The cookieType property describes the—wait for it—type of the cookie, which is just a number from 1 to 6. You will deliberately not use cookie type 0. This value has a special meaning, as you’ll learn toward the end of this part of the tutorial. Each cookie type number corresponds to a sprite image: You may wonder why you’re not making RWTCookie a subclass of SKSpriteNode. After all, the cookie is something you want to display on the screen. If you’re familiar with the model-view-controller (or MVC) pattern, think of RWTCookie. The spriteName helper method returns the file name of that sprite image in the texture atlas. In addition to the regular cookie sprite, there is also a highlighted version that appears when the player taps on the cookie. Your implementation of RWTCookie will be very straightforward. Paste this into the @implementation block of RWTCookie.m: - (NSString *)spriteName { static NSString * const spriteNames[] = { @"Croissant", @"Cupcake", @"Danish", @"Donut", @"Macaroon", @"SugarCookie", }; return spriteNames[self.cookieType - 1]; } - (NSString *)highlightedSpriteName { static NSString * const highlightedSpriteNames[] = { @"Croissant-Highlighted", @"Cupcake-Highlighted", @"Danish-Highlighted", @"Donut-Highlighted", @"Macaroon-Highlighted", @"SugarCookie-Highlighted", }; return highlightedSpriteNames[self.cookieType - 1]; } - (NSString *)description { return [NSString stringWithFormat:@"type:%ld square:(%ld,%ld)", (long)self.cookieType, (long)self.column, (long)self.row]; } The spriteName and highlightedSpriteName methods simply look up the name for the cookie sprite in an array of strings. Recall that cookieType starts at 1 but arrays are indexed starting at 0, so you need to subtract 1 from cookieType to find the correct array index. The description method is a debugging tool, so passing an RWTCookie object to NSLog() will print out something helpful: the type of cookie and its column and row in the level grid. You’ll use this in practice later. Keeping the Cookies: the 2-D Grid Now you need something to hold that 9×9 grid of cookies. For that, you’ll make another class, RWTLevel. Go to File\New\File…, choose the iOS\Cocoa Touch\Objective-C class template and click Next. Name the class RWTLevel, make it a subclass of NSObject, click Next and then Create. Replace the contents of RWTLevel.h with the following: #import "RWTCookie.h" static const NSInteger NumColumns = 9; static const NSInteger NumRows = 9; @interface RWTLevel : NSObject - (NSSet *)shuffle; - (RWTCookie *)cookieAtColumn:(NSInteger)column row:(NSInteger)row; @end This declares two constants for the dimensions of the level, NumColumns and NumRows, so you don’t have to hardcode the number 9 everywhere. The shuffle method fills up the level with random cookies. There is also a method to obtain a cookie object at a specific position in the level grid. Of course, the interesting stuff happens in RWTLevel.m, so switch to that file and add the following instance variable: @implementation RWTLevel { RWTCookie *_cookies[NumColumns][NumRows]; } This creates a two-dimensional array that holds pointers to RWTCookie objects, 81 in total (9 rows of 9 columns). You may be wondering why you are making a C array instead of an NSArray. There are two reasons. - A multi-dimensional C array is a perfect representation of a 2D grid. If you know the column and row numbers of a specific item, you can index the array as follows: // find the element at column 3, row 6 myCookie = _cookies[3][6]; - The second advantage over an NSArrayis that a C array can contain nilelements, which is something you’ll need to make non-square levels. With this in mind, implementing cookieAtColumn:row: becomes easy. Add it to RWTLevel.m: - (RWTCookie *)cookieAtColumn:(NSInteger)column row:(NSInteger)row { NSAssert1(column >= 0 && column < NumColumns, @"Invalid column: %ld", (long)column); NSAssert1(row >= 0 && row < NumRows, @"Invalid row: %ld", (long)row); return _cookies[column][row]; } Notice the use of NSAssert1() to verify that the specified column and row numbers are within the valid range of 0-8. This is important when using C arrays because, unlike NSArrays, they don’t check that the index you specify is within bounds. Array indexing bugs can make a big mess of things and they are hard to find, so always protect C array access with an NSAssert! Note: New to NSAssert? The idea behind NSAssert. NSAssert three methods to RWTLevel.m: - (NSSet *)shuffle { return [self createInitialCookies]; } - (NSSet *)createInitialCookies { NSMutableSet *set = [NSMutableSet set]; // 1 for (NSInteger row = 0; row < NumRows; row++) { for (NSInteger column = 0; column < NumColumns; column++) { // 2 NSUInteger cookieType = arc4random_uniform(NumCookieTypes) + 1; // 3 RWTCookie *cookie = [self createCookieAtColumn:column row:row withType:cookieType]; // 4 [set addObject:cookie]; } } return set; } - (RWTCookie *)createCookieAtColumn:(NSInteger)column row:(NSInteger)row withType:(NSUInteger)cookieType { RWTCookie *cookie = [[RWTCookie alloc] init]; cookie.cookieType = cookieType; cookie.column = column; cookie.row = row; _cookies[column][row] = cookie; return cookie; } The real work happens in createInitialCookies.. Recall that this needs to be a number between 1 and 6. arc4random_uniform(NumCookieTypes)returns a number between 0 and 5, so you have to add 1. - Next, the method creates a new RWTCookieobject and adds it to the 2-D array. This step employs a helper method, createCookieAtColumn:row:withType:. The reason for having this separate method is that later you also need to create RWTCookieobjects from another place. - Finally, the method adds the new RWTCookieobject to an NSSet. A set is like an array, except it cannot contain the same object more than once and the objects are not ordered (they do not have an index). shufflereturns this set of cookie objects to its caller. One of the main difficulties when designing your code is deciding how the different objects will communicate with each other. In this game, you often accomplish this by passing around a collection of objects, usually an NSSet or NSArray. In this case, after you create a new RWTLevel object and call shuffle to fill it up with cookies, the RWTLevel replies, “Here is a set with all the new RWTCookie objects I just added.” You can take that set and, for example, create new sprites for all the cookie objects it contains. In fact, that’s exactly what you’ll do next.— RWTMySc RWTLevel, RWTCookieand a few other classes. The models will contain the data, such as the 2-D grid of cookie objects, and handle most of the gameplay logic. - The views will be RWTMySc. If game logic and sprites are all mixed up, then it's hard to write such tests, but in this case you can test RWTLevel separate from the other components. This kind of testing lets you add new game rules with confidence you didn't break any of the existing ones. Open RWTMyScene.h and replace its contents with the following: @import SpriteKit; @class RWTLevel; @interface RWTMyScene : SKScene @property (strong, nonatomic) RWTLevel *level; - (void)addSpritesForCookies:(NSSet *)cookies; @end The scene has one public property to hold a reference to the current level. Next, open RWTMyScene.m and add the following code at the top, just underneath the existing #import: #import "RWTCookie.h" #import "RWTLevel.h" static const CGFloat TileWidth = 32.0; static const CGFloat TileHeight = 36.0; @interface RWTMyScene () @property (strong, nonatomic) SKNode *gameLayer; @property (strong, nonatomic) SKNode *cookiesLayer; @end Each square of the 2-D grid measures 32 by 36 points, so you put those values into the TileWidth and TileHeight constants. These constants will make it easier to calculate the position of a cookie sprite. To keep the Sprite Kit node hierarchy neatly organized, RWTMyScWithSize: to create the layers. Put this after the code that creates the background node: self.gameLayer = [SKNode node]; [self addChild:self.gameLayer]; CGPoint layerPosition = CGPointMake(-TileWidth*NumColumns/2, -TileHeight*NumRows/2); self.cookiesLayer = [SKNode node]; self.cookiesLayer.position = layerPosition; [self.gameLayer addChild:self.cookiesLayer]; This adds to empty SKNodes to the screen to act as layers. You can think of these as transparent planes you can add other nodes in. Remember that earlier you set the anchorPoint of the scene to (0, 0), and the position of the scene also defaults to (0, 0). This means (0, 0) is in the center of the screen. Therefore, when you add these layers as children of the scene, by default (0, 0) in. The only missing piece is addSpritesForCookies:, so add it below: - (void)addSpritesForCookies:(NSSet *)cookies { for (RWTCookie *cookie in cookies) { SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:[cookie spriteName]]; sprite.position = [self pointForColumn:cookie.column row:cookie.row]; [self.cookiesLayer addChild:sprite]; cookie.sprite = sprite; } } - (CGPoint)pointForColumn:(NSInteger)column row:(NSInteger)row { return CGPointMake(column*TileWidth + TileWidth/2, row*TileHeight + TileHeight/2); } addSpritesForCookies: iterates through the set of cookies and adds a corresponding SKSpriteNode instance to the cookie layer. This uses a helper method, pointForColumn:row:, that converts a column and row number into a CGPoint that is relative to the cookiesLayer. This point represents the center of the cookie’s SKSpriteNode. Hop over to RWTViewController.m and add the following code at the top, just underneath the existing #import lines: #import "RWTLevel.h" @interface RWTViewController () @property (strong, nonatomic) RWTLevel *level; @property (strong, nonatomic) RWTMyScene *scene; @end This class continuation includes private properties for the RWTLevel and RWTMyScene objects. Next, add these two new methods: - (void)beginGame { [self shuffle]; } - (void)shuffle { NSSet *newCookies = [self.level shuffle]; [self.scene addSpritesForCookies:newCookies]; } beginGame kicks off the game by calling shuffle. This is where you call RWTLevel’s shuffle method, which returns the NSSet containing new RWTCookie objects. Remember that these cookie objects are just model data; they don’t have any sprites yet. To show them on the screen, you tell RWTMyScene to add sprites for those cookies. Finally, replace viewDidLoad with the following implementation: - (void)viewDidLoad { [super viewDidLoad]; // Configure the view. SKView *skView = (SKView *)self.view; skView.multipleTouchEnabled = NO; // Create and configure the scene. self.scene = [RWTMyScene sceneWithSize:skView.bounds.size]; self.scene.scaleMode = SKSceneScaleModeAspectFill; // Load the level. self.level = [[RWTLevel alloc] init]; self.scene.level = self.level; // Present the scene. [skView presentScene:self.scene]; // Let's start the game! [self beginGame]; } This is largely the same as before, except now you place the RWTMyScene instance into self.scene and you create a new RWTLevel instance. Then, you set the level property on the scene to tie together the model and the view. Build and run, and you should finally see some cookies: Note: You may wonder why this game uses NSInteger and NSUInteger instead of just int, and CGFloat instead of float. This has everything to do with the iPhone 5s and 5c, which are 64-bit devices. An int is only 32-bits, so using int on a 64-bit device is not ideal. The size of an NSInteger or an NSUInteger, on the other hand, is based on the architecture of the device. In other words, they are 32-bit on 32-bit devices and 64-bit on 64-bit devices. The same thing goes for a CGFloat. It wouldn’t create a big problem to use int and float, but now that we have 64-bit devices it’s good to get into the habit of using NSInteger and CGFloat. Oh, and if you’re wondering about the difference between NSInteger and NSUInteger: the latter can only do positive numbers, not negative ones—the U stands for “unsigned”. To learn more about the integer types in iOS, check out our Objective-C Data Types: Integer video tutorial.. Drag the Levels folder from the tutorial’s Resources folder into your Xcode project. As always, make sure Copy items into destination group’s folder RWTLevel, but first you need to add a new class, RWTTile, to represent a single tile in the 2-D level grid. Note that a tile is different than a cookie, since tiles as "slots", and cookies are the things in the slots. I'll discuss more about this in a bit. Add a new Objective-C class file to the project. Name it RWTTile and make it a subclass of NSObject. You don’t have to make any changes in the source files for this new class right now. Later on, I’ll give you some hints for how to use this class to add additional features to the game, such as “jelly” tiles. Open RWTLevel.h and add an import for this new class: #import "RWTTile.h" Add these two method declarations, too: - (instancetype)initWithFile:(NSString *)filename; - (RWTTile *)tileAtColumn:(NSInteger)column row:(NSInteger)row; In RWTLevel.m, add a new instance variable that describes the structure of the level: RWTTile *_tiles[NumColumns][NumRows]; Like the _cookies variable, this is a 2-dimensional C array. Whereas the _cookies array keeps track of the RWTCookie. Add this method to load a JSON file: - (NSDictionary *)loadJSON:(NSString *)filename { NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:@"json"]; if (path == nil) { NSLog(@"Could not find level file: %@", filename); return nil; } NSError *error; NSData *data = [NSData dataWithContentsOfFile:path options:0 error:&error]; if (data == nil) { NSLog(@"Could not load level file: %@, error: %@", filename, error); return nil; } NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; if (dictionary == nil || ![dictionary isKindOfClass:[NSDictionary class]]) { NSLog(@"Level file '%@' is not valid JSON: %@", filename, error); return nil; } return dictionary; } This method simply loads the specified file into an NSData object and then converts that to an NSDictionary. This is mostly boilerplate code that you’ll find in any app that deals with JSON files. Note: To learn more about JSON and parsing it in iOS, check out our Working with JSON Tutorial. Next, add the new initWithFile: method to RWTLevel.m: - (instancetype)initWithFile:(NSString *)filename { self = [super init]; if (self != nil) { NSDictionary *dictionary = [self loadJSON:filename]; // Loop through the rows [dictionary[@"tiles"] enumerateObjectsUsingBlock:^(NSArray *array, NSUInteger row, BOOL *stop) { // Loop through the columns in the current row [array enumerateObjectsUsingBlock:^(NSNumber *value, NSUInteger column, BOOL *stop) { // Note: In Sprite Kit (0,0) is at the bottom of the screen, // so we need to read this file upside down. NSInteger tileRow = NumRows - row - 1; // If the value is 1, create a tile object. if ([value integerValue] == 1) { _tiles[column][tileRow] = [[RWTTile alloc] init]; } }]; }]; } return self; } This loads the named file into an NSDictionary using the loadJSON: helper method and then steps through the “tiles” array to look at the design of the level. Every time it finds a 1, it creates an RWTTile object and places it into the _tiles array. Note that you have to reverse the order of the rows here, because the first row you read from the JSON corresponds to the last row of the table, since you have set up (0, 0) to be the bottom left of the table. The final method to add is tileAtColumn:row:: - (RWTTile *)tileAtColumn:(NSInteger)column row:(NSInteger)row { NSAssert1(column >= 0 && column < NumColumns, @"Invalid column: %ld", (long)column); NSAssert1(row >= 0 && row < NumRows, @"Invalid row: %ld", (long)row); return _tiles[column][row]; } Like the corresponding cookieAtColumn:row:, this method simply peeks into the array and returns the corresponding RWTTile object, or nil if there is no tile at that location. At this point, the code will compile without errors but you still need to put this new _tiles array to good use. Inside createInitialCookies, add an if clause inside the two for loops, around the code that creates the RWTCookie object: // This line is new if (_tiles[column][row] != nil) { NSUInteger cookieType = ... ... [set addObject:cookie]; } Now the app will only create an RWTCookie object if there is a tile at that spot. One last thing remains: In RWTViewController.m’s viewDidLoad, replace the line that creates the level object with: self.level = [[RWTLevel alloc] initWithFile:@"Level RWTMyScene.m: @property (strong, nonatomic) SKNode *tilesLayer; Then add this code to initWithSize:, right above where you create the cookiesLayer. It needs to be done first so the tiles appear behind the cookies (Sprite Kit nodes with the same zPosition are drawn in order of how they were added): self.tilesLayer = [SKNode node]; self.tilesLayer.position = layerPosition; [self.gameLayer addChild:self.tilesLayer]; Add the following method to RWTMyScene.m, as well: - (void)addTiles { for (NSInteger row = 0; row < NumRows; row++) { for (NSInteger column = 0; column < NumColumns; column++) { if ([self.level tileAtColumn:column row:row] != nil) { SKSpriteNode *tileNode = [SKSpriteNode spriteNodeWithImageNamed:@"Tile"]; tileNode.position = [self pointForColumn:column row:row]; [self.tilesLayer addChild:tileNode]; } } } } This loops through all the rows and columns. If there is a tile at that grid square, then it creates a new tile sprite and adds it to the tiles layer. You'll need to call this method from other classes, so open RWTMyScene.h and add the method declaration there: - (void)addTiles; Next, open RWTViewController.m. Add the following line to viewDidLoad, immediately after you set self.scene.level: [self.scene addTiles]; Build and run, and you can clearly see where the tiles are: You can switch to another level design by specifying a different file name in viewDidLoad. Simply change the initWithFile:). Swiping to Swap Cookies In Cookie Crunch Adventure, you want the player to be able to swap two cookies by swiping left, right, up or down. Detecting swipes is a job for RWTMySc and touchesEnded methods from RWTMyScene. Even though iOS has very handy pan and swipe gesture recognizers, these don’t provide the level of accuracy and control that this game needs. Go to RWTMyScene.m and add two private properties: @property (assign, nonatomic) NSInteger swipeFromColumn; @property (assign, nonatomic) NSInteger swipeFromRow; These properties record the column and row numbers of the cookie that the player first touched when she started her swipe movement. Initialize these two properties at the bottom of the main if block in initWithSize:: self.swipeFromColumn = self.swipeFromRow = NSNotFound; The special value NSNotFound means that these properties have invalid values. In other words, they don’t yet point at any of the cookies. Now add a new method touchesBegan: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // 1 UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInNode:self.cookiesLayer]; // 2 NSInteger column, row; if ([self convertPoint:location toColumn:&column row:&row]) { // 3 RWTCookie *cookie = [self.level cookieAtColumn:column row:row]; if (cookie != nil) { // 4 self.swipeFromColumn = column; self.swipeFromRow = row; } } } The game will call thisx9 grid. - Next, the method verifies that the touch is on a cookie rather than on an empty square. - Finally, it records the column and row where the swipe started so you can compare them later to find the direction of the swipe. The convertPoint:toColumn:row: method is new. It’s the opposite of pointForColumn:row:, so you may want to add this method right below pointForColumn:row: so the two methods are nearby. - (BOOL)convertPoint:(CGPoint)point toColumn:(NSInteger *)column row:(NSInteger *)row { NSParameterAssert(column); NSParameterAssert(row); // Is this a valid location within the cookies layer? If yes, // calculate the corresponding row and column numbers. if (point.x >= 0 && point.x < NumColumns*TileWidth && point.y >= 0 && point.y < NumRows*TileHeight) { *column = point.x / TileWidth; *row = point.y / TileHeight; return YES; } else { *column = NSNotFound; // invalid location *row = NSNotFound; return NO; } } This method takes a CGPoint that is relative to the cookiesLayer and converts it into column and row numbers. If the point falls outside the grid, this method returns NO. Note: column and row are so-called output parameters. These are necessary because a method can only return a single value, but here you need the method to return three values: 1) the BOOL that indicates success or failure; 2) the column number; and 3) the row number. NSParameterAssert() ensures that the column and row pointers are not nil, which would horribly crash the app.: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { // 1 if (self.swipeFromColumn == NSNotFound) return; // 2 UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInNode:self.cookiesLayer]; NSInteger column, row; if ([self convertPoint:location toColumn:&column row:&row]) { // 3 NSInteger horzDelta = 0, vertDelta = 0; if (column < self.swipeFromColumn) { // swipe left horzDelta = -1; } else if (column > self.swipeFromColumn) { // swipe right horzDelta = 1; } else if (row < self.swipeFromRow) { // swipe down vertDelta = -1; } else if (row > self.swipeFromRow) { // swipe up vertDelta = 1; } // 4 if (horzDelta != 0 || vertDelta != 0) { [self trySwapHorizontal:horzDelta vertical:vertDelta]; // 5 self.swipeFromColumn = NSNotFound; } } } Here is what this does step by step: - If swipeFromColumnis NSNotFound, then either the swipe began outside the valid area or the game has already swapped the cookies and you need to ignore the rest of the motion. You could keep track of this in a separate BOOL but using swipeFromColumnis just as easy. - This is similar to what touchesBegandoesColumnto NSNotFound, the game will ignore the rest of this swipe motion. The hard work of cookie-swapping goes into a new method: - (void)trySwapHorizontal:(NSInteger)horzDelta vertical:(NSInteger)vertDelta { // 1 NSInteger toColumn = self.swipeFromColumn + horzDelta; NSInteger toRow = self.swipeFromRow + vertDelta; // 2 if (toColumn < 0 || toColumn >= NumColumns) return; if (toRow < 0 || toRow >= NumRows) return; // 3 RWTCookie *toCookie = [self.level cookieAtColumn:toColumn row:toRow]; if (toCookie == nil) return; // 4 RWTCookie *fromCookie = [self.level cookieAtColumn:self.swipeFromColumn row:self.swipeFromRow]; NSLog(@"*** swapping %@ with %@", fromCookie, toCookie); }x: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { self.swipeFromColumn = self.swipeFromRow = NSNotFound; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [self touchesEnded:touches withEvent:event]; } If the gesture ends, regardless of whether it was a valid swipe, you reset the starting column and row numbers to the special value NSNotFound. class, RWTSwap. This is another model class whose only purpose it is to say, “The player wants to swap cookie A with cookie B.” Create a new Objective-C class file named RWTSwap, subclass of NSObject. Replace the contents of RWTSwap.h with the following: @class RWTCookie; @interface RWTSwap : NSObject @property (strong, nonatomic) RWTCookie *cookieA; @property (strong, nonatomic) RWTCookie *cookieB; @end For debugging purposes, add the following method to RWTSwap.m: - (NSString *)description { return [NSString stringWithFormat:@"%@ swap %@ with %@", [super description], self.cookieA, self.cookieB]; } Now that you have an object that can describe an attempted swap, the question becomes: Who will handle the logic of actually performing the swap? The swipe detection logic happens in RWTMyScene, but all the real game logic so far is in RWTViewController. That means RWTMyScene must have a way to communicate back to RWTViewController that the player performed a valid swipe and that a swap must be attempted. One way to communicate is through a delegate protocol, but since this is the only message that RWTMyScene must send back to RWTViewController, you’ll use a block instead. Add the following forward declaration to the top of RWTMyScene.h: @class RWTSwap; Then add the following block property: @property (copy, nonatomic) void (^swipeHandler)(RWTSwap *swap); It’s the scene’s job to handle touches. If it recognizes that the user made a swipe, it will call this swipe handler block. This is how it communicates back to the RWTViewController that a swap needs to take place. At the top of RWTMyScene.m, import the new swap class: #import "RWTSwap.h" Add the following code to the bottom of trySwapHorizontal:vertical:, replacing the NSLog() statement: if (self.swipeHandler != nil) { RWTSwap *swap = [[RWTSwap alloc] init]; swap.cookieA = fromCookie; swap.cookieB = toCookie; self.swipeHandler(swap); } This creates a new RWTSwap object, fills in the two cookies to be swapped and then calls the swipe handler to take care of the rest. So RWTViewController will decide whether the swap is valid; if it is, you'll need to animate the two cookies. Add the following method to do this in RWTMyScene.m: - (void)animateSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion { // Put the cookie you started with on top. swap.cookieA.sprite.zPosition = 100; swap.cookieB.sprite.zPosition = 90; const NSTimeInterval Duration = 0.3; SKAction *moveA = [SKAction moveTo:swap.cookieB.sprite.position duration:Duration]; moveA.timingMode = SKActionTimingEaseOut; [swap.cookieA.sprite runAction:[SKAction sequence:@[moveA, [SKAction runBlock:completion]]]]; SKAction *moveB = [SKAction moveTo:swap.cookieA.sprite.position duration:Duration]; moveB.timingMode = SKActionTimingEaseOut; [swap.cookieB.sprite runAction:moveB]; } This is basic SKAction animation code: You move cookie A to the position of cookie B and vice versa. The cookie that was the origin of the swipe is in cookieA and the animation looks best if that one appears on top, so this method adjusts the relative zPosition of the two cookie sprites to make that happen. After the animation completes, the action on cookieA calls the completion block so the caller can continue doing whatever it needs to do. That’s a common pattern for this game: The game waits until an animation is complete and then it resumes. dispatch_block_t is simply shorthand for a block that returns void and takes no parameters. This method needs to be publicly visible, so open RWTMyScene.h and add the method declaration: - (void)animateSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion; Now that you've handled the view, there's still the model to deal with before getting to the controller! Open RWTLevel.h and add an import: #import "RWTSwap.h" Also add the method signature: - (void)performSwap:(RWTSwap *)swap; Then implement performSwap: in RWTLevel.m: - (void)performSwap:(RWTSwap *)swap { NSInteger columnA = swap.cookieA.column; NSInteger rowA = swap.cookieA.row; NSInteger columnB = swap.cookieB.column; NSInteger rowB = swap.cookieB.row; _cookies[columnA][rowA] = swap.cookieB; swap.cookieB.column = columnA; swap.cookieB.row = rowA; _cookies[columnB][rowB] = swap.cookieA; swap.cookieA.column = columnB; swap.cookieA.row = rowB; } This first makes temporary copies of the row and column numbers from the RWTCookie objects because they get overwritten. To make the swap, it updates the _cookies array, as well as the column and row properties of the RWTCookie objects, which shouldn’t go out of sync. That’s it for the data model. Go to RWTViewController.m and add the following code to viewDidLoad, just before the line that presents the scene: id block = ^(RWTSwap *swap) { self.view.userInteractionEnabled = NO; [self.level performSwap:swap]; [self.scene animateSwap:swap completion:^{ self.view.userInteractionEnabled = YES; }]; }; self.scene.swipeHandler = block; This creates the block and assigns it to RWTMyScene’s swipeHandler property. Inside the block, you first tell the level to perform the swap, which updates the data model—and then tell the scene to animate the swap, which updates the view. Over the course of this tutorial, you’ll add the rest of the gameplay logic to this block. While the animation is happening, you don’t want the player to be able to touch anything else, so you temporarily turn off userInteractionEnabled on the view. Build and run the app. You can now swap the cookies! Also, try to make a swap across a gap—it won’t work!. RWTCookie already has a method to return the name of this image: highlightedSpriteName. You will improve RWTMyScene to add this highlighted cookie on top of the existing cookie sprite. Adding it as a new sprite, as opposed to replacing the existing sprite’s texture, makes it easier to crossfade back to the original image. In RWTMyScene.m, add a new private property: @property (strong, nonatomic) SKSpriteNode *selectionSprite; Create this object at the bottom of the if block in initWithSize:: self.selectionSprite = [SKSpriteNode node]; Add the following method: - (void)showSelectionIndicatorForCookie:(RWTCookie *)cookie { // If the selection indicator is still visible, then first remove it. if (self.selectionSprite.parent != nil) { [self.selectionSprite removeFromParent]; } SKTexture *texture = [SKTexture textureWithImageNamed:[cookie highlightedSpriteName]]; self.selectionSprite.size = texture.size; [self.selectionSprite runAction:[SKAction setTexture:texture]]; [cookie.sprite addChild:self.selectionSprite]; self.selectionSprite.alpha = 1.0; } This gets the name of the highlighted sprite image from the RWTCookie object and puts the corresponding texture on the selection sprite. Simply setting the texture on the sprite doesn't give it the correct size but using an SKAction does. You also make the selection sprite visible by setting its alpha to 1. You add the selection sprite as a child of the cookie sprite so that it moves along with the cookie sprite in the swap animation. Also add the opposite method, hideSelectionIndicator: - (void)hideSelectionIndicator { [self.selectionSprite runAction:[SKAction sequence:@[ [SKAction fadeOutWithDuration:0.3], [SKAction removeFromParent]]]]; } This method removes the selection sprite by fading it out. It remains for you to call these methods. First, in touchesBegan, in the if (cookie != nil) section, add: [self showSelectionIndicatorForCookie:cookie]; And in touchesMoved, after the call to trySwapHorizontal:vertical:, add: [self hideSelectionIndicator]; There is one last place to call hideSelectionIndicator. If the user just taps on the screen rather than swipes, you want to fade out the highlighted sprite, too. Add these lines to the top of touchesEnded: if (self.selectionSprite.parent != nil && self.swipeFromColumn != NSNotFound) { [self hideSelectionIndicator]; } RWTLevel.m and find createInitialCookies. Replace the single line that calculates the random cookieType using arc4random_uniform with the following: NSUInteger cookieType; do { cookieType = arc4random_uniform(NumCookieTypes) + 1; } while ((column >= 2 && _cookies[column - 1][row].cookieType == cookieType && _cookies[column - 2][row].cookieType == cookieType) || (row >= 2 && _cookies[column][row - 1].cookieType == cookieType && _cookies[column][row - 2].cookieType == cookieType)); Yowza! What is all this? This piece of logic picks the cookie type at random and makes sure that it never creates a chain of three or more. In pseudo-code, it looks like this: do { generate a new random number between 1 and 6 } while (there are already two cookies of this type to the left or there are already two cookies of this type below); RWTLevel.m, add a new private property: @interface RWTLevel () @property (strong, nonatomic) NSSet *possibleSwaps; @end Again, you’re using an NSSet here instead of an NSArray because the order of the elements in this collection isn’t important. This NSSet will contain RWTSwap objects. If the player tries to swap two cookies that are not in the set, then the game won’t accept the swap as a valid move. At the start of each turn, you need to detect which cookies the player can swap. You’re going to make this happen in shuffle. Change the code for that method to: - (NSSet *)shuffle { NSSet *set; do { set = [self createInitialCookies]; [self detectPossibleSwaps]; NSLog(@"possible swaps: %@", self.possibleSwaps); } while ([self.possibleSwaps count] == 0); return set; } As before, this calls createInitialCookies to fill up the level with random cookie objects. But then it calls a new method that you will add shortly, detectPossibleSwaps, to fill up the new possibleSwaps set. In the very rare case that you end up with a distribution of cookies that allows for no swaps at all, this loop repeats to try again. You can test this with a very small level, such as one with only 3x3 tiles. I've included such a level for you in the project called Level_4.json. detectPossibleSwaps will use a helper method to see if a cookie is part of a chain. Add this method now: - (BOOL)hasChainAtColumn:(NSInteger)column row:(NSInteger)row { NSUInteger cookieType = _cookies[column][row].cookieType; NSUInteger horzLength = 1; for (NSInteger i = column - 1; i >= 0 && _cookies[i][row].cookieType == cookieType; i--, horzLength++) ; for (NSInteger i = column + 1; i < NumColumns && _cookies[i][row].cookieType == cookieType; i++, horzLength++) ; if (horzLength >= 3) return YES; NSUInteger vertLength = 1; for (NSInteger i = row - 1; i >= 0 && _cookies[column][i].cookieType == cookieType; i--, vertLength++) ; for (NSInteger i = row + 1; i < NumRows && _cookies[column][i].cookieType == cookieType; i++, vertLength++) ; return (vertLength >= 3); } and keeps going left. This is expressed succinctly in a single line of code: for (NSInteger i = column - 1; i >= 0 && _cookies[i][row].cookieType == cookieType; i--, horzLength++) ; This for loop has no body, only a semicolon. That means all the logic happens inside its parameters. for (NSInteger i = column - 1; // start on the left of the current cookie i >= 0 && // keep going while not left-most column reached _cookies[i][row].cookieType == cookieType; // and still the same cookie type i--, // go to the next column on the left horzLength++) // and increment the length ; // do nothing inside the loop You can also write this out using a while statement but the for loop allows you to fit everything on a single line. :] There are also loops for looking to the right, above and below. Note: It’s possible that _cookies[column][row] will return nil because of a gap in the level design, meaning there is no cookie at that location. That’s no problem. In other programming languages, you have to do an explicit check for nil, but in Objective-C, if an object is nil and you access a property, that also returns nil or 0. So if there’s no RWTCookie object at _cookies[a][b], then _cookies[a][b].cookieType is 0. Valid cookie types are numbers between 1 and 6, so 0 will never match any cookie. Therefore, the logic in hasChainAtColumn:row: works even if there are gaps in the level. When that happens, the for loop will immediately terminate. And that’s why I made cookieType start at 1—so I didn’t have to add another nil check into these loops! This sort of thing may not be immediately obvious when you read the code. :] RWTSwap: - (void)detectPossibleSwaps { NSMutableSet *set = [NSMutableSet set]; for (NSInteger row = 0; row < NumRows; row++) { for (NSInteger column = 0; column < NumColumns; column++) { RWTCookie *cookie = _cookies[column][row]; if (cookie != nil) { // TODO: detection logic goes here } } } self.possibleSwaps = set; } This is pretty simple: The method loops through the rows and columns, and for each spot, if there is a cookie rather than an empty square, it performs the detection logic. Finally, the method places the results into self.possibleSwaps.”: // Is it possible to swap this cookie with the one on the right? if (column < NumColumns - 1) { // Have a cookie in this spot? If there is no tile, there is no cookie. RWTCookie *other = _cookies[column + 1][row]; if (other != nil) { // Swap them _cookies[column][row] = other; _cookies[column + 1][row] = cookie; // Is either cookie now part of a chain? if ([self hasChainAtColumn:column + 1 row:row] || [self hasChainAtColumn:column row:row]) { RWTSwap *swap = [[RWTSwap alloc] init]; swap.cookieA = cookie; swap.cookieB = other; [set addObject:swap]; } // Swap them back _cookies[column][row] = cookie; _cookies[column + 1][row] = other; } } This attempts to swap the current cookie with the cookie on the right, if there is one. If this creates a chain of three or more, the code adds a new RWTSwap object to the set. Now add the following code directly below the code above: if (row < NumRows - 1) { RWTCookie *other = _cookies[column][row + 1]; if (other != nil) { // Swap them _cookies[column][row] = other; _cookies[column][row + 1] = cookie; if ([self hasChainAtColumn:column row:row + 1] || [self hasChainAtColumn:column row:row]) { RWTSwap *swap = [[RWTSwap alloc] init]; swap.cookieA = cookie; swap.cookieB = other; [set addObject:swap]; } _cookies[column][row] = cookie; _cookies[column][row + 1] = other; } }: possible swaps: {( <RWTSwap: 0x960a480> swap type:6 square:(1,7) with type:1 square:(2,7), <RWTSwap: 0x960a4b0> swap type:2 square:(4,5) with type:4 square:(5,5), <RWTSwap: 0x960ac10> swap type:2 square:(5,7) with type:5 square:(6,7), <RWTSwap: 0x960ac40> swap type:4 square:(7,5) with type:3 square:(8,5), <RWTSwap: 0x960a470> swap type:1 square:(2,7) with type:5 square:(2,8), <RWTSwap: 0x960a4a0> swap type:1 square:(5,6) with type:2 square:(6,6), . . . )} To Swap or Not to Swap… Let’s put this list of possible moves to good use. Add the following method to RWTLevel.m: - (BOOL)isPossibleSwap:(RWTSwap *)swap { return [self.possibleSwaps containsObject:swap]; } You also need to add the method signature to RWTLevel.h so other classes can ask it whether a swap is possible: - (BOOL)isPossibleSwap:(RWTSwap *)swap; Finally call the method in RWTViewController.m, in the swipe handler block: id block = ^(RWTSwap *swap) { self.view.userInteractionEnabled = NO; if ([self.level isPossibleSwap:swap]) { [self.level performSwap:swap]; [self.scene animateSwap:swap completion:^{ self.view.userInteractionEnabled = YES; }]; } else { self.view.userInteractionEnabled = YES; } }; Now the game will only perform the swap if it’s in the list of sanctioned swaps. Build and run to try it out. Hmm, something isn’t right—now you can’t make any swaps! Here’s what’s happening: RWTLevel’s NSSetwith possibleSwapscontains RWTSwapobjects that describe all the allowed moves. - But when you perform a swipe, RWTMyScenecreates a new RWTSwapobject. - When isPossibleSwap:looks for that swap in its list, of course it does not find it. It may have an RWTSwapobject that describes exactly the same move, but the actual instances in memory are different. When you run [set containsObject:obj], the set calls isEqual: on that object and all the objects it contains to determine if they match. By default, isEqual: only looks at the pointer value of the object and, as you discovered, those pointer values will never match up. The solution is to override isEqual: on the RWTSwap object to be a little smarter. In RWTSwap.m, add the following method: - (BOOL)isEqual:(id)object { // You can only compare this object against other RWTSwap objects. if (![object isKindOfClass:[RWTSwap class]]) return NO; // Two swaps are equal if they contain the same cookie, but it doesn't // matter whether they're called A in one and B in the other. RWTSwap *other = (RWTSwap *)object; return (other.cookieA == self.cookieA && other.cookieB == self.cookieB) || (other.cookieB == self.cookieA && other.cookieA == self.cookieB); } When you overwrite isEqual:, it is crucial that you also provide an implementation of the hash method. These two go hand-in-hand. If you forget to provide your own version of hash, then [NSSet containsObject:] still won’t work properly. Add the hash method below: - (NSUInteger)hash { return [self.cookieA hash] ^ [self.cookieB hash]; } Also, import RWTCookie so this will work: #import "RWTCookie.h" The rule is that if two objects are equal, then their hashes must also be equal. The hash value must be as unique as possible. Combining the hashes of the two RWTCookies with a bitwise XOR works well. The hash of an RWTCookie object is simply its pointer. Build and run again. Now you should be able to make swaps again, but only those that will result in a chain. Note that after you perform a swap, the "valid swaps" array is now invalid. You'll fix that in the next part of the series. Animating Invalid Swaps It’s also fun to animate attempted swaps that are invalid, so add the following method to RWTMyScene.m: - (void)animateInvalidSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion { swap.cookieA.sprite.zPosition = 100; swap.cookieB.sprite.zPosition = 90; const NSTimeInterval Duration = 0.2; SKAction *moveA = [SKAction moveTo:swap.cookieB.sprite.position duration:Duration]; moveA.timingMode = SKActionTimingEaseOut; SKAction *moveB = [SKAction moveTo:swap.cookieA.sprite.position duration:Duration]; moveB.timingMode = SKActionTimingEaseOut; [swap.cookieA.sprite runAction:[SKAction sequence:@[moveA, moveB, [SKAction runBlock:completion]]]]; [swap.cookieB.sprite runAction:[SKAction sequence:@[moveB, moveA]]]; } This method is similar to animateSwap:completion:, but here it slides the cookies to their new positions and then immediately flips them back. Don’t forget to add the method signature to RWTMyScene.h, as well: - (void)animateInvalidSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion; In RWTViewController.m, change the else-clause inside the swipe handler to: } else { [self.scene animateInvalidSwap:swap completion:^{ self.view.userInteractionEnabled = YES; }]; } RWTMyScene.m: @property (strong, nonatomic) SKAction *swapSound; @property (strong, nonatomic) SKAction *invalidSwapSound; @property (strong, nonatomic) SKAction *matchSound; @property (strong, nonatomic) SKAction *fallingCookieSound; @property (strong, nonatomic) SKAction *addCookieSound; Rather than recreate an SKAction every time you need to play a sound, you’ll load all the sounds just once and keep re-using them. Add the following method: - (void)preloadResources { self.swapSound = [SKAction playSoundFileNamed:@"Chomp.wav" waitForCompletion:NO]; self.invalidSwapSound = [SKAction playSoundFileNamed:@"Error.wav" waitForCompletion:NO]; self.matchSound = [SKAction playSoundFileNamed:@"Ka-Ching.wav" waitForCompletion:NO]; self.fallingCookieSound = [SKAction playSoundFileNamed:@"Scrape.wav" waitForCompletion:NO]; self.addCookieSound = [SKAction playSoundFileNamed:@"Drip.wav" waitForCompletion:NO]; } Call this from initWithSize: at the bottom of the main if block. [self preloadResources]; Then add the following line to the bottom of animateSwap:completion: [self runAction:self.swapSound]; And add this line to the bottom of animateInvalidSwap: [self runAction:self.invalidSwapSound]; That’s all you need to do to make some noise. Chomp! :] Where to Go From Here? Here is a sample project with all of the code from the: Artwork by Vicki Wenderlich. The music is by Kevin MacLeod. The sound effects are based on samples from freesound.org.
https://www.raywenderlich.com/66877/how-to-make-a-game-like-candy-crush-part-1
CC-MAIN-2017-26
refinedweb
7,253
57.37
CentOS Project is increasing its efforts to empower contributors to produce and collaborate on new CentOS Variants, in which groups of contributors combine the CentOS core with newer or otherwise custom components to suit that group’s needs. Xen4CentOS, which combines CentOS 6 with components from the Xen project and the "longterm maintenance" release of the Linux kernel, is an example of an existing variant project. For more on variants, refer to the CentOS Project site and the CentOS and Variants section of our FAQ. The contributor groups behind variants are called Special Interest Groups. For more on SIGs, refer to the CentOS Project wiki. The CentOS Project put out a call for the formation of new SIGs and variants last week, and has fielded a healthy response from the community. Several projects have expressed interest in forming a Cloud SIG, and there’s been interest in Web Hosting, Documentation, and other SIG themes, as well. If you’re interested in proposing a SIG or variant, or would like to learn more, drop a line to centos-devel@centos.org, ask on irc in #centos on the Freenode network, or tune in next week for a chat about establishing the Cloud SIG at the CentOS Office Hours session on 23rd Jan 2014 @ 16:00 UTC. Below is a rundown of the new variant and SIG activity on the centos-devel mailing list since last week: Cloud SIG and Variant Discussion Cloud-Infra SIG creation request We’re looking to create an easy to use distribution of RDO/OpenStack built on CentOS. Our understanding is that we need to first create a SIG and then we’re able to create 1 or more variants. What we’d like to do: - Provide all the dependencies that are either not in base CentOS or are too old in the base CentOS in a single location (maybe a distinct yum repo) - Be able to build and sign packages needed to run RDO/OpenStack within the CentOS infrastructure - Be able to generate a LiveCD in the CentOS infrastructure that allows people to get up and running quickly. - Provide Install media for people that do not want to use a LiveCD." — Mike Burns on behalf of The RDO Team OpenNebula Variant and Cloud SIG proposals We have been involved with CentOS for the past year making a stable Cloud Management Platform [2]. I would like to hereby propose a new CentOS variant, namely the OpenNebula variant. This variant would add three roles to the CentOS installation: - OpenNebula Frontend - OpenNebula Node KVM - OpenNebula Node Xen — Jaime Melis from the OpenNebula project Cloud SIG interest from CloudStack Reading the call for SIG, there is definitely interest from CloudStack to participate and create a ClouStack centOS variant for both instances and head/hypervisor nodes. Our default image template is already a centos template and our best quick start guide is based on CentOS. We also have a community run yum repo for all our packages. I see interest to create a Cloud Image for CloudStack clouds as well as creating variants for our management server and our hypervisor setup. — Sebastien from the Apache CloudStack project A formal request to create a Eucalyptus Special Interest Group …I would like to formally request the formation of a Eucalyptus SIG… We build Eucalyptus, a cloud infrastructure application, around CentOS and have for 3 years now. We have an installer that is derived from Anaconda. We’ve sponsored CentOS events, and we deliver CentOS images to our users. Our packages are currently in a standalone repository, but we would be happy to merge these into whatever CentOS repository emerges (EPEL? Some new version of EPEL? CentOS core itself? I’m unclear on where this sits currently.) — Greg DeKoenigsberg from Eucalyptus oVirt and CentOS Cloud SIG Cloud SIG seems very relevant to oVirt. We’re looking forward to assist with oVirt support as well. We have some CentOS fans in the oVirt community, so this should work well for everyone. Currently we have our live oVirt [1] built using CentOS. So having you guys reviewing it would be beneficial. For the standard el platform, we need some help with dependencies. Here’s a short list which we would like to see go in over & above 6.5 - qemu-kvm compiled with RHEV flags - Support of librbd, libgfapi in qemu-kvm & libvirt, including sanlock & kernel modules - Network namespaces, VXLAN, GRE support in the IP stack (kernel through iproute, dnsmasq, etc) - The cloud-init version being used in RHEL 6.5. - Support of cgroups - selinux policies — Doron Fediuck from oVirt Unified Cloud SIG There seems to be some consensus in various different threads that what we need is a single consolidated Cloud SIG effort, and decide, over time, if it’s sensible to split into project-specific SIGs. Easier to start consolidated than try to figure out how to merge later. — Rich Bowen from Red Hat Other Variants and SIGs under Discussion NethServer as CentOS Variant and SME SIG Proposal We’d like to share with you our experience and our ideas for the future developments. You could think of NethServer as CentOS with some extra packages, particularly a powerful and extensible web interface that simplifies common administration tasks. NethServer is for the sysadmin who appreciates the effectiveness of a user interface which saves time compared to direct configuration file modification and for users who want to approach CentOS without having Linux skills. — Alessio Fattorini from NethServer Create the CentOS Hosting SIG One of the proposed Future SIGs () is the Hosting (or "Web Hosters") SIG. Since Web Hosters are one of the key and core users of CentOS, this seems like a SIG that should be started sooner, rather than later :) I’d like to propose that such a SIG be started. — Jim Jagielski Documentation SIG Has there been any interest or progress in the suggested Documentation SIG? — Philip Mather VoIP SIG I’d like to put my hand up to be part of the VoIP SIG. After mentioning this in IRC, I’ve also had two other people contact me privately (puzzled and JHogarth) with their interest too. Currently we (FreePBX) build 'FreePBX Distro', which is a up-to-date CentOS distro, with a couple of known-broken packages upgraded (drbd, pacemaker) or replaced (asterisk). — Rob Thomas from FreePBX ClearCenter Marketplace for CentOS Variant ClearCenter and ClearFoundation are interested in starting a CentOS variant called 'ClearCenter Marketplace for CentOS'. This will allow management of various CentOS services, EPEL packages, and third party applications to be easily managed and configured under CentOS. We are also interested in being part of a SIG centered around 'Server Management.' Please let us know the next steps. We’d like to get started right away and we are willing to participate in the process of helping to set up shop. Let us know how we can serve. — David Loper from ClearFoundation
https://www.redhat.com/en/blog/centos-sig-and-variant-activity
CC-MAIN-2022-33
refinedweb
1,151
58.11
note arturo <p>The problem is that the name of the module is <code>File::Find</code>, not just <code>Find</code></p> <p>Since it is part of the standard Perl distribution, it will Just Work if you replace <code> use Find; </code> in your script with <code> use File::Find; </code> <p>The reason is that Perl modules have name spaces, and the structure of these name spaces are reflected in directory structures; the "File" namespace is for modules deal with files and filesystems, and "Find" is one of the modules in that namespace. Thus, when you say <code>use File::Find</code>, perl searches for <code>File/Find.pm</code> in the directories in the <code>@INC</code> array. If you look in the directory where <code>Find.pm</code> resides, you'll see that there are all sorts of other files with names like <code>Copy.pm</code>, and at the top of every one of them will be a line that says <code>package File::[filename];</code>, where "filename" is the name of the file you're looking at minus its ".pm" extension.</p> <p>HTH</p> <p class="mysig">If not P, what? Q maybe? <br />"Sidney Morgenbesser"</p> 250639 250639
http://www.perlmonks.org/?displaytype=xml;node_id=250644
CC-MAIN-2017-09
refinedweb
207
66.67
Today I played around with some modules and libraries and Python, so I want to use this as a starting point to fill the “Development” category here a little bit :-) In the first … let’s call it a “Mini-Intro” I want to give a small introduction into Py-CDDB and how you can use it to get to know the CDDA in your CD-ROM driver better. Requirements What and how? In this small intro you will get to know 2 modules provided by the CDDB-Py package: 1. DiscID 2. CDDB You can use these two modules to access data about your audio CD stored for example in the database on which is also the default database queried by the CDDB module. Another cool thing here is, that the CDDB module uses the urllib and so also uses the $http_proxy environment varialble if it is set :-) The homepage of the CDDB-Py project already gives a nice little example on how to use these two modules so I will just re-use it and go through it step by step. As the first step we need to import the two modules: import CDDB, DiscID Now that we have the modules at our disposal let’s open the CD-ROM device and get the ID of the disc: cdrom = DiscID.open("/dev/hdc") In the original example Disc.open() was used without the optional device-parameter. I use it here so that I get a working example on my own machine :-) Ok, we now have the CD and can get its DiscID: disc_id = DiscID.disc_id(cdrom) We can now use the retrieved DiscID to query the FreeDB server: (query_status, query_info) = CDDB.query(disc_id) CDDB.query() has some parameters for choosing for example which server to query and with what account. Only the first parameter is required as it holds the ID of the disc. If everything goes well, the query_info element will now hold a list of matching CDs. The original example doesn’t seem to use a list here, so I will adapt the example for the last few lines a little bit. (read_status,read_info) = CDDB.read(query_info[0]['category'],query_info[0]['disc_id']) With this step we finally get some “plaintext” info about the CD like the artist, the tracknames etc. We can now use this to generate a small list of all the tracks of the disc including their titles and close the cdrom at the end. for i in range(disc_id[1]): print "Track %.02d: %s" % (i, read_info['TTITLE' + `i`]) cdrom.close() This will procude this little listing for the CD I have in my CD-ROM drive right now: Track 00: Microphone Fiend Track 01: Pistol Grip Pump Track 02: Kick Out The Jams Track 03: Renegades of Funk Track 04: Beautiful World Track 05: I'm Housin' Track 06: In My Eyes Track 07: How I Could Just Kill A Man Track 08: The Ghost of Tom Joad Track 09: Down on the Street Track 10: Street Fighting Man Track 11: Maggie's Farm Again, this small intro heavily uses a code sample available on. For more details on CDDB-Py please read the documentation available in the source package and on the homepage :-)
https://zerokspot.com/weblog/2005/01/08/cddb-access-in-python/
CC-MAIN-2018-09
refinedweb
540
62.82
When using 'rpmbuild --define "_without_xen"', but on a new enough Fedora where %{with_libxl} still gets set to 1 by default, the build dependencies were incomplete, which could result in 'make rpm' failing because ./configure failed to build the libxl driver. * libvirt.spec.in (BuildRequires): Fix xen-devel condition. Signed-off-by: Eric Blake <eblake redhat com> --- Pushing under the build-breaker rule. I found this on a machine with 'xen-devel' uninstalled, while running ./autobuild.sh; it took me a while to find the root cause, since autobuild.sh uses 'rpmbuild --nodeps' and therefore failed to tell me which packages I did not have installed. libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index f40b614..aee61fa 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -412,7 +412,7 @@ BuildRequires: python-devel %if %{with_systemd} BuildRequires: systemd-units %endif -%if %{with_xen} +%if %{with_xen} || %{with_libxl} BuildRequires: xen-devel %endif BuildRequires: libxml2-devel -- 1.8.1.4
https://www.redhat.com/archives/libvir-list/2013-June/msg01249.html
CC-MAIN-2014-23
refinedweb
167
50.63
Jasper is a bi-directional interface between programs written in Java and programs written in Prolog. The Java-side of the interface constists of a Java package ( jasper) containing classes representing the SICStus emulator. The Prolog part is designed as an extension to the foreign language interface, which means that foreign/3 declarations are used to map Java-methods on Prolog predicates and provide automatic conversion of arguments. Jasper can be operated in two different ways, depending on which emulator is used as top-level application; the Java Runtime System or the SICStus Development System. When the Java Runtime System is used as a top-level application, the SICStus runtime kernel is loaded into the Java Runtime System. When the Java Runtime System is loaded into the SICStus Development System, it is loaded as any other foreign resource, i.e. by using load_foreign_resource/1. This distinction is not visible to the programmer, but it is useful to have a picture of how the interface works. Note: Some of the information in this chapter is a recapitulation of the information in the chapter section Mixing C and Prolog. The intention is that this chapter should be possible to read fairly independently. The low-level interface uses the JNI (Java Native Interface) to call C functions from Java. The JNI is a native interface standard developed by Sun Microsystems. See section Resources. Since the interface uses the JNI, it is necessary that the Java VM which is to be used has support for JNI. Even though the JNI is intended as a standard, not all vendors support it. If your Java installation does not support the JNI, Sun's Java Runtime Environment provides a minimal execution enviroment for running Java code. It can be downloaded from The rest of this chapter assumes that there is a Java installation with JNI support available. Java methods are called from Prolog much in the same way as C functions are called (see section Calling C from Prolog); by creating a foreign resource. When loaded, this resource installs a set of predicates which are mapped onto Java-methods and when invoked, converts the Prolog arguments to the corresponding Java-types before calling the Java method itself. In fact, a foreign resource (as defined in section Foreign Resource and Conversion Declarations) is not language specific itself. The language is instead specified in the second argument to the foreign/3 fact and it is possible to mix foreign C functions with foreign Java methods. How a foreign resource is created in general is described in detail in section Creating the Linked Foreign Resource. The following section(s) will focus on the Java-specific parts of foreign resources. There is no support for static linking of foreign resources containing Java declarations, since Java implementations usually do not support static linking. Java-methods are declared similarly to C-functions. There are two major differences. The first is how methods are identified. It is not enough to simply use an atom as the C interface does. Instead, a term method/3 is introduced: method(+ClassName,+MethodName,+Flags) foreign/3when declaring Java methods. The first argument is an atom containing the Fully Qualified Classname of the class. The second argument is the method name. The third argument is a list of flags. Possible flags are instanceor static, indicating whether or not the method is static or non-static. Non-static methods must have an object-reference as their first argument. This is a reference to the object on which the method will be invoked. This term is then used to identify the method in the foreign_resource/2predicate. So, to define a foreign resource exporting the non-static Java method getFactorsin the class PrimeNumberin the package numbers, the method/3term would look like method('numbers/PrimeNumber','getFactors',[instance]) The syntax for foreign/3 is the basically the same as for C-functions: foreign(+MethodIdentifier, java, +Predicate) method/3term as described above. Predicate specifies the name of the Prolog predicate that will be used to call MethodIdentifier. Predicate also specifies how the predicate arguments are to be translated into the corresponding Java arguments. The following table lists the possible values of arguments of the predicate specification to foreign/3. The value declares which conversion between corresponding Prolog argument and Java type will take place. Note: The conversion declarations (composed of the declarators specified below) together with the method/3 term are used by the glue-code generator to create the method's type signature, i.e. a string which can uniquely identify a method within a class. This means that unlike the C interface, the conversion declarations for a Java method will affect the lookup of the method-name (in the C interface, only the function name is relevant). So, if a method is declared as foo(+integer), there must be a method which has the name foo and takes one argument of type int, or an argument which can be automatically converted to an int (a short, for example). Prolog: +integer Java: int int. Prolog: +byte Java: byte byte. Prolog: +short Java: short short. Prolog: +long Java: long long. Note: Since Java's longtype is 64 bits wide and there is no standardized support for 64 bits integers in C, the value will be truncated. So, this declaration is really only useful in order to indicate which method should be used. For example: class Bar { void foo(int x) { ... } void foo(long x) { ... } }In order to be able to indicate that the latter of the foomethods should be called, a +longdeclaration must be used, even if the value itself will be truncated in the call. Prolog: +float Java: float float. Prolog: +double Java: double double. Prolog: +term Java: SPTerm SPTerm. Prolog: +object(Class) Java: SPTerm Class. Prolog: +atom Java: SPTerm SPTerm. Prolog: +boolean Java: boolean true, false}. The Java method will receive a boolean. Prolog: +chars Java: String String. Prolog: +string Java: String String. Prolog: -atom Java: SPTerm SPTermwhich can be modified. The argument will be bound to the value of the atom when the method returns. Prolog: -chars Java: StringBuffer StringBufferwhich can be modified. The argument will be bound to a list of the character codes of the StringBufferobject. Prolog: -string Java: StringBuffer StringBufferwhich can be modified. The argument will be bound to an atom converted from the StringBufferobject. Prolog: [-integer] Java: int M() int. The value will be converted to a Prolog integer. Prolog: [-byte] Java: byte M() byte. The value will be converted to a Prolog integer. Prolog: [-short] Java: short M() short. The value will be converted to a Prolog integer. Prolog: [-long] Java: long M() long. The value will be converted and possibly truncated to a Prolog integer. Prolog: [-float] Java: float M() float. The value will be converted to a Prolog float. Prolog: [-double] Java: double M() double. The value will be converted to a Prolog float. Prolog: [-term] Java: SPTerm M() SPTermwhich will be converted to a Prolog term. Prolog: [-object(Class)] Java: SPTerm M() Prolog: [-atom] Java: SPTerm M() SPTermwhich will be converted to a Prolog atom. Prolog: [-boolean] Java: boolean M() boolean. The value will be converted to a Prolog atom in { true, false}. Prolog: [-chars] Java: String M() Stringwhich will be converted to a list of character codes. Prolog: [-string] Java: String M() Stringwhich will be converted to an atom. The following is an simple, but complete example of how a Java method can be called from Prolog. First, we must write the resource file. Let us call it `simple.pl'. % File: simple.pl :- module(simple, [simple/2]). :- use_module(library(jasper)). :- load_foreign_resource(simple). foreign(method('Simple', 'simpleMethod', [static]), java, simple(+integer,[-integer])). foreign_resource(simple, [ method('Simple', 'simpleMethod', [static]) ]). This file is the processed with the script splfr (see section Interface Predicates) to produce a foreign resource: % splfr simple simple.pl SICStus 3.7: Mon Mar 2 19:22:44 MET 1998 {/var/tmp/aaaa004Cd.c generated, 20 msec} yes Note that we do not specify any Java files to splfr as we would specify C files when building foreign resources for C code. This is because the C code can be compiled into the resource itself, while the Java code must be loaded at runtime into the JVM. This means that the resource will only contain the glue-code for calling the JVM, and no actual Java code. Hence, these resources are usually quite small. Note also that the use of +dynamic is implicit and obligatory; resources with Java-calls must be dynamic. Now, we need some Java code to call: Simple.java: public class Simple { static int simpleMethod(int value) { return value*42; } } This Java code must now be compiled. Refer to the documentation of your Java implementation exactly how to do this. On Solaris, this might look like: % javac Simple.java Now we are ready to call the method simple/2 from inside SICStus. % sicstus SICStus 3.7: Mon Mar 2 19:22:44 MET 1998 | ?- compile(simple). {compiling ...} [...] {compiled ... simple.pl in module simple, 160 msec 48640 bytes} yes | ?- simple(17,X). X = 714 ? yes | ?- What has happened is that the predicate simple/2 has been installed as a predicate defined in Java (this is not exactly true; the predicate is defined as a C-function which calls the Java method). When we load the simple module, we will first load the jasper module (and thereby the JVM) and then load the simple foreign resource, which defines the simple/2 predicate. Calling Prolog from Java is done by using the Java package jasper. This package contains a set of Java classes which can be used to create and manipulate terms, ask queries and request one or more solutions. The functionality provided by this set of classes is basically the same as the functionality provided by the C-Prolog interface (see section Mixing C and Prolog). The usage is easiest described by an example. The following is a Java version of the train example. See section Train Example (connections). import jasper.*; public class Simple { public static void main(String argv[]) { SICStus sp; SPPredicate pred; SPTerm from, to, way; SPQuery query; int i; try { sp = new SICStus(argv,null); sp.load("train.ql"); pred = new SPPredicate(sp, "connected", 4, ""); to = new SPTerm(sp, "Orebro"); from = new SPTerm(sp, "Stockholm"); way = new SPTerm(sp).putVariable(); query = sp.openQuery(pred, new SPTerm[] { from, to, way, way }); while (query.nextSolution()) { System.out.println(way.toString()); } } catch ( Exception e ) { e.printStackTrace(); } } } This is how it works: jasper-classes. To find them, the class-path should be set to contain the path to the SICStus libraries ( $SP_PATH/library). How this is done depends on the operating system and which Java implementation is used, but typically there is a environment variable CLASSPATHwhich contains the path. The path can often also be set on the commandline using an option such as `-classpath'. Refer to your Java documentation for more details. SICStusclass. NOTE: This class must only be instantiated once per Java process. Multiple SICStus-objects are not supported. Most methods take a reference to this object as their first argument. This is implicit in the rest of this chapter, unless otherwise stated. load. Corresponds to SP_load()in the C-interface. See section Loading Prolog Code. SPPredicateclass: SPPredicate pred = new SPPredicate(sp, "connected", 4, ""); connected/4. It is now time to create the arguments for the query. The arguments are placed in an array which is passed to a suitable method to make the query. The arguments consist of objects of the class SPTerm. For example, if we need two atoms and a variable for the query | ?- connected('Stockholm', 'Orebro', X, X).the following Java code will do it for us: to = new SPTerm(sp, "Orebro"); from = new SPTerm(sp, "Stockholm"); way = new SPTerm(sp).putVariable(); query(pred, args) connected/4this is not the case; there are more than one solution. queryCutFail(pred, args) query()it only finds the first solution, and then it cuts away all other solutions and fails. openQuery(pred, args) connected/4may give us multiple solution, this is what we will use. SPQuery query; query = sp.openQuery(pred, new SPTerm[] { from, to, way, way }); while (query.nextSolution()) System.out.println(way.toString());The openQuerymethod returns a reference to the query, an object of the SPQueryclass. To obtain solutions, the method nextSolution()is called with no arguments. nextSolutionreturns trueas long as there are more solutions, the example above will print the value of wayuntil there are no more solutions. Detailed documentation of the classes in the jasper package can be found at follow this hyperlink. This documentation will most probably be included in a future version of the manual. Exceptions are handled seamlessly between Java and Prolog. This means that exceptions can be thrown in Prolog and caught in Java and the other way around. For example, if a predicate called from Java raises an exception by raise_exception/1 and the predicate itself does not catch the exception, the Java-method which performed the query, queryCutFail() for example, will throw an exception containing the exception term. Symmetrically, a Java-exception thrown (and not caught) in a method called from Prolog will cause the corresponding predicate ( simple/2 in the example above) to raise an exception containing the exception object (in the internal Prolog representation of a Java object). There are almost infinitely many Java resources on the Internet. Here is a list of a few which are related to Jasper: See the file `README' for details on how to use the examples.See the file `README' for details on how to use the examples. library('jasper/examples') Go to the first, previous, next, last section, table of contents.
https://sicstus.sics.se/sicstus/docs/3.7.1/html/sicstus_12.html
CC-MAIN-2021-39
refinedweb
2,281
57.77
This article is useful for those who have never worked with WebService call from VC++ and they want to know how to send a request and get a response? This is my first application which I have created for learning purposes. I have referred to one CodeProject article. For WebService call, we require two things: one is that WebService must be created before calling it and the other is this VC++ application which calls it. First of all, I would like to give you a brief on how to create a WebService. I am a System developer, that's why I don't have that good knowledge of creating a Webservice. You need to start Visual 2005, then File ->New-> website-> ASP.NET webservice. Then one default function will be created by the browser. Inside that function, you need to write some functionality that you want to take as request and return something on input basis. I have taken name as input and return address as per input name. That's why you can see Chaitanya name inside the XML code which I am posting on that link. Once the web service is created, you need to publish your site (which you can do using Inet manager). Here is the code which I have used for posting a request and getting a response from WebService. // // Any source code blocks look like this // IXMLHttpRequestPtr httpReq( _uuidof(MyXMLHTTPRequest)); _bstr_t HTTPMethod ; _variant_t noAsync = _variant_t( (bool)false ); //httpReq.CreateInstance("MyXMLHTTPRequest"); CString strUserName = "mahesh"; // this one is user name of webservice machine VARIANT vUser; vUser.vt = VT_BSTR; vUser.bstrVal = strUserName.AllocSysString(); CString strPass = "gtl=11"; // this is system password VARIANT vPassword; vPassword.vt = VT_BSTR; vPassword.bstrVal = strPass.AllocSysString(); HTTPMethod = _bstr_t( "POST" ); // this is url as webservice. httpReq->open(HTTPMethod , "",noAsync,vUser,vPassword); httpReq->setRequestHeader("Content-Type", "application/soap+xml"); CString szRequest; szRequest = "<?xml version=\"1.0\" encoding=\"utf-8\"?> \ <soap12:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap12=\"\"> \ <soap12:Body>\ <HelloWorld xmlns=\"\"> \ <strUserName>Chaitanya</strUserName>\ </HelloWorld>\ </soap12:Body>\ </soap12:Envelope>"; VARIANT vRequest; vRequest.vt = VT_BSTR; vRequest.bstrVal = szRequest.AllocSysString(); httpReq->send(vRequest); // sending to that URL BSTR strText; _bstr_t bsResponse = httpReq->responseText; //receiving reply from web service AfxMessageBox(bsResponse); CDialog::OnOK(); One very important thing is that we need to import MSXML.dll which you can see in the code in stdafx.h and "using namespace MSXML;" line in file. using namespace MSXML; You can advise me on how to improve this article so that I can also learn new things. If you have any queries, you can post a message. I will try to solve it, and that way I will also learn new things in this area. You can mail me at cha1202001.
https://www.codeproject.com/Articles/19301/WebService-Call-From-VC?msg=4011645
CC-MAIN-2017-43
refinedweb
449
65.83
Salams. As some of you may already know, I'm in the look out for a new roadster since my Altis 2011 recently got lifted from my garage, as part of the fresh outbreak of the seemingly indestructible car theft virus. I have quite a few options available before me, but one thing is for sure, and read my lips: "NO MORE TOYOTA! I have kind of made it a resolution to myself that I'll not purchase any more IMC vehicle, till at least this fleecing manufacturer does not make it's cars less hotcakes for thieves, in the absence of an immobilizer and very easy forging of the chassis details placed below the front seats. I've come to learn sadly, that these models (2009-2011), when stealth, are traded at almost original, used price with new docs!!! Anyhow, to get to the point, I'm seriously considering a fully loaded Honda Civic, 2012 Oriel, Prosmatic, yet with the present Atlas manufacture standstill going on, prices and premiums of Civics have gone up quite to the steeper side and the wait also is kind of unbearable, once they start rolling out their cars this month, hopefully. I came across some ads here for the Hybrid models, fresh import, and would like and appreciate our esteemed members here to kindly comment on the pro's and con's of these?? I know, I'm sacrificing the sunroof with these models, yet found the Hybrid engine, multimedia steering controls and cruise control a fair package in contrast, leave alone the reasonable prices, as if compared to the local price-jack these days (23 Lakhs for on spot delivery) Kindly shed some light on these models, with specifics on below: 1) What is the actual mileage of these cars, since the importers proclaim above 30kms/per ltr?2) Is the hybrid engine function serviceable here in Pakistan, in case of any malfunction?? Do we have the people to deal with these engines?3) Does this car have the some torque/output as the genuine petrol only model?4) Does it have the same output/power on electric charge, as when on petrol?5) Is the imported color range of paints available here, in case of any minor/major bodywork required?Some of the options around:Used Honda Civic 2007 for sale in Karachi - Ad ID: 351969 | PakWheelsUsed Honda Civic 2006 for sale in Karachi - Ad ID: 351604 | PakWheelsUsed Honda Civic 2006 for sale in Lahore - Ad ID: 332781 | PakWheelsUsed Honda Civic 2007 for sale in Lahore - Ad ID: 329114 | PakWheelsWould appreciate some qualitative inputs here, especially by those of you who may have used it, or have some personal experience with it. Let's make it the Honda Civic Hybrid, query thread. Regards. as for the mileage n condition refer to the auction grade sheet.so 1 query will b killed! well civic hybrid is good car its engine is same as city 1.3, comes with, ice control on steering wheel, Anti skid control, heated seats, cruise, cd, rims and loads of other option. The battery lasts for 10yrs min replacement arnt tht expensive £1000 can get you one from the market. I have 5 cars in black and silver on there way to Pakistan. get a jdm civic 1.8 Thanks for the reply. Well, if engine is the same as in the City, I believe we have quite an under-powered fellow there, don't we? I personally cannot adjust to the City, due to it's 1300cc, and then we have an even larger vehicle with the same engine, displacement???! If so, that's virtually the coup-de-grace to this thread and query, instead I probably should check out for the 1.8 JDM as Hashim bro just suggested. Hates off for IMC boycott ! They deserve this ! .. Have you got your money back from Insurance guys yet ?? I guess Civic Hybrid is with 1400CC engine with the same body as that of 1800 so Power to weight ratio of this car will be even less then Honda City ! If you are looking for some Power at hand, Civic Hybrid will not be a happy ride.... Sir Why not try "Civic Oriel Manual" instead of going for 4-5 years old car ! I suggested Manual because of Better Mileage then Prosmatic ! 1) What is the actual mileage of these cars, since the importers proclaim above 30kms/per ltr? For Mileage Honda recently lost a Mileage claim case, check it out , very interesting read Bottom Line - Honda Civic mileage verdict has industry sweating 2) Is the hybrid engine function serviceable here in Pakistan, in case of any malfunction?? Do we have the people to deal with these engines? No don't think so however, Battery packs and engines have reasonable good life. Honda gives 10 year warranty for the battery pack and life of cells are 25 years so is quite reliable ! BUT REMEMBER machine is a machine at the end , if it goes bad you can't tell it that your warranty is still not expired 3) Does this car have the some torque/output as the genuine petrol only model? NOT AT ALL SIR ! Torque of Hybrid engine is 89 ft·lbs at 4500 rpm (Max) While that of 1.8 is 128 ft·lbs at 4300 rpm (Max) 4) Does it have the same output/power on electric charge, as when on petrol? NOO ... 1.4 << 1.8 Engine in terms of HP, torque and everything related ! 5) Is the imported color range of paints available here, in case of any minor/major bodywork required? Toyota and Honda purchase Paints from Akzo Noble, BIGGEST PAINT MANUFACTURER OF THE WORLD so I hope you can find a match ! when u fit a civic 1.8 with cng power goes down also and not every1 does a drag on the traffic lights.Hybrids is a economical car not for speeding at traffic lights its does ur overtaking with ease saves u on fuel bills, comfortable then the local civic and built quality u get safety features in 8 airbags form anti skid control so value for money. the local crap made cheaply made a 4 yr old car looks better. hybrids primarily for city commute where stop and go is quite alot.usually it serves one purpose which is daily drive.we in Pakistan need a car for commute on long routes and as a daily ride. most of us have one car to do this. same car is our weekend ride and also our Walima Car. so lot many things have to be considered. if ur the city exec or the american soccer man, the hybrid will suit you. if u want fun then these arent your play area. so do consider that. Nice Discussion, I vote for Hybrid as we can expect 150 Rs/liter (petrol) so better to save money on fuel and hybrids are good and green and I think Hybrid is the future car.Fuel Saving is good habit and If we think about environment (pollution) that will be a really educated mindset. (I am really Sad about Your Altis) like @zunny said its for some one who does city driving not gt road or motorway regular drive nor for ppl who want power though u dont get much out of civics or corola either. mostly r clocked over 100k.. 99.9% odo r tempered in pakistan 2) Is the hybrid engine function serviceable here in Pakistan, in case of any malfunction?? Do we have the people to deal with these engines? No... however most of these cars r refurbished on bybrid part.. the batteries r mostly replaced giving u another 4 year life 3) Does this car have the some torque/output as the genuine petrol only model?These cars are for fuel economy, comfort.. 5) Is the imported color range of paints available here, in case of any minor/major bodywork required? U ll get good shades if its a UK import.. the JDM r mostly sliver and white, or most u would get black - U should also try for Thank you everybody above, and thanks Umair2203 bro for your detailed reply. I must say, above notion by CrashD bro literally spells it all out, compromising power for fuel economy. Though it's a desirable target with respect to unstable, exorbitant fuel prices in Pakistan these days, it sadly does not suit my longer routes, where I need the power quotient more, especially during full 3 months vacations, when surfing around the demanding hilly areas, requiring a stronger torque figure. I think, I'll have to take a look at the 1.8 JDM's, before I make up my mind for a local car or not. @Umair2203...........Bro, thanks! Just pray that this "hat" of "No, to Indus" could be held stationary in that position, I must say driving the Altis was quite of an addiction and I do have hard time rejecting it again, especially when bearing in mind that the Civic is to be upgraded this year also. One very tough decision, I must say, but it's time Indus started considering that they're merely offering "toffees", new grape-wine colors, etc, and no real value changes, with respect to immobilizers, hard to adulterate engine/chassis details. Humbly, from some of my dealer friends over here, I came to know recently that even they're very careful when taking in a used 2009-2011 Corolla, due to the ease of adulterating it's details!!!!! Finally, on the Manual Oriel, how much do you feel the difference with respect to fuel consumption is, when comparing it to the prosmatic? Difference is 1-2 Km/ltr ... If prosmatic is around 13 km/ltr .. Manual can go upto 15 km/ltr if driven carefully ! Slightly off topic but I was thinking that we should start online campaign to ask Toyota Indus to improve the Security conditions of their car by introducing some anti theft mechanisms and Immobilizer specially ! Dear AK-471, first of all I am sorry to hear about your loss. We are going through strange times and everyone, it seems, is bearing the brunt of lawlessness and week governance. I hope that you are able to recoup your loss from the insurance and move on with your life.<?xml:namespace prefix = o<o:p></o:p><o:p> </o:p>I own a 08 oriel manual, when I drove it out of the dealership I was not a happy camper. Constant gear shifting in stop and go situations was not enjoyable. So I garaged the car for some time as I had a prosmatic, 05 and drove the R-18 only on the motorway. Using Hi-OCT for the most part, and currently a mix of 60-40, the vehicle has finally clocked 30k. I would like to add that now for various reasons, I am in love with this car. It has superb road handling on the motorway, excellent performance and turning radius for in-city driving, and a soft and gentle shift that works effortlessly, and adapts to your driving style. <o:p></o:p><o:p> </o:p>Coming to your question, Civics’ fuel mileage is pretty much linked to you driving habits. It gives me between 11.5-12.3 within city with or without the ac, and 14-16 with speeds ranging between 120-150kms. At all times, the car changes its behavior for managing expectations. I have tested its braking on two occasions and you can steer it to a complete halt from 120 kms without feeling stressed out.<o:p></o:p><o:p> </o:p>I recommend the R-18 oriel manual all the way.<o:p></o:p><o:p> </o:p>Cheers <o:p></o:p><o:p> </o:p> @QFA......Thanks for the very kind words bro. Insurance claim is in process, but final Police report cannot be had before 90 days from theft incident. All docs./requirements have been handed in by me, now waiting for the time period to mature. Appreciate your recommendation for the Manual Oriel and Umair2203 bro's calculations also. I am most inclined towards the R-18, Oriel. Umair bro, we're at full wavelengths here with this respect. I have been thinking of this also, seriously. Someone has to do the start. We would need signatures of quite a number of people, on the finally prepared draft. Let me know how we can proceed, if I can be of any help. MOD EDIT: Off topic. @AK471 bhai. Really sorry to hear about your loss..... Nazar hi lag gaee apki car ko.. Wo apki nhii saare Pakwheels ki favourite car thee Was it insured??
https://www.pakwheels.com/forums/t/honda-civic-hybrid-ok/172851
CC-MAIN-2018-05
refinedweb
2,134
70.23
12-15-2020 12:46 AM - edited 12-15-2020 12:48 AM Hi all! I have a problem regarding ZCU102 PS PCIe Root Port. Recently I'm working on a standalone FW project using PS PCIe RP on the zcu102 evaluation board. The zcu102 EV board (RP) has a PCIe endpoint device attached to it. EP device has PCIe DMA engine in it. My goal is to make the PCIe EP DMA access zcu102 PS DDR buffer region. I configured the PS PCIe block as belows. Using this HW, I was able to recognize the PCIe device on Petalinux and perform EP DMA successfully. So, I'm sure there would be no issues with HW. But the problem arose with standalone FW. BSP's pciepsu_v1_2 made EP device enumeration easy, and accessing the BAR area of EP device was not difficult. However, when DMA is triggered through the EP BAR setting, the EP DMA fails to access the zcu102's memory. In more detail, 'master abort' error occurs while EP DMA tries to read the memory. The DDR area on the zcu102 HW uses the address 0x8_0000_0000, and a part of this memory will be used as a DMA buffer. For testing, I made a simple example where EP DMA reads the contents of src_buf and writes it back to dst_buf. However, EP DMA was unsuccessful. It did not fetch any correct data from RP and I got 'master_abort' while EP reading the contents of RP's src_buf. This conceptual zcu102 FW test code is roughly flown as follows. #include "xpciepsu.h" #include "xpciepsu_common.h" XPciePsu pci_dev; main(void) { u32 *src_buf, *dst_buf; u32 size = 0x1000; PcieInitRootComplex(&pci_dev, XPAR_PSU_PCIE_DEVICE_ID); find_ep_device(&pci_dev, PCIE_EP_DEVICE_ID); pci_enable_device_mem(&pci_dev); pci_set_master(&pci_dev); src_buf = 0x800000000UL; dst_buf = 0x800001000UL; memset(src_buf, 0xF, size); memset(dst_buf, 0x0, size); issue_ep_dma_request(&pci_dev, src_buf, dst_buf, size); while (1) { if (*dst_buf) break; } } For your reference, I'll add some comments for this test code. 1. PcieInitRootComplex(), which is included in the zcu102 PCIe RP enumeration_example code, calls a BSP function XPciePsu_CfgInitialize(). XPciePsu_CfgInitialize() calls XPciePsu_BridgeInit(). 2. XPciePsu_BridgeInit() in xpciepsu.c seems to be logically identical to the nwl_pcie_bridge_init() of pcie-xilinx-nwl.c in petalinux kernel source. 3. In XPciePsu_BridgeInit(), subtractive decode (I_ISUB_CONTROL.ingress_sub_enable) is set. It seems that there's no need to set ingress address translation. So, I left all AXIPCIE_INGRESSx registers at zeroes. Are there any additional settings necessary to make EP DMA work normally? Thanks in advance for your help... Best regards, John 04-16-2021 03:00 AM Hi, I ran into the same problem just like your case. My EP device is a M.2 NVMe SSD. Have you resolve this issue? If so, may I know what's the additional tricks I need to take? Thanks! 04-19-2021 11:11 AM We have released answer record on PS PCIe as RP and nVME SSD as EP. If you are looking for that please refer to Xilinx_Answer_76169_ZCU102_PS_PCIe_NVMe.pdf Regards Praveen 04-21-2021 01:57 AM Hi @elien1222 We have AR:71493 which details a Petalinux image generation and system example design with ZCU102 PS PCIe as RP and a ZC706 as EP. 04-22-2021 02:35 AM Hi Gareth, None of these xilinx solution works since I'm not using petalinux. The same synthesis and implementation run do work for petalinux in my case but the performance on SSD is way tooooo bad. I can only achieve < 600MB/s W/R speed using all four dd tasks simultaneously. This speed is similar to PL XDMA when using petalinux NVMe driver. But for baremetal/RTOS I could achieve line rate on XDMA up to 3.3GB/s for a single thread. And 1.5GB/s for Gen2 x4 is good enough for me thus I'm porting this driver to the PSU PCIe side. Then I encounter this RMA error. 04-25-2021 09:11 AM Performance depends on various factors w.r.t hardware and software side. NVMe performance depends on type of flash being used, the firmware if any, which comes in data path on EP, the whole architecture deployed by EP vendors. On software front, how are you measuring performance ? Is it multi-threaded ? Since data has to reach till user space application there will be performance impact as there will be context switching from application to kernel NVMe stack. (CPU speeds could be low unlike x86) The type of interrupts being exercised also affect performance. In root port we support only MSI, so all interrupts are routed to single CPU. (Only with MSI-X interrupts are routed to different cpu’s, which will provide better performance) Could you try other NVMe SSD as well like Samsung . May be you can try using multiple performance testing utilities to see how much difference they make. Would you point me to baremetal application which you used for XDMA+nVME test design? Regards Praveen 04-25-2021 09:21 PM The performance is a pure software issue on Zynq MPSoC, not hardware. 600MB/s is the cap for both PL XDMA and PSU GTR under a linux driver stack. Even with four simultaneous write/read thread this is still the case. Thus for performance I have to migrate to a freeRTOS enviroment. Please check Shane Colton's write up on his baremetal SSD NVMe driver. Both Samsung 970 and XPG 8200 could achieve manufacturer's claimed I/O speed under baremetal. I have no doubt other SSD will be able to achieve such speed using a raw driver stack.
https://forums.xilinx.com/t5/PCIe-and-CPM/PCIe-Endpoint-DMA-access-fail-on-ZCU102-PS-Root-Port-system/m-p/1231035
CC-MAIN-2021-39
refinedweb
922
66.64
0 #include <iostream> // required to perform C++ stream I/O #include <iomanip> // required for parameterized stream manipulators using namespace std; // for accessing C++ Standard Library members // function main begins program execution int main(){ double wage = 0, raise = 0, raiseMoney = 0; int years = 0; // Prompt user to enter weekly wage cout << "Enter starting weekly wage: "; cin >> wage; // Prompt user to enter amount of raise cout << "Enter amount of raise (in %): "; cin >> raise; // Prompt user to enter years of employment cout << "Enter years of employment: "; cin >> years; wage = wage * 52; raiseMoney = (raise / 100) * wage; cout << setprecision(2) << fixed; cout << "\nYear Annual Salary\n"; for(int i = 0 ; i < (years) ; i++) { cout << (i+1) << " $" << wage + (raiseMoney * i) << "\n"; } cout << endl; return 0; The numbers are not adding up correctly: Can someon just check out the code and tell me what I am missing or did wrong, This is what it is supposed to print. Year Annual Salary 1 26000.00 2 26780.00 3 27583.40 4 28410.90 5 29263.23 6 30141.13 7 31045.36 8 31976.72 Press any key to continue.... Any Help would be appreciated!!! Edited by Narue: Fixed code tags
https://www.daniweb.com/programming/software-development/threads/389414/pay-raise-calculator
CC-MAIN-2017-17
refinedweb
194
73.07
Tiny python package to parse the GECOS field. Project description ez-gecos (v0.2.1) Tiny package to parse the GECOS field. Version ez-gecos is only tested on Python 3.7 Installation Simply install using pip (or pipenv). PyPi pip install ez-gecos Github pip install git+ From source git clone pip install ./ez-gecos Usage from gecos import GECOS # If username is not supplied, GECOS tries to parse the GECOS # field of the username found in environment variable 'USER' gecos = GECOS(username='someuser') # or gecos = GECOS() # Full name from GECOS field or None. print(gecos.full_name) # Room from GECOS field or None. print(gecos.room) # Work phone from GECOS field or None. print(gecos.work_phone) # Home phone from GECOS field or None print(gecos.home_phone) # Other from GECOS field or None. # If there are more than one other, they are returned # as a comma separated list. print(gecos.other) # Full GECOS field or None print(gecos.full) # or print(gecos) # Returns email address from GECOS field or None. # The email address is parsed from 'other', and # returns first entry that looks like an email address. print(gecos.email_address) Links License Project details Release history Release notifications | RSS feed Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages. Built Distribution ez_gecos-0.2.1-py3-none-any.whl (17.3 kB view hashes)
https://pypi.org/project/ez-gecos/
CC-MAIN-2022-27
refinedweb
236
69.07
This patch adds simplification for isfinite, isnan and isinf when we know that we don't have NaNs or Infs (based on the corresponding function attributes). Doing this requires a small infrastructure improvement to TargetLibraryInfo, as I'll explain below. C/POSIX specify that math.h provides a set of macros, of which these are a subset: int isfinite(x); int isnan(x); int isinf(x); where x is some floating-point type (float, double, long double). When we're compiling with -ffast-math (or specifically with -ffinite-math-only), it is profitable to statically simplify calls to these functions. For a motivating use case, consider compiling this code using libc++: #include <complex> using namespace std; complex<float> bar(complex<float> C); complex<float> foo(complex<float> C) { return bar(C)*C; } and you'll quickly see that, even at -O3 -ffast-math, we produce a mess of code including calls to isnanf and isinff. Why those functions? This comes down to how glibc implements these macros: - define isnan(x) \ (sizeof (x) == sizeof (float) \ ? isnanf (x) \ : sizeof (x) == sizeof (double) \ ? isnan (x) : __isnanl (x)) Other systems use similar macro expansions, with some variation in the names of the underlying functions. OSX here has a split system (or at least used to). When using finite-math-only mode, you get function calls: #define isfinite(x) \ ( sizeof(x) == sizeof(float) ? __isfinitef((float)(x)) \ : sizeof(x) == sizeof(double) ? __isfinited((double)(x)) \ : __isfinitel((long double)(x))) but when in IEEE-conforming mode, you get faster inline implementations: #define isfinite(x) \ ( sizeof(x) == sizeof(float) ? __inline_isfinitef((float)(x)) \ : sizeof(x) == sizeof(double) ? __inline_isfinited((double)(x)) \ : __inline_isfinitel((long double)(x))) where the headers define things like: __header_always_inline int __inline_isfinitef(float __x) { return __x == __x && __builtin_fabsf(__x) != __builtin_inff(); } __header_always_inline int __inline_isinff(float __x) { return __builtin_fabsf(__x) == __builtin_inff(); } __header_always_inline int __inline_isnanf(float __x) { return __x != __x; } so some effort has been made to preserve the full functioning of these calls even when otherwise compiling in finite-math-only mode. This optimization would purposely break that feature (in favor of lowering abstraction penalties). If we do this and a user wishes to check his or her inputs for NaNs, Infs, etc. the user must do so in a translation unit where such values are permitted to exist. To be fair, gcc's manual does not define finite-math-only mode in this way, but rather: Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs. perhaps implying that it is fine to check numbers for NaN/Inf that you did not compute via some arithmetic operation. We could certainly do it this way (i.e. based on an operand's fast-math flags -- although the implementation is not completely trivial because we need to look through PHIs, not just at direct function arguments), although that has the obvious problems with users being surprised by the effects of function inlining. Also, we have -fno-builtin-foo, although it would need some enhancements to work easily in this case because of the macros. As another data point, FreeBSD seems to always use an inline version of isnan, but has function calls for isinf/isfinite. Some alternatives (not all mutually exclusive with this one): - As mentioned above, base the folding decision on the fast-math flags of the inputs (looking through phis) instead of the caller's function attributes - In non-finite-math-only mode, replace the calls with a direct implementation (i.e. have the compiler do on all platforms what the OSX math.h header does) - Always replace the calls with inline versions, but mark the instructions somehow so that they don't be removed by later optimizatons - Enhance libc++ to contain some FINITE_MATH_ONLY ifdefs Regarding the infrastructure enhancement, we currently check for known library calls by name like this in SimplifyLibCalls: if (TLI->getLibFunc(FuncName, Func) && TLI->has(Func)) { but currently this does not work if a library function's name is not the default name, but rather one substituted with TLI.setAvailableWithName. This is because we simply never search these custom names when looking for known functions by name (we know only to generate the custom name if we already have its LibFunc identifier). To make this work (necessary for this case because systems disagree on finite vs. isfinite vs. __isfinited, etc.) I've added an additional StringMap to TargetLibraryInfo used to lookup LibFunc identifiers based on custom names. As it turns out, this also requires adding a copy constructor to StringMap (D18506).
https://reviews.llvm.org/D18513
CC-MAIN-2019-35
refinedweb
752
51.48
On 16.02.2013 19:33, Ville Skyttä wrote: > Makes it clearer that it's a Makefile snippet, distinguishes from VDR > conf files. Reposted here per Klaus' request, he'd like to see 3 > people ack this. > --- > Make.config.template | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Make.config.template b/Make.config.template > index b02d796..5bd0a10 100644 > --- a/Make.config.template > +++ b/Make.config.template > @@ -62,7 +62,7 @@ endif > > # Use this if you want to have a central place where you configure compile time > # parameters for plugins: > -#PLGCFG = $(CONFDIR)/plugins.conf > +#PLGCFG = $(CONFDIR)/plugins.mk > > ### The remote control: There have been two more AKCs on vdr-portal.de (where I posted your patch and asked for ACK/NACK), so the patch is accepted. Klaus
http://www.linuxtv.org/pipermail/vdr/2013-February/027299.html
CC-MAIN-2016-18
refinedweb
130
68.57
PhpStorm 2021.1 is a major update that introduces the ability to preview for PHP and HTML files in the editor, 20+ new inspections to help prevent bugs, improvements in all subsystems, and pair programming via Code With Me. Set any PHP version for the project without modifying composer.json. This can be helpful, for example, to see how compatible the codebase is with a newer PHP version before actually switching to it. To make it easier to find and change PHP-related settings, we’ve moved this section to the top level Settings / Preferences | PHP. In the Editor, there is a new icon in the top-right corner that opens a tab for previewing files inside of PhpStorm. It works with HTML and PHP files. Open a PHP file, type your code, and you can immediately see the result alongside it. There is no need to switch to other windows! Any changes in linked CSS and JavaScript files will be reflected in the preview as well. PhpStorm uses a local PHP interpreter that is specified in the project settings under Settings/Preferences | PHP. Docker and other remote interpreters are not supported. You can turn on the preview icon by enabling at least one browser under Preferences | Tools | Web Browsers and checking the For HTML files checkbox. You can also use the shortcut Alt+F2 to open a preview tab. Many content management systems and frameworks allow you to specify a table prefix, which is useful when using the same database for multiple applications. In previous versions, PhpStorm would lose database integration in such cases because SQL queries contained markers for prefixes. Now it is possible to specify prefixes via the .phpstorm.meta.php file. Learn more about meta files and how to specify SQL prefixes in the help article. If a boolean expression contains true or false literals, PhpStorm can help simplify it. Use an Alt+Enter quick fix to remove redundancies and improve readability. The === operator for strict comparison will always result in false if one operand type is not the same as the other. PhpStorm will highlight such cases, as they can potentially be a source of bugs. PhpStorm takes into account all type-inferred information, and will help you find issues in less obvious cases. It used to be common practice to add a variable assignment in a function call to mimic a parameter name. With PHP 8, use Alt+Enter to replace the assignment with a real named argument. This code snippet isset($a) ? $a : $b; is exactly the same as $a ?? $b, so PhpStorm will suggest an Alt+Enter quick-fix to replace it. Some if or else blocks may become redundant after changes that make their bodies the same. PhpStorm will offer either to extract common parts or to merge blocks. Press Alt-Enter on any if and choose Invert `if` statement from the menu. This will change the condition to its opposite and make the necessary code adjustments to preserve the logic. If you are a fan of the early return practice, this action will help you refactor your code. In some cases, the leading backslash is redundant for namespaces. PhpStorm helps determine where it can be removed. Variables for key and value in a foreach loop can clash with the names of other variables or parameters. PhpStorm highlights all of the places where errors could occur. PhpStorm highlights when the curly braces in the context of string interpolation are redundant and can be safely removed to make the code cleaner. If the declared type does not match the type of a value, you can quickly update the type using Alt+Enter. Or with PHP 8, PhpStorm will offer to use a union type. Using the isset() function is only effective for arrays and variables. In all other cases, it makes sense to verify whether the operand is not null. Use Alt+Enter to replace isset() checks with null checks. PhpStorm highlights http:// protocol usages in strings and offers an Alt-Enter quick-fix to change them to https://. You can also add URLs to the ignore list with a quick-fix. PhpStorm highlights some typical misusages of parameter names or return values, for example $ needle and $haystack or $x and $y. This could be a potential bug or at least very confusing for those who read the code. You can now choose a code inspection profile before committing changes to the VCS. Click the gear icon to show commit options, then tick the Analyze code checkbox, click Configure, and choose the desired profile. Profiles can be created in Preferences/Settings | Editor | Inspections. In PHP, loop constructs like foreach, for, while, and catch blocks do not have isolated scopes. This can be inconvenient if you want to rename a variable only inside a block. In PhpStorm 2021.1, we have introduced a synthetic scope for such blocks, so the rename refactoring (Shift+F6) will be more intuitive. PhpStorm 2021.1 analyzes how variables are used and injects language references automatically. For example, if a variable is used in a preg_* function, PhpStorm knows it’s a pattern and highlights RegExp. PhpStorm now considers extensions in both require and suggest sections. PhpStorm will warn you when an extension is registered in composer.json as suggested but is used without checks, like extension_loaded() or function_exists(). You can use a quick-fix to move extensions to require/require-dev. In this release, our main focus was stability and quality. In total, we fixed 2246 issues submitted to our issue tracker by users and JetBrains team members. Here are just a few of the most interesting ones: Code With Me is a JetBrains tool for collaborative development and pair programming. We initially introduced it in PhpStorm 2020.3, and this release delivers a number of significant improvements. Set the needed level of access to your project and share the link with your guests. Peers do not even need to have their own IDEs installed to collaborate, and the platform features embedded audio and video calls, along with chat messaging. For businesses that require extra security, Code With Me on-premises can be installed and securely run on a company’s own private network. You can now define SSL settings in the HTTP client by clicking Add environment file and selecting Private. The IDE will automatically create a file where you can add your SSL configurations: clientCertificate, hasCertificatePassphrase, clientCertificateKey, verifyHostCertificate. There is a new eye icon that contains options for the way the body is displayed. You can switch modes between Text / JSON / HTML / XML, you can enable line numbers, and there is a new button to quickly Copy Response Body to Clipboard. Split the editor by dragging a tab to the corners of the IDE window. Then double-click the tab to maximize the editor area for it. Double-click it again to restore it to its original size. Use the JSONPath query language to search through JSON documents. New actions are available under Edit | Find | Evaluate JSONPath. PhpStorm now supports the newline-delimited JSON Lines format used for working with structured data and logs. The IDE will recognize .jsonl, .jslines, .ldjson, and .ndjson file types. It is now possible to adjust font variations and a fallback font. Find the new options under Typography Settings in Settings / Preferences | Editor | Fonts. All the new features and improvements from WebStorm 2021.1 are also available in PhpStorm 2021.1, either out of the box or with free plugins from the Plugin Marketplace. You can now fix problems in CSS with Stylelint in just a few clicks. Hover over a problem in your file or place the caret on it and press Alt+Enter, then select Stylelint: Fix current file. Additionally, you can now specify a path to the configuration file under Settings / Preferences | Languages & Frameworks | Style Sheets | Stylelint. When working with style sheets, you can now check the specificity of your selectors – just hover over a selector that you want to check. Alternatively, focus on a selector and press F1/Ctrl+Q to see this information in the Documentation popup. To create a new pull request, click on the + icon or go to Git | GitHub | Create Pull Request. The new dialog includes everything you might need: Take a look at What’s new in DataGrip 2021.1 – all these features are available in PhpStorm, too. Here are just a couple of them. The Modify user window, which you can invoke on a user in the database explorer with Cmd/Ctrl+F6, now has a UI for adding grants to objects. This is available for PostgreSQL, Redshift, Greenplum, MySQL, MariaDB, DB2, SQL Server, and Sybase. This is our solution for anyone wanting to generate simple statements straight from the database explorer. When you right-click on an object in the explorer, the list that appears will contain special live template items. Learn more about how to create your own context live templates.
https://www.jetbrains.com/phpstorm/whatsnew/2021-1/
CC-MAIN-2021-43
refinedweb
1,493
64.91
The holoenzyme (α 2 ββσ) can be separated into two The core enzyme has a general affinity for DNA, in which electrostatic attraction between the basic protein and the acidic nucleic acid plays a major role Any (random) sequence of DNA that is bound by core polymerase in this general binding reaction is described as a loose binding site . No change occurs in the DNA, which remains duplex. The complex at such a site is stable, with a half-life for dissociation of the enzyme from DNA ~60 minutes. Core enzyme does not distinguish between promoters and other sequences of DNA. Sigma factor introduces a major change in the affinity of RNA polymerase for DNA. The holoenzyme has a drastically reduced ability to recognize loose binding sites Xthat is, to bind to any general sequence of DNA. The association constant for the reaction is reduced by a factor of ~10 4 , and the half-life of the complex is <1 second. So sigma factor destabilizes the general binding ability very considerably. But sigma factor also confers the ability to recognize specific binding sites. The holoenzyme binds to promoters very tightly, with an association constant increased from that of core enzyme by (on average) 1000 times and with a half-life of several hours. The specificity of holoenzyme for promoters compared to other sequences is ~10 7 , but the association constant can be quoted only as an average, because there is wide variation in the rate at which the holoenzyme binds to different promoter sequences. This is an important factor in determining the efficiency of an individual promoter in initiating transcription. The binding constants extend from ~10 12 to ~10 6 , reflecting promoter strengths that support initiation frequencies of ~1/sec (rRNA genes) to ~1/30 min (the lacI promoter). We are now in a position to describe the stages of transcription in terms of the interactions between different forms of RNA polymerase and the DNA template. The initiation reaction can be described by the parameters that are summarized in Figure 9.9: - The holoenzymePpromoter reaction starts by forming a closed binary complex. "Closed" means that the DNA remains duplex. Because the formation of the closed binary complex is reversible, it is usually described by an equilibrium constant ( K B ). There is a wide range in values of the equilibrium constant for forming the closed complex. - The closed complex is converted into an open complex by "melting" of a short region of DNA within the sequence bound by the enzyme. The series of events leading to formation of an open complex is called tight binding . For strong promoters, conversion into an open binary complex is irreversible, so this reaction is described by a rate constant ( k 2 ). This reaction is fast. Sigma factor is involved in the melting reaction (see 9.7 Substitution of sigma factors may control initiation). - The nextstep is to incorporatethe first two nucleotides; then a phosphodiester bond forms between them. This generates a ternary complex that contains RNA as well as DNA and enzyme. Formation of the ternary complex is described by the rate constant k i ; this is even faster than the rate constant k 2 . Further nucleotides can be added without any enzyme movement to generate an RNA chain of up to 9 bases. After each base is added, there is a certain probability that the enzyme will release the chain. This comprises an abortive initiation , after which the enzyme begins again with the first base. A cycle of abortive initiations usually occurs to generate a series of short (2V9 base) oligonucleotides. - When initiation succeeds, the enzyme releases sigma and makes the transition to the elongation ternary complex of core polymerasePDNAPnascent RNA. The critical parameter here is how long it takes for the polymerase to leave the promoter so another polymerase can initiate. This parameter is the promoter clearance time; its minimum value of 1V2 sec establishes the maximum frequency of initiation as <1 event per second. The enzyme then moves along the template, and the RNA chain extends beyond 10 bases. When RNA polymerase binds to DNA, the elongated dimension of the protein extends along the DNA, but some interesting changes in shape occur during transcription. Transitions in shape and - When RNA polymerase holoenzyme initially binds to DNA, it covers some 75V80 bp, extending from V55 to +20. (The long dimension of RNA polymerase (160 ) could cover ~50 bp of DNA in extended form, which implies that binding of a longer stretch of DNA must involve some bending of the nucleic acid.) - The release of sigma results in a change in the shape of the RNA polymerase at the transition from initiation to elongation. The loss of sigma is associated with the loss of contacts in the V55 to V35 region, leaving only ~60 bp of DNA covered by the enzyme. This corresponds with the concept that the more upstream part of the promoter is involved in initial recognition by RNA polymerase, but is not required for the later stages of initiation (see later). - When the RNA chain extends to 15V20 bases, the enzyme makes a further transition, to form the complex that undertakes elongation; now it covers 30V40 bp (depending on the stage in the elongation cycle). It is not known whether the change at the start of elongation involves a significant alteration in the shape of the enzyme or whether the DNA is released into a less compact form. How is RNA polymerase distributed in the - Excess core enzyme exists largely as closed loose complexes, because the enzyme enters into them rapidlyand leavesthem slowly. There is very little, if any, free core enzyme. - There is enough sigma factor for about one third of the polymerases to exist as holoenzymes, and they are distributed between loose complexes at nonspecific sites and binary complexes (mostly closed) at promoters. - About half of the RNA polymerases consist of core enzymes engaged in transcription. - How much holoenzyme is free? We do not know, but we suspect that the amount is very small. {% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %} RNA polymerase must find promoters within the context of the genome. Suppose that a promoter is a stretch of ~60 bp; how is it distinguished from the 4 10 6 bp that comprise the E. coli genome? Figure 9.12 illustrates the principles of three models. The simplest model is to suppose that RNA polymerase moves by random diffusion. Holoenzyme very rapidly For RNA polymerase to move from one binding site on DNA to another, it must dissociate from the first site, find the second site, and then associate with it. Movement from one site to another is limited by the speed of diffusion through the medium. Diffusion sets an upper limit for the rate constant for associating with a 60 bp target of <10 8 M V1 sec V1 . But the actual forward rate constant for some promoters in vitro appears to be ~10 8 M V1 sec V1 , at or above the diffusion limit. If this value applies in vivo , the time required for random cycles of successive association and dissociation at loose binding sites is too great to account for the way RNA polymerase finds its promoter. RNA polymerase must therefore use some other means to seek its binding sites. The process could be speeded up if the initial target for RNA polymerase is the whole genome, not just a specific promoter sequence. By increasing the target size, the rate constant for diffusion to DNA is correspondingly increased, and is no longer limiting. If this idea is correct, a free RNA polymerase binds DNA and then remains in contact with it. How does the enzyme move from a random (loose) binding site on DNA to a promoter? The most likely model is to suppose that the bound sequence is directly displaced by another sequence. Having taken hold of DNA, the enzyme exchanges this sequence with another sequence very rapidly, and continues to exchange sequences until a promoter is found. Then the enzyme forms a stable, open complex, after which initiation occurs. The search process becomes much faster because association and dissociation are virtually simultaneous, and time is not spent commuting between sites. Direct displacement can give a "directed walk," in which the enzyme moves preferentially from a weak site to a stronger site. Another idea supposes that the enzyme slides along the DNA by a one-dimensional random walk, being halted only when it encounters a promoter. However, there is no evidence that RNA polymerase (or other DNA-binding RNA polymerase encounters a dilemma in Sigma factor is involved only in initiation. It is released from the core enzyme when abortive initiation is concluded and RNA synthesis has been successfully initiated. Free sigma factor becomes immediately available for use by another core enzyme. We do not know whether sigma is released as a consequence of overcoming abortive initiation, or whether instead it is the release of sigma factor that ends abortive initiation and allows elongation to commence. Release of sigma leaves the core enzyme on DNA. The core enzyme in the ternary complex is bound very tightly to DNA. It is Core enzyme has a high intrinsic affinity for DNA, which is increased by the presence of nascent RNA. But its affinity for loose binding sites is too high to allow the enzyme to distinguish promoters What is responsible for the ability of holoenzyme to bind
http://flylib.com/books/en/2.643.1.109/1/
CC-MAIN-2014-41
refinedweb
1,571
59.94
Hi there! Im new to Java and I'm also new to these forums. And hopefully i can get some advice to point me in the right direction. My assignment was to make a program that calculates and writes a persons taxes, based on their income. If the income were less then (or the same) as 8900. 0 would be payed in taxes. If the income were more than 8900 but less than 198700. 100 would be payed in taxes. If the income were more than (or the same) as 198700. 100 + 20% of the income above 198700 would be payed in taxes. And also, before the program shuts down it should ask me if i want to calculate some more. So i have it almost done. It's just something that is missing, and i just can't figure it out. Maybe u guys can help me out a bit. Here's the code i've written so far: import javax.swing.*; public class Test { public static void main (String[] arg) { int knappNr; do{ String tax = JOptionPane.showInputDialog ("Write your income"); double pay = Double.parseDouble (pay); if (pay <=8900) pay = 0; else if (pay >=198700) pay = pay - 198700; pay = pay * 0.20 + 100; else pay = 100; JOptionPane.showMessageDialog (null, "Your tax to pay is " + pay+" dollar"); knappNr = JOptionPane.showConfirmDialog (null, "Do you want to make another calculate?", "Question", JOptionPane.YES_NO_OPTION); } while (knappNr == 0); } } Thank you in advance.
http://www.javaprogrammingforums.com/whats-wrong-my-code/17533-having-hard-time-solve-probably-easy-rest-you.html
CC-MAIN-2015-27
refinedweb
238
85.89
Lots of good comments on my previous post. To briefly follow up:! If you would like to receive an email when updates are made to this post, please register here RSS Great series!! Tree traversal can also be done without using stack. For example,. But, this approach makes tree node more "heavy" as additional information has to be used. In your approach how do you traverse the tree for a second time? All the nodes will be marked as visited. I think what you want to do is store the "visited" information in a separate dictionary object which is owned by the traverser. You could make Visited an integer, incrementing it each time you visit a node. Obviously, it also doesn't work for immutable trees :-) I should say "incrementing it each time you TRAVERSE THE TREE"... Dictionary approach seems to be better, in scenarios when traversing is done only with search purpose. In this case not all nodes will be visited and "visited" counter can be useless. Perhaps a nice feature of a future C# would be to allow a function to delegate the yield ability to some deeper function. That would allow you to write InOrder like this maybe: public static IEnumerable<T> InOrder<T>(this IBinaryTree<T> tree) { yield tree.left.InOrder(); yield return tree.value; yield tree.right.InOrder(); } Of course that's not a trivial feature to implement, but maybe someday C# will have continuations. The InOrder function should be checking against IsEmpty instead of null or Count > 0. And speaking of null, it would be a nice feature to be able to specify that a variable of a class can not be set to null. This would simplify code so that we would not have to check that a value passed into a method is null because it would not be allowed by the compiler. This would require being able to identity a default value so that an array could be initialized. In the case of these immutible data structues, the default would of course by Empty. "I would very much like to add new syntax to a hypothetical future version of C# which would be a syntactic sugar for the code above." It's called F#. Whoops, that's what I get for modifying the code from another project and posting it without compiling it. Thanks for the note. I've a small question unrelated to this immutables series, but I hope is still relevant for this blog: Why did you not include generic properties/indexers in C#? Are you contemplating doing so in the "hypothetical future version of C#". Why do we have to bother about "out-of-stack". Using the stack for recursion in trees are done in functional programming like F#, Lisp all the time. The only datastructure too big to use the stack is lists and similar, which can be several thousand elements. Trees on the other seldom becomes deeper than 100 levels, especially if you use balanced trees like AVL or red-black trees. Stackless in-order binary tree traversal with left, right and parent pointers only Off the top of my head and untested class Node { Node Parent; Node Left; Node Right; Object Value; } class InOrderTreeWalk { bool descendLeft; Node current; InOrderTreeWalk(Node start) { this.descendLeft = true; this.current = start; } bool moveNext() { if(this.current == null) { return false; } if(this.descendLeft) { this.descendLeft = false; while(this.current.left != null) { this.current = this.current.left; } else { if(this.current.right != null) { this.current = this.current.right; while(this.current.left != null) { this.current = this.current.left; } else { if(this.current.parent != null && this.current == this.current.parent.left) { this.current = this.current.parent; else { while(this.current.parent != null && this.current == this.current.parent.right) { this.current = this.current.parent; } if(this.current.parent == null) { this.current = null; return this.current != null; object getValue() { return (this.current != null) ? this.current.Value : null; Note that in Ifeanyi's code you are still using an additional O(n) memory for the parent pointers vs Eric's b-tree implementation. A binary tree already takes up O(n) memory for n nodes though, so you could just add it together and get back O(n) total memory usage. This doesn't sound so bad in theory. On the other hand, if you are using a balanced binary search tree, with recursion or explicit stack a traversal will only use O(log n) for extra memory. In practice it will then use less memory, as you'd have to run O(n/logn) traversals concurrently for it to actually use more. How are you going to build an immutable binary tree that has parent pointers? Note that "binary tree" and "b tree" are two entirely different data structures. "b tree" is NOT short for "binary tree".;
http://blogs.msdn.com/ericlippert/archive/2007/12/19/immutability-in-c-part-seven-more-on-binary-trees.aspx
crawl-002
refinedweb
803
65.62
Motion Sensor Motivation To create a sensor that detects motion and stores data online. Motion is detected using an Arduino Nano with a PIR sensor. The Arduino Nano has an Ethernet shield and is connected to the internet where it stores data on a thingspeak server. Everything is nicely placed within a 3D printed case. 3D Printed Casing The arduino and ethernet shield is placed inside a 3D printed box with easy access to the PIR sensor adjustments. These being sensitivity/time to keep motion detection and range. Prototyping First trials used an arduino nano and a motion sensor. The LED lights up, while motion is being detected. Then a few prototypes were made, connecting the Arduino Nano with ethernet shields Data Entries I have had a motionsensor constantly logging data for every 20 seconds, and it has been running constantly for a few years now. I recently did reset my log and last time I checked there were: ~447.063 entries / data points available. This corresponds to ~100 days of data, logging every 20th second. When data are stored online, they can easily be retrieved using APIs etc. You can follow another project I made logging weather pressure data, which all data are logged and available here. Data on the phone The nice thing about thingspeak, is the ease of getting an app for the phone. I use a Thingspeak Widget to retrieve data from all my individual sensors. Then I can always follow the temperature in my workshop or near my 3D printer, humidity, pressure, light level and motion in my workshop. PIR is the motion widget, because it is showing 0: no motion is present. I recall buying a household plant for my workshop. I asked the usual question of how much light it did need, and he said - how many lux do you have where it is being placed .. It was really great to pick up the phone and show him graphs of light levels, temperatures, humidity etc. He sure didn’t expect that ! Data Processing The data retrieved from the module is just a simple ‘0’ (no motion) or ‘1’ (motion). But it is really interesting how much you can extract from that sort of data. These types of data are like a fingerprint! It is scary how much information you get, when did go to bed and when did I got up in the morning. When I started working in the workshop and how the activity (motion) level increased during the day. All, this from simple binary numbers, scary - but also really cool. Because data is given for every 20th second, it is easy to average over a period of time, for example 30 minutes. Then a plot can be made showing the motion activity level between 0 and 1, for a given time in my workshop IRL Testing We actually did place a few at my work. And using only motion data like this, you can see which person they actually monitored ! Like a personal fingerprint. Think about it. Most people have routines, when do they usually meet, when they go to launch etc. Simple data points like a ‘0’ and a ‘1’ can give so much information. Data like this, can really be useful or misused. Simple binary data points can give you a lot of information - you just need enough of them. Complete code The complete code can be seen here. There are also libraries available to connect arduino with thingspeak which I recommend. The code is assembled from a lot of different sources, and has been mixed a lot. It will be almost impossible now to mention all the sources used - but it is possible to use some of the many guides online. #include <UIPEthernet.h> // **** SENSOR SETUP **** const int inputPin = 2; // PIR Sensor InputPin bool mv = 0; // **** THINGSPEAK SETTINGS **** String apiKey = "PLACE YOUR API KEY HERE"; const char* server = "api.thingspeak.com"; unsigned long UpdateThingSpeak = 20000; // Time interval in milliseconds to update ThingSpeak (>16 s) unsigned long lastConnectionTime = 0; // **** VARIABLE SETUP **** boolean lastConnected = false; int failedCounter = 0; // **** ETHERNET SETTINGS **** byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x78, 0xEE }; # MAKE YOUR OWN MAC ADDRESS HERE // IPAddress ip(XXX, XXX, XXX, XXX); // SET YOUR STATIC IP ADRESS HERE EthernetClient client; // Initialize Arduino Ethernet Client void setup() { Serial.begin(9600); // Start Serial for debugging on serial monitor delay(10); // allow time for sensors to start up // Start Ethernet on Arduino Ethernet.begin(mac); // Dynamic IP // Ethernet.begin(mac, ip); // Fixed IP } void loop() { // Print Update Response to Serial Monitor if (client.available()) { char c = client.read(); Serial.print(c); } // Disconnect from ThingSpeak if (!client.connected() && lastConnected) { Serial.println("...disconnected"); Serial.println(); client.stop(); } // Update ThingSpeak if(!client.connected() && ((unsigned long)(millis() - lastConnectionTime) >= UpdateThingSpeak)) { mv = digitalRead(inputPin); // PIR Serial.println("mv = "); Serial.println(mv); updateThingSpeak("field1="+String(mv)); } // Check if Arduino Ethernet needs to be restarted if (failedCounter > 3 ) {startEthernet();} lastConnected = client.connected(); } void updateThingSpeak(String tsData) { if (client.connect(server, 80)) {); }
https://srosendal.github.io/inventor/motionsensor/
CC-MAIN-2020-29
refinedweb
828
56.35
Last year, December became my favorite month of the year when I stumbled upon something called Advent of Code. It's a calendar that each day presents 2 new coding challenges for you to crack. The goal is to solve these using any programming language you want, in order to save christmas. This year I got tired of creating all the files, folders and download the input everyday, that I finally decided to do something about it. So what does a lazy coder do? We automate! I make 1 folder for each day containing 2 files for each part. I have a test.py where I test code snippets and I create a testinput.txt for any test input. Then I download the input file for the day and add it accordingly. Disclaimer: I've only tested this on Windows so your mileage may vary. Prerequisites: Python 3, Selenium, Chrome Driver (or your driver of choice) from selenium import webdriver from selenium.webdriver.chrome.options import Options import os, sys #Verify we're getting input if len(sys.argv) != 2: print('Missing day number. Run e.g:') print('python setup.py 13') sys.exit(2) day = str(sys.argv[1]) path = str(os.getcwd()) + "/day" + day #Create folder from input try: os.mkdir(path) except OSError: print ("Creation of the directory %s failed" % path) #Create 4 empty files lista = ["/part2.py", "/test.py", "/testinput.txt"] for i in lista: open(path + i, 'a').close() #Create and Write to part1.py part1 = path + "/part1.py" f = open(part1, "a") f.write('data = open("input.txt").read().split("\\n")') f.close() chrome_options = Options() chrome_options.add_argument("--headless") # Replace value with your session cookie for AoC session_cookie = {"name": "session", "value": "<Session_cookie>"} # initialize driver object and change the <path_to_chrome_driver> depending on your directory where your chromedriver should be driver = webdriver.Chrome(chrome_options=chrome_options, executable_path="<path_to_chrome_driver>") # URLs we need url = " url_input = " + day + "/input" # get request to target the site selenium is active on, add our cookies and go to input driver.get(url) driver.add_cookie(session_cookie) driver.get(url_input) # Find our text input on the input page, "pre" is our tag ID content = driver.find_element_by_tag_name("pre").text # Save content to file path = path + "/input.txt" f = open(path, "a") for line in content: f.write(line) f.close() # Remember to quit the driver driver.quit() #Success?! print(str(path) + " and adjacent files created!") Feel free to use this and adjust it to your own liking. Make sure to edit the 2 fields in the code: - Session cookie - path_to_chrome_driver Run it by executing it together with a number for the day you're planning to do, e.g: python setup.py 25 Discussion (1) Nice! I'll try to combine with another script to auto create and download input files. And time + run them
https://dev.to/zolor/automating-advent-of-code-2dlf
CC-MAIN-2022-21
refinedweb
467
60.72
0 QUESTION : 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest number that is evenly divisible by all of the numbers from 1 to 20? While trying to solve this problem, i came up with the code i have given here. The codes compiles and runs, but i get a wrong answer. Someone plz show me where i've gone wrong and help me obtain the correct answer. #include <iostream> using namespace std; class common { public: int ans; void calc(); }; void common:: calc() { ans = 0; int test = 20, flag = 0, i = 1; while (flag==0) { for (i = 1; i<20; i++) { if (test%i) { if (i==19) { ans = test; flag = 1; } } else { test += 20; continue; } } } cout << "Answer : \t" << ans << endl; } int main() { common inst; inst.calc(); }
https://www.daniweb.com/programming/software-development/threads/169800/problem-to-find-smallest-no-divisible-by-all-of-the-first-20-natural-numbers
CC-MAIN-2018-09
refinedweb
142
73.81
Tutorial Using Airtable first discovered Airtable in late 2018, and was immediately blown away. For those not already familiar with it yet, Airtable is a cloud-based collaborative database-spreadsheet hybrid application. It offers a flexible and intuitive GUI, reasonable prices (along with a generous free tier), and a full REST API with excellent auto-generated documentation. It also works great as a data source for Gatsby.js, and I’m excited to show you how! In this lesson we are going to create a very basic food truck menu using Airtable, and then display it (almost) effortlessly in a Gatsby website. This article assumes you already have a basic Gatsby.js project set up and you’re ready to edit. If you need help getting to that point, try going through the Your First Steps with Gatsby v2 post and then return here afterwards. Airtable Setup Since this is more of a Gatsby-focused article, we will only cover the general steps involved on the Airtable side of things. You will quickly see that Airtable’s UI is very intuitive, and the auto-generated documentation is top-notch when needed. I encourage you to take a slow afternoon to explore the features and functionality available with it, though… As you’ll discover just how powerful and flexible it can be. (I use it in several personal and client projects, and not just with Gatsby!) 1. Create an Airtable account The first thing we need to do is create an Airtable account, unless you already have one. Just head over to the Airtable website and click the ‘Sign Up’ link in the main nav. Once you’re signed up (and/or signed in), you will be at the main dashboard. You’re initially provided with a single workspace, which holds a collection of demonstration bases (a.k.a. databases.) Each base can contain any number of tables, which function like database tables. Workspaces and bases are free to create, so feel free to create a new empty workspace here if you like. (This is recommended, but not required.) 2. Create a new base For our food truck menu, we need to create a new base. Let’s create one by clicking the gray 'Add a base’ button inside the workspace of your choice. Select the “start from scratch” option when asked, and then in the pop-up we will give our new base a title. (You can also assign a color and glyph for the icon, if you want.) Let’s name ours ChompsFoodTruck. 💡 Pro Tip: When working with client projects in Airtable, always create a new workspace for each client. Ownership of bases cannot be transferred, but ownership of workspaces can! 3. Rename the default table With our new base initialized, click on its icon to start configuring it. You’ll notice that the tab at the top is labeled Table 1, so we should rename it to something more appropriate. Let’s rename it to Sandwiches for our purposes. Since we reference this table name over in Gatsby, I recommend using camelCase or PascalCase naming if your table name needs multiple words, e.g. SoupsAndSalads 4. Edit the table Let’s edit the Sandwiches table structure to fit our needs: - Step 1: Delete the default Notesand Attachmentscolumns. - Step 2: Create two new columns, Description(type: Single Line Text) and Price(type: Currency) - Step 3: Add a few rows of sample data! Use your favorite sandwiches, and make up a price and description for each. With those steps out of the way, we have a simple Sandwiches table set up in our ChompsFoodTruck base. We could easily duplicate this to make other menu sections, like sides and/or drinks, but we’ll keep it simple for this lesson. 5. Airtable API Credentials We only have one step left in Airtable: obtaining our API credentials. Making calls to the Airtable API requires both a base ID and an API Key. To get the base ID, click the Help link next to your profile link (top right), and then click API documentation in the dropdown. This will auto-generate fresh documentation for our ChompsFoodTruck base in a new browser tab. Then click the Sandwiches menu link, and in the example (JavaScript) code on the right you’ll see the base ID listed: var base = new Airtable({apiKey: 'YOUR_API_KEY'}) .base('appABCD12345'); // 👈 nice! To get your API key, just head over to your account overview page. There you’ll see a button to (re)generate a new key. Our Airtable setup is complete! (And that auto-generated documentation was neat, right?!) Let’s head back over to our Gatsby project, where we will bring in this data with almost zero effort. Bringing the Data into Gatsby We could write some code using the code examples provided by the Airtable documentation, and it’s not difficult to work with. However, since we are using Gatsby it’s always a good idea to look in the plugins section on their official site for something that will help. Luckily for us, there is an excellent gatsby-source-airtable plugin that we can use! This plugin can fetch rows of data from multiple bases and tables in Airtable, and it automatically converts them all into GraphQL nodes. 1. Installation The first thing we need to do is install the gatsby-source-airtable plugin. Let’s stop our development server if it’s running, and then at the command prompt: $ yarn add gatsby-source-airtable 2. Plugin Configuration As with all Gatsby plugins, we also need to include it in gatsby-config.js and set some configuration options. Let’s do that now by inserting it into the plugins array, as shown here: // ... siteMetadata above here plugins: [ { resolve: `gatsby-source-airtable`, options: { apiKey: `YOUR_AIRTABLE_API_KEY`, tables: [ { baseId: `AIRTABLE_BASE_ID`, tableName: `Sandwiches` }, // We can add other bases/tables here, too! //{ //baseId: `AIRTABLE_BASE_ID`, //tableName: `Sides` //} ] } }, // ... other plugins here ] This is the minimum configuration, and it is all that we need to retrieve our sandwich data. Let’s make sure it works by restarting our dev server and then opening GraphiQL in a browser tab. (Typically this URL is:) You should see two new entries at the top of the Explorer menu on the left: airtable and allAirtable. If you query the data in allAirtable.nodes, you should see all of your sandwich data listed. Awesome! 🥪🥪🥪 3. Displaying our data At this point we now have our Airtable base set up, and we’ve already got the data in GraphQL nodes available to Gatsby. All that’s left is do is query and display it on our site! We could certainly do that by using a page-level query, but for maximum portability let’s instead create a new Menu component and use a static query within it. Let’s create a new file at /src/components/Menu.js, and add the following code: import React from 'react'; import { useStaticQuery, graphql } from 'gatsby'; const Menu = () => { const data = useStaticQuery(graphql` query MenuQuery { sandwiches: allAirtable( filter: { table: { eq: "Sandwiches" } } sort: { fields: data___Price, order: DESC } ) { nodes { data { Name Price Description } recordId } } } `); return ( <div> <h3>Sandwiches</h3> <ul> {data.sandwiches.nodes.map((item, i) => ( <li key={item.recordId}> <p> {item.data.Name}, ${item.data.Price} </p> <p>{item.data.Description}</p> </li> ))} </ul> </div> ); }; export default Menu; As you can see, we are just mapping over our sandwich data and returning <li> elements. Note that we are making use of a newer feature of Gatsby, useStaticQuery, which uses a built-in React Hook to allow GraphQL queries inside any component at build time. Important: This feature requires Gatsby version 2.1.0 or higher, and React 16.8.0 or higher. Also notice that we’re making use of a filter option in the query to ensure we are only retrieving data from the Sandwiches table. (In this manner, we could create additional queries if we had other menu sections!) That’s it! We can now use our new Menu component anywhere in our project, just like any other component. (I would recommend styling it, though!) Other plugin config options We’ve already used the two required options within each tables object, baseId and tableName, and those don’t really need much explanation. But there are a few other useful options available inside each tables object: - tableView: (String) This option allows you to use a custom view that you’ve set up inside Airtable. (e.g. for highly customized row ordering and/or filtering you’ve done on the Airtable side.) - queryName: (String) Sometimes you may be using two bases that have tables with the same names. With this option, you can set an alternate name for a table to make GraphQL queries easier to work with. - mapping: (Object) This option lets you map columns to specific data types for Gatsby to transform. It’s invaluable for using with markdown data or with image attachments! - tableLinks: (Array of strings) Airtable offers a special column type that links to entries of other tables. With this option, we define these column names to make sure Gatsby retrieves the full data. (Otherwise, it will only fetch each linked item’s ID.) The plugin documentation goes into greater detail about these options, and some fantastic usage examples are available in the plugin’s Github repo, including both image processing and markdown processing examples. Conclusion This menu example was somewhat basic, but hopefully you’ve seen that Airtable and Gatsby.js make an incredible duo – especially with help from the gatsby-source-airtable plugin. Don’t stop here, though! I definitely encourage you to further explore and tinker around with Airtable’s features on your own. Possible ideas: - Try adding new tables with other menu sections, e.g. Nachosand Drinks. - Try creating an Infotable to store the food truck’s email, phone number, logo, etc. - Try adding images for your menu items, and then use Gatsby’s fantastic Imagecomponent to display them. 🥪 Happy learning and bon Appétit!
https://www.digitalocean.com/community/tutorials/gatsbyjs-using-airtable-with-gatsby
CC-MAIN-2020-34
refinedweb
1,665
63.8
Packaging:Minutes/20090217 From FedoraProject < Packaging:Minutes Fedora Packaging Committee Meeting 2009-02-17 Present - Denis Leroy (delero) -) - Xavier Lamien (SmootherFrOgZ) Regrets - Hans de Goede (hansg) Writeups There are no new guidelines this week. Votes The following proposals were considered: - User Creation - Somehow during the wiki conversion a guideline page was created that redirected too a draft page. This was in error; FPC never approved the draft and the redirection page has been removed. - Preferring %global over %define - - Draft was accepted. If FESCo approves, we will run through and update the various guidelines and templates. - Review Guideline for fonts - - The draft was unchanged from two weeks ago, save for the addition of a discussion section. FPC again voted against the draft. - However, see below for discussion of plans for the ReviewGuidelines document. - PHP Guideline changes to accommodate channels - - The draft was clarified as requested in the previous meeting. The new draft was accepted. - Guidelines for the Epoch: tag - - The draft was modified according to discussion and the modified draft was accepted. - Revised Icon Cache scriptlets - - The draft was accepted. - Clarification to the guideline on duplicate files - - The draft was accepted. Older Business The following three drafts from the previous meeting await FESCo - Explicit Requires - - Updated Haskell Guidelines - - Symlinks - Other Discussions - There was some discussion relating to the ReviewGuidelines document in the wake of the failure of the ReviewGuideline_for_fonts document to pass for a second time. abadger1999 drafted as a strawman, and spot indicated that he plans to put additional work into ReviewGuidelines. There was also discussion of moving it out of the Packaging namespace and handing it over to the Package Review SIG, but that SIG has yet to develop fully.
http://fedoraproject.org/w/index.php?title=Packaging:Minutes/20090217&oldid=79211
CC-MAIN-2016-50
refinedweb
281
53.92
I’ve yet to see another testing system for local web testing that I like as much as WebTest… which is perhaps personal bias for something I wrote, but then I don’t have that same bias towards everything I’ve written. Many frameworks build in their own testing systems but I don’t like the abstractions — they touch lots of internal things, or skip important steps of the request, or mock out things that don’t need to be mocked out. WSGI can make this testing easy. There’s also a hidden feature here: because WSGI is basically just describing HTTP, it can be a means of representing not just incoming HTTP requests, but also outgoing HTTP requests. If you are running local tests against your application using WebTest, with just a little tweaking you can turn those tests into HTTP tests (i.e., actually connect to a socket). But doing this is admittedly not obvious; hence this post! Here’s what a basic WebTest test looks like: from webtest import TestApp import json wsgi_app = acquire_wsgi_application_somehow() app = TestApp(wsgi_app) def test_login(): resp = app.post('/login', dict(username='guest', password='guest')) resp.mustcontain('login successful') resp = resp.click('home') resp.mustcontain('<a href="/profile">guest</a>') # Or with a little framework integration: assert resp.templatevars.get('username') == 'guest' # Or an API test: def test_user_query(): resp = app.get('/users.json') assert 'guest' in resp.json['userList'] user_info = dict(username='guest2', password='guest2', name='Guest') resp = app.post('/users.json', content_type='application/json', body=json.dumps(user_info) assert resp.json == user_info The app object is a wrapper around the WSGI application, and each of those methods runs a request and gets the response. The response object is a WebOb response with several additional helpers for testing (things like .click() which finds a link in HTML and follows it, or .json which loads the body as JSON). You don’t have to be using a WSGI-centric framework like Pylons to use WebTest, it works fine with anything with a WSGI frontend, which is just about everything. But the point of my post: you don’t have to use it with a WSGI application at all. Using WSGIProxy: import os import urlparse if os.environ.get('TEST_REMOTE'): from wsgiproxy.exactproxy import proxy_exact_request wsgi_app = proxy_exact_request parsed = urlparse.urlsplit(os.environ['TEST_REMOTE']) app = TestApp(proxy_exact_request, extra_environ={ 'wsgi.scheme': parsed.scheme, 'HTTP_HOST': parsed.netloc, 'SERVER_NAME': parsed.netloc}) else: wsgi_app = acquire_wsgi_application_somehow() app = TestApp(wsgi_app) It’s a little crude to control this with an environmental variable ($TEST_REMOTE), but it’s an easy way to pass an option in when there’s no better way (and many test runners don’t make options easy). The extra_environ option puts in the host and scheme information into each request (the default host WebTest puts in is). WSGIProxy lets you send a request to any host, kind of bypassing DNS, so SERVER_NAME is actually the server the request goes to, while HTTP_HOST is the value of the Host header. Going over HTTP there are a couple features that won’t work. For instance, you can pass information about your application back to the test code by putting values in environ['paste.testing_variables'] (which is how you’d make resp.templatevars work in the first example). It’s also possible to use extra_environ to pass information into your application, for example to get your application to mock out user authentication; this is fairly safe because in production no request can put those same special keys into the environment (using custom HTTP headers means you must carefully filter requests in production). But custom environ values won’t work over HTTP. The thing that got me thinking about this is the work I’m doing on Silver Lining, where I am taking apps and rearranging the code and modifying the database configuration ad setup to fit this deployment system. It would be really nice having done that to be able to run some functional tests, and I really want to run them over HTTP. If an application has tests using something like Selenium or Windmill that would also work great, but those tools can be a bit more challenging to work with and applications still need smaller tests anyway, so being able to reuse tests like these would be most useful.
http://www.ianbicking.org/blog/2010/04/webtest-http-testing.html
CC-MAIN-2019-43
refinedweb
717
55.13
Hi Richard, Thanks for your response. I'd say that's definitely some basic mistake. As you'd said, it is basic behavior (and I was hoping to read that). The problem is that I can't find where my mistake is... Yes, I tried field injection and I also tried method injection using the bind and unbind methods in the consumer, but they weren't called when I thought they should be. The code that I have attached in my original post is my test with method injection. I was hoping anybody more experienced than me could find what I'm doing wrong. Anyway, in the following lines you can find some parts of the code. Perhaps there is something that I'm missing but that is obvious to you. . consumer.xml: <?xml version="1.0" encoding="UTF-8"?> <iPOJO> <component classname="org.test.iPOJO.consumer.Consumer"> <requires field="inter" id="Inter"> <callback transition="bind" method="bindInter"/> <callback transition="unbind" method="unbindInter"/> </requires> <callback transition="validate" method="start"/> <callback transition="invalidate" method="stop"/> </component> <instance component="org.test.iPOJO.consumer.Consumer"/> </iPOJO> . consumer.java: public class Consumer implements Runnable { private InterfaceOne inter; public void start() { System.out.println("[Consumer] Validating"); run(); } public void stop() { System.out.println("[Consumer] Invalidating"); stopRequestReceiver(); } // This was never called public synchronized void bindInter (InterfaceOne i) { System.out.println("[Consumer] Binding"); } // This was never called public synchronized void unbindInter (InterfaceOne i) { System.out.println("[Consumer] Unbinding"); } (...) } . providerA.xml (providerB is similar): <?xml version="1.0" encoding="UTF-8"?> <iPOJO> <component classname="org.test.iPOJO.providerA.ProviderA"> <provides/> <callback transition="validate" method="start"/> <callback transition="invalidate" method="stop"/> </component> <instance component="org.test.iPOJO.providerA.ProviderA"/> </iPOJO> . providerA.java: public class ProviderA implements InterfaceOne { private int state = 1; public void start() { System.out.println("[ProviderA] Validating"); state = 1; } public void stop() { System.out.println("[ProviderA] Invalidating"); state = 0; } (...) } Thanks, Fabio Fonseca Richard S. Hall wrote: > > That doesn't sound right. I'd say there is something else simple going > wrong. If you are using field injection in the consumer, you could look > to add method injection too to see if you are getting proper callbacks > when services come and go. Regardless, this sounds like pretty basic > behavior, so I have to assume there is a simple mistake. > > -> richard > > On 12/18/11 5:38 PM, Fabio Fonseca wrote: >> Hello all, >> >> I'm starting to develop my master thesis and this is my first post to >> this >> forum. My research concerns the challenges of developing Self-Adaptable >> software (software that can change its behavior in response to a change >> in >> its operation context). Right now I'm doing an assessment aiming to find >> which technologies are available today that could help achieving a >> self-adaptable software. >> >> I'm using Apache Felix + iPOJO to develop a simple test. I have a >> consumer >> which wants to consume providers that implement a interface named >> InterfaceOne. I have two providers that fits this requirement (named >> ProviderA and ProviderB). They all do nothing useful, I am just trying to >> produce a self-adaptable behavior. >> >> I am using the launcher.jar which is provided with the code that comes >> with >> the great book "OSGi in Action". This launcher creates an instance of the >> Felix Framework and loads the bundles found in the bundles/ directory >> passed >> as a parameter when running the launcher.jar. >> >> So I have 4 bundles. Each one of them has an iPOJO component inside it, >> except the first one that just has the InterfaceOne interface: >> . services-1.0.jar >> . consumer-1.0.jar >> . providerA-1.0.jar >> . providerB-1.0.jar >> >> The consumer is a simple http listener that uses localhost port 8080 to >> listen to anything that may appear. When something access the port 8080, >> it >> calls the available provider. >> >> When I start the launcher, all bundles are active and OSGi chooses one of >> the providers and binds it to the consumer. Using the shell commands I'm >> able to stop the providers' bundles and when I do it, the consumer is >> invalidated (as per the iPOJO lifecycle). >> >> I concluded that when I start the consumer bundle the available provider >> is >> bound to the consumer and it remains bound even when I stop its bundle >> (in >> the OSGi lifecycle). The cenario is: >> >> - start ProviderA >> - start Consumer (consumer starts since its dependency is satisfied) >> - start ProviderB >> - stop ProviderA (consumer is still valid in the OSGI's lifecycle, since >> there is a provider (ProviderB) that satisfy its dependency) >> >> At this moment, if I call localhost:8080, the consumer uses ProviderA, >> even >> when ProviderA is not available anymore. I conclude that the binding >> between >> Consumer and its provider (which is in this case still the ProviderA) >> continues to exist even when I stop ProviderA. I read somewhere that >> iPOJO >> lifecycle takes over OSGi's lifecycle, but when I stop ProviderA, the >> component becames Invalidated (I know because I placed a method that is >> called when the provider is invalidated). So, even with the provider >> Invalidated, it is still called. I also read somewhere that each >> component >> is implemented as a Singleton by default, and I have not changed its >> behavior. So, I'm lost here. I expected that, in the above cenario, >> ProviderB would be called instead of ProviderA. >> >> Anyone has a clue that could help me understand how this mechanism works? >> Attached you can find a file with all my source code and ant tasks I'm >> using >> to play with iPOJO and OSGi. >> >> OIA+Code.zip >> >> Thanks a lot in advance! >> Fabio Fonseca > > --------------------------------------------------------------------- >
http://mail-archives.apache.org/mod_mbox/felix-users/201112.mbox/%3C33000287.post@talk.nabble.com%3E
CC-MAIN-2019-26
refinedweb
923
55.74
Gems hidden in plain view. I couldn’t have said it better: While OpenCV was designed for use in full-scale applications and can be used within functionally rich UI frameworks or without any UI at all, sometimes you want to try some functionality quickly and visualize the results. This is what the HighGUI module has been designed for. It provides easy interface to: - Create and manipulate windows that can display images and “remember” their content (no need to handle repaint events from OS). - Add trackbars to the windows, handle simple mouse events as well as keyboard commands. - Read and write images to/from disk or memory. - Read video from camera or file and write video to a file. HighGUI hides a few gems that might not be very well known. 💎 Snap to Window Border When developing algorithms, it is very common to open several windows and compare them. HighGUI cv::imshow is perfect for this. However, to compare two images the windows must be perfectly aligned. Luckily, on Windows, HighGUI windows automatically snap to the screen edges, so that it is easy to align and stack your image windows for pixel perfect alignment. 💎 Copy to Clipboard Sometimes you want to save the contents of a HighGUI window. You could take a screenshot (was it Alt+PrnScr? Ctrl+Cmd+Shift+4?), and even then, you often get the screen border and have to start cropping that out (see screenshot above). On Windows, just hit Ctrl+C and the image is copied to the system clipboard. 💡 Upon Ctrl+C cv::waitKey()returns 3. Ignore this value to avoid closing the window. 💎 Mouse Wheel Support HighGUI windows support the usual mouse events. On Windows, is also supports mouse-wheel events (both vertical and horizontal (where available)). The relevant events are EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL. The amount of scrolling is returned by getMouseWheelDelta(). Putting it all together (with a sprinkling of C++11) looks something like this: #include <iostream> #include <opencv2\highgui.hpp> #include <opencv2\opencv.hpp> int main(int argc, char* argv[]) { if (argc < 2) { std::cerr << "Usage: " << argv[0] << " <image file name>\n"; return EXIT_SUCCESS; } cv::Mat img = cv::imread(argv[1]); cv::imshow("image", img); cv::setMouseCallback("image", [](int event, int x, int y, int flags, void* userdata) { cv::Mat& image = *reinterpret_cast<cv::Mat*>(userdata); // get source image static cv::Mat tmp; // make static to avoid reallocations per call image.copyTo(tmp); // overwrite old image with fresh copy static int radius = 21; if (cv::EVENT_MOUSEWHEEL == event) radius = std::max(11, radius + cv::getMouseWheelDelta(flags) / 120); cv::circle(tmp, { x,y }, radius, { 255.,255.,255. }); // draw a circle around mouse position cv::imshow("image", tmp); }, &img); const auto CTRL_C = 3; while (CTRL_C == cv::waitKey()); // don't close on Ctrl-C return EXIT_SUCCESS; } Briefly, the code: - Loads an image with cv::imread(); - Displays it using cv::imshow; - Sets a mouse-callback via cv::setMouseCallback(): - Uses a non-capturing lambda which converts to a function pointer; - Passes the input image as userdata; - The lambda: - Makes a copy of the source image to draw on; - Captures the mouse wheel event and changes the circle radius based on the scroll amount and direction; - Draws the circle on the image and displays it. - Waits for keyboard inputs before exiting, but ignores Ctrl+C. Which results in this: Windows Only As you may have noticed, these particular gems are all Windows specific (I should know, I implemented them). Have you always wanted to contribute to an open source project? Got some GUI experience on various windowing platforms? Well, here’s your chance! OpenCV will gladly accept pull requests for more platforms. 💎 You can find the sample app on GitHub. Got more tips and gems, please share them with me in the comments below, Twitter or elsewhere! Acknowledgments: banner :: Lena
http://videocortex.io/2017/opencv-highgui-gems/
CC-MAIN-2020-16
refinedweb
631
63.8
How to Package TensorFlow Code You can launch a training operation with the command gcloud ml-engine jobs submit training. When you execute this, you can identify your source code with the --package-path and --module-name flags. The --package-path flag identifies the directory that contains your code, and this directory must meet the following requirements: - The directory must contain the module identified by --module-name. - The parent directory must have a file named setup.py. - Every directory under the parent directory must have a file named __init__.py. This file is usually empty. - The development system must have setuptoolsinstalled. This last point is important. Before uploading a package, the ML Engine uses setuptools to zip the parent directory into a *.tar.gz file. If you’ve installed pip, you can install setuptools with pip install setuptools. In a Python package, setup.py contains instructions for building and installing the package. If you want the ML Engine to install your package, setup.py must perform two operations: - Import setuptools.setup. - Call the setupfunction of the setuptoolsmodule. The setup function accepts a great deal of information about the package, including its name, version, and dependencies. The table lists nine of the parameters that you can set. Parameters of the setup Function Rather than list your package’s dependencies, you can call the find_packages provided by setuptools. This listing presents the content of the setup.py file: Setup Script for a Machine Learning Package from setuptools import find_packages from setuptools import setup REQUIRED_PACKAGES = ['tensorflow>=1.3'] setup( name='trainer', version='0.1', install_requires=REQUIRED_PACKAGES, packages=find_packages(), include_package_data=True, author='Matthew Scarpino' description='Running MNIST classification in the cloud' ) Sadly, the ML Engine doesn’t always have the latest versions of the packages installed. At the time of this writing, the current TensorFlow version is 1.4, but the default version supported by the ML Engine is 1.2. You can request a specific version of a package by setting the install_requires field. In the listing, this field requests a version of TensorFlow greater than or equal to 1.3. For more information on supported versions, visit this site.
https://www.dummies.com/web-design-development/other-web-software/package-tensorflow-code/
CC-MAIN-2019-30
refinedweb
357
50.63
Unable to build for Android - stddef.h not found Hey, guys. I'm new to HaxeFlixel (and Haxe in general) and I'm trying to build my test project for a few different platforms. I've tried Windows and Android, both of which worked wonderfully in the beginning. Windows still works, but Android does not. There's no rhyme or reason why, but sometimes when I attempt to build my game for Android, I get an error about stddef.h not being able to be found in my Android NDK path, so the build fails. I ran the "lime setup android" command and went through all the steps. I assume it was setup correctly because I was able to build for Android with no problem at first. I got my APK, put it on my phone, and it worked. I went through the process of making some changes to my project, rebuilding, repeat. It worked two or three times, but then the next time it failed and I was given this error: C:\Code\HAXE\HaxeFlixel\DungeonCrawlerTutorial>lime build android: C:\Users\Parker\AppData\Local\Android\ndk/platforms/android-9/arch-arm/usr/include/stdint.h:31:20: fatal error: stddef.h: No such file or directory #include <stddef.h> ^ compilation terminated. Error: error running arm-linux-androideabi-g++ -Iinclude --sysroot=C:\Users\Parker\AppData\Local\Android\ndk/platforms/android-9/arch-arm -IC:\Users\Parker\AppData\Local\Android\ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -IC:\Users\Parker\AppData\Local\Android\ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -IC:/HaxeToolkit/installs/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=9 -Wa,--noexecstack -O2 -DNDEBUG -c -Wno-invalid-offsetof -frtti -o C:/Code/HAXE/HaxeFlixel/DungeonCrawlerTutorial/export/android/obj/obj/android-v7/__pch/haxe/hxcpp.h.gch C:/HaxeToolkit/installs/hxcpp/3,3,49/include/hxcpp.h But nothing was changed. I deleted my Android NDK folder and reinstalled it and it started building again, but only a few times before the same error came up. What could be causing this and how can I fix it? Thanks for any help! Hey! I'm also new to HaxeFlixel, only tried compiling demos from flixel-demos to see if they're mobile compatible. After jumping through a few hoops I managed to get the Flixius project to work successfully on Android. From what I see your problem is a bit like mine: hxcpp (or is it NDK itself?) tries to search for a file within the library in the wrong location. The file in issue was libgcc.a, and I realized that all I needed to do was change the name of the folder where libgcc.a was (originally it was 4.9.x) to 4.9, and Haxe then successfully compiled. You could try searching inside the folder of Android NDK to find stddef.h, and copy the header file and see if it works (assuming it's inside the NDK somewhere else). Other than that, I dunno. Hey, thanks for the response! I actually came across that issue myself where I had to change the directory name, but this problem is separate from that one. It worked a few times after I changed the directory name, but then I started running into this issue. I found a version of stddef.h in the linux folder, so I tried copying that over just to see if it it helps, and then I got errors about stdarg.h missing. So I seems to be missing a few files and I have no idea why. I redownloaded Android NDK and these files aren't included in a fresh download either. So I'm at a complete loss and have no idea what the issue is. I guess this isn't a common issue because no one else seems to quite know what it is either. Maybe it's the SDK Tools and APIs? I have these installed: SDK Build Tools 19.1 SDK Buils Tools 23.0.3 SDK Tools 25.1.7 Android 4.1.2 (API 16) Android 4.4.2 (API 19) Android 6.0 (API 23) If I remember, Build Tools 19.1 and Android 4.4.2 (API 19) are needed and the latest SDK Tools. EDIT: You can set the paths manually without running openfl setup androidin .hxcpp_config.xml. I'm on Windows, so it's in my Users/Dean/ folder. Not sure abour Linux. Hope it helps. If not, you might try the OpenFL forums. @dean poker158149 is on Windows you can tell by "C:\Users\Parker" If he was on Linux it would be something like "/home/parker" @poker158149 This looks like the root of your issue:: Try running: lime clean android The other thing it might be is that you need to reinstall hxcpp @dean Thanks for the info, I do have all of the appropriate SDK's and such installed and working. I've used them before without issue, but I am new to using the NDK, which is where the problem seems to exist. @Israel I ran the clean commands and reinstalled hxcpp to make sure it was fresh, and no luck. It seems like it may be something related to the Android NDK. I'm new to using that and simply unzipped it and then pointed lime to it. Is there anything else I need to do in relation to Android NDK other than unzip it? Thanks for your help so far! UPDATE: I seemed to have figured out a potential fix for the issue and will share it for those who are interested. The version of Android NDK that I was using that kept giving me the issue was revision 12b. I decided to revert to an older version to see if it would help, so I reverted to revision 11c and it fixed the issues! I'm not sure if something's wrong with version 12 of Android NDK, but reverting back to version 11 seems to have solved my problems. Interesting. I guess perhaps the NDK r12b is way too 'new' where the devs for HaxeFlixel/OpenFL/Lime have not been able to fully check it and integrate all the necessary stuff. Considering that OpenFL still recommends r8b and does not officially support newer versions as shown in their page, you're OK. Already there's still the problem that HaxeFlixel 4.x series are not yet compatible with OpenFl 4.x and Lime 3.x series as well. We'll have to wait I guess. Although I'm intrigued at this since it didn't happen to me; the folder name change sufficed and I was able to compile the Flixius project successfully. I installed the Android Studio bundle (2.1.2) with the SDKs included for this. Did you do the same or it's just the SDKs that you have listed above? I kept thinking about the fact that HaxeFlixel uses older versions of OpenFL and Lime, and thought maybe it was those that wanted the older versions of the NDK. I did not install the Android Studio bundle, I only grabbed the raw SDKs. It is really interesting that it worked for you but not for me. Maybe the Android Studio bundle fixes whatever the issue is that I'm having with the raw SKD. Poker158149, for some reason, when I ran the Multitouch project on Flixel-Demos I was unable to compile and had the exact same error as you had. Since then I'm unable to compile any other project, despite me setting android to minimum-sdk-version at 18 and target-sdk-version at 23. I recall changing something else within the project file of Flixius, but I can't remember, and now I can't recompile it! Now I realize the fact that hxcpp forces to compile to android-9 by default when in fact it should compile to android-18 or android-23, because this error is encountered since android-9 is so old. I've been trying to find the code for this, but so far I've failed since I'm unable to find the exact file that forces android-9 to be used for compilation.
http://forum.haxeflixel.com/topic/151/unable-to-build-for-android-stddef-h-not-found
CC-MAIN-2021-10
refinedweb
1,415
65.93
Created on 2011-10-12 06:33 by grahamd, last changed 2013-02-04 17:09 by jcea. This issue is now closed.. Whoops. Missed the error. The fatal error that occurs is: Fatal Python error: Couldn't create autoTLSkey mapping Note that this doesn't apply to default: the problem is that 2.7 and 3.2 don't use native TLS, and with the ad-hoc TLS implementation, a NULL value isn't supported: """ /* Internal helper. * If the current thread has a mapping for key, the appropriate struct key* * is returned. NB: value is ignored in this case! * If there is no mapping for key in the current thread, then: * If value is NULL, NULL is returned. * Else a mapping of key to value is created for the current thread, * and a pointer to a new struct key* is returned; except that if * malloc() can't find room for a new struct key*, NULL is returned. * So when value==NULL, this acts like a pure lookup routine, and when * value!=NULL, this acts like dict.setdefault(), returning an existing * mapping if one exists, else creating a new mapping. """ So PyThread_set_key_value() has different semantics between 2.7/3.2 and default... > So _PyGILState_Reinit() is broken because it assumes that an auto > thread state will always exist for the thread for it to reinit, which > will not always be the case. Hmm... Please see """: """ I think you should be calling call PyGILState_Ensure() before (whoch does associate the thread state to the autoTLS key. I let Antoine answer, he's got much more experience than me. The PyGILState_Ensure() function is only for when working with the main interpreter. These external threads are not calling into the main interpreter. Because they are external threads, calling PyGILState_Ensure() and then PyGILState_Release() will cause a thread state to be created for the main interpreter, but it will also be destroyed on the PyGILState_Release(). The only way to avoid that situation and ensure that the thread state for the main interpreter is therefore maintained would be to call PyGILState_Ensure() and then call PyThreadState_Swap() to change to thread state for the sub interpreter. Problem is that you aren't supposed to use PyThreadState_Swap() any more and recollect that newer Python 3.X even prohibits it in some way through some checks. So, the documentation you quote is only to do with the main interpreter and is not how things work for sub interpreters. > So, the documentation you quote is only to do with the main > interpreter and is not how things work for sub interpreters. You're right, my bad. However, it would probably be better to destroy/reset the autoTLSkey even if the current thread doesn't have an associated TLS key (to avoid stumbling upon the original libc bug of issue #10517): """ void _PyGILState_Reinit(void) { PyThreadState *tstate = PyGILState_GetThisThreadState(); PyThread_delete_key(autoTLSkey); if ((autoTLSkey = PyThread_create_key()) == -1) Py_FatalError("Could not allocate TLS entry"); /* re-associate the current thread state with the new key */ if (tstate && PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) Py_FatalError("Couldn't create autoTLSkey mapping"); } """ Now that i think about it, the problem is even simpler: this patch shouldn't have been applied to 2.7 and 3.2, it was only relevant for native pthread TLS implementation (which does allow NULL values). So the solution would be simply to backout this patch on 2.7 and 3.2. > So the solution would be simply to backout this patch on 2.7 and 3.2. Actually, I just checked, and the native TLS implementation is present in 3.2, so this problem shouldn't show up: did you test it with 3.2? AFAICT, this should only affect 2.7 (for which this patch wasn't relevant). True. Doesn't appear to be an issue with Python 3.2.2. Only Python 2.7.2. I was not aware that the TLS mechanism was changed in Python 3.X so assumed would also affect it. So, looks like the change shouldn't have been applied to Python 2.7. How many moons before Python 2.7.3 though? > How many moons before Python 2.7.3 though? If you convince python-dev that's it's a critical bug (is it?) I suppose it could happen soon. New changeset ee4fe16d9b48 by Charles-François Natali in branch '2.7': Issue #13156: revert changeset f6feed6ec3f9, which was only relevant for native Here's a patch for 3.2 and default which calls PyThread_set_key_value() only if there was an auto thread state previously associated (while the current code works with pthread TLS, there are other implementations which may behave strangely, and there's still the ad-hoc implementation in Python/thread.c). New changeset 3313ce92cef7 by Charles-François Natali in branch '2.7': Issue #13156: Add an entry in Misc/NEWS. New changeset ba90839c4993 by Charles-François Natali in branch '3.2': Issue #13156: _PyGILState_Reinit(): Re-associate the auto thread state with the New changeset aa6ce09d2350 by Charles-François Natali in branch 'default': Issue #13156: _PyGILState_Reinit(): Re-associate the auto thread state with the Alright, should be fixed now. Graham, thanks for the report! Just FYI, I've lately been trying to track down a different threading-related bug, and I think the fix for this one also fixed that one by accident. Leave the following program running for a while under python-2.7.2: ---snip--- import subprocess import threading import random class Forkfuzz(threading.Thread): def run(self): while random.randint(0,100) > threading.active_count(): Forkfuzz().start() p = subprocess.Popen(['/bin/sleep', '1']) p.communicate() if __name__ == "__main__": while True: Forkfuzz().run() ---snip--- Eventually, you'll see a bunch of python process that are deadlocked in the following state: #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 #1 0x00000000004e02ad in PyThread_acquire_lock (lock=<value optimized out>, waitflag=<value optimized out>) at Python/thread_pthread.h:321 #2 0x00000000004e0447 in find_key (key=1, value=0x0) at Python/thread.c:268 #3 0x00000000004e053b in PyThread_get_key_value (key=38356064) at Python/thread.c:360 #4 0x00000000004cb2f8 in PyGILState_GetThisThreadState () at Python/pystate.c:598 #5 _PyGILState_Reinit () at Python/pystate.c:547 #6 0x00000000004e43f9 in PyOS_AfterFork () at ./Modules/signalmodule.c:979 ... The problem happens when one thread forks while another thread holds a lock on the TLS mutex. The child process then tries to acquire this mutex, and can never do so because the thread that holds it only exists in the parent. When the same program is run under python-2.7.3, the problem goes away.
http://bugs.python.org/issue13156
CC-MAIN-2017-09
refinedweb
1,086
66.64
CodePlexProject Hosting for Open Source Software Could be a crazy request, but... How could I modify the code to upload and process the files synchronously? I have set the max upload parameter to 1, but the processing still happens asynchronously. Thank you in advance That would not be possible with Silverlight. Silverlight only allows asynchronous communication with your web server. Though that seems like a "limitation" imposed on you by Silverlight, in this particular case at least, it is not much of a problem. File uploading is something that should arguably never be done synchronously -- it can take a long and/or unpredictable amount of time. It would be a bad user experience to freeze the UI while a file upload is in progress. I figured out the answer to my problem. First, let me modify my question: How can I process the files synchronously after they have been uploaded? I simply added "lock (typeof(IUploadedFileProcessor))" around the code inside my ProcessFile method. Thank you for your help and for the control. It has been a huge help If you would only like the server to process one file at a time, probably because you are accessing a shared resource on the server, a simple approach would be to use a lock in your custom file processor. public class ExampleFileProcessor : IUploadedFileProcessor { private static object _processingLock = new object(); #region IUploadedFileProcessor Members public void ProcessFile(HttpContext Context, string FileGuid, string FileName, string ContextParam) { string sandboxPath = Path.Combine(Sandbox.UploaderControlSandboxPath, FileGuid); using (FileStream fs = File.OpenRead(sandboxPath)) { // this code should only be entered by one thread at a time lock (_processingLock) { // do something useful to the file } } // for testing, this example just deletes the file from the sandbox after it has been uploaded; comment // out this line if you want to verify that files are being uploaded correctly while testing File.Delete(sandboxPath); } #endregion } Are you sure you want to delete this post? You will not be able to recover it later. Are you sure you want to delete this thread? You will not be able to recover it later.
http://silverlightuploader.codeplex.com/discussions/155545
CC-MAIN-2017-30
refinedweb
347
62.78
05 October 2012 04:30 [Source: ICIS news] SINGAPORE (ICIS)--Japanese producer Polyplastics plans to conduct maintenance at its 33,000 tonne/year polyoxymethylene (POM) or polyacetal plant in Kuantan, Malaysia in January next year, a company source said on Friday. The exact dates of the turnaround have yet to be fixed, the source said. Polyplastics has plans a near-fourfold capacity increase at the Kuantan plant to 123,000 tonnes/year by 2014. The company has four production bases for POM in Asia – at ?xml:namespace> POM has applications in fuel pump modules, sanitary equipment parts, DVD's mechanical components and cosmetic
http://www.icis.com/Articles/2012/10/05/9601262/japans-polyplastics-eyes-jan-13-turnaround-at-malaysia-pom-plant.html
CC-MAIN-2014-41
refinedweb
103
52.39
Source Flask-Script / docs / index.rst Flask-Script flaskext.script import Manager from myapp import app manager = Manager(app) @manager.command def hello(): print "hello" if __name__ == "__main__": manager.run() Once you define your script commands, you can then run them on the command line: python manage.py hello > hello Source code and issue tracking at Bitbucket. Installing Flask-Script Install with pip and easy_install: pip install Flask-Script or download the latest version from Bitbucket: hg clone cd flask-script python setup.py develop If you are using virtualenv, it is assumed that you are installing Flask-Script in the same virtualenv as your Flask application(s). Creating and running commands flaskext class - using the @command decorator - using the @option decorator To take a very simple example, we want to create a Hello command that just prints out "hello world". It doesn't take any arguments so is very straightforward: from flaskext -h -h option: python manage.py -h > Just say hello Finally, the @option decorator, again belonging to Manager can be used when you want more sophisticated control over your commands: @manager.option('-n', '--name', help='Your name') def hello(name): print "hello", name The @option decorator is explained in more detail below. Adding arguments to commands flaskext.script import Command, Manager, Option class Hello(Command): option_list = ( Option('--name', '-n', dest='name'), ) def run(self, name): print "hello %s" % name Positional and optional arguments are stored as Option instances - see the :ref: There are a couple of important points to note here. The short-form -n is formed from the first letter of the argument, so "name" > "-n". Therefore it's a good idea that your optional argument variable names begin with different letters. The second issue is that the -h switch always runs the help text for that command, so avoid arguments starting with the letter "h". Note also that if your optional argument is a boolean, for example: @manage hello joe -c dev.cfg hello JOE Assuming the USE_UPPERCASE setting is True in your dev.cfg file. Notice also that the "config" option is not passed to the command. In order for manager options to work you must pass a factory function, rather than a Flask instance, to your Manager constructor. Getting user input Flask-Script comes with a set of helper functions for grabbing user input from the command line. For example: from flaskext :ref:`api` below for details on the various prompt functions. Default commands Flask-Script has a couple of ready commands you can add and customise: Server and Shell. The Server command runs the Flask development server. It takes an optional port argument (default 5000): from flaskext -h for details on these. You can redefine the defaults in the constructor: server = Server(host="0.0.0.0", port=9000) Needless to say the development server is not intended for production use. The Shell command starts a Python shell. You can pass in a make_context argument, which must be a callable returning a dict. By default, this is just a dict returning the your Flask application instance: from flask import app from flaskext.script import Shell, Manager from myapp import app from myapp import models from myapp.models import db def _make_context(): return dict(app) Accessing local proxies The Manager runs the command inside a Flask test context. This means that you can access request-local proxies where appropriate, such as current_app, which may be used by extensions.
https://bitbucket.org/asksol/flask-script/src/998abd98d910/docs/index.rst
CC-MAIN-2016-07
refinedweb
575
64
On 07/06/07, Oshani Seneviratne <oshani@apache.org> wrote: > On 6/7/07, Ross Gardler <rgardler@apache.org> wrote: > >. ... > FWIW, I used TortoiseSVN to create the patch, and I trust it do the > job well because I have not had any problems in creating patches with > it in the past. That's your first mistake, using a GUI - never trust the little beggers (only half joking). > Anyway, I am really sorry for the extra trouble and the time you > wasted on going through my patch. No need to be sorry. People have cleared up after me in the past, this is just part of the pay back. Besides, knowing that we all makes mistakes is what makes us willing to clear up after other peoples. It's only when we don't learn that we need to be sorry (search the archives for how many times I've not set my SVN line endings correctly - I'm certainly sorry about that each. > > > > > Glad to do it. Hope changes to the > FORREST_HOME/site-author/content/xdocs/docs_0_90/howtohowto-buildPlugin.xml > would do the trick. Perfect. > >. > > > > > Thanks again for spotting these! > After removing the XHTML namespace the page was rendered properly. > <h1>s and <h2>s didn't seem to do any harm. Anyway, I will get rid of > those and use appropriate elements in their place to make it a valid > xdoc. They don't do any harm if you are rendering to HTML as these are valid HTML elements. But try creating, for example, a PDF and you'll see the harm. Thanks for your great work (and community engagement) so far. Ross
http://mail-archives.apache.org/mod_mbox/forrest-dev/200706.mbox/%3C61c9bc470706070842g6b4777b6w254f826ae9cc167b@mail.gmail.com%3E
CC-MAIN-2017-30
refinedweb
274
75.1
Results 1 to 5 of 5 - Join Date - Dec 2009 - 9 - Thanks - 3 - Thanked 0 Times in 0 Posts alternatives to the use of the eval function Hi - I wrote some code that uses the eval function. I am in the process of rewriting the code to improve on it where possible (a learning exercise). I have read that eval is evil because of security concerns and that the eval'd code is not compiled prior to runtime. I don't think my use of eval presents a security concern. However, I wonder if there is some way to replace the eval function with a more natural technique. I have done this using eval(); also using a new Function method. I have tried using a window[] method but I can't get that to work. OK, on the the actual code: The purpose of the javascript is to count keystrokes. I have a bunch of global counter variables declared in this fashion: Code: MyLib.CountQ=0; MyLib.CountW=0; MyLib.CountE=0; MyLib.CountR=0; MyLib.CountT=0; MyLib.CountY=0; MyLib.CountU=0; MyLib.CountI=0; MyLib.CountO=0; MyLib.CountP=0; Code: //MyLib is a global variable namespace. function Count() {//updates counters var varkeyname= specialchars(MyLib.KeyName);//identity of the key pressed. var stra="Count"+varkeyname;// string used to change an html value. //var strb=eval("MyLib.Count"+varkeyname+"+=1");//original eval function that worked just fine. var strb='return MyLib.Count'+varkeyname+'+=1';//string to update a counter. var myfunc= new Function(strb);//Function intended to replace the eval function - this also works just fine. document.getElementById(stra).value = myfunc(); ... This is not a critical issue but I'd appreciate any comments. Thanks, Jim Last edited by lbjvg; 12-15-2009 at 06:53 AM. - Code: MyLib.Count = []; ... MyLib.Count["Q"] = 0; MyLib.Count["W"] = 0; ... function Count() { var varkeyname= specialchars(MyLib.KeyName); ++MyLib.Count[varkeyname]; ... Code: <script> var Count = { "Q": 0, "W": 0, "E": 0, "R": 0, "T": 0, "Y": 0 } Count["Y"] += 17; ++Count["Q"]; var msg = ""; for ( var c in Count ) { msg += c + "::" + Count[c] + "\n"; } alert(msg); </script>Be yourself. No one else is as qualified. - Join Date - Jun 2007 - Location - Urbana - 4,650 - Thanks - 11 - Thanked 626 Times in 605 Posts Function() is arguably worse than eval, forget about it... Code: eval("MyLib.Count"+varkeyname+"+=1") Code: MyLib["Count"+varkeyname]+=1;Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com LOL! Right you are! Trust me to go around the mountain in the other direction. Well, I suspect mine would *barely* outperform that, but if he had to restructure other code clearly that's a winner.Be yourself. No one else is as qualified. - Join Date - Dec 2009 - 9 - Thanks - 3 - Thanked 0 Times in 0 Posts Excellent replies. This advances my understanding of syntax. The simpler solution was what I was hoping for right now since I can use it as is; but I may eventually decide to put the counter variables into an array or a list to make the code more compact. Thanks! - Jim Gallagher
https://www.codingforums.com/javascript-programming/184547-alternatives-use-eval-function.html
CC-MAIN-2017-47
refinedweb
526
74.08
Python 3.7 is officially released! This new Python version has been in development since September 2016,: - Easier access to debuggers through a new breakpoint()built-in - Simple class creation using data classes - Customized access to module attributes - Improved support for type hinting - Higher precision timing functions More importantly, Python 3.7 is fast. In the final sections of this article, you’ll read more about this speed, as well as some of the other cool features of Python 3.7. You will also get some advice on upgrading to the new version. The: def divide(e, f): return f / e a, b = 0, 1 print(divide(a, b)): def divide(e, f): # Insert breakpoint here return f / e A breakpoint is a signal inside your code that execution should temporarily stop, so that you can look around at the current state of the program. How do you place the breakpoint? In Python 3.6 and below, you use this somewhat cryptic line: def divide(e, f): import pdb; pdb.set_trace() return f / e Here, pdb is the Python Debugger from the standard library. In Python 3.7, you can use the new breakpoint() function call as a shortcut instead: def divide(e, f): breakpoint() return f / e(): $ python3.7 bugs.py > /home/gahjelle/bugs.py(3)divide() -> return f / e (Pdb): $ PYTHONBREAKPOINT=0 python3.7 bugs.py ZeroDivisionError: division by zero Oops, it seems as if you haven’t fixed the bug after all… Another option is to use PYTHONBREAKPOINT to specify a debugger other than PDB. For instance, to use PuDB (a visual debugger in the console) you can do: $ PYTHONBREAKPOINT=pudb.set_trace python3.7 bugs.py For this to work, you need to have pudb installed ( pip install pudb). Python will take care of importing pudb for you though. This way you can also set your default debugger. Simply set the PYTHONBREAKPOINT environment variable to your preferred debugger. See this guide for instructions on how to set an environment variable on your system. The new breakpoint() function does not only work with debuggers. One convenient option could be to simply start an interactive shell inside your code. For instance, to start an IPython session, you can use the following: $ PYTHONBREAKPOINT=IPython.embed python3.7 bugs.py IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: print(e / f) 0.0 You can also create your own function and have breakpoint() call that. The following code prints all variables in the local scope. Add it to a file called bp_utils.py: from pprint import pprint import sys def print_locals(): caller = sys._getframe(1) # Caller is 1 frame up. pprint(caller.f_locals) To use this function, set PYTHONBREAKPOINT as before, with the <module>.<function> notation: $ PYTHONBREAKPOINT=bp_utils.print_locals python3.7 bugs.py {'e': 0, 'f': 1} ZeroDivisionError: division by zero Normally, breakpoint() will be used to call functions and methods that do not need arguments. However, it is possible to pass arguments as well. Change the line breakpoint() in bugs.py to: breakpoint(e, f, end="<-ENDn") Note: The default PDB debugger will raise a TypeError at this line because pdb.set_trace()does not take any positional arguments. Run this code with breakpoint() masquerading as the print() function to see a simple example of the arguments being passed through: $ PYTHONBREAKPOINT=print python3.7 bugs.py 0 1<-END ZeroDivisionError: division by zero See PEP 553 as well as the documentation for breakpoint() and sys.breakpointhook() for more information. Data Classes The new dataclasses module makes it more convenient to write your own classes, as special methods like .__init__(), .__repr__(), and .__eq__() are added automatically. Using the @dataclass decorator, you can write something like: from dataclasses import dataclass, field @dataclass(order=True) class Country: name: str population: int area: float = field(repr=False, compare=False) coastline: float = 0 def beach_per_person(self): """Meters of coastline per person""" return (self.coastline * 1000) / self.population These nine lines of code stand in for quite a bit of boilerplate code and best practices. Think about what it would take to implement Country as a regular class: the .__init__() method, a repr, six different comparison methods as well as the .beach_per_person() method. You can expand the box below to see an implementation of Country that is roughly equivalent to the data class: After creation, a data class is a normal class. You can, for instance, inherit from a data class in the normal way. The main purpose of data classes is to make it quick and easy to write robust classes, in particular small classes that mainly store data. You can use the Country data class like any other class: >>> norway = Country("Norway", 5320045, 323802, 58133) >>> norway Country(name='Norway', population=5320045, coastline=58133) >>> norway.area 323802 >>> usa = Country("United States", 326625791, 9833517, 19924) >>> nepal = Country("Nepal", 29384297, 147181) >>> nepal Country(name='Nepal', population=29384297, coastline=0) >>> usa.beach_per_person() 0.06099946957342386 >>> norway.beach_per_person() 10.927163210085629 Note that all the fields .name, .population, .area, and .coastline are used when initializing the class (although .coastline is optional, as is shown in the example of landlocked Nepal). The Country class has a reasonable repr, while defining methods works the same as for regular classes. By default, data classes can be compared for equality. Since we specified order=True in the @dataclass decorator, the Country class can also be sorted: >>> norway == norway True >>> nepal == usa False >>> sorted((norway, usa, nepal)) [Country(name='Nepal', population=29384297, coastline=0), Country(name='Norway', population=5320045, coastline=58133), Country(name='United States', population=326625791, coastline=19924)] The sorting happens on the field values, first .name then .population, and so on. However, if you use field(), you can customize which fields will be used in the comparison. In the example, the .area field was left out of the repr and the comparisons. Note: The country data are from the CIA World Factbook with population numbers estimated for July 2017. Before you all go book your next beach holidays in Norway, here is what the Factbook says about the Norwegian climate: “temperate along coast, modified by North Atlantic Current; colder interior with increased precipitation and colder summers; rainy year-round on west coast.” Data classes do some of the same things as namedtuple. Yet, they draw their biggest inspiration from the attrs project. See our full guide to data classes for more examples and further information, as well as PEP 557 for the official description. Customization of Module Attributes Attributes are everywhere in Python! While class attributes are probably the most famous, attributes can actually be put on essentially anything—including functions and modules. Several of Python’s basic features are implemented as attributes: most of the introspection functionality, doc-strings, and name spaces. Functions inside a module are made available as module attributes. Attributes are most often retrieved using the dot notation: thing.attribute. However, you can also get attributes that are named at runtime using getattr(): import random random_attr = random.choice(("gammavariate", "lognormvariate", "normalvariate")) random_func = getattr(random, random_attr) print(f"A {random_attr} random value: {random_func(1, 1)}") Running this code will produce something like: A gammavariate random value: 2.8017715125270618 For classes, calling thing.attr will first look for attr defined on thing. If it is not found, then the special method thing.__getattr__("attr") is called. (This is a simplification. See this article for more details.) The .__getattr__() method can be used to customize access to attributes on objects. Until Python 3.7, the same customization was not easily available for module attributes. However, PEP 562 introduces __getattr__() on modules, together with a corresponding __dir__() function. The __dir__() special function allows customization of the result of calling dir() on a module. The PEP itself gives a few examples of how these functions can be used, including adding deprecation warnings to functions and lazy loading of heavy submodules. Below, we will build a simple plugin system that allows functions to be added to a module dynamically. This example takes advantage of Python packages. See this article if you need a refresher on packages. Create a new directory, plugins, and add the following code to a file, plugins/__init__.py: from importlib import import_module from importlib import resources PLUGINS = dict() def register_plugin(func): """Decorator to register plug-ins""" name = func.__name__ PLUGINS[name] = func return func def __getattr__(name): """Return a named plugin""" try: return PLUGINS[name] except KeyError: _import_plugins() if name in PLUGINS: return PLUGINS[name] else: raise AttributeError( f"module {__name__!r} has no attribute {name!r}" ) from None def __dir__(): """List available plug-ins""" _import_plugins() return list(PLUGINS.keys()) def _import_plugins(): """Import all resources to register plug-ins""" for name in resources.contents(__name__): if name.endswith(".py"): import_module(f"{__name__}.{name[:-3]}") Before we look at what this code does, add two more files inside the plugins directory. First, let’s see plugins/plugin_1.py: from . import register_plugin @register_plugin def hello_1(): print("Hello from Plugin 1") Next, add similar code in the file plugins/plugin_2.py: from . import register_plugin @register_plugin def hello_2(): print("Hello from Plugin 2") @register_plugin def goodbye(): print("Plugin 2 says goodbye") These plugins can now be used as follows: >>> import plugins >>> plugins.hello_1() Hello from Plugin 1 >>> dir(plugins) ['goodbye', 'hello_1', 'hello_2'] >>> plugins.goodbye() Plugin 2 says goodbye This may not all seem that revolutionary (and it probably isn’t), but let’s look at what actually happened here. Normally, to be able to call plugins.hello_1(), the hello_1() function must be defined in a plugins module or explicitly imported inside __init__.py in a plugins package. Here, it is neither! Instead, hello_1() is defined in an arbitrary file inside the plugins package, and hello_1()becomes a part of the plugins package by registering itself using the @register_plugin decorator. The difference is subtle. Instead of the package dictating which functions are available, the individual functions register themselves as part of the package. This gives you a simple structure where you can add functions independently of the rest of the code without having to keep a centralized list of which functions are available. Let us do a quick review of what __getattr__() does inside the plugins/__init__.py code. When you asked for plugins.hello_1(), Python first looks for a hello_1() function inside the plugins/__init__.py file. As no such function exists, Python calls __getattr__("hello_1") instead. Remember the source code of the __getattr__() function: def __getattr__(name): """Return a named plugin""" try: return PLUGINS[name] # 1) Try to return plugin except KeyError: _import_plugins() # 2) Import all plugins if name in PLUGINS: return PLUGINS[name] # 3) Try to return plugin again else: raise AttributeError( # 4) Raise error f"module {__name__!r} has no attribute {name!r}" ) from None __getattr__() contains the following steps. The numbers in the following list correspond to the numbered comments in the code: - First, the function optimistically tries to return the named plugin from the PLUGINSdictionary. This will succeed if a plugin named nameexists and has already been imported. - If the named plugin is not found in the PLUGINSdictionary, we make sure all plugins are imported. - Return the named plugin if it has become available after the import. - If the plugin is not in the PLUGINSdictionary after importing all plugins, we raise an AttributeErrorsaying that nameis not an attribute (plugin) on the current module. How is the PLUGINS dictionary populated though? The _import_plugins() function imports all Python files inside the plugins package, but does not seem to touch PLUGINS: def _import_plugins(): """Import all resources to register plug-ins""" for name in resources.contents(__name__): if name.endswith(".py"): import_module(f"{__name__}.{name[:-3]}") Don’t forget that each plugin function is decorated by the @register_plugin decorator. This decorator is called when the plugins are imported and is the one actually populating the PLUGINSdictionary. You can see this if you manually import one of the plugin files: >>> import plugins >>> plugins.PLUGINS {} >>> import plugins.plugin_1 >>> plugins.PLUGINS {'hello_1': <function hello_1 at 0x7f29d4341598>} Continuing the example, note that calling dir() on the module also imports the remaining plugins: >>> dir(plugins) ['goodbye', 'hello_1', 'hello_2'] >>> plugins.PLUGINS {'hello_1': <function hello_1 at 0x7f29d4341598>, 'hello_2': <function hello_2 at 0x7f29d4341620>, 'goodbye': <function goodbye at 0x7f29d43416a8>} dir() usually lists all available attributes on an object. Normally, using dir() on a module results in something like this: >>> import plugins >>> dir(plugins) ['PLUGINS', '__builtins__', '__cached__', '__doc__', '__file__', '__getattr__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_import_plugins', 'import_module', 'register_plugin', 'resources'] While this might be useful information, we are more interested in exposing the available plugins. In Python 3.7, you can customize the result of calling dir() on a module by adding a __dir__()special function. For plugins/__init__.py, this function first makes sure all plugins have been imported and then lists their names: def __dir__(): """List available plug-ins""" _import_plugins() return list(PLUGINS.keys()) Before leaving this example, please note that we also used another cool new feature of Python 3.7. To import all modules inside the plugins directory, we used the new importlib.resources module. This module gives access to files and resources inside modules and packages without the need for __file__ hacks (which do not always work) or pkg_resources (which is slow). Other features of importlib.resources will be highlighted later. Typing Enhancements Type hinting and annotations have been in constant development throughout the Python 3 series of releases. Python’s typing system is now quite stable. Still, Python 3.7 brings some enhancements to the table: better performance, core support, and forward references. Python does not do any type checking at runtime (unless you are explicitly using packages like enforce). Therefore, adding type hints to your code should not affect its performance. Unfortunately, this is not completely true as most type hints need the typing module. The typingmodule is one of the slowest modules in the standard library. PEP 560 adds some core support for typing in Python 3.7, which significantly speeds up the typing module. The details of this are in general not necessary to know about. Simply lean back and enjoy the increased performance. While Python’s type system is reasonably expressive, one issue that causes some pain is forward references. Type hints—or more generally annotations—are evaluated while the module is imported. Therefore, all names must already be defined before they are used. The following is not possible: class Tree: def __init__(self, left: Tree, right: Tree) -> None: self.left = left self.right = right Running the code raises a NameError because the class Tree is not yet (completely) defined in the definition of the .__init__() method: Traceback (most recent call last): File "tree.py", line 1, in <module> class Tree: File "tree.py", line 2, in Tree def __init__(self, left: Tree, right: Tree) -> None: NameError: name 'Tree' is not defined To overcome this, you would have needed to write "Tree" as a string literal instead: class Tree: def __init__(self, left: "Tree", right: "Tree") -> None: self.left = left self.right = right See PEP 484 for the original discussion. In a future Python 4.0, such so called forward references will be allowed. This will be handled by not evaluating annotations until that is explicitly asked for. PEP 563 describes the details of this proposal. In Python 3.7, forward references are already available as a __future__ import. You can now write the following: from __future__ import annotations class Tree: def __init__(self, left: Tree, right: Tree) -> None: self.left = left self.right = right Note that in addition to avoiding the somewhat clumsy "Tree" syntax, the postponed evaluation of annotations will also speed up your code, since type hints are not executed. Forward references are already supported by mypy. By far, the most common use of annotations is type hinting. Still, you have full access to the annotations at runtime and can use them as you see fit. If you are handling annotations directly, you need to deal with the possible forward references explicitly. Let us create some admittedly silly examples that show when annotations are evaluated. First we do it old-style, so annotations are evaluated at import time. Let anno.py contain the following code: def greet(name: print("Now!")): print(f"Hello {name}") Note that the annotation of name is print(). This is only to see exactly when the annotation is evaluated. Import the new module: >>> import anno Now! >>> anno.greet.__annotations__ {'name': None} >>> anno.greet("Alice") Hello Alice As you can see, the annotation was evaluated at import time. Note that name ends up annotated with None because that is the return value of print(). Add the __future__ import to enable postponed evaluation of annotations: from __future__ import annotations def greet(name: print("Now!")): print(f"Hello {name}") Importing this updated code will not evaluate the annotation: >>> import anno >>> anno.greet.__annotations__ {'name': "print('Now!')"} >>> anno.greet("Marty") Hello Marty Note that Now! is never printed and the annotation is kept as a string literal in the __annotations__dictionary. In order to evaluate the annotation, use typing.get_type_hints() or eval(): >>> import typing >>> typing.get_type_hints(anno.greet) Now! {'name': <class 'NoneType'>} >>> eval(anno.greet.__annotations__["name"]) Now! >>> anno.greet.__annotations__ {'name': "print('Now!')"} Observe that the __annotations__ dictionary is never updated, so you need to evaluate the annotation every time you use it. Timing Precision In Python 3.7, the time module gains some new functions as described in PEP 564. In particular, the following six functions are added: clock_gettime_ns(): Returns the time of a specified clock clock_settime_ns(): Sets the time of a specified clock monotonic_ns(): Returns the time of a relative clock that cannot go backwards (for instance due to daylight savings) perf_counter_ns(): Returns the value of a performance counter—a clock specifically designed to measure short intervals process_time_ns(): Returns the sum of the system and user CPU time of the current process (not including sleep time) time_ns(): Returns the number of nanoseconds since January 1st 1970 In a sense, there is no new functionality added. Each function is similar to an already existing function without the _ns suffix. The difference being that the new functions return a number of nanoseconds as an int instead of a number of seconds as a float. For most applications, the difference between these new nanosecond functions and their old counterpart will not be appreciable. However, the new functions are easier to reason about because they rely on int instead of float. Floating point numbers are by nature inaccurate: >>> 0.1 + 0.1 + 0.1 0.30000000000000004 >>> 0.1 + 0.1 + 0.1 == 0.3 False This is not an issue with Python but rather a consequence of computers needing to represent infinite decimal numbers using a finite number of bits. A Python float follows the IEEE 754 standard and uses 53 significant bits. The result is that any time greater than about 104 days (2⁵³ or approximately 9 quadrillion nanoseconds) cannot be expressed as a float with nanosecond precision. In contrast, a Python int is unlimited, so an integer number of nanoseconds will always have nanosecond precision independent of the time value. As an example, time.time() returns the number of seconds since January 1st 1970. This number is already quite big, so the precision of this number is at the microsecond level. This function is the one showing the biggest improvement in its _ns version. The resolution of time.time_ns() is about 3 times better than for time.time(). What is a nanosecond by the way? Technically, it is one billionth of a second, or 1e-9 second if you prefer scientific notation. These are just numbers though and do not really provide any intuition. For a better visual aid, see Grace Hopper’s wonderful demonstration of the nanosecond. As an aside, if you need to work with datetimes with nanosecond precision, the datetime standard library will not cut it. It explicitly only handles microseconds: >>> from datetime import datetime, timedelta >>> datetime(2018, 6, 27) + timedelta(seconds=1e-6) datetime.datetime(2018, 6, 27, 0, 0, 0, 1) >>> datetime(2018, 6, 27) + timedelta(seconds=1e-9) datetime.datetime(2018, 6, 27, 0, 0) Instead, you can use the astropy project. Its astropy.time package represents datetimes using two float objects which guarantees “sub-nanosecond precision over times spanning the age of the universe.” >>> from astropy.time import Time, TimeDelta >>> Time("2018-06-27") <Time object: scale='utc' format='iso' value=2018-06-27 00:00:00.000> >>> t = Time("2018-06-27") + TimeDelta(1e-9, format="sec") >>> (t - Time("2018-06-27")).sec 9.976020010071807e-10 The latest version of astropy is available in Python 3.5 and later. Other Pretty Cool Features So far, you have seen the headline news regarding what’s new in Python 3.7. However, there are many other changes that are also pretty cool. In this section, we will look briefly at some of them. The Order of Dictionaries Is Guaranteed The CPython implementation of Python 3.6 has ordered dictionaries. (PyPy also has this.) This means that items in dictionaries are iterated over in the same order they were inserted. The first example is using Python 3.5, and the second is using Python 3.6: >>> {"one": 1, "two": 2, "three": 3} # Python <= 3.5 {'three': 3, 'one': 1, 'two': 2} >>> {"one": 1, "two": 2, "three": 3} # Python >= 3.6 {'one': 1, 'two': 2, 'three': 3} In Python 3.6, this ordering was just a nice consequence of that implementation of dict. In Python 3.7, however, dictionaries preserving their insert order is part of the language specification. As such, it may now be relied on in projects that support only Python >= 3.7 (or CPython >= 3.6). “ async” and “ await” Are Keywords Python 3.5 introduced coroutines with async and await syntax. To avoid issues of backwards compatibility, async and await were not added to the list of reserved keywords. In other words, it was still possible to define variables or functions named async and await. In Python 3.7, this is no longer possible: >>> async = 1 File "<stdin>", line 1 async = 1 ^ SyntaxError: invalid syntax >>> def await(): File "<stdin>", line 1 def await(): ^ SyntaxError: invalid syntax “ asyncio” Face Lift The asyncio standard library was originally introduced in Python 3.4 to handle concurrency in a modern way using event loops, coroutines and futures. Here is a gentle introduction. In Python 3.7, the asyncio module is getting a major face lift, including many new functions, support for the context variables (see below), and performance improvements. Of particular note is asyncio.run(), which simplifies calling coroutines from synchronous code. Using asyncio.run(), you do not need to explicitly create the event loop. An asynchronous Hello World program can now be written: import asyncio async def hello_world(): print("Hello World!") asyncio.run(hello_world()) Context Variables Context variables are variables that can have different values depending on their context. They are similar to Thread-Local Storage in which each execution thread may have a different value for a variable. However, with context variables, there may be several contexts in one execution thread. The main use case for context variables is keeping track of variables in concurrent asynchronous tasks. The following example constructs three contexts, each with their own value for the value name. The greet() function is later able to use the value of name inside each context: import contextvars name = contextvars.ContextVar("name") contexts = list() def greet(): print(f"Hello {name.get()}") # Construct contexts and set the context variable name for first_name in ["Steve", "Dina", "Harry"]: ctx = contextvars.copy_context() ctx.run(name.set, first_name) contexts.append(ctx) # Run greet function inside each context for ctx in reversed(contexts): ctx.run(greet) Running this script greets Steve, Dina, and Harry in reverse order: $ python3.7 context_demo.py Hello Harry Hello Dina Hello Steve Importing Data Files With “ importlib.resources“ One challenge when packaging a Python project is deciding what to do with project resources like data files needed by the project. A few options have commonly been used: - Hard-code a path to the data file. - Put the data file inside the package and locate it using __file__. - Use setuptools.pkg_resourcesto access the data file resource. Each of these have their shortcomings. The first option is not portable. Using __file__ is more portable, but if the Python project is installed it might end up inside a zip and not have a __file__attribute. The third option solves this problem, but is unfortunately very slow. A better solution is the new importlib.resources module in the standard library. It uses Python’s existing import functionality to also import data files. Assume you have a resource inside a Python package like this: data/ │ ├── alice_in_wonderland.txt └── __init__.py Note that data needs to be a Python package. That is, the directory needs to contain an __init__.py file (which may be empty). You can then read the alice_in_wonderland.txt file as follows: >>> from importlib import resources >>> with resources.open_text("data", "alice_in_wonderland.txt") as fid: ... alice = fid.readlines() ... >>> print("".join(alice[?’ A similar resources.open_binary() function is available for opening files in binary mode. In the earlier “plugins as module attributes” example, we used importlib.resources to discover the available plugins using resources.contents(). See Barry Warsaw’s PyCon 2018 talk for more information. It is possible to use importlib.resources in Python 2.7 and Python 3.4+ through a backport. A guide on migrating from pkg_resources to importlib.resources is available. Developer Tricks Python 3.7 has added several features aimed at you as a developer. You have already seen the new breakpoint() built-in. In addition, a few new -X command line options have been added to the Python interpreter. You can easily get an idea of how much time the imports in your script takes, using -X importtime: $ python3.7 -X importtime my_script.py import time: self [us] | cumulative | imported package import time: 2607 | 2607 | _frozen_importlib_external ... import time: 844 | 28866 | importlib.resources import time: 404 | 30434 | plugins The cumulative column shows the cumulative time of import (in microseconds). In this example, importing plugins took about 0.03 seconds, most of which was spent importing importlib.resources. The self column shows the import time excluding nested imports. You PEP 540.) In this mode, UTF-8 will be used for text encoding regardless of the current locale. Optimizations Each new release of Python comes with a set of optimizations. In Python 3.7, there are some significant speed-ups, including: - There is less overhead in calling many methods in the standard library. - Method calls are up to 20% faster in general. - The startup time of Python itself is reduced by 10-30%. - Importing typingis 7 times faster. In addition, many more specialized optimizations are included. See this list for a detailed overview. The upshot of all these optimizations is that Python 3.7 is fast. It is simply the fastest version of CPython released so far. So, Should I Upgrade? __getattr__() on modules,. See the Porting to Python 3.7 guide for details to be aware of when upgrading. Source: realpython
https://learningactors.com/cool-new-features-in-python-3-7/
CC-MAIN-2018-51
refinedweb
4,503
58.69
Welcome to the world of python. Here we are going to make a basic guessing game. Enjoy! Teacher Notes Teachers! Did you use this instructable in your classroom? Add a Teacher Note to share how you incorporated it into your lesson. Step 1: Download Python 2.7, NOT 3.x First you have to download python 2.7 from python's official site.... Don't download it from other sites, they sometimes might insert some form of malware in it. Download your specific version your operating system. Also, download the latest version of python 2.7.x that there is. It will make no difference at all. Go through the installation process. Congratulations, you completed step 1!!! Step 2: Starting Your Guessing Game Now that you have Python 2.7.x installed, you can start making the guessing game. Open a python shell. You should have something that looks similar to what I have shown above. Now we can start making the game. Step 3: The Start So, you have your shell open now. Great, let's start now. Go to file, new file, and click that. You should now have a blank space where you can start typing. Then type exactly what I have. code: import random import time So what we are doing is asking python to bring some things in. You can probably guess that importing random will help us design the part where a random number is chosen. The import time is just once you finish the game, it will close after a certain amount of time. Good job so far! Step 4: Using Variables So far you should have import random import time This is good. Now we are going to set the random part. Type this exactly code: num = random.randint(1, 101) What this is doing is setting a variable that is a random integer between, 1-100. "But Jason, it says 1, 101." Well yes it does, but python does it up to 101, not over. So this means you have to go one over the range you want, if that makes any sense. This is same with loops, (if you want to learn python, you will learn about this later) Step 5: Making Important Things So now, you should have this so far import random import time num = random.randint(1, 101) Now we are going to add more code. Here is what we are going to add: code: while True: print 'Guess a number between 1 and 100' guess = input() i = int(guess) Now you have to have the stuff below while True indented. You also need a colon too. What this piece of code is saying is print Guess a number between 1 and 100. That is what the user will see when we run this program. next we set a variable called guess to take input from a user Then we set another variable that is called i that turns the user's input to a integer. You see, when you type in something, it is always a string. So if you didn't convert it, python would give you an error. Now that it is an integer, we can start using it. Great job so far!!! Step 6: Final Steps So you've made it this far! That's great. This is what you should have so far: Code: import random import time num = random.randint(1, 101) while True: print 'Guess a number between 1 and 100' guess = input() i = int(guess) if i == num: print 'You guessed right!' print 'This window will close in 5 seconds now.' time.sleep(5) break # that pound symbol is a comment by the way, don't put this in the code. I can't indent here for some reason so just look at the picture I provided to see how I did it. I do apologize. elif i < num: print 'Try Higher' elif i > num: print 'Try lower' What this does is if you guessed the exact number, it will say you guessed right! It will close in 5 seconds. elif is if you didn't guess right and then if the number was smaller that what you said, it said go lower, etc. Now lets go to the final step... Step 7: Ending It So here is the final code Look at the picture in the previous step, it shows it much better! So now you just finished your guessing game. So here it is. Lets try it. Type in power-shell if you are in windows. You also should save this to your desktop. Then I will show you how to do it! So first I change directories with (cd) then desktop. Then type python whateveryounamedit.py Then go ahead and try it. Have fun with your guessing game. Thanks for viewing my tutorial. I hope you enjoyed it! 6 Discussions 2 years ago Can you code for generating random images which are in the form of .gif or .png like in a picture guessing game? 3 years ago Nice tutorial, it is works, Thanks, Reply 3 years ago Thanks NikolozS, stay tuned for more tutorials in coding! 3 years ago Thank you for the tip ThomasK19. I didn't think I could indent here. Does the tutorial still work though? I assume it will still work, if you see the pictures too. 3 years ago Looks cool. Clear and specific! I am excited to see your next instructable! 3 years ago This looks like fun!
https://www.instructables.com/id/How-to-Make-a-Python-Guessing-Game/
CC-MAIN-2019-35
refinedweb
919
85.99
In this chapter we begin by outlining the basic processes you need to go through in order to compile your C (or C++) programs. We then proceed to formally describe the C compilation model and also how C supports additional libraries. The stages of developing your C program are as follows. (See Appendix and exercises for more info.) Create a file containing the complete program, such as the above example. You can use any ordinary editor with which you are familiar to create the file. One such editor is textedit available on most UNIX systems. The filename must by convention end ``.c'' (full stop, lower case c), e.g. myprog.c or progtest.c. The contents must obey C syntax. For example, they might be as in the above example, starting with the line /* Sample .... (or a blank line preceding it) and ending with the line } /* end of program */ (or a blank line following it). There are many C compilers around. The cc being the default Sun compiler. The GNU C compiler gcc is popular and available for many platforms. PC users may also be familiar with the Borland bcc compiler. There are also equivalent C++ compilers which are usually denoted by CC (note upper case CC. For example Sun provides CC and GNU GCC. The GNU compiler is also denoted by g++ Other (less common) C/C++ compilers exist. All the above compilers operate in essentially the same manner and share many common command line options. Below and in Appendix we list and give example uses many of the common compiler options. However, the best source of each compiler is through the online manual pages of your system: e.g. man cc. For the sake of compactness in the basic discussions of compiler operation we will simply refer to the cc compiler -- other compilers can simply be substituted in place of cc unless otherwise stated. To Compile your program simply invoke the command cc. The command must be followed by the name of the (C) program you wish to compile. A number of compiler options can be specified also. We will not concern ourselves with many of these options yet, some useful and often essential options are introduced below -- See Appendix or online manual help for further details. Thus, the basic compilation command is: cc cc -o program program.c which puts the compiled program into the file program (or any file you name following the "-o" argument) instead of putting it in the file a.out . The. We will briefly highlight key features of the C Compilation model (Fig. 2.1) here. Fig. 2.1 The C Compilation Model We will study this part of the compilation process in greater detail later (Chapter 13. However we need some basic information for some C programs. The Preprocessor accepts source code as input and is responsible for For example The C compiler translates source to assembly code. The source code is received from the preprocessor. The assembler creates object code. On a UNIX system you may see files with a .o suffix (.OBJ on MSDOS) to indicate object code files. If a source file references library functions or functions defined in other source files the link editor combines these functions (with main()) to create an executable file. External Variable references resolved here also. More on this later (Chapter 34). Now that we have a basic understanding of the compilation model we can now introduce some useful and sometimes essential common compiler options. Again see the online man pages and Appendix for further information and additional options. cc file1.o file2.o ...... -o executable cc calc.c -o calc -lm Many other libraries are linked in this fashion (see below) cc prog.c -L/home/myname/mylibs mylib.a BY default, The preprocessor first searches for #include files in the directory containing source file, then in directories named with -I options (if any), and finally, in /usr/include. So to include header files stored in /home/myname/myheaders you would do: cc prog.c -I/home/myname/myheaders Note: System library header files are stored in a special place (/usr/include) and are not affected by the -I option. System header files and user header files are included in a slightly different manner (see Chapters 13 and 34) For further information on general compiler options and the GNU compiler refer to Appendix . C is an extremely small language. Many of the functions of other languages are not included in C. e.g. No built in I/O, string handling or maths functions. What use is C then? C provides functionality through a rich set function libraries. As a result most C implementations include standard libraries of functions for many facilities ( I/O etc.). For many practical purposes these may be regarded as being part of C. But they may vary from machine to machine. (cf Borland C for a PC to UNIX C). A programmer can also develop his or her own function libraries and also include special purpose third party libraries (e.g. NAG, PHIGS). All libraries (except standard I/O) need to be explicitly linked in with the -l and, possibly, -L compiler options described above. The UNIX system provides a large number of C functions as libraries. Some of these implement frequently used operations, while others are very specialised in their application. Do Not Reinvent Wheels: It is wise for programmers to check whether a library function is available to perform a task before writing their own version. This will reduce program development time. The library functions have been tested, so they are more likely to be correct than any function which the programmer might write. This will save time when debugging the program. Later chapters deal with all important standard library issues and other common system libraries. The sqrt): man 3 sqrt If you don't know the name of the function, a full list is included in the introductory page for section 3 of the manual. To read this, type man 3 intro There(). You will soon discover (if you have not already) that the C compiler is pretty vague in many aspects of checking program correctness, particularly in type checking. Careful use of prototyping of functions can assist modern C compilers in this task. However, There is still no guarantee that once you have successfully compiled your program that it will run correctly. The UNIX utility lint can assist in checking for a multitude of programming errors. Check out the online manual pages (man lint) for complete details of lint. It is well worth the effort as it can help save many hours debugging your C code. To run lint simply enter the command: lint myprog.c. Lint is particularly good at checking type checking of variable and function assignments, efficiency, unused variables and function identifiers, unreachable code and possibly memory leaks. There are many useful options to help control lint (see man lint). Exercise 12171 Enter, compile and run the following program: main() { int i; printf("\t Number \t\t Square of Number\n\n"); for (i=0; i<=25;++i) printf("\t %d \t\t\t %d \n",i,i*i); } Exercise 12172 The following program uses the math library. Enter compile and run it correctly. #include <math.h> main() { int i; printf("\t Number \t\t Square Root of Number\n\n"); for (i=0; i<=360; ++i) printf("\t %d \t\t\t %d \n",i, sqrt((double) i)); } Exercise 12173 Look in /lib and /usr/lib and see what libraries are available. Exercise 12174 Look in /usr/include and see what header files are available. Exercise 12175 Suppose you have a C program whose main function is in main.c and has other functions in the files input.c and output.c: Exercise 12176 Suppose you have a C program composed of several separate files, and they include one another as shown below:
http://www.cs.cf.ac.uk/Dave/C/node3.html
CC-MAIN-2014-10
refinedweb
1,323
65.22
. Note that typedef names that alias a direct base will work in the same way, and it is even possible to mix and match names either side of the ::. For example:; struct derived : base { typedef base inherited; }; Change 7.3.3 namespace.udecl paragraph 1 as follows ] Moreover, if a using-declaration names a constructor (3.4.3.1 class.qual), it implicitly declares a set of constructors in the class in which the using-declaration appears (12.9 class.fwd): For using-declarations that name a constructor, see 12.9 class.fwd. [Note: Since constructors do not have names, these access rules do not apply to constructors, see 12.9 class.fwd] ..::T; ~D() { clog << "Destroying wrapper" << endl; } }; with no arguments is implicitly declared. ...
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2203.html
crawl-001
refinedweb
125
64.1
02 February 2009 08:42 [Source: ICIS news] By Bohan Loh SINGAPORE (ICIS news)--Equate Petrochemical Co (Equate) has announced on Monday another delay in the start-up of its Shuaiba, Kuwait projects to the third quarter of 2009. This is the fourth time since October 2008 that Equate will be pushing back the expansion of its polyethylene (PE) facility in Shuaiba. Last month, ICIS news reported that the project start-up would be delayed to May 2009 due to contracting problems. The capacity of Equate’s high density PE (HDPE) /linear low density PE (LLDPE) swing plant was supposed to be increased 50% to 900,000 tonnes/year under the plan. Equate is a joint venture between ?xml:namespace> The company added that Kuwait Aromatics’ (KARO) 820,000 tonne/year paraxylene (PX) and 395,000 tonne/year benzene units at the same site would also be delayed to the third quarter of the year from the previously targeted June 2009. The PX produced at the site is intended for exports, while the benzene output will be used for captive purposes by Kuwait Styrene’s ethylbenzene and styrene monomer (SM) plant that is due to come on-stream in the second half of 2009. Kuwait Styrene is also a joint venture of PIC and Dow
http://www.icis.com/Articles/2009/02/02/9189138/equate-delays-shuaiba-projects-start-up-to-q3-09.html
CC-MAIN-2014-52
refinedweb
215
62.92
An http/https client library that works with asyncore/asynchat Project description Origin This package was originally written as a sort of proof-of-concept github gist on December 25, 2011 by Josiah Carlson. This updated package is copyright 2012, and is released under the GNU LGPL v2.1 license. Description This package offers the ability to connect to http servers via the asyncore and asynchat modules, in an attempt to download files, or otherwise integrate connecting to other services from within asyncore-derived services. Download Files - The included async_http.get module, which can be used on the command line: - $ python -m async_http.get <list of urls> … will fetch the provided urls in parallel. If you check the source for the get.py module, you can see how you can override the http_body(), http_done(), and http_close() method to (for example) fetch content remotely and possibly redirect it somewhere else. By properly subclassing from DownloadFile you can serve remote files, similar to the requested feature here: Make OAuth Requests - The included async_http.oauth module, which can be used on the command line: - $ python -m async_http.oauth ckey,csecret [tkey,tsecret] <url> … will perform an Oauth 1.0a request against the provided url with the given client key and secret, with optional token key and secret (your url will determine whether you need a some sort of access or request token). Features - HTTP/HTTPS - redirect support - chunked transfer encoding - timeouts - transparent gzip handling (derived from) - OAuth 1.0a client support (no other 3rd party libraries required) API If you want to write your own handlers for events, subclass from _http.AsyncHTTPRequest, and override one or more of the following methods: def http_setup(self): ''' Called just before the connection is set up. You can manipulate headers, request body, etc. ''' def http_response(self): ''' Called after the response is read. You can handle redirects, perform additional logging, start a reply in a proxy, etc. ''' def http_body(self): ''' Called at the end of every chunk with chunked transfer encoding, and any time data is read for the body otherwise. ''' def http_chunk(self): ''' Called after every chunk with the chunked transfer encoding, immediately after the body callback. ''' def http_done(self): ''' Called when the body has finshed being transferred. This will not be called when there is an error. ''' def http_close(self): ''' Called when the connection has been closed. ''' Project details Release history Release notifications Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/async_http/0.12/
CC-MAIN-2018-47
refinedweb
418
63.9
#include <MStateManager.h> Container class for an acquired GPU blend state. MBlendState wraps an acquired composite GPU blend state. This blend state can be used to set the current GPU blend state using MStateManager::setBlendState(myBlendState). Instances of MBlendState cannot be created or modified by users. You can read the descriptor for an MBlendState using MBlendState::desc(), but you cannot set or alter the descriptor directly. MBlendState can only be obtained via MStateManager::acquireBlendState(). To use MStateManager::acquireBlendState(), create and fill an MBlendStateDesc instance with the requested state and pass it to MStateManager::acquireBlendState() which will return the cached unique blend state of that description. If the unique blend state did not previously exist in the cache, it is created. The information included in the blend state includes alpha to coverage enable, independent blend enable, a global float4 blend factor, and an array of blending descriptors, one for each target. The advantages of using this class rather than setting blend. Blend operations for hardware target blending. Specifies what value to use as blend factor with an optional pre-operation. A bitfield that indicates which color components(red, green, blue, alpha) are writable. Get the blend state descriptor that was used to create the state object. Returns the name of this class. This method allows access to the draw API dependent handle for a blend state. This handle is owned by the MBlendState and is provided to allow access to use as a read-only object. Modifications should never be performed on this handle. Any modifications may result in unpredictable stability as the MBlendState no longer has knowledge of it's contents. For OpenGL, such a handle does not exist and a NULL pointer will be returned. For DirectX 10 and higher, a pointer to a Direct3D state will be returned.
https://help.autodesk.com/cloudhelp/2017/ENU/Maya-SDK/cpp_ref/class_m_h_w_render_1_1_m_blend_state.html
CC-MAIN-2022-21
refinedweb
300
57.47
__author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2016 term" Natural Language Inference (NLI) is the task of predicting the logical relationships between words, phrases, sentences, (paragraphs, documents, ...). Such relationships are crucial for all kinds of reasoning in natural language: arguing, debating, problem solving, summarization, and so forth. Our NLI data will look like this: The first sentence is the premise and the second is the hypothesis (logicians call it the conclusion). We looked at NLI briefly in our word-level entailment bake-off (the wordentail.ipynb notebook). The purpose of this codebook is to introduce the problem of NLI more fully in the context of the Stanford Natural Language Inference corpus (SNLI). We'll explore two general approaches: This should be a good starting point for exploring richer models of NLI. It's also fun because it sets up a battle royale between models that require serious linguistic analysis (the linear ones) and models that are claimed by advocates to require no such analysis (deep learning). import os import re import sys import pickle import numpy as np import itertools from collections import Counter from sklearn.feature_extraction import DictVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import classification_report import utils from nltk.tree import Tree from nli_rnn import ClassifierRNN %config InlineBackend.figure_formats=['svg'] Make sure your environment includes all the requirements for the cs224u repository. It's okay if you couldn't get TensorFlow to work – it's not required for this notebook. Dowbload the nli-data data distribution and put it in the same directory as this notebook (or update snli_sample_src just below. For the homework: make sure you've run nltk.download() to get the NLTK data. (In particular, you need to use NLTK's WordNet API.) # Home for our SNLI sample. Because SNLI is very large, we'll work with a # small sample from the training set in class. snli_sample_src = os.path.join('nli-data', 'snli_1.0_cs224u_sample.pickle') # Load the dataset: a dict with keys `train`, `dev`, and `vocab`. The first # two are lists of `dict`s sampled from the SNLI JSONL files. The third is # the complete vocabulary of the leaves in the trees for `train` and `dev`. snli_sample = pickle.load(open(snli_sample_src, 'rb')) snli_sample.keys() dict_keys(['dev', 'vocab', 'train']) SNLI contains both regular string representations of the data, unlabeled binary parses like the following: ( ( A child ) ( is ( playing ( in ( a yard ) ) ) ) ) and labeled binary parses like (ROOT (S (NP (DT A) (NN child)) (VP (VBZ is) (VP (VBG playing) (PP (IN in) (NP (DT a) (NN yard))))) (. .))) Here are the class labels that we wish to learn to predict: LABELS = ['contradiction', 'entailment', 'neutral'] The training set for SNLI contains 550,152 sentence pairs, with sentences varying in length from 2 to 62 words. This is too large for in-class experiments and assignments. This is why we're working with the sample in snli_sample: len(snli_sample['train']) 15000 len(snli_sample['dev']) 3000 len(snli_sample['vocab']) 5328 Both train and test are balanced across the three classes, with sentences varying in length from 3 to 6 words. These limitations will allow us to explore lots of different models in class. You're encouraged to try out your ideas on the full dataset outside of class (perhaps as part of your final project). The following function can be used to turn bracketed strings like the above into trees: def str2tree(s): """Map str `s` to an `nltk.tree.Tree` instance. The assumption is that `s` represents a standard Penn-style tree.""" return Tree.fromstring(s) t = str2tree("""(ROOT (S (NP (DT A) (NN child)) (VP (VBZ is) (VP (VBG playing) (PP (IN in) (NP (DT a) (NN yard))))) (. .)))""") t For baseline models, we often want just the words, also called terminal nodes or leaves. We can access them with the leaves method on nltk.tree.Tree instances: t.leaves() ['A', 'child', 'is', 'playing', 'in', 'a', 'yard', '.'] To make it easy to run through the corpus, let's define general readers for the data. The general function for this yields triples consisting of the the left tree and the right tree, as parsed by str2tree, and finally the label: def snli_reader(sample): """Reader for SNLI data. `sample` just needs to be an iterator over the SNLI JSONL files. For this notebook, it will always be `snli_sample`, but, for example, the following should work for the corpus files: import json def sample(src_filename): for line in open(src_filename): yield json.loads(line) Yields ------ tuple (tree1, tree2, label), where the trees are from `str2tree` and label is in `LABELS` above. """ for d in sample: yield (str2tree(d['sentence1_parse']), str2tree(d['sentence2_parse']), d['gold_label']) def train_reader(): """Convenience function for reading just the training data.""" return snli_reader(snli_sample['train']) def dev_reader(): """Convenience function for reading just the dev data.""" return snli_reader(snli_sample['dev']) To start, we'll adopt an approach that is essentially identical to that of the supervisedsentiment.ipynb notebook: we'll train simple MaxEnt classifiers on representations of the data obtained from hand-built feature functions. This notebook defines some common baseline features based on pairings of information in the premise and hypothesis. As usual, one can realize big performance gains quickly by improving on these baseline representations. The first baseline we define is the word overlap baseline. It simply uses as features the words that appear in both sentences.) Another popular baseline is the full cross-product of words from both sentences: itertools.product(t1.leaves(), t2.leaves())]) Both of these feature functions return count dictionaries mapping feature names to the number of times they occur in the data. This is the representation we'll work with throughout; sklearn will handle the further processing it needs to build linear classifiers. Naturally, you can do better than these feature functions! Both of these might be useful even in a more advanced model, though. As usual, the first step in training a classifier is using a feature function like the one above to turn the data into a list of training instances (feature representations and their associated labels): def build_linear_classifier_dataset( reader, phi=word_overlap_phi, vectorizer=None): """Create a dataset for training classifiers using `sklearn`. Parameters ---------- reader An SNLI iterator like `snli_reader` above. Just needs to yield (tree, tree, label) triples. phi : feature function Maps trees to count dictionaries. vectorizer : `sklearn.feature_extraction.DictVectorizer` If this is None, then a new `DictVectorizer` is created and used to turn the list of dicts created by `phi` into a feature matrix. This happens when we are training. If this is not None, then it's assumed to be a `DictVectorizer` and used to transform the list of dicts. This happens in assessment, when we take in new instances and need to featurize them as we did in training. Returns ------- dict A dict with keys 'X' (the feature matrix), 'y' (the list of labels), 'vectorizer' (the `DictVectorizer`), and 'raw_examples' (the original tree pairs, for error analysis). """ feat_dicts = [] labels = [] raw_examples = [] for t1, t2, label in reader(): d = phi(t1, t2) feat_dicts.append(d) labels.append(label) raw_examples.append((t1, t2)) if vectorizer == None: vectorizer = DictVectorizer(sparse=True) feat_matrix = vectorizer.fit_transform(feat_dicts) else: feat_matrix = vectorizer.transform(feat_dicts) return {'X': feat_matrix, 'y': labels, 'vectorizer': vectorizer, 'raw_examples': raw_examples} To keep this notebook relatively simple, we adopt a bare-bones training framework, using just a standard-issue MaxEnt classifier. The following function is from supervisedsentiment.ipynb: def fit_maxent_classifier(X, y): """Wrapper for `sklearn.linear.model.LogisticRegression`. This is also called a Maximum Entropy (MaxEnt) Classifier, which is more fitting for the multiclass case. Parameters ---------- X : 2d np.array The matrix of features, one example per row. y : list The list of labels for rows in `X`. Returns ------- `sklearn.linear.model.LogisticRegression` A trained `LogisticRegression` instance. """ mod = LogisticRegression(fit_intercept=True) mod.fit(X, y) return mod For a more robust and responsible approach, see supervisedsentiment.ipynb notebook, especially the section on hyperparameter search. The linear_classifier_experiment function handles the book-keeping associated with running experiments. It essentially just combines all of the above pieces in a flexible way. If you decide to expand this codebase for real experiments, then you'll likely want to incorporate more of the functionality from the supervisedsentiment.ipynb notebook, especially its method for comparing different models statistically. def linear_classifier_experiment( train_reader=train_reader, assess_reader=dev_reader, phi=word_overlap_phi, train_func=fit_maxent_classifier): """Runs experiments on our SNLI fragment. Parameters ---------- train_reader, assess_reader SNLI iterators like `snli_reader` above. Just needs to yield (tree, tree, label) triples. phi : feature function (default: `word_overlap_phi`) Maps trees to count dictionaries. train_func : model wrapper (default: `fit_maxent_classifier`) Any function that takes a feature matrix and a label list as its values and returns a fitted model with a `predict` function that operates on feature matrices. Returns ------- str A formatted `classification_report` from `sklearn`. """ train = build_linear_classifier_dataset(train_reader, phi) assess = build_linear_classifier_dataset(assess_reader, phi, vectorizer=train['vectorizer']) mod = fit_maxent_classifier(train['X'], train['y']) predictions = mod.predict(assess['X']) return classification_report(assess['y'], predictions) print(linear_classifier_experiment()) precision recall f1-score support contradiction 0.41 0.58 0.48 1000 entailment 0.45 0.34 0.39 1000 neutral 0.35 0.29 0.32 1000 avg / total 0.40 0.40 0.40 3000 print(linear_classifier_experiment(phi=word_cross_product_phi)) precision recall f1-score support contradiction 0.63 0.58 0.60 1000 entailment 0.55 0.63 0.59 1000 neutral 0.56 0.53 0.54 1000 avg / total 0.58 0.58 0.58 3000 Cross product of synsets compatible with each word, as given by WordNet. (Here is a codebook on using WordNet from NLTK to do things like this.) More fine-grained WordNet features — e.g., spotting pairs like puppy/dog across the two sentences. Use of other WordNet relations (see Table 1 and Table 2 in this codelab for relations and their coverage). Using the tree structure to define features that are sensitive to how negation scopes over constituents. Features that are sensitive to differences in negation between the two sentences. Sentiment features seeking to identify contrasting sentiment polarity. Very recently, recurrent neural networks (RNNs) have become one of the dominant approaches to NLI, and there is a great deal of interest in the extent to which they can learn to simulate the powerful symbolic approaches that have long dominated work in NLI. The goal of this section is to give you some hands-on experience with using RNNs to build NLI models. Because these models are demanding not only in terms of data but also in terms of training time, we'll just get a glimpse of their potential, but I think even this glimpse clearly indicates their great potential. The model we'll be exploring is probably the simplest one that fits the NLI problem. It's depicted in the following diagram: This model would actually work for any classification task. For instance, you could revisit the supervisedsentiment notebook and try it out on the Stanford Sentiment Treebank. The dominant applications for RNNs to date have been for language modeling and machine translation. Those models have many more output vectors than ours. For a wonderful step-by-step introduction to such models, see Denny Britz's four-part tutorial (in the form of a notebook like this one). See also Andrej Karpathy's insightful, clear overview of different RNN architectures. (Both Denny and Andrej are Stanford researchers!) The above diagram is a kind of schematic for the following model definition: $$h_{t} = \tanh\left(x_{t}W_{xh} + h_{t-1}W_{hh}\right)$$ $$y = \text{softmax}\left(h_{n}W_{hy} + b\right)$$ where $n$ is the sequence length and $1 \leqslant t \leqslant n$. As indicated in the above diagram, the sequence of hidden states is padded with an initial state $h_{0}$. In our implementation, this is always an all $0$ vector, but it can be initialized in more sophisticated ways. It's important to see that there is just one $W_{xh}$, just one $W_{hh}$, and just one $W_{hy}$. Our from-scratch implementation of the above model is in nli_rnn.py. As usual, the goal of this code is to illuminate the above concepts and clear up any lingering underspecification in descriptions like the above. The code also shows how backpropagation through time works in these models. You'll see that it is very similar to regular backpropagation as we used it in the simpler word-entailment bake-off (using the feed-forward networks from shallow_neural_networks.py.) The following function uses our snli_reader infrastructure to create datasets for training and assessing RNNs. The steps: LABELSvector defined above to turn each string label into a one-hot vector. def build_rnn_dataset(reader): """Build RNN datasets. Parameters ---------- reader SNLI iterator like `snli_reader` above. Just needs to yield (tree, tree, label) triples. Returns ------- list of tuples The first member of each tuple is a list of strings (the concatenated leaves) and the second is an np.array (dimension 3) with a single 1 for the true class and 0s in the other two positions """ dataset = [] for (t1, t2, label) in reader(): seq = t1.leaves() + t2.leaves() y_ = np.zeros(3) y_[LABELS.index(label)] = 1.0 dataset.append((seq, y_)) return dataset Nex we define functions for the training and assessment steps. It's currently baked in that you want to train with train_reader and assess on dev_reader. If you start doing serious experiments, you'll want to move to a more flexible set-up like the one we established above for linear classifiers (and see supervisedsentiment.ipynb for even more ideas). The important thing to see about this function is that it requires a vocab argument and an embedding argument: vocabis a list of strings. It needs to contain every word we'll encounter in training or assessment. embeddingis a 2d matrix in which the ith row gives the input representation for the ith member of vocab. This gives you flexibility in how you represent the inputs. In the experiment run below, the inputs are just random vectors, but the homework asks you to try out GloVe inputs. def rnn_experiment( vocab, embedding, hidden_dim=10, eta=0.05, maxiter=10): """Classifier RNN experiments. Parameters ---------- vocab : list of str Must contain every word we'll encounter in training or assessment. embedding : np.array Embedding matrix for `vocab`. The ith row gives the input representation for the ith member of vocab. Thus, `embedding` must have the same row count as the length of vocab. Its columns can be any length. (That is, the input word representations can be any length.) hidden_dim : int (default: 10) Dimensionality of the hidden representations. This is a parameter to `ClassifierRNN`. eta : float (default: 0.05) The learning rate. This is a parameter to `ClassifierRNN`. maxiter : int (default: 10) Maximum number of training epochs. This is a parameter to `ClassifierRNN`. Returns ------- str A formatted `sklearn` `classification_report`. """ # Training: train = build_rnn_dataset(train_reader) mod = ClassifierRNN( vocab, embedding, hidden_dim=hidden_dim, eta=eta, maxiter=maxiter) mod.fit(train) # Assessment: assess = build_rnn_dataset(dev_reader) return rnn_model_evaluation(mod, assess) def rnn_model_evaluation(mod, assess, labels=LABELS): """Asssess a trained `ClassifierRNN`. Parameters ---------- mod : `ClassifierRNN` Should be a model trained on data in the same format as `assess`. assess : list A list of (seq, label) pairs, where seq is a sequence of words and label is a one-hot vector giving the label. """ # Assessment: gold = [] predictions = [] for seq, y_ in assess: # The gold labels are vectors. Get the index of the single 1 # and look up its string in `LABELS`: gold.append(labels[np.argmax(y_)]) # `predict` returns the index of the highest score. p = mod.predict(seq) predictions.append(labels[p]) # Report: return classification_report(gold, predictions) Here's an example run. All input and hidden dimensions are quite small, as is maxiter. This is just so you can run experiments quickly and see what happens. Nonetheless, the performance is competitive with the linear classifier above, which is encouraging about this approach. vocab = snli_sample['vocab'] # Random embeddings of dimension 10: randvec_embedding = np.array([utils.randvec(10) for w in vocab]) # A small network, trained for just a few epochs to see how things look: print(rnn_experiment(vocab, randvec_embedding, hidden_dim=10, eta=0.001, maxiter=10)) Finished epoch 10 of 10; error is 1.0777186145 precision recall f1-score support contradiction 0.35 0.38 0.36 1000 entailment 0.41 0.52 0.46 1000 neutral 0.39 0.26 0.31 1000 avg / total 0.38 0.39 0.38 3000 As noted above, ClassifierRNN is just about the simplest model we could use for this task. Some thoughts on where to take it: Additional hidden layers can be added. This is a relatively simple change to the code: one just needs to define a version of $W_{hh}$ for each layer, respecting the desired dimensions for the representations of the layers it connects. The backpropagation steps are also straightforward duplications of what happens between the current layers. ClassifierRNN uses the most basic (non-linear) activation functions. In TensorFlow, it is easy to try more advanced designs, including Long Short-Term Memory (LSTM) cells and Gated Recurrent Unit (GRU) cells. The documentation for these is currently a bit hard to find, but here's the well-documented source code. Our implementation uses the same parameter $W_{hh}$ for the premise and hypothesis. It is common to split this into two, with the final hidden state from the premise providing the initial hidden state of the hypothesis. The SNLI leaderboard shows the value of adding attention layers. These are additional connections between premise and hypothesis. They can be made for each pair of words or just for the final hidden representation in the premise and hypothesis. Our implementation currently has only a single learning rate parameter. A well-tested improvement on this is the AdaGrad method, which can straightforwardly be added to the ClassifierRNN implementation. Our implementation is regularized only in the sense that the number of iterations acts to control the size of the learned weights. Within deep learning, an increasingly common regularization strategy is drop-out. We haven't made good use of trees. Like many linguists, I believe trees are necessary for capturing the nuanced ways in which we reason in language, and this new paper offers empirical evidence that trees are important for SNLI. Tree-structured neural networks are by now well-understood extensions of feed-forward neural networks and so are well within reach for a final project. The Stanford Deep Learning course site is a great place to get started. Do get the full SNLI and figure out how to grapple with its large size! Here's a useful and insightful blog post by Sam Bowman on SNLI's design. The folder nli-data in this repository contains the NLI data from the SemEval 2014 semantic relatedness task. This data set is called "Sentences Involving Compositional Knowledge" or, for better or worse, "SICK". It's freely available from the SemEval site. nli-data contains a parsed version created by Sam Bowman as part of his research on neural models of semantic composition. SemEval 2013 also had a wide range of interesting data sets for NLI and related tasks. The FraCaS textual inference test suite is a smaller, hand-built dataset that is great for evaluating a model's ability to handle complex logical patterns. Models for NLI might be adapted for use with the 30M Factoid Question-Answer Corpus. Models for NLI might be adapted for use with the Penn Paraphrase Database. Python NLTK has an excellent WordNet interface. As noted above, WordNet is a natural choice for defining useful features in the context of NLI. Your task: write and submit a feature function, for use with build_linear_classifier_dataset and linear_classifier_experiment, that is just like word_cross_product_phi except that, given a sentence pair $(S_{1}, S_{2})$, it counts only pairs $(w_{1}, w_{2})$ such that $w_{1}$ entails $w_{2}$, for $w_{1} \in S_{1}$ and $w_{2} \in S_{2}$. For example, the sentence pair (the cat runs, the animal moves) would create the dictionary {(cat, animal): 1.0, (runs, moves): 1.0}. There are many ways to do this. For the purposes of the question, we can limit attention to the WordNet hypernym relation. The following illustrates reasonable ways to go from a string $s$ to the set of all hypernyms of Synsets consistent with $s$: from nltk.corpus import wordnet as wn puppies = wn.synsets('puppy') print([h for ss in puppies for h in ss.hypernyms()]) # A more conservative approach uses just the first-listed # Synset, which should be the most frequent sense: print(wn.synsets('puppy')[0].hypernyms()) [Synset('dog.n.01'), Synset('pup.n.01'), Synset('young_person.n.01')] [Synset('dog.n.01'), Synset('pup.n.01')] A note on performance: in our experience, this feature function (used in isolation) gets a mean F1 of about 0.32. This is not very high, but that's perhaps not surprising given its sparsity. In the simple RNN experiment above, we used random input vectors. In the word-entailment bake-off, pretraining was clearly beneficial. What are the effects of using pretrained inputs here? Submit: A function build_glove_embedding that creates an embedding space for all of the words in snli_sample['vocab']. (You can use any GloVe file you like; the 50d one will be fastest.) See randvec_embedding above if you need further guidance on the nature of the data structure to produce. If you encounter any words in snli_sample['vocab'] that are not in GloVe, have your function map them instead to a random vector of the appropriate dimensionality (see utils.randvec). A function call for rnn_experiment using your GloVe embedding. (You can set the other parameters to rnn_experiment however you like.) The output of this function. (You won't be evaluated by how strong the performance is. We're just curious.) You can use utils.glove2dict to read in the GloVe data into a dict. A note on performance: your numbers will vary widely, depending on how you configure your network and how long you let it train. You will not be evaluated on the performance of your code, but rather only on whether your functions do their assigned jobs. The goal of this question is to begin to access the extent to which RNNs can learn to simulate compositional semantics: the way the meanings of words and phrases combine to form more complex meanings. We're going to do this with simulated data so that we have clear learning targets and so we can track the extent to which the models are truly generalizing in the desired ways. The base dataset is nli_simulated_data.pickle in this directory (the root folder of the cs224u repository). (You'll see below why it's the "base" dataset.) simulated_data = pickle.load(open('nli_simulated_data.pickle', 'rb')) This is a list of triples, where the first two members are lists and the third member is a label: simulated_data[:5] [([['a'], ['a']], 'equal'), ([['a'], ['c']], 'superset'), ([['a'], ['b']], 'neutral'), ([['a'], ['e']], 'superset'), ([['a'], ['d']], 'neutral')] The letters are arbitrary names, but the dataset was generated in a way that ensures logical consistency. For instance, if (['x'], ['y'], 'subset') is in the data and (['y'], ['z'], 'subset') is in the data, then (['x'], ['z'], 'subset') is as well (transitivity of subset). Here's the full label set: simulated_labels = ['disjoint', 'equal', 'neutral', 'subset', 'superset'] These are interpreted as disjoint. For example, 'subset' is proper subset and 'superset' is proper superset – bothe exclude the case where the two arguments are equal. As usual, we have to do a little bit of work to prepare the data for use with ClassifierRNN: def build_sim_dataset(dataset): """Map `dataset`, in the same format as `simulated_data`, to a dataset that is suitable for use with `ClassifierRNN`: the input sequences are flattened into a single list and the label string is mapped to the appropriate one-hot vector. """ rnn_dataset = [] for (p, q), rel in dataset: y_ = np.zeros(len(simulated_labels)) y_[simulated_labels.index(rel)] = 1.0 rnn_dataset.append((p+q, y_)) return rnn_dataset Finally, here is the full vocabulary, which you'll need in order to create embedding spaces: sim_vocab = ["not"] + sorted(set([p[0] for x,y in simulated_data for p in x])) sim_vocab ['not', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'] Complete the function sim_experiment so that it trains a ClassifierRNN on a dataset produced by build_sim_dataset and evaluates that classifier on a dataset produced by build_sim_dataset: ###################################################################### # TO BE COMPLETED ###################################################################### def sim_experiment(train_dataset, test_dataset, word_dim=10, hidden_dim=10, eta=0.001, maxiter=100): # Create an embedding for `sim_vocab`: # Change the value of `mod` to a `ClassifierRNN` instance using # the user-supplied arguments to `sim_experiment`: # Fit the model: # Return the evaluation on `test_dataset`: return rnn_model_evaluation(mod, test_dataset, labels=simulated_labels) Submit: Your completed sim_experiment. Fiddle with sim_experiment until you've found settings that yield perfect accuracy on the training data. In other words, if d is the dataset you created with build_sim_dataset, then sim_experiment(d, d) should yield perfect performance on all classes. (If it's a little off, that's okay.) Submit: Your function call to sim_experiment showing the values of all the parameters. If you need to write any code to prepare arguments for the function call, then include those lines as well. Tip: set eta very low. This will lead to slower but more stable learning. You might also pick high word_dim and hidden_dim to ensure that you have sufficient representational power. These settings in turn demand a large number of iteration. ###################################################################### # TO BE COMPLETED ###################################################################### Now that we've established that the model works, we want to start making the data more complex. To do this, we'll simply negate one or both arguments and assign them the relation determined by their original label and the logic of negation. For instance, the training instance p q, subset will become not p not q, superset p not q, disjoint not p q, overlap The full logic of this is a somewhat liberal interpretation of the theory of negation developed by MacCartney and Manning 2007. $$ \begin{array}{c c} \hline & \text{not-}p, \text{not-}q & p, \text{not-}q & \text{not-}p, q \\ \hline p \text{ disjoint } q & \text{neutral} & \text{subset} & \text{superset} \\ p \text{ equal } q & \text{equal} & \text{disjoint} & \text{disjoint} \\ p \text{ neutral } q & \text{neutral} & \text{neutral} & \text{neutral} \\ p \text{ subset } q & \text{superset} & \text{disjoint} & \text{neutral} \\ p \text{ superset } q & \text{subset} & \text{neutral} & \text{disjoint} \\ \hline \end{array} $$ If you don't want to worry about the details, that's fine – you can treat negate_dataset as a black-box. Just think of it as implementing the theory of negation. def negate_dataset(dataset): """Map `dataset` to a new dataset that has been thoroughly negated.""" new_dataset = [] for (p, q), rel in dataset: neg_p = ["not"] + p neg_q = ["not"] + q combos = [[neg_p, neg_q], [p, neg_q], [neg_p, q]] new_rels = None if rel == "disjoint": new_rels = ("neutral", "subset", "superset") elif rel == "equal": new_rels = ("equal", "disjoint", "disjoint") elif rel == "neutral": new_rels = ("neutral", "neutral", "neutral") elif rel == "subset": new_rels = ("superset", "disjoint", "neutral") elif rel == "superset": new_rels = ("subset", "neutral", "disjoint") new_dataset += zip(combos, new_rels) return new_dataset Using negate_dataset, we can map the base dataset to a singly negated one and then create a ClassifierRNN dataset from that: neg1 = negate_dataset(simulated_data) neg1_rnn = build_sim_dataset(neg1) Your task: use your sim_experiment to train a network on train_dataset plus neg1, and evaluate it on a dataset that has been doubly negated by running negate_dataset(neg1) and preparing the result for use with a ClassifierRNN. Use the same hyperparameters that you used to memorize the data for task 2. Submit: the code you write to run this experiment and the output (which should be from a use of sim_experiment). A note on performance: our mean F1 dropped to about 0.61, because we stuck to the rules and used exactly the configuration that led to perfect results on the training set above, as is required. You will not be evaluated based on the numbers you achieve, but rather only on whether you successfully run the required experiment. That's all that's required. Of course, we hope you are now extremly curious to see whether you can find hyperparameters that generalize well to double negation, and how many times you can negate a dataset and still get good predictions out! neg3 and beyond?! ###################################################################### # TO BE COMPLETED ######################################################################
http://nbviewer.jupyter.org/github/cgpotts/cs224u/blob/master/nli.ipynb
CC-MAIN-2018-05
refinedweb
4,719
55.44
Archives More Vista Baby Naming Fallout I have over 100 links to other blogs, news sites, and rumblings (including Windows Vista magazine and The Guardian) over the naming of our daughter last month. I'll probably post a follow-up with links to them, as some of them are quite humorous. However this one jumped out at me this morning: This time, it’s allegedly a Vice President of Microsoft, Bil Simser, who has charted new baby naming territory. According to a post in the Windows Vista Magazine, Simser’s new daughter is named Vista Avalon. Vice President huh? Well it's got to be true, it's on the Internet. What a promotion from MVP, and I don't even work for the company! Gotta love the media. As my first executive decision, I hereby declare .NET, SharePoint, and Visual Studio open source! Now should I should send a note to billg@microsoft.com asking for my parking pass and key to the executive squash courts. Update: It's been noted that Vista wasn't listed on Wikipedia's page for unusual names. No longer. I updated it with her name and a link to her blog entry. She's the first entry for the letter "V". Change Calendar Time Zone Got an odd message this morning as I was slugging through emails (and figuring out how to corrupt the world with my new CrackBerry). I have no idea what this means? Someone changed Mountain Standard Time and I didn't get the memo or something? ReSharper Goodness? One of our devs was doing a refresh from source control just now and got this ReSharper exception: JetBrains.ReSharper.Util.InternalErrorException: Shit happened Shit happened ---> JetBrains.ReSharper.Util.InternalErrorException: Shit happened at JetBrains.ReSharper.Util.Logger.LogError(String) in c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 389 column 7 at JetBrains.ReSharper.VS.ProjectModel.WebProjectReferenceManager.ProcessAssemblyReferences(AssemblyReferenceProcessor) in c:\Agent\work\Server\ReSharper2.5\src\VS\src\ProjectModel\WebProjectReferenceManager.cs:line 409 column 9 at JetBrains.ReSharper.VS.ProjectModel.WebProjectReferenceManager.getReferences() in c:\Agent\work\Server\ReSharper2.5\src\VS\src\ProjectModel\WebProjectReferenceManager.cs:line 442 column 9 at JetBrains.ReSharper.VS.ProjectModel.WebProjectReferenceManager.UpdateAssemblyReferences() in c:\Agent\work\Server\ReSharper2.5\src\VS\src\ProjectModel\WebProjectReferenceManager.cs:line 205 column 7 at JetBrains.ReSharper.Shell.<>cDisplayClass1.<Invoke>b0() in c:\Agent\work\Server\ReSharper2.5\src\Shell\src\Invocator.cs:line 225 column 33 at System.RuntimeMethodHandle.InvokeMethodFast(Object, Object[], SignatureStruct&, MethodAttributes, RuntimeTypeHandle) at System.RuntimeMethodHandle.InvokeMethodFast(Object, Object[], Signature, MethodAttributes, RuntimeTypeHandle) at System.Reflection.RuntimeMethodInfo.Invoke(Object, BindingFlags, Binder, Object[], CultureInfo, Boolean) at System.Delegate.DynamicInvokeImpl(Object[]) at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry) at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object) at System.Threading.ExecutionContext.runTryCode(Object) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, Object) at System.Threading.ExecutionContext.RunInternal(ExecutionContext, ContextCallback, Object) at System.Threading.ExecutionContext.Run(ExecutionContext, ContextCallback, Object) at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry) at System.Windows.Forms.Control.InvokeMarshaledCallbacks() at System.Windows.Forms.Control.WndProc(Message&) at System.Windows.Forms.ScrollableControl.WndProc(Message&) at System.Windows.Forms.ContainerControl.WndProc(Message&) at System.Windows.Forms.Form.WndProc(Message&) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&) at System.Windows.Forms.ControlNativeWindow.WndProc(Message&) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr) Brilliant! Followup: Found a few references to this here and here. It was fixed in 2.5.2. Project Structure - By Artifact or Business Logic? We're currently at a crossroads about how to structure projects. On one hand we started down the path of putting classes and files into folders that made sense according to programming speak. That it, Interfaces; Enums; Exceptions; ValueObjects; Repositories; etc. Here's a sample of a project with that layout: After some discussion, we thought it would make more sense to structure classes according to the business constructs they represent. In the above example, we have a Project.cs in the DomainObject folder; an IProject.cs interface in the interface folder; and a PayPeriod.cs value object (used to construct a Project object) in the ValueObjects folder. Additional objects would be added so maybe we would have a Repository folder which would contain a ProjectRepository. Using a business aligned structure, it might make more sense to structure it according to a unit of work or use case. So everything you need for say a Project class (the class, the interface, the repository, the factory, etc.) would be in the same folder. Here's the same project as above, restructured to put classes and files into folders (which also means namespaces as each folder is a namespace in the .NET world) that make sense to the domain. It may seem moot. Where do I put files in a solution structure? But I figured I would ask out there. So the question is, how do you structure your business layer and it's associated classes? Option 1 or Option 2 (or maybe your own structure). What are the pros and cons to each, or in the end, does it matter at all? More ReSharper 3.0 Goodness Found an interesting tidbit today. I had a piece of code with the word "bug" in a comment. It showed up like this in my IDE: Lo and behold I found that ReSharper is finding keywords in my comments and colorizing them so they stand out. It also does this with TODO and other keywords that you define. In the Tools options you'll find a leaf node called Todo Items. In there you can set up patterns. Here's the pattern for Bug: So any time it find "bug" (using the regular expression) it'll colorize it red and display the error icon on that line. The default items that are added are Todo, Note, and Bug. You can add your own so you might use this as a good way to highlight things in your code to junior developers (for example creating one called "Pattern" to highlight an implementation of a specific design pattern). Note, this might not be a 3.0 thing but since I don't have 2.5 installed anymore I can't tell if it's been there all along. Very neat! Richard Campbell in Calgary Wednesday, June 27 Richard Campbell will be presenting to the Calgary .NET User Group on Wednesday, June 27th. Richard is the co-host of .NET Rocks and an awesome speaker. Based out of Vancouver, he haunts our Calgary corner a few times (last time I remember he was at our 2006 Code Camp) so please do try to get out to see him. I had issues (read:errors) trying to register on the website so you should be able to just show up for registration (I tried seeing where you could contact someone, but their contact page doesn't seem to have any contact info like oh, emails or phone numbers). The event is in the Nexen Centre, located at 800 7th Ave SW. Once you get in, you have to go upstairs to +15 level, then past the Brown Bag (a sandwich shop), then over a walking bridge to the conference centre. It's poorly marked, but it's the same place I gave my MOSS 2007 presentation if anyone was paying attention. See you there! A Visual Tour of ReSharper 3.0. Mike Cohn is blogging Or maybe I'm just slow on the uptake? I got word via Mountain Goat Software, Mike's company, that his blog Succeeding with Agile is now available. However there are posts there dating back to January. In any case, whether it's new or not, it's a blogger to read. Mike has always been there for me with little tidbits of extra info and sending me resources when I was swimming in Agile questions. He's an excellent speaker and I look foward to his blog entries, even if they're only going to be once a month (hey, he's a busy guy). Check it out and consider adding him to your blog roll as he's on of the key guys in Agile software today. No iPhone for you Canada!? Load Testing Smart Clients It's a question, not a blog post. Anyone got some good tips, tricks, techniques, and tools for load testing Smart Clients? There's a plethora of info out for load testing web applications but little to nothing on Smart Clients. Just looking for ideas from the code monkeys out there. An attempt at working with eScrum Okay, first off this tool wins the "Most Horrible Name Marketing Could Come Up With" award. I mean seriously, eScrum? Well, I guess when Scrum for Team System is taken what else do you do? I took a look at eScrum but after an hour of configuration and various error messages I gave up. I'm the type that if I need to spend half a day to try something out, something that I kind-of already have, that's half a day wasted. I personally think most of the people out there that are saying this tool is "pretty nice" haven't actually installed it (or tried to install it). So take this blog entry with a grain of salt as I didn't complete it to get to the finish line. What is eScrum? Anyways, eScrum is a web-based, end-to-end project management tool for Scrum built on top of TFS. It allows multiple ways to interact with your Scrum project: - eScrum web-based UI - TFS Team Explorer - Excel - MS Project Like any Scrum tool, it offers a one-stop place for all Scrum artifacts like product backlogs, sprint backlogs, retrospectives, and those oh-so-cool burndown charts. Installation is pretty painless. That is until you realize that you need a bevy of Microsoft technologies and tools installed in order to run eScrum. eScrum uses a variety of web and back-end technologies and you need to install of of them before getting your eScrum site up and running, although you can install them before or after eScrum, your choice. You'll need to install: - Microsoft .NET Framework v2.0 (well, duh) - Microsoft Team Foundation Server and Microsoft Team Explorer - ASP.NET 2.0 AJAX Extensions 1.0 and the AJAX Control Toolkit - Anti Cross-Site Scripting Library Once everything is installed hang on a second kids, there's still configuration to be done! eScrum is a bit of a pain to configure. Configuring eScrum is like installing Linux, there are a lot of steps and at any point you can really screw things up..config.CHANGEME.0"/> </dependentAssembly> </assemblyBinding> </runtime> Setting up SharePoint Templates Oh yeah, the fun still continues and we're still not finished. The eScrum TFS Template includes a team SharePoint portal template which gets installed when a new TFS Project is created with the eScrum template. The SharePoint templates must be added to the server before creating a TFS Project with the eScrum Process Template. Deployment Steps. Follow these instructions to get this step done: - Log on to the target server - Open a command prompt and change directory to: <SystemDrive>\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN - Add the new templates using - stsadm -o addtemplate -filename <path>\eScrum.stp -title "eScrum" - stsadm -o addtemplate -filename <path>\eScrumFeaturesIdeas.stp -title "eScrum Features & Ideas" - stsadm -o addtemplate -filename <path>\eScrumRiskLog.stp -title "eScrum Risk Log" - stsadm -o addtemplate -filename <path>\eScrumStrategy.stp -title "eScrum Strategy & Issues" - Type IISRESET to reset IIS Setting up an eScrum TFS Project eScrum uses eScrum TFS Projects as a back end storage and management, so you won't be able to use it on existing projects. Once you have added the eScrum Process Template to your TFS server, you will need to create a new TFS Project using the eScrum Template. First you'll need to get the templates uploaded via Team Explorer (or inside Visual Studio). Make sure you don't have even the Word document open while you're uploading the template or it will fail when it tries to create the zip file. Once you've uploaded the templates and they're available, you need to create a project using the eScrum template: - In Team Explorer, right click your server and select "New Team Project…" - Name your project and use the eScrum template - Add yourself and your team members are all added to the Project Contributors (or Project Administrators, depending on your preference) security group. - Right-click on your new Project and select "Team Project Settings.Group Membership…" - Double-click either the Administrators or Contributors group - Change the "Add member" selection to "Windows User or Group" - Add your members - Click OK Finally! There are some other installs they want you to do and I suggest you follow the various installation and configuration guides but for my test this was good enough to get something up and running. Now browse to where you installed it and you'll see something like this: Creating Projects eScrum is a little odd, but it seems to align to the Scrum process. Of course the thing with Scrum is that it's adaptable. There is no golden rule of how it works. There are guidelines and people generally follow them but for example in eScrum you must have a product. The eScrum project you create isn't good enough, it needs something actually called a "Product" (using the concept that multiple products form a project). I don't personally do Scrum that way so found it a little frustrating. The other frustrating thing when setting up a project (oh sorry, "product") was that I couldn't save it until I Product contributors were added (team members) and it wouldn't let me add team members until I created groups and that's where I stopped before my brain exploded. Enough Configuring, I give up! Yes, I gave up installing and configuring the beast as it was just too much. I mean, I'm all for tools and setting up websites but after an hour of screwing around (even though I knew what I was doing) I said enough was enough. Realistically, give yourself a half day (if you rush) or a full day with some testing to get this puppy up and running. In fact, even after I had the template setup and a test project created I had no idea (other than through the Web UI) how to create a product? (which I couldn't do because of the security issues) It didn't look like I could create one in Team Explorer as all it would let me create was a bug, product details (but it needs a product first), sprint details, sprint retrospective, or a sprint task. WTF? Yeah, the SharePoint Scrum Master was lost so either I'm an idiot (possible) or this tool isn't very intuitive, even for someone who thinks he knows what he's doing. I wasn't going to go through the rest of the steps and who knows what else was needed, thus I wasn't able to get screenshots with projects configured and sprint backlog items, etc. I'll leave that for another soul to give up his day for. I do however have some images for the various tabs so you can get a feel for what eScrum has to offer: Product Page Sprint Page Daily Scrum Page Retrospective Page Bottom Line Was it worth it? Was it worth all the installing and configuring and configuring and installing? IMHO, no. I'm very happy with Conchango's Scrum for Team System and hey, to install that I just had to upload a new process template from Team Explorer. No mess no fuss. Once you do get the configuration and installation out of the way, eScrum looks interesting. It's got a nice dashboard for tracking your sprint, lets you keep on top of the daily Scrum electronically, and offers a bevy of Scrum reports like burndowns, metrics, and a product summary (none of which I have seen because I didn't take it that far when setting it up). There are problems with the setup (even though I didn't finish). For example the SharePoint template contains entry into the Links list pointing to and, none of which are correct so you have to fix this (and frankly, I don't even know what the eTools link is supposed to be). The SharePoint templates are just custom lists with a few extra fields, nothing special here. Even the logo for the site was broken in the template so it's obviously this is either rushed or nobody cares about the quality of presentation of the tool (and I wouldn't call this a 1.0 release). Other things that immediately are a problem I had with this, you had to modify an XML config file every time you needed to add a project (and it's called a "Group" inside of the config file). Maybe you can do it through the web UI, but it looked to me like you had to modify this for each project. I think for any kind of adoption, Microsoft needs to put together an installer for this as we don't all have a day to kill configuring a tool that should be seamless (after all, it's just a website and a TFS template remember). They also should have some documentation/guidance on this. From the looks of what I could get up and running there's very little actual "guidance" on using the tool and frankly, from the websites there's very little anything about this tool. Does MS think you install it (assuming you have the gumption to go through the entire process) and it'll just work and people will understand it? Even Scrum for Team System has nice documentation written on the process that goes along with the tool. Tools and technologies alone do not make for a good package. If you want to use Scrum with TFS, stick to Conchango's Scrum For Team System template. It has it's own share of flaws but installs in about 5 minutes. Coalescing with ReSharper 3.0 The ReSharper 3.0 beta is out and I'm really digging it. It's little things that make my day a better place. For example I had a piece of code that looked like this: 14 public ErrorReportProxy(IWebProxy proxy, bool needProcessEvents) 15 { 16 errorReport.Proxy = proxy; 17 if (proxy.Credentials != null) errorReport.Proxy.Credentials = proxy.Credentials; 18 else errorReport.Proxy.Credentials = CredentialCache.DefaultCredentials; 19 needProcessEvents = needProcessEvents; 20 } "if" statements are so 1990s so you can rewrite it like this using the conditional operator "?" 14 public ErrorReportProxy(IWebProxy proxy, bool needProcessEvents) 15 { 16 errorReport.Proxy = proxy; 17 errorReport.Proxy.Credentials = (proxy.Credentials != null) 18 ? proxy.Credentials 19 : CredentialCache.DefaultCredentials; 20 needProcessEvents = needProcessEvents; 21 } However with nullable types in C# 2.0 you can use the language feature of using the "??" assignment (called the null coalesce operator). The ?? operator defines the default value to be returned when a nullable type is assigned to a non-nullable type. This shortens the code but makes it more readable (at least to me). ReShaper to the rescue as it showed me squiggly lines in my code where I had the "?" operator and said (in a nice ReSharper way not an evil Clippy way): '?:' expression could be re-written as '??' expression. So a quick ALT+ENTER and the code becomes this: 14 public ErrorReportProxy(IWebProxy proxy, bool needProcessEvents) 15 { 16 errorReport.Proxy = proxy; 17 errorReport.Proxy.Credentials = proxy.Credentials ?? CredentialCache.DefaultCredentials; 18 needProcessEvents = needProcessEvents; 19 } Okay, so maybe I'm easily amused but it's the little things that make my day (and maybe yours) a little brighter. The coding assistance feature of ReSharper 3.0 is shaping up to be very useful indeed. Refactoring Dumb, Dumber, Dumbest away 4 {: - Get rid of that original if statement, however this might be a bigger problem as it bubbles up to some of the parent classes. At the very least, it could be simplified and still meet the business problem. - Since all ISegmentConfiguration classes return the cable count, maybe this should just be a property as there's no real calculation involved here for the cable count. Feel free to suggest even more improvements if you see them!. The Robot is in the House Errr, make that the yard. Quick. What am I doing right now? I mean, right now, this very instant. Yes, I'm typing this blog entry but what else am I doing? I'm cutting my lawn. Really. Late last year we had a rather talented chap come in, brave the coldness of Alberta in September, and proceed to lay out 10,000 square feet of sod (no easy feat). That's the size of our backyard. Of course come the spring brings the weeds, and the grass, and the chore of cutting all this new grass. There I was faced with the decision. Should I buy a ride-on mower and be a weekend Andretti, chewing up the grass, and probably killing myself or at least one of the dogs in the process. Or is there a better option? Enter the RL1000 Robomow from Friendly Robotics. Yeah, I kid you not. I heard about it through the grapevine, did some research and lo and behold most people felt it was a good buy. It's the same cost as a ride-on mower so it was one or the other. The geek in me of course chose the robot. After all, how many people can claim to have a robot do their backyard lawn cutting for them? It arrived on Friday and I spent part of Saturday setting it up. I felt like Sam Neill in Bicentennial Man when their Robot (in the guise of Robin Williams) gets delivered to the house, although the Robomow doesn't talk, do dishes, or take care of kids it does a splendid job of cutting grass. It took me about an hour to lay out 500 feet of perimeter wire. This is a long piece of wire pegged into the ground that holds it down and surrounds your lawn. The Robomow, on it's first run, will travel around the perimeter following the wire and get a feel for how your backyard is layed out. Luckily ours, while huge, is pretty much square with a small section on either side of the house. After pegging everything in, I fired it up and had Sheila (RedvsBlue fans will know where this comes from) go around the figure stuff out. Once that worked (and it did on the first shot, I was impressed) I commanded her to do my bidding and mow that lawn. First it edges the lawn, cutting along where the perimeter is setup, then it criss-crosses over the middle part. It does this several times and as it hits each edge, it will make a small adjustment and go back the way it came (in a slightly altered direction from where it came). After 3 or 4 passes it's done. It takes about 2-3 hours to do the lawn but I just sit back and don't worry about it. Works like a charm, although a) I had to go and remove some of the larger weeds in the middle of the ground as Sheila got stuck on them and b) you still have to trim the edges but it only takes about 20 minutes for that (and less for a smaller lawn). All in all, a good investment. I have it programmed now to go every Tuesday, Thursday and Saturday night at 7pm. This leaves me the chore of watering the beast on Sundays which is fine for me and keeps everything short and sweet. There's no bagging, it just mulches things down to a fine cut and is actually better for the lawn overall. If you're looking for a new geek toy and have a big, flat, square(ish) lawn I highly recommend the Robomow. It really does work as advertised. My own Private WTF I've always wanted to submit something to The Daily WTF (come to think of it, I think I did but that was a long time ago) but today it just made me cry as I experienced my own private WTF. We had a developer leaving today and as I was doing a code sweep (looking at what was there, how the domain was shaping up, etc.) I came across this gem: 5 private enum DumbLevel 6 { 7 Dumb, 8 Dumber, 9 Dumbest, 10 Not 11 } Okay, I said to myself. It's his last day, he's having some fun. Back when I worked with wood burning computers I wrote code with silly variable names too. Then of course my curiosity was piqued and I just had to know how this enum was being used. This led me to this snippet: 19 if (cableCount == 0) 20 { 21 if (cableCount == 1) 22 { 23 if (PassesCount > 1) 24 { 25 if (i <= (_segments.Count - 2)) //for all but last 26 dumbLevel = DumbLevel.Dumbest; 27 else dumbLevel = DumbLevel.Dumb; //last segment 28 } 29 else dumbLevel = DumbLevel.Dumb; 30 } 31 else dumbLevel = DumbLevel.Dumber; 32 } 33 else 34 { 35 dumbLevel = DumbLevel.Not; 36 } 37 38 //calculate cable count and heat segment voltage based on the segment configuration 39 switch (dumbLevel) 40 { 41 case DumbLevel.Dumb: 42 cableCount = segment.GetCableCount(); //use # of tracers to determine cable count 43 AuditStep("Cable Count: {0} (based on count of Tracers identified)", cableCount); 44 AuditStep(""); 45 heatSegmentVoltage = SupplyVoltageProject.VoltageDropsegmentPercentage; 46 AuditStep("Supply Voltage ({0}) * Voltage Drop ({1}) * Segment Percentage ({2})", SupplyVoltage, 47 Project.VoltageDrop, segmentPercentage); 48 break; 49 50 case DumbLevel.Dumber: // code omitted for sanity 51 break; 52 } This was by far the ugliest code I've seen on this project. The if statements alone started my blood to boil, but then when I started to see the case statements my brain turned to mush and that was my day done. Sigh. Oh well, next week I'll introduce the team to the concept of inheritance so they can see how to make the case statements (and the craziest set of Enum values I've ever seen) go away. And Donald thinks he has it rough hiring new guys? NOTE: sorry about the formatting, my VS settings are just hosed today. The Red "X" of Death You've heard of the Blue Screen of the Death (Windows). You've heard of the Yellow Screen of Death (ASP.NET). Now here's the Red "X" of Death. Got this on one of our apps the other day by our QA folks. It's a Smart Client app using the DevExpress Ribbon, CAB, and a host of other UI goodness. Needless to say, the error wasn't too useful to anyone trying to fix it. There's supposed to be a grid in the middle there with all kinds of useful information and calculations. DevExpress just decided that it really didn't want to do all that work and gave us a nice big red "X" as if we're missing an image from a website. Old and busted or new hotness Roy Osherove posted a what's hot and what's not list, mainly aimed at this whole ALT.NET developer talk that's been going on. Unfortunately, I'm a little at odds with what Roy posted and don't agree with some (most?) of his comparisons. It's also hard to compare things here as he's grouped items together that either overlap, are completely different, or don't make sense to be together and are vague. I really don't care for the whole ALT.NET tagging as I think even the term ALT.NET is silly but here's my spin on Roy's items. UPDATE: Roy updated his blog entry with a note that he didn't necessarily agree with the list, these were his observations of the world. I was a little confused because I thought he was emoting what he felt. Silly me. Still, I think the comparisons are a little strange as it mixes technology with concepts hence why I put my list at the end together. I also stand corrected on A# and that Castle can do both DI and AOP quite well. Thanks for the info! Hot: Castle, ActiveRecord, NHibernate Not: Datasets, Entity Framework, MS Application Blocks I'm not quite sure what he's talking about here. I don't feel ActiveRecord is "hot" and I try to avoid the pattern altogether. NHibernate for sure and Castle is cool (over DataSets any day). Is he comparing Castle and it's DI against MS Application Blocks? More on that later. Hot: MVC, NUnit, MonoRail Not: Web Forms, SCSF, VSTS, MSTest Again it gets a little clouded here (at least with my glasses on). Definately NUnit over MSTest hands down. With the pain and suffering Oren's been going through with Web Forms, MonoRail looks like a good alternative (JP gave a presentation at the Calgary Code Camp and from what I saw it looked promising). MVC hot? A pattern? I guess. However it's a tough call here as SCSF implements MVC and it's not a horrible implementation of the pattern, so how can one be hot and the other not. Also I'll agree that VSTS isn't necessarily hot (more like complex, expensive, etc.) but what are you comparing it to? Hot: XP, TDD, Scrum Not: MSF Agile, MSF for CMMI No argument here and right on the money. I wish MSF Agile was never created. Hot: OR/M, NHibernate, LLBLGen, etc. Not: DLinq, Data Access Block, Plain ADO.NET NHibernate for sure, but LLBLGen generates code that uses ADO.NET under the covers here. I guess the point is that it's not hot to write ADO.NET code directly but have a code generator do it for you? Personally that's fine because anyone that writes their own full DAL is just wasting brain cells. Hot: Open Source (Mono, SourceForge) Not: Application Blocks, CodePlex This confuses me. Open Source is one thing, but it's being compared to... Open Source. The MS Applicaition Blocks are all open source and every project on CodePlex is as well. If you're comparing SF to CP from an open source perspective, neither really are. You can't get CodePlex code at all (there's an Open Source version someone wrote but it's far from complete) and SourceForge hasn't released their code for years with the old code barely able to instal and configure (Alexandria). Better to go with GForge if you're looking to run your own SourceForge site and source code is provided. Hot: CVS, SVN Not: VSS, VSTS Source Control Agreed. VSS is the devil's spawn, although with all the crashing you can get I would suggest SVN is hot and CVS isn't. CVS is better than VSS stability wise, but it's still not all that hot. Hot: Subtext, DasBlog, WordPress, etc. Not: Microsoft MSN Spaces, Community Server Roy is comparing blog software for those that haven't clued in. I do agree that SubText/DasBlog/WordPress is much more powerful and are better blog engines. CS seems to be bloatware now (and I have a bad feeling from it after the last weblogs update). Microsoft does have SharePoint for blogs and it's getting better, but maybe still not ready for primetime to compete with something like DasBlog. The thing about blog software though is that there isn't going to be a giant shift. I mean, let's say the next guy (Google, MS, whoever) comes out with the be-all and end-all blog engine. Do you think thousands of DasBlog or WordPress users are going to migrate en masse? My blog is on CS, so is Roy's. So are we not hot because of this setup and Hanselman is? Okay, I'll stop there as there are some other weird deviations Roy makes. I totally am all in when it comes to simplicity in design, but he compares it to the entire P&P (which started this entire thread the last couple of weeks). I'll bite that CAB is complex and we've done that discussion to death. However where is the more simplistic version of CAB that gives us everything we need? Where's the HOT version of CAB? RYO Winforms, I don't think so. And I haven't worked at Google but being at Microsoft is pretty fun, but I guess that depends on what team you're on. There's also a point he makes about Google Gears being hot and Smart Client not. I haven't had an opportunity to really get into Gears and it sounds great, but things always come in great packages. Is this really the future of apps? I mean, with Silverlight we have super rich clients written in .NET managed code and all doing whatever they need to over the wire. Are going back to writing crappy web apps (maybe with MonoRail to reduce the crappiness) and just plug Gears in and voila, offline capabilities. Is a Silverlight/Gears combination the golden ticket here and Smart Clients go the way of big fat clients from VB6 days long passed. Like I said, I do agree with some of his comparisons, but let's compare apples to apples here. Here's my modified list where it's just one product/technology/concept against the other. I've also ommitted things that Roy and I agree on that are already in his list: Extending the Notification Pattern Example: - Working solution file that compiles and runs (C# 2.0 although with slight modifications [removal of generics] it could work under 1.1) - Implementation of the Model View Presenter pattern. Martin uses the Autonomous View approach in his sample because he's really focused on Notification, but I thought it would be nice to show it implemented with MVP. Autonomous View is a pattern for putting all presentation state and behavior for a window in a single class, but that really doesn't support a base approach that I prefer namely MVP and separation of concerns so the MVP pattern is here for completeness. - Added Rhino mock tests to show how to test the presenter with a mocked out view. I thought this was important as the example is all about UI validation and this would be a good example to mock out a view using Rhino. The Tests It starts with the tests (it always starts with the tests). As I was re-implementing an example my tests were slighted a little bit towards how the sample worked. However I was focused on 3 main validations for the UI: - Policy Number is present - Claim Type is present - Incident Date is present and valid (cannot be set in the future)POLICYNUMBER); 37 Expect.Call(view.IncidentDate).Return(VALIDINCIDENTDATE); 38 Expect.Call(view.ClaimType).Return(VALIDCLAIMTYPE);POLICYNUMBER = ""; 14 private const string VALIDPOLICYNUMBER = "1"; 15 private const string INVALIDCLAIMTYPE = ""; 16 private const string VALIDCLAIMTYPE = "1"; 17 private static readonly DateTime INVALIDINCIDENTDATE = DateTime.MinValue; 18 private static readonly DateTime VALIDINCIDENTDATE =POLICYNUMBER); 80 Expect.Call(view.ClaimType).Return(VALIDCLAIMTYPE); 81 Expect.Call(view.IncidentDate).Return(VALIDINCIDENTDATEPOLICYNUMBER); 42 failIfNullOrBlank(((RegisterClaimDTO)Data).Type, RegisterClaimDTO.MISSINGINCIDENTTYPE); 43 fail(((RegisterClaimDTO)Data).IncidentDate == RegisterClaimDTO.BLANKDATE, RegisterClaimDTO.MISSINGINCIDENTDATE); 44 if (isNullOrBlank(((RegisterClaimDTO)Data).PolicyId)) 45 return; 46 Policy policy = FindPolicy(((RegisterClaimDTO)Data).PolicyId); 47 if (policy == null) 48 { 49 Notification.Errors.Add(RegisterClaimDTO.UNKNOWNPOLICYNUMBER); 50 } 51 else 52 { 53 fail((((RegisterClaimDTO)Data).IncidentDate.CompareTo(policy.InceptionDate) < 0), 54 RegisterClaimDTO.DATEBEFOREPOLICYSTART);POLICYNUMBER); 47 checkError(RegisterClaimDTO.MISSINGINCIDENTTYPE); 48 checkError(RegisterClaimDTO.DATEBEFOREPOLICYSTART); 49 checkError(RegisterClaimDTO.MISSINGINCIDENTDATE); RegisterClaim.cs ServerCommand.cs Domain Layer Policy.cs Presentation Layer FrmRegisterClaim.cs IRegisterClaimView.cs Program.cs RegisterClaimPresenter.cs Service Layer ClaimService.cs DataTransferObject.cs Error.cs Notification.cs Register! I keep Hugh in my back pocket! Introducing. Do as I say, not as I do More fallout from the TestDriven.NET vs. Microsoft department. I read your comments to my blog (no, I didn't moderate any of them) and read through Dan Fernandez's well written and concise response here. Dan is the lead product manager for Visual Studio Express, so other than the legal guys, this is coming from the horses mouth. Phil Haack has a great piece here with his take on it (which has an interesting spin, as he declares MS violated the TestDriven.NET agreement by reverse engineering it to determine how TD.NET works with Express, touche). After reading through everything out there (including all the comments on Jamie's Slashdotted blog) I do understand both sides of the story. I do agree that MS is in their rights to put what they want in their EULA and they're right that users of TestDriven.NET in Express products are violating it. I don't agree that MS is playing by their own rules. Specifically I personally have a real problem with Microsoft saying TestDriven.NET violates a EULA, yet they themselves do exactly the same thing with Popfly Explorer, XNA Game Studio Express, and the Reporting add-in. It's no different than saying cops are allowed to break the law because they're cops. No. You write the rules and live by the rules (lead by example). Just because it's your product doesn't give you the right to violate your own agreement. There's also confusion in this issue because it's an EULA that TestDriven.NET violates. Let's look at that. End User License Agreement. IANAL, but in many cases of "agreements" they have never held up in court. They're simply that, an agreement. You either agree or disagree, but in the end there's no legal ramification either way against you. Remember the Dell incident where the EULA for Windows was shrink-wrapped but yet you had to agree to it. If you opened the package to read the EULA, you were agreeing to it even if you didn't agree after reading it. I do agree with the Blue Monster in that it's their right to put whatever they want in their EULA. It's theirs and they craft it. The thing here is that it's an End User agreement. So who's at fault here? Jamie for building a tool, or everyone who's using it. I believe it's the latter and most Americans will agree (yeah, I'm going to get slack for this generalization) in the same vein as it's not the gun manufacturers that are at fault, it's the people using them. So everyone who's installed TestDriven.NET on an Express SKU and allowed it to run is in violation. Where's the cease and desist orders for all of you? Jamie certainly isn't in the wrong to create the software he did (and MS recognizes this) but users (including himself perhaps, assuming he tested it) are violating their agreement with Microsoft by using it. The general consensus I'm seeing from the community (via comments and blogs) is that MS should patch the Express SKUs to not even allow loading add-ins. Of course, there's still the issue of their own add-ons but I'm sure they could get around that somehow. There's still the question of what specifically Jamie is violating (or rather what clause). Many people are asking that question but I guess it's a legal-speak problem as I can't find anything specific enough from Dan Fernandez's Blog: "Jamie has also made available a version of his product that extends the Visual Studio Express Editions which is a direct violation of both the EULA and “ethos” of the Express product line." If it's a "direct violation" what's the "specific clause" it's violating? Again I read it this afternoon and I can't see it. As for the violation of the "ethos" of the Express product line, ethos [meaning a distinguishing character according to Merriam-Webster] seems very subjective to me depending on who's looking at it. There's part of the EULA that states that you may not "work around any technical limitations in the software". Again, subjective here as I'm not sure that adding new functionality that didn't exist is a work around technical limitation. Express does not have a technical limitation running Unit Tests, it was just never designed with it in. Much like it can't edit images directly, do I voilate the EULA if I build something that let's me manipulate image files in Paint.NET instead of Visual Studio Express? Another comment is on reverse engineering the product (VS not TD) but I know how Jamie wrote his addin and it never reverse engineered anything. It uses a documented and public API that's been there for years. I do like and agree with Frans' comment on Phil's blog entry: "MS should have disabled add-in support in the toolkit. OF course they were tool lazy to do so or technically unable to do so, so they thought they could hide behind a silly phrase in an EULA which isn't even applicable here (as the EULA has no right on what Jamie distributes to OTHERS). If Jamie compiles his code on teh command line the whole EULA argument is moot, just to illustrate the point." So a few options could be pursued at this point: - Jamie removes the Express support for TD.NET. Maybe end of story? He did it before, and only since it was re-enabled has this bear reared it's ugly head. - MS issues a patch to the Express line to not load add-ins. Problem is their own add-ons won't load (unless they themselves circumvent that) - MS finds out everyone who's running TD.NET and issues a cease and desist letter them them because they're violating their EULA. Won't happen and again, they would have to tell their own users of Popfly Explorer and other tools to do this. - MS strong-arms Jamie to remove the product, support, or both. Jamie collapses under legal costs and gives up. Might happen as Microsoft has more than enough resources to just simply throw at this problem to make it go away. What a silly mess. Anyways, I'm done with this thread. Jamie has been Slashdotted, and life will find a way. The pot calling the kettle black.
https://weblogs.asp.net/bsimser/archive/2007/6
CC-MAIN-2018-22
refinedweb
7,153
64.61
On Wednesday 16 May 2012 12:18:57 Don Moir wrote: > > I think the pragma in ffmpeg would be more clutter then the cast but I > have a ffmpeg.h file that does whatever for my needs. For the include > part it does this: > > extern "C" > { > #pragma warning(disable:4244) > #include <libavcodec/avcodec.h> > #include <libavformat/avformat.h> > #include <libswscale/swscale.h> > #include <libswresample/swresample.h> > #include <libavutil/opt.h> > #pragma warning(default:4244) > } > > The #pragma warning number is going to be compiler specific but this does > the trick for MS compiler. I would prefer not to use the pragma so I will > know if I get a warning but it can be so annoying that I do it for > ffmpeg. I do the same but in what is a slightly more cross-platform way. The following disables the warnings for Visual Studio and clang, these are the only two compilers I've found so far that emit warnings for this code. // Switch off the conversion warning we get from libavutil/common.h #if defined(_MSC_VER) #pragma warning( push ) #pragma warning( disable : 4244 ) #elif defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wconversion" #endif extern "C" { # include "libavcodec/avcodec.h" # include "libavfilter/avfilter.h" -- # include "libswscale/swscale.h" } // Re-enable conversion warning #if defined(_MSC_VER) #pragma warning( pop ) #elif defined(__clang__) #pragma clang diagnostic pop #endif --
http://ffmpeg.org/pipermail/ffmpeg-devel/2012-May/124872.html
CC-MAIN-2016-26
refinedweb
228
58.99
BitTorrent For Enterprise File Distribution? Soulskill posted more than 5 years ago | from the make-it-so dept. (5, Insightful) 91degrees (207121) | more than 5 years ago | (#26111385) Re:Sneakernet (4, Insightful) tepples (727027) | more than 5 years ago | (#26111451)." Yes yes yes!!! (-1, Troll) Anonymous Coward | more than 5 years ago | (#26111557)! Re:Yes yes yes!!! (0, Offtopic) kurt555gs (309278) | more than 5 years ago | (#26111793) To bad I don't have any mod points, this one (above troll) is better than the usual. Re:Yes yes yes!!! (0) Anonymous Coward | more than 5 years ago | (#26111847) No way, that's kiddie pr0n! And with a (probably) illegal alien at that! For shame. Re:Yes yes yes!!! (0) Anonymous Coward | more than 5 years ago | (#26111879) A 17 y/o having sex with a 15 y/o is legal almost everywhere, except some US states. Re:Yes yes yes!!! (2, Funny) Anonymous Coward | more than 5 years ago | (#26111813) Slashdot: news for nerds, stiffs that matters. Re:Sneakernet (1) 91degrees (207121) | more than 5 years ago | (#26111659) If so, the data is just as good on a DVD as on a hard disk. If not my idea's rubbish but suggesting it was inexpensive. Re:Sneakernet (1) Tokerat (150341) | more than 5 years ago | (#26111681) If that's the case, you would need a store to run setup.exe every time... Re:Sneakernet (1) the_B0fh (208483) | more than 5 years ago | (#26111749):Sneakernet (1) neomunk (913773) | more than 5 years ago | (#26111867) I don't think that putting a DVD into a (hopefully) physically secured computer is as automagical as doing absolutely nothing on the client end while a script/daemon takes care of all the work. Re:Sneakernet (4, Insightful) maxume (22995) | more than 5 years ago | (#26111941) Also, burning (and packaging and mailing...) a bunch of DVDs isn't necessarily cheap/quick/easy, so it breaks down pretty quickly as the number of stores increases. Re:Sneakernet (1) fxkr (1343139) | more than 5 years ago | (#26111617) Re:Sneakernet (0) Anonymous Coward | more than 5 years ago | (#26111697) First: You mean latency, not bandwidth. Second: Things change so you can't just repeat this line year after year, you have to revisit the question regularly. What does the math look like in 2008? What would be an estimate of disc cost + mailing cost + recurring employee time cost vs file transfer cost? Re:Sneakernet (1) 91degrees (207121) | more than 5 years ago | (#26111923) No. I mean bandwidth. Latency is meaningless here because you're just sending a disc out. The data transfer rate is 4GB over a couple of days which is somewhere in the order of 10-100Kbits/s. Re:Sneakernet (0) Anonymous Coward | more than 5 years ago | (#26111983) No, bandwidth is meaningless because it can scale trivially (just send more DVDs). Oh and I guess you did the math and it didn't work out in your favor. I thought so too. BitTorrent (-1, Troll) Anonymous Coward | more than 5 years ago | (#26111393) better approach (-1, Offtopic) Anonymous Coward | more than 5 years ago | (#26111397). Different torrent client ? (5, Informative) drsmithy (35869) | more than 5 years ago | (#26111399) Re:Different torrent client ? (5, Interesting) Anonymous Coward | more than 5 years ago | (#26111471) rtorrent [rakshasa.no] watching a directory for .torrent would be the way to go. And then use unison [upenn.edu] to keep the .torrent directory in-sync. Re:Different torrent client ? (0) Anonymous Coward | more than 5 years ago | (#26111569) I think even uTorrent can monitor a directory =] Re:Different torrent client ? (1) rusl (1255318) | more than 5 years ago | (#26111831) Re:Different torrent client ? (0) Anonymous Coward | more than 5 years ago | (#26111803) uTorrent and Azureus both do this. Storm or some other botnet (1, Funny) Anonymous Coward | more than 5 years ago | (#26111403) Ask a warez site. Dedicated Server (0, Flamebait) Szentigrade (790685) | more than 5 years ago | (#26111405) technologies working together isn't patchwork (1) Yonkeltron (720465) | more than 5 years ago | (#26111413) ask us (4, Informative) TheSHAD0W (258774) | more than 5 years ago | (#26111417). Snail-mail USB sticks (-1, Redundant) timeOday (582209) | more than 5 years ago | (#26111421) Re:Snail-mail USB sticks (5, Insightful) SirLurksAlot (1169039) | more than 5 years ago | (#26111477):Snail-mail USB sticks (2, Insightful) hedwards (940851) | more than 5 years ago | (#26111851) that bittorrent has similar capabilities. Works great (5, Insightful) Anonymous Coward | more than 5 years ago | (#26111427) BitTorrent is an excellent intranet content-distribution tool; we used it for years to push software and content releases to 600+ Solaris servers inside Microsoft (WebTV). -j Sure, why not? (5, Insightful) sexybomber (740588) | more than 5 years ago | (#26111431):Sure, why not? (0) tylerni7 (944579) | more than 5 years ago | (#26111827) If that wasn't what he meant, well, maybe it should be inappropriate. There is certainly nothing wrong with bittorrent, but I'm not sure how the clients would react if they knew that they had to use their bandwidth to push your software. They might be fine with it, especially if it's a closed network, and that bandwidth can't be put to any good use. However, unless it was already written in a contract somewhere that they agree to let you use their connection for anything, I don't think it would be appropriate to silently push bittorrent clients on their machines that they don't know about. Re:Sure, why not? (2, Insightful) Bert64 (520050) | more than 5 years ago | (#26111835) Pirates still prefer FTP, it seems all of the big warez groups are still pushing files around using FTP... Re:Sure, why not? (2, Interesting) hedwards (940851) | more than 5 years ago | (#26111871). rsync (5, Informative) timeOday (582209) | more than 5 years ago | (#26111439) In a word, Yes (4, Informative) cullenfluffyjennings (138377) | more than 5 years ago | (#26111443) I've seen bittorrent used for several business critical functions. One example is world of warcraft distributing updates using it. Re:In a word, Yes (-1, Offtopic) Anonymous Coward | more than 5 years ago | (#26111801) Re:In a word, Yes (1) hedwards (940851) | more than 5 years ago | (#26111875) I suspect that the GP is either referring to professional farmers or to Blizzard's own staff. Re:In a word, Yes (5, Insightful) nabsltd (1313397) | more than 5 years ago | (#26111927) For Blizzard, updates to World of Warcraft are very much a "business critical function". World of Warcraft uses it. (0) gblackwo (1087063) | more than 5 years ago | (#26111449) Cisco already makes a product to do this - WAAS (5, Informative) colinmcnamara (1152427) | more than 5 years ago | (#26111453):Cisco already makes a product to do this - WAAS (2) CaymanIslandCarpedie (868408) | more than 5 years ago | (#26111721) identical, this product wouldn't really provide any benefit. If the file is basically identical then you can do the same thing with rsynch or similar for free. Even if they are identical, the functionality you are talking about is based on local caching. Since the files being moved are only moved once a month (depending on other data moving between sites and size of disk cache the unit has) that cached could likely have been cleared by the next months data is moved. Again rendering this expensive solution useless. use Again, I love WAN acceloration and if properly used and understood in the right situations, it is some of the most useful and worthwhile pieces of kit in any datacenter. However, for the use mentioned. Doesn't seem the right fit to me. Re:Cisco already makes a product to do this - WAAS (4, Interesting) Bert64 (520050) | more than 5 years ago | (#26111863) Bittorrent will transfer the differences too, if you make a new file overwrite an old one, it will replace any chunks which are different. Re:Cisco already makes a product to do this - WAAS (3, Informative) Anpheus (908711) | more than 5 years ago | (#26111967) (3, Insightful) jamiebecker (160558) | more than 5 years ago | (#26111977) using files as they're being written: some scripting -- rsync or BTdownload -- would fix this. copy the files to a working location when the update is complete, and then work from there while updates are restarted on the temp dir. Azureus (0) Anonymous Coward | more than 5 years ago | (#26111459) Azureus, for instance, will happily check a directory regularly for torrents and just start downloading those. It should be trivial to apply some sort of external mechanism to PUTting such torrents in place on needed computers. Bittorrent is not secure (1) Hal_Porter (817932) | more than 5 years ago | (#26111461). You could probably rig up a system where scripts check secure FTP servers for updates, and download them. Cascade the SFTP servers so that each one feeds out to two more, geographically close ones and you'll be ok. If possible only download diffs, not the whole thing. And find an SFTP client which will pull several files at a time since that gives better throughput on high latency connections which are window size limited. Re:Bittorrent is not secure (5, Informative) jd142 (129673) | more than 5 years ago | (#26111537):Bittorrent is not secure (1, Offtopic) Hal_Porter (817932) | more than 5 years ago | (#26111677) I've worked at places that use IPSec or VPN. A common problem is that the server is loaded down so the secure connection is rather slow. So people will use VPN to pick up email/access the intranet when they need to and plain IP for internet access. Or people will bring laptops home and use plain IP on their unsecured home wireless network. Problem with this scheme is that if one of the machines with the files on is abused like this you could potentially have a problem. And if the files end up on pirate bay or you'll probably get fired no matter how encrypted they are. Now in an ideal world everyone would understand things enough to not connect a secure machine to the public internet and also that it doesn't matter if files leak if they are sufficiently encrypted. Or that as you put it "if a competitor wanted the information there are easier ways to get it". But we don't live in that world. Mind you I'd define sufficiently encrypted as something much more secure than a passworded ZIP file. Re:Bittorrent is not secure (1) rusl (1255318) | more than 5 years ago | (#26111893) Re:Bittorrent is not secure (1) SanityInAnarchy (655584) | more than 5 years ago | (#26112101):Bittorrent is not secure (1) nabsltd (1313397) | more than 5 years ago | (#26111947).. If the CIO expects "official" support... (5, Informative) aktzin (882293) | more than 5 years ago | (#26111473). CIO's want pre-built software (1) obstalesgone (1231810) | more than 5 years ago | (#26111491) Get it pre-built and externally supported. It'll be a lot easier to fly by your CIO. The solution you suggested makes sense. 1. RSA keys are shared across the network. 2. A new file becomes available on your "central" server and is placed into a directory automatically shared by a bt client on the central server. 3. A simple script on the central server checks a list of servers it needs to update, and tells each of them to initiate a transfer using the bittorrent protocol. 4. ??? 5. Profit. Re:CIO's want pre-built software (2, Insightful) obstalesgone (1231810) | more than 5 years ago | (#26111505) Better yet, tack on: 6. Give the script that handles this a name, build deployment tools, and release them under GPL. No, you fool! (5, Funny) bistromath007 (1253428) | more than 5 years ago | (#26111493) Re:No, you fool! (2, Interesting) Mad-Bassist (944409) | more than 5 years ago | (#26111991) Oooooh... I can see the whole issue of throttling suddenly becoming very amusing as the corporate behemoths start slugging it out. WAFS from GlobalScape (1, Informative) Anonymous Coward | more than 5 years ago | (#26111509) We do something similiar using WAFS by GlobalScape (Previously Availl). It provides bit-level updates to data either on a schedule or continuously, and can keep a specified file version archive too. The continuous update to HQ should keep DSL utilisation low. Chained client/server (4, Insightful) Manfre (631065) | more than 5 years ago | (#26111515)? (1) abigsmurf (919188) | more than 5 years ago | (#26111527) why not spread out the backups? Limit the bandwidth of the backups to allow enough regular traffic and have different stores send their backups on different days Re:load balancing? (1) rusl (1255318) | more than 5 years ago | (#26111921) Re:load balancing? (4, Interesting) abigsmurf (919188) | more than 5 years ago | (#26112125) SurgePlus Offsite File Synchronization. (-1, Offtopic) Blowit (415131) | more than 5 years ago | (#26111541) I think you should check out for a product called Surgemail. It has a built in program called Surgeplus, a client that synchronizes any folders you want. You could create a script on each machine to do daily archival changes and have Surgeplus automatically upload these files to Surgemail. I know this is a mail server however for 5 accounts this is free to use. You can log into the same account and have each offsite to have a backup of all the files in a distributed manner. so the storage folder you want to backup to would be like this: c:\Offsite\Store001 -- current store backup is stored in c:\Offsite\StoreXXX -- Other stores will sync into these folders automatically (will automatically create it from the server) On the server you would have the folder you want to store it in as: ... private/Backup/Store001 private/Backup/Store002 private/Backup/Store003 BEST OF ALL, THIS IS FREE for under 5 users. Since you only need to login as the same user, it will be synchronized across all of your remote stores giving you full offsite secure backup. No need to pay for offsite backup services. This is also a full fledged mail/calendar server so if you want to use that portion too, it is the least expensive mail server to use internally. Check it out and give it a try. My clients love it! Re:SurgePlus Offsite File Synchronization. (1) Blowit (415131) | more than 5 years ago | (#26111577) Here are the direct links for the product: BITSAdmin (0) Anonymous Coward | more than 5 years ago | (#26111545) WTF? (-1, Flamebait) rerunn (181278) | more than 5 years ago | (#26111551) WTF does the business sector have ANYTHING to do with what protocol you use?? The business wont give a crap if you used smoke signals, as long as they get their shit when they need it. I could imagine a homebrew tracker, with uTorrent and an RSS feed at each site, but that sounds a little too patchwork to fly by the CIO Go to the kitchen, get the dullest butter knife you can find, and then try your hardest to slit your left wrist. Grind as hard as you can. If you dont see bone, keep trying. Try harder. Did ya really need to submit an article to figure this out?? Re:WTF? (1) the_B0fh (208483) | more than 5 years ago | (#26111815). Captain disillusion (4, Informative) jonaskoelker (922170) | more than 5 years ago | (#26111559):Captain disillusion (0) Anonymous Coward | more than 5 years ago | (#26111949) Otherwise, your ISP's router, diligent in separating traffic though it may be, can get hacked. It is clear you missed the bit about IPSec... or perhaps don't know what it does. The whole idea of VPNs, or encryption in general, is that they assume every point between you and your destination is Carol and they protect your data anyway. So yeah, you're right, it's not 100% guarenteed to be invulnerable, but to break it you'd have to guess an unreasonably hard to guess number. More like 99.9999% guarenteed (assuming you do your initial key distribution properly and don't let people do dumb things on the machines on each end of the VPN tunnerl) Re:Captain disillusion (0) Anonymous Coward | more than 5 years ago | (#26111953) Yes the ISP's routers could get compromised, but that's the whole point of IPsec - so that someone in the middle can't read your traffic. Re:Captain disillusion (0) Anonymous Coward | more than 5 years ago | (#26112111) Unless you have very long wires, some box is going to route them. Are those your own? Otherwise, your ISP's router, diligent in separating traffic though it may be, can get hacked. Unless the traffic is encrypted with IPsec before it gets to the ISP's router. Many large ISPs offer a hosted VPN service, where the ISP manages everything for you. From the article summary it isn't clear if they use a hosted VPN service or they just purchase regular DSL and have a VPN router that is configured to null-route non-VPN traffic. And it doesn't matter who owns the router, but who pwns it :) Re:Captain disillusion (1) Seth Kriticos (1227934) | more than 5 years ago | (#26112133) To go back to the topic: If you don't trust your ISP (legitimate thing) then you should encrypt the data before sending. If you use a sophisticated encryption algorithm (like AES or serpent) and then send it out, then the listeners will have some problems reading the data. You probably even could use public BT in such a case with rsync'ed To go back to my original topic, the smartest thing to do is to lower the probability of data infiltration. So use a IPSec'ed VPN to send out encrypted form of the archives via rtorrent. I know, eats resources, but it would be fun, no? How I would do it... (5, Interesting) LuckyStarr (12445) | more than 5 years ago | (#26111605) ... How is the VPN setup (5, Informative) eagle486 (553102) | more than 5 years ago | (#26111637) Your best bet is multicast, there are programs for software distribution that use multicast. Re:How is the VPN setup (0) Anonymous Coward | more than 5 years ago | (#26111857) If the VPN is setup in a standard hub and spoke configuration then bittorrent would not help since all traffic between sites has to go via the central site. Did you read the article summary? (emphasis added) "private network of retail stores connected to our corporate office (and to each other) with IPsec over DSL" it's called dsync (5, Interesting) slashdotmsiriv (922939) | more than 5 years ago | (#26111639) (4, Informative) slashdotmsiriv (922939) | more than 5 years ago | (#26111657) I hate to reply to my posts, but this link has an even shorter description of the tool: conferences.sigcomm.org/sigcomm/2008/papers/p505-puchaA.pdf Call me old fashioned (1) Hognoxious (631665) | more than 5 years ago | (#26111649) Cleversafe? (1, Informative) Anonymous Coward | more than 5 years ago | (#26111655) You should take a look at cleversafe.org - it's an opensource 'dispersed storage' infrastructure which allows you to slice up files and distribute them across a network of storage servers. Not sure if this would get you what you want, but it's worth looking into. Foldershare? (1, Informative) MunkieLife (898054) | more than 5 years ago | (#26111699) Rsync or DFS sound like good choices (0) Anonymous Coward | more than 5 years ago | (#26111715) You don't say if the files are changed at the remote sites, or just at head office. Rsync is an option - have 10 remote sites replicate from the master, then have other stores replicate from the submasters. You don't say if you're running windows, but the distributed file system [wikipedia.org] works pretty well. Supports remote differential compression. uhhhhh multicast? (1) branto (811992) | more than 5 years ago | (#26111745) Use existing technology (5, Funny) Mostly a lurker (634878) | more than 5 years ago | (#26111747) IPSec over DSL (1) kabloom (755503) | more than 5 years ago | (#26111755) Are you using IPSec in Tunnel mode or Transport mode? If you're using it in tunnel mode, then you're not going to fix your bandwidth problem, because all data has to go through corporate HQ anyway because that's where the tunnels end. Downtime? (0) Anonymous Coward | more than 5 years ago | (#26111789) Um, ok the data goes down and you have it everywhere but the main site that needs to download it again at a capped rate. How do you get it back to the hosting data site rapidly enough to be useful? A encrypted usb memory key and a stamp go a long way. Seriously it's a good idea and nice in practice but have you ever tried sitting there on your hands while a boss with a whip watches you download the company files at 150k/s. If this is to be able to backup your branch office sites and restore remotely that is fine, I just wouldn't want a 3hr downtime to show up on my record while you retransmit data. I actually have backups go to other sites across the nation now because of hurricanes damage or if the world ends and the future civilization's life hangs in the balance of our spreadsheet data. It is more my last line of defense. Depending on VPN topology (1) Razron (12415) | more than 5 years ago | (#26111823) Most VPN setups like this are hub and spoke with the central office being the spoke. So connections that go from one remote sit to another still have to go through the central office. So you still have a bandwidth problem at the central office. If you have your VPN setup as a mesh so it has connections to multiple sites you might be able to get this to work. The problem you run into then is most inexpensive VPN solutions will only be able to handle so many different VPN tunnels before they run out of CPU. Not know what you used to setup your remote offices as a VPN concentrator this may not be a problem. Hadoop DFS sounds more appropriate (1) kevinodotnet (122092) | more than 5 years ago | (#26111837) Why not use the Hadoop distributed file system [apache.org] ? It offers automatic replication and you can treat each "store" as a "rack" to guarantee multiple remote backups. You also get the immediate advantage of having a single file namespace and instant streaming access to all of the files from any single location. The only advantage to Bittorrent that I can see is faster recovery time since a single store can source the backup from from N other stores (instead of 2, or whatever number of replications you have decided on). Sub.TV already does this (0) Anonymous Coward | more than 5 years ago | (#26111873) Sub.tv use bittorrent to distribute large video files to plasma screens in student unions - they auto-download - IIRC, it's an older Azureus client, presumably written with a plug-in, that ran on an always-on windows box. It seems an entirely appropriate mechanism for it, and they're already doing what you seem to want! rsync (1) ratsbane (1363433) | more than 5 years ago | (#26111881) Use Existing Tape Backup Software Features (0) Anonymous Coward | more than 5 years ago | (#26111899) I have used commercial packages like the Enterprise Backup Solution we already use to backup data to tape to mirror files. Even across a SLOW AS CHRISTMAS T1 connection it works VERY well to only copy the files that change on a daily basis. So, unless you are modifying GIGS of data at-a-time, keep it simple. Lotus Domino! (0) Anonymous Coward | more than 5 years ago | (#26111903) Lotus Domino! It's replication keeps databases/websites and documents/files contained within them in sync across multiple servers. You can specify how the data is distributed across the network with connection documents. Integrate a datacenter server (1) Korkman (704276) | more than 5 years ago | (#26111915) Setup a cheap file server in a datacenter, hook it up into your VPN network and store all backups there. Use rsync - very fast, uses SSH nowadays for auth and encryption. Encrypt the whole backup partition (dmcrypt, truecrypt, etc.) and keep the key private. Manual mount and key entry after rebooting. That way datacenter operators can't (easily) gain access to the files. Or transfer already encrypted files, which will destroy rsync performance, though. Set SSH and all the other services to listen on the VPN IP only, making the machine invisible to the common internet. Not as fancy as Peer-To-Peer distribution, but very reliable and fast. Also you get less administrative headaches, I think. Windows DFS -- Dont use FRS (5, Informative) anexkahn (935249) | more than 5 years ago | (#26111943) Re:Windows DFS -- Dont use FRS (0) Anonymous Coward | more than 5 years ago | (#26112005) Rely on someone else's bandwidth (0) Anonymous Coward | more than 5 years ago | (#26111979) NFS with DFS (1) flyingfsck (986395) | more than 5 years ago | (#26112127) Try looking into CleverSafe (0) Anonymous Coward | more than 5 years ago | (#26112131) Do not use BitTorrent (0) Anonymous Coward | more than 5 years ago | (#26112153) Take a look at your company's network topology. If it is a typical branch setup, like "hub and spoke" where your branches are all remotely connected through the central head office, then BitTorrent will waste bandwidth. Why have a peer to peer application like Bittorrent routing traffic from a branch, up to the head office, and back down to another branch? You do not want to impact other applications running across the WAN on a remote branch. Unless your WAN topology is fully meshed, peer-to-peer apps are probably not so efficient. It's better to use a direct-push strategy. Take a look at Microsoft DFS (distributed file system) - you can control replication links and times, or use a protocol like FTP and put QoS network restrictions on it. Schedule pushes for off-peak hours, where possible. Stagger updates to each branch, if necessary. My company uses an IBM product called Tivoli to push updates to branches, because it has bandwidth control capabilities. There are other apps like this out there (probably cheaper as well). BitTorrent is better suited to Internet downloads, and because bandwidth is controlled autonomously in each client, what's to prevent client's in different sites from hogging all the bandwidth in any given branch? More commercial solutions... (1) Strawberry (97160) | more than 5 years ago | (#26112159) Both Kontiki and Ignite sell enterprise-type (supported, maintained etc.) P2P systems that can be deployed internally if you need something off-the-shelf.
http://beta.slashdot.org/story/111543
CC-MAIN-2014-41
refinedweb
4,427
69.01
09 February 2012 08:38 [Source: ICIS news] SINGAPORE (ICIS)--China’s Panjin Heyun Industrial Group is planning to start up its new 200,000 tonne/year methyl tertiary butyl ether (MTBE) plant at Panjin in Liaoning province during March/April, said a source close to the company on Thursday. The unit was earlier due to start in January, but it has been pushed back to March/April, said the source, without elaboration. Upon completion of the project, the company’s overall MTBE capacity will increase to 450,000 tonnes/year, making it the largest MTBE producer in ?xml:namespace> Meanwhile, Panjin’s two MTBE plants at the same site are running at above 90% capacity. The plants have a nameplate capacity of 50,000 tonnes/year and 200
http://www.icis.com/Articles/2012/02/09/9530727/chinas-panjin-heyun-plans-to-start-up-mtbe-plant-in-marchapril.html
CC-MAIN-2014-10
refinedweb
129
56.59
More and more often, we see schema designs that use UUIDs as primary keys. That's a valid choice if you're concerned about sharding and partitioning your database, but it has its own drawbacks, sometimes in unexpected places. If you're working on a system big enough that needs to use UUIDs, chances are that at some point you'll have to turn those UUIDs into strings, perhaps in order to pass them across different systems. In order to serialize the UUID into a string, Python has to format the UUID's hex property into a string containing hyphens, as RFC 4122 requires. And in order to do that, it has to slice that property 5 times. def __str__(self): hex = '%032x' % self.int return '%s-%s-%s-%s-%s' % ( hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:]) This is fasted way to do it, and it isn't usually a bottleneck per-se, as the overhead is minimal. However, it's common for UUIDs to be used in scenarios where there's a lot of data and computation, and in some situations you might find yourself serializing a homogenous set of UUIDs over and over. This might happen in a situation where you have a 'heap' of hotter model instances that ares processed more often than most. import random import uuid uuids = [uuid.uuid4() for _ in range(99)] normal_distrib = [random.choice(uuids) for _ in range(9999)] for uuid in normal_distrib: [str(uuid) for _ in range(100)] In this situation, the overhead adds up, and could become a bottleneck you'd never think about. You could use uuid.hex instead of the serialized value, but that would break the RFC and, more pragmatically, it would make the data not really portable across systems or languages. Your best option is going to be the lru_cache decorator. First, abstract the logic that's calling the serialization into a function that you can decorate: def some_logic(): for instance in instances: requests.post(url, {'uuid': str(instance.pk)}) from functools import lru_cache @lru_cache(max_size=None) def post_instance(instance): requests.post(url, {'uuid': str(instance.pk)}) def some_logic(): for instance in instances: post_instance(instance) Note: You might be tempted to abstract the str call itself: @lru_cache def uuid_to_str(uuid): return str(uuid) def some_logic(): for instance in instances: requests.post(url, {'uuid': uuid_to_str(instance.pk)}) That's not really a good idea. You'll end up caching too much. The cache size will be wasted in calls that are rarely reused, making the more common calls incur in cache misses. Next, add logging to get some insight. This will tell uis if our caching is actually effective, and gives us some indication of how big the cache size should be: import logging logger = logging.getLogger(__name__) def some_logic(): for instance in instances: post_instance(instance) logger.debug(post_instance.cache_info()) Briefly run the code against production data, and you'll get something like this in your logs: CacheInfo(hits=126, misses=8, maxsize=32, currsize=8) If hits is really low, then you know lru_cache won't help you with this data. Your dataset of UUIDs is too heterogenous to take advantage of caching. currsize gives you an idea of how big of a cache you might need and what you should set lru_caches maxsize argument to. Keep in mind that higher values will use more RAM, and we're not really interested in perfectly caching every single value that's used more than once. We just want to cut down on the most common ones most of the times. As rule of the thumb, if currsize is smaller than 512, I would set maxsize to that value plus some room (I like to go to next power of 2). Otherwise, I would cap maxsize to 128. In our cexample, I would use max_size=16: @lru_cache(max_size=16) def post_instance(instance): requests.post(url, {'uuid': str(instance.pk)}
https://www.revsys.com/tidbits/caching-uuids-win/
CC-MAIN-2019-26
refinedweb
660
63.49
The Tutorial illustrates a program in JDBC Prepared Statement Insert. In this Tutorial the code describe the include a class JdbcPreparedstatementInsert, Inside the class we have a main method follows the list of steps as follow - Importing a java.sql provides you a network interface that enables you to communicate between front end application in java and database in backend. Loading a driver inside the try block by calling a class.forName ( ),that accepts a driver class as argument. DriverManager.getConnection ( ) - The method enables you to built a connection between url and database. In the given below code, we declare String variable sql,that is used to hold the insert value into the employees table. prepare Statement ( ) - Unlike create Statement, the prepare Statement is used to execute the same statement object, if it is repeated again. Normally this reduces the time of execution to execute the code. set String ( ) - This is a method defined in prepared Statement class, When you want to substitute a question mark place holder in code, we use set XXX,In case we want to substitute a question mark place holder by string ,then we write set String( ). execute Update ( ) - This method return you a integer value show you the number of rows inserted in a table. This also indicates a numbers of rows affected in the table. execute Query ( ) - This method return you the result set ,that store the value of record set. The select sql statement is used to retrieve the record from table in database. next ( ) - This method is used to retrieve the next series element in the result set. Finally the Print ln show you the output as specified below the code In case the exception exists in try block, the catch block caught and handle the exception.JdbcPreparedstatementInsert.java import java.sql.*; public class JdbcPreparedstatementInsert {); con.setAutoCommit(false); String sql = "insert into Employees (FirstName,LastName) values(?,?)"; pst = con.prepareStatement(sql); pst.setString(1, "Girish"); pst.setString(2, "tewari"); pst.executeUpdate(); pst.close(); sql = "select * from Employees"; pst = con.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { System.out.print(rs.getString(1) + "\t"); System.out.print(rs.getString(2) + "\t"); System.out.println(rs.getString(3)); } rs.close(); pst.close(); con.close(); } catch (Exception Prepared Statement Insert View All Comments Post your Comment
http://www.roseindia.net/jdbc/prepared-statement-insert.shtml
CC-MAIN-2017-09
refinedweb
382
50.23
This is the code that I have and for some reason it is not given me that I need. #include <iostream> #include <iomanip> using namespace std; int main () { // variables double salary = 0.0; int RATE = .03; // enter salary cout << "Salary (-1 to stop): "; cin >> salary; // display raises with 2 decimal places cout << fixed << setprecision(2); //begin loop while (salary != -1) { cout << "Annual Raises for next three years: " << endl; // while loop to calculate annual raises while (RATE < .07) { // display annual raise amount cout << RATE * 100 << "% raise: "; cout << salary * RATE << endl; // update salary value and annual raise rate. salary += (salary * RATE); RATE += .01; //enter salary cout << "Salary (-1 to stop): "; cin >> salary; // reset variables RATE = .03; } //end of loop return 0; } // end of file } I need to display the amount of annual raises for the next three years. All it is giving me is where the user can put in a salary and then nothing for the raise. It is not even letting me end the program by entering (-1). Please someone help me??????
https://www.daniweb.com/programming/software-development/threads/428874/something-went-wrong
CC-MAIN-2017-26
refinedweb
172
82.44
This is a classic ’toy’ data set used for machine learning testing is the iris data set.. The iris data set comes preloaded in scikit learn. Let’s load it and have a look at it. import numpy as np from sklearn import datasets iris=datasets.load_iris() # The iris dataset is an object that contains a number of elements: print (list(iris)) OUT: ['data', 'target', 'target_names', 'DESCR', 'feature_names'] # feature_names shows data field titles: print (iris.feature_names) OUT: ['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width (cm)'] # data is the data for each sample; columns described by feature_names: # lets' print just the first 10 roes print (iris.data[0:10]) OUT: # data is the data for each sample; columns described by feature_names: # lets' print just the first 10 roes print (iris.data[0:10]) [[5.1 3.5 1.4 0.2] [4.9 3. 1.4 0.2] [4.7 3.2 1.3 0.2] [4.6 3.1 1.5 0.2] [5. 3.6 1.4 0.2] [5.4 3.9 1.7 0.4] [4.6 3.4 1.4 0.3] [5. 3.4 1.5 0.2] [4.4 2.9 1.4 0.2] [4.9 3.1 1.5 0.1]] # target_names lists types of iris identified: print (iris.target_names) OUT: ['setosa' 'versicolor' 'virginica'] # target lists the type of iris in each row of data: # this maps to the target_names print (iris.target)] # DESCR gives us description of the data set: print (iris.DESCR) OUT: ... Data sets in scikit learn load_boston: boston house-prices dataset (regression). load_iris: iris dataset (classification). load_diabetes: diabetes dataset (regression). load_digits: digits dataset (classification). load_linnerud: linnerud dataset (multivariate regression). load_wine: wine dataset (classification). load_breast_cancer: breast cancer wisconsin dataset (classification). Other sources of test data sets One thought on “61. Machine learning: The iris data set”
https://pythonhealthcare.org/2018/04/14/61-machine-learning-the-iris-data-set/
CC-MAIN-2018-51
refinedweb
311
66.13
#include <ares.h> int ares_set_servers(ares_channel channel, struct ares_addr_node *servers) The name server linked list pointer argument may be the result of a previous call to ares_get_servers(3) or a linked list of ares_addr_node structs setup by other means. This function replaces any potentially previously configured name servers with the ones given in the linked list. So, in order to configure a channel with more than one name server all the desired ones must be specified in a single list. ares_set_servers(3) does not take ownership of the linked list argument. The caller is responsible for freeing the linked list when no longer needed. This function is capable of handling IPv4 and IPv6 name server addresses simultaneously, rendering ares_init_options(3) with optmask ARES_OPT_SERVERS functionally obsolete except for IPv4-only name server usage.
http://www.makelinux.net/man/3/A/ares_set_servers
CC-MAIN-2014-15
refinedweb
132
50.16
There are so many great projects that can be created with Python programming. Today, we look at rolling the dice game made by the i:Imagine class. This game requires the understanding of randomness. For example, in real life every time you toss a dice, you get a random number, right? Therefore when students run the program, random values come up each time. Another critical concept for this game is the use of functions and loops. - Functions are efficient ways of writing scripts. They allow programmers to repeat commands instead of typing the same codes over and over again. In the example below, dice_roll is the function that makes the code to repeat multiple times without typing it again. import random def dice_roll(): question1 = input(“pick a number between 1 and 6”) r = random.randint(1,6) print(“this is your number”,r) ask= input(“do you want to continue or quit”) if ask == “continue”: dice_roll() else: print (“goodbye”) dice_roll()` 2. Loops allow for repetition. For example if the student wants to ask a user a question 3 times, they use a loop to automate that process. To plan and analyse their program, students use flowcharts. You start the game by clicking RUN. To continue with the game, students type ‘’yes’ to get the random numbers. To end the game the student types ‘no’ Application: The idea of random is applicable in board games. - [Telecoms] Numerical methods to filter out noise in communication systems - [Polling] Exit polls to predict outcome of elections
https://www.tinkeredu.net/the-classic-dice-game-with-python/
CC-MAIN-2022-05
refinedweb
252
66.13
- Advertisement This stream auto-updates - Past hour Hemisphere used for lighting and heavily smoothed meshes JoeJ replied to NikiTo's topic in Math and Physicshmmm... One idea would be to lerp between face normal in interpolated normal with face normal dot product, so at shallow angles expose low poly mesh but prevent artifacts. I guess this works fine for N dot L, because at silhouettes the real mesh becomes visible anyways. Curious how this would look for integrated lighting over the hemisphere... - Today Hemisphere used for lighting and heavily smoothed meshes Hodgman replied to NikiTo's topic in Math and PhysicsHaving light rays below the hemisphere is one thing... But this situation can also cause the viewing ray to be below the horizon (so N dot V is negative). Some BRDFs give crazy results in that case, so you have to clamp it to zero... and if you clamp it to zero, you can end up with a weird edge area with flat/cut-off looking shading. (FWIW, both light rays and view rays should be of equal importance because of Helmholtz reciprocity -- swapping L and V in a BRDF should give identical results -- but in practice I've noticed some differences) I'm interested in workarounds too 😅 Simple solution is to just try not to use such low-poly meshes such that the vertex normal vs triangle normal can be extremely different... Also, if you've baked normal maps from a very high poly mesh onto a low poly one, then the normal map will somewhat correct for this issue on the low poly mesh (but at the same time, may also cause the problem...) If you do this for viewing rays, you end up with ugly black regions that show up around mesh silhouettes... And if you do it for light rays but not view rays, you've violated Helmholtz reciprocity (fine for a hacky renderer, not for a film quality offline one). Vincenzo Manto joined the community C# Trying to implement a basic utility base AI setup in Unity 3dmodelerguy posted a topic in Artificial IntelligenceSo I am attempting to implement a basic start to a utility based AI in Unity and I have something that seems to be working and wanted to get any impressions people might have about how I have it setup, all the relevant code can be found here that implements a basic AI for moving and being idle: 1st SDL Engine Drawing BMP Blank Screen Lactose replied to Alio's topic in For Beginners's ForumStart by checking for errors wherever you have SDL calls, especially where you're loading and creating the texture. Check the return value, then call SDL_GetError() if needed. Use the documentation to determine how to properly check for errors; the easiest way is to just type in the function call name in the search box, top left. For example: Your very first call is SDL_LoadBMP. The documentation for this call says that this returns null if there was an error. Thus, check the return value to see if it's null before going continuing on. Game engine for a 10 years old fredrick91 replied to Acharis's topic in Engines and MiddlewareI'm with "Chillehh", Game Maker 4 through to 7 was my go-to toys when I was 10-14, (mid-2000s). It has some great built-in tools for animation, teaches you about object orientation, (a a simple level), and it just works! I didn't have internet, so I just looked at the samples. The beginner level is mostly putting boxes in order, a great way to learn an visualize the code in your head. Then later on you can learn/teach GLM, the scripting language which mostly does away with all the boxes. You have if-statements, loops and other common things to scripting. Take a look at it, it's(at least was) great! Coding with boxes(visually) Good tutorial: More advanced coding: Dynamic lighting in Fateless VoxycDev posted a blog entry in Voxyc DevelopmentDynamic lighting now works in Fateless. There are still no normals and no shadows, but hopefully this will be the necessary breakthrough to make it look from "whack" to "not that bad." Directional spotlights are the next goal. The overall mesh of the buildings and terrain should reflect the skybox, so in this case ambient light should probably be more orange. Get it on Google Play A good 3D math library in C for OpenGL? fredrick91 replied to babaliaris's topic in Math and PhysicsI would recommend GLM, since it is made to have similar styntax to GLSL, so you can write your math in the same way; both server-side and client-side. Especially if you enable swizzling, "vec3 v = other.xyz;". It is not a DLL, so no linking required. I'm with "a light breeze" on not dropping C++. It will probably serve you better to work in C++ than C, if you want to make games and work with graphics. There is no need to learn C first and then move on to C++, since the languages grow increasingly distant by each new release. Not sure about C-compatibility though. CGLM seems to be GLM, so I would go with that. Good luck! - Trannamcomputer joined the community A good 3D math library in C for OpenGL? Green_Baron replied to babaliaris's topic in Math and PhysicsI am confused by the term dll as math libraries i think of (vectors, matrixes, quaternions, boudning shapes, rays, collisions, intersections, etc. pp) usually come as header-only files. How about data types and precision that are much easier to implement in C++ (templates) than in C ? Almost all math libs i know, if they are not for pure demonstration purposes, offer that functionality. - A good 3D math library in C for OpenGL? a light breeze replied to babaliaris's topic in Math and PhysicsIf you're having trouble with DLLs in C++, wouldn't it be a better idea to drop the DLLs than to drop C++? Seriously, DLLs are a huge pain in the ass for basically no benefit. The only time DLLs make sense is when different parts of the project need to be distributed under different licenses. That's a legal reason for using DLLs. There is no technical reason for using DLLs, ever. - - [Survey] Help us Help you make Better Games 2GuyGames posted a topic in Production and Management: - Five Nations Webellion posted a project in WebellionFive Nations is a real-time sci-fi strategy game for PC platforms, Switch, and mobile. Encompassing tactical combat in space in real-time mixed with micromanagement of economy, construction, and production, it will play both in single player and multiplayer modes. The RTS mechanics being custom-made to deliver action-packed gameplay. Gameplay You are a commander of one of the five greatest galactic empires in the far future Develop your space facilities, mining stations, factories, power plants, and research centers. Produce a gigantic armada of spacecraft to confront and destroy your rivals by applying shrewd strategies to outmaneu... Join our Discord server and get Super Early Access Social Media Facebook fan page: Instagram: GameJolt: Itch.io: Twitter: Five_Nations_-_First_Trailer.mp4 Looking for muiscal feedback and career advice nl6515 replied to nl6515's topic in Music and Sound FXGreat examples thanks! I see what you mean more clearly now. Yes, the attack and envelope of the sample generated in most of the VST's I use can be manipulated, I'll mess around with that on my next composition to emphasize the rhythmic feel. 1st SDL Engine Drawing BMP Blank Screen Alio posted a topic in For Beginners's ForumHello I have bought the book SDL game development from amazon to learn SDL2 game programming on Ubuntu. I have my first game engine up and running but when I add code to draw a BMP in the top left of the screen I just get a black screen when I run it. Can anybody help me solve this I would really appreciate it. Also I am not sure if I have the texture creation code on lines 8-15 in the right place, I tried moving it around but it didn't make a difference. main.cpp <code> #include <SDL2/SDL.h> #include "Game.h" #include "Game.cpp" int main(int argc, char * args[]) { Game * g_game = new Game; g_game->init("Chapter 1", 100,100,640,480,false); while(g_game->running()) { g_game->handleEvents(); g_game->update(); g_game->renderer(); } g_game->clean(); return 0; } <code/> Game.cpp <code> #include "Game.h" #include <iostream> bool Game::init(const char* title, int xpos, int ypos, int width, int height, bool fullscreen) { SDL_Surface * pTempSurface = SDL_LoadBMP("assets/rider.bmp"); m_pTexture = SDL_CreateTextureFromSurface(m_pRenderer,pTempSurface); SDL_FreeSurface(pTempSurface); SDL_QueryTexture(m_pTexture, NULL,NULL,&m_sourceRectangle.w,&m_sourceRectangle.h); m_destinationRectangle.x = m_sourceRectangle.x =0; m_destinationRectangle.y = m_sourceRectangle.y =0; m_destinationRectangle.w = m_sourceRectangle.w; m_destinationRectangle.h = m_sourceRectangle.h; int flags = 0; if (fullscreen) { flags = SDL_WINDOW_FULLSCREEN; } // attempt to initialize SDL if(SDL_Init(SDL_INIT_EVERYTHING) == 0) { std::cout<<"SDL Init Success\n"; // init the window m_pWindow = SDL_CreateWindow(title, xpos, ypos, width, height, flags); if(m_pWindow != 0) //window init success { std::cout<<"Window Creation Success\n"; m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, 0); if(m_pRenderer !=0) // render init success { std::cout<<"Renderer Creation Success\n"; SDL_SetRenderDrawColor(m_pRenderer, 0,0,0,0); } else { std::cout<<"Renderer Init Fail\n"; return false; // renderer init fail } } else { std::cout<<"Window Init Fail\n"; return false; //window init fail } } else { std::cout<<"SDL Init Fail\n"; return false; // SDL init fail } std::cout<<"Init success\n"; m_bRunning = true; // everything inited successfully // start the main loop return true; } void Game::renderer() { SDL_RenderClear(m_pRenderer); // clears the renderer // to the draw colour SDL_RenderCopy(m_pRenderer, m_pTexture, &m_sourceRectangle,&m_destinationRectangle); SDL_RenderPresent(m_pRenderer); // draw to the screen } void Game::update() { } void Game::clean() { std::cout<<"Cleaning game\n"; SDL_DestroyWindow(m_pWindow); SDL_DestroyRenderer(m_pRenderer); SDL_Quit(); } void Game::handleEvents() { SDL_Event event; if(SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: m_bRunning = false; break; } } } <code/> game.h <code> #ifndef __Game__ #define __Game__ class Game { public: Game() {} ~Game() {} bool init(const char* title, int xpos, int ypos, int width, int height, bool fullscreen); void renderer(); void update(); void handleEvents(); void clean(); // a function to access the private running variable bool running() {return m_bRunning;} private: SDL_Window * m_pWindow; SDL_Renderer * m_pRenderer; SDL_Texture * m_pTexture; //the new SDL Texture variable SDL_Rect m_sourceRectangle; // the first rectangle SDL_Rect m_destinationRectangle;// another rectangle bool m_bRunning; }; #endif /* defined(__Game_h__) */ <code/> Change Animation in OpenGL tamlam replied to tamlam's topic in Graphics and GPU ProgrammingHi @GoliathForge, I can move to the world coord. then rotation then translation. However, it only has the final result (the new rotated cube) not the animation. I try to use the below function glutTimerFunc(0, Timer, 0); but it only happens for one rotation action. global float angle=0.0f; In the void Display(), rolling the cube with glRotatef(angle, 0, 0, 1); at the end of function with angle += 10. I do not know when I can call the function for translation. for the 1st action, I translated the lower right corner to (0,0,0) then rotates from 0 -90 degree for animation. then the 2nd action is wrong with the coordinate. In OpenGl when I used glutDisplayFunc(Display); it always calls back the Display() function that I could not modify the next action. Why is the wireframe rendering so slow compared to solid? VanillaSnake21 replied to VanillaSnake21's topic in Graphics and GPU Programming@Green_Baron That's some great work, I'll see if I can pull your project. I'm still not entirely convinced it's about culling in general just because of how tiny the scene size is, the gfx should be able to easily render 100k tris even with no culling at all at more than 80fps, but I will try to get it working and see if it helps. Thanks, I've enjoyed looking over all of your projects if nothing else. 😋 - The Mills | Survival Game Nova Villanueva posted a project in Nova VillanuevaWhat is The Mills? The Mills is a despair survival game set in a bleak, post-apocalyptic world. As The Engineer, the lone human among robots, you scavenge for resources. Each of the robots is unique – some are kind, some frightening, and some aggressive. As you try to stay alive, you must constantly make choices: will you focus on your survival alone, or help the robots who come across your path? Development Live Stream: Twitch A good 3D math library in C for OpenGL? Randy Gaul replied to babaliaris's topic in Math and PhysicsI like these two. alihayder38 joined the community - Creating the Cinematic Game Intro Animation Nova Villanueva posted a blog entry in Game Dev | Survival Game | The MillsSurvival Game | The Mills | Hello! Today I integrated the cinematic animation for the intro of the game. I had made for the teaser trailer to embed the animation within the actual game's scene. This was a horrible idea - every time I had to playtest the game, of course we had to watch the intro animation. Anyway, I moved over the intro of the animation to another scene that we can get through the Main Menu. I am used Unity's Cinemachine for the cameras but using Maya for animation so there was a disconnect. Tomorrow or later today I'll try using the timeline of Cinemachine better. Fixed: The Navmesh (what lets players and robots know where they can walk) was acting up. I increase the Voxel in the advance settings back to .07. I dropped it too low before as I was trying to get a better response, but I went too over board with it. To Do - Things on my mind Add the Grenade for the player to be able to craft to the programming. The item can already be made to explode robots (to loot them). Use Zbrush to sculpt the main characters hair. Right now nobody know that its suppose to be a girl. Use Timeline for Cinemachine Check out if the entire scene will work better with ambient light. The robots right now are either too unlit or the 'specular' goes crazy when lit. Game Dev Log | Today's Screenshot - - Unirule is a game inspired by elements of the Civilisation series, Sim-City series, and an old game called Tyrants. Unirule is intended to be a real-time multiplayer game. The current version is being written in JavaScript utilising the THREE.js API for the client and Node.js for the server. The game's framework is projected to be completed by April 26th 2019, after which full attention will be devoted to game design and development. The game's engine will run a 24 / 7 live simulation of a living breathing world simulating thousands of individual people. Each person, or Simulin, will be AI driven. The people will collect resources, craft tools, explore their world and think up new ideas and inventions. They will band together, conduct trade, engage in conflict and expand their respective territories. You as a participant in this world will be given an opportunity to play as some of these people. The goal of Unirule is to achieve global hegemony. You'll accomplish this goal by gaining influence over the majority of the people through economic, military and cultural influences. When you're logged into the game you'll be able to dictate the actions and choices of the people you directly influence. When you are away the simulation will continue and the people you influence will carry on with what ever tasks you've assigned to them. You will start your game as one simulated person and you'll have the option to choose between one of three classes. Each class has unique abilities, actions, and structures that they can build; each of which will allow you to increase your overall power and influence. You can either start as a Farmer, Hunter or Story teller. As your game progresses many other classes will become available such as the Lender, Warlord and Emissary to name a few. In addition, you'll also be able to control up to three people with differing or similar classes at the same time. Perhaps initially you'll want two Farmers and one Hunter to boost food production and provide basic defences. Maybe you'll start out by pillaging local tribes with a wandering band of Hunters. Or maybe you'll want to start a primitive faith and be worshipped. All of these play styles will be possible. Lastly, and perhaps most importantly, you'll be able to ally with or challenge other human players within the same world. Sometime during 2019 I hope to have a server up and running so others can give the project, in it's alpha state, a whirl to see what they think. This project is in its proof of concept stage. The end goal for the proof of concept is to expand on the gameplay potential of the three base classes. I'd like to develop the three base classes to the point where they open additional classes, and to test player connection and simulation stability. Thanks for reading and feel free to leave a comment. - Hello, Over the past six weeks I’ve been soul searching. This is a hard blog for me to publish, I’m going to be opening up about my past and writing about some of my deep insecurities and shortcomings, along with how being apart of GameDev has helped me find some personal progress. I’m going to be reaching far back into my past to provide some context. I have tried my best to reduce the personal drama. My mother wanted to give me the best education she could here in Canada and so she chose to enroll me in French immersion. I struggled and failed Kindergarten. My earliest friends moved on. By grade three I was struggling with both French and English. I was given two options, I could either repeat grade three or change to the English only program. Either way I had to part ways with more friends. I had learned to become unsure of myself. Measuring true personal growth had become dusted over like neglected instrument gauges in need of a cleanse. I found solace in my imagination and it became my trusted companion. In my early teens I started to recognised some of my abilities, discovering things I had not noticed before. I started to receive encouraging complements from others and like any teenager I let it get to my head and neglected the gauges. I decided to start programming a game to help answer some of the questions that have nagged at me for so long. When will I find some meaningful confidence and How can I start to clean these dusty gauges? On March 7th I finally answered the first question. I had found the personal confidence, It was good enough for me. By end of March I began to see the answer to the second question. Regretfully the answer is not found sitting in front of a computer. I’m not leaving, but for a while I need to focus on some personal growth. Opening up about my ideas in 2014 was a big step for me. I am truly thankful for all the kind words, support and encouragement over these past 5 years. It’s been a blessing. I wanted to share these words with you because my friends should be in the know A Revolutionary New Game GoliathForge replied to Mr. Blue Sky's topic in Hobby Project Classifieds<sigh> Well, very good. I like the name your (group) has chosen for this project. Do you have any concept art or pencil work you're prepared to show to get the ball rolling? A Revolutionary New Game fleabay replied to Mr. Blue Sky's topic in Hobby Project ClassifiedsDouble Dragon? - Advertisement
https://www.gamedev.net/index.php?app=core&amp;module=system&amp;controller=terms&amp;do=dismiss&amp;ref=aHR0cHM6Ly93d3cuZ2FtZWRldi5uZXQv&amp;csrfKey=ddfb090d281269c086e72a7803f6560c
CC-MAIN-2019-22
refinedweb
3,321
61.67
Sep 20, 2007 07:07 AM|psan|LINK Hi, I have added a ITemplate to a Control that inherits from GridView. In the code I have a class that creates a row with some controls from the ITemplate. (CreateFilterRow) When I add "normal" controls (like TextBox) in the ITemplate there is no problem, and I get all the controls on postback. (Was I problem if I didn't solved it this way, check previous post) The problem is when I use ASP.NET AJAX Toolkit with my controls that should be added to the new row. I get the message "Extender controls may not be registered after PreRender". I have tried many different solutions, and some "worked" and I didnt get the error, but the code I use now is the only code that returns my controls on postback. The code I use to add the row to the GridView is the following (the most important): protected override Table CreateChildTable() { _table = base.CreateChildTable(); return _table; } protected override void PrepareControlHierarchy() { base.PrepareControlHierarchy(); TableRow _row = CreateFilterRow(); //Creates my row with controls from my custom template. _table.Controls.AddAt(0, _row); //Adds the row ontop to create a extra header. } When I use this (instead of the above) code I get a "Extender controls may not be registered after PreRender" on postback. But it works before postback. The strange part is that I add it before OnPreRender :/ // METHOD:: OnPreRender protected override void OnPreRender(EventArgs e) { TableRow _row = CreateFilterRow(); this.Controls[0].Controls.AddAt(0, _row); // Do as usual base.OnPreRender(e); }The code below is used to get the controls from template:public List ControlHolder { get { //If Template is already fetched, get from viewstate if (HttpContext.Current.Session["ControlHolder"] != null) return (List )HttpContext.Current.Session["ControlHolder"]; //Get from Template List tmpHolder = new List (); Control tmpControls = new Control(); if (FilterTemplate != null) FilterTemplate.InstantiateIn(tmpControls); foreach (Control item in tmpControls.Controls) if (item.GetType() != typeof(LiteralControl)) tmpHolder.Add(item); HttpContext.Current.Session["ControlHolder"] = tmpHolder; return tmpHolder; } } GridView Custom Control ITemplate Toolkit All-Star 35458 Points Sep 24, 2007 05:06 AM|Nai-Dong Jin - MSFT|LINK Hi, From your description, it seems that while you are using ASP.NET AJAX Toolkit with your controls, you’ll get a message which says "Extender controls may not be registered after PreRender", right? For this kind of issue, one workaround is to call the base OnPreRender method before declaring your controls while overriding the OnPreRender method on the page where you had the new extender control. See the following code snippet: protected override void OnPreRender(EventArgs e) { // add base.OnPreRender(e); at the beginning of the method. base.OnPreRender(e); // codes to handle with your controls. ... } Also, there’s a good sample on how to create an ASP.NET AJAX Toolkit Extender Control to Extend an standard control. See, Hope that helps. Thanks. None 0 Points Jul 08, 2010 08:15 AM|aguetat|LINK I try the tutorial to create an asp.net ajax toolkit extender control to extend a gridview see the article #mce_temp_url# it work in IE and Firefox but not in google chrome ??? please help me 3 replies Last post Jul 08, 2010 08:15 AM by aguetat
https://forums.asp.net/t/1160803.aspx?Extender+controls+may+not+be+registered+after+PreRender+While+adding+a+new+Gridview+Template+
CC-MAIN-2018-26
refinedweb
533
56.25
CodePlexProject Hosting for Open Source Software Looking for some guidance on how best to pass parameters to a web api in order to create an orchard content type. So I have an orchard content type called Apartments and it is composed of several parts. Take for example the title part: In the html form (which is also used to create an apartment) it has the name "Title.Title". So presumably if I pass an dynamic object with the key "Title.Title" I could pass it directly to the ContentManager and it would know which part it mapped to. I could do the same for other parts too. Does this seem reasonable? I'm not convinced public HttpResponseMessage PostApartment(dynamic item) { Services.ContentManager.Create(item); return Request.CreateResponse(); } Why would you want to put a dynamic object as the parameter here? Looks like it will only confuse model binding. Fair point. That's not going to work is it. So perhaps I have to create a modelview? Something like: public class ApartmentViewModel { public int ApartmentId { get; set; } public string Title { get; set; } } But how would I map 'Title' here to my ContentType > TitlePart > Title field? I'm a bit lost. Edit: Actually that's not going to work either - it won't know what kind of ContentType it's creating will it. Stumped. You can tell the content manager what type to create using its New method. Once you've set the properties you need to set on the relevant parts is when you call create with the new content item. Here is an example... public HttpResponseMessage PostApartment(ApartmentViewModel model) { var contentItem = Services.ContentManager.New<ApartmentPart>("Apartment"); contentItem.As<TitlePart>() = model.Title; contentItem.As<ApartmentPart>().ExternalId = model.ApartmentId; Services.ContentManager.Create(item); return Request.CreateResponse(); } In this example I have made the assumption that ApratmentId is not an OrchardId Thanks for the excellent example. Very useful. I am struggling a bit to understand the relationship between a ContentItem and a ContentPart. My understanding: the Apartment ContentItem is composed of many ContentParts i.e. ApartmentPart, TitlePart But when creating the new item in the code above it's: Services.ContentManager.New<ApartmentPart>("Apartment"); Which implies Apartment IS an ApartmentPart. A content part is a discrete piece of functionality, where as a contentitem is a grouping of those functionalities. Its what makes orchard so powerful. I could have done Services.ContentManager.New("Apartment") This would return a contentitem which I could then do As<ApartmentPart>() Are you sure you want to delete this post? You will not be able to recover it later. Are you sure you want to delete this thread? You will not be able to recover it later.
http://orchard.codeplex.com/discussions/401469
CC-MAIN-2016-50
refinedweb
448
58.89
Creating a Dockable Panel-Controlmanager Using C#, Part 2 Creating a Dockable Panel-Controlmanager Using C#, Part 2 Fly Panels, Fly! Goals of this Article What you want to achieve in this article is to get a borderless Form to be moved around on the screen by capturing it with the mouse and dragging it around, and to be able to resize the form, the same way as a normal sizeable Form could be sized by dragging its edges. Note: To understand the design and construction of this DockablePanel Controler, you need to follow the steps in Part one of this article series. So, if you haven't read Part One yet, please first read and download Part 1 of this article series. This article will teach you how to work with the base class 'Control' to pass Mouse events from controls that are placed on a Form to the Panel's Mouse events in a manner that you will have the Panel's MouseMove event thrown independent if the Form is covered with lots of different controls or there is only one very big control set on the Form, which covers it totally. You will be able to have the MouseMove event thrown wherever and whenever the mouse hovers over the Panel, This will be done without any usage of hooking. The funny trick on this is that, for the user, all this events seems to be the Forms mouse events, because at every time he never sees the original Form the programmer has created at Designtime. Let me give you a short review to fully get the point. Figure 1: The DockableForm is fully covered with the DockablePanel control. If you were to try to move the Form using the Mouse by dragging it around, nothing happens because: - A borderless Form has no Titlebar that you can use to move it around. - - You never will reach the Form with any mouse action because the Form's surface is totally covered by the Panel, and what you see as the Form's Titlebar is actually your GradientPanel class, which is used here to build the Headerbox of your new Control. To achieve this, you need to implement two operations; you need to get the Panel moving and you need to be able to resize the panel using the mouse by dragging its borders during runtime, just as a normal resizable Form acts. To move a normal Form around, you move the mouse cursor over the Titlebar, press the left mouse button down, and keep the left mouse button depressed while moving the mouse around. When the left mouse button is released, the Form is no longer captured so you can stop moving the form. All this works only when the mouse is over the title of the Form; in this case, this is represented by the HeaderBox of the DockablePanel. So, the first thing, obviously, you need to do is to create the MouseUp, MouseDown, and MouseMove delegates for the HeaderBox. To do this, select the DockablePanel; in the Designer View, select the HeaderBox; in the Properties Window choose 'Events', and double-Click on the needed events. This will create the following code (add the #region markings so you keep a neat and tidy code). #region Delegates private void HeaderBox_MouseDown(object sender, MouseEventArgs e) { } private void HeaderBox_MouseUp(object sender, MouseEventArgs e) { } private void HeaderBox_MouseMove(object sender, MouseEventArgs e) { } #endregion Now, you need to add code to these Delegates. To get the global Screen coordinates of your Mouse, you will use the API call ClientToScreen(), so add the necessary namespace on top of the DockablePanel codepage. using DockingControls.WinAPI; namespace DockingControls.Forms { . . . . internal sealed partial class DockablePanel : UserControl{ . . . . // we add to the Private Fields just after private bool _isMouseDown = false; // the following needed fields private WinAPI.POINT _mousePos; private int _lastX; private int _lastY; And in the MouseDown Delegate, you check whether the left Button was pressed when the MouseDown is fired. private void HeaderBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { LeftMouseButtonPressed(e); } } private void LeftMouseButtonPressed(MouseEventArgs e) { // store the actual mouseposition _mousePos.x = e.X; _mousePos.y = e.Y; // change it to global-Screen Coordinates so we have // the real position of the mouse instead of // its position in the header APICall.ClientToScreen(HeaderBox.Handle, ref _mousePos); // the internal notification that the mouse is just down _isMouseDown = true; // the global position of the DockablePanels Left-Top // corner is the global Position of the mouse // reduced by the position in the header, so we get _lastX = _mousePos.x - e.X; _lastY = _mousePos.y - e.Y; } This way, you get the start position of your DockableForm where it is placed on the screen, upon starting the Form move. The following picture demonstrates the coordinate calculations. Figure 2: Calculation of Global Screen Coordinates of the Panels Left Top Corner In the MouseUp Delegate, you simply set the internal notification (_isMouseDown) to false because you have released the button; it is not pressed down any more. At the moment, there is nothing else to do with this delegate. private void HeaderBox_MouseUp(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left){ _isMouseDown = false; } } With the MouseMove delegate, you need to check the value of the internal boolean (_isMouseDown) to determine whether the form should still move or not. If the mousebutton was released, _isMouseDown will be false, meaning you are no longer moving. This is done with the next code segment. private void HeaderBox_MouseMove(object sender, MouseEventArgs e) { if (_isMouseDown ){ MouseMoves(e); } } private void MouseMoves(MouseEventArgs e){ WinAPI.POINT mousePos; // we read the actual mouse position, which will change // during moving mousePos.x = (short)e.Location.X; mousePos.y = (short)e.Location.Y; // we calculate the global Position again APICall.ClientToScreen(HeaderBox.Handle, ref mousePos); // and the moving method itself Moving(mousePos); } With the Moving procedure (which follows next), you need to ensure that you are attaching and detaching the panel to and from the carrier form, depending whether it is moved or docked. Basically, with this method you are using the difference between the previous position and the current position. private WinAPI.POINT Moving(WinAPI.POINT mousePos){ if (_carrierAttached){ _carrierForm.Left += (mousePos.x - _mousePos.x); _carrierForm.Top += (mousePos.y - _mousePos.y); }else{ // if all is working well this only will happen // in the first moment, when we are remove a docked panel // from its docking position this.Left += (mousePos.x - _mousePos.x); this.Top += (mousePos.y - _mousePos.y); } _mousePos.x = mousePos.x; _mousePos.y = mousePos.y; return mousePos; } If you were to compile and run the project, you would be able to move the panel in the same way as you can move a form—through its Titlebar. A Note before compiling the project: Remember that, back in Part 1 when you created the buttonstrip, you made them as visible. Now, because they are in the correct place, you should hide them because you want them hidden when the program starts. Edit CreateAllElements in the DockingManager class, to look like the following, to hide the Buttonstrips when the program starts: public void CreateAllElements() { // Buttonstrips to hide the panels LeftButtonStrip = CreateButtonStrip(DockStyle.Left,false ); RightButtonStrip = CreateButtonStrip(DockStyle.Right,false); TopButtonStrip = CreateButtonStrip(DockStyle.Top, false); BottomButtonStrip = CreateButtonStrip(DockStyle.Bottom,false); } There are no comments yet. Be the first to comment!
http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c14337/Creating-a-Dockable-PanelControlmanager-Using-C-Part-2.htm
CC-MAIN-2014-52
refinedweb
1,218
58.21
Welcome to the leapday summary. We'll crack straight on with perl6-internals Running up to release time As Leapday had been chosen as the release date for Parrot 0.1.0, the week was mostly spent getting things ready for release. A case in point was the PLATFORMS file which lists those platforms on which Parrot is known to compile and run, which (at the beginning of the week) was short several platforms and generally out of date. So everyone manned the pumps and sent in reports of success and failure. BTW, if you manage to get Parrot up and running (or even partially up and limping) on a platform that's not listed in PLATFORMS then perl6-internals@perl.org would be very pleased to hear from you. Objects and time Dan announced that he'd trodden on one of the nasty bits of objects; the proper ordering of classes for initialization and destruction in the face of multiple inheritance. He announced that he was in the process of actively ignoring it for the time being and canvassed opinions about whether to delay the Leapday release in favour of fully specced/implemented objects or whether to make the 29th without objects, or some other choice. In the end we decided to still aim for the 29th, with objects in a 90% there state, but with big 'HERE BE DRAGONS' warnings plastered on the tricky edge cases. A little later Dan announced what would be there for the release (Multiple inheritance, attributes, object instantiation and method calls) and what wouldn't (monkeying with some things after subclassing/instantiation, method redispatch and fancy namespace lookups). As the week progressed, objects inched closer and closer to readiness, though at least one summarizer's heart was in his mouth as the week ebbed away. Would Dan get everything he'd promised working before the deadline? Tune in later on to find out. Feature Freeze On Wednesday, Leo Tötsch announced a feature slush (patches to add OO features were still being accepted) in anticipation of a release. The patch rate increased as people got on with fixing up failing tests on various platforms, improving documentation, and improving OO functionality. Not all the object patches were from Dan; chromatic got in on the act with a couple of tweaks to parrotobject.pmc... Native PBC issues It turns out that, just at the moment, Parrot bytecode isn't actually platform independent. This will, of course, get fixed, but it's not Leo's top priority at present. He asked people who are running Parrot on 64 bit and Big endian architectures to submit native_pbc test files (if you're on such an architecture, take a look at t/native_pbc/*.t for instructions, and the Parrot community will thank you for it). Object Questions Simon Glover did some sterling work exercising the Object documentation and implementation, posting several bug reports and questions. Ladies and Gentleman: Objects! On Wednesday, several full days before the release date, Dan announced that objects were done (well, everything that he promised would work did) and asked for people to start 'abusing it heavily'. Which they promptly did. There was applause too. Next on the hit list Having got objects up, Dan immediately posted a list of desiderata for the next release but one. Is there no stopping him? Today we have naming of parts Will the madness never stop? Mitchell Charity spoke for everyone when he posted an extract from PDD15: What .NET calls an attribute parrot calls a property What .NET calls a property parrot calls an attribute Everyone shared the pain, though Paolo Molaro pointed out that it's not exactly accurate and the .NET name for a parrot attribute is 'field' (which is yet another term with wide variety of meanings when you think about it). Not being the biggest OO fan in the world, Dan swears he's just going to rename them Fred and Barney but not tell anyone which is which. LANGUAGES.STATUS updates Mitchell also pointed out that LANGUAGES.STATUS was out of date and several languages which were supposed to be okay failed to work on his system. He asked for feedback to get it updated correctly. Inconsistent Parrot/IMCC behaviour Gregor Purdy found that Parrot was doing different things with the .pasm file generated from an .imc file by IMCC than it was when it ran the .imc file directly. Melvin Smith and Leo both agreed that it was a bug, but it's very hard to fix with the current incarnation of IMCC. IMCC2 should (will) fix the issue. Leo provided a workaround to fix the generated .pasm though. The Kakapo leaps Yay! Parrot 0.1.0 "Leaping Kakapo" got released at 2004022913:45:49 GMT. This is a big release, with Objects and multi-threading as well as a major documentation overhaul and a bunch of other good stuff. Anyone who suggests that I'm only really excited by this particular release because I came up with the code name. Pointing out that the Kakapo is a flightless, nearly extinct species of parrot is considered unsporting. Meanwhile, in perl6-language Perl 6? When? Aaron Sherman noted that Apocalypse 1 was published in 2001, and it made mention of Apocalypse 26. And we've seen all of six apocalypses. He wondered if there was anything that could be done to increase the apocalypse rate. As chromatic pointed out, no plan survives first contact with the enemy; it turns out that a lot of the theoretical apocalypses (one apocalypse per chapter of Programming Perl), aren't actually necessary for specifying the language to the point where we can start implementing. Larry also answered Aaron's concerns and noted that last year he had to take half a year off 'to participate in various non-optional gastric revisions'. He quickly discussed the outstanding chapters and RFCs and pointed out that a large amount of the work had already been done. Which is nice. Larry also showed us his outline of Apocalypse 12 which is apparently about a week away from the first alpha for the sixcabal. It looks rather promising (and it's rather easy to see why it's taken so long). -- Larry's big plan -- Apocalypse 12 outline Thinking about accessors John Williams wondered about how accessors will work with Perl 6 objects. In particular he wondered about cases like: $foo.bar_attr += $z; $foo.bar_attr++; Things got a little complicated, indeed Larry muttered that there would be a delay to A12 because John had asked him to explain something that he hadn't figured out yet. An interesting matching problem Austin Hastings came up with a neat little problem for matching. Consider an instrumented string class which carries information like 'bold' and 'italic' or even the language of a substring. How would you write a search to match all the letters 'l' in french text. (Not a very realistic problem I know, but you'll have to bear with me). Larry responded with a neat idea involving &, so you would write: /[l & <french>]/ where french is presumably a block rule that makes a method call on the appropriate character. Exegesis 7 Damian's Exegesis 7, dealing with the replacement for Perl 5's format, was published on Thursday. It's jolly good. Really. And you can use it now if you grab Perl6::Form from CPAN. This threw up a pile of questions about ambiguities, edge cases and all the other stuff that p6l does so well. The version of the exegesis at perl.com has already been updated to take some of these issues into account. Announcements, Apologies, Acknowledgements Whee! The Summary goes to the mailing lists before midnight on Monday. "Will I be able to keep up this dizzy pace?" I ask myself. If you find these summaries useful or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl. You might also like to send me feedback at -- The Perl Foundation x -- Perl 6 Development site -- My website, "Just a Summary"
https://www.perl.com/pub/2004/02/p6pdigest/20040229.html
CC-MAIN-2017-39
refinedweb
1,348
63.49
I love using Cygwin, but I hate all of the extra disk space it seems to use caching stuff I don't need. What can I delete to keep my installation footprint as small as possible? On a related note, what is a good barebones set of packages that will give me the essentials, without fluff that I'll probably never run? Some people appear to be under the assumption that it is easy to swap out the hardware on whatever platform this person is using. It may very well be that 500MB is actually a large amount of space to sacrifice if they are perhaps using a CF adapter and a 4GB card to run windows on a netbook or similar. Or they may be installing it to a virtual image and this extra information means the difference between it fitting on a DVD unzipped or having to span multiple DVDS and dealing with the issues that come with that, especially if it is being sent to a client that isn't particularly technical for example; In-house training material for the application your company develops. Having one defined image that is the same for all trainees works wonders, makes the environments homogenous and makes the trainer's life easier. Virtual images are a simple way to do this in most situations. Solve the problem that the user asked about or ask them a question to get more information. POTENTIAL SOLUTION: When installing Cygwin, on the screen where it asks you where to store your packages, point it at a specific location, say c:\Cygwin\Packages. Install as normal, run it to check that it operates correctly. Delete the folder the packages are stored in, if required for updates Cygwin will download it again, not the most effective use of bandwidth but depending on your requirements it may be better than keeping the cache locally. Another option is to install these packages, but the first time you do it, save the packages to another location like a USB drive, then if you have to do I note that that my current install is under 250MB, It would have to be four times that size before I started to care about it on my laptop. But, if you have needs to get it smaller... Download the installer. Save it to to c:\cygwin\setup.exe. Run the installer. Unselecting as many of the packages as you can. Noting, that if you select a package that has requirements, it will auto-select the needed packages. Remove the installer cache (which should have defaulted to c:\cygwin(http|ftp)somethingoranother. Rerun the installer from c:\setup.exe attempting to uninstall more packages. Repeat until the installer is as small as you wish. Note, there will be a bunch of basic library packages that will be required in even the most minimal install. I have in the past (about a year ago), gotten it down to under 100 megs while still having everything I ever threw at it in terms of bash scripting. I can't use Windows without installing Cygwin, but I've never really had too much of a problem with it using disk space though. I think you can delete the folder Cygwin stores the packages in but every time you update Cygwin it will download the packages it needs. As for a barebones setup, it really depends on what you need. I start with the base Cygwin install and add OpenSSH, Cron, RXVT, Screen, Vim, Git, Curl, Zip/Unzip, and Wget. Those are most all the tools I need, but I just install something else if the need arises. Instead of Cygwin, you could also go with more packages that are not intending to solve all the problems Cygwin aims to be able to solve. There are packages of unix utilities with just the a limited selection of the most commonly used programs. Unix Utilties for Windows is the one I used back in the day, but it appears to be a dead project. GnuWin32 appears to still be alive. I would start with the basic cygwin package, and 'page-fault' in any additional commands you need. I keep a list of common utilities which I use, but might be quite different from what you use. Do NOT select ALL packages when you install Cygwin. I did this once and it took about 6GB. My thinking was then I'd never have to worry about not having a program. It was a bad idea. My Windows XP machine has 1.1 GB in service pack uninstall data. I'd delete those files well before trying to trim down Cygwin. Try using the WinDirStat program and see where all your hard drive space is going - it's probably not Cygwin. Also, from time to time, you should probably delete C:\cygwin\tmp, as this doesn't get cleared on reboot. You could switch from CygWin to Gow, a lightweight alternative to CygWin (about 10 times lighter) If you've pulled the setup files more than once you'll see that unused files are left behind... To cleanup a Cygwin install set (not the installed code base but the package used to DO the install... I think I saw a perl script to do this somewhere, but try this java code to cleanup a Cygwin setup: import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.HashSet; public class CygwinCleaner { boolean doClean = false; long diskFileCount = -1; long setupFileCount = 0; long missingFileCount = 0; long srcFileCount = 0; long deleteCount = 0; public HashSet<String> pkgs = new HashSet<String>(9999); public String formatCount(long count) { DecimalFormat df = new DecimalFormat("##,###"); String retval = " " + df.format(count); return retval.substring(retval.length() - 6); } public void checkForMissingFiles() { for (String filename : this.pkgs) { if (!filename.contains("-src.")) { if (!((new File(filename)).exists())) { System.err.println(" Missing " + filename); missingFileCount++; } } } } public void checkOrCleanFiles(File testfile) { String tfap = null; if (testfile.isDirectory()) { for (File file : testfile.listFiles()) { checkOrCleanFiles(file); } } else { this.diskFileCount++; tfap = testfile.getAbsolutePath(); if (!this.pkgs.contains(tfap)) { if (this.doClean) { System.err.println("Deleting \"" + tfap + "\""); if (testfile.delete()) { this.deleteCount++; } else { System.err.println("COULD NOT DELETE \"" + tfap + "\""); } } else { System.err.println("WOULD delete \"" + tfap + "\""); } } } } public boolean loadFileList(File file) { boolean retval = false; if (file.exists()) { try { String basedir = (new File(file.getParent())).getParent() + "/"; basedir = basedir.replace('\\', '/'); BufferedReader br = null; br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line = br.readLine(); String installFile = null; boolean processlines = false; while ((line = br.readLine()) != null) { if (processlines) { if (line.startsWith("install:") || line.startsWith("source:")) { installFile = line.substring(1 + line.indexOf(" ")); installFile = installFile.substring(0, installFile.indexOf(" ")); installFile = basedir + installFile; String hashString = (new File(installFile)).getAbsolutePath(); if (!this.pkgs.contains(hashString)) { this.pkgs.add(hashString); this.setupFileCount++; if (line.startsWith("source:")) { srcFileCount++; } } } } if (line.startsWith("@ ")) { processlines = true; } if (line.startsWith("[test]") || line.startsWith("[prev]")) { processlines = false; } } br.close(); retval = true; } catch (Throwable t) { t.printStackTrace(); } } return retval; } public static void main(String[] args) { if (args.length == 0) { System.err.println("Usage::::: CygwinCleaner {full_path_to_setup.ini} [CLEAN]\nIf only the ini file is specified then a report will be generated\nTo perform the cleanup add the second optional parameter of CLEAN"); } else { System.out.print("CygwinCleaner: "); CygwinCleaner cc = new CygwinCleaner(); String setupFileName = args[0]; if (args.length > 1) { if (args[1].equalsIgnoreCase("CLEAN")) cc.doClean = true; } if (cc.doClean) { System.out.println("Performing cleanup\n"); } else { System.out.println("Reporting only\n"); } File file = new File(setupFileName); cc.pkgs.add(file.getAbsolutePath()); if (cc.loadFileList(file)) { cc.checkOrCleanFiles(file.getParentFile()); cc.checkForMissingFiles(); System.out.println(" Total of:" + cc.formatCount(cc.setupFileCount) + " files in setup.ini"); System.out.println(" Source:" + cc.formatCount(cc.srcFileCount) + " files in setup.ini"); System.out.println(" Leaving:" + cc.formatCount((cc.setupFileCount - cc.srcFileCount)) + " files in setup.ini\n"); System.out.println(" Total of:" + cc.formatCount(cc.diskFileCount) + " files in setup directory before cleanup"); System.out.println(" Deleted:" + cc.formatCount(cc.deleteCount) + " files in setup directory (unused)"); System.out.println(" Leaving:" + cc.formatCount((cc.diskFileCount-cc.deleteCount)) + " files in setup directory after cleanup\n"); System.out.println(" Missing:" + cc.formatCount(cc.missingFileCount) + " files in setup directory that are contained in setup.ini"); } else { System.err.println("setup.ini file (" + setupFileName + ") does nofiles in setup"); } } } } As a cygwin user i agree with both the prior posts. NEEDS: grep, sed, awk, cut, diff, comm, vim, OpenSSH, tar, gzip, bash, wget As for space, I agree with Ian. Small price to pay for space. You can now get a 1TB 10,000 RPM drive for under $100.00. I can remember when we all had to pay over $150.00 for a 20.00 GB drive. If you are really concerned about local drive space, try to get your self a NAS storage box to sit on your network, and store the "downloaded packages" to it. That will further reduce the footprint on your own machine. It's really a small price to pay for Cygwin. By posting your answer, you agree to the privacy policy and terms of service. asked 7 years ago viewed 8858 times active 1 year ago
http://serverfault.com/questions/829/how-can-i-use-cygwin-without-wasting-hd-space
CC-MAIN-2016-30
refinedweb
1,529
59.8
It's not the same without you Join the community to find out what other Atlassian users are discussing, debating and creating. Hi - I have a Scriptrunner Scripted field that works fine, and correctly returns one of two values : 'Planned' or 'Un-Planned'. I have used a "Exact Text Searcher (natural)" as the search selector for the script field, which allows me to use the result of the scripted field in all the dashboard widgets and reports....except a 3rd party barchart plugin called 'Barcharts for JIRA'. For some reason it cannot pickup on the value of my scripted field (or epic links either, if that's relevant). My idea was to create a second, normal text field (which the bar chart plugin can handle), and copy the value of the scripted field into the text field. I have tried using the Behaviour module in script runner, but it is returning the value of the scripted field as 'null' I have been using basically this syntax: def targetVal = getFieldByName("customfield_10836") def sourceVal = getFieldByName("Planned/Unplanned") targetVal.setFormValue(sourceVal) I also tired adding .value, .text, .toString() etc.to the end of the targetVal line, but I just cant seem to capture the actual textual value of my script field. What am I doing wrong? Could anyone give me example code some example code to put in the initialize function of the behaviour Hi, so I got the best solution possible in the end; the guys at TNG tech who make the plugin released a new version (3.3) that natively/automatically supports scripted fields! No need for behaviours, listeners etc. Although I enjoyed trying to workaround my original problem, even if it was long winded! Hi Paddy, Scripted fields cannot be added in a screen therefore getFieldByName( "Scripted Field A") will return null every time. Instead you can retrieve it's value via the CustomFieldManager. So in a behaviour, in order to get the value of a scripted field: import com.atlassian.jira.component.ComponentAccessor def scriptedField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Scripted Field") def scriptedFieldValue = underlyingIssue?.getCustomFieldValue(scriptedField) Hi Thanos, Thank you, that got me a bit closer to achieving what I want. I now am able to read the script field's value and copy it into my 'slave' text field...but...something is happening I don't understand. My Script field and my 'slave' text field are on my 'view issue' screen. Neither of them are on my 'create issue' screen (intentionally). If I create a new issue, and then navigate to it, the script field works as it always has done and displays a value, but my slave field is initially blank. If I hit the 'edit' button, change nothing and simply hit the update button, the edit screen disappears and now back on the view issue screen the behavior you helped me with fires, and successfully copys the value of the script field to the slave field. Why does the behaviour only fire by going to edit mode? And is there a way to change this so it happens automatically when an issue is initially created? I intend to eventually hide this slave field eventually once I get it to work, if this affects the answer... Any help or advice appreciated Paddy - Behaviours have some limitations, one of which is that they're JavaScript-based, and so they're limited to the fields available on a given screen. You might be able to work around the issue by adding your slave field to the create screen, then using the behaviour to make it hidden. As a side note, you might file a bug with the makers of Bar Charts. Hi - I also tried adding the slave field to the create screen, but no luck either. I did raise an issue with the vendor to ask if support could be added for scripted fields... So, it's a bit of a hack, but you could use a Scripted Service to periodically go through the issues where the slave field doesn't match the scripted field and copy the values over. Hi - so I actually managed to achieve what I needed. I used a custom event listener that fires when a new issue is created in my project. I check the script field and slave field exist in the issue that fired it, then check the issue type, and if it is the relevant one I grab the value of the script field and write it into the slave field. The original behaviour then works and keeps the field in sync if the issue is ever edited. Clunky, but works . Still open to suggestions for a more elegant solution if anyone has the.
https://community.atlassian.com/t5/Marketplace-Apps-questions/Use-Behaviour-plugin-scripted-field-value/qaq-p/97243
CC-MAIN-2019-04
refinedweb
783
61.36
This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project. See the CrossGCC FAQ for lots more information. hi, this is my long irix-story: After fighting for many days to try ... this sounds similar as in 4.html :-) first step (like in case of solaris): getting some missing stuff from this was simple. (ok some trial an error to find out the complete set) i had to install fw_expat-1.95.6.tardist fw_gawk-3.1.2.tardist fw_gcc-3.3.tardist fw_gettext-0.11.5-sgipl1.tardist fw_make-3.80.tardist fw_openssl-0.9.6j.tardist fw_patch-2.5.4.tardist fw_tar-1.13.25-sgipl1.tardist fw_wget-1.8.2.tardist the stuff in /usr/freeware/bin should be placed in PATH before standard tools of same name (make, patch ...) as usual. 2.: egrep on irix has no -q switch, i changed the one appearance of "egrep -q" in getandpatch.sh to "egrep -s" (line 170) after these prerequisites i made a gcc-3.2.3-glibc-2.3.2.dat similar to the existing examples and using the demo-ia64.sh with eval `cat ia64.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest for the first call. (my target platform is a readhat based sgi-prism with gcc 3.2.3 and glibc 2.3.2) the getandpatch.sh works without problems but the build-process stops several times and has to be reinvoked after some fixes. 3. to avoid rebuilding the whole stuff after crashes i have changed the call of all.sh for later calls to eval `cat ia64.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest --nounpack plus commenting out some rm -r statements in all.sh 4. the next problem comes from some incompatibility in the /usr/include/sys/ucontext.h which is also use by gcc from the freeware distribution. one has to define __SGI_NOUCONTEXT_COMPAT at some central place to avoid problems with register-names. i made this by putting a #define in several auto-generated gcc/auto-host.h files, after the corresponding error-message. may be one can handle this by defining CC as "gcc -D..." or using some additional flags to the configure-step for gcc. a similar problem appears with glibc in this case i'm putting the #define to build/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/build-glibc/config.h 5. the sed version on irix has only one namespace .-(. sed fails on glibc-2.../intl/po2test.sed because of multiple defined labels. this is a good target for a patch. 6. the argument line in the kernel-configuration was to short (0x5000) in the case where a lot of .os-es are cat'ed as input to ar. i'm changing this via systune to 0x8000 7. compilation of glibc.../nsswitch.c failed because of undefined LIBNSS_FILES_SO. the whole build-glibc/gnu/lib-names.h was empty. the reason was a none working Makeconfig which only works with bash as /bin/sh one can not aspect that on other systems as linux /bin/sh is bash. the error causing expression is if eval test -z "\$${versioned_$${lib}}"; then \ where the argument of test is "evaled" to empty string and this is not accepted by /sbin/test. my quick and dirty changes has the following form $(common-objpfx)soversions.i: $(common-objpfx)shlib-versions.v default_setname='$(filter-out %_default,$(oldest-abi:%=GLIBC_%))'; \ while read conf version setname; do \ test -n "$$version" && \ test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \ : "$$conf"` != 0 || continue; \ if test "x$$version" = xDEFAULT; then \ default_setname="$$setname"; \ else \ $(abi-default_setname) \ lib=`echo $$version | sed 's/=.*$$//'`; \ vlib=`eval echo "\$$\{versioned_$${lib}\}"`; \ vlib=`eval echo $${vlib}`; \ if test -z "$$vlib" ; then \ eval versioned_$${lib}=yes; \ number=`echo $$version | sed "s/^.*=//"`; \ echo $$lib $$number $${setname:-$${default_setname}};\ fi; \ fi; \ done < $< > $@T; exit 0 mv -f $@T $@ ## ## test -n "$$version" && \ ## test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \ ## : "$$conf"` != 0 || continue; \ ## if test "x$$version" = xDEFAULT; then \ ## default_setname="$$setname"; \ ## else \ ## $(abi-default_setname) \ ## lib=`echo $$version | sed 's/=.*$$//'`; \ ## if eval test -z "\$${versioned_$${lib}}"; then \ ## eval versioned_$${lib}=yes; \ ## number=`echo $$version | sed "s/^.*=//"`; \ ## echo $$lib $$number $${setname:-$${default_setname}}; \ ## fi; \ ## fi; \ ## done < $< > $@T; exit 0 ## mv -f $@T $@ (i'm not a friend of this kind of shell-cryptomania so i dont know, what i'm doing here ...) 8. last but not least there was a wrong generated assembler code from glibc-build/sysd-syscalls comparing with the gcc-build on ia64 shows that a macro has the argument 0 instead of 2 for the number of arguments. wrong: PSEUDO (__libc_nanosleep, nanosleep, 0) correct: PSEUDO (__libc_nanosleep, nanosleep, 2) again sysd-syscalls is generated, so i dont know how to patch it before invoking crosstool. from this experience I'm afraid that there are several other hidden assembler-mistakes. but finally crosstool finished its task with a working cross-compiled hello example. has anybody some idea' how to write patches for this configuration? i.b. ------ Want more information? See the CrossGCC FAQ, Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
http://sourceware.org/ml/crossgcc/2005-12/msg00110.html
crawl-002
refinedweb
868
59.8
LaravelLaravel & VueJsVueJs A beautiful webapp to fetch dns records Recently my company Spatie launched, a beautiful site to quickly lookup dns records. True to form, we also opensourced it, here is the sourcecode on GitHub. If you want to do some dns lookups in your own app, you’ll be happy to know that we extracted the dns lookup functionalities to a package. In this blog post I’d like to share why and how we’ve built all this. Why create another dns lookup service? A few weeks ago Jef, our project manager at Spatie, was asked by a client to give some dns related info. Because Jef is not a technical person. He has a fear/hate relation with the terminal. So he always delegates technical questions like those to his teammates. They just use dig to quickly get dns records. Wouldn’t it be great if Jef could do the dns lookups on his own? An idea was born. But aren’t there already many services to perform dns lookups? Let’s Most of the services work, but they are really really ugly. We couldn’t find any dns lookup service that looks beautiful. So we went ahead with creating a webapp of our own. Introducing dnsrecords.io My colleague Willem did an excellent job in making dnsrecords.io look beautiful. This is what you see when visiting the site. No distractions like on the other sites. Just enter a domain to get some records. It couldn’t be simpler. The results are displayed on a link which has a sharable link. You can just visit to get the dns records of Facebook. If you type help you see some extra commands you can execute on our app: Our real killer feature is of course that you can play Doom. Go on and waste some hours with this excellent game. When you’re done with that go on and drag that bookmarklet to your toolbar to lookup the dns records of the sites you visit. Behind the scenes We’ve open sourced the entire site. You can view the code that’s actually being deployed to our server in this repo on GitHub. Let’s walk a bit through the code. When looking at an early version of the only controller in this project, you’ll see that everything happened inside that single controller. But because we want to easily add more commands in the features we refactored it quite a bit. In the current version the controller is quite skinny: <?php namespace AppHttpControllers; use AppServicesCommandsCommandChain; use IlluminateHttpRequest; class HomeController extends Controller { public function index() { return view('home.index'); } public function submit($command = null, Request $request) { $command = $request['command'] ?? $command; if (!$command) { return $this->index(); } return (new CommandChain())->perform(strtolower($command)); } } Every submitted $command is delegated to a CommandChain. Let’s take a look at the code of that CommandChain. class CommandChain { protected $commands = [ Manual::class, Localhost::class, Clear::class, Ip::class, Doom::class, DnsLookup::class, ]; public function perform(string $command): Response { return collect($this->commands) ->map(function (string $commandClassName) { return new $commandClassName; }) ->first->canPerform($command) ->perform($command); } } You’ll see above that we register some command classes to the chain. In perform we’ll instanciate them. The chain will ask each class: “can you perform this $command? “. The first one that can will actually perform that $command. Let’s take a look at a such a command class. Here’s the code of the Doom command: namespace AppServicesCommandsCommands; use AppServicesCommandsCommand; use SymfonyComponentHttpFoundationResponse; class Doom implements Command { public function canPerform(string $command): bool { return $command === 'doom'; } public function perform(string $command): Response { return redirect(''); } } The perform function of a Command class always returns are IlluminateHttpResponse. In case of the Doom command we’ll just return a redirect to a site where you can play Doom. Let’s take a look at another command, the DnsLookup command: namespace AppServicesCommandsCommands; use AppServicesCommandsCommand; use AppServicesDnsRecordsRetriever; use SpatieDnsDns; use SymfonyComponentHttpFoundationResponse; class DnsLookup implements Command { public function canPerform(string $command): bool { return true; } public function perform(string $command): Response { $dns = new Dns($command); $dnsRecords = $dns->getRecords(); $domain = $dns->getDomain($command); if ($dnsRecords === '') { $errorText = __('errors.noDnsRecordsFound', compact('domain')); flash()->error($errorText); return redirect('/'); } return response()->view('home.index', ['output' => $dnsRecords, 'domain' => $domain ]); } } Noticed that canPerform returns true. This command basically says, I can handle everything. If you look again $commands array in the CommandChain you’ll see that DnsLookup is registered last. So when no other Command can handle the $command the DnsLookup will do its thing. The real magic of looking up dns records happens inside that SpatieDnsDns object which is part of our spatie/dns package. Here’s how you can use it: $dns = new SpatieDns('spatie.be'); $dns->getRecords(); // returns all records $dns->getRecords('A'); // returns only A records $dns->getRecords('MX'); // returns only MX records $dns->getRecords('A', 'MX'); // returns both A and MX records $dns->getRecords(['A', 'MX']); // returns both A and MX records The actual lookup of dns records inside that package is being done by calling dig, a command line tool to lookup dns related info. Here is the relevant function inside the SpatieDnsDns class where that call happens. protected function getRecordsOfType(string $type): string { $command = 'dig +nocmd '.escapeshellarg($this->domain)." {$type} +multiline +noall +answer"; $process = new Process($command); $process->run(); if (! $process->isSuccessful()) { throw new Exception('Dns records could not be fetched'); } return $process->getOutput(); } In closing I hope you’ve enjoyed this little behind the scenes of. I’d like to emphasise that creating this service was a team effort. Every member of our team helped with making the code better. We also got some great contributions from the community for which we are grateful. This is not the first project that we’ve open sourced. If you like to see some more work by our team, take a look at our Dashboard, or the many Laravel, PHP and JavaScript packages we created previously. Want to support our open source efforts? Then consider, becoming a patreon. Source link
https://www.laravel-vuejs.com/a-beautiful-webapp-to-fetch-dns-records/
CC-MAIN-2018-26
refinedweb
1,005
56.86
. The proposed project can measure the rate of water flow in litre / minute and total water flow in litres. Let’s take a look at YF-S201 water flow sensor. Illustration of YF-S201: YF-S201 is a Hall Effect based water sensor. It has three terminals 5V (nominal working voltage), GND and output. The +5V is red coloured wire, the black one is GND and yellow one is output. The sensor gives out frequency directly proportional to water flow. The YF-S201 sensor can measure from 1 litre / minute to 30 litre / minute. The water pressure should be less than or equal to 1.75 MPa. The water can be injected from one end and water flows through the other end. The sensor may be placed after the main gate-valve of tank; if you want to measure the water flow in a network of water pipes or you can place just before a water tap to measure the water flow of single tap. The placement of the sensor can be anywhere according to user’s need but, care must be taken to avoid leakage of water. The sensor has a magnet and Hall Effect sensor; if we take a look at the sides of the water flow sensor, we can witness a plastic turbine in the path of water flow. A round shaped magnet is embedded at the center of the turbine and the Hall Effect sensor is sealed and protected from moisture and placed above the magnet. The Hall Effect sensor produces a pulse for every revolution of the turbine. Water Flow Waveform on Serial Plotter We can see the pulses generated by water flow sensor on serial plotter of arduino IDE, shown below (Using Arduino Single channel Oscilloscope). We have blown air through the sensor to rotate the turbine as a test and the waveform generated is shown above. The denser waveform on left hand side represents higher frequency and faster rotation of turbine, the less dense waveform at right hand side signifies the vice versa. A consistent water flow gives out consistent frequency output. We have to convert the frequency into litre/minute scale. To do this, the manufacturer has given a formula: Water flow rate (litre/min) = frequency / 7.5 So, we need to measure the generated frequency and apply the above formula in the program code. Technical Specifications of YF-S201: · Accuracy: +/- 10%, if you need better precision, we need to calibrate. · Working Temperature: -25 to + 80 degree Celsius. · Working humidity: 35% to 80% RH. · Output duty cycle: 50% +/- 10%. · Maximum water pressure: 1.75 MPa. · Pulses per Litre: 450. · Maximum current draw: 15 mA at 5V That concludes the YF-S201 water flow sensor. Now let’s move to the schematic. Schematic Diagram: The water flow sensor’s output pin is connected to A0 of Arduino. Use the 10K potentiometer for adjusting display contrast. Wire the Arduino and LCD display as per the above diagram. Program Code: //-----Program Developed by R.Girish-----// #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); int X; int Y; float Time = 0; float frequency = 0; float waterFlow = 0; float total = 0; float LS = 0; const int input = A0; const int test = 9; void setup() { Serial.begin(9600); lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0,0); lcd.print("Water Flow Meter"); lcd.setCursor(0,1); lcd.print("****************"); delay(2000); pinMode(input,INPUT); pinMode(test, OUTPUT); analogWrite(test,100); } void loop() { X = pulseIn(input, HIGH); Y = pulseIn(input, LOW); Time = X + Y; frequency = 1000000/Time; waterFlow = frequency/7.5; LS = waterFlow/60; if(frequency >= 0) { if(isinf(frequency)) { lcd.clear(); lcd.setCursor(0,0); lcd.print("L/Min: 0.00"); lcd.setCursor(0,1); lcd.print("Total: "); lcd.print(total); lcd.print(" L"); } else { total = total + LS; Serial.println(frequency); lcd.clear(); lcd.setCursor(0,0); lcd.print("L/Min: "); lcd.print(waterFlow); lcd.setCursor(0,1); lcd.print("Total: "); lcd.print(total); lcd.print(" L"); } } delay(1000); } //-----Program Developed by R.Girish-----// Author’s Prototype: The “L/Min” indicates the current water flow rate and the “Total” indicates the total water flowed since the circuit turned ON. You can also flow any liquids whose viscosity value is near to water. If you have any questions regarding this digital water flow meter using Arduino, feel free to express in the comment section, you may receive a quick reply. Shaikh murad says Water pressure should be less than 1.75 mpa so . sir can we use this project for petrol pump pressure. Because im not sure about the pressure of petrol pumps in mpa thankyou GR says Hi Shaihk, Petrol should work fine with this sensor. I won’t recommend using with petrol or any expensive liquids because this sensor has tolerance of +/- 10%. Meaning you will end up in pumping 10% more or 10% less petrol. Regards Ameesha Singh says can you give the flow chart of this program? Wexler says Hi is it possible to add an Eprom Memory to the circuit in order to keep the consumption over time even the power is turned off? I suppose some changes must be done also over the code. Can You solve this issue ? Thank You! GR says Hi Wexler, Yes, we can add an SD card or utilize built-in EEPROM of ATmega 328P for saving data. We can provide you the solution. Customized Arduino code is premium as of now , if you are interested comment with your detailed requirements, we will proceed. Regards rahul k says sir, i know that connecting LCD to potentiometer is for adjusting brightness but why did you connect the 5v pin of the flow sensor to the potentiometer? can i know why is that connection needed? GR says HI Rahul, Look at the circuit carefully, the 5V line is common for the potentiometer and flow sensor, it is just 5V path, red wire. Regards afrid says Sir kindly answer my question I made a transformer which have primery winding is 220 turn(18 swg wire 1kg) and secondary turn is 22 turn(10 swg 650gram) now the input voltage is 210 volt and output is 18 volt bobin size is ( 6inch×3inch) how much current given in output ????? Plz answer my question Swagatam says Afrid, It cannot be possible to judge the current through a visual analysis…you will have to check it with an ammeter.
https://www.homemade-circuits.com/simple-digital-water-flow-meter-using-arduino/
CC-MAIN-2022-40
refinedweb
1,068
64
Introduction to Programming Languages/Evaluation Strategies Evaluation Strategies[edit] The parameter evaluation strategy adopted by a programming language defines when parameters are evaluated during function calls. There are two main strategies: strict and lazy evaluation. Strict Evaluation[edit] The strict evaluation strategy consists in the full evaluation of parameters before passing them to functions. The two most common evaluation strategies: by-value and by-reference, fit into this category. Call-by-Value: The call-by-value strategy consists in copying the contents of the actual parameters into the formal parameters. State changes performed in the formal parameters do not reflect back into the actual parameters. A well-known example of this type of behavior is given by the swap function below, implemented in C: void swap(int x, int y) { int aux = x; x = y; y = aux;; } int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); swap(a, b); printf("%d, %d\n", a, b); } Once the swap function is called, the contents of variables a and b are copied to the formal parameters x and y respectively. The data exchange that happens in the body of swap only affect the formal parameters, but not the actual ones. In other words, the swap call is innocuous in this program. In order to circumvent this semantics, the language C lets us use pointers to pass the address of a location, instead of its contents. Thus, the function below swaps the contents of two variables, as intended: void swap(int *x, int *y) { int aux = *x; *x = *y; *y = aux; } int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); swap(&a, &b); printf("%d, %d\n", a, b); } The call-by-value strategy is very common among programming languages. It is the strategy of choice in C, Java, Python and even C++, although this last language also supports call-by-reference. Call-by-Reference: whereas in the call-by-value strategy we copy the contents of the actual parameter to the formal parameter, in the call-by-reference we copy the address of the actual parameter to the formal one. A few languages implement the call-by-reference strategy. C++ is one of them. The program below re-implements the swap function, using the call-by-reference policy: void swap(int &x, int &y) { int aux = x; x = y; y = aux; } int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); swap(a, b); printf("%d, %d\n", a, b); } In C++, parameter passing by reference is a syntactic sugar for the use of pointers. If we take a careful look into the assembly code that g++, the C++ compiler, produces for the function swap, above, and the function swap with pointers, we will realize that it is absolutely the same. The call-by-reference might be faster than the call-by-value if the data-structures passed to the function have a large size. Nevertheless, this strategy is not present in the currently main-stream languages, but C++. Parameter passing by reference might lead to programs that are difficult to understand. For instance, the function below also implements the swap function; however, it combines three xor operations to avoid the need for an auxiliary variable. void xor_swap(int &x, int &y) { x = x ^ y; y = x ^ y; x = x ^ y; } This function might lead to unexpected results if the formal parameters x and y alias the same location. For instance, the program below, which uses the xor_swap implementation zeros the actual parameter, instead of keeping its value: int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); xor_swap(a, a); printf("%d, %d\n", a, b); } Lazy Evaluation[edit] The strict evaluation strategies force the evaluation of the actual parameters before passing them to the called function. To illustrate this fact, the program below, implemented in python, loops. def andF(a, b): if not a: return True else: return b def g(x): if g(x): return True else: return False f = andF(False, g(3)) There are parameter passing strategies that do not require the parameters to be evaluated before being passed to the called function. These strategies are called lazy. The three most well-known lazy strategies are call by macro expansion, call by name and call by need. Call by Macro Expansion: many programming languages, including C, lisp and scheme, provide developers with a mechanism to add new syntax to the core language grammar called macros. Macros are expanded into code by a macro preprocessor. These macros might contain arguments, which are copied in the final code that the preprocessor produces. As an example, the C program below implements the swap function via a macro: #define SWAP(X,Y) {int temp=X; X=Y; Y=temp;} int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); SWAP(a, b); printf("%d, %d\n", a, b); } This macro implements a valid swap routine. The preprocessed program will look like the code below. Because the body of the macro is directly copied into the text of the calling program, it operates on the context of that program. In other words, the macro will refer directly to the variable names that it receives, and not to their values. int main() { int a = 2; int b = 3; printf("%d, %d\n", a, b); { int tmp = (a); (a) = (b); (b) = tmp; }; printf("%d, %d\n", a, b); } The expressions passed to the macro as parameters are evaluated every time they are used in the body of the macro. If the argument is never used, then it is simply not evaluated. As an example, the program below will increment the variable b twice: #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) int main() { int a = 2, b = 3; int c = MAX(a, b++); printf("a = %d, b = %d, c = %d\n", a, b, c); } Macros suffer from one problem, called variable capture. If a macro defines a variable v that is already defined in the environment of the caller, and v is passed to the macro as a parameter, the body of the macro will not be able to distinguish one occurrence of v from the other. For instance, the program below has a macro that defines a variable temp. The call inside main causes the variable temp defined inside this function to be captured by the definition inside the macro's body. #define SWAP(X,Y) {int temp=X; X=Y; Y=temp;} int main() { int a = 2; int temp = 17; printf("%d, temp = %d\n", a, temp); SWAP(a, temp); printf("%d, temp = %d\n", a, temp); } Once this program is expanded by the C preprocessor, we get the code below. This program fails to exchange the values of variables temp and a: int main() { int a = 2; int temp = 17; printf("%d, temp = %d\n", a, temp); {int temp=a; a=temp; temp=temp;}; printf("%d, temp = %d\n", a, temp); } There are a number of lazy evaluation strategies that avoid the variable capture problem. The two best known techniques are call-by-name and call-by-need. Call by Name: in this evaluation strategy the actual parameter is only evaluated if used inside the function; however, this evaluation uses the context of the caller routine. For instance, in the example below, taken from Weber's book, we have a function g that returns the integer 6. Inside the function f, the first assignment, e.g., b = 5, stores 5 in variable i. The second assignment, b = a, reads the value of i, currently 5, and adds 1 to it. This value is then stored at i. void f(by-name int a, by-name int b) { b=5; b=a; } int g() { int i = 3; f(i+1,i); return i; } Very few languages implement the call by name evaluation strategy. The most eminent among these languages is Algol. Simula, a direct descendent of Algol, also implements call by name, as we can see in this example. The call by name always causes the evaluation of the parameter, even if this parameter is used multiple times. This behavior might be wasteful in referentially transparent languages, because, in these languages variables are immutable. There is an evaluation strategy that goes around this problem: the call by need. Call! fib m n = m : (fib n (m+n)) getIt [] _ = 0 getIt (x:xs) 1 = x getIt (x:xs) n = getIt xs (n-1) getN n = getIt (fib 0 1) n The getIt function expands the list produced by fib only as many times as it is necessary to read its n-th element. For instance, below we have a sequence of calls that compute the 4-th element of the Fibonacci sequence: getIt (fib 0 1) 4 = getIt (0 : fib 1 1) 4 getIt (fib 1 1) 3 = getIt (1 : fib 1 2) 3 getIt (fib 1 2) 2 = getIt (1 : fib 2 3) 2 getIt (fib 2 3) 1 = getIt (2 : fib 3 5) 1 = 2
https://en.wikibooks.org/wiki/Introduction_to_Programming_Languages/Evaluation_Strategies
CC-MAIN-2019-18
refinedweb
1,517
55.47
File IO Represents file or directory Doesn't do IO Can be obtained from... are planning to learn file management using Java IO package.This class is available... or Directory Change a File timestamp Create a Temp Create text file at client's directory from server. Create text file at client's directory from server. Need java code to create text file at client's directory from server..... Please Help Working With File,Java Input,Java Input Output,Java Inputstream,Java io Tutorial,Java io package,Java io example File(path) Create File object for default directory...;Create File object for directory path given as string. File(dir, fname) Create File object for directory. Thus FTP Server : Create Directory In this section you will learn how to create directory on FTP server using java Java Create Directory The following example will show how to Create Directory in Java. Though... is already created" will be displayed. Example of Java Create Directory... of the program. For this we cerate a file object in File class which will create a IO File - Java Beginners IO File Write a java program which will read an input file & will produce an output file which will extract errors & warnings. It shall exclude... from the log file. This is the task assigned to me..Please help How to read properties file in java How to read properties file in java Description of Example:- In this example...= 8285279608 Example of Read properties file in java import java.io.... with the assigned key in the properties data file. How we will create .properties Copy Directory or File in Java will see how contains of a directory or a file is copied from.... otherwise read the source directory name and create the OutputStream instance... Copy Directory... how to write the program Read and write file Read and write file HI, How to read and write file from Java program? Thanks Hi, See the following tutorials: Java Write To File Read File Thanks Java file new directory Java file new directory In this section, you will learn how to create a new... an object of File class and specify a directory which you want to create. Then we..."); file.mkdir(); } } By using the method mkdir(), you can create a directory Read File in Java Read File in Java This tutorial shows you how to read file in Java. Example... shows you how to read file in Java * */ public class ReadFileExample { public... is the complete example of Java program that reads a character file and prints Moving file or directory from one directory to another Moving file or directory from one directory to another... from one directory to another. In this section an example is given... you want to create a new directory(Y/N)? y File or directory moved create create how to create an excel file using java Read Text from Standard IO from the keyboard and write output to the display. They also support I/O... through System.in which is used to read input from the keyboard... facilities for reading text from either the file or the keyboard on the command Java Write To File From String Java Write To File From String In this tutorial you will learn how to write to file from string. Write to file from string using java at first we will have... you how to write a file from string"; File file = null File copy from one directory to another in java very good code example for copying a file from one directory to another directory in Java. I have to write a program in my application for copying one file... for copying the file from one directory to another directory in Create Directory - Java Tutorial Java Create Directory - Java Tutorial  ... class to crate the directory. File The File class an abstract representation of file and directory pathnames. File class is used to interact with the files Create File in Java in string, rows, columns and lines etc. In this section, we will see how to create a file. This example takes the file name and text data for storing to the file.... If the mentioned file for the specified directory is already exist Read page from Web server Java NotesRead page from Web server The Java io package provides... is the complete example code in Java which reads the data from website and prints... }//end class ReadURL Another way to read from a server It's possible java io java io Write a program to use a File object and print even numbers from two to ten. Then using RandomAccessFile write numbers from 1 to 5. Then using seek () print only the last 3 digits Java Create Directory - Java Tutorial will learn how to create directory using java program. This program also explains... Java Create Directory - Java Tutorial  ... will use the class File class to crate the directory. Class File The File class java binary file io example java binary file io example java binary file io example How to Write to a File in Java In this Java tutorial, we will demonstrate how to write to a file in Java... to a file from Java program. To write the Java Write To File we will use two...[]) { try{ // Create file FileWriter fstream = new FileWriter("out.txt Read Write Read Write Hi; How can I read certain line of say 10 text files and write to one text file Java Read Multiple Files and store the data into another text file The given code reads all the text files of the directory Getting Current Directory from java - Java Beginners Getting Current Directory from java I'm designing an application in linux where i need to get the current directory of my java file... I'm using.../example/java/io/GetCurrentDir.shtml Thanks How To Create a New File which will demonstrate you about how to create a new file in Java...How To Create a New File In this section we will discuss about how to create... store String, characters, numbers etc. In Java to create a File for storing Create PDF from java code to create pdf file from database call from java programming. thank you...Create PDF from java Good afternoon, I have a problem how to create report. i want to create report in pdf file from my database in mysql. Now i which Java Read File Line By Line, Video Tutorial of Java Read File Line By Line Video Tutorial and example for the most searched topic "Java Read File... code to read a text file in Java line by line. Steps to create a test... and save in a directory Step 2: Create a java file and save on your computer. Step Java Write To File - Java Tutorial the file into specified directory. Following code write data into new...) to a file. You create a FileWriter by specifying the file to be written... an internal FileOutputStream to write bytes to the specified file Create File in Java of how to create a file in java: package FileHandling; import java.io.File...File is nothing but a simple storage of data in Java language. We call one... or directory and also use the pathname. File is collection of stored information how to write to file from string in Java how to write to file from string in Java Hi, Please any one help me for how to write to file from string in Java. I am beginner in Java programming. Thanks, Hi, Are you eager to learn how to write to file from Java IO CharArrayWriter explains that how to write char array to the output stream using, read the characters, and write the data to the file. For this in the example I have used...Java IO CharArrayWriter In this tutorial we will learn about how to create a create personalized SMS for each recipient - Java Server Faces Questions how to create a create personalized SMS for each recipient i am doing a project at college, i am using java server faces technology. I am having a problem of file upload, i want to upload a comma separated file (CSV) and read Java write file Java write file Following example demonstrates, how to create and write a file. In the example subclasses of Writer abstract class are used to write java io java io by using java coding how to invoke a particular directory Ant make directory with relative path ; This example illustrates how to make directory, how to compile java file and how to create jar file. This is a simple program...; is used to compile the java file and copy the class file in build directory How to make directory in java Description: This example demonstrate how to create a directory at specified...;new File("c:\\newDir"); file1.mkdirs();  ... is that it will make a dir at root directory of C drive Java IO FilterWriter Java IO FilterWriter In this example we will discuss about the FilterWriter... an example is being given which demonstrates about how to use Java FilterWriter. In this example I have created a Java class into which tried to write the data how to read and write an xml file using java how to read and write an xml file using java Hi Can anyone help me how to read and write an xml file which has CData using java Create and Save Excel File in JSP and saving Excel file from JSP application. In this example we are going... Create and Save Excel File in JSP  .... Java program allows to you to create any number of excel sheets in an excel How to create XML file - XML How to create XML file Creating a XML file, need an example. Thanks... language has many API's to create xml file from program.Here is the code example...()); }}Thanks Hi,Java programming language has many API's to create xml file from MappedByteBuffer example, How to create a large size file in java. Java MappedByteBuffer example, How to create a large file in java. In this tutorial, you will see how to create a large file with the help...;} } Output C:\>java CreateFile File How to write a file in Java? and strings. Example of how to write text to a file in java: import java.io....How to write a file in Java? To write a file in Java use the class FileWriter... will make a text file by the name "out.txt" and will write "Hello Java Java IO OutputStreamWriter tried to write the data to a file. So, when you will executed this example..."); bw.newLine(); bw.write("Java IO OutputStreamWriter Example...Java IO OutputStreamWriter In this section we will learn about the Java How to Create Excel Page Using JSP using pure word files using Java. We can create, read or write MS Excel file using... using java .By going through the steps of this example we can create any... must create the object of HSSFBook to read and write a workbook. It is top most java IO java IO Write a Java program to accept a file name as command line argument. Append the string "File Modified by Programme" to the end of the same file and print the contents of the modified File Java Io BufferedWriter , these are used to read data from the source. Then to write these data to the output...Java IO BufferedWriter In this section we will discuss about.... BufferedWriter class is used to write to the stream from buffer. Generally Java IO Path called the delimiter. The file separator varies from O/S to O/S for example... a file uses the complete directory path from root node to file is an absolute... not contains the complete directory path from root node to the file which has create folder chooser - Java Server Faces Questions create folder chooser I don't know how to create a browser folder( to save file download, for instance, not file chooser), please help me,(use swing...() { try { bi = ImageIO.read(new File("node.jpg")); w in File in Java How to write in File in Java Hi, How to write in File in Java. Please suggest and give example of this program. thanks Java IO InputStream Example Java IO InputStream Example In this section we will discuss about... created a text file and write some texts into them. In the example I have... it on the console. Source Code /*This example demonstrates that how to read How to write into CSV file in Java Object to PrintWriter instance. How to create File to CSV in Java...How to write into CSV file in Java How to write into CSV file in Java Hi, To create Comma separated value(CSV) file is very simple Java write to file Java write to file How to write to a file in Java? Is there any... to a text file. Here is the examples: Example program to write to file. File Handling examples in Java Java Input/Output Examples How to read file in Java Create JAR file - Java Beginners Create JAR file Respected Sir, I got the answer from your side. But do let me know, isn't there any other way of making a JAR File. Simply like...)).. Point is i just read somewhere that instead of changing the Environment Variable can create a jar file - Java Beginners how can create a jar file plz any one help me which file can i create the jar file plz give exact command Hi The basic format... that you want to create a JAR file. * The f option indicates that you want How to create file from input values in Jframe ? How to create file from input values in Jframe ? hi i m doing my project using java desktop application in netbeans.i designed a form to get... the inputs given by the user.i had a java program for it and accessed it by creating Read File Line by Line - Java Tutorial How to read file from Applet BufferedInputStream Example... Java Read File Line by Line - Example code of reading the text file... to write java program to read file line by line. We will use the DataInputStream File Management Example in Java for creating and updating data into text file? How a programmer can write code... for a good program to download the data from ftp server and then read the file one line... of file. Read the example Read file in Java for more information on reading How to write in File in Java How to write in File in Java Hi, How to write in File in Java... bufferedWriter object to write in the file. For more details and examples related to How to write in File of Java Program How to Create Multiplication Table from 1 to 10? How to Create Multiplication Table from 1 to 10? Hi, I want to develop an small application store products. So, i how to create multiplication... to 10 using in Java programming language. I had read an articles last month where Create Temp File Create Temp File In this section, you will learn how a temporary file is created to the default directory. A temporary file is a file that is created Create new file in java Create new file in java We are going to discuss how to create new file in java.... With File class we create files and directories. Java File represents actual... create main method than we use try and catch block. We have created File object How to create charts in Java? How to create charts in Java? Is there any example of creating charts and graphs in Java? thanks Hi, check the tutorial: Chart & Graphs Tutorials in Java Thanks Create PowerPoint Slide Using Java format by pure Java. It supports read and write capabilities of some, but not yet... Create PowerPoint Slide Using Java In this example we are going to create Java IO PipedWriter . This example explains how to write a specified length of characters started from...Java IO PipedWriter In this tutorial we will learn about the PipedWriter.... Syntax : public void write(int c) throws IOException Example Here How to Create New Excel Sheet Using JSP How to create new excel sheet using jsp  ... a new excel sheet using java .You can create any number of new excel sheets in a excel file. To create a excel sheet we can use third party APIs Directory chooser in core java - Java Beginners []) { JFrame frame = new JFrame("Directory chooser file example"); FileChooser...Directory chooser in core java Hi, I have to create a Utility... to create a GUI( AWT or Swing based only) which should have 2 directory
http://www.roseindia.net/tutorialhelp/comment/40802
CC-MAIN-2014-23
refinedweb
2,797
63.9
This post, I will be discussing one of the incredibly popular wrong practice of converting characters into their ASCII value in Java. Can you spot any problem with below? The output on console: 65 -- keep coding !!! public class CharToAscii { public static void main(String[] args) { char aAsChar = 'A'; System.out.println((int)aAsChar); //prints ASCII value } } 65 The program runs properly and prints the output as expected. So what's the issue? Above program will not mind as long as you can guarantee that input character is an english alphabet or some well known special character. The issue is with the message it conveys, it conveys that each character is mapped to a unique integer representation (which is ASCII number for English letters and some common characters like @, - etc). It gives impression that a number can be typecast to character and vice-versa. There is no one-to-one mapping between the two; the above code works as expected but it's WRONG. Char in Java takes 2 bytes (or 16 bits), so it maps 65535 characters (i.e. math.pow(2,16)-1), whereas ASCII is restricted to 128. There is huge list of characters which don't have ASCII representation at all. So definitely above approach is misleading. So what should be the proper way to convert character 'A' to its ASCII value. The proper way would be to use Unicode code point which is numerically equivalent to ASCII value. Unicode is the superset of ASCII. English alphabet 'A' in Unicode is U+0041 or 65 in decimal. So below approach should be preferred to convert characters into ASCII value or their encoded integer value. int ascii = String.valueOf('A').codePointAt(0); //return 65 If you interested in knowing the evolution of character encoding systems and knowing it in more details, I would strongly recommend this article, from Joelonsoftware. -- keep coding !!!
http://geekrai.blogspot.com/2015/02/proper-way-to-convert-character-to.html
CC-MAIN-2019-04
refinedweb
313
57.37
Devel::PPPort - Perl/Pollution/Portability Devel::PPPort::WriteFile() ; # defaults to ./ppport.h Devel::PPPort::WriteFile('someheader.h') ; Perl has changed over time, gaining new features, new functions, increasing its flexibility, and reducing the impact on the C namespace environment (reduced pollution). The header file, typicaly ppport.h, written by this module attempts to bring some of the newer Perl features to older versions of Perl, so that you can worry less about keeping track of old releases, but users can still reap the benefit. Why you should use ppport.h in modern code: so that your code will work with the widest range of Perl interpreters possible, without significant additional work. Why you should attempt older code to fully use ppport.h: because the reduced pollution of newer Perl versions is an important thing, so important that the old polluting ways of original Perl modules will not be supported very far into the future, and your module will almost certainly break! By adapting to it now, you'll gained compatibility and a sense of having done the electronic ecology some good. How to use ppport.h: Don't direct the user to download Devel::PPPort, and don't make ppport.h optional. Rather, just take the most recent copy of ppport.h that you can find (probably in Devel::PPPort on CPAN), copy it into your project, adjust your project to use it, and distribute the header along with your module. Devel::PPPort contains a single function, called WriteFile. It's purpose is to write a 'C' header file that is used when writing XS modules. The file contains a series of macros that allow XS modules to be built using older versions of Perl. This module is used by h2xs to write the file ppport.h. WriteFile takes a zero or one parameters. When called with one parameter it expects to be passed a filename. When called with no parameters, it defults to the filename ./pport.h. The function returns TRUE if the file was written successfully. Otherwise it returns FALSE. The file written by this module, typically ppport.h, provides access to the following Perl API if not already available .
http://search.cpan.org/~jhi/perl/ext/Devel/PPPort/PPPort.pm
CC-MAIN-2016-44
refinedweb
362
65.73
(One of my summaries of a talk at the 2019 PyGrunn conference). Servers used to be managed by proper wizards. But even wizards can be killed by a balrog. So… what happens when your sysadmin leaves? The point of failure is the sysadmin. Knowledge about infrastructure is centralised. It is non-reproducible. A solution is configuration management. Chef, ansible, saltstack, puppet. Configuration that’s in source control instead of information in a sysadmin’s head. It is a reproducible way to build your infrastructure. Source code, so everyone can see how a system works. You can even version your infrastructure. He’ll use saltstack as an example, that’s what they’re using in his company. It is a master/minion system. So a central master pushes out commands to the minion systems. For testing, he uses a tool called “kitchen”, originally intended for puppet, which can however also be used with saltstack: . He showed a demo where he created a couple of virtualbox machines and automatically ran the salt scripts on them. You can then ssh to those boxes and check if they’re OK. But… that’s manual work. So he started using testinfra and pytest. Testinfra helps you test infrastructure. There are build-in tests for checking if a package has been installed, for instance: def test_emacs_installed(host): assert host.package("emacs").is_installed You can run those tests via “kitchen”. They use that to test their infrastructure setup from travis-ci):
https://reinout.vanrees.org/weblog/2019/05/10/3-testing-infrastructure-code.html
CC-MAIN-2021-21
refinedweb
244
70.6
This article is the next article in LINQ learning tutorials which will cover LINQ to XML basics. IntroductionThis article is the next in the LINQ series to make the learning easy for beginners to get a clear understanding of the concepts. I have seen young developers and students that are very confused about LINQ and XML. This article will help them to understand and leverage their knowledge and to learn the advanced features later.If you are new to LINQ then please have a look at the basic articles for LINQ. BackgroundLINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework.MSDN Says, LINQ to XML is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET Framework programming languages.It provides both DOM and XQuery/XPath like functionality in a consistent programming experience across the various LINQ-enabled data access technologies.Functional constructionIt is a way to create a XML tree using a single statement rather going for the traditional approach of DOM implementation.There are certain classes that are used to create an XML tree with functional construction.The following is LINQ to XML class hierarchy, I have copied this image from the MSDN to make the structure more clear.The preceding diagram is from the MSDN.There are many more classes that can be used in LINQ to XML. The following are a few of them to explain the functional construction of XML. CustomersDetail.xml Sample CodeThis is sample code for the functional construction of XML using LINQ to XML with a statement. I have hard coded the values here just to explain the structure and classes used. The preceding example has hard-coded values just to explain how the functional construction works.We can do that using in-memory objects or data from a database using ADO.Net or using the Entity Framework depending on your requirements.Here I am explaining this using an in-memory object List.Sample code Main Method Querying using xml document using LINQ to XMLIEnumerable<T> can be used to query the XML data and for this standard query the operators show up as extension methods on any object that implements IEnumerable<T> and can be invoked like any other method. Another way to do that Manipulating XMLLINQ to XML provides a full set of methods for manipulating XML including insert, delete, copy and update XML content.Inserting new ElementUsing the Add() method new elements can be added to the existing XML Tree. If it is necessary to get the n elements added at the first element. There are two methods available if you want to add at a specific location. Deleting XMLTo delete XML, navigate to the content you want to delete and use the Remove() Method to perform the delete operation as in the following: Updating XMLXML Elements can be updated using the setElement Method. The ReplaceNodes() method can be used if nodes need to be replaced.Validation of XMLXML can be validated using the XML Schema Definition (XSD) language.XElement tree validation with an XML schema is done by importing the System.Xml.Schema namespace.A XSD file will give you a schema file where user validations can be placed and that can be applied to XML data and the validation can be implemented.On failure or success when validating there is a delegate provided that can use an error message and a customer error message can be printed.Sample Code A XSD file can be added from the Microsoft project templates.There is an overloaded Add method provided for adding the schema files URI and target namespace.The Validate method will accept a schema object and an event handler for validating the XML file against the XSD.OutputAdvantages of LINQ to XML ConclusionThere are many advantages and disadvantages of using LINQ technology. It is very important to choose very intelligently the LINQ for your application so that beautiful features of LINQ to XML can be utilized and the application could be more efficient. It should not be a performance overhead and problem for your application.More Tutorials on LINQ will be coming shortly.Keep smiling and keep learning. References: View All
https://www.c-sharpcorner.com/UploadFile/de41d6/learning-linq-made-easy-linq-to-xml-tutorial-3/
CC-MAIN-2019-47
refinedweb
712
55.13
I am trying to scrape AFL odds from betfair (). I am fairly new to webscraping however have managed to scrape odds from other bookies but i am having trouble with Betfair. The data I need is within a "ui-view" tag which doesn't seem to open when I use Beautiful soup to get the HTML. I've tried unsuccessfully to use selenium when loading the page to get the odds. from selenium import webdriver from bs4 import BeautifulSoup import pprint as pp BETFAIR_URL = "" #functions def parse(url): # open url driver = webdriver.Chrome( 'C:/Users/Maroz/Downloads/chromedriver_win32 (1)/chromedriver.exe') # opens page driver.get(url) # parses as html soup = BeautifulSoup(driver.page_source, 'html.parser') # closes same driver.quit() return soup betfair_soup = parse(BETFAIR_URL) pp.pprint(betfair_soup) #edit to show that it finds nothing in the span i need which is within the ui-#tags price = betfair_soup.find_all("span", {"class": "bet-button-price"}) pp.pprint(price) #output is [] I expected the betfair_soup to contain the infomation within this tag ui-view however it remains closed when printed to the terminal. Won't let me post an image because this is my first post but you might be able to see a screenshot of the tags I am trying to access here. As requested here is the html I get in terminal: <!--[if IE]> <script type="text/javascript">window['isIE'] = true;</script> <![endif]--> <!-- Set ie10 class: --> <!--[if !IE]><!--> <script> (function () { var isIE10 = Function('/*@cc_on return [email protected]*/')(); if (isIE10) { document.documentElement.className += ' ie10'; } })(); </script> <!--<![endif]--> <bf-meta-tags></bf-meta-tags> <bf-tooltip-guide><div class="tooltip-guide-container" ng-<!-- --></div></bf-tooltip-guide> <!-- --><ui-view></ui-view> #INFO IS IN HERE <script src="//ie2eds.cdnppb.net/resources/eds/bundle/vendor-assets-min_4146.js"></script> <script src="//ie2eds.cdnppb.net/resources/eds/bundle/bf-eds-static-client.min_4146_.js"></script> <script type="text/javascript"> I put a comment where the odds are located, when i view the page source the tags are also closed, so there isn't any way of me showing you what i see when i inspect element on the odds box other than the photo link i posted above^ edit: After trying suggestion to wait for ui-view to load this is the entire response, I still couldn't access the information in the span tags though. FINAL EDIT: Problem solved! Thank you to everyone for your suggestions and special thanks to S Ahmed for his persistence in solving this for me! Looks like it takes time to load the content of the <ui-view>tag and it is loaded by javascript. Try to wait for an internal element to be present before getting the source of the page. Try this: You have to import the following libraries Edit: Try waiting for the span.bet-button-priceto be present instead of the #main-wrap
https://techqa.club/v/q/cant-scrape-ui-tags-in-python-unsure-why-c3RhY2tvdmVyZmxvd3w1NTc4MjQ2Mg==
CC-MAIN-2021-39
refinedweb
477
57.87
Get Test Infected with NUnit: Unit Test Your .NET Data Access Layer Steven A. Smith ASPAlliance.com October 2003 Applies to: Microsoft® ASP.NET Summary: Learn how to use NUnit and some related tools to successfully support testing a Data Access Layer for ASP.NET applications. Test-driven development (TDD) has grown in popularity recently, especially with the growth of the Extreme Programming (XP) methodology. NUnit is an open-source unit-testing tool built for .NET, which follows in a long line of similar xUnit testing tools built for other platforms. It provides an easy-to-use framework for writing and running unit tests for your .NET applications. (15 printed pages) Download NUnitSample.msi. Contents Introduction Test Driven Development NUnit: A Test Framework for .NET Related Tools A Simple Application Lessons Learned Summary Resources Introduction All developers know their code should be tested to improve its quality. However, most developers hate to test. They especially hate to test their own code, since doing so uses time that instead could be spent writing cool new features and requires them to face their own potentially imperfect code. One way around these psychological barriers to testing is to write tests before writing the code, and to make it clear that the code isn't done until it passes the tests. The tests, in turn, reflect the external requirements of the code's behavior—in essence the tests document the design of the code. Writing tests first as a methodology is known as test driven development (or in some circles test driven design), or TDD. Test Driven Development Test driven development, or TDD, is of course too large a topic for this article. You can learn more about it at TestDriven.com or from some of the additional resources listed at the end of this article. A few relevant points are explained below. Improved Productivity A key principle of TDD is that developers are most productive when they are in the process of fixing a bug in an application (note: not looking for the bug). This is one of the few times during development that measurable progress is being made on the project. While developers spend time on other things, like finding bugs, they aren't able to spend as much time writing code to correct defects (for example, fixing bugs). A key benefit of test driven development (TDD) is to maximize the time developers spend in bug-fix mode, thus maximizing their productivity. Improved Quality In TDD, all non-trivial features of an application are tested. These tests are written before the actual code is written, and they are run all the time. Whenever a test fails, the developer immediately corrects the failure. So, when the time comes to add new functionality, the developer assumes the functionality exists and writes a test. He then runs the tests (which often won't even compile if they rely on as-yet-undefined classes and methods), and when they fail, he enters bug-fix mode and begins adding code to the application until he can get all tests to pass once more. Often, the process of writing the test for the functionality will provide the developer with a better understanding of how the production code should be designed, resulting in improved final code quality. TDD also makes code easier to maintain, upgrade, and redesign, and has other benefits which the reader is encouraged to research. NUnit: A Test Framework for .NET NUnit is an open-source testing framework for .NET, modeled after other similar testing frameworks in the xUnit family, such as JUnit for Java (in fact the initial version was a direct port of JUnit). You can download the latest version of NUnit from NUnit. NUnit provides a simple way for developers to write unit tests of the .NET classes, and comes with a small, sample application that demonstrates its use. The current version is written in C# and relies on attributes rather than inheritance and/or naming conventions to define tests and test suites. The main attributes involved are TestFixture, which applies to a class containing tests, SetUp and TearDown, which are run before and after each test, and Test. NUnit also provides a simple graphical user interface that lets you select which assembly you want to test and which set of tests within that assembly you want to run. It then runs all of the tests in the assembly (or namespace or class) selected, displaying a green bar if everything passes and a red bar if any tests failed. Details of each failed test are also displayed, making it very easy to locate the cause of the failure. Figure 1. NUnit's GUI tool provides instant feedback that everything is running as it should be, according to the tests defined so far. Figure 2. NUnit shows the details of a failure caused by an invalid connection string. There are other testing tools coming to market for .NET, but today NUnit has the largest support base, and is both free and open source, making it something you may want to try first. Related Tools NUnit Visual Studio .NET Addin This addin, which requires NUnit, allows you to run your tests without leaving the Visual Studio .NET IDE. Simply right-click on a project or solution in the Solution Explorer to run all tests within that project or solution. The results are displayed in the Output window. Unfortunately, there are no pretty green or red bars, but if having one less program open is important to you, this can be a useful tool. Figure 3. Run tests in Visual Studio .NET with a simple right-click. Figure 4. Output from NUnit tests run within Visual Studio .NET NUnitASP NUnitASP allows TDD to be extended to the user interface in ASP.NET, by providing a means of testing Web controls. Its usage is beyond the scope of this article, but you may learn more about it from the NUnitASP Web site. A Simple Application To demonstrate TDD, I've used it to help me redevelop a multi-tier sample application for ASP.NET. The application demonstrates how to register a user for an application, how to grant them access to secure web pages, and how to allow them to sign in and sign out. The data access layer for this application is concerned with adding users to the database, retrieving user information, and verifying that user logins are correct. I’ve used this sample for a couple of years now and built it with TDD several times, learning new things with each iteration. Lessons Learned Use a Test Database This should really go without saying, but just to be sure, you should always run your tests against a test database that is completely separate from your production database. The schema should match the production database's schema as closely as possible. The database should contain no data, except perhaps static lookup table data like lists of US states or city-ZIP code tables. All of the data you’ll be testing will be added during the setup of each test. Database Setup Set up the test database using a stored procedure. Originally, I was running the tests using setup routines in the code. At first this resulted in the database changing slightly with every test (most notably, IDENTITY columns were growing ever larger). Eventually, I coded enough into the SetUp and TearDown routines in my test code to get the database back to a standard repeatable state, but then I found that I was duplicating a lot of this code within each TestFixture class. Since it was all SQL script, I moved it into a pair of stored procedures, and I found that this made for a much cleaner set of test fixtures. The following code sample demonstrates how to set up simple test_SetUp and test_TearDown stored procedures, with code for resetting IDENTITY columns. The DBCC CHECKIDENT function is key to putting IDENTITY columns back to their original states. Code sample. SetUp and TearDown stored procedures ensure tests run in a consistent, realistic environment. CREATE PROCEDURE dbo.test_SetUp AS BEGIN exec test_TearDown ------------------------------------------- -- SET UP USERS TABLE ------------------------------------------- exec usp_InsertUser 'John', 'Doe', 'jdoe@test.com', 'password', 0 exec usp_InsertUser 'Jane', 'Smith', 'jsmith@test.com', 'password', 0 exec usp_InsertUser 'Admin', 'User', 'admin@test.com', 'password', 0 ------------------------------------------- -- SET UP ROLES TABLE ------------------------------------------- insert Roles (RoleName) values ('Admins') insert Roles (RoleName) values ('Power Users') insert Roles (RoleName) values ('Editors') ------------------------------------------- -- SET UP USERROLES TABLE ------------------------------------------- -- John Doe insert UsersInRoles (UserID, RoleID) values (1,1) insert UsersInRoles (UserID, RoleID) values (1,2) -- Jane Smith insert UsersInRoles (UserID, RoleID) values (2,3) -- Admin User insert UsersInRoles (UserID, RoleID) values (3,1) END GO By using the MS Data Access Application Block, the amount of code required to call these procedures is minimized (one line per call). Figure 5 shows an example TestFixture for my Users class, which has methods for adding users to and retrieving them from the database. A test user is defined with private variables and used in each of the tests that require an existing user (this user is added by the test_SetUp stored procedure). Figure 5. A sample TestFixture Notice that SetUp and TearDown are each only one line of code. In fact, since these are the same for all tests against this database (not just the ones in this class), I could probably just move these to my test's base class, which defines its ConnectionString property. Also note that I'm calling test_SetUp in both SetUp and TearDown—this is so my front-end application, which uses the same test database, has some data it can use. It would be more efficient to have a totally separate test database, which was completely emptied in each TearDown. The two tests shown, GetUser, and AddUserFailure, use different techniques to ensure that the underlying Users.GetUser() method is working correctly. In the GetUser() test, assertions are used to verify that all properties of a user extracted from the database match up with expected values. Each AssertEquals() call succeeds if the second and third parameters are equal. If not, then the test fails and the message provided as the first parameter is displayed. The AddUserFailure test uses the ExpectedException attribute defined in the NUnit framework. In this case, the AddUser method should throw an exception if an attempt is made to add a user whose email already exists in the users database. This test will only succeed if an exception of the proper type is thrown. Most tests consist of some setup (anything not done in the global SetUp routine) followed by one or more assertions. In testing a data access layer, none of my tests have needed to be more than a few lines long (at most one assertion per column/property, as with the GetUser() test above). Once the tests are in place, the data access layer can be refactored with confidence. For example, in my production DAL code, I had the code from some time ago. I added the tests, made sure they covered everything I cared about, and then converted my methods to use the Microsoft® Data Access Application Block, greatly reducing the lines of code necessary. I reran the tests periodically to ensure that everything still worked. Once that was done, I implemented an intelligent caching layer within the DAL, which was largely transparent from the calling code and thus could be tested with the same set of tests (and a few new ones to test the caching features). Having the test suite allowed me to make these fairly drastic changes quickly and with confidence. Performance In order to maximize the performance of your test suite, you should make sure your setup and teardown scripts are doing as little as possible. Generally, the only test cases that matter with regard to quantity are 0, 1, and more than 1. Thus, there is generally little benefit derived from testing that a table works with fifty rows of data versus testing that it works with two or three rows. If you have a subset of tests that require a substantial amount of data to be present, place these tests in their own separate test fixture and create separate stored procedures for their setup and teardown. Typically you’ll want these stored procedures to call test_SetUp and test_TearDown internally. Upgrading to .NET 1.1 If you have NUnit version 2.0 and .NET 1.1, NUnit will not work by default. You can fix this by adding a <startup> section to NUnit's configuration file. Within the startup element, you'll specify supportedRuntime and requiredRuntime versions, to force it to run under 1.1. You can do this for some projects and not others if you want to continue running NUnit 2.0 under .NET 1.0 for some projects. The final section would look like this: <startup> <supportedRuntime version="v1.1.4322"/> <requiredRuntime version="v1.1.4322"/> </startup> Note that the latest version of NUnit is 2.1 at the time of this writing, and provides support for .NET 1.1 intrinsically. Configuration Files Setting up configuration files for NUnit can be tricky if you haven't done it before. This is a very common requirement, especially in the data access scenario, since most data access layers depend on a configuration file for their database connection string information. In order to use a configuration file with NUnit, follow these steps: - Copy your ASP.NET web.config to your NUnit test project's output folder (for example, /bin). - Rename the copy to the same name as your NUnit test project assembly, with ".config" added to the end. (if the assembly name is "AspAlliance.Data.UnitTests.dll" then the config file should be "AspAlliance.Data.UnitTests.dll.config"). - Edit the new .config file and change your database settings so you are pointing to your test database, not production! Sample Configuration File: MyCompany.Security.Data.UnitTests.dll.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <!-- Required for NUnit 2.0, but not for 2.1 --> <!-- <startup> <supportedRuntime version="v1.1.4322"/> <requiredRuntime version="v1.1.4322"/> </startup> --> <appSettings> <add key="MyApplication.ConnectionString" value="server=localhost; database=NUnit;Integrated Security=true" /> </appSettings> </configuration> Scale Scalability is a valid concern with this approach. If we wanted to simulate production exactly, our setup procedure would backup the production database to the test database before each unit test. Assuming the database is more than a few megabytes, this would take far too long (unit tests should run in seconds, or at worst a few minutes, but no longer, for all but the largest of applications). So, as long as only a sampling of production data is sufficient and covers the relevant variations in the production data, the setup procedure should only involve a few inserts per table, and thus should scale fairly well (see Performance, above). At some point, for some applications, this technique will simply be too slow to use as frequently as TDD demands. At that point, one option is to scale back the frequency with which these tests are run. Darren Hobbs suggests this in his brief article, Putting the Unit in Unit Tests. Darren contends that most tests that rely on a lot of database setup are too slow and too brittle (prone to breaking during design changes) to be run all the time, as unit tests should be. I agree that if and when such tests do become a burden, one reasonable solution would be to only run them prior to checking code into production, rather than on every build or feature adjustment. Another option worth exploring is to use mock objects instead of a test database. However, since we're concerned with testing the data access layer here, there is very little for the code to do without a database to talk to, which is why I haven't gone this route. Creating mock objects also takes more development time than writing a couple of setup and teardown stored procedures. A brief comparison of test databases vs. mock objects can be found from the Unit Testing Database Code on the DevDaily Web Site. Summary Using NUnit, you can quickly detect problems in your data access layer (before your users do). By following a test-first development style, you will write better code and have greater confidence in your ability to modify the code without breaking other parts of the application. Hopefully this article has made you curious to learn more about test driven development, NUnit, and how they can help you build high quality .NET applications. Resources - NUnit Web site - NUnit Addin for Visual Studio.NET - NUnitASP Web site - TestDriven.com Web site - XP Programming Web site - Test Driven Development Group page on Yahoo - Test Driven Development: By Example by Kent Beck—Book page on Amazon.com - Refactoring: Improving the Design of Existing Code by Martin Fowler—Book page on Amazon.com - .TEST from ParaSoft - Unit Testing Database Code by Richard Dallaway - Unit Testing Database Code on the DevDaily Web site About the Author:.
https://msdn.microsoft.com/en-us/library/aa479010.aspx
CC-MAIN-2015-22
refinedweb
2,843
61.77
Several issues with Sync Center. - Thursday, January 26, 2012 2:53 PM Dear All, First of all thanks for taking time to read this question thread. I want to give you all some more information about the company where I'm employeed. We have 2 sites in the Netherlands. We have 5000+ employees and most of them are working with WIN7 ENT x64 SP1 (Version 6.1 build 7601: Servicepack 1). The servers are on Windows Server 2008 R2. We are using a DFS path for the homedrives of the users. We have 4 namespaces for this. Examples We have enabled the Offline files and folders with allmost no restriction on the usage of this. The GPO is not configured except for 1 thing. It will sync with the folder Data on the homedrive: \\COM.PANY.com\Users1\username\data We encounter several issues with Sync Center and we want to have them resolved, that's why I finally come out here. Problem 1: During Sync and usage of the homedrive (ask properties of all documents and folders) will force the homedrive in a offline modus for several minutes. Problem 2: Syncing with other usernames. Problem 3: Files will not be synced. Problem 1: I can reproduce this problem at my own computer and several other computers. When the user or me will click in sync center to sync all partnerships it will start. But in the meantime if the user saves a large file to his home directory, or opens the root of his homedrive and presses CTRL+A and after this ALT+ENTER it will read a part of the homedrive and will be forced in a offline modus for several minutes (between 1 till 15 min). Tried really allmost everything I could found: But the issue still remains, hope you all have some idea's for this. Problem 2: It's very odd and I can't tell you more then this, but hopefully you all have a brillant idea for this that resolves this problem. But once in a time a user reports that Sync Center gives an Access Denied error in the overview. When we connect to this user remotely we will see an username of a different user. It's a kind of magic, so hopefully you will know what you need or better yet, you will know how to prevent this. To solve the issue for the user is a reinitialize. Problem 3: The user saves his data on H:\Data, but because of problem 1 the data is only stored locally and will not be saved on the server. And some of all the users are not syncing anymore from 4-10-2011 (DD-MM-YYYY). We can't understand why it will not sync for some users after this date. I understand if this is unclear for you all, but this is my first post on TechNet. And I really want to solve this and if you need more information about this issue, please tell me how to get it and what and I will answer as soon as possible. I'm located in the GMT+1 and I will have a look at this forum during working hours and days. Hope to hear soon from you. Best Regards, John van Hoof. All Replies - Monday, January 30, 2012 9:28 AMSomeone? Please, it's really getting an issue. Could someone please give me an advise? - Tuesday, January 31, 2012 12:14 PM Hi John, If you can make sure that the network connectivity is still available when the issue occurs(homedrive offline mode), the status of the Offline Files may change into a Offline mode because the system detects a Slow Link when saving large files or query the properties of files. For Windows 7, the Slow Link Detect Interval is 5 minutes. That is, the machine detects if the Link is Slow every 5 minutes and it switches the Online/Offline mode according to the determined link speed. Therefore perhaps you may test on one of your Windows 7 client to increase the "Check for a slow connection every X minutes" value when the status is Online. Location to set the value: Control Panel > Sync Center > Manage Offline Files > Network tab In addition, I would also like to know if you have set the Size Limit of the Offline Files on the client side? Location to check the settings: Control Panel > Sync Center > Manage Offline Files > Disk Usage tab Best Regards, Steven Xiao Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. - Tuesday, January 31, 2012 12:29 PM Dear Steven, I have created a batchfile to ping the server in a loop and it doesn't have a networkconnectivity that was down or not responding. So the network (should) be no problem. We have changed the setting within Sync Center about Slow Link Detect Interval to 1440 (24 hours). The Slow Link Detection is by the GPO "Not Configurate", so that shouldn't be the problem also and in the registry is showing IsSlowLink DWORD=0. (HKEYLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\History). So I assume that it never had a SlowLink? I have also tried to set the Slow Detection in the local GPO to 0kbps (Is never slow), didn't resolved the problem. Currently at my side, where I can reproduce the problem, the diskage is: All Files: 4,19GB in use (21,8GB Available) Temp files: 4,10GB in use (21,8GB Available) As my point of view to this problem: It isn't the network, because the servers are staying online and it's not the diskage of Sync Center neither the SlowLink policy of Windows/Sync Center. Hope to hear soon from you. Best Regards, John van Hoof - Wednesday, February 01, 2012 3:54 AM Hi John, Firstly I would like to let you know that the Offline Files slow link detection after Vista has been changed, due to the fact that the Offline File's status has become a per-share attribute(that is, in Win7 and Vista, the offline share1 can be offline while the other offline share2,3,4 are still online), the system just tries to access the share via SMB (not PING) to detect if the slow link exists. It is different with the former XP OS(all offline shares are the same online/offline status simultaneously). On the other hand, per my knowledge, a "Not Configured" GPO doesn't mean that the related settings is disabled on the affected machines. Your clients will still detect the slow link using the 5 minutes interval by default. You may completely disable the "Configure slow-link Speed" GPO under the path: "Administrative Templates > Network > Offline Files" to prevent your Win7 computers from using the slow-link mode. You can also enable and decrease the value of the "Configure Slow link speed" GPO under the path: Administrative Templates > Network > Offline Files. (It seems that you have done this?) Configures the threshold value at which Offline Files considers a network connection to be "slow". Any network speed below this value is considered to be slow. Best regards, Steven Xiao Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. - Wednesday, February 01, 2012 9:02 AM Hi Steven, Thanks for your respond again! :) And for the information about the SMB, thanks didn't know that! Is there a way to monitor the SMB traffic? I know if you have nothing configured in the GPO, it will automatically go to the default setting of Windows and that is 500kbps. You will find a GPResult /r about that setting under in the post. But I had already set everything on Disable through the GPO because of the troubleshooting I already did, but I set everything back on default because it didn't worked. I even set the setting to "Always fast connection", didn't work either. But I can reproduce the problem every day I want, every time I want, so I think (and I could be wrong) it's not the slow link threshold. But I say it again, correct me if I'm wrong. ================================================ Last time Group Policy was applied: 2/1/2012 at 9:17:42 AM Group Policy was applied from: Server01.COM.PANY.com Group Policy slow link threshold: 500 kbps Domain Name: COM Domain Type: Windows 2000 ================================================ - Thursday, February 02, 2012 12:01 PM Hi John, If the issue maintains when you have the GPO "Configure slow-link mode" (sorry for the type error in my last response) to disable Slow Link, perhaps it isn't the slow link detection that is causing the unexpected offline state. Have you tried the clean boot mode the eliminate the interference from any third-party software? If possible, test the scenario when both the server and the client are under the clean-boot mode. Clean Boot. ---------------------------. Best regards, Steven Xiao Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. - Thursday, February 02, 2012 12:04 PM Hi Steven, Your type error doesn't matter, as long we understand each other :) I will try the clean boot this afternoon and I will let you know. - Thursday, February 02, 2012 1:23 PM Hi Steven, I have tested it, did a clean boot but the virusscanner McAfee will be started again when booted. So I uninstalled it. I have to inform you that I still have the same issue, ofcourse I have picked another laptop to check this. This will proof again that it is reproducable on every computer, everywhere at any time. :( Hope to hear soon from you. - Wednesday, March 21, 2012 12:20 PM Hi John and Steven. It seams that we have exactly the same problem here at our site, as is described above. I have although tried one other thing. I did connect the share with direct link (H=\\%server%\%user%) instead of using DFS. In my experience after trying a lot of different sync, I did not have any problem at all. I did sync different folders (more then one) and files, and I did exclude files and folders. But as soon as I use DFS-link the problem starts again. //Peter - Wednesday, May 16, 2012 2:10 PM Greetings John, did you ever find the solution of your issues? Basically i'm having similar issues when people at my work login in the morning, sync center goes to 100% CPU processing and the computers start to work very slow. After an hour they recover in a "ok" speed. When i kill the sync center task the processor load drops to 5%. - Friday, May 18, 2012 8:04 AM Hi Hector, I didn't find any solution to this problem, we are still experiencing this issue. We didn't get the solution we where hoping for. Maybe the only solution is to kick Sync Center out of the Window(s)? Or in the worst case the hole Windows out of the Window(s)?
http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/f0bf851d-3440-4401-9596-9a7cc2d4ed82
CC-MAIN-2013-20
refinedweb
1,927
69.31
Modern PHP: New Features and Good Practices 182 Michael Ross writes. Keep reading for the rest of Michael's review.Programmers familiar with the language and its community may recognize the author's name, because he is the creator of PHP The Right Way, a website which he describes as "an easy-to-read, quick reference for PHP popular coding standards, links to authoritative tutorials around the Web and what the contributors consider to be best practices at the present time," in 21 different languages. Yet rest assured that the book under review is not merely a dead-tree version of the website. Instead, the book covers the more recent advancements within the language, while the website covers best practices and standards. This should be borne in mind, otherwise the reader may be baffled by the absence from the book of certain topics on the website essential to the language, such as SPL, PEAR, and PHPDoc. Moreover, of the topics shared between the book and the website, the information is generally organized quite differently, with more example code in the book. This title was published on 1 March 2015, under the ISBN 978-1491905012, by O'Reilly Media, who kindly provided me with a review copy. Its material is presented in 268 pages, organized into 13 chapters (The New PHP; Features; Standards; Components; Good Practices; Posting; Provisioning; Tuning; Deployment; Testing; Profiling; HHVM and Hack; Community), which are grouped into three parts (Language Features; Good Practices; Deployment, Testing, and Tuning) — as well as two appendices (Installing PHP; Local Development Environments) and an index. The publisher's page does not offer much of interest. However, all of the example code is available from the book's GitHub repository. There are differences between the GitHub code and what is printed in the book, e.g., a baffling require 'vendor/autoload.php'; in the first example code file. The author claims that the reader does not need to know PHP, but at least "a basic understanding of [] fundamental programming concepts" (page xiv). However, anyone without at least intermediate skills and experience with PHP could conceivably struggle with these more advanced subjects. The first chapter is only a brief overview of the history of PHP, its current state, and some possible future changes to the language's engine. The real content starts in the second chapter, in which the author gives the reader a fast-paced introduction to his seven favorite major new features in PHP: namespaces, class interfaces, traits, generators, closures, Zend OPcache, and the built-in HTTP server. In some regards, the coverage is a bit too fast-paced, as some topics and questions likely in the reader's mind are not addressed — for instance, namespace case-sensitivity and techniques for ensuring that a chosen namespace is globally unique (page 9). For each topic, its purpose and advantages are explained, and sometimes illustrated with code examples, although none are extensive. The second part of the book opens with a chapter on some of the new standards in the PHP ecosystem that are intended to move the common development process from a reliance upon one isolated framework, with an idiosyncratic coding style, to distributed components that can interoperate through the use of interfaces, industry-wide coding standards, and the use of autoloaders for finding and loading classes, interfaces, and traits at runtime. Components are covered in more detail in the subsequent chapter, as is Composer, for installing components and managing dependencies. The fifth chapter is a lengthy but information-packed exposition of numerous best practices regarding input data sanitization, password handling, dates and times, and safe database queries, among other topics. Some of the advice can be found in other PHP books and online, but all of this is neatly explained, updated with the newer PHP versions, and worthwhile as a refresher. Deployment, testing, and tuning are the broad subject areas of the third and final part of the book. The author discusses the options for hosting your PHP applications, as well as provisioning any self-managed web server and tuning a server for optimal performance. All of the instructions assume you are using Linux and nginx, and thus would be of less value to those using Windows or Apache, for instance. The material on application deployment is relatively brief, and focuses on use of the Capistrano tool. Testing is often neglected in real-world projects, but certainly not in this book, as the author explains unit and functional testing, illustrated through the use of PHPUnit. This is followed by information on how to use a development or production profiler to analyze the performance of your application, with detailed coverage of Xdebug and XHProf, among other tools. The next two chapters dive into topics related to the (possible) future of PHP — specifically, Facebook's HHVM PHP interpreter and their Hack derivative language. The final chapter briefly discusses the PHP community. The two appendices explain how to install PHP on Linux or OS X for commandline use, and how to set up a local development environment. The author mentions a free edition of Zend Server, but the vendor page mentions no such pricing. Despite its technical subject matter, this book is not a difficult read. The author's writing style is usually light and friendly, especially in the preface. In a few places, the phrasing is a bit too terse, which might prove momentarily confusing to some readers, e.g., "Function and constant aliases work the same as [those of] classes" (page 11). The text has some errata (aside from the two, as of this writing, already reported): "curl" (pages 15, 220, and 222; should read "cURL"), "a an argument" (page 33), "Prepared statement [to] fetch" (pages 99 and 100), "with [the] php://filter strategy" (page 110), "2 Gb" (page 129; should read "2 GB"), "the the" (page 154), "path to a the code" (page 176), and "Wordpress" (page 190; should read "WordPress"). One weakness with the book is that for several of the topics — including some critical ones — there is not enough detailed information provided that would allow one to begin immediately applying that technique or resource to one's own coding, but instead just enough information to whet one's appetite to learn more (presumably from another book or a website). Secondly, some of the narrative — particularly near the end of the book, when discussing various tools — would be of less value to anyone not developing analytics environment. Beware that some of the tools require numerous dependencies. For instance, do you have Composer, Git, MongoDB, and its PHP extension installed? If not, then you won't be using XHGUI. Also, some of the installation and configuration steps are quite lengthy, with no details provided for troubleshooting issues that might arise. Lastly, despite the promise that any reader with only basic programming knowledge will be able to fully understand the book, such a reader would likely find much of its contents mystifying without further preparation from other sources. Nonetheless, the book has much to offer, despite its slender size. Numerous resources are recommended — most if not all apparently vetted by the author, who clearly has considerable experience in this arena. Some valuable techniques are presented, such as those instances in the text where the author shows how to use iteration on large data sets to minimize memory usage. In addition, the example code demonstrates that the author has made the effort to produce quality code that can serve as a model to others. Modern PHP does a fine job overall of explaining and advocating the newer capabilities of PHP that would attract developers to choose the language for building state-of-the-art websites and web applications. Michael Ross is a freelance web developer and writer. You can purchase Modern PHP: New Features and Good Practices from amazon.com. Slashdot welcomes readers' book reviews (sci-fi included) -- to see your own review here, read the book review guidelines, then visit the submission page. If you'd like to see what books we have available from our review library please let us know. Best practice for PHP... (Score:2, Insightful) Best practice for PHP: don't use PHP. Re:Best practice for PHP... (Score:5, Funny) Best Practice to make PHP run fast: Run. Fast. Re: (Score:1) It's nice enough for building a Personal Home Page, anyhow. Re: (Score:1) Best practice for PHP: don't use PHP. I've got mod points, but I won't use them in this thread. I didn't know whether to mod your post funny, insightful, or informative... hah (Score:1, Insightful) The best practice for using PHP: don't use it at all! im skeptical... (Score:5, Funny) ....PHP enthusiasts and detractors.... Who is this PHP "enthusiast" and how many drugs does he take to maintain this elaborate illusion... Re: (Score:3) Someone who hates everything else even more? It has the advantage that it does backwards compatibility well with advance notice when a feature is about to disappear This means that if I need to upgrade my PHP application, I am sure to have a version that supports both the new interfaces and the old deprecated interfaces and more importantly it means that if I have a number of different apps that I need installed, I am not likely to need to move them each into their own VM. Python as an example of everythin Re: (Score:1) In my experience people who were too lazy to learn perl in the mid 90s and who are not experienced in Java. Re: (Score:2) Not sure what you mean, i mean there are *bad* java web apps, but if you choose well from the many design paradigms available in the different Java Frameworks/Libraries, then you can obtain pretty well defined web apps. PHP is fine (Score:5, Insightful) It gets the job done quickly and easily, and if you find or write a good foundation of libraries and classes, the code is elegant and easy to understand as well. Just like every other language. Re: (Score:1, Troll) PHP is inherently insecure. You can't have a web platform language with constant patches. One day your fine, the next, rooted. Stay away. Re: PHP is fine (Score:1) How the heck is the parent "trolling"? That comment is completely true! Go check out the PHP changelogs. Some of the bugs being fixed in the 20th or even 30th or more patch release of the various stable releases are unbelievable. Clearly there is a quality issue at play when the relatively recent 5.4 version has had 39 patch releases, and the newer 5.5 version has already had 23. Re: (Score:1) write better code or learn how to secure your site/server... preferably both. i have 5 year old code running on a nearly-as-old version of php and mysql.. no security issues of any kind... on the same server is a couple ancient joomla (yuk) and wordpress installs.. same deal.. the server is secure, the sites are as well despite their obsolete software, and have a few nifty home-grown security measures in place, even the known exploits in both of those very hacker-friendly applications are totally unexploita I CAN tell you. Autoglobals, for 1. Much better (Score:3) I CAN tell you why PHP 3.x and 4.x were used in a lot of projects with security problems. I've made many posts here going into detail. The biggest thing was probably autoglobals. That was insane for a WEB language, even one then intended to be easy. It might make sense for local macros (vbscript) that are supposed to be written by non-programmers. If you combined few of PHP 4.x blind spots with stupid Plesk running the script via suexec, you either found out you quickly got owned, or more often got own Re: (Score:3) Re:PHP is fine (Score:4, Interesting) Re: (Score:2, Interesting) You clearly never had to use ExpressionEngine. If you think PHP was written by very inexperienced programmers, you're in for the shock of your life. ExpressionEngine has something called "Global variables" which are in fact CONSTANTS. And that kind of nonsense is just the tip of the iceberg. Look up their "parsing order", it was created by insane people with no previous programming knowledge. Re: (Score:2) Re: (Score:2) I have worked extensively with both. Expression Engine is just a bunch of ... huh?? It's not bad, but anything other than what they give you can be a pain in the ass. CI in general was always sorta good but shoulda been better. Magento has clearly been something that redefined PHP applications. The 1.x branch is going to go down as some of the least maintainable software ever written, but it was bad in a very productive way. 2.x (which you'll probably be seeing in a /. ad in the next few weeks before the co Re: (Score:2) Re: (Score:2) I think the problem a lot of programmers have with PHP is that it originally was written by very inexperienced programmer(s) and it still (?) shows. (1) So was Python. (2) So does Python. Python is only slightly more consistent than PHP, but gets much more bad press than PHP. I always wonder why that is. Re: (Score:1) VHDL. Wow. Unlike PHP, Perl, C, C++, C#, Pascal, and ECMAScript, VHDL's got a whole new paradigm. the code is elegant and easy to understand as well. Just like every other language Maybe I need to learn a new language. Re: (Score:2) Re: (Score:1) Actually, it's sane is to write haystack.find(needle) or find(haystack, needle) for same reasons. Collection first, then operand. If you want "english", use COBOL. Re: (Score:2) Then explain array_search($needle, $haystack) Re:PHP is fine (Score:5, Funny) Sometimes bad tools are just bad. (Score:2, Insightful) I don't get this it's-never-the-tools-but-always-the-programmer attitude that you have. I've seen it a lot at Y Combinator's Hacker News site, too. It's really a dumb concept. Some tools are inherently bad, and irreparably broken, even in the hands of the most skilled and experienced practitioners. Even the best master carpenter can't use a blob of Jello as a hammer or a saw. That doesn't mean the carpenter is no good. This carpenter is the best there is. He's just using a totally inadequate tool. It's the sam Re: Sometimes bad tools are just bad. (Score:1) The fact that we have to hold your hand through this process indicates that you should never be allowed to develop or work on any sort of software, ever. PHP's broken type system, its broken operators, its remarkably inconsistent standard library, its awkward syntax, its quirky and unexpected semantics, and its buggy implementations are good places to start when learning about its serious problems. The more you look into such things, the more you will learn about how flawed it is. Re: (Score:2) If the type system is broken, how is it broken? Broken meaning what? If you're going to make a compelling argument, you might want to start simply and at least give a practical example. You've failed to come up with reasoning compelling that would cause someone with customers and a revenue stream to take notice. Would you put up with that kind of failure in your utopia? My classical inheritance is intact, my multi-inheritance via composition (traits) is intact, I have lambdas. I have a lot less than that in Re: (Score:2) The problem is that people like you will continue to deflect the problems away because you're not competent enough to understand them in the first place. You don't know your code is broken. The fact that you don't know that the type system is broken means that you're wholly unaware that any code you have written involving integers can behave completely differently when you move your codebase from a 32bit system to a 64bit system. It means you probably don't realise that your code is failing when you expect ' Re: (Score:1) Re: (Score:1) Re: (Score:2) Re: (Score:2) And recently all over again with the EDM kids and their Javascript. My lawn, etc. Re: (Score:3) Blaming the language for bad code is asinine. It's not asinine but it is probably overly harsh. PHP is popular because it's easy for beginners to learn, easy to get stuff done quickly & simply, and easy for programmers familiar in C & C++ to start web development without having to grok a completely unfamiliar language. PHP is bad because it's easy for everyone using it to write insecure code. Re: (Score:2, Informative) Only a fanboy makes excuses for why they are too blind to see the many ways it is broken. PHP was designed and developed by a complete fucktard. Let's look at some code ... Note: The online manual is completely useless: * true... [php.net] * false... [php.net] * TRUE... [php.net] * FALSE... [php.net] More stupid shit PHP does ... Re: (Score:2) > You say zero and 0 and "0" the same. No, not me, I'm only listing PHP's stupidity. Here is a table showing how PHP's == operator is completely fucked up ..... [habnab.it] Of Javascript is just as retarded ...... [github.io] Re: (Score:2) Did PHP rape your dad or something? That's the only way I can imagine it makes you this angry. Seriously, this is pathetic. PHP works for many people who don't seem to find fault with the criticisms you've outlined. They either don't notice it, work around it, or work in the language with such a level of abstraction that they are not a problem. So please grow up - you are just embarrassing yourself now, with your neckbeard coder rage. Re: (Score:2) Ad hominem fallacy. The reasons _why_ I hate PHP are irrelevant. PHP is a shit design language. Education is the only way to get people to see its problems. > They either don't notice it, Typical head in the sand. Ignoring a problem doesn't make it go away. > work around it, Sometimes you can, however one can't work around fundamental inconsistency embedded in the design. > or work in the language with such a level of abstraction that they are not a problem. Exactly; They use a better designed language Re: (Score:2) > from some ideology that isn't based in rational discourse. /sarcasm Ah, so consistency is irrational now. Only in a brain-dead language can you do stupid shit like this: You PHP / Javascript apologists crack me up. Re: (Score:2) > Lisp is perfect for you. We're not talking about other languages. We're talking about how fucked up PHP is. > it's not like the interpreter is making arbitrary decisions Counter-example: [3v4l.org] Re: (Score:2) I think I've discovered your problem. It seems that the code you write serves no purpose. If your goal is to write code that serves no purpose, PHP is not for you. You might prefer KAREL. Re: (Score:2) Let's talk about a language for noobs designed by a boob: Re: (Score:2) If you write a good foundation of libraries and classes you'll need a hack like APC to get any decent execution speed. It also sucks at memory utilization. Everyone likes to link to that "fractal of bad design" article, but it's pretty much just a bunch of whining. Here's a real article that just plain hurts, it has to do with PHP's memory allocation:... [github.io] Re: (Score:2) Why are you not using Zend OPCache? Let's go, time to migrate beyond 5.3. Re: (Score:1) Damn, snagged! Re:PHP is fine (Score:5, Insightful) This is bullshit. A shitty language promote shitty code. Aside from the whole taking pride in your work and other "soft" effects, in PHP's case, there are several big, concrete instances of this happening. For example, older versions of PHP were obviously designed without any clear understanding of how a web request operates. So, for example, you'd have SQL escaping happening in the input layer rather than at the database layer. Nobody who understands what they are doing would design something to work that way. But the core PHP devs totally fucked up in the beginning. They have since started to pull this crap out of PHP, but take a look around. Big, widely-used PHP packages like CodeIgniter have replicated this topsy-turvy design fuckup even in recent versions. That's no coincidence - that's inherited from PHP's design flaws. The blind led the blind into hell, and this crap permeates the PHP developer community as a result. Likewise with the cavalier attitudes towards correctness. Error handling, character encoding, testing, release management, things like that. Where PHP fucks up, the community is sure to follow. The low quality of PHP has a direct negative effect on the code its fans write.. Re: (Score:1) Re: (Score:2) ." Absolutely and evidence of this is always only a Google search away. Search on how to do something with a database and the results you get are riddled with things like SQL injection Re: (Score:2) To follow on from this: Language Community Litmus Test: Database Placeholders [wumpus-cave.net]. An informal survey shows PHP joint bottom, with all but one of the top 5 hits for "PHP database tutorial" promoting insecure methods. And, as you mention, the official PHP tuto Re: (Score:2) Bad coders are irrelevant to the fact that PHP is objectively and measurably bad in design and implementation. It started as a toy, and that pedigree still shows. Not only is it still the mess of internal inconsistency, braindead weak-typing and promotion, and anemic text support, but there's some amazing -- I mean brilliantly, awe-inspiring, mind-boggling -- idiocy in some of its baked in APIs: LDAPs ldap_list() vs ldap_read() vs ldap_search() all perform the same operation but with different scopes, none o Re: (Score:2) Re: (Score:2) Suppose all guns came without safety catches. I now go and blame this technical oversight for the increase in people with blown-off heads. You now claim that blaming the safety-catch-less badly designed guns for the casualties is asinine. > It gets the job done quickly and easily, So does a gun without a safety catch. Re: (Score:2) Re:PHP is fine (Score:5, Funny) The problem with the PHP community is that it's filled with the kind of people who feel it's good idea to work on PHP. Are you down w/ OPP? (Score:1) I'm not down with Other People's PHP (OPP), knaw me Never understood the PHP hate (Score:3, Insightful) I've written PHP, Java, Javascript, C#, C++, C, and VB (and have dabbled in Ruby and Python), and I still don't get the hate for PHP. Granted, weakly-typed variables are a bit aggravating, but that's the only major complaint I have with it. A better model for Dynamic Typing (Score:2) A lot of that can be alleviated simply by having a language that does not overload operators across types, such as "+" for addition and concatenation, and by having optionally type-validated parameters. ColdFusion may suck in other ways, but it got these two things mostly right. Witness the function parameter (argument) declaration definition: Re: (Score:1) The summary does mention JavaScript. And Php still has the problem for equality operators (greater than, equal, etc.). Then again, ColdFusion didn't quite settle equality comparing either. Re: (Score:2) PHP is a piece of shit and this is why (Score:1) Re: (Score:2) That's a great list! Analysis of the PHP source code, showing some of the ways PHP is fucked up and hopeless beyond repair:... [viva64.com] Couch programmers bashing again. (Score:5, Insightful) Re: (Score:2) It's got nothing to do with laziness, at the end of the day the fact remains that PHP has an awful lot more inconsistencies, and has an awful track record on security, stability and functionality. I'm skeptical that anyone who claims to have a good depth of experience of PHP but claims it's as fine as anything else really does have the experience they're claiming. As soon as you need to start doing anything serious, like say, making use of threads, PHP's deficiencies rapidly come to the fore when compared to Re: (Score:2) Hmm. No idea what the fuck just happened to the rest of my post, lucky Slashdot isn't written in PHP or I could blame it for that too :) Anyway, basically my point was that it's really not in question that PHP has a number of problems that it's competition simply does not have, those problems are not caused by the programmer, they're caused by the language and it's libraries. Yes you can write bad code in .NET, Java, C++ and whatever else, you can also write good code in PHP. None of that is in doubt, but it' Re: (Score:2) That requires a few assumptions though, that you're using HHVM rather than the official PHP interpreter and that your application really is IO bound (which is entirely application dependent), and finally that you're not fully optimising your .NET, Java, or whatever else environment too. Even given these assumptions though, there's still the problem that PHP simply doesn't offer the breadth of support for hosting your application to optimally cater to different cases in the first place. For example, with WCF Re: (Score:2) "HHVM just closes that gap entirely" This is wholly false, HHVM is still a long way behind the level of JIT optimisation that both the JVM and the CLR perform, in part because PHP was never designed with the intention of being JIT'd from the outset making it much harder to JIT well in the first place. The amount of language inconsistency, edge cases where it contradicts itself and general design whereby things have been bolted on unplanned and ad-hoc all but guarantees you'll never write a JIT compiler for P Re: (Score:2) The second half of the paragraph proves that I understand VM technology in quite a lot of detail, and understand the sorts of difficulties involved in moving from a language to executable code through an intermediate form. I know that HHVM doesn't support strict PHP which is presumably what you're referring to, but if you're confusing the moderate changes made to make it work in a JIT at all with the complete break needed to be able to act in a competitively optimised JITted environment then it's not me that Re: (Score:2) Yeah you're right, I haven't touched PHP in a couple of years now so I haven't seen anything about (nor can I find anything even now) PHP's new async support for the things you list. Yes I'm aware it's now got some half-arsed threading support hacked in to move away from basing attempts at multi-threading on curl hacks, but it's not me you need to be telling this to - it's the other guy whose argument that PHP is fine performance wise is because you're spending 90% of the timing waiting on blocking IO, whic Re: (Score:2) Okay, so it sounds like I was right then after all if you're conflating curl hacks which require the spawning of a completely different process and a full blown TCP connection to achieve anything with an actual proper threading solution or async IO implementation (FWIW I find it amusing that you claim multithreading and async IO are completely unrelated things and then pretend curl is an async IO implementation- facepalm. You don't even know how PHP's curl library works). I was going to reply in a bit more d Re: (Score:2) "multithreading can be used to implement async io but it is not a requirement, see node.js." Oh god. Node.js uses IOCP, which implements a thread based model. Did you think it used magic or something? No wonder you're posted AC, you're just embarrassing yourself. Acting as living proof that PHP developers are clueless. Well done, you've successfully proven my points throughout. Re: (Score:2) Oh are you still here embarassing yourself? I thought you'd gone. Processes != threads. This is CS101. P.S. The way you speak of IOCP shows you don't even know what IOCP is or how it works. Is that you Bronscon? Re: (Score:2) You still seem to think spawning new processes is in any way a passable form of multi-threading in a high load environment as opposed to spawning new threads. This alone shows you're not fit to have any kind of discussion on this topic. For starters, it means you can handle drastically fewer concurrent tasks because it has by far a higher memory and CPU footprint to do so. That's before you factor in the problems of shared data meaning you're probably also duplicating data in your separate processes (i.e. ea Re: (Score:2) [citation needed] I miss Slashdot / get off my lawn (Score:2, Informative) The comments on this article are a horrible cesspool worthy of Youtube commenters. PHP hatred is the in thing, I get it. But what do these comments have to do with the fine article? How are we improving as an industry by hating on PHP? How are we encouraging the next generation of coders by these vapid, ignorant comments? If you agree, I invite you to join the rest of us Slashdot refugees at HN. Ouch. So sad. Not By Choice (Score:2) This is mostly because there are few practical alternatives on the client side. You can't have the user install say Python on the client side if you want to use Python. It's the QWERTY of programming languages: you are stuck with it because everybody else is also stuck with it. They are not going to fudge their browser just for your particular site. While J Re: (Score:2) Javascript is what makes pages load on peoples' browsers in seconds instead of milliseconds. It can turn a relatively recent computer or tablet into a slug. Keep your 'code' outta the marked up text that I'm trying to read. Nobody cares that you think you're a 'web developer' because you can slow down a stream of text that your 'users' are trying to fricking read. Re: (Score:2) OK, Grandpa. Sorry. We'll get off your lawn now. You can install NoScript and have to refresh your pages time and time again any time you want to use them, wasting seconds and many KB in the process. The rest of us will keep using the tools which give us the web we want to use. Shouldn't you be napping somewhere? No Static Typing (Score:4, Interesting) For all of PHPs many, many horrors, the one that actually got me the most is the lack of static typing when working with a large body of PHP code (Wordpress). One can wonder at many of the details of arrays etc, but once you know all the gotchas then you can work with them. But no static typing gets you over and over. It is also interesting that 40 years of careful research into programming language design, including very sophisticated systems such as Algol 68 and Common Lisp, had absolutely no effect on the design of what are the most commonly used hack languages today. (PHP and.)" You may have won the Internet today. I salute you sir. (btw I'm totally stealing.) Thank god for that. Re: (Score:2) Without any actual evidence, the 40 years of careful research is nothing more than navel gazing. This research has been the equivalent of "don't you think this is true? here's why" which is not how any kind of science is established. PHP best practice (Score:2) Don't. PHP - Best common practices: (Score:2) Don't use PHP. Use node. If you can't do that, use C. Not C# or C++, C. What, are you eight or something? Re: (Score:1) Even Wikipedia's transitioning from PHP to Lua. [citation needed] Re: (Score:1) Re: (Score:2)... [wikimedia.org] Re:Yes. (Score:4, Insightful) after years as the target of criticism, the PHP computer programming language is seeing a revival PHP has a really bad reputation, probably well-deserved. I don't know if it can overcome that at this point. It can be implemented well. I have seen it. The trouble arises when folks insist on over-engineering their PHP solution. I won't mention the photo project, but one time I was looking for the value of a variable. After days of grepping and sifting through thousands of lines of code, I found out that this variable was nothing but a constant in a very deeply embedded class structure. Why they created this whole class and derivatives just to set a constant, I can only guess that they freebased the OOP Kool-Aid. I don't give a shit what your CS prof says, there is nothing wrong with defines. Or 'goto's for that matter. There's nothing more annoying than a method/function that's hundreds of lines long just because the programmer didn't want to use a 'goto'. If your function is hundreds of lines long just because you didn't use a goto, you're still doing it wrong. Re: (Score:1) A lot of BS about PHP comes from developers of more OOP/MVC coding designs using Ruby on Rails, where as I think Ruby on Rails is a mess. look at the mess calling the mess a mess! Re: (Score:3) Just install one of the many many WAMP packages (WAMP = Windows + Apache + MySQL + PHP). Typically you just run a setup executable and get a ready to use installation of Apache with PHP and a MySQL server, which normally includes phpMyAdmin and some other helpful stuff. Re: Facebook was written in PHP (Score:2) Disclaimer: I genuinely like PHP. Facebook was originally written in Facebook, yes. However, you are missing the important fact Facebook took it upon themselves to fix a bunch of PHP's mistakes with HipHop PHP, later named HHVM. I've actually played with HHVM a bit. It maintains mostly backwards compatability with PHP code, but adds optional static typing and a few other goodies.
https://books.slashdot.org/story/15/03/22/1447230/modern-php-new-features-and-good-practices
CC-MAIN-2017-43
refinedweb
5,850
62.07
Question: I watched a talk by Douglas Crockford on the good parts in Javascript and my eyes were opened. At one point he said, something like, "Javascript is the only language where good programmers believe they can use it effectively, without learning it." Then I realized, I am that guy. In that talk, he made some statements that for me, were pretty surprising and insightful. For example, JavaScript is the most important programming language on the planet. Or it is the most popular language on the planet. And, that it is broken in many serious ways. The most surprising statement he made, for me, was "new is dangerous". He doesn't use it any more. He doesn't use this either. He presented an interesting pattern for a constructor in Javascript, one that allows for private and public member variables, and relies on neither new, nor this. It looks like this: // neo-classical constructor var container = function(initialParam) { var instance = {}; // empty object // private members var privateField_Value = 0; var privateField_Name = "default"; var privateMethod_M1 = function (a,b,c) { // arbitrary }; // initialParam is optional if (typeof initialParam !== "undefined") { privateField_Name= initialParam; } // public members instance.publicMethod = function(a, b, c) { // because of closures, // can call private methods or // access private fields here. }; instance.setValue = function(v) { privateField_Value = v; }; instance.toString = function(){ return "container(v='" + privateField_Value + "', n='" + privateField_Name + "')"; }; return instance; } // usage var a = container("Wallaby"); WScript.echo(a.toString()); a.setValue(42); WScript.echo(a.toString()); var b = container(); WScript.echo(b.toString()); EDIT: code updated to switch to lowercase class name. This pattern has evolved from Crockford's earlier usage models. Question: Do you use this kind of constructor pattern? Do you find it understandable? Do you have a better one? Solution:1 This looks like the non-singleton version of the module pattern, whereby private variables can be simulated by taking advantage of JavaScript's "closures". I like it (kinda...). But I don't really see the advantage in private variables done in this way, especially when it means that any new methods added (after initialisation) do not have access to the private variables. Plus, it doesn't take advantage of JavaScript's prototypal model. All your methods and properties must be initialised EVERY time the constructor is called - this doesn't happen if you have methods stored in the constructor's prototype. The fact is, using the conventional constructor/prototype pattern is much faster! Do you really think private variables make the performance hit worth it? This kind of model makes sense with the module pattern because it's only being initialised once (to create a pseudo-singleton), but I'm not so sure it makes sense here. Do you use this kind of constructor pattern? No, although I do use its singleton variant, the module pattern... Do you find it understandable? Yes, it's readable and quite clear, but I don't like the idea of lumping everything inside a constructor like that. Do you have a better one? If you really need private variables, then stick with it by all means. Otherwise just use the conventional constructor/prototype pattern (unless you share Crockford's fear of the new/ this combo): function Constructor(foo) { this.foo = foo; // ... } Constructor.prototype.method = function() { }; Other similar questions relating to Doug's views on the topic: Solution:2 I avoid this pattern as most people find it harder to read. I generally follow two approaches: If I only have one of something, then I use anonymous objects: var MyObject = { myMethod: function() { // do something } }; For more than one of something I use standard javascript prototypal inheritance var MyClass = function() { }; MyClass.prototype.myMethod = function() { // do something }; var myObject = new MyClass(); (1) is much easier to read, understand, and write. (2) is more efficient when there are multiple objects. Crockford's code will create a new copy of the functions inside the constructor every time. Closure also has the downside of being more difficult to debug. Although you lose truly private variables, you prefix supposed-to-be-private members with _ as a convention. this is an admittedly difficult problem in javascript, but can be worked around using .call and .apply to set it up properly. I also often use var self = this; to create a closure variable to use as this inside functions defined within a member function. MyClass.prototype.myMethod = function() { var self = this; // Either function inner1() { this.member(); } inner1.call(this); // Or function inner2() { self.member(); } inner2(); }; Solution:3 Do you use this kind of constructor pattern? Nope Do you find it understandable? Yes, its very straight forward. Do you have a better one? I haven't watched the talk yet, but I will be getting to it shortly. Until then, I don't see the danger of using new and this, and here's why: Without having heard his points, I can only assume that he suggests staying away from such things because of the nature of this, and how it is prone to change depending on the context in which a particular method is executed (directly upon the original object or as a callback, etc). As an educator, he may be teaching avoidance of these keywords because of the demographic of largely unaware and inexperienced developers who dabble in JavaScript without first grokking the nature of the language. For experienced developers who are intimately acquainted with the language, I'm not convinced that it's necessary to avoid this feature of the language, which grant it an amazing amount of flexibility (which is completely different from avoiding things like with). All that said, I'll be watching it now. At any rate, when not using some sort of framework that supports automagic inheritance (like dojo.declare), or when writing a framework independent object, I currently take the following approach. Definition: var SomeObject = function() { /* Private access */ var privateMember = "I am a private member"; var privateMethod = bindScope(this, function() { console.log(privateMember, this.publicMember); }); /* Public access */ this.publicMember = "I am a public member"; this.publicMethod = function() { console.log(privateMember, this.publicMember); }; this.privateMethodWrapper = function() { privateMethod(); } }; Usage: var o = new SomeObject(); o.privateMethodWrapper(); Where bindScope is a utility function similar to Dojo's dojo.hitch or Prototype's Function.prototype.bind. Solution:4 In his book it's called functional inheritance (page 52). I don't use it yet. It's understandable if you learn javascript from Douglas. I don't think there is a better approach. This one is good because it: enables a programmer to create private members secures private members and eliminates this opposed to pretend-privacy (private members start with _) makes inheritance smooth and without unnecessary code However, it has some drawbacks. You can read more about it here: Solution:5 Do you use this kind of constructor pattern? I've used this patter earlier on when I was first learning JavaScript and stumbled on to Douglas Crockford's literature. Do you find it understandable? As long as you understand closures, this method is clear. Do you have a better one? It depends on what you are trying to accomplish. If you're trying to write a library that will be as idiot proof as possible, then I can completely understand the use of private variables. It may help prevent users from inadvertently disturbing the integrity of your object. Yes, the cost in time might be slightly larger (about 3 times as larger), but the cost of time is a moot argument until it's actually affecting your application. I noticed the test mentioned in a previous post (test) does not account for how long it takes to access an object's functions. I've found that the prototype/constructor method usually leads to a quicker construction time, yes, but it doesn't necessarily save time in retrieval. There is an additional cost of using the prototype chain to find a function versus having a function attached directly to the object you're using. So if you're calling a lot of prototype functions and not constructing a lot of objects, it might make more sense to use Crockford's pattern. I tend to not like to use private variables, though, if I'm not writing my code for a large audience. If I'm with a team of people who are all capable coders, I can generally, trust that they'll know how to use my code if I code and comment well myself. Then I use something akin to Crockford's pattern sans private members/methods. Solution:6 If we need to create always the same kind of object, I rather use the Prototypal constructor pattern, since it allows share methods and properties through automatic delegation via prototype chain. Also we can keep the private objects; look at this approach: var ConstructorName = (function() { //IIFE 'use strict'; function privateMethod (args) {} function ConstructorName(args) { // enforces new (prevent 'this' be the global scope) if (!(this instanceof ConstructorName)) { return new ConstructorName(args); } // constructor body } // shared members (automatic delegation) ConstructorName.prototype.methodName = function(args) { // use private objects }; return ConstructorName; }()); I recommend reviewing this answer where we can find an interesting way to create a constructor function: Different way of creating a Javascript Object This is an example where you can use the approach of prototypal constructor: How do I create a custom Error in JavaScript? Solution:7 Think that can help the discussion to report here what is the main point about this pattern as explained by Douglas Crockford in his âAdvanced JavaScriptâ presentation video . The main point is to avoid the use of the new operator. Because when someone forget to use the new operator when calling an object constructor function, then object members added in the constructor all end up into the global namespace. Note that in this case there is no run-time warning or error that inform of the mistake, the global namespace simply get polluted. And this has proven to be have serious security implications and to be source of many hard to diagnose bugs. That's is the main point of this Powerconstructor pattern. The private/privileged part is secondary. It's ok to do that in a different way. So is that prototype members are not used. HTH luKa Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com EmoticonEmoticon
http://www.toontricks.com/2018/02/tutorial-oo-javascript-constructor.html
CC-MAIN-2018-09
refinedweb
1,720
55.54
"Serge E. Hallyn" <serue@us.ibm.com> writes:> Except the sysfs mount holds no refcount on the userns. So as long as we> do the ida tagging as you suggested in your response to patch 6, there> should be no reference to the user_ns left in sysfs code.>> The extra reference in patch #9 is for a light ref on the network> namespace. I'm still not sure that needs to be there, since if the> network namespace goes away, it will properly unregister its sysfs> mounts. Eric, Benjamin, I really don't see any use for the hold_net()> from sysfs. What is it doing?Mostly just being a sanity check. We can remove that if it easier.Eric
http://lkml.org/lkml/2008/6/25/369
CC-MAIN-2016-26
refinedweb
119
82.65
> > Which is almost certainly not what you want to happen. Think about direct> > rendering.> > I don't see what direct rendering has to do with closing the security> hole that /dev/shm currently is.Direct render objects (like shared memory objects) are backed by shmfs,so if you impose random limits on the shmfs you'll get weird graphicshappenings. You use a *lot* of shmfs objects when you are running 3Dgaming, enormous amounts for all your textures and the like.The DRM case means you can't set tight limits on shmfs and expect to playWarcraft.> Uh? I am pretty sure we don't want to mount a private tmpfs for each> user in /dev/shm and /tmp. If you have 500 users you'd have 500 tmpfs onOh I do. That would actually do something abut temporary file handlingwhich is a much much bigger issue than a DoS when people get it wrong.It's a bit of Unix history that wants sorting out more than /usrand /bin...> /tmp and on /dev/shm. Despite that without some ugly namespace hackeryOnly if they were all logged in> you couldn't make them all appear in /tmp as /dev/shm without> subdirectories. Don't forget that /dev/shm and /tmp are an established> userspace API.Don't forget there have been pam modules for doing per user /tmp/ foryears and years.> Resource limits are exactly the API that makes sense here, because:No because they are inherited process things and the exhaustion behaviouris not standards defined. Christoph is right that this should beimplemnted via quota.It might well be that your quota implementation is handled by a mountoption (sysfs just makes it more complex) and that mount blah -oquotaallusers=16G is how you set it up, but doing it via quota interfaces makes all sortsof crap just work including warning users about quota limits.Alan
http://lkml.org/lkml/2011/11/7/487
CC-MAIN-2013-20
refinedweb
314
71.04
The factorial of an integer is the product of that number and all of the positive integers smaller than it. Thus the factorial of 5, written 5!, is the product of 5*4*3*2*1, or 120. Example 1-7 shows a class, Factorial, that contains a method, factorial( ), that computes factorials. This class is not a program in its own right, but the method it defines can be used by other programs. The method itself is quite simple; we'll see several variations of it in the following sections. As an exercise, you might think about how you could rewrite this example using a while loop instead of a for loop. package je3.basics; /** * This class doesn't define a main( ) method, so it isn't a program by itself. * It does define a useful method that we can use in other programs, though. **/ public class Factorial { /** Compute and return x!, the factorial of x */ public static int factorial(int x) { if (x < 0) throw new IllegalArgumentException("x must be >= 0"); int fact = 1; for(int i = 2; i <= x; i++) // loop fact *= i; // shorthand for: fact = fact * i; return fact; } }
http://books.gigatux.nl/mirror/javaexamples/0596006209_jenut3-chp-1-sect-7.html
CC-MAIN-2019-13
refinedweb
193
63.19
Problem 1: Phone book. A phone book file is organized so that each line is an entry for one person. Each line has the following format: first, a name (one word, no spaces), then zero or more phone numbers, each preceded by a space (no spaces within a phone number). For example, these lines might be entries in a phone book file: Karen 555-231-5437 898-340-9870 Ala 212-889-0314 Write a function named getPhoneBook() that takes one parameter - the name of a file. getPhoneBook() should read the contents of the named file into a dictionary in which each name is a key and each value is a list of associated phone numbers. getPhoneBook should return (not print out!) the dictionary it constructs.
https://www.daniweb.com/programming/software-development/threads/421893/final-exam-practice-problem-input-output-really-need-help
CC-MAIN-2018-13
refinedweb
126
71.04
Content is crucial to any React web application. It makes our applications interactive for users and makes them a web application over just a static website. For bigger React applications, it's not uncommon to have ten to a hundred different content streams throughout. Because of this sheer volume, it's important to implement them properly.\n\n\\\nEvery content stream has different states. The most common separation has 4 different categories, namely when the stream is pending, loading, successfully loaded, or has errored. This means that every component has to implement 4 different code branches per content stream to account for every possible state. On top of that, every additional content stream contributes multiplicatively towards the number of branches that you need to maintain in the code.\n\n\\\nEvery possible branch leads to additional logic to account for that branch in the code, which in turn increases the complexity of the React code. As the complexity rises, it becomes more and more difficult to keep the code readable. This will lead to worse maintainability, which can be a serious risk long-term for any React codebase. Therefore, it's very important to make sure that the code for handling React content states stays readable, starting at the most fundamental level.\n\n\\\nThis article will go over the two most common ways to handle content states in your React components. We will discuss the advantages and drawbacks in terms of readability and the use cases for every structure. This information will provide you with a solid foundation on how to implement content states in your React components in a readable manner. After this article, you will be able to apply these structures, identify when your code declines in readability, and keep more complex constructions readable by building on top of this knowledge.\n\n\n---\n\n## Handle States In The Render\n\nThe most common approach you will encounter is handling the content states directly in the render through conditionals. What you do is check for a specific content state and, based on it, conditionally render code that reflects the UI for that content state. Generally, it would look as follows:\n\n\\\n```javascript\nexport const ComponentWithContent = (props) => {\n // Code...\n return (\n <div className="container">\n {contentState === "pending" && <span>Pending...</span>}\n {contentState === "loading" && <span>Loading...</span>}\n {contentState === "error" && <span>An error has occurred...</span>}\n {contentState === "success" && <div>{/* ... */}</div>}\n </div>\n );\n}\n```\n\n\\\nHere we have a component with a variable that captures the state of a content stream. The stream could be coming from anywhere: props, state, a hook, or external code. In the context of this article, this is all considered the same and does not affect anything that will be discussed. The most important aspect is that there is a variable that captures the content state.\n\n\\\nIn the render, we check for the different possible content states and render UI based on it. In this example, we make use of the AND operator. But all the same, it would apply even if the conditionals were implemented differently. For example, using ternary operators or composite components that handle the state.\n\n\\\n```javascript\nexport const ComponentWithContent = (props) => {\n // Code...\n return (\n <div>\n <State value={contentState}>\n <State.Pending>\n <span>Pending...</span>\n </State.Pending>\n <State.Loading>\n <span>Loading...</span>\n </State.Loading>\n <State.Error>\n <span>An error has occurred...</span>\n </State.Error>\n <State.Success>\n <div>{/* ... */}</div>\n </State.Success>\n </State>\n </div>\n );\n}\n```\n\n\\\nThe biggest advantage of handling all the cases of the content stream in the render is that everything is exactly in one place. When reviewing, going through the code, or refactoring it, you only have to look at one place. You will immediately get an overview of the entire structure and see how the content states are handled.\n\n\\\nAnother advantage is that the similarities and differences are clear. In particular, this structure focuses on similarities while highlighting minor differences. Based on where the conditionals for the content states are placed, it's relatively easy to determine what code is shared and what code is specific for a certain state. Not only does this improve the readability, but also the future maintainability, as this is crucial information to have when refactoring such a component in the future without prior context.\n\n\\\nBecause of the way this structure focuses on similarities and highlights differences, it works great in scenarios where the different content states have either similar DOM structures or only affect similar areas of the DOM. In those cases, the different branches are grouped at the location that they target in the render function. If you are reading through React code from top to bottom, this will feel very natural as the last section is always the render and greatly improve readability.\n\n\\\nTake the example at the start of this section. All of the branches are nested inside the container element. While reading, refactoring, or reviewing this code, two things are immediately clear. First is that the UI for all the content states is the same up to and including the container element. The second is that the content only affects the UI in this particular area, the children of the container element.\n\n\\\nIn the context of this trimmed-down example, these nuggets of information are not too significant. But in real-world scenarios, DOM structures are usually significantly larger. Navigating your way through them is not a trivial task, let alone being able to identify similarities and differences, which is important for refactoring and maintainability. In those cases, every bit of information adds up, and handling all content states in the render is one way to improve readability.\n\n\\\nWhile we have discussed the advantages and use cases, there are also scenarios where this approach will actually hurt the readability more than it does good. As mentioned, this approach works great if the different content states have similar DOM structures or only affect similar areas of the DOM.\n\n\\\nIf these do not apply to the component, then implementing the content states using this approach can become quite a mess. If a lot of different areas of the DOM are affected by different content states, this approach will result in a lot of distributed conditionals inside your render. While at a low number, this isn't too bad. The readability of your React code will greatly decrease as the number of conditionals increases because they are relatively verbose.\n\n\\\nThis is even worse if the content states have varying DOM structures. Trying to create one large structure that will accommodate all of them rarely does anything good for the readability of the code. It will split up your code into even larger conditional blocks and distribute them over different locations and even nesting levels. This will result in an extremely convoluted and hard-to-follow DOM structure, which will only hurt the code readability.\n\n### Summary\n\n* ✅ Everything is structured in one place.\n* ✅ Focuses on similarities and highlights differences.\n* ✅ Works great if content states have very similar DOM structures or affect the same area of the DOM.\n* ⛔ Will result in a lot of distributed conditionals in the render if content states have different DOM structures.\n* ⛔ Code can become a big mess where large blocks are separated conditionally and at different nesting levels.\n\n\n---\n\n## Handle States Through Early Returns\n\nAnother approach to handle content states is through early returns. This approach puts the conditionals out of render and moves them up in the component. When the condition is met, the component does an early return with the appropriate code. This continues until all the content branches are handled, and all the options are exhausted. Generally, it would look as follows:\n\n\\\n```javascript\nexport const ComponentWithContent = (props) => {\n // Code...\n if (contentState === "pending") {\n return (\n <SomePendingComponent />\n );\n }\n\n if (contentState === "loading") {\n return (\n <LoadingSpinner />\n );\n }\n\n if (contentState === "error") {\n return (\n <ErrorMessage>An error has occurred...</ErrorMessage>\n );\n }\n\n return <div>{/* ... */}</div>;\n};\n```\n\n\\\nIn the example, the component first checks whether the content stream is still pending. If so, it will do an early return with a component that is specific to the pending state. If not, we will continue and immediately check for the next possible state. The same goes for the loading state and then the error state. Lastly, we are sure that all the other options were already exhausted, so the last case to handle is the success state, which we can do through a regular return.\n\n\\\nThe biggest advantage of this approach is that this structure requires the least effort of keeping track of the data flows when reading through the component code top to bottom. The code is always only tackling one state at a time. This means that when you read it, you only have to remember which state you are in, which is indicated by the conditionals. Then, when you enter the block statement, you know that everything inside of the block is only related to that particular content state. This decreases the burden on the reader to constantly have to keep a mental modal of the UI, the similarities between states, and the differences. Rather, they can focus on a single state at a time, like reading chapters of a book, and move on to the next state when they are done.\n\n\\\nIn line with this is how people most commonly prefer to go through the different content states. Based on what I personally do and saw from other people, we most of the time prefer to first handle the loading states, then the error one, and then leave the success state for last. This approach fits exactly in that preference and thus matches the structure of the code the most with the expectations of readers. This will make the code more natural to follow and to read, thus benefitting the readability.\n\n\\\nThis approach works really great if the different content states lead to totally different DOM structures. If similarities are small, then it's becomes very difficult to both maintain the readability and keep the code together while still accounting for all the differences because there are a lot. So instead, the content cases are separated from each other and handled on their own. This puts most of the emphasis on the differences. The more different the DOM structures for the content states are, the more this approach enhances the readability of the code.\n\n\\\nThe best-case scenario for this approach is that every content state has a totally different DOM structure, as that maximizes the readability of this approach. But that is not always possible or applicable in real-world scenarios. Likely, there will still be some similarities in structure between content states, which is also the main drawback to this approach.\n\nIn general, handling content states through early returns does really well to accommodate for differences but is very bad at accounting for similarities. Because of the way it tackles content states one entirely at a time, code will have to be duplicated if similarities occur. The more code is shared between the content states, the more code duplication it introduces to the React component.\n\n\\\nAnother drawback of this approach is that the code and logic for handling the content stream are distributed vertically all over the component. It's impossible to get a quick overview of how all the different content states are handled. Instead, if the readers need a complete picture, e.g., refactoring, they are required to go through all of its tops to bottom and compare them case by case. This can take quite some time and effort.\n\n\\\nAnother drawback is the distance that is created between the code for handling a certain case and the utility code related to it. The usual structure of React components is that hooks reside at the top. Not only is this a convention, but also a requirement as they can't be conditionally called. In this approach, we're actively creating distance between that code and code for states that are handled later in the component. The later a state is handled and the larger the code for handling the other states are, the more distance is created relative to relevant (state) variables, callbacks, or hooks. In certain scenarios, the distance can become so big that it actively obstructs how efficiently the reader can go through the code and understand it, thus diminishing the readability.\n\n### Summary\n\n* ✅ Tackling one content state at a time.\n* ✅ Readers don't have to keep a full mental modal of the similarities and differences but can just focus on the current state that is handled.\n* ✅ Leaves the success case for last, which is the reading style a lot of developers prefer.\n* ✅ Works great if content states have very different DOM structures.\n* ⛔ Doesn't handle code similarities well, which can quickly lead to a lot of code duplication.\n* ⛔ Impossible to get a quick overview of the content states logic.\n* ⛔ Vertical distance between content state logic and their utility code (variables, callbacks, and hooks) can obstruct the readability if it becomes too big.\n\n\n---\n\n## Final Thoughts\n\nContent streams are an important part of any React project. They make React applications live up and interactive for the users. But from the development perspective, your components become complex very quickly as the number of content streams increases. This leads to a multiplicative increase in the number of content states that the components need to handle. Long term, making sure that this code is readable has a serious impact on maintainability.\n\n\\\nIn this article, we discussed two fundamental approaches to handling content states in your React components. Either handling them in the render, using conditionals or composite components, or handling them through early returns. Both have their advantages, drawbacks, and use cases in terms of readability. This information provides you with a solid foundation on how to implement content states in your React components in a readable manner. You will be able to apply these structures, identify when your code declines in readability, and keep more complex constructions readable by building on top of this knowledge.\n\n\\\nAlso published on <>.
https://hackernoon.com/handling-readable-react-content-states-g84135xv
CC-MAIN-2021-39
refinedweb
2,448
53.92
From “6 Simple Tips to Get Stackoverflow Reputation Fast” at codexon.com: - Be the First to Answer. Even at the cost of quality. - Use Downvotes and Comments Strategically - Use obnoxious in-your-face formatting and lists. - Be Aware of the 200 rep/day Limit - Edit, But Don’t Edit Too Much - Associate your other accounts Courtesy of our pal codexon. Agree? Disagree? Walnuts? Cantaloupe? locked by Jeff Atwood Jun 22 ’17 at. - 258How in the world do you downvote strategically…? – aggregate1166877 Oct 18 ’12 at 15:05 - 138By downvoting other answererswho are competing with your answer. If you do that when you would not have done (had you not answered the question), then that is strategic. – Phil H Oct 31 ’12 at 11:35 - 70More importantly, down voting answers costs you rep. So using too frequently isn’t going to help your score. – HaemEternal Jan 21 ’13 at 13:19 - 109Where is the part about using jQuery for the answer?! – Awesome Poodles May 31 ’13 at 1:17 - 25You could always just ask a ridiculous number of questions… meta.stackexchange.com/questions/1326/… – apaul May 31 ’13 at 5:54 - 104I’m kind of appalled at the existence of this post… – jpmc26 Jul 15 ’13 at 7:21 - 207downvoting only for the sake of for personal rep gain. Now that is anti-community. – Tanvimil Aug 17 ’13 at 9:58 - 15ALSO Dont Comment on a post which is voted down I mean under 0, It will make them think that you were the downvoter ….. – UltraDEVV Sep 25 ’14 at 16:42 - 4What about: Provide copy and paste solutions to simple, everyday problems in enterprise languages, especially Java [and now Swift]? – Carl Smith Nov 9 ’14 at 19:28 - 4Can someone please explain #6? Is that the same as merging 2 accounts created inadvertently? It seems like that would rarely happen. If it did, there wouldn’t be many points in one of the accounts. – Nelu Nov 28 ’14 at 1:52 - 8I would down-vote this, but I don`t have enough reputation A far more constructive answer is provided here – dmcquiggin Apr 5 ’15 at 3:10 - 12@Phil H “downvoting other answerers who are competing with your answer” is very evil – bugsbunny5112 May 8 ’15 at 9:54 - 11this have been been posted 6 years ago, but I find disgusting and unethic to “downvote” perfectly valid answers just to get reputation. – Alvaro Menéndez Oct 15 ’15 at 21:31 - 9These tips are not to be taken seriously, as they are clearly tongue-in-cheek. This is a satirical commentary from someone who is clearly unhappy with the status-quo. – Sheamus Apr 3 ’16 at 15:58 - 4As a long-time StackOverflow user, I strongly disagree with #1. The whole appeal of StackOverflow is quality answers, not fast answers at the cost of quality! It’s actually upsetting to see that as a suggestion at all… – CoolBots May 12 ’16 at 20:31 I don’t know about you but here’s my strategy. - Post high quality answers. This should be numbered 1 2 and 3. But a good answer will more often than not trump a fast answer. Though there are cases where it does not. - Monitor the frontpage and the new questions list. Learn their cache time and refresh accordingly or use the tag pages (Example) to get live updates on new questions. - Set up a good but short list of Interesting and Ignored tags. For example I have css, html, jquery, javascript, mysql and php as interesting tags. This will help you see questions, which you can answer, quicker. - Avoid Wall-of-Text questions. They take way too much effort for little reward. And usually are syntax errors or bad structure. - Post an answer even if the question already has 1–2 or even 3 answers. In these cases, take your time and answer well. This will usually net you a good sum of rep. - Learn when to edit. Post a short answer at first and then edit. You have <5 minutes to make that answer shine. - Be humble, thorough and fair. There are a lot of smart people out there and many will know much more than you about the subject. Be thorough in the code you post, check it for syntax errors and make sure it fits the question. And if you see that the correct answer is already there, upvote it, that person deserves the rep. - 994I voted this up because it contains a list with bold items. – Jeff Atwood Aug 25 ’09 at 11:02 - 36@Jeff Atwood aren’t we all hypnotized by bold? – Maxim Zaslavsky Sep 8 ’09 at 22:34 - 140I think the list should have one more item: 8. Provide a good and simple code example (and format it correctly) – awe Jul 22 ’10 at 12:37 - 14If SO reputation were money, this post would be investment advice, and @Olafur a rich man. – abel Jan 15 ’11 at 10:42 - Now you can edit your questions and answers any time. – nyuszika7h Jan 22 ’11 at 23:47 - 10By the way, subjective is not a tag anymore. – Dan Jun 13 ’11 at 10:28 - 269. Demo Link. Add link to a ready to run demo of your code. (codepad.org, jsfiddle.net, …) – PiTheNumberJan 16 ’13 at 10:04 - 52I would add #8 Go Niche. Find something you are good at that is not as popular as [java]or [sql]. Watch that tag every day and answer questions if you can. There are usually fewer people on the tag and you can take more time to answer. – Jess Apr 10 ’13 at 20:58 - 4Regarding demo links, I totally agree. However, please keep in mind that sometimes those links get broken. That is why I consider good practice to paste that code in your answer here at SO too. – pablofiumara Sep 12 ’13 at 4:39 - 1What’s a “Wall of Text” question? Very verbose? Or something else? – Shiva Jan 17 ’14 at 23:44 - 4Wall of text are unformatted big chunks of code, with little to no explanation of what is going on and what the point of the OP is. Also check urban dictionary urbandictionary.com/define.php?term=wall%20of%20text – Zlatin Zlatev Feb 25 ’14 at 13:25 - I would like to add some points to your point 5. As you say Post an answer even though the question has 1–2 or even 3 answers, In that case check whether already existing answer have covered all the things.Sometimes more knowledge peoples will post quickly with all the thing need to be know about that point. So in that case dont try to Duplicate it. – krishna May 26 ’14 at 10:53 - @JeffAtwood I checked the source, they are clearly strong. – kzh Oct 3 ’14 at 18:29 - 6“Post a short answer at first and then edit. You have <5 minutes to make that answer shine” This might have been fine 5-6 years ago with a lot less users, now it doesn’t help you, or anyone else. You just get downvoted immediately for posting a poor or less than useful answer. – James Apr 12 ’15 at 17:33 - 1@abel: Ólafur Waage would not be a rich man. His post is a community wiki! – David Oct 5 ’15 at 20:37 To be perfectly honest, I absolutely agree with #3. A bit of formatting - Makes the post more readable - proves that the user put a bit of effort into it - prevents the “Wall of Text crits you” effect - stands out - allows me to spot important points more easily - puts some structure into the posting And #6 is also a no-brainer. Not because of the reputation but because that gives clickable names when migrating the question. Point #1 is well discussed, just search for the fastest gun in the west problem. And Point #5 benefits the person who asks the question, because more visibility = more chance for an answer without having to post a bounty. So only Point #2 is purely evil and should be somehow monitored and actively counterattacked, but I think that’s what Jeff & Co. have been doing since almost Day 1. But overall, I agree with these points, because nicely formatted answers from people with accounts who bump the question once in a while to give it more exposure are a Win for the site. To further prove my point, here is a picture of a bunny with a pancake on its head: - 27“To further prove my point, here is a picture of a bunny with a pancake on its head.” That’s hallarois! – John Militer May 12 ’16 at 1:52 - 6I mis-read that as “a pancake with a bunny on its head”. – immibis Jul 13 ’16 at 8:58 - 2Interesting technique to draw attention – rocketspacer Nov 17 ’16 at 22:07 - 7I forgot what the post was about. Can we talk more about the bunny? – SqlZim Dec 22 ’16 at 22:31 - 1Looks like two pancakes even. – Patrick B. Apr 25 ’17 at 13:20 Is it just me, or would following these tips make you feel dirty too? Is this where the word “rep whore” comes from? Especially #2 – is highly unfair, gaming the system, and preventing its usefulness. #1 – is true, it is the old “fastest gun in the west” problem. After the first upvote(s) I can still invest in a great answer (otherwise being pushed down and I lose my first place). #4-6 – are great. Am I an idealist? I would like to help and be helped. And still I find myself going after those 12 points to get edit powers at the time of writing. But at what expense? Never gonna do #2! - 27I’ll upvote you since you are the top answer. 🙂 – Vilx- Aug 25 ’09 at 8:31 - 2And I wasn’t even first to answer 😉 And you noticed: no formating, no stratigical downvoting (I assure), didn’t edit the answer so far. But also did not hit the 200 rep/day limit 😦 – malach Aug 25 ’09 at 8:40 - 3“highly unfair”? It’s mildly manipulative at best. Face it, at best you’re only going to affect the ranking significantly if you and someone else posted almost-identical answers and neither one of you edits. I have answers posted late, with few votes for the first day and several down-votes that are still collecting up-votes months later, long after other, formerly high-ranked answers stalled out. IMHO, if you’re in it for the game, then accept that you’ll be gamed; if you’re in it for the answers, then a few bogus votes make no difference. – Shog9♦ Aug 25 ’09 at 16:15 - 2I look at it as highly unfair in the light that the person is willing to “harm”somebody else in something that is so important to himself. I personally could care less. – malach Aug 25 ’09 at 21:08 - 1I would upvote this if I had enough reputation. There must be a better way to promote correct answers, rather than encouraging a reputation game. Especially since stackoverflow answers are so high in the google results lists. – Frank Hileman Aug 3 ’11 at 17:13 - To quote a different meta post, “it [the reputation system] really is just a ‘necessary evil’ to aid the privilege system (and it also is a sort of reward).” Downvoting an answer just to get more rep is gaming the system, but no system is perfect, and SE’s community moderated reputation system works much better than countless other forums. I hate that things like “strategic downvoting” exist on this forum, but it happens.Another good quote“Don’t use it [reputation] to gauge post quality.”True dat!– charmoniumQ Aug 9 ’13 at 7:39 - @Frank I upvoted it for you 🙂 – John Militer Jun 9 ’17 at 1:48 Well, I certainly credit all my success on Stack Overflow to - judicious - use - of - obnoxious - lists… - 180I fixed your post for you – Jeff Atwood Aug 25 ’09 at 8:10 - 1ah much clearer now – hyperslug Aug 25 ’09 at 8:22 - 10This highlights #3: Jeff, your formatting just earned Shog9 an upvote! – malach Aug 25 ’09 at 8:36 - 6Also highlights #5! Though not really in the way it was intended… – Shog9♦ Aug 25 ’09 at 15:17 - Well said, I say! – jrummell Aug 27 ’09 at 16:43 - 56-1, not enough bold. – badp Jul 21 ’10 at 11:24 - 9This answerneeds more backticksin order to be usefulas an answerto the question. – a CVnMay 19 ’14 at 14:03 - 27Oh, is that where the o in <ol>stands for? Obnoxious list… – Justus Romijn Feb 12 ’15 at 13:59 - lol @JustusRomijn I know nothing about code, but it’s probably Ordered list. Unless that was a joke… – Unitato Jun 5 ’17 at 12:43 I’d add one more: answer the questions people can understand. A question like “I’m having a problem with really really really tricky SQL query: I need to count records groupwise” will bring you 10 upvotes in a minute, if you were first to answer. But one of the answers I’m most proud of took me something like 30 minutes and was accepted with a negative score (someone might have been using downvoting strategically, you know). There are just too many lines to be interesting. - 48My highest-scoring answer on SO was a one-liner straight from the docs.. – John Fouhy Aug 25 ’09 at 8:26 - 7Very true. Some of the most basic C#/Java questions are among those where the most rep is dealt out. – JonikAug 25 ’09 at 8:28 - 1In specific problems are going to gainer less votes/views then a general question. Its just the nature of the beast.– James McMahon Aug 25 ’09 at 15:06 - 2So true. My highest scoring answers are quick-fire copies from the docs. BTW as we’re rep farming here, why not link to your poor, unloved, masterwork? I bet it’d get upvotes (I would) – MarkJ Sep 16 ’09 at 22:10 - 1OK, my mate Google found it and I just have upvoted it. stackoverflow.com/questions/1165878/… – MarkJ Sep 16 ’09 at 22:15 - Agreed! The answer that got me the most rep was pointing out that someone used ‘=’ instead of ‘==’… – Liz Sander Jul 20 ’12 at 14:35 - 1@JamesMcMahon: This is not necessary a case of specific question. “Why my Java homework doesn’t work” can accumulate more point the answer to “How to get code coverage in C++” despite the latter being both harder and non-specific. – Maciej Piechotka Aug 30 ’13 at 9:32 - This is an 1-lined answer with boldand italic and I won’t earn any reputation from this. – Jamie Apr 27 ’14 at 8:43 - @JohnFouhy, They should deal out rep not just based on upvotes, but on upvotes per view. In other words questions with more views would gain less rep per upvote. – Pacerier May 5 ’14 at 19:05 - 1This is so true. I had someone say as much on a highly highly technical, very lengthy answer of mine. Really good answers can sometimes get overlooked, and the quickly upvoted answers aren’t necessarily that great, because “information can’t be that useful if so many people already know it.” – Wildcard Apr 1 ’16 at 21:30 I am formatting my answer as a list, but I have a good reason (see number 3 below): - Be the first to answer While the fastest gun problem is not new to us, the post was written for an audience not familiar with Stack Overflow, so the OP is right in bringing it up. Being the first to answer is likely to bring you more votes. However, I disagree with his statement that there are many bad/wrong answers on top of the list because of it, my own experience is that quality floats to the top. - Use Downvotes and Comments Strategically I don’t know, most of the time I can easily see the three top answers on my screen. If a user can read them without scrolling, he/she will be very likely to do so, therefore I don’t think this has a big effect. Besides, the vote difference between the first three answers is often more than two votes, so this is likely not to work at all. The - systematic downvoting of a specific user’s answers, as shown in the screenshot, will definitely be caught by the system. - Use obnoxious in-your-face formatting and lists There is a reason why answers with formatting are getting upvoted more often. It is the same reason why the option to use formatting exists: Formatted answers are good answers. The same answer in plain text is not as readable as if it was well formatted, hence the trend for answers with lists and other formatting to float to the top. As for answers that start with a bold Yes or No at the top: If the question asks Is X a good thing to do? first giving a clear answer and then elaborating on your reasons is a good practice. These answers are upvoted because they are good answers. - Be Aware of the 200 reputation/day Limit The reputation limit was never a problem for me, because I never got near 😉 - Edit, But Don’t Edit Too Much Editing in order to bump up the question on the home page is a strategy that is likely to work.Unfortunately. - Associate your other accounts Hey, I did that! And you know what: I got 100 points out of it!!!!! Once. Not such a big deal, really. At the end I am left wondering: Most of us got to a point when we didn’t consider our reputation that important any more. For me that was after I passed the 3k threshold on Stack Overflow and was allowed to vote on closing questions. (Yes, most of the people who tell others not worry about their reputation so much, because hey, it ain’t that important, you know, have a reputation where it really isn’t that important any more.) Somehow, the OP doesn’t seem to fall into that category. - 38This answer sucks, it has no picture in it. – Johnno Nolan Aug 25 ’09 at 9:40 - I was with you till point 5. Refining and bumping is not only a strategy, it is highly encouraged! For point 6 you get my favourite punctuation mark link: sockenseite.de/__oneclick_uploads/2006/10/ausruf.html – Ladybug KillerAug 25 ’09 at 9:49 -… 🙂 – JonikAug 25 ’09 at 10:02 - 😉 – Treb Aug 25 ’09 at 11:49 - @Treb: It still hurt my eyes. And it drags down the whole post. – Ladybug Killer Aug 25 ’09 at 11:56 - Well, reputation is somewhat important in the begining, especially in cases when you cannot up-vote other people’s answers, just because there is limit of let’s say 15 reputation to do that. – Zlatin Zlatev Feb 25 ’14 at 13:29 #2 on this list “Use Downvotes and Comments Strategically” makes me rage. I prefer Jon Skeet’s advice on Answering technical questions helpfully. - 3Seeing as he has 229k reputation as of this writing, I would take his advice 🙂 – André Caron Oct 20 ’10 at 5:47 - 3+1 Agree – not only is Jon Skeet a SO living legend, he’s polite & funny. – Jeremy Thompson Nov 2 ’11 at 2:44 - @AndréCaron And now, seven years later, he’s at… Only 940k?! He’s been slacking! – Nic Hartley Apr 16 ’17 at 3:48 Ways to amass rep that positively impact the site. There are plenty of vampiric strategies that one can employ. Those that overall don’t make the site a better place to be. That don’t make it a more effective place to get questions answered. I’ll be talking about the ways that make the site work better. I find that there are two general strategies to getting rep quickly: Frequently visit “high-churn” tags These are tags that get a lot of questions. Which means they quickly get a lot of answers. But the former means that, if you visit the site 20 times a day, odds are you will find a few questions that you can answer which have not yet been answered. Naturally, this requires some significant expertise in high-churn fields, so that you can not simply quickly answer questions, but do so effectively. You can expect to get 2-4 upvotes on these questions, so you don’t need more than 4-6 of them daily before you hit the cap. And it doesn’t even matter if a couple of others slip in; as long as you’re within the first 4 minutes of the question hitting the site, you stand a good chance of getting some upvotes. Well, assuming your answer is correct. Have significant expertise in a “low-churn” tag Maybe this tag only gets 10 questions a day. Maybe only 4 regular contributors even check the tag, let alone know how to answer them. Being able to serve the under-served parts of SO means that you don’t have to visit very often, but it also means you get a lot more accepts, rather than just upvotes. So if you combine these two strategies, the 200 rep barrier becomes less important, since accepted answer rep doesn’t count against it. Indeed, if you happen to have a lot of various obscure knowledge, serving the under-served parts of SO can get you all the rep you need. Plus, you get to help people who might otherwise have not gotten help. The downside here is that the low-churn tags are also more likely (by volume) to be from new posters who don’t know what the accept button is, or don’t even have the rep to upvote. However, those few regular contributors to those tags will likely hit you with an upvote when they see your answer. Other Tactics There are also other tactics that you can employ in your answer. One that I do as a matter of course that just so happens to fit in is to add useful advice while answering. You should know the general idioms around a particular knowledge base and preach them where possible. For example, if you’re answering a C++ question where someone is gratuitously using new, add a suggestion to your answer that they use a stack variable. If they’re talking about writing destructors, bring up the Rule of Three and smart pointers. Experienced C++ programmers will almost always upvote you for that, and you’ll be helping someone find programming techniques that they may not have found otherwise. Overkill is another tactic. If you can’t be first, then by God be biggest. Go into massive detail. Lecture the person asking the question. You can’t overkill on most questions. But you don’t have to. If you’re in a high-churn tag, a good bit of overkill can earn you 100 rep easily. Overkill doesn’t work so well in low-churn tags, since overkill relies on many people seeing the sheer massiveness of your answer. - 13Overkill as in “I answered this question 2 years late, so I’ll write a lot about it.” 🙂 Good answer. – CoffeeRain Feb 6 ’12 at 21:13 - 1“Being able to serve the under-served parts of SO […] also means you get a lot more accepts, rather than just upvotes.” is just a theoretical thesis. I’m mainly active in two such under-served parts: maven, jenkins. There are 10 accepted in my recent 60 answers and 37 with zero votes. So you apparently get neither of them there. To be honest: This stresses my altruism and makes it less fun to contribute. – Gerold Broser Sep 5 ’15 at 23:28 - Most of my reputation goes from overkill answer. But it worked only once in my life, and I write a lot of overkill answers. – Tomáš Zato Dec 18 ’15 at 14:51 I know first hand that #3 is a sure easy way to get more attention to your answer (and in turn more upvotes). I always do my best to distinguish my answer from all the others by using plenty of links, quotes, formatting. Most of the time, this will shoot my question to the top of the list and ensure upvotes a plenty. Oh, and especially pictures: - 5yes but that is not a bad thing, good formatting is a net positive – Jeff Atwood Aug 25 ’09 at 8:15 - What you say is indeed mostly true. But the last example could be better — you say especially pictures, yet link to an answer with 0 votes 😉 – Jonik Aug 25 ’09 at 8:22 - 1Jeff: Yes, it is a good thing :). Jonik: Yeah, it was a horrible example (It actually used to be -1), but it was taking me too long to find a better answer. – Josh Hunt Aug 25 ’09 at 8:42 - 2Lousy pictures! Missing freehand circles! – Ladybug Killer Aug 25 ’09 at 8:46 - Love the fact my answer with equal formatting didn’t get any upvotes 😛 superuser.com/questions/9120/… – Ivo Flipse Aug 25 ’09 at 10:48 - Ivo: In this case, i think you could have done without a giant XBox on the page. That only deters voters 😛 – Josh Hunt Aug 25 ’09 at 11:45 - 2And the nominations for “Most effective use of an unrelated image” are… – Justin Jan 18 ’11 at 13:36 - Links are an important part of formatting. My highest voted answer should be a one-liner, but I added 5 superfluous links and an unnecessary code example. I put the least relevant information first and the most relevant information last. I feel kinda dirty now… – Eva Mar 5 ’13 at 0:53 - I think people really like when you put a different link on every word of a phrase. I get hetcha upvotes when I do that. – Eva Mar 5 ’13 at 0:54 - This answer is a good example on Graphics. It was not a good answer to the question, but it gained up-votes because of nice images and formatting. Sadly, this entire question was made community wiki, so it lost the rep-potential… – awe Aug 19 ’13 at 13:02 - Pictures got me 5k on DIY and a couple of K pm SuperUser… in a few months…. I got bored of downloading pictures…. – Piotr Kula Sep 25 ’13 at 12:20 Should we really care about points all the time? I am here for: - Learning: It can be anything like learning new tips, logic, etc. - For getting my answers - and obviously if you want your answer then do some favor for others. Check their questions and try to give them a proper solution for their problem. Honestly saying, I don’t give a damn about my reputation. This is not a college class where you have to score good marks for good grades or something like that. Answer quickly but incorrectly unfortunately works. Sometimes such answers are even hastily marked as best answer. I suggest sorting answers starting from most recently added, or sort few most recently added above others (this way each answer will be top for at least a moment). Don’t let few up/down votes affect order, at least when question is still new. SELECT … FROM answers … ORDER BY (CASE WHEN abs(number_of_votes) > threshold THEN number_of_votes ELSE 0 END), (date_added > NOW() - interval '10 minutes') DESC, … - 1` SELECT * FROM ( SELECT * FROM answers WHERE number_of_votes > THRESHOLD ORDER BY number_of_votes ) q UNION ALL SELECT * FROM answers WHERE number_of_votes <= THRESHOLD AND date_added > NOW – ’10 minutes’::INTERVAL UNION ALL SELECT * FROM answers WHERE number_of_votes <= THRESHOLD AND date_added <= NOW() – ’10 minutes’::INTERVAL ` This is more index friendly. Sorry, just couldn’t help it 🙂 – Quassnoi Aug 25 ’09 at 12:41 - 2I like code examples. You get +1 just for that… – awe Jul 22 ’10 at 12:45 Let me tackle these one at a time. Be the First to Answer. Even at the cost of quality. Absolutely true. Like others have said, this is actually a good thing because getting a quick answer to a problem is typically what you want. The only problem is (as noted by codexon) wrong quick answers can get voted up. Or someone posts something that’s irrelevant but correct and gets voted up because people don’t seem to understand or don’t read the OP’s requirements. Use Downvotes and Comments Strategically I don’t really like tactical downvoting. I really think downvoting shouldn’t be anonymous for this and other reasons. Or as a compromise, downvotes on questions you also answer shouldn’t be anonymous. This also includes putting on a downvote and later taking it off. As others have noted, if you want to rescind a downvote, you can edit the answer (with 3k+ reputation) and you’re then allowed to rescind it after the normal time limit. Use obnoxious in-your-face formatting and lists. I don’t see how “obnoxious” formatting helps. But there’s definitely an advantage to using something other than a “blob” of text. You can break that up with headings, lists and/or images. It also helps to put a useful title in a link instead of just a raw URL. Be Aware of the 200 reputation/day Limit As I think Jon Skeet wrote, you need to get to the 200 reputation cap limit as soon as possible during the day to increase the window for over-200 reputation gains from accepted answers and bounties. I’ve made numerous posts against the reputation system working like this. I actually think this disadvantages more casual users. After all Jon Skeet won’t spend much time during the day in the soft cap region. I read once he said that sometimes when he gets up in the morning he’s already at +200 for the day (which is 6-8 hours in for him in the UK). Edit, But Don’t Edit Too Much True again. You don’t want to make your posts CW and I have again posted numerous times how I think this owner edit forcing CW is actually a bad thing. It discourages people from maintaining their posts. I’ve proposed several solutions including edits after 6 not bumping the post but they’ve all been rejected. I think we should be doing everything we can to encourage people to maintain content they’ve written and updating it as the facts change. Associate your other accounts This is an easy one. The only thing I’d add is that you want to judiciously bounty hunt and look for new bounties with low upvote answers. You also want to look for bounties that end late in the “reputation day” as around half the time the OP just lets the bounty lapse without selecting an answer and you know when that will be. No point wasting your time with bounties that end at 1 am UTC. I’m not sure many bounty posters realize that the top answer only gets half the bounty by auto-acceptance. IMHO we need to encourage active selection of an answer by giving the OP a nominal reputation amount (say 10 points) for selecting an answer rather than auto-selecting. Basically what’s been said is correct. A few of the things I consider negative and should be addressed as described above. - 1“As I think Jon Skeet wrote…” Should the reputation system be designed based on the guy with the highest score? How many people hit the rep cap anyway? I hit it the other day — for the first time in my life, and I’m just outside the top 10%.. – John Fouhy Aug 25 ’09 at 22:30 - 1By definition those at the top have the most experience, which is noteworthy. But I wasn’t putting Jon up as an expert in this context, merely attributing the source. – cletus Aug 26 ’09 at 6:40 For an eye-opening read, check out the comments on Reddit. Amusingly enough, someone chose the title of this post as Why Stack Overflow sucks. My favourite from one Overflow again. Why even bother. - 2Before I saw that, I thought nothing can beat youtube comments. – Quassnoi Aug 25 ’09 at 14:48 - 2There are some people that seem to have some pre-existing prejudice to SO that I don’t fully understand. – James McMahon Aug 25 ’09 at 15:15 - 10There are some people that have pre-existing prejudice to everything you can name. – Quassnoi Aug 25 ’09 at 16:07 - 12“I decided never to waste time on StackOverflow again” -> David Verhasselt “Seen 45 mins ago“. Tsk. – hyperslug Aug 26 ’09 at 20:48 - 2@hyperslug, He meant “answering questions”. – Pacerier May 5 ’14 at 19:40 I have also written an article on Stack Overflow tips and tricks that can be viewed here: The main points include: 1. Get 100 Reputation Points Free 2. Add “Interesting” & “Ignored” Tags 3. Install a Greasemonkey Script 4. Be the First to Answer a Question 5. Markdown 6. Don’t Over-Style Your Answers 7. Add Pictures 8. Use Google Effectively 9. Use JS Bin 10. Edit Your Answers Cleverly 11. Keep Your References Open 12. Involve Yourself to Earn Badges - I wanted to upvote you for suggesting association, but your post looks as though you will get +100 on the main site, which is not true. – Pavel Mar 9 ’16 at 19:17 - Be the first to post a good answer. Even at the cost of quality.~ Post a correct and helpful answer. Make it perfect afterwards. Use Downvotes and Comments Strategically~ This is wasted effort. Making other answers look worse doesn’t make yours better. - Use obnoxious in-your-faceformatting and lists wisely. - Be aware of the 200 rep/day limit~ Gain the favor of OP. You will get additional rep for your answers being accepted even after you’ve hit the cap. - Edit, But Don’t Edit Too Much~ Prefer fewer but greater edits over many minor ones. Care about those who are already reading it. Associate your other accounts– Seriously? … that desperate? + tips from my experience: - Provide additional helpful info related to the matter.~ This might include pointing out good / bad practices, pointing out completely different (better) approaches rather than helping to fix the one included in question etc.~ Impart the knowledge that OP as well as many future visitors will appreciate. - Help others to make their answers better, collaborate. Be generous, kind and humble.~ Others will treat you the same way. Karma is good thing. - 6+1000 for point 7 – VonC Oct 7 ’13 at 8:53 I’ve seen a user with over 1000 reputation but his writing sounded like a newbie. I looked at his profile and saw 266 questions with lots of upvotes and 11 answers with a total of one upvote. So the strategy is to ask a LOT of easy questions on popular topics so people can answer and upvote you. It’s freaking sad but at the same time amusing that people are actually mostly hackers. We hack around the system to get what we want. I think that this is very valuable at times but dangerous at other times. - 4Indeed and there are much worse examples. 1800 low-quality questions for a total of 10,000 reputation points. – Peter Mortensen Oct 6 ’15 at 18:31 NOOOOO!!!!! MUST DO DAMAGE CONTROL!!!!! Seriously though. If you just take some of the “advice” from the linked article as it is, much harm would be done to the ecosystem. Re: “Be the First to Answer. Even at the cost of quality.” This is missing a second part: please make sure you improve your answer after quick-posting it. Re: “Use Downvotes and Comments Strategically.” Noooo!!!! Downvote if and only if an answer is bad. Don’t “strategically” downvote because the answer is competing with yours. Plus your down-vote gets locked in after 5 minutes, so the damage can’t be undone unless you commit further evils. Don’t be afraid to call out on an answer that is plain wrong though, via comments and/or downvotes. Re: “Use obnoxious in-your-face formatting and lists.” Well, I won’t use the term “obnoxious” (“obnoxious” works pretty well on Meta though) Just make sure that your post is easy to read. Use proper formatting - put code or code-related things in code block or inline code span. - use headers if your post is relatively long to organize things - use lists when applicable - if you feel that some related documentation/reference can provide further details, mention it in your question. - if you’re quoting text/explanation from a reference or from a post, put it in blockquotes and give credits. - for emphasis or highlighting keywords, use italics or bold, but sparingly. Re: “Be Aware of the 200 rep/day Limit” - Fair enough. You don’t want to spin your wheels. Re: “Edit, But Don’t Edit Too Much” Don’t edit at all unless you have something useful to add or something that needs to be changed. Bumping up your answer just for the sake of drawing attention bumps down other questions that might need attention more than you do. Re: “Associate your other accounts” - Fair enough. - 1I think you’re missing the tongue-in-cheek nature of this question and its answers… – Cody Gray Jul 23 ’13 at 10:09 - 1Nuh uh, I’m just catering towards users who are taking this “thread” seriously. – Old Checkmark Jul 23 ’13 at 10:11 Warning: The following contains absurd levels of snark that might be dangerous to the eyes, hands, or soul of a moderately to severely sane reader. I promise there’s a point to this at the end. Maybe. If someone has beat you to the #1 with a one-liner, follow up with some extreme #3 by repeating their answer: Jeff‘s answer is absolutely correct: Walnuts do taste great with cantaloupe. Here’s a code example that explains it a bit more: public class Walnuts extends Cantaloupe implements DeliciousCombination { } When writing walnut-related code, follow these steps: - Determine if you need cantaloupes - Determine if you have cantaloupes - Eat the walnuts no matter what Things to beware about cantaloupes: - They are less delicious without walnuts - They are much heavier than walnuts - Fewer people are allergic to cantaloupes than to walnuts walnuts.org, the official specification for walnuts, has this mostly unrelated thing to say about them: California grows more than 99% of the country’s supply and two-thirds of the world’s walnut trade. Additional resources about walnuts and cantaloupe recipes: Wikipedia’s page on walnuts, Wikipedia’s page on cantaloupe, Wikipedia’s page when I clicked random article [Note/Edit/Update/Addendum/tl;dr/Other Indication of Superfluous Footnote] You should probably get rid of the magic number on line 1000000. You will get upvoted more than the person who answered first, and you don’t even need to know the answer beforehand. As long as you have some experience in the general field and you understand what the answer is saying, you can add completely unnecessary bits and reap the benefits of another person’s hard work! But in all seriousness, I don’t think this trick is always bad. You still have to put effort into your code example, lists, quotes, and finding related(ish) links. People upvote because it looks like you put more work into your answer (you might’ve) and because it’s possible your answer is clearer to understand. Though Rule #1 says your answer will probably not get accepted. - 2May I suggest reducing some of the snark in this answer? Your last paragraph makes this a decent answer, in my opinion, but someone may not get that far before dismissing it. – Andrew Barber Mar 5 ’13 at 2:05 - 1@AndrewBarber You’re right. I have this awful habit of burying the lead. Somehow every time I come up with something that I think flows, the most important point is in the last letter of the last word of the last sentence of the overly-long gag. I will try to think of a way to get to the point faster. – Eva Mar 5 ’13 at 2:18 - 3I need to get a handle on my snark problem. Snarkers Anonymous? – Eva Mar 5 ’13 at 23:35 - @Eva Get some friends around to help you with “The Hunting of the Snark“? – SlySven Jan 8 ’16 at 20:49 - Was it really suppose to be a joke? I see many users make good use of the ways of the Dark Side. – SPArchaeologist Dec 1 ’16 at 19:42 Regarding #2, what if you hide votes for the 10 minutes or so? By “hide”, I mean: people can vote, but answers will appear to have 0 score (and time-based sort order) until the 10 minutes are up. You could even hide timestamps and randomize display order for the initial window, though I’m not sure that would be worth it. - 5You would have to randomize the display order. If you simply had it by time, then people would still do tactic 1. – Unknown Aug 25 ’09 at 8:34 If I can add three more… - The highest concentration of SO fanatics (and by natural association, the FGITW’s) is on the west coast of the USA, secondarily NYC. So visit the site when these regions are likely to be asleep and snipe out any questions that would otherwise get nailed in the FGITW rush. For what it’s worth, Jon Skeet is in UTC+0. - If you get an accepted answer, go back and look at the tags. Then look at them again. Are they the right tags? Are all the relevant tags present? Also… On the right side of the page will be a list of ‘related’ questions. Check the tags on those questions to see if any are relevant towards getting your accepted answer better exposed to the community. - Lastly, defensive protection. Look at the original question carefully. Are there any improvements that can be made to prevent its closure as a duplicate? As off topic? Also, try and flesh out your answer before the FGITW’s get their first caffeine hit. I have it in mind that these are legitimate whilst simultaneously serving best community interests. Jokes aside there is a certain flaw in the way that reputation is earned. There are additional factors to how much reputation you’ll receive by asking a question or answering one that have nothing to do with the “correctness” of the question/answer. It helps if you answer quickly, I found that if I answer an open question a day or more after it was posted the chances of getting up voted or chosen are close to nil. People almost never up vote a question, I think it got something to do with the fact that it’s hard to decide if the question is a “good” question. And of course users that instead of learning or answering questions try to grab as much reputation as possible, I’ve noticed people using the same dirty tricks explained in the post (like coping an already posted answer and bumping the other question down). - I have one exception to this rule. I’ve answered a simple mysql question that regularly brings in upvotes. Still the first security flawed question is way ahead 🙂 But I agree with what you say. – akostadinov Jul 22 ’13 at 16:14 Also, work in popular subject areas. Most people wouldn’t recognize Jon Skeet’s name if he had the ability to write swift and excellent answers in Lisp, Haskell, and Delphi, but not anything else. Pick your questions. Only answer questions that are easy to read. If people are turned off from reading the question, they’re unlikely to upvote your answer. I think a great way to restrain this behaviour is forcing to leave a comment on downvote. I think that the downvote comment must be anonymous, for not letting people downvote only for revenge. In this way if the reason of the downvote is not good enough, a moderator (or everyone using the voting system) can eliminate the downvote (and take measure against the user with this bad behaviour if it persist in time). - @Brad: What did you not understand? – kentaromiura Aug 25 ’09 at 18:04 - The question doesn’t ask how to fix the situation. – Brad Gilbert Aug 25 ’09 at 18:07 - Sorry, but with ” Walnuts? Cantaloupe? ” you weren’t too clear of what you’re really asking, basically you’re asking for opinions, and that’s my opinion. – kentaromiura Aug 25 ’09 at 18:11 - 1I love this foolish behaviour, this is a open question (on a meta site) that is barely a question, the OP intention is not clear, but basically it ask for opinion, I gave one, costructive, and I get a downvote… It’s just Amazing! XD – kentaromiura Aug 25 ’09 at 18:39 The choice of question is probably the most important point missing from the list – once you have embellished your post with enough obnoxious formatting, it’s all about the number of people who see your question – the more people who see your answer, the more potential votes. This means that the more popular the question the more upvotes, in particular: - Really easy questions tend to do well – lots of people think that they could have a go at answering it, so it gets lots of views. - QUESTIONS WITH THE TITLE IN ALL-CAPS also do quite well as some people quite enjoy moaning about / closing rubbish questions. - Questions posted by anyone demi-famous (like Jeff or Jon Skeet) always attract massive views. - Subjective questions are also great, but you need to get in there early before they become community wiki. Of course popular questions also means more competition, and so its more important than ever to make sure that you get in early – even so, more popular questions always offer a better vote-to-effort ratio in the long run. For users who don’t have a lot of experience in programming and rarely answer questions, try editing posts. NOTE: Only suggested edits work, so if you have 2,000 or more reputation, you cannot get reputation from this. Tips on Editing - Code Spacing: Some questions may have code that is spaced more than usual. Try to take advantage of this and space out the code so that it is properly spaced neatly. Using an online compiler is helpful. - Grammar Correction: Some people (most commonly new users) will post bad grammar. Edit that as soon as possible so that the question is good quality. - Grave Accents: Names of methods should use grave accentsto open and close. - Block quotes: use the >followed by any text to block quote the entire line. This is generally used for errors. - Titles: Sometimes the title contains unnecessary words (ie. C# in a question that is tagged C#). Delete those. For unclear titles, they can be fixed. - 1Caution on Editing: If your edit is not upto the mark, then sometime you will receive edit ban– krishna May 26 ’14 at 11:17 - 1Well usually these editing techniques work out fine and should be acceptable. My edit percentage is still 90%. – puretppc May 30 ’14 at 20:21 I’ve seen a corollary to #5: If you’re the top answerer, periodically edit the question to bring more attention and votes to your post. That way, your own answer never becomes wiki. For the most part it seems accurate. I’m not sure you could call it gaming since this is already known tacitly condoned. Reputation is a system that happens to motivate many people well, and it has produced great results. Coming up with strategies to maximize it while not really contributing is unfortunate, but bearable considering the advantages. - I guess it largely depends on whether each edit is actually warranted and useful; periodically making trivial, non-consequential edits could more readily be considered gaming. (But if someone does a series of thoroughly useful edits, it might be partly gaming, or he might have the purest of intentions – others cannot really know.) – Jonik Aug 25 ’09 at 9:48 - Linking to the question from other, related questions can accomplish the same thing. Provided they’re worthwhile references / edits, i don’t see a problem with either. – Shog9♦ Aug 25 ’09 at 15:19 Most of the answers given here are about how to manipulate things to favor you, get more exposure for your answers, get to easy to answer questions faster and such. But I think an important tip, to maintain the integrity of the forum, is to make sure that you’re knowledgeable about the subject matter you want to answer questions on. It does nobody any good if you try to answer questions with BS just so you can be first. If you’re an expert on a particular topic, your well-crafted, timely answers to difficult questions should earn you reputation, not just initially, but over time as well. After enough time, a person like this could eventually get 200 reputation a day just from residual upvotes on past answers, and that to me seems like a good position to be in. You’re likely not going to achieve that with an “answer as fast as possible” strategy with low quality answers on low quality questions. Some examples that seem to work for me. - Provide a detailed analysis of the question. - Asking why the question doesn’t do the preferred method. This can be difficult to get right. If you come off as mean, people will down-vote your answer, instead of up-voting it. - Post an answer that does what the OP wants, but the way it should be done. Specifically, not what the OP is asking. - Post multiple answers that are significantly different. For example to the question Regular Expression to match valid dates, I posted three different answers. 1. Be the First to Answer. Even at the cost of quality. Instead, randomize the order of the answers while the question is new. In addition, hide the up-vote/down-vote count as to not influence the other readers (i.e. lemming effect). Eventually transition the question back to normal view. The rate of activity on the question should determine the length before standard view is enabled. - 2This just optimizes SO for those who want to play games, at the expense of those who actually wish to use it for Q&A. – Shog9♦ Aug 25 ’09 at 21:20 - 3@Shog9 I disagree: this would reduce the short term benefit of the first answer with some up votes compared to later answers that may have been more thought out and/or referenced. – Mark Hurd May 31 ’10 at 2:09 I know people disagree with #2. I disagree with #1 but I know it sometimes holds true. The others seem somewhat accurate. - 12#2 is the only one I disagree with to the point of considering some algorithmical way of blocking it – Jeff AtwoodAug 25 ’09 at 8:14 - 1#2 just seems like temporary result-manipulating similar to this: meta.stackexchange.com/questions/15746/…. In time the best answers will bubble up. – hyperslug Aug 25 ’09 at 8:46 You must log in to answer this question. Not the answer you’re looking for? Browse other questions tagged discussion reputation article strategy . #1 is very true, but could maybe be alleviated by just receiving answers for a reasonably short amount of time (say 5 min) after the question was posted — without displaying them. Then, these first answers could be shown in random order. This might take a little pressure away and encourage people to put some more efforts in their first try. - I feel that the asker getting a fast response is much more useful and valuable than tweaking the system to discourage gaming reputation. – user133653 Aug 25 ’09 at 9:29 - See meta.stackexchange.com/questions/73/… for a slightly different take on that idea. – Greg Hewgill Aug 25 ’09 at 9:42 2. Use Downvotes and Comments Strategically See my response to #1. I think that will help curb this. Another solution is to increase downvote cost if you have already answered the question. If the user downvotes before answering, then either revert the user’s downvotes for the question, apply the new “cost” of the downvotes to the user after answering the question. This could be a confirmation the user has to agree to after clicking “submit”. For example: “Answering this question will remove X reputation due to downvotes assigned to competing answers. Continue?” - 3Disagree. I sometimes downvote other answers on questions I have answered because the other answers are seriously wrong. I remember one question for alternative ways to determine whether .NET objects were equal, and there was an upvoted answer advising using GetHashCode [which is utterly wrong according to the docs]. It would have hurt a little to lose extra rep for downvoting that. – MarkJ Sep 16 ’09 at 22:23 What’s the use of these reputations anyway? I became a member of SoF to find quality answers for my questions and if somebody has a question that I might know the answer, help him to find the answer. I know that it is enjoyable to gain respect among the fellow programmers, but I think that is not the goal. It’s not a race for gaining more reputations but it’s a game of helping each other to improve our knowledge. We are not players against each other but we are members of a team playing to gain the knowledge and skills that we need to be even better programmers. - 2To me it is primarily a game, the Q&A is just a nice bonus. I dislike reading about the crap I do in my day job, but I love games. – McGarnagle May 25 ’12 at 7:22 Others answered well how to continue, but here’s my strategy for the very start: Not everyone is good in programming, but there are lots of sites on the Stack Exchange network and odds are good that you are good at something we have a site for. Pick a topic you know enough about to be able to give good answers, read their tour, lurk around for a while and answer wherever you have something helpful to say (protip: early betas have less traffic, so you have more time to answer before someone else does and you don’t have to watch duplicate answers too much). After a few days return to Stack Overflow with association bonus of +100 points allowing you to chat, comment and upvote, privileges whose lack annoys the most. Here is what I think about those suggestions: - Be the First to Answer. Even at the cost of quality. Absolutely not. It’s happened several times that I started writing an answer to an unanswered question, which took time since I was writing high-quality answers. While I was writing, others had time to answer before me and sometimes even got upvotes. But I just continued writing my answer, and when I posted it, it got more upvotes than the others and sometimes even got accepted. Here is a concrete example. Also, if you have a good answer to an old question, don’t hesitate to post it. This answer is my highest upvoted non-meta post on the whole Stack Exchange network, and it was posted 6 years after the question was asked. It’s even the answer to that question with the most upvotes, it even outscored the acceped answer. Of course, it took time to collect all those upvotes, but in the long term I earned a whole lot of reputation from it. And I still see from time to time a +10 in my profile page because someone upvoted it. - Use Downvotes and Comments Strategically What? Abuse the system? No way. I don’t know how comments can be used strategically, but tactical downvoting is wrong. It might earn you reputation, but it’s not very nice. Answers should be downvoted because they’re wrong or low quality, not because someone else who posted an answer wants his answer to be on the top. Also, if you abuse the system too much, you might risk being suspended (I don’t know what the exact criteria are, but I’m not planning on trying it). - Use obnoxious in-your-face formatting and lists. Format your posts well. That way, they will be easier to read and therefore more useful. But even if the post is badly formatted, someone will probably edit it sooner or later. The question is how many people didn’t upvote your post in the mean time because they thought it was ugly. Anyway, it doesn’t take a huge effort to format correctly, so why not do it? - Be Aware of the 200 rep/day Limit I’ve never earned that much reputation in one single day, so for me it’s not that important. However, for someone like Jon Skeet, it would probably be useful. - Edit, But Don’t Edit Too Much This depends on how much reputation you have: - If you have more than 2000 reputation, editing doesn’t affect your reputation at all, so you can edit as much or as little you want, it doesn’t make any difference. - If you have less than 2000 reputation, edit a lot since each approved edit gives you 2 reputation. But make sure that your edit is good, otherwise it will be rejected and rejected edits don’t give any reputation. Also, it’s better to edit posts of decent quality that aren’t likely to get deleted, since every time a post you edited gets deleted, you lose the 2 reputation that you earned from editing it. So editing an answer saying “i hav the same prombem plzzzz help” into “I have the same problem please help” won’t do you much good. - Associate your other accounts That’s a great idea. If you associate your accounts and earn 200 reputation on one of them, you will automatically earn 100 reputation on all of them, even on the one where you earned 200 reputation. The only problem is that that only happens once. But it’s better than not at all. In addition to this, I have my own tips on how you can earn a lot of reputation. These tips made me earn a lot of reputation on Stack Overflow. - Once you have the privilege to review, review a lot In the review, you can come across posts that can make you earn reputation. If you have less than 2000 reputation, there are a lot of posts by people who are bad in English just waiting for you to edit them. For each post that you edit, you earn 2 reputation. If you edit a lot of posts, you will earn a lot of reputation. You might even come across some question that you can answer. That’s happened to me several times and each time I came across a question that I could answer, I answered it and my answer most of the time got accepted and a few upvotes. If this happens regularly, you will end up earning a lot of reputation. - On Stack Overflow, participate in documentation Look around in the Stack Overflow documentation to see if there is something you can improve. Every time your change gets approved, not only do you earn 2 reputation for the approval itself, but if you edit enough, you also earn 5 reputation for each upvote on that topic and 5 reputation each time someone references the topic in an upvoted answer. Introductory topics are especially good for this, since they get upvoted often. Edit a few introductory topics in some popular languages, and then enjoy the +5’s appearing on your screen every day. To conclude: - Post high-quality answers, and don’t get discouraged if someone else answers before you - Never abuse the system - Format your posts correctly - If you’re Jon Skeet, be aware of the 200 rep/day limit; if you’re Donald Duck, concentrate on the other tips - Edit a lot, especially if you have less than 2000 reputation - Associate your other accounts - Once you have the privilege to review, review a lot - On Stack Overflow, participate in documentation I think that the most important ones are #1 (my version), #7 and #8 (Stack Overflow only). If you have less than 2000 reputation, #5 is also important. Weekend effect Most “hard” sites tend to have two large groups: - The professionals of the site topics - Enthusiasts If you belong to (2), it is much more hard for you to get reputation. But: the professionals are tend to be far, far away on the weekend. This opens the gates before the commoners. Here is the time, as you can activate yourself, to concentrate your effort. Look for the enthusiasts. Here is the time to get your first mortherboard badge. Note: if you want to get the mortarboard badge, or to hit the repcap, you have to start the day early. If you are a professional, then it is the possibility to get your first motherboard badge without working on it on all the day. Not - formating And Spalling well (incoroect)[hyperlionks] - And general usessness Of {posts}(0) Categories: Uncategorized
https://tlfong01.blog/2019/05/29/six-simple-tips-to-get-stack-overflow-reputation-fast/
CC-MAIN-2019-35
refinedweb
10,336
70.94
a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc. Project description This project checks the health for a number of backends and sees if they are able to connect and do a simple action. plugin_dir.register(DjangoDatabaseBackend) Install Add this to urls.py url(r'^ht/$', include('health_check.urls')) Add required apps: 'health_check', # required 'health_check.db', 'health_check.cache', 'health_check.storage', 'health_check.contrib.celery', 'health_check.contrib.s3boto_storage', Note Not that you will need a result backend configured for celery. Set up monitoring You can use tools like Pingdom or other uptime robots. The /ht/ endpoint will respond a HTTP 200 if all checks passed and a HTTP 500 if any of the tests failed. Writing a custom health check Writing a health check: class MyHealthCheckBackend(BaseHealthCheckBackend): def check_status(self): # The test code goes here. # You can use `self.add_error` or raise a # `HealthCheckException`. Similar to Django's form validation. pass def identifier(self): return self.__class__.__name__ # Display name on the endpoint. Register the backend in your app configuration: from django.apps import AppConfig from health_check.plugins import plugin_dir class MyAppConfig(AppConfig): name = 'my_app' def ready(self): from .backends import MyHealthCheckBackend plugin_dir.register(MyHealthCheckBackend) Project details Release history Release notifications Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/django-health-check/2.1.0/
CC-MAIN-2018-51
refinedweb
237
52.97
import "go.chromium.org/luci/common/gcloud/gs" Package gs implements a versatile Google Storage client on top of the standard Google Storage Go API. It adds: - The ability to read from specific byte offsets. - Exponential backoff retries on transient errors. - Logging - The ability to easily stub a Google Storage interface. doc.go gs.go limited.go path.go writer.go. NewProdClient creates a new Client instance that uses production Cloud Storage. The supplied RoundTripper will be used to make connections. If nil, the default HTTP client will be used. (lc *LimitedClient) NewReader(p Path, offset, length int64) (io.ReadCloser, error) NewReader implements Client. Path is a Google Storage path. A full path consists of a Google storage bucket and a series of path components. An example of a Path is: gs://test-bucket/path/to/thing.txt MakePath constructs a Google Storage path from optional bucket and filename components. Trailing forward slashes will be removed from the bucket name, if present. Bucket returns the Google Storage bucket component of the Path. If there is no bucket, an empty string will be returned. Concat concatenates a filename component to the end of Path. Multiple components may be specified. In this case, each will be added as a "/"-delimited component, and will have any present trailing slashes stripped. Filename returns the filename component of the Path. If there is no filename component, an empty string will be returned. Leading and trailing slashes will be truncated. IsFullPath returns true if the Path contains both a bucket and file name. Split returns the bucket and filename components of the Path. If a bucket is not defined (doesn't begin with "gs://"), the remainder will be considered to be the filename component. If a filename is not defined, an empty string will be returned. type Writer interface { io.WriteCloser // Count returns the number of bytes written by the object. Count() int64 } Writer is an augmented io.WriteCloser instance. Package gs imports 13 packages (graph) and is imported by 12 packages. Updated 2019-12-06. Refresh now. Tools for package owners.
https://godoc.org/go.chromium.org/luci/common/gcloud/gs
CC-MAIN-2019-51
refinedweb
346
60.92
Question about objects I had a problem with a code I was writing for class and I couldn't figure out why it was acting the way it was. I finally got the program to work but I had a problem with a block of code and I would appreciate if someone could tell me what it acted this way. First let me tell ou how I solved it, I moved the Student student2 = new Student(); line into the while loop. Before what was happening was after the first go around, the compareTo was pointing at the same object. After I placed the previous line of code into the while loop it worked fine. Why is that? Here is the code: import java.util.*; import java.io.*; public class Project1 { public static void main(String[] args) throws IOException { // counter for while loop. int control = -1; //open file Scanner inputStream = openFile(); //declaration of student objects Student student1 = new Student(); Student student2 = new Student(); //from here!!! //input of student object from file student1.input(inputStream); student1.output(); while (inputStream.hasNext() && control <= 0) { //to here --->//Student student2 = new Student(); student2.input(inputStream); student2.output(); control = student1.compareTo(student2); student1 = student2; System.out.println(control); student1.output(); } Message was edited by: zfivgas
https://www.java.net/node/659144
CC-MAIN-2015-14
refinedweb
208
58.58
View for spread-sheet view. More... #include <pqSpreadSheetView.h> View for spread-sheet view. It can show data from any source/filter on the client. Uses pqSpreadSheetViewModel, pqSpreadSheetViewWidget and pqSpreadSheetViewSelectionModel. Definition at line 46 of file pqSpreadSheetView.h. Definition at line 52 of file pqSpreadSheetView.h. Get the internal model for the view. Returns the currently visible representation, if any. Note that this view supports showing only one representation at a time. Fired when the currently shown representation changes. repr may be NULL. Called when a new repr is added. Called to ensure that at most 1 repr is visible at a time. Called at start of every render. If in "selection-only" mode, and showing composite dataset, we want to make sure that we are shown a block with non-empty cells/points (if possible). Called at end of every render. We update the table view. When user creates a "surface" selection on the view. Called when checkbox "Show Only Selected Elements" is updated. Called when the "Font Size" property is updated. Create a QWidget for the view's viewport.
https://kitware.github.io/paraview-docs/latest/cxx/classpqSpreadSheetView.html
CC-MAIN-2021-49
refinedweb
181
71.71
The following form allows you to view linux man pages. #include <sys/types.h> #include <sys/stat.h> int mkfifo(const char *path, mode_t mode); int mkfifoat(int fd, const char *path, mode_t mode); work- ing directory is used and the behavior is identical to a call to mkfifo(). The mkfifo() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. permis- sion, or write permission is denied on the parent directory of the fifo to be created. [ELOOP] Too many symbolic links were encountered in translat- ing the pathname. . chflags(2), chmod(2), mknod(2), stat(2), umask(2) The mkfifo() system call is expected to conform to ISO/IEC 9945-1:1990 ("POSIX.1"). The mkfifoat() system call follows The Open Group Extended API Set 2 specification. The mkfifoat() system call appeared in FreeBSD 8.0. webmaster@linuxguruz.com
http://www.linuxguruz.com/man-pages/mkfifoat/
CC-MAIN-2019-04
refinedweb
155
56.05
. This is the way I went about the "Validate a Sudoku Board” problem.. This one is fairly straight-forward, your basic task is to make sure that the value of any given cell isn’t replicated in the cell’s row, column, or “cube”. The problem is how you go about this. There is a space-efficient way, but requires more looping, or there is a method that requires only visiting any cell one time, but requires extra space. Given that the puzzle is fixed in size (9x9 grid), I’ll opt for better algorithmic complexity and use space to hold the set of all numbers seen for each given row, column, and cube. By using 27 sets to hold these values (9 for the rows, 9 for the columns, 9 for the cubes), we can easily see if we’ve already seen the current number in the given row, column, or cube and immediately declare the puzzle invalid. Of course, we could get even more space-efficient and use 27 BitArrays (or one large one partitioned, etc.), but then we lose the elegance of set logic. I like keeping things logically simple and then optimizing for space after determining there is a need, so I’d probably opt to use Sets in my original answer in an evaluation, and then mention that if space were a concern, I would then optimize to BitArray. So, here’s my solution: 1: public class SudokuBoard 2: { 3: private readonly char[,] board; 4: 5: // validate board is a 9x9 array 6: public SudokuBoard(char[,] board) 7: { 8: if (board == null || board.GetLength(0) != 9 || board.GetLength(1) != 9) 9: { 10: throw new ArgumentException("Board is not valid size for Sudoku"); 11: } 12: 13: this.board = board; 14: } 15: 16: public bool Validate() 17: { 18: // yes, i could use BitArray for space efficiency, but i like the logical feel 19: // of the set and how it returns false on Add() if already there. 20: var rows = Enumerable.Range(1, 9).Select(i => new HashSet<char>()).ToArray(); 21: var columns = Enumerable.Range(1, 9).Select(i => new HashSet<char>()).ToArray(); 22: var cubes = Enumerable.Range(1, 9).Select(i => new HashSet<char>()).ToArray(); 23: 24: // process each cell only once 25: for (int row = 0; row < 9; ++row) 26: { 27: for (int column = 0; column < 9; ++column) 28: { 29: var current = board[row, column]; 30: if (char.IsDigit(current)) 31: { 32: // determine which of the "cubes" the row/col fall in 33: var cube = 3 * (row / 3) + (column / 3); 34: 35: // if add to any set returns false, it was already there. 36: if (!rows[row].Add(current) || !columns[column].Add(current) || !cubes[cube].Add(current)) 37: { 38: return false; 39: } 40: } 41: } 42: } 43: 44: return true; 45: } 46: } Note that I’m not checking for invalid characters for the sake of brevity, though we could easily do this in the constructor, or in the Validate() method itself: 1: var current = board[row, column]; 2: if (char.IsDigit(current)) 3: { 4: // blah blah blah 5: } 6: else if (!char.IsWhiteSpace(current)) 7: { 8: return false; 9: } Finally, here’s a simple driver to illustrate usage: 1: public static class Driver 3: public static void Perform() 4: { 5: var board = new char[9,9] 6: { 7: {'5', '3', ' ', ' ', '7', ' ', ' ', ' ', ' '}, 8: {'6', ' ', ' ', '1', '9', '5', ' ', ' ', ' '}, 9: {' ', '9', '8', ' ', ' ', ' ', ' ', '6', ' '}, 10: {'8', ' ', '2', ' ', '6', ' ', ' ', ' ', '3'}, 11: {'4', ' ', ' ', '8', ' ', '3', ' ', ' ', '1'}, 12: {'7', ' ', ' ', ' ', '2', ' ', ' ', ' ', '6'}, 13: {' ', '6', ' ', ' ', ' ', ' ', '2', '8', ' '}, 14: {' ', ' ', ' ', '4', '1', '9', ' ', ' ', '5'}, 15: {' ', ' ', ' ', ' ', '8', ' ', ' ', '7', '9'}, 16: }; 17: 18: var validator = new SudokuBoard(board); 19: 20: Console.WriteLine("The Sudoku board is " + (validator.Validate() ? "valid" : "invalid")); 21: } 22: } Wednesday, June 3, 2015 2:52 AM |
http://geekswithblogs.net/BlackRabbitCoder/archive/2015/06/02/solution-to-little-puzzlersndashvalidate-a-sudoku-board.aspx
CC-MAIN-2020-34
refinedweb
619
65.76
By Nishchay Kumar Singh on Jan 18, 2017 5:12:34 AM Introduction: ORMLite (Object Relational Mapping) database provides lightweight data mapping between Java Classes & SQL Databases. ORMLite mainly supports the following JDBC connections: MySQL, Postgres, H2, SQLite, Derby, HSQLDB, Microsoft SQL Server and so forth. Since it is not an in-built library in Android like SQLite, developers need to add the respective Jar file or dependency first before starting development. Why ORMLite? Before delving into the topic of ORMLite, we need to understand why we need ORMLite. As compared to SQLite database in an Android library, ORMLite can be used repeatedly without making too many changes to the code (in terms of queries).While dealing with ORMLite, it is not necessary to learn SQL as another language since we can use objects and pre-defined methods to create our database. How to start & use ORMLite: To start development using ORMLite in Android, we need to follow the below mentioned steps: Downloading ORMLite jar file (Android): For using ORMLite with Android application, you should download ormlite-android-4.43.jar and ormlite-core-4.43.jar & above version files. Add them as library files to the project and you are ready to start the development. Configuration of your model class: After successful download of ORMLite jar files, the second step for a user is to configure their Model class. Users can use the following annotations to configure their classes. - @DatabaseTable: The @DatabaseTable annotation is used to provide a specific user-define name to a database while creating a Database Table.. - @DatabaseField: The @DatabaseField annotations are used to provide fields to the database created. - @DatabaseField(id=true): The @DatabaseField annotation is used if a user need to declare any of the fields created in the database as a Primary Key. Below is an example to demonstrate ORMLite model class: Example: @DatabaseTable(tableName = "employee") public class Employee{ @DatabaseField(id = true) private String name; @DatabaseField private String empID; @DatabaseField Private double salary; public Employee() { // ORMLite needs a no-arg constructor with package visibility. } public Employee(String name, String empID,String salary) { this.name = name; this.empID = empID; this.salary =salary; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getempID() { return empID; } public void setempID(String empID) { this.empID= empID; } Public double getsalary(){ return salary; } public void setsalary(double salary) { this.salary= salary; } } Configuration of DAO: DAO stands for Data Access Object which provides us CRUD (Create,Read,Update&Delete) database operations. The simplest way to create a DAO is to use a static createDao method in the DaoManager class. The DAO of Employee class defined will look like: **Private Dao<Employee,String> empdao = DaoManager.create(connectionSource,Employee.class); Custom Statement Builder: DAO has some pre-defined methods to query for an object that matches an ID field as (queryForId) & if it matches all objects, then (queryForAll) and some other simple matching methods. However, for more custom queries we have queryBuilder() method which returns a QueryBuilder object for a DAO with which you can construct custom queries of your database tables. Query Builder Basics: To start working with query builder, we have to first provide column names to our database fields so that it will be easy for us to use them while building our query. Below is an example to show how to build a query in ORMLite: @DatabaseTable(tableName =“Employee") public class Employee{ public static final String FIELD_NAME = "name"; ... @DatabaseField(canBeNull = false, columnName = FIELD_NAME) //this will check that the name given by user to column FIELD_NAME should not be empty private String name; … Now let us start building query as: QueryBuilder<Employee, String> queryBuilder = empdao .queryBuilder(); Where<Employee, String> where = queryBuilder.where(); where.eq(Employee.FIELD_NAME, "Rohit"); where.and(); where.eq(Employee.FIELD_Emp_ID, "12345"); PreparedQuery<Employee> preparedQuery = queryBuilder.prepare(); Using this With Android OS: While working with Android operating system we need to create our own database helper class extends to OrmLiteSqliteOpenHelper class. This class creates an override method as onCreate and onUpgrade .These override methods create and upgrade your database when your application is going to start and can also provide the DAO. Classes used by other classes: While working with this, you should keep your helper class as public so that all other classes can easily access it. Once you have defined your database helper you need to use it in your activities. The simple method to use your OpenHelperManager is to extend it to OrmLiteBaseActivity for each of your activities. If you don't want to follow the above method you can directly call OpenHelperManager.gethelper() method to your respective classes. Once you use OpenHelperManager.gethelper() save the helper class and then call OpenHelperManager.release() to release the call. Table Config File: We have used ORMLite annotations for configuring our class. If required you can also remove the annotations which makeour data access objects operations a bit faster.. In ORMLite you can configure data using a text configuration file. This configuration file consists of different tags related to database table and the fields associated with it. The OrmLiteConfigUtil class writes this config text file in android raw resource folder and can be declared in your database helper class. Below is an example of config text file: public class DatabaseConfigUtil extends OrmLiteConfigUtil { public static void main(String[] args) throws Exception { writeConfigFile("ormlite_config.txt"); } }
https://blog.trigent.com/using-ormlite-in-android-mobile-apps
CC-MAIN-2019-39
refinedweb
891
54.63