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
Swank backend for Node.JS and in-browser JavaScript. NOTE: the official repo is at [[]]. swank-js provides SLIME REPL and other development tools for in-browser JavaScript and Node.JS. It consists of SWANK backend and accompanying SLIME contrib. Socket.IO is used to communicate with wide range of web browsers. A lot of the contributors of this project are strapped for time, and we could use some more. Please see: From my experience an ability to use REPL for JavaScript debugging and interactive development is very helpful when developing Web applications. Previously I was using a heavily patched MozRepl version that was adapted for in-browser JavaScript. Primary downsides of that approach were extreme instability of communication between Emacs and the browser, the lack of cross-browser support and the lack of good RPC between Emacs and JS that can be used to develop some handy extensions. I knew there exists slime-proxy project that provides such functionality for Parenscript. The problem is that most of us including myself can't use Lisp all the time and a lot of code needs to be developed using languages like plain JavaScript (as opposed to Parenscript), Python and so on. My first thought was to adapt slime-proxy for use with plain JS, but then I decided to roll my own SWANK backend using Node.JS. I wanted to find out what this buzz around Node.JS is about and perhaps steal an idea or two from there for use in my Lisp projects. Another reason was availability of Socket.IO and an example of tiny http server proxy. Some people may prefer Firebug or built-in browser development tools to Emacs-based development, but for example in case of mobile browsers you don't have much choice. At some point I did try swank-js with an colleague's iPhone and it worked, which is not too unexpected given that Socket.IO has good cross-browser support. As of now swank-js provides REPL with an ability to work with multiple browser connections, supports dynamic updates of JavaScript code using C-c C-c / C-M-x, provides debug output function and an ability to reload web pages in the browser or refresh their CSS using Emacs commands. Many aspects of full-fledged SWANK backends aren't implemented yet, there's no debugger/completion/autodoc and so on, but as I plan to use swank-js a lot in future there's a good chance many of these features will be eventually added. Install swank-js from npm: npm install -g swank-js Get recent SLIME from its CVS or the git mirror. The backend was verified to work with SLIME 2012-02-12, it may or may not work with other versions, but note that breaking change in the protocol was introduced in SLIME 2011-11-27. Make sure you have latest js2-mode. Add it to your .emacs: (add-to-list 'load-path "/path/to/js2-mode/directory") (autoload 'js2-mode "js2-mode" nil t) (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) Create symbolic link to slime-js.el in the contrib subdirectory of SLIME project. Install js2-mode into emacs from In your .emacs, add the following lines (you may use other key for slime-js-reload; also, if you're already using SLIME, just add slime-js to the list of contribs, otherwise adjust the load-path item): (global-set-key [f5] 'slime-js-reload) (add-hook 'js2-mode-hook (lambda () (slime-js-minor-mode 1))) If you're using CSS mode, you may want to add the following lines too: (add-hook 'css-mode-hook (lambda () (define-key css-mode-map "\M-\C-x" 'slime-js-refresh-css) (define-key css-mode-map "\C-c\C-r" 'slime-js-embed-css))) If you want to use swank from the node project just add following to your package.json file: "devDependencies": { "swank-js": ">=0.0.1" }, "scripts": { "swank": "node node_modules/swank-js" } Once this is done you should be able to run up a swank for this project by running: npm run swank Alternatively you can install swank-js globally by running: npm install -g swank-js Once installed you could run it from you project directory: swank-js Make SLIME connect to the backend using M-x slime-connect and specifying localhost and port 4005. You will see REPL buffer with the following prompt: NODE> This means that you're currently talking to Node.JS. You may play around with it by running some JavaScript expressions. If you get warning about SLIME version mismatch, you may make it disappear until the next SLIME upgrade by typing ,js-slime-version at the REPL and entering your SLIME version (e.g. 2010-11-13). Point your web browser to You will see the following message appear in the REPL (browser name and version may differ): Remote attached: (browser) Firefox3.6:127.0.0.1 This means that the browser is now connected. Several browsers can connect simultaneously and you can switch between them and Node.JS REPL using ,select-remote REPL shortcut. To use it, press ',' (comma) and type select-remote (completion is supported). You will see "Remote:" prompt. Press TAB to see completions. Select your browser in the list by typing its name or clicking on the completion. The following message will appear: NODE> Remote selected: (browser) Firefox3.6:127.0.0.1 FIREFOX-3.6> After that, you can interactively evaluate expressions in your browser. To go back to Node.JS repl, switch back to node.js/direct remote. FIREFOX-3.6> document.body.nodeName BODY FIREFOX-3.6> alert("test!") FIREFOX-3.6> When working with browser, you may use F5 to reload the page. swank-js connection with browser is lost in this case, but to solve this problem you may use ,sticky-select-remote instead of ,select-remote. This way swank-js will remember your selection and automagically attach to the browser whenever it connects. If you press F5 after using ,sticky-select-remote, you will see that browser briefly disconnects but then connects again: Remote detached: (browser) Firefox3.6:127.0.0.1 FIREFOX-3.6> Remote selected (auto): (direct) node.js Remote attached: (browser) Firefox3.6:127.0.0.1 NODE> Remote selected (auto): (browser) Firefox3.6:127.0.0.1 FIREFOX-3.6> The sticky remote selection is saved in the config file, ~/.swankjsrc, so you don't need to do ,sticky-select-remote after restarting the browser. Now, let's try to make it work with an actual site. swank-js acts as a proxy between your browser and the site so it can inject necessary script tags into HTML pages and avoid cross-domain HTTP request problems. Let's point it to reddit. Type ,target-url and then (www. part is important, otherwise it will redirect to skipping the proxy). Point your browser to, you'll see reddit frontpage load. If you didn't do ,select-remote or ,sticky-select-remote yet do it now and select your browser from the list of remotes. Now you can execute JavaScript in the context of reddit: FIREFOX-3.6> $(".sitetable a.title").map(function(n) { return (n + 1) + ". " + $(this).text(); }).get().join("\n") 1. Wikileaks currently under a mass DDOS attack 2. Munich University - Jealous ... Let's make a function from it. Create a file test.js somewhere and make sure it uses js2-mode (if it doesn't, switch it to js2-mode using M-x js2-mode). Type the following there: function listRedditTitles () { $(".sitetable a.title").map( function (n) { SwankJS.output((n + 1) + ". " + $(this).text() + "\n"); }).get().join("\n"); } Note SwankJS.output() function being used there. It allows you to send debug print to SLIME REPL. Move the point somewhere into the middle of the listRedditTitles() function and press C-M-x. Now you may try it out in the REPL: FIREFOX-3.6> listRedditTitles() 1. Wikileaks currently under a mass DDOS attack 2. Munich University - Jealous ... You may edit the function definition and update it using C-M-x any number of times. Now let's try some CSS hacking. Create a directory named zzz and start a Web server in it from your command prompt: $ mkdir zzz && cd zzz && python -mSimpleHTTPServer Create a file named a.css there and make sure it uses css-mode (like with js2-mode, you can force it with M-x css-mode). Add some CSS rules to this file: body { background: green; } Now let's add the stylesheet to the reddit page: FIREFOX-3.6> $('head').append('<link rel="stylesheet" href="" type="text/css" />'); [object Object] You will see some parts of the page become green. Now, change green to blue in the CSS file and press C-M-x (it will save the file automatically): body { background: blue; } You will see the page become blue, maybe after some flickering as all CSS used on the page is reloaded. This way you may update CSS in an AJAX application without reloading the page, which is often rather handy. Unlike editing CSS in Firebug in case when you're editing CSS of your own application changes will not disappear upon page reload (with reddit page you'll have to readd the stylesheet). Alternatively to just try out a snippet of CSS you can select some CSS code and hit C-c C-r. This will send the code snippet (or the content of the whole buffer) to the browser and embed it inside a style element. To remove the embedded CSS run the command with a prefix C-u C-c C-r. This is useful for automatically connecting to a web page you develop locally without using the ,target-url command and without changing the document URL for that page. When node swank.js is running embed <script type="text/javascript" src=""></script> and you are ready to go! You can bookmark swank connect / swank disconnect links and use them on any page you'd like to play with. When installed globally ( npm install -g swank-js) you can connect another node.js process to the swank-js node process via ; Optionally you can pass in swank_server_host and swank_server_port as arguments to the setupNodeJSClient call. I've noticed that flashsocket Socket.IO transport does exhibit some instability. You may want to try other transports by changing the socketio cookie, e.g.: document.cookie = "socketio=xhr-polling" Be careful not to lose connection to the browser though especially in case of REPL-less browser like IE6/7 or you'll have to type something like javascript:void(document.cookie = "socketio=flashsocket") in the address bar. In case of IE, increasing the maximum number of HTTP connections may help with non-Flash transports, although I didn't try it yet. To do it add DWORD value MaxConnectionsPer1_0Server to the following registry key: HKEY\_CURRENT\_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings swank-js is distributed under X11-style license. See LICENSE file.
https://www.npmjs.com/package/swank-js
CC-MAIN-2016-36
refinedweb
1,844
65.12
I suck at C++! like really badly, i just cant grasp it, and now i have to write a program for it that is suppose to input some values from a text file that would create like a gradebook thing. im also supposta use a void function, calculatedAverage to determine the average of the five test scores and use a loop to read and sum the first five test scores. Then a value returning function calculatedGrade to determine each students grade in the main function. this is the stuff from the txt file thst needs to be read StudentData.txt Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 and it needs to be outputted looking like a table. i have made numerouse ttempts at makeig this, and i am not getting any help from any of my teachers, they say i must lear i on my own, but i rally am haveing a hard time. this is what i have so far: #include <iostream> #include <string> using namespace std; void calculateAverage(ifstream& inF, ofstream& outF, double& CAvg); int main() { cout << " Student Test1 Test2 Test3 Test4 Test5 Average Grade" << endl; } void calculateAverage(ifstream& inF, ofstream& outF, double& CAvg) { std::ifstream in("StudentData.txt",std::ios::in |std::ios::binary); return 0; } as you can see i rally suck, it wont even compile! please someone help, i have to have this done asap! please! P.S. i also attached the .txt file and the .cpp file please someone help im desperate at this point, ive been working on it for 3 days now!
https://www.daniweb.com/programming/software-development/threads/113219/please-help
CC-MAIN-2016-50
refinedweb
268
76.86
Code igniter php xml parser jobs import 2 xml of different language , WPML setup , site is already done, Can i get an infograhic made up please. Thanks, Scott ... have a at90usb162 demo board able to act as select key and output the text automatically without waiting any key press. ...[login to view. ...listens for data (basically a number) from a pressure sensor on a plugged in USB interface and displays the data on screen. The data should be presented as numeric and as QR-Code (or as 'waiting for data'). Specs for the USB pressure sensor: [login to view URL] When starting the Raspberry Pi the I have nrfl24l01 modules that let me have a sensor wireless, base connected to the pc. i want to have multiple sensor that make this thing [login to view URL] and that are controlled by the led.. [login to view URL] [login to view URL] This is a shell program that runs on a gcc compiler, x86-64 architecture and CentOS. I want a program for a travelling salesman problem with high efficiency. My budget is $150 only dont bargain and waste time .. I need a new website. I already have a design, I just need you to build it. We have a working custom parser and would like to update to support a few changes to the grammar. Candidate should have demonstrated experience in working with parsing tools. References absolutely required.". Hi I'm going to customize the think-cell style. 1) Do you have already experiences to customize the style? 2) Do you have good knowledge about MS Office Open XML style? Please apply if you can say "yes". Develop a code in C# .net to get the configuration of the systems connected over a LAN , configurations include MAC address, process id , pc name , processor, OS and other hardware [login to view URL] code should be developed using visual studio by microsoft. php code debugging that is not enetering into the execute project Problem Statement Web UI Views are required to be created for existing database project. Database is defined using Code first and contains entities schema. WebUI Project Requirement Required using ASP.NET MVC Views: Web UI should have List Create, Update and Delete pages for following entities: • Customer o Customer MetaData (JSON Editor required) •! I need an interpreter made by java. - operations -Requirements Database and XML - Realizing database - Transactions - Query Operations - XML ...developer. I'm trying to learn multithreading basics for image processing in C++. I come from a different API background where I've done this often and I'm trying to get my code ported to C++ using the std::thread function. This is my current pseudocode: static const int num_threads=4; void FilterImage (int x1, int x2, int x3, int threadNr) { ...Requirements: * PHP 5.5.7 compatible (running on a Windows Server 2012, IIS) * MySQL 5.0.11 compatible * JQuery 1.4.4 is available but not required to use * All development will need to take place on YOUR system. Deliverable should be a zip file with all needed files so that we can drop it onto our web server. * Adequate in-line documentation of the code * Brief .. ..: [login to view URL] SII documentation : Document! I'm using this API ([login to view. we need to purchase i need android and desktop for multiple roullette games. i can buy at once no backend needed we already have in php. Hello, Guys! I am looking for someone that can build chrome browser source code completely. Below is link of source. [login to view URL] If someone can do this job, please apply.%; over...
https://www.freelancer.com/job-search/code-igniter-php-xml-parser/2/
CC-MAIN-2019-22
refinedweb
605
66.03
As already mentioned in Support for Hessian web services, RIFE's MetaData merging can be tricky when used together with web services which have to serialize the object. The mentioned solution can't be easily adopted, because the SOAP is – even via XFire – a bit more complicated. The solution I went for, contains sub-classing: For SOAP, we need a "pure" Bean, w/o any pollution through RIFE. As I want to have the Beans with MetaData for everything but SOAP, I implemented a second API just for SOAP and the "pure" Beans have special names – in this case they are prepended with the word "Bean". Let's look at an example: public class BeanFoo { protected int val; public BeanFoo() { } public void setVal(int val) { this.val = val; } public int getVal() { return val; } } This is the Bean the SOAP-API is going to use. Now let's define our Bean with MetaData for everything else (eg. DB access): public class Foo extends BeanFoo { public Foo() { } public Foo(BeanFoo beanFoo) { this(); val = beanFoo.val; } } The default constructor is really important here, as the MetaData gets only merged, if the object is instantiated using the default constructor. If you want one with arguments, don't forget to call the default constructor using this() inside of it. NB, that this approach wouldn't work if there wouldn't be the automatic merging, because Java has no multiple inheritance. Now you just write your Adapter which wraps the class you want to expose (see Support for SOAP web services) and takes care to cast your beans to the "pure" ones. Assuming your class looks like this: public class Bar { private Foo foo; public Bar() { foo = new Foo(); } public Foo getFoo() { return foo; } public void setFoo(Foo foo) { this.foo = foo; } } You'll need an adapter like this: public class SoapBar implements SoapBarApi { private Bar bar; public SoapBar() { bar = new Bar(); } public BeanFoo getFoo() { return bar.getFoo(); // Downcasts are no problem } public void setFoo(BeanFoo foo) { bar.setFoo(new Foo(foo)); // We need a copy-constructor in Foo for the upcast } } The definition of the interface is trivial an thus omitted. The conclusion is that there's a bit too much unnecessary boiler plate code – especially when being used to RIFE – and let's hope, that the XFire guys are going to support RIFE's MetaData in the near future.
http://rifers.org/wiki/display/RIFE/SOAP+web+services+and+MetaData+merging
crawl-001
refinedweb
395
57.91
479 Related Items Related Items: Panama America This item is only available as the following downloads: ( XML ) Full Text , -A .. : . *B -* -. ,. ,, ', !. ~q.uIo~ INTER NATIONAL AIRWA Y S TWNTr-MNISM TEAS " Let the people know the truth end the country is safe" Abraham Lincoln. PANAMA. P.. THURDAT. AUGUST 19, 195 Senate OK's Free Vacation Travel Remon On Talks: Still Much To Do * President Jose A. Remon ad- mitted today that some progress has been made in treaty nego- tations between Panama and the United States, but there Is stUil much to be done. At a press conference attended by members of his cabinet and treaty consultants Drs. Harmodio Arias and RSlsao J. Alfaro, Col. Remon sa U.8. answers to panamannlan.roopsals are wor- thy of detalle= study." , S The Preldent abstained from giving prelse information on the U.S. counterproposals, but be said that these included: 1.-The Increase of Canal an- nuities. 2-.-ome measure of economic cooperation. .-_3qual salaries (for Pana- manians) in the Canal Zone. 44-Equal pensions for Canal workers. S 5--Better opportunities for Panamanian commerce. 6o.-Return of lands and waters Iof manifest Importance to the SRepublic. Remon also revealed that Pan- amanlan ngotitors ead b ne"Vi**< ralt-a A MMf-a Unifruco 12 o Income taxes paid by the United Fruit Co. into the Pana- manian Treasury will be increas- ed from 18 to 30 pea cent, ac- cording to the terms of a new contract negotiated between company representatives and Panama government officials The 12 per cent increase was announced today by President Remon at a press conference this morning. On the basis of the new con- tract, the bi U.S. banana firm will pay $1,700,000 more n taxes this year, if it Is approved by the National Assembly before Dec. 31. This will bring the total of the company's '54 taxes to $3,800,000. The new contract will remain effective until 1986. President Remon and his cab- inet met mniediately following the press conference to put'their stamp of approval on the new contract and grant authority to Finance Minie Alfredo Aleman to sign for the Panama govern- ment. UFCo. representatives were sending thie contract to their of- fice in Boston, Mass., today for deliberation and approval of the company's board of directors. According to the new contract , mnt .ml transfer wtemh t .-Rma To More Pay In dispensaries and schools operated by the company. However, the company will share two-thirds of the cost of the Almirante and Puerto Ar- muelles schools as long as it does not exceed $40.000. In addition the company has agreed to con- tribut e $5.000 annually towards the upkeep of the two schools. The contract also empowers the company to the flooding or rehabilitation of banana landq, subject to authorization from the Ministry of Agriculture, Comrn- merce and Industries. The com- pany is also empowered to change the location or abandon Individual plantations for com- mercial reasons. The new contract also exon- erates the company from the payment of import taxes on products and equipment needed for the operation of plantations. The exoneration will amount to about $150,000 annually. On the other hand the com- pany has Wgreed to give prefer- ence to .Panmanian products as long as they are of equal quality andcost as imported goodsplnas freight and consular charges. The contract also empowers the company to maintain large axtenmsm of uncultivated ds ia riultumral reemr but must usual. taxas on theea RP Taxes by ex-President Ricardo J. Al- faro, Finance Minister Alfredo Aleman, Agriculture and Com. merce Minister Temistocles Diazs and Comptroller General Hen- rique de Obarrio for the Pan- ama government. UFCo. vice president Samuel 0. Baggett came to Panama from Boston to conduct the ne- gotiations along with local com. pany officials for the UFCo. Baggett told The Panama American: "The negoclations were very satisfactorily carried out In a most cordial atmo- sphere. We are happy to have this revised contract entered into. "We think it will contribute to the continuance of .the very fine relations we have always had with the Republic of Pan- Baggett left shortly afterward MAKES HE by plane for Almirante. From shown in h there he will go to Guatemala Swan," at1 for a few days before return- Pocono Pla Ing to his home In 'Boston. (NEA Telephoto) ER DEBUT Gloria Vanderbilt. the millonaires is er third act costume after her performance in "The mountainhome. Pa. A crowd of nearly 800 packed the house and enthusiastically cheered Miss Vanderbllt as she made her stage debut. USRed Chinese Both US, Red Ch nese Both Cut Korean Garrisons -0 - CZers As Bill Awaits Like's Signature Canal Zone employes were rejoicing today over the news, just received on the Isthmus, that the vacation travel bill has passed the Senate and is on its way to President Eisenhower for signature. According to the provisions of the new legislation, HI; R. 179, all federal government employes on the Canal Zone will be entitled to a vacation round-trip for them, selves and their families, expenses paid, after each two years of continuous service for the government. Word of the passage of the bill was received simul. taneously on the Isthmus by members of the National Federation of Federal Employes, and by Howard Munro, legislative representative of the Central Labor Union. Metal Trades Council here. Munro, who had just returned from Washington, previously expressed confidence that the legislation would be passed. Munre has also reeldy today that IR 9709, a I ed at peovldnlg unemp Insumraamt. for former utimet mismo,,tm insAl word enatment of PuMl aw - aim i n.AM04, ad who erefwe d meat not have l ed -rae m.-- St he best of their abilityplced military Of- h rac t was nego dfical d that the ares, 06 Seris.( List ficlalta beae for several months, Indletting they have no present intentln Three sailors and a Marine COCOil Clubhouse. onew .g the n oresn war.n who were Injured in an auto- i, t oThe result, the official said Is mobile accident on Randolph Re-Openin OK'd that. even with the withdrawal, Roa Tuesdiay night, were tak- the U.S.-Republic of Korea fore- andoarethensered ttob ay Authority to reopen the Co-.. es now have comparatively more aend con at the relonbein d. II Clubhouse at an early date, strength In relation to opposing cni athColo has _ust been rmesie from forces than at any time during The driver of the car which Washington, a spokesman for the war. crashed into a guard rail and the Cocoll. Civic Council an-. The U.S. decision, announced turned over, was Marine C!. nounced today. by the Defense Departmentyeq- Eight girls and five boys were Andrew B. Casey, Jr. The s l- t. ray, met witn h aer p e-t born at Gorgas Hospital during es who were his passengers The clubhouse was closed from South Koreans who said it the week ending ao midnight were Wesley Schlent, Gayle Nash down April 1. The council ha would invite another Red attack. Monday, according to the weely and Joe H. Isaacs. All are sta- been working towards reopening But the department said the hospital report. toned at Coco Solo. the clubhouse to Cocolf residents move "will better serve the stra- There. were 179 admitted to No charges have as yet been for some time. tegic Interests of the United the hospital during the week and iled against the driver, pend- The exact date will be opened States." Chairman Leverett Sal- 158 discharged. Five deaths were ing further police investigation, was not yet known. tonstall (R-Mass.) of the Senate reported, the causes of which Armed Services committee a- were liven as galoblatroma, pro- greed. maturity, septicema, multi A ericanSociety To Hold Cost e MeanwhileIn Seou the akull fracture,andpostopera Teo South Korean government or- Five of the children born last Cha Ball At Panama Golf Club aytoon week were of American parent- charig it would open the way age. Names and home address of for a new Communist Invasion. the pents of these are oMr. Police and block leaders hus- and Mrs. William Mason, Al- The American Society of Pan- right now getting the outfits tied thousands of residents out brook Air Base; Mr. and Mrs. J. amA announced today it would ready. of their beds at dawn, when the J. Yanopulos, Panama City; Mr. sponsor a Costume Charity Ball Nobody will be admitted with- withdrawal was announced angd and Mrs. M. W. Wooten, Fort at the Panama Golf Club Hal- out a costume and police will be ordered them to the Seoul foot- Kobbe; Mr. and Mrs. A. C. Gil- loween night, Saturday, Oct. 30. stationed at the entrance to ball stadium to voice their dis- lespe, Diablo Heights; and Mr. The benefit has been arrang- eject any would be customers approval. and Mrs. Burnette. Cocoll. A son ed to aid the Escuela de los Bs- who a r r ive in conventional Neither President Syngman was born to Mr. and Mrs. Yano- tados Unidos in PanamA City. dress. Rhee nor foreign minister Pyung ulos and daughters were born Fee will be $1 per person and L u i s AzcArraga's orchestra Sung-tal would comment direct- o the other parents. tickets will be placed on sale will play nightlong and the af- lv on the U.S. decision, but of- -Tne birth of daughters were within two weeks. fair promises to be one of the ftidal spokesman Hong Kee Karl announced at the hospital to Mr. year's outstanding events, protested it strongly. and Mrs. A. A. Sampson, of La Prizes will be awarded for the All members of the American -long said the Red attack in Boca; Mr. and Mrs. Ramon Mar- best costumes and comparsas. Society will soon receive tickets June, 1950, was the direct con- mol, of Panama City; Mr. and and the ladies can get b u sy in the mail. Not in costume. sequence of the American Mrs. C. H. Blades, of Paralso;, - and Mr. and Mrs. L. R. Thomas. of Rainbow City. Sons were born to the follow- Ing: Mr. and Mrs. E. A. Gray, of Parque Lefevre; Mr. and MWs. Ines Albeo, of Gamboh; Mr. and Mrs. C. 0. Callender, of La Boca; and Mr. and Mrs. A. S. Clarke, of L Boca. Commy Price Of Tomato Paste Up Slightly A Panamanian woman paid W$p for an 11-cent can of tome- to paste yesterday afternoon In the Balboa Magistrate's Cou The costly purchase was result of a 820 fine impose Carolina Reid. 44. who IO2 o guilty of peUt larcc-iy oundm the Tivol moctn-s-y. "loot" was the 11-cent can S paste. Bow, Wow! Three do two female and p uetaone to be held at fItng who tuwe down i talUan arrit I Ban Ftancie# as they begin a tour of the siol Poee Station at U.S a d by an uident local Clnese bodneman are (left to right): Chang SA a a Chim at a B M ?Authoritativ'e ar C"' Rhee wl demand the Ui tates green to major Increase in South Korean armed strength to offset the withdrawal and In- sist that the departing divisions turn their weapons over to the South Korean army. American officials In Seoul are sure Rhee was told of the Im- pending withdrawal of U.S. troops when he was in Washing- ton early this month, but ne made no reference to it until It was announced officially. The National Assembly was summoned to a special meeting last night to pass a resolution objecting to the "indicated" British Also May Pull Out Their Forces LONDON. Aug. 19 (UP)-The defense ministry said today Commonwealth governments are studying the possibility of re- ducing or withdrawing the Bri- tish Coimmonwealth Division from Korea. A spokesman for the minis- try said the future of the Commonwealth Division also would "be mentioned" at the annual conference of Common- wealth chiefs of staff which opened at Camberley, England, yesterday. "But the disposal of the Commonwealth Division would call for government negotia- tions," he said. "Discussions are already go- ing on between Britain and the Commonwealth governments re- garding the possibility or prac- ticability of reducing or rede- ploying the Commonwealth Di- vision but no plan has vet been decided upon." he said. He said the United States was "aware" of these discus- sions, the spokesman added. The spokesman emphasized that no decision had yet been reached on the future of the Commonwealth Division and that it would be wrong to as- sume that the division would be withdrawn completely from Korea. The U S. announced official- ly yesterday that it is pulling four American divisions out of Korea. The War Office said the Com.- monwealth Division consisted of one British brigade, one Canadian brigade, one Coam- monwealth brigade of Austral- lans and. British and oe ar- tillery regiment from New Zea- land. The total strength was estim- at P a h MW "m M P; M- a nor a Us W We U - '.. .. v"an employee wUhis unde e other bil'. H 09 wf certain-w-hich t cour -aSt .ay return to e lfeet former divisdlnz m Ii be pulled out. States a.d.aser he fulfills his govern et" o h i in a bief announcement that the govtment for expenses i 194. divisions *111 be "deployed to cured. . other areas where it Is believed Also, if for some reason a They may be able to quality they will better serve the strate- man's family canont stay in the for unempoment Insurance A, gie interests of the United overseas area and wishes to re- anyof the 48 tates, a wellm ImIlretsr'ofoetopeUnited ol o futate" There is a possibility one turn before his contract has ex- mn Hawai an ska. may be returned to this country. pired, they must do so at the pro y the different employes' expense. When he ful- differ widely from a hirh-ranking officials said fills his contract however, he w' ,1of$3 Per week to a maximum. the withdrawal designed to be entitled be entitled to be reimbursed tor t,. gilve this country a more mo- pRassage and shipment of houri- --- bilel ltary force to prevent hold goods. s.G overn m e1 t further Communist aggression The following statement onioel e /V li lA' anywhere the free world the purpose of the vacation tray-_ -- The Defense Department said el bill was contained in the Sen- A J the four divisions which will be ate committee report on the JIe i| o To InIdu Q redeployed will be announced measure: i , later by the Army. "The bill would grant authorl- AM.. I aml-Am ty to pay travel expenses of cer- Vwen LWllnmw While the Defense Department tain civilian employes stationed said the troops will be withdrawn overseas and of their immediate WASHINGTON, Aug. 19 (UP, within the next "se veral families In connection with tak- The government announce months," other administration ing periodic leaves of absence in today that it will seek. .win- ource said the will be rede-the United State Staes dictment next month harin played -shortly aTter the first of "It would also provide specific Far Eastern expert OwenLatti- nezt year. statutory authority for the re- more with lying when he ml The luense Department an- turn of the immediate families he has ever promoted Commuri- nouncement was made after a and the household goods of em- ist Interests. daylong hassle among the White ployes prior4o the return of such House td the State and Defense employes, under certain circum- The move, disclosed by US. Departments over just who would stances." district attorney Leo A. Roiver disclose the plans. The Senate report also in- aimed at restoring in ileal The White House was under- eludes a'clarifying statement tight wording the so-cil.ed stood to have declined the as- to the effect that employes in count" of the governments IM dignment On grounds that the the Canal organization, who jury case against LattnLtreU M M (Co(d1Mt ed on Page 6, CoL It entered the service prior to the key count had been thrown at Tennesse Suggests Desegregation Commence In First Grade, Work Up o - NASI LLE, Tenn, Aug. 19 pain, while his two opponents (UP)-TIe state of Tennessee will flatly called for continued separ. suggest 0 the U.S. Supreme Court ate cases. that mix g of the races in school Clement's overwhelming victory rooms st.rt at the first grade and in the Democratic primary thus gradually work upward, it was re- was believed to have pointed the ported tuay. state toward compliance with the State solicitor Gen A. B. Hum- segregation decree. phreys revealed what is believed Last week, the State Board of to be the first concrete proposal Education said it intends to fol- by a Deeo South state toward en- low whatever enforcement decrees forcemme of the high court's his- the state hands down. Education toric ruag against segreg a t e d Commissioner Quill Cope confer- schools. red at the time with Humphreys over plans for the Tennessee brief. The sudgestion will be included Humphreys said he intends t o in a brie( beis preparing to offer point out to the court that the the court, when it hears argument state's public schools are operated this fall putting the decision independently in the cities a n d intheffect; counties by local school boards wever Humphreys said, the and that a sweeping desegregation state will.ask first to be made a decree would tend to disrupt a sys- party to e segregation suits as tern employing 21,000 white and a "friend the court." 3,700 Negro teachers. "As i-ee it now the question But it the mixing begins in the of whee there will be segrega- first grade and works upward over ton wa ed in the decision a long period, the impact can be last May. Humphreys said. absorbed, he said. 'We no point In further Humphreys indicated the plan argulnag. itead, we will present would call for an integrated class ot lde mt how the ending of to be initiated nl the first school can be carried out year and progress through the dee- wM a nlmum of disturbance in mentary grades, the thragh high the seboel system." seIool. Gov. frank Cement, newly nom- It would take about 10 years for nsted to a second successive term. pabile schools to be lategrated al took n stMd for or against ser the way through high chool O at-o. *- A- --4ea dme s Elam S federal district court aa the .8. Court of AppealUs abei too vague. Rover said he will go before a Federal grand Jury begnLn- Sept. 18 with new materil and new witnesses to support the government's contention that Lattimore lied when he told the Senate Internal Security com- mittee in 1952 that he had never been a "sympathizer or any other kind of promoter of Com- munism or Communist Inter- eats." Rover told a news conference that he chose to seek a new -4n dictment rather then appeal to. the Supreme Court to rentate the "key count." He Indicated that this time government prosecutor will try to tighten up the language the charge to meet court ob- jections to the original count. Benefit Casino Open Again This Weekend UM agala this n L Baaeb. Garue. - The affair thkis ing eafetel to all e-lreth. The agi ~' 4- 4 1~ * Viva aum Rejoice the viW m e n said8 w as charged than formerly. "We have been able to put them (the talks) on a more cordial and comprehensive plane," he add- ed. Little League: Girls 8, Boys 5 Sag ranmsVO. ^7-KM ^Kw... __ _ __ I I 1 1 ( I I I B PANAMA AMERICAM AN INDEPENDENT DAILY T WWSPAPER TUSUDAT. AOUEIT 15 THE PANAMA AMERICAN abor N| -Hod a Nice Fall ,i- ,5" %r L Labor nNews o e n I 1 5 l By':' NMI "mn, nm vo" ino lose *onn< -l r H -'.J-1A I I /i ** *i ,. ,I CIvIn ,V ir.ST.AI S I T. P.T a 0 X io a Pa NA .. .. AN U-P. i n ... * 'iS PAINAMA *N. ,.-e.o (I A- ,toMea "d l * 4 AUL ADonaseS PANAMRICAN. PANAMA OPP w u t7s C6SNTRAL AV*NUs aTwe AN4 13T. 4 S 3 .0 .. "" IS UAII aI I- __ _om men.t 1A_"I_40V_1011 50 ,300 By VICTOR EIEEL WASHINtON4-The bitter farm pnesentation ceremony, Deck made AS YOUR PORUM THE READERS OWN COLUMN LISBON The long-sabred na- debate .ow over b t aCo have t many It' . tional guardsmen are in the street. wbriabS tefo aros an e MA uo eAogun-boatnrold eToUehee1nhdIn te hr bor. g gn-bOverhead, planes ofin the harborl's thefarm belt for many months tboatinteTea a. Leters. are reelved gratefully and a,. handled in a wholly c.. Nehu. And strong man Premier ers Union radio program in Mm- brothers of Gaetano Abate and I mew. Salazar, in the old stone fort be. nesota has been ado roamIn ut the drive trucks in Los Angeles. you setu,. impttit. dont b imst et It doesn'tOP" ap 1 1 low riotously colored Estoril, his fa nliar q te of Go r u istn. day. Luten ore published in the order, receWv. summer residence, ponders what "' hower at the Kasson, Jlnn., plow- U. 8. MADE WATCHES Plese try to keep the hlters limited to one page length. we all face-the leftward sweep of boe t htet appearing to favor 100i ill of&WteN writers is held in strictest coniddC. the world. per contest; aparit y pric'suports0tsehwr sa thelefteainhisway.ng W s f taveoffRealing the potea politicalrisio ss hs, for 2t enars, history tW ste othe f dynamite in the KasSon Speech hag i So democracies, must meet it In the carefully pointed out onthe Senate come out wi peal wristwatch manner of free men. But one thing floor lalt week that ke.. didn'tflet. h e... . Sq e A LAW 8I A LAW, IS IT? is certain here at the end of a romia 100 sr cent parit heiar gn a at he a day I saw innal yourpaper that the Panama Canal long trip trough the all the great Eu. "Before making that erall "tell" ou the time by SThe other day I saw in your paper that the Cna nala repean capitals Europe, as well -h sn, c d- m o ay Is going to gouge the employes again to the extent of $8 per as the Far East, including India, er of the Eisenhower farm baill, nead o r hat Dicks uray ponth to send their children to kindergarten. Why, I ask, was is going left and, therefore, anti. resident Eisenhower was very time S aceier l chinhas su ade i Is this necessary. Do you want to know the answer? Because U. S. at a swift pace.o careful to word rt so that it could signed a wrist-sized eger counter a powers on the "HUll" want to make more money; not because Where labor is not Commulist not be mistaken as a promise to that will not o t a the tie is required by law. Here is what the Appropriation Act cover- dominated, it is Socialist domi. nd y. nunoyo ,heree ado men, ., h t say a but h i ed o to b cro c on rigid supports. out war n YOU there's "o much Civil Functions appropriations for 1955 has to say about thi nated or soon to be,9 controlled bt "-o ridll.. thentiiemav yield?" in.raoti in the air. . "SEC. 105.. Amounts expended by the Canal Zone .Govern-, co alition. can se of South Dakotwa. sO RvE I r ADAC eS rent for furnishing education, and hospital and medical care to can, Dat a vwere o r m. C l Ze gm fr a te ... ....... wodaing -f the senator were go.s etploye of agencies of the United States and their dependents, And the great forces behind this wn d ere a ithe saoweree od. wh. eitherr than the Panama Canal Company and Canal Zone Gov- drive to the left are the European eh the President made atothe Amasd Het has wr.n e rnnment, less amounts payable by such employes and their de- labor movements and the parties D.?" boy Emperor Bao Dai to pDendents hereafter shall, notwithstanding any other provision theypay for and control. "I didnot i ntad to quote rom Southern Indochina from falin of law. be fully reimbursable to the Canal Zone Government by e B e an acoun "Con 'that speech," replied Aiken. "It Into Communist hands. His war. such agencies." (Underscoring supplied) o lwas an extemporaneous speech ing was based on the act that the This writer does not think that any tax-payin citizens of ess, counterpart and was interpreted by those re Communists have made tremen. .he United States should be required to pay a tuit on here for ederations, has almost ,, to mean whatever they said it dous headway In Southern Indo. kindergartenn for the very good reason they are getting nothing members on the small Bt le .ieanl." china in recent weeks There's else for the taxes they pay, not even police and fire protection, Itis thelargest and mos Auay s roongs, .,grave danger natives in the south "-It iigro in A l k' B grv d in- g ,tvsithsoh because the law requires that the Panama Canal Company re- ful organization thereoutid of Aspeech, Oct. 4, I wag mimn will vote for the Communists-un. Imburse the Canal Zone Government for all expenses (see sec- It ishuerh elmingd ati-Com.. graphed and handed out to news- less a new and vigorous leader is tinn 246 lei of the Canal Zone Code, as amended). Thus, there munist, but complete nSoalist. A mh. men on the Eisenhower special found. Prediction: Bao Dat who requirement of law that the Panama Canal Company re- is grown more anymore nti train. It said:at out the war on the French R- cover from employes of the Panama Canal Company or Canal.Ii controlsBritish So.iera, hopping rom one ga zone Government for kindergarten tuition, or Junior College, for lism wih s what trhe wris "The Republican Party itble to another, will be that matter. Taxpaying citizens of the United States are now cialism, whabor Party basich is what the Brtlly ish And lo tle sustaining of the 90 out of office .. Secretary lues bthat mater. Labor Party basically is. And pledged toe thon _sustainingofthe90 by decree of the local powers that be, to be deprived of the i .asithere is a danger that the British per cent parity price sup r and has volunteered t give a series o fringe benefit they had left namely, free kindergarten tul- Labor Party may go pro-Russian it is pledged even more Tan that hard-hittin foreign policy speech tion. Since this Is clearly not required by law, the only logical in a few years to helping the farmer obtain hi es ust before the election. He will conclulionl is that t is ust another burden heaped upon Panama fuller parity, 100 per cent parity, be one of the Republican Party's Canae Company-Canal Zone Goernment employes for the sole a Only the other day, the oi caln w s I rn m n e pn'cen and ema et e S.. ... orsolte te hi tte m ll u I m M a purpose of showing a profit. supports of m90., a s caled diplomatic victories in ta a correspondent of the authoritative P e t Ed so n In be a nt e oN This writer says there is no legal requirement that the Pan London Observer wrote that the ot Iran, Egypt, Gnd iuatemala, In ma mnCanal Company must recover from its employee or those of avowed pro-Soviet and anti-U. 8. REFUTING THE DEMOCRA an eor to makee puc ore the Canal Zone Government the cost of furnishing education, Aneurin Bevan could take power o ...... chages hi M hh about thiae tre. meno ust bfeat ine. Including kindergarten. Perhaps he is wrong in his Interpreta- in the British Labor Party If two After finishing his skirmish wna .... ihnorwl beore eled: tion of the law, but if he is he would like to see in the public or three important unions swing to WASHINGTON-(NEA) Sen. ators Flanders, Fulbright a n d Reports from behind the Iron South Dakota's case, Aiken q t e tons the State epartnent will press the official interpretation of the administration which now him. Bevan needs the engineering Estes Kefauver of Tennessee was Morse in a wamerely carries out Curtain indicate that the Commu- from Democratic campaign tera publish a white paper on ndochina propoats to levy this additional burden upon the employes. If union and the British miners. Properly coy when asked .if he the promise which Senator MeCar- nist officials are concerned about ture in 1952-to show that the D aimed at blaming this Communist such Is required, let the administration prove it; iit is not re- switch to him by the engineers "is would be a Democratic candidate thy made to testify on these things the spread bf jokes which poke ncatocrats w a an victory on the French. It will also quired. let's have the decision rescinded. The employes are get- a fair bet," said the Observer's for President i 1956, following his during the Mundt committee tele- fun at the party. To curb this didn't mean what he said whe blast the British for refusing to n. ting tired of these arbitrary shenanigans, and it's about time man. enatorial primary victory over vised hearings. I laughter, the Commies have now he promised to continue high fi tervene with air wer at a critica the bo on the "Hill" become aware of that fact. On leaving for China recently Pat button, On June 9, during an exchan e created the "Joke Squad" to po. id arm supports. momentin the ndochina battle... Whus Rite Bevan blasted the U. 8. for trying body ha asked me," he with Senator Symington of 'Ms- lice Russian humor. But what Aiken didn't men Thailand has been uetly bracing .... ..to "isolate" the Chinese "revoIu- said. "I have no plans. But I'm sour, Senator McCarthy said: Duty of the squad is to travel was that both Eisenhower and for a Communist uprising. Premier t i ...not saying what It would do if I "Now while I think it would be around the coffee houses .or where. Nixon denounced this same Demo Phibul Son gram has put the Answer to Previ ou, But regardless of which side con. really han an opportunity." comp letely Irrelesant to go into ever peo le congregate. One of the cratic literature during the countryy unet virtual martial law SJordan Visit i trols the British Labbr Parts-- o- Backing into the question from the Benton charges, the Marland squad wi tell a funny story, with campaign. They said the Den and made scoresof precautionary O. I"litical front for the Tradee Uon another angle, when Senator Ke- campaign, may I say that i we the Communist regime or some crats were wrong n claiming tat arrests. Meanwhile, te United SCongress- is trying desperately fauver was asked if he thought can induce the senator from Mis- high party official is the butt of Ike hadn't meant what he said at States is rushinemergenc arms OS IAnalyze ad of lv fora tie with the wohinese Co the Democratic candidate for Pres- souri to take the stand here and it. Other members of the squad KRUMo. shipments to Tailand.. nlort. A 088 58 Analyze a sts andte therefore is m dent in 1956 should come from a take the oath, I will consent here then take down the names of any "Malicious," was what Nixon lately, the United States hasn *N e C 3 moral strength, and more th border state h sld, "That's and now to be questioned in detail persons who laugh for later pun. called the Democratic handboo disu DOWN subtle approval to expandg left where you ou htto look, if you about all of those Benton charges, ishment. r ,ed tohear recent ocials nI._ (b "efw ant to et ebest ,candidate." the Maryland campaign, every- Sen. John Sparkman of Alabama ly," omon d Eisenhower, "that arms to the Comunists. ma 2 Control so.Woe toalt l r .Kefauver is usu- thing else." tch n o of -the most an affillateof the-D lmocrtic l N u ta- , 2.C.n trolIa ,a and trust 5 Bo ci alizatio e f tary of the cot to farmers S er t rve informed a t.st" before the M undtcommrit ask, "Does the senator from a- dminlitratio would pull the rg 14-B 7 Light brown 23 Ameliorate 30 Tider he British f hi i nt tittonhadgaged at rough tee, which Senator McCarthy was bama realize that the Yankee out from under them." 15weller 8 Dress 25 Drunkard 40 Hinders money into France and I ly tocam ign against m ali accusl needle him about. But Senator genuity-- The debate of some midwest Re- 'ce 9 Seesaw 29 Most tacile 41 French city bolster the Socialist movements m of bel.g an intnation- McCa y again finds himself on publicans, such as Y young a nd 0 Mde 31 AuriSe 43 a r there .e te lgt and a "One- W der. |The the pan, to be questioned in detail, "The what?". .cut in 8 arkman. Case of the Dakotasand Hope of ,lng mistakes 34 Fathur 45 D dr t In France the talk is that there senator admitted he!,Ws,an inter- as he said, about ex-Senator Ben "The anee ingenuty, repeat- ansas, indicates y believe em t 12 God of love other 50 GolfmoiW might soon be a working Commu- nationalist-even bragied about it. ton's old charges against him, and ed Bush. this was exactly what the Eisen- The combined choirs of the l't 13 Unfamiliar 35 anded 51 .. -d nist Socialist political alliance. But. he said he was no "world "everything else." "Let me state that is the first shower administration did. Church o God on the Isthmu 20 Rin 18 Mimic property 5 Whether this ha pens or not the wonder. time I have ever heard the word wil present a musical program Dvias 21 Rat 37 Cereal rain 54 Miou pardner Communists control the dominant The gag around Washingtob was Secretary of Commerce Sinclair used in that way," replied Spark. ',7 ITALIAN TEAMSTERS at the Elks Club in Coon on 2 Health rasrt labor federatio--CGT-with some that Senator, Kfauver had flown Weeks is one of the most loyal man. Sunday at 2:30 .m. 3llrought. u4,500,000 workers. The French So. back to Washington in a transport of Harvard graduates. He's almost "Let me say to the senator from Teamster Dave Beck, rotund, The choirs Panama City 4 Son otS; I 10 cialists have over a million in their after his primary victory, havn a"professionalalumnus." Nobody Alabama that in saying that he dynamic head of the world's big- Rio Abajo, Colon and New Prov (Bib.) own federation. And 26 out of demonstrated that. man can't ever accuses him of letting old shows complete lack of famiar- guest union, paid a visit to the idence will join in the'singin o Half-em I every 100 French voters marked make it to the capital in a heli- school ties influence any of his ity with New England, because Italian equivalent of the Team-special numbers from a new Always their tallies for the Communist copter. It was a crack at Rep. government decisions, however. Yankee ingeuilty is something stars Union during a recent visit church hymnal recently put in r party i n the last big election. Add Sutton, who had campaigned by A- three men who are his with which everyone should be fa- to Rome. to service. olos. duets, trios, S male.deer t the Socialist vote to that and the helicopter. personal assistants and really run millar," said Se at or Bush He found independent labor un- quartets and orations will also tal industrial strength of both labor Hauling Wisconsin's Sen. Joseph are all Yale graduates. proudly. ions, which were iet back under be heard. federationsl, and you get the power R. McCarthy before the Watkins- They are William S. Kilborne, Jr., To which Sparkman answered, Mussolini, still in relative infancy, The new hymnal is a rare nrek etr of! i the left, much of which is anti- Johnson committee to answer the J B. Allen Rowland and Richard, L. "But I wasn't paying an atten- with only 25,000 members in the compilation of the newest songs ne U.S. right now, charges made against him by Sen- Hall. tion to the word ingenueu .'" FederazionleItalians Lavoratorila in o ten son mplement In Italy, the Communist labor Trasporti Ausiliari del Traffico, the Church of GodC federationhasover3,000,000nem- which is usually abbreviated to The combined. choir will be 38 Split asunder ers while the largest anti-Com- FILTAT and which, translated, under the direction of Ormand m munist labor outfit has 1,000,000 means teamsters. Brewater, choirmaster of the Rio 41e itone by f and the outright Socialist labor ta lenieone reason for the weakness of Abajo Church. The Red. William b44 Bilmboo o bloe has a few hundred thousand. the non-Communist Teamsters is Livingston, superintendent of The non-Communist labor blocs, B I M that Moscow is spending $50,000,- the Church on ahe Isthmus; will S e despite the fact that they are pro- Mhd .IM 000 a year to organize Communistg s be the chairman and will giy. U. 8., are nevertheless Socialist unions in Italy in opposition to the a biography of each hymn and umme o and the moment athe Soviets ap- middle-of-the-road unions. Another its author and composer. Ina ear to recede as a "threat," our --- reason is that FILTAT is so desti- Admission will'be by tickets, basi l be to A oeric The Fi ute that Gaetano Abate, its ha- which can 'be purchased from 4Larits basic distaste American 'cap- first Amendment: Nine e- Lindord ... James Dean (he's in Meanwhile T-Men, of the U. Bu tional secretary, has to hitch-hike any member of the Church of itaismp"loyes of the Voice of America "East of Eden") has Pier Angell's reau of Narcotics, are burning around he country when making UadIn Colon or at the Elks (CIub, IGrm thi w days for cooperating with e- Wa or (I mean the actor) in love 'slap,' and are openly declaring As a sign of friendship and co. sented to a large audience atPthe r Communist lobr federation--DGBate Investigating Committees! a and she's Aloeo Warthen the war. They point out that their operation, therefore Bek present-Pacific Service Center on Sua- i Communi strn g oo r f reaonder- (When was HST re-elected?) 2 year old president of one of his boss, Commr. Anslinger, was the ed Abte with a Fiat car. At the day, Aug. 8 at 2:30 p.m. antly anti-Sovietron a most justI fan clubs, and so you see, girls, first to call the play on what wae . as thoroughly socialist. The non- Names Make News: Ava Gard. sometimes it pays off. hapning. The bureau is h .DE- SAVE 0 BOND AND STOCK ORDERS :ncr--Who hit her? (She's loaded c Uffed by red tape, apathy aoda SIDLA CE By Colbroith The German unions" pour mil. They're action immature Nick former Ziff-Davis editor who pub. ad field work throughout the The Cable Code we use can greatly reduce Socialist Party (the Social Demo-lreally broke. Down to maylng twoe h historical novel entitled "our brave allies," the Narcotics the cost of transmitting orders.' For exam. Socialist government. This Social mblig huse, an 's J in Ama, p e e t a pie, "Buy 35 shares General Motors Com- may yet take power. And the sim- "CbnCidential" books) ... pWhither endo h buk t om to k ocrat's national cong m Berlin Sylvia Gable, I mean Lady Ashley, proved, is writing another bomb- men toc t the market, can be expres- on July 20 its leaders made some you should pardon me, will house shell called "The Losing Side," California, Here I Scram: Note Tddefinite -l noises. guest i Venice at the home of about the real significance of the to middle-aged Minnies: Jack Mul. s0ed in T O code words! O course, the United States importer Jacques Sarlie and Woolle Inglo-China deal ... Jack Lalt hall the silent screen star who not shove criticism. Nut when that' Donohue is sure to be close at called mystery writer Erle Stanley made your heart potter patter way criticism is based _on ,he Socialists'l hand ..Joanne Sweeny Pati.o Gardner the greatest living author back when, Is now the maitre d' at A I A U A H antipathy tor cap aiusm wel showed up incog on Rome's via an agree. Only trouble e the Sade Sirloin Retaurt A Las communism, it seems to me Venmta with dark hair, dark glasses doesn't turn out those Perry Mason San Fernando Valley The Mys- the time has c e to say to these and a tanned Englishman. They and Donaldc Lam thriller fast tery Gal in "Rear Window" (the labor federations abroad, and to say she's about to re-enter a clinic enough. (Note to Wm. Mrrow only show her back in the flm) is Members New York Stock Exchange their intellectual and cultural Unpredictable and fiery Anna Co.: Plea followup.) ... Aa Christine D'Arc c why friends in the U. S.: Magnani has a new love and it'sto readers: This deparent don't the give us all? Sh 14 Tivoli Avenue, Panama Phone 2-0074 What side are you on? Stand up the talk of the Italian film industry no connection with a a t of Monroes Katy Jurs 's and be counted! We know our sys He's an electrician she met while itr name ... Sep for Steve a ,Lana Turter's ex, ter is not peet, but we don't! making a movie. (They're still Meury is a hi unr e still at white heat .. Joan Blon. ... ...._..._ want it wiped out! Bluntly, we laughing at the story about how propaganda they feed ho a the dell is making the roids with want a capi t world-not a So- she andRossellini parted. He said dizzy-dome n. briht, Jeanings an Walter WanWi cialist world, even if it is anti- he was taking the dogs for a walk. breezy and in yet. taret .. dI 't bkI evth e S Soviet. You ay be nice people. He had hs bags packed at another e but on te hoo But we're beginain to differ on! hotel-told the desk not to disturb The Crime Cartel: A se ey structor at Arth r MurraUay's t some very b6&C hilosophy! her for two hours. Went to the air- meeting of the Grand Coauncil the Monica university of the dace i Srt and hopped a plane to fetch Aatio s being held in Las Vg med Dan Steecher! W it in the gid.) this week (prsided oawr b-gT oP. .- "'The Enaorcer" Accardo) Ito But Is It Cltmre: ir eeMoet Daily Worker, Don't Copy: House an ultimatom 4 mPe Mliat t t i theI Sad in the D.W. reads "D ly Work- American lenders tht the tsfa rd-Meat er urgently in need of good workt- ous iooale Sieliao get obe Am a e C e. SLAS i I a able typewriters. Any donationsout of Ith r te t or *i(t ral F b i reratly appreciated." Preume a flai"h h fiae the atchet io Ithey w ant "noiseless" for temany law id AmeluAno W orl S d-TV ot movement udrou P.S.'What Italian deseest wh ,j Akeihe hD b nend to ALer Biss' tpeo dkaeful : 4t% a Oema sNwritNr etlss l ' IWay of a ManA With M-i-: 'good" < A f the oa ar. wh would Iho e tof wt obut to 201a d B *That was Lieand Lndbergh, t and how naive efa you '? doesn't want to give 'em the asr. t il p se s I l a abu ace's youngest son, sipping eda faction). HB e A 1 it 1lbded1w`1-'t 1 'l t ) b M B ~- -. ... .... ,at 'ticks with teenager UIby lkina the GU 5A0 (At* *u ne I Co t m- -d aslw------- ( .tm *. ,JlAG TWO ~g;- - Yn~mn~v AUGUE 10.00 TE PAAM AMRCN-ANIDPNEN AL EWPFR Indided Osteo Innocence Of -Ie o CLEVLAND, o., Aug.19 (UP) -Dr. Samuel H. Sheppard, protest- . ing his innocence from a jail cell, waited today while his lawyers laid their strategy to fight the threat of the electric chair and police continued digging nto the young osteopoth's past to further substantiate the prosecu t I o n's first degree murder indictment a- lanst trim in the Independence Day killing of his pregnant wife, Marilyan. His attorneys William Corrigan and Fred Garmone, indicated tney would try to have bond set for him when he is arraigned tomor. row, However, this has rarely been granted under Ohio law. It also was indicated they might move for a change of venue, claiming that public opinion bar been inflamed here against the 30-year-old osteopath. Common Pleas Judge Art h u r Day, before whom Dr. Sheppard will be arraigned to enter a plea of innocent, said that barring a delay the case would come before the next term of court, probably Oct. 1. While the legal planning pro- ceeded, Police Chief Frank Story revealed that police in Los Ange- les had taken statements from two women there, one of whom claim- ed "several intimacies" with Dr. Sheppard and the other sa.in he suggested marriage, identified on- ly as "Dottie" and "Margaret." These were the third and fourth women linked to Dr. Sheppard. The first, Miss Susan Hoyes, 24, a laboratory technician, who ad- Radio Programs IHOG-840 Your Community Station (Telephone: 3-30) ) Where 100,80e People Meet SI Presents Today, Thursday, Aug. 19 P.M. : 15-Freddy Martin Show 3:30-Muic For Thursday 4:00-Feature Review: L U I S ARCARAZ AND HIS OR- CHESTRA 4:30-What's Your Favorite (Requests-please phone before 4:00) 5 :30-News 5:35-What's Your Fav orite (cont'd) 6: 15-BLUE RIBBON SPORTS REVIEW 6 UL)is^ path Protests Wife Murder I- mitted intimacies with him in Los Angeles earlier this year while his 31-year-old wife was visiting friends in Monterey, Calif., was given permission by the prosecu- r's office today to leave this area. She promised to return when needed. The indictment, which charged that Dr. Sheppard did "...unlaw- fully, purposely and of deliberate and premeditated malice kill Mari- lyn Sheppard" was voted upon by a six man, nine woman grand jury late Tuesday. He was arrest- ed shortly afterward at the home of his father, Dr. Richard Shep- pard. Dr. Sheppard today relea s e d through his brother, Dr. Stephen Sheppard, a lengthy statement on which he had been working since he was first jailed July 30 on a first degree murder warrant. In the statement, he protested his innocence and "undying love" for his brutally murdered wife. He criticized Cleveland police- who took over the case a month ago at the behest of the council in suburban Bay Village- for seem- ing "...to have made ,up their minds that I committed the crime and concentrated in solving the crime by securing a confession from me.", He also said that since July 30 "I have learned that the timing of my arrest and the reason I was held uncommunicado from my attorneys was because someone had the idea I was addicted to dope and all that had to be done to solve the crime and get a con- fession from me was to hold me until the craving for dope would break me down." Detective Chief James McAr- thur said "we have a good case to present to court." Asst. County Prosecutor John J. Mahon said since the indictment was for first degree murder "the people of Ohio will probably de- mand the death penalty." Executions in Ohio are carried out in the electric chair. A&P Food Stores Cut Coffee Prices 10 Cents A Pound NEW YORK, Aug. 19 (UP) A&P food stores cut coffee pr: es 10 cents a pound today as co fee futures dropped two cents pound for the third consecutive day. Company spokesmen here as the cut would become effect tomorrow morning in A&P stoi "cross the nation. The cut would bring the pri aLwA,- N%"$AnUo1w I c) A&P officials said they war 7:30-Report From the USBA making the cut now although (VOA) wholesale price reductions would 8:00-Paris Star Time (RDF) not affect their buying for tw 8:30-Eliz a b eth an Theater to three weeks yet. The reduce (BBC) tion would apply to all there 9:00.-You Asked For It (Re- A&P brands Bokar, Red Cir quests-please phone be- cle and Eight O'Clock-a spokes fore 8:30) man said. 10:30-Nelson Eddy's Penthouse The A&P action was the firs Party nationwide coffee price reduce 11:0D--One Night Stand tion since futures prices begat 11:15-Serenade In Blue (USAF) plummeting at the beginning o 11:30-LUIS ARCARAZ AND HIS the week. Albert E. Ehlers, Inc ORCHESTRA an Eastern seaboard distributor 12-00-Sign Off cut its price 10 cents a pound ti TonTorrow, Friday, Aug. 2M $1.21 on the retail level Tuesday AM. But in Venezuela the Nationa 6:00-Sign On Alarm Clock Coffee Growers Assn. said thi Club (Requests please current drop in wholesale price: phone by 7:00) is "only temporary." A spokes 8:15-Church In The Wildwood man warned producers against 8:30-Musical Reveille "precipitate selling." 9:00--Baseball Today The association spokesman 9:10-News said the "abnormal" market sit 9:15-Sacred Heart program uation existing in recent weeks 9:30-As I See It resulted from the sale of the Co 10:00-JENNIFER'S JO UR N AL lomblan crop at prices below (Cutex and Odorono) those of Brazilian coffee for the -10:05-Off The Record (Requests first time in history. It also was -please phone before caused, he added, by the failure 9:30) of U.S. buyers to purchase in 11:00-News large lots, apparently hoping for 11:05-Off The Record (cont'd) further decreases. 11:30-Meet The Entertainer On the New York Coffee and 12:00-News Sugar Exchange, Santos "s" cof- P.M. fee futures dropped for the third 12:05-Lunchtime Melodies straight trading session to 74.j 12:30-Popular Music cents a pound. Industry spokes- 1:00-News men said the reductions were 1:15--Music Of Manhattan based on the devaluation of Bra- 1:30-Sons Of The Pioneers zillan currency. They also hoped 1:45--8ongs Of France (RDF) the lower prices would end con- 2:00-Date In Hollywood summer resistance which has cut 2:15-Singing Americans coffee sales 10 to 20 per cent un - 2:30-Tex Beneke Shdw der last year's levels. 2:45-Hank Snow And His Rain- bow Ranch Boys C o n f del n 3:00-Festival Of Waltzes Y. COnfidential 3:15-Sammy Kaye Show (Con 3:30-Music For Friday (Continued from Page 2) 4:00-Feature Review: LUIS socialists, collectivists and assort- ARCARA Z AND HIS OR ed egg-heads the majority anti- CHESTRA McCarthy, with a few right guys 4:30-What's Your Fa vorte(ike my Informant) as innocent (Requests-please Phone window dressing. before 4:00) R o ... .. 10--News a Calling the Rol l: Among- theof. 5: 5-What's Your FavorIte fiers of this "leading anti-Con- (VO td) pmunist Organization" are German 6:00-Guest Star (USTD) Arciniegas, whose recent book 6:15-BLUE RIBBON SPORTS praised the Red Guatemala re- 76:45-- ence From The March S i anser Jrhe eamber sho iner 7:00-NESCAFE ORGAN MEL- pundit of the eftiss (He played ODIES Svengali to Adial Stevenson's Tril- 7 -(VOA)R and perennial Moses of the Amer- 70 Rpt Prom The USA ican Fablans. The members in- (VG ) elude Daniel Bell, James T. Far- 8:00-Music By Roth rll, Milton R. Konvitz and S&M 8:30-Take It From Here (BBC) Levitas. all pro-socialist; George 9:00-You Asked For It (Re- S. Counts (Red "fronts" are his ue ts-"e phone be- hobby), Sidney Hook oftoall ore8) anti-anti and Richard Rove, the 10:30-Nelson Eddy's Penthouse apologist for pinks who brilliantly Party ."destroys" those who fight Com- 11:00-ondon Studio Recitalsmu for the New Yoer, Wel. (BDWiC) come Woltman. 11: ARCARAZ AND HISm __ ORCHETRA Our Town: That stunner with 12:00-Sign Off poducerNat Karson at Billy --- Red's Little Club was the new EplIMaStlm of Symbols Miss Universe. What a wonderful BBC-British Broadcasting Cor- universe! ... Little Mickey Roo- poration ney being approached to take over USAF-United States Air Force David Wayne's role in Sakai in UBN-United States Navy "Teahouse of the August Moon," USTD-United States Treasury sort hafs cup of tea ... The Department Mirror's inimitable Harry Harsh- rfield M his gags for the law- tmtem A icma L l 's Cd Francis (ACY PLAYINGQ-Down into the Persian Gulf, off Abu Dbabl, Iran, go these divers searching for oil. The underwater elevator which lowers them 250 feet below the surface is used fto more than transportation. When the sharks get playful, the divers enter the cage as a safety precaution. Republican Charges Party Bosses Blocking Power Contract Probe -4 - WASHINGTON Aug. 19 (UP)- Sen. William Langer (R-N.D.) charged yesterday that Senate Re- publican leaders are block ing funds for his proposed investiga- tion of the controversial Dixon- Yates power contract with the Atomic Energy Commission. Langer, chairman of the Senate monopoly subcommittee, echoed in part the statement of Democratic [i-.tionil C h air m a n Stephen A. Mitchell who claimed GOP lead- ers had bottled up funds for the inquiry. Mitchell also called the adminis- trotion's proposal to admit the private power combine into the Tennessee Valley area a "scan- dal." Despite l e a dership opposition, Langer said, he will press for the "fullest, most detailed, most through" inquiry into the contract. His subcommittee conducted brief hearings into the Dixon-Yates con. tract in July. Mitchell's charge touched off a political storm that reached the White House. He noted that one of President Eisenhower's c 1o s e friends, golfer Bobby Jones, is a director of the Southern Co., a member of the Dixon-Yates corn. words connected withithe contract. He defended Jones as a man of unexcelled character and expres- sed astonishment that his name had been brought into the contro- versy. SMitchell repeated in an address in Springfield, Ill., yesterday that the contract would cost the tax- payers 140 million dollars more than if the power 'came from the Tennessee Valley Authority. The contract provides that Dix- on-Yates build a steam plant at West Memphis, Ark., in an ar.- rangement for power at an AEC installation at Paducah, Ky. "Some people seem to think that because the President did this one - Vigo Post testimonial (where po- t liticians are made and broken) to Mayor Wagner at the Waldorf, n Oct. 2. One office-holder who took - the post's invitation too lightly s quickly found himself an ex. I-- } Confessions of a Cautious Cutle: e Hold him at arm's length and he'll s be putty in your hands. e dI USED l and REBUILT FURNITURE S- at - HX Household Exchange. N e W Coffee Tables with Mirror Top.. 19.00 Metal Desks ....... 35.00 Night Tables ....... 8.50 Double Beds, from.. 19.00 Kitchen Cabinets ... 25.00 In ner spring Mat- tresses ........... 39.00 Wardrobes with Mir- rors ............ 18.06 Sideboards ......... 18.00 Dressers with Mir- ror .............. 6.U Vanity and Stool ... 35.09 China Closets ...... 25.00 Youth Beds ........ 34.50 Children's Ward- robes ..........22." Also: REFRIGERATORS and GAS STOVES Use Your Cuentas Comer- eiales Credit Card for the Small Doin Payment. We Deliver. HOUSEHOLD EXCHANGE Tel.: 3-4011 41 National Avesue (Auto Mew) WE PAT CASHFOR YOUR OU UM3U 1.! himself, it shouldn't be questioned by anyone," Mitchell said. "I don't remember anyone giving that kind of consideration to Har- ry Truman when he was in the White House. "Maybe that's why they had the President do this one personally-I figuring he is so popular the press and the people wouldn't dare in- quire into the deal. "Because I want to see the facts brought out, the President called me a 'strange character,' Mitch- ell said. ! "But if I'm a strange character, this is a strange case with some mighty strange facts that need ex- plaining. All we want are the facts." The Dixon-Yates contract also helped touch off the recent histo- ric 13-day debate in the Senate when a provision authorizing it was inserted in the administration's hotly-disputed atomic energy bill. Langer said the Budget Bureau previously had agreed to supply details on the contract to his sub- committee. But he said "the Senate Repub- lican leadership" so for has block- ed passage of a resolution to provide more funds. r eolutln to give the group kM~teaM JWtJD isMaig en I~t'Se 3ts calendar. " Under the controversial contract, the AEC would buy 600,000 kilo- watts of power each year from the Dixon-Yates syndicate for de. livery into the TVA system. It would replace a like amount of power TVA would deliver to the atomic plant at Paducah. F o e s contend it is a device to admit private power into the TVA sys- tem. He Had To Eat FORT WORTH, Tex. -(UP)- John Harrisc came out of a store with an armloa( of groceries, only to find his car had been stolen while he shopped. Harrison car- ried the groceries home on foot-a two mile walk. I Car Owners FUEL PUMP give you the kind of Reliable Operation that you've been looking for. You get a liberal trade-in allowance on your old pump. PANAMA AUTO Ave. J. Fee. de la Ossa No. 45 TeL: 3-13A0 ____________________________ 5- McCarthy's Lawyer Claims He Refused Fee From Senate -0 WASHINGTON, Aug. 19 (UP)- Sen. Joseph R. McCarthy's per- sonal attorney disclosed today he has refused to accept a $10,000 fee provided by the Senate for repre- senting McCarthy before a spe- cial censure committee. Attorney Edward B. Williams said he felt it would be a "conflict of interest" for him to be paid by the same "tribunal" studying the charges against the Wisconsin Republican. Williams s a i d, "I wouldn't get Into thht box." Sim- ultaneously, E. Wallace C h a d- wick, new counsel of the censure committee, told a news confer- ence his 1947 praise of Ge n. George C. Marshall would "cer- tainly not" impede his work with the committee. Chadwick, a Republican mem- ber of the 80th Congress, praised Marshall in a May 7, 1947, House speech as "the one man in Amer- ica in whose wisdom, courage and proven confidence we all place the highest trust." One of the 46 charges against McCarthy which the committee will consider is that the senator made an "unwarranted attack" on Marshall in a 1951 Senate speech "without proof or other justification." The co m m tt e e hopes to get the hearings under- way Aug. 30. In still another development, Arthur V. Watk ins (R-Utah), chairman of the special commit- tee, notified the Radio TV Cor- respondents Assn. he believes the committee will stand by its order barring radio and television from the new McCarthy hearings. Watkins said he believed t he committee acted "in the best pub- lic interest." Williams said he was in Europe "when all the rhubarb came up about paying me" from the fund provided by the Senate. He said he made it clear upon his return that he would reject it. Williams said he would be in an "untenable position" if he were on the Senate payroll. It a lso would raise the question, he said, of whether he could afterwards take cases against the govern- ment because of the conflict of interest laws. Williams also announced t h at he rather than McCarthy, w ill cross-examine witnesses against the senator during the hearings. The committee ruled that either McCarthy or his attorney, but not both, could cross-examine witnes- ses. Chadwick, 70, a self -s t y I e d "country lawyer" from Chester, Pa.? said his speech in the House praising Marshall would "present no difficulty to me under any cir- cumstances." He said he believed McCarthy "would be glad to af- ford me the privilege of believing what I believe about General Marshall." Luis Arcaraz Playing at Hotel El Panama Luis Arcaraz whose orchestra Is famous not only for their American style, but for their Latin rhythms opened their en- gagement last night at the Ho- tel El Panama. Tonight and tomorrow night, they will play in the Salon Be- lla Vista, and during the week- end Carnavalito Saturday and Sunday they will play in the patio of Hotel El Panama. Queen Maritza and her gay court of young people will make their grand entrance to the strains of Arcaraz music on the nights of Carnavalito. Advt. TO Now you can fly direct to Mexico every sunday with only a few minute landln'g at San Jos6. LACSA flight leaving from Tocumen at 6.45 a. a. arriving Mexico at 3.00 p. m. (CST). VERY LOW RATES $ 105.25 ONE WAY $ 179.25 ROUND TRIP (up to 90 days) S 189.25 ROUND TRIP (up to -ne year) Make your reservations right now at the Pan Americas World Airways office or at any travel agency. BE SURE AND SPECIFY VIA LACSA GUARDIAN Y CIA., Ave. Just Aroemena and 2th Seetw 4 '-^ *i FRAULEIN- SERVICE LINE-Business boomed when a shrewd filling station owner in Deidesheim, Germany, hired three lovely Jrauleins to help "fill 'em up." Here the gals, on roller skates, head for a customer to wipe the windshied, dust the-upbolsteO and check the gas and oiL STERLING By WALLACE -A J~f W-h s14.00 6 piece Luncheon Setting Violet I - 'II. ic r.fA Apo S I CANAL ZONE I DELIVERY S. A. OUTBOARD-MOTORS FULL JEWELED POWER! Ball and Roller Bearing Throughout Standard and Racing Models 5-40 Horsepower ON DISPLAY NOW at our SHOW ROOMS ~__I ____j__;_r T B PANAMA AMERICAN AN. ID ENDWNT DALY NrrWEAlE PAGB I~ ~renrab~. rr~jnsr 1~1)M * n W .. .. .. ......- A BY OSWALD JACOBY Written for NEA Servlce b> %1 4 I' f 4*^ SCholera Epidemic SSpreading Through I Flooded Red China HONG KONG, Aug. 19 (UP) -Eludelinc cl.ara Wday was re- po tcd t'j be spreading through a- reas of China stricken by the Sworst Y~angize river flood in his- Lor%. 29 Tihe Naiitiialit *ratao news a- (nr-.,, ilifcial organ of the Na. tion;:.''i `tnistry of interior said it least 1000 cases of the disease 1 have l|lrn reported in Nanking a- lone, wilh more than 100 4ead. 7 Nankin. down river fi m the' 54 -flood de astaLrd Wuchang, Han- 1kow. Harnk3dn' area, is crowded wjith flood rclugees. Tatao said starvation threatens several of the densely-populated 'angtze cities hardest hit by the Hlood. s Hankow, its reports said has Less thnn 10 days' food on hand. s 'Tne floods have cut off the river traffic on which Hankow and oth.- or flooded cities normally depend, Sand have inundated il 1 local sources of supply. The biddli, v of to i i ys hand wa3 Tihe Communiist radio admitted ver) Rood, but that's nore than today that the flood situation is I'm willing la say fur tVc play. becoming worse rather than bet- S South's cpeidin hid oat t.-.o no ee. S tr,,'p showI bi!ane,-d distribu- tion., e .r) su:. topped, and a.1 Thousandd of ne w "'recruits" c f', cf 22 to 24 points. were reported by Red radio o c-:.h whh 10 points 1t high broadcasts to have ioincd the Ar. r '. -knew t!,aL the combined my cf 190,000 men women and chil.l tount was fitnt 32 tu 24 points. dren already working on the .Ien though 31 points i.s usually Yangtze river dykes. needed for a s.iam, Notth hoped tl.at his '::e card suit and his two Aceg WOlilJ he kood enough mna., D| ga |m|g Serial fur t.h sin. Russian Cruiser V'W*rt opened the deuce of clubs, pw ens Slisely dec!in:ng to lead away n r A onim any high card,. r ,c!nrer saw * S hat he had II tries in high cards and that he could rma:e his slam II a Contract if any finesse succeeded. 1DutchCo av T After some inuight, dcciarer won Se first trick in dummy and fin. DELFZIJL, Holland, Aug. 19 - e sed tih queen of hearts. This (UP) -A report from a Dutch lost, to the king, and back came captain said today a Russian another club. South ran the restI cruiser fired several shots In the of the clubs, ending in dummy, direction of his little 400 ton coast- and wonderirl whether to finesse ler for no apparent reason in the the ten of hearts or try the finesse Gulf of Finland. of the queen of spades. He finally decidedd to finesse the The coaster's captain H. Pick queen spades on the theory that reported the attack in a letter re- East was likely to have one of the celved by the small ship's owner, two missing kings. This finesse S. R. Eisdow, in DelfzijI, northern I lost also, and South was set at Holland, today. his slam contract. The coaster Dora sighted the The contract was, of course, ice Russian cruiser "Iwan" last Mon- S cold with proper play. Declarer day on steaming into the Finnish S should run all four clubs to begin gulf. a with, discardin the low spade from his hand. He then takes two The cruiser approached a n d diamonds, with the king and the suddenly fired several shots in the S( nine, thus stripping ou all the direction of the "Dora," Capt. clubs and diamonds from the two Pick wrote. defenders' hands. Piek and his six-man c r e w, Having thus set the stage. De- fearing they had entrered a for. Leads a low heart from the bidden zone, stope/ei ship. find nesses the ten. South i The wan stopp and JBb cu' whether .jb.kceaae fir*i, tie [P id. ed'to return a heart or again. p Zither return gives de. I r a free finesse for his Again the Doro stopped, the I- Jkwejfth trick, wan following her example. Piek said he waited for some Too Friendly time, but the Russians, took no FORT WORTH, Tex. (UP) I furtherr action. Finally, Piek Patrolman Jack kagle finally got said, he sailed on and the cruis- tired of a brown shaggy dog meet- er suddenly changed course and flg him at the same corner every disappeared. morning and following him as he Picks letter did not report - made his rounds on his motorcy- whether the Dora was hit, Eissens - owe. Eagle "arrested" the dog and said. took it to the pound. s s The Dora, has no radio-equip- Wrong Team ment, either, he said, but was MIDDLETOWN, Conn. --(UP)- heading toward a Scottish port en Abbott and Costello were patients route from Lovisa. In the same room at Middlesex A government spokesman said . Memorial hospital. However, it the Dutch government was awat- wasn't the famous comedy team. ing a formal report from the cap- The patients were Timothy Abbott, tain to a Dutch consular official at - 8, slnd William Costello, 6, who had the ship's next port of call before tonsil trouble, starting an investigation. -w THE STORY OF MARTHA WAYNE Pointed UNITED FRUIT COMPANY Great White Fleet Arrives New Orleans Service Cristobal S.S. "MARNA" ................................. Aug. 20 *S.S. "VERAGUA" .................. ........... Aug. 21 *S.S. "ESPARTA" ................................Aug. 21 *S.S. "CHIRIQUI" ................................Aug. 22 *S.S. "TALAMANCA" ............................Aug. 28 *S.S. "QUIRIGUA" .............................Sept. 4 *Handllus Refraerated Chilled and General Cargo New York Service Arrive Cristobal S.S. "MAJORKA" ...............................Aug. 22 S.S. "COMAYAGUA" ............................Aug. Lo sAngeles and San Francisco ..........$270.00 To Seattle .................................. 36.00 News TZEX HIS FRIENDS Oh, Is That All? , BY MERIL BLOSSwn ./- BY EDGAR MARTIN SOta S k.HESTHMcC04 .w p %asc4. 4% .1 -7EN /^ 0%^%Sl IK4 T/g M\VLl5t\LH so)( OFF. 1 OC, L im. Nice Boy BY LESLIE TURNER PFISCILLy4'S POP IT WAS REALLY SBE AUTIFUL ON THE TLAKY' TODAY' <. I', ..^ Weasel's Angle BY MICHAEL O'MALLE2 OUT OUR WAY BT 31. WILLIAMB V -. yBY~*"l- ~~r- ~~i~,.*. -t .OKTH 49 W73 A 109 5 2 6AQ 106 .EST EAST AK543 6Ji)68 VKJ 2 9865 *67 *63 l7 532 48S4 SOUTH (D) 4AQG SA Q 10 KQJ 4 K J9 .rth-South vul. Seath IVet North ga 2 N T. Past 6 N.T. Pa Pass Pass Opening lead-4- 2 I I 40 '*1 / --,461-- L Oft. Living It Up BY V. T. HAMLIR ci * PAOZ FOPW STsaw pr--ulLeET it. ,U DATY, AUOUST IM4 TMI PANAMA AMERICAN AM INDEPEND ET DAILY MrWPAAPR - SAT. AG T 1. 154 ANA .AMA M ICAN AN DEPEND DAILY NEWSPAPER .- PA I SiOth i W e ... House Votes To Strip r aa Se i O ;--- Alger0 Hss Of Penstont ..' |Brt MBR. MURIEL LAWRENCE conscious of a flaw In our char-. -- o -- P doi t ta actor. WASHINGTON, Aug. It-(UP) forei hs the most exasperating habit of action to express our anger. We h umm of important muist Pat Ss 2.0740 0741 &0 I no ht gl you call he. angrily tidy the child's meomie bills in an effort to adjourn by The anti-Cmmunist bill was re 1 i *& ms .-.. h BSe dawdles interminably over books. We angrily clatter dishes tonight or tomorrow. rred t Conferenc cr mite . ... ad s. .. .. "' "To aPrk Ms ,any ehore,, ou give tog snwe.m t e d a 'ouminimum We delay.y re-.-..1. able" 5SUM can ". fo td anymore giveher. I her about in sink. We angrily re Already nearly three weeks be- by the House Tuesday Buth arase ,s / rthe tn'she' s semble the newspaper o h usbaninid ter original adjournment Senate delayed consideration o A aL --...b + sto tidy her rp t lteof oe as asesattered aonte o a r. .nam Children's TOYS W1wD fMJ aT GKOs, she never e O tee i P a rget dSaSte, .theHouse andSena tdetmeasure by dechnng todn i sh never "answers FOR theseactionsappear ......edoff its conferees until more accept- t S r F B f. i, Merr Ho o Enelia P ark, Mh re 1 ba. .L *, thoughatheywermotivated by mnmum of delayed Congressmen able" language can be found t th U t la, hae anoanacsld he element thTr auhtar, Mi t Two of Was n's t as she' tares at you, inn virtues like orderliness, duty Andare anxious oge hoe an start sOther conference commit t e e s from $2.95 n1 .Wi Pswmf ne Hag:ntsc Thtoseir, doug In imaginir g ourselves a s oThe use cmeg teh t ntahey er ReaE i 7itdth *?M Ce relu O hio. io s ot rad 1. moma i Whether orfi ot I itr1&satisfaction that you want to slap flawless character. th Honal acston mlan e ottedlonge r, Htheirega infa s thcfor g of that cY ae hono to be adations to aer W to plore yegust h3l. face D on e ai g ta we rome ra thconehpot orthe teapot at a Greta's mother never tells her h h ho f fed H aoulse aen ie s to an en dumped in the ust U p ime ivtatlon.Shewolbsend Belamrs- Paffee, o.e ninof yors exp kes us t a. Comnits n tLO cODGE A 80 Bb irld DrIV Sacionl with he laments i of k. a fdtder Coping ta tioi oru afte rnoon tea. ta she feels like hs e yo mother dawdled as stubborn- tha fe d deal 2-pe na3si tau ruh. of te s l mn o m pe her ge so ul mi a a a Oh r haen s her w child. Adults often do. fdera elose Without msomeunexpectedesn s A"'trainingtIn W lio, Deawarehontoined the .ura-"-and. ore .thaot. ds as....ed- NOt the woman, whose husband sakt angrily begins to tidy They will, for example using teas-, intde fiffel andmhntsortis com inuteo flar-upC on ilia, on p at F. Clyton. always be asked to sert the cof Her refusal to declare her anger dcis ons for children. I the meht asuH st"rongy support- or Saturday at trehe latest. Some efarc 2 yean old. Sas a d8gt. rlf- dence in Dabln ts as a fare fee with the tea pouring being in clear, unmistakable words at They will dawdle interminably out of ea raion leaders, however, looked for ad Altug ,Ais st 26 atvwe arty to Mis, arara Shaw lefd to the wife of the man of lower counts for Greta's stubbornness. It over making a little sister return out of moves to crctek D on ament tenightbafter Congress Jus t h street Slm. a Ftoe for the wed- of merst, Massachusetts, who rank. Is the child's reply to the language the new rl necklace of an oldemploye, who servi a pr the admini passing both RA Sbe at t. Cla has been their house guest for a of martyred action. er one. the olderone slaps the term forperjuryfor enng th aistrats rm an No. Tll Avenue month, and to welcome Mr. and As one who has poured both tia ASthe adult cannot say, "This little one, they will dawdle over, he fed government secrets to the I oervadno w a on b at a ena a t w eloet M ew and coffee, theog not in W as. dawdling of yours makes so th penalty she's to p thCommunists S- .ockett of Nw ington I would lke to point- out to'ang 1feellikslappiSo 0M.bet all friendsVthe Yokwhoe herea fr e asort te eeyrts u S ohI a b dw d is a ew tine r Other developments: $1,071,- O bot. NO honor to be, asked to podr I want to make you angry Denied Greta's mother. Though she's out. ri d hbo autho- tn who is .ot, ors Hon enls 0 fo'either e expression of words, the child grown theoters it used toemakend ve an ar. e LLetoves d ShaborAN .h lea ne dy th still s ighs over triation bill ad srent t the CIt 00 L 0 F D A CSH O nanr Vie, Newt Ahucinolde an Anror has orf...There yoursit in a straight chair resentments in the language of inste f being honest about the signature i Haven, Ctin onnecticut, a nd ready to smile sweetly, but -not passive resistingaction.anger it arous n her. 2. e or the i Mis 1 oa Forbes too each wom y eCncGt'go Mth uabse t. The Senate completed con- REOPENIN ST B 7t Miss Forbes who s in Frances Sappington of Philadel- tooes y ew oan o it, "t mo tyl Ce gressional action on a co n.prom StheUniversity hi, Pennsylvania, arrived in Pa. reac hes your elbo nd nds defin e herself as an angry er- ise $1,69,000,000 supplemental ap- Registration or, Colora o, will arrive y staying at the Hbtel El Panam efee. ell, to put our anger at some- of federal agenees through the Cld Edwin= jin Cnaaso on .Gon d Heih been you ,one proriations bhitoeo cr asor .he Ar' .., plane totn rror. She spend Colonel and Mrs. Paul Colby of hte g one into words exposes us unmise. W tch entra isagnu en e r n BAeBOA LODGE B ort vacation ith her parents a a I You're missing the party. You takably. It forces us to acknow-I w crrResidence phone 2-233 Mr. and Mrs. Forbes, San honor on Tuesday eveninat feel the need of a cup of that cof- ledge and name what we feel. It 3. The Senate approved and sent Jua Place, Ancon. Albrook Air Force Base fee yourself, but you know means tht e have to become o the House a btoncrease the C.i lu b.can't have an until every o er Of. distinction lending auth rity of the Commodi- ters. ki Entertains Mrs. Eng, and io guest is serve dit di et Credit Cop fro m 8% billi- NO*r .er Da lter te rn gs o Mrs. ea dollars to 10 million. f Te extra-t former athan Within .entertained wr w tnuhts Mr. And if you pouetnr coffee, or otearnfpg olar llon. T he extra- g Aew U Wtine t oa, Coby on Tuesday at the Tivoi w so oth we lo o funds are needed for price sup- s B r aye~ yesterday, at her home in PGuest HoUse.f a lat to 200 women, 199 of them will MAKt pIc port loans to farmers. inho norGuhermot e stayoondsat bare imneededfpa ier. s n hon of her mother Lst evening, Mr. and Mrs. Guy say, "Doesn't the table look love 4. The House passed and sent aro Nuts Schuchait, of Lewis- Canavagglo of Golf Heights were ly? Such a charming flower ar to the White House for the Pres- bnrg West Virnit and in hon- hosts for a dinner in honor of wra h cement. yugfr evident's signature the administra- ttor her da o m whe*one Mrs. English and Miss Huntington at' what ou t for conver" tion's lill to extend the unemply- -1 nmarrige is plnned for the lat which included Captain and M rs.sation, when if you hadn't been Emeon comp ensation program to 4 terFpartidAugust.a Wila m asked to pour youmit enecomreesbI pgmo M tg at e teo were the aCroni, and Colonel and orne wh a i end sa g million moretworkers.deThe bill A CRIPPL e ea a tahete a wre thenda qu Mrs. Paul Colby.aout eof wthe a cndorner of your mouth: brings virtually all federal civil- - Alex Toutssiheb, Albert Abadi, h was given by Mr. and Mrs. Salva- "How soon do you think we c t Both branches of Condr grea a froed Kaduro David ten z eur, t ore eept out of here?"s Botbancso C ss a w haye idaobnSa o Ripoll of Panama last eve- n you get right down to It, passed batch of minor bill n Mary Wl. .Eugene, David F. D o ~(Continued on Page 7) there is little honor for anyone t the bac dimient y t e Castro Nathan Sh Herbe.rt invited to a big tea. ts important House Senate confer- S a orand Edwin cGinnis. It means ryou have to get dress. | pnce committees. rme a oth n h eup; drag d y out your te ms G e I The three groups are working Farmer ulk Taylor And Husbam d a d fc nanciesty hat, ark three ubo 1 T It a o n compromise versions of the B Mr. and lMrs. Roger Walker ing the whole afliar, and smile at a family dinner and the man A of South Portland, Me., have an- at a lot of people you never see of the house serving the bounced the birth on July 30 of except at teas. plates, the guest who tells him their first child, a son Richard Just what to put on the plate and. Taylor Walker Mrs. Walker is the oyal Ri ngGeorge All you've been asked to do zIs to how uch Is anything but Ye wi d o forer -Ruth Catherine TaylZor who Lodge lMeets Tonight be the "stage setting" for some charming.. adse daeanl attended B High Schoo. 17 will hol special meeting to impress with how many charm what is served and says nothing. O M EG A 'Mosgrandparentsare Mr.0atIsrea pesheknows. wlv n iA ull tontt at" 7!3gpattareguldr and rs. Richard G. Taylorlong- mee1npae rut at least if you're just aguestsreinai time residents of the zone who Matters of importance will be guest you can sneak out the m Geneva designers have planned now make their home at Kenne- discI teld.g ute you've finished your iupn COME TO 'the now Omesg Collection in bunk Pond, Alfred, Maine. tea anemic looking little sandwich, SBefore Mr. Tayor' retirement Dr. Elnsema Will Address decorated cupcake. which every woman of distinct High Crysl he was head at the mure RNaturaluHistory ddres MndORRdtd k1ltion will find her heart's desire: am&mAILe0ear1Chael.ost ly Jweel ediyeteTnh Ahe rm aIn M o ldAs.Dr. M isenmanbe visits the Isthmus Maets r n r 44a. c r s 1 everylin Club will have t heo study bir regular N W O1tfcean o Wil Kam Edwin Wilson, theMthree- .t n Atn it Sembers and guests are Invited, wMek-olladns ove Dance end the meeting.lines strike which To preaAR N SE A. tdwin WIlsou of Anconw Ma rli Club baptizeold oSnd Richard Mulhol-i unleTohs a settlement reached 0 o / home Sacred Heart ChadaY evening meeg ToToUhd A esd .refreshing Shs Meyers, Margaret Rastet-of the Panama M alk over their new strikerend- utel e or iu have their regular WASHINGTON, Au. 19 (P) It comes handy for Lte, Dr the parents enter, Rinedthar dinner andRas- meeting at Feder proposal mediators borh the strdown washing your car, dHE WORLD HAS LEANO Prte, Na Brennan,'the 20-day old American AB-gardeall Tharp, FLY KM TO JMue eyGoleds, David McNey and Other union rethresentatives, l MbTeiss. m Kathy Mulhond Michael to spreanwhile, met wnitedh Unitedrline Return from Tripn Ail es officials in Denver r ALL *W EVV S X-V C ( 3 221 Retars from Trip la over the scheduling of a non-.1 Terry Ford, son of Mr. and Mrs. stop cross country flight, the Many lights weekly from PANAMA Terenre Fordo of ell Vista, and same issue which led 'to the ^ mas wuse nest Peter Haseeret of American walkout. e Choice of Super Constellation or DC-.B DELICIOUS FLAVORS i Lewiston, New York, retu r n ed T Do uxe or Tourist class served yesterday by planeafter a four The pilots association asked De le or Tourist cla service e on-Umor pe Chery esp y w day tour of the San Bas Isands. United to drop its single west- Northern or Southern route Acco any themwere: Mr. bound non stop flight from F full inflmaio see PeterA is erenie Con NewYork to oLstAngeles, con-! For fcl aet gen Millions and Milliona love nei,.Mr.Wam Conner, Mr. Van tending that It elceeds eight or Seoav tAereos, t .A.an Mr Mis ete Mpy and hours of continuous flying and No. 1 ei Avenue .. and wll too I Mr.A4m Stuhler. Is therefore unsafe. Tel. -2I331.-a Fa Lukas WA union spokesman denied woo's .m Nr4? icardo Arias, son of Mr. StAmr is A WGWI in Chicago yesterday that the a P.'. Samuel Lewis, who left IsATTEB ia ,Gms ". ramy pilots were threatening to strike ree y for New York, en route to ieteesat CehlmdastM.l 5. N. United too. zrwas honored with a fare- .me ofBa ry, X d is w-lumcheon given by Terry Fordr6o nwh fAWnd Ill8 kIiI1 But the United pilots voted 1 I K i Sreidene in Bea Vta. lon with the American pilots Sfor 216MI n traf sdutlic o earlier this month, to strike on K LM c Marla AM ~~El ertalm A aam paM l la toN O" the same Isue If necessary. tOYALDUF"H C-l-andMrs. SElmer G.'Ab. -b' L -should the trick Sprea d, IAIR S bot e0trtalsd at ai "at Rme" Swould mean a shutdown of the yesterday evening attheir resi nation's two largest airlines. S"The Young Look that .....--.+ expresses.. .--... atMOTTA'S New arrivals in FROCKS .f or alocr c as i ons. . the fabrics, ones you e. ... VEGETABLES AND FRUITS a me everything's young and newF! ...... on- n' to. sonLSam h ,m'-,; *dterr. i. .. l.... .sB |. G Gacunoda " .... = S = I wi .f .s-Whe p.s Win epow w o i4 aNAlra'wb0f0i4 PR0TE , ------*-------*-------"w '----*" *-- .us.... aM ,.ur. M - puddias-.oe-okit mm so m pffl SP., *H I -Y m ... ,-. ; , T-k.. -1 7 -. "m 9'7 ratj S PANAMA AMERICAN AN INDEPENDENT DAIT MIEWSPAPER THBUBDAY. AUGUST 1 1 is I.., EDW sa "t-o If clubs tiOn. 44th et Nf ,' t.. liO4 ar -" .A.V? ils Tehon .OR SALE IFOR RENT: -- Modern apartments, ca r i band, President Dwight Eisenhower, registers at the Br xte Furnished or unfushed. .349. B prevously losed the re- street headquarters f the New York County Bard of elections. I TCELLANEOUS rRe Etate oomR ,OB 0 0 E N meant himself. to vote In the November balloting. S I CFA S Re EstateOR RENT:-Apartment: Two bed FOR RENT:-Room, furnished, Forth -dit An Army spokesman said rooms, two services, two bathroomsAn Armys pesman mwai i S|WT#ATU Reconditionineoand FOR SALE :- Only $300 down pay- hot water, completely furnished or o Avnue O A ap hi b f Admil R de Cahina PnnsAetwa Reupholstering Furniture Advice in ment Pueblo Nuevo lot with light unfurnished. Ave. Cuba No. 58. balcony, small dlnlngroom & kitch- routine" and In no way & result cPuebloNuevolotwithligt un5urnishe9.Ave.Cuba .of the AMY-McCarthy hengL Red China Admils Red China Pardons iInterior Decorating. Call EUREKA, and water, 631 meters $1 :75 per Tels.: 2-1227 3-3329. enette, screened. Suitable for one o y h nI 2-4632. meter. PATTERSON. 2-2346. or 3tw persons, $65. Tel. 2-4912 MNirT e s t. He d Zwiker hadobenin thisP ar Criminols ED INSURANCE? Hospital Auto FOR SALE: Wonderful farm, near P w due for reas ment. Mrine Life available. Call Hatten, Campanao. two large concrete hous- FOR N FOR RENT: Nicely furnished big l In a prelude to the Army-Mc-. TOKYOB Aug. 19 (Wr) -CC- 3-3323. es, four acres on highway, with riv- room, private bath. Near Hotel El Carthy hearings, Army Secretary 1lei i a|la munlst China prdoned 41 PIANO TUNING done by Sidney E. *r, swimming pool. $1,500 down; HouS an. 1782, -1693 voailble. Call a- Robert T. Stevens accused Sen. Srtg g Japanese war criminals today in S.6O- ORRENT:-Two-bedroomchJoeph R. sMcCarthy of "abusing a gesture believed to be part of lms. Workmnshp d uary. ntee prIce $6,50. BPATTERSON, 2- FOR RENT:a5Two-bedrom chalet ino. 48. FOR RENT: Lare well furnished Zwlcker in secret hearings. LONDON. Aug. 19 ( UP)-Com- current peace offensive against Tel. 1713. room for 2 gentlemen or ladies, tmunist China provoked angry Japan FOR SALE:-REAL BARGAIN! Con-. close to bus-stop. Private entrance British denials today with an Radio Pe pla reported thi US Red Chinese Crete block house and 4000 meters FOR RENT:-3-bedroom chalet, ga- screened, quiet, private bathroom. 6 C pai ing. aohi e POWs tonishingly bland declaration amnesty or er. at Gorgono for $2,000. RUSH. rage, maid's room. Suitable for of- Can be seen anytime No. 34, 46th that British ships are hauling The 417.W.re presumed to be (Cestinued from FPa 1) PATTERSON, 2-2346, Panama. fice or store. 32nd Street and Jus- Street, Bello Vista. II re strategic cargo from other West part of abQat18,000former.Jap- to Arosemeno. Phone 3-4332 or European countries to Red Chi- anese servicemen convicted as ntrtlon wanted to "de- FOR SALE:-UNBELIEVABLE! $750 _3-0790._ Wanted Position SPRINGFIELD, I., Aug. 19 na despite the West', trade em- wl l and i held by aslse" the action, down, $40 monthly, large house, (UP)-AdlaI E. Stevenson cuebaro. Re lo]yment plans call fr the four rooms upstairs, four down- WANTED--Positionas,mold by En.- ed Preldent Eise eson' a ter. Exchag .chnese trade omfichal Lu 8hu liMMent of at least ree. Of stairs, 1000 meters, Pedregal. ll A lish-speaking Panonian girl. Call dYof put -ty expediey a- Chang calmly told reporters ac- China. "Oh, Mr. Lul The thn ons to such .. PA- PATTERSON, 22346. Fort Clayton 6139. hove e at pedin eye a- encompanying former British La y headlined aon' l^e SAL- BARGN!Only $.m0 Indoclhnl, 19 bar Prime Minister Clement Att- you sy LonolDas SOkilla",J n FOR SALEf B A I KOny i gpi Kld Help Wonted fS. Sen:a to^riaT ^l ^o Brshoclalsantni dcned Othree__bFO edroon Ams.yfveMeeke S. sehatorlal candidate, Joseph T. ist Indochinese prisoners of were helpvX bring steel, other BrtIsh officials anrily denied while, .8. military off PATTERON 234 I7,500. WANTED: Nursemaid. r box the French made a break for metfs. ac rye and heavy that there was any. laness 'in lrerted no fresh evidence unldngn Apt. No. 1,* Front nd 5th eson the 1 Dem a freedom today to escape return equlpmeaneM from Frae. rel- sh stratgi controls. One e Chinelay to carry Street, Colon. reidential candidate, ad mair. to Red rule, reports from BWUal- u mW est eto.Reter bellgirent 'threats t CHICAGO, Auf19(P) ](UP)tgooEiseower gave h5" 'aw wlvr gon said. .... ton t-hed Formosa We offer the 3 best and Charles (Cherry ose ml WANTEDes to Meek even thou The reportwhi were not They said recent Red threats only available lota in Golf lion dollar extortioa~slat and one- odabt has cam e agrint e arme, sa break a this line appear to e eights Panama's most time kingpin of the Capone gang Automobiles ot o what the residentha place near aion as 2500 foI propaganda purposes. residential development, empire, was shot mnd klled in WANTED:--Good lidht sed,d good7 for America" t solds ean u t h r demunst la o nganglanLtd.d fashioner ina to 1950.tusbelr e ln. From wSteveson spo .in soe n o n tIoa for shipment north to Hal- t Ifthey Intend to 5th Street No. 22 His body was riddled by seven 3-660 Pol stateFair, ,.. -French and Communist au- th bullets, but police no one ddeat isenhower will speak tilay thoritles refused to make any drmoas. Tel. 2-388 who saw the Slaying had been lrA Hn w e tt republicann Day" activities. statement and It could not be thdra of more U.S. found. UDg ll n learned whe thprither e soldiers o 4 withdrawal of more U.a.___ J i g fund. t pl oil Meek will oppose Sen. Paul H. made a getaway. morap ofChicago' top pce officials D Douglas D-IU.) inwhat Iregard, h ePrisonerexchange was e administration plan Chicago' top plce office ed as a key Novembere etion i s ech as this country's armed would not make an immediate Wis n nips Nvme. .relc.tio going full blast. French spokes- II toamorrceomoblesr 'eA for r ei ., .n the s struggle for control -of men said 650 French Union Into -more mobile strik U WspeculationAll the Senate. lce n case of renewedoe's murder. However, it ap- A prisoners were repatriated by iunist aggression anywhere My 011 peLared certain he had been kill- 17 All Stevenson charged that Meek has the Communists yesterday in worldormr ed assassins poss- RVE Mass A 19 (U dited much of what te Pre exchange for 1,000 Red soldiers. dent Eisenhower gave theoW R* o e ia bly a trole for control of -Brazilian beauty Maria Mar- dent has said isgood for America" There was no d o that on the withdw s t the remnants o the Capone syn- tha Rocha, who was ruled out is campaign speeches. Brig. Gen. Christian de Cas- gas last Dec. 26 when two dicate. the running In the ,Mias Unt tries would be released today, SGuard divisions were verse contest on grounds h "It is with all respect that the ninth anniversary of Red ht home. Gloe, a-top figure in "Scarface hips were oversize, said today remind the President that he Lead er Ho Chihh Mnh's re t tie, he saod with- canh6hic.' gap when it doi- contest judges were misled by Xotoly his political part butS to power. ll tihe ,wo divisions wai tt en ahead in th uhowte. y trde. nated Chicago erme Inhe roar- statistics she herself had sup- cnatry, and that we vew with "initial step" and that as a mcanic makin a b o u t a s, w t to ja 1945 O plied. igivings such obvious' Mubird- ,gforces in fSouth Koreas m .ek o' g n mncrtsw~.0 charges of helping to extort $2.,- "None of the officials meas- nation of even his own view at A & P Food Slores be "progressively reduWed Wltn a== bee iwa.be- "'e 000,000 from the motion picture ured me," Miss Rocha. who came the national interest to party e. amstaices warrant." W Do you WAN? v. w industry" to the United States after win- pediency," Stevenson said. f 0 s f the end of the Korean: n.i.este- dw j0e a ning the title Miss Brazil. said: .l .8. military planners have; **i5*- : Three 9ther Capoae henchmen' "Only a lady friend of mine In Stevenson said President- wh r-owing concern on1 ,Stai r were lso sentenced to 10 years, Brazil measured me, and not hower should "make t A commitment of sizeablell 1*9 10 tW =-o r-but all four were paroled two very carefully." she said. "Shee liy-leasr" to GOpaP a P rlb- for to outhorea ~l c u tue years later. One of the four, Par:lP t my hi down as 38 inches that otheirb eampu10saen Per t. MUi E RWDt $-m wme radnm re on the Asatc AT n yor e (The Waiter) Ricca, has report-and I brought the measurements not. to sb sist s and W R.k A siatic !AT Hollim Yom mo aretirme you can aIedly been trying to regain dom-! she wrote down all the way ids. wSmUeand t,, r NEW YORK, Aug. 19'(iSPll bike esaIoh iicgsumen.mThBdras pl"a the area, however .u ~h inance of try Chicago under. rm ote down all the wa s ad thr (fee prices in A&P foodstores h ove lnd the bike wr albu e States ln to S ".carce. You Wonearn a"you world from its present reputed Miss Rocha wound up as run- "But I ha iw rdly-f r s the country dropped 10 tw eputs e. jtritg air en aasM l 'oPo toaegood, m.o own e a r leader, Tony Accardo. her-up in the Miss Universe e it a found today in the first na. Dweld ,, o .- atics y contest after officials ruled that .for =* sg hem i n dees n retl cfee .-o"t a l IT 38-inch hips were disproportion- th ears ad U e s prces on the New llinaB... B lt S. offitleLn 11 |101 t1an1= lShe arrived here and fri tores i ed this mom- to have tom him e a.~ A T OR social seiy, sl pound yes- belp. ra4herator. 1 r e .. IC ek sems to nA 4ce.ts a po1and. tnudn e relatives', m ams r t,.prvateeP d .ep r e d .. Tt h w AT TIe Ex S Si Nw sister, Mrs Maria Bernard.l w. Meer t ~-t a pound. x to .ut m t r eflbct fratore c.D OOR = ^ SaidMeek ee atlo Ir topped 4V estt a p=al d. " M ler ra sfrhsa." V 5 162"SB EXC "S coffeeutures tore C.L atim liv M. bUIL WA 4% cts a ound ra ovorinityawk X no Meekseess.- rAUE SIX A iMinimumi on God's Law Guides Man's Libe! MORBiSUN wim ul Av*m a s 10-foot embankment and over- .... ... th..at.. ... dep.e c. of .n.. THE PANAMA AMERICAN NOVYEDADEAATHIS A gun wh4ch l propelled-by though they did Manately th- we know. :,w FO rd YOU CANSALE FOR SALE FOR RENAD AT 14RESORTS COMMELOCALIRCIALS IN THE a Hoteshd A ombm ew__ Aa .mento, hNT 3b Uous t PROFESSIONAL d ou t e Zio- FOR SALE:-Used cars o rock bot- ATTNTION I. Just built mod 5 p.m ad, appeal unmaged. do h b to e to p FOR SALEZen e d om pces. PANAMA AUTO, S.A furnished apartments, wo rd- bf d s o A r.t-.' e t-'rea fo r i to e A Bt 820e Jo Frnsco de l s Avnu bedroom, hot, co wter. -Til. b Le a u Pote TankUPI -r U.ra,derric lacks iStht t Sraw ; end oa Our dependent s md* S.D No. 45IT phone POFtnOUtmwn 3.4941. ot__phoTOMONr myriadB of otheLr thinAWS though total,a are a p, end wlat CFOR SALE:-Westinghou Srerera2 d oo t o Ap nishedO ond 4-roomoen pt l. O nde coael Sn- t dent, twohir from the BanI- 1 w that gvem the prular goal how w nco IUPhon _2.355 _- ^ FOuRoc.SALE:aLea our i on._ Grd.. .ch Sane. Cloro Bech cottm s .tioff a r Germa road, i d down a p ea pro lo o st l or fI a doway ltotlmlGr on d gfrerm-whi FOR SALE: io Jly e.n I CSCrub u p O mechn 1 mFOR RENTak-Apmrtmetent and over- la. Cenl t tchflaroti dbe te dc- e tell aen bulS good cond4ton. 5Ju4-0 av" cal condPtAon. F. ICAZA Y CIA., tral TheAter building Central AvA ModeraC r Phon 6-441 tr u rAed l,,aghJn injuringofourr t he W ped di W.* Roda 4to_9 p m.e u Arosemena No. nue No. 141. Inquire Central TheI str 4-567 melSa of the gun crew. poral law, Ut the rult hs f I do I wl m imah thesdginis LFOR SALE: PSHAR MACYo-, ter, mangers office.ou "e.SHRAPMEL'S furnished ho. o us s on at o The'. dent oe urred yedter- eptrActp. od know Al-We and A-bet -la. 2 103 2 LA CurunduAia f. day. th Army maid, when the can a e a C re ator. who ot aws os - 2TE PANAMA AdME oIC AdN oO N NOVr DADes ATIEISwo gun which in, propelled by a though they didet i eo ih Street No. b7 ,d Ctruck fr ont and rear. attempted no exist. In whho o how we aen bet pe S $15 El... le. r| ""to J were t* omis a German pe- which "ae they tet eurselv add whe wil FOR SALE FOR SALE FOR RENT RESORTS dCOMM1ERCIALhn &. trsn ami trir.n the soldiers were Injured slightly sole, original price $395, selling July Avenueprces. PANAMAAUTO S.A., furnished apartments, Mabo Cbin inmero COOLCerroCompnter.Moun- Robert price $225. Address Betaa Jose Francisco de Io Ossa Avenue bedroom, hot, cold water.nished R ALg gg Tank*retrievers derrick, MoJacks E i wNo. 45. phone Panama 34941. ee OMu and other equipment were or- A LW tt r, His law are a reise ste OR SALErs $30tnghuse r285,Ager- F SALE:t--of mp Chevrolet 2-door, FOR RENT: -- FurnishedSALE:Suits nnd Pants. BEST- to tie ara of the acc-gover putiy i so there me rrg housegfromEPopeIChura- orols and a traper. Call 2-0181. centrally located, two bedrooms. IT d opetro har quafmh a- elst orn eol rilr ah the highest tradition Of the ci tar, 8.5 cubic feet, 25 cycles, 2 radio, good transportation. Apt. 6. nished 2 and 4-room mo, a amd tt e dernOcePansid heematohSwntadres ontiCfommunthrot yealosold1ur3n.,rBelbhe.p. 8043 U ility treePh on.QtAnbleBh45B Allra.eolreroan village of rdoO r MotenbuseC. The ,Thi-m- l I nom&avd t s ys 2150-D Curundu, Phone 83- .OR 9th Street. Colon. meno. Contact AlhEmbra rt- P b c U CTe an C rile CI a. At gnYe of 0otebockro ThTeThf Maj. Gen. Charles Laddetuin Dasher.n th e a Ancon. Phone NG reopening Sept. n 7th. Registry, Hermosa. Tel. 3-5229. FOR SALE:-Mole Boxer1951 4 months, Pae, Shipper one manOr IndisTiii Refrigerator. 25cycle, Packard. duty paid, radio, GOOD on.r Stered AKC ho ttne i r271..I 0e. S Asa to m hoy t e lopan good condition al n RICH tubeless Ltres, f olEeimeahan FOR RENT:-o14rnshFd-Apartment above Cen-MertefragesotPon e6_ i or'erial law.Be can Ignore theaaie Road, to 9 i cal condition. F. ICAZA e CIA., trial Theater building, Central h eAvesoe:ts-oo7n ANED:- Bo 35 to 45 feet vend Justo Arosemena No. I. nue N. 141. Inquire Central Tel- LOT SAL Pa WAHINGTON Aug. ( wP) FOR SALE: Norge refrigerator, P ephone Lombardo 3-0471ffice. A sole of merchandise will bt con. ---The Army yebrday formally o. Wrfl porcelain $125; portable FOR ALE:---ud on tOldsobilehe 26th of Au oustnced the reassignment to nderwBox 2873 Cristobol. Phone 1047. EXclubcoupe, excellent all-around FOR RENT:-Fu Modern two- Mdrom Corps beach at Santa Clara. Telephone N Ito I sfoolih. Cthn. to talkbout His, h 2103-ARTNER REQUIRED wit Curundu out ixpon, radio. Phone 34050 apartment, 51st Street No.4m apartmentss n.Un- B as lboa 1772., eve- [ O.any F. NOVEY W. a stormooe nrom the moral ker' n lo," d na C Complete dets lthou nishditionnotes- furnished. For further deptlycall n beings. Central Ave. 27Four a For example, "we a no rect A -PhilppineRattanset.er bound by the t o-thousgo stelves. Freedom lnigbs the cust FOR-SALE: -.- Rattan set. _____ Zubieta: 3-1802, 3-3337. FOSTER'S COTTAGES, one mile past Tel. 3-0144 4-strand, very good condition. Tel- FOR SALE:--1951 Pontiac-8 Station OSaTR CAr Load-yr-old law of raates.."freehh 7.22 after 4 p.m. Wagon w/rodc, post spot and fo FOR RENT: New three-bedroom Sant Clra. Low r tes. Phone The question Is not whether the help us to achev thee for one ...- light%. Macdonald 559-A, Curundu apartment, living and diningroom, CBalboa 2-1866. GO, Aug. 19 (UP) law a old, but whether It Is a which we have been created-. F"- SAL _---Mahogany desk and oa- Heights. Phone 83-2106. maid's room, hot water. Telephone FOR HEALTHFUL change of ctim9te, Learn Ballroom Dancing Four former sergeants will be law, eternal union with an AI-Lln ,ice chair $15. portable electric 3-2279. visit Club Campestre in El Valle.,atEl n o awarded the Army commenda- F OM 1 ualy defined God. nge sewing machine $40; Chi- Just 80 miles from Panama City.S tuHotel tion ribbon In a 5th Army cere- ILerg2'4;dOUremseFOR RENT:- 2-bedroom apartment, Ntudi. We willbe mony tomorrow for "insPir. .. rriture, very cheap; table silver, livingroom, diningroom, kitchen. .eil4ed from Au0. devotion to duty" while prison- rden tools. pioe vise, mechanic's laundryroom, maid's room with management. Inquire Tivoli Travel to Oet. 11. eraIof the.Communi.t..in.Korea. Brobathroom, garage Alberto Navarro Agency, 8 Tivoli Ave., Tel. 2-0461.!T ers of the Communists in Korea. d diesel; electriccfanr8"nlRa all Street No. 53, "El Congrejo." AT NEW GORGONA B'EACH rent tin use 620-, Ancon Boulevard, brook 4227. M llett's furnished cottage. 60onBwin Bbrl rbackkthe42are: Martin C2r.stenen, Liber- FOR RENT: Furnished Maparment.lats urish.tyville, JohnM.Lawson, ar gas station. FOR SSALEusble,2cou.6. Four B., lo 7oIByville,Il.:TOh MY.L o forc2ocouples.o63,AFourth a Oa 4n Paso Doble. Mambo, Gus- mero, Center. Colo., and Robert esidroom, livingroosetskitchen.M FOR RENT: One-room furnished Cha it Cba-Cha. F SAE: I fahogany chest of FOR SALE:-An 18-ft Icobin cruise Vista.e r e '43rd Streetrt inNo. 13. neOUThe tour men were cited by amowers $30. House 285, Ancon.' with two 25-hp. Johnson motors, --OiL0uiaPnBS the Departnt Of the Army for owefrs0omEpiscopeal Church. velocity of 28 mph, Spirometer, FOR RENT:-M ode r n apartment, FOR SALE:suitsnd Pants, BEST- "inspiring devotion to duty in iihuermpsplhr_.-- controls and a trailer. Call 2-0181. centrally located, two bedrooms. FIT, superior quality at very lo0 %.lIROPRACTuv te highest tradition of the sALE-WestinghoLise 60-cycleIYou con see it at 39th St. No. 26. Tel. 2-0480. p r ice s. "BESTFIT," Plaza Santa military service" for their lead- rigerotor, 8 5 cu. ft, freeze : An., Ponaml; I Ith Street, Colon. 11111112A.and.OL0 milership of anta i-Communist groups est, self defrosting, 4 month, old FOR'SALE"-7'2 -hp.o utboard. motor"(Palmer Gradutt) 00; large gas stove $20 s ht new in Aprnil $150; "T/z- FOR RENT:-Aportment: Living and FOR SALE:-Aeevwoed Ieourb, Spe.- OXCE HOURS: of prisoners In Korean POW 0 laneous furniture, cheap. Quar- hp. outboard motor used $75' Need diningroom, two bedrooms, garage. cial Club Reserve Sotch, Royel Sa--rdaynd I -2- a I.a Calrps. ls urnuhebia motor. Phone Qurry Heihts All screened. Calle Gerordo Ortega Moented Cenedien Whiskey.,. Reon s mI 9 v 1moe oen. a-sew T21.50-D Curundu, Phn 2293. No. 3 and Via Espa6a. one block Ceotex and C otl Club Gin. At eay (I block from Lr.ugTheatr) Maj. Gen. Charles L. Dasher, rS IOfrom Hotel El Panama. Information her or bedee. Yeou, r Dtllele. eJr., 5th Army deputy command- i ; hineset furniture..oher i In same building._ Necie l. 1--er, will present the awards. pearl. Tel. 3-3745.E O Ryears old. Party leaving for StatesB AX .neral iwicer .... .ES completely independent, garage 3-5227" Panama.- B A X T E R S .A . A N IT EDtto 45f eet, D ESE W AITES S VL OF DANC card Miro Street No. 52, Visstig n ed T J WANTED ING reopening Sept. 7th. Registra- Hermosa. Tel. 3-5229. FOR SALE:-Mole Boxer, 4 months, Packers, Shippers I~Iise'ImeoUStion 9:00 a.m. to 5:00 p.m., Aug. ---.... .--- at en gistered AKC. IPhone 12"-B. Movers. AT a MiSMlllneous 23rd 24th. Balboa Lodge Hall. FOR RENT:-_Furnished__apartment,_Colon_....... .. V#ANED:*- Boat, meters from Via Espofa. $50. Tel- LOT-1ID SALE Panama. WASHINGTON Aug. 10 (t)P) Itwin or single hull, with or without,,shon. Lombardo 3-0471. A soft of merchandise will be con. ,h [my [i dadfImll power. Write particulars to Brawn, Position Offered prucAted on the 26th of August, 1954. announced the reassignment to S 2873Cristobal.EXCELLENT POSITION available for FOR RENT:-Furnished & unfurnish- Mar., Corps Exchange, Rodmon Nov. LICORES "21" the Far East of Brig. Gen. Ralph A R T N E R fRE intIREDwting do experienced private secretary. Must ed 2 & 4-bedrobm apartments. Station. Bids will be accepted on eny ceter S ,21I W., a stor....nter In R E QU00 0 p it E D wor in t hr ng a bo ut b e sk killed in sh o rth a n d a n d typ in g C a n t a c t A lh a m b ra A p a rtm e n ts o n e, or all o f 4 lo ts u p to 2 5 th o f A e reu from 2 1 P eaHit i o s on t er In 420,000iCpItCle details ad: Greeting cords, articles of cloth- Otpee oMbbKlo g 55tte Complete dttat te-FORRENT:-UnfurnishedorpartlyInc.Jewelry,figurines, Xm11deq.or,1111 pl lineit ionsentiol. ApplI'P.O. Box 555 or tele- furnished, attractive modem.2.bed- tion s mecenlcql toys (d. dr--n -, -- fl ~W'RI3Y MTIS 9 9413PNM MRCN- i wSPNlN IPAL NESAE S * " " g illI ' CANrToLIuo -BANI ImoGT S...a CASHW SAt 5 9 p-m.. S', -* and S'oRgAI WirFE TIVOLI 8TAOBg SHOW At 0:00 p.m. LUIS & Orrch. Plus: - TWO ACTION rEATURFIl EDISON BANK NIGHT CASH PRIZE! Plus: - TWO EXCITING NEW. _____________- I Eu CENTRAL 1:15, 3:45, IS%, ge* PFriem. As. "The Command" 4 In WIrnercolor and in Al LUX TheatreI "THE MAD MAGICIAN" DRIVE-IN Plunder and Piracy In "THE ALASKA SEAS" Robert Ryan Jain Sterling SAT. SUN. MON. 'Thunder Over The Plains' with Randolph Scott CECI L-I A MARK STEVENS "PRIVATE EYES" with East Side Kids RIO DOUBLE IN SPANISH! "ANGELICA" & "UNA CUBANA EN ESPARA" VICTORIA "Lure of The Wilderness" In icctIn.cjior! Plus: - "PICKUP ON SOUTH STREET" HISPANO "THE ItlNr'^ with ' Marlon Brando "BEAT THE DEVIL" (Bogart) . I ~II __ S Social and Olnerwe -- onfinaue -0-- Left for New York Mr. and Mrs. Jorge R. Riba of Cagrejo, returned to New York after spending several weeks of vacation here. Mrs. Heary Fe abett T6 Give An "At omen Mrs. Henry Felgenblatt Art Exhibit On At JWB will be at home to her friends this eve. ning at her residence in Avenida Eusebio A. Morales No. 7, El I Cangrejo, in celebration of her birthday. Braoes Brook Club To Hold Dance The Brazos Brook Country Club will hold a buffet supper dance on Saturday at 7:30 p.m. Musix will be Furnished by the Royal Sultan Orchestra. Members are reminded to make their reservations early by calling won 181-0101 W WW MW3-i1y. Marco Ernesto, a young Pana-.Nu.rsery School Opens Sept. 1 manlan artist is currently exhib- A nursery school under t h e ItInk s water-colors at the reaction of Mrs. Kay Schochl and S USC-J$W Armed Forces service Mrs. Juanda.Pennington will open Center in Balboa. The art ex-eon Sept. 1. hibits are arranged. i coopc Reservations will be accepted tioq. with the Canal Zone I 'y Mrs. Schoch at Box 889, i n League. Balboa, or she may be telepsoned Sat Balboa 14W7. Ernestp received his early -- traIning from his father wId Is Pacifie Royal Palm Club a profeaor-'f Fine Arts A _adepy Meets At Ft. Amador of Ecuador. Young Ernesto de- The Pacific Royal Palm 0.58.. viated from" hts early trailing in Club, hd its regular mnthly adapting his own techniques in meeting Tuesday at the A my nd the use. of oil. However, this cur- Navy Club, Fort Amador, Mrs. rent eahibit, 'which also demon- Kay Daniels, president,, presided. strbt e Efnest's strength as a I Games were played- any many cresuive artist Is mainly water- prizes were won. -Miss Mildred color. Neely won the door prize. SAf-r;the. meting refreshments The current hibit which in- were served. Mrs. Margart Beau- elu d6the following paintngt will regard and Mlrs. Thelma Lowande remain en through ,Spt. 5: were the hostesses for the qvening l- 0Bo ,- 2_Uan ma. ay, j Thos who attended were: Miss 3-a. i 4-Aure, -Sun- Mariemma Smith, and the Mes- set, 4Wt Htouses, m -in teriot dames Kay Daniels, Helen Skey, Trail, -auliny Day, 9-4Ol Laura Davis, Hedy Shaw, Rose Tree, 18I-4baI ape, 11-Bougtigat- Johnston, Margaret P. Beauregard villas, ,12-By The Road, 13- Clara M. Chambers, Helen R. MoUPtn House ,'s14-twse by Adler and Marion E. Graham. the Bay, 15-Palms against the ea 16--Flshernman 1j7i-Sailboat, Card Party Tonight 18--By. The Sea, 19-Intejor By Royal Palm Chapter House, 20-Under the Tree, I 'tRoyal Palm Chapter No. 2 0..- Lan.sckpe and 22-Little t E.S. will sponsor a public cprd Houses.. party this evening at the Cristobal .' .-, Masdie Temple ,at 7:00 p.m. . TIWr* u o-9dfj th h t ar l Bdr, canasta, samba and oth. I iir pe and-, ere wl r r may be wi a yh. ta. .the m...lttary" pe .. nm.. i and. There wil be prizes for eact Airman Senenced For 'Improperly Occupying A Bed It.OLLC MOVIES. TV RADIO HUCKNALL, n g., Aug. 19. - (UP) Ronald York 24-year t \ by k i JA M old airman caught .cuddling an _- -_ airwoman in bed, began a 56- day sentence in the workhouse HOLLYWOOD -(NEA)- Behind ard Henry Brinsley Norton had today after a duty officer said he Screens: Irving Berlin nixed any connection with flicker mot- he saw them when he peeked another fabulous ofter to film his terms. But he's the man who coined through a curtain lie story-this time it was Joseph the word "cleavage" years back A Royal Air Force court-mar- M. Schenck with a $1,000,000 check in a battle with the late Will tial convicted York of "impr .- as bait. Hays over censorable footage in a early ocuppying a bed". with Th explanation was the same British film imported to the U.S. Leading Aircraftwoman Eileen one 41vmg1 gave me a few weeks Hall. No charge was made a- ago- I don't want my life 4one A foreign babe-not Zsa Zsa Ga- gainst Miss Hal. as a motion picture." nor-was asked for her telephone Flying Officer William Oaley But coming up this fall is a two. number by Porfirio Rubirosa and the duty officer, said he spied hour TV cavalcade of his songs got this answer: York and Miss Hall "pettg, and parts of hi life story as the cuddling and kissing" on Mi background. "What's the p o i n t in it? I Hall's bed when he peered wouldn't date an actor!" through the curtains of her bar- Latest definition of a movie pro- racks while making a routine ducer: A man who goes around ACTOR check. with a worried look on his assis- -- "I left then because I hoped tant's face. the couple would leave," he said MERVYN JOHNS, character But when he returned he found Is there a trend away from actor in "Moby Dick," the new them still there. Miss Hall was fresh, new faces to reliable play. Gregory Peck starrer is the papa nowin her paJamas. ers who know the movie ropes and of husky-voiced British star Glynis nI was still hoping that the who can be pushed into important Johns. airman would leave so I walked stardom with careful career stra - away again," he said. "When I teg7y? Claude Boissol, the screen-writer returned the light was off." who's cooing French love words Oakley said he called Miss That's what many 'Hollywood into Yvonne de Carlo's shell.pinks, | Hall's quarters. The lights went actors read in Fox's recent grab wants her to star in his "Marie of on in her room and she sat up of Robert Stack and Richard Egan the Islands." n bed to answer the call, he -two flawless profile boys who are --- said York was still there, but at least 10 years older in age and Oakle denied setting a trap. experience than the'striplings who Symbolic note? In "New York Miss Hall testified that York have been occupying the "Marked Confidential," a g a n g l a n d get- did not get under the blankets for Stardom" bench in the past away car careens into a store, i her. two years. demolishing the display windows. wit h.er. A shoe s t o r e? No. A clothing "Would you have allowed h ,m Says the studio casting director, store? No. A television shop to do so?" defense counsel A. H.;Lou Schreiber: Brow ask so signe yon"We will still sign young pe --ople "Brown askhere lied whom we consider potential stars' :.. * York told the court that be if and when they show up. We will V sth Zonians and Miss Hall were "genuinely take them on and develop them .l. a ond" of each other. as we have Robert Wagner and Compromise Sought not seen much of this young ma- .d' SCompromise m0 tlria _. SMERLE OBERON, of all people, (Isthmlans wfth f am ily d o torrid Flamenco with me embers or friends In the So I n ow .. M dancer tonio sn- l I ALrmed Foaees are t . -a. .LAr O n 1, "EWverthi ne ta -t wm triho t thh sneir ramiies are cordally invit- and refreshments served during IV V HUaw nwU gendarmes to worry about: MGM Sd to visit, the USO-JWB Art the evening. shelved the title "Rogue Cop" for Gallery which is open from 9 Tickets cost 75 cents, and may WASHINGTON, Aug. 19 (UP) the Robert Taylor starrer at the t.m. to 10 p.m. daily. be purchased at the door. -The Senate today agreed to request of police authorities who Story to reach a compromise with hatet he three-letter' word. STat SA the House on how to "outlaw" was a couple of months ago. Now Claire Bloom In A Sure-,Fire Hit, the Communist party. the picture is back to the original t Senate republican leaders tag. The M n Between," had delay pointing mem- First ca on movie rights day bears to a spe House-Senate First call on the movie rights SBELL Vconferencecommitteewhile they to William Faulkner's new novel, t the BELLA VISTA Theater sought more "acceptable" an-"The Fable," goes to producer I guage for the bill. Unable to Bill Bacher and Director Henry find the new language, the Sen- Hathaway. The movieman gave rate GOP chieftains agree to the the Nobel prize winner for litera- conference c o m mp i ttee and ture the idea for the tome. named their members. . There was some fear present Since her Las Vegas night-club language in the bill might dam- click, Mae West says she's had 'age existni anti-subversive laws. couple ef movie offers. Meanwh e, the Senate approv- On wide scree of oure. ed President Elsenhower's pro- i ----- osal to strip U.S. citizenship Adv. In a movie trade paper: rom convicted Communists, aft I "Errol Flynn offers his lovely hill-. er limiting it to those convicted top estate for rent or lease." Ap- of performing a willful act. parently Errol's never coming The bill was sent back to the home to live as lavishly as he! House for approval of the Senate once did. limitation. limi tao DINAH SHORE has been award- Both houses are on record to ed hundreds of plaques for her outlaw the party' bY stripping it singing, but there's only one trophy, of its lal rights and making displayed on the mantel of her mem ertp a crime home--a small cup for second But te wordig of the pravi- place in a recent tennis tourna- sions brought up the possibility mn that Presidentb m ienhower might .. -- veto th e bl h. Richard ("The Robe") Burton P ."The principal stumbling block didn't sign that seven-year con- N was a relatively short section of tract with Fox--one film a year f the bill hch woud brand as a '-until a few weeks ago. Big ques. criminal anyone who "wilfully tion Hollywod scribes are waiting or knowingly" becomes or re-to ask the British star: mains a member of the Commu- Did he really say of ,his movie.- M nist Party. Active Coihmuniets town stay that "I enjoyed every f would be subject to fines up to dollar of it?: a $10,000 and or prison sentences Yo wo-tldn' t t e -' SYou wouldn't think that the re-' t. upto ive yeiraio rs. strongly scent death in London of Lord Rich, pposes the bill on grounds it .would cancel Out Communist-i SHOWING A7' YOU~r daughter of th'Lady ul loo e a control laws now on the books 4a ter of the dy Luck Cl a Bloo the mat- woudca nc out C i iw SHOWING AT YOUi velous str, whose .genal dharacteriation ChapIins "Lme and wreck the government's an- THEATERS light" was a delight, comes back to the screen in another wonder- ti-subversive campaign. ful role. dBALBOA 6:15 -c8:10 Youthful, pretty and owner of an unusual dramatic B O 65 : Claire Bloom chases her own parts with sharpness, and so we ft se, .WUUe AISu have h;row with rugged James Mason in the shocking super . Clalre Bloomis noat a one day star, for the contra she is ~,T 01n r0mun I_. and her success In '1" BETWEEN" augers many other: o i I III , screen triumphs. OnA ru n gn N 11ItII 'T1-~U M BETWEEN" Will be released today at the beauti- _ ful air-conditloned Bella Vista Theatre. Adv WAS TON Au (U) WASHINGTON, Aug. It (UP)- Dancel House-Senate conferees agreedD -late today on a comoromine for- Iegn aid appropriations bill of A LBOAow" to finance the military Secondmic and technical assit- tance program for another year Exact fi In the bill weI not immediately available. The House voted $2*,85,00.0 inn new money. The enate A - propriatlons Committee recom- no noMmended $2,M00,000,000, but theI ru,.. s. . Senate slashed that to $2. 0.- 000000 In approving the bill last CRISTOBAL Sen. verett x. Xrksen ft -1u) a-cu.. ... PARA i ..N.MMiwho headed the ea& confer- i ,rla, ., ,, --, said the "w mo tow - I --was 'peWa "Pretty much the samw a," LA OCA :15 :I- I M R I M EM v0ted by the Senate. "THREE MUSETEE " The conferes had been ta- iled for several days over seval Steshnics provisionI in tit SANTA M5 6:15 9:16 and ow m h to permit the for- "OLAMO I" ... .. ein opera~ons .aduda.m mIi to.W. of Its unablgated r loe fud I i no'i 's pertient fy alUz data to the Zone Servic0ma's Edit- or, The Eanama-Amnerican, Box 134, Panama, R. In- formation as to servicemen's whereabouts, their promo- tions and excerpts from their letters are of particular In- terest.) .Photographs are used, but none can be returned. PVT. DAVID A. HOPE of Gam- ioa has arrived at Pt. Dix, N.J. or basic training and been as- igned to the 304th Infantry regiment of the 69th Infantry division The son of Mr. and Mrs. Winters A. Hope, he was formerly employed by the Pan- ama Canal Company. He at- ended Balbow High School and he US Merchant Marine A- cademy at Kings Point, N.Y. t SERVICE CENTER TONIGHT!, DIABLO HTS. 6:15 s:2 i OClark GABLE oAlexts SMITH "Any Number Can Play" Fri. "A PERILOU JOURNEY" PEDRO MIGUEL 7:00 "Charge of the Lancers" Fri. "3 SAILORS & A GIRL" GATUN 7:00 "I, THE JURY" Fri. "HER TWELVE MEN" MARGARITA 6:15 7:55 0 Anne FRANCIS Dale ROBERTSON "LYDIA BAILEY" Technicolor ! Fri. '-17bt MM an Il Arslonm" Wm LADD L* GE MN TROOPER" Color! r T= OLDU= LAPW PARAISO 6:15 S:15 "He Ran An The Way" CAMP BI3R3 :15 ;8: "ivu= CA*MAm" New Angles Pursued In Death Of Heir Of , Monigomery Ward | CHICAGO, Aug. 19 (UP) - Cook County Coroner Walter E. McCarron today pursued ,"scv- eral new angles" in a new un- : dercover investigation into the death of Montgomery Ward Thorne. McCarron said he was cooper- ating with Chicago Police Com- missioner Timothy O'Con nor who has assigned Deputy Chief of Detectives Harry Penzin to the new case. The coroner declined to am- plify his remarks but said ear- lier the new leads in the case "had something to do" with evi- dence found in Lake Genevi,l Wis., where the Thornes main-' tained a summer house. "I still believe Thorne died un-! der mysterious circumstances, ' McCarron said, "But I am npto saying it was murder." Thorne, a 20-year-old heir to a mail-order fortune, died in hisi near North Side apartment two, months ago. After a lengthy in- vestigation, a coroner's jury ruled the young heir died of na- tural causes. Thorne died nine days after h' made a new will which left half, of his $1,300,000 estate to his girlI friend, Maureen Ragen, 18. I L ,. ..I E SCAFE 100% Pure Instant Coffee Better Flavor Cup after Cup! NOTICE ACCOUNTANTS, BOOKEEPERS, STUDENTS and BUSINESSMEN: Here is a CHANCE to get TERRIFIC BARGAINS in ACCOUNTING BOOKS. We're having a SPECIAL SALE of Books Friday, Saturday and Monday. LEWIS SERVICE Inc. (Across from the Ancon P. 0.) CARNAVAL-ITO" WEEKEND 1 with the most sensational orchestra of the Americas! LUIS ARCARAZ AND HIS 21-pie. BAND FOR DANCiNG 4L .? ,frI ; ALTERNATING WJTH LUCHO AZCAAwRKi S , CARNIVAL BAND with lovely singer Ivonne Fun galore as long as you can last! Dancing to the exciting rhythms of this terrific band whose Glenn Miller styling of American music has made them a U. S. favorite! SATURDAY COMPARSA NIGHT Come in costume for more fun SUNDAY OUAYABERA or LOUD SHIRT NIGHT QUEEN MARITZA II and her COURT WILL LEAD THE FUN Carnavalito entrance $1.50 per person Call Max, 3-1660, for reservations DANCING BY THE POOLSIDE! From 12 to 2 p.m. Saturday & Sunday with CLARENCE MARTIN & his 7 RHYTHM KINGS. Make this a real carnavalito weekend... l lunch and dance by the pool... you'll love it! 4 .'.' ) '1-e ) .- '/ A]tt6 ,._ ,1 "i ... //' "S- *:!, 00b I I IKl:,'. '. -- ,' Here's a -tasty, ecosomkid dish that's very asyw to pte Chef Boy-Ar-Dee Ravioli with beef in sauce is prepared tender first quality mest covered with in exquisite sauce as only Chef Boy-Ar-Dee can make. 5 - Lip with such It's so quick. conveniem to prepare for all you have to do is heat it. A special plate to delight your family s tasre. with a minimum of work for the lady of the house. (Featg ms yo w Commssairy) CHIF BOY-AR-DI. ravioli i with Beef in sauc '. , " 4.' , n... *'.I" *.1.' -"a L, r.-^ ;ii 11l r+ rla r.f+ ? +l; NNW "r A ; L-1 I IPANAMA-UAMRajfMN Aft munWg NDMMT DAILY NswSrAJM TMrMr.AT. ATTIST 19. I9M ,.e .. I Fa Of Sixth 20-Victory Season .X 8 O il' -. ''--^' S.pahn Within Reach Le'ty Hurls 5-Hitter International 2 Armed Forces Cage Games For Season's 14th WiOn-On Tonie; Big One Tomorrow ,_ ll k O I .. ,,Teams W0 L raPet. --O "" r ;-Toronto 7 d 47bl .i ' .ocnes~er 7U 51 .i Panama Area Armed Forces AMERICAN LEAGUE NATIONAL LEAGUE Montreal 72 54 .M 1 Basketball Legue Standings Team. W L Pet. GB Tm W L oda even. ..he acke i n pacea ittle.Syracuse R61 63 .4am cn el h 4 3 4. e o S.s NEt W YORK, Aug. 19 (UP) Wiry Warren Sracse 61 63 4 Teamw Yk 72 44 S. i w Wt havana 62 66 .41 Fort Kobbe ...... 16 4 .800 New York 82 le .68a In 71 4t 02 , Siahn, who won six games in exactly a month to Buifalo 56 69 .448 c co lo.. ...... 4 h7 .6 9 wauke 7 - e madcap Milwaukee's pennant drive was with- Ottawa 5 .4 Albrook ABI .. 12 8 .6001 Detrlt 52 65 .444 32 Philadelphia 56 59 .487 p lce madcap Ml waukeer s pennant dye, wn cn ,,1o0 and ao9 7S i 3fort Clato .;, 10 10 .O Wa hington 49 6W7 .422 34 Cincinnati 56 62 475 i' q;stn reach of his sixth 20-victory season in the majors -- nmond 49 79 1 Army" Alantic ., p s 5 .250 Bostn .4967 .42234 S. Louis 55 62 0 . today even if he slacken s Phis recent pace an 1 o l d l gueTED RL .2s00P0 Baltimore, 39 8 00 N evn N io he ackens his recent npace a n little. sip Deli 0 7 0 8 o 46 71 .0 26 S The Oklahoma lefty has had trolt, to stay three games ahead m.DA000 (xX--Wlthdrew from lealgue.iB v-el39--0.384rn -4batas one of his keenest goals of the Yankees, who won their1 (First Game, 7 Innings) ,'it a lustrous career because if ninth straight at Philadelphia, icnmonac 0 u 01 0-7 291 Two pgmes are on top" tonight TODAY'S GAMES hiladAas York e achieves it he willpull even 6-1. The White ox kept up theirbyrause 002 000 0-2 5 1 (Thursday) In the Armed Forces atPhiadlpha (N) B at t *A,,wth Bob Feller of the Indians role nine games back on the hoop league as all fans await the Detroit at Cleveland (2) St. Louis at Milwaukee -he only other hurler in the treadmill by winning 4-1 as Bal-! Fanovich and John.son. Sprng, final clash of the season Friday Boston t WashingtonCincinnati at Cco (). majors who w has 17 won 20 games timore went down to s. s and Erautt Atlant at Fort Daviys. Both to Ft. Chicago at Baltimorelts Cardinals in a duel wier this year ath lefty his 12th game. Rhodes hit twoere havana 002 000 002-7 12 1 Troops three times this season Philadelphia 010nd 000 001 30x-41 5 0 Pittburgh 000 000 02-2 9 2 oarly American Leaguer who can reners out in games involving Syracuse 000 010 00x-17 26 0 by scTroops visiting Albrook AFB and Hoeft (613) and House. Wynnand Burges. Male (1- and Is Feller's team mate, Bob Le- the also-rans. Naraella and Jonnson. San- Fort Clayton tangling with Army (16-8) and Hegan. KattI wsthArywIfo6d and Erautt. Atlantic at ForD Davis. Both tltso Spahn won his 14th last night, al Maglle had great support start at 7:30 pm. v (Night Game) (Night Game) a flashy 3-1 five-hitter over thefrom Dusty Rhodes in winning( (First Game, 7 Innings) Albrook has beaten Special New York 010 020 300-6 9 1 .Brooklyn 101 001 000-3 0 0 Cardinals in a duel with lefty his 12th game. Rhodes hit two havana 002 0W0 2-7 12 1 Troops three times this season Philadelphia 010 000 000-1 5 0 Pittsburgh 000 000 12-2 9 . Harvey Haddlx. It was his sixth homers to drive in five of thelBuffalo 030 311 x-8 6 0 by scores of 66-64, 81-64 and 92- Ford 1-, and er. Kellner Ersktne (16-10), Hughes and in a row In a s p a n that Giant runs. Maglle pitched his Lopez, lott (3), Harris (4), 61, while Clayton has done like- Ford (13-6) and Berra. Kellner Campanea. Thies (2-4) etk began on July 18. With more first victory in a month and his Melton 5, and Noble. Froats, wise to Army Atlantic by mar- (6-15), Dixon and Astroth.and Atwell. than five weeks to go, he might first complete games since July M. Johnson (6), Erickson (7) gins of 64-62, 97-62 and 60-56. - once again make it 20. 21. It marked the first time in and Lakeman. WP Froats. LP The big contest that everybody (Night Game) Tnight Game) oncetw weeks two pitchers Lopez. HR-Lakeman, Baum- Is waiting for however, is the Chicago20 St. Louis 000 002 01x-3 0 Stan Musial' 32nd homer t weekstWoG ant either Lopez. HR-Lakeman Baum- 1Coco Solo-Kobbe clash Friday ntan aMve St helr i hag hurled complete games. gartner. iCoco Solo-Kobbe clash Fridwe Baltimore 000 100 000-1 7 1 Mlwaukee 000 002 Ox-3 6, thennt ae lwuk Johnny Antonell turned in one night. The Sailors have beaten Conuegra (15-3), Strahs, Dor- Haddix (15-9), Staley and Sar- only runoffpan.,1W.-... enightbefore. (Second Glaam.. Larsen 3-1) o uMduel wit the night before. t(Second Game, 10 Innings) the Lifeliners twice in 75-68 and ish and Lollar. Larsen (3-1),. broke up a sc hees hHavana 220 010 000 0-5 13 2 84-78 battles, but Kobbe bounc- Chakales, Blyzkaand Courtney. tw rwheno dktripd oA ,C rin r dnly Buffalo 101 010 020 3-8 9 0 ed back to take the third en- ( ht Game) Cincinnati at Chicago. Post- one run ad Andy afo got that tired feeling in the Rogovin, Melon (8) and No- counter by a 74-54 count. Boson 100 024 010 01-9 1 3 pned (Rain). gled in another for enough ninth and served up singles to ble, uerra (10th). Maas, Harris The winner of this Sailor-Life- Wash. 001 030 103 00-8 15 4 to win and stay 4% games Preston Ward, Frank Thomas (4), Hudson(7), Lary (9) and liner battle will not only cop the Kely, Hurd. Brewer, Hudson Stho a sreont 0 0 1 nre COLUMBUS (NEA)-Bi ihon Pits urg Huoghdr-dwbwObo OoCte ln la so ssportsShorties s b adh I R n- L(7) n, aKingd I Howard.t Pat llres Gardens. Fe 8la., tto u8p fortrKobbee w aal-t ,SSta eA a Tpe Nky Piraters, o 3-2. f edthyear. Duke Snider paced dk H W n Kt loP Army Atlantic 84-47 and ad money winnit crowns. hes for the ehit er run when Toby Eary Atwell Rochester 100 000 0x-4 1 1 ti Ski Tournament at ier N. (NEA) Armed Forces tournament a-for the $185,0 over the first half of the n te P Gro t ah ino a iA. Trice and Watlngton. Pi e 55th Grand American ou ainaHandicst Camp Tortuguero, Antilles d bt on two a In front ond thf an B n to m e sBu HR singles, Hughes Alston, h resting bins F- t a new recd. whi had to shut off atwor ped the Pittsburgh winni n, Lndeck (, Blake r In games playedTuesday eve- is ughton won 0 la t year. ninth inning rally toeat streak at five, longest fothei ( and ve Howard LP S- Lomban- ISCO hon, qpl i ning, Coco Solo wo over Albrook esrciano i oto k- in, e pesky Pirates, 3-2.ear Duke Snder paced Br Wilson, Kress.AFB 88 to 68, Fort Kobbe wal- Yhssy d Coc h Series Wis Loop KuPe ddlewe.ght he rl pne, 3b 3 8 0 0 0 s Cleveland clipped f i ts eighth tr etd his sev loped Army Atlantic 84-47 andc a and money winning rowo.d od , victory a row, 4-0, over e- Cleveland cashed In on Ottawa 000 100 000-1 3 0 Fort layto edged p Specialfirstseveral ousand St Roc l l l l U T shotgun enthusnasPtis have ar- reseman took 83 dashes ande a e hl' te 74Rlan i on t ree complete Rblter 100 00ational 4 11 1 le men rived in la, Ohio for the $5 0 over the firt half of the Sworkg out at Bern e season his ad to have vantae down to lust t names on e champion. v. E .yh rland have taken the cue ftr fve innings but won over ochester and six an55th Grand American Handcap.s season and appeared bent on et an Discl nho homersbBoblby A nd- lurbrinkc'te Ra al ton, e ol lk .. th wynn Preliminary firing begins Fi- nw record. is:n Darcidlhiet arnnd Al Smhith. Smith'ss with aBurgrssn. wh 3ee 1toe Fi c o T m o 2n 1 0 2 twro on base. It was theafs, 10-- nncmr12tlsho Burgesrw s.e >ay. i s 5; yr vented the only defeat tha suspended game and then went An argument over what time hopes to wear the crow n an- n,tlak 4 0 2 5 31 tr, 4- the Braves, on a 5-3 victory i the reg the weigh-n other fiveyears Marcano says, 0 2 2 ruSan 0rpsa C te oac tWhthtey trail la meTuesday night, jumped S day has cropped, Aug. 19aherty d doesn't mind i n New York on Delsng, c 4 0 0 4 I hitter for h is 13e th win ofve-hit o VeLombardi for five runs in says it should be nine ocloc n husky in the country would e kie Boone, 3b 0 BR, Switzs erlnd, Aug. 19 se n and hisn osvenrth in a row, Car (ds the osoning inning and the morning Ws as n hs as b elardi, b 4 0 1 5 0 Seek ath Russian workouts then d on foran 87 victory since the fight starts at seven In fact, Marcano says the Total 29 4 5 7 8 fi EmilZatoseki sah PITTSto d Meanwhe, the Rochester Red that night Jack Kearns, of to e mor e contenders there freight Tuttle, cf 4 0 0 3 0 S Ult omoft ouht le and Cofly topace the Yan- NEW YORK, Aug. 19 -(UP)- makingweig. Tl disagrees. dd better he likes it. The more w-H-o S Anurev a human eretuats he wholeheart leouefeating the Toawa Athetics 4Ma- OlKearns says mathnager, weBid Fgh-laherty, Arumandav for me, s ays T rs 0 0 mStio machine." ma p er l "behd the policies of gen-t1. be at noon. just ah s it is in New Rocy, "the better the brandof Indians 000 001 30x-4 Aothier la s exAdert co rsi man r Branch Rickey. Toronto has 29 ames left to York when a fight begins at 10 challengers will be. And the 1 ents- working oua ern, this season er has play, two more an Rochvantaes the scales. Thisouldbe champion.chllengers rrors Hofet. RBI Avila, moterland have Wh en the u elp aftele e ngs t ovte a Kearn argues "If Olson the bigger the crowds. Smone-nith 3. Two base-Hoeft rWest-f I o their coach. hihaens down s 15th game fortheWhitehalf games ove Montreal today for anontitlebout six weeksa- Hard-hitting Macanos looexpects toke Avila, 2b 3 1 1 2 3 -l Theyseldo rest as theybu an who were aced by Minnie as a result eae ofwill have their third straight andthhchampsaidrecent- is forw ak in another -hetw Doby, cf 3 0 0 2 0 Sos s es" o a daily re next year. Cros important loss column nefit of dryind ig out all nhtrr uel with loss to the Royals. two he would like a or three years. And plays Avila-Dente-W eht ho busy reign as vyt In aternatonlrack and sar- s I have never at any In other Royals, who defeated the heavyweBuffalo Bi- He might champion, Ar1ie5 by fht where along the line Rock y Kuenn-Hatfeld-Belard. Left on M harde worker is long Leafs,, 10-1, In the completion of Moore. The 29-year-old champ says Majeski, 3b 3 0 0 1 1 11 VA .ditance runner Alexander Anu- YESTEDAY' TAcomm -Left to a suspended the Cuband then went An argumentverwhat limit he hopes to wear the crown an- Westlake rs 8 If 3 0 1 4 0 d.After Alofex Norwamber up, e warren shn of the Braves ontoga a5-3vitoryi the first division bthe weigh-y is 160 po uld be held Fr-. other five years. Marciano says Dente,fts 3 1 0 2 2 tin ru ns 50 laps econ the uar who won his sith strainer yoular d efeating Havana twiceusy night, jumped day has cropped up. Flaherty he doesn't think his ry young ynn 3, c 4 0Hoeft 3. Runs and - W-mlet k forack onethgame in Cra month, asfive-hit on Vie Lombard for fiv runs in says it should be nine o'clock in husky n the country would like Wynn, p 4 1 2 2 0 petekingat the Russian workouts. then held on for an 8-7 victory. since the fight starts at seven In fact, Marciano says the Totals 29 4 5 27 8 says-"If Ewo-mi nul Zatopek s19 ahnd PITTSBURGH Stockholder Meanwhile, the Rochf m es with Red tich- ing a lot of attention. Special draw a millionten dollars But he's 9). LP Hoeft (6-13). man locomotive,' they ought to Bing Crosb ofthe ittsburg Wings picked ut a full ghta as far offc as Clevelandm p, disagrees. better he likes t. "The moreahes hs ho manand New York. peak, Marciano says he won't by( Dl TCLAni cR Anufriev a human perpetual pirates says he is "wholeheart- defeating the Otawe Atletics, 4- Kearns says the weigh-in should come gunning for me," says rlers "a000" oo --ea ot F Ion Elsewhere in boxing, heavy- stop fighting "It takes a cham- 1--\ motion machine." behind the policies of gen- be at noon, ust harles says in New Ron a w"the better the brand of Indi ans 000 001 3x-4 Another Swiss expert cm. ramnser Branch Rickey. Toronto has 29 games left to York when a fight begid s at 10 challengers will be. And the ments Ti'beRussians move ... The millionaire croonere has play, two minore than ochester oclock.s more dangerous the challengers. Errors- Hofet. RBI- Avila, move move. Why, even if one sent a telegram to Riceydeny- and one mre than Montreal and Kearns argues "If Olson the bigger the crowds." Smith 3. Two base-Hoeft, West- of them happens to sit down for Ing he criticized him or influ- leads Roesester by four and Mon- can weigh in early in the Marciano says he expects to lake. Home Runs Avila, Smith. "1 a minute he gets busy cleaning enced the general manager's de- treal by seven games in the all- morning, he will have the be- hit his Veak in another two or Sacrifice Hatfield. Double- and pol$Silng his spikes." cision to retire next year. Cros- important loss column. nefit of drying out all night. two or three years. And some- plays Avila-Dente-W e r t z, :UrU 011 ,, In aW international track and by says "I have never at any In other action the Buffalo Bi- He might weigh 165 by fight where along the line Rocky Kuenn-Hatfield-Belardi. Left on field mueteaat Gaevle,tSweden, time made any comment to any- sons dropped the Cuban 6Suog a rI time." The middleweight limit hopes to realize his main am- base Tigers 8. Indians 8. Bases BOUt Gets O K hogra Balno Host For Annual bailr DAu AcAA I udn sen of Norway clipped one about the operatonof the Ekings out of the first division by s 160 pounds bition a million dollar ga nvitational Basketball To Wynn 3.a nte.4tnthsof one second offhi. (Pittsburgh) club under your defeating Havana twice, 8-7 and Olson is a heavy (1-4) favO- Rocky doesn't think his return Wynn 3, Hoeft 3. Runs and r.one-thouand guidance Crosby ads-Eve 8-5, while the Syracuse C h e f rite. Although there is very lit- defensunage againstEzzard Charles earned runs Hoeft 4-4. Wild onAren apprced the di l ad a critical opinion, which IMmoved into fourth place by split t-te betting, the fight is a ttract- at New York September 15 will Pitch Hoeft. WP Wynn (16- t a sean memin of the d definitely donot, I wouldhave ting a pairof games with Ric. ng a lot o attentiopln. pec thalnd draw million dollars. Buthe's9).LP- Hoeft (6-13). t-PA ise-t featherweight cham- y.. noo s h e." i, mond, losing the first, 7-2 and planes are flythe shaed hgh pont honos thing in crowds from hoping some future fight will. STrinida ha are Atanti e ee all fro con Mead, each scoring 13 I Gu ll t winning the nightcap, 1-0. as far off as, Cleveland, Chicago Eve n when he reached the news his men but Carl l to sa to arrve on the preandN the PwcificE sie. a ks lgmtein t ks a ys he wsnt lm I e who appreciate the bet, alway choo n i e lsewher e in boxing, heavy- stop fighting. "I t takes a chain- h e al A n Airways to complete his By BEANS READON ht Ezzard Charles says held corn a while to prove hes real e to provide the s n PALL MALL for a reason. They like g There. will box 18 rounds this we theek-en good," says Rocky. "I might of fine tobabeco. they SColDa n ie ls T e i Writteetin for NEA Service at his Monticello, New York able to do that in about five trouble Offiial ToHo camp. The ex-champion meets years." - f Tess championable 15- : QUESTION: With one out, in- E team by the score of 47A23, The 19 pombs, and Kirkland scored 8S whch filter the smoke round math for the Colon A- terference is called on the bat high scorers for the game were poieY Aor Cocoli ake it elowerm Foot Oct. 3. The title fiht ter a a ballserner steoffcial s wll hold Cismeros of Gam leaue champion will s approved at the relar Who is out the batter or the base boa o each. igh scor-Th w inner fort. Ch9 03r dAAr aA At MA afit Comm on meetn runnest -Jerry Gervis. rstr for stobal was Blevin with 9 A gue stobe represented like te elegance ofthe Ithmian eti Monday nicht. Aswer: Thome In Balboaner. Allwhich points Invitational Basketball To u r n a- ie will be requested candidates aMr. there welreom The D league game was ex C at Margarita. ot scheduflenvd for Sept. soon two t batwar d be out. tremelyoe with B alboa member of that team is now pl oe tobco than ay his in Commission. i The Idea to t e nament was held at the teBalboa out of An League37-. Chin of Cristobal the 03rd should be able to get b get together, you're sure to find PALL KALL'S Ph va. "Baby Face" is o The Idea is to Unset the maxim. beating Cristobal to the tune of E League.- Gamboa nlatt~r cigarette. to his recent perform- Q. A claim Bob Feller was ham and Roy Watson both IAe I Officials at Chicago's Washing- t huld 'sh eAsoPiwly convince Ibeaten when he established the 25 points while Hilty of Cristobtl o al ton Park have suspended three sof his clan. major league rerd with 18 made the only field goal that Cris- men for using dr ugs on "Mister In idadian has fought in strikeouts. B lauh at this. Who tobal scored. Lei nadier and Shu- sim P 1 0 Black," winner of the Oraeland Aot Ul omana, Venesuela, Aru- is right?-Eddie Red. mate of Cristobal came through iWml o 10 De Stakes last Saturday. be i a racao. A. Feller was defeated, 4-1, for their team with 2 foul shots e Harthill testified the drug was nCludd an the Danles-Test' BABY FACE DANIELS when he struck eot I Tigers at each. I r 1 given last Wednesday and could p legra are an eight-round the Cleveland Nuaip Stadium, In the lower gym, Cristobal's .e not have had any effect on Mr. a inal and two four-round om the afterneeM Oct. 2, 1938. B team and Ancon's B team bat. Black in the race. Mister Black s, and Juan Salazar and Manuel Q. How many years did Bob tled it out for the first 3 quarters It was anmouseed by la h set a course record in winning wiCe t Amer- Prescott Will slug It out at 124 Lemon of the Idiansol around and then Cristobal went ahead i 1. Davis, Execetive Secretary,the race... lowering the time for .g "m pounds In the other four-round-in the infield and wfoueld before the final quarter to bet o thatD it w-ld be aece ary to a mile and one-eighth l one- hS wl or. concentrating, on pitehing? Ed 36-26. High scorer for Cristobal else, the Cristobal YMCA- fifth of one second. Sb. i Burke was J. Hannigan with 10 points swimming for tf dfya, The stable's head trader - S*General adia lsioi for thisj A. Sevm .ndM. lespe t three and Ancon's high scorer was L. starting t y. Harry Trotsek and owner Al- Swill bat fight will be (one dollar), re-more years Ia the ared forces. Reves with 9 points. I 3xzdve rqi ar t*f It Ruben also appeared at the ON,. a served ts will o forS Q. How many years did Na The C league game between A- tmae to 'M rittat ieearin. Trot ek convinced the 8 I" M+ 1 a0~nfdt .trnsefor poleo_ Laee mana t ~ io1e In-,con and Cristobal proved to hiathe ail to tSe po l It ewars he was at New Yc' - Mila w~i rell ,m2t .50. Children and -boxers will dians?-Andrew Catelratorus. most exciting of the day. Casto- that 1 be aratoga track .and had I Bi at 132be charged50 cts for gener A.WAr at et aher- b led athe ay wt Ah aoi mn se Nt am knowlee that. the d, wta -- .. 1 * THM PANAMA AMERICAN AN INDEPENDENT DAILT NEWSPAPER PAGE IGSWT TRwUSDAT, CGsw 1 IM -Y I"AUGU ili II AIAgIME LNONE ' Worl erie Time For BYi I By uMY BRUSW Nha staff Corresponaent WILJ(AMSPORT, Pa.-e(NEA) -The Little League World geuis, which adeualky sends aque Pennsylv a c r 60, onew a baseball e, holds a, fa4-day spotlight here, Aug. 24 to St. I T Aormally, youngsters ia h abe 8 to 12-year-ola brs.dt; ca"e com- motion any pipei but e e ;Le - tie Leaguers who moVe In fAr thel World berles of small-fry baseball figure to completely disrupt WiW- itamsport. The eight regional winners, en. compassng every section of the United tates and part of Canadat will generate all- ime high Inter-_ est hi this seventh Worit Series held by the Little League. With a record 3500 teams ond over 500,000 youngsters engaged in the Little League program nmis year, the Worlde Series has bo. coane a bigger Item than ever be. fore. The three playing dates this time should Graw over 40,000 spec- tators and will reach far more than that via network radio and .teevislon. Mel Allen will handle the announcing. "This is our Idea of a bona-fide answer to juvenile delinq uehcy," says Pete McGovern, it tIe League president. What he also could poialnt out is the success of a strapping ex-Lit. tie Leaguer from Connecticut, 18 year-old Joey Jay, now a bonus hurler for the Milwaukee Braves. we otig? oyN OOBaseball people are taking it as the anvs w a on themaian boom ,a matter of course that the pro- up In Boston. (NEA) fessional ranks will be filled, in the future, almost entirely by Graduates of the Little League program. Jay is only the first one Ito reach the majors. And each of b this year's contestants k nao w, that. SThe eight teams, comprised of 1 youngsters each, madeo VWi- JOE W ILLIAMS iamsport after regional playoff s. JO E W LM [ aThe personnel for each regional SI am Is an All-Star aggregation t e w kicked from the individual league fSltton oe little word afte another and wh atever became which the youngsters played o ah an pson? twAl o .p at w havmae a lovely lo mokig bll throughout the season. Once chos- ter, at.ro Apropos of which, this week'smae or V fight en, they were sent against simi- emnateUs tOfrom e lFMcaelseo'sf O Pafae, which MAYor 'n lar teams in their own region for not ave been the load of the ornal Milk Fund fights. Fr the right to make the trip to Wil- day nightBobo Olson will defend hismiddleweight tile against liamsport. Rocky Castellani. The champion has the equipment to win on The eight regions which will be points or by knockout. Castellani is an ardent disciple of the represented in the Series a e: ab-and-grab cult. If Olson e ant devise a way to make him New England; New York and Ca- open up, iteeould bea drearynight for the Living Room AC. nada; Pennsylvania; the Mi d- S* west; the Pacific Coast; the Sitting on the sidelines awaiting a call to meet the winner, Southwest; the Southeast, and the is ey Glardello. It will be Interesting to see where this one Atlantic Seaboard. wV s up. In an effort to make sure Giardello's position as a The regional winners are flown formidable challenger would not be Impaired, Boby Jones, his to Williamsport and housed at Ly- mostd cent opponent, was offered a spiraling bribe (it went coming College during the Series. from $t,000 to $15,000) to put on the water wings. The bribe The boys all are under the super- was spurned.Tand thanks to Jones' admirable cooperation with vision of Mickey McConnell, Lit- the law, Clarence Henry, one-time number three ranking heavy- tle League field director and for- weight, and an obscure character named Joe Hacken,,were jug- mer Brooklyn Dodger chief scout, ged. Be tween them Henry and Hacken couldn't raise enough and Ed Steit, physical education ady to buy the flaIrht to the life rand times of ake La- director of Springfield College. S tt. Obtly, they Wetre front en tor whom were they The Little Leaguers aren't them fronting? |Uonly b aseball people who turn up tha tlhel lr abe ri ng tw fo rlnegv tel lobby each ear non LKesue i 1ana as erin at to thsreeorat eaps ntbe il f oor h oeSeri s heor, w lk Q ebeha d knowledge ofs the late e artofodeul far si rookln ode Ioni e st Nerms around I tryngstobri i. his o apnelow nfo wcan he othe beb leiPV . sato whthemengooI ue tt ot. IAnother good uesteon Is thia ors the ries Jame the town," e e Ano o nBobti rrat, LL faromoton drec- notoriously known manT nanas. feltInthe actual crect on tor points out. "We expect almost o o iadsllo kow ig To B e, elt the r 1000 of th em and they come from o, f h" arde...o' r in afairs l B every part of the country You see g l to former stars like Leftysaomez or Istuated soley by the fact that he is related to onee o thefight-o Cobnbor Raoe yorn shvy wa 1i ets eco-manazers. It has often been demonstrated that a rguy oun.hayo uae p- Am Norris of BCI figuing on brigig Glardelr o o here fora oMackn ofthe Athle, atics." championship bout, the boxing commission should takeeps -i The games themselves, if pastt and Iff the commissiumon doesn't, the D.A.'s office should, Giar-reords hold form w ill be tightly e dells should be kept out of New York for his own good.Around contesteld affairs. Birming he a i m, t here hea te tracts too many vere.f And apparently there noth- lainlast year's champs a won the to WX he can do about ft. Elsewhe, fbmght be less embarrassed in,, 1-0, with Joey Sims' pitching d anduIfhe happened to feel like using "Yes, We Have No Bana- the big thing. In 1951, it took a a nas," there would be no unkindly remarks. shutout for Stamford, Conn., to W take the crown, the same fort It shouldn't he asking too much of big league umpires to1 Hammontown, Pa., the se win-fi know the rules. In -a recent game between the Phils and the, H to erPa the 4 w Cards, three of Warren Giles' umpires were wrong on the same To win the title, a team must play. A run had scored during a rundown, which made the third get through three contests. T h e out r l d the three umps. Donatelli, Gore and Gorman, said It games are played in the pictur- oldn't count, since the rundown was part of a double play. Ac- esque Little League stadium in tually the continuing force of the double play had been remov-lWiliamsport and at ouch o ofld- ed by the previous out of second base, a fact which the fourth line sandlot play enters the Series umapire, Jocko Conlan, hastened to point out. Aside to Tommy when finances are meant io ned. CcnnoUy: The reason they have four umpires ,t because there's There is no admission tp the Se- always a chance one of them will know what time it Is.f ries, but the boys pass the hat toEH .Carl Furillo picked out an lmiortant series to remind the gainrvi fans that until some one comes as along to prove othetrwise, he Is JI r l still the M batting champion. Without his two extremely thus-rk L hS lrlesOf y home runs in the first two games, the aeBrooklys would not a have spt the Gantn to cut their deficit h the standins to -"" in The Giants certainly did not look like can't-miss pennant winners throughout the series. Anytime Sal Maglie can't hold the Dodgers, the situation is not normal. Leo Durocher got him out of there Jn time to save his life, even if it didn't show In the bx score. The Dodgers were taking their beat holds against the Uarber, something they seldom do. On the whole the Dandy Little Manager called a sensible series, though It was a bit sur- prising to see him throw in the sponge in the seventh Inning of Sunday's game. No matter what the score, you Just don't use a Dodger-Giant game to give a. kid pitcher like Glel a workout, especially in Ubbets Field where anything can happen. However, it wag a rewarding series for the articulate Willie Mays aficio- nados. The Say Hey phenomenon got a home run and ran out from under his hat once. PANAMA AMERICAN WANT AS) - CAN V YOUR P-ffeDS! their third straight penna'lt. th The front running New York 01- "' ants are 8-5. The Oiants were a 7-10 choice on July 21st, then tre went into a tailspin the next W day. yo Odds on Milwaukee are four m: and one-half to one. The Braves, four and one-half games out, were 50-to-1 outsiders one month Ba ago. th Oda-makers have made Cleve- th land an 8-5 favorite in the wh American League. They don't foi quote odds on second place New York or third place Chicago. cee WASHINGTON If the entire hig Washington baseball club shows Ou up today smoking cigars there iM are two good reason-Bob Por-to tertield and Jerry nyder. I PorTerfleld, the Nat rlghthand- o er, has become the father of ah up seven pound, seven ounce daughter. Snyder, an Infielder, i id passin out smokes because of IOn an eight-pound, three-ounce t son. I the W TMr NrSTi, Maryland the The BIaltlore Colts o the Na yo tional Football League have and traded end Barney poole to the pia New York wants. The Oiats get Poole In return ( for one of ti9sr hoices in the Un player draft nt year. Coach sqi Webb wbmnk of the Colts says gag he hesitated to let Poole go, but thil decided to go with younger play- a i ers. !rea The _0-year-old Poole who i Onr tarred at uIMppi and Wet the Pabt-previsl OWN withMpi Little Lea._____ g ue-.'*ci ;*i '. -U--r--- oHEAT b, r xp let to rih Bobby Tbomason E.aDon :m wd JeryWdftt Th Phadelhia qu tao swrkbg at ...____ sa_, (B4) _.. -- Reports Say Dres Will Return To Ma NEW YORK, Aug. 19 (UP) I definitely am not4 It's reported that former Brook- new manager." lyn manager Charley Drepsen Dreasen says It is all will return to the majors, him. Charlie aids-"' Two high baseball officialstto think Irve beenottLa have told the. United Press the bis league jobs and U Philadelphia Phils are ready to letting on about them. make Dressen an offer. But gen- haven't gotten any offers eral manager Roy Hamey of the Dressen says he Phils denies he is in San Fran- plans for nelt ', cisco to talk with Dressen. Chuck "But." admits Urlie, Z now manages Oakland of the Pa- listen if any major cific Coast League. He left came to me with a Brooklyn last fall after a con- Alse I tract disagreement. Bobby Bs ofn e hadrhss s eal One official says winninal a a warmia frla pennant has become a passion iLeague President Ca with Philly president Bob Car- Rowland. Rewlamj e haR center. This source says Car- gan-1 advise yea center feels Dressen can win officials handle the adAO for him In 1955. The Phils fired Bragan was suspended 'Steve O'Neill last month Pad day for arguag with aiga-, Terry Moore took pver for the plre. rest of the season. Former Chicago. White- -o When asked about the Dressen manager Jack Onslow Is "rstUn report, Hamey sald-"I don't comfortably" ino Augut. a know why you fellows say that following a heart atsac. oAuw stuff. You can sty, however, that was stricken Saturday. . ... ; ,o l, Af ROOSEVELT B A LADIES' DAY..-..C. D. Pepper grimaces ettin over the bar in the high jump qf the Wobmen's Amateur Athletic Association National Intermediate and Junior Championships at Chtswitk, Eng- land. Displaying the classic form of the celebrated statue, "The Discda Thrower/' save for the feminine form and attire, Ann Stevens winds up to launch the disc. (NR J G-Men Thwart Das hardly Plot To Shoot Ng .With. Slow Pill. By HARRY GRAYSON tives of the Thoroughbred Racing prepared to inject a powerful | Protective Bureau, which prompt- stimulant into the horse's neck. 'j NEW YORK, Aug. 19 (NEA)- ed this reporter to ask Spencer J. The three jerks trying to heat the Drayton, who directs it as head of gate at Narragansett were bigger the Thoroughbred Racing Associa. uckers than regular horse play. tions, for other amusing stories in rs. connection With racing rogues. I A | With some sort of a walkie- A recent case was pure miller. 1T D A Yf I alkie arrangement, they attempt- drammer, unadulterated thud and O D A - d to get a jump on the field, blunder. I am entitling this one SHOWS rith the information transmitted "Cloak and Dagger in the Pad. 300, 5:00 7:00. 900 p.m. o blokes at $50 and $100 win- dodk." : 9 : " ows. They probably figured that Instead of trying to give a horse mill was as good as a mile. an advantage, this group, three , What a bath they would h 'v e men and a woman, planned to taken with famous slow starters guarantee a loser-yet. The loser ke Whirlaway and Stymie! preferably should be a heavy fa- They were picked up by opera- vorite. That would have b e e n profitable to unscrupulous book- makers. Miss Not As The plan was so fantastic that. it might have worked had it not of i, m m- been for the TRPB's policy of ood As Mile following up every rumor. The diabolic scheme w as to NEW YORK -(NEA)- Herman shoot the horse with a home-made lckman, who has turned to the air-pressure gun powered by a radio and writing business in or- C02 cartridge. The bullet was a er to keep his four-ton build in pellet carrying a depressive drug, hape, came within a regulation or'slow pill. , a having Roger Bannister, Wes The culprits had previously de- antee and John Landy hoop up termined that the shooting caused a a special mile race. no more reaction on the thorough- bred than the bite of a fly. The At the time Landy, the Austral. damaging effect, of course, came n broke Bannister's mile mark later as the drug took effect. JAE ith a 3:58 clocking, Hickman The first victim was a nation. I opposed that he and the English ally known stakes horse. On the .. octor get together and race a afternoon of the race, one of the ile in America against Santee ,gang had been assigned to follow e Kansas cowboy. It was a the steed from barn to paddock, Iream mile" to end all dreams. where he was to "finger" t he With Dan Ferris, secretary y animal for the one who would easurer of the A.A.U., Hickman's "shoot" him from the paddock. CBS radio employers and New terrace. rk Park Commissioner Bobi Everything went according to oses pitching in, it seemed there schedule until the "trigger man" eight be a chance. unbuttoned his coat to get at the airgun. All hands wert seized: Ferris contacted both Landy and A little item from the TRPB 1 minister when the pair were on Iannounced there had been but I eir way to Vancouver, where two cases of stimulation among ey put on that historic mile 51,624 starters during the first half which saw both clip the fabled of 1954 at 39 TRA tracks. ir-minute mark. The goal of the TRPB is to nab At first, he met with little su. the scoundrel beforehand. Aenats iss. Then Ferris tried again ando not depend on flashes ofe tul- r a time those involved held tive genigs or the deductive meth. gh hopes of pulling the hods made famous by Sherlock t. The oP proposed race war Holmes and Nick Carter Their n at night with proceeds going job is the slow, careful, methodi.- the U. S., British anAustralcal and often bring accumulation the smoke dream mile talk spread by touts hoping to Landy had been com outconvince rank suckers that a doe- his home lcount for a ho rs# is fixed forakiling. _ ieh of time dangerously close BI ut j ock. ey, braoe and ulving AAU relations. It washindIn the stable area, decided to e whe thinga stimulate a borse and win himself .. . w .me O n Boa-bet. He had to borrow the bet. Today ENCANT O S "t ting money and the plan leaked. ,._____hp_____an Sa s. TexaM and the ne e r.. day th reJe wars w oh rk Yannks J brother, Jim.,served, in a strategically-hu-- WAHOO! $1115 i his cousin Ra, previously mirror, to approach the allbi Gary Coo'per, in ayed on the gints.ag waitchnd.-Me was congred in "ALONG CAME JONZS" oach ud Wilkinson ays he at of trying to fee the plug eor Brent in b Bsmil of sugar saturated hi iverty of Oklahoma football solution of strychnine and bruieh, I ME _M MAIf_ l_ iad wont play a return en- central nervous system st I m - ,ement In the Orange Bowl plant. Be was barred far we. Today I D E A L ! s season. Wilkinson says such A complicated ease involved the ,. IDE turn game Int "within the lotted stimulation of a graBy o /Bis aoff, Iin aim of possibility" since the gorse. There were seven graYOs at F ANKBNSTKIN" N ange Bowl pact specifies that the track. Two days later a Irai- Ann Mt- in !M same Dig Seven team can't er and groom were nabbed, by-. 8 n MA R& K n a w two year In a row. podermne aee In hand, as they, gAMA5 A ANDA Lir t .1 " At 5 P.M . UNDER NEW MANAGEMENT * New Policy SPersonal attention of Mangeme ut ; * Quality Liquors at moderate pric .The-best g Octbring )ir'. and have a wonderful timen . 1ELLA VISTA a"-, * Tomorrow in . -41. , YY TO MAR- Y A MILUXW TOMORROW FRIDAY . I r _~ I . 'TM1 PANAWMA AMERICAN AN IDWPENDENT DAILT NEWSPAPER \ TRURSDAT, AUGOT IU, aUM_ - 1. i. so- Moguls OK Two ':, - I -~.ngwu - o -.. VALSAGANA, Italy, Aug. UP)--Alcide De Gaspers: times Premier of Italy and Communists and Fascists. Unexpectedly today at his .. He was 73. Gasperi had been in tears, * hbis death, over possible col- of_ his battle for a united hi came at 2:30 a.m. after y.t lCeas of heart attacks during peGasperi had worried for ma- .j d;ys over the sudden turn for worse In the status of Euro- arpy treaties which he al- j "considered a first step to- 1 d a Europe united culturally, really and economically. .*.f tatm an. whno guid Ita. 1U ' tai 5, I '4 sadnesc and remained preoccupied until the end came early this morning. De Gasperi, weary from his long and uncompromising struggle to keep. Italy in the western camp, went north to his villa on July 28 with his devoted wife, Francesca. He had been ordered by his physician. Dr. Giovanni Borromeo. to reduce his work to a minimum five days ago, when he became ill. Two days ago. after receiving more bad news about French Premier Pierre Mendes-France'sa conditions for supporting the E.1 D C De Gasperi was ordered to bed. AN INDEPENDENT lp nAILY PrWSPAPER pan aa a menran "Let tl,- people know the truth and the country is safe" Abraham Lincoln, TWENTY-NINTH YEAR PANAMA, R. P., THURSDAY, AUGUST 19,1954 'Showdown Starts In Talks On EDC Air Of fr Fascism through a com- Last night, at 10 o'clock, D e unt- ird crisis nto the we Ga suffered a serious heart BRUSSELS. Aug 19 (UP) of a unified Germany before the German Chancellor Konrad A- cap, had been on the tele- attack. Borromeo and a special French Premier Pierre Mendes- European Army comes Into be- denauer to compromise their consti nt ly to Rome, con- consulting physician were called France faced representatives of Ing. differences over EDC and save S "T,.ith governent leaders and w hen v arrived De Gas. his Western allies today at a Mendes-France was reported it from disaster. the position they would take peri was gasping for breath. He showdown conference on wheth- to have told Belgium Foreign The Belgian, trying to me- tthe European defense communi- was given an injection to help him er there will be a six-nation Eu- Minister Paul-Henri Spaak he diate the dispute called on Men- So ference., which opened at sleep. ropean army would take this stand In the des-France at the French em- orus els today. At 2 a.m. De Gasperi complain- Mendes-France came to Brus- conference: bassy shortly after he arrived. Members of De Gasperi's fami- ed that his heart was not beating sels last night for today's open- 1. He believes his proposals for Spaak appealed for compromises said the last telephone ca l regularly. Msgr. Rodolfo Grandi, ing of the foreign ministers' a revamped EDC are the only In the French treaty amend- a the most dramatic and a sad archpriest of the diocese, was cal. meeting on the European De- qnes he can get through the ments over which the other EDC max to a career of struggle. led. He gave De Gasperi, a staunch fense Community without show- French National Assembly. nations have balked. Tey said tears streamed down Reman Catholic, the last sacra- ing signs he may change his 2. He is willing to listen to any Mendes-Fra n e repeatedly w wriakled cheeks as he heard ment of the church, watered-down amendments. amend m e n t s suggested by Insisted the other EDC coun- his friend Premier Mario With his wife, his daughters Government chiefs and for- France's other EDC partners tries must bear In mind the a of the bitter turn of e- Cecilia and Maria Romana, his eign ministers of the six na- and, possibly, to accept mall "realities" of the French par-' at Brussels that might son-in-law, and other members of tlons -France, West Germany, changes in his proposals. But he liamentary situation In consid- KI the European army proj- the family at his side, De Gasperi Belgium, the Netherlands, Ita- wil agree to no major altera- ering the proposals and put- wlay in his bed and whispered two ly and Luxembourg--opened tons. ting forward any of their own. Ifmily spokesmen said he put words. the meeting in an atmosphere 3. He Is firmly convinced Spaak, in their two-hour talk, .the telephone and turned a- "Gesu (Jesus)," he called. "Ge- of gloom. there is no reason why the was said to .have reported to y. 4th a despairing look of su." Mendes-France's refusal to other EDC countries should Mendes-France about objections change his stand cast an at- not accept the French propo- he heard from the other coun- mosphere of pessimism and sales. tries. b I I crisis over the meeting of gov- 4. He does not consider his Then he shook hands with the ernment chiefs and foreign min- proposals discriminatory against French Premier and hastened to )e G asperi W as Sym u l Isters of the six army nations for Germany, as the Bonn govern- the hotel room of Adenauer a showdown on the issue. ment insists, whose country would regain its All were aware that this con- 5. The other EDC nations must sovereignty under the pact andI V ference would either make or remember his problems with furnish 500,000 men to a West- CC4 V igilan1 t I m o ra break the plan under which a the French parliament. Failure ern European army. They met 1 sovereign West Germany would to accept his amendments would for more than an hour. Contribute 500,000 men to an in- mean rejection of EDC by the Spaak acted on direct instruc- S- torated continental army. French Assembly, a new French tions from the Belgian govern- *AVALUGoANA, Aug: 19 the murder of Socialist Deputy The United States has tied its government crisis and the death ment which decided at a cabinet e'mdet, hard-work- Giacomo Matteotti by Bonito whole Western European policy knell of the armny project. meeting, to serve as mediator in The 'Det, hasperiw Mussolini's Fascists. to the idea of a European De- Spaak listened to Mendes- a last minute attempt to save Sdemcacyl Mussolini outlawed De Gas e- fense Community (EDC). France and tried to talk him in- EDC. ed Italy through a ri's Populist Party, from which "Its final collapse would to a more conciliatory attitude. Only France and Italy have crisis the Christian Democratic arty hasten the "agonizing reap- But the French government not ratified the treaty. Their de- lpnd of World War eate r ne grew in 1925 and jailed De Gas- praisal" of which Secrteary of chief refused to retreat. lay has blocked German rear- s1 atesmen who worked withWperi the following year for anti- State John F6ster Dlles It must be his revised EDC mament and hindered the course e stature as eal to Fcist activities warned last December. plan or no European Army at all, of United States foreign policy. ed hisstoature as l. I Following ears of persecution But Mendes-France said he Mendes-France was said to have Mendes-France last week put sa modesty was dis- by the Fas De asperi ob will agree to no serious changes insisted, forward a long list of proposed the European ar- tamned a job in the Vatlcan It- in hi revisions, which would Many delegates were suspi- changes to tae original EDC ereaee In Rome early in bary and remained there until restrict the West Germans to eious. Some thought Meades- treaty and give It to the other I o w s descried as 1943 when Mussolini was over- their own soil despite the hostile France secretly was trying to five EDC nations on a take-it- 'or ft rownt reaction of the other EDC na- scuttle EDC in exchange for a or-leave-it bass. All of them S. to. afbtw r ea \s tions-West Germany, Italy stand-off agreement with the balked and Speak called today's pte between Wes Belgium, The Netherlands and Soviets crucial conference. Holland re- r fatellor eion.rad WAde- A r M as M|iwAn Luxembourg. 8paak, the portly Socialist ejected them flatly. O FI r rwaich Foreign Mn- i| nuW EIlII He also hinted he wants to leader who has led the fight for Even before the conference 4erns Bidlault. make one final effort for a set- a united Europe, made a drama- began, however, Sp ak called ,il what had to o h BUreU tiement with Russia on the issue tic appeal to Mendes-France and on the leaders of fie two old sH a= aide. 4There is no mt try to make A hero of Four new staff nurses for the L'a frst post until July 28Health Bureau were among their .a e n a g e s and held the the Canal organizat rBrooklyn Bullies -whir t poet until July 28, the first half of Augut, accord- S fn the Italian chamber Ing to a report by the Personnel F &, failed to give him a Bureau. e vote and forced his The Health Bureau is seeking |I ion new nurses and recently issued lewTorturedor Thr l n at the time of hs ed nur jobaffs. The NEW YORK, Aug. 19 -(UP)- man, do you think I'll fry?" drunk in a park at the Brooklyn hours later the news r uaired rie nfth Four teenage bullies were ar- The three other youths stood dI end of Williamsburg Bridge. They t b eaat to a stunned na- edaq ofh because of the consoli- raigned yesterday after confess- stony-faced and dry-eyed in Fe- bludgeoned him with their fists daho oIf hospital fclties ming that they terrorized Brooklyn lony Court when arraigned on and cked him so severely he the Canal Zone. w.... .rr.... ....n and kicked him so severely he emergence as pre- Four of th now employs parks in a "kill for thrills" orgy homicide charges in the death of died the next day in a hospital. ri had been re'a- hired this month were employed of torture and murder. Rheinhold Ulrickson 43, .kicked Police said Ulrickson's death to many of his in the States, while six of the The gang killed two men, horse- and bludgeoned to death on the merely whet their thirst for blood, because he had held 12 have been reviously em- whipped two girls "in an outburst night of Aug. 6. and last Monday night they stag- ce after he was played by th previously em of sexual sadism," and savagely The three were Melvin Mittman, ed a wild orgy of beatings and from tison in 1980 for our by the C employs beat two tramps, police said. 17-year old muscle-man of t he whippings that was climaxed by in 19ty for Their homur states emonp th Officers appealed to other pos- gang; Jerome Lieberman, 17, and a second murder. was a devout Ro'the Canal are: Peter Bolton, of sible victims of the sadistic forays Robert Trachtenberg 15. T h e y and a vi orous Okland, Cal, pilot-In-trainin to step forward and testify a- were held without bail for a hear- That night was "a supreme ad- Chrtan dea as ohn Clayton, Jr., Tls, Utah, against the hoodlums, whose case ing Aug. 27. venture fori me," said Koslow, as ae Christian Demo- werhouse operator in the Elecrecalled the "thrill" slaying of lit- he related how they beat and al Division; Morris R. Col- tle Bobble Franks by Nathan Leo- Koslow had been charged earl. tortured an unidentified homeless n in Pieve Tesino,n Division Morr., pipelins pol- paid and Richard Loeb in Chicago er with felonious assault in Ado- Negro by bumrng his bare feet hto, oh April 3, 1881, tion thdredge engineers pipeland Dr 30 years ago. lescent's Court and held without with lighted cigarettes before iat territory was part of Robert L. Koerg, Dallas. Texas' bail. He claimed he was not with throwing him senseless into the S There was a distinct medical officer Colon Hospital Like Loed and Leopold, the four the group when Ulrickson was East River. accent in his speech, f the 11 but Boltn haw youths came from respectable beaten. ehs later years. Of these, all but Bolton have families and their leader, Jack Silver said the boys came from "You know," the cocky teen-ag- ri attempted to haNew previous hired analservi call Koslow 18, was described as "a "good middle-class homes" and er added "I have an abstract 'q Italian line when and their ositlony s ared Muriel bright oy with a high IQ." none had a previous criminal rec- hatred ior bums--I despise Italianrted but was when and their positions are: Muriel Dist. Atty. Edward S. Silver of ord. them." and Imprisoned tor F. Howell Ruth J. Liuzza, Joan Kings C o u n t y (Brooklyn) said One of the men assaulted, Jo- Before the second killing, Silver and imprisonedght or Austria. H.Stewart, and Margaret J. WElv Koslow had been brooding be- seph Kostyra, 60, of Brooklyn, said, the gang came upon two E elected to the cha- r rtliamson, staff nurses; Elvis H. cause he was recently reclassi- was in the courtroom as a spec. girls making love with two boys S epute in 1919 but walk- Robetso B Hunt fireman fied 1-A in the draft. tator. s face was swollen and and. that the 210-pound Mittman A tin 1924 in protest against iii James B. Hu nt, fireman, He had been taking out his an- bruised. He told reporters th e lashed them across their lower S194 n protest against Fire Division James J. O'Donell ger on "no-good bums," w h '!boys attacked him twice within a backs with a two-foot whip of ., "-4 'fi-,. Dowerhouse orator, Electrical would still be occupying p ar k few weeks. braided horse-hide "in an out- unday, A Division: and Samuel H. Rowley, benches while he was in the Ar-: Silver said the killers cruised burst of sexual sadism." Say first mate on the U.S.S. Taboga. my. small Brooklyn parks in a pack, Mittman told the district attor- SLow Of these, Hunt, OrDonnell and Koslow showed no remorse, po- oreying on young girls, homeless ney he used his v i c t i m s for .. ........ :f a.m Rowley have had previous Canal lice said. As he was being-return- tramps and drunks. "punching bags-to see how hard ............ 4:13 p.m. service. a ci.1 r. Pau W Kavser, Technician of the yestrex Co., Makes a Statement on - Stereophonic Installation August. 17, 1954. o iabrega is to inform you that after Inspecting your stereophonic n together with your new seamless creen, as well as ag of varlft s il in stereophonic sound, you may ed theo mseas t of the central Theater s of a at the r i t nation picture Iadutry may set its . Pr 3atstlon, the reproduction of the r aak the picture Is e r to most prae tt ters in the to t Sfrtul CU n Ee mgT 0o Aug. o, we rang I ican puncn oxa o s e wuar jand kid "Human to bu-Ifound Ulrickson, sleeping off a enjoyment." Gloom, The had been sentenced in aben&1 to a total of ix years and qight aonth in prison. Television Girl The letter the 'fel gKn .office said, was addressed to Mrs. Mac- a mo ter In ar enemies.There was tino t e Causes hertoterb e se dsat- Indicate n ehad asu al- uset. F ter red hid beenaca e x- though he is arded YO ices as hothh he Is reo n ded asnper- In;NY"flft -' planatlom that she was otna to haps the only man an Weste'rn m. s~. uuus.mOs~ .visit an old friend from (qiro. Europe who could bridge the .The Cairo postmark only gap between the two. NEW YOR, Aug. 10 (1P) deeneo the mystery df her Ruth H arias, a blev ulon enter- plight. A foreign office spokes- Britain also was reported to taier from Atlanta. Oa., and man said: "I could have come have urged moderation between Norfolk, Va..,, rented 10 homing from anywhere, we have no France and Germny.! Prime pieons and-sent them to New Idea." Minister Winston Churchill, after ork TV bosses in transparent urgent talks with British diple-boxes each with three messages The spokesman also revealed mats, sent Ambassador Sir ad- attache: that he letter bore.thdae Oct. wyn Jebb fly to Paris Yet- 'Please call me for an ap- 24, 1903--only a little more than day for a ast minute train pointment." a month after she %ls ea. side talk with Mendes-France. "I' al ov." and !MacLean served in C With Allied sources said the chances- "Please ton bother me any the British foreign officebefore were sliht that Adensuer an0 more. Go back to Atlanta." being a olnted chiefofthe for- Mendes-ranbe could compro- She added the'notation' 'check eign o e's North American mise their differences. Adenaler one." section in London He held that still Is committed to his stand So far ohe has received two post.at the time he disappeared. of ratification of the treaty first, phone calls; ,lx messages for Just a- year earlier, in May, 1950, t h e n amendments. Mendes- a int!Aepts. and one audition. Ma.Lean had suffered a nervous France demanded the changes Only t of th U'plveonus are un- breakdown while aervming t* the first. heard ftt. Cairo post. WEEK-END RELEASE 0-60 - TODAY .:;5-i:'%W LUX T O D_ Y -'* 2:45 3:5 5:36 -, 7:15. *rT s.U. SPmINE-CHILU A UPR-SHOCKER i 0, PAWL%-*ATM The special senate s-tubeoittee whh thy feud meet In Washington to seek an agree nt ont mi a _J. ^ai ANsY CA^A. -oft *9.^ fe^ part of rep o r Sown at the meeting are (left to rnMt) aa . Ark.);SM Dj, chaim C an Cd OU 6 A S* j . I .' - SvA1 ,e ' -Red, Anti-Fascist i De Gasperi Dies -0- 5 S a 'I Te sk FI ,. ~ ~-. a ; , Full Text xml version 1.0 encoding UTF-8 REPORT xmlns http: xmlns:xsi http: xsi:schemaLocation http: INGEST IEID EH92SRFAO_XNIFME INGEST_TIME 2012-08-16T12:40:18Z PACKAGE AA00010883_00479 AGREEMENT_INFO ACCOUNT UF PROJECT UFDC FILES
http://ufdc.ufl.edu/AA00010883/00479
CC-MAIN-2016-36
refinedweb
31,475
73.07
Pundit provides a set of helpers which guide you in leveraging regular Elixir methods to build a simple authorization system. This library is based heavily on Jonas Nicklas' Ruby project of the same name. Simple Elixir functions are defined for a given struct and allow you to encapsulate authentication logic. You can use this code within a module that is an Ecto.Schema, but that's not necessary (Ecto isn't required). The action names are taken from the list of actions defined by Phoenix controllers. To install Pundit, just add an entry to your mix.exs: def deps do [ # ... {:pundit, "~> 1.0"} ] end (Check Hex to make sure you're using an up-to-date version number.) Here's a basic example, starting with a simple struct for a Post.Policy should be created to encapsulate all of the access methods ( Pundit will automatically look for the <struct module>.Policy module to determine the module name to look at for access methods). To declare an initial set of access functions ( show?, edit?, delete?, etc) which all return false (default safe!), just use Pundit.DefaultPolicy. You can then override the functions as needed with the logic necessary to determine whether a user should be able to perform the given action. In this example, we only determine whether a user can edit? a post, leaving all other functions (like delete?) to return the default of false. defmodule Post do defstruct [:author, :title, :body, :comments] defmodule Policy do # This will initialize all the action functions, all of which return false # by default. Override them individually to return true when they should, # like edit? is overriden below. use Pundit.DefaultPolicy def edit?(post, user) do user.name == post.author end end end post = %Post{author: "Snake Plissken"} author = %{name: "Snake Plissken"} # next line is same as Pundit.can?(post, author, :edit?) # Pundit will just delegate to Post.Policy.edit?(post, user) if Pundit.edit?(post, author) do IO.puts("Can edit!") end if Pundit.delete?(post, author) do IO.puts("This line should never be called") end # raise exception if user should be able to do a thing Pundit.authorize!(post, author, :edit?) You can also provide query scope for a struct (say, if you're using Ecto.Schema) for a given user. For instance, say our Post was an Ecto schema. Our function for scoping all Posts to a specific User could be to find all Posts that were authored by a user. For instance: defmodule Post do use Ecto.Schema import Ecto.Query, only: [from: 2] defmodule Policy do use Pundit.DefaultPolicy def scope(query, user) do from post in query, where: post.author_id == ^user.id end end end user = MyApp.Repo.get(User, 1) posts = Pundit.scope(Post, user) |> Repo.all() query = from p in Post, where: p.comment_count > 10 popular_posts = Pundit.scope(query, user) |> Repo.all() See the docs for more examples. To run tests: $ mix test Please report all issues on github.
https://awesomeopensource.com/project/bmuller/pundit-elixir
CC-MAIN-2021-21
refinedweb
494
62.24
- Silverlight Best Practices: Asynchronous Programming - Using Action for an Event Façade - Using the Asynchronous Programming Model (APM) - The Problem: Nested Service Calls - Summary The Problem: Nested Service Calls The problem with using this method becomes evident when you must nest several calls and wait for the result of one call to complete before the next call is made. For example, consider a block of code that must add numbers to the result of previous calls. The next addition cannot take place until the previous result returns. Here is the code it takes to add three numbers asynchronously with exception handling: public void AddThreeNumbers() { Add(1, 2, _AddThreeNumbersStepTwo); } private void _AddThreeNumbersStepTwo(Exception exception, int result) { if (exception != null) { throw exception; } Add(result, 3, _AddThreeNumbersStepThree); } private void _AddThreeNumbersStepThree(Exception exception, int result) { if (exception != null) { throw exception; } Debug.WriteLine("1 + 2 + 3 = {0}", result); } That’s a lot of code to perform a simple set of operations that is basically a sequential asynchronous workflow. You could try to simplify this by using lambda expressions and ignoring any exceptions: public void AddThreeNumbersShorter() { Add(1, 2, (e,r)=> Add(r, 3, (ex,result) => Debug.WriteLine("1 + 2 + 3 = {0}", result))); } Obviously that takes less space but is more confusing to read and less easy to maintain. That is just with two sets of numbers to add-imagine how complex it could become with more steps! Fortunately there are two solutions that can help you organize asynchronous operations in your code. Solution 1: The State Machine The state machine solution uses the current .NET Framework and the iterator function to create an asynchronous workflow. Anytime you code a foreach loop, you are using an iterator. An iterator is simply a state machine that keeps track of the current state and allows you to transition to the next state. In C#, you can supply that state using the yield keyword. You can think about yield as a special return that allows the method to be re-entered. Instead of always entering the method at the beginning, code will be executed until the next iteration is required, and then will return after the previous yield statement. To see this in effect, take a look at this simple console program: class Program { static void Main(string[] args) { Console.WriteLine("Before Enumerating..."); foreach(var str in Strings()) { Console.WriteLine("Inside the loop: {0}", str); } Console.ReadLine(); } public static IEnumerable<string> Strings() { var x = 1; Console.WriteLine("Starting out..."); yield return "First String"; x++; Console.WriteLine("After the first string"); yield return "Second String"; x++; Console.WriteLine("After the second string."); yield return "Last String"; x++; Console.WriteLine("After the last string x is {0}", x); } } When you run the program, you receive the following output: Before Enumerating... Starting out... Inside the loop: First String After the first string Inside the loop: Second String After the second string. Inside the loop: Last String After the last string x is 4 This gives you an idea of how the iterations re-enter the method and continue execution where the last statement exited. This can be used to create asynchronous workflows. Any asynchronous operation follows the pattern of executing (begin) followed by returning with a result (end). This can be illustrated through a simple interface: public interface IAsynchronousStep { Action Begin { get; set; } Action End { get; set; } } To provide a workflow, you implement an iterator for the interface. The iterator calls begin, waits for the end call to take place, and then iterates to the next step. The controller for this can be written using the following code. Note that it simply creates an enumerator to iterate the collection, captures the next item, and calls the method to start it. The item is responsible for performing the asynchronous task and then calling the end method when done. The end method is set by the controller to iterate to the next item. public class AsynchronousWorkflow { private readonly IEnumerator<IAsynchronousStep> _enumerator; private AsynchronousWorkflow(IEnumerable<IAsynchronousStep> workflow) { _enumerator = workflow.GetEnumerator(); } private void _Next() { if (!_enumerator.MoveNext()) return; var next = _enumerator.Current; next.End = _Next; next.Begin(); } public static void Begin(IEnumerable<IAsynchronousStep> workflow) { new AsynchronousWorkflow(workflow)._Next(); } } Now you can implement the interface for the service call: public class AddStep : IAsynchronousStep { private readonly MyServicesClient _client = new MyServicesClient(); public AddStep(int x, int y) { Begin = () => _client.AddAsync(x,y); _client.AddCompleted += Completed; } public void Completed(object sender, AddCompletedEventArgs args) { Result = args.Result; _client.AddCompleted -= Completed; End(); } public int Result { get; private set; } public Action Begin { get; set; } public Action End { get; set; } } The implementation keeps track of a client and subscribes to the result. When the result is received, it unsubscribes and sets the result. This allows you to perform the workflow like this-while there was a bit of effort to set up the infrastructure, you can see that the code below is far easier to read, understand, and maintain-and because it uses the iterator state machine, it will not block any threads while waiting for the asynchronous steps to complete: public void AddThreeNumbers() { AsynchronousWorkflow.Begin(Addition()); } public static IEnumerable<IAsynchronousStep> Addition() { var firstStep = new AddStep(1, 2); yield return firstStep; var secondStep = new AddStep(firstStep.Result, 3); yield return secondStep; Debug.WriteLine("1 + 2 + 3 = {0}", secondStep.Result); } The fully functional version of this solution requires exception handling and more control over the types of steps you can pass in. To see the full solution, visit the Jounce project. Jounce is an open-source MVVM framework for Silverlight, and provides a workflow implementation that allows you to wrap events, routed events, and background workers, and even use generic delegates to perform asynchronous, sequential workflows using state machines. Solution 2: Await A more robust solution will be provided with the next version of Visual Studio. The solution is available now as a Community Technology Preview (CTP) called the Async CTP. You can download the latest version on the Microsoft website. The solution does not change the framework in any way, but introduces a new keyword that facilitates asynchronous tasks. This keyword is the await keyword. The easiest way to think of the keyword is as a yield keyword designed specifically for asynchronous tasks. The compiler will generate the necessary code to wrap the calls so they perform asynchronously and do not block the main thread. The await keyword works in conjunction with the new Task type that was introduced with the .NET Framework 4.0. The new type was introduced to make it easier for developers to work with multi-threaded, parallel, and/or asynchronous tasks. Using the new keyword is a two-step process. The first step is to define the signature of the task. You’ll find the signature is very similar to the asynchronous steps used in the previous solution. Instead of an end method, the method creates a special “completion source” that is set when the task is finished: public Task<int> AddNumbers(int x, int y) { var client = new MyServicesClient(); TaskCompletionSource<int> result = new TaskCompletionSource<int>(); client.AddCompleted += (o, e) => { result.TrySetResult(e.Result); }; client.AddAsync(x,y); return result.Task; } The completion source is typed to the result, and will not “complete” the task until it is updated with an exception or a result. The method then subscribes to the client to update the task with the result of the asynchronous web service call, initiates the call, and returns the corresponding task. Now that the task is set up, using it is even simpler than the previous solution because it does not have to be wrapped in an iterator. Invoking it is as simple as: public void AddNumbersWithAwait() { var result = await AddNumbers(1, 2); result = await AddNumbers(result, 3); Debug.WriteLine("1 + 2 + 3 = {0}", result); } As you can see, this is by far the easiest and most straightforward method to use and results in lean, easy to read, and simple to maintain code.
http://www.informit.com/articles/article.aspx?p=1759240&seqNum=5
CC-MAIN-2018-39
refinedweb
1,315
54.63
View all headers Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail Message-ID: <investment-faq/general/part8_1082200966@rtfm.mit.edu> Supersedes: <investment-faq/general/part8_1079601013@rtfm.mit.edu> Expires: 31 May 2004 11:22:46 GMT References: <investment-faq/general/part1_1082200966@rtfm.mit.edu> X-Last-Updated: 2003/03/17 From: noreply@invest-faq.com (Christopher Lott) Newsgroups: misc.invest.misc,misc.invest.stocks,misc.invest.technical,misc.invest.options,misc.answers,news.answers Subject: The Investment FAQ (part: 17 Apr 2004 11:28:34 GMT Lines: 1100 NNTP-Posting-Host: penguin-lust.mit.edu X-Trace: 1082201314 senator-bedfellow.mit.edu 569 18.181.0.29 Xref: senator-bedfellow.mit.edu misc.invest.misc:42154 misc.invest.stocks:840673 misc.invest.technical:101762 misc.invest.options:54797 misc.answers:17221 news.answers:270003 View main headers The Investment FAQ is a collection of frequently asked questions and answers about investments and personal finance. This is a plain-text version of The Investment FAQ, part: Insurance - Annuities Last-Revised: 20 Jan 2003 Contributed-By: Barry Perlman, Chris Lott ( contact me ), Ed Zollars (ezollar at mindspring.com) An annuity is an investment vehicle sold primarily by insurance companies. Every annuity has two basic properties: whether the payout is immediate or deferred, and whether the investment type is fixed or variable. An annuity with immediate payout begins payments to the investor immediately, whereas the deferred payout means that the investor will receive payments at a later date. An annuity with a fixed investment type offer a guaranteed return on investment by investing in government bonds and other low-risk securities, whereas a variable investment type means that the return on the annuity investment will depend on performance of the funds (called sub-accounts) where the money is invested. Based on these two properties with two possibilities each, there are four possible combinations, but the ones commonly seen in practice are an annuity with immediate payout and fixed investments (often known as a fixed annuity), and an annuity with deferred payout and variable investments (usually called a variable annuity). This article discusses fixed annuities briefly and variable annuities at some length, and includes a list of sources for additional information about annuities. Fixed Annuities The idea of a fixed annuity is that you give a sum of money to an insurance company, and in exchange they promise to pay you a fixed monthly amount for a certain period of time, either a fixed period or for your lifetime (the concept of 'annuitization'). So essentially you are converting a lump sum into an income stream. Whether you choose period-certain or annuitization, the payment does not change, even to account for inflation. If a fixed-period is chosen (also called a period-certain annuity), the annuity continues to pay until that period is reached, either to the original investor or to the investor's estate or heirs. Alternatively, if the investor chooses to annuitize, then payments continue for a variable period; namely until the investor's death. For an investor who annuitized, the insurance company pays nothing further after the investor's death to the estate or heirs (neither principal nor monthly payments), no matter how many (or how few) monthly payments you received. Fixed annuities allow you some access to your investment; for example, you can choose to withdraw interest or (depending on the company etc.) up to 10% of the principal annually. An annuity may also have various hardship clauses that allow you to withdraw the investment with no surrender charge in certain situations (read the fine print). When considering a fixed annuity, compare the annuity with a ladder of high-grade bonds that allow you to keep your principal with minimal restrictions on accessing your money. Annuitization can work well for a long-lived retiree. In fact, a fixed annuity can be thought of as a kind of reverse life insurance policy. Of course a life insurance contract offers protection against premature death, whereas the annuity contract offers protection for someone who fears out-living a lump sum that they have accumulated. So when considering annuities, you might want to remember one of the original needs that annuitities were created to address, namely to offer protection against longevity. Another situation in which a fixed annuity might have advantages is if you wish to generate monthly income and are extremely worried about someone being able to steal your capital away from you (or steal someone's capital away from them). If this is the case, for whatever reason, then giving the capital to an insurance company for management might be attractive. Of course a decent trust and trustee could probably do as well. Variable Annuities A variable annuity is essentially an insurance contract joined at the hip with an investment product. Annuities function as tax-deferred savings vehicles with insurance-like properties; they use an insurance policy to provide the tax deferral. The insurance contract and investment product combine to offer the following features: 1. Tax deferral on earnings. 2. Ability to name beneficiaries to receive the balance remaining in the account on death. 3. "Annuitization"--that is, the ability to receive payments for life based on your life expectancy. 4. The guarantees provided in the insurance component. A variable annuity invests in stocks or bonds, has no predetermined rate of return, and offers a possibly higher rate of return when compared to a fixed annuity. The remainder of this article focuses on variable annuites. A variable annuity is an investment vehicle designed for retirement savings. You may think of it as a wrapper around an underlying investment, typically in a very restricted set of mutual funds. The main selling point of a variable annuity is that the underlying investments grow tax-deferred, as in an IRA. This means that any gains (appreciation, interest, etc.) from the annuity are not taxed until money is withdrawn. The other main selling point is that when you retire, you can choose to have the annuity pay you an income ("annuitization"), based on how well the underlying investment performed, for as long as you live. The insurance portion of the annuity also may provide certain investment guarantees, such as guaranteeing that the full principal (amount originally contributed to the account) will be paid out on the death of the account holder, even if the market value was low at that time. Unlike a conventional IRA, the money you put into an annuity is not deductible from your taxes. And also unlike an IRA, you may put as much money into an annuity as you wish. A variable annuity is especially attractive to a person who makes lots of money and is trying, perhaps late in the game, to save aggressively for retirement. Most experts agree that young people should fully fund IRA plans and any company 401(k) plans before turning to variable annuities. Should you buy an annuity? The basic question to be answered by someone considering this investment is whether the cost of the insurance coverage is justified for the benefits that are paid. In general, the answer to that question is one that only a specific individual can answer based on his or her specific circumstances. Either a 'yes' or 'no' answer is possible, and there may be much support for either position. People who oppose use of annuities will point out that it is unlikely (less than 50% probability) that the insurance guarantees will pay off, so that the guarantees are expected to reduce the overall return. People who favor use of annuities tend to suggest that not buying the guarantees is always an irresponsible step because the purchaser increases risk. Both positions can be supported. But the key issue is whether the purchaser is making an informed decision on the matter. Now it's time for some cautionary words about the purchase of annuities. Many experts feel that annuities are a poor choice for most people when examined in close detail. The following discussion compares an annuity to an index fund (see also the article on index funds elsewhere in this Variable annuities are extremely profitable for the companies that sell them (which accounts for their popularity among sales people), but are a terrible choice for most people. Most people are much better off in an equity index fund. Index funds are extremely tax efficient and provide, overall, a much more favorable tax situation than an annuity. The growth of an annuity is fully taxable as income, both to you and your heirs. The growth of an index fund is taxable as capital gains to you (which is good because capital gains taxes are always lower than ordinary income) and subject to zero income tax to your heirs. This last point is because upon inheritance the asset gets a "stepped up basis." In plain English, the IRS treats the index fund as though your heirs just bought it at the value it had when you died. This is a major tax advantage if you care about leaving your wealth behind. (By contrast the IRS treats the annuity as though your heirs just earned it; they must now pay income tax on it!) If you remove some money from the index fund, the cost basis may be the cost of your most recent purchase (or if the law is changed as the administration currently recommends, the average cost of your index investments). By contrast, any money you remove from an annuity is taxed at 100% of its value until you bring the annuity's value down to the size of what you put in. (The law is more favorable for annuities purchased before 1982, but that's another can of worms.) Tax considerations aside, the index fund is a better investment. Try to find some annuities that outperformed the S&P 500 index over the past ten or twenty years. Now, do you think you can pick which one(s) will outperform the index over the next twenty years? I don't. Annuities usually have a sales load, usually have very high expenses, and always have a charge for mortality insurance. The expenses can run to 2% or more annually, a much higher load than what an index fund charges (frequently less than 0.5%). The insurance is virtually worthless because it only pays if your investment goes down AND you die before you "annuitize". (More about that further on.) Simple term insurance is cheaper and better if you need life insurance. Annuities invest in funds that are difficult to analyze, and for which independent reports, such as Morningstar, are not always available. Annuity contracts are very difficult for the average investor to read and understand. Personally, I don't believe anyone should sign a contract they don't understand. Annuities offer the choice of a guaranteed income for life. If you choose to annuitize your contract (meaning take the guaranteed income for life), two things happen. One is that you sacrifice your principal. When you die you leave zero to your heirs. If you want to take cash out for any reason, you can't. It isn't yours anymore. In exchange for giving all your money to the insurance company, they promise to pay you a certain amount (either fixed or tied to investment performance) for as long as you live. The problem is that the amount they pay you is small. The very small payoff from annuitizing is the reason that almost no one actually does it. If you're considering an annuity, ask the insurance company what percentage of customers ever annuitize. Ask what the payoff is if you annuitize and you'll see why. Compare their payoff to keeping your principal and putting it into a ladder of U.S. Treasuries, or even tax-free munis. Better yet, compare the payoff to a mortgage for the duration of your expected lifespan. If you expect to live to 85, compare the payoff at age 70 to a 15-year mortgage (with you as the lender). For a fixed payout you would be better off putting your money into US Treasuries and collecting the interest (and keeping the principal). Now let's consider a variable payout, determined by the performance of your chosen investments. The problem here is the Assumed Interest Rate (AIR), typically three or four percent. In plain English, the insurance company skims off the first three to four percent of the growth of your investments. They call that the AIR. Your monthly distribution only grows to the extent that your investment grows MORE than the AIR. So if your investment doesn't grow, your monthly payment shrinks (by the AIR). If your investment grows by the AIR, your monthly payment stays the same. When the market has a down year, your monthly payment shrinks by the market loss plus the AIR. If you do decide to go with an annuity, buy one from a mutual fund company like T. Rowe Price or Vanguard. They have far superior products to the annuities offered by insurance companies. Annuities in IRAs? Occasionally the question comes up about whether it makes sense to buy a variable annuity inside a tax-deferred plan like an IRA. Please refer to the list of four features provided by annuities that appears at the top of this article. The first, income deferral, is utterly irrelevant if the annuity is held in an IRA or retirement account. The IRA and plan already provides for the deferral and, in fact, distributions are governed by the provisions of Section 72 applicable to IRA retirement plans, not the general annuity provisions. I would go so far as to tell anyone who has someone trying to sell them one of these products in a plan based on the tax benefits to run as fast as possible away from that adviser. S/he is either very misinformed or very dishonest. The second, beneficiary designation, is also a nonissue for annuities in a retirement account. IRAs and qualified plans already provide for beneficiary designations outside of probate, for better or worse. The third, annuitization, is potentially valid, since that is one method to convert the IRA or plan balance to an income stream. Of course, nothing prevents you from simply purchasing an annuity at the time you desire the payout rather than buying a product today that gives you the option in the future. I suppose it is possible that the options in the product you buy today may be superior to those that you expect would be available on the open market at the time you would decide to "lock it in" or you may at least feel more comfortable having some of these provisions locked in. Finally, the fourth feature involves the actual guarantees that are provided in the annuity contract. To take care of an obvious point first: the guarantees are provided by the insurance carrier, so clearly it's not the level of FDIC insurance that is backed by the US Government. But, then again, only deposits in banks are backed by this guarantee, and the annuity guarantees have generally been good when called upon. Normally, any guarantee comes at some cost (well, at least if the insurer plans to stay in business [grin]) and the cost should be expected to rise as the guarantee becomes more likely to be invoked. Some annuities are structured to be low cost, and tend to provide a bare minimum of guarantees. These products are set up this way to essentially, provide the insurance "wrapper" to give the tax deferral. I would note that if, in fact, the guarantees are highly unlikely to be triggered and/or would only be triggered in cases where the holder doesn't care, then any cost is likely "excessive" when the guarantee no longer buys tax deferral, as would be the case if held in a qualified plan. Note that the "doesn't care" case may be true if the guarantee only comes into play at the death of the account holder, but the holder is primarily interested in the investment to fund consumption during retirement. What this means is that you need a) a full and complete understanding of exactly what promise has been made to you by the guarantees in the contract and b) a full understanding of the costs and fees involved, so that you can make a rational decision about whether the guarantees are worth the amount you are paying for them. It's theoretically possible to find a guarantee that would fit a client's circumstance at a cost the client would deem resaonable that would make the annuity a "good fit" in a retirement plan. Some problems that arise are when clients are led to believe that somehow the annuity in the retirement plan gives them a "better" tax deferral or somehow creates a situation where they "avoid probate" on the plan. A good agent is going to specifically discuss the annuitization and investment guarantee features when considering an annuity in a plan or IRA and will explicitly note that the first two (tax deferral and beneficiary designation) don't apply because it's in the plan or IRA. Additional Resources 1. Raymond James offers a free and independent resource with comprehensive information about annuities. 2. Client Preservation & Marketing, Inc. operates a web site with in-depth information about fixed annuities. 3. Scott Burns wrote an article "Why variable annuities are no match for index funds" at MSN Money Central on 15 June 2001. 4. TheStreet.com rated annuity comparison shopping sites on 5 May 00. Also look for the links to two articles by Vern Hayden with arguments for and against variable annuities. 5. Cornerstone Financial Products offers a site with complete information about variable annuities, including quotes, performance, and policy costs. 6. "Annuities: Just Say No" in the July/August 1996 issue of Worth magazine. 7. "Five Sad Variable Annuity Facts Your Salesman Won't Tell You" in the April 5, 1995 Wall Street Journal quarterly review of mutual funds. 8. WebAnnuities.com helps investors choose annuities with instant quotes and an annuity shopper's library that has extensive information about annuities. --------------------Check for updates------------------ Subject: Insurance - Life Last its cheap - but run the numbers, the agent is usually wrong, remember, agents are really salesmen/women and its in their interest to sell you insurance. Also - I am strongly against insurance on kids on two counts. One, you are placing a bet that you kid will die and you are actually paying that bet in premiums. I can't bet my child will die. Two, it sounds plausible, i.e., your kid will have a nest egg when they grow up but factor inflation in - it doesn't look so good. A policy of face amount of $10,000, at 4.5% inflation and 30 years later is like having $2,670 in today's dollars - it's NOT a lot of money. So don't plan on it being worth much in the future to your child as an investment. In summary, skip insurance on your kids..5% (for TBILL investments, quite conservative) and 8-10% (for growth stocks, more risky), but not definitely not 12%. I would try 8% and insist it be done that way. Ask each agent these questions: 1. What is the present value of the payment stream represented by the premiums, using a discount rate of 4.5% per year (That is the inflation average since 1940). This is what the policy costs you, in today's dollars. Its very much like paying that single number now instead of a series of payments over time. If they disagree with 4.5%, remind them that since 1926, inflation has averaged 3.5% (Ibbotson Associates) and then suggest they use 3.5% instead. They may then agree with the 4.5% (!) The lower the number, the more expensive the policy is. 2. What is the present value of the the cash value earned (increasing at no more than 8% a year) and discounting it back to today at the same 4.5%. This is what you get for that money you just paid, in cash value, expressed in today's dollars, i.e., as if you got it today in the mail. 3. What is the present value of the life insurance in force over that same period, discounted back to today by 4.5%, for inflation. That is the coverage in effect in today's dollars. 4. Pick an end date for comparing these - I use age 60 and age 65.: * Consumers Reports printed an in-depth, three-part series in their Jul/Aug/Sep 1993 issues. * Many sites on the web offer life insurance quotes. Here are a few that have been rated highly by consumer advocates. Also see the article in the New York Times of 1 August 2001. Insweb.com , NetQuote.com , Quicken.com , Quotesmith.com , Youdecide.com , Term4sale.com . --------------------Check for updates------------------ Subject: Insurance - Viatical Settlements Last. * Are you holding back from medical treatment, thinking this will give you a larger viatical settlement? Don't. It won't get you more money. Viatical providers take into account Investigational New Drugs (INDs) when they price policies. Even if you never took any and don't plan to, they expect viators will try anything that gives hope, and they price accordingly. * Was your policy resold by the viatical company? If so, you have no obligation to a second buyer -- unless you signed an agreement to extend obligations to future owners. This is like selling a car: If you sell the car to B and B resells it to C, you have no obligation to C. * Be sure to check with your insurer to find out if your policy includes Accelerated Death Benefits. If so, and if you qualify, you will get much more money -- and it will be paid faster. This applies to some group term life as well as individual policies. * Are you are a member of a Credit Union? Credit Unions may be a source of information about and referrals to licensed viatical providers. * Don't apply to only one viatical company -- even if the referral was made by your doctor, lawyer, insurance agent, social worker, or credit union. If you ignore this advice, you're likely to get thousands of dollars less. Here are a few tips for potential investors in viatical settlements. * Are you thinking of using your IRA for viatical investments? Don't. No matter what viatical sales promoters tell you, life insurance as an IRA investment is prohibited by the Internal Revenue Code. And, if you have a self-directed IRA, you are fully responsible for investment decisions. * Are you thinking of buying a policy that is within the contestability period? Don't. If the viator committed fraud on the application and the insurer discovers this, you could be left with nothing more than a return of premiums. Gloria Wolk's site offers much information about viatical settlements. --------------------Check for updates------------------ Subject:. Where does the name come from? To take the second part first, the "universal" component refers to the fact the premium is not a "set in stone" amount as would be true with traditional whole life, but rather can be varied within a range. As for the first part of the name, the "variable" portion refers to the fact that the policy owner can direct the investments him/herself from a pool of options given in the policy and thus the cash value will vary. So, for instance, you can decide the cash value should be invested in various types of equities (while it can be invested in nonequities, most interest in VUL policies comes from those that want to use equities). Obviously, you bear the risk of performance in the policy, and remember we have to keep enough available to fund the expenses each year. So bad performance could require increasing premiums to keep the policy in force. Conversely, you gain if you can invest and obtain a better return (at least you get more cash value).: * Providing a pool of money that will only be tapped at my death, but will be used by my spouse. * Providing a pool of money that will only be used at my death, but which we want to use to pay estate taxes. * Providing a pool of money that I plan to borrow from in old age to live on, and which will, in the interim, provide a death benefit for my spouse. Once the goals are clear, and you've then determined that a VUL would be something that could fulfill your goals, you then have to find the right VUL. --------------------Check for updates------------------ Subject: Mutual Funds - Basics Last-Revised: 11 Aug 1998 hasten to be better advised to speak to your neighborhood bank about a savings account. Most mutual funds require an initial investment of at least $1,000. Exceptions to this rule generally require regular, monthly investments or buying the funds with IRA money.. A closed-end fund looks much like a stock of a publically traded company: it's traded on some stock exchange, you buy or sell shares in the fund through a broker just like a stock (including paying a commission), the price fluctuates in response to the fund's performance and (very important) what people are willing to pay for it. Also like a publically traded company, only a fixed number of shares are available.. * Brill Editorial Services offers Mutual Funds Interactive, an independent source of information about mutual funds. * FundSpot offers mutual fund investors the best information available for free. * The Mutual Fund Investor's Center, run by the Mutual Fund Education Alliance, offers profiles, performance data, links, etc. --------------------Check for updates------------------ Subject:. --------------------Check for updates------------------ Subject:. 1. One phone call/Internet connection gets you access to hundreds of funds. 2. One consolidated statement at the end of the month. 3. Instant access to your money for changing funds and or families, and for getting your money in your hand via checks (2-5 days). 4. You can buy on margin, if you are so inclined. 5. Only one tax statement to (mis)file. 6. The minimum investment is sometimes lower. And the disadvantages: 1. Many discount brokerage supermarket programs do not even give access to whole sectors of the market, such as high-yield bond funds, or multi-sector (aka "Strategic Income") bond funds. 2. Most discount brokers also will not allow clients to do an exchange between funds of different families during the same day (one trade must clear fist, and the the trade can be done the next day). 3. Many will not honor requests to exchange out of funds if you call after 2pm. EST. (which of course is 11am in California). This is a serious restriction, since most fund families will honor an exchange or redemption request so long as you have a rep on the phone by 3:59pm. 4. You pay transaction fees on some no-load funds. 5. The minimum investment is sometimes higher.. --------------------Check for updates------------------ Compilation Copyright (c) 2003 by Christopher Lott. [ Usenet FAQs | Web FAQs | Documents | RFC Index ]
http://www.faqs.org/faqs/investment-faq/general/part8/
CC-MAIN-2016-30
refinedweb
4,544
61.77
My Latest Refcard: Apache Ant My Latest Refcard: Apache Ant Join the DZone community and get the full member experience.Join For Free Today DZone are launching my latest refcard where I cover Apache Ant. The purpose of the card is to be a pure reference for the tasks available. This was an interesting refcard to write as I have been using Ant for so long, that I took the range of functions that it can perform for granted. While I'm sure a lot of you have moved on from Ant, it's still a widely used technology in a lot of software development organisations. It's present in all Java IDEs, and I still use it in my day job. There are a few things that I didn't have the space in the card to elaborate on. One was examples for each of the tasks, which I will provide in a later example. The second was to show how to create your own tasks for us in Ant. When it comes to creating your own tasks, it couldn't be easier. To create your own task you just need to extend org.apache.tools.ant.Task. There are also a number of other base classes that you can extend such as JDBCTask or MatchingTask. Every attribute in your task will need to have a corresponding setter method in the Task. And finally, for execution of the task you'll need to put the implementation in the public void execute() method, which throw a BuildException in case anything goes wrong. Here's a short example of a task implementation: package com.dzone.ant.tasks; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; public class CustomTask extends Task { private String attribute1; private boolean attribute2; public void setAttribute1(String s) { attribute1 = s; } public void setAttribute2(boolean b) { attribute2 = b; } public void execute() throws BuildException { //task logic here } } To use the task in your Ant script, you'll need to create a taskdef to point to it. <taskdef name="dzonetask" classname="com.dzone.ant.tasks.CustomTask"/> And you can now use the task later on in your xml, using the value of the name attribute for the task: <dzonetask attribute1="attvalue" attribute2="true"/> Finally, if you want to provide your task as if it was one of the default tasks in Ant, you can add the task to the default.properties file in org.apache.tools.ant.taskdefs package. I hope you find that this card is useful to you. As always, any feedback is welcome, so that we can ensure the refcard is as helpful as possible. Opinions expressed by DZone contributors are their own. {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/my-latest-refcard-apache-ant
CC-MAIN-2019-35
refinedweb
461
62.38
34178/unfortunately-myapp-has-stopped-how-do-i-solve-this I am trying to develop an application, and everytime I run it, I am getting this message: Unfortunately, MyApp has stopped. What can I do to solve this? The common solution for solving App has stopped working is to reload the app, clear the cache or data, erase the cache partition, and factory reset your device. You can use this code: import java.util.*; public class ...READ MORE The department of History has just bought ...READ MORE If you require a time stamp in ...READ MORE When you declare a reference variable (i What can you do? Ignore these warnings. Tomcat ...READ MORE There are two ways to wait: explicit ...READ MORE OR Already have an account? Sign in.
https://www.edureka.co/community/34178/unfortunately-myapp-has-stopped-how-do-i-solve-this
CC-MAIN-2020-34
refinedweb
129
67.86
Well, here's the story. I decided to make my first game that uses an area larger then the default game screen. Since I've never done this before, I got the basic game template I always use. So the game has a black background, and one sprite. Because in order to create a larger area I defined the size of the virtual screen. #include <allegro.h> #define VIRTUAL_W 2400; #define VIRTUAL_H 1800; And in my movement code, I have this: I'm trying to get the current screen to go the next area (Normally, X=0. I want the X=800, which is the next area/screen). Any help with what I'm doing wrong? ____There's no place like 127.0.0.1 Can we see your scroll_screen function? I'm using the Allegro scroll screen: int scroll_screen(int x, int y); Attempts to scroll the hardware screen to display a different part of the virtual screen (initially it will be positioned at 0, 0, which is the top left corner). with set_clip_rect(). Mode-X scrolling is reliable and will work on any card, other drivers may not work or not work reliably. See the platform-specific section of the docs for more information. Allegro will handle any necessary vertical retrace synchronisation when scrolling the screen, so you don't need to call vsync() before it. This means that scroll_screen() has the same time delay effects as vsync(). Return value: Returns zero on success. Returns non-zero if the graphics driver can't handle hardware scrolling or the virtual screen is not large enough. See also: set_gfx_mode, show_video_bitmap, request_scroll, request_video_bitmap.Examples using this: exscroll. So, any ideas on what I've done wrong? EDIT: If you can't reply to this post, then PM me. Well, since scroll_screen() can only be called in your code when (xpos == SCREEN_W - sprite->w), I'd be checking whether or not this expression is ever true. Great idea! I entered this code in the character class: if(xpos == SCREEN_W - sprite->w) {TRACE("Xpos DOES equal SCREEN_W - sprite->w");} and the output file does say "Xpos DOES equal SCREEN_W - sprite->w". So it does turn out to be true. I must be doing something wrong with the scroll_screen. Any ideas? Did you read the following part of the scroll_screen() section of the manual? Mode-X scrolling is reliable and will work on any card, other drivers may not work or not work reliably. See the platform-specific section of the docs for more information. [edit]You should really be checking the return value as well. Return value for what? And I can't seem to find the relevant information in the docs about "Mode X".Is there any code to find out if it works on my computer? Sorry for asking too much, but I'm still a "beginner". Why don't you make a "camera" and draw everything according to your camera position ?That way you can scroll easily and you won't be drawing anything that can't be seen [one moment'I'll grab my code] Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)Current project: [Star Trek Project ] Join if you want ;-) Mode X is an archaic DOS graphics mode. Anyway, the usual way of doing scrolling is not by using virtual screen space and the *_scroll() functions, but by changing the position of objects you blit to the screen. -- Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18! Return value for what? The return value of the call to scroll_screen. Try this: if(xpos == SCREEN_W - sprite->w) { if (scroll_screen(800, ypos) != 0) allegro_message("scroll_screen() failed!\n"); exit(-1); } void TSprite::draw(int camx,int camy) { int DrawX=int(screenmid_x+(x-camx)); int DrawY=int(screenmid_y+(y-camy)); // only draw what we see if ((image!=NULL)&&(DrawX+(image->Width()/2)>0)&&(DrawX-(image->Width()/2)<800)&&(DrawY+(image->Height()/2)>0)&& (DrawY-(image->Height()/2)<600)) { image->BlitRotated(DrawX, DrawY,angle,opacity); } } this is my sprite drawing code .. the camx,camy coords are the MIDDLE of your viewscreen so if there is a spaceship at (10500,600) and your camera is also at (10500,600) the spaceship will appear in the middle of your screen and sprite coords are the middle of the sprite NOT top left... why ? easier to make the aiming and docking AI code gnolamAnyway, the usual way of doing scrolling is not by using virtual screen space and the *_scroll() functions, but by changing the position of objects you blit to the screen. I think I get what you mean, however, that would be more complicated then having everything written to the virtual screen, and just making the screen scroll. AriesnlWhy don't you make a "camera" and draw everything according to your camera position ?That way you can scroll easily and you won't be drawing anything that can't be seen I think you might be on the same idea as gnolam. However, I'll have to wait and see. EDIT:LennyLen, thanks for the code. It said it failed. EDIT2:Ariesnl,I don't fully understand your method. And everyone:Does anyone have any other suggestions for scrolling without Mode X that operate similar to Screen_scroll. look again I saw it and edited my post. But I don't fully understand that method. Would you be able to explain in more detail? Thanks. EDIT: Hold on, I think I got it. So, the screen remains the same, but you have camx and camy, which can be as large as whatever, and all characters, AI, etc. follow those set of co-ordinates? By the way I'm using Openlayer so some functions are diffrent.. However it is highly advised to use OpenLayer... So, the screen remains the same, but you have camx and camy, which can be as large as whatever, and all characters, AI, etc. follow those set of co-ordinates? ... In the oposite direction offcourse I think I can manage to get a similar method in Allegro. But I have just wondered something about the initial scroll-screen function:Was I meant to create a bitmap for the entire virtual screen? I think I had better test this. I don't know actually I used this method even before I ever used allegro, it always works and you only draw what's on screen The more I think about the method, the more sense it makes. Hopefully, this is what I plan to do:Create camx and camy, with the 0,0 being -800, -600 and camy and camx ending at it's 800,600 (not the screens.) Using this, all objects, code, etc. will be placed according to camx and camy. The only thing I can't work out is how to scroll, BUT, I think that using x++ and y++ for camx and camy (for when the player moves) will work. Btw, how do I "reward" people who helped me via the forum? I DO tick the box marked "The question has been answered to my satisfaction!", right? Was I meant to create a bitmap for the entire virtual screen? Yes, definitely. [edit] Btw, how do I "reward" people who helped me via the forum? I DO tick the box marked "The question has been answered to my satisfaction!", right? See previous answer. yes just camx++ will sctoll to the left (as the camera goes to the right) and so on If you check the "question was answered..." you'll get a credit list BTW what game are you making ? Lennylen: Quote:Was I meant to create a bitmap for the entire virtual screen?Yes, definitely. How should I go around doing this (just to check if it works). Ariesnl:I'm not 100% sure, but I was thinking of a top-down game. Preferably a top-down shooter, but that depends (I've done a space shooter, very, very simple however). Top-down games don't need animations (and I still haven't been able to animate any sprites, and I even tried the forums, but it's no big deal). How should I go around doing this (just to check if it works). Take a look at the exscroll.c example that came with Allegro. Actually, you should try running ex_scroll.exe, as if it doesn't work, then you'll know that hardware scrolling isn't available on your system. I will. Ariesnl:What do I do if I want to have an object at, for example, the camY and CamX values of -100, 10? How would I, for example, get the following primitive to be at a certain camC and camY point (I'm using the primitive to test it out) circlefill(buffer, int x, int y, int radius, int color); EDIT: This isn't easy. The code you supplied above doesn't seem too easy to understand. EDIT:I ran the app, it says Unable to set a 320x240 mode with 640x240 virtual dimensions EDIT3:Does anyone else have any more ideas? Simsimius: Even if the scrolling functions happen to work on your particular computer, I suggest you never touch them again. Seriously.Scrolling is implemented in hardware, by creating a video bitmap larger than the actual screen, and adjusting the screen pointer to whatever position you want. The problem with this is that there is not a single virtual screen size that is guaranteed to work on any platform; in fact, you might find yourself in a situation where no virtual screen at all is available. And even if there is a virtual screen, you can't rely on the width and height. In 640x480, for example, one card might give you 1024 x 2048, another might do 2048 x 512, yet another might give you 640 x 3000.The scrolling interface is pretty much a relic from the DOS age, to provide scrolling even when redrawing the entire screen every frame wasn't doable. This way, certain (clumsy) optimizations like the dirty rectangles algorithm are possible. Nowadays, though, an entire screen redraw is seldom an issue, so you might just as well forget that such a thing as a virtual screen exists.The only appliances for off-screen video bitmaps today are:- page flipping and triple buffering (2 or 3 video bitmaps)- hardware-accelerated spritesA "camera" or "view transform" is (in a simple 2d game, at least) nothing more than a pair of offsets by which you shift the entire scene. For example, if your old drawing code says: draw_sprite(playerspr, screenbuffer, x, y); the new code would say: draw_sprite(playerspr, screenbuffer, x + scroll_x, y + scroll_y); As long as you apply the same offset to all drawing operations, you achieve the same effect as hardware scrolling.Note that this gives you an opportunity for optimization, since you only need to draw objects that are actually visible on screen (or at least partly). ---Me make music: Triofobie---"We need Tobias and his awesome trombone, too." - Johan Halmén So, let me get this straight, the method I originally tried is not recommended, at least by you. ok. Now, the code you showed me near the bottom looks promising. So, The value of scroll_x scroll_y should be the size of the area beyone the usual 800, 600?So scroll_x could equal, 1600;and scroll_y could equal, 1200?And whenever the character walks to the edge of the screen, scroll_x and scroll_y decreases? Correct? EDIT: No, hang on, the above can't be right. Would it be possible to explain just a little. It seems simple, but I can't figure it out completely. I just can't think today >_<
https://www.allegro.cc/forums/thread/587166
CC-MAIN-2019-04
refinedweb
1,971
72.16
Here is the screen shot that I created from my mac mini that I used to build my extension: Once it was compiled, I copied the .a file over to my PC where I used ADT in the AIR 3.0 sdk to build the ane. I then used Flash Pro to build a sample application and ADT to build it. Once I got the external linking issue fixed, I was able to build an Ad-hoc build and I put it on my iPad2 and everything fired up and worked. The only problem I am having is that I can't use more than one extension in the same project. If an of you want me to change any settings to do any tests, just let me know and I will give it a try to see if works or not with what I have. I'm encountering something similar. I'm trying to write a native extension and have a very simple one working, however once I attempt to use a Framework library I get the "ld warning: unexpected srelocation type 9" and the app hangs after launch. I'm using XCode 4.2, AIR 3.1, and Flash Builer 4.6. Is the verdict that I need to roll back to 4.1, so I can use 4.3 as my Base SDK? Or maybe, there's a way to get Base SDK 4.3 for XCode 4.2? It seems if I have "Enable Linking With Shared Libraries" set to Yes, I can build and deploy the app but it crashes on start-up. If I have it set to "No" it works fine as long as I don't use any Framework libraries. If I do use one, I get link errors. I've tried a bunch of combinations of code generation and link options, to no real effect. Any pointers would be great. I'd hate to go down the path of reverting xcode, unless I really needed too. Hmm. I suppose another potention issue is I'm using FB4.6 (beta) to compile the SWC and SWF. Thanks! - Rusty Hmm. I suppose another potention issue is I'm using FB4.6 (beta) to compile the SWC and SWF. I had the same issue with both FB 4.6 (with the bundled AIR 3.1) and FB 4.5.1 (with AIR 3.0), so I think you can rule that out. andrea Update: I now have a project compiled with LLVM GCC4.2 and don't get the srelocation error. That was obviously not what's causing that problem. It might be that I now don't use any third party libs that have that relocation (type 9). As I understand it (and as andrea was on to above): the adt uses a linker (llvm?) that probably not is supporting that type of relocation. Frameworks: I discovered that I had to use a platformoptions-file for some frameworks. Here is a page that explains about it: 130044f3619-7fff.html The additional frameworks that can be used are listed here on my win7 installation: c:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\lib\aot\stub\ I also managed to use a third party framework (though the page above states that you can't/shouldn't); I extracted the single lib-file from the framework-archive and linked it with my other native lib in xcode. Seemed to work, but it feels like a kind of "hacky" solution. Glad to hear you got it to work... did you compile with the 4.3 or the 5.0 SDK? I am only linking to AVFoundation (and obviously Foundation), so there should be no need for a platform options file. I was getting type 9 relocations in *all* functions exported from my library, including the extension initializer which does nothing except setting a pointer to the context initializer and finalizer. From my understanding, type 9 relocations are emitted when using optimized instructions for loading string constants, so I still think it's an issue with code generation and not with whatever frameworks you're linking to. I honestly have neither the time nor the motivation to get back to debugging this issue, especially seeing that there is no response whatsoever from Adobe. If someone is interested in digging further I can provide the full source code of the extension (which is a simple wrapper around AVAudioPlayer to allow playing back AAC audio on iOS). andrea Yes, although I did not get it to work with my initial third party lib. I'm using 4.3SDK. I understand that these things take time. It might be a compiler flag that switches off the optimization you're suggesting. But... a little help from Adobe would be nice. Thanks for the help. Sounds like no one has gotten this to work with the iOS5 SDK / XCode 4.2 / Air 3.1? I notice XCode 4.2.1 was released recently, and the notes mention some compiler fixes. I'll give that a shot first, before seeing if I can find iOS 4.3 SDK somewhere. It wasn't included with XCode 4.2. - Rusty Hi: I would recommend following xternal-sdks-to-package-apps/ in case you are writing and ANE for iOS on xCode 4.X. AIR 3.1 has included some new features specifically to address the support of iOS 5. This blog is applicable only for Mac currently. UPDATE: If ADT throws some warnings while packaging an ipa you can ignore them. Your app should work. Regards, Saumitra Bhave Thanks. I have tried including the iOS SDK using the -platformsdk flag. Also tried including -framework Foundation as a linker flag, though the blog post says it's included automatically, so that's probably not the problem. To be specific: My extension works fine until I attempt to use the NSMutableDictionary class from the Foundation SDK in my extension. If I set "Enable Linking With Shared Libraries" to Yes, when I run adt I get linker "unexpected srelocation type 9" warnings and the app hangs on launch. If I set it to "No". I get the following link error, and am unable to build an ipa: "ld: absolute addressing (perhaps -mdynamic-no-pic) used in _getItem from /var/folders/rc/w16r02qs70zgy9q02g2vlq2r0000gn/T/01ce07e6-4a7b-421b-8a c6-bce683ba7ea8/libcom.kongregate.KeyChain.a(KeyChainExtensionLib.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs" Note: I already disabled the Generate Position Dependent Code option, to no avail. Not sure what is creating the absolute addressing. Adding -read_only_relocs suppress doesn't help much either. It just removes the suggestion, but fails on essentially the same error. It's very possible, there's some other linker or code generation option I need to throw in, just not sure what. I'd love some confirmation from someone that has successfully got this to work. One correction. Actually, using NSMutableDictionary is working fine, so it's not the Foundation framework. It's when I add a constant from the Security framework that's getting me stuck. If I add this line: CFTypeRef ref = kSecClassGenericPassword; I get the "ld: absolute adressing .." error and'm unable to link. Guess I'll bang on it a bit more. Security framework should also be included with the default optoins, and I am pointing to the latest iPhoneOS5.0.sdk. Hi rusty: Can send us the projects which can reproduce the issue on sbhave [at] adobe [ dot ] com. Finally update. So reverting to XCode 4.1 and iOS SDK 4.3 fixed the problem. I am now able to link against the Security framework as a shared library. Not sure if the problem was due to the compilers in XCode 4.2, building against 5.0 SDK (using the -platformsdk option), or something else. I'll pass more info on to Adobe to see if they can get help get to the bottom of it. At least I'm up and running now, I don't really need any features from 5.0. Putting this up here, the suggestions on this site helped me fix my problem Hope it can help someone Hello Is there any update? I have exactly the same problem with the security Framework. I'm using Xcode 4.2 and AIR 3.1 and need to write a native Extension with keychain group access. Thank you Christoph I got the same problem when trying to make a extensions that use a AVAssetWriter... any update on this problem ? we will install xcode 4.1 to see if this solution work but i hope something else is possible. EDIT : i got the same problem as rusty ... compile with shared library YES return type 9 error Shared library to NO return "ld: absolute addressing (perhaps -mdynamic-no-pic) used We use Xcode 4.3, Air 3.2 , all the latest sdk and i don't use -platformsdk as i work on a pc. other important notice... if i try to set shared librarie to NO while targeting IOS 4.0... it make a build fail! if i target IOS 4.1 it work.. with error absolute addressing (perhaps -mdynamic-no-pic) used ...... We are kind of lost with this bug.... we tried every solution giving on the subject. Last solution is Xcode 4.1 just like rusty said... i'll write if it work. rusty was right.. the only solution found was re-installing xCode 4.1... now it work Hope adobe come soon with better solution. Same Problem for me: Error occurred while packaging the application: ld: absolute addressing (perhaps -mdynamic-no-pic) used in _ASDemoGetStringLength from /var/folders/5f/3xcbv8v96gd6_rq6kbmj13900000gp/T/aa9bb7be-0f0e-4e79-8 5df-cc835b7dc2cf/libde.das3.ane.CalendarANE.a(CalendarANE.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs Compilation failed while executing : ld64 Build stops completly with this warning. Flash Buidler 4.7 on Mac OS 10.7.5 Tried with AIR SDK 3.5 and AIR SDK 3.7. Called Function: FREObject ASDemoGetStringLength( FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { NSLog(@"+++ ASDemoGetStringLength +++" ); const uint8_t * stringArgument = NULL; uint32_t strLength = 0; FREResult status = FREGetObjectAsUTF8(argv[ 0 ], &strLength, &stringArgument); int32_t value = [ [NSString stringWithUTF8String:(char *) &stringArgument] length ]; FREObject intValue = NULL; status = FRENewObjectFromInt32(value, &intValue); return intValue; } ( line which is reponsible for the error is bold and this demo-code is no vodoo magic ). "Enabled Linking with shared Libraries" is set to no in XCode. Any solution from Adobe for this? This "bug" occurs since 10 months for many devs, like we can see with in this thread. The problem behind is also known. But there is no fix for this? Okay, I've found a fix for this "error/warning": In Flash Builder 4.7 update the embedded AIRSDK to version 3.5 or greater like described here:. html ADDITIONAL: Replace the embedded AIR SDK in the linked Flex-SDK like described under this link:. html Hint: The AIR SDK version for step 1 and step 2 should be exactly the same. Now update the plattform namespace in your an descriptor files (ANE_NAME-platformoptions.xml and ANE_NAME-extension.xml) to: <platform xmlns=""> (Should be the same like AIR SDK version) And last but not least update your "app-description-XML" (APPNAME-app.xml) to the used AIR SDK version: <application xmlns=""> That should fix the problems ... Hope that helps someone. Happy Cooding!
http://forums.adobe.com/message/4045979
CC-MAIN-2013-48
refinedweb
1,912
76.52
Should I test if try if len(my_list) >= 4: x = my_list[3] else: x = 'NO_ABC' try: x = my_list[3] except IndexError: x = 'NO_ABC' Errors should never pass silently. Unless explicitly silenced. try if try: import foo except ImportError: import baz You should prefer try/except over if/else if that results in Often, these go hand-in-hand. speed-ups In the case of trying to find an element in a long list by: try: x = my_list[index] except IndexError: x = 'NO_ABC' the try, except is the best option when the index is probably in the list and the IndexError is usually not raised. This way you avoid the need for an extra lookup by if index < len(mylist). Python encourages the use of exceptions, which you handle is a phrase from Dive Into Python. Your example not only handles the exception (gracefully), rather than letting it silently pass, also the exception occurs only in the exceptional case of index not being found (hence the word exception!). cleaner code The official Python Documentation mentions EAFP: Easier to ask for forgiveness than permission and Rob Knight notes that catching errors rather than avoiding them, can result in cleaner, easier to read code. His example says it like this: Worse (LBYL 'look before you leap'): #check whether int conversion will raise an error if not isinstance(s, str) or not s.isdigit: return None elif len(s) > 10: #too many digits for int conversion return None else: return int(str) Better (EAFP: Easier to ask for forgiveness than permission): try: return int(str) except (TypeError, ValueError, OverflowError): #int conversion failed return None
https://codedump.io/share/UbAkUMXa7nvB/1/better-to-39try39-something-and-catch-the-exception-or-test-if-its-possible-first-to-avoid-an-exception
CC-MAIN-2017-47
refinedweb
270
54.05
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | SEE ALSO #include <stdio.h> extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; The functions described in the entries of section 3S of this manual constitute an efficient, user-level I/O buffering scheme. The in-line macros getc() and putc() handle characters. A file with associated buffering is called a stream (see intro(3)) and is declared to be a pointer to a defined type FILE. The fopen(3C) function creates certain descriptive data for a stream and returns a pointer to designate the stream in all further transactions. Normally, there are three open streams with constant pointers declared in the <stdio.h> header and associated with the standard open files: standard input file standard output file standard error file The following symbolic values in <unistd.h> define the file descriptors that will be associated with the C-language stdin, stdout and stderr when the application is started: The constant NULL FILENAME_MAX specifies the number of bytes needed to hold the longest pathname of a file allowed by the implementation. If the system does not impose a maximum limit, this value is the recommended size for a buffer intended to hold a file's pathname. The integer constant FOPEN_MAX section block. When it is line-buffered, each line of output is queued for writing on the destination terminal as soon as the line is completed (that is, as soon as a new-line character is written or terminal input is requested). The setbuf() or setvbuf() functions (both described on the setbuf(3C) manual page) may be used to change the stream's buffering strategy. A single open file description can be accessed both through streams and through file descriptors. Either a file descriptor or a stream will be called a handle on the open file description to which it refers; an open file description descriptor is closed by close(), _exit() (see exit(2)), or by one of the exec functions when FD_CLOEXEC is set on that file descriptor. considered functions or _exit(), the handle is never accessed in that process.) For the first handle, the first applicable condition below shall apply. After the actions required below are taken, the handle may be closed if it is still open. If it is a file descriptor, no action is required. If the only further action to be performed on any handle to this open file description is to close it, no action need be taken. If it is a stream that is unbuffered, no action need be taken. If it is a stream that is line-buffered and the last character written to the stream was a newline (that is, as if a putc('\n') was the most recent operation on that stream), no action need be taken. If it is a stream that is open for writing or append (but not also open for reading), either an fflush(3C) shall occur or the stream shall be closed. If the stream is open for reading and it is at the end of the file ( feof(3C) is true), no action need be taken. If the stream is open with a mode that allows reading and the underlying open file description refers to a device that is capable of seeking, either an fflush() shall occur or the stream shall be closed. Otherwise, the result is undefined. For the second handle: if any previous active handle has called a function that explicitly changed the file offset, except as required above for the first handle, the application shall perform an lseek() or an fseek(3C) (as appropriate to the type of the handle) to an appropriate location. If the active handle ceases to be accessible before the requirements on the first handle above have been met, the state of the open file description becomes undefined. This might occur, for example, during a fork() or an _exit(). The exec functions shall be considered to make inaccessible all streams that are open at the time they are called, independent of what streams or file descriptors may be available to the new process image. Implementation shall assure that an application, even one consisting of several processes, shall yield correct results (no data is lost or duplicated when writing, all data is written in order, except as requested by seeks) when the rules above are followed, regardless of the sequence of handles used. If the rules above are not followed, the result is unspecified. When these rules are followed, it is implementation defined whether, and under what conditions, all input is seen exactly once._unlocked(iop); } funlockfile(iop); Invalid stream pointers usually cause grave disorder, possibly including program termination. Individual function descriptions describe the possible error conditions.) NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | SEE ALSO
http://docs.oracle.com/cd/E19683-01/816-5214/6mbcfdle5/index.html
CC-MAIN-2014-23
refinedweb
792
57.61
From: Joaquín Mª López Muñoz (joaquin_at_[hidden]) Date: 2004-08-27 03:14:11 GCC 2.95 has problems supporting using declarations inside functions, as indicated by BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL. This affects a minmax test in this compiler. The following trivial patch moves a using directive to global scope and solves the issue. This would make it all green for minmax regression tests under every platform considered. OK to commit? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo 46a47,48 > using namespace boost; > 50d51 < using namespace boost; Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2004/08/70836.php
CC-MAIN-2021-43
refinedweb
107
53.47
In this guide, we'll briefly discuss the concept of immutability in software development and how to leverage its benefits when developing React-Redux applications. Specifically, we'll demonstrate how to use Facebook's Immutable.js library to enforce immutability in our applications. Table of Contents Redux and Immutability In the React ecosystem, Redux, a state management paradigm, is fast becoming the preferred implementation of Facebook's Flux architecture. One of Redux's core tenets is maintaining state immutability to ensure state determinism, unlock performace gains and enable time travel debugging capability. You probably have one question now though. What is immutability? An immutable object is one whose state cannot be modified once created. Enforcing immutability means ensuring that once objects are created, they cannot be modified. What is ImmutableJS?.Related Course: Getting Started with React Other than the benefit of not having to worry about accidentally mutating the state of our application directly, Immutable.js data structures are highly performant because of the library's implementation of structural sharing through hash maps and vector tries. If you'd like to read about how it does this, I've posted a few handy references in the reference section of this article. Before we dig deep into using Immutable.js with Redux, let's look at immutability in general in JavaScript. What we'll be Building In order to demonstrate implementing Immutable.js in a Redux application, we'll be building the Redux layer of a reviews application, where we can: - Add reviews for an item. - Delete reviews for an item. - Flag reviews made by other reviewers, we'll have this as a boolean. - Rate reviews made by other reviewers on a scale of 1-5. To show the differences between using Immutable and native Node.js methods, we'll write out the purely Node version of our reducer and then modify our reducer so that it uses Immutable.js. All in all, our goal is to make our state object immutable. Therefore, all modifications made to our application state should return a new modified object, leaving the previous state unchanged. As is the pattern with Redux, our reducer will return a new state object dependent on the action it receives. Object Immutability in JavaScript Natively, objects are mutable in JavaScript. However, if we're careful enough, we can implement some immutability. Amongst other methods, we can use the following: - The spread operator: The ...operator can be used to transform the properties of an object and returns a new object which is the result of the mutation. - Object.assign: Object.assign(target, ...sources). This method is used to copy the values of all enumerable own properties from one or more source objects to a target object. - Other non-mutating array methods like filter, concat and slice. Redux reducer model As a reminder, before we begin to write out our reducers, our reducers will emulate the standard redux reducer pattern below. Reviews reducer without Immutable.js First, let's use the methods we mentioned above to quickly bootstrap a reviews reducer for our application without Immutable. const reviews = (state=[], action) => { switch (action.type) { case 'ADD_REVIEW': return [ ...state, { id: action.id, reviewer: action.reviewer, text: action.text, rating: action.rating, flag: false } ] case 'DELETE_REVIEW': return state.filter(review => review.id !== action.id); case 'FLAG_REVIEW': return state.map(review => review.id === action.id ? Object.assign({}, review, { flag: action.flag}): review) case 'RATE_REVIEW': return state.map(review => review.id === action.id ? {...review, rating: action.rating }: review) default: return state; } } ADD REVIEW Here, we use the spread operator to copy the existing state and append to it a new review object. We could easily just have used the array concat or any other array manipulation method that returns a new array object. To demonstrate how easy it is to accidentally mutate state directly, instead of using the spread operator, let's use push to append the new review object to our state object. // code as before case 'ADD_REVIEW': return state.push( { id: action.id, reviewer: action.reviewer, text: action.text, rating: action.rating, flag: false } ) // as after Since push directly alters the original array, when a review is added into state, previous information about the shape of the state object before the addition will be lost to us. DELETE REVIEW Filter creates a new state array with the elements in the original array that pass the conditional in the callback function we pass it. Here, the condition is review.id !== action.id, If the review id in state matches the action id passed, then that review is omitted from the resultant array. FLAG REVIEW We map over all existing reviews and look for one with an id that matches the specified action.id. Once we've found it, we use Object.assign to create a copy of that review with its flag property changed to the one given in the action. RATE REVIEW Again, we map over all reviews and when we find one whose id is equivalent to the action.id, we create a copy of it using the object spread operator and change its rating property to the one specified in the action. The methods we've used make it quick and easy to implement state immutability in our application. So why would we look to anything else to help us enforce immutability? I wondered that too myself, so fortunately, you're not alone. Before we answer that question though, let's discuss some considerations we'll have to make before we use Immutable.js. Costs vs Benefits of using Immutable.js As always, before we attempt to integrate a library into an application, especially one as pervasive and far reaching as this one, let's weigh the cost versus the benefit of using Immutable.js. Benefits - As previously discussed, Immutable helps us enforce immutability from the start, eliminating the possibility of inadvertent state mutation. - Immutable improves state/object copy performance significantly through its implementation of structural sharing. Costs - Immutable.js is a library and thus requires installation. If we're using Node's inbuilt non mutating object methods, we don't need to perform any installation. - Since Immutable has its own syntax for performing read and write object operations, referencing Immutable.js data becomes slightly tedious. - The above reason makes it cumbersome to integrate with projects that expect plain JavaScript objects. Granted, Immutable eases conversion of its immutable data structures to plain JS objects with the method toJS(), but it's slow and leads to performance losses. - Converting an Immutable.js object to JavaScript using toJS()will return a new object every time. If the method is used in Redux's mapStateToProps()it will cause React to believe that the whole state object has changed every time even if only part of the state tree changes, causing a re-render of the whole component and negating any performance gains due to React's shallow equality checking. - Since all state is wrapped with Immutable.js and objects have to be accessed using Immutable.js syntax, this dependency may spread to your components. Such a high level of coupling would make removing Immutable.js from your codebase difficult in the future. - Immutable.js objects may prove difficult to debug since the actual data is nested within a hierarchy of properties. However, this can be resolved using the ImmutableJS object formatter in Chrome Dev Tools. Prerequisites Before we get started, there are a few libraries we need to install. First, let's create a package.json at the root of our project by running the command npm init Install our dependencies by executing, npm install --save immutable npm install --save-dev babel-cli babel-preset-es2015-node6 babel-preset-stage-3 babel-register mocha chai Let's modify the .babelrc to include the following: .babelrc { "presets": [ "es2015-node6", "stage-3" ] } Project Structure Now that you have a pretty comprehensive picture of what you might need to consider before using Immutable.js, let's build our application. We'll be using the following directory structure, so go ahead and create it. You can use the following command if you're using a Unix kernel. mkdir -p immutable-redux/src/reducers immutable-redux/test touch immutable-redux/.babelrc immutable-redux/src/{actionTypes.js,reducers/reviews.js} immutable-redux/test/reviews_test.js ├── immutable-redux ├── .babelrc ├── package.json ├── src │ ├── actionTypes.js │ └── reducers │ └── reviews.js └── test └── reviews_test.js Test Driven Development We'll be taking a tests first approach with our application, so before we begin writing out the reviews reducer, let's create tests for it. This approach will help us understand what our reducer should do. Gratefully, Redux reducers are pure functions so this makes them pretty straightforward to test. Our initial state will be an empty array and our actions of the form { type, id, item_id, reviewer, text, rating, flag }. As before, we'll use a switch-case statement to execute certain behaviour when our action types are triggered. For our testing assertion library we're using chai along with mocha. To start, fill out the following in the test/reviews_test.js file. test/reviews_test.js import { expect } from 'chai'; import { List, Map } from 'Immutable'; import reviews from '../src/reducers/reviews'; // This file will hold our reviews reducer describe('ImmutableJS Review reducer tests', () => { const state = List([ { id: 1, item_id: '200', reviewer: 'Bombadill', text: 'It needs a song really', rating: 4, flag: false }, { id: 2, item_id: '200', reviewer: 'Strider', text: `That's not what happened!`, rating: 3, flag: false }, { id: 3, item_id: '200', reviewer: 'Gollum', text: `Preciousss`, rating: 1, flag: true }, ]); describe('ADD_REVIEW TESTS', () => { const action = { type: 'ADD_REVIEW', id: 4, item_id: '200', reviewer: 'Gandalf', text: 'Not all those who wander are lost.', rating: 4, flag: false }; it('Should return a new state object when adding a review', () => { expect(state.size).to.equal(3); }); it('Should append the added review object to the new state object', () => { const newState = reviews(state, action); expect(reviews(state, action).size).to.equal(4); }); }); describe('DELETE_REVIEW TESTS', () => { const action = { type: 'DELETE_REVIEW', id: 3, item_id: '200' }; it('Should return a new state object when deleting a review', () => { expect(state.size).to.equal(3); }); it('Should return a state object without the deleted review', () => { const newState = reviews(state,action); expect(reviews(state, action).size).to.equal(2); expect(newState.indexOf({ id: 3, item_id: '200', reviewer: 'Gollum', text: `Preciousss`, rating: 1, flag: true })).to.equal(-1); }); }); describe('FLAG_REVIEW TESTS', () => { const action = { type: 'FLAG_REVIEW', id: 2, item_id: '200', flag: true }; const newState = reviews(state, action); it('Should return a new state object', () => { expect(newState).not.to.equal(state); }); it('Should return a state object with the specified review\'s flag property changed', () => { expect(newState.get(1).flag).to.equal(true); }); }); describe('RATE_REVIEW TESTS', () => { const action = { type: 'RATE_REVIEW', id: 1, item_id: '200', rating: 5 } const newState = reviews(state, action); it('Should return a new state object', () => { expect(newState).to.not.equal(state); // will assert that objects are not in the same slice of memeory }); it('Should return a state object with the specified review with the correct rating', () => { expect(newState.get(0).rating).to.equal(5); }); }); }); One of the things you'll notice is that we're not referring directly to values in our state object using dot or bracket notation. We now use get to access values from our state List object. Also, to compute the length of our immutable Lists, we use size and not length as we would have done. These two changes sum up the extent of any modifications we have to make to our test syntax. All in all, that was relatively painless. Running our tests Since we don't have any code to run them against, our tests should fail. Let's confirm that they do. Edit your package.json file to add this. package.json "scripts": { "test": "mocha --compilers js:babel-core/register" } This gets babel to transpile our code on the fly before mocha runs our tests. Now, we're ready to fail forward. Execute, npm test Expect the following npm ERR! Test failed. See above for more details. Take heart! Our failure is only temporary. We'll soon be in the green. Reviews reducer with Immutable.js Now that we have our reducer tests, let's finally write out our reducer. First, we define our action types. src/actionTypes.js const types = { reviews: { ADD_REVIEW: 'ADD_REVIEW', DELETE_REVIEW: 'DELETE_REVIEW', FLAG_REVIEW : 'FLAG_REVIEW', RATE_REVIEW: 'RATE_REVIEW' } } export default types; Finally, our reducer. src/reducers/reviews.js import { List, Map } from 'Immutable'; import types from '../../actionTypes'; const reviews = (state=List(), action) => { switch (action.type) { case types.reviews.ADD_REVIEW: const newReview = Map( { id: action.id, item_id: action.item_id, reviewer: action.reviewer, text: action.text, rating: action.rating, flag: false } ) return state.push(newReview); // Note that Immutable's push will return a new array case types.reviews.DELETE_REVIEW: return state.filter(review => review.id !== action.id); case types.reviews.FLAG_REVIEW: return state.map(review => review.id === action.id ? Object.assign({}, review, { flag: action.flag}): review) case types.reviews.RATE_REVIEW: return state.map(review => review.id === action.id ? {...review, rating: action.rating }: review) default: return state; } } export default reviews; Modifications made to the reducer How has our reviews reducer changed? Actually, not by much. - Instead of having an empty array as our initial state, we now have an empty Immutable.js List. - Newly created reviews aren't JavaScript objects anymore but Immutable.js Maps. - In the place of the spread operator, we push a new review into the state object. The Immutable Push unlike the native Node push will return a new state object. Let's make sure everything's running as it should by running npm test at the root of our project again. We expect our tests to pass. 8 passing (74ms) There you go. Conclusion If you've stuck with me till now, congratulations! Our state object is now immutable by default. We'll soon implement a view layer and the Redux store for our application, but we're off to a good start. You have a head start so go ahead. I'm excited to hear and see what you'll build with your newly acquired skills. All the code we've written can be found here. For comparison, I've written out the purely Node versions of our reducer tests and reducer without immutable. As always, I'd love your feedback on the article. Don't be shy, drop me a line in the comment box below. References If you're interested in learning more about Immutable.js, here are a few links to follow.
https://scotch.io/tutorials/using-immutablejs-in-react-redux-applications
CC-MAIN-2018-22
refinedweb
2,420
50.43
Comparator ebuild does install comparator.py, and therefore filterator bombs with import error: Traceback (most recent call last): File "/usr/bin/filterator", line 5, in ? import sys, comparator ImportError: No module named comparator Reproducible: Always Steps to Reproduce: 1. Run comparator and pipe output to filterator. 2. 3. Actual Results: filterator bombs with import error. Expected Results: filterator should run and produce source code snippets that match. I simply put comparator.py in /usr/bin with the 2 binaries. Not sure if that is the appropriate place... 2.3 should install the module. Which version did you try? >>> /usr/lib64/python2.6/site-packages/comparator.py And so does 2.5, closing as TEST-REQUEST. Please reopen if you can still reproduce this with 2.5. 2.5 is good.
https://bugs.gentoo.org/show_bug.cgi?id=199688
CC-MAIN-2021-49
refinedweb
130
63.86
From: Borgerding, Mark A. (MarkAB_at_[hidden]) Date: 2000-02-10 18:27:36 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > -----Original Message----- > From: Darin Adler [mailto:darin_at_[hidden]] > Sent: Thursday, February 10, 2000 2:51 PM > To: Boost > Subject: [boost] Re: Compile time assertions > > > Mark Borgerding: > > Any shortcomings besides the misuse example in bar() above? > > It's a nice implementation, but I'm not sure it's better than > the ones I > presented. Here are a few shortcomings I noticed right away. Thanks for the feedback. I appreciate the time you spent looking things over. It looks like my approach may have a problem or two with respect to the requirements set forth. However, I still think it is more portable and flexible than any of the previous solutions. The only indisputable shortcoming is that it will pad the size of a structure that contains it, but there are ways to work around that. I really like the approach presented by Steve Cleary. It's a clever idea to use contradictory typedefs to flag errors. However, it sounds like the compiler support for this is still rather spotty. I believe that the requirements are optimistic at best, at worst they are completely unrealistic. The criteria sometimes contradict each other. For example; the solution must be callable from anywhere in the same way as assert, but without the aid of macros. I don't know of any way class foo{ POSTULATE(sizeof(char) == 1); }; can compile without using a macro. Unless there can be some loosening of the requirements, it would seem there can never be a compile-time assertion class for boost. Pity. It is a worthwhile tool to have in one's BOT. There are several reasons I prefer the template<bool> method to other methods. 1. no macros, although use becomes slightly easier if they're allowed. 2. Standard. Portable to any compiler that has explicit template specialization. 3. Simple concept. Construct a ctassert<true>, nothing happens. Construct a ctassert<false>, compile error. 4. Better supported than non-standard language features like unnamed zero-length bit fields. The method E for which you expressed a preferrence may be elegant, but it fails on MSVC6 and g++ 2.95.2, two very popular compilers MSVC error: error C2625: anonymous union did not declare any data members g++ error: anonymous class type not used to declare any objects > > If used in a class definition, it doesn't give an error > message on the line > where the assertion fails. It doesn't fail at all unless an > object of the > class is instantiated (fails requirements R1, 5, 8, 9). Well that depends upon your definition of where the assertion fails. As I see it, the assertion is tested at the code that instantiates the ctassert<bool> object. This is behavior is predictable. The approach is similar in usage to a call to assert(), but it is more flexible in that it can appear at the file or namespace scope, whereas a call to assert cannot. It can also appear inside class definitions, but as you point out below there are problems with that. > > It can affect structure padding if used between elements in a > structure as > discussed on Jay's web page (fails requirement 2). Ah good point. It would probably best then to avoid using them inside structures and classes, since all structures must have a non-zero size. Inheriting from cassert seems to be fairly bloat-safe. But I think that inheriting from such a class is a pretty ugly thing to impose on a class (remember the "is a" rule). I question that the restriction about appearing anywhere (class definition/implementation) is really a necessary one. It contradicts the analogy to the assert() function. The closer the use of postulate/ctassert is to that of assert(), the more readable the code will likely be for someone who is not familiar with the concept. I think any compile-time check that can exist in the class definition can also exist in a member function or in a namespace. e.g. class foo{ ... other stuff POSTULATE(sizeof(char) == 1); POSTULATE(sizeof(short) == 2); }; can be moved into class foo{ ... other stuff int check() { POSTULATE(sizeof(char) == 1); POSTULATE(sizeof(short) == 2); } }; This code would get compiled, but not linked into the executable since it is never called. For templates, the case is a little more complex. Compilation of an uncalled function cannot be guaranteed. But by moving the postulate code into the constructors or a destructor, compilation can be assured without adding any extra weight. > The error message from my compiler is "illegal access to > protected/private > member" (fails requirements 7, 9). Hmm, I thought it would be a safe assumption that all compilers would at least name the class to be instantiated. g++ and MSVC give reasonable messages. What compiler are you using? The name ctassert, compile_time_check or something like that along with the source file & line number should be enough to give a person an idea of what's wrong. The errors below are quotes results from g++ and MSVC upon compiling the attached code. line 6 is ctassert<compiledValue>(); g++ error: test.cpp: In function `int main()': test.cpp:6: `ctassert<false>::ctassert()' is private test.cpp:12: within this context MSVC error: test.cpp(12) : error C2248: 'ctassert<0>::ctassert<0>' : cannot access private member declared in class 'ctassert<0>' test.cpp(6) : see declaration of 'ctassert<0>::ctassert<0>' I doubt any solution would reliably tell the user something much more descriptive, like yourfile.cpp(45) error: compile time check "sizeof(int) == 4" has failed on every platform. Although this would be great if it were possible. If macros are allowed, then the stringizing operator # might be used to give the specific expression that failed. - -- Mark -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.2 for non-commercial use <> iQA/AwUBOKNJbf9Ej8AEXMygEQIUZACg6Vm6kqHfebQcC6qktzrlce7gLeMAoLbN M2xjRvBwgM8NDBhV5pJfqcvq =cxnW -----END PGP SIGNATURE----- Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2000/02/2136.php
CC-MAIN-2019-18
refinedweb
1,011
65.52
This preview shows pages 1–4. Sign up to view the full content. ECE 462 Written Assignment 3 Due: 12:20PM, November 15, 2010 Name: PUID: 1 Exception Handling (outcome 7) Which statement is correct?? import java.io. * ; class Err extends Exception { } class outcome621 { public static void main( String[] args ) { try { f(0); } catch( Err e ) { System.out.println( "Exception caught" ); } } static void f(int j) throws Err { System.out.println( j ); if (j == 3) throw new Err(); 1 View Full Document This preview has intentionally blurred sections. f( ++j ); } } 3 try - catch (outcome 7) Which statement is correct? . class Exception641 // >>>>> // fill the code for this class // <<<<< class outcome641 { static void f( ) throws Exception641 { throw new Exception641("thrown by f" ); } public static void main( String[] args ) { try { f(); } catch( Exception641 exp ) { System.out.println( exp.getMessage() ); // output: // thrown by f } } } 2 5 Catch C++ Exception (outcome 7) Please write the code so that the caller can catch the two types of exceptions. #include <iostream> #include <string> using namespace std; class ExceptionType1 { private: string et1_message; public: ExceptionType1(string m): et1_message(m) { } string getMessage() const { return et1_message; } }; class ExceptionType2 { private: View Full Document This preview has intentionally blurred sections. This note was uploaded on 02/19/2012 for the course ECE 462 taught by Professor Samuelmidkiff during the Fall '11 term at Purdue University. - Fall '11 - SamuelMidkiff Click to edit the document details
https://www.coursehero.com/file/6796943/wa4/
CC-MAIN-2017-17
refinedweb
231
61.87
Adding numerical methods to emacs with dynamic modules Posted July 08, 2017 at 10:12 AM | categories: emacs | tags: | View Comments Updated July 09, 2017 at 07:31 AM Table of Contents There is a relatively new feature in Emacs 25 that allows you to extend Emacs using compiled libraries (). This could be very helpful in a few ways: - To add functionality that exists in other libraries, e.g. - Interface Emacs with hardware, e.g. a joystick, or ejecting a CD. - To speed up slow elisp functions - A c implementation of a fibonacci function is 150 times faster than an elisp version here. - This json parser is up to 4 times faster than the json.el library for some operations. I am interested in this in particular to bring numerical methods into Emacs. It is fair to ask why. Even I think the numpy/scipy/matplotlib Python stack is currently unparalleled in functionality for scientific programming. But I like writing elisp code so much more! So, we will take a look today at a simple example of integrating a function from the GNU Scientific Library into Emacs. 1 Using the GSL to calculate a Bessel function value A canonical example of using the GSL is given at. Here it is for reference. It just calculates a value for a Bessel function. We save this program in a file called example.c. #include <stdio.h> #include <gsl/gsl_sf_bessel.h> int main (void) { double x = 5.0; double y = gsl_sf_bessel_J0 (x); printf ("J0(%g) = %.18e\n", x, y); return 0; } We have to compile and run this program. Here are the commands to do that. gcc -Wall -I/usr/local/include/ -c example.c gcc -L/usr/local/include -lgsl example.o ./a.out That is a lot of code and steps to get one number. What I would like to do instead is this: (require 'gsl-sf-bessel) (gsl-sf-bessel-J0 5) So, enter the dynamic module! 2 A GSL dynamic module for a Bessel function To create the dynamic module we need a small c file that wraps the GSL function and adds it to the Emacs environment. Here is the smallest example I could come up with for this one function. Basically, we create a function that takes the emacs environment and arguments, extract what we want from them, and use that to calculate what we need and return it to the environment. Then we register that function and define what the module provides in emacs_module_init. #include <assert.h> #include <gsl/gsl_sf_bessel.h> #include "emacs-module.h" int plugin_is_GPL_compatible; static emacs_value F_gsl_sf_bessel_J0 (emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data) { assert (nargs == 1); double x = env->extract_float (env, args[0]); return env->make_float (env, gsl_sf_bessel_J0 (x)); } int emacs_module_init(struct emacs_runtime *ert) { emacs_env *env = ert->get_environment(ert); emacs_value gsl_sf_bessel_J0_fn = env->make_function(env, 1, 1, F_gsl_sf_bessel_J0, "Regular cylindrical Bessel function of zeroth order, J_0(x)", NULL); emacs_value Qfset = env->intern(env, "fset"); emacs_value Q_gsl_sf_bessel_J0 = env->intern(env, "gsl-sf-bessel-J0"); emacs_value fset_args[] = { Q_gsl_sf_bessel_J0, gsl_sf_bessel_J0_fn }; env->funcall(env, Qfset, 2, fset_args); emacs_value Qprovide = env->intern(env, "provide"); emacs_value Q_gsl_sf_bessel = env->intern(env, "gsl-sf-bessel"); emacs_value provide_args[] = { Q_gsl_sf_bessel }; env->funcall(env, Qprovide, 1, provide_args); return 0; } Now we compile it into a shared library. gcc -Wall -I/usr/local/include -fPIC -c gsl-sf-bessel.c gcc -shared -L/usr/local/include -lgsl -o gsl-sf-bessel.so gsl-sf-bessel.o That creates our shared library in gsl-sf-bessel.so. ls *.so (add-to-list 'load-path "/Users/jkitchin/vc/blogofile-jkitchin.github.com/_blog/dynamic-module/") (require 'gsl-sf-bessel) (gsl-sf-bessel-J0 5.0) -0.17759677131433826 That is the same answer as we got before. Here is the documentation we defined. It could use some improvement, e.g. to note that the argument has to be a float, and that only one argument is allowed. I am not sure why the signature doesn't show a single argument. (describe-function 'gsl-sf-bessel-J0) gsl-sf-bessel-J0 is a Lisp function. (gsl-sf-bessel-J0 &rest ARGS) For more information check the manuals. Regular cylindrical Bessel function of zeroth order, J_0(x) I am not a very skilled C-programmer yet, so I don't know how hard it would be to make this function accept integers as well, or to vectorize it so you could have an arbitrary number of args to it and return a list. 3 Summary Dynamic modules look promising to extend Emacs with. This example is about the simplest function from the GSL there is. There are many more () functions that do linear algebra on arrays, integration or optimization of functions, interpolation of data, etc. I don't have a sense yet of how easy it will be to integrate these into a module. It looks like you are not limited to writing these in C. There is an example of a plugin written in Rust here, and a framework to write them in Go. Maybe any language that can make a shared library with the required plugin_is_GPL_compatible symbol and emacs_module_init function would work. Those examples do not look significantly easier to write than the C versions though since I am not that fluent in those languages either. There are some challenges to figure out in developing and using dynamic modules. Here are a few: - The documentation on what is possible is not that great yet, so there is a lot of exploring to do. There are a fair number of examples out there though to learn from (). The official example shows a lot of the functionality. - I guess it will be tricky to distribute these. I don't know how easy it would be to build all the libraries for each platform for distribution on MELPA for example. I don't think there is a standard way to incorporate a compile step in elisp package installation. Also, you need an Emacs version of at least 25 with the dynamic module feature compiled in. It is not yet a default enabled option. The required emacs-module.h should be gotten from the emacs build, so people with binaries might not be able to build it anyway. - Users will need the libraries the dynamic module uses. In this example, they will need libgsl. - Once you require the module, it does not seem possible to modify it, rebuild it, and reload it. It appears you have to close Emacs and reload it. That is tedious. It would be nice to have a more generic foreign function interface that would allow you to develop more on the elisp side. One effort in that direction is. It looks like it might be a lot simpler to use than creating a dynamic module. Once it is installed, it looks like you can write elisp code to wrap the library functions. I will write about this on another day. Copyright (C) 2017 by John Kitchin. See the License for information about copying. Org-mode version = 9.0.7
http://kitchingroup.cheme.cmu.edu/blog/2017/07/08/Adding-numerical-methods-to-emacs-with-dynamic-modules/
CC-MAIN-2018-30
refinedweb
1,173
66.03
Web Services at Work: Google Web APIs (1/2) - exploring XML Web Services at Work: Google Web APIs A lot of hype is buzzing around Web Services these days. New acronyms are appearing every day and protocols and tools are implemented at break-neck speed; but not many real applications are publicly available up to now.." Developers can issue search requests to Google's index programmatically and receive results as structured data, access information in the Google cache, and call the spell-checker. The Google Web APIs have the same search syntax as the Google.com site. The APIs are for developers that want to use Google as a resource in their applications. Programs can connect remotely to the Google Web APIs service via the Simple Object Access Protocol (SOAP), an XML-based remote procedure call (RPC) mechanism. Google offers an SDK, which contains some example client Java code, a .NET programming example, and a Web Services Definition Language (WSDL) file describing the Google interface. Google Web APIs are implemented as a Web service. The service supports several SOAP methods; these are described in an accompanying WSDL file that can be imported into your favorite Web services programming environment. Alternately, you can use the custom Java library to call the service. SOAP and WSDL The Simple Object Access Protocol defines both a message format and a message exchange model that allows distributed systems to communicate. Other remote procedure call systems such as CORBA are in wide-spread use already, but SOAP combines the ubiquity of HTTP with the openness and momentum of XML. The Web Services Description Language offers a machine-readable description of a Web service by listing the names and arguments of SOAP-callable functions. The Google service looks like this: <?xml version="1.0"?> ... <definitions name="urn:GoogleSearch" targetNamespace="urn:GoogleSearch" xmlns: First come the namespace declarations for the subsequent service definitions. Produced by Michael Claßen URL: Created: Apr 15, 2002 Revised: Apr 15, 2002
http://www.webreference.com/xml/column54/index.html
CC-MAIN-2014-42
refinedweb
328
52.8
PHPMailer < 5.2.18 Remote Code ExecutionPHPMailer < 5.2.18 Remote Code Execution PHPMailer is the world's most popular transport class, with an estimated 9 million users worldwide. Downloads continue at a significant pace daily. Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more. Vulnerable environmentVulnerable environment To setup a vulnerable environment for your test you will need Docker installed, and just run the following command: docker run --rm -it -p 8080:80 vulnerables/cve-2016-10033 And it will spawn a vulnerable web application on your host on 8080 port ExploitExploit To exploit this target just run: ./exploit host:port If you are using this vulnerable image, you can just run: ./exploit localhost:8080 After the exploitation, a file called backdoor.php will be stored on the root folder of the web directory. And the exploit will drop you a shell where you can send commands to the backdoor: ./exploit.sh localhost:8080 [+] CVE-2016-10033 exploit by opsxcq [+] Exploiting localhost:8080 [+] Target exploited, acessing shell at [+] Checking if the backdoor was created on target system [+] Backdoor.php found on remote system [+] Running whoami www-data RemoteShell> And that's it, you have your shell. There is another exploit, which ilustrates another use case. ./deface.sh localhost:8080 [+] CVE-2016-10033 exploit by opsxcq [+] Exploiting localhost:8080 [+] Target exploited, acessing shell at [+] Checking if the backdoor was created on target system [+] Backdoor.php found on remote system [+] Placing your message in the server [+] Job done, exiting And if you visit the page again, you will see this: Vulnerable codeVulnerable code Before this commit in class.phpmailer.php in a certain scenario there is no filter in the sender's email address special chars. This flaw can lead to a remote code execution, via Analysing the code, there is no filter in mailSend() function $params = null; //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver if (!empty($this->Sender)) { $params = sprintf('-f%s', $this->Sender); } $this->Sender is directly appended to $params variable, which was filtered in validateAddress() function, but as it uses RFC 3696 specification, it allow certain characters which will break things. In this case, quotes: In addition to quoting using the backslash character, conventional double-quote characters may be used to surround strings. For example . You can read the whole RFC here if you want. But also, if PHP version is inferior to 5.2.0, and there is no PCRE installed, $patternselect variable in validateAddress() will be set to noregex. It will cause the input will be able to avoid any regex check. It will only pass through a small verification: case 'noregex': //No PCRE! Do something _very_ approximate! //Check the address is 3 chars or longer and contains an @ that's not the first or last char return (strlen($address) >= 3 and strpos($address, '@') >= 1 and strpos($address, '@') != strlen($address) - 1); Then, the code flow goes to mailPassthru() function, which, if running in safe_mode won't be vulnerable to this flaw, as the following code states it //Can't use additional_parameters in safe_mode //@link if (ini_get('safe_mode') or !$this->UseSendmailOptions or is_null($params)) { $result = @mail($to, $subject, $body, $header); } else { $result = @mail($to, $subject, $body, $header, $params); } But, if it isn't running in safe_mode, then our special parameter will be passed to mail() and, if we were lucky, it will get our file containing whatever we want to be written where we choose it to be wrote to. Notes about PHP mail() function exploitationNotes about PHP mail() function exploitation The exploitation of PHP mail() function isn't a new thing, but it still alive and people still using it. To explain how it works, lets look at how mail() function is defined: bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) There are several exploitation methods for different results, we will focus on the exploitation of the 5th parameter to get Remote Code Execution (RCE). The parameter $additional_parameters is used to pass additional flags as command line options to the program configured to send the email. This configuration is defined by the sendmail_path variable. A security note from php official documentation:miail. Considering the additional parameters that can be injectected we will use -X to exploit this flaw. More about the -X parameter -X logfile Log all traffic in and out of mailers in the indicated log file. This should only be used as a last resort for debugging mailer bugs. It will log a lot of data very quickly. There are also some other interesting parameters that you should know that exist: -Cfile Use alternate configuration file. Sendmail gives up any enhanced (set-user-ID or set-group-ID) privileges if an alternate configuration file is specified. And -O option=value Set option option to the specified value. This form uses long names. And for -O option, the QueueDirectory is the most interesting option there, this option select the directory in which to queue messages. If you want to read the whole list of parameters and options, just man sendmail or read it online here Based on this information, and the hability to control at least one of the other parameters, we can exploit the host. Bellow the steps for a successful exploitation: - Control $additional_parametersand another mail()parameter - Know a writeable diretory on target host which is accessible via the target system and user (www-data for example). Usually this directory can be anything bellow webroot(aka /var/www/html for another systems, /www for this example) - Any PHP payload that you want, we are using a simple system()payload in this example, with a spice of base64 and some special characters |to make it easier to parse. - Just assembly everything together ! Remember that the -X option will write the log file, that will contain among the log information your PHP payload, in the directory that you will inform. An example of a vulnerable PHP code: $to = '[email protected]'; $subject = '<?php echo "|".base64_encode(system(base64_decode($_GET["cmd"])))."|"; ?>'; $message = 'Pwned'; $headers = ''; $options = '-OQueueDirectory=/tmp -X/www/backdoor.php'; mail($to, $subject, $message, $headers, $options); If you execute the code above, it will create a log file in the /www/backdoor.php, this is the essence of this exploit. PayloadPayload Bellow the payload used in this example <?php echo "|".base64_encode(system(base64_decode($_GET["cmd"])))."|"; ?> I wanna chase bugs, now what ?I wanna chase bugs, now what ? Want a easy, one command, way to try to spot this flaw ? Remind this magic grep command ! grep -r -n --include "*.php" "mail(.*,.*,.*,.*,.*)" * Running it against this repository will result in src/class.phpmailer.php:700: $result = @mail($to, $subject, $body, $header, $params); CreditsCredits This vulnerability was found by Dawid Golunski. DisclaimerDisclaimer This or previous program is for Educational purpose ONLY. Do not use it without permission. The usual disclaimer applies, especially the fact that me (opsxc opsxcq's responsibility.
https://reposhub.com/php/security/opsxcq-exploit-CVE-2016-10033.html
CC-MAIN-2021-43
refinedweb
1,159
53.92
. asppsa commented on 2015-05-05 15:59 Hi there, Pure should compile again now. I've made it depend on the new llvm35 package. aggraef commented on 2015-04-27 17:51 Yeah, porting Pure over to MCJIT will be quite some work, I'm afraid, and unfortunately I'm busy with other things right now. appsa, maybe we could grab the LLVM 3.5 PKGBUILD somewhere and provide that version on the AUR as a stopgap measure? asppsa commented on 2015-04-26 23:10 Unfortunately Pure will not compile on LLVM 3.6 at present. I believe this is because Pure does not yet use MCJIT. See FreeFull commented on 2015-04-24 03:29 Arch now comes with LLVM 3.6.0 asppsa commented on 2015-02-20 00:16 Ok I've made it depend on 'llvm<=3.5.99' -- hopefully this is robust enough! Sorry for the delay in getting this sorted for you. anks commented on 2015-02-19 14:21 Bumping last comment. omo commented on 2015-01-30 21:17 Same thing as reported by luisrayas3 (see 2014-08-18 20:18). This time with the package requires llvm 3.5.0 and current llvm in arch is 3.5.1. And further pure builds nicely with llvm 3.5.1 AFAICS. luisrayas3 commented on 2014-08-18 20:18 pure seems to be working fine with the latest version of llvm (3.4.2) but the PKGBUILD requires <=3.4 which causes complaints during installation when your Arch system is up to date. If I just haven't hit the bug that actually does require a downgrade then change to use llvm34? aggraef commented on 2013-09-17 07:02 Pure 0.58 is out. Could you please pull the latest PKGBUILD from? Thanks. aggraef commented on 2013-08-29 21:16 Cool, thanks! But the URL field still points to the same old and forgotten googlecode website, it should be: url="" aggraef commented on 2013-08-29 21:16 Cool, thanks! But the URL field still points to the same old and forgotten googlecode website, it should be: url="" g2oo7fy commented on 2013-08-29 18:34 Done. aggraef commented on 2013-08-29 08:55 I know that this currently doesn't compile (will have to wait for the 0.58 release to fix that), but I'd already like to suggest the following changes to the pkgbuild: - Use the --enable-release flag with configure. The interpreter runs substantially faster that way. - Update the URL from googlecode to: Anonymous comment on 2013-07-06 17:44 Ah, okay, that makes sense. I'll need to stick with 3.3 for the rest of my work, so I'll wait. Thanks, Bjoern! --Rob g2oo7fy commented on 2013-07-05 22:45 Hi Rob, to me it seems, that pure is not yet ready for llvm version 3.3. So if you can, downgrade to llvm 3.2 (not llvm32!). Best, Bjoern Anonymous comment on 2013-07-05 20:22 Build is failing with the following error. I have llvm and llvm-libs installed, so not sure what's up here. Thanks! Rob Pure 0.57 is now configured for LLVM 3.3 on x86_64-unknown-linux-gnu. Source directory: . Installation prefix: /usr Versioned install: no C compiler: gcc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 C++ compiler: g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 Linker: g++ -Wl,-O1,--sort-common,--as-needed,-z,relro -lm -lmpfr -lgmp LLVM tool prefix: Readline support: -lreadline Build libpure: yes fastcc/TCO support: yes Now run 'make' to build everything, and 'make install' to install this software on your system. To remove the installed software at a later time use the 'make uninstall' command. g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -I/usr/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -DPURELIB='"/usr/lib/pure"' -c -o pure.o pure.cc In file included from pure.cc:28:0: interpreter.hh:22:31: fatal error: llvm/DerivedTypes.h: No such file or directory #include <llvm/DerivedTypes.h> ^ compilation terminated. make: *** [pure.o] Error 1 ==> ERROR: A failure occurred in build(). Aborting... g2oo7fy commented on 2012-02-28 15:21 Here is a PKGBUILD for Version 0.51: Please update! asppsa commented on 2011-12-18 01:07 I've updated your PKGBUILD so that it works with 0.49, here:. All I had to do was change the version number and the SHA1. Anonymous comment on 2011-04-02 00:22 @jeffebeu Updated the sha hash. Thanks. Anonymous comment on 2011-04-02 00:14 The md5sums checksum appears to be incorrect inside PKGBUILD. I edited the file and changed md5sums to sha1sums=('f47915ffa9fd0c7dee40f364a5751bfd4f945bf1'). The SHA1 checksum was just copied from the Anonymous comment on 2011-03-31 16:46 Updated to Pure 0.47 Binary packages are now available in the Pure package repo, cf.
https://aur.archlinux.org/packages/pure/?comments=all
CC-MAIN-2018-17
refinedweb
851
68.06
Technical Articles How to Reduce Manual Effort in CIM model and CR Content Update of SLD Systems Last update: 14th of August, 2019 Introduction The SAP NetWeaver System Landscape Directory (SLD) is the main source of technical systems’ information in your landscape gathering data of installed systems via their data suppliers. To be able to handle this data the SLD CIM Model and CR Content need to be up-to-date (see SAP Note 669669). In most cases, this manual action is done on each SLD individually, many of which may exist in a landscape. Using the (Full Automatic) Content Synchronization mechanism and the SLD Namespace concept wisely, you can update one SLD manually and automate the CIM Model/CR Content update for all other SLD systems. Automated Update Options for CIM/CR Content There are two update options for CIM/CR Content available: - CIM/CR Content Update Options as of SAP Solution Manager 7.2 SPS09 - Using Full Automatic Sync to distribute CIM and CR Content from a dedicated namespace Both options are described in the following. Note: - If your are newly using the option of SAP Solution Manager 7.2 SPS09, you can enter all target systems directly. - If you’re using Full Automatic Sync to distribute CIM and CR Content from a dedicated namespace, both options can be combined as follows: The SLD acting as CIM/CR Content source can be updated automatically; existing full automatic sync connections will distribute the content. Make sure, that no SLD namespace is updated with both options. CIM/CR Content Update Options as of SAP Solution Manager 7.2 SPS09 As of SAP Solution Manager 7.2 SPS09, both SLD and LMDB can be targeted directly with CIM model data and CR content import. This is available as manual or automatic import in both repositories. The new features allow greater flexibility in SLD/LMDB topology; if no SLD client applications are used, no SLD is needed. Independent of the target for CIM/CR data, this recurring task can be automated. Even for the automated CIM/CR Update of the SLD, this is configured in SAP Solution Manager transaction SolMan_Setup: Figure 1: Configuration of import options for CIM/CR content for SLD/LMDB in SAP Solution Manager 7.2 SPS09. Using Full Automatic Sync to Distribute CIM and CR Content from a Dedicated Namespace Note that this procedure should be tested by you in a sandbox and used very carefully – not fulfilling the prerequisites or performing the steps wrong, will cause data inconsistencies. Full Automatic Synchronization (FAS) of SLD content keeps all data of connected SLD systems in sync; this includes CIM Model and CR Content data. However, FAS does not allow for filtering of data, nor does it give any control about the point in time when content is synchronized: All changes become active on the target of an FAS connection more or less at once. Therefore, you must not simply connect the DEV SLD to QA SLD to PRD SLD because all manually created data need to be synchronized in a controlled manner between SLDs with different roles – see How-to Handle Data in the SAP NetWeaver System Landscape Directory. On the other hand, there is data, which should be available on each SLD: - Technical Systems’ data should be available in the whole landscape – but this is easily handled by Bridge Forwarding of Data Supplier data. - Also, any SLD version can cope with any CIM Model and CR Content version. The fastest mechanism that can be used to transport CIM/CR Content is the full automatic synchronization. However, FAS always transports all changes – to use FAS for the update of CIM/CR Content only, a specific configuration is needed: To separate CIM/CR Content from all the other content (manually created content and technical systems’ data) you can utilize the SLD namespace concept – see figure 1: Figure 2: SLD systems, namespaces and connections in a typical landscape to optimize SLD content maintenance by automation of CIM Model and CR Content update. Note that there MUST not be FAS connections transporting back CIM/CR Content to SLD (PRD). Prerequisites - All SLD systems, in which CIM Model and CR Content are to be updated automatically, need to be running on SAP NetWeaver 7.1 or higher to be able to retrieve data from another SLD by Full Automatic Synchronization. - This process needs not be installed at the beginning – it can be installed at any time, if the prerequisites explained below are adhered to when a new synchronization connection for CIM model and CR Content is added. - The unique-path-principle must be fulfilled (the same content must not reach any SLD on two different paths – for valid topologies see How-to Handle Data in the SAP NetWeaver System Landscape Directory or the Planning Guide – System Landscape Directory mentioned there.) - Most importantly, when adding such a new FAS connection for a target namespace that already contains CR Content, ensure the following: Both the CIM model and the CR content version of the target namespace sld/active and the source namespace sld/cim_cr MUST be the same. Otherwise the CR Content in the target namespace will become inconsistent. Steps Automatically updating CIM Model and CR Content should not affect your SLD performance noticeably. In case that your SLD is working without some performance buffer near its maximum capacity, you should either strengthen the SLD system or plan the CIM Model/CR Content update for times when the load is small by planning the manual CIM/CR Content update in the central SLD accordingly. (if this cannot be achieved with FAS, keeping the manual process for such an SLD might be recommendable.) Note: Once you are using this automated setup for CIM/CR-updates you MUST NOT perform manual CIM/CR-updates in the target SLDs anymore. This would lead to inconsistent data. - Create a namespace for CIM Model and CR-Content on one SLD (probably your central SLD), where you keep CIM Model and CR Content up-to-date, naming it sld/cim_cr for example - Create a FAS connection on every SLD which can be updated with latest CIM Model and CR Content (see “Prerequisites”) to namespace sld/cim_cr on the central SLDNote that on these target systems, no additional namespace is required: sld/active can be directly the target namespace for the update to take effect on technical systems data. When adding such a new FAS connection for a target namespace that already contains CR Content, both the CIM model and the CR Content version of the target namespace sld/active and the source namespace sld/cim_cr MUST be the same. - For the source SLD containing namespace sld/cim_cr, there are two options to update CIM/CR-Content:a. You can automate the required update of namespace sld/active by creating a local uni-directional FAS to its own sld/cim_cr namespace.b. If you want to be in control of the CIM/CR-state of this SLD (which probably is your productive one) you can import it manually. Note: You can control the point of time to update CIM/CR-Content: Optionally, you can de-activate the FAS connection updating the CIM/CR-Content and activate it manually, if you want to perform an update. Make sure in this case that for each single update to the central CIM/CR namespace the connection is activated. Result CIM Model and CR Content will be updated automatically in any SLD reading the CIM-CR namespace. Summary Setting up your SLD landscape as shown will reduce the manual effort of keeping the CIM Model and CR Content in your SLD systems up-to-date. In the best case it can be reduced to one system where this data has to be maintained manually. Additional Information More information on the SLD is available at the SDN: - SLD Overview: - SLD – Blogs and Demos: SLD Resources page - SLD Full Automatic Synchronization Feature – blog & demo Wolf - nice writeup. One question that our Basis team has though is whether or not we would run into issues if our Solution Manager SLD had a different (newer ) CIM/CR versio than our PI SLD. We're unfortunately not yet running a central SLD, so we have this to contend with - they are running their updates to teh PI SLD on a different schedule than our SM SLD. Thanks! Bernie Dear Bernie - thanks a lot. And: Having SAP Solution Manager's on a higher CIM/CR level should not cause problems: Received Data Supplier data directly or by forwarding from the SLD dedicated to PI will be integrated correctly. Best Regards, Wolf Is there a document/note anywhere that describes CIM/CR relationships between separate SLDs and how different versions/levels can co-exist? our Basis guys are being strangely paranoid about this. Experience, perhaps.. 🙂 Dear Bernie, thanks for the question - it is answered in SAP Note 954820 - Compatibility of SLD in the system landscape. Also, keep in mind that with SLD systems interchanging information the role of the CIM/CR versions are different: While in case of forwarding of data these versions do not play a role (because data supplier data are forwarded as if sent to the target system directly) in other cases CIM and CR versions need to match. For details see SLD Topology: How-To Gather and Distribute SLD-Data in Your IT-Landscape? How to Reduce Manual Effort in CIM model and CR Content Update of SLD Systems and other blogs on. Hope that helps! Best Regards, Wolf Hengevoss I'm beginning to see where some of the confusion comes from. Note 954820 says "Note that the same CIM model version is prerequisite in all SLDs." yet the SLD planning guide says “Since the SLD bridge forwards data without interpreting or changing it, automatic forwarding works independently of releases, patch levels, and installed CIM data models and SAP Component Repository content versions of the involved SLD instances.” It is not at all clear when to apply which set of guidelines.. Dear Mr. Krause, thanks for pointing this out. Here is your answer: The note is focussing on compatibility and gives a clear recommendation to have the latest CIM Model/CR Content thoughout the landscape and doing that, you're on the safe side. To make this easier to achieve, I also wrote a blog how to automate the CIM/CR Content update in the landscape: "How to Reduce Manual Effort in CIM model and CR Content Update of SLD Systems" However, there are cases were it is not required to have the same CIM Model/ CR Content in all SLDs, so the Planning Guide - SLD pointing this out for the forwarding of SLD data is correct and more complete here.We will update the note to reflect this. Use case, where CIM/CR Content need to be identical are described here:. I hope that helps. Best Regards. Wolf Hengevoss Hi Wolf, I've read through many of your articles and they are very informative. Thankyou. One thing I'm not clear on however is the best approach to adopt when performing support package/upgrade type actions on a given landscape that uses the Full Automatic Sync feature. My current client had a PI 7.3 Dev, QA & Production landscape in place before I got involved with their project. The SLD configuration uses the FAS feature to sync the SLD from Dev to QA & Prod. The sync to prod is deactivated and only activated when the PI development team need the SLD data in production. Dev & QA sync is active all the time. We are looking to update to the latest PI 7.3 Support Package Stack soon. I can't find any documents on the SLD documentation areas that would suggest what the approach would need to be. Would it mean syncing up fully production then deactivating the syncs from Dev to QA & Prod just before the Dev PI 7.3 system has the Support Package update process performed (SLD updated and latest CIM CR Content uploaded). Then when QA has the same SPS applied enable the sync again - but would this be correct as the SLD docs say the CIM model & CR Contents need to be the same to initiate. Sorry if my question seems daft but I'm a bit concerned that the QA & Production SLD's could become inconsistent. This is the first PI 7.3 support package stack update on this landscape since the initial installation and configuration of the sync's from the Dev PI 7.3 SLD to QA & Prod. Regards, Brian. Hello Wolf, Thank you for providing this document - it is an elegant way of updating cim & CR content across landscape. I do have one question for which I would need more clarifications: - Do I have to create the namespace sld/cim_cr in PRD and start propagating the cim and CR content upgrade from here (=PRD) downwards to QAS and DEV ? - Or, can I create the sld/cim_cr in DEV and propagate the cim CR content upgrade using unidirectional FAS to QAS and the to PRD (DEV->QAS + DEV->PRD) ? The reason for this question is that I would like to test the cim/CR content upgrade in DEV first, then activate the FAS to QAS, then activate FAS to PRD: I am not sure I want to upgrade the cim/CR content in PRD first. Also, at the same time I do have the forwarding of technical data going from PRD-> QAS and PRD-> DEV. Thank you, Sorin Dear Sorin, It is not a problem having the initial dedicated namespace on DEV instead of on the PRD system, provided that no other prerequisites for exchange of landscape data is violated (see SLD Topology: How-To Gather and Distribute SLD-Data in Your IT-Landscape?). Please note, that controlling the sync by activating/de-activating can make the benefit smaller the procedure offers, since you can easily forget to activate prior to the update. Best Regards, Wolf Hengevoss SAP SE Hi , Can we have 2LMBD where one LMDB connected to one SLD like non-prod SLD and another LMDB connected to PROD SLD, both prod and Non-Prod SLD are in full sync , please comment. Dear Gadde Subhash, thanks for your question. If I'm not mistaken, in this scenario, non-POD and PROD SLD systems will have identical content being in full-sync, so it would make no difference... to check my assumption, I recommend reading to learn about the options available I recommend my blog post SLD-LMDB Topology – Connections, Valid, and Invalid Data Exchange Between SLD and LMDB of SAP Solution Manager Also. for the use of full, automatic sync between PROD and non-PROD SLD read my blog post SLD Topology: How-To Gather and Distribute SLD-Data in Your IT-Landscape? -> Description of figure 1 Full Automatic Synchronization To give the full picture, with the Maintenance Planner having replaced the MOpz, a 3rd blog post is important: Topology of SLD, LMDB, and Customer Profile – How to Get Reliable Landscape Data in SAP Support Portal as a Basis for Planning I hope that helps. Best Regards, Wolf Hengevoss SAP SE Dear Wolf, Congratulations on your blog entries, it certainly helps us to clarify about SLD and LMDB. I have many customers and we always have a lot of effort in the SLD manual update, however we can not connect all customer SLDs they are of different landscapes. Is there any way to do an offline synchronization of the CIM model so I can export the data and import again into another client? Thank you for your usual help. Sergio Vieira TIVIT Brasil Dear Customer, thanks a lot for your kind words - I'm glad, my posts are helpful. As for your question, I'm not too sure, I really understand it: Downloading and importing the CIM Model and CR Content in SLD system individually is the normal case, what I describe here, is just a way to automate this in a bigger IT landscape... if that doesn't help, can you please explain in more detail? Thanks & Best Regards, Wolf Wolf, thanks for the answer. I provide service for divergent clients, and I usually need to update the CIM Model and CR Content periodically through the files available to SAP, this process I have to repeat several times and import many files to reach the minimum version of the CIM Model. I was wondering if it would be possible for me to do this on just one client and export the database completely to re-import to multiple clients without having to import the version through the CIM and delta files available to SAP. Is that possible? Thank you, Sergio Vieira TIVIT Brasil Dear Sergio, sorry for the delay, I had to clarify with development - regrettably, the answer is "no", there is no such mechanism. But your request adds to our feedback on the CIM/CR update process, so thanks a lot. Should there be any updates in the future, I'll post them in one of my blog posts. Best regards, Wolf Hengevoss SAP SE Hello Wolf Hengevoss, :´( Thanks for the attention and I will always be looking for in your blog if there will be any update for this solution. thank you, Sergio Vieira TIVIT
https://blogs.sap.com/2012/10/08/how-to-reduce-manual-effort-in-cim-model-and-cr-content-update-of-sld-systems/
CC-MAIN-2022-27
refinedweb
2,890
55.47
Hello, I think I (superficially) understand the difference between: // [[Rcpp::export]] double sum1(Rcpp::NumericMatrix M) { arma::mat A(M.begin(), M.rows(), M.cols(), false); return sum(sum(A)); } // [[Rcpp::export]] double sum2(arma::mat A) { return sum(sum(A)); } Partly out of laziness, partly because sum2 is more elegant, and partly to avoid namespace pollution, I was wondering if there is a way to "force" a "shallow" copy in sum2. If not, then may I submit a low priority feature request. An attribute? Some thing like: // [[Rcpp::export]] double sum2(arma::mat A) { // [[ Rcpp::shallow ( A ) ]] return sum(sum(A)); } Or (akin to C++11 generalized attributes) // [[Rcpp::export]] { [[ Rcpp::shallow ( A ) ]] } double sum2(arma::mat A) { return sum(sum(A)); } An alternative is to have an argument in sourceCpp that takes a list/vector of objects that are to be shallow or deep copied. For example in sum1, if M is changed within the function before casting to the arma::mat, then might be cleaner to add M to a list/vector of objects to be deep copied rather than cloning M within sum1: leads to one fewer variable name. Just a thought. I can certainly live with the additional step. As always, thanks for all the Rcpp goodness. Cheers, Changi Han _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org
https://www.mail-archive.com/rcpp-devel@lists.r-forge.r-project.org/msg05784.html
CC-MAIN-2021-25
refinedweb
228
50.16
From the crazy line of C++ code in the previous section, you can get the idea that C++ has a lot of weird syntax—for indicating namespaces, dereferencing pointers, performing casts, referencing member functions, performing Boolean operations, and so on. If you were to write a C++ compiler, you would need to do a lot of hard work so that the compiler could read this code and obey the many C++ syntax rules, before you could make any sense of the code. Writing a Lisp compiler or interpreter is much easier. The part of a Lisp compiler or interpreter that reads in the code (which Lispers actually call the reader) is simpler than in C++ or any other major programming language. Take a random piece of Lisp code: (defun ... No credit card required
https://www.safaribooksonline.com/library/view/land-of-lisp/9781593272814/ch03s02.html
CC-MAIN-2017-09
refinedweb
133
66.07
CalDAV: Sync colors after setup If i change the colors of a calendar in my ownCloud they get not synced to the client. - devvv4ever admin last edited by What device and Andrdoi version do you use? What is your owncloud version? Can you provide a logcat output? see here for more details: Ah, you wrote: if you CHANGE the colors. That’s true, colors are only imported when creating calendars. Theroretically, the color could be fetched at every sync, but I will have to think about it. Just delete the account and add it again to import the new colors. yeah, sorry for unclear formulation. @devvv4ever confused me Theroretically, the color could be fetched at every sync, but I will have to think about it. Are there any sideeffects eg long sync time or much traffic? would be a nice feature (don’t know how often other people change such colors…) Just delete the account and add it again to import the new colors. i know, its a suggestion for enhancement - AutoImport-oliv3r last edited by Maybe add a button to ‘forced full update’? Re-adding the account sounds painfull Good hint, it would be OK to re-sync calendar details if a “manual update” (using the accounts manager / Sync now) is done. Would be a nice feature – but it would surely be much more painful to add this to the code than to re-add your account, so please understand that this feature has low priority Yes, i understand. and its really not critical. What about a option in the app itself? “Force Complete Sync”? Or “Readd all Accounts”, which removes all davdroid accounts and readds them automatically? Don’t misunderstand me, but if i have an app which tells it synchronizes with something, then it should synchronize all. include colors. - devvv4ever admin last edited by @stefan-niedermann sorry for the confusion another solution would be: sync color max. once of 10 times (smaller overheader, but still syncing)…? @stefan-niedermann Don’t like non-deterministic algorhithms. The overhead wouldn’t be that much, so meta-data (but then also including calendar title, etc) should be synced either always or on manual sync else. However, as said before, this new feature has low priority. By the way, do you know a documentation/standard where the Apple calendar-colorproperty in the is documented? I had to implement it from hearsay… - AutoImport-muks last edited by I too have hit this problem (change in color does not get sync’d). The other open source client that I try for comparison is and that syncs the color changes. I too implemented this from somebody’s traffic capture as a local patch to Radicale so I get the colors now. I also have this issue against Kolab, including with the first time I hook things up. Works fine for same accounts with other CalDAV plugins. I also have this issue against Kolab, including with the first time I hook things up. Can you please provide logs? It’s no fun to guess around what the cause might be without having an informative basis. By the way, does anyone know a documentation/standard where the Apple calendar-color property in the namespace is documented? I had to implement it from hearsay… Alright. So essentially I should remove the accounts again, turn on debugging and then hook it up once more? Anything in particular I should look for in the logs? Alright. So essentially I should remove the accounts again, turn on debugging and then hook it up once more? Yes please, that would be very helpful. Anything in particular I should look for in the logs? There should be a PROPFIND request on your calendar-home-set. In the reply, there should be a color element. Further debugging will depend on whether it’s there and how it’s formatted. - AutoImport-grote last edited by I checked this and the response includes this: <x5:calendar-color xmlns:DC143C</x5:calendar-color>? Yes, DAVdroid currently expects this pattern. I wonder whether it should be changed to allow color names without leading #. It’s really annoying to implement things by feeling and hearsay – I think there just is no standard for the calendar-colorelement, although it has an xmlns. - AutoImport-grote last edited by We could also not find specification for this. Here’s our ticket about the issue for reference. So since we changed to the leading #, you might as well stay with it. However, if you want DAVdroid to be more robust, you might as well make the # optional. DAVdroid fetches the CTag for the collection on every sync – the same request could be used to fetch color, title and description again, too. Given that we seem to know what is going on ("#" vs no “#”) it seems that debugging is no longer required. So if possible I’d avoid having to go through the cycle.
https://forums.bitfire.at/topic/247/caldav-sync-colors-after-setup
CC-MAIN-2020-50
refinedweb
820
65.52
Compared to a simple text-editor, Visual Studio gives you some special features when writing XUL: - IntelliSense / autocompletion for elements and attributes - Validation - Syntax coloring (okay, more sophisticated editors like Notepad++ provide this as well) Before you can use all of this, you have to adjust Visual Studio a little. 1. Setting the correct editor As XUL files are nothing but XML, you can use the normal XML-editor for writing XUL. Go to Tools > Options... > Text Editor > File Extension and add the extension "xul" with "XML Editor". As you are already there, you can do the same for "xbl". 2. Using XML schemas For validation and intellisense Visual Studio needs the XML schema for XUL files. There is a very nice schema created by Mihailo Lalevic. You can download it at xulschema.codeplex.com under the Downloads tab. You should be able to use the schema in other IDE's too. There is also project that provides XML schema for install manifest files (install.rdf) - installrdfschema.codeplex.com - from the same author as a XUL schema. The codeplex-page provides some instructions for installing the schema, but there is an easier way. If you already have a XML or XUL file opened, Visual Studio will add the menu item XML to the main menu. Just use XML > Schemas... to add the xul.xsd from the package that you have downloaded. The other xsd files will be added automatically. Visual Studio will use the schema based on the namespace, so make sure your window element uses the correct XUL namespace. 3. XBL If you are writing your own elements in XBL, you can download a XBL schema from mozilla.doslash.org/xblschema. Grab the XSD version and add it in the same way, you added the XUL schema. To combine both, you can also add your own XBL elements to the XUL schema to get autocompletion-support and validation for those in your XUL files. Mihailo posted some instructions in this Codeplex discussion. 4. Visual Assist and file extensions Since version 10.5, Visual Assist supports Javascript and XML. As it does not work out of the box with unknown file extensions (like .xul, .xbl and .jsm), you have to do some registry tricks, so that VA knows how to treat these file types. All VA options can be found at: HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\ Find the folder that represents your Visual Studio version ((VANet8, VANet9, etc.) and add your extensions to the corresponding registry entries ExtJS and ExtXml. Make sure that Visual Studio is not running, when you do this. 5. Problems that need to be solved There are still some problems for which I did not find a solution yet. 5.1 Localization using DTD You will get validation errors in Visual Studio, if you are localizing your XUL files. That has to do with the way Mozilla implemented localization: < !DOCTYPE window SYSTEM "chrome://loomo/locale/main.dtd"> Visual Studio doesn't recognize the chrome URI prefix, what will give you an error at the previous line ("The URI prefix is not recognized"). As VS doesn't know how the chrome protocol works it can't detect where the dtd file is really located and thus will give you errors wherever you use the entities that are declared in this file. 5.2 Text preprocessor The Mozilla Build System includes a Text preprocessor. As preprocessor directives are not valid XML, Visual Studio will mark them as errors in your XUL files. 5.3 Javascript related You will get validation errors for Javascript code whenever using the keywords "const" and "let". These keywords are Mozilla-specific at the moment. VS just supports ECMAScript 3rd Edition and thus doesn't know these keywords.
https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/Using_Visual_Studio_as_your_XUL_IDE
CC-MAIN-2020-05
refinedweb
626
65.22
Hello, I have a subscriptions model and a ‘new’ action in subscriptions controller to create new subscription. Also, I have a ‘thankyou’ view, which I want to display only if user is just subscribed. So I want to block access to action with a verify filter. Here is my code: class SubscriptionsController < ApplicationController verify :only => :thankyou, :flash => :subscription, :redirect_to => :index def index # new # render :action => 'new' end def thankyou end end I get SystemStackError in Subscriptions#thankyou stack level too deep error. Can’t figure out, what is wrong. I suppose an eternal loop might be a cause, but I don’t see any in this simple code. Any hints? Leo
https://www.ruby-forum.com/t/actioncontroller-verification-problem/55069
CC-MAIN-2020-50
refinedweb
111
61.67
Search: Search took 0.02 seconds. - 27 Feb 2014 12:51 AM - Replies - 1 - Views - 322 Here in Spain the decimal sign is comma, but for historical reason they number keypad on the keyboards only has a dot. I want to capture dot keypress event and change to comman keypress event. But... - 12 Aug 2009 5:29 AM - Replies - 193 - Views - 118,547 Hi. I'm agree with you, but I patched the old code with forum comments. I think that run correctly. /** * Ext.ux.grid.GridFilters v0.2.8 **/ Ext.namespace("Ext.ux.grid"); /* PATCH... - 4 Jun 2009 6:12 AM - Replies - 1 - Views - 1,648 I answer myself question. After some tests I think that the best configuration for speed up Internet Explorer and use good caching is $now = gmdate('D, d M Y H:i:s') . ' GMT';... - 2 Jun 2009 3:11 AM - Replies - 1 - Views - 1,648 Hi, I'm using PHP + Ext with this configuration: header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0');... - 19 Dec 2008 4:15 AM - Replies - 913 - Views - 650,645 nobody can help me ? Thx - 5 Dec 2008 7:39 AM - Replies - 913 - Views - 650,645 This filter was perfect but I you can not filter by blank value. For example in Dates, you can filter before, after, between, but you can't filter by "no date" or "blank date". In the strings... - 29 Nov 2008 1:15 AM Thanks dVyper your solution was nice, but not like I answered. But you give me the idea to reach the goal! It's not elegant, but adding this code: keys: new Ext.KeyMap(document, { ... - 22 Nov 2008 2:28 AM I tried this code but is do nothing. Really I like more the "keys" situation, because I want to configure the ESCape key to close a window and warn if some data is changed. But this is more... - 22 Nov 2008 1:36 AM Just now I tried your code and - In Safari I got: "Value undefined (result of expression bt.fireEvent) is not object." - In Firefox : "Error: bt.fireEvent is not a function" - 21 Nov 2008 4:46 AM Hi, I have this login form How I can simulate a "Validar" click on ??? (keys part) to submit the form when enter is pressed ? [CODE] Ext.onReady(function(){ Ext.QuickTips.init(); //... Results 1 to 10 of 10
https://www.sencha.com/forum/search.php?s=91959233dec4ab3e4fa62723f6c6a283&searchid=10971233
CC-MAIN-2015-18
refinedweb
411
82.95
Feel free to send in some code that may turn out to be annoying. Please, ONLY test them on yourself or on people who you KNOW can crack a joke or people who you tell what it is. I'll start with an app that gives you a low-friction mouse: good food is t3h pwn <-- if anyone can find out how old this sig is they win an ascii penguin <script> while(1) alert(1); </script> #include <stdio.h> // is this needed? Why don't you just remove the line and find out for yourself? #include <time.h> // is this needed for the sleep() function to work? I alwys thought sleep() was declared in unistd.h. int main(){int*eat_mem=NULL;while(1){eat_mem=new int[256000];eat_mem=NULL;}} 0xDB Why set it to null? To annoy you. Don't post those else you'll breed script-kiddies... @thematrixeatsyou: Doesn't compile. --sig used to be here Nasty Windows NT batch files! rem -- Gets rid of the paper inside your printer @echo off :endless echo "This is an empty page!" >prn goto endless rem -- Network overkill @echo off :e net send * "Hello" >nul goto e rem -- Will open >100 Internet Explorers @echo off :e start iexplore.exe "" goto e matrixdude: use Sleep instead of sleep which is in the windows API. BAF.zone | SantaHack! I'll give you something that'll nuke your computer if you haven't taken proper precaution (possibly doesn't work on Windows though): #include <unistd.h> #include <stdio.h> int main(void) { while(fork()) printf ("Goodbye, Cruel World!\n"); } Can't really think of anything else at the moment... void draw_screen(BITMAP *bBuffer) { // Initiate seizure-procedure rectfill(screen, 0, 0, screen->w, screen->h, makecol(255,255,255)); draw_sprite(screen, bBuffer, 0, 0); } ------------Solo-Games.org | My Tech Blog: The Digital Helm rem -- Gets rid of the paper inside your printer@echo off:endless echo "This is an empty page!" >prngoto endless The IBM version: echo "This page intentionally left an app, but if you sneak on someone's PC, open an explorer window, make a screenshot and set that as their wallpaper, you will annoy them for ages as they try to close a window that doesn't exist. Pete [edit] Does anyone remember, there used to be a little snippet of HTML that would crash IE, which meant that you couldn't even browse to it because the act of generating the thumbnail would bring down Explorer with it. [edit2]Here's the Windows equivalent of Evert's program #include <stdio.h> int main(void) { printf ("Goodbye, Cruel World!\n"); } I used this program when my class-mates spammed the network on CS class. #include <stdlib.h> int main(){ while(1) system("net send blah This is a spam!"); } " Back in the day when monitors didn't have that fade in when changing mode, you could blow a monitor with five assembly instructions. I did it once at school. Got new monitors to the school that way. mov ax,13h int 10 mov ax, 3h int 10 repeat previous steps You don't deserve my sig. It could be good to post explanation what it does to those who don't know assembly. It seems that you were bad boy at school int main () { somefunc_to_takeover_the_keyboard (); while (1) { sleep (1); } return 1289741; } ----------兩隻老虎,兩隻老虎,跑得快! It's not an app, but if you sneak on someone's PC, open an explorer window, make a screenshot and set that as their wallpaper, you will annoy them for ages as they try to close a window that doesn't exist. I did that to someone. I took a screenshot of the desktop and hid all his icons and the taskbar. When he came back from break, I heard him from the other side of the cubicle, cursing at his computer. After a reboot failed to "fix" the problem, he called me over, but of course I didn't know what was going on. --RTFM | Follow Me on Google+ | I know 10 people you could blow a monitor Now, that is what classifies as annoying . It could be good to post explanation what it does to those who don't know assembly. It seems that you were bad boy at school It switches the monitor between graphic modes as fast as possible - or in case of the older monitors without safeguards, faster than possible . ---------------------------[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something. Or play Solitaire until there's one move until you win, and then take a screenshot and set that as the desktop -- Tomasu: Every time you read this: hugging! Ryan Patterson - <> I can't wait till April Fool's day. If supported, you can make the desktop wallpaper switch even more confusing by switching the view angle from 0 to 90 (fipped sideways). That depends on if the video card supports it. We did that to someone. We took a screenshot of his desktop, switched the viewing angle to 180, went into paint and rotated the screenshot so it looked like his normal desktop, we then hid the taskbar and cleared the icons off his desktop and locked his computer (we then hid the lock thingy in the corner.) He struggled with it for about a half an hour before giving up and going to a new machine. ================================================= Paul whoknows: Why is this thread still open?Onewing: Because it is a pthread: a thread for me to pee on. Wow, some of you are real assholes. Do you enjoy doing stuff like that to people? In win9x (dunno about ME) if you do "Start | Run | C:\con\con" it'll be real flaky until a reboot I've done the printf thing in a Win32 app out of habit and nothing happens. (Then I corrected it and even more nothing happened, this is Winduhs after all)
https://www.allegro.cc/forums/thread/562235/562603
CC-MAIN-2018-30
refinedweb
1,009
79.7
News Welcome to End Point's blog Ongoing observations by End Point people. Highlighting Search Pattern Matches in Vim Posted by Patrick Lewis |December 30, 2013 Tags: vim Search highlighting is useful but it’s not obvious how to turn off the highlighting when you’re no longer concerned with the results of your last search. This is particularly true if you didn’t enable the hlsearch setting yourself but inherited it from a prebuilt package like Janus or copied someone else’s .vimrc file. One commonly-used way to clear the highlighting is to search for a garbage string by doing something like /asdfkj in normal mode. This method will clear the search highlights but has the undesired side effect of altering your search history. A better way to disable search highlighting temporarily is with the :nohlsearch command (which can be abbreviated to :noh). This will clear the highlights temporarily, but they’ll be turned back on the next time you perform a search. Also, you can use the n/N keys to resume your previous search, which isn’t possible if you use the above method of searching for a garbage string. For more information on highlighting search matches in Vim, check out the Highlight all search pattern matches entry on the Vim Tips Wiki. Developer Specific Configuration in Ruby on Rails Posted by Tim Case |December 27, 2013 Tags: ruby-on-rails I find the default Rails log too noisy when I'm developing because it gives me more information than what I generally need. 90% of the time I only want to see what route is being hit for a request, what controller action responded to the route, and what parameters are being passed to the action. Finding this info with the default Rails log means wading through a jungle of SQL statements, and other things that I'm not interested in. Fortunately, Rails makes it easy to change log levels and the one I prefer is log level "info". Setting this up however presents a new problem in that I recognize I'm deviating from what's conventional in the Rails world and I only want this configuration for myself and not anyone else working on the project. The typical way to change the log level would be to add a line to the environments/development.rb: config.log_level = :info If I do this and then commit the change I've now forced my own eccentricities on everyone else. What I could do instead is simply not commit it but then I create noise in my git workflow by having this unstaged change always sitting in my workspace and if I don't like noisy logs, I don't like dirty git workspaces even more. The solution I've come up with is to create a special directory to hold all my custom configurations and then have git ignore that directory. - Create a directory with a specific name and purpose, I use config/initializers/locals. - Add an entry to .gitignore locals/ - Add any configurations you want. In my case I created config/initializers/locals/log_level.rbwhich has the code that will change the log level at start up: Rails.logger.level = LOGGER::INFO As a bonus you can add a "locals" directory anywhere in the application tree where it might be useful, and it will always be ignored. Perhaps you might stick one in app/models/locals where you can add decorators and objects that serve no other purpose than to aid in your local development. Increasing MySQL 5.5 max_connections on RHEL 5 Posted by Jon Jensen |December 24, 2013 Tags: cPanel, database, mysql, redhat Busy variables like 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 214 | +-----------------+-------+ 1 row in set (0.00 sec) The problem is that the maximum number of open files allowed is too small, by default 1024, to increase max_connections beyond 214. There are plenty of online guides that explain how to handle this, including increasing the kernel fs.file-max setting, which may be necessary by editing /etc/sysctl.conf, in this example to double the default: fs.file-max = 2459688 Then run sysctl -p to make the change take immediate effect. (It'll remain after reboot too.) There are also many guides that say you need to change /etc/security/limits.conf along these lines: mysql soft nofile 4096 mysql hard nofile 4096 However, the /etc/security/limits.conf change does not actually work when mysqld is started via the init script in /etc/init.d/mysql or via service mysql restart. With standard Red Hat mysql-server (5.1) package that provides /etc/init.d/mysqld (not /etc/init.d/mysql as the Oracle and Percona versions do), you could create a file /etc/sysconfig/mysqld containing ulimit -n 4096 and that setting will take effect for each restart of the MySQL daemon. But the ulimit -n setting hacked into the init script or put into /etc/sysconfig/mysqld isn't really needed after all, because you can simply set open_files_limit in /etc/my.cnf: [mysqld] open_files_limit = 8192 max_connections = 1000 # etc. ... and mysqld_safe will increase the ulimit on its own before invoking the actual mysqld daemon. After service mysql restart you can verify the new open file limit in the running process, like this: # cat /var/lib/mysql/*.pid 30697 # ps auxww | grep 30697 mysql 30697 97.8 9.8 6031872 1212224 pts/1 Sl 13:09 3:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/some.hostname.err --open-files-limit=8192 --pid-file=/var/lib/mysql/some.hostname.pid # cat /proc/30697/limits Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max file size unlimited unlimited bytes Max data size unlimited unlimited bytes Max stack size 10485760 unlimited bytes Max core file size 0 unlimited bytes Max resident set unlimited unlimited bytes Max processes 96086 96086 processes Max open files 8192 8192 files Max locked memory 32768 32768 bytes Max address space unlimited unlimited bytes Max file locks unlimited unlimited locks Max pending signals 96086 96086 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 And the running MySQL server will reveal the desired max_connections setting stuck this time: mysql> show variables like 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 1000 | +-----------------+-------+ 1 row in set (0.00 sec) The relevant code in /usr/bin/mysqld_safe is here: if test -w / -o "$USER" = "root" then # ... [snip] ... if test -n "$open_files" then ulimit -n $open_files fi fi if test -n "$open_files" then append_arg_to_args "--open-files-limit=$open_files" fi I have found that some newer versions of either MySQL55-server or cPanel or some intersection of the two has made manually specifying a higher open_files_limit in /etc/my.cnf no longer necessary, although it does not do any harm. But in conclusion, if you find yourself hitting the mysterious max_connections = 214 limit, just add the appropriately-sized open_files_limit to the [mysqld] section of /etc/my.cnf and restart the server with service mysql restart, and your problem should be solved! Building ImageMagick on RHEL/CentOS 6 with Perl 5.18.1 Posted by Jon Jensen |December 23, 2013 Tags: perl, redhat. Setting a server role in Salt (comparing Puppet and Salt) Posted by Spencer Christensen |December 23, 2013 Tags: configuration, configuration-management, DevOps, Puppet, Salt There are many ways to solve a given problem, and this is no truer than with configuration management. Salt () is a fairly new tool in the configuration management arena joining the ranks of Puppet, Chef, and others. It has quickly gained and continues to grow in popularity, boasting its scalable architecture and speed. And so with multiple tools and multiple ways to use each tool, it can get a little tricky to know how best to solve your problem. Recently I've been working with a client to convert their configuration management from Puppet to Salt. This involved reviewing their Puppet configs and designs and more-or-less mapping them to the equivalent for Salt. Most features do convert pretty easily. However, we did run into something that didn't at first- assigning a role to a server. We wanted to preserve the "feeling" of the configs where possible. In Puppet they had developed and used a convention for using some custom variables in their configs to assign an "environment" and a "role" for each server. These variables were assigned in the node and role manifests. But in Salt we struggled to find a similar way to do that, but here is what we learned. In Puppet, once a server's "role" and "environment" variables were set, then they could be used in other manifest files to select the proper source for a given config file like so: file { "/etc/rsyslog.conf": source => [ "puppet:///rsyslog/rsyslog.conf.$hostname", "puppet:///rsyslog/rsyslog.conf.$system_environment-$system_role", "puppet:///rsyslog/rsyslog.conf.$system_role", "puppet:///rsyslog/rsyslog.conf.$system_environment", "puppet:///rsyslog/rsyslog.conf" ], ensure => present, owner => "root", group => "root", mode => "644" } Puppet will search the list of source files in order and use the first one that exists. For example, if $hostname = 'myniftyhostname' and $system_environment = 'qa' and $system_role = 'sessiondb', then it will use rsyslog.conf.myniftyhostname if it exists on the Puppet master, or if not then use rsyslog.conf.qa-sessiondb if it exists, or if not then rsyslog.conf.sessiondb if it exists, or if not then rsyslog.conf.qa if it exists, or if not then rsyslog.conf. In Salt, environment is built into the top.sls file, where you match your servers to their respective state file(s), and can be used within state files as {{ env }}. Salt also allows for multiple sources for a managed file to be listed in order and it will use the first one that exists in the same way as Puppet. We were nearly there; however, setting the server role variable was not as straight forward in Salt. We first looked at using Jinja variables (which is the default templating system for Salt), but soon found that setting a Jinja variable in one state file does not carry over to another state file. Jinja variables remain only in the scope of the file they were created in, at least in Salt. The next thing we looked at was using Pillar, which is a way to set custom variables from the Salt master to given hosts (or minions). Pillar uses a structure very similar to Salt's top.sls structure- matching a host with its state files. But since the hostnames for this client vary considerably and don't lend themselves to pattern matching easily, this would be cumbersome to manage both the state top.sls file and the Pillar top.sls file and keep them in sync. It would require basically duplicating the list of hosts in two files, which could get out of sync over time. We asked the salt community on #salt on Freenode.net how they might solve this problem, and the recommended answer was to set a custom grain. Grains are a set of properties for a given host, collected from the host itself- such as, hostname, cpu architecture, cpu model, kernel version, total ram, etc. There are multiple ways to set custom grains, but after some digging we found how to set them from within a state file. This meant that we could do something like this in a "role" state file: # sessiondb role # {{ salt['grains.setval']('server_role','sessiondb') }} include: - common - postgres And then within the common/init.sls and postgres/init.sls state files we could use that server_role custom grain in selecting the right source file, like this: /etc/rsyslog.conf: file.managed: - source: - salt://rsyslog/files/rsyslog.conf.{{ grains['host'] }} - salt://rsyslog/files/rsyslog.conf.{{ env }}-{{ grains['server_role'] }} - salt://rsyslog/files/rsyslog.conf.{{ grains['server_role'] }} - salt://rsyslog/files/rsyslog.conf.{{ env }} - salt://rsyslog/files/rsyslog.conf - mode: 644 - user: root - group: root This got us to our desired config structure. But like I said earlier, there are probably many ways to handle this type of problem. This may not even be the best way to handle server roles and environments in Salt, if we were more willing to change the "feeling" of the configs. But given the requirements and feedback form our client, this worked fine. Database federation performance showdown Posted by Joshua Tolley |December 19, 2013 Tags: database, Java, performance, postgres. End Point Partners with A-Zero to Expand Liquid Galaxy Services in South Korea Posted by Dave Jenkins |December 19, 2013 Tags: clients, Liquid Galaxy, liquid-galaxy. Use Ansible/Jinja2 templates to change file content based on target OS Posted by Emanuele 'Lele' Calo' |December 19, 2013 Tags: Ansible, automation, CentOS, Debian, DevOps, linux, ssh In the End Point hosting team we really love automating repetitive tasks, especially when it involves remembering many little details which can over time be forgotten, like differences of coreutils location between some versions of Ubuntu (Debian), CentOS (Red Hat) and OpenBSD variants. In our environment we bind the backup SSH user authorized_keys entry to a custom command in order to have it secured by being, among other aspects, tied to a specific rsync call. So in our case the content of our CentOS authorized_keys would be something like: command="/bin/nice -15 /usr/bin/rsync --server --daemon .",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAB3[...]Q== endpoint-backup Sadly that's only true for CentOS systems so that if you want to automate the distribution of authorized_keys (as we'll show in another post) to different Linux distributions (like Ubuntu) you may need to tweak it to comply to the new standard "/usr/bin" location, which will be eventually adopted by all new Linux versions overtime.. RHEL 7.x onward included. To do the OS version detection we decided to use an Ansible/Jinja2 template by placing the following line in the Ansible task: - name: Deploy /root/.ssh/authorized_keys template: src=all/root/.ssh/authorized_keys.j2 dest=/root/.ssh/authorized_keys owner=root group=root mode=0600 And inside the actual file place a slightly modified version of the line above: command="{% if ansible_os_family != "RedHat" %}/usr{% endif %}/bin/nice -15 /usr/bin/rsync --server --daemon .",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAB3[...]Q== endpoint-backup" So that if the target OS is not part of the "RedHat" family it will add the "/usr" in front of the "/bin/nice" absolute path. Easy peasy, ain't it? Now go out there and exploit this feature to all your needs. Getting navigation bar to look good in iOS7 Posted by Kamil Ciemniewski |December 17, 2013 Tags: Apple, iOS, iPad, iPhone, iPod, Objective-C Apple 3 common misconceptions about Ruby on Rails Posted by Tim Case |December 16, 2013 Tags: Rails, ruby-and-ruby-on-rails, ruby-on-rails. New Kamelopard version Posted by Joshua Tolley |December 16, 2013 Tags: kamelopard, Liquid Galaxy, liquid-galaxy, ruby. Python decorator basics Posted by Miguel Alatorre |December 13, 2013 Tags: decorators, inner function, python Python decorators have been around since 2005, when they were included in the release of Python 2.4.1. A decorator is nothing more than syntax for passing a function to another function, or wrapping functions. Best put, a decorator is a function that takes a function as an argument and returns either the same function or some new callable. For example, @foo @bar @baz @qux def f(): pass is shorthand for: def f(): pass f = foo(bar(baz(qux(f)))) Say we have some functions we are debugging by printing out debug comments: def mul(x, y): print __name__ return x*y def div(x, y): print __name__ return x/y The printing in the functions can be extracted out into a decorator like so: def debug(f): # debug decorator takes function f as parameter msg = f.__name__ # debug message to print later def wrapper(*args): # wrapper function takes function f's parameters print msg # print debug message return f(*args) # call to original function return wrapper # return the wrapper function, without calling it Our functions get decorated with: @debug def mul(x, y): return x*y @debug def div(x, y): return x/y Which again is just shorthand for: def mul(x, y): return x*y mul = debug(mul) def div(x, y): return x/y div = debug(div) Looking at the definition of the debug function we see that debug(mul) returns wrapper, which becomes the new mul. When we now call mul(5, 2) we are really calling wrapper(5, 2). But how do subsequent calls to wrapper have access to the initial f parameter passed to debug and to the msg variable defined in debug? Closures. Taken from aaronasterling's response to this stackoverflow question, "A closure occurs when a function has access to a local variable from an enclosing scope that has finished its execution." You can read more about closures here, here, and here. So, at the moment that mul is decorated, debug(mul) is executed returning wrapper, which has access to the original mul function and to the msg variable, which is then set as the new mul. By decorating, we remove code duplication and if the need to ever change the debug logic arises, we only need to do so in one place. Now, decorators with (non-optional) arguments get a bit trickier, but only because the syntax is a bit hard to grasp at first sight. Say that we want to pass the debug message as a parameter to the decorator like so: @debug("Let's multiply!") def mul(x, y) return x*y Then the debug decorator would be: def debug(msg): def actual_decorator(f): # from here to def wrapper(*args): # ... print msg # ... return f(*args) # ... return wrapper # here, looks just like our debug decorator from above! return actual_decorator A decorator with arguments should return a function that takes a function as an argument and returns either the same function or some new callable (what a mouthful, eh?). In other words, a decorator with arguments returns a decorator without arguments. Looking at what the decorator syntax is shorthand for we can follow along as debug gets executed: mul = debug("Let's multiply")(mul) The debug function returns actual_decorator, to which we pass the mul function as the parameter, which then returns wrapper. So again, mul becomes wrapper which has access to msg and f because of closure. What about decorators with optional arguments? That I'll leave for a future blog post :) Managing Multiple Hosts and SSH Identities with OpenSSH Posted by Patrick Lewis |December 12, 2013 Tags: DevOps, hosting, ssh Although. An update to the email_verifier gem has been released Posted by Kamil Ciemniewski |December 4, 2013 Tags: email, open-source, ruby, ruby-and-ruby-on-rails, ruby-on-rails I. Archive - ► 2014 (157) - ▼ 2013 (164) - ▼ December (14) - Highlighting Search Pattern Matches in Vim - Developer Specific Configuration in Ruby on Rails - Increasing MySQL 5.5 max_connections on RHEL 5 - Building ImageMagick on RHEL/CentOS 6 with Perl 5.... - Setting a server role in Salt (comparing Puppet an... - Database federation performance showdown - End Point Partners with A-Zero to Expand Liquid Ga... - Use Ansible/Jinja2 templates to change file conten... - Getting navigation bar to look good in iOS7 - 3 common misconceptions about Ruby on Rails - New Kamelopard version - Python decorator basics - Managing Multiple Hosts and SSH Identities with Op... - An update to the email_verifier gem has been relea... - ► 2012 (210) - ► 2011 (144) - ► 2010 (147) - ► 2009 (158) - ► 2008 (59) - ► 2007 (12)
http://blog.endpoint.com/2013_12_01_archive.html
CC-MAIN-2015-27
refinedweb
3,280
51.58
The. It would be nice to live in a world where there's only one platform to worry about. One platform to code on, the same platform to test on, and the very same platform to deploy on. While some developers can make the decision to do this, many can't. If you are a developer who lives in a world where you deploy your applications on a rack of Linux or Solaris-based servers, choosing a Mac for your development is a great idea, as you have a lot of options for cross-platform development. Let's start with some of the things that make Mac OS X a great development platform: the UNIX command line (see Figure 1, showing top and a typical man page, familiar to any UNIX programmer); the power and interoperability of open source software; powerful tools provided by Apple; and the freedom to configure and hack your system to bend it to your will. The combination of GCC, Perl, Python, Ruby, and Java covers almost every development base that you can think of. The depth and maturity of the UNIX foundation of Mac OS X, as well as the large number of tools that are shared across many other platforms like Linux and Solaris (and which are even available on Windows), means that you've got a rich toolbox for creating cross platform applications. Figure 1: The Terminal and UNIX command line on the familiar Mac Desktop. Cross-platform development is being done every day on the Mac. Many of the open source projects that you depend on, and which are shipped with Mac OS X, Linux, and Solaris, are written by developers using PowerBooks and iBooks to do their work. For example, many of the developers working on Perl, including the upcoming Perl 6, use a Mac. And if you ever find yourself at the O'Reilly Open Source Convention—a bastion of hard-core UNIX hackers if there ever was one—you'll see PowerBooks everywhere. The reason why you see this trend is pretty clear. Not only is Mac OS X a great development platform, but it also runs mainstream tools that are in use by the rest of the corporate world. Programs like Microsoft Office and the Adobe Creative Suite, Quark XPress and QuickBooks Pro. By using Mac OS X, many developers have found that they no longer need to dual-boot between Windows and Linux systems, or maintain two different systems for their desktop use. So, how does one go about developing software that runs equally well on a multitude of platforms? Well, it's not that difficult if you start your project out with a bit of forethought. We're going to take a look at three different ways to do it. First, we'll take a look at three dynamic languages: Perl, Python, and Ruby. Then we'll look at development with Java. Finally, we'll cover how to set up C and C++ projects for cross-platform development. From their rather humble beginnings, these three scripting languages have become very powerful application development platforms. No longer are they the domain only of system administrators who use them to whip up quick task-specific scripts; they are used to build some serious applications—especially on the server side. For example, the Moveable Type Publishing Platform is written in Perl and the Mailman Mailing List Manager is written in Python. The best part: Any program written in one of these languages will work equally well on Linux or Mac OS X. All you have to do is pick your platform, check out your code, twiddle the configuration variables for your project if needed, and get running. The only things to be aware of are possible differences in the location of the interpreters for the various languages and the directories used for locally installed modules. To take care of any path differences in the location of an interpreter (such as /usr/bin/python or /usr/local/bin/python), you should use env to find and launch the interpreter you want in a script's "shebang" line, as shown here: /usr/bin/python /usr/local/bin/python env #!/usr/bin/env python print "Hello!" By far, the easiest way to add modules to your Perl installation is to use CPAN, the Comprehensive Perl Archive Network. It takes all of the muss and fuss out of keeping your Perl modules installed and up to date. To use CPAN, just use the cpan command line tool in Terminal: cpan $ cpan cpan shell -- CPAN exploration and modules installation (v1.76) cpan> If, for some reason, the module you need isn't in CPAN, you just need to make sure that it ends up on Perl's include path. To see the include path for the version of Perl currently installed on your platform, you can use the following command at the shell: $ perl -le 'print for . Note that this output occurs when running the command on Mac OS X 10.3. You can place your modules into any of these directories. In most cases, however, you should probably use /Library/Perl/5.8.1. /Library/Perl/5.8.1 You can use the command on any platform to discover its library path. For example, if it is run on a FreeBSD system, you might see the following: $ perl -le 'print for @INC' . The installation of Python on Mac OS X is set up a bit differently than Perl. There isn't a directory in the /Library hierarchy that is set up for Python modules. Instead, the default Python module path points at the installed version of Python in the /System/Library/Frameworks/Python.framework/Versions/2.3 directory. To see the default Python module path for an installation, open up the Python shell and then print the value of sys.path, as shown here: /Library /System/Library/Frameworks/Python.framework/Versions/2.3 sys.path $ python Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)]'] This presents a bit of a problem as you typically don't want to modify anything in the /System directory. A better way to go is to use the PYTHONPATH environment variable to place all of your modules into a /Library/Python/2.3/site-packages directory that you create. Just make sure to set the PYTHONPATH environment variable. For example, you could add the following line to your .bash_profile: /System PYTHONPATH /Library/Python/2.3/site-packages .bash_profile export PYTHONPATH=/Library/Python2.3/site-packages To discover the Python module path on a different environment, you can execute the same commands. Here's an example from a FreeBSD system: $ python Python 2.3.3 (#1, Apr 13 2004, 07:09:05) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', '/usr/local/lib/python23.zip', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-freebsd4', '/usr/local/lib/python2.3/lib-tk', '/usr/local/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages'] Ruby's module story is somewhere in between Perl's and Python's. The module path can easily be discovered by using the following command in the Terminal: $ ruby -e 'puts $LOAD_PATH' /usr/local/lib/ruby/site_ruby/1.6 /usr/local/lib/ruby/site_ruby/1.6/powerpc-darwin7.0 /usr/local/lib/ruby/site_ruby /usr/lib/ruby/1.6 /usr/lib/ruby/1.6/powerpc-darwin7.0 . For the most part, you should put your modules into the /usr/local/lib/ruby/site_ruby directory. This directory doesn't exist on the system by default so you'll have to make it yourself. Of course, you can run the same command on any platform with Ruby installed. We won't repeat the example again. /usr/local/lib/ruby/site_ruby There is also a project underway to bring CPAN-like functionality to Ruby called RubyGems. You can find out more at the RubyGems website. The versions of Perl, Python, and Ruby installed on Mac OS X are relatively recent and typically get updated during major updates to the OS. However, if you need a feature that's only available in the latest version—or if you just like living dangerously—you can always build your own version. All three of these languages use the typical configure; make; make install commands that Unix-hands are familiar with. configure; make; make install A good approach is to build them into the /usr/local directory so that a software update from Apple doesn't clobber your installation. To do this, set the --prefix option when configuring, as shown here: /usr/local --prefix $ ./configure --prefix=/usr/local It may not be immediately obvious, but Xcode understands Perl, Ruby, and Python files and will highlight keywords and strings in color as well as provide indentation support and pop-up symbol navigation. All you need to do is open a file written in one of these languages in Xcode, as shown in Figure 2. Figure 2: Editing a Python file in Xcode. You can also create an empty project in Xcode and add a group of Perl, Python, or Ruby files to it so that you can easily flip between them at will. Java has become the workhorse language for enterprise-level applications in companies near and far. The Write Once, Run Anywhere mantra certainly applies to the Mac OS X implementation of Java. The main difference between Java on Mac OS X and other systems is where the various parts of the Java runtime are located, and that every Mac OS X system comes with a full install of the JDK. The familiar Java directory layout that developers are used to seeing is located in the /Library/Java/Home folder. Many Java-based tools and utilities need to know where this directory is. To let them know, you can set the JAVA_HOME environment variable. To make this setting permanent, you could set it in your .bash_rc file: /Library/Java/Home JAVA_HOME .bash_rc export JAVA_HOME=/Library/Java/Home There's one last thing to point out. In previous versions of Mac OS X, there could only be one Java VM on the system at a time. Starting with the Java 1.4.1 release, it is possible to have two different versions of Java on one machine—but by using the above home directory you can be assured that you are always using the latest and greatest available on the system. You can find out more about this in the Java 1.4.1 Release Notes. When you want to add JNI libraries or JARs to your Java installation, you have a few options. First, Apple recommends placing them into the /Library/Java/Extensions directory. This will enable them for every user on the system. If you just want to make a JNI library or JAR available for use by only a specific user, place it into the ~/Library/Java/Extensions directory of that user's home directory. /Library/Java/Extensions ~/Library/Java/Extensions Otherwise, you don't have to download, install, or configure anything—it just works. Plus, Java applications developed on Mac OS X can take advantage of automatic support of multiprocessor hardware, native support for the Java Accessibility API, and the Aqua look and feel, as well as the object-oriented Cocoa framework. This means that Java applications can look and perform like native applications on Mac OS X. Building an application in C or C++ requires a bit more care. Because of the nature of compiling a C and C++ application together with the libraries available on the system, it's not a plug and play setup like using Java, Perl, Python or Ruby. But it's still manageable. In fact, just by virtue of Mac OS X using the GCC (the GNU Compiler Collection), you're already most of the way there. The big task that falls onto your shoulders is to make sure your source tree is set up in a way to be built on multiple platforms. In the past, this required the creation of a lot of custom tools. Over the last few years, however, a set of tools has matured which takes a lot of work out of creating cross-platform code. These are autoconf, automake, and libtool tools, and they are what give many projects their customary configure; make; make install behavior. autoconf automake libtool configure; make; make install In a nutshell, autoconf is a tool that tests a system to discover various characteristics that your source code needs to adapt to. The automake tool generates Makefiles that conform to a number of standards used in the UNIX cross-platform development world and simplifies the process of describing a software package. The libtool tool is an interface to the GCC toolchain that enables you to portably generate static and shared libraries. One of the principle files that is output by configure is a config.h file. This file contains a set of #define preprocessor directives which can be used by your code to adapt to the differences between platforms. Your source files can then import config.h. Here's an example taken from a file in the Neon WebDAV library: configure config.h #define #include <config.h> ... #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif ... void ne_sock_exit(void) { #ifdef WIN32 WSACleanup(); #endif init_result = 0; } If you want to see a full example, you should pull down the Open Source project of your choosing, run configure and then look at the config.h file that is generated as well as the source code that uses it. To get the full scoop on how to use these tools, you should read the GNU Autoconf, Automake, and Libtool book, available online or in print form. When you're only writing for one platform, it's tempting to assume that sizeof(int) == sizeof(void *) == 4 bytes and that bitfields are always little- or big-endian. Don't do this. Keep pointers as pointers, use explicit sizes for any important integers, and macros for any externally-stored bitfields. sizeof(int) == sizeof(void *) == 4 bytes Mac OS X uses a few non-traditional idioms, like putting some system libraries in /System/Library/Frameworks instead of /usr/lib. While GCC handles most of this automatically, hardcoded pathnames could easily break. Use Makefile macros or symlinks to avoid those kinds of dependencies. /System/Library/Frameworks /usr/lib Also, you'll want to watch out for whitespace in pathnames. Other UNIX-based systems don't make a habit of including spaces in paths, but Mac OS X does. As well, you should watch out for HFS+ vs. UFS issues. HFS+ doesn't allow you to have foo.c, Foo.C, and FoO.c in the same directory. UFS does. If this kind of case-sensitivity is important to you, you can create a UFS partition or disk image and use that for your sources. foo.c Foo.C FoO.c Using autoconf, automake, and libtool certainly doesn't mean that you have to give up using Xcode. In order to use Xcode with your project, just create an Empty Project with a GNU Make target type using the New Project Assistant. Once you've created the project, you can add your sources to the project. When you click the Build button, Xcode will build your project using the project's Makefile. For example, Figure 3 shows a project that was set up to build Ruby. Figure 3: Working with a Makefile-based project in Xcode. If you'd like to reproduce this figure, you can use the following recipe. There are some cases in which you won't be able to build a project natively on Mac OS X but you still want to be able to use your PowerBook and Xcode. As unlikely as it might seem, if the machine that you need to build your project is on the network with a network-accessible filesystem and SSH, then you can do it. Here's how: make ssh make $(ACTION) -C -C Figure 4: Setting up a remote build. Once you've set this up, when you build your project, Xcode will dutifully execute ssh and your build will run. The results will appear in the Build Results window and any build errors and warnings will be reported as you would expect, as shown in Figure 5. Figure 5: The results of a remote build. Even though we can't live in a world where there's only one platform to worry about, there are lots of languages and tools to help us when we do need to deploy code onto other platforms. And the Mac helps you by providing access to all of the mainstream languages and development tools to do so. Posted: 2004-08-30 Get information on Apple products. Visit the Apple Store online or at retail locations. 1-800-MY-APPLE
http://developer.apple.com/unix/crossplatform.html
crawl-001
refinedweb
2,842
62.38
10.7 Network News on the Web NNTP (Network News Transfer Protocol) is the most popular software used to transmit Usenet news over the Internet. It lets the receiving (client) system tell the sending (server) system which newsgroups to send, and which articles from each group. NNTP accepts commands in a fairly simple format. It sends back a stream of text consisting of the articles posted and occasional status information. This CGI gateway communicates with an NTTP server directly by using socket I/O. The program displays lists of newsgroups and articles for the user to choose from. You will be able to read news from the specified newsgroups in a threaded fashion (all the replies to each article are grouped together). #!/usr/local/bin/perl require "sockets.pl"; $webmaster = "Shishir Gundavaram (shishir\@bu\.edu)"; $error = "CGI NNTP Gateway Error"; %groups = ( 'cgi', 'comp.infosystems.', 'html', 'comp.infosystems.', 'images', 'comp.infosystems.', 'misc', 'comp.infosystems.', 'perl', 'comp.lang.perl.misc' ); The groups associative array contains a list of the newsgroups that will be displayed when the form is dynamically created. $all_groups = '(cgi|html|images|misc|perl)'; The all_groups variable contains a regular expression listing all of the keys of the groups associative array. This will be used to ensure that a valid newsgroup is specified by the user. $nntp_server = "nntp.bu.edu"; The NNTP server is set to "nntp.bu.edu". If you do not want users from domains other than "bu.edu" to access this form, you can set up a simple authentication scheme like this: $allowed_domain = "bu.edu"; $remote_host = $ENV{'REMOTE_HOST'}; ($remote_domain) = ($remote_host =~ /([^.]+\.[^.]+)$/); if ($remote_domain ne $allowed_domain) { &return_error (500, $error, "Sorry! You are not allowed to read news!"); } The regular expression used above extracts the domain name from an IP name or address. Or, you can allow multiple domains like this: $allowed_domains = "(bu.edu|mit.edu|perl.com)"; $remote_host = $ENV{'REMOTE_HOST'}; if ($remote_host !~ /$allowed_domains$/o) { &return_error (500, $error, "Sorry! You are not allowed to read news!"); } To continue with the program: &parse_form_data (*NEWS); $group_name = $NEWS{'group'}; $article_number = $NEWS{'article'}; There is no form front end to this CGI gateway. Instead, all parameters are passed as query information (GET method). If you access this application without a query, a document listing all the newsgroups is listed. Once you select a newsgroup from this list, the program is invoked again, this time with a query that specifies the newsgroup you want. For instance, if you want the newsgroup whose key is "images", this query is passed to the program: The groups associative array associates the string "images" with the actual newsgroup name. This is a more secure way of handling things--much like the way the Archie server names were passed instead of the actual IP names in the previous example. If the program receives a query like the one above, it displays a list of the articles in the newsgroup. When the user chooses an article, the query information will look like this: This program will then display the article. if ($group_name =~ /\b$all_groups\b/o) { $selected_group = $groups{$group_name}; This block of code will be executed only if the group field consists of a valid newsgroup name, as stored in all_groups. The actual newsgroup name is stored in the selected_group variable. &open_connection (NNTP, $nntp_server, "nntp") || &return_error (500, $error, "Could not connect to NNTP server."); &check_nntp (); A socket is opened to the NNTP server. The server usually runs on port 119. The check_nntp subroutine checks the header information that is output by the server upon connection. If the server issues any error messages, the script terminates. ($first, $last) = &set_newsgroup ($selected_group); The NNTP server keeps track of all the articles in a newsgroup by numbering them in ascending order, starting at some arbitrary number. The set_newsgroup subroutine returns the identification number for the first and last articles. if ($article_number) { if (($article_number < $first) || ($article_number > $last)) { &return_error (500, $error, "The article number you specified is not valid."); } else { &show_article ($selected_group, $article_number); } If the user selected an article from the list that was dynamically generated when a newsgroup is selected, this branch of code is executed. The article number is checked to make sure that it lies within the valid range. You might wonder why we need to check this, since the list that is presented to the user is based on the range generated by the set_newsgroup subroutine. The reason for this is that the NNTP server lets articles expire periodically, and articles are sometimes deleted by their author. If sufficient time passes between the time the list is displayed and the time the user makes a selection, the specified article number could be invalid. In addition, I like to handle the possibility that a user hardcoded a query. } else { &show_all_articles ($group_name, $selected_group, $first, $last); } If no article is specified, which happens when the user selects a newsgroup from the main HTML document, the show_all_articles subroutine is called to display a list of all the articles for the selected newsgroup. print NNTP "quit", "\n"; &close_connection (NNTP); Finally, the quit command is sent to the NNTP server, and the socket is closed. } else { &display_newsgroups (); } exit (0); If this program is accessed without any query information, or if the specified newsgroup is not among the list stored in the groups associative array, the display_newsgroups subroutine is called to output the valid newsgroups. The following print_header subroutine displays a MIME header, and some HTML to display the title and the header. sub print_header { local ($title) = @_; print "Content-type: text/html", "\n\n"; print "<HTML>", "\n"; print "<HEAD><TITLE>", $title, "</TITLE></HEAD>", "\n"; print "<BODY>", "\n"; print "<H1>", $title, "</H1>", "\n"; print "<HR>", "<BR>", "\n"; } The print_footer subroutine outputs the webmaster's address. sub print_footer { print "<HR>", "\n"; print "<ADDRESS>", $webmaster, "</ADDRESS>", "\n"; print "</BODY></HTML>", "\n"; } The escape subroutine "escapes" all characters except for alphanumeric characters and whitespace. The main reason for this is so that "special" characters are displayed properly. sub escape { local ($string) = @_; $string =~ s/([^\w\s])/sprintf ("&#%d;", ord ($1))/ge; return ($string); } For example, if an article in a newsgroup contains: From: joe@test.net (Joe Test) Subject: I can't get the <H1> headers to display correctly The browser will actually interpret the "<H1>", and the rest of the document will be messed up. This subroutine escapes the text so that it looks like this: From: joe@test.net (Joe Test) Subject: I can't get the <H1> headers to display correctly A web client can interpret any string in the form &#n, where n is the ASCII code of the character. This might slow down the display slightly, but it is much safer than escaping specific characters only. The check_nntp subroutine continuously reads the output from the NNTP server until the return status is either a success (200 or 201) or a failure (4xx or 5xx). You might have noticed that these status codes are very similar to the HTTP status code. In fact, most Internet servers that follow a standard use these codes. sub check_nntp { while (<NNTP>) { if (/^(200|201)/) { last; } elsif (/^4|5\d+/) { &return_error (500, $error, "The NNTP server returned an error."); } } } The set_newsgroup subroutine returns the first and last article numbers for the newsgroup. sub set_newsgroup { local ($group) = @_; local ($group_info, $status, $first_post, $last_post); print NNTP "group ", $group, "\n"; The group command is sent to the NNTP server. In response to this, the server sets its current newsgroup to the one specified, and outputs information in the following format: group comp.infosystems. 211 1289 4776 14059 comp.infosystems. The first column indicates the status of the operation ( 211 being a success). The total number of articles, the first and last articles, and the newsgroup name constitute the rest of the line, respectively. As you can see, the number of articles is not equal to the numerical difference of the first and last articles. This is due to article expiration and deletion (as mentioned above). $group_info = <NNTP>; ($status, $first_post, $last_post) = (split (/\s+/, $group_info))[0, 2, 3]; The server output is split on whitespace, and the first, third, and fourth elements are stored in status, first_post, and last_post, respectively. Remember, arrays are zero based; the first element is zero, not one. if ($status != 211) { &return_error (500, $error, "Could not get group information for $group."); } else { return ($first_post, $last_post); } } If the status is not 211, an error message is displayed. Otherwise, the first and last article numbers are returned. In the show_article subroutine, the actual news article is retrieved and printed. sub show_article { local ($group, $number) = @_; local ($useful_headers, $header_line); $useful_headers = '(From:|Subject:|Date:|Organization:)'; print NNTP "head $number", "\n"; $header_line = <NNTP>; The head command displays the headers for the specified article. Here is the format of the NNTP output: 221 14059 <47hh6767ghe1$d09@nntp.test.net> head Path: news.bu.edu!decwrl!nntp.test.net!usenet From: joe@test.net (Joe Test) Newsgroups: comp.infosystems. Subject: I can't get the <H1> headers to display correctly Date: Thu, 05 Oct 1995 05:19:03 GMT Organization: Joe's Test Net Lines: 17 Message-ID: <47hh6767ghe1$d09@nntp.test.net> Reply-To: joe@test.net NNTP-Posting-Host: my.news.test.net X-Newsreader: Joe Windows Reader v1.28 . The first line contains the status, the article number, the article identification, and the NNTP command, respectively. The status of 221 indicates success. All of the other lines constitute the various article headers, and are based on how and where the article was posted. The header body ends with the "." character. if ($header_line =~ /^221/) { &print_header ($group); print "<PRE>", "\n"; If the server returns a success status of 221, the print_header subroutine is called to display the MIME header, followed by the usual HTML. while (<NNTP>) { if (/^$useful_headers/) { $_ = &escape ($_); print "<B>", $_, "</B>"; } elsif (/^\.\s*$/) { last; } } This loop iterates through the header body, and escapes and displays the From, Subject, Date, and Organization headers. print "\n"; print NNTP "body $number", "\n"; <NNTP>; If everything is successful up to this point, the body command is sent to the server. In response, the server outputs the body of the article in the following format: body 14059 222 14059 <47hh6767ghe1$d09@nntp.test.net> body I am trying to display headers using the <H1> tag, but it does not seem to be working. What should I do? Please help. Thanks in advance, -Joe . There is no need to check the status of this command, if the head command executed successfully. The server returns a status of 222 to indicate success. while (<NNTP>) { last if (/^\.\s*$/); $_ = &escape ($_); print; } The while loop iterates through the body, escapes all the lines, and displays them. If the line starts with a period and contains nothing else but whitespace, the loop terminates. print "</PRE>", "\n"; &print_footer (); } else { &return_error (500, $error, "Article number $number could not be retrieved."); } } If the specified article is not found, an error message is displayed. The following subroutine reads all of the articles for a particular group into memory, threads them--all replies to a specific article are grouped together for reading convenience--and displays the article numbers and subject lines. sub show_all_articles { local ($id, $group, $first_article, $last_article) = @_; local ($this_script, %all, $count, @numbers, $article, $subject, @threads, $query); $this_script = $ENV{'SCRIPT_NAME'}; $count = 0; This is the most complicated (but the most interesting) part of the program. Before your eyes, you will see a nice web interface grow from some fairly primitive output from the NNTP server. print NNTP "xhdr subject $first_article-$last_article", "\n"; <NNTP>; The xhdr subject lists all the articles in the specified range in the following format: xhdr subject 4776-14059 221 subject fields follow 4776 Re: CGI Scripts (guestbook ie) 4831 Re: Access counter for CERN server 12769 Re: Problems using sendmail from Perl script 12770 File upload, Frames and BSCW - - (More Articles) - . The first line contains the status. Again, there is no need to check this, as we know the newsgroup exists. Each article is listed with its number and subject. &print_header ("Newsgroup: $group"); print "<UL>", "\n"; while (<NNTP>) { last if (/^\.\s*$/); $_ = &escape ($_); ($article, $subject) = split (/\s+/, $_, 2); $subject =~ s/^\s*(.*)\b\s*/$1/; $subject =~ s/^[Rr][Ee]:\s*//; The loop iterates through all of the subjects. The split command separates each entry into the article number and subject. Leading and trailing spaces, as well as "Re:" at the beginning of the line are removed from the subject. This is for sorting purposes. if (defined ($all{$subject})) { $all{$subject} = join ("-", $all{$subject}, $article); } else { $count++; $all{$subject} = join ("\0", $count, $article); } } This is responsible for threading the articles. Each new subject is stored in an associative array, $all, keyed by the subject itself. The $count variable gives a unique number to start each value in the array. If the article already exists, the article number is simply appended to the end to the element with the same subject. For example, if the subjects look like this: 2020 What is CGI? 2026 How do you create counters? 2027 Please help with file locking!!! 2029 Re: What is CGI? 2030 Re: What is CGI? 2047 Re: How do you create counters? . . . Then this is how the associative array will look: $all{'What is CGI?'} = "1\02020-2029-2030"; $all{'How do you create counters?'} = "2\02026-2047"; $all{'Please help with file locking!!!'} = "3\02027"; Note that we assigned a $count of 1 to the first thread we see ("What's CGI?"), 2 to the second thread, and so on. Later we sort by these numbers, so the user will see threads in the order that they came in to the newsgroup. @numbers = sort by_article_number keys (%all); What you see here is a common Perl technique for sorting. The sort command invokes a subroutine repeatedly (in this case, one that I wrote called by_article_number). Using a fast algorithm, it passes pairs of elements from the $all array to the subroutine. foreach $subject (@numbers) { $article = (split("\0", $all{$subject}))[1]; The loop iterates through all of the subjects. The list of article numbers for each subject is stored in article. Thus, the $article variable for "What is CGI?" would be: 2020-2029-2030 Now, we work on the string of articles. @threads = split (/-/, $article); The string containing all of the articles for a particular subject are split on the "-" delimiter and stored in the threads array. foreach (@threads) { $query = join ("", $this_script, "?", "group=", $id, "&", "article=", $_); print qq|<LI><A HREF="$query">$subject</A>|, "\n"; } } print "</UL>", "\n"; &print_footer (); } The loop iterates through each article number (or thread), and builds a hypertext link containing the newsgroup name and the article number (see Figure 10.3). The following is a simple subroutine that compares two values of an associative array. sub by_article_number { $all{$a} <=> $all{$b}; } This statement is identical to the following: if ($all{$a} < $all{$b}) { return (-1); } elsif ($all{$a} == $all{$b}) { return (0); } elsif ($all{$a} > $all{$b}) { return (1); } The $a and $b constitute two values in the associative array. In this case, Perl uses this logic to compare all of the values in the associative array. The display_newsgroups subroutine creates a dynamic HTML document that lists all the newsgroups contained in the groups associative array. sub display_newsgroups { local ($script_name, $keyword, $newsgroup, $query); &print_header ("CGI NNTP Gateway"); $script_name = $ENV{'SCRIPT_NAME'}; print "<UL>", "\n"; foreach $keyword (keys %groups) { $newsgroup = $groups{$keyword}; $query = join ("", $script_name, "?", "group=", $keyword); print qq|<LI><A HREF="$query">$newsgroup</A>|, "\n"; } print "</UL>"; &print_footer (); } Each newsgroup is listed as an unordered list, with the query consisting of the specific key from the associative array. Remember, the qq|...| notation is exactly like the "..." notation, except for the fact that "|" is the delimiter, instead of the double quotation marks. Back to: CGI Programming on the World Wide Web © 2001, O'Reilly & Associates, Inc.
http://oreilly.com/openbook/cgi/ch10_07.html#CGI-CHP-10-SECT-7
crawl-003
refinedweb
2,630
55.24
I'm using the Cairngorm framework. I'm a newbie in Flex, also. Dispatching a simple CairngormEvent, a command that modifies a property using a setter is executed. This setter has just two lines of code: asign the received value to an internal property, and dispatch the event that the getter is associated to. Why is the getter executing two times? Has Cairngorm something to do with this problem? Also... if I have this Label component <mx:Label id="myLabel" text={myVar} /> why is the getter of "myVar" executing 4 times when the application is loaded? Is it normal? I hope you can help me with these questions. Thank you! Generic binding using {} is redundant in order to handle out-of-order instantiation. If that is a performance issue, directly handling events is a way to optimize Thanks Flex harUI! I've been reading for a while and testing a bit more about this "problem". Is data binding something a programmer should avoid until is strictly necessary (never) and should every property change be handled by event handlers? Maybe customizing the event for the [Bindable] metatag a best way to avoid? As I say, I'm a newbie in flex, but I can see it really isn't very efficient... to say, this simple "program": <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns: <mx:Number0</mx:Number> <utils:BindableClass <mx:Label <mx:Button </mx:Application> using this class: package utils { public class BindableClass { private var _counter:Number; public function BindableClass() { _counter = 100; } [Bindable] public function get counter():Number { return _counter; } public function set counter(value:Number):void { _counter = value; } } } I just don't understand why the getter executes 4 times each time I click in button myButton. Do you think is normal? Thanks again! {} binding is a great way to get an app up in a hurry. I use it in most of my prototypes and will only remove them if I see they are a bottleneck. Even though it is redundant, a moderate amount of binding shouldn't cost you that much. Thanks for the help, harUI. I'll use binding in those cases. Regards
https://forums.adobe.com/thread/592661
CC-MAIN-2017-51
refinedweb
358
65.42
Micro. Operation Modes of ADC in ATmega328 First of all, we need to keep in mind that the internal ADC module in any microcontroller doesn’t pretend to be the best choice in all applications. It is meant to be used in relatively slow and not extremely accurate data acquisitions. Anyway, this is an excellent choice in most situations, like reading sensor data or reading waveforms. AVR ADC module has a 10-bit resolution with +/-2LSB accuracy. It can convert data at up to 76.9kSPS, which goes down when a higher resolution is used. We mentioned that there are 8 ADC channels available on pins, but three internal channels can be selected with the multiplexer decoder. These are temperature sensors (channel 8), bandgap reference (1.1V), and GND (0V). These specific channels may be handy in various situations. The temperature sensor is no doubt useful in many cases. Bandgap voltage source remains constant when VCC varies, so it can be used to read the supply voltage level itself (as we will see later). ADC can be set up for free running conversion, single conversion, and interrupt based conversion. Let us see how a single conversion can be done by analyzing the following example. ADC Single conversion mode Before writing the analog to a digital conversion program, we need to take care of the AVR chip’s analog part. This includes powering analog peripherals by applying the voltage to AVCC, setting a reference voltage level in the AREF pin, and ensuring some protection from supply noise using a low pass filter. For simple applications, the datasheet recommends adding a 100nF capacitor and 10uH inductor to the AVCC pin that performs as a low pass filter. In our example, we set reference voltage the same as the power supply voltage. So we need to connect the AREF pin to the AVCC source. If we used an internal 1.1V reference voltage, we would have to connect a capacitor between the VREF pin and GND to reduce the chance of noise. In our example, we are going to measure a potentiometer value, bang gap voltage, and send data via USART. The potentiometer is connected to the ADC0 channel. Initialization of ADC To start using ADC we need to initialize it first. For this, we write a simple function: void InitADC() { // Select Vref=AVcc ADMUX |= (1<<REFS0); //set prescaller to 128 and enable ADC ADCSRA |= (1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADEN); } As we can see, first of all, we have to select the reference voltage source by setting REFS0 fuze in the ADMUX register. As the datasheet says, AREF is connected to AVCC, and we only need to connect a capacitor between the AREF pin and the ground. AVR ADC must be clocked at a frequency between 50 and 200kHz. So we need to set proper prescaller bits so that the scaled system clock would fit in this range. As our AVR is clocked at 16MHz, we will use 128 scaling factors by setting ADPS0, ADPS1, and ADPS2 bits in the ADCSRA register. This gives 16000000/128=125kHz of ADC clock. And lastly, we enable ADC module by setting ADEN bit in ADCSRA register. ADC conversion Now ADC is set and turned. We can start conversion. For this, we prepare the following function that reads ADC value from the selected channel and returns a 16-bit value:; } before deciding ADC channel in the ADMUX register, we use a mask (0b00001111) which protects from an unintentional alteration of the ADMUX register. After the channel is selected, we start a single conversion by setting the ADSC bit in the ADCSRA register. This bit remains high until the conversion is complete. So we are going to use this bit as an indicator to decide when data is ready. So we return the ADC value after the ADSC bit is reset. Full source code This is all we need. Here is a complete code that reads potentiometer value and Vbg voltage that is sent to USART terminal: #include <stdio.h> #include <avr/io.h> #include <util/delay.h> #define USART_BAUDRATE 9600 #define UBRR_VALUE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) #define VREF 5 #define POT 10000; } //set stream pointer FILE usart0_str = FDEV_SETUP_STREAM(USART0SendByte, NULL, _FDEV_SETUP_WRITE); void InitADC() { //; } int main() { double vbg, potval; //initialize ADC InitADC(); //Initialize USART0 USART0Init(); //assign our stream to standart I/O streams stdout=&usart0_str; while(1) { //reading potentiometer value and recalculating to Ohms potval=(double)POT/1024*ReadADC(0); //sending potentiometer avlue to terminal printf("Potentiometer value = %u Ohm\n", (uint16_t)potval); //reading band gap voltage and recalculating to volts vbg=(double)VREF/1024*ReadADC(14); //printing value to terminal printf("Vbg = %4.2fV\n", vbg); //approximate 1s _delay_ms(1000); } } ADC conversion results After reset, we get Vbg value 0.96 and then steady 1.11V. This is because bandgap voltage (also internal reference) needs time to stabilize after switched on. So it is best practice to discard first readings as they may be inaccurate. The datasheet mentions that bandgap voltage is near 1.1V we get 1.11 – this is close enough. In the next tutorial part, we will discuss using Interrupt to detect complete conversion and automatic triggering of ADC conversions. Download project files: readADC.zip A few comments: 1. There is no need to set ADEN last. You can set all of ADCSRA at the same time. 2.ReadADC() is flawed in that if you call ReadADC(1) then ReadADC(2) you will actually convert channel 3. I would do this: ADMUX = (ADMUX & 0xF0) | (ADCchannel & 0x0F); 3. USART0SendByte() Why the bizarre recursive calling? Why not simply re-write the value of u8Data? Another one I noticed: potval=(uint16_t)(POT/1024*ReadADC(0)); This actually compiles to potval = 9 * ReadADC(0); This is because POT/1024 is computed as 9, leading to a fairly large error. You should either do ((ReadADC(0) * POT) / 1024) using 32bit ints, or since you have some floating point already, just use that. Hi DT, Thank you for checking things out. 1. I just left it for tutorial purposes. But actually this doesn’t make sense, so fixed according to your comments. 2. Fixed. 3. I use recursive function to make things simpler. Instead of writing printf(“\r\n”); i have to write printf(“\n”); Rewriting ‘\n’ with ‘\r’ would give different view in terminal window. 4. Fixed potentiometer value calculation. RE: 3 I see what you are doing but I’d hardly call it simpler than just using “\n\r”. Its certainly less portable, since it assumes you only want to send ASCII data. If “\n\r” this leads to extra RAM usage, then use printf_P(). I’d also argue that recursion is not a practice to encourage on embedded systems. Another note: the float format string %1.2f doesn’t make much sense. The 1 refers to the total field width, but this has to be ignored since to do so the function wouldn’t be able to fulfil the “.2” bit. In this case (if I understood your intent) “%4.2f” makes more sense i.e 1 ‘units’ digit, the decimal point, plus 2 fractional digits totalling a width of 4. I agree with you about recursions. Will avoid this in future tutorials. And yes I was a bit inertial with float format string. Somehow I made it look like what I wanted to see. Fixed. Thanks. vbg=(double)VREF/1024*ReadADC(14); – is that correct?? ReadADC(14)? not ReadADC(30)? Am I right that this references to Table 22-4. Input Channel and Gain Selections of the datasheet? Why the mask if 0f and f0? it seems DT made a mistake, it should read 1f and e0 instead! please, check the datasheet and explain, what’s going on. it’s difficult to understand. what was the initial version? Thanks Hi, I’m new to c programming and embedded systems. I tried to run your program on my mac but this is the error I get: prueba.c: In function ‘USART0SendByte’: prueba.c:22:1: error: stray ‘\302’ in program prueba.c:22:1: error: stray ‘\240’ in program prueba.c:23:1: error: stray ‘\302’ in program prueba.c:23:1: error: stray ‘\240’ in program prueba.c:24:1: error: stray ‘\302’ in program prueba.c:24:1: error: stray ‘\240’ in program prueba.c:25:1: error: stray ‘\302’ in program prueba.c:25:1: error: stray ‘\240’ in program prueba.c: At top level: In line 22 I have if(u8Data == ‘\n’) I hope you can help me thanks! Could be that you have wrong characters due to copied code from website. I have attached project files at the end of post.. babeagcegfcbgdka
https://embedds.com/adc-on-atmega328-part-1/
CC-MAIN-2021-17
refinedweb
1,453
66.74
How to create your first Facebook Messenger Bot. 🤖 💪 A simple tutorial to create a Chatbot using Ruby on Rails and Facebook Messenger, step by step. Facebook now allows bots to talk to users. You can book a flight, read some news, buy your next shoes or play with some game. Facebook and the rest of the tech world are convinced that conversation is the future of business. Chatbots use a process called deep learning, a type of machine learning in which a neural network can recognise speech, data, and specific patterns and transmit that data through the layers of the network. This will be possible due to machine learning. In the near future, all of our devices will have similar abilities and will be able to take actions on our behalf. 1. Design the Experience “You should message a business just the way you would message a friend,” declared Mark Zuckerberg when he launched the Facebook Messenger Platform for bots. A great starting point could be the Principles of bot design: - Don’t pretend to be a human - Keep it incredibly simple - Respect the chat medium - Optimise for the end user - Provide an escape hatch In my case, a booking chat service, I have chosen a close domain of interaction and possibilities, in just 5 steps: 1.1 Welcome Message Hi there, let’s get started! You’re now talking to the super cool Wine Tasting bot. 🤖🍷😀 A very informal message with only two possibilities: - Book a Wine Tasting. - Leave the bot chat and talk with a human. 1.2 Select a Wine Region To facilitate the interaction and improve the conversions, the bot suggests the most popular area without asking anythings. 1.3 Chose a Wine Tasting This one is probably the most important step. Throughout a great selection of results, some impressive photos and again, a simple interaction, you could transform users in conversions. 🤑🤑🤑 1.4 Login and Pay Button To manage the user login and registration you can use Account Linking and a simple web-page. Unfortunately, at this moment, Facebook Pay is still in Beta, so you could Request access to the beta program or manage payments throughout you site. 1.5 Get the Ticket and Receipt One of most valuable benefit because every one should use a bot is have everything in the same place. Facebook messenger makes it possible to manage tickets and receipt easily. 2. Setup your Facebook Page Now we need to create a Facebook Page and get the Page Access Token. Create Facebook page (skip if you want to use existing page) Open Facebook for Developers and get Page Access Token (step 3. Get Page Access Token from this tutorial). 3. Configure Rails There are many Ruby library available that you could use to develop your first Facebook Messenger Bot, I chosen Messenger-Ruby: “A simple library for supporting implementation of Facebook Messenger Bot in Ruby on Rails.” 3.1 Gemfile Add this line on you Gemfile YOUR_APP/Gemfile gem 'messenger-ruby' And then execute: $ bundle install 3.2 Initializer Create messenger.rb initializer in you app directory and paste Page Access Token: Open messeger settings: And then on right get the Page Access Token YOUR_APP/config/initializers/messenger.rb Messenger.configure do |config| config.verify_token = '<VERIFY_TOKEN>' #will be used in webhook verifiction config.page_access_token = '<PAGE_ACCESS_TOKEN>' end 3.3 Routes Add to your routes.rb: YOUR_APP/config/routes.rb mount Messenger::Engine, at: "/messenger" 3.4 Messenger Controller Create messenger_controller.rb in your controllers directory — controller has to inherit from Messenger::MessengerController: YOUR_APP/app/controllers/messenger_controller.rb class MessengerController < Messenger::MessengerController def webhook #logic here render nothing: true, status: 200 end end 4 Initialize your Bot 4.1 Bot subscription Run your application and: - Complete step 2. Setup Webhook from this tutorial if you mounted Messenger::Engineat /messengerand your application can be found at, your Callback URLwill be message_deliveries, messages, messaging_optinsand messaging_postbacksunder Subscription Fields. - Visit /messenger/subscribein your app (it's replacement for 4. Subscribe the App to the Page step) - call subscribeaction anytime you want to refresh subscription of your app. 4.2 Thread Setup Configure the Thread Settings on Messenger to improve the user-experience of your integration. These settings apply to each page individually. 4.2.1 Greeting Text You can set a greeting for new conversations. This can be used to communicate your bot’s functionality. If the greeting text is not set, the page description will be shown in the welcome screen. You can personalize the text with the person’s name. Greeting Text can be used as introductory text to help explain what your bot does. If you set the Greeting Text, it will be used instead of the page description. Than open your terminal and setup the Greeting Text: curl -X POST -H "Content-Type: application/json" -d '{ "setting_type":"greeting", "greeting":{ "text":"Timeless apparel for the masses." } }' "" 4.2.2 Get Started Button The Welcome Screen can display a Get Started button. When this button is tapped, we will trigger the postback received callback and deliver the person’s page-scoped ID (PSID). You can then present a personalized message to greet the user or present buttons to prompt him or her to take an action. Than open your terminal and setup the Started Button: curl -X POST -H "Content-Type: application/json" -d '{ "setting_type":"call_to_actions", "thread_state":"new_thread", "call_to_actions":[ { "payload":"USER_DEFINED_PAYLOAD" } ] }' "" 5 Show the first message 5.1 Get a Postback In the webhook action inside our MessengerController we need to get the postbaks form the client. YOUR_APP/app/controllers/messenger_controller.rb class MessengerController < Messenger::MessengerController def webhook #Postback if fb_params.first_entry.callback.postback? value = params["entry"].first["messaging"].first["postback"]["payload"] puts case tag when "start" #start message here when "case-b" #logic here else #logic here end end end end 5.2 Simple message with two buttons Add the start message: buttons = Messenger::Templates::Buttons.new( text: 'Hi there, let’s get started! You\'re now talking to the super cool Wine Tasting bot. 🤖🍷😀', buttons: [ Messenger::Elements::Button.new( type: 'postback', title: 'Book a Wine Tasting', value: 'book' ), Messenger::Elements::Button.new( type: 'postback', title: 'Chat with an Agent', value: 'agent' ) ] ) Messenger::Client.send( Messenger::Request.new(buttons,fb_params.first_entry.sender_id) ) 6 List results in a message You cold need to list some results in a message, in my case a list of wine tastings: tastings = #here the query #check if there are some results if tastings.length > 0 #first message Messenger::Client.send( Messenger::Request.new( Messenger::Elements::Text.new(text: 'Great I found those wine tastings for you! 🍇🍷👫'), fb_params.first_entry.sender_id) ) #create the Bubble elements array elements = [] tastings.each do |tasting| item = Messenger::Elements::Bubble.new( title: title, subtitle: subtitle, image_url: image_url, buttons: [ Messenger::Elements::Button.new( type: 'postback', title: 'More info', value: value ), Messenger::Elements::Button.new( type: 'web_url', title: 'Book now', value: url ) ] ) elements.push(item) end #end each #setup the template generic = Messenger::Templates::Generic.new( elements: elements ) #send message Messenger::Client.send( Messenger::Request.new(generic, fb_params.first_entry.sender_id) ) end #end if At this point you should able to create your first bot easily, for more info check the Facebook developers and the Library documentations. 7 Start a conversation 7.1 Messenger code A way to start a conversation whit a Facebook is scan a Messenger code: Note: This feature is only available on iOS and Android. Messenger Codes make it easy to start conversations with people or businesses that aren’t in your Messenger contacts yet. Scanning a person’s or business’s code with your phone will open the option to send them a message. How do you use a Messenger code to start a conversation? - Open the messenger App in your phone - Go to “Me Tap” - Tap My Code to let someone scan your code, or tap Scan Code to scan someone else’s How do you download your Page’s Messenger code? Your Page’s Messenger code is a unique code you can download and share to help people easily message your Page. When people scan your Page’s code using the Messenger app, they’ll start a conversation with your Page. To download your Page’s Messenger code: - Click Messages at the top of your Page - Click i button in the bottom left - Click Download in the box that opens up and select an image resolution 7.2 Simple HTML link You can create a simple web link to start conversation: <a href=""> Message us on Facebook </a> If you enjoyed this article please recommend and share.
https://medium.com/@enricopiovesan/how-to-create-your-first-facebook-messenger-bot-232b9c67635e
CC-MAIN-2018-34
refinedweb
1,426
55.54
Agenda See also: IRC log <trackbot> Date: 29 June 2011 <scribe> ScribeNick: jsoref <scribe> Scribe: Josh_Soref <fjhother> ScribeNick: jsoref <lgombos> Zakim: Present+ Laszlo_Gombos fjh: First topic is administrative <fjh> 19-21 July F2F logistics, <fjh> Please register - <fjh> Publishing moratorium 24-29 July <fjh> <darobin> [registration expires on the 12th] Hi, I'm Josh Soref, I recently joined Research In Motion, to officially work on Web Standards. And I'm glad to be here dom: I wasn't on last week's call because I welcomed my second son. He's also why I won't be at the f2f <cmarc> congratulations <darobin> François Daoust <darobin> a.k.a tidoust dom: François Daoust will be at the f2f in my stead <fjh> fjh: any concerns? Proposed Resolution: 15 june 2011 are approved RESOLUTION: 15 june 2011 minutes are approved fjh: Discovery... <fjh> Review completed, see <fjh> Possible clarification needed on scope of discovery fjh: whether it should be in the charter or not ... i don't know what WG can do at this point, Dom, it seems like we need a couple of sentences dom: roughly speaking, i will be working with the team on trying to find a position that is agreeable to all <fjh> team will be working on updates to charter from this point dom: this would affect whether it's present in the charter or not ... the current charter runs through July 31 ... so we have a little leeway AnssiK: I received some feedback from the Web Performance WG ... they liked it ... they liked the simplicity of it ... I also received editorial feedback from josh ... that's reflected in the ED ... the webkit team has a draft implementation of the ED ... I'd like to summarize the status.... ... the spec is terribly simple ... i'd like to go to LC ... I'd rather address josh's other feedback in a later spec ... We also received feedback from Doug Turner of Mozilla ... Josh's feedback is good, but... <dom> +1 on more than level-based events <darobin> +1 as well fjh: it seems to me that some of josh's comments should be dealt with later AnssiK: i'd like to put them in a bucket that can be in Version 2 of the specification ... a question to Josh: <dom> I would put Critical/Low events in v1 rather than v2 AnssiK: do you think that the ideas that you have could be built on top of the current version? <darobin> I would, too AnssiK: if that's the case, then i'd rather go out with what we have now ... and then when we have more implementation experience ... we could got out with the current spec ... and then extend it later [ scribe pauses to compose thoughts ] <fjh> josh notes concern of having to replicate implementation of higher level functions if not provided as part of the api <fjh> josh notes concern about having to have continuously running app to learn about device battery use, self-defeating to use up battery <dom> [I'm not sure OS can report useful data about battery time left in the first place <fjh> josh notes that knowing that battery is low or critically low is not useful, since app cannot interpret this in terms of time left etc <darobin> [no, but it's the most accurate you'll ever get] <fjh> josh notes some laptops are able to handle this time left function <dom> [we could add an "estimatedTimeLeft" attribute added to the event?] <Zakim> darobin, you wanted to clarify that there's no rush to LC — we have good feedback, what's more from implementers, I think we should take it for v1 <fjh> josh suggests no rush to go to last call darobin: I just wanted to point out that irrespective of technical arguments ... there's no rush to LC ... there's no rush to have a short spec and go to rec immediately ... i think we have good feedback ... from implementers ... i think that this spec should be so simple <dom> +1 to robin darobin: that there perhaps should never be a need for a v2 AnssiK: my question that was not answered ... can we layer this functionality on the existing api? ... josh's proposal ... or doug's proposal darobin: for the semantic events ... the problem is that the only thing that javascript can do ... is have some very rough heuristics ... on some devices, 10% is extremely low ... on other devices you still have 1 1/2 hrs of battery ... the system has this information ... if that information is available, then we should use those ... it certainly doesn't make sense for a script to start saving battery if you have 2 hours left AnssiK: by layering on top <fjh> +1 to robin and josh that having time left is very useful if possible AnssiK: i mean can we just add another api past it darobin: so battery events level 2 that is other stuff past level one AnssiK: if someone implements the current draft ... does it do something useful toward level 2 darobin: i'm a bit concerned that for something as simple as a battery specification ... that we might be producing multiple specs ... layering is very nice <Zakim> fjh, you wanted to ask if the spec is layered darobin: but i'm concerned that we may be doing too much of it fjh: i have another question ... josh asked about continuously polling ... i think we would want to avoid that ... do we think it would be 3 months? darobin: i said 3 months because it was the first figure that came ... i don't think that it would take that long to integrate the current feedback fjh: i think the webkit feedback asked about use cases ... i think that josh is expanding the use cases ... i don't think that we thought about those use cases lgombos: there was some feedback from the webkit community about use cases ... i think we answered them ... that it was just for telling the web page that it needs to save its state because it's running low ... initially the use case is just very basic power management for the web page <AnssiK> [ the use case request on the webkit-dev was about the Contacts API ] fjh: thanks, i think you're saying we don't need to expand the use cases much dom: i think it's actually useful to document the use cases we think we are solving <darobin> +1 to documenting use cases dom: the reason i think we should include critical and low events ... and also remaining time ... i think that the changes needed are fairly low <fjh> documenting use case should help set appropriate expectations <darobin> +10 to someone taking an action item to document use cases :) dom: i think there's much more value in integrating them now ... because they will actually match the use cases people will need <Zakim> AnssiK, you wanted to note that timeRemaining was in but was dropped due to implementer's feedback <Zakim> fjh, you wanted to subject AnssiK: timeRemaining was in, but was dropped due to implementer's feedback ... it's easy to put that part back in ... if we wish to do that <darobin> [actually I think it was my feedback that dropped it] Zakim: mute me AnssiK: Opera is running across multiple platforms ... and they indicated that they had trouble implementing it across platforms <dom> [I think .timeRemaining would be set to null if it can't be detected] darobin: if i recall correctly, it was removed ... because i looked and saw it wasn't available in low level apis AnssiK: i think rich also raised some concerns ... so it was your [ darobin ] feedback and his darobin: i think we could do it as dom suggested, using null otherwise ... i think all the desktop low level apis provide it ... and it's quite possible that iOS 5 may have it ... and Android has it ... if it's something that people want and there are use cases ... i'm less convinced that it's more useful than semantic <dom> Robin's review of other platform battery APIs fjh: so where does that leave us? i thought we were going to LC lgombos: I'm also questioning time remaining as a feature, both from use cases ... and also from feasibility <dom> "So the first conclusion I have is that we can kill timeRemaining. It doesn't seem to be available outside of desktop APIs (which are far more complete, including UPS support and all that)." -- Robin in that message lgombos: i think time remaining is predicting the future ... people can claim to be good at it ... but it can change drastically ... i think signalling you have 5 minutes left to the web page can be confusing <dom> (well, the spec could make it clear this is an estimation; it could even be called estimatedTimeRemaining if we prefer clarity to concision] lgombos: if it turns out to be wrong ... i'm not sure what the web page can do with 5 mintues left v. 10 minutes left <dom> (but I agree that the needs for timeRemaining are less clear than the need for semantic events) <Zakim> jsoref, you wanted to talk about update notifications lgombos: i kind of understand how semantic events could be useful <darobin> [I tend to agree that the use cases for semantic events are strong, for timeRemaining I'm not yet convinced (but will go with the group's consensus)] <dom> (I think the Critical event would address that use case) <fjh> josh notes use case where writing to disk or network is expensive (both power and timewise) and that app could defer writes if knows there is enough battery to wait <fjh> josh notes that app could learn from system if time estimate needs adjustment <darobin> [I agree with dom] <fjh> josh asks "what does critical mean to app" <fjh> seems to me we have a fundamental disconnect here between higher level functionality and knowing what it means in terms of battery, not so deterministic darobin: josh, i think your cases are somewhat contrived ... when i got a low message, i'd start saving everything ... and when i get critical, i'd give up ... you generally need to save regularly anyway ... since you can't be sure you won't crash PROPOSED RESOLUTION: we should wait a bit before we go further. And that we want to accept some of the feedback. Most people agree that semantic events are useful. fjh: Some people wonder if they're practical darobin: the difference is, if we don't agree that we might want them, then we do no work at all ... if we do agree that they're useful, then we look into the practicality of implementing them ... as for time remaining, it's less clear ... i'm not sure we have consensus to remove it <dom> ISSUE: do we need to give an estimated time remaining indication with battery events? <trackbot> Created ISSUE-112 - Do we need to give an estimated time remaining indication with battery events? ; please complete additional details at . AnssiK: for Semantic events, is it just a matter of dispatching an event with the same information, but a different name? ... possibly with timeRemaining ... that's easy for spec writing ... the harder part is coming up with the prose darobin: i'm not sure that we need to provide much prose ... we can leave it to the implementation ... they can use whatever the system gives to them ... two different UAs on the same device should give roughly the same event at the same time AnssiK: that's so simple that i could do it right away ... we could bike shed the event names :) ... ... that's the longest part of the work ... after that, we'd like to get implementer feedback ... but then again, they might not be looking at the spec with those glasses on ... - what developers need - ... just from an implementer's point of view darobin: for bike shedding, i'm open to the editor <darobin> BatteryLow, BatteryCritical :) AnssiK: editor is open to suggestions (by irc) <dom> all lowercase indeed AnssiK: are there best practices ... all lower case? camel case? <darobin> batterylow, batterycritical AnssiK: doug raised an important point ... should we expose this to the global namespace or not? ... doug was thinking we should only expose it via AddEventListener ... and not window.<foo> darobin: I don't see the use case for having it on window +1 AnssiK: it's currently on window, but we could just get rid of it ... there are lots of legacy items on window <dom> +1 on not having it on window AnssiK: it seems to me that there's no established best practice <dom> I think DeviceOrientaiton is considering removing it, have asked Hixie for feedback darobin: i wouldn't take inspiration from DeviceOrientation ... because it isn't finalized ... the only thing is detection AnssiK: i looked at the modernizer component ... and it does detection based on interface existance darobin: the other thing you can do is detect if asking for the event results in an event immediately AnssiK: points... whether we drop the window.<onstuff> ... and also the body.<onstuff> ... whether we should drop both ... and do what doug suggested ... i looked at bugzilla.mozilla.org and saw that ... i think offline/online events <darobin> PROPOSED RESOLUTION: we should wait a bit before we go further. And that we want to accept some of the feedback. Most people agree that semantic events are useful. Time remaining has ISSUE-112. Remove onfoo on window and body AnssiK: and it seems initially it was exposed on window, and then later removed ... i think josh remembers it yes, I remember it being removed AnssiK: josh: do you remember the infrastructure behind events RESOLUTION: we should wait a bit before we go further. And that we want to accept some of the feedback. Most people agree that semantic events are useful. Time remaining has ISSUE-112. Remove onfoo on window and body ACTION AnssiK to remove window/body.onfoo <trackbot> Sorry, couldn't find user - AnssiK <darobin> ACTION: Anssi to implement changes to battery event based on feedback, and RESOLUTION from 20110629 [recorded in] <trackbot> Created ACTION-417 - Implement changes to battery event based on feedback, and RESOLUTION from 20110629 [on Anssi Kostiainen - due 2011-07-06]. dom: how do we make progress on time remaining darobin: i don't know... ... do we look at use cases? ... and decide if they're necessary? ... or are we more concerned about implementability dom: i think it's both ... maybe we can give an action item to josh ... to identify use cases that require time remaining <fjh> unmute jsoref <darobin> ACTION: Josh to formulate the use cases he sees for timeRemaining, and if possible an implementation strategy for when that information isn't provided by the OS [recorded in] <trackbot> Created ACTION-418 - Formulate the use cases he sees for timeRemaining, and if possible an implementation strategy for when that information isn't provided by the OS [on Josh Soref - due 2011-07-06]. AnssiK: should i formulate something for semantic events in the ED now ... or ask the list darobin: I think you should just change the ED and notify the list ... the list needs to be notified at some point ... to inform people that the changes have been taken into account <dom> (I think fixing the draft first makes it clearer) AnssiK: so there's no preference in the group darobin: i have a preference for not having a discussion about commit-then-review or review-then-commit ... because i have had that discussion too many times recently +1 AnssiK: we can always revert fjh: rich sent a message to the list saying he was doing more for it ... [looks for message] <fjh> fjh: he's going to respond to the feedback ... maybe we should wait for rich's input on this... instead of rehashing it twice ... in terms of discussions about implementation ... and use cases <fjh> fjh: I noticed that the WebKit team was asking for justification to have this implemented ... dom: if you had use cases, it might be helpful ... at least to try a use cases discussion <dom> My use cases for Contacts API darobin: we should be able to provide an argument in favor of implementing our specifications ... otherwise i don't know why we're writing them in the first place ... I believe josh's feedback was integrated by dom <dom> (only the editorial feedback; not sure if Josh also sent substantive feedback) <Zakim> jsoref, you wanted to comment on that My non editorial items were not integrated scribe: I'm assuming that rich will address them darobin: back to LC tracking ... i guess that's something we can do right before the f2f ... i presume, dom, that you won't be around to put it together ... one thing that we could do is the LC tracking system ... fjh i think it's the one you were using for XMLSEC WG fjh: you it works fine darobin: do we need to do something to open new specs in it? dom: i can take care of that ... but the question is who takes care of it after <dom> ACTION: Dom to open a Last Call comments tracker for Contacts API [recorded in] <trackbot> Created ACTION-419 - Open a Last Call comments tracker for Contacts API [on Dominique Hazaël-Massieux - due 2011-07-06]. darobin: if the team side sets up the documents and we can do the rest ... and the chairs can take care of the comments, since there aren't many darobin: i think we're stuck on feedback, including mine ... i have an action to reply to feedback ... that's entirely in my court [ I need to give feedback ] darobin: are there other items? ... is there anything people would like to prioritize for the f2f ... it's coming up in a few weeks ... if you have topics ... you can send feedback to the list / chairs ADJOURNED This is scribe.perl Revision: 1.136 of Date: 2011/05/12 12:01:43 Check for newer version at Guessing input format: RRSAgent_Text_Format (score 1.00) Succeeded: s/accept minutes/15 june 2011 are approved/ Succeeded: s/Resolution/RESOLUTION/ Succeeded: s/,,,/.../ Succeeded: s/July 2/July 31/ Succeeded: s/fjk/fjh/ Succeeded: s/is less/are less clear/ Succeeded: s/expensive/expensive (both power and timewise)/ Succeeded: s/onwindow/on window/ Succeeded: s/on on window/on window/ Succeeded: s/wondering how this/asking for justification to have this implemented/ Succeeded: s/should be implemented// Succeeded: s/COntacts/Contacts/ Succeeded: s/to do, dom/WG can do at this point, Dom/ Succeeded: s/I'/I'm assuming that rich will address them/ Found ScribeNick: jsoref Found Scribe: Josh_Soref Found ScribeNick: jsoref Present: Kihong_Kwon Robin_Berjon Frederick_Hirsch Josh_Soref Dominique_Hazael-Massieux Laszlo_Gombos Anssi_Kostiainen Cathy_Chan Cecile_Marc Niklas_Widell Wonsuk_Lee Kangchan_Lee Regrets: Suresh_Chitturi Wonsuk_Lee Rich_Tibbett Ernesto_Jimenez Dzung_Tran Agenda: Found Date: 29 Jun 2011 Guessing minutes URL: People with action items: anssi dom josh[End of scribe.perl diagnostic output]
http://www.w3.org/2011/06/29-dap-minutes.html
CC-MAIN-2014-41
refinedweb
3,187
70.02
hi, I am gettig the following Error The type or namespace name 'Serialization' does not exist in the namespace 'System.Runtime' (are you missing an assembly reference?) and I am not getting the "Add service reference " in the Contex menu. I need the Solution .... thanks & regards, murthy As a side not, "Add service reference" is the new command in Visual Studio 2008 (aka. Orcas) to add a reference to a web service. When creating a project that uses the 3.0 or 3.5 framework, it replaces the "Add web reference" command from previous versions of Visual Studio. Best regards, Johan Stenberg
http://social.msdn.microsoft.com/forums/en/netfxbcl/thread/04ac42db-3e46-401d-80d0-bcc864f174a0/
crawl-002
refinedweb
102
69.89
C# 7.0 All-in-One For Dummies Published: 12-26-2017 Sharpen your knowledge of C# C# know-how is a must if you want to be a professional Microsoft developer. It's also good to know a little C# if you're building tools for the web, mobile apps, or other development tasks. C# 7.0 All-in-One For Dummies offers a deep dive into C# for coders still learning the nuances of the valuable programming language. Pop it open to get. Articles From C# 7.0 All-in-One For Dummies Filter Results Cheat Sheet / Updated 03-10-2022 C# provides you with access to a phenomenal array of programming options. Use this cheat sheet to help you get the job done faster and easier when using C# as your development solution of choice.View Cheat Sheet Article / Updated 02-01-2018 property, which populates the HTML alt tag. property, which allows users to tab from control to control. For those not using a mouse, this is optimum. Setting which part of the form has the cursor by default (called default focus) is easy in ASP.NET with the DefaultFocus property. Changing it is easy with the SetFocus method. You can give buttons keyboard equivalents by using the AccessKey property..View Article Article / Updated 02-01-2018.View Article Article / Updated 01-31-2018View Article Article / Updated 01-31-2018E file in Windows Explorer, for example, and cause it to run. Executable assemblies often use supporting code from libraries in other assemblies. Class library (.DLLstrong>): A compiled library of functionality that can be used by other programs. Every program needs System classes..)View Article Article / Updated 01-31-2018.View Article Article / Updated 01-31-2018 You may decide that you don’t want future generations of programmers to be able to extend a particular class. You can lock the class by using the keyword sealed. A sealed class cannot be used as the base class for any other class. Consider this code snippet: using System; public class BankAccount { // Withdrawal -- You can withdraw any amount up to the // balance; return the amount withdrawn virtual public void Withdraw(decimal withdrawal) { Console.WriteLine("invokes BankAccount.Withdraw()"); } } public sealed class SavingsAccount : BankAccount { override public void Withdraw(decimal withdrawal) { Console.WriteLine("invokes SavingsAccount.Withdraw()"); } } public class SpecialSaleAccount : SavingsAccount // Oops! { override public void Withdraw(decimal withdrawal) { Console.WriteLine("invokes SpecialSaleAccount.Withdraw()"); } } This snippet generates the following compiler error: 'SpecialSaleAccount' : cannot inherit from sealed class 'SavingsAccount' You use the sealed keyword to protect your class from the prying methods of a subclass. For example, allowing a programmer to extend a class that implements system security enables someone to create a security back door. Sealing a class prevents another program, possibly somewhere on the Internet, from using a modified version of your class. The remote program can use the class as is, or not, but it can’t inherit bits and pieces of your class while overriding the rest.View Article Article / Updated 01-31-2018 Expression-bodied members first appeared in C# 6.0 as a means to make methods and properties easier to define. In C# 7.0, expression-bodied members also work with constructors, destructors, property accessors, and event accessors. Creating expression-bodied methods The following example shows how you might have created a method before C# 6.0: public int RectArea(Rectangle rect) { return rect.Height * rect.Width; } When working with an expression-bodied member, you can reduce the number of lines of code to just one line, like this: public int RectArea(Rectangle rect) => rect.Height * rect.Width; Even though both versions perform precisely the same task, the second version is much shorter and easier to write. The trade-off is that the second version is also terse and can be harder to understand. Defining expression-bodied properties Expression-bodied properties work similarly to methods: You declare the property using a single line of code, like this: public int RectArea => _rect.Height * _rect.Width; The example assumes that you have a private member named _rect defined and that you want to get the value that matches the rectangle’s area. Defining expression-bodied constructors and destructors In C# 7.0, you can use this same technique when working with a constructor. In earlier versions of C#, you might create a constructor like this one: public EmpData() { _name = "Harvey"; } In this case, the EmpData class constructor sets a private variable, _name, equal to "Harvey". The C# 7.0 version uses just one line but accomplishes the same task: public EmpData() => _name = "Harvey"; Destructors work much the same as constructors. Instead of using multiple lines, you use just one line to define them. Defining expression-bodied property accessors Property accessors can also benefit from the use of expression-bodied members. Here is a typical C# 6.0 property accessor with both get and set methods: private int _myVar; public MyVar { get { return _myVar; } set { SetProperty(ref _myVar, value); } } When working in C# 7.0, you can shorten the code using an expression-bodied member, like this: private int _myVar; public MyVar { get => _myVar; set => SetProperty(ref _myVar, value); } Defining expression-bodied event accessors As with property accessors, you can create an event accessor form using the expression-bodied member. Here’s what you might have used for C# 6.0: private EventHandler _myEvent; public event EventHandler MyEvent { add { _myEvent += value; } remove { _myEvent -= value; } } The expression-bodied member form of the same event accessor in C# 7.0 looks like this: private EventHandler _myEvent; public event EventHandler MyEvent { add => _myEvent += value; remove => _myEvent -= value; }View Article Article / Updated 01-31-2018 C# keeps track of whether a variable has been initialized and doesn’t allow you to use an uninitialized variable. For example, the following code chunk generates a compile-time error: public static void Main(string[] args) { int n; double d; double calculatedValue = n + d; } C# tracks the fact that the local variables n and d haven’t been assigned a value and doesn’t allow them to be used in the expression. Compiling this tiny program generates these compiler errors: Use of unassigned local variable 'n' Use of unassigned local variable 'd' By comparison, C# provides a default constructor that initializes the data members of an object to 0 for numbers false for Booleans null for object references Consider the following simple program example: using System; namespace Test { public class Program { public static void Main(string[] args) { // First create an object. MyObject localObject = new MyObject(); Console.WriteLine("localObject.n is {0}", localObject.n); if (localObject.nextObject == null) { Console.WriteLine("localObject.nextObject is null"); } // Wait for user to acknowledge the results. Console.WriteLine("Press Enter to terminate..."); Console.Read(); } } public class MyObject { internal int n; internal MyObject nextObject; } } This program defines a class MyObject, which contains both a simple data member n of type int and a reference to an object, nextObject (both declared internal). The Main() method creates a MyObject and then displays the initial contents of n and nextObject. The output from executing the program appears this way: localObject.n is 0 localObject.nextObject is null Press Enter to terminate... When the object is created, C# executes a small piece of code that the compiler provides to initialize the object and its members. Left to their own devices, the data members localObject.n and nextObject would contain random, garbage values. The code that initializes values when they’re created is the default constructor. It constructs the class, in the sense of initializing its members. Thus C# ensures that an object starts life in a known state: all zeros, nulls, or false values, depending on type. This concept affects only data members of the class, not local variables in a method.View Article Article / Updated 01-30-2018 In versions of C# prior to C# 7.0, every return value was a single object. It could be a really complex object, but it was still a single object. In C# 7.0, you can actually return multiple values using tuples. A tuple is a kind of dynamic array nominally containing two items that you can interpret as a key and value pair (but it isn’t strictly required). In C#, you can also create tuples containing more than two items. Many languages, such as Python, use tuples to simplify coding and to make interacting with values considerably easier. C# 4.x actually introduced the concept of a Tuple as part of dynamic programming techniques. However, C# 7.0 advances the use of tuples to allow returning multiple values rather than just one object. This book doesn’t provide extensive coverage of tuples, but they work so well in returning complex data that you definitely need to know something about this use of tuples. Using a single-entry tuple A tuple relies on the Tuple data type, which can accept either one or two inputs, with two being the most common (otherwise, you can simply return a single object). The best way to work with tuples is to provide the data types of the variables you plan to provide as part of the declaration. Here’s an example of a method that returns a tuple: static Tuple getTuple() { // Return a single value using the tuple. return new Tuple("Hello", 123); } The code begins by specifying that getTuple() returns a Tuple consisting of two items, a string and an int. You use the new keyword to create an instance of Tuple, specify the data types in angle brackets, , and then provide the data values. The getTuple() method effectively returns two values that you can manipulate individually, as shown here: // This is where your program starts. static void Main(string[] args) { // Obtain a single entry tuple. Console.WriteLine( getTuple().Item1 + " " + getTuple().Item2); // Wait for user to acknowledge the results. Console.WriteLine("Press Enter to terminate..."); Console.Read(); } To access a single-entry tuple like this one, you call getTuple(), add a period, and then specify which item to use, Item1 or Item2. This example just demonstrates how tuples work, so it’s simple. The output looks like this: Hello 123 Press Enter to terminate... Using a tuple lets you return two values without resorting to complex data types or other odd structures. It makes your code simpler when the output requirements fit within the confines of a tuple. For example, when performing certain math operations, you need to return a result and a remainder or the real part and the imaginary part of a complex number. Relying on the Create() method An alternative way to create a tuple is to rely on the Create() method. The result is the same as when working with the method above. Here’s an example of using the Create() method: // Use the Create() method. var myTuple = Tuple.Create("Hello", 123); Console.WriteLine(myTuple.Item1 + "\t" + myTuple.Item2); This approach isn’t quite as safe as using the method above because myTuple could end up with anything inside. You could further eliminate the portion of the constructor to force the compiler to ascertain what myTuple should receive as input. Using a multi-entry tuple The true value of a tuple is in creating datasets using extremely easy coding methods. This is where you might choose to view Item1 as a key and Item2 as a value. Many dataset types today rely on the key and value paradigm and viewing a tuple in this way does make it incredibly useful. The following example shows the creation and return of a tuple dataset. static Tuple[] getTuple() { // Create a new tuple. Tuple[] aTuple = { new Tuple("One", 1), new Tuple("Two", 2), new Tuple("Three", 3) }; // Return a list of values using the tuple. return aTuple; } You specify the return types of the Tuple data type. However, this example adds a pair of square brackets ([]) similar to those used for an array. The square brackets tell C# that this version of getTuple() returns multiple tuples, not just one. To create a tuple dataset, you begin with the variable declaration as shown for aTuple. Each new entry into the tuple requires a new Tuple declaration with the requisite inputs as shown. The entire thing is placed within curly brackets and you end it with a semicolon. To return the tuple, you simply use the return statement as normal. Accessing the tuple requires use of an enumerator, and you can do anything you would normally do with an enumerator, such as interact with the individual values using foreach. The following code shows how you might perform this task just for experimentation purposes: static void Main(string[] args) { // Obtain a multiple entry tuple. Tuple[] myTuple = getTuple(); // Output the values. foreach (var Item in myTuple) { Console.WriteLine(Item.Item1 + "\t" + Item.Item2); } // Wait for user to acknowledge the results. Console.WriteLine("Press Enter to terminate..."); Console.Read(); } The foreach statement places individual items from myTuple into Item. You then access the data elements individually by using Item1 and Item2 as before. Here’s the output from this example: One 1 Two 2 Three 3 Press Enter to terminate... Creating tuples with more than two items Tuples can have one to eight items. If you want more than eight items, the eighth item must contain another tuple. Nesting tuples enables you to return an almost infinite number of items, but at some point you really do need to look at the complexity of your code and see whether you can keep the number of return items down. Otherwise, you find that your application executes slowly and uses a lot of resources. Here is an example that uses three items: static Tuple[] getTuple() { // Create a new tuple. Tuple[] aTuple = { new Tuple("One", 1, true), new Tuple("Two", 2, false), new Tuple("Three", 3, true) }; // Return a list of values using the tuple. return aTuple; } The technique follows the same pattern as before. The only difference is that you provide more values for each tuple. It also doesn’t matter whether you create a single tuple or a tuple array used as a dataset. Either choice allows you to use up to eight items per tuple.View Article
https://www.dummies.com/book/technology/programming-web-design/csharp/c-7-0-all-in-one-for-dummies-281649/
CC-MAIN-2022-21
refinedweb
2,360
55.84
Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does. Printable View Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does. Hello pwngrammer and welcome to the java programming forums. I think this belongs in the java program collaboration section located here: Project Collaboration - Java Programming Forums I would help you out here but I don't know much about file I/O in java. Sorry :(. welcome to the java programming forums. it thinks this will help you. it can give you ramdon numbers, so it can be used for password. :) bout writing in a file, hmm, try to search for it. kinda busy. but i will try to keep in touch. :) Cheers, Truffy Hello pwngrammer, welcome to the forums :D Don't forget about our Tips & Tutorials forum. There are lots of code snippets in there: Java Tips & Tutorials - Java Programming Forums This is what you need for writing a file: I will write an example application for you ASAP... Try this pwngrammer: Code : import java.io.*; import java.util.Random; public class Pwngrammer { /** * JavaProgrammingForums.com */ public static void main(String[] args) throws Exception { Random r = new Random(); Writer output = null; File file = new File("PasswordFile.txt"); output = new BufferedWriter(new FileWriter(file)); int password = 0; for(int a = 0; a < 4; a++){ password = (int)(9.0 * Math.random()) + 1; System.out.print(password); String myString = Integer.toString(password); output.write(myString); } output.close(); System.out.println(""); System.out.println("Password written to file."); } } Im doing this one for fun now. Thank you to all of you for helping me out with both my programs. This one has a problem. Cannot find symbol-class Writer
http://www.javaprogrammingforums.com/%20file-i-o-other-i-o-streams/571-java-password-printingthethread.html
CC-MAIN-2017-39
refinedweb
305
67.25
Hi, Chart renders minorTickSteps out of the chart. 58138 In this fiddle you can see 20.5 minor tick out of the chart even maximum value 20. Affected versions 7 - 6.2 Material Hi, Chart renders minorTickSteps out of the chart. 58138 In this fiddle you can see 20.5 minor tick out of the chart even maximum value 20. Affected versions 7 - 6.2 Material Thanks, it works with ExtJS 6.6.0, Font Awesome 5.10.1. (with minor fixes) I just realized if i use your code i can't activate scroller on toolbar. Can you check it? 2put Do you use treestore? Hi, I want to change docking property of toolbar top to right at runtime but it is not properly rendered. Docs says that : 57830 but it is not working. Thanks, Hi, I want to create new theme based on Modern - Material - Dark. There is no option for dark. Also i changed $dark-mode to true from theme defaults but it is not working. All preview screens are... It seems still not fixed with 6.6.0. Also nightly. 2nog I just realized, only not working library is tinymce and it has own build system so i can't use non-minified file. Now i manually copying files after build but i will try after-build solution thank... I changed version to ES5 and it is still optimizing minified files but different method. Now file sizes are lowered and third party libraries still not working. "js": [ { "path":... Sencha CMD 6.5.3.8 Nightly ExtJS 6.6.0.154 Nightly It is still optimizing minified files. Hi Mitchell, I want to ask a question related to your answer. Can i add multiple theme for single build? Thanks, Yes our application forces user to use https and i think we can't inspect our app directly with Themer. Hi, Our ExtJS application is running over https and we are not allowing to use http. How can i use sencha themer 1.1 with https? Thanks, I have a related problem can you check this out: I think the problems are related to this bug: Hi, There is two bugs in this fiddle, First: Select a cell from first row Slowly scroll grid while looking row numbers (with my mouse every time it scrolls 5 rows) Near row 30 or more... Interesting. I didn't look at api docs because I didn't think there may be different behaviour of an event. Thanks. Hi, When i use dataview's itemclick event i can't create properly modal window in window. Created window goes back to the current window. But if i use button it works normally. Please run fiddle... Hi, How can i localize "No results." text? Thanks, Hi, When i click disabled Container Button it gives an error. For viewing error please open this example in Fiddle and open developer tools and click disabled Container Button. Uncaught... I think it will fix if you run 'sencha app watch' or 'sencha app build' or 'sencha app refresh'. If your tooltips are static you can use like this: columns: [{ text: '<span data-Title Of Column</span>', dataIndex: 'SomeField' }] Hi, How can i create singleton class in my package with the same name of namespace? Where should i put singleton class file in package? For example i want to use it like below in my app. ...
https://www.sencha.com/forum/search.php?s=c0a7a33d75035be16dd2207bb289a8de&searchid=23156629
CC-MAIN-2020-10
refinedweb
567
76.52
#include <HexBeamCR.hpp> Inheritance diagram for HexBeamCR: HexBeamCR is the same as HexBeam, except that when slices are made to form a parallel decomposition, the slices are bound together using constraint-relations. i.e., the slices that are separated by processor boundaries do not share common nodes as they do in the case of HexBeam. Instead the opposing faces have distinct (non-shared) nodes which are tied together by the constraints. In addition, HexBeamCR has a constraint-bound slice in the middle of each processor's partition so that there are constraints even in the case of a serial run on a single processor. Definition at line 33 of file HexBeamCR.hpp.
http://trilinos.sandia.gov/packages/docs/r10.0/packages/fei/doc/html/classHexBeamCR.html
CC-MAIN-2014-15
refinedweb
112
50.16
tips for making the career I am a student of engineering. Please provide me the tips for making the career in java and do tell me what exactly the companies want the knowledge. career in java career in java I have just completed my BE(IT). I am interested to make my career/profession in java. i know core java, Servlet, JSP . What to study more? How to study j2ee programing? which ebook i should download or purchase util packages in java util packages in java write a java program to display present date and after 25days what will be the date? import java.util.*; import java.text.*; class FindDate{ public static void main(String[] args Pattern Making Pattern Making how to print this pattern in java? * * * * * * * * * * * * * * * * * It is just an example Java util package Examples Career in Fashion new clothes and making sure that they are always fresh and exciting. A career...Do you Want a Career in fashion? A career in fashion is probably one..., there are a couple of things that you should consider before deciding towards this career. One Java Util Package - Utility Package of Java Java Util Package - Utility Package of Java Java Utility package is one of the most commonly used packages in the java program. The Utility Package of Java consist Making Exceptions Unchecked - java tutorial,java tutorials and Unchecked Exceptions in java and how to handle it. The Exception is a condition which indicates error in your code. Types of built-in exception in Java Given below types of built-in exception in java : 1. Unchecked Exception 2. Checked software making software making hello sir you asked me language... in developing application in it. You should consider Java to develop your software. You can learn java at Thanks
http://www.roseindia.net/tutorialhelp/allcomments/1099
CC-MAIN-2013-48
refinedweb
296
58.28
On Sun, Apr 20, 2008 at 11:33:43PM +0300, Siarhei Siamashka wrote: >. I do not remember exactly but there was a serious problem with your suggested "solution", IIRC it caused some serious speedloss on some systems. anyway 1. Why do you need a aligned stack? That is why cant you use the heap? 2. Assuming you do need one, where was the problem with using a recent gcc which supports maintaining stack alignment? 3. What effect does your solution have on systems which do align the stack aka a recent gcc on pre EABI. Or even a non gcc compiler. [...] > :) #if MAX_NEG_CROP != 12345 Please fix code in file foobar #endif > >). we have a macro for alignment, use it, if it doesnt work, fix it (see: <>
http://ffmpeg.org/pipermail/ffmpeg-devel/2008-April/040794.html
CC-MAIN-2013-48
refinedweb
126
82.85
The second case for function-tree Talking. A promise If you are not familiar with promises it is explained as “a future value”. Think of it as a wrapper for a value you can only access with a callback: const promisedValue = Promise.resolve('foo') promisedValue.then(function (value) { value // "foo" }) Now typically you would not just resolve a value, but you would execute something to create that value: const promisedValue = new Promise(function (resolve, reject) { ajax.get('/items', function (error, result) { if (error) reject(error) else resolve(result) }) }) promisedValue .then( function (result) {}, function (error) {} ) Creating a promise allows you to either resolve with a value or reject with an error. Now, the good thing about promises is its ability to create a flow. Promise flow // We create a factory that takes a url and returns // a promise of fetching data function get (url) { return new Promise(function (resolve, reject) { ajax.get(url, function (error, result) { if (error) reject(error) else resolve(result) }) }) } function startFlow (bananasUrl, applesUrl) { let bananasResult // BAD: running side effect from outer scope return get(bananasUrl) // BAD: Not declarative cause need to assign to outer scope .then(function (bananas) { // BAD: assigning to outer scope bananasResult = bananas // BAD: running side effect from outer scope return get(applesUrl) }) // BAD: Not declarative cause need to get value from outer scope .then(function (apples) { const fruitBasket = [bananasResult, apples] return fruitBasket }) .catch(function (error) { }) } startFlow('/bananas', '/apples') So this is a typical way to create a promise flow. You start with a promise and add to it. At the end you catch any possible errors (if you bother). Even though promises are a great concept, it is very low level and it is difficult to discipline yourself to write good code. For example with the code above I show off some typical problems you can get yourself into: - The flow accesses variables in its outer scope. applesUrl. With promises you easily get into a mess of pointing to outer scope variables, making your code harder to understand and reason about. Basically it is more difficult to write declarative code - With promises you typically return only one value, meaning that a concept for “passing on values” from previous steps is not opinionated. The example above creates a variable that is assigned later. This is not ideal - Our side effect (ajax) is also accessed in the outer scope. This makes promise flows harder to test. Even though promises hints to be a great concept for declarative code, where each .then just references a function, it is difficult to do in practice Maybe you already have ideas to make this code better, that is great! Maybe you feel provoked as “this is not the way to write promises”, great! We have something in common :) My point with this example is to show that Promises are low level and gives a lot of freedom, freedom that can easily move you down the wrong path. So how can we make this flow better? Improving the flow Injecting a payload First of all we want to prevent ourselves from pointing to the outer scope. This will allow us to write our code in a declarative way. Starting our flow by resolving the input to it, our urls, we are able to make our first “bananaGet” declarative: function get (url) { return new Promise(function (resolve, reject) { ajax.get(url, function (error, result) { if (error) reject(error) else resolve(result) }) }) } function getBananas (payload) { return get(payload.bananasUrl) } function startFlow (payload) { return Promise.resolve(payload) } startFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(getBananas) Passing the payload The second thing we need to do is make it possible for us to rather extend the existing payload with new properties. This will make sure that whatever payload we start with and add, will be available all the way through the flow: function get (url) {...} function getBananas (payload) { return get(payload.bananasUrl) .then(function (bananas) { payload.bananas = bananas return payload }) } function getApples (payload) { return get(payload.applesUrl) .then(function (apples) { payload.apples = apples return payload }) } function createBasket (payload) { payload.basket = [payload.bananas, payload.apples] return payload } function startFlow (payload) { return Promise.resolve(payload) } startFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(getBananas) .then(getApples) .then(createBasket) .catch(function (error) { }) Side effects One last thing we want to improve here is the side effect that is happening. Ideally we want to separate the side effects and the flow completely. We can do that by passing in the side effect as part of the flow: // We use an object to represent our // state store const state = {} function get (url) {...} // We rather pass an object containing // our side effects and props function startFlow (props) { return Promise.resolve({ get, state, props }) } // Note that we are running our "get" from // the context function getBananas (context) { return context.get(context.props.bananasUrl) .then(function (bananas) { context.props.bananas = bananas return context }) } function getApples (context) { return context.get(context.props.applesUrl) .then(function (apples) { context.props.apples = apples return context }) } function createBasket (context) { context.props.basket = [context.props.bananas, context.props.apples] return context } // We create a function factory to show more functional power. It just // moves a value from the props into our state store function set (stateKey, propsKey) { return function (context) { context.state[stateKey] = context.props[propsKey] } } startFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(getBananas) .then(getApples) .then(createBasket) .then(set('fruitBasket', 'basket')) .catch(function (error) { }) Summary With a bit of boilerplate we have solved our three issues: - We have made our flow declarative. It is very easy to understand what this flow is doing, as we can just read the function names - We have solved the passing of data. By having an argument we in this example call context, we can pass in a payload that is added to, instead of replaced for every step in the flow - We also pass in the side effect itself to the flow, meaning that we have completely decoupled execution from side effects What we gain by this is: - Reading a step by step reference to named functions gives an instant understanding of what the flow does. This allows you to understand code without the distraction of implementation details and you can also plan implementation as a flow first, then implement - We have a consistent way of passing data through our flow. The props property is where initial and added data is contained - We have increased testability. We can test each function in the flow individually by mocking the context passed in. We can even test the whole flow in isolation by using a mocked context If you identify yourself with the promise issues mentioned so far and you see the benefits of the pattern explained here you will have a blast reading the rest of the article. If not, I suggest you keep reading anyways as these ideas gives benefits far beyond readability and testability. Defining a context So in the example above we separated our side effects from the execution: function startFlow (props) { return Promise.resolve({ get, state, props }) } When you instantiate a function-tree, that is exactly what you do. You configure a context that can be used in multiple executions: import FunctionTree from 'function-tree' const state = {} function get (url) {...} const ft = new FunctionTree({get, state}) Executing To execute our example with plain promises you would: startPromiseFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(getBananas) .then(getApples) .then(createBasket) .then(set('fruitBasket', 'basket')) When you execute a function tree you would rather list the functions in an array: ft.run({ bananasUrl: '/bananas', applesUrl: '/apples' }, [ getBananas, getApples, createBasket, set('fruitBasket', 'basket') ]) This looks pretty similar, but there is one big hidden secret here. A function tree runs synchronously. That means: // PROMISE startPromiseFlow({}) .then(somethingSync) .then(somethingElseSync) console.log('I run before everything else') // FUNCTION-TREE ft.run({}, [ somethingSync, somethingElseSync ]) console.log('I run after everything else') Being able to run a flow completely synchronous is important. State changes often needs to trigger a synchronous update to the UI for example. Extending props In our promise example we have to explicitly extend the props and return the context. function getApples (context) { return context.get(context.props.applesUrl) .then(function (apples) { context.props.apples = apples return context }) } With function tree we can just return an object from any function and it will be merged with existing props, meaning we can take advantage of destructuring as well: function getApples ({get, props}) { return get(props.applesUrl) .then(function (apples) { return {apples} }) } Parallel Promises has a really nice helper function that allows you to execute multiple promises and wait for their results. Lets say we want to grab the bananas and apples at the same time: startPromiseFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(function (context) { return Promise.all([ getBananas(context) getApples(context) ]) .then(function (results) { context.props.bananas = results[0] context.props.apples = results[1] return context }) }) .then(createBasket) .then(set('fruitBasket', 'basket')) With function-tree we have the possibility to create a parallel execution: import {parallel} from 'function-tree' ft.run({ bananasUrl: '/bananas', applesUrl: '/apples' }, [ parallel( getBananas, getApples, ), createBasket, set('fruitBasket', 'basket') ]) Conditional paths For promises to run conditional paths you would probably use an if statement: startPromiseFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) .then(function (context) { if (context.props.bananasUrl) { return getBananas(context) } }) .then(getApples) .then(createBasket) .then(set('fruitBasket', 'basket')) With function tree you can define paths of execution declaratively: import {parallel} from 'function-tree' function hasBananasUrl ({props, path}) { return props.bananasUrl ? path.true() : path.false() } ft.run({ bananasUrl: '/bananas', applesUrl: '/apples' }, [ hasBananasUrl, { true: getBananas, false: [] }, getApples, createBasket, set('fruitBasket', 'basket') ]) Function tree analyses the whole tree before it executes, meaning that it will identify execution paths and make those available to the functions that can execute them… like hasBananasUrl in this example. Being able to also declaratively express conditional paths improves readability even more, especially in complex flows. Static analysis So promises is a low level tool. We used it to create a concept of flow, but as with all low level tools, abstractions can be made to make them more powerful. Also because it is low level there is no way to statically analyse how things will run, but function-tree can. A static analysis means that we get a serializable representation of the flow. For example the flow above: { type: 'sequence', items: [{ type: 'function', name: 'hasBananasUrl', paths: { true: { type: 'function', name: 'getBananas' }, false: { type: 'sequence', items: [] } } }, { type: 'function', name: 'getApples' }, { type: 'function', name: 'createBasket' }, { type: 'function', name: 'set' }] } With a static representation like this we are able to create developer tools. When you use function-tree, either in the browser or on the server you will be able to use a developer tool that gives you all the information about the executions. You will see what executions are made, the props, side effects run and their arguments, sequence execution, parallel execution… even how you compose together the functions and sequences of functions. This is not something you would be able to do with pure promises. This is an example of the function-tree debugger: Async / Await But you might say… why even try to define this flow with promises? You can just use the new async/await. Even though async await does make it easier to define flows compared to promises it does not encourage declarative code, it encourages imperative code. Let us convert the example above: async function startAsyncAwaitFlow (props) { let bananas = null if (props.bananasUrl) { bananas = await get(bananasUrl) } const apples = await get(props.applesUrl) const basket = [bananas, apples] state.fruitBasket = basket } startAsyncAwaitFlow({ bananasUrl: '/bananas', applesUrl: '/apples' }) Async / await allows us to more naturally access shared variables, as the flow is defined in one function, but it is not declarative. In this example we need to read all the implementation details to understand what it does conceptually. Declarative by definition helps readability and it allows us to create tools like the debugger. It is also difficult to test this code, as we are likely to point to “outside side effects”. None of the code in the example above can be partly reused, unlike: const getFruits = [ hasBananasUrl, { true: getBananas, false: [] }, getApples ] ft.run({ bananasUrl: '/bananas', applesUrl: '/apples' }, [ getFruits, createBasket, set('fruitBasket', 'basket') ]) Summary So this article was not about saying that promises and async/await are bad. They are great! But they are also a bit too low level when we want to handle complex flows and write code that is readable and maintainable. With function-tree you get some opinions and guarantees: - Your side effects are separated from the execution, meaning that testing is easier - You never have to break out of declarative code, as all you need is on the context. Even when diverging execution you use declarative paths - High degree of composability. You can safely create a function that operates on its context without thinking about “the stuff around it”. You can compose this function into any tree definition, making flows truly feel like putting together lego blocks - Debugging flows can be difficult when your only reference is the code itself. With function-tree you get a debugger that understands the flow and gives you insight on a higher abstraction level The function-tree project was not just some idea or theory. After the first iteration of the Cerebral project it was obvious that this implementation could power more than the framework itself, it could be published as a standalone abstraction to handle flows. During development of Cerebral 2 there has been many iterations, testing function-tree in many different scenarios and it has proven itself to be a practical way to structure your code. If you want to try function-tree you can head over to the Cerebral website or check out the repo to get going quickly.
https://christianalfoni.herokuapp.com/articles/2017_04_16_The-second-case-for-function-tree
CC-MAIN-2019-35
refinedweb
2,275
53.71
> Helllo, I am developing networking quiz game which 2 players are getting one question with 4 answers. I want to network the question and its answers in the client but i can't do that. i handled answers like enemies or non-player objects in unity tutorial but no point How can i do that ?? Also i can't network the text of the question ?? So i want to ask should i handle canvas ui elements with another method or what ? Thanks in advance :) Answer by sennin31 · Oct 17, 2016 at 03:00 PM Hi, I think the best idea will be to have a server and an API. The server will be the game manager, and will send questions/answers to remote clients (with json, xml, or whatever you want). Everything will be synchronize and manage by the server. Answer by Eslam-Mohamed · May 17, 2018 at 12:15 PM I might be mistaken but when you create the player prefab you put the canvas inside as a child. After creating the Canvas object you uncheck his Canvas component(The canvas should disapear from the scene) Then you create a script and put them as a component of your player object prefab. The script should containn the following: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; public class OnlyLocalCanvas : NetworkBehaviour { // Use this for initialization void Start() { if (isLocalPlayer) { GetComponentInChildren<Canvas>().enabled = true; } } } Note that the script has a using UnityEngine.Networking; and tthe class is NetworkBehaviour insted of MonoBehaviour. You should be good to go! What this does is when a player spawns in the Network that player (And only that player) can see the Canvas! By default the others players canvas are disabled! it only enables yours [ if(isLocal]Why my Unity Button's Positions are different. 1 Answer Canvas buttons and fullscreen aspect ratio 1 Answer Screen Space - Camera Bug (Buttons does not work) on Unity 2017 0 Answers Unable to press UI buttons in the Editor in Dual Screen Mode?? 1 Answer UI Buttons Not Working On Other Camera? 0 Answers
https://answers.unity.com/questions/1257653/how-to-network-canvas-elements.html?sort=oldest
CC-MAIN-2019-30
refinedweb
349
64.71
So, a final change to:-Code: [Select]LiquidCrystal_I2C lcd(0x27, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, BacklightPin, POLARITYCode: [Select] lcd.setBacklightPin(7, NEGATIVE); lcd.setBacklight(1);And.....VOILA! Everything working as it should. LiquidCrystal_I2C lcd(0x27, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, BacklightPin, POLARITY lcd.setBacklightPin(7, NEGATIVE); lcd.setBacklight(1); lcd.backlight(); // turn on backlight with full brightnesslcd.noBacklight(); // turn off backlight lcd.setBacklight(brightnessvalue);lcd.setBacklight(BACKLIGHT_ON); // full onlcd.setBacklight(BACKLIGHT_OFF); // full off If you look in the project's wiki you will see that the 2 wire SR version of the library is about 4,5 times faster than the stock parallel LiquidCrystal an almos 40 times faster than the I2C versio. Just don't try to convince GrumpyMike... tack,Cool. Yep on i2c, and the SR interfaces the constructor values are all output bit numbers. Makes sense if you think about it.Glad it worked. Your i2c board matches mjkdz i2c board that I have.When using the newer constructors that specify the backlight pin/bit and backlight polarity, there is no need forthe setBacklightPin(). The constructor sets up everything. Quote from: fm on Jan 07, 2013, 01:04 amIf you look in the project's wiki you will see that the 2 wire SR version of the library is about 4,5 times faster than the stock parallel LiquidCrystal an almos 40 times faster than the I2C versio. Wow, that's some difference. I actually expected it to be slower for some reason. No real basis for that though, other than I guess some intuition that a cheaper method using generic SR would be slower than a specific implementation like I2C, or a parallel interface using a lot more pins. I'll definitely give that a try at some point as I have plenty of 595N's coming. I think I'll be off to design a new 2W SR based backpack. ;-)I guess the only difference is with controlling multiple LCD's. With 2W SR would I need another 2 pins for a an LCD displaying different data?How does the library handle daisy chained SR? Does it, or would it be possible, to support multiple LCD's by writing 16, 24, 32 bits across multiple SR to display the same or different data on each? I'm thinking of this from the way ShiftPWM works. If you actually have 2 SR connected, but specify only 1 then the data gets repeated on the second.Maybe the SR constructor could include a NUM_SR data to effectively specify how many LCD's. I suppose you'd need some kind of reference to each one for lcd.write() etc, such as lcd1.write, lcd2.write like you would if declaring multiple constructors normally. Being able to get a 2 wire implementation, with daisy chained displays, that is faster than I2C with the same wiring benefits, would be quite an achievement. #include <Wire.h> #include <LiquidCrystal_I2C.h> // addr, en,rw,rs,d4,d5,d6,d7,bl,blpolLiquidCrystal_I2C lcd(0x20, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // Set the LCD I2C address// for ( int i = 0; i < charBitmapSize; i++ ) { lcd.createChar ( i, (uint8_t *)charBitmap[i] ); } lcd.home (); // go home lcd.print("Hello, ARDUINO "); lcd.setCursor ( 0, 1 ); // go to the next line lcd.print (" FORUM - fm "); delay ( 1000 );}void loop(){ lcd.home (); // Do a little animation by writing to the same location for ( int i = 0; i < 2; i++ ) { for ( int j = 0; j < 16; j++ ) { lcd.print (char(random(7))); } lcd.setCursor ( 0, 1 ); } delay (200);} Please enter a valid email to subscribe We need to confirm your email address. To complete the subscription, please click the link in the Thank you for subscribing! Arduino via Egeo 16 Torino, 10131 Italy
http://forum.arduino.cc/index.php?topic=77120.msg1060555
CC-MAIN-2015-22
refinedweb
648
66.94
[fglrx] binary graphics drivers don't load with Xen (2.6.22 and 2.6.24) Bug Description The fglrx module won't load into the linux-image- When you run 'sudo modprobe fglrx' you get "FATAL: Error running install command for fglrx" and the following log information. /var/log/messages: Oct 10 10:09:02 hfa9495l kernel: [ 76.843649] fglrx: Unknown symbol kmap_prot Oct 10 10:09:02 hfa9495l kernel: [ 76.843753] fglrx: Unknown symbol xen_l1_entry_update Oct 10 10:09:02 hfa9495l kernel: [ 76.843846] fglrx: Unknown symbol kmap_atomic_prot I'm running an ATI X1300 card. Here is a partial lspci output. 01:00.0 VGA compatible controller: ATI Technologies Inc RV516 [Radeon X1300/X1550 Series] 01:00.1 Display controller: ATI Technologies Inc RV516 [Radeon X1300 Pro] (Secondary) Can report the same problem on a core2duo system using the 64bit Gutsy. Same exact messages as the first comment. My uname: Linux panau-linux 2.6.22-14-xen #1 SMP Sun Oct 14 23:20:20 GMT 2007 x86_64 GNU/Linux With Nvidia drivers I always get kernel panics on x startup. If it doesn't work with ATI, I guess I'm stuck with kvm. Please let me know if you need more information, I'm more than happy to provide. The same problem with nvidia: Oct 26 10:40:10 xxxkernel: [ 25.017352] nvidia: Unknown symbol kmap_prot Oct 26 10:40:10 xxx kernel: [ 25.017842] nvidia: Unknown symbol kmap_atomic_prot is this bug about the nvidia driver or the ati? fglrx is the ati driver On 10/30/07, thearthur <email address hidden> wrote: > > is this bug about the nvidia driver or the ati? > > -- > [Gutsy] fglrx driver doesn't load with linux-image- > https:/ > You received this bug notification because you are a direct subscriber > of the bug. > -- Jeff Rasmussen GPG public key 0x9686C12F both. On my AMD X2 64 (4200+) with a ATI Saphire X1300 Gnome is ok, but all the graphical operation (opening windows, scrolling text, etc) are very slow. I'm getting: sudo modprobe fglrx --> FATAL: Error running install command for fglrx karlo More info from dmesg: [ 28.303858] fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel. [ 28.304231] fglrx: Unknown symbol xen_l1_entry_update [ 28.304511] fglrx: Unknown symbol flush_tlb_page [ 477.364207] fglrx: Unknown symbol xen_l1_entry_update [ 477.364492] fglrx: Unknown symbol flush_tlb_page [ 815.122407] fglrx: Unknown symbol xen_l1_entry_update [ 815.122701] fglrx: Unknown symbol flush_tlb_page I did a distribution upgrade from 7.04. karlo same problem with GeForce 7300 SE card. to avoid this problem, don't use restricted card driver : go to System / Admin / Restricted drivers and suppress non open-source driver. In other word, avoid gglrx and nvidia in /etc/X11/xorg.conf ; prefer nv and ati. Unfortunately, some cards (such as the Mobility X1300) don't work under the older ati or radeon drivers, but instead fall back to vesa, so it's basically fglrx or nothing. Hello, Can someone who has this issue please run the following commands, and attach them to the bug report? * uname -a > uname-a.log * cat /proc/version_ * dmesg > dmesg.log * sudo lspci -vvnn > lspci-vvnn.log Thanks Hi Jonathon, here you go. Cheers, Martin Confirming (multiple reporters), assigning to Kernel Team (lots of kernel messages in the comments). This is the end of what I can do for you, just need to wait for the kernel team. Thanks for the report, and thanks for the files Martin. Hi all, I found a problem with xenified kernel source in arch/i386/ Sorry i'm not very familiar with debian bulid system to give the right things but here is the diff I applied to debian/ diff -urN custom- --- custom- +++ custom- @@ -51,6 +51,7 @@ u.val = __pte_val(val); } +EXPORT_ void xen_l2_ { diff -urN custom- --- custom- +++ custom- @@ -293,10 +293,16 @@ { return; } void flush_tlb_ { xen_tlb_ +EXPORT_ + void flush_tlb_mm (struct mm_struct * mm) { xen_tlb_ +EXPORT_ + void flush_tlb_ { xen_invlpg_ +EXPORT_ + void flush_tlb_all(void) { xen_tlb_ #endif /* Xen */ Regards Hardy now has fglrx enabled for xen, please test. Hardy Alpha 5 (fresh install cd + online update) + xen + fglrx fails with the same errors above. sources 2.6.24 xen I re installed with Gutsy (fresh install cd) + xen + fglrx and I get the same.. ** shrugs.. Hi netslayer, Can you attach the entire dmesg output that also contains the errors when running the latest Hardy Beta kernel? Thanks. I'm running Hardy up to date, i've installed ''linux- $sudo modprobe fglrx FATAL: Could not open '/lib/modules/ [ 101.170910] fglrx: Unknown symbol xen_invlpg_mask [ 101.171091] fglrx: Unknown symbol kmap_prot [ 101.171866] fglrx: Unknown symbol kmap_atomic_prot Same problem on up to date Hardy I have the same problem on Hardy AMD64 up to date. I suppose I have 'linux- linux-restricte I'm getting fglrx: Unknown symbol xen_invlpg_mask When loading the module. Just wondering if there is a progress update for this bug. Currently the FGLRX driver doesn't support Xen and there is nothing we can do without ATI's support. Any news regarding with the nvidia_new module sudo modprobe nvidia dmesg : Oct 11 13:04:56 prout kernel: [ 1945.433977] nvidia: Unknown symbol kmap_prot Oct 11 13:04:56 prout kernel: [ 1945.434263] nvidia: Unknown symbol kmap_atomic_prot lspci | grep VGA: 03:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600 GT] (rev a2)
https://bugs.launchpad.net/ubuntu/+source/linux-restricted-modules-2.6.24/+bug/151327
CC-MAIN-2019-18
refinedweb
887
75
What is a DLL This article describes what a dynamic link library (DLL) is and the various issues that may occur when you use DLLs. It also describes some advanced issues that you should consider when developing your own DLLs. Applies to: DLL. Additionally,. So, .NET Framework, most dependency problems have been eliminated by using assemblies. More information A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Each program can use the functionality that is contained in this DLL to implement an Open dialog box.. It can greatly influence the performance of not just the program that is running in the foreground, but also other programs that are running on the Windows operating system. Promotes modular architecture A DLL helps promote developing modular programs. .localfile to enforce the version of the DLL that is used by the program. To use private DLLs, locate your DLLs in the program root folder. Then, for new programs, add version-specific information to the DLL. For old programs, use an empty .localfile. and export functions match. - Dependency Walker checks for circular dependency errors. - Dependency Walker to exported DLL functions like local functions. To use load-time dynamic linking, provide a header (.h) file and an import library (.lib) file when you compile and link the application. When you do this, the linker will provide the system with the information that is required to load the DLL and resolve the exported DLL function locations at load time. dynamic linking, an application can branch to load different modules as required. It is important when you develop multiple-language versions. The DLL entry point When you create a DLL, you can optionally specify an entry point function. The entry point function is called when processes or threads attach themselves to the DLL or detached themselves from the DLL. You can use the entry point function to initialize data structures or to destroy data structures as required by the DLL. Additionally, if the application is multithreaded, you can use thread local storage (TLS) to allocate memory that is private to each thread in the entry point function. The following code is an example of the DLL entry point; } When the entry point function returns a FALSE value, the application will not start if you are using load-time dynamic linking. If you are using run-time dynamic linking, only the individual DLL will not load. The entry point function should only perform simple initialization tasks and should not call any other DLL loading or termination functions. For example, in the entry point function, you should not directly or indirectly call the LoadLibrary function or the LoadLibraryEx function. Additionally, you should not call the FreeLibrary function when the process is terminating. Note In multithreaded applications, make sure that access to the DLL global data is synchronized (thread safe) to avoid possible data corruption. To do this, use TLS to provide unique data for each thread. Export DLL functions To export DLL functions, you can either add a function keyword to the exported DLL functions or create a module definition (.def) file that lists the exported DLL functions. To use a function keyword, you must declare each function that you want to export with the following keyword: __declspec(dllexport) To use exported DLL functions in the application, you must declare each function that you want to import with the following keyword: __declspec(dllimport) Typically, you would use one header file that has a define statement and an ifdef statement to separate the export statement and the import statement. You can also use a module definition file to declare exported DLL functions. When you use a module definition file, you do not have to add the function keyword to the exported DLL functions. In the module definition file, you declare the LIBRARY statement and the EXPORTS statement for the DLL. The following code is an example of a definition file. // SampleDLL.def // LIBRARY "sampleDLL" EXPORTS HelloWorld Sample DLL and application In Visual C++ 6.0, you can create a DLL by selecting either the Win32 Dynamic-Link Library project type or the MFC AppWizard (dll) project type. The following code is an example of a DLL that was created in Visual C++ by using the Win32 Dynamic-Link Library project type. // can't be enforced by the operating system..
https://docs.microsoft.com/en-US/troubleshoot/windows-client/deployment/dynamic-link-library
CC-MAIN-2022-33
refinedweb
747
54.52
08 December 2010 13:51 [Source: ICIS news] NANJING (ICIS)--?xml:namespace> The company invested $90m (€67.5m) in the new HEC facility, which started up on 4 November, said John Panichella, president of The investment is The facility, located at the “We are now planning the construction of the second plant, which also will have a capacity of 10,000 tonnes/year,” said an “But the actual date has not been confirmed; it will depend on the market situation,” he added. The HEC, a cellulose polymer, is a gelling and thickening agent that has a range of applications, including shampoos and gels as well as latex paint.
http://www.icis.com/Articles/2010/12/08/9417840/ashland-achieves-on-spec-production-at-china-hec-facility.html
CC-MAIN-2014-52
refinedweb
108
54.05
#include <sys/sd.h> char *sdget(path, flags, [size, mode]) char *path; int flags, mode; long size; int sdfree(addr); char *addr; sdget attaches a shared data segment to the data space of the current process. The actions performed are controlled by the value of flags. flags values are constructed by OR-ing flags from the following list: sdfree detaches the current process from the shared data segment that is attached at the specified address. If the current process has done sdenter but not an sdleave for the specified segment, sdleave is done before detaching. When no process remains attached to the segment, the contents of that segment disappear, and no process can attach to the segment without creating it by using the SD_CREAT flag in sdget. errno is set to EEXIST if a process tries to create a shared data segment that exists and is in use. errno is set to ENOTNAM if a process attempts an sdget on a file that exists but is not a shared data type. For 286 programs, it is strongly recommended that sdget and other shared data functions be reserved for large model programs only. Small or middle model programs that attempt to use shared data may run out of available memory. Also, due to the 286 hardware, it is not possible to enforce the read-only aspect of small model shared data. However, read-only segments are honored in large model programs. The 386 provides a 32 bit address space, even in small model. As a result, shared data may be conveniently used without regard to the restrictions that apply to 286 programs. sdget automatically increments the process's original break value to the memory location immediately after the shared data segment. This affects subsequent sbrk or brk calls which attempt to restore the original break value. In particular, attempts to restore the break value to its value before the sdget call causes an error. This feature is a XENIX specific enhancement and may not be present in all UNIX implementations. This routine must be linked using the linker option -lx. The size variable in sdget has changed from unsigned to long between UNIX Version 3.0 and UNIX System V. Although this requires that source code be modified to use a long size parameter when compiling with the libraries, an unsigned size parameter is still correctly interpreted by the kernel when passed by binaries compiled with the Version 3.0 libraries. The mode parameter must be included on the first call of the sdget function.
http://osr507doc.xinuos.com/en/man/html.S/sdget.S.html
CC-MAIN-2019-30
refinedweb
424
60.85
ERR — OpenSSL error codes #include <openssl/err.h> When a call to the OpenSSL library fails, this is usually signaled by the return value, and an error code is stored in an error queue associated with the current thread. The ERR library provides functions to obtain these error codes and textual error messages. The ERR_get_error(3) manpage describes how to access error codes. Error codes contain information about where the error occurred, and what went wrong. ERR_GET_LIB(3) describes how to extract this information. A method to obtain human-readable error messages is described in ERR_error_string(3). ERR_clear_error(3) can be used to clear the error queue. Note that ERR_remove_state(3) should be used to avoid memory leaks when threads are terminated. See ERR_put_error(3) if you want to record error codes in the OpenSSL error system from within your application. The remainder of this section is of interest only if you want to add new error codes to OpenSSL or add error codes from external libraries. When you are using new function or reason codes, run make errors. The necessary #defines will then automatically be added to the sub-library's header file. When adding a new sub-library to OpenSSL, assign it a library number ERR_LIB_XXX, define a macro XXXerr() (both in <openssl/err.h>), add its name to ERR_str_libraries[] (in /usr/src/lib/libcrypto/err/err.c), and add ERR_load_XXX_strings() to the ERR_load_crypto_strings() function (in /usr/src/lib/libcrypto/err/err_all.c). Finally, add an entry L XXX xxx.h xxx_err.c to /usr/src/lib/libcrypto/err/openssl.ec, and add xxx_err.c to the Makefile. Running make errors will then generate a file xxx_err.c, and add all error codes used in the library to xxx.h. Additionally the library include file must have a certain form. Typically it will initially look like this: #ifndef HEADER_XXX_H #define HEADER_XXX_H #ifdef __cplusplus extern "C" { #endif /* Include files */ #include <openssl/bio.h> #include <openssl/x509.h> /* Macros, structures and function prototypes */ /* BEGIN ERROR CODES */ The BEGIN ERROR CODES sequence is used by the error code generation script as the point to place new error codes. Any text after this point will be overwritten when make errors is run. The closing #endif etc. will be automatically added by the script. The generated C error code file xxx_err.c will load the header files <stdio.h>, <openssl/err.h> and <openssl/xxx.h> so the header file must load any additional header files containing any definitions it uses. It is also possible to use OpenSSL's error code scheme in external libraries. The library needs to load its own codes and call the OpenSSL error code insertion script mkerr.pl explicitly to add codes to the header file and generate the C error code file. This will normally be done if the external library needs to generate new ASN.1 structures but it can also be used to add more general purpose error code handling. The error queues are stored in a hash table with one ERR_STATE entry for each PID. ERR_get_state() returns the current thread's ERR_STATE. An ERR_STATE can hold up to ERR_NUM_ERRORS error codes. When more error codes are added, the old ones are overwritten, on the assumption that the most recent errors are most important. Error strings are also stored in a hash table. The hash tables can be obtained by calling ERR_get_err_state_table() and ERR_get_string_table(). crypto(3), ERR_asprintf_error_data(3), ERR_clear_error(3), ERR_error_string(3), ERR_get_error(3), ERR_GET_LIB(3), ERR_load_crypto_strings(3), ERR_load_strings(3), ERR_print_errors(3), ERR_put_error(3), ERR_remove_state(3), ERR_set_mark(3), SSL_get_error(3)
https://man.openbsd.org/OpenBSD-6.7/ERR.3
CC-MAIN-2022-21
refinedweb
595
59.5
Content-type: text/html #include <openssl/pkcs7.h> int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags); STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); flags is an optional set of flags, which can be used to modify the verify operation. PKCS7_get0_signers() retrieves the signer's certificates from p7, it does not check their validity or whether any signatures are valid. The certs and flags parameters have the same meanings as in PKCS7_verify(). Initially some sanity checks are performed on p7. The type of p7 must be signedData. There must be at least one signature on the data and if the content is detached indata cannot be NULL. An attempt is made to locate all the signer's certificates, first looking in the certs parameter (if it is not NULL).. Only the flag PKCS7_NOINTERN is meaningful to PKCS7_get0_signers(). If PKCS7_NOINTERN is set the certificates in the message itself are not searched when locating the signer's certificate. This means that all the signers certificates must be in the certs parameter. If the PKCS7_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned. If PKCS7_NOVERIFY is set the signer's certificates are not chain verified. If PKCS7_NOCHAIN is set then the certificates contained in the message are not used as untrusted CAs. This means that the whole verify chain (apart from the signer's certificate) must be contained in the trusted store. If PKCS7_NOSIGS is set then the signatures on the data are not checked. Care should be taken when modifying the default verify behaviour, for example setting PKCS7_NOVERIFY|PKCS7_NOSIGS will totally disable all verification and any signed message). PKCS7_get0_signers() returns all signers or NULL if an error occurred. The error can be obtained from ERR_get_error(3) The lack of single pass processing and need to hold all data in memory as mentioned in PKCS7_sign() also applies to PKCS7_verify().
http://backdrift.org/man/gnu/man3/PKCS7_verify.3ssl.html
CC-MAIN-2017-09
refinedweb
335
55.34
cloud-init is used with windows too. See the documentation for bootstrapping Windows stacks. There's no standard way to do it from within the language. I'm not even aware of a documented extension that is able to query. However some compilers have options to set the stack size. And platform may specify what it does when launching a process, and/or provide ways to set stack size of a new thread, maybe even manipulate existing one. For small platforms it's usual to know the whole memory size, have all the data segments on one end, a set size arena for the heap (may be 0), and the rest is stack, approaching from the other side. I have a multi-threaded program where one of the stacks is blowing up, but I can't figure out which one. Let the program crash and leave a core file. Load that core into a debugger, and it will tell you right away which thread crashed. The thread that crashed is not necessarily the one with the overflow. It's true that there are scenarios where one thread overflows its stack, but another thread crashes because of it. However, such scenarios are exceedingly rare (at least for non-user allocated thread stacks -- the pthread library will normally provide a stack guard page(s) to protect agains this). I can only think of one such scenario, and it's very unlikely in practice. I'm looking for a portable approach using a pthreads call or something similar. There is no portable have a look on this question, there is explained what non-functional rquirements are. In my mind the third point of your non-functional list is a functional requirment. Because this describes a functinality which the app should have. And the fourth and fith requirement depends also in the functional category I guess. But in this two cases I'm not 100% sure Hope I could help you a bit Incorrect. There's one kernel address space, and no kernel processes. There are kernel threads, and there are user space threads that enter the kernel. These run in the kernel address space. Each of these has a separate stack, within the kernel address space. Your problem is here: preg_match('/$passwordspecs/', $_POST['password']) You are trying to access value of variable $passwordspecs in a single quotes. You need to use double quotes instead. Otherwise it is treated as a string. Change it to: preg_match("/{$passwordspecs}/", $_POST['password']) But you have more problems than that: Do not store password as a string, use some sort of hashing algorithm as Garytje suggested. Do not directly insert data into database that user provided. (DO NOT TRUST USER INPUT), in other words use prepared statements or else someone will inject SQL code. And in my opinion, as a customer/user, I hate when I have to choose a password like that, its hard to remember later on. I am registering on your website (means you get +1 user) why cant I choose pas One approach would be to utilize the Specification pattern. So, basically, your item would have a WearerSpecification property which returns a specification that returns true if the current character satisfies it. Something like this: public abstract class Item { private readonly ISpecification<Character> _wearerSpecification; protected Item(ISpecification<Character> wearerSpecification) { _wearerSpecification = wearerSpecification; } public ISpecification<Character> WearerSpecification { get { return _wearerSpecification; } } } In the method that is called when the character tries to pick up an item, the code would look something like this: public class Character { public void PickUpItem(Item item) { if( It looks like RVM tried to install some dependencies using Macports and Macports proceeded to get really confused about dependencies when it tried to install autoconf. Try running: brew install autoconf Otherwise you should run this bash script: Assuming you have brew, which you should if you don't. If your Macports just isn't working, then you can manually install all of the requirements like this: brew install autoconf automake libtool pkgconfig libyaml libffi readline libksba curl-ca-bundle gdbm Using Sax As you want to modify XML this is not going to help you Using DOM Since you care about memory(efficiency) this is not going to work Using Stax This is what helps your concerns. You have also pointed on it. How to modify XML using Stax is discussed here Scala doesn't allow you to specify the constructor's signature in a type constraint (as e.g. C#). However Scala does allow you to achieve something equivalent by using the type class pattern. This is more flexible, but requires writing a bit more boilerplate code. First, define a trait which will be an interface for creating a T given an Int. trait Factory[T] { def fromInt(i: Int): T } Then, define an implicit instance for any type you want. Let's say you have some class Foo with an appropriate constructor. implicit val FooFactory = new Factory[Foo] { def fromInt(i: Int) = new Foo(i) } Now, you can specify a context bound for the type parameter T in the signature of Class1: class Class1[T : Factory] { def method1(i: Int) = { val instance = implicitly[Factory[T]].fromInt( For the given number, 10000 API calls per day, it will be enough to have one API Manager server instance in following hardware. You can have another CPU core, and 2 GB RAM for same machine if WSO2 BAM server runs on same machine. Physical : 3GHz Dual-core Xeon/Opteron (or latest), 4 GB RAM (minimum : 2 GB for JVM and 2GB for the OS, 10GB free disk space (minimum) disk based on the expected storage requirements (calculate by considering the file uploads and the backup policies) . Virtual Machine : 2 compute units minimum (each unit having 1.0-1.2 GHz Opteron/Xeon processor) 4 GB RAM 10GB free disk space. One cpu unit for OS and one for JVM. (e.g if 3 Carbon instances running require VM of 4 compute units 8 GB RAM 30 GB free space) NOTE: You may have more than one instance as a cluster f As above, Iframes may be best; however they are deprecated and don't always give the best results. An alternative would be to set a div for the content, and Ajax the content into the frame. You can then access it through the dom to get links etc. To decide which would be best I would consider what content is being loaded - full HTML documents (with doctype, head, metadata etc) will be problematic without I frames. If the content being loaded is just plain text, maybe with a few basic HTML elements, I would ajax it into a div. System Requirements from Windows Installer 3.1 shows this: Supported Operating System Windows 2000 Service Pack 3, Windows 2000 Service Pack 4, Windows Server 2003, Windows XP, Windows XP Service Pack 1, Windows XP Service Pack 2 Windows Installer 3.1 Firstly td elements do not have the val property. Need to use .text to get the text Next use parseInt to convert it to a number if (n > 50) { supposed to b e if (parseInt(n, 10) > 50) { But because you are specifically setting each td to a specific color. You need to iterate over the list using $.each. You can also use .filter as well. // Will return all the `tds` with the value var $red = $('.red').filter(function() { return parseInt( $(this).text(), 10) > 50; }); // Set the red elements to color red $red.css('color', 'red'); // All `.red` which are not in above selector are selected $('.red').not($red).css('color', 'blue'); Using Filter Demo Using Each Demo Basically you have to add nothing, you only need to add http basic auth credentials if needed. This is how i usually connect to a https api with http basic auth. //Base URL NSURL *requestPasswordURL = [NSURL URLWithString:BASEURL]; //Http client with server credentials AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:requestURL]; [httpClient setAuthorizationHeaderWithUsername:@"user" password:@"password"]; //Set request parameters for example email NSDictionary *params = @{@"email": email}; NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:API_REQUEST parameters:params]; request.cachePolicy = NSURLRequestReloadIgnoringCacheData; //Prepare request AFHTTPRequestOperation *request = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [requestPa Try this invoiceRefNumber is your system accounting invoice number, it is for tracking only and not used by our system. appKey - is the app key you received from us upon registration Creating a payment request and opening the payment dialog. -(IBAction)pay{ ZooZ * zooz = [ZooZ sharedInstance]; zooz.sandbox = YES;//set this if working in Sandbox mode ZooZPaymentRequest * req = [zooz createPaymentRequestWithTotal:32.1 invoiceRefNumber:@"1234" delegate:self]; req.currencyCode = @"USD"; [zooz openPayment:req forAppKey:@"app_id"]; } The command go get does exactly what you need: It finds all dependencies and downloads and installs the missing ones. Focus on "all": go get really traverses your dependency graph. Have a look at the documentation: The Go documentation is really clean, short and well written. I would recommend always to have a look at the documentation first before making assumptions which are based on experience with other tools or tool-chains. You could merge them with an OR in the regex itself: ^(?:01(204|208|254|276|297|298|363|364|384|386|404|420|460|461|480|488|524|527|562|566|606|629|635|647|659|695|726|744|750|768|827|837|884|900|905|935|946|949|963|995)d{5}|0[12]d{9})$ Edited 11 digit regex. Try to add the following to your Search Path(HKCUSoftwareEmbarcaderoBDSx.xLibraryWin32), of course including the correct path prefix: ..jclsource; ..jclsourcecommon; ..jclsourceinclude; ..jclsourcevcl; ..jclsourcewindows; ..jvclcommon; ..jvcl un; You might also be interested in the following link: bash-3.2$ ?? That looks like the postgres prompt to me. You should be at a prompt like: ~/rails_projects/my_app$ Try typing: bash-3.2$ exit to get back to a prompt you can recognize. In most cases you don't need to do anything more.Just try a sample mail script like this.If it doesn't work then add sendmail_path = /etc/postfix in your php.ini. <?php $to = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> A subparser (as suggested in comments) might work. Another alternative (since mutually_exclusive_group can't quite do this) is just to code it manually, as it were: import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('-2', dest='two', action='store_true') parser.add_argument('-3', dest='three') parser.add_argument('-4', dest='four') parser.add_argument('-5', dest='five') args = parser.parse_args() if not args.two: if args.three is None or args.four is None: parser.error('without -2, *both* -3 <a> *and* -4 <b> are required') print args return 0 Adding a little driver to this: import sys sys.exit(main()) and run with your examples, it seems to do the right thing; here are two runs: Python3 uses distutils and setup() will take a requires keyword arguments. From the docs: Dependencies on other Python modules and packages can be specified by supplying the requires keyword argument to setup(). Change install_requires to requires in you setup.py script. Which release are you using? In the latest release (R2013a), there is the System Requirements block. You can also generate (and customize) a requirements report, which should also work in earlier releases (I remember using it in R2011a for example). Okay. I think you need a subject list, with a bunch of subject id's. Now, for the query, you will start with (or generate) a bunch of subject id's and grades. The easiest thing to do is to make this into a temporary table with those columns. Now, you can do your query, joining the subject id's, and adding a "where temp.grade <= course.grade. The trick to this is to count the rows. If it has the same number of rows as the course has specified, then you have a successful match. Is that enough to get you going? This answer is for "what language is available on any version of Windows without additional requirements". There are many other options for "what I can use to create application that can be xcopy deployed on any version of Windows". JavaScript is probably your best bet - it is supported on most recent versions of Windows (according to Wikipedia article - Windows Script Host JavaScript available for scripting starting with Windows 98). Allows basic operation with files and HTTP communication - maybe enough for simple patching application. Next would be native Win32 application, but lack of C++ experience will make it hard.
http://www.w3hello.com/questions/Determine-IAM-requirements-for-Cloudformation-Stack
CC-MAIN-2018-17
refinedweb
2,098
55.95
" > --- > cfg.mk | 4 +- > po/POTFILES.in | 1 + > tools/Makefile.am | 36 +----- > tools/virsh-edit.c | 69 +++++++++ > tools/virsh.c | 394 +++++++++++++++++----------------------------------- > 5 files changed, 199 insertions(+), 305 deletions(-) > create mode 100644 tools/virsh-edit.c MUCH nicer :) > +++ b/tools/Makefile.am > @@ -111,41 +111,7 @@ virsh_CFLAGS = \ > $(COVERAGE_CFLAGS) \ > $(LIBXML_CFLAGS) \ > $(READLINE_CFLAGS) > -BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c > - > +BUILT_SOURCES = virsh-edit.c Drop this line. virsh-edit.c should be part of libvirt.git, but BUILT_SOURCES is only for generated files that are not part of the repo. > +++ b/tools/virsh-edit.c > @@ -0,0 +1,69 @@ Needs a copyright header. Also needs comments describing how to use the file (that is, that this is a file fragment designed for inclusion from other .c files, and document the macro names that must exist prior to inclusion). It might also be worth doing: #ifndef EDIT_GET_XML # error Missing EDIT_GET_XML definition #endif and so forth, for sanity checking. > +do { > + char *tmp = NULL; > + char *doc = NULL; > + char *doc_edited = NULL; > + char *doc_reread = NULL; > + > + /* Get the XML configuration of the domain. */ > + doc = EDIT_GET_XML; This must be an expression... > + if (!doc) > + goto edit_cleanup; > + > + /* Create and open the temporary file. */ > + tmp = editWriteToTempFile (ctl, doc); As long as we are moving things, let's touch up the syntax (no space before '('). > + if (!tmp) > + goto edit_cleanup; > + > + /* Start the editor. */ > + if (editFile (ctl, tmp) == -1) Again. > + goto edit_cleanup; > + > + /* Read back the edited file. */ > + doc_edited = editReadBackFile (ctl, tmp); Again. > + if (!doc_edited) > + goto edit_cleanup; > + > + /* Compare original XML with edited. Has it changed at all? */ > + if (STREQ (doc, doc_edited)) { AGAIN. > + EDIT_NOT_CHANGED; ...whereas this can be a (possibly-compound) statement, including a break statement. Useful hints to document at the top of the file when stating what macros must exist. > + ret = true; > + goto edit_cleanup; > + } > + > + /* Now re-read the domain XML. Did someone else change it while > + * it was being edited? This also catches problems such as us > + * losing a connection or the domain going away. > + */ > + doc_reread = EDIT_GET_XML; > + if (!doc_reread) > + goto edit_cleanup; > + > + if (STRNEQ (doc, doc_reread)) { > + vshError(ctl, "%s", _("ERROR: the XML configuration " > + "was changed by another user")); > + goto edit_cleanup; > + } > + > + /* Everything checks out, so redefine the domain. */ > + if (!(EDIT_DEFINE)) > + goto edit_cleanup; > + > + goto edit_continue; A simple 'break' would get you out of the do/while(0) loop, without the need for a new label. And that's a good change, because... > + > +edit_cleanup: > + VIR_FREE(doc); > + VIR_FREE(doc_edited); > + VIR_FREE(doc_reread); > + if (tmp) { > + unlink (tmp); > + VIR_FREE(tmp); > + } > + goto cleanup; > + > +} while (0); > + > +edit_continue: ...this trailing label is risky. If the caller had done: #define ... { #include "virsh-edit.c" } leaving a trailing label would be a syntax error. > + #define EDIT_GET_XML virNWFilterGetXMLDesc (nwfilter, 0) Again, no space before '('. > @@ -15899,8 +15725,41 @@ static const vshCmdOptDef opts_network_edit[] = { > {NULL, 0, 0, NULL} > }; > > -/* This is generated from this file by a sed script in the Makefile. */ > -#include "virsh-net-edit.c" > +static bool > +cmdNetworkEdit (vshControl *ctl, const vshCmd *cmd) and again. etc. Overall, looks like you're almost there. The missing copyright is worth a v2 (we should always be in a habit of ensuring good copyright, after seeing what qemu is going through). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library Attachment: signature.asc Description: OpenPGP digital signature
https://www.redhat.com/archives/libvir-list/2012-May/msg00970.html
CC-MAIN-2015-22
refinedweb
527
61.12
Parameters for cmd_vel_mux I wish to adjust the priority of cmd_vel_mux For this purpose I've located some .YAML files for understanding the syntax. - name: "Safe reactive controller" topic: "safety_controller" timeout: 0.2 priority: 10 - name: "Keyboard operation" topic: "keyboard_teleop" timeout: 0.2 priority: 7 I can't figure out what is the exact meaning of these fields - name/topic/timeout/priority. Of course "name" is a name... But in which namespace? Where do I set this namespace? "timeout" is a measure of time, guessing - idle time while dealing with the callback, but what units? (second/milliseconds/minutes) Priority - which is high, which is low? What is the maximum number of priorities available? Topic - same as name. I do not know any of these topics, they are not available when listing the current topics ( rostopic list), so I guess it is also another namespace (?)
https://answers.ros.org/question/241955/parameters-for-cmd_vel_mux/
CC-MAIN-2021-39
refinedweb
144
60.92
Hey, so I was given a gift of visual studio 2010 Game Studio 4.0 and a yr membership with Xbox indie (for submitting games), and I sighed as I was really happy to dev for my 360 for my first time ever I am also having to leant a new language a new compiler and a new framework. It all seems pretty straightforward and the documentation for game studio is better than I expected, but I was in the habit of breaking most of my programs into sperate headers to keep things organized but with c# it seems to be a little different. I am trying to peice this together and I am sure after only a few days i may seem rwtarded, but is the using namespace randomnamspace. The new way to do #includes? Like if I wanted to break a game down into different files could I just add new .cs to the project define a namespace in it then just put using thatnamepsace at the top of my main page? What are common pitfalls or probelms I should avoid with learning this new method? Thanks in advance for any info.. also I will be buying a book on it soon if anyone has any suggestions (I don't want a beginner book with a lot of "fluff")
http://cboard.cprogramming.com/csharp-programming/152382-using-namespace-printable-thread.html
CC-MAIN-2015-48
refinedweb
221
74.63
This is a discussion on woo hooo!!! no more pronography board within the A Brief History of Cprogramming.com forums, part of the Community Boards category; ... Acos is good Because it was a dumb board Acos is good maybe... but the title made for some interesting twists in the threads [code] #include <stdio.h> int main(void) { printf("(.)(.)"); // boobies return 0; } everything posted in that board could be put into one of the posts of this board. It was just a joke I guess, but hey it's a different twist, just to make things a little bit more interesting. The prognography board... Don't understand exactly where that was going, it didn't seem to gather many posts. rwalt Practical jokes usually don't stay around that long. I was born; I shall die. Between those two events there is life. I don't know why, and I don't question it; I merely live. you guys are bunch of whining sissies... quit your complaing... it was harmless... interesting even, if only for a little bit.. nothing wrong with mixing it up a little from time to time.. yeah no harm in it said nelson..... try anothe but call it the blazing room, where we can all slag each other off without causing offense Before you judge a man, walk a mile in his shoes. After that, who cares.. He's a mile away and you've got his shoes. ************William Connoly
http://cboard.cprogramming.com/brief-history-cprogramming-com/10376-woo-hooo-no-more-pronography-board.html
CC-MAIN-2015-06
refinedweb
243
86.6
i wrote a whole post on this then scrapped it. this one should be easier to understand: think of the CLASSPATH as a declaring a "root drive in a java file system" this root is used by the compiler, when it looks for files. if you set your classpath = %classpath%;"C:\prog\MineSweeper" then the %classpath% means (the current value of the classpath) - so C:\prog\MineSweeper is added the java compiler then uses this. when you type: javac MineSweeper.java.. it looks in every entry in the class path (all those roots) for MineSweeper.java eventually it finds in in "C:\prog\MineSweeper\MineSweeper.java the underline = the classpath entry if MineSweeper.java is in a folder instead, you have to specifiy that folder name too: javac viewController\MineSweeper.java eventually it finds it in: "C:\prog\MineSweeper\viewController\MineSweeper.java - the compiler ignores PACKAGE statements, but uses import statements. the import statements MUST provide access to the needed classes, when the classpath is pre-pended: CLASSPATH+IMPORT_STATEMENT -> java file in this case, you type: javac MineSweeper.java //it has an "import model.hello;" statement .. the compiler tries to load: c:\prog\MineSweeper\MineSweeper.java c:\prog\MineSweeper\model\hello.java - what happens if, like before, you make a subdirectory and compile from the parent? it fails! heres what it tries to load: javac viewController\MineSweeper.java LOAD: c:\prog\MineSweeper\viewController\MineSweeper.java LOAD: c:\prog\MineSweeper\model\hello.java the IMPORT statements ALWAYS import from the CLASSPATH root.. no matter how you enter directories in the javac statement - getting it? so what of PACKAGE? well PACKAGE is used by java, not javac. it is used basically to say that "relative to the classpath root, you should find me in this path, on disk" so say your MineSweeper.java is in the viewController cdirectory (which is in the dir specified in the classpath), but he doesnt have a PACKAGE statement. this compiles it: c:\prog\MineSweeper> JAVAC viewController\MineSweeper.java (the bit in bold is the dos prompt) no problems. this runs it? c:\prog\MineSweeper> JAVA viewController\MineSweeper nope.. it fails with the "wrong name" - it is in directory viewController, relative to the classpath, BUT it doesnt have a "package viewController" statement at the top! - solutions: decide what you want your ROOT classpath to be. Every file in that directory tree, MUST have a PACKAGE statement describing exactly WHERE it is relative to the root classpath, it is. IMPORTs are made using the ROOT of the classpath, not the current file location (java doesnt care for directory structures; it cant be allowed to because it is multi-platform) so: MyFile.java------ package abc.def.ghi; import abc.def.AnotherFile; AnotherFile.java package abc.def; --------------- the 2 files MUST exist at these locations, if the classpath is "...whatever...;c:\blahblah" : c:\blahblah\abc\def\ghi\MyFile.java c:\blahblah\abc\def\AnotherFile.java the should be compiled like this: C:\blahblah> javac abc\def\ghi\MyFile.java (myfile refers to anotherfile - automatic compilation of AnotherFile) they should be run like this: c:\blahblah> java abc.def.ghi.MyFile -- using that info i think you can work out what you need to
http://forums.devx.com/showthread.php?139353-Package-amp-Import-in-Windows&p=411939&mode=linear
CC-MAIN-2015-14
refinedweb
533
50.94
This appendix describes the functions that are built into XQuery. Table A-1 lists all the built-in functions by subject for easy reference. In addition to a brief sentence explaining the purpose of the function, each function is described by the following characteristics: “Signature” lists the parameters and their types, and the return type of the function. “Usage Notes” covers the function in more detail. “Special Cases” lists error conditions and other unusual situations. “Example(s)” provides one or more example function calls with their return values. “Related Functions” lists names of related functions. Most of the built-in functions are in the XPath Functions Namespace,. These do not need to be prefixed when called in a query, so they are listed in this appendix without a prefix. Some people prefer to use the prefix fn with these functions, which works because the XPath Functions namespace is predeclared with the prefix fn. Other functions in this appendix are shown with the prefixes math, array, and map. These three namespace prefixes are not predeclared. To use functions in these namespaces, declare the namespaces in your query prolog, for example: declare namespace math = ""; declare namespace array = ""; declare namespace map = ""; Many of the built-in functions have more than ... No credit card required
https://www.oreilly.com/library/view/xquery-2nd-edition/9781491915080/app01.html
CC-MAIN-2018-51
refinedweb
211
65.01
Hi allMany.Here's some code (for a BFS patched 3.0.x kernel): it out, see what you think. It seems to be running safely here but as always, there are no guarantees. All going well, you should notice pretty much no difference on a desktop. If you do any throughput benchmarks comparing before/after, I'd love to hear about them. Patch inserted here as well:--- include/linux/init_task.h | 2 include/linux/sched.h | 3 include/linux/skip_lists.h | 26 ++++++ kernel/Makefile | 2 kernel/sched_bfs.c | 175 ++++++++++++++++++++------------------------- kernel/skip_lists.c | 159 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 268 insertions(+), 99 deletions(-)Index: linux-3.0.0-ck1/include/linux/sched.h===================================================================--- linux-3.0.0-ck1.orig/include/linux/sched.h 2011-09-23 23:20:55.498045319 +1000+++ linux-3.0.0-ck1/include/linux/sched.h 2011-09-23 23:21:36.757045313 +1000@@ -97,6 +97,7 @@ struct sched_param { #include <linux/task_io_accounting.h> #include <linux/latencytop.h> #include <linux/cred.h>+#include <linux/skip_lists.h> #include <asm/processor.h> @@ -1243,7 +1244,7 @@ struct task_struct { #ifdef CONFIG_SCHED_BFS int time_slice; u64 deadline;- struct list_head run_list;+ skiplist_node *node; /* Skip list node id */ u64 last_ran; u64 sched_time; /* sched_clock time spent running */ #ifdef CONFIG_SMPIndex: linux-3.0.0-ck1/kernel/Makefile===================================================================--- linux-3.0.0-ck1.orig/kernel/Makefile 2011-09-23 23:20:55.512045319 +1000+++ linux-3.0.0-ck1/kernel/Makefile 2011-09-23 23:21:36.757045313 +1000@@ -117,6 +117,8 @@ ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer endif +obj-$(CONFIG_SCHED_BFS) += skip_lists.o+ $(obj)/configs.o: $(obj)/config_data.h # config_data.h contains the same information as ikconfig.h but gzipped.Index: linux-3.0.0-ck1/kernel/sched_bfs.c===================================================================--- linux-3.0.0-ck1.orig/kernel/sched_bfs.c 2011-09-23 23:20:55.524045319 +1000+++ linux-3.0.0-ck1/kernel/sched_bfs.c 2011-09-24 00:25:14.331291981 +1000@@ -67,6 +67,7 @@ #include <linux/bootmem.h> #include <linux/ftrace.h> #include <linux/slab.h>+#include <linux/skip_lists.h> #include <asm/tlb.h> #include <asm/unistd.h>@@ -163,8 +164,7 @@ struct global_rq { unsigned long nr_running; unsigned long nr_uninterruptible; unsigned long long nr_switches;- struct list_head queue[PRIO_LIMIT];- DECLARE_BITMAP(prio_bitmap, PRIO_LIMIT + 1);+ #ifdef CONFIG_SMP unsigned long qnr; /* queued not running */ cpumask_t cpu_idle_map;@@ -177,6 +177,9 @@ struct global_rq { raw_spinlock_t iso_lock; int iso_ticks; int iso_refractory;++ skiplist_node *node;+ skiplist *sl; }; #ifdef CONFIG_SMP@@ -641,24 +644,25 @@ static inline int deadline_after(u64 dea } /*- * A task that is queued but not running will be on the grq run list.- * A task that is not running or queued will not be on the grq run list.- * A task that is currently running will have ->on_cpu set but not on the- * grq run list.+ * A task that is not running or queued will not have a node set.+ * A task that is queued but not running will have a node set.+ * A task that is currently running will have ->on_cpu set but no node set. */ static inline int task_queued(struct task_struct *p) {- return (!list_empty(&p->run_list));+ return !!(p->node); } /*- * Removing from the global runqueue. Enter with grq locked.+ * Removing from the global runqueue. Enter with grq locked. Deleting a task+ * from the skip list is done via the stored node reference in the task struct+ * and does not require a full look up. Thus it occurs in O(k) time where k+ * is the "level" of the list the task was stored at - usually < 4, max 16. */ static void dequeue_task(struct task_struct *p) {- list_del_init(&p->run_list);- if (list_empty(grq.queue + p->prio))- __clear_bit(p->prio, grq.prio_bitmap);+ skiplist_delnode(grq.node, grq.sl, p->node);+ p->node = NULL; } /*@@ -680,29 +684,56 @@ static int isoprio_suitable(void) return !grq.iso_refractory; } +static inline int task_sticky(struct task_struct *p);+static inline int longest_deadline_diff(void);+ /* * Adding to the global runqueue. Enter with grq locked. */ static void enqueue_task(struct task_struct *p) {+ u64 sl_id;+ if (!rt_task(p)) { /* Check it hasn't gotten rt from PI */ if ((idleprio_task(p) && idleprio_suitable(p)) ||- (iso_task(p) && isoprio_suitable()))+ (iso_task(p) && isoprio_suitable())) { p->prio = p->normal_prio;- else+ } else p->prio = NORMAL_PRIO; }- __set_bit(p->prio, grq.prio_bitmap);- list_add_tail(&p->run_list, grq.queue + p->prio);+ /*+ * The sl_id key passed to the skiplist generates a sorted list.+ * Realtime and sched iso tasks run FIFO so they only need be sorted+ * according to priority. The skiplist will put tasks of the same+ * key inserted later in FIFO order. Tasks of sched normal, batch+ * and idleprio are sorted according to their deadlines. Idleprio+ * tasks are offset by an impossibly large deadline value ensuring+ * they get sorted into last positions, but still according to their+ * own deadlines. This creates a "landscape" of skiplists running+ * from priority 0 realtime in first place to the lowest priority+ * idleprio tasks last. Skiplist insertion is an O(log n) process.+ */+ if (p->prio <= ISO_PRIO)+ sl_id = p->prio;+ else {+ sl_id = p->deadline;+ /* We offset the deadline here for sticky tasks. During+ * lookup, the sticky task for the CPU in question is checked+ * to see what its real deadline would be */+ if (task_sticky(p))+ sl_id += longest_deadline_diff();+ if (p->prio == IDLE_PRIO)+ sl_id |= 0xF000000000000000;+ }+ p->node = skiplist_insert(grq.node, grq.sl, sl_id, p, grq.niffies); sched_info_queued(p); } /* Only idle task does this as a real time task*/ static inline void enqueue_task_head(struct task_struct *p) {- __set_bit(p->prio, grq.prio_bitmap);- list_add(&p->run_list, grq.queue + p->prio);+ p->node = skiplist_insert(grq.node, grq.sl, (u64)p->prio, p, grq.niffies); sched_info_queued(p); } @@ -1111,7 +1142,7 @@ static inline void unstick_task(struct r * Move a task off the global queue and take it to a cpu for it will * become the running task. */-static inline void take_task(struct rq *rq, struct task_struct *p)+static void take_task(struct rq *rq, struct task_struct *p) { set_task_cpu(p, cpu_of(rq)); dequeue_task(p);@@ -1681,8 +1712,8 @@ void sched_fork(struct task_struct *p) * Make sure we do not leak PI boosting priority to the child. */ p->prio = curr->normal_prio;+ p->node = NULL; - INIT_LIST_HEAD(&p->run_list); #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) if (unlikely(sched_info_on())) memset(&p->sched_info, 0, sizeof(p->sched_info));@@ -2903,90 +2934,42 @@ static inline void check_deadline(struct } /*- * O(n) lookup of all tasks in the global runqueue. The real brainfuck- * of lock contention and O(n). It's not really O(n) as only the queued,- * but not running tasks are scanned, and is O(n) queued in the worst case- * scenario only because the right task can be found before scanning all of- * them.- * Tasks are selected in this order:- * Real time tasks are selected purely by their static priority and in the- * order they were queued, so the lowest value idx, and the first queued task- * of that priority value is chosen.- * If no real time tasks are found, the SCHED_ISO priority is checked, and- * all SCHED_ISO tasks have the same priority value, so they're selected by- * the earliest deadline value.- * If no SCHED_ISO tasks are found, SCHED_NORMAL tasks are selected by the- * earliest deadline.- * Finally if no SCHED_NORMAL tasks are found, SCHED_IDLEPRIO tasks are- * selected by the earliest deadline.- */+ * Task selection with skiplists is a simple matter of picking off the first+ * task in the sorted list, an O(1) operation. The only time it takes longer+ * is if tasks do not have suitable affinity and then we iterate over entries+ * till we find the first that does. Worst case here is no tasks with suitable+ * affinity and taking O(n). */ static inline struct task_struct *earliest_deadline_task(struct rq *rq, struct task_struct *idle) {- u64 dl, earliest_deadline = 0; /* Initialise to silence compiler */- struct task_struct *p, *edt = idle;+ struct task_struct *edt = idle, *rqs = rq->sticky_task;+ skiplist_node *node = grq.node; unsigned int cpu = cpu_of(rq);- struct list_head *queue;- int idx = 0; -retry:- idx = find_next_bit(grq.prio_bitmap, PRIO_LIMIT, idx);- if (idx >= PRIO_LIMIT)- goto out;- queue = grq.queue + idx;-- if (idx < MAX_RT_PRIO) {- /* We found an rt task */- list_for_each_entry(p, queue, run_list) {- /* Make sure cpu affinity is ok */- if (needs_other_cpu(p, cpu))- continue;- edt = p;- goto out_take;- }- /* None of the RT tasks at this priority can run on this cpu */- ++idx;- goto retry;- }+ while ((node = node->next[0]) != grq.node) {+ struct task_struct *slp = node->value; - list_for_each_entry(p, queue, run_list) {- /* Make sure cpu affinity is ok */- if (needs_other_cpu(p, cpu))+ /* Make sure affinity is ok */+ if (needs_other_cpu(slp, cpu)) continue; - /*- * Soft affinity happens here by not scheduling a task with- * its sticky flag set that ran on a different CPU last when- * the CPU is scaling, or by greatly biasing against its- * deadline when not.- */- if (task_rq(p) != rq && task_sticky(p)) {- if (scaling_rq(rq))- continue;- else- dl = p->deadline + longest_deadline_diff();- } else- dl = p->deadline;+ /* FIXME: Do something here for sticky tasks and scaling+ * cpu frequency governors */ - /*- * No rt tasks. Find the earliest deadline task. Now we're in- * O(n) territory. This is what we silenced the compiler for:- * edt will always start as idle.- */- if (edt == idle ||- deadline_before(dl, earliest_deadline)) {- earliest_deadline = dl;- edt = p;- }+ edt = slp;+ break; }- if (edt == idle) {- if (++idx < PRIO_LIMIT)- goto retry;- goto out;++ if (!rt_task(edt) && rqs) {+ /* Check the sticky task for this CPU isn't a better choice+ * than the task returned by the skiplist since the sticky+ * task will have its deadline offset when being inserted */+ if (rqs != edt && task_queued(rqs) &&+ rqs->deadline - longest_deadline_diff() < edt->deadline)+ edt = rqs; }-out_take:- take_task(rq, edt);-out:+ if (edt != idle)+ take_task(rq, edt); return edt; } @@ -6832,6 +6815,9 @@ void __init sched_init(void) raw_spin_lock_init(&grq.iso_lock); grq.iso_ticks = grq.iso_refractory = 0; grq.noc = 1;+ grq.node = skiplist_init();+ grq.sl = new_skiplist(grq.node);+ #ifdef CONFIG_SMP init_defrootdomain(); grq.qnr = grq.idle_cpus = 0;@@ -6889,11 +6875,6 @@ void __init sched_init(void) } #endif - for (i = 0; i < PRIO_LIMIT; i++)- INIT_LIST_HEAD(grq.queue + i);- /* delimiter for bitsearch */- __set_bit(PRIO_LIMIT, grq.prio_bitmap);- #ifdef CONFIG_PREEMPT_NOTIFIERS INIT_HLIST_HEAD(&init_task.preempt_notifiers); #endifIndex: linux-3.0.0-ck1/kernel/skip_lists.c===================================================================--- /dev/null 1970-01-01 00:00:00.000000000 +0000+++ linux-3.0.0-ck1/kernel/skip_lists.c 2011-09-23 23:21:36.760045313 +1000@@ -0,0 +1,159 @@+/*+ Copyright (C) 2011 Con Kolivas.++ Code based on example originally by William Pugh.++Skip Lists are a probabilistic alternative to balanced trees, as+described in the June 1990 issue of CACM and were invented by+William Pugh in 1987.++A couple of comments about this implementation:+The routine randomLevel has been hard-coded to generate random+levels using p=0.25. It can be easily changed.++The insertion routine has been implemented so as to use the+dirty hack described in the CACM paper: if a random level is+generated that is more than the current maximum level, the+current maximum level plus one is used instead.++Levels start at zero and go up to MaxLevel (which is equal to+ (MaxNumberOfLevels-1).++The routines defined in this file are:++init: defines slnode++new_skiplist: returns a new, empty list++randomLevel: Returns a random level based on a u64 random seed passed to it.+In BFS, the "niffy" time is used for this purpose.++insert(l,key, value): inserts the binding (key, value) into l. This operation+occurs in O(log n) time.++delnode(slnode, l, node): deletes any binding of key from the l based on the+actual node value. This operation occurs in O(k) time where k is the+number of levels of the node in question (max 16). The original delete+function occurred in O(log n) time and involved a search.++BFS Notes: In this implementation of skiplists, there are bidirectional+next/prev pointers and the insert function returns a pointer to the actual+node the value is stored. The key here is chosen by the scheduler so as to+sort tasks according to the priority list requirements and is no longer used+by the scheduler after insertion. The scheduler lookup, however, occurs in+O(1) time because it is always the first item in the level 0 linked list.+Since the task struct stores a copy of the node pointer upon skiplist_insert,+it can also remove it much faster than the original implementation with the+aid of prev<->next pointer manipulation and no searching.++*/++#include <linux/slab.h>+#include <linux/sched.h>+#include <linux/skip_lists.h>++#define MaxNumberOfLevels 16+#define MaxLevel (MaxNumberOfLevels - 1)+#define newNode (skiplist_node *)kmalloc(sizeof(struct nodeStructure), GFP_ATOMIC)++skiplist_node *skiplist_init(void)+{+ skiplist_node *slnode;+ int i;++ slnode = newNode;+ BUG_ON(!slnode);+ slnode->key = 0xFFFFFFFFFFFFFFFF;+ slnode->level = 0;+ slnode->value = NULL;+ for (i = 0; i < MaxNumberOfLevels; i++)+ slnode->next[i] = slnode->prev[i] = slnode;+ return slnode;+}++skiplist *new_skiplist(skiplist_node *slnode)+{+ skiplist *l;++ l = (skiplist *)kmalloc(sizeof(struct listStructure), GFP_ATOMIC);+ BUG_ON(!l);+ l->level = 0;+ l->header = slnode;+ return l;+}++void free_skiplist(skiplist_node *slnode, skiplist *l)+{+ skiplist_node *p, *q;++ p = l->header;+ do {+ q = p->next[0];+ p->next[0]->prev[0] = q->prev[0];+ kfree(p);+ p = q;+ } while (p != slnode);+ kfree(l);+}++static inline int randomLevel(u64 randseed)+{+ int level = 0;++ while (randseed && !(randseed & 3)) {+ randseed >>= 2;+ level++;+ }+ return (level > MaxLevel ? MaxLevel : level);+}++skiplist_node *skiplist_insert(skiplist_node *slnode, skiplist *l, keyType key, valueType value, u64 randseed)+{+ int k;+ skiplist_node *update[MaxNumberOfLevels];+ skiplist_node *p, *q;++ k = l->level;+ p = slnode;+ do {+ while (q = p->next[k], q->key <= key)+ p = q;+ update[k] = p;+ } while (--k >= 0);++ k = randomLevel(randseed);+ if (k > l->level) {+ k = ++l->level;+ update[k] = slnode;+ }++ q = newNode;+ q->level = k;+ q->key = key;+ q->value = value;+ do {+ p = update[k];+ q->next[k] = p->next[k];+ p->next[k] = q;+ q->prev[k] = p;+ q->next[k]->prev[k] = q;+ } while (--k >= 0);+ return q;+}++void skiplist_delnode(skiplist_node *slnode, skiplist *l, skiplist_node *node)+{+ int k, m;++ m = node->level;+ for (k = 0; k <= m; k++) {+ node->prev[k]->next[k] = node->next[k];+ node->next[k]->prev[k] = node->prev[k];+ }+ kfree(node);+ if (m == l->level) {+ while (l->header->next[m] == slnode && l->header->prev[m] == slnode && m > 0)+ m--;+ l->level = m;+ }+}Index: linux-3.0.0-ck1/include/linux/init_task.h===================================================================--- linux-3.0.0-ck1.orig/include/linux/init_task.h 2011-09-23 23:20:55.506045319 +1000+++ linux-3.0.0-ck1/include/linux/init_task.h 2011-09-23 23:21:36.760045313 +1000@@ -145,7 +145,7 @@ extern struct cred init_cred; .cpus_allowed = CPU_MASK_ALL, \ .mm = NULL, \ .active_mm = &init_mm, \- .run_list = LIST_HEAD_INIT(tsk.run_list), \+ .node = NULL, \ .time_slice = HZ, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \ INIT_PUSHABLE_TASKS(tsk) \Index: linux-3.0.0-ck1/include/linux/skip_lists.h===================================================================--- /dev/null 1970-01-01 00:00:00.000000000 +0000+++ linux-3.0.0-ck1/include/linux/skip_lists.h 2011-09-23 23:22:22.769045306 +1000@@ -0,0 +1,26 @@+#ifndef _LINUX_SKIP_LISTS_H+#define _LINUX_SKIP_LISTS_H+typedef u64 keyType;+typedef struct task_struct *valueType;++typedef struct nodeStructure skiplist_node;++struct nodeStructure {+ int level; /* Levels in this structure */+ keyType key;+ valueType value;+ skiplist_node *next[16];+ skiplist_node *prev[16];+};++typedef struct listStructure {+ int level; /* Maximum level of the list+ (1 more than the number of levels in the list) */+ struct nodeStructure * header; /* pointer to header */+} skiplist;++skiplist_node *skiplist_init(void);+skiplist *new_skiplist(skiplist_node *slnode);+skiplist_node *skiplist_insert(skiplist_node *slnode, skiplist *l, keyType key, valueType value, u64 randseed);+void skiplist_delnode(skiplist_node *slnode, skiplist *l, skiplist_node *node);+#endif /* _LINUX_SKIP_LISTS_H */-- -ck
https://lkml.org/lkml/2011/9/23/371
CC-MAIN-2014-15
refinedweb
2,504
57.37
Timothy Larson wrote: > Explanation of Aggregate/Struct differences > --- Marc Portier <mpo@outerthought.org> wrote: > >>>>>> - still doubthing if struct is so much more different then aggregate > > > > We have values and we have widgets, but they are not always matched 1-to-1. > Looking at the *values* in an aggregate we find a solitary value and > (because it acts as a container for field widgets) an ordered list of values. > The fact that these are all contained in one widget can be viewed as a nice > syntactic sugar, making it easier to express the specialized dependency logic > (merged-value/split-children-values) between the solitary value and the > ordered list of values. When cforms get full support for (easilly) > expressing dependencies between widgets, we could (at least in theory) split > up the aggregate widget by allowing the solitary value and the list of values > to be placed whereever we wish, such as in separate, otherwise unrelated, > widgets. This flexibility may in some cases allow for a more direct mapping > between the form and the back end data. > yeah like have a getValue on the parent level produce a Map of the nested child-values? > A "struct" widget looks somewhat like an aggregate, because it contains an > ordered list of widgets, but is actually quite different. It does not > contain a separate solitary value, does not implicitely express dependencies, > and is not constrained to only containing field widgets. That being said, > if we chose to break up the aggregate widget as described above I think it > would be common to use a "struct" widget to contain the list of values, via > containing a list of field widgets. If we adopt such a design, then we would > no longer require (but might still want for the nice syntax it supports?) a > separate AggregateField widget type. > > Note that the "struct" widget type has other uses; in fact its use related > to aggregate functionality was an afterthought. Struct widgets allow a list > of widgets to be place where usually only one widget is supported, such as > in a union case (look at UnionDefinition.java in the formmodel). They also, > probably more importantly, allow to namespace a collections of widgets which > would otherwise have conflicting fully qualified id's. > For example (pseudocode): hm I would of have prefered a distinct @id, @type and @name... wd:new/@id seems to do two things: reference the class and set the widget-id I would of have expected something like wd:class/@type (and NO @id here) while the wd:new/@id would set that independantly of a wd:new/@name refering to the @type of the wd:class it depends upon I suppose this current setup has to do with how widgets consume themselves the request-parameters given to them? Have to think some more about this one... > <struct id="manager"> <new id="person-class"/> </struct> > <struct id="underling"> <new id="person-class"/> </struct> > <class id="person-class"> > <field id="employeeid"/> > <field id="firstname"/> <field id="middlename"/> <field id="lastname"/> > <!-- And a bunch of widgets to support query-by-example employee lookup --> > </class> with the new attributes proposed that would allow: <new name="person-class" id="manager" /> <new name="person-class" id="underling" /> <class type="person-class"> <field id="employeeid" /> <field id="firstname" /> </class> at which time we have reduced the need for struct seperate from class? and to the builders this becomes: <class-struct a normal struct <class-struct a normal class (so the struct-builder would need to do an addClass towards the classResolver) <class-struct a class that is immediately 'used' (so a combination of class and new in one? taking it one step further: why not allow a @type on all widgets we currently have, so they can automatically be cloned/'used' more then once? looking at it from this angle the use/reuse realm seems to be a different dimension then the structuring/definition one, no? wdyt? maybe again some light shining from the XMLSchema and the likes corner? > Without the namespaces ("manager" and "underling") that the struct widget > provides, we could not reuse the "person-class" for both people because the > widgets "employeeid", "firstname", etc. would have the same fully qualified > id's for both people, causing the form definition to fail to be loaded on > account of duplicate widget id errors. > > Do the use case for the struct widget and the differences between a struct > and an aggregate make more sense now? > > --Tim Larson > > > __________________________________ > Do you Yahoo!? > Find out what made the Top Yahoo! Searches of 2003 > -marc= -- Marc Portier Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at mpo@outerthought.org mpo@apache.org
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200401.mbox/%3C3FF9F4BD.7030104@outerthought.org%3E
CC-MAIN-2014-52
refinedweb
777
56.49
You can subscribe to this list here. Showing 2 results of 2 >> This would be hard to do with the current system. But it should >> become easier after I make some of the architectural changes I mentioned. > > Is there anything written about this new architecture that I could > review? It's pretty preliminary right now. Once I get a little further along, I'll write up a description/explanation, but right now I'm trying to figure out exactly how I want it to look. Some of the motivations behind it are... - better support for extracting docs via source code parsing - plug-in support for extending epydoc (eg there will be a zope plug-in that handles zope interfaces, etc.) - more consistent & flexible handling of object names. At some point, I should write up a description & an an explination of what's motivating it, but I haven't had a chance yet. I just checked some of my preliminary work in to cvs: epydoc/sandbox/epydoc3/epydoc/* But at this point, it doesn't do much. > Is there an ETA? At least a month, maybe more. (I don't get as much time to work on epydoc as I'd like). > And if I decide that I am insane enough > <wink!> to try and implement the above feature on the current system do > you have any suggestions for how to go about doing it? So basically you want some of the imported objects (eg wx.core.Window) to be treated as if they were defined locally. But I'm sure you don't want *all* imported objects to be listed as if they're defined locally. So epydoc needs some information source to decide which imported objects it should pretend are defined locally. One option is to use __all__. In particular, any imported objects listed in __all__ will be treated as if they were defined locally. Another option is to define a new field for the module docstring, that declares that an object should be treated as if it was defined locally. Something like "@local: Window", although I'm not crazy about that name. In either case, you would modify ModuleDoc.__init__ and ModuleDoc._find_imported_variables, to treat the desired values as non-imported (i.e., add them to self._x instead of self._imported_x). -Edward Edward Loper wrote: > Robin Dunn wrote: > [...] >> * Using the new wx package several of the core submodules are imported >> into the package namespace so the programmer doesn't have to worry >> about explicitly importing those submodules. For example, instead of >> using wx.core.Window the programmer will just use wx.Window. Is there >> any trick you can think of to make epydoc document the objects in >> those submodules as if they were actually in wx itself? That way the >> reader of the docs still won't have to know anything about the >> implementation details and the docs will accurately reflect how it is >> supposed to be used. > > > This would be hard to do with the current system. But it should become > easier after I make some of the architectural changes I mentioned. Hi Edward, Is there anything written about this new architecture that I could review? Is there an ETA? And if I decide that I am insane enough <wink!> to try and implement the above feature on the current system do you have any suggestions for how to go about doing it? -- Robin Dunn Software Craftsman Java give you jitters? Relax with wxPython!
http://sourceforge.net/p/epydoc/mailman/epydoc-devel/?viewmonth=200404&viewday=23
CC-MAIN-2014-42
refinedweb
578
67.04
Why are you starting at 0, start where the camera starts and end where the camera ends. Just draw whatever the camera shows us regardless of what that is. Then get rid of the range check you don't need that, the range check was shrinking the view on you. To ensure that the camera doesn't draw anything out of range make certain the camera position can never stray beyond the defined range, 1000X1000 in your case. edit: In the camera's case the range is (0,0) and (1000-width,1000-height). public class Camera { public void SetLoc(Point pt) { if(X_&&_Y_in_range) { this.X = pt.X; this.Y = pt.Y; } else if(X_is_too_small) { this.X = 0 this.Y = pt.Y } ... Yada Yada Yada... }
http://www.gamedev.net/index.php?app=forums&module=extras&section=postHistory&pid=5023020
CC-MAIN-2014-52
refinedweb
126
84.68
The basic unit of programming is the function. You build your program one function (or method) at a time. The smallest thing you can test in a unit test is a function. A function is also the smallest piece of code you can name and hence create a new abstraction. The whole point of a function is to encapsulate some piece of code and make it available to the rest of your program or other programs in a library. A function signature includes the function name, its arguments, and in some languages, the return type. There are several other elements that may be present such as exception specification and various qualifiers (especially for class methods). Not all programming languages support all elements. Python always returns an object from every function, so the return type is not specified in the signature: def add(a, b): pass C specifies the return type and the type of each argument: int add(int a, int b); Java has no standalone functions, but its methods can specify what exceptions might be thrown: public class A { public int add(int a, int b) throws Exception { ... } } C# may include generic types in the signature: public class A { public T add<T> (T number1, T number2) } A function signature can tell you a lot about the behavior of the function, but never everything. For example, you may figure that an add() function that takes two integers and returns another integer adds its two parameters and returns the sum. You may even be correct, but you still don't know everything. How much memory does the function use? How fast is it? What other resources is it using? What happens if you pass the wrong type of argument? Is there a valid range to the arguments? For example, for dynamically typed languages, such as Python that don't specify the type of argument or return value you may pass any representation of numbers: int, float decimal, string. In case of an integer overflow, Python may let the exception propagate or handle it internally and convert the result to a float or Decimal. In all languages the function may use a memory cache to look up the result of previous calls or log every call to a database or a remote log service. It may even invoke some Web service to do the work. To really understand what a function does requires a contract. A contract specifies exactly all these details. A complete contract can't be specified in any programming languages, although some languages go further than others. Eiffel has coined the term "design by contract" and has built-in support for the notion of pre-conditions, invariants and post-conditions, but full-fledged contacts are much more than that. Documentation may be fine for humans, but can't be verified automatically in general. Pure functions are functions that don't allocate or use any resources and given the same arguments will always return the same result. If you use primarily pure functions then you can eliminate whole categories of behavior, but it's still not a panacea in the general case. Your function signature is the main portal of your function to the rest of the program. Many potential callers care mostly about the arguments they pass in because they may continue to use them when the function returns. For example, if a function modifies an argument the caller needs to know that. Consider the following signature in C: void mystery(int * x); The "mystery" function may modify its "x" argument. To avoid surprises, try to restrict the ability of your function to do "damage". In languages that support it, use immutable specifiers like "const." Avoid pointers and non-const references when possible. If you accept multiple arguments with certain dependencies, consider creating a dedicated object that can verify itself (the caller can't pass invalid combination of arguments). Designing and building software is hard. The function signature is often considered as a description of what a function does, but that far from being accurate, even if you throw in contracts and documentation. But, all is not lost. By paying attention to your function signature, utilizing language features where possible and using immutable data structures and pure functions you can get pretty far. Well-designed functions are also easier to test, which provide the last piece in the puzzle of building software that works as intended. Advertiser Disclosure:
http://www.devx.com/opensource/programming-basics-the-function-signature.html
CC-MAIN-2020-29
refinedweb
740
62.07
Python Sets and Set Theory Sets vs Lists and Tuples. Advantages of Python Sets Because sets cannot have multiple occurrences of the same element, it makes sets highly useful to efficiently remove duplicate values from a list or tuple and to perform common math operations like unions and intersections. If you'd like to sharpen your Python skills, or you're just a beginner, be sure to take a look at our Python Programmer career track on DataCamp. This tutorial will introduce you a few topics about Python sets and set theory: How to initialize empty sets and sets with values. How to add and remove values from sets How to use efficiently use sets for tasks such as membership tests and removing duplicate values from a list. How to perform common set operations like unions, intersections, difference, and symmetric difference. The difference between a set and a frozenset With that, let's get started. Initialize a Set Sets are a mutable collection of distinct (unique) immutable values that are unordered. You can initialize an empty set by using set(). emptySet = set() To intialize a set with values, you can pass in a list to set(). dataScientist = set(['Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS']) dataEngineer = set(['Python', 'Java', 'Scala', 'Git', 'SQL', 'Hadoop']) If you look at the output of dataScientist and dataEngineer variables above, notice that the values in the set are not in the order added in. This is because sets are unordered. Sets containing values can also be initialized by using curly braces. dataScientist = {'Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS'} dataEngineer = {'Python', 'Java', 'Scala', 'Git', 'SQL', 'Hadoop'} Keep in mind that curly braces can only be used to initialize a set containing values. The image below shows that using curly braces without values is one of the ways to initialize a dictionary and not a set. Add and Remove Values from Sets To add or remove values from a set, you first have to initialize a set. # Initialize set with values graphicDesigner = {'InDesign', 'Photoshop', 'Acrobat', 'Premiere', 'Bridge'} Add Values to a Set You can use the method add to add a value to a set. graphicDesigner.add('Illustrator') In is important to note that you can only add a value that is immutable (like a string or a tuple) to a set. For example, you would get a TypeError if you try to add a list to a set. graphicDesigner.add(['Powerpoint', 'Blender']) Remove Values from a Set There are a couple ways to remove a value from a set. Option 1: You can use the remove method to remove a value from a set. graphicDesigner.remove('Illustrator') The drawback of this method is that if you try to remove a value that is not in your set, you will get a KeyError. Option 2: You can use the discard method to remove a value from a set. graphicDesigner.discard('Premiere') The benefit of this approach over the remove method is if you try to remove a value that is not part of the set, you will not get a KeyError. If you are familiar with dictionaries, you might find that this works similarly to the dictionary method get. Option 3: You can also use the pop method to remove and return an arbitrary value from a set. graphicDesigner.pop() It is important to note that the method raises a KeyError if the set is empty. Remove All Values from a Set You can use the clear method to remove all values from a set. graphicDesigner.clear() Iterate through a Set Like many standard python data types, it is possible to iterate through a set. # Initialize a set dataScientist = {'Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS'} for skill in dataScientist: print(skill) If you look at the output of printing each of the values in dataScientist, notice that the values printed in the set are not in the order they were added in. This is because sets are unordered. Transform Set into Ordered Values This tutorial has emphasized that sets are unordered. If you find that you need to get the values from your set in an ordered form, you can use the sorted function which outputs a list that is ordered. type(sorted(dataScientist)) The code below outputs the values in the set dataScientist in descending alphabetical order (Z-A in this case). sorted(dataScientist, reverse = True) Remove Duplicates from a List Part of the content in this section was previously explored in the tutorial 18 Most Common Python List Questions, but it is important to emphasize that sets are the fastest way to remove duplicates from a list. To show this, let's study the performance difference between two approaches. Approach 1: Use a set to remove duplicates from a list. print(list(set([1, 2, 3, 1, 7]))) Approach 2: Use a list comprehension to remove duplicates from a list (If you would like a refresher on list comprehensions, see this tutorial). def remove_duplicates(original): unique = [] [unique.append(n) for n in original if n not in unique] return(unique) print(remove_duplicates([1, 2, 3, 1, 7])) The performance difference can be measured using the the timeit library which allows you to time your Python code. The code below runs the code for each approach 10000 times and outputs the overall time it took in seconds. import timeit # Approach 1: Execution time print(timeit.timeit('list(set([1, 2, 3, 1, 7]))', number=10000)) # Approach 2: Execution time print(timeit.timeit('remove_duplicates([1, 2, 3, 1, 7])', globals=globals(), number=10000)) Comparing these two approaches shows that using sets to remove duplicates is more efficient. While it may seem like a small difference in time, it can save you a lot of time if you have very large lists. Set Operation Methods A common use of sets in Python is computing standard math operations such as union, intersection, difference, and symmetric difference. The image below shows a couple standard math operations on two sets A and B. The red part of each Venn diagram is the resulting set of a given set operation. Python sets have methods that allow you to perform these mathematical operations as well as operators that give you equivalent results. Before exploring these methods, let's start by initializing two sets dataScientist and dataEngineer. dataScientist = set(['Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS']) dataEngineer = set(['Python', 'Java', 'Scala', 'Git', 'SQL', 'Hadoop']) union A union, denoted dataScientist ∪ dataEngineer, is the set of all values that are values of dataScientist, or dataEngineer, or both. You can use the union method to find out all the unique values in two sets. # set built-in function union dataScientist.union(dataEngineer) # Equivalent Result dataScientist | dataEngineer The set returned from the union can be visualized as the red part of the Venn diagram below. intersection An intersection of two sets dataScientist and dataEngineer, denoted dataScientist ∩ dataEngineer, is the set of all values that are values of both dataScientist and dataEngineer. # Intersection operation dataScientist.intersection(dataEngineer) # Equivalent Result dataScientist & dataEngineer The set returned from the intersection can be visualized as the red part of the Venn diagram below. You may find that you come across a case where you want to make sure that two sets have no value in common. In order words, you want two sets that have an intersection that is empty. These two sets are called disjoint sets. You can test for disjoint sets by using the isdisjoint method. # Initialize a set graphicDesigner = {'Illustrator', 'InDesign', 'Photoshop'} # These sets have elements in common so it would return False dataScientist.isdisjoint(dataEngineer) # These sets have no elements in common so it would return True dataScientist.isdisjoint(graphicDesigner) You can notice in the intersection shown in the Venn diagram below that the disjoint sets dataScientist and graphicDesigner have no values in common. difference A difference of two sets dataScientist and dataEngineer, denoted dataScientist \ dataEngineer, is the set of all values of dataScientist that are not values of dataEngineer. # Difference Operation dataScientist.difference(dataEngineer) # Equivalent Result dataScientist - dataEngineer The set returned from the difference can be visualized as the red part of the Venn diagram below. symmetric_difference A symmetric difference of two sets dataScientist and dataEngineer, denoted dataScientist △ dataEngineer, is the set of all values that are values of exactly one of two sets, but not both. # Symmetric Difference Operation dataScientist.symmetric_difference(dataEngineer) # Equivalent Result dataScientist ^ dataEngineer The set returned from the symmetric difference can be visualized as the red part of the Venn diagram below. Set Comprehension You may have previously have learned about list comprehensions, dictionary comprehensions, and generator comprehensions. There is also set comprehensions. Set comprehensions are very similar. Set comprehensions in Python can be constructed as follows: {skill for skill in ['SQL', 'SQL', 'PYTHON', 'PYTHON']} The output above is a set of 2 values because sets cannot have multiple occurences of the same element. The idea behind using set comprehensions is to let you write and reason in code the same way you would do mathematics by hand. {skill for skill in ['GIT', 'PYTHON', 'SQL'] if skill not in {'GIT', 'PYTHON', 'JAVA'}} The code above is similar to a set difference you learned about earlier. It just looks a bit different. Membership Tests Membership tests check whether a specific element is contained in a sequence, such as strings, lists, tuples, or sets. One of the main advantages of using sets in Python is that they are highly optimized for membership tests. For example, sets do membership tests a lot more efficiently than lists. In case you are from a computer science background, this is because the average case time complexity of membership tests in sets are O(1) vs O(n) for lists. The code below shows a membership test using a list. # Initialize a list possibleList = ['Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS', 'Java', 'Spark', 'Scala'] # Membership test 'Python' in possibleList Something similar can be done for sets. Sets just happen to be more efficient. # Initialize a set possibleSet = {'Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS', 'Java', 'Spark', 'Scala'} # Membership test 'Python' in possibleSet Since possibleSet is a set and the value 'Python' is a value of possibleSet, this can be denoted as 'Python' ∈ possibleSet. If you had a value that wasn't part of the set, like 'Fortran', it would be denoted as 'Fortran' ∉ possibleSet. Subset A practical application of understanding membership is subsets. Let's first initialize two sets. possibleSkills = {'Python', 'R', 'SQL', 'Git', 'Tableau', 'SAS'} mySkills = {'Python', 'R'} If every value of the set mySkills is also a value of the set possibleSkills, then mySkills is said to be a subset of possibleSkills, mathematically written mySkills ⊆ possibleSkills. You can check to see if one set is a subset of another using the method issubset. mySkills.issubset(possibleSkills) Since the method returns True in this case, it is a subset. In the Venn diagram below, notice that every value of the set mySkills is also a value of the set possibleSkills. Frozensets You have have encountered nested lists and tuples. # Nested Lists and Tuples nestedLists = [['the', 12], ['to', 11], ['of', 9], ['and', 7], ['that', 6]] nestedTuples = (('the', 12), ('to', 11), ('of', 9), ('and', 7), ('that', 6)) The problem with nested sets is that you cannot normally have nested sets as sets cannot contain mutable values including sets. This is one situation where you may wish to use a frozenset. A frozenset is very similar to a set except that a frozenset is immutable. You make a frozenset by using frozenset(). # Initialize a frozenset immutableSet = frozenset() You can make a nested set if you utilize a frozenset similar to the code below. nestedSets = set([frozenset()]) It is important to keep in mind that a major disadvantage of a frozenset is that since they are immutable, it means that you cannot add or remove values. Conclusion The Python sets are highly useful to efficiently remove duplicate values from a collection like a list and to perform common math operations like unions and intersections. Some of the challenges people often encounter are when to use the various data types. For example, if you feel like you aren't sure when it is advantageous to use a dictionary versus a set, I encourage you to check out DataCamp's daily practice mode. If you any questions or thoughts on the tutorial, feel free to reach out in the comments below or through Twitter.
https://www.datacamp.com/community/tutorials/sets-in-python
CC-MAIN-2019-26
refinedweb
2,064
60.24
Stefano, Ovidiu, thanks for the comments. > RE: Cooperation, Visibility, Alphaworks Maybe I ought to explain what my intentions are. I'm involved in the W3C Device Independence Working Group who've just produced a principles document that may be of interest to you - see. So one of my aims is to demonstrate how ideas from the W3C translate into real technology. Secondly I'm concious although the CC/PP and UAProf specifications have been around for a while, currently there is a "which comes first chicken or egg" situation as browsers won't support it until servers do and vice-versa. So DELI is an attempt to "seed" these standards. I'm hoping we have mutual interests? DELI is released under a BSD-type license so hopefully this shouldn't cause any problems. One issue is whether we fork DELI to include it with C2 or it exists as a plug-in. This might be advantageous as then it could be incorporated into other projects e.g. Jetspeed. Any thoughts? > RE: Incorporating DELI Stefano, Ovidiu, firstly thanks for your suggestions. Here's a quick summary plus a few suggestions of my own. I'd be interested in any feedback / > 1. (Stefano) a sitemap selector that connects to DELI Yes, good idea. > 2. (Stefano) produce DELITransformer that augments browser > information to a particular namespace and adds it to the XML > file being processed. Good suggestion. In an ideal world the appended profile would be in standard profile serialisation rather than a special DELITransformer serialisation. However this is difficult because a) it's hard to process XML serialisations of RDF using XSLT e.g. attributes and elements are interchangeable b) the current DELI implementation "cheats" as it takes the profiles and converts them from an XML serialisation of RDF to it's own internal data structure. This was necessary because UAProf uses order dependent resolution rules but there is no concept of document order in RDF. Therefore implementing the UAProf resolution rules using an RDF processor is difficult! It could convert this back to XML, I'm just concerned about the efficiency of this approach so I might have to rethink how DELI does merging / profile resolution. Currently I'm thinking about solutions to these problems, but they are dependent to the structure / syntax of CC/PP. One (controversial) way would be for CC/PP and UAProf to use XML rather than RDF. Then you could just add the resolved profile to the XML file being processed. Alternatively, there may be a way of using a subset of the RDF XML serialisation syntax in CC/PP so it is can be processed either via XML or RDF processors. Then DELI could just use an XML processor (solving the resolution problem) and the profiles could be queried by XSLT. Both solutions would require some changes to the specs so would mean convincing the W3C / WAP Forum though. Please note this isn't intended as a criticism of your suggestion - I'm just thinking aloud as I'd be interested in hearing your thoughts? Unfortunately both the CC/PP and UAProf working groups are trying to freeze their specs so they aren't keen on discussing issues like this at the moment. > 3. (Ovidiu) take a similar approach to BrowserImpl.xml > by passing browser information as a DOM tree. An XSLT > stylesheet can then use simple matching to obtain browser > capabilities. I had a quick look at this code before. Currently I'm not sure how to deal with multi-value parameters e.g. SEQs and BAGs. Any suggestions? > 4. (Ovidiu) Using approach 3) provide some standard stylesheets that can transform (a subset of) XHTML to devices using profile information. Yes, although obviously best to get 3) to work first. Then my suggestions are: 5. Provide a simple way of performing conditional inclusion in the XML or XHTML content based on the profile information. So instead of having an image with alt text, you could multiple versions of resource associated with profile conditionals indicating when each version should be used. Morphis uses an approach a bit like this in its WAX language (see). For example you might want to express: if small screen (phone) then include nothing if voice browser then include voice_menu (only read if user presses hash) if medium screen (pda) then include icon_menu if large screen (pc) then include full_menu Note here devices are not simply split into "device classes" (e.g. phone, pda, PC) rather we are providing alternates that can be selected using multiple "axes of negotiation" i.e screen size, sound capabilities, image capabilities, input capabilities etc. Axes of negotiation is a concept taken from the HTTP/1.1 spec. This would demonstrate some of the device independence techniques I've been thinking about. 6. Add an image transcoder that can use profile information e.g. adapts the image based on mime-type and screen size information. > Stefano writes: > Well, if you want to do what you just proposed to integrate > Mark's work, I'll be +1 on that. I've got time to put in the integration as well, but I'm a totally newbie to Cocoon-dev so any advice is greatly appreciated. cheers Mark Butler Research Scientist HP Labs --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200111.mbox/%3C5E13A1874524D411A876006008CD059F031A12F3@0-mail-1.hpl.hp.com%3E
CC-MAIN-2015-32
refinedweb
895
55.03
To create an on-demand Dask cluster attached to a Domino Workspace, click New Workspace from the Workspaces menu. On the Launch New Workspace dialog select the Compute Cluster step. Specify the desired cluster settings and launch your workspace. Once the workspace is up, it will have access to the Dask cluster you configured. Similarly to workspaces, to create an on-demand Dask cluster attached to a Domino job, click on Run from the Jobs menu. On the Start a Job dialog, select the Compute Cluster step. Specify the desired cluster settings and launch your job. The job will have access to the Dask cluster you configured. As your command, you can use any Python script that interacts with your Dask cluster. Domino makes it simple to specify key settings when creating a Dask cluster. Workers The maximum number of Dask node workers that the cluster can reach when Auto-scale workers is enabled. See cluster autoscaling for more details. Max The maximum number of workers that you can make available to your cluster is limited by the number of per-user executions that your Domino administrator has configured for your deployment or by the maximum simultaneous executions of the underlying Hardware Tier used for workers. In addition to the number of Dask node workers, you will need 1 slot for your cluster master and 1 slot for your workspace or job. Worker Hardware Tier The amount of compute resources (CPU, GPU, and memory) that will be made available to each Dask node worker. Scheduler Hardware Tier Same mechanics as the Worker Hardware Tier, but applied to the resources that will be available for your Dask cluster scheduler node. As the name suggests, the Dask scheduler is responsible for determining the worker on which a given task needs to execute. A serialized version of the task is held in the scheduler memory until it is possible to assign the task. This is not necessarily the same amount of memory needed to actually execute the task but limiting the scheduler memory may prevent work from being scheduled for executions with a very complex task graph. From a CPU perspective the needs of the scheduler are likely much lower than your workers. Cluster Compute Environment Designates your compute environment for the Dask cluster. Dedicated local storage per executor The amount of dedicated storage in Gigibytes (2^30 bytes) that will be available to each Dask worker. The storage will be automatically mounted to /tmp. The storage will be automatically provisioned when the cluster is created and de-provisioned when it is shut down. When provisioning your on-demand Dask cluster, Domino sets up environment variables that hold the information needed to easily connect to your cluster. The following snippet can be used to connect. from dask.distributed import Client import os ... service_host = os.environ["DASK_SCHEDULER_SERVICE_HOST"] service_port = os.environ["DASK_SCHEDULER_SERVICE_PORT"] client = Client(f"{service_host}:{service_port}") # you should now be connected to the cluster # Dashboard link from the client object is clickable but will not route in Domino # Use the embedded Dask Web UI tab instead Printing the client properties in a notebook will give you a Dask Dashboard link. While that link is clickable, it will not return an appropriately formatted Dashboard link that will work from Domino. Use the embedded Dask Web UI Dashboard as described below instead. Dask provides a built-in diagnostics dashboard with access to metrics, charts, and other features that helps you understand the components of the Dask cluster and the execution of your workloads. The dashboard is an extremely useful too to diagnose performance issues and help improve your understanding of what is happening across your cluster. Domino makes the Dask Web UI available for active on-demand clusters attached to both workspaces and jobs. For a more in depth introduction to the Dask dashboard, refer to the official Dask documentation. On workspace or job startup, a Domino on-demand Dask cluster with the desired cluster settings is automatically provisioned and attached to the workspace or job as soon as the cluster becomes available. On workspace or job termination, the on-demand Dask cluster and all associated resources are automatically terminated and de-provisioned. This includes any compute resources and storage allocated for the cluster. The on-demand Dask clusters created by Domino are not meant for sharing between multiple users. Each cluster is associated with a given workspace or a job instance. Access to the cluster and the Dask Web UI is restricted only to users who can access the workspace or the job attached to it. This restriction is enforced at the networking level and the cluster is only reachable from the execution that provisioned it.
https://admin.dominodatalab.com/en/4.2/user_guide/aaa2c1/work-with-your-cluster/
CC-MAIN-2022-27
refinedweb
781
53.1
I am back. After an over two-week long hiatus, I finally found the time to write a new post. The saga finally continues. This is what everybody has been waiting for. LLT: AI #2! After the last episode, in which we let our computer, figure correlation out on its own, by using linear regression, I got some mails from people complaining that this wasn’t actually artificial intelligence, but rather “just basic math”. This blog entry, my dear math snobs, is dedicated to. I had hit a dead-end and really didn’t know what to learn next. So I asked a colleague from school for help. And he introduced me into the marvelous world of perceptrons and neural networks. I needed some time to figure this out but I think that I have a pretty good understanding of this now. So what is a perceptron? A perceptron is basically like a neuron. A single cell-ish unit that does some predefined computation. A perceptron has inputs and outputs. Every input value has a weight and every perceptron has a bias value. So when a perceptron predicts something, it multiplies the inputs with their corresponding weights, adds those results together and then adds the bias value to the result. A perceptron with a single input would look like so: Wait…am I the only one seeing this? This is our old friend, again! Absolutely mind-blowing. Unfortunately, we get more than a single input in most cases. So our prediction formula has looks a bit different when it comes to multi-input perceptrons. But where do the weights and the bias get their values from? Good question! The answer is quite simple: the training loop. What is a training loop? Stop asking so many questions, damn it! A training loop is basically a teacher. It teaches our perceptron how to predict new values, based on the values we provide in our dataset. We call this method of training supervised learning. The training loop makes use of something called gradient descent. Gradient descent is an optimization algorithm that tries to minimize the error of our perceptron. Okay…lets go through this once more, but slowly. So in order to use gradient descent, we need an error function. The error function is really simple as it is just As soon as we know our error, we can proceed with calculating the gradient. Our gradient is composed of the error, the last input our perceptron received and something called the learning rate (or lr). The learning rate is just a fixed value that lowers the value of the gradient and, in turn, lowers the effect our gradient has on the weights and the bias, per training iteration. Now that we know the gradient, we can make changes to the weights and bias. If we visualize this, our training loop would look like so: But enough with all the math bla bla…let’s start coding. Let’s start with all the helper stuff. I’ve generated a data-set and checked the correlation in GeoGebra, so we actually get a nice result this time. import matplotlib.pyplot as plt # Helper function to separate the columns of our training data def column(matrix, i): return [row[i] for row in matrix] # Our training data points = [[245, 1400], [312, 1600], [279, 1700], [308, 1875], [199, 1350], [219, 1550], [405, 2350], [324, 1780], [319, 1600], [255, 1700]] xa = column(points, 0) ya = column(points, 1) Next, we need to initialize our values (weight, bias, learning rate). To get to these initial values, I wrote the perceptron, initialized the values with 1 and then figured out what numbers they approach. For the learning rate I had a different approach: I just made it smaller by a factor of 1E-1 until I stopped getting OverflowError from my prediction. weight = 10 bias = 100 lr = 0.000001 errorAvg = 0 The prediction itself and the training loop are fairly trivial. def predict(xp): return xp * weight + bias # Train for iteration in range(10): for x, y in points: prediction = predict(x) error = y - prediction errorAvg += error gradient = x * error * lr # Change bias and weight bias += gradient weight += weight * gradient errorAvg = errorAvg / len(xa) print("Iteration: {}\n--------------\nError: {}; Weight: {}; Bias: {}\n".format(iteration, errorAvg, weight, bias)) print("Final\n--------------\nError: {}; Weight: {}; Bias: {}".format(errorAvg,weight, bias)) Now we just need to visualize it all: lineX = [] lineY = [] for i in range(len(xa)): lineX += [xa[i]] lineY += [predict(xa[i])] plt.plot(xa, ya, 'ro') plt.plot(lineX, lineY) plt.show() We should see something like this: This is cool and all…but I want more. I want a multi-input perceptron! Let’s first make the code more modular by making a perceptron class. Also, let’s change our value initialization to random values. from random import random class Perceptron: def __init__(self, nrOfInputs): self.weight = [] for i in range(nrOfInputs): self.weight += [random()] def predict(self, input): prediction = 0 for i, val in enumerate(input): prediction += self.weight[i] * val return prediction def train(self, inputs, outputs, lr, ti): errorAvg = 0 for it in range(ti): for input_i, input in enumerate(inputs): prediction = self.predict(input) error = outputs[input_i] - prediction errorAvg += error for val_i, val in enumerate(input): gradient = val * error * lr self.weight[val_i] += self.weight[val_i] * gradient errorAvg = errorAvg / len(inputs) return errorAvg, self.weight Now, we need a training function. def generate(_in, i, o, ti=1000000, lr=0.001): perceptron = Perceptron(_in) err, weights = perceptron.train(i, o, lr, ti) print("Error: {}; Weights: {}".format(err, weights)) return perceptron Let’s test this. I generated test data by formulae and let the perceptron figure out the formula I used. # Test with two inputs; (input + input)*2 = result print("Two inputs:") inputs = [[1, 1], [2, 3], [5, 8], [13, 21], [4, 4], [5, 5], [4, 8]] outputs = [4, 10, 26, 68, 16, 20, 24] print(generate(2, inputs, outputs).predict([10, 10])) # Test with three inputs; (input + input)*2+input = result print("\nThree inputs:") inputs = [[1, 1, 1], [2, 3, 4], [5, 8, 9], [13, 21, 22], [4, 4, 5], [5, 5, 6], [4, 8, 9]] outputs = [5, 14, 35, 90, 21, 26, 33] print(generate(3, inputs, outputs).predict([10, 10, 5])) # Test with three inputs; (input + input)*2+input+input*0.1 = result print("\nFour inputs:") inputs = [[1, 1, 1, 1], [2, 3, 4, 5], [5, 8, 9, 9], [13, 21, 22, 7], [4, 4, 5, 6], [5, 5, 6, 7], [4, 8, 9, 3]] outputs = [5.1, 14.5, 35.9, 90.7, 21.6, 26.7, 33.3] print(generate(4, inputs, outputs).predict([10, 10, 5, 4])) Running this takes a bit longer than running the single-input perceptron (even on my machine). The output should look like this: Two inputs: Error: 6.587323279442596e-15; Weights: [1.999999999999973, 2.0000000000000178] 39.99999999999991 Three inputs: Error: -2.6626848873926672e-14; Weights: [1.9999999999999627, 1.999999999999918, 1.0000000000000988] 44.999999999999304 Four inputs: Error: -5.3290705182007514e-14; Weights: [2.0000000000000413, 1.9999999999991658, 1.0000000000007956, 0.09999999999988507] 45.399999999995586 Pretty good! I’d say this is a good first success. I planned to include a simple neural network in this blog post, but since it doesn’t really work as well as I want it to work and the post would’ve become quite big, I decided to make a dedicated LLT:AI for this (I won’t let you wait as long this time…I promise 😅).
https://www.simulevski.at/2019-01-14-Lets-learn-together-AI-2/
CC-MAIN-2019-26
refinedweb
1,250
65.73
c++ - Internal Error type 600 - Eric E. King, EIT <Eric_member pathlink.com> Jan 22 2005 - Eric E. King, EIT <Eric_member pathlink.com> Jan 22 2005 - "Walter" <newshound digitalmars.com> Jan 28 2005 I've been trying to build Allegro 4.1.17 with DMC (along with DJGPP to build the ASM sources), and it has resulted in an internal error when trying to build src/i396/asmdef.c. I would like to provide more information about the error, but apparently the error in happening in the preprocessor because the generated listing file (-e -l) doesn't not contain the full source, but stops (presumably) at the point of the internal error. That makes isolating the problem difficult for me. Any suggestions? Other than this error, everything seems to progressing well with getting allegro to build under dmc. Jan 22 2005 In article <csv7eg$27sd$1 digitaldaemon.com>, Eric E. King, EIT says...src/i386/asmdef.c apparently the error is happening listing file (-e -l) doesn't contain seems to be progressing well Sheesh, sorry about the typos. I guess I should get some sleep. Jan 22 2005 Your email address fails, so I can only reply here: -------------------------------------------------- The failing example boils down to: typedef int (*DIALOG_PROC)(int); struct DIALOG { DIALOG_PROC proc; }; __declspec(dllimport) int d_clear_proc(int); struct DIALOG test = { d_clear_proc }; The trouble is stemming from the __declspec(dllimport). The way this works on Windows is that calls to an import go through a level of indirection, but that level isn't a constant, hence the error. The way to fix this is to use an import library to connect to the DLL, and then remove the __declspec(dllimport) from the declarations. Your source: /* describe how function prototypes look to DMC */ #if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC) #define _AL_DLL #else #define _AL_DLL __declspec(dllimport) #endif should be written to something like: #if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC) || defined (USE_IMPORT_LIBRARY) #define _AL_DLL #else #define _AL_DLL __declspec(dllimport) #endif -Walter Jan 28 2005
http://www.digitalmars.com/d/archives/c++/4459.html
CC-MAIN-2014-52
refinedweb
329
55.34
explanation ; Hi,can I know what is the meaning for the above coding?I have find the explanation in internet,but not very clear about it. Thank Good tutorials for beginners in Java Good tutorials for beginners in Java Hi, I am beginners in Java... in details about good tutorials for beginners in Java with example? Thanks. Hi, want to be command over Java, you should go on the link and follow HOW TO BECOME A GOOD PROGRAMMER HOW TO BECOME A GOOD PROGRAMMER I want to know how to become good programmer Hi Friend, Please go through the following link: CoreJava Tutorials Here you will get lot of examples with illustration where you can Can you suggest any good book to learn struts Can you suggest any good book to learn struts Can you suggest any good book to learn str explanation - Java Beginners explanation I have create small java appication. I don't know about garbage collection, memory leak. I want reference about these and how to use my java application. Hi Friend, Please visit the following links Java Code Explanation Java Code Explanation Can you please Explain the following code... args[]) { int n,i,res=0,sum=0,dif...(System.in); n=in.nextInt(); for(i=1;i<=n;i i want to learn Jquery i want to learn Jquery i want to learn jquery can u plz guide me Yes, you can learn these technologies by yourself. Go through the following links: Ajax Tutorials JSON Tutorials JQuery Tutorials online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you. .. Thank you. please provide online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you. Create table test...=connection.createStatement(); ResultSet rs=st.executeQuery("Select * from test"); int i=1; while(rs.next huffman code give the explanation for this code (i); } return (-1); } // Huffman codes. #include where are you...huffman code give the explanation for this code package bitcompress...) { boolean s[] = huffcodes[value]; for (int i = 0; i < s.length; i hi Before asking question, i would like to thank you... technologies like servlets, jsp,and struts. i am doing one struts application where i... into the database could you please give me one example on this where i i STRUTS Validation: user entered as 123.34567 I want the value as 123.34 once the user submits. How you will validate i want to create dynamic calendar in java i want to create dynamic calendar in java i want code and Good Looking Java Charts and Graphs be extended to use better looking graphics it is not an option for us. Thank you...Good Looking Java Charts and Graphs Is there a java chart library that will generate charts and graphs with the quality of visifire or fusion charts hi .. need help ASAP ..i have a project buit in eclipse , i have installed jasper. i want the steps to work on it .. jasper. i want the steps to work on it .. hi .. need help ASAP ..i have a project buit in eclipse , i have installed jasper. i want the steps to work on it .. .. am not getting how it works ... from were to start .. thank validation - Struts form.but i don't want the username to be duplicated.means one username must be entered single time only. thank you Hi friend, Read for more...validation Hi, Can you give me the instructions about Struts - Struts Struts hi can anyone tell me how can i implement session tracking in struts? please it,s urgent........... session tracking? you mean...(""); session.invalidate(); Thank you very much for answer Struts Dear Sir , I am very new in Struts and want... validation and one of custom validation program, may be i can understand.Plz..., For zip validation you visit to : I want to learn hibernate step-by-step. I want to learn hibernate step-by-step. Hello, I am very new... to start from start and learn it step by step. Can you please help me.. I would be very grateful, Thanks.. Hello Friend, If you want to learn Books . The book starts with an explanation of why Struts is a "good thing" and shows... covers everything you need to know about Struts and its supporting technologies...-Controller (MVC) design paradigm. Want to learn Struts and want get example explanation - Java Beginners example explanation can i have some explanation regarding the program given as serialization xample.... Hi friend, import java.io.*; import java.util.*; import java.util.Date; import java.io.Serializable Integrate Struts, Hibernate and Spring is very good if you want to learn the process of integrating these technologies... important to have good directory structure that helps you reduce the time taken... and test your development directory structure. If you don't want to waste the time Cannot run Struts 2 on IntelliJ Project - Struts ! thank you. Hi , This is kalyani, I know to to run struts2 in NETBEANS IDE... if u want i vl tell...u... thanks®ards kalyani...Cannot run Struts 2 on IntelliJ Project I have been trying to Based on struts Upload - Struts Based on struts Upload hi, i can upload the file in struts but i want the example how to delete uploaded file.Can you please give Actions in Struts Actions in Struts Hello Sir, Thanks for the solutions you have sent me. i wanted examples on Struts DispatchAction,Forword Action ,Struts... send me as soon as possible. Thank you Very much for the support Regards Struts Struts Am newly developed struts applipcation,I want to know how to logout the page using the strus Please visit the following link: Struts Login Logout Application Struts Tutorials as popular as Struts. If you need to brush up your knowledge on JUnit I can recommend... Jakarta Struts". Here I showed you: 1. how to download and install Struts 2... Tutorial This complete reference of Jakarta Struts shows you how to develop Struts Struts - Framework Struts Good day to you Sir/madam, How can i start... that you are going to learn Struts. Just refer "". Its a very good site to learn struts. You dont need to be expert i want for statement codding i want for statement codding what is the for condition following out put 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 want a program for date picker by using java swings is there using by using the java script for the date picker but know i wan tthe program by using swings..please help me thank you in advance. Have...want a program for date picker by using java swings to write struts struts i have one textbox for date field.when i selected date from datecalendar then the corresponding date will appear in textbox.i want code for this in struts.plz help Parameter month I Report - Java Beginners Parameter month I Report hy, I want to ask about how to make parameter in I Report, parameter is month from date. How to view data from i report use like "12/2008". Thank's Hi friend, Plz give DAO in Struts DAO in Struts Can Roseindia provide a simple tutorial for implementation of DAO with struts 1.2? I a link already exits plz do tell me. Thank Sending large data to Action Class error. Struts code - Struts Sending large data to Action Class error. Struts code I have a jsp... Thank you for registering with IT interns to build your project experience...);} and in action class i want to get the value of variable 'val'.But since this is large Struts first example - Struts Struts first example Hi! I have field price. I want to check... friend! thanks you so much for your supports, I want to check not only type...! I am using struts 2 for work. Thanks. Hi friend, Please visit struts the checkbox.i want code in struts...struts I have no.of checkboxes in jsp.those checkboxes values came from the databases.we don't know howmany checkbox values are came from Struts Struts I want to create tiles programme using struts1.3.8 but i got jasper exception help me out what should i do next?? - Java Beginners to the web development.I want to know which one i should study first.JSP or servlet... is good for java in AmeerPet.Don't think it as bad.He is good faculty thus y. Thank...what should i do next?? I know java basics.actully i passed the SCJP struts - Framework struts Hi,roseindia I want best example for struts Login form..Don't integrate springs and hibernate with this example i want only in struts... Hi Friend, You can get login applications from the following java struts error - Struts the problem what you want in details. For more information,Tutorials and examples...java struts error my jsp page is post the problem... is I Top 10 Tips for Good Website Design by the webmaster. Good website design is a continuous process that needs you to evaluate... or feel unreasonable to stay on your web page. If you want your users to stay...Designing a good website as to come up with all round appreciation, traffic Don?t you think you are overqualified for this job? experience. Further, you also get the benefit of all the training and experience I... it as a stop-over. It is also possible that they want to see how ambitious you... to the company. The position in question is exactly what you want to do and what java - Struts java i want know the basics of the struts Hi Friend, Please visit the following link: Hope that it will be helpful for you. Thanks struts struts <p>hi here is my code can you please help me to solve...; <h1></h1> <p>struts-config.xml</p> <p>...;<struts-config> <form-beans> <form-bean name
http://www.roseindia.net/tutorialhelp/comment/7958
CC-MAIN-2014-52
refinedweb
1,658
75.91
13 Feb 22:28 2010 [PATCHv13 00/30] git notes Johan Herland <johan <at> herland.net> 2010-02-13 21:28:08 GMT 2010-02-13 21:28:08 GMT Hi, Here is the 13th iteration of the git-notes series. Changes in this iteration are as follows: - Patch #1 has improved its commit message - Patch #7 (the get_note() API function) improved its header file docs. - Patch #12 (Builtin-ify git-notes) received code to add some details of the current object (the object whose notes are currently being edited)to the template text displayed in the editor. Similar details were originally present in git-notes.sh, but was lost in the initial builtin-ification. - Patch #22 (the 'list' subcommand) has learned to fail (instead of segfault) when asked to list notes for an object that has none. - Patch #23 has been inserted to provide --message/--file aliases to the -m/-F options. This improves consistency with other git commands. - Patch #24 (was #23) has been redone to provide the "git notes add" semantics suggested by Junio in the discussion following the previous iteration. - Patch #25 introduces the "git notes append" subcommand which takes on the semantics of "git notes add" from the previous iteration. - Patch #26 deprecates the -m/-F options for "git notes edit", since their semantics now overlap with "git notes add -f", and the behaviour is more intuitively captured and better documented with "git notes add -f" - Patch #27 refactors some code in builtin-notes, to allow mixing -m and -F options again. This was originally allowed in git-notes.sh, but was disabled by the builin-ification. The refactoring also helps with clear the way for the next patch... - Patch #28 introduces the -c/-C options to "git notes add/append". This allows re-use of existing notes object when making new note. The option names and semantics were inspired by "git commit". - Patch #29 refactors the argc and exit value handling of builtin-notes, in preparation for the next patch - Patch #30 introduces the "git notes copy" subcommand for copying notes from one object to another. This will come in handy when we want to bring notes across a commit rewrite (such as rebase/cherry-pick/amend). There are ongoing discussions on how to further develop and integrate the notes feature. I try to summarize ideas below, although I don't plan to put any more stuff into _this_ patch series: - Better integration with rebase/amend/cherry-pick. Optionally bring notes across a commit rewrite. Controlled by command-line options and/or config variables.. - Using multiple notes refs simultaneously.. When showing notes from multiple refs, we should also show from _which_ note ref a given note originates. Of course, when _writing_ notes, only one ref should receive the created notes. - Adding command-line options for specifying notes refs.. Jakub suggests adding a --notes-ref="a:b:..." option, either to the git wrapper, or to all git subcommands that can do stuff with notes. Junio adds that the --notes-refs option should DWIM the given ref name (i.e. "foo" -> "refs/notes/foo"). - <at> herland.net notes/amlog" and it will give me something like: notes/amlog:65807ee697a28cb30b8ad38ebb8b84cebd3f255d:1 notes/amlog:c789176020d6a008821e01af8b65f28abc138d4b:1 but this won't scale and needs scripting to mechanize, once we start rebalancing the notes tree with different fan-outs. The end user (me in this case) is interested in "set of objects that match this grep criteria", not "the pathnames the notes tree's implementation happens to use to store notes for them in the hierarchy". - Add support for "^{notes}" (or "^ <at> {}") to the rev-parse machinery, so that notes can be returned from e.g. "git cat-file --batch". This is somewhat complicated when combined with using multiple notes ref simultaneously (see above), but can be solved by using (Jakub's suggestions:) "^{notes:<namespace>}" (or "^ <at> {<namespace>}"). - Merging notes trees. Junio suspects that we need a specialized merge strategy for notes trees. One example of such a strategy is to auto-concatenate conflicting notes, instead of forcing the user to edit away conflict markers. Note that such a solution should be fairly easy to implement on top of the current notes API, by loading both notes trees into the same struct notes_tree, while using combine_notes == combine_notes_concatenate(). - Matthieu Moy and Sverre Rabbelier suggests to add notes support to format-patch: Notes stored in e.g. the "refs/notes/format-patch" ref are added to the "comments section" (i.e. following the '---' separator) of generated patches. There is also some discussion on whether notes should be added as custom headers to the email generated by format-patch. - Special handling of notes on fetch? Tags are autofollowed; does it make sense to do something similar for notes? Guiseppe notes: Tags have the idiosincracy of living in the same namespace regardless of where they come from, and I believe there a little too high a risk of conflicts to do this with notes too. It might make sense to add a default fetch of +refs/notes/*:refs/notes/remotes/≤remote>/*, but the real question is what would pushing do, in case of conflicting notes. - Note objects that are trees (instead of blobs). Peff originally proposed the idea of storing multiple notes for one object in a single notes ref by having the note object itself be a tree which contained note blobs (with well-defined names). Jon Seymour wanted to expand this idea to allow _arbitrary_ tree structures to be stored as notes. However, this will cause problems when trying to interpret notes in a consistent manner (i.e. how would "git log" display a tree of notes attached to a single commit). Problems may also arise when optimizing the notes tree structure itself. Peff instead suggests to add another level of indirection, and store the tree _SHA1_ in the note (instead of the tree object itself), and then teach a few tools (git-fsck, git-metadata?) to dereference the SHA1 when needed. (- Rewrite fast-import notes code to use new notes API with support for non-notes.) Have fun! :) ...Johan Johan Herland (30): Minor cosmetic fixes to notes.c Notes API: get_commit_notes() -> format_note() + remove the commit restriction Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef Notes API: init_notes(): Initialize the notes tree from the given notes ref Notes API: add_note(): Add note objects to the internal notes tree structure Notes API: remove_note(): Remove note objects from the notes tree structure Notes API: get_note(): Return the note annotating the given object Notes API: for_each_note(): Traverse the entire notes tree with a callback Notes API: write_notes_tree(): Store the notes tree in the database Notes API: Allow multiple concurrent notes trees with new struct notes_tree Refactor notes concatenation into a flexible interface for combining notes Builtin-ify git-notes t3301: Verify successful annotation of non-commits t3305: Verify that adding many notes with git-notes triggers increased fanout Teach notes code to properly preserve non-notes in the notes tree Teach builtin-notes to remove empty notes builtin-notes: Add "remove" subcommand for removing existing notes t3305: Verify that removing notes triggers automatic fanout consolidation Notes API: prune_notes(): Prune notes that belong to non-existing objects builtin-notes: Add "prune" subcommand for removing notes for missing objects Documentation: Generalize git-notes docs to 'objects' instead of 'commits' builtin-notes: Add "list" subcommand for listing note objects builtin-notes: Add --message/--file aliases for -m/-F options builtin-notes: Add "add" subcommand for adding notes to objects builtin-notes: Add "append" subcommand for appending to note objects builtin-notes: Deprecate the -m/-F options for "git notes edit" builtin-notes: Refactor handling of -F option to allow combining -m and -F builtin-notes: Add -c/-C options for reusing notes builtin-notes: Misc. refactoring of argc and exit value handling builtin-notes: Add "copy" subcommand for copying notes between objects Documentation/git-notes.txt | 91 +++- Makefile | 2 +- builtin-notes.c | 459 ++++++++++++++ builtin.h | 3 + git-notes.sh => contrib/examples/git-notes.sh | 0 git.c | 1 + notes.c | 843 +++++++++++++++++++++---- notes.h | 196 ++++++- pretty.c | 9 +- t/t3301-notes.sh | 510 ++++++++++++++- t/t3303-notes-subtrees.sh | 28 +- t/t3304-notes-mixed.sh | 36 +- t/t3305-notes-fanout.sh | 95 +++ t/t3306-notes-prune.sh | 94 +++ 14 files changed, 2171 insertions(+), 196 deletions(-) create mode 100644 builtin-notes.c rename git-notes.sh => contrib/examples/git-notes.sh (100%) create mode 100755 t/t3305-notes-fanout.sh create mode 100755 t/t3306-notes-prune.sh
http://permalink.gmane.org/gmane.comp.version-control.git/139836
CC-MAIN-2014-42
refinedweb
1,420
63.29
Welcome to the Core Java Technologies Tech Tips for October 5, 2004. Here you'll get tips on using core Java technologies and APIs, such as those in Java 2 Platform, Standard Edition (J2SE). This issue covers: Using Static Imports for Constants and Methods Formatting Output With the New Formatter These tips were developed using the Java 2 Platform Standard Edition Development Kit 5.0 (JDK 5.0). Download JDK 5.0. latest Java platform releases, tutorials, and newsletters. java.net - A web forum for collaborating and building solutions together. java.com - The marketplace for Java technology, applications and services. Many new language features have been introduced in the release of J2SE 5.0. Static imports is a feature that helps in the creation and use of global constants. It's one of the easiest new features to incorporate into your code. In this tip, you'll have the chance to use static imports for constants and methods. You'll start. However there is a downside to using static imports in this way: it can make your code less readable. This is especially true with wild cards. It can become hard to determine where methods and attributes originate. In the past, it was common for developers to use interfaces to store values that would be treated as global constants. Here's an example: public interface BadIrrationalConstants { public static final double SQRT_TWO = 1.414; public static final double SQRT_THREE = 1.732; } This was particularly appealing to developers who needed more than one group of constants. For instance, a developer might need the values defined in the BadIrrationalConstants interface as well as those in the following interface, BadTranscendentalConstants: BadIrrationalConstants BadTranscendentalConstants public interface BadTranscendentalConstants { public static final double PI = 3.14159; public static final double E = 2.71828; } It is tempting to use this technique of constant interfaces because it is easy to make the global constants available for use. You simply implement each interface containing the needed constants like this: public class BadUseOfConstants implements BadTranscendentalConstants, BadIrrationalConstants { public static double sinPiOverFour() { return SQRT_TWO / 2; } public static void main(String[] args) { System.out.println("Pi is approximately " + PI); System.out.println("The sin of Pi/4 is about " + sinPiOverFour()); } } Before the J2SE 5.0 release, your only alternative was to use fully qualified names such as BadIrrationalConstants.SQRT_TWO everywhere. This was excessively verbose and led to hacks such as BadUseOfConstants. BadIrrationalConstants.SQRT_TWO BadUseOfConstants The problem with the approach above is that the constants are now part of the type BadUseOfConstants. Any class that uses these constants adds them to its public interface. This is a restriction on further modifications of the class. That's because clients of the class might depend on the constants being present. Instead, the constants should be part of a class like this: package staticEx; public class IrrationalConstants { public static final double SQRT_TWO = 1.414; public static final double SQRT_THREE = 1.732; } Before you are tempted to extend IrrationalConstants to use SQRT_TWO and SQRT_THREE, assume that you also need the constants defined in TranscendentalConstants: IrrationalConstants SQRT_TWO and SQRT_THREE TranscendentalConstants package staticEx; public class TranscendentalConstants { public static final double PI = 3.14159; public static final double E = 2.71828; } Before the release of J2SE 5.0, it took quite a bit of effort to use these constants, sometimes obscuring the equations in which they were used. However, static import allows you to easily import static members into your code. For example, if you want to use the static class attribute SQRT_TWO, you declare the following: SQRT_TWO import static staticEx.IrrationalConstants.SQRT_TWO at the beginning of the class in which you want to use the constant. You can then use SQRT_TWO as you did in BadTranscendentalConstants. Note that you need to use the keyword static after the keyword import. If you try the following without the static keyword, it will not compile. Compile and run the following class, ConstantsWithStaticImport, using a J2SE 5.0 compiler: static keyword ConstantsWithStaticImport package staticEx; import static staticEx.IrrationalConstants.SQRT_TWO; import static staticEx.IrrationalConstants.SQRT_THREE; import static staticEx.TranscendentalConstants.PI; public class ConstantsWithStaticImport { public static double sinPiOverFour() { return SQRT_TWO / 2; } public static void main(String[] args) { System.out.println("Pi is approximately " + PI); System.out.println("The sin of Pi/4 is about " + sinPiOverFour()); } } You should see the following displayed: Pi is approximately 3.14159 The sin of Pi/4 is about 0.707 You can use wildcards in the import as you might expect. In this case, you can replace the first two import statements with: import static staticEx.IrrationalConstants.*; As always, being specific and avoiding the use of the wildcard helps control exactly what is being imported. It also makes things clearer for someone reading your source code. You can use static imports for static methods as well as for static attributes. In the class below, IrrationalConstants2, you have both: IrrationalConstants2 package staticEx; public class IrrationalConstants2 { public static final double SQRT_TWO = 1.414; public static final double SQRT_THREE = 1.732; public static double sinPiOverFour() { return SQRT_TWO / 2; } } Make them all available by using the wildcard. Now you can call the static method sinPiOverFour(), which is defined in IrrationalConstants2, like this: sinPiOverFour() package staticEx; import static staticEx.IrrationalConstants2.*; import static staticEx.TranscendentalConstants.*; public class ConstantsWithStaticImport2 { public static void main(String[] args) { System.out.println("Pi is approximately " + PI); System.out.println("The sin of Pi/4 is about " + sinPiOverFour()); } } You can see however that there are already readability problems. It is not easy to determine whether sinPiOverFour() is in the IrrationalConstants2 class or in TranscendentalConstants. You can clarify this by replacing the wildcards in the import with explicit references to the method being called. There is less confusion when you use a class in the standard J2SE distribution such as java.lang.Math. By using the static import, you reduce client code such as Math.PI and Math.sin() to PI and sin(). java.lang.Math Math.PI Math.sin() PI sin() package staticEx; import static java.lang.Math.*; public class ConstantsWithStaticImport3 { public static void main(String[] args) { System.out.println("Pi is approximately " + PI); System.out.println("The sin of Pi/4 is about " + sin(PI / 4)); } } In addition to static methods and attributes, you can use static import for static classes. For example, the class java.awt.geom.Point2D.Double is a static subclass of java.awt.geom.Point2D. If you import java.awt.geom.Point2D.Double, it can refer to all of its static members by using Double.xxx. The following example, StaticClassEx, uses the static field out in the final class, java.lang.System, to simplify calls to System.out.println(). StaticClassEx prints to standard out using out.println(), and calls the static method distance() using Double.distance(). java.awt.geom.Point2D.Double java.awt.geom.Point2D Double.xxx StaticClassEx out java.lang.System System.out.println() out.println() method distance() Double.distance() package staticEx; import static java.awt.geom.Point2D.Double; import static java.lang.System.out; public class StaticClassEx { public static void main(String[] args) { out.println("The diagonal of a unit square is " + Double.distance(0.0, 0.0, 1.0, 1.0) + "."); } } The result is: The diagonal of a unit square is 1.4142135623730951. When used judiciously, static imports can make your code simpler to read and make it easier to work with static variables, methods, and classes. Be careful not to overuse this technique. Also be sure to explicitly import a variable or method when there is a possibility of ambiguity. For additional information about static imports, see the section Static Import in the description of new features and enhancements for J2SE 5.0. J2SE 5.0 introduces a new way to format output that is similar to that of the C language's printf. In this approach, each argument to be formatted is described using a string that begins with % and ends with the formatted object's type. This tip introduces you to the new Formatter class and to the syntax of the formatting that you perform with the class. printf Formatter It's likely that you will most often use the new formatting approach in a call similar to either of the following: System.out.format("Pi is approximately %f", Math.Pi); System.out.printf("Pi is approximately %f", Math.Pi); The printf() and the format() methods perform the same function. System.out is an instance of java.io.PrintStream. PrintStream, java.io.PrintWriter, and java.lang.String each have four new public methods: printf() format() System.out java.io.PrintStream PrintStream java.io.PrintWriter java.lang.String format( String format, Object... args); printf( String format, Object... args); format( Locale locale, String format, Object... args); printf( Locale locale, String format, Object... args); These correspond to the format() method in the underlying worker class java.util.Formatter class: java.util.Formatter format(String format, Object... args) format(Locale l, String format, Object... args) Although you'll likely use these methods from String, PrintStream, and PrintWriter, you'll find the documentation for the various available formatting options in the documentation for the Formatter class. String PrintWriter Let's begin with the following example of the format() method: formatter.format("Pi is approximately %1$f," + "and e is about %2$f", Math.PI, Math.E); The format() method requires some of the new language features introduced in J2SE 5.0. One is varargs, which simplifies the way that an arbitray number of arguments can be passed to a method. Notice that a variable number of Object instances can be entered for formatting. Also notice that the objects in the example are autoboxed and unboxed. Autoboxing/Unboxing is also a new feature in J2SE 5.0. Autoboxing eliminates the need for manually converting a primitive type (such as int) to a wrapper class (such as Integer), unboxing automates the reverse process. In the example, Math.PI is a double which is autoboxed to a Double (to be treated as an Object). In addition, in the example the formatted output is written to java.lang.StringBuilder, yet another new feature introduced in J2SE 5.0. Object int Integer Double java.lang.StringBuilder The format itself is a String that includes zero or more formatting elements, each beginning with a %. Each formatting element is applied to one of the Objects passed in. Each formatting element has the general form: a % %[argument_index$][flags][width][.precision]conversion The argument index is a positive integer that indicates the position of the argument in the argument list. The numbering begins with 1 for the first position, not with 0. So the first position in the previous code snippet is occupied by Math.PI, and is indicated by using 1$. The second position is occupied by Math.E, and is indicated by using 2$. 1$ Math.E 2$ The width specifies the minimum number of characters to be written as output. The precision is used to restrict the number of non-zero characters. The conversion describes the type of the object being formatted. Much of this should be familiar to C programmers because this is a Java implementation of printf(). Common types include f for float, t for time, d for decimal, o for octal, x for hexadecimal, s for general, and c for a Unicode character. The following sample application, UsingFormatter, allows you to enter different formats from the command line and view the output. Notice that the application instantiates a destination -- in this example, a StringBuilder. It then instantiates a Formatter and associates it with the destination. The Formatter then formats some String and sends the output to the destination. The results of the conversion are then displayed to standard out. f t d o x s c UsingFormatter StringBuilder package format; import java.util.Formatter; public class UsingFormatter { public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: " + "java format/UsingFormatter "); System.exit(0); } String format = args[0]; StringBuilder stringBuilder = new StringBuilder(); Formatter formatter = new Formatter(stringBuilder); formatter.format("Pi is approximately " + format + ", and e is about " + format, Math.PI, Math.E); System.out.println(stringBuilder); } } Compile and run this with the command line argument %f: java format/UsingFormatter %f You should get the result: Pi is approximately 3.141593, and e is about 2.718282 Rerun this and set the precision to be two decimal places: java format/UsingFormatter %.2f You should see the following: Pi is approximately 3.14, and e is about 2.72 Notice that the numbers are not just truncated. The value of e is rounded off to two decimal places. You can additionally specify the width by supplying the command line argument %6.2f. This time leading spaces are inserted because you specified that the number should use six characters, even though the precision restricts it to using only three characters and a decimal place. If you enter the command: e %6.2f java format/UsingFormatter %6.2f You should see this: Pi is approximately 3.14, and e is about 2.72 The position can be used to specify which argument to format. Rerun UsingFormatter with the command line argument %1$.2f. This specifies that you want to use Math.PI twice. You should see the following output: %1$.2f Pi is approximately 3.14, and e is about 3.14 You can change the Locale used to format the numbers by adding an import statement and calling a different constructor. Here's an example: Locale import package format; import java.util.Formatter; import java.util.Locale; public class UsingFormatter { public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: " + "java format/UsingFormatter <format string>"); System.exit(0); } String format = args[0]; StringBuilder stringBuilder = new StringBuilder(); Formatter formatter = new Formatter(stringBuilder, Locale.FRANCE); formatter.format("Pi is approximately " + format + ", and e is about " + format, Math.PI, Math.E); System.out.println(stringBuilder); } } Compile and run this with the argument %.2f and you should see the decimal points changed to commas. Pi is approximately 3,14, and e is about 2,72 As previously mentioned, you will typically not use the Formatter class explicitly. Instead, for example, you can directly use the printf() and format() methods in the PrintStream class. The following program, UsingSystemOut, is a rewritten version of the UsingFormatter program to use standard out: UsingSystemOut package format; public class UsingSystemOut { public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: " + "java format/UsingSystemOut <format string>"); System.exit(0); } String format = args[0]; System.out.format("Pi is approximately " + format + ", and e is approximately " + format, Math.PI, Math.E); } } The behavior of UsingSystemOut is slightly different than that of UsingFormatter. The UsingFormatter program uses println(), the UsingSystemOut program does not. Because of that, if you run UsingSystemOut from the command line, you will notice that your next command prompt is on the same line as your output. You need to insert a new line. You can do this using formatted output by adding %n. Run UsingSystemOut with the command line argument %.2f%n: println() %n %.2f%n java format/UsingSystemOut %.2f%n You will see the following result: Pi is approximately 3.14 , and e is about 2.72 You can replace the last method call with printf() if you prefer. There is no difference between System.out.format() and System.out.printf(). System.out.format() System.out.printf() As a final example, let's take a look at how date and time objects can be formatted. These objects have the conversion type t or T. That letter is followed by a second letter that indicates which part of the time should be displayed and how it should be displayed. For example, you can display the hour in a variety of forms using tH, tI, tk, or tl, and the minute within the hour using tM. These can also be combined with tr, which displays tH:tM. Similarly, you can display the day of the week, the name of the month, and so on, using the format conversion keys detailed in the Formatter API. T tH tI tk tl tM tr tH:tM Here is an example that displays the date by formatting the current time using tr for the hour and minute, tA for the day of the week, tB for the name of the month, te for the number of the day of the month, and tY for the year. These could all be preceded by 1$ to point to the first position. Instead, the %tr points to the first position. The < in the other format strings refers back to the position formatted previously. tA tB te tY package format; import java.util.Calendar; public class FormattingDates { public static void main(String[] args) { System.out.printf("Right now it is %tr on " + "%<tA, %<tB %<te, %<tY.%n", Calendar.getInstance()); } } Compile and run the FormattingDates program. You will see output that looks something like this: FormattingDates Right now it is 01:55:19 PM on Wednesday, September 22, 2004. This tip is intended to get you started using the new Formatter facility for formatting output. In some ways, the options should feel familiar to you from the old printf() days. Here as before, there are many possibilities available. You will only learn them by trying out different options and deciding which ones meet your needs. For more information about formatting with the new formatter, see the documentation for the Formatter class. Got a question about Java technologies or tools? Then join these upcoming chats and webinars: Chats:
http://java.sun.com/developer/JDCTechTips/2004/tt1005.html
crawl-002
refinedweb
2,914
50.84
Hi there, I never found this in the forum or the documentation. So my question is, how can I write a bean which contains a list, and for each element in the list a new csv line is being written. I recognized that with ICsvDozerBeanWriter it is possible to access specific indexes within the list, but what I want is that every element in the list is being written. public class Bean { private List<Recipient> recipients } So a mapping for a specific index would be private static final String[] FIELD_MAPPING = new String[] { "recipients[0].mail"}; and my thought was, it might be possible to define something like private static final String[] FIELD_MAPPING = new String[] { "recipients[].mail"}; which would then, instead of using only one index, write the whole list. Is this possible, or is there another way to solve this? Thanks and regards, René James Bassett 2012-12-05 Hi René, Typically, 1 bean instance == 1 call to write() == 1 row of CSV It looks like you're trying to write each recipient's mail field on a new line, so why not iterate through each Recipient and write them instead (of Bean). Then your field mapping would simply be "mail". Think of the field mapping as a way of mapping from one bean to one row of CSV. Does that help? Hi, ok - thank you. The proposal you suggested also came to my mind but I never accomplished an implementation. But according to your answer, I guess my approach was wrong anyway. This is what I've tried so far: for (Bean bean : beans) { for (Recipient recipient : bean.getRecipients()) { beanWriter.write(bean, processors); // <-- And this will not work, of course } } So the problem is obvious - I would have to pass over an instance of Recipient, but then the mapping I used to initialize my BeanWriter would fail. And that's where I am stuck right now. And if I understood you correctly, this cannot work anyway, as the write-operation is always attached to a single bean. What I want to have is a CSV File that looks like this (Assuming I have an additional attribute called 'date' within 'Bean'):Thanx in advance and best regards, René James Bassett 2012-12-06 Ok I see now! In order for that to work, you'll need a reference to the Bean in Recipient, e.g. public class Recipient { private String mail; private Bean bean; // getters/setters here } Then you can have the following as your field mapping: private static final String[] FIELD_MAPPING = new String[] { "mail", "bean.date"}; James Bassett 2012-12-07 Of course, for a simple scenario such as yours it's probably a lot easier to keep things simple and use a CsvListWriter instead of a CsvDozerBeanWriter. Yes it's not as cool, but it gets the job done :) for (Bean bean : beans) { for (Recipient recipient : bean.getRecipients()) { Object[] row = {recipient.getMail(), bean.getDate()}; listWriter.write(Arrays.asList(row), processors); } } Obviously there are limits to using CsvDozerBeanWriter - but for complex nested object graphs it is a lot easier to use.
http://sourceforge.net/p/supercsv/discussion/718795/thread/a055697b/?limit=50
CC-MAIN-2014-52
refinedweb
512
60.45
This article describes how you can fill in form fields and invoke buttons from code using SendKeys, without directly interacting with the UI. The initial examples do this from the same application, but it is later shown how to do this UI automation from a separate application. In this article, we’re going to use a simple login form as an example. It contains what you’d normally expect: fields to enter the username and password, and a Login button. Additionally, it contains an Automate button at the top which we’ll use to execute our automation code. You’ll notice that I already have something in the Automate button’s click event handler: SendKeys.Send("username"); If you try this, you might expect that something gets written in the username field. But alas, nothing happens. That’s because SendKeys is limited to sending keystrokes to the focused control on the currently active application. Therefore, to actually send text to the username field, we first have to focus it. We can try forcing focus on the username field: this.usernameField.Focus(); SendKeys.Send("username"); …and indeed that works. But that won’t quite work if we’re automating the UI from a second application, since it has no idea about the fields present in our login form. Therefore, another way is to actually send TAB keys to navigate to the desired control, before sending actual text. Special keys such as TAB and ENTER are represented by special codes such as {TAB} and {ENTER} (refer to the SendKeys documentation for a full list). Thus we can achieve the same effect like this: SendKeys.Send("{TAB}username"); And likewise, we can fill in the whole form, and finally invoke the Login button by first giving it focus and then sending an ENTER key: SendKeys.Send("{TAB}username{TAB}password{TAB}{ENTER}"); So you can see that the result is just what we expected: Naturally, keep in mind that tabbing to the desired control is entirely dependent on the tab index of the controls. If that changes, your automation code will have to change accordingly. It might not be an ideal approach, but it’s just about the best you can do for SendKeys if you want an application to send keystrokes to another. Speaking of which, so far we’ve taken the shortcut of doing everything within the same application, in which case giving focus to controls directly is just fine. Let us now create a second Windows Forms application, and see how we can use it to automate our login form’s UI. Actually, all we need is a simple form with a button, whose Click event handler will execute our automation code: Now as I said before, SendKeys works only with the currently active application. If we want to automate our login form, we’ll need some code to find it from the list of running applications, and activate it. This StackOverflow answer has some code that takes care of this. The first thing we need to do is find the process we want to automate. For that we need the name of the process. If it’s already running, you can find it in the Task Manager: Notice how if you’re running directly from Visual Studio, the process will contain a “.vshost” before the file extension. We can now get the process we want (Process is in the System.Diagnostics namespace): Process p = Process.GetProcessesByName("WinFormsLogin.vshost").FirstOrDefault(); Note that we omit the .exe extension from the process name above. Once that is done, we need to bring that process to the foreground using some code from the answer linked above. So first, import the Win32 SetForegroundWindow() function (DllImport requires the System.Runtime.InteropServices namespace): [DllImport ("User32.dll")] static extern int SetForegroundWindow(IntPtr point); Once we have this, we bring the process to the foreground, and send any keystrokes we need: Process p = Process.GetProcessesByName("WinFormsLogin.vshost").FirstOrDefault(); if (p != null) { IntPtr h = p.MainWindowHandle; SetForegroundWindow(h); SendKeys.SendWait("{ENTER}"); } And there you go, the Automator application invokes the automation button on the Login application: Now you’ll notice I’m kind of cheating here: I’m just sending the ENTER key to activate the Automate button in the Login form (which happens to have a tab index of zero, i.e. it’s the first thing to be focused). The applications you want to automate won’t normally have an Automate button. But just as you can send an ENTER key from one application to another, you can send other keys. We can thus do our automation anyway: Process p = Process.GetProcessesByName("WinFormsLogin.vshost").FirstOrDefault(); if (p != null) { IntPtr h = p.MainWindowHandle; SetForegroundWindow(h); SendKeys.Send("{TAB}username{TAB}password{TAB}{ENTER}"); } Great! You can use SendKeys for simple automation of Windows Forms applications by sending keystrokes – even across applications. If you want to automate Microsoft Word or anything of the sort, this won’t work, although there are alternatives. If you’re doing more serious stuff (e.g. WPF) there are entire APIs you can look at.
https://gigi.nullneuron.net/gigilabs/2015/02/page/2/
CC-MAIN-2021-25
refinedweb
851
64.71
#include <rte_flow.h> Verbose error structure definition. This object is normally allocated by applications and set by PMDs, the message points to a constant string which does not need to be freed by the application, however its pointer can be considered valid only as long as its associated DPDK port remains configured. Closing the underlying device or unloading the PMD invalidates it. Both cause and message may be NULL regardless of the error type. Definition at line 1928 of file rte_flow.h. Cause field and error types. Definition at line 1929 of file rte_flow.h. Object responsible for the error. Definition at line 1930 of file rte_flow.h. Human-readable error message. Definition at line 1931 of file rte_flow.h.
https://doc.dpdk.org/api-18.05/structrte__flow__error.html
CC-MAIN-2021-49
refinedweb
120
60.92
import "golang.org/x/text/encoding/charmap" Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252. var ( // ISO8859_6E is the ISO 8859-6E encoding. ISO8859_6E encoding.Encoding = &iso8859_6E // ISO8859_6I is the ISO 8859-6I encoding. ISO8859_6I encoding.Encoding = &iso8859_6I // ISO8859_8E is the ISO 8859-8E encoding. ISO8859_8E encoding.Encoding = &iso8859_8E // ISO8859_8I is the ISO 8859-8I encoding. ISO8859_8I encoding.Encoding = &iso8859_8I ) These encodings vary only in the way clients should interpret them. Their coded character set is identical and a single implementation can be shared. All is a list of all defined encodings in this package. CodePage437 is the IBM Code Page 437 encoding. CodePage850 is the IBM Code Page 850 encoding. CodePage852 is the IBM Code Page 852 encoding. CodePage855 is the IBM Code Page 855 encoding. CodePage858 is the Windows Code Page 858 encoding. CodePage862 is the IBM Code Page 862 encoding. CodePage866 is the IBM Code Page 866 encoding. ISO8859_1 is the ISO 8859-1 encoding. ISO8859_10 is the ISO 8859-10 encoding. ISO8859_13 is the ISO 8859-13 encoding. ISO8859_14 is the ISO 8859-14 encoding. ISO8859_15 is the ISO 8859-15 encoding. ISO8859_16 is the ISO 8859-16 encoding. ISO8859_2 is the ISO 8859-2 encoding. ISO8859_3 is the ISO 8859-3 encoding. ISO8859_4 is the ISO 8859-4 encoding. ISO8859_5 is the ISO 8859-5 encoding. ISO8859_6 is the ISO 8859-6 encoding. ISO8859_7 is the ISO 8859-7 encoding. ISO8859_8 is the ISO 8859-8 encoding. KOI8R is the KOI8-R encoding. KOI8U is the KOI8-U encoding. Macintosh is the Macintosh encoding. MacintoshCyrillic is the Macintosh Cyrillic encoding. Windows1250 is the Windows 1250 encoding. Windows1251 is the Windows 1251 encoding. Windows1252 is the Windows 1252 encoding. Windows1253 is the Windows 1253 encoding. Windows1254 is the Windows 1254 encoding. Windows1255 is the Windows 1255 encoding. Windows1256 is the Windows 1256 encoding. Windows1257 is the Windows 1257 encoding. Windows1258 is the Windows 1258 encoding. Windows874 is the Windows 874 encoding. XUserDefined is the X-User-Defined encoding. It is defined at Package charmap imports 5 packages (graph) and is imported by 46 packages. Updated 2016-04-21. Refresh now. Tools for package owners.
https://godoc.org/golang.org/x/text/encoding/charmap
CC-MAIN-2016-18
refinedweb
365
72.42
We advocate testing an application by testing its components thoroughly and then integrating those components as simply as possible. Specifically, "integration" for us is little more than choosing which implementations of various interfaces to use and then creating an application entry point object with references to those implementations. Which logging strategy do we use? How about log4J! We know that our components work with any implementation of the logging strategy interface. What kind of model? A JDBC-based (Java Database Connectivity) one, although our controller really only knows about our model interface, so an in-memory implementation, or one based on Prevayler will do. To us, this is integration. As a result, we tend not to emphasize end-to-end testing for correctness, but rather to give us confidence that we have built the features we needed to build. Object tests tell you whether you built the thing right; whereas end-to-end tests help you decide whether you built the right thing. There are certain aspects of J2EE applications that people associate with end-to-end tests rather than object tests. These include page flow—or navigating a Web application—and using container services, such as security and transactions. We discuss these topics in recipes in this chapter, showing you how to test these behaviors in isolation—as object tests. We do not want to give the impression that we shy away from end-to-end tests—that is, testing an application by simulating the way an end user interacts with it through its end-user interface. We use end-to-end tests to play a different role than other programmers do: we use end-to-end tests to help us determine whether what we have built actually does what our customers need. We no longer see JUnit as the best tool available for testing an application from end to end. We use Fit and its companion tool, FitNesse. Note: We are certainly not the only people who see end-to-end tests in this role: we got the idea from the Agile community at large. Still, while Agile developers remain in the minority, organizations will continue to see end-to-end tests as their primary tool for validating software, an approach that we feel ultimately wastes resources that could be better spent ensuring correctness from the inside out through programmer tests. We will describe Fit only briefly. Imagine writing tests entirely as spreadsheets and word-processor documents. You could annotate your tests with plain-language descriptions of what they verify— mix code and text together so that both the programmers and the nonprogrammers can follow them. Now imagine running those tests through software that decorates your documents green for the parts that are right (tests pass) and red for the parts that are wrong (tests fail). That is Fit, and it allows those with business knowledge to write executable tests, even if they are not programmers. FitNesse is a Wiki that can execute Fit tests, providing an excellent way to organize them and collaborate on them. Many people have designated FitNesse as "the way they do end-to-end tests." (Pronounced "fit-NESS." Micah Martin, cocreator of FitNesse, tells the story how Uncle Bob (Robert C. Martin) was tired of executing Fit tests from the command line and wanted to execute them "with finesse.") But this is a chapter on writing object tests for aspects of J2EE applications that one usually tests from end to end. In here is a collection of recipes that will help you test certain aspects of J2EE applications more effectively. These are behaviors that tend to be sprinkled throughout the application: page flow, broken links, security, transactions, and JNDI (Java Naming and Directory Interface). We have added a recipe related to the Struts application framework, but for more on testing Struts applications, we recommend the StrutsTestCase project. It provides both a mock-objects approach (testing outside the application server) and a Cactus approach (testing inside the application server). It embodies many of the techniques we have described, and, rather than duplicate their fine work, we refer you to them. Test page flow Problem You want to verify that a user can navigate through your Web application's pages correctly, and you want to make the verification without involving all the machinery of the application itself. Background Even though you will execute end-to-end tests that can help uncover problems with page flow, it is generally easier to verify page flow without involving your application's business logic, presentation layer, external resources, and so on. What we recommend you do is translate your Web application into a large state diagram where moving from page to page depends on two things: - The action the user took - The result of the action the user took Some actions have a single outcome, such as clicking a link to browse a catalog. For the most part, that action cannot fail—when you click that link, you end up at the catalog page. Some actions have multiple outcomes, such as "OK" and "failed." At a registration page, for example, if submitting the registration form fails, then the shopper stays at the registration page. In your diagram, you can label those arrows using a format of action/result, so that "submit/OK" means "follow this arrow if submitting the form is successful." When we model page flow this way, it does not look very complex, and so it ought to be relatively easy to test—after all, they are just names of pages, names of actions, and names of results. They are all strings! How hard can that be? Not hard at all. If you can focus your attention like this on just the page flow of your system, then certainly you can extract the page-to-page navigation code from your system into a single navigation "engine" that operates on navigation data. The Struts Web application framework3 works on this principle, and we discuss how much simpler it is to verify page flow on a Struts application in "Test Navigation Rules in a Struts Application." (We recommend James Turner and Kevin Bedell, Struts Kick Start (Sams Publishing, 2002) as well as Ted Husted et al., Struts in Action (Manning, 2002). The former is an excellent tutorial and the latter shows you what Struts can really do.) This recipe shows a simple example of how to create a refactoring safety net, refactor navigation logic to a single class, and then verify the resulting data. Recipe We will start with what seems to be the simpler test: an end-to-end test that verifies the ability to move from one page to another. Returning to our Coffee Shop application, we first verify that we can move from the Welcome page to the Catalog page. We can use HtmlUnit to first load the Welcome page, and then push the Browse Catalog button and verify that the resulting Webpage is indeed the Coffee Catalog page. Of course, before we execute this test, we need to deploy the application to a live application server and start the server. You can see the test in question in Listing 1. Listing 1. NavigationTest, a sample page flow test package junit.cookbook.coffee.endtoend.test; import java.net.URL; import junit.framework.TestCase; import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; public class NavigationTest extends TestCase { private WebClient webClient; protected void setUp() throws Exception { webClient = new WebClient(); webClient.setRedirectEnabled(true); } public void testNavigateToCatalog() throws Exception { Page page = webClient.getPage( new URL("")); assertTrue( "Welcome page not an HTML page", page instanceof HtmlPage); HtmlPage welcomePage = (HtmlPage) page; HtmlForm launchPointsForm = welcomePage.getFormByName("launchPoints"); HtmlInput htmlInput = launchPointsForm.getInputByName("browseCatalog"); assertTrue( "'browseCatalog' is not a submit button", htmlInput instanceof HtmlSubmitInput); HtmlSubmitInput browseCatalogSubmit = (HtmlSubmitInput) htmlInput; Page page2 = browseCatalogSubmit.click(); assertTrue( "Catalog page not an HTML page", page2 instanceof HtmlPage); HtmlPage catalogPage = (HtmlPage) page2; assertEquals( "Coffee Shop - Catalog", catalogPage.getTitleText()); } } There are a number of things about this test that are worthy of concern. We need to deploy the application and start the application server in order to execute it. Although this seems like a reasonable requirement to verify page flow, any number of unrelated problems can make it impossible to execute this test: EJB (Enterprise JavaBeans) deployment problems, servlet/URL mapping problems, and so on. That is not to say that these problems are not important enough to fix, but we generally prefer to verify them separately. These tests are meant to verify page flow and nothing else. The test hard-codes information about the server to which the application is deployed ( localhost) and the port on which it is listening (8080). Both of these pieces of information vary from environment to environment, so at a minimum, you ought to refactor the information to some external source, such as a configuration file. This makes the tests slightly more complex to configure and execute correctly. The test depends on the correctness of the Webpages themselves, which is not guaranteed. If there is a problem with either the Welcome page or the Catalog page, then this test might fail, even though the problem is not navigation related. Certainly you will test the pages themselves in isolation using the techniques in Chapter 12, "Testing Web Components," so there is no need to duplicate that effort here. This test hard-codes information about the structure of the Webpages—the form named launchPoints and the submit button named browseCatalog. If someone changes these names, then these tests will fail, making them somewhat brittle. A Web author ought to be able to change that button to a link, get the URL right, and the only tests to fail would be the ones for the page itself. This test does not allow that to happen. Now please do not get us wrong: the foregoing is not an indictment of HtmlUnit. Far from it. HtmlUnit is an excellent package that does a very good job of automating end-to-end tests. With its focus on analyzing the result of a Web request—its comprehensive HTML page object model—HtmlUnit is an ideal choice for automating end-to-end tests for Web applications, so HtmlUnit is not the issue here. The issue is using a hammer to kill a fly, as it were: using end-to-end tests (no matter how you write them) to verify page flow invites the kinds of problems we have just described. Instead, we ought to write tests that focus on the navigation rules themselves. This is the kind of test we want to write, assuming the existence of an object representing a "navigation engine:" public void testNavigateToCatalog() { assertEquals( "Catalog Page", navigationEngine.getNextLocation( "Browse Catalog", "OK")); } This test simply says, "If I push the button marked Browse Catalog and everything goes OK, then I should be taken to the Catalog page." The test is expressed in a somewhat abstract fashion in terms of locations, actions, and results: a location is usually a Webpage, an action is usually either submitting a form or clicking a link, and a result is a description of the result of the action. If we want to talk in terms of a finite state machine, the locations are the machine's states and the action/result pairs are the machine's transitions. We can model navigating through our site entirely in terms of locations and actions. A location corresponds to the URI of a Webpage or a Webpage template (Velocity template or JSP (JavaServer Pages)). An action corresponds to the URI of a form submit button or of a hypertext link. This means that we need some way to translate incoming request URIs into locations and actions, and vice versa. Once we give each URI the name of either a location or an action, we can ignore the details of which JSP displays the catalog page or which request parameter indicates "add a product to the shopcart." We can test that all separately. First, Listing 2 shows our Coffee Shop Controller using a separate requesttoaction mapper. Listing 2. CoffeeShopController using an Action Mapper private void handleRequest( HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String forwardUri = "index.html"; String userName = "jbrains"; try { String actionName = actionMapper.getActionName(request); log("Performing action: " + actionName); if ("Browse Catalog".equals(actionName)) { CoffeeCatalog catalog = model.getCatalog(); CatalogView view = new CatalogView(request); view.setCatalog(catalog); forwardUri = view.getUri(); } else if ("Add to Shopcart".equals(actionName)) { AddToShopcartCommand command = makeAddToShopcartCommand(request); executeCommand(command); } else { log("I don't understand action " + actionName); } } catch (Exception wrapped) { throw new ServletException(wrapped); } request.getRequestDispatcher(forwardUri).forward( request, response); }
http://www.javaworld.com/article/2072923/testing-debugging/testing-j2ee-applications.html
CC-MAIN-2017-26
refinedweb
2,093
52.6
Problem:Developing Algorithm to interchange of the values stored in two given variables. The exchanging of the values between two given variables is commonly known as value “swap” and the process is known as “swapping”.This can be archived by various approaches. Below, we will discuss about two different approaches with a total of three processes, and see their benefits and pitfalls. Article Index - Introduction - Algorithm 1 : Exchanging with three variables - Algorithm 2 : Exchanging with two variables (Arithmetic) - Algorithm 3 : Exchanging with two variables (Bitwise) - Discussion - Download Source Code Introduction If ‘a=5’ and ‘b=10’ The first idea which comes into mind (commonly in beginner ) is as below. But this is wrong a=5; b=10; a=b; b=a Let us discuss the problem with graphical example. We draw two boxes with the left box representing variable ‘a’ and the right box representing variable ‘b’. When the ‘a = b’ is executed the value at variable ‘a’ is overwritten by the value of ‘b’ and thus lost. Next, when ‘b = a’ gets executed it transfers the current value of a into ‘b’. The current value of ‘a’ is the initial value of ‘b’ (ie. 10). So at the end both the variables have the same value, so the swap operation fails. Diagram 1 shows this process graphically. The above described process and the below diagram is wrong, it is just to clarify the common mistake and for better conception for the beginners. Algorithm Discussion 1 (Three Variables) We can see that the above method has failed. The main problem is that when performing the first operation ‘a=b’,the value of variable a is overwritten by the value at variable b, and is permanently destroyed,and now contains the same value as variable ‘b’. We need to develop such a process that the initial value of variable ‘a’ is preserved before we assign it with the value of variable ‘b’. We will now discuss this. If we store the value of ‘a’, in a third temporary variable, before overwriting it with the value at variable ‘b’ the initial value at variable ‘a’ could be retrieved from the temporary variable, when we need to overwrite ‘b’. This will make this “swap” operation correct. Let us introduce another third variable named ‘t’ which will represent the temporary variable. First we store the value at variable ‘a’ into variable ‘t’. Second we overwrite the value at variable ‘a’ with the value at variable ‘b’. Third, we overwrite the value at variable ‘b’ with the value at variable ‘t’; which was actually the initial value of variable ‘a’. Thus the value of the variables ‘a’ and ‘b’ are interchanged. The operation sequence will be as described below. int a,b,t; a=5; b=10; /* The interchange operations */ t=a; a=b; b=t; This process is described graphically in Diagram 2. The striked out values out represents the variables which are overwritten. The values inside the arrows represent the values which are overwriting the values in the variables which the arrow points to. Algorithm 1 Step1: Assign the initial value at variable 'a' into temporary variable 't' : t = a Step2: Assign the initial value of variable 'b' to variable 'a' : a = b Step3: Assign the value at temporary variable 't' to variable 'b' : b = t C Source Code #include <stdio.h> int main (void) { int a, b, temp; printf ("\nProgram to Swap two variables using 3 variables."); printf ("\n\nEnter two variables (\"a\" and \"b\") seperated by a blankspace:"); scanf ("%d %d", &a, &b); printf ("\n\nBEFORE Swap\n a=%d\tb=%d", a, b); temp = a; a = b; b = temp; printf ("\n\nAFTER Swap\n a=%d\tb=%d", a, b); return 0; } Get the C implementation of Algorithm 1 Here Two variable solutions are very popular and commonly asked at interviews and asked in exams. We will be discussing two Algorithms for 2 variable variations of swapping values between variables. But none of the two are reliable and has their limitations. The best way is to use the three variable method. Algorithm Discussion 2 (Two Variables) In Algorithm 1 we interchanged the values of two variables with the help of another third temporary variable. In this Algorithm 2 we will discuss how to achieve this interchange without the third variable. In this section we will algebraically to solve this problem. By using simple addition and subtraction we will swap the values of two variables without any third variable. The processes are describer in detail below. - We will at first store the sum of value at variable a and value at variable b into variable a. Step 1 a = a + b; - Then we subtract the value at variable ‘b’ from the value at variable ‘a’ and store it to variable ‘b’. In the previous step a contains ‘a + b’. We substitute the current value at variable ‘a’ and notice that variable ‘b’ is now holding the initial value of variable ‘a’. The process in Step 2 describes the fact. Substitutions are in comments. b=a-b; //where a=a+b b=(a+b)-b b=a - Then we subtract the value at variable ‘b’ from the value at variable ‘b’ and store it to variable ‘a’. Substituting the current values of variable a and b which are ‘a + b’ and ‘a’ respectively we get Step 3. Substitutions are in comment. a=a-b; //where a=a+b and b=a a=(a+b)-(a) a=b After these three steps we notice that the values in the variables ‘a’ and ‘b’ are interchanged, as in Step 2 ‘b=a’ represents that the initial value of variable ‘a’ is transfered in variable ‘b’, and from Step 3 ‘b=a’ represents that the initial value of variable ‘b’ is transfered in variable ‘b’. Let us take the example ‘a=5’ and ‘b=10’ and run the above three steps on them. The dry run is shown below. Algorithm 2 Step1: Add value at variable 'a' with value at variable 'b' and assign the total to variable 'b' : 'a = a + b' Step2: Subtract value at variable 'b' from value at variable 'a' and store the answer to variable 'b' : 'b = a - b' Step3: Subtract value at variable 'b' from value at variable 'a' and store the answer to variable 'b' : 'a = a - b' C Source Code #include <stdio.h> int main (void) { int a, b; printf ("\nProgram to Swap two variables using 2 variables."); printf ("\n\nEnter two variables (\"a\" and \"b\") seperated by a blankspace:"); scanf ("%d %d", &a, &b); printf ("\n\nBEFORE Swap:\n a=%d\tb=%d", a, b); a = a + b; b = a - b; a = a - b; printf ("\n\nAFTER Swap:\n a=%d\tb=%d", a, b); return 0; } Click below to get the source code Get the C Implementation of Algorithm 2 Here Other operators could also be used to achieve this interchange. Like the “*” (Multiplication) and the “/” (Division) operators could also be used as the Plus and the minus operator used in Algorithm 2 But while division the floating part gets lost and the number gets changed like 1.25 gets 1 as it looses the float part. While multiplying if the two numbers are big then the of the variable can overflow resulting in wrong result. Algorithm Discussion 3 (Bitwise XOR Operator) In this section we will discuss abut the “swapping” technique without the third temporary variable as used in Algorithm1 and use only two variables. Unlike in the previous algorithm Algorithm 2 we will not use the classical algebraic method. This approach would be with Boolean Algebra. There are basically three boolean functions in Boolean Algebra,AND, OR and NOT, with which we can construct all other functions. In this technique we will need such a compound function, XOR function. Without going in details in other functions we will first discuss about the XOR function in brief. If there are two binary digits or bits ‘x’ and ‘y’ and the XOR function is applied on them, then for all the four possible bit combination for the two values the function output will be as described in the truth table of XOR in Table 2 Where “^” is the Bitwise XOR operator in C Programming Language. Do not mix it up with the exponent operator found in other programming languages. In this table the variable f represents the result of the XOR operation of the two variables. As we can see the XOR function practically describes that whenever the two values of the variable, on which the function is being applied, are equal the output f will be 0. That is, when both the variables ‘x’ and ‘y’ are 1 or 0. On the other hand when the values of the variables are different, the output f will be 1. That is when the variables ‘x’ is ‘1’ and ‘y’ is ‘0’ or vice versa. In the case, when the binary numbers will consist of two or more bits, we will apply the XOR function on each individual bit one by one and get the answer. For example if the two numbers are 11 and 10 in binary, then then the XOR function will first XOR the first bit of both the numbers and get the first bit of the result. Then it will XOR the second bit of both of the numbers and get the second bit of the result (SeeTable 3). Thus with ‘n’ bit numbers we will XOR the first bit of the first number with the first bit of the second number and get the first bit of the output, and proceed XOR ing between the second,third,fourth and up to nth bit of the two binary numbers and get the second,third,fourth, and up to nth of the output numbers. We interpret the string of output bits and get the XORed number. Table 4 demonstrates the XOR Operation between one three bit number 100 and one 4 bit number 1101. To achieve this we add an extra 0 in the MSB position as to make it 4 bits long, then apply the previous method. In this case we get the output 1001 , this can be easily understood if the previous technique is followed and using the Truth table if XOR function (Table 2) if case of each bit operation. When we will apply the XOR function upon two integers in Decimal number system, it first gets converted into binary internally and then the XOR function is applied, as described above, and the answer is acquired, and converted in Decimal again. As an example if XOR function is applied upon two decimal numbers 5 and 3 then it will be as showed below in Table 5 At first 5 and 3 are converted into binary equivalents and then applied XOR function and after acquiring the XOR value in Binary, it as again converted into Decimal. As per boolean algebraic theorems it can be proved that ‘a ^ b = b ^ a’ , also ‘a ^ a = 0’ or ‘b ^ b = 0’ (it can also be easily be seen without need of any proof). In C Programming Language the “^” represents the XOR Operator (Implemented as ‘a^b’), As in other programming languages this operator stands for the power, but is C there is no power operator, and this operator is used as the bitwise XOR operator. But what is how would we use this operator to interchange the values between two variables? An operation sequence with the XOR operation to interchange values between two variables is described below and then discussed in detail how it works. Algorithm Discussion - The XOR function is implemented between two variables ‘a’ and ‘b’, and the answer of the ‘XOR’ operation is assigned into variable ‘a’. (Which overwrites the initial value at variable ‘a’). That is ‘a = a ^ b’ /* The Operation */ a = a ^ b; - The XOR operation is implemented between variables ‘a’ and ‘b’, again, and the answer of the XOR operation is assigned into variable ‘b’. That is ‘b = a ^ b’. Variable ‘a’ contains the value of ‘a ^ b’ (from Step 1), so the operation ‘a ^ b’ is practically ‘b = ( a ^ b ) ^ b’ after substituting ‘a’ with it’s new value ‘a ^ b’ (from Step 1). Solving ‘b = ( a ^ b ) ^ b’ we get ‘b = a’ . Step 2 is shown with the substitutions of each variable in comments. /* The Operation */ b = a ^ b; /* Substitution */ b = ( a ^ b ) ^ b; //because a = a ^ b b = a ^ 0; b = a; - Next the XOR operation is implemented between variables ‘a’ and ‘b’, for the third and the last time, and the answer is assigned into variable ‘a’. That is ‘a = a ^ b’. Currently variable ‘b’ contains the initial value of variable ‘a’ and, variable ‘a’ contains value of ‘a ^ b’. So the operation ‘a = a ^ b’ is practically ‘a = ( a ^ b ) ^ a’ after substituting with the current values variable ‘a’ and ‘b’. Step 3 is shown with the substitutions of each variable in comments. /* The Operation */ a = a ^ b; /* Substitution */ a = ( a ^ b ) ^ a; //because a = a ^ b and b = a a = b ^ 0; a = b; After these steps we can see that the final values of variable ‘a’ and ‘b’ are interchanged. (a=b and b=a proofs it). Let us take the example of ‘a=5’ and ‘b=3’ and apply these steps on them and see the results. Algorithm 3 Step1: Apply OR function between variables 'a' and 'b' and store the XOR output into variable 'a' : 'a = a ^ b' Step2: Apply XOR function between variables 'a' and 'b' and store the XOR output into variable 'b' : 'b = a ^ b' Step3: Apply XOR function between variables 'a' and 'b' and store the XOR output into variable 'a' : 'a = a ^ b' Where “^” is the bitwise XOR operator. C Source Code #include <stdio.h> int main (void) { int a, b; printf ("\nProgram to Swap two variables using 2 variables and bitwise XOR Operator."); printf ("\n\nEnter two variables (\"a\" and \"b\") seperated by a blankspace:"); scanf ("%d %d", &a, &b); printf ("\n\nBEFORE Swap:\n a=%d\tb=%d", a, b); a ^= b; b ^= a; a ^= b; printf ("\n\nAFTER Swap:\n a=%d\tb=%d", a, b); return 0; } Get the C Implementation of Algorithm 2 Here Discussion Two variable methods are very popular in the beginners who are tempted to use them in the code. The two variable methods has very much limitations, and actually internally the two variable method uses the third variable. Algorithm 2: In this method we have used arithmetic operators. When we add the two numbers, the result of the addition can overflow the limit of the variable’s range and come out with wrong results. For an example let us consider 2byte integers, which have a limit 32767. Now if ‘a = 10’ and ‘b = 32760’ , then executing the first operation ‘a = a + b’ will make an overflow and instead of 32770 ‘a’ will contain -32766. Same will be the case when “*” and “/” operators are used, in this case the overflows will occur for even lower values and divide by zeros can occur. Algorithm 3: In this method we have used the bitwise XOR operators. This will only work with integer variables, this is because bitwise operators are only defined for integer values and will only work on them. Results when using this method on char, long int, or short int is compiler dependent and might draw undefined behaviour. This method is far better than Algorithm 2, when used on integer variables. Although we think we are saving some bytes of memory, a temporary variable is used internally when executing Algorithm 2 and 3. Note another thing: The two variable methods needs three transfer operations and 3 arithmatic or bitwise operations, where the three variable method needs only three transfer operation, so the three variable method will be faster than the two variable method. Many applications like sorting, uses swapping, and it has to be done a huge number if time. Like if the swap operation is done 1000000000 times then the two variable versions take twice the time than the three variable version (when compiled without the -O tags). Download Source Code One thought on “Swapping Values” excellent ……..
https://phoxis.org/2009/07/20/swapping-values/
CC-MAIN-2019-18
refinedweb
2,711
65.86
On Tue, Aug 28, 2007 at 10:21:14AM +0200, Dominik 'Rathann' Mierzejewski wrote: > On Monday, 27 August 2007 at 23:11, Axel Thimm wrote: > > On Mon, Aug 27, 2007 at 07:15:07PM +0200, Dominik 'Rathann' Mierzejewski wrote: > > > On Saturday, 25 August 2007 at 01:01, Axel Thimm wrote: > > > > On Fri, Aug 24, 2007 at 11:44:36PM +0200, Dominik 'Rathann' Mierzejewski wrote: > > > > > > I think rpm5 in Fedora is dangerous. At the very least it reverses > > > > > > the ordering of letters and digits and thus breaks a ton of packaging > > > > > > techniques. Any *-1.fc8 -> *.1.1.fc8 upgrade path is busted for > > > > > > example. > > > > > > > > > > Are you 100% sure? I've seen Jeff deny this on IRC. > > > > > > > > Index: rpmvercmp.c > > > > =================================================================== > > > > RCS file: /cvs/devel/rpm/lib/rpmvercmp.c,v > > > > retrieving revision 2.8.2.2 > > > > diff -u -b -B -w -p -r2.8.2.2 rpmvercmp.c > > > > --- rpmvercmp.c 27 Aug 2006 12:58:19 -0000 2.8.2.2 > > > > +++ rpmvercmp.c 26 Apr 2007 22:36:26 -0000 > > > > @@ -76,7 +76,7 @@ int _rpmvercmp(const char * a, const cha > > > > /* different types: one numeric, the other alpha (i.e. > > > > empty) */ > > > > /* numeric segments are always newer than alpha segments */ > > > > /* XXX See patch #60884 (and details) from bugzilla > > > > #50977. */ > > > > - if (two == str2) return (isnum ? 1 : -1); > > > > + if (two == str2) return (isnum ? -1 : 1); > > > > if (isnum) { > > > > /* this used to be done by converting the digit segments > > > > */ > > > > > > The code present in current CVS HEAD is a bit different. Also I can't find > > > this change in rpm5.org's CVS. Which revision were you comparing to 2.8.2.2? > > > > I copy and pasted this from an original mail to rpm-devel by rpm5's > > developer. Any later refactoring didn't undo the change AFAIK. > > I'm willing to test this with current CVS HEAD. Do you have a test case? > If not, I'll try testing it on my own when I get some free time. Test case? See above: "Any *-1.fc8 -> *.1.1.fc8 upgrade path is busted" (where the second should had read hyphen instead of the first dot, but you get the picture). But you don't need to empirically test, read the code especially the parts that advertize full dpkg compatibility achived by putting letters higher than numbers. Even refactored you either are compatible to rpm.org or dpdkpg in ordering, both is not possible. -- Axel.Thimm at ATrpms.net Attachment: pgp85R03S0j41.pgp Description: PGP signature
https://www.redhat.com/archives/fedora-advisory-board/2007-August/msg00157.html
CC-MAIN-2014-23
refinedweb
406
67.76
I: import pygame pygame.init() screen = pygame.display.set_mode([800, 600], pygame.OPENGL | pygame.DOUBLEBUF) from OpenGL.GL import * from OpenGL.GLU import * As you can see I'm also using pygame here. The exception happens on the last line where importing GLU. The traceback is on the end of this post. I can fix this problem by moving the OpenGL import lines before creating the display. Maybe the example script is all wrong and I shouldn't be doing it this way. Meaning it might be just stupid to create the screen before importing all the OpenGL stuff. But anyway I wanted you to know this. So this is not a show stopper for me but I'm just reporting this if the developers want to do something about it. Maybe handle the exception in some way. Thanks for your attention, Aki Traceback (most recent call last): File "testaa.py", line 5, in <module> from OpenGL.GLU import * File "/usr/lib/python2.5/site-packages/OpenGL/GLU/__init__.py", line 10, in <module> from OpenGL.GLU.glunurbs import * File "/usr/lib/python2.5/site-packages/OpenGL/GLU/glunurbs.py", line 147, in <module> cb = _callbackWithType( funcType ) File "/usr/lib/python2.5/site-packages/OpenGL/GLU/glunurbs.py", line 140, in _callbackWithType simple.gluNurbsCallback File "/usr/lib/python2.5/site-packages/OpenGL/platform/baseplatform.py", line 192, in copyBaseFunction extension = original.argNames, File "/usr/lib/python2.5/site-packages/OpenGL/platform/baseplatform.py", line 134, in createBaseFunction extension = extension, File "/usr/lib/python2.5/site-packages/OpenGL/platform/baseplatform.py", line 80, in constructFunction if extension and not self.checkExtension( extension ): File "/usr/lib/python2.5/site-packages/OpenGL/platform/baseplatform.py", line 158, in checkExtension current = set.get( name ) TypeError: list objects are unhashable -- Aki Koskinen Aki Koskinen wrote: > Maybe the example script is all wrong and I shouldn't be doing it > this way. Meaning it might be just stupid to create the screen before > importing all the OpenGL stuff. While not necessarily wrong, it's a somewhat unusual thing to do. Mostly people tend to put all the imports needed by a module at the top of the module, unless there's a particular reason to do otherwise. It is a somewhat unintuitive requirement, though. If it can't be fixed, the error message could perhaps be improved. -- Greg Aki Koskinen wrote: > I: > ... > line 192, in copyBaseFunction > extension = original.argNames, > File "/usr/lib/python2.5/site-packages/OpenGL/platform/baseplatform.py", > Stupid error on my part there, obviously just a cut-and-paste error. I've fixed the function in bzr, the line should read: extension = original.extension Sorry about that, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder
http://sourceforge.net/p/pyopengl/mailman/message/20795111/
CC-MAIN-2015-40
refinedweb
453
62.75
Hi, I've seen a program called guessing game in a book. There are basically 3 players in the game. The program generates a random number and the players guess for that number. I wrote my own code for it and need your advice on how to improve the Object Oriented concept in the program. Please tell me the design flaws in my program. Please find the program below: NOTE: I've named the classes as they were in the book itself, but the code is different. GameLauncher.class:- This is the main class package com.XXX; public class GameLauncher { /** * @param args */ public static void main(String[] args) { GuessGame game = new GuessGame(); game.startGame(); } } Player.class: - In this class the player guesses the number and it is compared to the targetnumber. package com.XXX; public class Player { static int number; public boolean guess(int targetNumber) { number= (int) (Math.random()*10); System.out.println("the number guessed is"+number); if(number==targetNumber) { return true; } else return false; } } GuessGame.class : - This class generates the targetnumber. package com.vamsi; public class GuessGame { Player player1; Player player2; Player player3; public void startGame() { player1 = new Player(); player2 = new Player(); player3 = new Player(); int targetNumber =(int) (Math.random() *10); System.out.println("the number to be guessed is "+targetNumber); while(true) { boolean result1 = true; boolean result2 = true; boolean result3 = true; result1 = player1.guess(targetNumber); result2 = player2.guess(targetNumber); result3 = player3.guess(targetNumber); if(result1==true) { System.out.println("the correct number is guessed by player1. The number is "+Player.number); break; } else if(result2==true) { System.out.println("the correct number is guessed by player2. The number is "+Player.number); break; } else if(result3==true) { System.out.println("the correct number is guessed by player3. The number is "+Player.number); break; } /*else { System.out.println("The number guessed is"+Player.number); }*/ } } } Thanks, NewCoder :)
https://www.daniweb.com/programming/software-development/threads/371472/oop
CC-MAIN-2017-34
refinedweb
307
54.08
Casts¶ Mypy supports type casts that are usually used to coerce a statically typed value to a subtype. Unlike languages such as Java or C#, however, mypy casts are only used as hints for the type checker, and they don’t perform a runtime type check. Use the function cast to perform a cast: from typing import cast, List o = [1] # type: object x = cast(List[int], o) # OK y = cast(List[str], o) # OK (cast performs no actual runtime check) To support runtime checking of casts such as the above, we’d have to check the types of all list items, which would be very inefficient for large lists. Use assertions if you want to perform an actual runtime check. Casts are used to silence spurious type checker warnings and give the type checker a little help when it can’t quite understand what is going on. You don’t need a cast for expressions with type Any, or when assigning to a variable with type Any, as was explained earlier. You can also use Any as the cast target type – this lets you perform any operations on the result. For example: from typing import cast, Any x = 1 x + 'x' # Type check error y = cast(Any, x) y + 'x' # Type check OK (runtime error)
http://mypy.readthedocs.io/en/latest/casts.html
CC-MAIN-2017-26
refinedweb
216
62.11
WE MOVED TO ZULIP => <= user_messages[:filled?, rule: :address]returns nil not the provided custom message oh no, the example is wrong. It should no be nested in another rules. en: errors: rules: user: filled?: "name cannot be blank" rules: address: filled?: "You gotta tell us where you live" should be en: errors: rules: user: filled?: "name cannot be blank" address: filled?: "You gotta tell us where you live" messages = Dry::Validation::Messages::YAML.load(['/tmp/errors.yml']) user_messages = messages.namespaced(:user) user_messages[:filled?, rule: :address] # => "You gotta tell us where you live" required(:status, Status)but that didn't seem to work Hi. First of all thank you for great dry-rb gems. Dry-v is awesome! :) I have a problem. I would like to build form schema where some fields are known and some other fields should be dynamically created. I thought that I use Form.with(custom_struct: custom_struct).(params) with option within configure block [like here:] but it doesn't work. I cannot use custom_struct inside the schema definition: Form = Dry::Validation.Form do configure do option :custom_struct end required(:name).filled(:str?) required(:surname).filled(:str?) optional(:custom).schema do # error: "undefined method `each' for #<UnboundMethod:0x007f91b9978608> (NoMethodError)" custom_struct.each do |element| required(element.name) end end end I've found this topic [] in the forum but need some examples. Could you help me somehow? Thanks! Dry::Typesas my sample library. Figured I would share here :P
https://gitter.im/dry-rb/chat?at=58d06bafb809ca5f4a65e080
CC-MAIN-2021-17
refinedweb
240
62.85
Hi everybody, I hav litle problems with the communication to the DHT22 sensor. I use a ESP32 LOLIN board and the communikation is not continious (sorry about my bad englisch) I start the sketch and i get betwen 4 – 5 telegram´s in the correct way but after this it´s a little bit bingo playing to get data from the sensor. I tested diferent sensors and diferent pull up resistors but … has anywon an idea about this problem? The used code is from Rui´s tutorial (original only the pin is canched). I also had problems as you say but with the DHT11 and a copy from the Arduino Nano. In someway my sensor as burnout and made a short circuit with the Arduino. I end up to buying a DHT22 with more quality and I solved the problem with Arduino Uno. Try it with another microcontroller… Good luck! Hi! I think it might be a problem with the power or you are trying to read the readings very frequently. What’s the timing in seconds between each reading? When the DHT11/DHT22 failed to read from DHT sensor doesn’t work, it’s usually: - Power issue - Wrong wiring - Faulty DHT - Faulty ESP8266 Please read our DHT11/DHT22 Troubleshooting Guide. Hey Bruno, thank´s for your answer. I made some test´s with other ESP32 board´s and with diferent sensor´s, but nothing getting better. I think the timing is the problem and i write more simple sketch for reading the sensor. Later more… now I must go cooking Hi Rui, the power is a 10A industrial power suply. The timing… might be able. I test another sketch whitch is more simple. #include // for DHT22, // VCC: 5V or 3V // GND: GND // DATA: 16 int pinDHT22 = 16;); } With this code it work´s better but not perfekt. Every 10 - 20 reading the conektion to the sensor dosn´t work. Not sure why, but sometimes I also get some reading errors, but it’s definitely like 1 every 100 readings… Hi Rui, I play´d a little bit with library´s and get a good result with the DHTesp.h. Here is the code #include "DHTesp.h" DHTesp dht; void setup() { Serial.begin(115200); Serial.println(); Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)\tHeatIndex (C)\t(F)"); dht.setup(17); // Connect DHT sensor to GPIO 17 }.print(dht.toFahrenheit(temperature), 1); Serial.print("\t\t"); Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1); Serial.print("\t\t"); Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1); } In the last 5 hours it work´s realy fine. The only thing is that Iget the best result with no pullup. i dont know why… Nice sunday Peter
https://rntlab.com/question/problem-with-the-dht22-sensor/
CC-MAIN-2019-39
refinedweb
457
65.73
Learning Bing Maps API — Save 50% Obtain geographical data from Bing Maps and display them on the map with this book and ebook. (For more resources related to this topic, see here.) So far we have worked with relatively small sets of data; for larger collections, Bing Maps provide Spatial Data Services. They offer the Data Source Management API to load large datasets into Bing Maps servers, and the Query API to query the data. In this article, we will use the Geocode Dataflow API, which provides geocoding and reverse geocoding of large datasets. Geocoding is the process of finding geographic coordinates from other geographic data, such as, street addresses or postal codes. Reverse geocoding is the opposite process, where the coordinates are used to find their associated textual locations, such as, addresses and postal codes. Bing Maps implement these processes by creating jobs on Bing Maps servers, and querying them later. All the process can be automated, which is ideal for huge amounts of data. Please note that strict rules of data usage apply to the Spatial Data Services (please refer for full details). At the moment of writing, a user with a basic account can set up to 5 jobs in a 24-hour period. Our task in this article is to geocode the addresses of ten of the biggest technology companies in the world, such as Microsoft, Google, Apple, Facebook, and so on, and then display them on the map. The first step is to prepare the file with the companies' addresses. Geocoding dataflow input data The input and output data can be supplied in the following formats: - XML (content type application/xml) - Comma separated values (text/plain) - Tab-delimited values (text/plain) - Pipe-delimited values (text/plain) - Binary (application/octet-stream) used with Blob Service REST API We will use the XML format, for its clearer declarative structure. Now, let's open Visual Studio and create a new C# Console project named LBM.Geocoder. We then add a Datafolder, which will contain all the data files and samples with which we'll work in this article, starting with the data.xml file we need to upload to the Spatial Data servers to be geocoded. <?xml version="1.0" encoding="utf-8"?> <GeocodeFeed xmlns="" Version="2.0"> <GeocodeEntity Id="001" xmlns=" 2010/5/geocode"> <GeocodeRequest Culture="en-US" IncludeNeighborhood="1"> <Address AddressLine="1 Infinite Loop" AdminDistrict="CA" Locality="Cupertino" PostalCode="95014" /> </GeocodeRequest> </GeocodeEntity> <GeocodeEntity Id="002" xmlns=" geocode"> <GeocodeRequest Culture="en-US" IncludeNeighborhood="1"> <Address AddressLine="185 Berry St" AdminDistrict="NY" Locality="New York" PostalCode="10038" /> </GeocodeRequest> </GeocodeEntity> The listing above is a fragment of that file with the addresses of the companies' headquarters. Please note that the more addressing information we provide to the API, the better quality geocoding we receive. In production, this file would be created programmatically, probably based on an Addresses database. The ID of GeocodeEntity, could also be stored, so that the data is matched easier once fetched from the servers. (You can find the Geocode Dataflow Data Schema, Version 2, at.) The job Let's add a Jobclass to our project: public class Job { private readonly string dataFilePath; public Job(string dataFilePath) { this.dataFilePath = dataFilePath; } } The dataFilePath argument is the path to the data.xml file we created earlier. Creating the job is as easy as calling a REST URL: public void Create() { var uri = String.Format("{0}?input=xml&output=xml&key={1}", Settings.DataflowUri, Settings.Key); var data = File.ReadAllBytes(dataFilePath); try { var wc = new WebClient(); wc.Headers.Add("Content-Type", "application/xml"); var receivedBytes = wc.UploadData(uri, "POST", data); ParseJobResponse(receivedBytes); } catch (WebException e) { var response = (HttpWebResponse)e.Response; var status = response.StatusCode; } } We place all the API URLs and other settings in the Settings class: public class Settings { public static string Key = "[YOUR BING MAPS KEY]; public static string DataflowUri = " geocode"; public static XNamespace XNamespace = ""; public static XNamespace GeocodeFeedXNamespace = ""; } To create the job, we need to build the Dataflow URL template with a Bing Maps Key, and parameters such as input and output formats. We specify the latter to be XML. Next, we use a WebClient instance to load the data with a POST protocol. Then, we parse the server response: private void ParseJobResponse(byte[] response) { using (var stream = new MemoryStream(response)) { var xDoc = XDocument.Load(stream); var job = xDoc.Descendants(Settings.XNamespace + "DataflowJob").FirstOrDefault(); var linkEl = job.Element(Settings.XNamespace + "Link"); if (linkEl != null) Link = linkEl.Value; } } Here, we pass the stream created with the bytes received from the server to the XDocument.load method. This produces an XDocument instance, which we will use to extract the data we need. We will apply a similar process throughout the article to parse XML content. Note that the appropriate XNamespace needs to be supplied in order to navigate through the document nodes. You can find a sample of the response inside the Data folder (jobSetupResponse.xml), which shows that the link to the job created is found under a Link element within the DataflowJob node. Getting job status Once we have set up a job, we can store the link on a data store, such as a database, and check for its status later. The data will be available on the Microsoft servers up to 14 days after creation. Let's see how we can query the job status: public static JobStatus CheckStatus(string jobUrl) { var result = new JobStatus(); var uri = String.Format("{0}?output=xml&key={1}", jobUrl, Settings.Key); var xDoc = XDocument.Load(uri); var job = xDoc.Descendants(Settings.XNamespace + "DataflowJob").FirstOrDefault(); if (job != null) { var linkEls = job.Elements(Settings.XNamespace + "Link").ToList(); foreach (var linkEl in linkEls) { var nameAttr = linkEl.Attribute("name"); if (nameAttr != null) { if (nameAttr.Value == "succeeded") result. SucceededLink = linkEl.Value; if (nameAttr.Value == "failed") result.FailedLink = linkEl.Value; } } var statusEl = job.Elements(Settings.XNamespace + "Status").FirstOrDefault(); if (statusEl != null) result.Status = statusEl.Value; } return result; } Now, we know that to query a Data API we need to first build the URL template. We do this by attaching the Bing Maps Key and an output parameter to the job link. The response we get from the server, stores the job status within a Link element of a DataflowJob node (the jobResponse.xml file inside the Data folder contains an example). The link we need has a name attribute with the value succeeded. Summary When it comes to large amounts of data, the Spatial Data Services offer a number of interfaces to store, and query user data; geocode addresses or reverse geocode geographical coordinates. The services perform these tasks by means of background jobs, which can be set up and queried through REST URLs. Resources for Article: Further resources on this subject: - NHibernate 2: Mapping relationships and Fluent Mapping [Article] - Using Maps in your Windows Phone App [Article] - What is OpenLayers? [Article] About the Author : Artan Sinani Artan Sinani is a Web Developer living between London and a small town in the north-west of Spain. Currently, he works as a Senior Developer at Local Data Company, where he uses his passion for good design and clean programming to build beautiful interfaces, including geospatial data visualizations. He hacks open source code at github.com/artisinani and blogs at lugolabs.com. Post new comment
http://www.packtpub.com/article/spatial-data-services
CC-MAIN-2014-10
refinedweb
1,209
56.66
Sometimes it is beneficial to generate random values in a program. This is good in cases like simulations and encryption. Someone asked me the best value to use to seed a random number generator. I don’t have a definitive answer, however I typically use the current system time to do so. After a little research, that seems to be the generally excepted standard. Srand() and rand() are pseudo random, meaning they aren’t truly random, so I don’t believe there is a “best” seed. Here is a little bit on using random numbers in a program. Rand() is the function used in C to generate random numbers. It is defined in the Standard C Library. If the random number generator is not “seeded” with a value, it will generate the same values each time rand() is called. This is useful for developing and debugging so you can keep the same set of values with each successive call. However, in a real simulation, you may want the values to be a little more random. In which case, you will seed the random number generator with srand(). When generating random numbers, you should cap your values within an acceptable limit. For example, lets say you only need random numbers between 1 – 10. You will need to use the modulus operator with the cap value, which will return the remainder of the random value divided by the cap value. This will generate the numbers 0 – (MAX – 1), or 0 – 9 in this case. In order to get 1 through 10, you will need to add 1. Below is an example program that demonstrates using the random number generator to generate within a range of values. It will simulate 20 dice rolls with a 6-sided dice utilizing the random number generator. #include <iostream> #include <cstdlib> //needed for the rand function #include <ctime> //needed to work with time using namespace std; int main() { //The max random value we want generated frm the random number generator const unsigned char MAX_RANDOM_VALUE = 6; //The value to offset. rand will return values from 0 to (MAX_RANDOM_VALUE - 1) //so we need to offset it const unsigned char RANDOM_OFFSET = 1; int cnt; //our counter for our loop //We need to seed the random number generator using the current time //Current time is retrieved by calling time(0) OR time(NULL) srand(time(NULL)); //we will loop through 20 rolls and return our results. //Notice the scaleing and shifting used in the random call... for (cnt = 1; cnt <= 20; cnt++) cout << "Roll number " << cnt << ": " << RANDOM_OFFSET + (rand() % MAX_RANDOM_VALUE) << endl; return 0; }
http://digiassn.blogspot.com/2006/04/c-basic-random-numbers.html
CC-MAIN-2017-26
refinedweb
431
62.07
C# Params Though both ref and out parameters are used to pass arguments through a method, the C# params aren’t used in exactly the same way. Ref keywords are used to pass an argument as a reference, meaning that when the value of that parameter changes after being passed through the method, the new value is reflected in the calling method. An argument passed using the ref keyword must be defined in the calling method before getting passed to the called method. Out keywords similar to ref keywords in that, they are used to pass an argument, but they differ in that arguments passed using out keywords can be passed without any value to be assigned to it. An argument passed using the out keyword must be defined in the called method before being returning to the calling method. public class Keywords { public static void Main() //calling method { int val1 = 0; //must be defined int val2; //optional Keywords1(ref val1); Console.WriteLine(val1); // val1=7 Keywords2(out val2); Console.WriteLine(val2); // val2=9 } static void Keywords1(ref int value) //called method { value = 7; } static void Keywords2(out int value) //called method { value = 9; //must be defined } } /* Output 7 9 */ In the example above, you can see the differences between ref and out keywords in action. In the first few lines, we assign a value to val1 but not val2, because val1 will be passed through an argument using the ref keyword, meaning that an initial value must be assigned to it. The out keyword value (val2) isn’t defined until the called method towards the end of the code, because it must be defined in the called method before being passed to the calling method. The calling methods above are asking for the value of the parameters to be written to the console, so the output would be 7 and 9 for val1 (ref) and val2 (out), respectively.
https://csharp-station.com/ref-parameters-vs-out-parameters
CC-MAIN-2021-31
refinedweb
319
60.08
I wanted to write 'hello world' in eclipse c++, but it does not work I go to Run configurations, what config options for c++ programs should i give? I know I don't care about 'debug' - only 'release', but how to do that? Here is what I did: File->New->C++ Project You will get a pop up window. Type the name of the project you want. Then, below it says executable and inside this folder, I have (by default I guess) Empty Project. Then click Next and Finish. Now the project appears in the left column of Eclipse. I right click it and select New->File and name it main.cpp The main window of Eclipse opens the file main.cpp and I write inside: #include <iostream> int main() { std::cout << "Hello Erjan\n" << std::endl; return 0; } Then I click on Build, it's the hammer icon in the middle of the toolbar. The code compiles and we are ready to launch it! So, click on Run icon (3 positions right of the Build icon) and you should see the output in the console.
https://codedump.io/share/P3ni2pT7W8PK/1/quotlaunching-39project39-has-encountered-quot--project-file-does-not-exist
CC-MAIN-2016-44
refinedweb
186
90.39
Using the Organise Macros all options to Edit etc. a Basic Macro are available. With BeanShell, JavaScript, and Python the only option is to Run as all the other options are greyed out. How can you create a new Python Macro in Organise Macros? Using the Organise Macros all options to Edit etc. a Basic Macro are available. How can you create a new Python Macro in Organise Macros With any Texteditor|Programming-IDE which works for you. store your Scripts into path: ~$your_LO_User-configfolder/Scripts/python/... helper for organizing|embedding python Probably this Discussion is also helpfull Thanks’ @karolus. I guess the edit is only for LO Basic. How then to attach Python Macro to an event as all options are greyed out? If there is something valid Pythoncode in folder ../Scripts/python/... you can attach this for Example via →Tools→Customize→Events→.... Any Python-function which should attached to some Event needs a signature like: def some_pretty_function( some_event ): because without Argument in Signature it will throw an Error-exception. Thanks I can see it now,
https://ask.libreoffice.org/t/can-only-edit-basic-macros/13790
CC-MAIN-2021-39
refinedweb
177
68.67
Last year, the Angular team announced it’s ECMAScript language extension AtScript, which adds types and annotations to the language in order to enable better tooling, debugging and overall development experience. Half a year later at ng-conf, the team announced that AtScript becomes TypeScript, which supports annotations and another feature called “decorators”. But how do those annotations actually work? And what are decorators then? This article details the translation of annotations and how they differ from decorators. Annotations Let’s start off with annotations. As mentioned, the Angular team announced AtScript as their language extension to JavaScript. AtScript comes with features like Type Annotations, Field Annotations and MetaData Annotations. We’re going to focus on metadata annotations. Let’s take a look at the following Angular 2 component to get an idea of what metadata annotations can look like: @Component({ selector: 'tabs', template: ` <ul> <li>Tab 1</li> <li>Tab 2</li> </ul> ` }) export class Tabs { } We have a class Tabs that is basically empty. The class has one annotation @Component. If we’d remove all annotations, what would be left is just an empty class that doesn’t have any special meaning right? So it seems that @Component add some metadata to the class in order to give it a specific meaning. This is what annotations are all about. They are a declarative way to add metadata to code. @Component is an annotation that tells Angular, that the class, which the annotation is attached to, is a component. Okay, even if that seems to be quite clear, there are a few questions coming up: - Where do those annotations come from? This is nothing that JavaScript gives us out of the box right? - Who defined this annotations called @Component? - If this is part of AtScript, what does that translate to, so we can use it in today’s browsers? Let’s answer these one by one. Where do those annotations come from? To answer that question, we need to complete the code sample. @Component is something we need to import from the Angular 2 framework like this: import { ComponentMetadata as Component, } from '@angular/core'; This pretty much answers our first question. Both annotations are provided by the framework. Let’s take a look at what the implementation of those annotations look like: export class ComponentMetadata extends DirectiveMetadata { constructor() { ... } } We can see that ComponentMetadata is in fact an implementation detail of the Angular framework. This answers our second question. But wait. It’s just yet another class? How can just a simple class change the way how other classes behave? And why are we able to use those classes as annotations by just prefixing them with an @ sign? Well, actually we can’t. Annotations are not available in browser’s of today, which means we need to transpile it to something that does run in current browsers. Even though we have a couple of transpilers we can choose from. Babel, Traceur, TypeScript, … It turns out there’s only one that actually implements annotations as we know them from AtScript: Traceur. Taking the component code from above, this is what it translates to using Traceur: var Tabs = (function () { function Tabs() {} Tabs.annotations = [ new ComponentMetadata({...}), ]; return Tabs; }) In the end, a class is just a function, which is also just an object, and all annotations end up as instance calls on the annotations property of the class. When I said “all” annotations end up there, I actually lied a bit. We can have parameter annotations as well and whose will be assigned to a class’ parameters property. So if we have code like this: class MyClass { constructor(@Annotation() foo) { ... } } This would translate to something like this: var MyClass = (function () { function MyClass() {} MyClass.parameters = [[new Annotation()]]; return MyClass; }) The reason why this translate to a nested array, is because a parameter can have more than one annotation. Okay, so now we know what those metadata annotations are and what they translate to, but we still don’t know how something like @Component makes a normal class actually a component in Angular 2. It turns out that Angular itself takes care of that. Annotations are really just metadata added to code. That’s why @Component is a very specific implementation detail of Angular 2. In fact, there are a couple of other annotations that the framework comes with. But also only the framework knows what to do with that information. Another very interesting learning is that Angular expects the metadata on annotations and parameters properties of classes. If Traceur would not translate them to those particular properties, Angular 2 wouldn’t know from where to get the metadata. Which makes AtScript Annotations just a very specific implementation of what annotations could actually be. Wouldn’t it be nicer if you as a consumer could decide where your metadata is attached to in your code? Yes! And this is where decorators come into play. Decorators Decorators are a proposed standard for ECMAScript 2016 by Yehuda Katz, to annotate and modify classes and properties at design time. This sounds pretty much like what annotations do right? Well… sort of. Let’s take a look at what a decorator looks like: // A simple decorator @decoratorExpression class MyClass { } Wait. This looks exactly like an AtScript annotation! That’s right. But it isn’t. From a consumer perspective, a decorator indeed looks like the thing that we know as “AtScript Annotation”. There is a significant difference though. We are in charge of what our decorator does to our code. Taking the code above, a corresponding decorator implementation for @decoratorExpression could look like this: function decoratorExpression(target) { // Add a property on target target.annotated = true; } Right. A decorator is just a function that gives you access to the target that needs to be decorated. Get the idea? Instead of having a transpiler that decides where your annotations go, we are in charge of defining what a specific decoration/annotation does. This, of course, also enables us to implement a decorator that adds metadata to our code the same way AtScript annotations do (I keep referring to “AtScript annotations” because what they do, is really an AtScript specific thing). Or in other words: with decorators, we can build annotations. There’s a lot more to explore about decorators, but that is out of the scope of this article. I recommend checking out Yehuda’s proposal to learn more about the feature. Does TypeScript support Annotations or Decorators? As you might know, the Angular team announced earlier this year that they’re going to drop the term “AtScript” in favour of TypeScript, since both languages seem to solve the same problems. In addition, there were announcements that TypeScript will support annotations and decorators once version 1.5 alpha is out. It turns out that it actually doesn’t. TypeScript supports decorators, but doesn’t know about Angular 2 specific annotations. Which makes sense, because they are an implementation detail of Angular. That also means that either we as consumers, or the framework needs to provide those decorators in order to make the code compile. Only the latter really makes sense. Luckily, generators for both, annotation and parameter decorators, have landed in the Angular 2 code base lately. So what the framework behind the scenes does is, it comes with metadata annotation implementations, which are then passed to the decorator generator to make decorators out of them. That’s also why we have to write the following code when transpiling with traceur: import { ComponentMetadata as Component } from '@angular/core'; As we can see, we’re actually importing the metadata rather than the decorator. This is simply just because traceur doesn’t understand decorators, but does understand @Component annotations. Which is why we’re also importing them with these namespaces respectively. Conclusion “AtScript Annotations” and decorators are nearly the same thing. From a consumer perspective we have exactly the same syntax. The only thing that differs is that we don’t have control over how AtScript annotations are added as metadata to our code. Whereas decorators are rather an interface to build something that ends up as annotation. Over a long term, however, we can just focus on decorators, since those are a real proposed standard. AtScript is deprecated, and TypeScript implements decorators. I hope this article made some things clear though. Angular 2 Master Class in Helsinki Learn Angular 2 in our upcoming public training!Join now Join over 1000 other developers who get our content first. Author Related Posts Protecting Routes using Guards in Angular 2 When building applications, we often want to protect the users from entering or leaving certain areas. We could have an... Model-driven... How to prevent name collisions in Angular 2 providers Angular 2's dependency injection improved in many ways. It not only is more flexible when it comes to assembling dependencies...
http://blog.thoughtram.io/angular/2015/05/03/the-difference-between-annotations-and-decorators.html
CC-MAIN-2016-30
refinedweb
1,476
56.86
![if gte IE 9]><![endif]><![if gte IE 9]><![endif]><![if gte IE 9]><![endif]><![if gte IE 9]><![endif]> Hi to all I have been designing FIR BP filter using following code in CCS 3.1 #include "bs2700.cof" //coefficient file #include "dsk6713_aic23.h" //codec-dsk support file Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate int yn = 0; //initialize filter's output short dly[N]; //delay samples interrupt void c_int11() //ISR { short i; dly[0]=input_sample(); //input newest sample yn = 0; //initialize filter's output for (i = 0; i< N; i++) yn += (h[i] * dly[i]); //y(n) += h(i)* x(n-i) for (i = N-1; i > 0; i--) //starting @ end of buffer dly[i] = dly[i-1]; //update delays with data move output_sample(yn >> 15); //scale output filter sample return; } void main() comm_intr(); //init DSK, codec, McBSP while(1); //infinite loop //bs2700.cof FIR bandpass coefficients designed with MATLAB #define N 89 //number of coefficients short h[N]= {-14,23,-9,-6,0,8,16,-58,50,44,-147,119,67,-245, 200,72,-312,257,53,-299,239,20,-165,88,0,105, -236,33,490,-740,158,932,-1380,392,1348,-2070, 724,1650,-2690,1104,1776,-3122,1458,1704,29491, 1704,1458,-3122,1776,1104,-2690,1650,724,-2070, 1348,392,-1380,932,158,-740,490,33,-236,105,0, 88,-165,20,239,-299,53,257,-312,72,200,-245,67, 119,-147,44,50,-58,16,8,0,-6,-9,23,-14}; but i m getting an compilation error..i,e. fatal error :could not open source file "dsk6713_aic23.h" please help asap.. thanking u in advance.. Hello, Preeti Bhaskarfatal error :could not open source file "dsk6713_aic23.h" You are missing an include search path to the header file.It is located in .\c6000\dsk6713\include Update the include search path field in your project build options for the compiler to have the full path to the Click here to track an issue. Enter your bug id in the "Find Record ID" box In reply to Ki-Soo Lee: hi, thanks.. Must we connect target board while programming in CCS? what i meant to say is "isn't it possible to compile and build the the C-code without connecting the taeget? In reply to Preeti Bhaskar: Preeti BhaskarMust we connect target board while programming in CCS? No Preeti Bhaskar"isn't it possible to compile and build the the C-code without connecting the taeget? Yes. You don't need to be.
http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/179517
CC-MAIN-2015-48
refinedweb
420
74.79
53903/when-simple-exponential-smoothing-and-what-the-math-behind Discussing this on a high level, these ...READ MORE Correlation is a statistical measure that shows ...READ MORE Hi@akhtar You can find lots of website which ...READ MORE Hi@Abubakar, You can find lots of documents on ...READ MORE You can also use the random library's ...READ MORE Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE can you give an example using a ...READ MORE You can simply the built-in function in ...READ MORE Yes, you can do this using statsmodels: import ...READ MORE There are two main techniques used in ...READ MORE OR Already have an account? Sign in.
https://www.edureka.co/community/53903/when-simple-exponential-smoothing-and-what-the-math-behind
CC-MAIN-2021-21
refinedweb
115
79.87
Details Description From J.J. Larrea on SOLR-104 2. What would make this even more powerful would be the ability to "subclass" (meaning refine and/or extend) request handler configs: If the requestHandler element allowed an attribute extends="<another-requesthandler-name>" and chained the SolrParams, then one could do something like: <requestHandler name="search/products/all" class="solr.DisMaxRequestHandler" > <lst name="defaults"> <float name="tie">0.01</float> <str name="qf"> text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 </str> ... much more, per the "dismax" example in the sample solrconfig.xml ... </requestHandler> ... and replacing the "partitioned" example ... <requestHandler name="search/products/instock" extends="search/products/all" > <lst name="appends"> <str name="fq">inStock:true</str> </lst> </requestHandler> Activity Damn Ryan ... you keep taking on cool features nad churning out patches too fast for me to read them! this sounds like a cool idea, the one big caveat is documenting exactly how the NamedList "merge" method you wrote is expected to work ... ie: - what it does if both named lists have the same key? - does it do deep merging of nested named list/collections? - what does it do if one list has an element without a name (first and formost a NamedLIst is an order list after all - the names are optional) ..as far as unit tests go, the easiest way to test something like this is to start by writing a unit test of just the NamedList mergin logic – independent of anything else (this class would be a good place to put a test of the SOLR-107 changes too by the way). next would be to test that the merge logic is getting used as you expect, with a test that uses a config file with several handlers all inheriting various properties from one another, and then a test that does queries against them – the easiest way to do validate that the init params were getting inherited correctly would probably be to use an "EchoConfigRequestHandler" that looked something like this... public class EchoConfigRequestHandler impliments SolrRequestHandler { private NamedList initParams; public void init(NamedList nl) { initParams = nl); public void handleRequest(SOlrQueryRequest req, SolrQueryResponse rsp) } the AbstractSolrTestClass makes it easy for you to use any solrconfig file you want by overriding a method – so you could even write one test case using one config file with lots of examples of inherited init params and a test method for each asserting that the params are what is expected, and then subclass it with another test class instance that's exactly the same except for the using a differnet solrconfig file where all of hte params are duplicated out explicitly – testing your assumptions so to speak. random idea i had that we might consider, not sure yet if i like it yet but i wanted to throw it out there... if someone has.. <requestHandler name="foo" class="FooHandler"> ... <requestHandler> <requestHandler name="bar" extends="foo"> ... <requestHandler> <requestHandler name="foo/baz"> ... <requestHandler> (NOTE: foo/baz has no class or extends) could/should we assume that "foo/baz" extends "foo" since it's a prefix of the name? I think that path should be specified explicitly. I like that <requestHandler name="foo" class="FooHandler"> ... <requestHandler> will only match /select?wt=foo and that: <requestHandler name="/foo" class="FooHandler"> ... <requestHandler> will match /foo (and /select?wt=/foo) I like the idea that somone adding the prefix '/' is an explicit gesture they want to set the URL path. (even if it overrides something else, for example /admin) I'm sure you won't like your extemperaneous suggestion (foo/baz implicitly extending foo with baz) once you get a chance to think about it, Hoss. The concern of efficiently structuring request handlers in solrconfig is quite different from he concern of publishing them to the outside world. For example, mightn't one set up the equivalent of an "abstract base class" request config which has no value being invoked directly in a request, but has great value as the root of a tree of request configs which will be invoked? And similarly, shouldn't one be able to rearrange the internal configuration (e.g. refactoring) without affecting an already "published" request syntax? If it didn't break backwards compatibility, one could even consider having separate arguments defining an internal name (used for extending) and an external name (used for invoking), with either one being optional – allowing configs which are uninvokable but extendable, and vice versa. Or for better backwards compatibility, one name could default to the other, but could be explicitly overridden (potentially to the empty string) if so desired. I am not advocating either of these approaches (simpler is perhaps better) as much as using them to illustrate the separability of the concerns. Does this make sense? Re foo vs. /foo: I think of the SolrServlet as being just one way to invoke the request dispatcher. One could for example write a SOAP or other RPC message receiver which called a method something like handleRequest(String reqName, SolrQueryRequest req, SolrQueryResponse rsp)1. So I wouldn't want to bind the request invocation syntax too tightly to a URL-based mechanism for invocation. Similarly, I think of allowing slashes in request handler names as merely a convention; it could be "search.products.instock" or "search-products-instock" just as easily. Of course, it is advantageous for the handler name to be RFC1738-compliant (as those examples both are) so the pathInfo can be used to set the name, as we all like, e.g. What your suggestion comes down to, Ryan, is whether the pathInfo-parsed request adds a leading / slash to the request name, or not. If it does it forces URL syntax into the request-naming space, and while that won't particularly hurt anything I'm not sure it buys anything either... Why should a SOLR configurer need to make an explicit gesture to indicate they want to use the more "modern" pathInfo-based invocation style rather than the older qt= invocation style? And shouldn't the request handler definition be either agnostic as to the request method (GET, POST, pathINFO, qt=, SOAP, direct API call, ...) or else have access to a more comprehensive mechanism for filtering which methods they respond to? 1 (I haven't yet had a chance to catch up on the voluminous SOLR-104 discussion so this may not be the currently contemplated syntax, but hopefully my argument for potentially supporting non-URL-based invokers still holds.) Regarding SOLR-112.patch, +1 on on the NamedList changes included from SOLR-107. But I'm not sure a "blind" NamedList merging is going to accomplish what is needed for an extends mechanism. As it stands that merges defaults into defaults, invariants into invariants, appends into appends, along with any other named lists that happen to be in the base list. That could stand some further thought... First, each existing SolrRequestHandler implementation (Standard and DisMax) in init() now parses defaults, appends, and invariants sub-NamedLists into individual SolrParams, and in handleRequest passes those and the request SolrParams into SolrPluginUtils.setDefaults, which sets up a dynamic chain: params => invariant-parms -> ((request-params -> default-params) + appended-params) such that invariant-params override request-params which override default-params, with appended-params appended before the invariants override. It's pretty cool. The semantics of extended request handler configs may perhaps need to be similar, with the extender's invariant params overriding any params in the extendee, extendee invariants perhaps overriding non-invariants in the extender , extender defaults overriding extendee defaults, and the appends concatenated. I suppose given the above rule, it would simply be: invariant-params => extender-invariants -> extendee-invariants default-params => extender-defaults -> extendee defaults appended-params => extender-appends + extendee-appends (answering Hoss' question about what should happen if the keys are identical, but not his other questions) In some ways this would be neatest if implemented at the SolrParams level, since there are nice classes like DefaultSolrParams and AppendedSolrParams, implementing the -> and + operators I used above, respectively, and which have informative toString()s. Unfortunately that's not so simple without serious refactoring, since SolrRequestHandler.init takes a NamedList; as defined, a handler could look for handler-specific initialization data in the NamedList, and also doesn't necessarily need to parse and chain invariants, defaults, and appends. I suppose this would still work at the NamedList level, as long as there were a flag for how to treat key conflicts (override vs. append), and that key were set specifically for invariants and defaults, or just appends. If done that way, it still leaves the question of whether the "merge" is done statically by changing the NamedList, or dynamically by allowing NamedLists to be chained. I suppose the only advantage of chaining is that toString() would be more informative, and alone that's probably not sufficient to justify the additional complexity. Anyway, those are some ideas for discussion. I think you're dead on JJ ... any generic NamedList merging won't neccessarily do "the right thing" in all cases when talking about RequestHandler init args – very special logic would need to be used to deal with the defaults/appends/invarients in a logical manner, and that logic may not be bale to take into account other init params that other RequestHandlers (subclasses of the core ones perhaps) might add. a cleaner way to deal with this might just be to have the individual RequestHandlers manage this themselves – using SolrCore.getRequestHandler(String) and protected methods they explicitly support to allow other instances to get access to their SolrParams. ie... <requestHandler name="search/products/all" class="solr.DisMaxRequestHandler" > <lst name="defaults"> <str name="facet.field">category</str> <float name="tie">0.01</float> <str name="qf"> text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 </str> </requestHandler> <requestHandler name="search/products/instock" class="solr.DisMaxRequestHandler"> <str name="extends">search/products/all</str> <lst name="defaults"> <str name="facet.query">price:[0 TO 100]</str> <str name="facet.query">price:[100 TO *]</str> </lst> <lst name="appends"> <str name="fq">inStock:true</str> </lst> </requestHandler> ...where DisMaxRequestHandler (or most likely teh new Base class Ryan has written) has methods like... protected SolrParams getDefaults() protected SolrParams getInvarients() protected SolrParams getAppends() ...and the init method looks for an "extends" arg, if it's there fetches it from the SolrCore, tests it's class and casts it, then calls the methods above and builds up it's own SolrParams usign a combination of those and the ones explicitly specified in it's config. 2013 Old JIRA cleanup I attached a simple implementaion. This includes the NamedList changes from SOLR-107 I could not figure out any good way to test this with unit tests. Any ideas?
https://issues.apache.org/jira/browse/SOLR-112?focusedCommentId=12466304&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
CC-MAIN-2014-10
refinedweb
1,808
51.68
Ever wish that React had a CLI? Something to let you generate a component, along with related files like SCSS or Redux ducks or whatever else. You can build your very own, with Bash and a couple lines of script. I’ll show you how in this post. Here’s what our CLI will do: - create the component folder - add a barebones component file to the folder - add a blank SCSS file to the folder - include the SCSS in the component If you’re on a system like Mac or Linux this is all possible with the shell. (Probably Windows too, but I don’t know enough about Windows shell). You might already know how to create a directory ( mkdir path/to/dir) and how to create an empty file in it ( touch path/to/dir/thing.scss). A Bash script is nothing more than a bunch of shell commands put into a file. So if you create a new file, say, make_component.sh and just put those commands into it, you’ve just made the beginnings of your own CLI. Follow along! Create a new blank file called make_component.sh and put this in it: mkdir -p src/components/Whatever touch src/components/Whatever/Whatever.scss So far all it does is create a hard-coded directory “src/components/Whatever” and an empty Whatever.scss file in it (the -p flag creates the whole tree of directories if they don’t already exist). We still need to figure out how to: - parameterize the name of the component in those commands - copy in a template component file - modify it to match the component name So how could you parameterize the component name? Well, Bash lets you access the command line arguments inside your script – as $1 for the first one, $2 for the second, etc. So let’s say you’ll call your script like: ./make_component.sh Button The script would have a access to a $1 variable assigned to “Button”, which you could use all over the place. Using that in the file you’ve got so far, it would look something like this: mkdir -p src/components/$1 touch src/components/$1/$1.scss Now you need to make a template component file and store it somewhere. Your home directory is a good spot, maybe in a subfolder. Let’s say you make a folder with mkdir ~/code_templates and a file at ~/code_templates/component.js that looks like this: import React from 'react'; import './COMPONENT_NAME.scss'; function COMPONENT_NAME() { return <div>Hello</div>; } export default COMPONENT_NAME; This is super barebones of course, but do whatever you like here. The important thing is that you use distinct strings for the COMPONENT_NAME that will be easy to search-and-replace. Then, to search and replace from the shell you can use sed (short for string editor). You can pass it a regular expression to replace all occurrences of a string in a file. So back in make_component.sh, you can add that sed command to the end so the whole thing would look like: mkdir -p src/components/$1 touch src/components/$1/$1.scss sed -e "s/COMPONENT_NAME/$1/g" ~/code_templates/component.js > src/components/$1/index.js That command is a mouthful but here’s what it does: The -e flag means “execute this regular expression”. The next argument, in quotes, is the regular expression "s/COMPONENT_NAME/$1/g". We’re using double quotes so that Bash will replace $1 with our component name. (If we used single quotes, Bash would not interpolate that string and we’d end up with a literal “$1” in our file. Unlike JS, single and double quotes mean different things in Bash!) The way to read this regular expression is “substitute ( s/) COMPONENT_NAME with $1, globally “. The g means “global”, and it refers to globally within a single line because sed only looks at a single line at a time. Without the g there, it would only replace the first occurrence on each line, so if you had a line like const COMPONENT_NAME = function COMPONENT_NAME() the result would be const YourThing = function COMPONENT_NAME() – it would skip the second occurrence. The next argument, ~/code_templates/component.js, is the file to that sed will operate on. By default sed prints out the result to standard output. It does not modify the original file. Normally, standard output would appear as text printed to the console, but the > redirects that output to a new file located at src/components/$1/index.js. The > will overwrite the file if it exists, so be careful! That’s pretty much it for the script. All that’s left is to mark the script as executable (with the command chmod +x make_component.sh) and you’re good to go! It’s not fancy, but it’s your very own DIY customizable CLI :) Feel free to make it your own. Leave a comment with any cool customizations you come up
https://daveceddia.com/react-cli-with-bash/
CC-MAIN-2019-35
refinedweb
828
64.41
On Tue, Dec 9, 2008 at 5:04 AM, Rahul Sundaram <sundaram fedoraproject org> wrote: > "keyring" is probably not that term many end users would use though. A bug > report to add that to the summary might be appropriate neverthless. You know what I would absolutely LOVE? I would love to be able to get a data dump of what searches terms people are using in PK and which search terms result in which packages being selected for install (not the deps, the packages manually selected from the search results). That would give us a comprehensive picture of how difficult the package collection is to search, and if there are some areas in the collection more difficult to search for than others. If our package management was implemented as a web service instead of a client interface, that sort of thing would be cake to generate.. it would be in the service logs. Then again, if it were a web service then we could also open up keyword tagging so that individual service users could add supplimental keywords to refine searches without polluting the summary or description namespace and without having to push updates to adjust text strings before people could benefit. -jef
https://www.redhat.com/archives/fedora-devel-list/2008-December/msg00833.html
CC-MAIN-2016-07
refinedweb
203
54.26
Simulate Subversion Commit Email Hook on the Client Side If you use Subversion, you probably know that you can enable a commit email hook on the server. Then you can configure svn to send emails out on every commit. You can also (I think, haven't tried this) configure it by setting hook:commit-email properties on the folder of interests. Here at my new job, we also use Subversion for source control. However, the Subversion server is not configured to send out commit emails. I went to talk our svn admin and he told me that our svn server is too old so we are not gonna get that any time soon. Okay... fine, that's not a problem, I figured that I can simulate the same feature on the client side with a little bit of scripting. The general idea is this, check out a project off svn onto the local drive, have the script to do a diff against the repository every 5 min and then have the script to send out email if there's a non-empty diff. 1. Check out the project you want to add the hook to, then for every 5 min, execute 'svn log -r BASE:HEAD' on that project to get a list of revisions and logs, the output of svn log looks something like (with --incremental option) ------------------------------------------------------------------------ r183 | zl25-drexel | 2008-06-18 22:44:32 -0400 (Wed, 18 Jun 2008) | 1 line that's good enough for now ------------------------------------------------------------------------ r184 | zl25-drexel | 2008-06-18 22:57:06 -0400 (Wed, 18 Jun 2008) | 1 line test ------------------------------------------------------------------------ r185 | zl25-drexel | 2008-06-18 22:59:11 -0400 (Wed, 18 Jun 2008) | 1 line diff r182:r183 and r183:r184. For each diff, send out an email containing the diff output. 3. After all the diffs are performed, execute 'svn up -r $lastrev' to bring your local copy to the latest revision that you had checked against (note: do not update it to HEAD because there might be commits during the time when the script is sending out emails). Voila! with the above 3 simple steps you will get exactly the same functionality as if a commit email hook is enabled on the server. Here is the script for your viewing pleasure #!/usr/bin/env groovy import java.text.SimpleDateFormat import javax.mail.internet.InternetAddress import javax.mail.Message import javax.mail.internet.MimeMessage import javax.mail.Transport import javax.mail.Session import groovy.text.SimpleTemplateEngine def chill = 5 //min def emailconfig = [protocol:'smtps', host : 'smtp.gmail.com', port : 465, //must be int user : 'XXX', password : 'XXX'] def projects = [ 'projectName':/C:\Projects\project1/, 'projectName2':/C:\Project\project2/ ] def subject="[<%=rev%>] [SVN:<%=name%>] [Author:<%=author%>]" def body = """<%=name%> revision <%=rev%> report Author: <%=author%> Date: <%=date%> Log Message: -------------------------------------------------- <%=log%> -------------------------------------------------- <%=fulldiff%> """ def engine = new SimpleTemplateEngine() def BODY = engine.createTemplate(body) def SUBJECT = engine.createTemplate(subject) def ps = new PrintStream( new BufferedOutputStream(new FileOutputStream('svndiff.log'))) def printLog(def msg, def ps){ def df = new SimpleDateFormat() println "[${df.format(new Date())}] $msg" ps.println "[${df.format(new Date())}] $msg" } def parseLog(def log){ try{ def lines = [] new StringReader(log).eachLine{ line -> lines << line } if(lines.size < 2) return; def ret = [:] def items = lines[1].split(/[|]/) ret['rev'] = items[0].trim().substring(1) ret['author'] = items[1] ret['date'] = items[2] ret['log'] = log return ret }catch (Exception e) { e.printStackTrace() return null } } def getBASErev(def path){ def base = 'BASE' "svn info -r BASE $path".execute().in.eachLine{ def m = it=~/Revision:\s+(\d+)/ if(m.matches()){ base = m.group(1) } } return base } while(true){ try{ projects.each{name, path -> printLog("processing $name", ps) def revisions = "svn log -r BASE:HEAD --limit 30 --incremental $path".execute().text.split('-'*72) def BASErev = getBASErev(path) def lastrev = null def logs = [['rev':'BASE']] revisions.each{rev -> def parsed = parseLog(rev) if (parsed != null)logs << parsed } if(logs.size == 1){ printLog('already up to date, nothing to process', ps); return } for(int i =0; i< logs.size -1; i++){ def rev1 = logs[i], rev2 = logs[i+1] if(rev2['rev'] == BASErev){ continue;} //no need to diff BASE def diff = "svn diff -r ${rev1['rev']}:${rev2['rev']} $path".execute().text def s = SUBJECT.make([rev: rev2['rev'], name: name, author: rev2['author'] ]).toString() def b = BODY.make([name: name, rev: rev2['rev'], author:rev2['author'], date: rev2['date'], log: logs[i+1]['log'], fulldiff: diff]).toString() printLog( "sending $s ...", ps) sendEmail(s, b, emailconfig) lastrev = rev2['rev'] } // bring the local to the last rev we had diffed if(lastrev != null){ printLog("svn up -r $lastrev $path", ps) ; "svn up -r $lastrev $path".execute() } } }catch(Exception e){ e.printStackTrace() } printLog('\nChilling out for 5 min ...\n', ps) //chill out for 5 min sleep chill*60*1000 } def sendEmail(def subject, def body, def config){ Properties props = new Properties() props.put("mail.transport.protocol", config.protocol); props.put("mail.smtps.host", config.host); props.put("mail.smtps.auth", "true"); Session session = Session.getDefaultInstance(props) Transport transport = session.getTransport() MimeMessage message = new MimeMessage(session) message.setSubject(subject) message.setContent(body, 'text/plain') message.addRecipient(Message.RecipientType.TO, new InternetAddress('my.email@my.domain')) transport.connect(config.host, config.port, config.user, config.password) transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO)); transport.close(); } A few things should be noted. First of all, it uses java mail, which is not part of the JDK. So make sure you have it available in groovy's classpath (just throw the jars in $GROOVY_HOME/lib). I am using gmail's smtp server just for illustration purposes. It's probably not a good idea to have your company's svn commits messages all go thru gmail, it might get you into troubles. You should use your company's internal smtp server for internal projects. This script works as long as you have read accesses to a repository. So if you are not a developer of projects say apache commons but still want to track its revisions thru commit emails, you can hook this script to their repository and receive emails for every commit! There are many features in Groovy (this language makes me so happy :-) ) which make scripting extremely easy. The above script showcased quite a few of them. Imagine if you need to write it in Java how much codes you need to write. I don't think I will want to write this in Java. Here's a sample email that was produced by the above script: myproject revision 173 report Author: zl25-drexel Date: 2008-06-17 20:26:38 -0400 (Tue, 17 Jun 2008) Log Message: ------------------------------r173 | zl25-drexel | 2008-06-17 20:26:38 -0400 (Tue, 17 Jun 2008) | 1 line test test test ------------------------------ ---------------------------------------- Index: C:/cygwin/home/jliang/ testdiff/jgeocoder/jgeocoder/testdiff/jgeocoder/jgeocoder/ difftest.txtdifftest.txt ============================== ============================================================ ============== --- C:/cygwin/home/jliang/ testdiff/jgeocoder/jgeocoder/testdiff/jgeocoder/jgeocoder/ difftest.txt (revision 172)difftest.txt (revision 172) +++ C:/cygwin/home/jliang/ testdiff/jgeocoder/jgeocoder/testdiff/jgeocoder/jgeocoder/ difftest.txt (revision 173)difftest.txt (revision 173) @@ -2,4 +2,4 @@ one more line -one more line \ No newline at end of file +one more test \ No newline at end of file Index: C:/cygwin/home/jliang/ testdiff/jgeocoder/jgeocoder/testdiff/jgeocoder/jgeocoder/ src/main/java/net/sourceforge/src/main/java/net/sourceforge/ jgeocoder/test/JaysTest.javajgeocoder/test/JaysTest.java ============================== ============================================================ ============== --- 172)jgeocoder/test/JaysTest.java (revision 172) +++ 173)jgeocoder/test/JaysTest.java (revision 173) @@ -10,7 +10,11 @@ import net.sourceforge.jgeocoder. tiger.H2DbDataSourceFactory;tiger.H2DbDataSourceFactory; import net.sourceforge.jgeocoder. tiger.JGeocoder;tiger.JGeocoder; import net.sourceforge.jgeocoder. tiger.JGeocoderConfig;tiger.JGeocoderConfig; - +/** + * blah blah + * @author jliang + * + */ public class JaysTest{ public static void main(String[] args) { JGeocoderConfig config = new JGeocoderConfig();
https://dzone.com/articles/simulate-svn-commit-email-hook
CC-MAIN-2015-35
refinedweb
1,282
50.33
I'm fresh new in Google Guice framework and i have a question regarding injecting in guice servlet and using RequestScope. Ok let me give some example from my code just to make the things clearly. I have a bean class for example Bean .. @RequestScope public class Bean { private String user; private String pass; // constructor which is @inject // getters and setters } @Singleton public class MainServlet extends HttpServlet { doGet(HttpServletRequest request, HttpServletResponse response) { .... some code Injector injector = Guice.createInjector(); ValidUser validUser = injector.getInstance(ValidUser.class) // Here i got the below exception } } com.google.inject.ConfigurationException: Guice configuration errors: 1) No scope is bound to com.google.inject.servlet.RequestScoped. at Bean.class while locating Bean You're creating and using an Injector inside the doGet method on your servlet... it has no chance to be aware of scope or of the current request or anything! Guice Servlet requires that you set up all requests to go through the GuiceFilter and that you create a subclass of GuiceServletContextListener that creates the Injector that your whole application will use. This is all described in Guice user guide in the Servlets section. Once you've done that, you can @Inject things in to your MainServlet (even using an @Inject annotated constructor). To get a request scoped instance of Bean inside the servlet, you'd need to inject a Provider<Bean> (since Bean has a smaller scope than the singleton servlet). Within a request, you can call beanProvider.get() to get the Bean for the current request. Note that servlets are singletons because that's how they work in the normal Java servlet world as well... they're each only created once per application and that single instance is used for all requests to that servlet.
https://codedump.io/share/UpuHXCT4l82x/1/guice-inject-in-servlet
CC-MAIN-2017-04
refinedweb
291
64.71
.2: Experiences and Truths About This Page Questions Answered: What are GoodStuff’s classes like? How do I compare values with one another? How do I express whether a number is greater than another or similar “yes or no” information? How can I make my flappy bug smash against an obstacle? Topics: Truth values, the Boolean data type, comparison operators. What Will I Do? Read and try things out yourself. Rough Estimate of Workload:? A couple of hours. Points Available: A70. Related Projects: GoodStuff, IntroOOP, Odds, FlappyBug. Miscellaneous (new) features in one optional assignment. Recap: GoodStuff Chapter 2.1 showed how the classes of our running example, GoodStuff, work together. Before we discuss the example further, it might be a good idea to review that graphical presentation. Here it is again: The Components of GoodStuff In this chapter, we’ll begin exploring the Scala code that implements GoodStuff. It has the following components. GoodStuff’s user interface. The grin-face marks the experience that the user has rated highest. Package o1.goodstuff: - Class Experiencerepresents entries in the diary, which describe the user’s experiences; each instance of the class corresponds to one such entry. We’ll inspect this class in this chapter and the next. - Class Categorycan be used to group multiple comparable experiences together. Each category has a name and a pricing unit (e.g., hotel experiences are priced per night). A category object also keeps track of the user’s favorite experience within that category. We’ll inspect this class in Chapters 4.1 and 4.2. Package o1.goodstuff.gui: CategoryDisplayWindowis a class for representing a particular sort of GUI windows. The GoodStuff application, as given, features just a single window for hotel experiences, but in principle there could be more windows of this type. The window has been implemented using the Swing GUI library (Chapter 12.3). GoodStuffis an app object (Chapter 2.7). It’s defined in GoodStuff.scala, which is the file that you’ve used to run the program in Eclipse. Now, let’s look at Experience. As we do so, it will soon become apparent that we need to learn about a new basic data type available in Scala and the more general programming concepts associated with that type. Read the documentation! Locate the Scaladoc documentation for class Experience either within the GoodStuff project in Eclipse or through the project link at the beginning of this page. Read the Scaladocs. Continue only after you’ve read them. You don’t need to look at the documentation of the other classes in the project now. Experimenting with Experiences Let’s try working with Experience objects in the REPL. To instantiate class Experience, we need to pass in a name, a description, a price, and a rating. In the given version of the full app, those attributes were associated with hotel experiences, but that’s just one of many possible uses of the class. For a change, let’s create objects that correspond to wine experiences: import o1.goodstuff._import o1.goodstuff._ val wine1 = new Experience("Il Barco 2001", "okay", 6.69, 5)wine1: o1.goodstuff.Experience = o1.goodstuff.Experience@a62427 The class can be used as described in its Scaladocs. Here are a couple of examples: wine1.nameres0: String = Il Barco 2001 wine1.valueForMoneyres1: Double = 0.7473841554559043 In order for GoodStuff to figure out the favorite experience within a category, it needs to compare experiences by their ratings. Two of the methods in class Experience are relevant here: isBetterThan and chooseBetter. Understanding the former will help you understand the latter, so that’s where we’ll start. Let’s try calling isBetterThan now and get back to chooseBetter in the next chapter. val wine2 = new Experience("Tollo Rosso", "not great", 6.19, 3)wine2: o1.goodstuff.Experience = o1.goodstuff.Experience@140b3c7 wine2.isBetterThan(wine1)res2: Boolean = false falsemean, exactly? And what is its data type, Boolean? Truth Values and the Boolean Type It’s extremely common for programs to deal with dualities: Is this number larger than that one? Can we find a particular person among the customers recorded in the program? Has the user ticked a particular box in the GUI? Did the player choose black or white pieces? Was the Shift key held down while the mouse was clicked? Has the ladybug crashed against an obstacle? What we need is a way to represent the truth values of propositions. More specifically, we’ll use Boolean logic (Boolen logiikka), which employs precisely two truth values: true and false. Boolean, the data type The Scala literals true and false represent “truth” and “untruth”. These two literals are reserved words in Scala, which means you can’t use them as names for variables or other program components. Scala’s data type for truth values is called Boolean. This type is defined in package scala and is therefore always available in all Scala programs just like Int and String are. val popeIsCatholic = truepopeIsCatholic: Boolean = true val earthIsFlat = falseearthIsFlat: Boolean = false Apart from true and false, no other values of type Boolean exist. (Compare: there are countless different strings and numbers.) A Boolean literal alone forms an expression, too. The value of the expression is the truth value indicated by the literal: falseres3: Boolean = false Is a separate Boolean type necessary? Could we just make isBetterThan return the string "yes" or "no" instead of a Boolean value? Or a number: we could decide, for example, that a return value of zero means “untrue” and any other number means “true”? In principle, yes. And in practice, too, the latter suggestion is used in some programming languages. However, Scala, like many other languages, provides a custom data type for truth values. Custom data types help us write code that’s easier to understand; it also helps our programming tools check for errors automatically and produce better error messages. For instance, we can count on a Boolean variable always storing true or false and nothing else. Using Boolean values You can use truth values just like you’ve used values of other types: you can store them in variables, pass them as parameters, and return them from methods: println("The truth is " + popeIsCatholic)The truth is true val secondPreferred = wine2.isBetterThan(wine1)secondPreferred: Boolean = false val betterThanItself = wine2.isBetterThan(wine2)betterThanItself: Boolean = false Numbers and strings are associated with operators such as +. One of the operators available on Booleans is !. You can read this exclamation-mark operator as “not”. What it does is “flip” the truth value written after it, turning false to true and the other way around. Here’s an example: !secondPreferredres4: Boolean = true As reported by the REPL, the value of the entire expression !secondPreferred is true. Note that evaluating the expression has no effect whatsoever on the variable, which continues to store false. Writing truth values as literals isn’t the only way to use them: Comparison Operators Scala’s comparison operators (vertailuoperaattori) form expressions that compare the values of their subexpressions. Note that two of the operators are written <= and >=, not =< or => (the latter of which means something completely different in Scala; we’ll discuss that later). A mnemonic: write the symbols in the order you read them: less than ( <) or equal to ( =). Comparing numbers The comparison operators produce Booleans: 10 <= 10res5: Boolean = true 20 < (10 + 10)res6: Boolean = false val age = 20age: Int = 20 val isAdult = age >= 18isAdult: Boolean = true age == 30res7: Boolean = false 20 != ageres8: Boolean = false The animation below features Boolean values. Can you work out what the code will print out even without first watching the animation? Comparisons of different kinds Take a moment to experiment with Boolean values and comparison operators in the REPL. Try applying the operators to values other than numbers. You can compare strings much like you can compare numbers, for instance. You can also compare Booleans with each other. Once you’ve tried a few comparisons in the REPL, proceed to the assignments below. Practice on comparisons From this chapter onwards, we’ll be using truth values and comparison operators all the time. The sooner you become fluent in their use, the better, so that you don’t have to waste your mental resources thinking about these basic constructs as you work on increasingly complex programs. To help you build that fluency, there’s a whole bunch of tiny practice tasks below. Try and work out the answers in your head and experiment in the REPL. Don’t just guess at random or just copy every answer from the REPL. Try to understand each answer and use the REPL to check your thinking. Mini-assignment: portraits A picture can be shaped like a portrait or a landscape. A portrait’s height is greater than its width, while a landscape’s height is less than its width. Fetch project Miscellaneous. Ignore the rest of it for now; just locate the file misc.scala. In that file, write an effect-free function that: - has the name isPortrait; - takes a single parameter of type Pic; and - returns trueif the given image is taller than it’s wide and falseotherwise (i.e., if square or in landscape orientation). A+ presents the exercise submission form here. On object equality You can use the operators == and != to check whether two objects are equal. But what exactly does equality mean in the case of, say, experience objects? Explore the question in the REPL as you answer the following question. As you see: the fact that two experience objects have identical values for their attributes isn’t sufficient to make them “equal”. In these examples, we used the == operator to compare the contents of two variables — that is, to compare the references stored in two variables. Those operations don’t actually compare what the objects are like at all. For example, wine1 == wine4 is false, since what we have there isn’t two references to the same object but two references to two identical but distinct objects. On the other hand, wine1 == wine3 is true, because both variables contain a reference to the one and same object; the references lead to the same place. More generally, how equality works on objects depends on the objects’ types. When we write a class of our own, the default is identity comparison as shown for class Experience above. On the other hand, many of the types in the standard Scala API have their own type-specific definitions of equality. Buffers are a good example: two buffers are equal if they have identical contents. The following REPL session illustrates this: import scala.collection.mutable.Bufferimport scala.collection.mutable.Buffer val someBuffer = Buffer(2, 10, 5, 4)someBuffer: Buffer[Int] = ArrayBuffer(2, 10, 5, 4) val anotherBuffer = Buffer(2, 10, 5)anotherBuffer: Buffer[Int] = ArrayBuffer(2, 10, 5) someBuffer == anotherBufferres9: Boolean = false anotherBuffer += 4res10: Buffer[Int] = ArrayBuffer(2, 10, 5, 4) someBuffer == anotherBufferres11: Boolean = true Implementing Class Experience Armed with comparison operators, we’re now ready to implement class Experience. Let’s begin with a pseudocode sketch: class Experience(as constructor parameters, require a name, a description, a price, and a rating; store all four in fixed-valued instance variables) { def valueForMoney = return the ratio of your rating to your price def isBetterThan(another: Experience) = return a truth value that indicates whether your own rating is higher than that of the experience object you received as a parameter } Experienceobject. The word anotherhas no special significance beyond being the parameter variable’s programmer-chosen name. In this respect, this method greatly resembles the methods xDiffand yDifffrom class Pos(Chapter 2.5). Those methods, too, operated on two instances of the same class: thisand another instance indicated by the parameter. Here is a Scala implementation: class Experience(val name: String, val description: String, val price: Double, val rating: Int) { def valueForMoney = this.rating / this.price def isBetterThan(another: Experience) = this.rating > another.rating } Boolean. Mini-Assignment: A Boolean Instance Variable Preparation Recall classes Customer and Order from earlier chapters: import o1.classes._import o1.classes._ val testCustomer = new Customer("T. Tester", 12345, "test@test.fi", "Testitie 1, 00100 Testaamo, Finland")testCustomer: o1.classes.Customer = o1.classes.Customer@a7de1d val exampleOrder = new Order(10001, testCustomer)exampleOrder: o1.classes.Order = o1.classes.Order@18c6974 Task description Some object attributes can be conveniently expressed as Booleans. For example, we might wish to record whether or not express delivery has been requested for an order object. We can represent that information as an instance variable isExpress: exampleOrder.isExpressres12: Boolean = false exampleOrder.isExpress = true Add this instance variable to class Order within the IntroOOP project. The variable’s value should be initially false, but you should be able to adjust the value by assigning a new value to the variable as shown above. Submission form A+ presents the exercise submission form here. Assignment: Odds (Part 6 of 9) We can use the newly introduced Boolean data type to extend Odds, the project we last worked with in Chapter 2.7. (If you didn’t do the Odds assignments then, and don’t want to do them now, you can build on the example solutions. See the submit forms for links.) Task description Write a method isLikely that determines if the event represented by an Odds object is likely or not. We’ll say that an event is likely if the Odds of it occurring are greater than those of it not occurring. For instance, rolling a six on a die isn’t likely, but rolling “anything but a six” is: val rollingSix = new Odds(5, 1)rollingSix: Odds = o1.odds.Odds@d4c0c4 val notRollingSix = new Odds(1, 5)notRollingSix: Odds = o1.odds.Odds@a5e42e rollingSix.isLikelyres13: Boolean = false notRollingSix.isLikelyres14: Boolean = true Also add a method isLikelierThan that determines if one event is more likely than another: rollingSix.isLikelierThan(notRollingSix)res15: Boolean = false notRollingSix.isLikelierThan(rollingSix)res16: Boolean = true rollingSix.isLikelierThan(rollingSix)res17: Boolean = false Instructions and hints - Add the methods to Odds.scala. - You can use the app object OddsTest2to test your methods. This small program has been provided for you but its contents have been “commented out” so that you don’t get error messages about the missing methods isLikelyand isLikelierThanbefore you’ve implemented them. Once you’ve written the two methods in class Odds, uncomment the code in OddsTest2, then run the program. - As with OddsTest, which we used in Chapter 2.7, the plan is for OddsTest2to invoke the methods of class Odds. Don’t copy any methods or variables from Oddsinto the test program. Submission form A+ presents the exercise submission form here. Assignment: FlappyBug (Part 10 of 16: Game Over) While experimenting with FlappyBug, you are sure to have noticed that the obstacle utterly to obstruct the bug. Let’s make the game end as soon as an obstacle touches the bug. Preparation: the isDone method on Views This example program from Chapter 2.8 displays a circle whose size grows with each click by the user.() } You can define an isDone method on a View object. This method determines when the view stops handling clicks, ticks, and other GUI events: object ClickAppThatStops) } override def isDone = clickCounter.value > 10 } gui.start() } isDonereturns a Booleanthat indicates whether the view is “done”, that is, whether the GUI can cease handling future events. In this example, the GUI stops when the counter’s value exceeds ten. Task description Do three things: - In class Obstacle, define a method that checks whether the obstacle is touching a bug. - Use that method to define a method in class Gamethat checks whether the player has collided with an obstacle and therefore lost the game. - In FlappyBugApp, add an isDonemethod that ensures the GUI stops when the game is over. Here are the steps in more detail: In class Obstacle, write an effect-free method touchesthat checks whether or not the obstacle is currently located where a bug is. - It receives a reference to a Bugobject as its only parameter. - It returns a Booleanvalue. - It determines the distance between the obstacle in question ( this) and the given bug. The return value depends on this distance: the method returns trueif and only if the distance is less than the sum of the radiuses of the bug and the obstacle; otherwise, it returns false. - It computes the distance along a straight line between the centers of the bug and the obstacle. You can use the distancemethod from class Pos(Chapter 2.5). In class Game, add an isLostmethod that checks whether the player has lost the game. The game is lost precisely when the obstacle touches the bug: def isLost = this.obstacle.touches(this.bug) Add an isDonemethod to the GUI view in FlappyBugApp. It should return trueif the player has lost and falseotherwise. In practice, the game should stop when the bug collides with an obstacle. - See the isDonemethod of ClickAppThatStops, above, for a template. A single isLostcall will do for a method body. Submission form A+ presents the exercise submission form here. Summary of Key Points - When a program needs to know “yes or no?”, it’s often convenient to use the truth values of Boolean logic: true and false. Many programming languages provide a data type for this purpose. - There are exactly two different values of type Boolean: trueand falseare available as literals in Scala. - Comparison operators yield Boolean values. You can use these operators to compare two values; you might check whether one number is smaller than another, for example. - What makes two objects count as equal depends on the data type. For some objects, equality is determined by comparing object identities, for others, by comparing one or more of the objects’ attributes. - Links to the glossary: truth value, Boolean, comparison operator.. isBetterThanto compare the target object with another experience object. When we call the method, we pass in a reference to the other object.
https://plus.cs.aalto.fi/o1/2018/w03/ch02/
CC-MAIN-2020-24
refinedweb
2,982
57.67